Dashboard › opencode › Distillation
74371765-4298-4245-a25e-361f95a3befa["lore_tm_v1_Ko6p9e-7jiPzxHwlIx9CKf1Sm23e0gSbBSBKeRPIXZk","lore_tm_v1_Sj1hIgxMZB63ZJinboc2VzOvXV5kMi3WQ0FtFpgbaxs","lore_tm_v1_YRl5FAJDkP-onGsg5cf2HpJBKBL2gZ-Xo81T5Iu7gNI","lore_tm_v1_mhrIOamos9lrGHPbB7echf11p-xDnLPOhit1bTJ9nU0"]
/home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts adapts Promise plugins into the Effect-only Core runtime via fromPromise(plugin), dynamically imports ClientApi and OpenCodeEvent, captures the plugin Scope.Scope, registers hooks/transforms in that scope, and uses Effect.acquireRelease so an optional Promise setup cleanup runs on unload./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:48-78 defines makeStreams(): each Promise async iterator uses Stream.toAsyncIterableWith(stream, context), tracks its close callback in subscriptions, supports an optional AbortSignal, removes abort listeners on close, and closes all subscriptions through a plugin-scope finalizer./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:80-169 defines rpcFromEffect(host, streams): generated client methods run local Effect RPC methods with optional abort signals; events.subscribe converts streams to AsyncIterable; events.on uses an AbortController and returns an unsubscribe callback; register wraps Promise handlers with Effect.tryPromise; ReturnedRpcError(type, message, data) is translated through context.error(...)./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:171-207 caches compiled HTTP endpoint codecs in compiledEndpoints: WeakMap<object, CompiledEndpoint>; compileEndpoint() rejects more than 1 payload schema or more than 1 success schema with Unsupported API schema cardinality: ${endpoint.identifier}, decodes params/query/headers/payload, recognizes HttpApiSchema.NoContent, and unwraps a sole data property from object success schemas before encoding./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:263-275 defines adaptApiMethod(), which decodes a Promise method’s input against endpoint schemas, merges decoded components with Object.assign({}, ...decoded), invokes the Effect host method, returns undefined for no-content endpoints, and otherwise encodes the result./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:288-596 constructs the Promise plugin context for these domains: app, location, options, agent, aisdk, catalog, command, event, experimental.terminal, generate, integration, mcp, permission, plugin, reference, rpc, skill, storage, tool, vcs, websearch, worktree, session, and shell./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:316-331 adapts Promise command transforms by wrapping each command’s definition.execute(input) in Effect.tryPromise({ catch: (cause) => cause })./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:333-341 adapts Core events by encoding each event with Schema.encodeUnknownEffect(OpenCodeEvent), casting it to the Promise event type, and exposing it through the scoped stream adapter with optional cancellation./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:383-422 adapts integration transforms, including OAuth methods: Promise authorize callbacks become Effects; "auto" authorization callbacks are zero-argument Effects; non-auto callbacks accept code; optional refresh callbacks are converted with Effect.promise./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:467-504 adapts tool editors while preserving list, get, namespace, add, update, and remove; Effect tool executors are exposed to Promise plugins through promiseExecutor(), while added or updated Promise tools execute through executePromiseTool()./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:505-571 adapts Promise-defined vcs, websearch, and worktree implementations with abort-aware attempt(): VCS supports info, optional bound base, branches, status, and diff; web search supports execute; worktrees support create, remove, and list./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:573-591 exposes Promise session methods create, get, switchAgent, switchModel, prompt, generate, command, synthetic, interrupt, rename, move, wait, and context, plus scoped session hooks./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:612-639 defines executePromiseTool(): Promise rejection is captured with Effect.tryPromise; a TypedFailure becomes Tool.Error, preferring an object’s string feedback, then an Error.message, then String(error) for its message; all other Promise tool errors become Effect defects via Effect.die(error)./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/permission.ts defines PermissionEvaluation with readonly sessionID, optional agent, action, resources, optional metadata and source, plus mutable effect and optional mutable message; PermissionHooks contains evaluate./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/permission.ts:22-35 defines PermissionAssertInput with sessionID, action, resources, optional save, metadata, source, and agent; PermissionDomain combines Pick<PermissionApi, "list" | "get" | "reply">, assert(input): Promise<void>, and hook: Hooks<PermissionHooks>.assert: permission.assert to the permission host in /home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/host.ts, adds an "unused permission.assert" defect stub in /home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/host.ts, and adds matching PermissionAssertInput/assert APIs to both Effect and Promise plugin permission domains./home/byk/Code/opencode-v2-pilot/packages/core/src/permission.ts as the Core permission source file.