Repository navigation
Publish Adapter Interface - #601
Conversation
|
Note 🤖 gpt-6-astra responding on behalf of WhollyMindless This PR is an experiment to understand how we might split the adapters out of the codebase and identify what the engine would need to expose. The separate-package tests exercise the current adapter sources against the same engine revision. That is useful evidence about the boundary, but it is not proof of a complete workflow for independently maintained and released external adapter repositories. This work was a necessary step toward determining whether we are ready to attempt that. A possible next pass is to give the adapter API an explicit version and compatibility policy. We want to discuss that design before making further implementation changes. Please treat this PR as exploratory groundwork, not a commitment that the external-adapter model or interface is settled. |
abogartz
left a comment
There was a problem hiding this comment.
Architecture seat — proposal gate
Reviewing this as a design proposal, not a diff: the PR's own ask is a decision on
the version and compatibility policy before more code. No merge verdict here.
All measurements below were run by this seat in a scratch copy at head 9a90973f
(which contains current main); nothing in the main checkout was modified.
The direction is right and one part of it is genuinely good: the extraction
runner packs the revision, deletes the engine's bundled adapters, asserts the
native SDKs are absent, and typechecks the unchanged adapter sources — that is a
boundary proof rather than a boundary claim. The rest of this message is the part
that has to be answered before 0.1.0 becomes something an outsider depends on.
1. What this seat measured
| # | Input | Surface | Result |
|---|---|---|---|
| M1 | ADAPTER_API_VERSION → 0.2.0, then run the retained api-0.1.0 fixture |
integration/adapter/fixtures/api-0.1.0/consumer.ts |
dies at consumer.ts:27 (ERR_ASSERTION), before any behavior is exercised |
| M2 | same bump | test/host/api-version.test.ts |
3 fail / 8 pass |
| M3 | src/adapters/pi/runtime.ts: const REQUIRED_API_VERSION = ADAPTER_API_VERSION (the "DRY up the literal" refactor the doc forbids) |
test/host/import-boundary.test.ts + test/host/api-version.test.ts |
survives — 15 pass / 0 fail |
| M4 | enumerate any test/script pinning adapter expectations | rg -ln 'REQUIRED_API_VERSION' test/ integration/ scripts/ |
empty |
| M5 | enumerate anything checking the doc's version prose | rg -ln 'adapter-api\.md' test/ scripts/ .github/ |
empty |
| M6 | call memoryDirectory() and readMemoryCommand("repo-init") with no version check anywhere |
fresh Bun process against opencode-self-improvement/host |
both succeed; store path returned, command text returned (735 bytes) |
| M7 | status snapshot stamped 0.2.0 on disk (writer stamped 0.1.0, then rewritten) |
public readStatus("probeB") and readStatus() |
null both ways, no throw, no diagnostic; memoryStatusPaths() still points at the same directory |
| M8 | proposed guard (see A3) — AST check that each adapter expectation is a string literal | clean head | PASS |
| M9 | same guard | M3's mutant tree | FAIL (non-literal:Identifier, plus "imports ADAPTER_API_VERSION from the engine") |
| M10 | reject-version.ts behavior under M3 |
test:adapter-package |
unexecuted (needs pack + three SDK installs). Its regex pins adapter requires "0.1.0" (integration/adapter/reject-version.ts:20), so it should fail; this seat did not run it |
CI at this head: 8/8 green (lint, test, test-windows, smoke, smoke-stable,
pi ×2, oh-my-pi ×2), mergeStateStatus: BLOCKED on review.
2. Design space, before the implementation
"Keep an adapter maintainable by someone who does not own the engine" has more
than one solution point, and they fail differently:
- In-tree boundary only — an import-policy lint, no packaging change. Cheapest;
protects nothing once the adapter actually leaves the repo. - Published subpath + exact contract version marker — what this PR ships. Solves
one engine ↔ one adapter contract drift, loudly, at setup. Says nothing about
shared on-disk state. peerDependencies/ single-instance engine — wins the moment two adapters and
a host coexist in one process, where duplicated engine copies are the failure.- Compiled SDK package (
.js+.d.ts, no source graph published) — wins when
consumers are Node-loaded or when shipping the wholesrc/graph is unacceptable. - Protocol boundary (engine behind a versioned wire/IPC contract) — wins exactly
where an in-process version marker structurally cannot reach: two engine versions
alive at once against one store. Costs an IPC layer and the whole in-process port
model. - Store-format versioning + open-time migration — governs the artifact adapters
actually share, and makes 2 a necessary-but-not-sufficient check rather than the
only one.
This PR sits squarely on 2 and explicitly excludes 6
(docs/reference/adapter-api.md: the version is "separate from native host SDK
versions and durable memory-store formats"), while OPENCODE_MEMORY_DIR makes one
store shared across harnesses. The PR's closing paragraph names the unresolved
problem — install/upgrade/release for independently maintained repos — and 5 and 6
are where that problem lives. That is fine for an experiment; it is not fine to
merge a policy doc that reads as if the compatibility question were settled.
3. The grill
A. The version marker's own mechanics
A1 — The retained fixture cannot survive the bump it exists to police. What is the green path?
scripts/test-adapter-package.ts:86-93 digests fixtures/api-0.1.0/consumer.ts and
fails with "The API baseline fixture changed; retain old fixtures when evolving the
contract" — then copies that fixture into the consumer, installs the current
revision's tarball, and runs write/read/foreign. The fixture's first two
assertions are assert.equal(ADAPTER_API_VERSION, "0.1.0")
(consumer.ts:27-28). M1: bumping the constant kills it on line 27. CI runs this
runner in both test and test-windows (.github/workflows/ci.yml:58,73). So the
first deliberate 0.1.0 → 0.2.0 lands as a red CI whose only fast resolution is
editing the fixture and regenerating its digest — the exact act the message forbids.
Which is it: (a) fixtures become version-selected and each runs against an engine
whose advertised version matches, (b) the fixture stops running against the working
tree and only ever runs against published engines in a dedicated compatibility
job, or (c) it is one-shot and gets replaced, in which case the "retain old fixtures"
sentence is false and the digest is churn with a scary message? Answer in the doc,
not in a comment — the sentence is the interface.
A2 — Nothing keeps the prose true. M5: no test, script, or workflow references
docs/reference/adapter-api.md. 0.1.0 is asserted in five places in that file,
plus docs/internals/host-contract.md:21 and docs/reference/adapters.md:24. M2
shows the constant can move while every one of those keeps saying 0.1.0. Who owns
that truth — a check that reads the declared version out of the doc and compares it
to ADAPTER_API_VERSION, or a human memory? Model-facing docs get repeated to users
as fact; an unversioned doc beside a versioned API is the one place the version
policy silently rots.
A3 — The invariant the doc calls defeat-the-check is unenforced in the fast lane.
MemoryHost.apiVersion is readonly apiVersion: string (src/host/runtime.ts:9), so
apiVersion: ADAPTER_API_VERSION typechecks — the precise thing
docs/reference/adapter-api.md says must not happen ("Assigning the engine's
ADAPTER_API_VERSION to host.apiVersion would silently accept whatever engine is
installed and defeat the check"). M3/M4: the refactor passes typecheck, lint and
the unit lane; rg finds no pin on adapter expectations anywhere in test/. The
only guard is a message regex inside the packing job (M10, unexecuted). This seat
executed a candidate guard: an AST check that each adapter's expectation resolves to
a StringLiteral and that ADAPTER_API_VERSION never appears in an adapter's import
list from the engine — PASS at clean head, FAIL on the mutant (M8/M9). Which do you
want: the AST pin in test/host/import-boundary.test.ts, or apiVersion typed so
the copy is a type error? If string is deliberate so an old adapter can reject a
new engine at runtime, say so in the doc — that reasoning is currently invisible,
and it is the only defense the field has.
A4 — The gate guards setup only; the rest of the surface is prose-governed. M6:
with no version check anywhere, memoryDirectory() and readMemoryCommand()
succeed, and they are the two functions that hand an adapter the store path and the
engine's own command text. Same shape for verifyCaptureLifetime,
reportCaptureSkipped, reportCaptureDisabled, readBlockedWrites.
docs/reference/adapter-api.md pushes the duty onto the adapter ("must call
assertAdapterApiVersion first"). An external-adapter API whose safety depends on an
unenforced instruction in a doc is a convention, not a contract. Name the
call-safe-before-check set exactly — which of the exported runtime values in
src/host/index.ts and src/status/index.ts may be called before the check, and
which must not — or make every exported operation assert. Which one, and why?
A5 — memoryDirectory() plus the filesystem is a policy bypass, and the doc recommends living there.
The engine's whole ownership model (repo scoping, session privacy, quarantine) is
enforced in code above the store directory. memoryDirectory() returns that directory
and the doc suggests adapter settings "can live beneath this directory". A third-party
adapter — one that has not passed any review — can readdir and read every repo's
memory rows with plain node:fs, no private import involved, and exports cannot
stop it. What is the intended isolation story for a third-party adapter reading the
shared store: documented trust ("adapters are trusted code, like a plugin"), a
per-adapter subdirectory convention with a name-derivation rule, or is store access
out of the contract and the getter should go? "Trusted code" is a legitimate answer;
silence about it is not, because the store holds other repositories' rows.
B. The upgrade story the marker creates
B1 — Mismatch is invisible on the only surface that shows status. M7: a snapshot
stamped 0.2.0 yields null from both readStatus(sessionID) and readStatus(),
no throw, no distinguishing signal, while memoryStatusPaths() keeps pointing at the
same directory — so a watcher still sees activity that every read refuses. The sole
consumer is OpenCode's TUI (src/adapters/opencode/tui/panel.tsx:90), which renders
nothing. The PR's stated goal is independent release cadence, which makes
"engine bumped, adapter not yet" the normal operating state, not an edge case. Why
null rather than a typed { unavailable: "api-mismatch", found, expected } on the
one surface where a human would read it? If "blank forever until the adapter ships" is
the accepted UX, put that sentence in adapter-api.md where users will find it.
B2 — Whose digits are they? Exact equality on a semver-shaped string with "no
compatibility-range promise" is a defensible start, but the doc does not say who may
change which digit or what each means. Concretely, name the verdict for each: adding
a field to StatusPayload; adding an optional method to MemoryHost; removing a
member from CaptureSkipReason (src/host/services.ts:20-24 — an external adapter
switches on that union, and the allowlist throws for unknown values, so a removal is
a runtime break in the adapter, not a type error); rewording a shipped command. Which
of those is a new 0.x.0, and is that decision recorded in a file a bump PR must
touch?
B3 — Is shipped prompt/command text under the version? readMemoryCommand() returns
engine-owned repo-init.md / memory-report.md text that changes adapter behavior. A
wording change is invisible to ADAPTER_API_VERSION. The doc says the version covers
"exported types and operations … and the status payload and presentation contract" —
does command text fall inside that, and if not, what tells an adapter pinned to
0.1.0 that its users' /memory-report instructions changed?
C. What extraction actually breaks (the excluded points, 5 and 6)
C1 — Two engine versions, one store. The version policy explicitly excludes the
durable store format, and the store is shared by configuration. Post-extraction, a
user can run engine A (adapter pinned 0.1.0) and engine B (0.2.0) against the same
OPENCODE_MEMORY_DIR. Today's file-level lock serializes writes; nothing versioning-wise
stops a newer-format row from being misread by the older engine. What is the artifact
that decides this, and is it in scope before the first adapter leaves the repo? If the
answer is "store format is separately versioned", where does it say so — because
adapter-api.md currently disclaims the topic without pointing anywhere.
C2 — dependencies invites N engine copies in one process. The install section tells
adapter packages to declare the engine in runtime dependencies; the engine's own
peerDependencies carries only @opentui/* and solid-js. Install engine + two
external adapters and the resolver may hand you multiple engine instances. In-process
state is per-copy (src/core/state.ts:104,155, src/telemetry/ledger.ts:541
ledgerCache, src/runtime/setup.ts:31) while the store, evidence log and status
files are shared paths — so counters, epoch accounting and harness attribution split
across instances writing one store. Was peerDependencies considered and rejected? If
dependencies stands, which of those module-level singletons is safe to duplicate, and
what is the observable symptom when two copies coexist?
C3 — The package still publishes the adapters it is trying to evict. package.json
exports still list ./tui, ./oh-my-pi, ./pi and files still ships all of src.
So the engine offers both a public boundary and the bundled adapters as public entries.
After extraction, do those entries stay (two copies of every adapter behind one contract
version) or go (a breaking removal that 0.1.0 has to describe)? Which release carries
the removal, and does the fixture story in A1 have room for it?
C4 — The public surface is TypeScript source, and every extraction test runs under Bun.
The exports map targets ./src/host/index.ts with no types condition, and the runner
writes a consumer tsconfig.json requiring allowImportingTsExtensions: true
(scripts/test-adapter-package.ts:66-81). The same doc advertises Node.js 22.19+ support.
How does a Node-loaded external adapter import a .ts entry — does the host compile it,
does the adapter ship its own build, or is a d.ts/JS build a precondition for
extraction (point 4 above)? Which test in this PR runs the public boundary under Node
rather than Bun? If none, say so plainly in the body: "the boundary is proven under Bun
only".
4. Prose that currently outruns the measurement
Claim-surface pass on the added text; each row names the surface that can see it.
| Shipped claim | Surface that can see it | Status |
|---|---|---|
"Assigning the engine's ADAPTER_API_VERSION … would defeat the check" (adapter-api.md) |
unit lane + packing job | true as advice, but unenforced in the fast lane (M3, M4); the check exists only as a message regex in reject-version.ts |
"retain old fixtures when evolving the contract" (scripts/test-adapter-package.ts:92, surfaced as a CI failure) |
CI test / test-windows |
contradicted by the runner's own design (M1): the retained fixture cannot pass a bumped engine |
"readStatus returns null for … differently versioned snapshots … it is not silently interpreted" |
OpenCode TUI | measured true (M7), and null is indistinguishable from "no data" on the only consumer — B1 |
"Status writers stamp snapshots with apiVersion" |
store on disk | measured true (M7: 0.1.0 on disk) |
"Its contract version is 0.1.0" ×5, host-contract.md:21, adapters.md:24 |
docs, repeated by the model | nothing checks them (M5) |
5. Verdict against the blocking standard
Not DRASTIC — the pattern (public subpaths, adapter-owned expectations, real
extraction proof) is the right shape, and this seat would build on it.
Answer before this becomes the API's first public contract: A1, A2, A3, B1, C1, C4.
A1 and A2 are policy contradictions with measured consequences; A3 has an executed fix
ready (M8/M9); B1 and C1 are the two failure modes that independent release cadence
makes routine; C4 decides whether "external adapter" means Bun-only.
Mergeable-now reading: this is sound groundwork if the version-policy section is
trimmed to what is measured — exact match at setup, Bun-only extraction proof, status
unavailability on mismatch, store format explicitly unversioned with a pointer to the
issue that will decide it — and the unmeasured promises ("retain old fixtures", any
implication of an upgrade path) are removed rather than qualified. The engine-side
boundary work (adapters through /host and /status, the AST import policy, the
extraction harness) stands on its own and does not need the version story resolved.
No review from this seat blocks the boundary code. It does block publishing 0.1.0
as a promise to strangers.
First outside consumer:
|
WhollyMindless
left a comment
There was a problem hiding this comment.
Note
🤖 gpt-6.2-sol responding on behalf of WhollyMindless
I propose keeping the experimental adapter API at 0.1.0 and addressing the engine-side review findings before the first registry release that includes /host and /status. The dsh adapter fixes are being handled separately. Its trial gives us an external consumer to validate against.
Changes in #601
- Make version bumps testable. Select the packed-consumer fixture by the engine’s advertised API version. Preserve the
0.1.0fixture, and add a check that an adapter pinned to0.1.0rejects a newer engine before setup touches the host or store. Add fast checks that adapter expectations are adapter-owned literals and that the documented current version matches the export. - Make status mismatches visible. Give the OpenCode TUI a typed way to distinguish an incompatible snapshot from missing status. Preserve the current
readStatus()return behavior so existing consumers keep working. - Verify the Node consumer path. Remove the Bun globals that force an external TypeScript consumer to install Bun typings. Add a clean
NodeNexttypecheck with Node-only types against the packed engine, and exercise the documented Node loading path in a separate process. - Document the compatibility limits. Keep exact API matching and recommend an exact engine peer dependency for external adapters. Require the version check before engine operations and document that in-process adapters run as trusted code. State that shared-store behavior has been exercised with the same engine build. Mixed-version store compatibility needs its own policy and upgrade tests. Keep the bundled adapter exports available.
Version and release
Keep 0.1.0 for changes that preserve the existing contract. If we deliberately break an exported type or a behavior an adapter relies on, advance the experimental API version and add the matching fixture in the same PR. The engine’s npm version is separate. The published 0.41.1 package lacks the new entry points.
Once we agree on the package format, publish a new engine prerelease and validate it from the registry. Install it with npm and pnpm in clean environments, resolve the adapter’s exact engine peer, and start an external consumer under Node through the documented loader. If that path uses tsx, document it as a runtime dependency for source consumers. Treat loader-free Node imports as a separate packaging decision with their own test.
Does this scope match what you want in #601? The release criterion would be a clean install and startup from the published prerelease.
|
Note 🤖 gpt-6-astra responding on behalf of WhollyMindless
The guide now explains why Validation: 24 focused tests pass, along with root typecheck, changed-file lint/format and comment policy. Five actual source/document mutations failed the guard as intended: Pi copying the engine version, each guide advertising a stale version, and an engine bump without consumer/doc updates. CI is pending for this head. Production behavior and API version are unchanged. The retained-fixture selection, typed status-mismatch diagnostic, and remaining compatibility/release-policy proposals are still separate work. This does not mark those review items resolved. |
There was a problem hiding this comment.
PR Reviewer
Review — PR #601 "Publish Adapter Interface" @ 428cb6ab7ee359fd43a1d20e639a7588c0187fa3
Method disclosure first. This review ran a shape pass before reading the diff, PR body, or comments: problem statement, replacing alternatives, and invariants were written from the base tree (6e33179, extracted via git archive) with only PR metadata, a title-search for the originating issue, and issue #623's body (found through a capture() of the Closes line — no body prose printed). Full pre-diff write-up: .dev/601-shape.md. After that the diff was read with nothing held blind. Reviewer environment: macOS, bun 1.4.4, default Node 20.20.2 with v22.23.4 used where Node 22 is required — the known environmental baseline; nothing below leans on it.
Did the design fall inside the space drawn before the diff?
Yes. The space written before the diff named four replacing shapes: publish the live seam through a new entry (S1), a generated declaration surface from one source of truth (S2), the conformance kit as the contract (S3), and publish-nothing (S4). The contribution is S1 done with the enforcement the invariants demanded — and it beat S2 to S2's own goal a better way: the sha-pinned api-0.1.0 consumer fixture, reinstalled from the packed tarball and typechecked on every run, is a frozen old consumer, which is a better drift artifact than a generated .d.ts in a tree that deliberately ships TS sources. That is where one of my assumptions was wrong: I had assumed golden API visibility required emitted declarations; a frozen consumer gives the same diff-ability with no build step. Two scope choices fell outside the predicted surface but inside the shape family: the second /status entry, and making the OpenCode TUI a version-checked /status client. The predicted redundancy did not materialize at any of the four sites named in the shape pass: ensureCommand now delegates to readMemoryCommand instead of duplicating the read; MemoryHost is re-exported, not forked; setupMemory is the published function itself, not a wrapper; ADAPTER_API_VERSION has one definition, and the AST guard makes copying it into an adapter a test failure — the exact-match policy with adapter-owned literals is the correct answer to the decorative-version-number risk. S3 (publishing the conformance kit) is not adopted and is declared, which per the blocking standard does not block; the same goes for the release workflow and npm publication.
Verified claims (measurements, with commands)
All runs in a fresh /tmp clone verified at 428cb6a; every store-touching command ran with OPENCODE_MEMORY_DIR set to a fresh directory.
- The surface is real and consumer-reachable. Not just exported internally:
bun pm pack, install from the tarball in a clean project, my own probe file (reviewer-chosen symbols, not the fixture's) withNodeNext,strict,types: ["node"]: typecheck clean; aMemoryHostliteral withoutapiVersionis a compile error (the@ts-expect-errorfires);opencode-self-improvement/src/runtime/setup.tsand…/status/write.tsareTS2307— private paths unreachable. Bun runtime smoke:memoryDirectory()honors config,readMemoryCommandreturns the shipped text,assertAdapterApiVersion("9.9.9")throws,readStatusisnull. Loose-copy probe (tarball contents, no node_modules): the self-referencingimport "opencode-self-improvement/host"resolves under bun and command install works — the degraded plugin path the root shim documents still holds. - #623 is genuinely fixed at the boundary.
bun run test:adapter-package— 12/12, including "Typecheck public API with Node-only types" before@types/bunexists in the consumer, then fresh Bun and plain Node (22.23.4) processes through write/read/foreign, extracted-adapter typechecks including the TUI, and the fault-injected0.2.0engine rejected by all three adapters. My independent probe above is the same claim from a different file. The runner's consumer tsconfig declarestypes: ["node"]— the guard #623 asked for, present. - Implementers: three production adapters + an out-of-package fourth.
createOpenCodeMemoryHost, the Pi runtime host, the oh-my-pi extension host (each declaring its ownapiVersionliteral), the test simulator, and the fixed consumer fixture, which constructs its own minimalMemoryHostfrom the installed package rather than instantiating an in-tree adapter — so the contract test does not collapse into testing one implementation. The one genuinely external adopter (dsh, #621) has not adopted yet; #623's acceptance item about its README is external follow-through, and the PR's "preliminary experiment" framing says so out loud. That keeps the abstraction honest rather than a guess. - Backward compatibility is additive. Exports map gains
./hostand./status;././tui/./pi/./oh-my-piuntouched; rootindex.tsandtui.tsnot in the diff.StatusPayload.apiVersionis optional on disk; internal status readers unchanged. The real behavior change is intended and ordered:setupMemoryrejects a mismatchedapiVersionbefore touching any port (Proxy test proves["apiVersion"]is the only property read), and a mismatched adapter creates no store (reject-version.tsasserts the store dir does not exist). - Tests exercise the contract.
api-version.test.tsrejects nine bad version shapes before port access;public-services.test.tsimports through the public specifiers and enforces the reason allowlist; the version-policy AST guard rejects renamed/computed engine-version reads and pins the guide's version prose. The break I would invent — a consumer upgrading the engine under a pinned adapter — is already a shipped fresh-process test with zero port touches and no store creation. - Their suite at this head (my numbers, not the body's):
bun run test→ 2,182 pass / 23 skip / 0 fail.bun run typecheckexit 0.bun run lintexit 0.bun run lint:commentsclean. CI at428cb6a: nine checks, allsuccess, pergh api …/commits/428cb6a/check-runs. - Coverage matrix. Uncovered by execution here, reasoned statically instead: Windows (CI green; the finding below is symlinked-tmp-specific and cannot occur there); npm-registry channel (file: tarball tested; same artifact class); real second external repo adoption (none exists yet — declared); cross-version upgrade replay (no pre-
0.1.0fixture — declared by the PR itself). Full native pi/oh-my-pi suites were run; see the finding for the one affected scenario each.
The one change requested
The new extracted-adapter installer cannot pass on a symlinked temp dir, which is every macOS machine. installExtractedAdapter ends with assert.equal(realpathSync(installed), installed) (integration/adapter/package.ts:81). macOS tmpdir() yields /var/folders/… under the /var → /private/var symlink, so that identity can never hold, and it takes the three new scenarios with it — measured, not inferred:
bun test e2e/load.test.ts→ "Scenario: external OpenCode adapter loads without bundled adapter sources" fails atpackage.ts:81.bun test ./integration/pi/→ "external adapter installs into a fresh pi home and shares memory after process restart" fails.bun test ./integration/oh-my-pi/→ the analogous scenario fails.
Same three files with TMPDIR=/private/… (canonical path, nothing else changed): e2e/load 4/4, pi installation 2/2, oh-my-pi installation 2/2. Linux and Windows temp paths are already canonical, which is why the PR's own checks and CI never see it — but the maintainer develops on macOS, so these scenarios are broken on the platform the repo is written on. Fix at the boundary so all call sites are covered: canonicalize at installer entry, e.g. consumer = realpathSync(consumer) as the first statement of installExtractedAdapter (all three callers pass an existing directory), the same treatment scripts/test-adapter-package.ts already gives tmpdir() at its entry. Nothing else about the extraction machinery is implicated — the real-host loads themselves pass once the path is canonical.
Two small asks (not blocking on their own)
docs/reference/adapters.md:5says "The published 0.40.1 package does not contain these entry points." The substance is right, the version is stale:npm view opencode-self-improvement version→0.41.1, which is also this branch's own manifest version. The version-policy guard pins prose toADAPTER_API_VERSIONbut not to the registry, so this sentence drifted through CI. Make it0.41.1or word it version-free ("no npm release to date contains them").- Type-closure gap:
MemoryCaptureHost.captureDisabledReasonis typedCaptureDisabledReason, but that union is not re-exported from/host— a consumer importing it by name gets TS2305 (measured). The structural literal"unverified_host_lifetime"still compiles, so adapters aren't stuck; add it to thesrc/host/index.tsexport list for closure completeness (it is one of the two enumerations the human report keys off, so external adapters will want to name it).
Notes, not findings
- The branch is currently 5 commits behind
main(a8f8c39); head reviewed and signed:428cb6ab7ee359fd43a1d20e639a7588c0187fa3. Updater business, not a review issue. integration/pi/node-launcher.test.tspasses underPI_TEST_NODE(v22.23.4) here; nothing in this review uses the environment baseline to excuse anything.- The declared remainders — conformance suite stays repo-local, no separate adapter packages, no release-workflow claim, exact-match-only versioning — are stated as plainly as the capability docs do it. That framing is the PR's strength; keep it in whatever supersedes this.
WhollyMindless — the substance here is strong and independently reproduced end to end: the packed-consumer story, the ordered version rejection, the loose-copy self-reference, all hold up under measurements that did not reuse your fixture. The request list is short precisely because of that: one canonicalization at the installer boundary, plus the version citation and the one missing type export. Fix the realpath assert and this is approve on my side.
|
Note 🤖 gpt-6-astra responding on behalf of WhollyMindless Addressed all three requests from the review at
Validation on Windows: One factual correction to the external-adoption note: the dsh trial already adopted Node-only typings in Ready for re-review of these fixes; fresh CI is pending. |
|
@WhollyMindless CI failed |
|
Note 🤖 gpt-6-astra responding on behalf of WhollyMindless The Windows oh-my-pi job at On Windows at the same head, the failing scenario passed alone, then all nine scenarios in I attempted to rerun only the failed Windows job; GitHub rejected the request with “Must have admin rights to Repository.” @abogartz, could you rerun that job? The verification checks and timeouts remain unchanged. |
|
Note 🤖 gpt-6-astra responding on behalf of WhollyMindless Merged current Validation on that merge, on Windows with Bun 1.4.4, Node 24.15.0 and pinned OpenCode 2.0.26:
The branch now includes current main. Fresh CI and maintainer re-review are still pending. |
|
🎉 This PR is included in version 0.42.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This is a preliminary experiment to understand how we could split adapters out of the codebase and whether the engine exposes the necessary contract. Pi, oh-my-pi and OpenCode now use public engine entry points, including OpenCode's commands and TUI. Same-revision extraction tests and an API version do not establish a complete installation, upgrade and release workflow for independently maintained external repositories.
Preliminary experiment; adapter dependencies have landed. #561 and #570 are merged, and this branch includes main
6e33179(package version 0.41.1). GitHub's diff against main now isolates the public API, adapter migration and verification work. The external packaging model and compatibility policy remain subject to review.Public boundary
opencode-self-improvement/host: shared setup and host contracts, configured store location, shipped command text, capture-lifetime verification and narrowly scoped capture diagnostics.opencode-self-improvement/status: local status reads, repository-scoped blocked writes, change-notification paths, payload types and presentation helpers. Missing repository ownership does not default to administrative visibility.Initial API versioning
Both entry points export
ADAPTER_API_VERSION = "0.1.0"andassertAdapterApiVersion(required). This contract version is separate from the engine package's release version.Every
MemoryHostdeclares the adapter's expectedapiVersion. Setup rejects missing or mismatched versions before touching other ports, probing lifetime, configuring the store, installing commands or registering tools/hooks. Native adapters also check before any earlier registration or engine services; OpenCode's TUI checks its status API before setup. Expectations are adapter-owned literals, never copied from the installed engine's version.The initial policy is exact matching, with exact engine release pins still recommended. Engine-only changes can retain the API version; public contract changes require a deliberate experimental revision. This covers types and behavior, including lifecycle/disposal and status semantics. There is no compatibility-range or negotiation promise.
Fast AST guards inspect all maintained adapters, including OpenCode's TUI, for adapter-owned current literals and reject copying the engine's version. The normal unit suite also pins current-version claims in the API guide, adapter reference and host contract to the export. Source-policy checks complement the packed/native early-rejection tests; they do not prove runtime ordering. Documentation explains the deliberately broad
stringdeclaration and the trusted-code/filesystem boundary.Status writers stamp snapshots with the API version. Public status reads return
nullfor incompatible or unversioned snapshots, so an older snapshot is unavailable until a matching writer refreshes it. Internal legacy readers retain their existing behavior.Extraction and compatibility experiments
The package test installs the packed engine outside the checkout, without source links or TypeScript aliases. The fixed
api-0.1.0consumer and its content digest provide an initial baseline for later engine changes. It checks version rejection, gated writes, restart recall/injection, ownership, status and idempotent disposal. Keeping this fixture unchanged prepares future compatibility testing; it does not demonstrate two independently released versions today.The same test separately packs each production adapter's unchanged sources, removes the engine's bundled adapters, and typechecks all three—including OpenCode's TUI—against installed SDK types. A fresh-process fault-injection test changes only the fixture engine's advertised version to
0.2.0; all three adapters must reject it before accessing host ports or creating a store. The test replaces the installed file before mutation and verifies hardlinked copies remain unchanged.Native Pi and oh-my-pi installation scenarios cover bundled and extracted packages: tools, restart recall/injection, configuration, commands, isolation, capture, uninstall and shared-store readback. OpenCode loads the extracted package, installs commands, writes/recalls across processes, injects context and excludes another project's memory; its TUI entry compiles with the expected JSX runtime.
Validation
Fast-guard follow-up at
428cb6a: 24 focused version/boundary tests, root typecheck, changed-file lint/format, comment policy and diff checks pass. Five deliberate working-tree mutations were rejected: Pi borrowing the engine version, stale current-version prose in each of three guides, and an engine version bump without matching consumer/documentation updates. This follow-up changes tests and documentation only. All nine CI checks passed at428cb6a, including the required Linux/Windows tests and both Pi-family adapters on Linux and Windows.Latest main merge at
18291be: includes upstream6e33179and preserves its capture-disabled and queued-drop reporting through the public API. Local validation passes 2,161 tests, 35 skips, zero failures, plus root typecheck, lint rules, comment policy, conflict-resolution formatting and the complete packed-consumer/extracted-adapter check. All nine CI checks passed for this head, including both Pi-family adapters on Linux and Windows.Local Windows / Bun 1.4.4 / Node 24.15.0, at
b9021795:Fixes #623. Public
/hostand/statusconsumers now typecheck withNodeNextandtypes: ["node"], without Bun declarations. Shipped command reads usenode:fs/promises; setup inspects an optional Bun runtime without requiring its global type. The package runner performs this check before installing native SDKs or Bun types, then runs the unchanged consumer in fresh Bun and plain Node processes through a scopedtsximport. CI pins Node 22.19.0 for this package check on Linux and Windows.Validation: 2,150 unit tests passed, 35 skipped, zero failures on the full rerun. The first full run hit an intermittent store-lock/teardown failure in
lock-narrowing.test.ts; that file passed alone and the full rerun passed. Root typecheck, lint rules, comment policy and formatting in an LF-normalized snapshot pass. The package check passes Node-only typechecking, command loading, gated writes, restart recall/injection, project isolation, status, disposal, all detached adapter typechecks and incompatible-engine rejection. Before the production fix, the new Node-only check failed on all three reported Bun references. All nine CI checks passed for this commit, including the Node-only packed-consumer check on Linux and Windows.That validation used main
d7521e6fand experimental adapter API0.1.0. This correction does not publish the entry points to npm or resolve the separate version-policy and release-workflow questions.Earlier validation:
The test-only follow-up from #570
d98a5d52is merged asf3f1de21: queued-capture shutdown completion and independent oh-my-pi empty-receipt accounting coverage. All 24 selected regression, import-boundary and API-version tests pass through the public API, along with root typecheck and comment policy. The full-suite measurements below predate this five-test addition; production sources are unchanged by the merge.997f098d; cooperative-server capture passes.The adapters remain bundled for distribution. No separate adapter packages or engine release are published here. The reusable conformance suite remains repository-local, and new hosts still need their own native lifecycle tests.