Dashboard › opencode › Distillation
2c6738f2-76c1-42c5-bd81-b1dd280935ee["lore_tm_v1_ztJ6kLJTvLl-guPyPDNWYQ6TD3M6jaRKiQWZ2vZvouI","lore_tm_v1_3s8XsMoShSg6XnLIDkK9Ka90WInfaJC6Hq17lLsYS98"]
/home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts, locationInfo() constructs Location.Info from the active location’s directory, workspaceID, and project; locationRef(input) resolves an optional requested directory/workspace into Location.Ref, defaulting omitted fields to the current location.isCurrentLocation(ref) requires both ref.directory === location.directory and ref.workspaceID === location.workspaceID.atWorktree(ref, run) rejects references with a workspaceID using Worktree.UnsupportedLocationError; absent or current-location references immediately use the existing Worktree.Interface, avoiding self-wait during plugin construction.atWorktree(ref, run) dynamically imports Plugin from ../plugin.js, obtains Plugin.Service and the target Worktree.Service under locations.get(ref), awaits plugins.awaitActivation, and then invokes run(target). The deferred import breaks the construction dependency between the plugin host and Plugin.listAgents(ref) runs under locations.get(ref), obtains that location’s Location.Service and Agent.Service, and returns { location: Location.Info, data: agents.list() }; cross-location agent.get searches this result by input.agentID, while same-location lookup uses agents.get(input.agentID)./home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts, activate(plugins, failures = []) normalizes generation IDs with Plugin.ID.make(plugin.id) and dies with Duplicate plugin ID: ${definition.id} when duplicate IDs are found.hold() and then lock.withPermit(...). It records discovery failures, compares the ordered active plugin list by plugin.id and plugin.revision, and computes the unchanged prefix at the first mismatch.nextInventory from slotInfo plus discovery failures, and publishes Plugin.Event.Updated only if the JSON-serialized inventory changed.State.batch(...) retains only the unchanged setup-order prefix, removes the changed suffix in reverse order, and closes each healthy prior activation scope with Scope.close(slot.activation.scope, Exit.void).slot.activation.failure exists and slot.plugin.revision === definition.revision, activation reuses that failed slot with the updated definition.load(definition) stores its activation; a failed load stores its error. If a healthy prior activation exists, the system attempts load(fallback.plugin) and, on success, restores that activation while retaining the new definition and new-load error; if restoration also fails, it logs failed to restore plugin; deactivating.inventory with active slotInfo entries plus failures and publishes Plugin.Event.Updated.pendingFailures worker logs disabled plugin after transform failure with plugin.id, failure state, ref, and Cause.die(item.failure.cause), then enters lock.withPermit(...) to refresh inventory, execute State.batch(item.refresh).pipe(Effect.exit), and publish Plugin.Event.Updated.Effect.ensuring(...) even if an inventory observer fails. Scope.close(item.scope, Exit.void) catches cleanup failures and logs failed to clean up disabled plugin, then runs via Effect.forkScoped({ startImmediately: true }) so the finalizer is not joined while holding activation synchronization.failed to refresh state after disabling plugin; non-interruption failures while reporting the disabled plugin are caught with Effect.catchCauseIf((cause) => !Cause.hasInterrupts(cause), ...) and logged as failed to report disabled plugin.