Dashboard › opencode › Distillation
7e744572-f655-49c3-a44e-d4a89db4efec["lore_tm_v1_TOXPp4GXVv4Q9siTp9TVh4SABCgRYeeVtSYPEOeW2w0","lore_tm_v1_wM-U_BBNCxKqH30O9bSvdOZveV4rOPDtdy-tSeeReNA","lore_tm_v1_NAcOblPdn0vVWEr6IK7AYcIku4KRy5eeOGxH8wii8Us","lore_tm_v1_TyUbrgB3llYsgbheC2mRHRyfVvlBaAWg2n8DyzcemZc","lore_tm_v1_Jph_SwEFq7C_yh_n1RGm6nRec5wECMm6ITJjCP13mTs","lore_tm_v1_HnjcIFNWqOz-YpbgTVnBgbdvm2VeunclhG5xWndzEUA","lore_tm_v1_3amPJsCtay16sgD5Uh9vfhPcdMxv9fFEqKBaxb-jVtU"]
bun typecheck from a package directory such as packages/core; never run tsc directly.sdk composes Client, Core, and Server.import { foo as bar } from "..." or resolve as pathResolve. An aliased type import such as import type { Plugin as PluginDefinition } from "..." is permitted only as a last resort when names genuinely collide and no alternative exists.import("...") references such as Schema.declare<import("@opencode/plugin/effect/plugin").Plugin["effect"]>; use ordinary type imports instead.import * as Foo from "..." and import type * as Foo from "...". For namespace-style access, import the moduleβs named exported namespace, e.g. import { Project } from "@opencode/core/project" and use Project.ID.do-not-run-tests-from-root guard; tests must run from package directories such as packages/core.HttpApi, run bun run generate from packages/client; generated client files must not be edited directly.v2; new branches/worktrees default to v2 or origin/v2 when the local ref is unavailable, pull requests default to target v2, and diffs should use v2 or origin/v2 because local main may not exist.feat/ or fix/; commits and PR titles use type(scope): summary with valid types feat, fix, docs, chore, refactor, and test..changeset files must not be added.@opencode/client/effect/api, must not redefine existing client-interface functions, and may add only functions meaningful in plugin context.try/catch, any, unnecessary destructuring, reassignment, and else; prefer Bun APIs, inferred types, const, ternaries/early returns, and functional array methods such as flatMap, filter, and map.await import("./module").then(...) or (await import("./module")).value() should be avoided.project_id: text() and created_at: integer(), rather than camelCase keys with explicit SQL column-name strings.globalThis.*, test the actual implementation, and not duplicate production logic.bun run dev:live from a development worktree, optionally followed by a project directory. The script discovers the server with opencode2 service status, obtains its private local credential with opencode2 service get password, and uses the dev TUI storage channel.packages/tui/src/feature-plugins/system/storybook, must be registered in index.tsx, render the real production component, keep side effects local, expose meaningful state through keybindings listed in StoryFooter, and provide reset behavior when needed. A specific story runs via OPENCODE_STORY=<story-id> bun run dev:live.theme.hue values and unrelated semantic tokens must not be repurposed. text.feedback and background.feedback are reserved for status/outcome feedback, formfield states for form controls/ordinals/selection markers, and action states for actions.packages/plugin/src/promise/plugin.ts defines Context.permission as PermissionDomain. Context also exposes app, location, options, agent, aisdk, catalog, command, event, experimental.terminal.read, integration, mcp, generate, plugin.list, reference, rpc, session, shell, skill, storage, tool, vcs, websearch, and worktree.packages/plugin/src/promise/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/promise/permission.ts defines PermissionAssertInput with sessionID, action, resources, optional save, metadata, source, and agent. PermissionDomain is Pick<PermissionApi, "list" | "get" | "reply"> plus assert(input): Promise<void> and hook: Hooks<PermissionHooks>.packages/plugin/src/promise/adapter.ts lines 434β445, the Promise permission adapter registers hooks through host.permission.hook(...), adapts assert by running host.permission.assert(input) and converting typed failure to a defect with Effect.catch((error) => Effect.die(new TypedFailure(error))), and maps list, get, and reply through PermissionEndpoints.packages/core/src/plugin/host.ts lines 384β404, the permission host exposes hook via hooks.register("permission", name, callback), passes through permission.assert, implements list with permission.forSession(input.sessionID), and verifies that get/reply request records belong to input.sessionID; mismatches fail with new Error(\Permission request not found: ${input.requestID}`)`.packages/core/src/permission.ts declares assert at line 105 as (input: AssertInput) => Effect.Effect<void, Error | SessionErrors.NotFoundError> and implements it beginning at line 221 with Effect.fn("Permission.assert")((input: AssertInput) => ...).