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 "errors"
6 "testing"
7
8 "amadan.net/oficina/equipo/internal/runner/provider"
9)
10
11func TestAssistLaunchCodex(t *testing.T) {
12 b := provider.Binding{Provider: "codex", CredentialHome: "/private/account", Home: "/private/run", RuntimeRoot: "/private/runtime"}
13 profile, err := provider.Profile("assist")
14 if err != nil {
15 t.Fatal(err)
16 }
17 in := provider.PolicyInputs{Action: "assist", Tools: profile.MCPTools(), DeniedPaths: []string{"/private/state"}}
18 if _, err := PolicyInputs(b, in, "gpt-6-astra"); err != nil {
19 t.Fatalf("assist refused: %v", err)
20 }
21 more := in
22 more.Tools = append(append([]string{}, in.Tools...), "mcp__equipo__record_task")
23 if _, err := PolicyInputs(b, more, "gpt-6-astra"); !errors.Is(err, provider.ErrPolicy) {
24 t.Fatalf("a seventh tool: %v", err)
25 }
26}
27
28// The Assistant answers a person who is waiting: each of its turns asks
29// for low reasoning effort on the connection's own model, and the team's
30// turns keep the model's default.
31func TestAssistLaunchCodexLowEffort(t *testing.T) {
32 b := provider.Binding{Provider: "codex", CredentialHome: "/private/account", Home: "/private/run", RuntimeRoot: "/private/runtime"}
33 turn := func(action string) map[string]any {
34 t.Helper()
35 profile, err := provider.Profile(action)
36 if err != nil {
37 t.Fatal(err)
38 }
39 in, err := PolicyInputs(b, provider.PolicyInputs{Action: action, Tools: profile.MCPTools(), DeniedPaths: []string{"/private/state"}}, "gpt-6-astra")
40 if err != nil {
41 t.Fatalf("%s: %v", action, err)
42 }
43 var thread struct{ Model string }
44 if json.Unmarshal(in.ThreadPolicy, &thread) != nil || thread.Model != "gpt-6-astra" {
45 t.Fatalf("%s thread %s", action, in.ThreadPolicy)
46 }
47 var params map[string]any
48 if err := json.Unmarshal(TurnParams(provider.Policy{TurnPolicy: in.TurnPolicy}, "th", "hello"), &params); err != nil {
49 t.Fatal(err)
50 }
51 return params
52 }
53 if got := turn("assist"); got["effort"] != "low" || got["threadId"] != "th" {
54 t.Fatalf("assist turn/start %v", got)
55 }
56 for _, action := range []string{"converse", "coordinate", "implement", "inspect"} {
57 if got, ok := turn(action)["effort"]; ok {
58 t.Fatalf("%s effort %v", action, got)
59 }
60 }
61}
62