@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,226 +0,0 @@
1
- export const terminalsPath = {
2
- '/v1/terminals': {
3
- get: {
4
- operationId: 'getTerminals',
5
- summary: 'List all terminals',
6
- description: 'Get a list of all active terminal sessions',
7
- responses: {
8
- '200': {
9
- description: 'List of terminals',
10
- content: {
11
- 'application/json': {
12
- schema: {
13
- type: 'object',
14
- properties: {
15
- terminals: {
16
- type: 'array',
17
- items: {
18
- $ref: '#/components/schemas/Terminal',
19
- },
20
- },
21
- count: {
22
- type: 'integer',
23
- },
24
- },
25
- },
26
- },
27
- },
28
- },
29
- },
30
- },
31
- post: {
32
- operationId: 'postTerminals',
33
- summary: 'Create a new terminal',
34
- description: 'Spawn a new terminal process',
35
- requestBody: {
36
- required: true,
37
- content: {
38
- 'application/json': {
39
- schema: {
40
- type: 'object',
41
- required: ['command', 'purpose'],
42
- properties: {
43
- command: {
44
- type: 'string',
45
- description: 'Command to execute',
46
- },
47
- args: {
48
- type: 'array',
49
- items: { type: 'string' },
50
- description: 'Command arguments',
51
- },
52
- purpose: {
53
- type: 'string',
54
- description: 'Description of terminal purpose',
55
- },
56
- cwd: {
57
- type: 'string',
58
- description: 'Working directory',
59
- },
60
- title: {
61
- type: 'string',
62
- description: 'Terminal title',
63
- },
64
- },
65
- },
66
- },
67
- },
68
- },
69
- responses: {
70
- '200': {
71
- description: 'Terminal created',
72
- content: {
73
- 'application/json': {
74
- schema: {
75
- type: 'object',
76
- properties: {
77
- terminalId: { type: 'string' },
78
- pid: { type: 'integer' },
79
- purpose: { type: 'string' },
80
- command: { type: 'string' },
81
- },
82
- },
83
- },
84
- },
85
- },
86
- },
87
- },
88
- },
89
- '/v1/terminals/{id}': {
90
- get: {
91
- operationId: 'getTerminalsById',
92
- summary: 'Get terminal details',
93
- description: 'Get information about a specific terminal',
94
- parameters: [
95
- {
96
- name: 'id',
97
- in: 'path',
98
- required: true,
99
- schema: { type: 'string' },
100
- },
101
- ],
102
- responses: {
103
- '200': {
104
- description: 'Terminal details',
105
- content: {
106
- 'application/json': {
107
- schema: {
108
- type: 'object',
109
- properties: {
110
- terminal: {
111
- $ref: '#/components/schemas/Terminal',
112
- },
113
- },
114
- },
115
- },
116
- },
117
- },
118
- '404': {
119
- description: 'Terminal not found',
120
- },
121
- },
122
- },
123
- delete: {
124
- operationId: 'deleteTerminalsById',
125
- summary: 'Kill terminal',
126
- description: 'Terminate a running terminal process',
127
- parameters: [
128
- {
129
- name: 'id',
130
- in: 'path',
131
- required: true,
132
- schema: { type: 'string' },
133
- },
134
- ],
135
- responses: {
136
- '200': {
137
- description: 'Terminal killed',
138
- content: {
139
- 'application/json': {
140
- schema: {
141
- type: 'object',
142
- properties: {
143
- success: { type: 'boolean' },
144
- },
145
- },
146
- },
147
- },
148
- },
149
- },
150
- },
151
- },
152
- '/v1/terminals/{id}/output': {
153
- get: {
154
- operationId: 'getTerminalsByIdOutput',
155
- summary: 'Stream terminal output',
156
- description: 'Get real-time terminal output via SSE',
157
- parameters: [
158
- {
159
- name: 'id',
160
- in: 'path',
161
- required: true,
162
- schema: { type: 'string' },
163
- },
164
- ],
165
- responses: {
166
- '200': {
167
- description: 'SSE stream of terminal output',
168
- content: {
169
- 'text/event-stream': {
170
- schema: {
171
- type: 'string',
172
- },
173
- },
174
- },
175
- },
176
- },
177
- },
178
- },
179
- '/v1/terminals/{id}/input': {
180
- post: {
181
- operationId: 'postTerminalsByIdInput',
182
- summary: 'Send input to terminal',
183
- description: 'Write data to terminal stdin',
184
- parameters: [
185
- {
186
- name: 'id',
187
- in: 'path',
188
- required: true,
189
- schema: { type: 'string' },
190
- },
191
- ],
192
- requestBody: {
193
- required: true,
194
- content: {
195
- 'application/json': {
196
- schema: {
197
- type: 'object',
198
- required: ['input'],
199
- properties: {
200
- input: {
201
- type: 'string',
202
- description: 'Input to send to terminal',
203
- },
204
- },
205
- },
206
- },
207
- },
208
- },
209
- responses: {
210
- '200': {
211
- description: 'Input sent',
212
- content: {
213
- 'application/json': {
214
- schema: {
215
- type: 'object',
216
- properties: {
217
- success: { type: 'boolean' },
218
- },
219
- },
220
- },
221
- },
222
- },
223
- },
224
- },
225
- },
226
- };
@@ -1,163 +0,0 @@
1
- import { errorResponse } from '../helpers';
2
-
3
- export const tunnelPaths = {
4
- '/v1/tunnel/status': {
5
- get: {
6
- tags: ['tunnel'],
7
- operationId: 'getTunnelStatus',
8
- summary: 'Get tunnel status',
9
- responses: {
10
- 200: {
11
- description: 'OK',
12
- content: {
13
- 'application/json': {
14
- schema: {
15
- type: 'object',
16
- properties: {
17
- status: {
18
- type: 'string',
19
- enum: ['idle', 'starting', 'connected', 'error'],
20
- },
21
- url: { type: 'string', nullable: true },
22
- error: { type: 'string', nullable: true },
23
- binaryInstalled: { type: 'boolean' },
24
- isRunning: { type: 'boolean' },
25
- },
26
- required: ['status', 'binaryInstalled', 'isRunning'],
27
- },
28
- },
29
- },
30
- },
31
- },
32
- },
33
- },
34
- '/v1/tunnel/start': {
35
- post: {
36
- tags: ['tunnel'],
37
- operationId: 'startTunnel',
38
- summary: 'Start a tunnel',
39
- requestBody: {
40
- required: false,
41
- content: {
42
- 'application/json': {
43
- schema: {
44
- type: 'object',
45
- properties: {
46
- port: { type: 'integer' },
47
- },
48
- },
49
- },
50
- },
51
- },
52
- responses: {
53
- 200: {
54
- description: 'OK',
55
- content: {
56
- 'application/json': {
57
- schema: {
58
- type: 'object',
59
- properties: {
60
- ok: { type: 'boolean' },
61
- url: { type: 'string' },
62
- message: { type: 'string' },
63
- error: { type: 'string' },
64
- },
65
- required: ['ok'],
66
- },
67
- },
68
- },
69
- },
70
- },
71
- },
72
- },
73
- '/v1/tunnel/register': {
74
- post: {
75
- tags: ['tunnel'],
76
- operationId: 'registerTunnel',
77
- summary: 'Register an external tunnel URL',
78
- requestBody: {
79
- required: true,
80
- content: {
81
- 'application/json': {
82
- schema: {
83
- type: 'object',
84
- properties: {
85
- url: { type: 'string' },
86
- },
87
- required: ['url'],
88
- },
89
- },
90
- },
91
- },
92
- responses: {
93
- 200: {
94
- description: 'OK',
95
- content: {
96
- 'application/json': {
97
- schema: {
98
- type: 'object',
99
- properties: {
100
- ok: { type: 'boolean' },
101
- url: { type: 'string' },
102
- message: { type: 'string' },
103
- },
104
- required: ['ok'],
105
- },
106
- },
107
- },
108
- },
109
- 400: errorResponse(),
110
- },
111
- },
112
- },
113
- '/v1/tunnel/stop': {
114
- post: {
115
- tags: ['tunnel'],
116
- operationId: 'stopTunnel',
117
- summary: 'Stop the tunnel',
118
- responses: {
119
- 200: {
120
- description: 'OK',
121
- content: {
122
- 'application/json': {
123
- schema: {
124
- type: 'object',
125
- properties: {
126
- ok: { type: 'boolean' },
127
- message: { type: 'string' },
128
- },
129
- required: ['ok'],
130
- },
131
- },
132
- },
133
- },
134
- },
135
- },
136
- },
137
- '/v1/tunnel/qr': {
138
- get: {
139
- tags: ['tunnel'],
140
- operationId: 'getTunnelQR',
141
- summary: 'Get QR code for tunnel URL',
142
- responses: {
143
- 200: {
144
- description: 'OK',
145
- content: {
146
- 'application/json': {
147
- schema: {
148
- type: 'object',
149
- properties: {
150
- ok: { type: 'boolean' },
151
- url: { type: 'string' },
152
- qrCode: { type: 'string' },
153
- },
154
- required: ['ok'],
155
- },
156
- },
157
- },
158
- },
159
- 400: errorResponse(),
160
- },
161
- },
162
- },
163
- } as const;
@@ -1,73 +0,0 @@
1
- import { askPaths } from './paths/ask';
2
- import { authPaths } from './paths/auth';
3
- import { branchPaths } from './paths/branch';
4
- import { configPaths } from './paths/config';
5
- import { doctorPaths } from './paths/doctor';
6
- import { filesPaths } from './paths/files';
7
- import { gitPaths } from './paths/git';
8
- import { mcpPaths } from './paths/mcp';
9
- import { messagesPaths } from './paths/messages';
10
- import { providerUsagePaths } from './paths/provider-usage';
11
- import { researchPaths } from './paths/research';
12
- import { sessionApprovalPaths } from './paths/session-approval';
13
- import { sessionExtrasPaths } from './paths/session-extras';
14
- import { sessionFilesPaths } from './paths/session-files';
15
- import { sessionsPaths } from './paths/sessions';
16
- import { ottorouterPaths } from './paths/ottorouter';
17
- import { skillsPaths } from './paths/skills';
18
- import { streamPaths } from './paths/stream';
19
- import { terminalsPath } from './paths/terminals';
20
- import { tunnelPaths } from './paths/tunnel';
21
- import { schemas } from './schemas';
22
-
23
- export function getOpenAPISpec() {
24
- const spec = {
25
- openapi: '3.0.3',
26
- info: {
27
- title: 'otto server API',
28
- version: '0.1.0',
29
- description:
30
- 'Server-side API for otto sessions, messages, and streaming events. All AI work runs on the server. Streaming uses SSE.',
31
- },
32
- tags: [
33
- { name: 'sessions' },
34
- { name: 'messages' },
35
- { name: 'stream' },
36
- { name: 'ask' },
37
- { name: 'config' },
38
- { name: 'files' },
39
- { name: 'git' },
40
- { name: 'terminals' },
41
- { name: 'ottorouter' },
42
- { name: 'auth' },
43
- { name: 'mcp' },
44
- { name: 'tunnel' },
45
- ],
46
- paths: {
47
- ...askPaths,
48
- ...authPaths,
49
- ...branchPaths,
50
- ...configPaths,
51
- ...doctorPaths,
52
- ...filesPaths,
53
- ...gitPaths,
54
- ...mcpPaths,
55
- ...messagesPaths,
56
- ...providerUsagePaths,
57
- ...researchPaths,
58
- ...sessionApprovalPaths,
59
- ...sessionExtrasPaths,
60
- ...sessionFilesPaths,
61
- ...sessionsPaths,
62
- ...ottorouterPaths,
63
- ...skillsPaths,
64
- ...streamPaths,
65
- ...terminalsPath,
66
- ...tunnelPaths,
67
- },
68
- components: {
69
- schemas,
70
- },
71
- } as const;
72
- return spec;
73
- }