Skip to content
Draft
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
503aff4
feat(proxy): add semantic policy routing
sozercan Jul 18, 2026
b44fa33
merge: resolve main conflicts
sozercan Jul 18, 2026
e68f807
fix(proxy): address policy routing review and lint
sozercan Jul 18, 2026
a8a5805
fix(proxy): address Codex policy review
sozercan Jul 18, 2026
f12fb3a
fix(proxy): narrow live policy validation
sozercan Jul 18, 2026
4c29c49
fix(proxy): sanitize policy routing failures
sozercan Jul 18, 2026
70a84da
fix(proxy): complete policy routing integration
sozercan Jul 18, 2026
bdec033
fix(proxy): protect policy telemetry secrets
sozercan Jul 18, 2026
4c4c817
fix(proxy): guard policy failure logging
sozercan Jul 18, 2026
7a1618e
fix(launch): enforce policy model compatibility
sozercan Jul 18, 2026
9a133b0
fix(launch): isolate policy model ownership
sozercan Jul 18, 2026
26880da
fix(launch): resolve scoped schema v3 models
sozercan Jul 18, 2026
b220591
fix(proxy): enforce policy parallel tool contract
sozercan Jul 18, 2026
d35e6ba
fix(proxy): keep policy preflight gate closed
sozercan Jul 18, 2026
b5525a5
fix(proxy): constrain policy quota headers
sozercan Jul 18, 2026
ccfea5c
fix(proxy): filter policy success headers
sozercan Jul 18, 2026
52cce89
fix(proxy): preserve replay key compatibility
sozercan Jul 18, 2026
c0396f1
fix(cli): clarify live policy preflight
sozercan Jul 18, 2026
984f461
fix(proxy): publish policy stats by public id
sozercan Jul 18, 2026
c1c798b
fix(proxy): harden semantic routing schema v2
sozercan Jul 19, 2026
8f58606
feat(dashboard): add live provider config editor
sozercan Jul 20, 2026
d196d20
fix(dashboard): address review and lint feedback
sozercan Jul 20, 2026
9b84f32
chore(ci): retrigger pull request checks
sozercan Jul 20, 2026
683d04b
fix(ci): remove obsolete compatibility wrappers
sozercan Jul 20, 2026
ee81598
fix(cli): restore standard help banner
sozercan Jul 20, 2026
748bdfa
fix(dashboard): align eligibility and host validation
sozercan Jul 20, 2026
d99fa28
fix(proxy): harden replay and host validation
sozercan Jul 20, 2026
372d787
ci: add live semantic policy routing smoke
sozercan Jul 20, 2026
e78f22a
Merge remote-tracking branch 'origin/classifiers' into ui
sozercan Jul 20, 2026
09cc363
fix(config): honor cancellation at persistence fence
sozercan Jul 20, 2026
6d624dc
fix(proxy): scope policy preflight to allowed models
sozercan Jul 20, 2026
7f4847b
fix(menubar): make proxy startup cancellable
sozercan Jul 20, 2026
b4e40f2
fix(ci): remove obsolete routing helpers
sozercan Jul 20, 2026
96597d7
fix(menubar): keep auth actions disabled during startup
sozercan Jul 20, 2026
c8bc03a
docs: clarify scoped launcher preflight
sozercan Jul 20, 2026
611cbef
docs(menubar): clarify startup controls
sozercan Jul 20, 2026
03b4926
fix(proxy): preserve request identity fences
sozercan Jul 20, 2026
ed5a691
chore(ci): run final pull request checks
sozercan Jul 20, 2026
34706c7
chore: merge latest classifier base
sozercan Jul 20, 2026
7fea286
fix(menubar): handle proxy stop result
sozercan Jul 20, 2026
733b6b5
ci: run semantic routing against Copilot models
sozercan Jul 20, 2026
0a20735
fix(ci): honor classifier retention mode in shim
sozercan Jul 20, 2026
f794da9
fix(ci): use a low-latency Copilot classifier
sozercan Jul 20, 2026
5570a1a
feat(dashboard): import YAML configurations
sozercan Jul 20, 2026
e910eb4
chore: merge latest classifier CI updates
sozercan Jul 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ jobs:
- name: Test Windows launcher lifecycle
run: go test . ./launch -count=1

- name: Test Windows managed config store
run: go test ./proxy -run 'ManagedProvidersConfig|ProvidersConfigSource|ProvidersConfigJSON' -count=1

darwin-launch:
runs-on: macos-latest
timeout-minutes: 15
Expand All @@ -90,6 +93,9 @@ jobs:
- name: Test Darwin launcher lifecycle
run: go test . ./launch -count=1

- name: Test Darwin managed config store
run: go test ./proxy -run 'ManagedProvidersConfig|ProvidersConfigSource|ProvidersConfigJSON' -count=1

build:
runs-on: ubuntu-latest
timeout-minutes: 15
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Vekil.app/
providers.json
providers.yaml
providers.yml
/provider-v3.yaml
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SPARKLE_DOWNLOAD_URL := https://github.com/sparkle-project/Sparkle/releases/down
SPARKLE_FEED_URL ?= https://github.com/sozercan/vekil/releases/latest/download/appcast.xml
SPARKLE_PUBLIC_ED_KEY ?=

.PHONY: build build-app build-tray-linux test-app test compaction-lab vet lint clean docker-build docker-build-rtk docker-rtk-e2e
.PHONY: build build-app build-tray-linux test-app test test-frontend compaction-lab vet lint clean docker-build docker-build-rtk docker-rtk-e2e

build:
go build -ldflags="$(LDFLAGS)" -o $(BINARY) .
Expand Down Expand Up @@ -96,9 +96,13 @@ build-tray-linux:
CGO_ENABLED=0 GOOS=linux \
go build -ldflags="$(LDFLAGS) -X main.buildVersion=$(APP_VERSION)" -o $(TRAY_LINUX_BINARY) ./cmd/menubar/

test:
test: test-frontend
go test ./... -count=1

test-frontend:
node --check proxy/dashboard/config.js
node --test proxy/dashboard/config.test.mjs

compaction-lab:
go run ./cmd/compaction-lab

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Use your GitHub Copilot subscription with Claude Code, point the Codex CLI at Az
- **Anthropic Messages API** — drop-in compatible with Claude clients
- **Gemini API** — Generate Content, Stream Generate Content, and Count Tokens
- **OpenAI Chat Completions** and **Responses** APIs, including optional Codex websocket bridging
- **Multi-provider routing** across GitHub Copilot, Azure OpenAI, OpenAI Codex, and generic compatible providers; schema-v2 ordered failover is available for supported static Azure/generic targets
- **Multi-provider routing** across GitHub Copilot, Azure OpenAI, OpenAI Codex, and generic compatible providers; schema v2 provides explicit routes, ordered failover, internal routes, and semantic policy routing
- **Optional tool optimizers** for opt-in shell command rewrites and tool-output reduction across supported API surfaces; see [Tool Optimizers](docs/tool-optimizers.md)
- **Codex compatibility shims** for compaction and memory summarization
- **Streaming**, tool use, parallel tool calls, compressed request bodies, and auth/token caching
Expand All @@ -50,6 +50,8 @@ brew install --cask sozercan/repo/vekil

For explicit provider routing, start the proxy with `--providers-config /path/to/providers.{json,yaml}`.

Schema-v2 policy routing defaults globally to `off`. V1 policy profiles support only text/function-tool `POST /v1/chat/completions` requests and one trusted user/tenant per deployment; see [Semantic Policy Routing](docs/policy-routing.md) before enabling `observe` or `enforce`.

### Launch a coding agent

The native binary can start a loopback-only proxy, validate one selected model,
Expand Down Expand Up @@ -97,6 +99,7 @@ Documentation lives under [`docs/`](docs/README.md); start with these:
| [Getting Started](docs/getting-started.md) | Install, run, first auth |
| [Configuration](docs/configuration.md) | Config map and generic flags |
| [Provider Routing](docs/provider-routing.md) | Provider auth and route failover |
| [Semantic Policy Routing](docs/policy-routing.md) | Schema-v2 policy selection and gates |
| [Provider API Keys](docs/provider-api-keys.md) | Where to get provider keys |
| [Tool Optimizers](docs/tool-optimizers.md) | Shell rewrite/output reduction |
| [Responses WebSocket](docs/responses-websocket.md) | Websocket bridge tuning |
Expand All @@ -105,6 +108,7 @@ Documentation lives under [`docs/`](docs/README.md); start with these:
| [API Reference](docs/api.md) | Endpoint behavior and compatibility |
| [Architecture](docs/architecture.md) | Package layout and design notes |
| [Traffic Dashboard](docs/dashboard.md) | Live browser dashboard and stats |
| [Dashboard Configuration](docs/dashboard-config.md) | Local provider/route/policy editor |
| [Tray App](docs/menubar.md) | macOS/Linux menubar usage |
| [Development](docs/development.md) | Build, test, benchmarks, CI |

Expand Down
99 changes: 94 additions & 5 deletions cmd/menubar/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ type menubarConfig struct {
ProvidersConfigPath string `json:"providers_config_path,omitempty"`
}

type providersConfigStartup struct {
Resolved proxy.ResolvedProvidersConfig
Store *proxy.ManagedProvidersConfigStore
ReadOnlyReason error
}

func menubarConfigPath() (string, error) {
dir, err := userConfigDir()
if err != nil {
Expand Down Expand Up @@ -85,18 +91,101 @@ func saveMenubarConfig(cfg menubarConfig) error {
return nil
}

func loadProvidersConfigForMenubar() (menubarConfig, proxy.ProvidersConfig, error) {
func loadProvidersConfigForMenubar() (menubarConfig, providersConfigStartup, error) {
cfg, err := loadMenubarConfig()
if err != nil {
return menubarConfig{}, proxy.ProvidersConfig{}, fmt.Errorf("%w: %w", errMenubarConfigLoad, err)
return menubarConfig{}, providersConfigStartup{}, fmt.Errorf("%w: %w", errMenubarConfigLoad, err)
}

providersCfg, err := proxy.LoadProvidersConfigFile(cfg.ProvidersConfigPath)
providers, err := resolveMenubarProvidersConfig(cfg, proxy.ProvidersConfigUseManaged)
if err != nil {
return cfg, proxy.ProvidersConfig{}, fmt.Errorf("%w: %w", errProvidersConfigLoad, err)
return cfg, providersConfigStartup{}, fmt.Errorf("%w: %w", errProvidersConfigLoad, err)
}

return cfg, providers, nil
}

func resolveMenubarProvidersConfig(cfg menubarConfig, mode proxy.ProvidersConfigResolveMode) (providersConfigStartup, error) {
return resolveProvidersConfigForStartup(cfg.ProvidersConfigPath, mode, userConfigDir, probeManagedProvidersConfigWritable)
}

func resolveProvidersConfigForStartup(
bootstrapPath string,
mode proxy.ProvidersConfigResolveMode,
getUserConfigDir func() (string, error),
probeWritable func(string) error,
) (providersConfigStartup, error) {
if getUserConfigDir == nil {
getUserConfigDir = os.UserConfigDir
}
if probeWritable == nil {
probeWritable = probeManagedProvidersConfigWritable
}
if mode == "" {
mode = proxy.ProvidersConfigUseManaged
}

configDir, err := getUserConfigDir()
if err != nil {
if mode == proxy.ProvidersConfigResetManaged {
return providersConfigStartup{}, fmt.Errorf("reset managed providers config: resolve user config directory: %w", err)
}
resolved, bootstrapErr := resolveReadOnlyProvidersConfigBootstrap(bootstrapPath)
if bootstrapErr != nil {
return providersConfigStartup{}, bootstrapErr
}
return providersConfigStartup{
Resolved: resolved,
ReadOnlyReason: fmt.Errorf("resolve managed providers config directory: %w", err),
}, nil
}

return cfg, providersCfg, nil
resolved, err := proxy.ResolveProvidersConfig(proxy.ProvidersConfigResolveOptions{
BootstrapPath: bootstrapPath,
UserConfigDir: configDir,
Mode: mode,
})
if err != nil {
return providersConfigStartup{}, err
}

startup := providersConfigStartup{Resolved: resolved}
store, err := proxy.NewManagedProvidersConfigStore(resolved.Bootstrap)
if err != nil {
var configErr *proxy.ConfigError
if errors.As(err, &configErr) && configErr.Code == proxy.ConfigErrorManagedStore {
startup.ReadOnlyReason = err
return startup, nil
}
return providersConfigStartup{}, err
}
if mode == proxy.ProvidersConfigIgnoreManaged {
startup.ReadOnlyReason = errors.New("managed providers config override is ignored for this startup")
return startup, nil
}
if err := probeWritable(store.Path()); err != nil {
startup.ReadOnlyReason = fmt.Errorf("managed providers config persistence is unavailable: %w", err)
return startup, nil
}
startup.Store = store
return startup, nil
}

func resolveReadOnlyProvidersConfigBootstrap(bootstrapPath string) (proxy.ResolvedProvidersConfig, error) {
resolved, err := proxy.ResolveProvidersConfig(proxy.ProvidersConfigResolveOptions{
BootstrapPath: bootstrapPath,
UserConfigDir: filepath.Join(os.TempDir(), "vekil-read-only-dashboard-config"),
Mode: proxy.ProvidersConfigIgnoreManaged,
})
if err != nil {
return proxy.ResolvedProvidersConfig{}, err
}
resolved.Bootstrap.Source.ManagedPath = ""
return resolved, nil
}

func probeManagedProvidersConfigWritable(path string) error {
return proxy.ProbeManagedProvidersConfigWritable(path)
}

func isMenubarConfigLoadError(err error) bool {
Expand Down
Loading