forked from docker/docker-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
179 lines (151 loc) · 5.79 KB
/
types.go
File metadata and controls
179 lines (151 loc) · 5.79 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
package api
import (
"time"
"github.com/docker/docker-agent/pkg/chat"
"github.com/docker/docker-agent/pkg/config/latest"
"github.com/docker/docker-agent/pkg/session"
)
type Message struct {
Role chat.MessageRole `json:"role"`
Content string `json:"content"`
MultiContent []chat.MessagePart `json:"multi_content,omitempty"`
}
// Agent represents an agent in the API
type Agent struct {
Name string `json:"name"`
Description string `json:"description"`
Multi bool `json:"multi"`
}
// CreateAgentRequest represents a request to create an agent
type CreateAgentRequest struct {
Prompt string `json:"prompt"`
}
// CreateAgentResponse represents the response from creating an agent
type CreateAgentResponse struct {
Path string `json:"path"`
Out string `json:"out"`
}
// CreateAgentConfigRequest represents a request to create an agent manually
type CreateAgentConfigRequest struct {
Filename string `json:"filename"`
Model string `json:"model"`
Description string `json:"description"`
Instruction string `json:"instruction"`
}
// CreateAgentConfigResponse represents the response from creating an agent config
type CreateAgentConfigResponse struct {
Filepath string `json:"filepath"`
}
// EditAgentConfigRequest represents a request to edit an agent config
type EditAgentConfigRequest struct {
AgentConfig latest.Config `json:"agent_config"`
Filename string `json:"filename"`
}
// EditAgentConfigResponse represents the response from editing an agent config
type EditAgentConfigResponse struct {
Message string `json:"message"`
Path string `json:"path"`
Config any `json:"config"`
}
// ImportAgentRequest represents a request to import an agent
type ImportAgentRequest struct {
FilePath string `json:"file_path"`
}
// ImportAgentResponse represents the response from importing an agent
type ImportAgentResponse struct {
OriginalPath string `json:"originalPath"`
TargetPath string `json:"targetPath"`
Description string `json:"description"`
}
// ExportAgentsResponse represents the response from exporting agents
type ExportAgentsResponse struct {
ZipPath string `json:"zipPath"`
ZipFile string `json:"zipFile"`
ZipDirectory string `json:"zipDirectory"`
AgentsDir string `json:"agentsDir"`
CreatedAt string `json:"createdAt"`
}
// PullAgentRequest represents a request to pull an agent
type PullAgentRequest struct {
Name string `json:"name"`
}
// PullAgentResponse represents the response from pulling an agent
type PullAgentResponse struct {
Name string `json:"name"`
Description string `json:"description"`
}
// PushAgentRequest represents a request to push an agent
type PushAgentRequest struct {
Filepath string `json:"filepath"`
Tag string `json:"tag"`
}
// PushAgentResponse represents the response from pushing an agent
type PushAgentResponse struct {
Filepath string `json:"filepath"`
Tag string `json:"tag"`
Digest string `json:"digest"`
}
// DeleteAgentRequest represents a request to delete an agent
type DeleteAgentRequest struct {
FilePath string `json:"file_path"`
}
// DeleteAgentResponse represents the response from deleting an agent
type DeleteAgentResponse struct {
FilePath string `json:"filePath"`
}
// SessionsResponse represents a session in the sessions list
type SessionsResponse struct {
ID string `json:"id"`
Title string `json:"title"`
CreatedAt string `json:"created_at"`
NumMessages int `json:"num_messages"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
WorkingDir string `json:"working_dir,omitempty"`
}
// SessionResponse represents a detailed session
type SessionResponse struct {
ID string `json:"id"`
Title string `json:"title"`
Messages []session.Message `json:"messages,omitempty"`
CreatedAt time.Time `json:"created_at"`
ToolsApproved bool `json:"tools_approved"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
WorkingDir string `json:"working_dir,omitempty"`
Permissions *session.PermissionsConfig `json:"permissions,omitempty"`
}
// UpdateSessionPermissionsRequest represents a request to update session permissions.
type UpdateSessionPermissionsRequest struct {
Permissions *session.PermissionsConfig `json:"permissions"`
}
// ResumeSessionRequest represents a request to resume a session
type ResumeSessionRequest struct {
Confirmation string `json:"confirmation"`
Reason string `json:"reason,omitempty"` // e.g reason for tool call rejection
ToolName string `json:"tool_name,omitempty"` // tool name for approve-tool confirmation
}
// DesktopTokenResponse represents the response from getting a desktop token
type DesktopTokenResponse struct {
Token string `json:"token"`
}
// ResumeElicitationRequest represents a request to resume with an elicitation response
type ResumeElicitationRequest struct {
Action string `json:"action"` // "accept", "decline", or "cancel"
Content map[string]any `json:"content"` // The submitted form data (only present when action is "accept")
}
// SteerSessionRequest represents a request to inject user messages into a
// running agent session. The messages are picked up by the agent loop between
// tool execution and the next LLM call.
type SteerSessionRequest struct {
Messages []Message `json:"messages"`
}
// UpdateSessionTitleRequest represents a request to update a session's title
type UpdateSessionTitleRequest struct {
Title string `json:"title"`
}
// UpdateSessionTitleResponse represents the response from updating a session's title
type UpdateSessionTitleResponse struct {
ID string `json:"id"`
Title string `json:"title"`
}