mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-19 01:27:34 +00:00
feat: URL-derived provider keys (hs-<hostname>) + dedup providers sharing same gateway URL
- GatewayProviderKey() derives stable key from gateway URL hostname e.g. https://llmgw.h.raczylo.com/v1 → hs-llmgw-h-raczylo-com - AbsorbDuplicateProviders() merges providers sharing the same baseURL into our canonical entry; user-crafted model metadata wins for overlaps - kilo: renders to opencode.jsonc (primary config), deep-merges providers, deletes enabled_providers filter that was hiding our gateway - opencode: absorbs duplicate providers from existing config - All adapters use GatewayProviderKey() instead of hardcoded string - Fix goose URL doubling (was /v1/v1/chat/completions → /chat/completions) - Fix token propagation: api_key written directly (not env var ref) - Zed: adds prompt_cache_key capability, deletes context_servers key to avoid ContextServerSettingsContent serde untagged-enum parse error
This commit is contained in:
@@ -91,7 +91,7 @@ func TestGooseRenderGatewayURL(t *testing.T) {
|
||||
var parsed map[string]any
|
||||
require.NoError(t, yaml.Unmarshal(seen[cfgDest].Content, &parsed))
|
||||
// Custom gateway → GOOSE_PROVIDER is the custom provider name.
|
||||
assert.Equal(t, "custom_harness-sync-gateway", parsed["GOOSE_PROVIDER"])
|
||||
assert.Equal(t, "custom_hs-gw", parsed["GOOSE_PROVIDER"])
|
||||
}
|
||||
|
||||
func TestGooseRenderProducesCustomProviderFile(t *testing.T) {
|
||||
@@ -109,13 +109,13 @@ func TestGooseRenderProducesCustomProviderFile(t *testing.T) {
|
||||
seen := map[string]adapter.File{}
|
||||
fs.ForEach(func(f adapter.File) { seen[f.Dest] = f })
|
||||
|
||||
cpDest := filepath.Join(home, ".config", "goose", "custom_providers", "custom_harness-sync-gateway.json")
|
||||
cpDest := filepath.Join(home, ".config", "goose", "custom_providers", "custom_hs-gw.json")
|
||||
require.Contains(t, seen, cpDest)
|
||||
assert.Equal(t, adapter.RenderedFile, seen[cpDest].Kind)
|
||||
|
||||
var cp map[string]any
|
||||
require.NoError(t, json.Unmarshal(seen[cpDest].Content, &cp))
|
||||
assert.Equal(t, "custom_harness-sync-gateway", cp["name"])
|
||||
assert.Equal(t, "custom_hs-gw", cp["name"])
|
||||
assert.Equal(t, "openai", cp["engine"])
|
||||
assert.Equal(t, "tok", cp["api_key"])
|
||||
assert.NotContains(t, cp, "api_key_env")
|
||||
|
||||
Reference in New Issue
Block a user