@@ -13,7 +13,6 @@ import { Bus } from "@opencode/core/bus"
1313import { Config } from "@opencode/core/config"
1414import { ConfigIntegration } from "@opencode/core/config/integration"
1515import { ConfigPolicyPlugin } from "@opencode/core/config/plugin/policy"
16- import { ConfigManaged } from "@opencode/core/config/managed"
1716import { ConfigProviderPlugin } from "@opencode/core/config/plugin/provider"
1817import { ConfigWebSearchPlugin } from "@opencode/core/config/plugin/websearch"
1918import { Credential } from "@opencode/core/credential"
@@ -1901,7 +1900,7 @@ describe("OpencodePlugin with a Console config", () => {
19011900 ) ,
19021901 )
19031902
1904- it . live ( "keeps Console providers out of user and project config's reach , bound to the Console connection" , ( ) =>
1903+ it . live ( "layers Console providers below user config, bound to the Console connection" , ( ) =>
19051904 Effect . acquireUseRelease (
19061905 Effect . sync ( ( ) =>
19071906 Bun . serve ( {
@@ -1930,23 +1929,17 @@ describe("OpencodePlugin with a Console config", () => {
19301929 const providers = yield * Provider . Service
19311930 const models = yield * Model . Service
19321931 const config = yield * Config . Test
1933- const overlay = {
1934- name : "Mine" ,
1935- settings : { apiKey : "my-key" , baseURL : "https://mine.example/v1" } ,
1936- headers : { "x-org-id" : "mine" } ,
1937- models : { chat : { name : "My Chat" } , mine : { name : "My Model" } } ,
1938- }
19391932 yield * config . setEntries ( [
1940- new ConfigManaged . Document ( {
1941- type : "document" ,
1942- info : Schema . decodeUnknownSync ( Info ) ( { providers : { remote : { headers : { "x-managed" : "true" } } } } ) ,
1943- } ) ,
19441933 new Document ( {
19451934 type : "document" ,
19461935 info : Schema . decodeUnknownSync ( Info ) ( {
19471936 providers : {
1948- remote : overlay ,
1949- normal : { ...overlay , package : "aisdk:@ai-sdk/openai-compatible" } ,
1937+ remote : {
1938+ name : "Mine" ,
1939+ settings : { apiKey : "my-key" } ,
1940+ headers : { "x-org-id" : "mine" } ,
1941+ models : { chat : { name : "My Chat" } } ,
1942+ } ,
19501943 } ,
19511944 } ) ,
19521945 } ) ,
@@ -1959,26 +1952,22 @@ describe("OpencodePlugin with a Console config", () => {
19591952 yield * OpencodePlugin . effect ( host )
19601953 yield * ConfigProviderPlugin . Plugin . effect ( host )
19611954
1962- // Managed configuration may still shape a Console provider; a project or user file cannot.
19631955 const provider = required ( yield * providers . get ( Provider . ID . make ( "remote" ) ) )
1964- expect ( provider . name ) . toBe ( "Console " )
1956+ expect ( provider . name ) . toBe ( "Mine " )
19651957 expect ( provider . integrationID ) . toBe ( Integration . ID . make ( "opencode" ) )
1966- expect ( provider . headers ) . toEqual ( { "x-org-id" : "console " , "x-console" : "true" , "x-managed " : "true" } )
1958+ expect ( provider . headers ) . toEqual ( { "x-org-id" : "mine " , "x-console" : "true" } )
19671959 expect ( provider . settings ) . toEqual ( {
19681960 baseURL : `${ server . url . origin } /v1` ,
19691961 custom : "console" ,
1962+ apiKey : "my-key" ,
19701963 provider : "remote" ,
19711964 } )
19721965 const chat = required ( yield * models . get ( Provider . ID . make ( "remote" ) , Model . ID . make ( "chat" ) ) )
1973- expect ( chat . name ) . toBe ( "Console Chat" )
1966+ expect ( chat . name ) . toBe ( "My Chat" )
19741967 expect ( chat . settings ) . toMatchObject ( { temperature : 0.1 } )
1975- expect ( yield * models . get ( Provider . ID . make ( "remote" ) , Model . ID . make ( "mine" ) ) ) . toBeUndefined ( )
1976-
1977- // Providers the Console does not supply stay overridable.
1978- const normal = required ( yield * providers . get ( Provider . ID . make ( "normal" ) ) )
1979- expect ( normal . headers ) . toEqual ( { "x-org-id" : "mine" } )
1980- expect ( normal . settings ) . toMatchObject ( { baseURL : "https://mine.example/v1" , apiKey : "my-key" } )
1981- expect ( required ( yield * models . get ( Provider . ID . make ( "normal" ) , Model . ID . make ( "chat" ) ) ) . name ) . toBe ( "My Chat" )
1968+ expect ( required ( yield * models . get ( Provider . ID . make ( "remote" ) , Model . ID . make ( "other" ) ) ) . name ) . toBe (
1969+ "Console Other" ,
1970+ )
19821971 } ) ,
19831972 ( server ) => Effect . promise ( ( ) => server . stop ( true ) ) ,
19841973 ) ,
0 commit comments