Dashboard › opencode › Distillation
120aee35-d29b-4eca-af07-f2d1a89d7a14["lore_tm_v1_wa3dw_DezmGGr8vNEKWv7Ih8MsnUQT0hWhntq182S9k","lore_tm_v1_EF1AhjS9mEw42zKDInuIu9Xxc4oPpAZoepWmoqEQYsY","lore_tm_v1_y3nzcTdv97XSn1qEzLUc_q6c5rr42UOvOTHrWc9bx7A","lore_tm_v1_QnJ_R4_T8PsL05r5eOEs5xk2cBCwOFlh_dEcbLuORhA","lore_tm_v1_AsdWPYY-khs8dtd9ZEuKKfJf5j2ipVFRrMhx-lK9VqA","lore_tm_v1_91IvSQWxZprkPRh71eBVPli6sENKutZAD5jlo8uhIi4","lore_tm_v1_-LwDY9O_PKRWgKIjgLgBIN3QPqgoC85J_9ysrpC6nNU"]
ToolDefinition/CodeMode-related query across packages/core/src/tool.ts, packages/core/src/aisdk.ts, packages/core/src/mcp/instructions.ts, packages/core/src/mcp/index.ts, packages/core/src/mcp/client.ts, packages/core/src/tool/runtime.ts, tool plugins, session context, internal plugins, and CodeMode files.packages/core/src/tool.ts:228-229 separates active tools into direct where tool.options?.codemode === false and codeModeTools where tool.options?.codemode !== false; packages/core/src/tool.ts:297-298 reserves the tool name "execute" for CodeMode.write.ts, websearch.ts, webfetch.ts, subagent.ts, skill.ts, shell.ts, read.ts, question.ts, patch.ts, grep.ts, glob.ts, and edit.ts use options: { codemode: false }; write.ts, patch.ts, and edit.ts additionally use permission: "edit"; opencode.ts uses namespace: "opencode", codemode: true, with one definition also pinned: true.Permission.Service and every other required Location service while the layer is constructed, and the executor captures those services.ToolFailure and do not use catchCause, because interruption and defects must survive.Permission.assert and question dismissals travel as defects beneath leaf mapError blankets and resurface as typed failures at SessionModelRequest.executeTool; leaves must never catch or convert them.Permission.CorrectedError, representing a decline with feedback, remains typed so the leaf converts it into ToolFailure and the model continues.Tool.Service uses shared State to replay synchronous transforms in registration order against a fresh editor.Tool.Service.reload() rebuilds from captured source data without changing registration precedence.dispose Effect.packages/core/src/plugin/host.ts:93-107 defines atWorktree(ref, run): workspace-scoped refs fail with Worktree.UnsupportedLocationError; absent/current-location refs immediately use captured worktrees; other locations defer import("../plugin.js"), acquire Plugin.Service and target Worktree.Service, wait on plugins.awaitActivation, then run under Effect.provide(locations.get(ref)).packages/core/src/plugin/host.ts:47-73 constructs the plugin host by acquiring and capturing services including App.Metadata, Agent.Service, AISDK.Service, Catalog.Service, Command.Service, Bus.Service, Integration.Service, KV.Service, Mcp.Service, Location.Service, Reference.Service, Rpc.Service, Skill.Service, Tool.Service, Vcs.Service, WebSearch.Service, Generate.Service, Permission.Service, PluginHooks.Service, Session.Service, PersistentPty.Service, LocationServiceMap.Service, and Worktree.Service.packages/core/src/plugin/host.ts:384-407 exposes the plugin permission domain as: hook via hooks.register("permission", name, callback), assert via captured permission.assert, list via permission.forSession(input.sessionID), and session-scoped get/reply operations that first verify request?.sessionID === input.sessionID; mismatches fail with Error("Permission request not found: ...").packages/core/src/plugin/host.ts:536-560 declares requirements = LayerNode.group([...]) with nodes in this order: App.node, Agent.node, AISDK.node, Catalog.node, Command.node, Bus.node, Integration.node, KV.node, Mcp.node, Location.node, Reference.node, Rpc.node, Skill.node, Tool.node, Vcs.node, WebSearch.node, Worktree.node, Generate.node, Permission.node, PluginHooks.node, Session.node, PersistentPty.node, LocationServiceMap.node.packages/core/src/plugin/host.ts:562-588 namespaces plugin storage keys as plugin:${pluginID encoded character-by-character as four-digit hexadecimal}:; get, set, and remove prepend the namespace, while scan namespaces prefix/after and strips the namespace from returned entry keys and next.packages/plugin/src/effect/permission.ts defines PermissionEvaluation with sessionID, optional agent, action, resources, optional metadata, optional source, mutable effect, and optional mutable message; PermissionHooks exposes evaluate: PermissionEvaluation.packages/plugin/src/effect/permission.ts defines PermissionAssertInput with sessionID, action, resources, optional save, optional metadata, optional source, and optional agent.packages/plugin/src/effect/permission.ts:33-36 defines PermissionDomain as Pick<PermissionApi<unknown>, "list" | "get" | "reply"> plus assert: (input: PermissionAssertInput) => Effect.Effect<void, unknown> and hook: Hooks<PermissionHooks>.packages/plugin/AGENTS.md states the plugin package has Effect and Promise versions; every Effect-version domain must extend the corresponding Effect API client interface from @opencode/client/effect/api; functions already present on that interface must not be redefined; plugin domains add only functions meaningful in plugin context.