oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package codex
2
3import (
4 "encoding/json"
5
6 "amadan.net/oficina/equipo/internal/runner/provider"
7)
8
9func effectiveConfigMatches(p provider.Policy, got map[string]json.RawMessage) bool {
10 if configSubset(p.Settings, marshal(got)) {
11 return true
12 }
13 var m struct{ ProviderVersion string }
14 if json.Unmarshal(p.Manifest, &m) != nil || m.ProviderVersion != Version {
15 return false
16 }
17 var want map[string]json.RawMessage
18 if json.Unmarshal(p.Settings, &want) != nil {
19 return false
20 }
21 // 0.165.0 keeps disabled tool flags in the session layer but omits
22 // them from typed effective config; this is not proof they are disabled.
23 // Live inventories must also prove absence. validateConfig separately
24 // requires an unchanged command-line layer.
25 var tools, effective map[string]json.RawMessage
26 keys := []string{"experimental_request_user_input"}
27 if p.Coordinator() || p.Research() || p.Glance() {
28 keys = append(keys, "update_plan")
29 }
30 if json.Unmarshal(want["tools"], &tools) != nil || len(tools) != len(keys) || json.Unmarshal(got["tools"], &effective) != nil {
31 return false
32 }
33 if len(effective) != 1 || !sameJSON(effective["web_search"], []byte(`null`)) {
34 return false
35 }
36 for _, key := range keys {
37 if !sameJSON(tools[key], []byte(`{"enabled":false}`)) {
38 return false
39 }
40 }
41 delete(want, "tools")
42 return configSubset(marshal(want), marshal(got))
43}
44
45// The pinned CLI discovers this disabled layer lazily after thread/start.
46func disabledEmptyProject(name, config []byte, reason string) bool {
47 return sameJSON(name, []byte(`{"type":"project","dotCodexFolder":"/workspace/.codex"}`)) && sameJSON(config, []byte(`{}`)) && reason == "To load project-local config, hooks, and exec policies, add /workspace as a trusted project in /home/runner/config.toml."
48}
49