Repository navigation
fix(cli): reconcile W9 against the merged sdk store surface - #74
Merged
Merged
Conversation
W8 landed with the canonical store API; the cli was pinned against the
pre-merge sketch. Reconciles to the sdk as shipped:
- api.ts is now a type-only re-export hub of the sdk surface + the
cli-local bridge constants (drift-proof by construction)
- ports/fs.ts: byte-oriented ops, .code-carrying errors (ENOENT→not-found
etc.), stat→null on missing, createExclusive via O_EXCL, readlink +
ln-backed symlink
- ports/exec.ts: run(command, args, opts) → {code,stdout,stderr} over
execFile only
- root.ts resolves the AGENTS ROOT (~/.agents), not the harness dir —
the sdk owns harness/ beneath it
- createStore gets {actor, approveExec}; TTY sessions answer approveExec
via a y/N prompt per exec class
- add maps --skill-target to installTarget + --update; list forwards
kinds/enabledOnly; audit reads store.auditLog(); serve reads
harness/config.toml under the store root
- toCliError forwards StoreError.kind + data instead of flattening
every store failure to "internal"
- testing layer rewritten to the canonical shapes (memory FsPort,
full-surface mock Store); all test fixtures updated
- sdk: drop the declare-global block (collides with @types/node at
TS2300), take TextEncoder/URL et al. from lib DOM instead; tsdown
alwaysBundle sdk so dist/cli.js runs standalone for scriptc
Verified end-to-end: add/list/verify/disable/enable/audit/doctor/remove
on a fresh store + stdio bridge handshake with capability-gated
extensions.list.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
W8 (sdk) and W9 (cli) were implemented in parallel against the pre-merge API sketch; when #73 landed with the canonical store surface, the cli drifted. This PR reconciles the cli to the sdk as shipped, so
harnessworks end-to-end on mergedv2— the first PR where the whole stack is real (no stubs anywhere in the path).Closes the wave-2 reconciliation item in
.agents/plans/2026-10-07-v2-foundation.md.Changes
api.ts→ type-only re-export hub of the sdk surface (Store, ports, wire types) + cli-local bridge constants. Re-exports are erased at build → drift is impossible by construction.ports/fs.tsrewritten to sdk'sFsPort: byte-orientedreadFile/writeFile/appendFile,.code-carrying errors (ENOENT→not-found, EEXIST→exists, …),stat→nullon missing,createExclusiveviaO_EXCL,readlink+ln-backedsymlink(island rule).ports/exec.tsrewritten torun(command, args, opts) → {code, stdout, stderr}overexecFileonly (no shell).root.ts: resolves the agents root (~/.agents), not the harness dir — the sdk ownsharness/beneath it. (Was causing doubledharness/harness/paths at runtime.)cli.ts:createStore(root, ports, { actor, approveExec })— TTY sessions get a y/N prompt per exec class.addmaps--skill-target→installTarget+ adds--update;listforwardskinds/enabledOnly;auditreadsstore.auditLog();servereadsharness/config.tomlunder the store root.errors.ts:toCliErrorforwardsStoreError.kind/datastructurally — atrust-violationormanifest-invalid(with issues) now surfaces as such instead ofinternal.FsPort(bytes, dirents,createExclusive) + a full-surface mockStore(list/get/install/remove/setEnabled/materialize/verify/doctor/policy/auditLog/subscribe/readLock).declare globalblock inports.ts(collides with@types/nodeat TS2300 in consumers); globals now come fromlib: ["DOM","DOM.Iterable"]intsconfig.tsdown.config.ts:deps.alwaysBundle: ["@any-harness/sdk"]—dist/cli.jsmust run standalone for scriptc packaging;neverBundledoesn't override dependency auto-externalization.Test plan
pnpm -r test— 121/121 pass (spec 1, metaharness 4, sdk 59, cli 57)pnpm -r typecheckcleanadd local:→list→verify→disable/enable→audit→doctor→removeon a freshANYHARNESS_HOMEserveover stdio:capabilities.negotiatehandshake → session → capability-gatedextensions.list; error envelopes verified (-32602/-32001/-32002/-32601)Notes
kindssee an emptyextensions.list— that's spec-correct (capability gating), worth knowing for claurst's client PoC.docs/site) — environmental, same as feat(spec): bridge protocol v0.1 — ops, capabilities, transports, security #68–feat(sdk): store + sources + lockfile + trust + bridge ops #73.Link to Devin session: https://app.devin.ai/sessions/b930ce55fa0b489c98bc27f0b9a3927c
Open in Devin Desktop: https://app.devin.ai/desktop/session/b930ce55fa0b489c98bc27f0b9a3927c?variant=devin
Requested by: @espetro