@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,102 +0,0 @@
1
- import { errorResponse, projectQueryParam } from '../helpers';
2
-
3
- const sessionIdParam = {
4
- in: 'path',
5
- name: 'sessionId',
6
- required: true,
7
- schema: { type: 'string' },
8
- } as const;
9
-
10
- export const branchPaths = {
11
- '/v1/sessions/{sessionId}/branch': {
12
- post: {
13
- tags: ['sessions'],
14
- operationId: 'createBranch',
15
- summary: 'Create a branch from a session message',
16
- parameters: [sessionIdParam, projectQueryParam()],
17
- requestBody: {
18
- required: true,
19
- content: {
20
- 'application/json': {
21
- schema: {
22
- type: 'object',
23
- properties: {
24
- fromMessageId: { type: 'string' },
25
- provider: { type: 'string' },
26
- model: { type: 'string' },
27
- agent: { type: 'string' },
28
- title: { type: 'string' },
29
- },
30
- required: ['fromMessageId'],
31
- },
32
- },
33
- },
34
- },
35
- responses: {
36
- 201: {
37
- description: 'Created',
38
- content: {
39
- 'application/json': {
40
- schema: { $ref: '#/components/schemas/Session' },
41
- },
42
- },
43
- },
44
- 400: errorResponse(),
45
- },
46
- },
47
- },
48
- '/v1/sessions/{sessionId}/branches': {
49
- get: {
50
- tags: ['sessions'],
51
- operationId: 'listBranches',
52
- summary: 'List branches of a session',
53
- parameters: [sessionIdParam, projectQueryParam()],
54
- responses: {
55
- 200: {
56
- description: 'OK',
57
- content: {
58
- 'application/json': {
59
- schema: {
60
- type: 'object',
61
- properties: {
62
- branches: {
63
- type: 'array',
64
- items: { $ref: '#/components/schemas/Session' },
65
- },
66
- },
67
- required: ['branches'],
68
- },
69
- },
70
- },
71
- },
72
- },
73
- },
74
- },
75
- '/v1/sessions/{sessionId}/parent': {
76
- get: {
77
- tags: ['sessions'],
78
- operationId: 'getParentSession',
79
- summary: 'Get parent session of a branch',
80
- parameters: [sessionIdParam, projectQueryParam()],
81
- responses: {
82
- 200: {
83
- description: 'OK',
84
- content: {
85
- 'application/json': {
86
- schema: {
87
- type: 'object',
88
- properties: {
89
- parent: {
90
- nullable: true,
91
- allOf: [{ $ref: '#/components/schemas/Session' }],
92
- },
93
- },
94
- required: ['parent'],
95
- },
96
- },
97
- },
98
- },
99
- },
100
- },
101
- },
102
- } as const;
@@ -1,485 +0,0 @@
1
- import { projectQueryParam } from '../helpers';
2
-
3
- export const configPaths = {
4
- '/v1/config': {
5
- get: {
6
- tags: ['config'],
7
- operationId: 'getConfig',
8
- summary: 'Get full configuration',
9
- description: 'Returns agents, authorized providers, models, and defaults',
10
- parameters: [projectQueryParam()],
11
- responses: {
12
- 200: {
13
- description: 'OK',
14
- content: {
15
- 'application/json': {
16
- schema: { $ref: '#/components/schemas/Config' },
17
- },
18
- },
19
- },
20
- },
21
- },
22
- },
23
- '/v1/config/cwd': {
24
- get: {
25
- tags: ['config'],
26
- operationId: 'getCwd',
27
- summary: 'Get current working directory info',
28
- responses: {
29
- 200: {
30
- description: 'OK',
31
- content: {
32
- 'application/json': {
33
- schema: {
34
- type: 'object',
35
- properties: {
36
- cwd: { type: 'string' },
37
- dirName: { type: 'string' },
38
- },
39
- required: ['cwd', 'dirName'],
40
- },
41
- },
42
- },
43
- },
44
- },
45
- },
46
- },
47
- '/v1/config/agents': {
48
- get: {
49
- tags: ['config'],
50
- operationId: 'getAgents',
51
- summary: 'Get available agents',
52
- parameters: [projectQueryParam()],
53
- responses: {
54
- 200: {
55
- description: 'OK',
56
- content: {
57
- 'application/json': {
58
- schema: {
59
- type: 'object',
60
- properties: {
61
- agents: {
62
- type: 'array',
63
- items: { type: 'string' },
64
- },
65
- default: { type: 'string' },
66
- },
67
- required: ['agents', 'default'],
68
- },
69
- },
70
- },
71
- },
72
- },
73
- },
74
- },
75
- '/v1/config/providers': {
76
- get: {
77
- tags: ['config'],
78
- operationId: 'getProviders',
79
- summary: 'Get available providers',
80
- description: 'Returns only providers that have been authorized',
81
- parameters: [projectQueryParam()],
82
- responses: {
83
- 200: {
84
- description: 'OK',
85
- content: {
86
- 'application/json': {
87
- schema: {
88
- type: 'object',
89
- properties: {
90
- providers: {
91
- type: 'array',
92
- items: { $ref: '#/components/schemas/Provider' },
93
- },
94
- details: {
95
- type: 'array',
96
- items: { $ref: '#/components/schemas/ProviderDetail' },
97
- },
98
- default: { $ref: '#/components/schemas/Provider' },
99
- },
100
- required: ['providers', 'details', 'default'],
101
- },
102
- },
103
- },
104
- },
105
- },
106
- },
107
- },
108
- '/v1/config/providers/{provider}': {
109
- put: {
110
- tags: ['config'],
111
- operationId: 'updateProviderSettings',
112
- summary: 'Create or update provider settings',
113
- parameters: [
114
- projectQueryParam(),
115
- {
116
- in: 'path',
117
- name: 'provider',
118
- required: true,
119
- schema: { $ref: '#/components/schemas/Provider' },
120
- },
121
- ],
122
- requestBody: {
123
- required: true,
124
- content: {
125
- 'application/json': {
126
- schema: {
127
- type: 'object',
128
- properties: {
129
- enabled: { type: 'boolean' },
130
- custom: { type: 'boolean' },
131
- label: { type: 'string' },
132
- compatibility: { type: 'string' },
133
- family: { type: 'string' },
134
- baseURL: { type: 'string', nullable: true },
135
- apiKey: { type: 'string', nullable: true },
136
- apiKeyEnv: { type: 'string', nullable: true },
137
- models: {
138
- type: 'array',
139
- items: { type: 'string' },
140
- },
141
- allowAnyModel: { type: 'boolean' },
142
- },
143
- },
144
- },
145
- },
146
- },
147
- responses: {
148
- 200: {
149
- description: 'OK',
150
- content: {
151
- 'application/json': {
152
- schema: {
153
- type: 'object',
154
- properties: {
155
- success: { type: 'boolean' },
156
- provider: { $ref: '#/components/schemas/Provider' },
157
- details: {
158
- type: 'array',
159
- items: { $ref: '#/components/schemas/ProviderDetail' },
160
- },
161
- },
162
- required: ['success', 'provider', 'details'],
163
- },
164
- },
165
- },
166
- },
167
- },
168
- },
169
- delete: {
170
- tags: ['config'],
171
- operationId: 'deleteProviderSettings',
172
- summary: 'Delete provider override or custom provider entry',
173
- parameters: [
174
- projectQueryParam(),
175
- {
176
- in: 'path',
177
- name: 'provider',
178
- required: true,
179
- schema: { $ref: '#/components/schemas/Provider' },
180
- },
181
- ],
182
- responses: {
183
- 200: {
184
- description: 'OK',
185
- content: {
186
- 'application/json': {
187
- schema: {
188
- type: 'object',
189
- properties: {
190
- success: { type: 'boolean' },
191
- provider: { $ref: '#/components/schemas/Provider' },
192
- details: {
193
- type: 'array',
194
- items: { $ref: '#/components/schemas/ProviderDetail' },
195
- },
196
- },
197
- required: ['success', 'provider', 'details'],
198
- },
199
- },
200
- },
201
- },
202
- },
203
- },
204
- },
205
- '/v1/config/providers/{provider}/models': {
206
- get: {
207
- tags: ['config'],
208
- operationId: 'getProviderModels',
209
- summary: 'Get available models for a provider',
210
- parameters: [
211
- projectQueryParam(),
212
- {
213
- in: 'path',
214
- name: 'provider',
215
- required: true,
216
- schema: { $ref: '#/components/schemas/Provider' },
217
- },
218
- ],
219
- responses: {
220
- 200: {
221
- description: 'OK',
222
- content: {
223
- 'application/json': {
224
- schema: {
225
- type: 'object',
226
- properties: {
227
- models: {
228
- type: 'array',
229
- items: { $ref: '#/components/schemas/Model' },
230
- },
231
- default: { type: 'string', nullable: true },
232
- allowAnyModel: { type: 'boolean' },
233
- label: { type: 'string' },
234
- },
235
- required: ['models', 'allowAnyModel', 'label'],
236
- },
237
- },
238
- },
239
- },
240
- 403: {
241
- description: 'Provider not authorized',
242
- content: {
243
- 'application/json': {
244
- schema: {
245
- type: 'object',
246
- properties: { error: { type: 'string' } },
247
- required: ['error'],
248
- },
249
- },
250
- },
251
- },
252
- 404: {
253
- description: 'Provider not found',
254
- content: {
255
- 'application/json': {
256
- schema: {
257
- type: 'object',
258
- properties: { error: { type: 'string' } },
259
- required: ['error'],
260
- },
261
- },
262
- },
263
- },
264
- },
265
- },
266
- },
267
- '/v1/config/defaults': {
268
- patch: {
269
- tags: ['config'],
270
- operationId: 'updateDefaults',
271
- summary: 'Update default configuration',
272
- description: 'Update the default agent, provider, and/or model',
273
- parameters: [projectQueryParam()],
274
- requestBody: {
275
- required: true,
276
- content: {
277
- 'application/json': {
278
- schema: {
279
- type: 'object',
280
- properties: {
281
- agent: { type: 'string' },
282
- provider: { type: 'string' },
283
- model: { type: 'string' },
284
- fullWidthContent: { type: 'boolean' },
285
- autoCompactThresholdTokens: {
286
- type: 'integer',
287
- nullable: true,
288
- },
289
- reasoningText: { type: 'boolean' },
290
- reasoningLevel: {
291
- type: 'string',
292
- enum: ['minimal', 'low', 'medium', 'high', 'max', 'xhigh'],
293
- },
294
- scope: {
295
- type: 'string',
296
- enum: ['global', 'local'],
297
- default: 'local',
298
- },
299
- },
300
- },
301
- },
302
- },
303
- },
304
- responses: {
305
- 200: {
306
- description: 'OK',
307
- content: {
308
- 'application/json': {
309
- schema: {
310
- type: 'object',
311
- properties: {
312
- success: { type: 'boolean' },
313
- defaults: {
314
- type: 'object',
315
- properties: {
316
- agent: { type: 'string' },
317
- provider: { type: 'string' },
318
- model: { type: 'string' },
319
- fullWidthContent: { type: 'boolean' },
320
- autoCompactThresholdTokens: {
321
- type: 'integer',
322
- nullable: true,
323
- },
324
- reasoningText: { type: 'boolean' },
325
- reasoningLevel: {
326
- type: 'string',
327
- enum: [
328
- 'minimal',
329
- 'low',
330
- 'medium',
331
- 'high',
332
- 'max',
333
- 'xhigh',
334
- ],
335
- },
336
- },
337
- required: ['agent', 'provider', 'model'],
338
- },
339
- },
340
- required: ['success', 'defaults'],
341
- },
342
- },
343
- },
344
- },
345
- },
346
- },
347
- },
348
- '/v1/config/debug': {
349
- get: {
350
- tags: ['config'],
351
- operationId: 'getDebugConfig',
352
- summary: 'Get debug configuration',
353
- responses: {
354
- 200: {
355
- description: 'OK',
356
- content: {
357
- 'application/json': {
358
- schema: {
359
- type: 'object',
360
- properties: {
361
- enabled: { type: 'boolean' },
362
- scopes: {
363
- type: 'array',
364
- items: { type: 'string' },
365
- },
366
- logPath: { type: 'string' },
367
- sessionsDir: { type: 'string' },
368
- debugDir: { type: 'string' },
369
- },
370
- required: [
371
- 'enabled',
372
- 'scopes',
373
- 'logPath',
374
- 'sessionsDir',
375
- 'debugDir',
376
- ],
377
- },
378
- },
379
- },
380
- },
381
- },
382
- },
383
- patch: {
384
- tags: ['config'],
385
- operationId: 'updateDebugConfig',
386
- summary: 'Update debug configuration',
387
- requestBody: {
388
- required: true,
389
- content: {
390
- 'application/json': {
391
- schema: {
392
- type: 'object',
393
- properties: {
394
- enabled: { type: 'boolean' },
395
- scopes: {
396
- type: 'array',
397
- items: { type: 'string' },
398
- },
399
- },
400
- },
401
- },
402
- },
403
- },
404
- responses: {
405
- 200: {
406
- description: 'OK',
407
- content: {
408
- 'application/json': {
409
- schema: {
410
- type: 'object',
411
- properties: {
412
- success: { type: 'boolean' },
413
- debug: {
414
- type: 'object',
415
- properties: {
416
- enabled: { type: 'boolean' },
417
- scopes: {
418
- type: 'array',
419
- items: { type: 'string' },
420
- },
421
- logPath: { type: 'string' },
422
- sessionsDir: { type: 'string' },
423
- debugDir: { type: 'string' },
424
- },
425
- required: [
426
- 'enabled',
427
- 'scopes',
428
- 'logPath',
429
- 'sessionsDir',
430
- 'debugDir',
431
- ],
432
- },
433
- },
434
- required: ['success', 'debug'],
435
- },
436
- },
437
- },
438
- },
439
- },
440
- },
441
- },
442
- '/v1/config/models': {
443
- get: {
444
- tags: ['config'],
445
- operationId: 'getAllModels',
446
- summary: 'Get all models across authorized providers',
447
- parameters: [projectQueryParam()],
448
- responses: {
449
- 200: {
450
- description: 'OK',
451
- content: {
452
- 'application/json': {
453
- schema: {
454
- type: 'object',
455
- additionalProperties: {
456
- type: 'object',
457
- properties: {
458
- label: { type: 'string' },
459
- authType: { type: 'string' },
460
- models: {
461
- type: 'array',
462
- items: {
463
- type: 'object',
464
- properties: {
465
- id: { type: 'string' },
466
- label: { type: 'string' },
467
- toolCall: { type: 'boolean' },
468
- reasoningText: { type: 'boolean' },
469
- vision: { type: 'boolean' },
470
- attachment: { type: 'boolean' },
471
- },
472
- required: ['id', 'label'],
473
- },
474
- },
475
- },
476
- required: ['label', 'models'],
477
- },
478
- },
479
- },
480
- },
481
- },
482
- },
483
- },
484
- },
485
- } as const;