Dashboard › opencode › Distillation
8b69a731-2663-46cb-b44d-e383ab6d0d8b["lore_tm_v1_GfgNeut0lU2kdFbw7gd5M1kMWUNMTky_HViFNtxUgPU","lore_tm_v1_WFbp-2ySUJxafVG7Q308LBFrv4bBokDsdaMD1tMSK0M","lore_tm_v1_ZJqwYbdVbcIRkz0X8T7C7tQLrRNgIL_6H56vaLpjg_w"]
Date: Sep 8, 2026
bun typecheck to be run from package directories such as packages/core; never run tsc directly.sdk composes Client, Core, and Server.import { foo as bar } from "..." and renamed imports such as resolve as pathResolve.import("...") references such as Schema.declare<import("@opencode/plugin/effect/plugin").Plugin["effect"]>. 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 other option exists.import * as Foo from "..." and import type * as Foo from "...". Namespace-style values should use the module’s named exported namespace, e.g. import { Project } from "@opencode/core/project" followed by Project.ID.@opencode/client/effect/api, not redefine functions already present there, and add only functions meaningful in the plugin context./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts lines 60–109. The stream adapter’s close() uses iterator.return?.() ?? Promise.resolve({ done: true as const, value: undefined }); abort invokes void close(); close is added to subscriptions; the abort listener uses { once: true }; and an already-aborted signal triggers abort() immediately./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts, stream next() closes after a completed iterator result and also closes before re-rejecting an iterator error; the returned iterable exposes return: close and satisfies StreamAdapter.rpcFromEffect in /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts obtains Effect.context<Scope.Scope>(), creates run with Effect.runPromiseWith(context), builds a local RPC client via host(definition), and exposes subscriptions through streams(local.events.subscribe(name), options).rpcFromEffect are generated from Object.keys(definition.methods). Each local[name] is asserted as (input: unknown) => Effect.Effect<unknown, unknown> under oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion, then executed as run(method(input), { signal: options?.signal })./home/byk/Code/opencode-v2-pilot/packages/core/src/permission.ts found 15 permission-error/assertion references: line 64 DeclinedError; line 66 CorrectedError; line 85 Error = BlockedError | CorrectedError; line 105 assert: (input: AssertInput) => Effect.Effect<void, Error | SessionErrors.NotFoundError>; line 117 deferred errors DeclinedError | CorrectedError; line 132 failure of pending deferred items with new DeclinedError(); line 202 creation of Deferred.make<void, DeclinedError | CorrectedError>(); line 221 Effect.fn("Permission.assert"); lines 240–242 comment that CorrectedError with feedback remains typed while Permission.DeclinedError becomes a defect via Effect.die(error); line 268 selection between new CorrectedError({ feedback: input.message }) and new DeclinedError(); line 278 deferred failure with new DeclinedError(); and line 324 Service.of({ ask, assert, reply, get, forSession, list })./home/byk/Code/opencode-v2-pilot/packages/core/src/v1/permission.ts: line 13 defines CorrectedError tagged "PermissionCorrectedError"; line 33 defines Error = DeniedError | RejectedError | CorrectedError.