Dashboard › opencode › Distillation
bf3a55f3-c1c5-4d81-ae20-26a2d9546cc7["lore_tm_v1_3th56gzSu4kSGa9bz0KeVbJbOwYkRXNPzWZBXyCUEMs","lore_tm_v1_keT03ZxnJlMsGN2MC-r5cYyI2_vrd_cr6dnQvH64Ei8","lore_tm_v1_WIshZrUWIrMDQ6rI1YA5E1aUandQgn7tMpfX14mhtIM","lore_tm_v1_XgvUFowg6DRgu65Z_29EyDYeNy7cnd0uEF_n43WcP6g","lore_tm_v1_cpgt9i3FELX5irdmgAFDaebAv8tIm13PWFsP8gf_koc","lore_tm_v1_IsjWbVFajOJQJaqOTC1QyGJdZX1JQ6XNKwUr67fbzEA","lore_tm_v1_GEm2VtYOM3517B7xQIfJMdQftc4Vp_oLHdEJjneTAxI","lore_tm_v1__IMj_M0SZe56OHtxcKgCDj-k7kmaPCjk6F1NoPIuOow","lore_tm_v1_oagLTK2zYFmKzkvgtYxcnxYc7JQPum48xwVxdx1YnvI","lore_tm_v1_4jcP8xFIrRXshg1_KUlKQ2u4E5imwmO1aUB0Had7Au4","lore_tm_v1_ApGya84a9rMcOEF0lJj6KyyaFens7tzp7EaGwZc3ZiY","lore_tm_v1_c0pPwGjsJE1jB9_Cu7sQLyqst-SHD9o9qL5RsD03LDo","lore_tm_v1_aUQpsnxJ8gfY5_n-SZ-1F7Fwa59myRLilthXapbQAvk","lore_tm_v1_0VS8dxf8jS_hhAQu11K65Dr11xVoU8GCc-Gry_w-wj4","lore_tm_v1_RqYkNqsYDkpZGgyet25RygdRLJG6GetqKF7acgvjz5o","lore_tm_v1_BdvAcp7Mr9F1_du0wGn4NEm0A4xAKDwtpKoauf7DX_k"]
/home/byk/Code/opencode/packages/opencode/src/server/routes/instance/httpapi/groups/provider.ts defines ProviderAuthApiError as Schema.ErrorClass("ProviderAuthError") with HTTP status 400; allowed name values are "BadRequest", "ProviderAuthOauthMissing", "ProviderAuthOauthCodeMissing", "ProviderAuthOauthCallbackFailed", and "ProviderAuthValidationFailed", while optional data fields are providerID, field, message, and kind.ProviderApi declares 4 endpoints under /provider: list (GET /provider, identifier provider.list), auth (GET /provider/auth, identifier provider.auth), authorize (POST /provider/:providerID/oauth/authorize, identifier provider.oauth.authorize), and callback (POST /provider/:providerID/oauth/callback, identifier provider.oauth.callback).ProviderAuthApiError; authorize accepts ProviderAuth.AuthorizeInput and returns Schema.UndefinedOr(ProviderAuth.Authorization), while callback accepts ProviderAuth.CallbackInput and returns Schema.Boolean.InstanceContextMiddleware, WorkspaceRoutingMiddleware, then Authorization. Its OpenAPI metadata describes it as "Experimental HttpApi provider routes.", version 0.0.1./home/byk/Code/opencode/packages/opencode/src/server/routes/instance/httpapi/api.ts constructs EventSchema from every EventManifest.Latest definition plus InstanceDisposed, annotating individual variants as Event.${definition.type} and the union as Event.ServerApi is produced by makeApi(...) with EventManifest.Latest.values().toArray(), LocationMiddleware, and SessionLocationMiddleware.RootHttpApi combines ControlApi, ControlPlaneApi, and GlobalApi, then applies SchemaErrorMiddleware and Authorization.InstanceHttpApi combines, in order, ConfigApi, ExperimentalApi, FileApi, InstanceApi, McpApi, ProjectApi, ProjectCopyApi, PtyApi, QuestionApi, PermissionApi, ProviderApi, SessionApi, SyncApi, TuiApi, and WorkspaceApi, then applies SchemaErrorMiddleware.OpenCodeHttpApi combines RootHttpApi, EventApi, InstanceHttpApi, ServerApi, and PtyConnectApi; its additional schemas are EventSchema, Question.Replied, Question.Rejected, Credential.Value, Integration.Inputs, Integration.Method, Integration.Ref, and SkillV2.Source./home/byk/Code/opencode/packages/opencode/src/server/routes/instance/httpapi/middleware/instance-context.ts defines InstanceContextMiddleware under key @opencode/ExperimentalHttpApiInstanceContext, requiring WorkspaceRouteContext.provideInstanceContext() reads WorkspaceRouteContext, safely decodes route.directory, loads an instance through InstanceStore.Interface.load({ directory }), and supplies the resulting context as InstanceRef plus route.workspaceID as WorkspaceRef.instanceContextLayer yields InstanceStore.Service once during layer construction and closes over it in the middleware implementation./home/byk/Code/opencode/packages/server/src/location.ts defines LocationMiddleware under key @opencode/HttpApiLocation, providing the services returned by LocationServiceMap.Service.get.Location.response(data) wraps an effect result in { location: new Location.Info({ directory, workspaceID, project }), data }.location[workspace] and location[directory], then headers x-opencode-workspace and x-opencode-directory; the directory finally defaults to process.cwd(). Header directory values are safely passed through decodeURIComponent, malformed encodings fall back unchanged, and resolved values are branded with AbsolutePath.make and WorkspaceV2.ID.make.HttpServerRequest.HttpServerRequest per request and provides locations.get(ref(request)) around the downstream effect./home/byk/Code/opencode/packages/app/src/utils/server-compat.ts defines a lazy compatibility facade that presents the current ServerApi shape while asynchronously selecting a V1 adapter or the current implementation according to ServerProtocol.createCompatibleApi() eagerly creates the V1 adapter and calls lazyApi(input.protocol.then(protocol => protocol === "v1" ? v1 : input.current), input.current).lazyApi() uses a recursive Proxy and a Map<PropertyKey, unknown> to preserve synchronous API namespace shape while deferring implementation selection; unavailable methods throw API method unavailable: ${String(property)}, and unavailable namespaces throw API namespace unavailable: ${String(property)}.sessionInfo() maps legacy SDK Session values into SessionInfo, defaulting cost to 0 and tokens to { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } }; it maps location to { directory: session.directory, workspaceID: session.workspaceID }, subpath from session.path, and preserves revert metadata.list to legacy experimental.session.list when search is cross-directory, otherwise legacy session.list; create to session.create; get to session.get; active to session.status with non-idle statuses normalized to { type: "running" }; rename to session.update; remove to session.delete; fork to session.fork; and interrupt to session.abort.session.prompt maps current text/files/agents into legacy promptAsync; file mentions become "text/plain" file parts with source ranges, ordinary files infer MIME from a data URI or default to "application/octet-stream", and the compatibility response uses admittedSeq: 0, current Date.now(), type "user", and default delivery "steer".session.command maps the model to ${providerID}/${id}, sends attached files as legacy file parts, and returns synthetic text /${value.command} ${value.arguments ?? ""}`.trim() with admittedSeq: 0 and default delivery "steer".session.compact requires a model, otherwise throws "A model is required to compact a V1 session"; it calls legacy session.summarize with providerID and modelID, then returns a synthetic "compaction" message.stage to session.revert, clear to session.unrevert, and leaves commit on input.current.session.revert.commit.list to legacy project.list, current to legacy project.current and returns { id, directory: worktree }, and directories to legacy worktree.list.status directly and maps current diff mode "working" to legacy mode "git"; diff entries default missing patch to "" and missing status to "modified".list to legacy file.list with default path ""; find maps directory selection to legacy string flags "true"/"false" and returns { path, type }, defaulting type to "file".get maps legacy provider auth methods: "api" becomes { type: "key", label }, while OAuth methods become { type: "oauth", id: String(index), label, prompts }; returned integrations initially have connections: [].auth.set({ providerID, auth: { type: "api", key } }), then disposes both the location-specific legacy instance and input.legacy() instance.${integrationID}:${method}. connect calls provider.oauth.authorize, returns URL/instructions/mode, and sets expiry to Date.now() + 10 * 60 * 1000; complete and status recover the method from the final colon-separated segment, call provider.oauth.callback, and dispose both legacy instances.list, create, get, and update to legacy PTY APIs; absent create data throws "Failed to create terminal", while absent get data throws Terminal not found: ${value.ptyID}./home/byk/Code/opencode/packages/app/src/utils/server-protocol.ts defines ServerProtocol = "v1" | "v2" and probes servers with Basic authorization when a password exists, AbortSignal.timeout(5_000), an OK-status requirement, and an application/json content-type requirement.detectServerProtocol() first probes /global/health; { healthy: true } selects "v1". It next probes /api/health; a numeric pid selects "v2", { healthy: true } selects "v1", and all other outcomes default to "v2"./home/byk/Code/opencode/packages/opencode/node_modules/@effect/platform-node contains exactly 5 entries: dist/, LICENSE, package.json, README.md, and src/.No files found.Ripgrep JSON record exceeded 65536 bytes./home/byk/Code/opencode/packages/opencode/node_modules/effect/src/unstable/http contains exactly 31 entries: Cookies.ts, Etag.ts, FetchHttpClient.ts, FindMyWay.ts, Headers.ts, HttpBody.ts, HttpClient.ts, HttpClientError.ts, HttpClientRequest.ts, HttpClientResponse.ts, HttpEffect.ts, HttpIncomingMessage.ts, HttpMethod.ts, HttpMiddleware.ts, HttpPlatform.ts, HttpRouter.ts, HttpServer.ts, HttpServerError.ts, HttpServerRequest.ts, HttpServerRespondable.ts, HttpServerResponse.ts, HttpStaticServer.ts, HttpTraceContext.ts, index.ts, internal/, Multipart.ts, Multipasta.ts, Multipasta/, Template.ts, Url.ts, and UrlParams.ts.HttpServerError.ts found exactly 3 references explaining that client-abort annotations map pure interrupts to HTTP 499, while server aborts map to HTTP 503./home/byk/Code/opencode/packages/opencode/node_modules/effect/src/unstable/http/HttpServerError.ts defines ClientAbort as a Context.Service<ClientAbort, true> keyed by "effect/http/HttpServerError/ClientAbort" and exposes ClientAbort.annotation, including a stack-trace annotation named "ClientAbort".causeResponse() inspects all cause reasons: failures use Respondable.toResponseOrElse, HttpServerResponse defects are used directly, other defects use Respondable.toResponseOrElseDefect, and interrupts are recognized as client interrupts when their annotations contain ClientAbort.key.causeResponse() chooses Response.empty({ status: 499 }) for a client interrupt and Response.empty({ status: 503 }) for a server interrupt. The internal default is Response.empty({ status: 500 }).causeResponseStripped() extracts an HttpServerResponse defect and removes it from the remaining cause; otherwise it defaults to HTTP 500. exitResponse() returns the response directly on success or delegates failed exits to causeResponseStripped().Found 46 matches. Files included packages/desktop/src/renderer/index.tsx, src/main/wsl/startup.ts, src/main/wsl/sidecar.ts, src/main/wsl/servers.ts, src/main/wsl/runtime.ts, and src/main/wsl/servers.test.ts.AbortController/AbortSignal across startup delays, sidecar startup, runtime commands, and serialized WSL jobs. beginJob() aborts the prior job before creating the next controller; runJob() passes the controller to runtime probing, distro refresh/install, addable-distro probing, and opencode installation./home/byk/Code/opencode/packages/desktop/src/renderer/index.tsx:270-273 defines the renderer platform fetch adapter as if (input instanceof Request) return fetch(input); return fetch(input, init), meaning a supplied init is discarded whenever input is already a Request.window.api; clipboard images become PNG files named pasted-image-${Date.now()}.png.nativeT(...); native menus, dialogs, and IPC handlers must not inspect locales, choose plural categories, or assemble translated sentence fragments.github.com/mozilla-l10n/firefox-l10n.window.api from src/preload, and main-process IPC handlers to be registered in src/main/ipc.ts.Found 26 matches; relevant abort handling was concentrated in @effect/platform-node/src/NodeHttpServer.ts, with additional lifecycle/close references in Undici.ts, NodeWorkerRunner.ts, NodeWorker.ts, NodeSocket.ts, and NodeRedis.ts./home/byk/Code/opencode/packages/opencode/node_modules/@effect/platform-node/src/NodeHttpServer.ts installs request and upgrade handlers and removes them during scope finalization before running preemptiveShutdown.NodeHttpServer.makeHandler() runs each request in a fiber containing a ServerRequestImpl; on Node response "close", it interrupts the fiber with ClientAbort.annotation only when nodeResponse.writableEnded is false.NodeHttpServer.makeUpgradeHandler() lazily upgrades through wss.handleUpgrade, wraps the WebSocket in Effect.acquireRelease, and closes the WebSocket on release."close" interrupts the request fiber with ClientAbort.annotation only when socket.writableEnded is false.