Dashboard › opencode › Distillation
7220dd7e-9aec-4dcd-ade8-bbce5fecf709["lore_tm_v1_WtG4i--9OP7o6OWZFLqQHW4HGhAdxWzm33hTV55R7L0","lore_tm_v1_wgJ5W0WZ4Zj5wI_QHppwy3QAJggXgu-avzlrbC-EZ9g"]
/home/byk/Code/opencode-v2-pilot/packages/schema/src/location.ts: Location.Ref contains directory: AbsolutePath and optional workspaceID: WorkspaceID; Location.Info contains the same location fields plus project: { id: ProjectID, directory: AbsolutePath, canonical: AbsolutePath }; response<S extends Schema.Top>(data: S) returns Schema.Struct({ location: Info, data })./home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/module.ts:60-71,107-116 accepts only a default-exported definition with { id, setup } or { id, effect }, while /home/byk/Code/opencode-lore/packages/opencode/src/index.ts:242,505-511 exports a V1 plugin function that would fail with: Plugin must export a default definition with an id and an effect or setup function./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts:54-63: Cleanup = () => Promise<void> | void, Plugin = { id, setup }, and Plugin.define() returns its definition unchanged../server export with default Plugin.define({ id: "lore", async setup(ctx) { /* V2 integration */ } }); V2 resolves package/server before package root per /home/byk/Code/opencode-v2-pilot/packages/plugin/src/host.ts:17-43 and /home/byk/Code/opencode-v2-pilot/packages/plugin/test/host.test.ts:81-104, while /home/byk/Code/opencode-lore/packages/opencode/package.json:9-15 currently exports only ".".client, project, directory, or worktree fields at /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts:25-52.type LoreContext = { readonly location: Plugin.Context["location"]; readonly agent: Pick<Plugin.Context["agent"], "transform">; readonly session: Pick<Plugin.Context["session"], "hook"> }, passing the full V2 context from the default definition while allowing tests to use a small typed harness.{ location, agents: { snapshot(), reload() }, session: { trigger(name, event) }, close() }.setup once per activation scope; 2. store hooks and transforms in registration order; 3. await hook callbacks sequentially while passing the same mutable event object, matching /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/hooks.ts:88-99; 4. return idempotent { dispose() } registrations; 5. automatically attach every registration to its activation scope even if Lore does not retain the returned registration; 6. on close(), run returned plugin cleanup and remove every registration; 7. if setup fails after partial registration, remove those registrations anyway; 8. keep every Location.Info activation independent./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:245-249, agent transform adaptation at :277-297, session hook adaptation at :573-590, and setup cleanup at :598-601.snapshot()/reload(), matching reload replay in /home/byk/Code/opencode-v2-pilot/packages/core/test/state.test.ts:55-70 and idempotent disposal/state rebuilding at :74-92.list(), get(id), default(id), update(id, callback), and remove(id), matching /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/agent.ts:6-16.close() calls; 3. an explicitly disposed registration removes only itself; 4. two registrations using the same callback remain independently disposable; 5. setup failure after registering a hook removes the partial registration; 6. async cleanup finishes before close() resolves; 7. triggering hooks after close produces no mutations./home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts:120-147, and asynchronous adapter cleanup at /home/byk/Code/opencode-v2-pilot/packages/core/test/plugin.test.ts:401-433.workspaceID values.Location isolation in /home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances.test.ts:16-142; setup failure and retry at :145-219; cold reconstruction and cleanup at :223-295; workspace-qualified isolation in /home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances-effect.test.ts:146-235; and independent server activation waits in /home/byk/Code/opencode-v2-pilot/packages/server/test/plugin-activation.test.ts:60-119.fetch; 4. B remains active but loses routing. Omitting cleanup was rejected because the interceptor would instead leak after all locations close.session.http.request hooks over per-activation global fetch patching for V2 routing.Request and Response values at /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/session.ts:39-63 and /home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts:243-270.primary, 2. compaction, 3. title, 4. generateβand preserve the exact upstream URL/path, authorization headers, x-api-key, provider, session, agent, project, and parent-session headers; all request kinds are covered by /home/byk/Code/opencode-v2-pilot/packages/core/test/session-model-request-hooks.test.ts:21-78.agents at /home/byk/Code/opencode-v2-pilot/packages/schema/src/config.ts:57-59; singular agent is only legacy input normalized into agents at /home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:131-166.ctx.agent.transform because a V2 Promise plugin has no config hook, setting both mode: "subagent" and hidden: true; /home/byk/Code/opencode-v2-pilot/packages/core/src/agent.ts:92-103 selects only agents that are neither subagents nor hidden.auto, keep, and buffer, while prune is unsupported, citing /home/byk/Code/opencode-v2-pilot/packages/schema/src/config/compaction.ts:6-14 and /home/byk/Code/opencode-v2-pilot/packages/core/src/config/normalize.ts:318-374; therefore the existing V1 mutation { auto: false, prune: false } must not be copied into the V2 adapter./home/byk/Code/opencode-lore/packages/opencode/test/v2-harness.ts and /home/byk/Code/opencode-lore/packages/opencode/test/v2-server.test.ts.