@agi-cli/server 0.1.80 → 0.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/index.ts +6 -2
- package/src/openapi/helpers.ts +64 -0
- package/src/openapi/paths/ask.ts +70 -0
- package/src/openapi/paths/config.ts +164 -0
- package/src/openapi/paths/files.ts +72 -0
- package/src/openapi/paths/git.ts +453 -0
- package/src/openapi/paths/messages.ts +92 -0
- package/src/openapi/paths/sessions.ts +90 -0
- package/src/openapi/paths/stream.ts +26 -0
- package/src/openapi/schemas.ts +293 -0
- package/src/openapi/spec.ts +17 -1142
- package/src/routes/config/agents.ts +44 -0
- package/src/routes/config/cwd.ts +21 -0
- package/src/routes/config/index.ts +14 -0
- package/src/routes/config/main.ts +68 -0
- package/src/routes/config/models.ts +109 -0
- package/src/routes/config/providers.ts +46 -0
- package/src/routes/config/utils.ts +107 -0
- package/src/routes/files.ts +218 -0
- package/src/routes/git/branch.ts +75 -0
- package/src/routes/git/commit.ts +159 -0
- package/src/routes/git/diff.ts +137 -0
- package/src/routes/git/index.ts +18 -0
- package/src/routes/git/push.ts +160 -0
- package/src/routes/git/schemas.ts +47 -0
- package/src/routes/git/staging.ts +208 -0
- package/src/routes/git/status.ts +76 -0
- package/src/routes/git/types.ts +19 -0
- package/src/routes/git/utils.ts +212 -0
- package/src/runtime/runner.ts +3 -6
- package/src/runtime/session-manager.ts +1 -1
- package/src/routes/config.ts +0 -387
- package/src/routes/git.ts +0 -980
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { providerIds } from '@agi-cli/sdk';
|
|
2
|
+
|
|
3
|
+
export const schemas = {
|
|
4
|
+
Provider: {
|
|
5
|
+
type: 'string',
|
|
6
|
+
enum: providerIds,
|
|
7
|
+
},
|
|
8
|
+
AskResponse: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
sessionId: { type: 'string' },
|
|
12
|
+
header: { $ref: '#/components/schemas/AskResponseHeader' },
|
|
13
|
+
provider: { $ref: '#/components/schemas/Provider' },
|
|
14
|
+
model: { type: 'string' },
|
|
15
|
+
agent: { type: 'string' },
|
|
16
|
+
assistantMessageId: { type: 'string' },
|
|
17
|
+
message: {
|
|
18
|
+
$ref: '#/components/schemas/AskResponseMessage',
|
|
19
|
+
nullable: true,
|
|
20
|
+
description:
|
|
21
|
+
'Present when the request created a new session or reused the last session for the project.',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: [
|
|
25
|
+
'sessionId',
|
|
26
|
+
'header',
|
|
27
|
+
'provider',
|
|
28
|
+
'model',
|
|
29
|
+
'agent',
|
|
30
|
+
'assistantMessageId',
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
AskResponseHeader: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
sessionId: { type: 'string' },
|
|
37
|
+
agent: { type: 'string', nullable: true },
|
|
38
|
+
provider: {
|
|
39
|
+
$ref: '#/components/schemas/Provider',
|
|
40
|
+
nullable: true,
|
|
41
|
+
},
|
|
42
|
+
model: { type: 'string', nullable: true },
|
|
43
|
+
},
|
|
44
|
+
required: ['sessionId'],
|
|
45
|
+
},
|
|
46
|
+
AskResponseMessage: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
kind: { type: 'string', enum: ['created', 'last'] },
|
|
50
|
+
sessionId: { type: 'string' },
|
|
51
|
+
},
|
|
52
|
+
required: ['kind', 'sessionId'],
|
|
53
|
+
},
|
|
54
|
+
Session: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
id: { type: 'string' },
|
|
58
|
+
title: { type: 'string', nullable: true },
|
|
59
|
+
agent: { type: 'string' },
|
|
60
|
+
provider: { $ref: '#/components/schemas/Provider' },
|
|
61
|
+
model: { type: 'string' },
|
|
62
|
+
projectPath: { type: 'string' },
|
|
63
|
+
createdAt: { type: 'integer', format: 'int64' },
|
|
64
|
+
lastActiveAt: { type: 'integer', format: 'int64', nullable: true },
|
|
65
|
+
totalInputTokens: { type: 'integer', nullable: true },
|
|
66
|
+
totalOutputTokens: { type: 'integer', nullable: true },
|
|
67
|
+
totalToolTimeMs: { type: 'integer', nullable: true },
|
|
68
|
+
toolCounts: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
additionalProperties: { type: 'integer' },
|
|
71
|
+
nullable: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ['id', 'agent', 'provider', 'model', 'projectPath', 'createdAt'],
|
|
75
|
+
},
|
|
76
|
+
Message: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
properties: {
|
|
79
|
+
id: { type: 'string' },
|
|
80
|
+
sessionId: { type: 'string' },
|
|
81
|
+
role: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
enum: ['system', 'user', 'assistant', 'tool'],
|
|
84
|
+
},
|
|
85
|
+
status: { type: 'string', enum: ['pending', 'complete', 'error'] },
|
|
86
|
+
agent: { type: 'string' },
|
|
87
|
+
provider: { $ref: '#/components/schemas/Provider' },
|
|
88
|
+
model: { type: 'string' },
|
|
89
|
+
createdAt: { type: 'integer', format: 'int64' },
|
|
90
|
+
completedAt: { type: 'integer', format: 'int64', nullable: true },
|
|
91
|
+
latencyMs: { type: 'integer', nullable: true },
|
|
92
|
+
promptTokens: { type: 'integer', nullable: true },
|
|
93
|
+
completionTokens: { type: 'integer', nullable: true },
|
|
94
|
+
totalTokens: { type: 'integer', nullable: true },
|
|
95
|
+
error: { type: 'string', nullable: true },
|
|
96
|
+
},
|
|
97
|
+
required: [
|
|
98
|
+
'id',
|
|
99
|
+
'sessionId',
|
|
100
|
+
'role',
|
|
101
|
+
'status',
|
|
102
|
+
'agent',
|
|
103
|
+
'provider',
|
|
104
|
+
'model',
|
|
105
|
+
'createdAt',
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
MessagePart: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
id: { type: 'string' },
|
|
112
|
+
messageId: { type: 'string' },
|
|
113
|
+
index: { type: 'integer', format: 'int64' },
|
|
114
|
+
type: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
enum: ['text', 'tool_call', 'tool_result', 'image', 'error'],
|
|
117
|
+
},
|
|
118
|
+
content: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
description:
|
|
121
|
+
'JSON-encoded content. For text: {"text": string}. For tool_call: {"name": string, "args": object}. For tool_result: {"name": string, "result"?: any, "artifact"?: Artifact}.',
|
|
122
|
+
},
|
|
123
|
+
agent: { type: 'string' },
|
|
124
|
+
provider: { $ref: '#/components/schemas/Provider' },
|
|
125
|
+
model: { type: 'string' },
|
|
126
|
+
startedAt: { type: 'integer', format: 'int64', nullable: true },
|
|
127
|
+
completedAt: { type: 'integer', format: 'int64', nullable: true },
|
|
128
|
+
toolName: { type: 'string', nullable: true },
|
|
129
|
+
toolCallId: { type: 'string', nullable: true },
|
|
130
|
+
toolDurationMs: { type: 'integer', nullable: true },
|
|
131
|
+
},
|
|
132
|
+
required: [
|
|
133
|
+
'id',
|
|
134
|
+
'messageId',
|
|
135
|
+
'index',
|
|
136
|
+
'type',
|
|
137
|
+
'content',
|
|
138
|
+
'agent',
|
|
139
|
+
'provider',
|
|
140
|
+
'model',
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
Artifact: {
|
|
144
|
+
oneOf: [
|
|
145
|
+
{ $ref: '#/components/schemas/FileDiffArtifact' },
|
|
146
|
+
{ $ref: '#/components/schemas/FileArtifact' },
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
FileDiffArtifact: {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: {
|
|
152
|
+
kind: { type: 'string', enum: ['file_diff'] },
|
|
153
|
+
patchFormat: { type: 'string', enum: ['unified'] },
|
|
154
|
+
patch: { type: 'string' },
|
|
155
|
+
summary: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
files: { type: 'integer' },
|
|
159
|
+
additions: { type: 'integer' },
|
|
160
|
+
deletions: { type: 'integer' },
|
|
161
|
+
},
|
|
162
|
+
additionalProperties: false,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
required: ['kind', 'patchFormat', 'patch'],
|
|
166
|
+
},
|
|
167
|
+
FileArtifact: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
properties: {
|
|
170
|
+
kind: { type: 'string', enum: ['file'] },
|
|
171
|
+
path: { type: 'string' },
|
|
172
|
+
mime: { type: 'string' },
|
|
173
|
+
size: { type: 'integer' },
|
|
174
|
+
sha256: { type: 'string' },
|
|
175
|
+
},
|
|
176
|
+
required: ['kind', 'path'],
|
|
177
|
+
},
|
|
178
|
+
Config: {
|
|
179
|
+
type: 'object',
|
|
180
|
+
properties: {
|
|
181
|
+
agents: {
|
|
182
|
+
type: 'array',
|
|
183
|
+
items: { type: 'string' },
|
|
184
|
+
},
|
|
185
|
+
providers: {
|
|
186
|
+
type: 'array',
|
|
187
|
+
items: { $ref: '#/components/schemas/Provider' },
|
|
188
|
+
},
|
|
189
|
+
defaults: {
|
|
190
|
+
type: 'object',
|
|
191
|
+
properties: {
|
|
192
|
+
agent: { type: 'string' },
|
|
193
|
+
provider: { $ref: '#/components/schemas/Provider' },
|
|
194
|
+
model: { type: 'string' },
|
|
195
|
+
},
|
|
196
|
+
required: ['agent', 'provider', 'model'],
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
required: ['agents', 'providers', 'defaults'],
|
|
200
|
+
},
|
|
201
|
+
Model: {
|
|
202
|
+
type: 'object',
|
|
203
|
+
properties: {
|
|
204
|
+
id: { type: 'string' },
|
|
205
|
+
label: { type: 'string' },
|
|
206
|
+
toolCall: { type: 'boolean' },
|
|
207
|
+
reasoning: { type: 'boolean' },
|
|
208
|
+
},
|
|
209
|
+
required: ['id', 'label'],
|
|
210
|
+
},
|
|
211
|
+
GitStatus: {
|
|
212
|
+
type: 'object',
|
|
213
|
+
properties: {
|
|
214
|
+
branch: { type: 'string' },
|
|
215
|
+
ahead: { type: 'integer' },
|
|
216
|
+
behind: { type: 'integer' },
|
|
217
|
+
staged: {
|
|
218
|
+
type: 'array',
|
|
219
|
+
items: { $ref: '#/components/schemas/GitFile' },
|
|
220
|
+
},
|
|
221
|
+
unstaged: {
|
|
222
|
+
type: 'array',
|
|
223
|
+
items: { $ref: '#/components/schemas/GitFile' },
|
|
224
|
+
},
|
|
225
|
+
untracked: {
|
|
226
|
+
type: 'array',
|
|
227
|
+
items: { $ref: '#/components/schemas/GitFile' },
|
|
228
|
+
},
|
|
229
|
+
hasChanges: { type: 'boolean' },
|
|
230
|
+
},
|
|
231
|
+
required: [
|
|
232
|
+
'branch',
|
|
233
|
+
'ahead',
|
|
234
|
+
'behind',
|
|
235
|
+
'staged',
|
|
236
|
+
'unstaged',
|
|
237
|
+
'untracked',
|
|
238
|
+
'hasChanges',
|
|
239
|
+
],
|
|
240
|
+
},
|
|
241
|
+
GitFile: {
|
|
242
|
+
type: 'object',
|
|
243
|
+
properties: {
|
|
244
|
+
path: { type: 'string' },
|
|
245
|
+
status: {
|
|
246
|
+
type: 'string',
|
|
247
|
+
enum: ['modified', 'added', 'deleted', 'renamed', 'untracked'],
|
|
248
|
+
},
|
|
249
|
+
staged: { type: 'boolean' },
|
|
250
|
+
insertions: { type: 'integer' },
|
|
251
|
+
deletions: { type: 'integer' },
|
|
252
|
+
oldPath: { type: 'string' },
|
|
253
|
+
},
|
|
254
|
+
required: ['path', 'status', 'staged'],
|
|
255
|
+
},
|
|
256
|
+
GitDiff: {
|
|
257
|
+
type: 'object',
|
|
258
|
+
properties: {
|
|
259
|
+
file: { type: 'string' },
|
|
260
|
+
diff: { type: 'string' },
|
|
261
|
+
insertions: { type: 'integer' },
|
|
262
|
+
deletions: { type: 'integer' },
|
|
263
|
+
language: { type: 'string' },
|
|
264
|
+
binary: { type: 'boolean' },
|
|
265
|
+
},
|
|
266
|
+
required: ['file', 'diff', 'insertions', 'deletions', 'language', 'binary'],
|
|
267
|
+
},
|
|
268
|
+
GitBranch: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
properties: {
|
|
271
|
+
current: { type: 'string' },
|
|
272
|
+
upstream: { type: 'string' },
|
|
273
|
+
ahead: { type: 'integer' },
|
|
274
|
+
behind: { type: 'integer' },
|
|
275
|
+
all: {
|
|
276
|
+
type: 'array',
|
|
277
|
+
items: { type: 'string' },
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
required: ['current', 'upstream', 'ahead', 'behind', 'all'],
|
|
281
|
+
},
|
|
282
|
+
GitCommit: {
|
|
283
|
+
type: 'object',
|
|
284
|
+
properties: {
|
|
285
|
+
hash: { type: 'string' },
|
|
286
|
+
message: { type: 'string' },
|
|
287
|
+
filesChanged: { type: 'integer' },
|
|
288
|
+
insertions: { type: 'integer' },
|
|
289
|
+
deletions: { type: 'integer' },
|
|
290
|
+
},
|
|
291
|
+
required: ['hash', 'message', 'filesChanged', 'insertions', 'deletions'],
|
|
292
|
+
},
|
|
293
|
+
} as const;
|