@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.
@@ -1,4 +1,11 @@
1
- import { providerIds } from '@agi-cli/sdk';
1
+ import { askPaths } from './paths/ask';
2
+ import { configPaths } from './paths/config';
3
+ import { filesPaths } from './paths/files';
4
+ import { gitPaths } from './paths/git';
5
+ import { messagesPaths } from './paths/messages';
6
+ import { sessionsPaths } from './paths/sessions';
7
+ import { streamPaths } from './paths/stream';
8
+ import { schemas } from './schemas';
2
9
 
3
10
  export function getOpenAPISpec() {
4
11
  const spec = {
@@ -15,1153 +22,21 @@ export function getOpenAPISpec() {
15
22
  { name: 'stream' },
16
23
  { name: 'ask' },
17
24
  { name: 'config' },
25
+ { name: 'files' },
18
26
  { name: 'git' },
19
27
  ],
20
28
  paths: {
21
- '/v1/ask': {
22
- post: {
23
- tags: ['ask'],
24
- operationId: 'ask',
25
- summary: 'Send a prompt using the ask service',
26
- description:
27
- 'Streamlined endpoint used by the CLI to send prompts and receive assistant responses. Creates sessions as needed and reuses the last session when requested.',
28
- parameters: [projectQueryParam()],
29
- requestBody: {
30
- required: true,
31
- content: {
32
- 'application/json': {
33
- schema: {
34
- type: 'object',
35
- required: ['prompt'],
36
- properties: {
37
- prompt: {
38
- type: 'string',
39
- description: 'User prompt to send to the assistant.',
40
- },
41
- agent: {
42
- type: 'string',
43
- description:
44
- 'Optional agent name to use for this request.',
45
- },
46
- provider: {
47
- $ref: '#/components/schemas/Provider',
48
- description:
49
- 'Optional provider override. When omitted the agent and config defaults apply.',
50
- },
51
- model: {
52
- type: 'string',
53
- description:
54
- 'Optional model override for the selected provider.',
55
- },
56
- sessionId: {
57
- type: 'string',
58
- description: 'Send the prompt to a specific session.',
59
- },
60
- last: {
61
- type: 'boolean',
62
- description:
63
- 'If true, reuse the most recent session for the project.',
64
- },
65
- jsonMode: {
66
- type: 'boolean',
67
- description:
68
- 'Request structured JSON output when supported by the agent.',
69
- },
70
- },
71
- },
72
- },
73
- },
74
- },
75
- responses: {
76
- 202: {
77
- description: 'Accepted',
78
- content: {
79
- 'application/json': {
80
- schema: { $ref: '#/components/schemas/AskResponse' },
81
- },
82
- },
83
- },
84
- 400: errorResponse(),
85
- },
86
- },
87
- },
88
- '/v1/sessions': {
89
- get: {
90
- tags: ['sessions'],
91
- operationId: 'listSessions',
92
- summary: 'List sessions',
93
- parameters: [projectQueryParam()],
94
- responses: {
95
- 200: {
96
- description: 'OK',
97
- content: {
98
- 'application/json': {
99
- schema: {
100
- type: 'array',
101
- items: { $ref: '#/components/schemas/Session' },
102
- },
103
- },
104
- },
105
- },
106
- },
107
- },
108
- post: {
109
- tags: ['sessions'],
110
- operationId: 'createSession',
111
- summary: 'Create a new session',
112
- parameters: [projectQueryParam()],
113
- requestBody: {
114
- required: false,
115
- content: {
116
- 'application/json': {
117
- schema: {
118
- type: 'object',
119
- properties: {
120
- title: { type: 'string', nullable: true },
121
- agent: { type: 'string' },
122
- provider: { $ref: '#/components/schemas/Provider' },
123
- model: { type: 'string' },
124
- },
125
- },
126
- },
127
- },
128
- },
129
- responses: {
130
- 201: {
131
- description: 'Created',
132
- content: {
133
- 'application/json': {
134
- schema: { $ref: '#/components/schemas/Session' },
135
- },
136
- },
137
- },
138
- 400: errorResponse(),
139
- },
140
- },
141
- },
142
- '/v1/sessions/{id}/messages': {
143
- get: {
144
- tags: ['messages'],
145
- operationId: 'listMessages',
146
- summary: 'List messages for a session',
147
- parameters: [projectQueryParam(), sessionIdParam(), withoutParam()],
148
- responses: {
149
- 200: {
150
- description: 'OK',
151
- content: {
152
- 'application/json': {
153
- schema: {
154
- type: 'array',
155
- items: {
156
- allOf: [
157
- { $ref: '#/components/schemas/Message' },
158
- {
159
- type: 'object',
160
- properties: {
161
- parts: {
162
- type: 'array',
163
- items: {
164
- $ref: '#/components/schemas/MessagePart',
165
- },
166
- },
167
- },
168
- required: [],
169
- },
170
- ],
171
- },
172
- },
173
- },
174
- },
175
- },
176
- },
177
- },
178
- post: {
179
- tags: ['messages'],
180
- operationId: 'createMessage',
181
- summary: 'Send a user message and enqueue assistant run',
182
- parameters: [projectQueryParam(), sessionIdParam()],
183
- requestBody: {
184
- required: true,
185
- content: {
186
- 'application/json': {
187
- schema: {
188
- type: 'object',
189
- required: ['content'],
190
- properties: {
191
- content: { type: 'string' },
192
- agent: {
193
- type: 'string',
194
- description: 'Agent name. Defaults to config if omitted.',
195
- },
196
- provider: { $ref: '#/components/schemas/Provider' },
197
- model: { type: 'string' },
198
- userContext: {
199
- type: 'string',
200
- description:
201
- 'Optional user-provided context to include in the system prompt.',
202
- },
203
- },
204
- },
205
- },
206
- },
207
- },
208
- responses: {
209
- 202: {
210
- description: 'Accepted',
211
- content: {
212
- 'application/json': {
213
- schema: {
214
- type: 'object',
215
- properties: { messageId: { type: 'string' } },
216
- required: ['messageId'],
217
- },
218
- },
219
- },
220
- },
221
- 400: errorResponse(),
222
- },
223
- },
224
- },
225
- '/v1/sessions/{id}/stream': {
226
- get: {
227
- tags: ['stream'],
228
- operationId: 'subscribeSessionStream',
229
- summary: 'Subscribe to session event stream (SSE)',
230
- parameters: [projectQueryParam(), sessionIdParam()],
231
- responses: {
232
- 200: {
233
- description: 'text/event-stream',
234
- content: {
235
- 'text/event-stream': {
236
- schema: {
237
- type: 'string',
238
- description:
239
- 'SSE event stream. Events include session.created, message.created, message.part.delta, tool.call, tool.delta, tool.result, message.completed, error.',
240
- },
241
- },
242
- },
243
- },
244
- },
245
- },
246
- },
247
- '/v1/sessions/{sessionId}/abort': {
248
- delete: {
249
- tags: ['sessions'],
250
- operationId: 'abortSession',
251
- summary: 'Abort a running session',
252
- description:
253
- 'Aborts any currently running assistant generation for the session',
254
- parameters: [
255
- {
256
- in: 'path',
257
- name: 'sessionId',
258
- required: true,
259
- schema: { type: 'string' },
260
- description: 'Session ID to abort',
261
- },
262
- ],
263
- responses: {
264
- 200: {
265
- description: 'OK',
266
- content: {
267
- 'application/json': {
268
- schema: {
269
- type: 'object',
270
- properties: { success: { type: 'boolean' } },
271
- required: ['success'],
272
- },
273
- },
274
- },
275
- },
276
- },
277
- },
278
- },
279
- '/v1/config': {
280
- get: {
281
- tags: ['config'],
282
- operationId: 'getConfig',
283
- summary: 'Get full configuration',
284
- description:
285
- 'Returns agents, authorized providers, models, and defaults',
286
- parameters: [projectQueryParam()],
287
- responses: {
288
- 200: {
289
- description: 'OK',
290
- content: {
291
- 'application/json': {
292
- schema: { $ref: '#/components/schemas/Config' },
293
- },
294
- },
295
- },
296
- },
297
- },
298
- },
299
- '/v1/config/cwd': {
300
- get: {
301
- tags: ['config'],
302
- operationId: 'getCwd',
303
- summary: 'Get current working directory info',
304
- responses: {
305
- 200: {
306
- description: 'OK',
307
- content: {
308
- 'application/json': {
309
- schema: {
310
- type: 'object',
311
- properties: {
312
- cwd: { type: 'string' },
313
- dirName: { type: 'string' },
314
- },
315
- required: ['cwd', 'dirName'],
316
- },
317
- },
318
- },
319
- },
320
- },
321
- },
322
- },
323
- '/v1/config/agents': {
324
- get: {
325
- tags: ['config'],
326
- operationId: 'getAgents',
327
- summary: 'Get available agents',
328
- parameters: [projectQueryParam()],
329
- responses: {
330
- 200: {
331
- description: 'OK',
332
- content: {
333
- 'application/json': {
334
- schema: {
335
- type: 'object',
336
- properties: {
337
- agents: {
338
- type: 'array',
339
- items: { type: 'string' },
340
- },
341
- default: { type: 'string' },
342
- },
343
- required: ['agents', 'default'],
344
- },
345
- },
346
- },
347
- },
348
- },
349
- },
350
- },
351
- '/v1/config/providers': {
352
- get: {
353
- tags: ['config'],
354
- operationId: 'getProviders',
355
- summary: 'Get available providers',
356
- description: 'Returns only providers that have been authorized',
357
- parameters: [projectQueryParam()],
358
- responses: {
359
- 200: {
360
- description: 'OK',
361
- content: {
362
- 'application/json': {
363
- schema: {
364
- type: 'object',
365
- properties: {
366
- providers: {
367
- type: 'array',
368
- items: { $ref: '#/components/schemas/Provider' },
369
- },
370
- default: { $ref: '#/components/schemas/Provider' },
371
- },
372
- required: ['providers', 'default'],
373
- },
374
- },
375
- },
376
- },
377
- },
378
- },
379
- },
380
- '/v1/config/providers/{provider}/models': {
381
- get: {
382
- tags: ['config'],
383
- operationId: 'getProviderModels',
384
- summary: 'Get available models for a provider',
385
- parameters: [
386
- projectQueryParam(),
387
- {
388
- in: 'path',
389
- name: 'provider',
390
- required: true,
391
- schema: { $ref: '#/components/schemas/Provider' },
392
- },
393
- ],
394
- responses: {
395
- 200: {
396
- description: 'OK',
397
- content: {
398
- 'application/json': {
399
- schema: {
400
- type: 'object',
401
- properties: {
402
- models: {
403
- type: 'array',
404
- items: { $ref: '#/components/schemas/Model' },
405
- },
406
- default: { type: 'string', nullable: true },
407
- },
408
- required: ['models'],
409
- },
410
- },
411
- },
412
- },
413
- 403: {
414
- description: 'Provider not authorized',
415
- content: {
416
- 'application/json': {
417
- schema: {
418
- type: 'object',
419
- properties: { error: { type: 'string' } },
420
- required: ['error'],
421
- },
422
- },
423
- },
424
- },
425
- 404: {
426
- description: 'Provider not found',
427
- content: {
428
- 'application/json': {
429
- schema: {
430
- type: 'object',
431
- properties: { error: { type: 'string' } },
432
- required: ['error'],
433
- },
434
- },
435
- },
436
- },
437
- },
438
- },
439
- },
440
- '/v1/git/status': {
441
- get: {
442
- tags: ['git'],
443
- operationId: 'getGitStatus',
444
- summary: 'Get git status',
445
- description:
446
- 'Returns current git status including staged, unstaged, and untracked files',
447
- parameters: [projectQueryParam()],
448
- responses: {
449
- 200: {
450
- description: 'OK',
451
- content: {
452
- 'application/json': {
453
- schema: {
454
- type: 'object',
455
- properties: {
456
- status: { type: 'string', enum: ['ok'] },
457
- data: { $ref: '#/components/schemas/GitStatus' },
458
- },
459
- required: ['status', 'data'],
460
- },
461
- },
462
- },
463
- },
464
- 400: gitErrorResponse(),
465
- 500: gitErrorResponse(),
466
- },
467
- },
468
- },
469
- '/v1/git/diff': {
470
- get: {
471
- tags: ['git'],
472
- operationId: 'getGitDiff',
473
- summary: 'Get git diff for a file',
474
- parameters: [
475
- projectQueryParam(),
476
- {
477
- in: 'query',
478
- name: 'file',
479
- required: true,
480
- schema: { type: 'string' },
481
- description: 'File path to get diff for',
482
- },
483
- {
484
- in: 'query',
485
- name: 'staged',
486
- required: false,
487
- schema: { type: 'string', enum: ['true', 'false'] },
488
- description: 'Show staged diff (default: unstaged)',
489
- },
490
- ],
491
- responses: {
492
- 200: {
493
- description: 'OK',
494
- content: {
495
- 'application/json': {
496
- schema: {
497
- type: 'object',
498
- properties: {
499
- status: { type: 'string', enum: ['ok'] },
500
- data: { $ref: '#/components/schemas/GitDiff' },
501
- },
502
- required: ['status', 'data'],
503
- },
504
- },
505
- },
506
- },
507
- 400: gitErrorResponse(),
508
- 500: gitErrorResponse(),
509
- },
510
- },
511
- },
512
- '/v1/git/branch': {
513
- get: {
514
- tags: ['git'],
515
- operationId: 'getGitBranch',
516
- summary: 'Get git branch information',
517
- parameters: [projectQueryParam()],
518
- responses: {
519
- 200: {
520
- description: 'OK',
521
- content: {
522
- 'application/json': {
523
- schema: {
524
- type: 'object',
525
- properties: {
526
- status: { type: 'string', enum: ['ok'] },
527
- data: { $ref: '#/components/schemas/GitBranch' },
528
- },
529
- required: ['status', 'data'],
530
- },
531
- },
532
- },
533
- },
534
- 400: gitErrorResponse(),
535
- 500: gitErrorResponse(),
536
- },
537
- },
538
- },
539
- '/v1/git/stage': {
540
- post: {
541
- tags: ['git'],
542
- operationId: 'stageFiles',
543
- summary: 'Stage files',
544
- requestBody: {
545
- required: true,
546
- content: {
547
- 'application/json': {
548
- schema: {
549
- type: 'object',
550
- properties: {
551
- project: { type: 'string' },
552
- files: {
553
- type: 'array',
554
- items: { type: 'string' },
555
- },
556
- },
557
- required: ['files'],
558
- },
559
- },
560
- },
561
- },
562
- responses: {
563
- 200: {
564
- description: 'OK',
565
- content: {
566
- 'application/json': {
567
- schema: {
568
- type: 'object',
569
- properties: {
570
- status: { type: 'string', enum: ['ok'] },
571
- data: {
572
- type: 'object',
573
- properties: {
574
- staged: {
575
- type: 'array',
576
- items: { type: 'string' },
577
- },
578
- failed: {
579
- type: 'array',
580
- items: { type: 'string' },
581
- },
582
- },
583
- required: ['staged', 'failed'],
584
- },
585
- },
586
- required: ['status', 'data'],
587
- },
588
- },
589
- },
590
- },
591
- 500: gitErrorResponse(),
592
- },
593
- },
594
- },
595
- '/v1/git/unstage': {
596
- post: {
597
- tags: ['git'],
598
- operationId: 'unstageFiles',
599
- summary: 'Unstage files',
600
- requestBody: {
601
- required: true,
602
- content: {
603
- 'application/json': {
604
- schema: {
605
- type: 'object',
606
- properties: {
607
- project: { type: 'string' },
608
- files: {
609
- type: 'array',
610
- items: { type: 'string' },
611
- },
612
- },
613
- required: ['files'],
614
- },
615
- },
616
- },
617
- },
618
- responses: {
619
- 200: {
620
- description: 'OK',
621
- content: {
622
- 'application/json': {
623
- schema: {
624
- type: 'object',
625
- properties: {
626
- status: { type: 'string', enum: ['ok'] },
627
- data: {
628
- type: 'object',
629
- properties: {
630
- unstaged: {
631
- type: 'array',
632
- items: { type: 'string' },
633
- },
634
- failed: {
635
- type: 'array',
636
- items: { type: 'string' },
637
- },
638
- },
639
- required: ['unstaged', 'failed'],
640
- },
641
- },
642
- required: ['status', 'data'],
643
- },
644
- },
645
- },
646
- },
647
- 500: gitErrorResponse(),
648
- },
649
- },
650
- },
651
- '/v1/git/commit': {
652
- post: {
653
- tags: ['git'],
654
- operationId: 'commitChanges',
655
- summary: 'Commit staged changes',
656
- requestBody: {
657
- required: true,
658
- content: {
659
- 'application/json': {
660
- schema: {
661
- type: 'object',
662
- properties: {
663
- project: { type: 'string' },
664
- message: { type: 'string', minLength: 1 },
665
- },
666
- required: ['message'],
667
- },
668
- },
669
- },
670
- },
671
- responses: {
672
- 200: {
673
- description: 'OK',
674
- content: {
675
- 'application/json': {
676
- schema: {
677
- type: 'object',
678
- properties: {
679
- status: { type: 'string', enum: ['ok'] },
680
- data: { $ref: '#/components/schemas/GitCommit' },
681
- },
682
- required: ['status', 'data'],
683
- },
684
- },
685
- },
686
- },
687
- 400: gitErrorResponse(),
688
- 500: gitErrorResponse(),
689
- },
690
- },
691
- },
692
- '/v1/git/generate-commit-message': {
693
- post: {
694
- tags: ['git'],
695
- operationId: 'generateCommitMessage',
696
- summary: 'Generate AI-powered commit message',
697
- description:
698
- 'Uses AI to generate a commit message based on staged changes',
699
- requestBody: {
700
- required: false,
701
- content: {
702
- 'application/json': {
703
- schema: {
704
- type: 'object',
705
- properties: {
706
- project: { type: 'string' },
707
- },
708
- },
709
- },
710
- },
711
- },
712
- responses: {
713
- 200: {
714
- description: 'OK',
715
- content: {
716
- 'application/json': {
717
- schema: {
718
- type: 'object',
719
- properties: {
720
- status: { type: 'string', enum: ['ok'] },
721
- data: {
722
- type: 'object',
723
- properties: {
724
- message: { type: 'string' },
725
- },
726
- required: ['message'],
727
- },
728
- },
729
- required: ['status', 'data'],
730
- },
731
- },
732
- },
733
- },
734
- 400: gitErrorResponse(),
735
- 500: gitErrorResponse(),
736
- },
737
- },
738
- },
739
- '/v1/git/push': {
740
- post: {
741
- tags: ['git'],
742
- operationId: 'pushCommits',
743
- summary: 'Push commits to remote',
744
- description:
745
- 'Pushes local commits to the configured remote repository',
746
- requestBody: {
747
- required: false,
748
- content: {
749
- 'application/json': {
750
- schema: {
751
- type: 'object',
752
- properties: {
753
- project: { type: 'string' },
754
- },
755
- },
756
- },
757
- },
758
- },
759
- responses: {
760
- 200: {
761
- description: 'OK',
762
- content: {
763
- 'application/json': {
764
- schema: {
765
- type: 'object',
766
- properties: {
767
- status: { type: 'string', enum: ['ok'] },
768
- data: {
769
- type: 'object',
770
- properties: {
771
- output: { type: 'string' },
772
- },
773
- required: ['output'],
774
- },
775
- },
776
- required: ['status', 'data'],
777
- },
778
- },
779
- },
780
- },
781
- 400: gitErrorResponse(),
782
- 500: gitErrorResponse(),
783
- },
784
- },
785
- },
29
+ ...askPaths,
30
+ ...sessionsPaths,
31
+ ...messagesPaths,
32
+ ...streamPaths,
33
+ ...configPaths,
34
+ ...filesPaths,
35
+ ...gitPaths,
786
36
  },
787
37
  components: {
788
- schemas: {
789
- Provider: {
790
- type: 'string',
791
- enum: providerIds,
792
- },
793
- AskResponse: {
794
- type: 'object',
795
- properties: {
796
- sessionId: { type: 'string' },
797
- header: { $ref: '#/components/schemas/AskResponseHeader' },
798
- provider: { $ref: '#/components/schemas/Provider' },
799
- model: { type: 'string' },
800
- agent: { type: 'string' },
801
- assistantMessageId: { type: 'string' },
802
- message: {
803
- $ref: '#/components/schemas/AskResponseMessage',
804
- nullable: true,
805
- description:
806
- 'Present when the request created a new session or reused the last session for the project.',
807
- },
808
- },
809
- required: [
810
- 'sessionId',
811
- 'header',
812
- 'provider',
813
- 'model',
814
- 'agent',
815
- 'assistantMessageId',
816
- ],
817
- },
818
- AskResponseHeader: {
819
- type: 'object',
820
- properties: {
821
- sessionId: { type: 'string' },
822
- agent: { type: 'string', nullable: true },
823
- provider: {
824
- $ref: '#/components/schemas/Provider',
825
- nullable: true,
826
- },
827
- model: { type: 'string', nullable: true },
828
- },
829
- required: ['sessionId'],
830
- },
831
- AskResponseMessage: {
832
- type: 'object',
833
- properties: {
834
- kind: { type: 'string', enum: ['created', 'last'] },
835
- sessionId: { type: 'string' },
836
- },
837
- required: ['kind', 'sessionId'],
838
- },
839
- Session: {
840
- type: 'object',
841
- properties: {
842
- id: { type: 'string' },
843
- title: { type: 'string', nullable: true },
844
- agent: { type: 'string' },
845
- provider: { $ref: '#/components/schemas/Provider' },
846
- model: { type: 'string' },
847
- projectPath: { type: 'string' },
848
- createdAt: { type: 'integer', format: 'int64' },
849
- lastActiveAt: { type: 'integer', format: 'int64', nullable: true },
850
- totalInputTokens: { type: 'integer', nullable: true },
851
- totalOutputTokens: { type: 'integer', nullable: true },
852
- totalToolTimeMs: { type: 'integer', nullable: true },
853
- toolCounts: {
854
- type: 'object',
855
- additionalProperties: { type: 'integer' },
856
- nullable: true,
857
- },
858
- },
859
- required: [
860
- 'id',
861
- 'agent',
862
- 'provider',
863
- 'model',
864
- 'projectPath',
865
- 'createdAt',
866
- ],
867
- },
868
- Message: {
869
- type: 'object',
870
- properties: {
871
- id: { type: 'string' },
872
- sessionId: { type: 'string' },
873
- role: {
874
- type: 'string',
875
- enum: ['system', 'user', 'assistant', 'tool'],
876
- },
877
- status: { type: 'string', enum: ['pending', 'complete', 'error'] },
878
- agent: { type: 'string' },
879
- provider: { $ref: '#/components/schemas/Provider' },
880
- model: { type: 'string' },
881
- createdAt: { type: 'integer', format: 'int64' },
882
- completedAt: { type: 'integer', format: 'int64', nullable: true },
883
- latencyMs: { type: 'integer', nullable: true },
884
- promptTokens: { type: 'integer', nullable: true },
885
- completionTokens: { type: 'integer', nullable: true },
886
- totalTokens: { type: 'integer', nullable: true },
887
- error: { type: 'string', nullable: true },
888
- },
889
- required: [
890
- 'id',
891
- 'sessionId',
892
- 'role',
893
- 'status',
894
- 'agent',
895
- 'provider',
896
- 'model',
897
- 'createdAt',
898
- ],
899
- },
900
- MessagePart: {
901
- type: 'object',
902
- properties: {
903
- id: { type: 'string' },
904
- messageId: { type: 'string' },
905
- index: { type: 'integer', format: 'int64' },
906
- type: {
907
- type: 'string',
908
- enum: ['text', 'tool_call', 'tool_result', 'image', 'error'],
909
- },
910
- content: {
911
- type: 'string',
912
- description:
913
- 'JSON-encoded content. For text: {"text": string}. For tool_call: {"name": string, "args": object}. For tool_result: {"name": string, "result"?: any, "artifact"?: Artifact}.',
914
- },
915
- agent: { type: 'string' },
916
- provider: { $ref: '#/components/schemas/Provider' },
917
- model: { type: 'string' },
918
- startedAt: { type: 'integer', format: 'int64', nullable: true },
919
- completedAt: { type: 'integer', format: 'int64', nullable: true },
920
- toolName: { type: 'string', nullable: true },
921
- toolCallId: { type: 'string', nullable: true },
922
- toolDurationMs: { type: 'integer', nullable: true },
923
- },
924
- required: [
925
- 'id',
926
- 'messageId',
927
- 'index',
928
- 'type',
929
- 'content',
930
- 'agent',
931
- 'provider',
932
- 'model',
933
- ],
934
- },
935
- Artifact: {
936
- oneOf: [
937
- { $ref: '#/components/schemas/FileDiffArtifact' },
938
- { $ref: '#/components/schemas/FileArtifact' },
939
- ],
940
- },
941
- FileDiffArtifact: {
942
- type: 'object',
943
- properties: {
944
- kind: { type: 'string', enum: ['file_diff'] },
945
- patchFormat: { type: 'string', enum: ['unified'] },
946
- patch: { type: 'string' },
947
- summary: {
948
- type: 'object',
949
- properties: {
950
- files: { type: 'integer' },
951
- additions: { type: 'integer' },
952
- deletions: { type: 'integer' },
953
- },
954
- additionalProperties: false,
955
- },
956
- },
957
- required: ['kind', 'patchFormat', 'patch'],
958
- },
959
- FileArtifact: {
960
- type: 'object',
961
- properties: {
962
- kind: { type: 'string', enum: ['file'] },
963
- path: { type: 'string' },
964
- mime: { type: 'string' },
965
- size: { type: 'integer' },
966
- sha256: { type: 'string' },
967
- },
968
- required: ['kind', 'path'],
969
- },
970
- Config: {
971
- type: 'object',
972
- properties: {
973
- agents: {
974
- type: 'array',
975
- items: { type: 'string' },
976
- },
977
- providers: {
978
- type: 'array',
979
- items: { $ref: '#/components/schemas/Provider' },
980
- },
981
- defaults: {
982
- type: 'object',
983
- properties: {
984
- agent: { type: 'string' },
985
- provider: { $ref: '#/components/schemas/Provider' },
986
- model: { type: 'string' },
987
- },
988
- required: ['agent', 'provider', 'model'],
989
- },
990
- },
991
- required: ['agents', 'providers', 'defaults'],
992
- },
993
- Model: {
994
- type: 'object',
995
- properties: {
996
- id: { type: 'string' },
997
- label: { type: 'string' },
998
- toolCall: { type: 'boolean' },
999
- reasoning: { type: 'boolean' },
1000
- },
1001
- required: ['id', 'label'],
1002
- },
1003
- GitStatus: {
1004
- type: 'object',
1005
- properties: {
1006
- branch: { type: 'string' },
1007
- ahead: { type: 'integer' },
1008
- behind: { type: 'integer' },
1009
- staged: {
1010
- type: 'array',
1011
- items: { $ref: '#/components/schemas/GitFile' },
1012
- },
1013
- unstaged: {
1014
- type: 'array',
1015
- items: { $ref: '#/components/schemas/GitFile' },
1016
- },
1017
- untracked: {
1018
- type: 'array',
1019
- items: { $ref: '#/components/schemas/GitFile' },
1020
- },
1021
- hasChanges: { type: 'boolean' },
1022
- },
1023
- required: [
1024
- 'branch',
1025
- 'ahead',
1026
- 'behind',
1027
- 'staged',
1028
- 'unstaged',
1029
- 'untracked',
1030
- 'hasChanges',
1031
- ],
1032
- },
1033
- GitFile: {
1034
- type: 'object',
1035
- properties: {
1036
- path: { type: 'string' },
1037
- status: {
1038
- type: 'string',
1039
- enum: ['modified', 'added', 'deleted', 'renamed', 'untracked'],
1040
- },
1041
- staged: { type: 'boolean' },
1042
- insertions: { type: 'integer' },
1043
- deletions: { type: 'integer' },
1044
- oldPath: { type: 'string' },
1045
- },
1046
- required: ['path', 'status', 'staged'],
1047
- },
1048
- GitDiff: {
1049
- type: 'object',
1050
- properties: {
1051
- file: { type: 'string' },
1052
- diff: { type: 'string' },
1053
- insertions: { type: 'integer' },
1054
- deletions: { type: 'integer' },
1055
- language: { type: 'string' },
1056
- binary: { type: 'boolean' },
1057
- },
1058
- required: [
1059
- 'file',
1060
- 'diff',
1061
- 'insertions',
1062
- 'deletions',
1063
- 'language',
1064
- 'binary',
1065
- ],
1066
- },
1067
- GitBranch: {
1068
- type: 'object',
1069
- properties: {
1070
- current: { type: 'string' },
1071
- upstream: { type: 'string' },
1072
- ahead: { type: 'integer' },
1073
- behind: { type: 'integer' },
1074
- all: {
1075
- type: 'array',
1076
- items: { type: 'string' },
1077
- },
1078
- },
1079
- required: ['current', 'upstream', 'ahead', 'behind', 'all'],
1080
- },
1081
- GitCommit: {
1082
- type: 'object',
1083
- properties: {
1084
- hash: { type: 'string' },
1085
- message: { type: 'string' },
1086
- filesChanged: { type: 'integer' },
1087
- insertions: { type: 'integer' },
1088
- deletions: { type: 'integer' },
1089
- },
1090
- required: [
1091
- 'hash',
1092
- 'message',
1093
- 'filesChanged',
1094
- 'insertions',
1095
- 'deletions',
1096
- ],
1097
- },
1098
- },
38
+ schemas,
1099
39
  },
1100
40
  } as const;
1101
41
  return spec;
1102
42
  }
1103
-
1104
- function projectQueryParam() {
1105
- return {
1106
- in: 'query',
1107
- name: 'project',
1108
- required: false,
1109
- schema: { type: 'string' },
1110
- description:
1111
- 'Project root override (defaults to current working directory).',
1112
- } as const;
1113
- }
1114
-
1115
- function sessionIdParam() {
1116
- return {
1117
- in: 'path',
1118
- name: 'id',
1119
- required: true,
1120
- schema: { type: 'string' },
1121
- } as const;
1122
- }
1123
-
1124
- function withoutParam() {
1125
- return {
1126
- in: 'query',
1127
- name: 'without',
1128
- required: false,
1129
- schema: { type: 'string', enum: ['parts'] },
1130
- description:
1131
- 'Exclude parts from the response. By default, parts are included.',
1132
- } as const;
1133
- }
1134
-
1135
- function errorResponse() {
1136
- return {
1137
- description: 'Bad Request',
1138
- content: {
1139
- 'application/json': {
1140
- schema: {
1141
- type: 'object',
1142
- properties: { error: { type: 'string' } },
1143
- required: ['error'],
1144
- },
1145
- },
1146
- },
1147
- } as const;
1148
- }
1149
-
1150
- function gitErrorResponse() {
1151
- return {
1152
- description: 'Error',
1153
- content: {
1154
- 'application/json': {
1155
- schema: {
1156
- type: 'object',
1157
- properties: {
1158
- status: { type: 'string', enum: ['error'] },
1159
- error: { type: 'string' },
1160
- code: { type: 'string' },
1161
- },
1162
- required: ['status', 'error'],
1163
- },
1164
- },
1165
- },
1166
- } as const;
1167
- }