@ottocode/server 0.1.259 → 0.1.261

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 (69) 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/agent/runner-reasoning.ts +38 -3
  42. package/src/runtime/agent/runner.ts +1 -0
  43. package/src/runtime/ask/service.ts +1 -0
  44. package/src/runtime/message/compaction-limits.ts +3 -3
  45. package/src/runtime/provider/reasoning.ts +18 -7
  46. package/src/runtime/session/db-operations.ts +4 -3
  47. package/src/runtime/utils/token.ts +7 -2
  48. package/src/tools/adapter.ts +21 -0
  49. package/src/openapi/paths/ask.ts +0 -81
  50. package/src/openapi/paths/auth.ts +0 -687
  51. package/src/openapi/paths/branch.ts +0 -102
  52. package/src/openapi/paths/config.ts +0 -485
  53. package/src/openapi/paths/doctor.ts +0 -165
  54. package/src/openapi/paths/files.ts +0 -236
  55. package/src/openapi/paths/git.ts +0 -690
  56. package/src/openapi/paths/mcp.ts +0 -339
  57. package/src/openapi/paths/messages.ts +0 -103
  58. package/src/openapi/paths/ottorouter.ts +0 -594
  59. package/src/openapi/paths/provider-usage.ts +0 -59
  60. package/src/openapi/paths/research.ts +0 -227
  61. package/src/openapi/paths/session-approval.ts +0 -93
  62. package/src/openapi/paths/session-extras.ts +0 -336
  63. package/src/openapi/paths/session-files.ts +0 -91
  64. package/src/openapi/paths/sessions.ts +0 -210
  65. package/src/openapi/paths/skills.ts +0 -377
  66. package/src/openapi/paths/stream.ts +0 -26
  67. package/src/openapi/paths/terminals.ts +0 -226
  68. package/src/openapi/paths/tunnel.ts +0 -163
  69. package/src/openapi/spec.ts +0 -73
@@ -1,594 +0,0 @@
1
- export const ottorouterPaths = {
2
- '/v1/ottorouter/balance': {
3
- get: {
4
- tags: ['ottorouter'],
5
- operationId: 'getOttoRouterBalance',
6
- summary: 'Get OttoRouter account balance',
7
- description:
8
- 'Returns wallet balance, subscription, account info, limits, and usage data',
9
- responses: {
10
- 200: {
11
- description: 'OK',
12
- content: {
13
- 'application/json': {
14
- schema: {
15
- type: 'object',
16
- properties: {
17
- walletAddress: { type: 'string' },
18
- balance: { type: 'number' },
19
- totalSpent: { type: 'number' },
20
- totalTopups: { type: 'number' },
21
- requestCount: { type: 'number' },
22
- scope: { type: 'string', enum: ['wallet', 'account'] },
23
- payg: {
24
- type: 'object',
25
- properties: {
26
- walletBalanceUsd: { type: 'number' },
27
- accountBalanceUsd: { type: 'number' },
28
- rawPoolUsd: { type: 'number' },
29
- effectiveSpendableUsd: { type: 'number' },
30
- },
31
- },
32
- limits: {
33
- type: 'object',
34
- nullable: true,
35
- properties: {
36
- enabled: { type: 'boolean' },
37
- dailyLimitUsd: { type: 'number', nullable: true },
38
- dailySpentUsd: { type: 'number' },
39
- dailyRemainingUsd: { type: 'number', nullable: true },
40
- monthlyLimitUsd: { type: 'number', nullable: true },
41
- monthlySpentUsd: { type: 'number' },
42
- monthlyRemainingUsd: { type: 'number', nullable: true },
43
- capRemainingUsd: { type: 'number', nullable: true },
44
- },
45
- },
46
- subscription: {
47
- type: 'object',
48
- nullable: true,
49
- properties: {
50
- active: { type: 'boolean' },
51
- tierId: { type: 'string' },
52
- tierName: { type: 'string' },
53
- creditsIncluded: { type: 'number' },
54
- creditsUsed: { type: 'number' },
55
- creditsRemaining: { type: 'number' },
56
- periodStart: { type: 'string' },
57
- periodEnd: { type: 'string' },
58
- },
59
- },
60
- },
61
- required: [
62
- 'walletAddress',
63
- 'balance',
64
- 'totalSpent',
65
- 'totalTopups',
66
- 'requestCount',
67
- ],
68
- },
69
- },
70
- },
71
- },
72
- 401: {
73
- description: 'Wallet not configured',
74
- content: {
75
- 'application/json': {
76
- schema: {
77
- type: 'object',
78
- properties: { error: { type: 'string' } },
79
- required: ['error'],
80
- },
81
- },
82
- },
83
- },
84
- 502: {
85
- description: 'Failed to fetch balance from OttoRouter',
86
- content: {
87
- 'application/json': {
88
- schema: {
89
- type: 'object',
90
- properties: { error: { type: 'string' } },
91
- required: ['error'],
92
- },
93
- },
94
- },
95
- },
96
- },
97
- },
98
- },
99
- '/v1/ottorouter/wallet': {
100
- get: {
101
- tags: ['ottorouter'],
102
- operationId: 'getOttoRouterWallet',
103
- summary: 'Get OttoRouter wallet info',
104
- description:
105
- 'Returns whether the wallet is configured and its public key',
106
- responses: {
107
- 200: {
108
- description: 'OK',
109
- content: {
110
- 'application/json': {
111
- schema: {
112
- type: 'object',
113
- properties: {
114
- configured: { type: 'boolean' },
115
- publicKey: { type: 'string' },
116
- error: { type: 'string' },
117
- },
118
- required: ['configured'],
119
- },
120
- },
121
- },
122
- },
123
- },
124
- },
125
- },
126
- '/v1/ottorouter/usdc-balance': {
127
- get: {
128
- tags: ['ottorouter'],
129
- operationId: 'getOttoRouterUsdcBalance',
130
- summary: 'Get USDC token balance',
131
- description:
132
- 'Fetches USDC balance from Solana blockchain for the configured wallet',
133
- parameters: [
134
- {
135
- in: 'query',
136
- name: 'network',
137
- schema: {
138
- type: 'string',
139
- enum: ['mainnet', 'devnet'],
140
- default: 'mainnet',
141
- },
142
- description: 'Solana network to query',
143
- },
144
- ],
145
- responses: {
146
- 200: {
147
- description: 'OK',
148
- content: {
149
- 'application/json': {
150
- schema: {
151
- type: 'object',
152
- properties: {
153
- walletAddress: { type: 'string' },
154
- usdcBalance: { type: 'number' },
155
- network: {
156
- type: 'string',
157
- enum: ['mainnet', 'devnet'],
158
- },
159
- },
160
- required: ['walletAddress', 'usdcBalance', 'network'],
161
- },
162
- },
163
- },
164
- },
165
- 401: {
166
- description: 'Wallet not configured',
167
- content: {
168
- 'application/json': {
169
- schema: {
170
- type: 'object',
171
- properties: { error: { type: 'string' } },
172
- required: ['error'],
173
- },
174
- },
175
- },
176
- },
177
- 502: {
178
- description: 'Failed to fetch USDC balance from Solana',
179
- content: {
180
- 'application/json': {
181
- schema: {
182
- type: 'object',
183
- properties: { error: { type: 'string' } },
184
- required: ['error'],
185
- },
186
- },
187
- },
188
- },
189
- },
190
- },
191
- },
192
- '/v1/ottorouter/topup/polar': {
193
- post: {
194
- tags: ['ottorouter'],
195
- operationId: 'createPolarCheckout',
196
- summary: 'Create a Polar checkout for topping up',
197
- requestBody: {
198
- required: true,
199
- content: {
200
- 'application/json': {
201
- schema: {
202
- type: 'object',
203
- properties: {
204
- amount: { type: 'number' },
205
- successUrl: { type: 'string' },
206
- },
207
- required: ['amount', 'successUrl'],
208
- },
209
- },
210
- },
211
- },
212
- responses: {
213
- 200: {
214
- description: 'OK',
215
- content: {
216
- 'application/json': {
217
- schema: { type: 'object' },
218
- },
219
- },
220
- },
221
- 401: {
222
- description: 'Wallet not configured',
223
- content: {
224
- 'application/json': {
225
- schema: {
226
- type: 'object',
227
- properties: { error: { type: 'string' } },
228
- required: ['error'],
229
- },
230
- },
231
- },
232
- },
233
- },
234
- },
235
- },
236
- '/v1/ottorouter/topup/select': {
237
- post: {
238
- tags: ['ottorouter'],
239
- operationId: 'selectTopupMethod',
240
- summary: 'Select topup method for pending request',
241
- requestBody: {
242
- required: true,
243
- content: {
244
- 'application/json': {
245
- schema: {
246
- type: 'object',
247
- properties: {
248
- sessionId: { type: 'string' },
249
- method: {
250
- type: 'string',
251
- enum: ['crypto', 'fiat'],
252
- },
253
- },
254
- required: ['sessionId', 'method'],
255
- },
256
- },
257
- },
258
- },
259
- responses: {
260
- 200: {
261
- description: 'OK',
262
- content: {
263
- 'application/json': {
264
- schema: {
265
- type: 'object',
266
- properties: {
267
- success: { type: 'boolean' },
268
- method: { type: 'string' },
269
- },
270
- required: ['success', 'method'],
271
- },
272
- },
273
- },
274
- },
275
- 404: {
276
- description: 'No pending topup',
277
- content: {
278
- 'application/json': {
279
- schema: {
280
- type: 'object',
281
- properties: { error: { type: 'string' } },
282
- required: ['error'],
283
- },
284
- },
285
- },
286
- },
287
- },
288
- },
289
- },
290
- '/v1/ottorouter/topup/cancel': {
291
- post: {
292
- tags: ['ottorouter'],
293
- operationId: 'cancelTopup',
294
- summary: 'Cancel pending topup',
295
- requestBody: {
296
- required: true,
297
- content: {
298
- 'application/json': {
299
- schema: {
300
- type: 'object',
301
- properties: {
302
- sessionId: { type: 'string' },
303
- reason: { type: 'string' },
304
- },
305
- required: ['sessionId'],
306
- },
307
- },
308
- },
309
- },
310
- responses: {
311
- 200: {
312
- description: 'OK',
313
- content: {
314
- 'application/json': {
315
- schema: {
316
- type: 'object',
317
- properties: {
318
- success: { type: 'boolean' },
319
- },
320
- required: ['success'],
321
- },
322
- },
323
- },
324
- },
325
- 404: {
326
- description: 'No pending topup',
327
- content: {
328
- 'application/json': {
329
- schema: {
330
- type: 'object',
331
- properties: { error: { type: 'string' } },
332
- required: ['error'],
333
- },
334
- },
335
- },
336
- },
337
- },
338
- },
339
- },
340
- '/v1/ottorouter/topup/pending': {
341
- get: {
342
- tags: ['ottorouter'],
343
- operationId: 'getPendingTopup',
344
- summary: 'Get pending topup for a session',
345
- parameters: [
346
- {
347
- in: 'query',
348
- name: 'sessionId',
349
- required: true,
350
- schema: { type: 'string' },
351
- },
352
- ],
353
- responses: {
354
- 200: {
355
- description: 'OK',
356
- content: {
357
- 'application/json': {
358
- schema: {
359
- type: 'object',
360
- properties: {
361
- hasPending: { type: 'boolean' },
362
- sessionId: { type: 'string' },
363
- messageId: { type: 'string' },
364
- amountUsd: { type: 'number' },
365
- currentBalance: { type: 'number' },
366
- createdAt: { type: 'integer' },
367
- },
368
- required: ['hasPending'],
369
- },
370
- },
371
- },
372
- },
373
- },
374
- },
375
- },
376
- '/v1/ottorouter/topup/polar/estimate': {
377
- get: {
378
- tags: ['ottorouter'],
379
- operationId: 'getPolarTopupEstimate',
380
- summary: 'Get estimated fees for a Polar topup',
381
- parameters: [
382
- {
383
- in: 'query',
384
- name: 'amount',
385
- required: true,
386
- schema: { type: 'number' },
387
- description: 'Amount in USD',
388
- },
389
- ],
390
- responses: {
391
- 200: {
392
- description: 'OK',
393
- content: {
394
- 'application/json': {
395
- schema: {
396
- type: 'object',
397
- properties: {
398
- creditAmount: { type: 'number' },
399
- chargeAmount: { type: 'number' },
400
- feeAmount: { type: 'number' },
401
- feeBreakdown: {
402
- type: 'object',
403
- properties: {
404
- basePercent: { type: 'number' },
405
- internationalPercent: { type: 'number' },
406
- fixedCents: { type: 'number' },
407
- },
408
- },
409
- },
410
- },
411
- },
412
- },
413
- },
414
- },
415
- },
416
- },
417
- '/v1/ottorouter/topup/polar/status': {
418
- get: {
419
- tags: ['ottorouter'],
420
- operationId: 'getPolarTopupStatus',
421
- summary: 'Get status of a Polar checkout',
422
- parameters: [
423
- {
424
- in: 'query',
425
- name: 'checkoutId',
426
- required: true,
427
- schema: { type: 'string' },
428
- },
429
- ],
430
- responses: {
431
- 200: {
432
- description: 'OK',
433
- content: {
434
- 'application/json': {
435
- schema: {
436
- type: 'object',
437
- properties: {
438
- checkoutId: { type: 'string' },
439
- confirmed: { type: 'boolean' },
440
- amountUsd: { type: 'number', nullable: true },
441
- confirmedAt: { type: 'string', nullable: true },
442
- },
443
- },
444
- },
445
- },
446
- },
447
- },
448
- },
449
- },
450
- '/v1/ottorouter/topup/razorpay/estimate': {
451
- get: {
452
- tags: ['ottorouter'],
453
- operationId: 'getRazorpayTopupEstimate',
454
- summary: 'Get estimated fees for a Razorpay topup',
455
- parameters: [
456
- {
457
- in: 'query',
458
- name: 'amount',
459
- required: true,
460
- schema: { type: 'number' },
461
- description: 'Amount in USD',
462
- },
463
- ],
464
- responses: {
465
- 200: {
466
- description: 'OK',
467
- content: {
468
- 'application/json': {
469
- schema: {
470
- type: 'object',
471
- properties: {
472
- creditAmountUsd: { type: 'number' },
473
- chargeAmountInr: { type: 'number' },
474
- feeAmountInr: { type: 'number' },
475
- currency: { type: 'string' },
476
- exchangeRate: { type: 'number' },
477
- },
478
- },
479
- },
480
- },
481
- },
482
- },
483
- },
484
- },
485
- '/v1/ottorouter/topup/razorpay': {
486
- post: {
487
- tags: ['ottorouter'],
488
- operationId: 'createRazorpayOrder',
489
- summary: 'Create a Razorpay order for topping up',
490
- requestBody: {
491
- required: true,
492
- content: {
493
- 'application/json': {
494
- schema: {
495
- type: 'object',
496
- properties: {
497
- amount: { type: 'number' },
498
- },
499
- required: ['amount'],
500
- },
501
- },
502
- },
503
- },
504
- responses: {
505
- 200: {
506
- description: 'OK',
507
- content: {
508
- 'application/json': {
509
- schema: {
510
- type: 'object',
511
- properties: {
512
- success: { type: 'boolean' },
513
- orderId: { type: 'string' },
514
- amount: { type: 'number' },
515
- currency: { type: 'string' },
516
- creditAmountUsd: { type: 'number' },
517
- keyId: { type: 'string' },
518
- },
519
- },
520
- },
521
- },
522
- },
523
- 401: {
524
- description: 'Wallet not configured',
525
- content: {
526
- 'application/json': {
527
- schema: {
528
- type: 'object',
529
- properties: { error: { type: 'string' } },
530
- required: ['error'],
531
- },
532
- },
533
- },
534
- },
535
- },
536
- },
537
- },
538
- '/v1/ottorouter/topup/razorpay/verify': {
539
- post: {
540
- tags: ['ottorouter'],
541
- operationId: 'verifyRazorpayPayment',
542
- summary: 'Verify Razorpay payment and credit balance',
543
- requestBody: {
544
- required: true,
545
- content: {
546
- 'application/json': {
547
- schema: {
548
- type: 'object',
549
- properties: {
550
- razorpay_order_id: { type: 'string' },
551
- razorpay_payment_id: { type: 'string' },
552
- razorpay_signature: { type: 'string' },
553
- },
554
- required: [
555
- 'razorpay_order_id',
556
- 'razorpay_payment_id',
557
- 'razorpay_signature',
558
- ],
559
- },
560
- },
561
- },
562
- },
563
- responses: {
564
- 200: {
565
- description: 'OK',
566
- content: {
567
- 'application/json': {
568
- schema: {
569
- type: 'object',
570
- properties: {
571
- success: { type: 'boolean' },
572
- credited: { type: 'number' },
573
- newBalance: { type: 'number' },
574
- },
575
- },
576
- },
577
- },
578
- },
579
- 401: {
580
- description: 'Wallet not configured',
581
- content: {
582
- 'application/json': {
583
- schema: {
584
- type: 'object',
585
- properties: { error: { type: 'string' } },
586
- required: ['error'],
587
- },
588
- },
589
- },
590
- },
591
- },
592
- },
593
- },
594
- } as const;
@@ -1,59 +0,0 @@
1
- import { errorResponse } from '../helpers';
2
-
3
- export const providerUsagePaths = {
4
- '/v1/provider-usage/{provider}': {
5
- get: {
6
- tags: ['config'],
7
- operationId: 'getProviderUsage',
8
- summary: 'Get usage information for an OAuth provider',
9
- parameters: [
10
- {
11
- in: 'path',
12
- name: 'provider',
13
- required: true,
14
- schema: { type: 'string', enum: ['anthropic', 'openai'] },
15
- },
16
- ],
17
- responses: {
18
- 200: {
19
- description: 'OK',
20
- content: {
21
- 'application/json': {
22
- schema: {
23
- type: 'object',
24
- properties: {
25
- provider: { type: 'string' },
26
- primaryWindow: {
27
- type: 'object',
28
- nullable: true,
29
- properties: {
30
- usedPercent: { type: 'number' },
31
- windowSeconds: { type: 'integer' },
32
- resetsAt: { type: 'string', nullable: true },
33
- resetAfterSeconds: { type: 'integer' },
34
- },
35
- },
36
- secondaryWindow: {
37
- type: 'object',
38
- nullable: true,
39
- properties: {
40
- usedPercent: { type: 'number' },
41
- windowSeconds: { type: 'integer' },
42
- resetsAt: { type: 'string', nullable: true },
43
- resetAfterSeconds: { type: 'integer' },
44
- },
45
- },
46
- limitReached: { type: 'boolean' },
47
- planType: { type: 'string', nullable: true },
48
- },
49
- required: ['provider', 'limitReached'],
50
- },
51
- },
52
- },
53
- },
54
- 400: errorResponse(),
55
- 404: errorResponse(),
56
- },
57
- },
58
- },
59
- } as const;