-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcodex.go
More file actions
42 lines (37 loc) · 1.04 KB
/
codex.go
File metadata and controls
42 lines (37 loc) · 1.04 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
package codex
// Codex is the main entry point for interacting with the Codex CLI.
type Codex struct {
exec *CodexExec
options CodexOptions
}
// New constructs a Codex client.
func New(options ...CodexOptions) *Codex {
var resolved CodexOptions
if len(options) > 0 {
resolved = options[0]
}
return &Codex{
exec: NewCodexExec(resolved.CodexPathOverride, resolved.Env, resolved.Config),
options: resolved,
}
}
// NewCodex is an alias for New.
func NewCodex(options ...CodexOptions) *Codex {
return New(options...)
}
// StartThread starts a new conversation with the agent.
func (c *Codex) StartThread(options ...ThreadOptions) *Thread {
var resolved ThreadOptions
if len(options) > 0 {
resolved = options[0]
}
return newThread(c.exec, c.options, resolved, "")
}
// ResumeThread resumes a previous conversation by thread ID.
func (c *Codex) ResumeThread(id string, options ...ThreadOptions) *Thread {
var resolved ThreadOptions
if len(options) > 0 {
resolved = options[0]
}
return newThread(c.exec, c.options, resolved, id)
}