@ottocode/server 0.1.260 → 0.1.262

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.
Files changed (67) hide show
  1. package/package.json +4 -3
  2. package/src/index.ts +5 -4
  3. package/src/openapi/register.ts +92 -0
  4. package/src/openapi/route.ts +22 -0
  5. package/src/routes/ask.ts +210 -99
  6. package/src/routes/auth.ts +1701 -626
  7. package/src/routes/branch.ts +281 -90
  8. package/src/routes/config/agents.ts +79 -32
  9. package/src/routes/config/cwd.ts +46 -14
  10. package/src/routes/config/debug.ts +159 -30
  11. package/src/routes/config/defaults.ts +182 -64
  12. package/src/routes/config/main.ts +109 -73
  13. package/src/routes/config/models.ts +304 -137
  14. package/src/routes/config/providers.ts +462 -166
  15. package/src/routes/config/utils.ts +2 -2
  16. package/src/routes/doctor.ts +395 -161
  17. package/src/routes/files.ts +650 -260
  18. package/src/routes/git/branch.ts +143 -52
  19. package/src/routes/git/commit.ts +347 -141
  20. package/src/routes/git/diff.ts +239 -116
  21. package/src/routes/git/init.ts +103 -23
  22. package/src/routes/git/pull.ts +167 -65
  23. package/src/routes/git/push.ts +222 -117
  24. package/src/routes/git/remote.ts +401 -100
  25. package/src/routes/git/staging.ts +502 -141
  26. package/src/routes/git/status.ts +171 -78
  27. package/src/routes/mcp.ts +1129 -404
  28. package/src/routes/openapi.ts +27 -4
  29. package/src/routes/ottorouter.ts +1221 -389
  30. package/src/routes/provider-usage.ts +153 -36
  31. package/src/routes/research.ts +817 -370
  32. package/src/routes/root.ts +50 -6
  33. package/src/routes/session-approval.ts +228 -54
  34. package/src/routes/session-files.ts +265 -134
  35. package/src/routes/session-messages.ts +330 -150
  36. package/src/routes/session-stream.ts +83 -2
  37. package/src/routes/sessions.ts +1830 -780
  38. package/src/routes/skills.ts +849 -161
  39. package/src/routes/terminals.ts +469 -103
  40. package/src/routes/tunnel.ts +394 -118
  41. package/src/runtime/ask/service.ts +1 -0
  42. package/src/runtime/message/compaction-limits.ts +3 -3
  43. package/src/runtime/provider/reasoning.ts +2 -1
  44. package/src/runtime/session/db-operations.ts +4 -3
  45. package/src/runtime/utils/token.ts +7 -2
  46. package/src/tools/adapter.ts +21 -0
  47. package/src/openapi/paths/ask.ts +0 -81
  48. package/src/openapi/paths/auth.ts +0 -687
  49. package/src/openapi/paths/branch.ts +0 -102
  50. package/src/openapi/paths/config.ts +0 -485
  51. package/src/openapi/paths/doctor.ts +0 -165
  52. package/src/openapi/paths/files.ts +0 -236
  53. package/src/openapi/paths/git.ts +0 -690
  54. package/src/openapi/paths/mcp.ts +0 -339
  55. package/src/openapi/paths/messages.ts +0 -103
  56. package/src/openapi/paths/ottorouter.ts +0 -594
  57. package/src/openapi/paths/provider-usage.ts +0 -59
  58. package/src/openapi/paths/research.ts +0 -227
  59. package/src/openapi/paths/session-approval.ts +0 -93
  60. package/src/openapi/paths/session-extras.ts +0 -336
  61. package/src/openapi/paths/session-files.ts +0 -91
  62. package/src/openapi/paths/sessions.ts +0 -210
  63. package/src/openapi/paths/skills.ts +0 -377
  64. package/src/openapi/paths/stream.ts +0 -26
  65. package/src/openapi/paths/terminals.ts +0 -226
  66. package/src/openapi/paths/tunnel.ts +0 -163
  67. package/src/openapi/spec.ts +0 -73
@@ -1,687 +0,0 @@
1
- import { errorResponse } from '../helpers';
2
-
3
- export const authPaths = {
4
- '/v1/auth/status': {
5
- get: {
6
- tags: ['auth'],
7
- operationId: 'getAuthStatus',
8
- summary: 'Get auth status for all providers',
9
- responses: {
10
- 200: {
11
- description: 'OK',
12
- content: {
13
- 'application/json': {
14
- schema: {
15
- type: 'object',
16
- properties: {
17
- onboardingComplete: { type: 'boolean' },
18
- ottorouter: {
19
- type: 'object',
20
- properties: {
21
- configured: { type: 'boolean' },
22
- publicKey: { type: 'string' },
23
- },
24
- required: ['configured'],
25
- },
26
- providers: {
27
- type: 'object',
28
- additionalProperties: {
29
- type: 'object',
30
- properties: {
31
- configured: { type: 'boolean' },
32
- type: {
33
- type: 'string',
34
- enum: ['api', 'oauth', 'wallet'],
35
- },
36
- label: { type: 'string' },
37
- supportsOAuth: { type: 'boolean' },
38
- supportsToken: { type: 'boolean' },
39
- supportsGhImport: { type: 'boolean' },
40
- modelCount: { type: 'integer' },
41
- costRange: {
42
- type: 'object',
43
- nullable: true,
44
- properties: {
45
- min: { type: 'number' },
46
- max: { type: 'number' },
47
- },
48
- required: ['min', 'max'],
49
- },
50
- },
51
- required: [
52
- 'configured',
53
- 'label',
54
- 'supportsOAuth',
55
- 'modelCount',
56
- ],
57
- },
58
- },
59
- defaults: {
60
- type: 'object',
61
- properties: {
62
- agent: { type: 'string' },
63
- provider: { type: 'string' },
64
- model: { type: 'string' },
65
- },
66
- },
67
- },
68
- required: ['onboardingComplete', 'ottorouter', 'providers'],
69
- },
70
- },
71
- },
72
- },
73
- },
74
- },
75
- },
76
- '/v1/auth/ottorouter/setup': {
77
- post: {
78
- tags: ['auth'],
79
- operationId: 'setupOttoRouterWallet',
80
- summary: 'Setup or ensure OttoRouter wallet',
81
- responses: {
82
- 200: {
83
- description: 'OK',
84
- content: {
85
- 'application/json': {
86
- schema: {
87
- type: 'object',
88
- properties: {
89
- success: { type: 'boolean' },
90
- publicKey: { type: 'string' },
91
- isNew: { type: 'boolean' },
92
- },
93
- required: ['success', 'publicKey', 'isNew'],
94
- },
95
- },
96
- },
97
- },
98
- },
99
- },
100
- },
101
- '/v1/auth/ottorouter/import': {
102
- post: {
103
- tags: ['auth'],
104
- operationId: 'importOttoRouterWallet',
105
- summary: 'Import OttoRouter wallet from private key',
106
- requestBody: {
107
- required: true,
108
- content: {
109
- 'application/json': {
110
- schema: {
111
- type: 'object',
112
- properties: {
113
- privateKey: { type: 'string' },
114
- },
115
- required: ['privateKey'],
116
- },
117
- },
118
- },
119
- },
120
- responses: {
121
- 200: {
122
- description: 'OK',
123
- content: {
124
- 'application/json': {
125
- schema: {
126
- type: 'object',
127
- properties: {
128
- success: { type: 'boolean' },
129
- publicKey: { type: 'string' },
130
- },
131
- required: ['success', 'publicKey'],
132
- },
133
- },
134
- },
135
- },
136
- 400: errorResponse(),
137
- },
138
- },
139
- },
140
- '/v1/auth/ottorouter/export': {
141
- get: {
142
- tags: ['auth'],
143
- operationId: 'exportOttoRouterWallet',
144
- summary: 'Export OttoRouter wallet private key',
145
- responses: {
146
- 200: {
147
- description: 'OK',
148
- content: {
149
- 'application/json': {
150
- schema: {
151
- type: 'object',
152
- properties: {
153
- success: { type: 'boolean' },
154
- publicKey: { type: 'string' },
155
- privateKey: { type: 'string' },
156
- },
157
- required: ['success', 'publicKey', 'privateKey'],
158
- },
159
- },
160
- },
161
- },
162
- 404: errorResponse(),
163
- },
164
- },
165
- },
166
- '/v1/auth/{provider}': {
167
- post: {
168
- tags: ['auth'],
169
- operationId: 'addProviderApiKey',
170
- summary: 'Add API key for a provider',
171
- parameters: [
172
- {
173
- in: 'path',
174
- name: 'provider',
175
- required: true,
176
- schema: { type: 'string' },
177
- },
178
- ],
179
- requestBody: {
180
- required: true,
181
- content: {
182
- 'application/json': {
183
- schema: {
184
- type: 'object',
185
- properties: {
186
- apiKey: { type: 'string' },
187
- },
188
- required: ['apiKey'],
189
- },
190
- },
191
- },
192
- },
193
- responses: {
194
- 200: {
195
- description: 'OK',
196
- content: {
197
- 'application/json': {
198
- schema: {
199
- type: 'object',
200
- properties: {
201
- success: { type: 'boolean' },
202
- provider: { type: 'string' },
203
- },
204
- required: ['success', 'provider'],
205
- },
206
- },
207
- },
208
- },
209
- 400: errorResponse(),
210
- },
211
- },
212
- delete: {
213
- tags: ['auth'],
214
- operationId: 'removeProvider',
215
- summary: 'Remove auth for a provider',
216
- parameters: [
217
- {
218
- in: 'path',
219
- name: 'provider',
220
- required: true,
221
- schema: { type: 'string' },
222
- },
223
- ],
224
- responses: {
225
- 200: {
226
- description: 'OK',
227
- content: {
228
- 'application/json': {
229
- schema: {
230
- type: 'object',
231
- properties: {
232
- success: { type: 'boolean' },
233
- provider: { type: 'string' },
234
- },
235
- required: ['success', 'provider'],
236
- },
237
- },
238
- },
239
- },
240
- 400: errorResponse(),
241
- },
242
- },
243
- },
244
- '/v1/auth/{provider}/oauth/url': {
245
- post: {
246
- tags: ['auth'],
247
- operationId: 'getOAuthUrl',
248
- summary: 'Get OAuth authorization URL',
249
- parameters: [
250
- {
251
- in: 'path',
252
- name: 'provider',
253
- required: true,
254
- schema: { type: 'string' },
255
- },
256
- ],
257
- requestBody: {
258
- required: false,
259
- content: {
260
- 'application/json': {
261
- schema: {
262
- type: 'object',
263
- properties: {
264
- mode: {
265
- type: 'string',
266
- enum: ['max', 'console'],
267
- default: 'max',
268
- },
269
- },
270
- },
271
- },
272
- },
273
- },
274
- responses: {
275
- 200: {
276
- description: 'OK',
277
- content: {
278
- 'application/json': {
279
- schema: {
280
- type: 'object',
281
- properties: {
282
- url: { type: 'string' },
283
- sessionId: { type: 'string' },
284
- provider: { type: 'string' },
285
- },
286
- required: ['url', 'sessionId', 'provider'],
287
- },
288
- },
289
- },
290
- },
291
- 400: errorResponse(),
292
- },
293
- },
294
- },
295
- '/v1/auth/{provider}/oauth/exchange': {
296
- post: {
297
- tags: ['auth'],
298
- operationId: 'exchangeOAuthCode',
299
- summary: 'Exchange OAuth code for tokens',
300
- parameters: [
301
- {
302
- in: 'path',
303
- name: 'provider',
304
- required: true,
305
- schema: { type: 'string' },
306
- },
307
- ],
308
- requestBody: {
309
- required: true,
310
- content: {
311
- 'application/json': {
312
- schema: {
313
- type: 'object',
314
- properties: {
315
- code: { type: 'string' },
316
- sessionId: { type: 'string' },
317
- },
318
- required: ['code', 'sessionId'],
319
- },
320
- },
321
- },
322
- },
323
- responses: {
324
- 200: {
325
- description: 'OK',
326
- content: {
327
- 'application/json': {
328
- schema: {
329
- type: 'object',
330
- properties: {
331
- success: { type: 'boolean' },
332
- provider: { type: 'string' },
333
- },
334
- required: ['success', 'provider'],
335
- },
336
- },
337
- },
338
- },
339
- 400: errorResponse(),
340
- },
341
- },
342
- },
343
- '/v1/auth/{provider}/oauth/start': {
344
- get: {
345
- tags: ['auth'],
346
- operationId: 'startOAuth',
347
- summary: 'Start OAuth flow with redirect',
348
- parameters: [
349
- {
350
- in: 'path',
351
- name: 'provider',
352
- required: true,
353
- schema: { type: 'string' },
354
- },
355
- {
356
- in: 'query',
357
- name: 'mode',
358
- required: false,
359
- schema: {
360
- type: 'string',
361
- enum: ['max', 'console'],
362
- default: 'max',
363
- },
364
- },
365
- ],
366
- responses: {
367
- 302: { description: 'Redirect to OAuth provider' },
368
- 400: errorResponse(),
369
- },
370
- },
371
- },
372
- '/v1/auth/{provider}/oauth/callback': {
373
- get: {
374
- tags: ['auth'],
375
- operationId: 'oauthCallback',
376
- summary: 'OAuth callback handler',
377
- parameters: [
378
- {
379
- in: 'path',
380
- name: 'provider',
381
- required: true,
382
- schema: { type: 'string' },
383
- },
384
- {
385
- in: 'query',
386
- name: 'code',
387
- required: false,
388
- schema: { type: 'string' },
389
- },
390
- {
391
- in: 'query',
392
- name: 'fragment',
393
- required: false,
394
- schema: { type: 'string' },
395
- },
396
- ],
397
- responses: {
398
- 200: {
399
- description: 'HTML response',
400
- content: { 'text/html': { schema: { type: 'string' } } },
401
- },
402
- },
403
- },
404
- },
405
- '/v1/auth/copilot/device/start': {
406
- post: {
407
- tags: ['auth'],
408
- operationId: 'startCopilotDeviceFlow',
409
- summary: 'Start Copilot device flow authentication',
410
- responses: {
411
- 200: {
412
- description: 'OK',
413
- content: {
414
- 'application/json': {
415
- schema: {
416
- type: 'object',
417
- properties: {
418
- sessionId: { type: 'string' },
419
- userCode: { type: 'string' },
420
- verificationUri: { type: 'string' },
421
- interval: { type: 'integer' },
422
- },
423
- required: [
424
- 'sessionId',
425
- 'userCode',
426
- 'verificationUri',
427
- 'interval',
428
- ],
429
- },
430
- },
431
- },
432
- },
433
- },
434
- },
435
- },
436
- '/v1/auth/copilot/device/poll': {
437
- post: {
438
- tags: ['auth'],
439
- operationId: 'pollCopilotDeviceFlow',
440
- summary: 'Poll Copilot device flow for completion',
441
- requestBody: {
442
- required: true,
443
- content: {
444
- 'application/json': {
445
- schema: {
446
- type: 'object',
447
- properties: {
448
- sessionId: { type: 'string' },
449
- },
450
- required: ['sessionId'],
451
- },
452
- },
453
- },
454
- },
455
- responses: {
456
- 200: {
457
- description: 'OK',
458
- content: {
459
- 'application/json': {
460
- schema: {
461
- type: 'object',
462
- properties: {
463
- status: {
464
- type: 'string',
465
- enum: ['complete', 'pending', 'error'],
466
- },
467
- error: { type: 'string' },
468
- },
469
- required: ['status'],
470
- },
471
- },
472
- },
473
- },
474
- 400: errorResponse(),
475
- },
476
- },
477
- },
478
- '/v1/auth/copilot/methods': {
479
- get: {
480
- tags: ['auth'],
481
- operationId: 'getCopilotAuthMethods',
482
- summary: 'Get available Copilot auth methods',
483
- responses: {
484
- 200: {
485
- description: 'OK',
486
- content: {
487
- 'application/json': {
488
- schema: {
489
- type: 'object',
490
- properties: {
491
- oauth: { type: 'boolean' },
492
- token: { type: 'boolean' },
493
- ghImport: {
494
- type: 'object',
495
- properties: {
496
- available: { type: 'boolean' },
497
- authenticated: { type: 'boolean' },
498
- reason: { type: 'string' },
499
- },
500
- required: ['available', 'authenticated'],
501
- },
502
- },
503
- required: ['oauth', 'token', 'ghImport'],
504
- },
505
- },
506
- },
507
- },
508
- },
509
- },
510
- },
511
- '/v1/auth/copilot/token': {
512
- post: {
513
- tags: ['auth'],
514
- operationId: 'saveCopilotToken',
515
- summary: 'Save Copilot token after validating model access',
516
- requestBody: {
517
- required: true,
518
- content: {
519
- 'application/json': {
520
- schema: {
521
- type: 'object',
522
- properties: {
523
- token: { type: 'string' },
524
- },
525
- required: ['token'],
526
- },
527
- },
528
- },
529
- },
530
- responses: {
531
- 200: {
532
- description: 'OK',
533
- content: {
534
- 'application/json': {
535
- schema: {
536
- type: 'object',
537
- properties: {
538
- success: { type: 'boolean' },
539
- provider: { type: 'string' },
540
- source: { type: 'string', enum: ['token'] },
541
- modelCount: { type: 'integer' },
542
- hasGpt52Codex: { type: 'boolean' },
543
- sampleModels: {
544
- type: 'array',
545
- items: { type: 'string' },
546
- },
547
- },
548
- required: [
549
- 'success',
550
- 'provider',
551
- 'source',
552
- 'modelCount',
553
- 'hasGpt52Codex',
554
- 'sampleModels',
555
- ],
556
- },
557
- },
558
- },
559
- },
560
- 400: errorResponse(),
561
- },
562
- },
563
- },
564
- '/v1/auth/copilot/gh/import': {
565
- post: {
566
- tags: ['auth'],
567
- operationId: 'importCopilotTokenFromGh',
568
- summary: 'Import Copilot token from GitHub CLI (gh)',
569
- responses: {
570
- 200: {
571
- description: 'OK',
572
- content: {
573
- 'application/json': {
574
- schema: {
575
- type: 'object',
576
- properties: {
577
- success: { type: 'boolean' },
578
- provider: { type: 'string' },
579
- source: { type: 'string', enum: ['gh'] },
580
- modelCount: { type: 'integer' },
581
- hasGpt52Codex: { type: 'boolean' },
582
- sampleModels: {
583
- type: 'array',
584
- items: { type: 'string' },
585
- },
586
- },
587
- required: [
588
- 'success',
589
- 'provider',
590
- 'source',
591
- 'modelCount',
592
- 'hasGpt52Codex',
593
- 'sampleModels',
594
- ],
595
- },
596
- },
597
- },
598
- },
599
- 400: errorResponse(),
600
- },
601
- },
602
- },
603
- '/v1/auth/copilot/diagnostics': {
604
- get: {
605
- tags: ['auth'],
606
- operationId: 'getCopilotDiagnostics',
607
- summary: 'Get Copilot token diagnostics and model visibility',
608
- responses: {
609
- 200: {
610
- description: 'OK',
611
- content: {
612
- 'application/json': {
613
- schema: {
614
- type: 'object',
615
- properties: {
616
- tokenSources: {
617
- type: 'array',
618
- items: {
619
- type: 'object',
620
- properties: {
621
- source: {
622
- type: 'string',
623
- enum: ['env', 'stored'],
624
- },
625
- configured: { type: 'boolean' },
626
- modelCount: { type: 'integer' },
627
- hasGpt52Codex: { type: 'boolean' },
628
- sampleModels: {
629
- type: 'array',
630
- items: { type: 'string' },
631
- },
632
- restrictedByOrgPolicy: { type: 'boolean' },
633
- restrictedOrg: { type: 'string' },
634
- restrictionMessage: { type: 'string' },
635
- error: { type: 'string' },
636
- },
637
- required: ['source', 'configured'],
638
- },
639
- },
640
- methods: {
641
- type: 'object',
642
- properties: {
643
- oauth: { type: 'boolean' },
644
- token: { type: 'boolean' },
645
- ghImport: {
646
- type: 'object',
647
- properties: {
648
- available: { type: 'boolean' },
649
- authenticated: { type: 'boolean' },
650
- reason: { type: 'string' },
651
- },
652
- required: ['available', 'authenticated'],
653
- },
654
- },
655
- required: ['oauth', 'token', 'ghImport'],
656
- },
657
- },
658
- required: ['tokenSources', 'methods'],
659
- },
660
- },
661
- },
662
- },
663
- },
664
- },
665
- },
666
- '/v1/auth/onboarding/complete': {
667
- post: {
668
- tags: ['auth'],
669
- operationId: 'completeOnboarding',
670
- summary: 'Mark onboarding as complete',
671
- responses: {
672
- 200: {
673
- description: 'OK',
674
- content: {
675
- 'application/json': {
676
- schema: {
677
- type: 'object',
678
- properties: { success: { type: 'boolean' } },
679
- required: ['success'],
680
- },
681
- },
682
- },
683
- },
684
- },
685
- },
686
- },
687
- } as const;