Dashboard › opencode › Distillation
cb083535-feb0-4818-bb7d-379f304471cb["lore_tm_v1__ryD-P7g09zvPNrk4YvLFtz9aHLfR8IE_Q4smyoyRqo","lore_tm_v1_NGpV8qNm-IFO7KQXHaIDxp16_aESiwyIGbFyeEZdwgw","lore_tm_v1_U1eElGEF6vmktEEC1rN8X1lG-k9iM5QAK1_Vu52GTCQ","lore_tm_v1_e3h42WAzoQq4lWKPrhY71bd-0jvSfuMgMdsZhDaHoYc","lore_tm_v1_cfVrQEw0ohw8kxkWFKr3jN0XCMmrEeBqzKylwXl0x2c","lore_tm_v1_mtdT82JlKvnFY7weTWwWFpOK3qEf5rpgpbGIaEN527M"]
SessionHookContext.hook<Name extends keyof SessionHooks>() in /home/byk/Code/opencode-v2-pilot/services/www/src/docs/content/build/plugins/index.mdx accepts options?: Name extends "prompt" ? never : { providerID?: string }; provider-scoping options are therefore never allowed for "prompt" hooks.ctx.permission.hook("evaluate", ...), skips event.action === "read", gets messages with ctx.session.context({ sessionID: event.sessionID }), asks ctx.generate.text() using { providerID: "anthropic", id: "claude-sonnet-4-6" }, parses the review, then assigns event.effect = decision.effect and event.message = decision.reason.allow and ask decisions; 2. an explicit configured deny is final and does not invoke the hook; 3. a hook may change effect to "allow", "ask", or "deny"; 4. message appears in an escalated permission request or becomes the denial reason.PermissionEvaluation contains readonly sessionID, optional readonly agent, readonly action, readonly resources: readonly string[], optional readonly metadata, optional readonly tool source { type: "tool"; messageID: string; id: string }, mutable effect: "allow" | "ask" | "deny", and optional mutable message.ctx.shell.hook("create.before", ...) to modify commands, working directories, timeouts, executables, or environment variables before execution; the example caps event.timeout at 60_000 via Math.min and sets event.env.COMPANY_ENV = "development".ShellHookContext.hook() supports "create.before" with ShellCreateBefore, whose mutable fields are command: string, cwd: string, timeout: number, shell: string, and env: Record<string, string | undefined>."execute.before" to inspect or replace tool input before execution and "execute.after" to inspect successful results or failures afterward; examples log event.input for the "read" tool, add metadata: { observed: true } to a completed result, and log event.error.message for an error.ToolHooks maps "execute.before" to ToolExecuteBefore and "execute.after" to ToolExecuteCompleted | ToolExecuteFailed; ToolHookContext.hook<Name extends keyof ToolHooks>() returns Promise<Registration>."opencode-acme-plugin", version "1.0.0", "type": "module", exports "." to "./src/index.ts" and "./rpc" to "./src/rpc.ts", and depends on "@opencode/plugin": "beta"."./rpc" package export is optional and is included when publishing a shared RPC contract for plugins and clients to import without loading the plugin implementation.server() function and a spread Plugin.define({ id: "example", async setup(ctx) { ... } }) V2 definition; both examples log "A tool is about to run" before tool execution.server() and uses its returned hooks; 2. V2 reads the default exportβs id and setup() or Effect plugin effect(), ignoring server(); 3. implementations must remain on their own APIs because sharing an export does not translate V1 hooks into V2 hooks; 4. Plugin.define(...) should be spread into the exported object so the V2 definition type-checks separately from server().1.18.29; older V1 releases may require function exports, so packages should be tested against the oldest intended V1 release and against V2./home/byk/Code/opencode-v2-pilot/packages/core/test/config/agent.test.ts verifies global permissions are applied before agent-specific permissions across config documents.build agent with default permissions plus { action: "bash", resource: "*", effect: "allow" }, then appends global { action: "bash", resource: "*", effect: "ask" } and { action: "read", resource: "*", effect: "allow" }, followed by agent-specific { action: "bash", resource: "git *", effect: "allow" }; consequently "git status" is allowed while "bun test" asks.reviewer agent fields merge across documents to produce description "Review changes", mode "subagent", hidden: true, and model { providerID: "openrouter", id: "openai/gpt-5", variant: "high" }.reviewer permission order is default permissions, global bash ask, global read allow, agent-specific edit deny, then agent-specific read deny; Permission.evaluate("read", "README.md", reviewer.permissions).effect is "deny".late agent receives default permissions, global bash ask, global read allow, and its agent-specific edit allow, while the configured removed agent with disabled: true is absent./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/index.ts exports PluginOptions; storage types StorageEntry, StorageScanOptions, and StorageScanResult; namespace Plugin; and schema values Agent, Command, Connection, Credential, Integration, Location, Mcp, Model, PersistentPty, Provider, Reference, Rpc, Skill, Vcs, WebSearch, and Worktree.close() calls in /home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances.test.ts, /home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances-lifecycle.test.ts, /home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances-effect.test.ts, /home/byk/Code/opencode-v2-pilot/packages/sdk/test/promise.test.ts, and /home/byk/Code/opencode-v2-pilot/packages/sdk/test/transport.test.ts./home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances-lifecycle.test.ts contains the live regression test "a cancelled borrower cannot strand a later failed instance construction".EmbeddedHost with config: { directory: directory.path, project: false, content: "{}" }, models: { fetch: false }, fs: { filewatcher: false }, and an instance cache key fixed to "shared".1, reports its fiber through started, waits on release, and fails with new Error("Configuration unavailable"); later attempts return { plugins: [] }.acquired empty; a scoped borrower starts instance provisioning and is interrupted; interruption does not prematurely release the in-flight construction; releasing the blocked configuration causes its fiber to fail within "1 second" and records released as [1]; a later provision succeeds with acquired equal to [1, 2]; closing the host leaves released equal to [1, 2].