-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrequest.go
More file actions
140 lines (99 loc) · 3.88 KB
/
Copy pathrequest.go
File metadata and controls
140 lines (99 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package codexcw
import "io"
// SandboxMode controls the sandbox policy passed to codex exec.
type SandboxMode string
const (
// SandboxReadOnly lets Codex inspect files without write access.
SandboxReadOnly SandboxMode = "read-only"
// SandboxWorkspaceWrite lets Codex write inside the configured workspace.
SandboxWorkspaceWrite SandboxMode = "workspace-write"
// SandboxDangerFullAccess removes Codex sandbox filesystem restrictions.
SandboxDangerFullAccess SandboxMode = "danger-full-access"
)
// ApprovalPolicy controls Codex approval behavior through config overrides.
type ApprovalPolicy string
const (
// ApprovalUntrusted asks before commands outside Codex's trusted set.
ApprovalUntrusted ApprovalPolicy = "untrusted"
// ApprovalOnRequest lets Codex work in the sandbox and request approval.
ApprovalOnRequest ApprovalPolicy = "on-request"
// ApprovalNever prevents interactive approval prompts.
ApprovalNever ApprovalPolicy = "never"
)
// ConfigOverride is passed as one -c key=value override.
type ConfigOverride struct {
// Key is the config path before the equals sign.
Key string
// Value is the config value after the equals sign.
Value string
}
// String returns the exact key=value argument expected by codex -c.
func (c ConfigOverride) String() string {
if c.Key == "" {
return c.Value
}
return c.Key + "=" + c.Value
}
// Request describes one selected-agent invocation.
type Request struct {
// Prompt is the user instruction sent to the selected agent.
Prompt string
// Stdin is additional prompt input when Prompt is empty or extra context
// when Prompt is set.
Stdin io.Reader
// Dir is passed to codex exec as --cd.
Dir string
// AddDirs grants the selected agent access to additional directories.
AddDirs []string
// Images are attached to the initial Codex prompt.
Images []string
// Model overrides the selected agent's model for this run.
Model string
// Profile selects a Codex config profile.
Profile string
// Sandbox controls the Codex sandbox policy (codex agent only).
Sandbox SandboxMode
// Approval controls the Codex approval policy through -c (codex agent only).
Approval ApprovalPolicy
// PermissionMode controls the Claude permission mode (claude agent only).
PermissionMode PermissionMode
// AllowedTools lists tool patterns Claude may use without prompting
// (claude agent only).
AllowedTools []string
// DisallowedTools lists tool patterns denied to Claude (claude agent only).
DisallowedTools []string
// Config contains raw Codex -c config overrides.
Config []ConfigOverride
// Enable contains feature flags passed with --enable.
Enable []string
// Disable contains feature flags passed with --disable.
Disable []string
// StrictConfig makes Codex reject unrecognized config fields.
StrictConfig bool
// Persistent keeps the selected agent's session data on disk.
Persistent bool
// IgnoreUserConfig skips CODEX_HOME/config.toml.
IgnoreUserConfig bool
// IgnoreRules skips user and project execpolicy .rules files.
IgnoreRules bool
// RequireGitRepo lets Codex enforce its Git repository check.
RequireGitRepo bool
// OutputSchemaPath points to a JSON Schema file for the final response.
OutputSchemaPath string
// OutputSchema is written to a temporary JSON Schema file for the run.
OutputSchema []byte
// OutputLastMessagePath asks Codex to write the final message to a file.
OutputLastMessagePath string
// DangerouslyBypassSandbox passes Codex's full bypass flag.
DangerouslyBypassSandbox bool
// DangerouslyBypassHooks runs enabled hooks without persisted trust.
DangerouslyBypassHooks bool
// Env appends environment variables for the selected agent process.
Env []string
// ResumeID resumes a specific agent session or thread id.
ResumeID string
// ResumeLast resumes the selected agent's most recent session.
ResumeLast bool
// ResumeAll disables Codex's cwd filtering while resuming.
ResumeAll bool
}