Documentation
¶
Overview ¶
Package opencode reads the project-scoped OpenCode V2 model catalog. It also releases verified disposable checkout locations.
Index ¶
- Constants
- func ReleaseLocation(ctx context.Context, runner execx.Runner, primary, target string) error
- func SessionDirectory(ctx context.Context, runner execx.Runner, cwd, sessionID string) (string, error)
- type Catalog
- type LoadedSkill
- type Model
- type ReleaseCheck
- type Runtime
- func (runtime Runtime) CheckPlugin(ctx context.Context, runner execx.Runner, directory, id string) error
- func (runtime Runtime) ReadCatalog(ctx context.Context, runner execx.Runner, directory string) (Catalog, error)
- func (runtime Runtime) ReadSkillCatalog(ctx context.Context, runner execx.Runner, directory string) (SkillCatalog, error)
- type SelectionCheck
- type SkillCatalog
Constants ¶
const ( Executable = "opencode2" RuntimeVersionPrefix = Executable + " v0.0.0-beta-" MinimumBetaBuild = 18314 MinimumVersion = RuntimeVersionPrefix + "18314" StableFloor = "2.0.0" VerifiedStable = "2.2.6" )
Variables ¶
This section is empty.
Functions ¶
func ReleaseLocation ¶ added in v0.17.0
ReleaseLocation retains the single-checkout handoff for review replacement.
func SessionDirectory ¶ added in v0.17.0
func SessionDirectory(ctx context.Context, runner execx.Runner, cwd, sessionID string) (string, error)
SessionDirectory observes the invoking local OpenCode service's session location. sessionID is only a lookup key. Never start/discover a replacement service, query a caller-selected endpoint, request a directory, or use an outer response location (which can just reflect the server's defaults).
Types ¶
type LoadedSkill ¶ added in v0.10.0
LoadedSkill is the safe subset of one live OpenCode skill. Its source location is deliberately not retained: compatibility depends on content, not where OpenCode loaded it from.
type Model ¶
Model is the safe subset of an available OpenCode model. Provider settings, headers, credentials, account identifiers, and request bodies are never retained.
type ReleaseCheck ¶ added in v0.17.1
ReleaseCheck rechecks observable activity before Git mutation after release. If removed is nonempty, the caller has already verified deletion of that checkout. Only remaining targets need delete access and cwd attribution. Bound merged cleanup also requests the non-loading global job probe.
func ReleaseLocations ¶ added in v0.17.0
func ReleaseLocations(ctx context.Context, runner execx.Runner, primary string, verify func(context.Context) error, checkJobs bool, targets ...string) (ReleaseCheck, error)
ReleaseLocations is called only after the run engine verifies disposable checkout ownership and removal prerequisites. These bounded observations are NOT atomic exclusion of host re-entry. No idle/completion hook calls this. All commands use the existing authenticated V2 CLI discovery, never a relay, service restart, session deletion or process termination. On Windows the runner must support concurrent persistent-terminal reads. Before #525 sequential handoffs could reload an earlier target through later session/terminal probes. Now probes that could load a target precede eviction. Bound cleanup supplies verify to recheck engine ownership before disposal and to keep retry advice on the bound path. Cleanup can use the returned check at later Git boundaries, under the same deadline. checkJobs also needs a late check on a ref-only retry, where there is no checkout to release or scan. Review replacement needs only this release.
type Runtime ¶ added in v0.16.0
Runtime binds all API reads/release calls to the V2 command whose version was checked. On Windows Local resolves a verified absolute native path first.
func Resolve ¶ added in v0.16.0
Resolve prefers opencode2, but also supports V2 installed as opencode. Raw process output is never included in errors because it may contain credentials.
func (Runtime) CheckPlugin ¶ added in v0.16.0
func (runtime Runtime) CheckPlugin(ctx context.Context, runner execx.Runner, directory, id string) error
CheckPlugin requires a live server component in the intended project scope.
func (Runtime) ReadCatalog ¶ added in v0.16.0
func (Runtime) ReadSkillCatalog ¶ added in v0.16.0
type SelectionCheck ¶
SelectionCheck reports whether one configured OpenCode role is present in the project-scoped live catalog.
func CheckSelections ¶
func CheckSelections(roles config.Roles, catalog Catalog) []SelectionCheck
CheckSelections checks all six configured roles in configuration order. It never includes other catalog entries in diagnostics.
type SkillCatalog ¶ added in v0.10.0
type SkillCatalog struct {
Skills []LoadedSkill
}
SkillCatalog is OpenCode's winning live skill set for one repository.
func ReadSkillCatalog ¶ added in v0.10.0
func ReadSkillCatalog(ctx context.Context, runner execx.Runner, directory string) (SkillCatalog, error)
ReadSkillCatalog returns the repository-scoped live OpenCode skill catalog. It verifies that OpenCode answered for directory and never includes command output or loaded skill content in an error.