@agi-cli/server 0.1.80 → 0.1.81
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 +4 -0
- 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 +349 -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/files.ts +160 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { gitErrorResponse, projectQueryParam } from '../helpers';
|
|
2
|
+
|
|
3
|
+
export const gitPaths = {
|
|
4
|
+
'/v1/git/status': {
|
|
5
|
+
get: {
|
|
6
|
+
tags: ['git'],
|
|
7
|
+
operationId: 'getGitStatus',
|
|
8
|
+
summary: 'Get git status',
|
|
9
|
+
description:
|
|
10
|
+
'Returns current git status including staged, unstaged, and untracked files',
|
|
11
|
+
parameters: [projectQueryParam()],
|
|
12
|
+
responses: {
|
|
13
|
+
200: {
|
|
14
|
+
description: 'OK',
|
|
15
|
+
content: {
|
|
16
|
+
'application/json': {
|
|
17
|
+
schema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
status: { type: 'string', enum: ['ok'] },
|
|
21
|
+
data: { $ref: '#/components/schemas/GitStatus' },
|
|
22
|
+
},
|
|
23
|
+
required: ['status', 'data'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
400: gitErrorResponse(),
|
|
29
|
+
500: gitErrorResponse(),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
'/v1/git/diff': {
|
|
34
|
+
get: {
|
|
35
|
+
tags: ['git'],
|
|
36
|
+
operationId: 'getGitDiff',
|
|
37
|
+
summary: 'Get git diff for a file',
|
|
38
|
+
parameters: [
|
|
39
|
+
projectQueryParam(),
|
|
40
|
+
{
|
|
41
|
+
in: 'query',
|
|
42
|
+
name: 'file',
|
|
43
|
+
required: true,
|
|
44
|
+
schema: { type: 'string' },
|
|
45
|
+
description: 'File path to get diff for',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
in: 'query',
|
|
49
|
+
name: 'staged',
|
|
50
|
+
required: false,
|
|
51
|
+
schema: { type: 'string', enum: ['true', 'false'] },
|
|
52
|
+
description: 'Show staged diff (default: unstaged)',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
responses: {
|
|
56
|
+
200: {
|
|
57
|
+
description: 'OK',
|
|
58
|
+
content: {
|
|
59
|
+
'application/json': {
|
|
60
|
+
schema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
status: { type: 'string', enum: ['ok'] },
|
|
64
|
+
data: { $ref: '#/components/schemas/GitDiff' },
|
|
65
|
+
},
|
|
66
|
+
required: ['status', 'data'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
400: gitErrorResponse(),
|
|
72
|
+
500: gitErrorResponse(),
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
'/v1/git/branch': {
|
|
77
|
+
get: {
|
|
78
|
+
tags: ['git'],
|
|
79
|
+
operationId: 'getGitBranch',
|
|
80
|
+
summary: 'Get git branch information',
|
|
81
|
+
parameters: [projectQueryParam()],
|
|
82
|
+
responses: {
|
|
83
|
+
200: {
|
|
84
|
+
description: 'OK',
|
|
85
|
+
content: {
|
|
86
|
+
'application/json': {
|
|
87
|
+
schema: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
status: { type: 'string', enum: ['ok'] },
|
|
91
|
+
data: { $ref: '#/components/schemas/GitBranch' },
|
|
92
|
+
},
|
|
93
|
+
required: ['status', 'data'],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
400: gitErrorResponse(),
|
|
99
|
+
500: gitErrorResponse(),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
'/v1/git/stage': {
|
|
104
|
+
post: {
|
|
105
|
+
tags: ['git'],
|
|
106
|
+
operationId: 'stageFiles',
|
|
107
|
+
summary: 'Stage files',
|
|
108
|
+
requestBody: {
|
|
109
|
+
required: true,
|
|
110
|
+
content: {
|
|
111
|
+
'application/json': {
|
|
112
|
+
schema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
project: { type: 'string' },
|
|
116
|
+
files: {
|
|
117
|
+
type: 'array',
|
|
118
|
+
items: { type: 'string' },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
required: ['files'],
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
responses: {
|
|
127
|
+
200: {
|
|
128
|
+
description: 'OK',
|
|
129
|
+
content: {
|
|
130
|
+
'application/json': {
|
|
131
|
+
schema: {
|
|
132
|
+
type: 'object',
|
|
133
|
+
properties: {
|
|
134
|
+
status: { type: 'string', enum: ['ok'] },
|
|
135
|
+
data: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
staged: {
|
|
139
|
+
type: 'array',
|
|
140
|
+
items: { type: 'string' },
|
|
141
|
+
},
|
|
142
|
+
failed: {
|
|
143
|
+
type: 'array',
|
|
144
|
+
items: { type: 'string' },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
required: ['staged', 'failed'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
required: ['status', 'data'],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
500: gitErrorResponse(),
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
'/v1/git/unstage': {
|
|
160
|
+
post: {
|
|
161
|
+
tags: ['git'],
|
|
162
|
+
operationId: 'unstageFiles',
|
|
163
|
+
summary: 'Unstage files',
|
|
164
|
+
requestBody: {
|
|
165
|
+
required: true,
|
|
166
|
+
content: {
|
|
167
|
+
'application/json': {
|
|
168
|
+
schema: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
project: { type: 'string' },
|
|
172
|
+
files: {
|
|
173
|
+
type: 'array',
|
|
174
|
+
items: { type: 'string' },
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
required: ['files'],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
responses: {
|
|
183
|
+
200: {
|
|
184
|
+
description: 'OK',
|
|
185
|
+
content: {
|
|
186
|
+
'application/json': {
|
|
187
|
+
schema: {
|
|
188
|
+
type: 'object',
|
|
189
|
+
properties: {
|
|
190
|
+
status: { type: 'string', enum: ['ok'] },
|
|
191
|
+
data: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {
|
|
194
|
+
unstaged: {
|
|
195
|
+
type: 'array',
|
|
196
|
+
items: { type: 'string' },
|
|
197
|
+
},
|
|
198
|
+
failed: {
|
|
199
|
+
type: 'array',
|
|
200
|
+
items: { type: 'string' },
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
required: ['unstaged', 'failed'],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
required: ['status', 'data'],
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
500: gitErrorResponse(),
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
'/v1/git/commit': {
|
|
216
|
+
post: {
|
|
217
|
+
tags: ['git'],
|
|
218
|
+
operationId: 'commitChanges',
|
|
219
|
+
summary: 'Commit staged changes',
|
|
220
|
+
requestBody: {
|
|
221
|
+
required: true,
|
|
222
|
+
content: {
|
|
223
|
+
'application/json': {
|
|
224
|
+
schema: {
|
|
225
|
+
type: 'object',
|
|
226
|
+
properties: {
|
|
227
|
+
project: { type: 'string' },
|
|
228
|
+
message: { type: 'string', minLength: 1 },
|
|
229
|
+
},
|
|
230
|
+
required: ['message'],
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
responses: {
|
|
236
|
+
200: {
|
|
237
|
+
description: 'OK',
|
|
238
|
+
content: {
|
|
239
|
+
'application/json': {
|
|
240
|
+
schema: {
|
|
241
|
+
type: 'object',
|
|
242
|
+
properties: {
|
|
243
|
+
status: { type: 'string', enum: ['ok'] },
|
|
244
|
+
data: { $ref: '#/components/schemas/GitCommit' },
|
|
245
|
+
},
|
|
246
|
+
required: ['status', 'data'],
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
400: gitErrorResponse(),
|
|
252
|
+
500: gitErrorResponse(),
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
'/v1/git/generate-commit-message': {
|
|
257
|
+
post: {
|
|
258
|
+
tags: ['git'],
|
|
259
|
+
operationId: 'generateCommitMessage',
|
|
260
|
+
summary: 'Generate AI-powered commit message',
|
|
261
|
+
description:
|
|
262
|
+
'Uses AI to generate a commit message based on staged changes',
|
|
263
|
+
requestBody: {
|
|
264
|
+
required: false,
|
|
265
|
+
content: {
|
|
266
|
+
'application/json': {
|
|
267
|
+
schema: {
|
|
268
|
+
type: 'object',
|
|
269
|
+
properties: {
|
|
270
|
+
project: { type: 'string' },
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
responses: {
|
|
277
|
+
200: {
|
|
278
|
+
description: 'OK',
|
|
279
|
+
content: {
|
|
280
|
+
'application/json': {
|
|
281
|
+
schema: {
|
|
282
|
+
type: 'object',
|
|
283
|
+
properties: {
|
|
284
|
+
status: { type: 'string', enum: ['ok'] },
|
|
285
|
+
data: {
|
|
286
|
+
type: 'object',
|
|
287
|
+
properties: {
|
|
288
|
+
message: { type: 'string' },
|
|
289
|
+
},
|
|
290
|
+
required: ['message'],
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
required: ['status', 'data'],
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
400: gitErrorResponse(),
|
|
299
|
+
500: gitErrorResponse(),
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
'/v1/git/push': {
|
|
304
|
+
post: {
|
|
305
|
+
tags: ['git'],
|
|
306
|
+
operationId: 'pushCommits',
|
|
307
|
+
summary: 'Push commits to remote',
|
|
308
|
+
description: 'Pushes local commits to the configured remote repository',
|
|
309
|
+
requestBody: {
|
|
310
|
+
required: false,
|
|
311
|
+
content: {
|
|
312
|
+
'application/json': {
|
|
313
|
+
schema: {
|
|
314
|
+
type: 'object',
|
|
315
|
+
properties: {
|
|
316
|
+
project: { type: 'string' },
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
responses: {
|
|
323
|
+
200: {
|
|
324
|
+
description: 'OK',
|
|
325
|
+
content: {
|
|
326
|
+
'application/json': {
|
|
327
|
+
schema: {
|
|
328
|
+
type: 'object',
|
|
329
|
+
properties: {
|
|
330
|
+
status: { type: 'string', enum: ['ok'] },
|
|
331
|
+
data: {
|
|
332
|
+
type: 'object',
|
|
333
|
+
properties: {
|
|
334
|
+
output: { type: 'string' },
|
|
335
|
+
},
|
|
336
|
+
required: ['output'],
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
required: ['status', 'data'],
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
400: gitErrorResponse(),
|
|
345
|
+
500: gitErrorResponse(),
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
} as const;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
errorResponse,
|
|
3
|
+
projectQueryParam,
|
|
4
|
+
sessionIdParam,
|
|
5
|
+
withoutParam,
|
|
6
|
+
} from '../helpers';
|
|
7
|
+
|
|
8
|
+
export const messagesPaths = {
|
|
9
|
+
'/v1/sessions/{id}/messages': {
|
|
10
|
+
get: {
|
|
11
|
+
tags: ['messages'],
|
|
12
|
+
operationId: 'listMessages',
|
|
13
|
+
summary: 'List messages for a session',
|
|
14
|
+
parameters: [projectQueryParam(), sessionIdParam(), withoutParam()],
|
|
15
|
+
responses: {
|
|
16
|
+
200: {
|
|
17
|
+
description: 'OK',
|
|
18
|
+
content: {
|
|
19
|
+
'application/json': {
|
|
20
|
+
schema: {
|
|
21
|
+
type: 'array',
|
|
22
|
+
items: {
|
|
23
|
+
allOf: [
|
|
24
|
+
{ $ref: '#/components/schemas/Message' },
|
|
25
|
+
{
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
parts: {
|
|
29
|
+
type: 'array',
|
|
30
|
+
items: {
|
|
31
|
+
$ref: '#/components/schemas/MessagePart',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: [],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
post: {
|
|
46
|
+
tags: ['messages'],
|
|
47
|
+
operationId: 'createMessage',
|
|
48
|
+
summary: 'Send a user message and enqueue assistant run',
|
|
49
|
+
parameters: [projectQueryParam(), sessionIdParam()],
|
|
50
|
+
requestBody: {
|
|
51
|
+
required: true,
|
|
52
|
+
content: {
|
|
53
|
+
'application/json': {
|
|
54
|
+
schema: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
required: ['content'],
|
|
57
|
+
properties: {
|
|
58
|
+
content: { type: 'string' },
|
|
59
|
+
agent: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'Agent name. Defaults to config if omitted.',
|
|
62
|
+
},
|
|
63
|
+
provider: { $ref: '#/components/schemas/Provider' },
|
|
64
|
+
model: { type: 'string' },
|
|
65
|
+
userContext: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description:
|
|
68
|
+
'Optional user-provided context to include in the system prompt.',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
responses: {
|
|
76
|
+
202: {
|
|
77
|
+
description: 'Accepted',
|
|
78
|
+
content: {
|
|
79
|
+
'application/json': {
|
|
80
|
+
schema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: { messageId: { type: 'string' } },
|
|
83
|
+
required: ['messageId'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
400: errorResponse(),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
} as const;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { errorResponse, projectQueryParam } from '../helpers';
|
|
2
|
+
|
|
3
|
+
export const sessionsPaths = {
|
|
4
|
+
'/v1/sessions': {
|
|
5
|
+
get: {
|
|
6
|
+
tags: ['sessions'],
|
|
7
|
+
operationId: 'listSessions',
|
|
8
|
+
summary: 'List sessions',
|
|
9
|
+
parameters: [projectQueryParam()],
|
|
10
|
+
responses: {
|
|
11
|
+
200: {
|
|
12
|
+
description: 'OK',
|
|
13
|
+
content: {
|
|
14
|
+
'application/json': {
|
|
15
|
+
schema: {
|
|
16
|
+
type: 'array',
|
|
17
|
+
items: { $ref: '#/components/schemas/Session' },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
post: {
|
|
25
|
+
tags: ['sessions'],
|
|
26
|
+
operationId: 'createSession',
|
|
27
|
+
summary: 'Create a new session',
|
|
28
|
+
parameters: [projectQueryParam()],
|
|
29
|
+
requestBody: {
|
|
30
|
+
required: false,
|
|
31
|
+
content: {
|
|
32
|
+
'application/json': {
|
|
33
|
+
schema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
title: { type: 'string', nullable: true },
|
|
37
|
+
agent: { type: 'string' },
|
|
38
|
+
provider: { $ref: '#/components/schemas/Provider' },
|
|
39
|
+
model: { type: 'string' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
responses: {
|
|
46
|
+
201: {
|
|
47
|
+
description: 'Created',
|
|
48
|
+
content: {
|
|
49
|
+
'application/json': {
|
|
50
|
+
schema: { $ref: '#/components/schemas/Session' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
400: errorResponse(),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
'/v1/sessions/{sessionId}/abort': {
|
|
59
|
+
delete: {
|
|
60
|
+
tags: ['sessions'],
|
|
61
|
+
operationId: 'abortSession',
|
|
62
|
+
summary: 'Abort a running session',
|
|
63
|
+
description:
|
|
64
|
+
'Aborts any currently running assistant generation for the session',
|
|
65
|
+
parameters: [
|
|
66
|
+
{
|
|
67
|
+
in: 'path',
|
|
68
|
+
name: 'sessionId',
|
|
69
|
+
required: true,
|
|
70
|
+
schema: { type: 'string' },
|
|
71
|
+
description: 'Session ID to abort',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
responses: {
|
|
75
|
+
200: {
|
|
76
|
+
description: 'OK',
|
|
77
|
+
content: {
|
|
78
|
+
'application/json': {
|
|
79
|
+
schema: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: { success: { type: 'boolean' } },
|
|
82
|
+
required: ['success'],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
} as const;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { projectQueryParam, sessionIdParam } from '../helpers';
|
|
2
|
+
|
|
3
|
+
export const streamPaths = {
|
|
4
|
+
'/v1/sessions/{id}/stream': {
|
|
5
|
+
get: {
|
|
6
|
+
tags: ['stream'],
|
|
7
|
+
operationId: 'subscribeSessionStream',
|
|
8
|
+
summary: 'Subscribe to session event stream (SSE)',
|
|
9
|
+
parameters: [projectQueryParam(), sessionIdParam()],
|
|
10
|
+
responses: {
|
|
11
|
+
200: {
|
|
12
|
+
description: 'text/event-stream',
|
|
13
|
+
content: {
|
|
14
|
+
'text/event-stream': {
|
|
15
|
+
schema: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description:
|
|
18
|
+
'SSE event stream. Events include session.created, message.created, message.part.delta, tool.call, tool.delta, tool.result, message.completed, error.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} as const;
|