Dashboard › opencode › Distillation
cb3d5b10-72df-4606-ab9f-b38e7786d3ac["lore_tm_v1_YtmozEXX_Met08dxMAkkBlfSw_g1XiQAEM5ov0P4HeI","lore_tm_v1_sc0SwsDvdGG8_wdnUo5rBWjFo73C-9xCADYTEZwICFg"]
/home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts exports the namespace ConfigProviderPlugin from ./provider.js and imports define from @opencode/plugin/effect/plugin, Document and Entry from @opencode/schema/config, Money from @opencode/schema/money, Effect from effect, Config, Provider, and ConfigEntryObserver./home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts defines Plugin with ID "opencode.config.provider" via define(...); its effect obtains Config.Service, then calls ConfigEntryObserver.observe(config, ctx.event, ctx.integration.reload().pipe(Effect.andThen(ctx.catalog.reload()))).provider.ts iterates over configuredProviders(loaded.entries). For an integration absent from the map, it adds a key method labeled "Manually enter API Key"; it applies a configured provider name; and when provider.env is defined, it adds an environment method with names: [...provider.env].provider.ts gets the latest "model" config via Config.latest(loaded.entries, "model") and, when present, sets the catalog default using configuredDefault.providerID and configuredDefault.model.provider.ts resolves its source as item.canonical ?? current?.provider.canonical ?? providerID; changed is true when an explicitly configured canonical differs from the current provider canonical.provider.ts replaces the target provider fields with structuredClone(source.provider) while preserving the target’s id and integrationID.provider.activation = "enabled". Optional overlays set canonical, name, package, and copied compaction; settings and body use Provider.mergeOverlay(...), while headers use Provider.mergeHeaders(...).item.models ?? {}, provider.ts chooses a base model using source?.models.get(config.modelID ?? id) ?? source?.models.get(id) and enables inheritance when the provider canonical changed or catalog.model.get(providerID, id) does not yet exist.provider.ts applies structuredClone(base). If the provider has an explicit item.package, it clears inherited model.package; if item.settings?.baseURL is explicitly configured and inherited model.settings exists, it deletes the inherited model.settings.baseURL.provider.ts can set family, name, modelID, package, copied compaction, and merged limit; merge compatibility with existing compatibility; merge settings and body through Provider.mergeOverlay(...); and merge headers through Provider.mergeHeaders(...).capabilities replaces the capability object with tools: config.capabilities.tools and copied input and output arrays.provider.ts initializes model.variants to [] if absent, matches variants by variant.id, appends { id: variant.id } when missing, then merges each variant’s optional settings, headers, and body using Provider.mergeOverlay(...), Provider.mergeHeaders(...), and Provider.mergeOverlay(...), respectively.tier, preserves input and output, and defaults missing cost.cache.read and cost.cache.write to Money.USDPerMillionTokens.zero.if (config.disabled !== undefined) model.enabled = !config.disabled./home/byk/Code/opencode-v2-pilot/packages/core/src/config/plugin/provider.ts covers lines 1–125 of 130; lines 126–130, including the visible but undefined-in-excerpt configuredProviders(...) helper’s likely implementation area, were not shown."model request" / model.request across 10 test files under /home/byk/Code/opencode-v2-pilot./home/byk/Code/opencode-v2-pilot/packages/core/test/tool-registry.test.ts has matches at line 1081 ("executes the tool advertised in a model request") and line 1108 ("executes and reports progress for codemode tools advertised in a model request")./home/byk/Code/opencode-v2-pilot/packages/core/test/session-title.test.ts registers a "session", "model.request" hook at line 276./home/byk/Code/opencode-v2-pilot/packages/core/test/session-runner.test.ts contains model-request-related matches at lines 564 (comment about pausing coordinated Session.resume at its first model request rather than a direct runner drain), 587 (comment that subscriptions must occur before resuming because model requests can arrive before retry backoff is scheduled), 1517 and 2405 (hooks.register("session", "model.request", ...)), 1770 (scenario "fails before the model request when the selected agent is unavailable"), 4267 (scenario "adds session correlation headers to model requests"), and 4280 (scenario "adds the parent session header to child model requests")./home/byk/Code/opencode-v2-pilot/packages/core/test/session-native-compaction.test.ts imports SessionModelRequest from @opencode/core/session/model-request at line 20 and registers "session", "model.request" hooks at lines 188 and 403./home/byk/Code/opencode-v2-pilot/packages/core/test/session-model-request.test.ts imports boundImages and unsupportedParts from @opencode/core/session/model-request at line 3./home/byk/Code/opencode-v2-pilot/packages/core/test/session-model-request-hooks.test.ts imports SessionModelRequest from @opencode/core/session/model-request at line 11./home/byk/Code/opencode-v2-pilot/packages/core/test/session-compaction.test.ts imports SessionModelRequest from @opencode/core/session/model-request at line 13./home/byk/Code/opencode-v2-pilot/packages/app/test-browser/websearch-request.test.ts checks input.model.request() at lines 120 and 126 (toBeUndefined()), line 137 (?.id equals consent.id), line 142 (toBeUndefined()), line 168 (?.id equals provider.id), and line 177 (toBeUndefined())./home/byk/Code/opencode-v2-pilot/packages/core/test/location-activity.test.ts has a line 26 comment explaining that the runner waits on a form instead of making a model request before asking a question./home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/provider-openai.test.ts imports SessionModelRequest from @opencode/core/session/model-request at line 20 and triggers "session", "model.request" at line 47./home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/provider-github-copilot.test.ts triggers "session", "model.request" at lines 50 and 230; line 226 names the test "ignores other providers' model requests"./home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/models-dev.test.ts has a line 723 test named "copies model request bodies without reinterpreting literal __proto__ keys"./home/byk/Code/opencode-v2-pilot/packages/core/test/config/compaction.test.ts imports SessionModelRequest from @opencode/core/session/model-request at line 12.