@ottocode/server 0.1.265 → 0.1.266

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 (72) hide show
  1. package/package.json +3 -3
  2. package/src/routes/auth/copilot.ts +699 -0
  3. package/src/routes/auth/oauth.ts +578 -0
  4. package/src/routes/auth/onboarding.ts +45 -0
  5. package/src/routes/auth/providers.ts +189 -0
  6. package/src/routes/auth/service.ts +167 -0
  7. package/src/routes/auth/state.ts +23 -0
  8. package/src/routes/auth/status.ts +203 -0
  9. package/src/routes/auth/wallet.ts +229 -0
  10. package/src/routes/auth.ts +12 -2080
  11. package/src/routes/config/models-service.ts +411 -0
  12. package/src/routes/config/models.ts +6 -426
  13. package/src/routes/config/providers-service.ts +237 -0
  14. package/src/routes/config/providers.ts +10 -242
  15. package/src/routes/files/handlers.ts +297 -0
  16. package/src/routes/files/service.ts +313 -0
  17. package/src/routes/files.ts +12 -608
  18. package/src/routes/git/commit-service.ts +207 -0
  19. package/src/routes/git/commit.ts +6 -220
  20. package/src/routes/git/remote-service.ts +116 -0
  21. package/src/routes/git/remote.ts +8 -115
  22. package/src/routes/git/staging-service.ts +111 -0
  23. package/src/routes/git/staging.ts +10 -205
  24. package/src/routes/mcp/auth.ts +338 -0
  25. package/src/routes/mcp/lifecycle.ts +263 -0
  26. package/src/routes/mcp/servers.ts +212 -0
  27. package/src/routes/mcp/service.ts +664 -0
  28. package/src/routes/mcp/state.ts +13 -0
  29. package/src/routes/mcp.ts +6 -1233
  30. package/src/routes/ottorouter/billing.ts +593 -0
  31. package/src/routes/ottorouter/service.ts +92 -0
  32. package/src/routes/ottorouter/topup.ts +301 -0
  33. package/src/routes/ottorouter/wallet.ts +370 -0
  34. package/src/routes/ottorouter.ts +6 -1319
  35. package/src/routes/research/service.ts +339 -0
  36. package/src/routes/research.ts +12 -390
  37. package/src/routes/sessions/crud.ts +563 -0
  38. package/src/routes/sessions/queue.ts +242 -0
  39. package/src/routes/sessions/retry.ts +121 -0
  40. package/src/routes/sessions/service.ts +768 -0
  41. package/src/routes/sessions/share.ts +434 -0
  42. package/src/routes/sessions.ts +8 -1977
  43. package/src/routes/skills/service.ts +221 -0
  44. package/src/routes/skills/spec.ts +309 -0
  45. package/src/routes/skills.ts +31 -909
  46. package/src/routes/terminals/service.ts +326 -0
  47. package/src/routes/terminals.ts +19 -295
  48. package/src/routes/tunnel/service.ts +217 -0
  49. package/src/routes/tunnel.ts +29 -219
  50. package/src/runtime/agent/registry-prompts.ts +147 -0
  51. package/src/runtime/agent/registry.ts +6 -124
  52. package/src/runtime/agent/runner-errors.ts +116 -0
  53. package/src/runtime/agent/runner-reminders.ts +45 -0
  54. package/src/runtime/agent/runner-setup-model.ts +75 -0
  55. package/src/runtime/agent/runner-setup-prompt.ts +185 -0
  56. package/src/runtime/agent/runner-setup-tools.ts +103 -0
  57. package/src/runtime/agent/runner-setup-utils.ts +21 -0
  58. package/src/runtime/agent/runner-setup.ts +54 -288
  59. package/src/runtime/agent/runner-telemetry.ts +112 -0
  60. package/src/runtime/agent/runner-text.ts +108 -0
  61. package/src/runtime/agent/runner-tool-observer.ts +86 -0
  62. package/src/runtime/agent/runner.ts +79 -378
  63. package/src/runtime/provider/custom.ts +73 -0
  64. package/src/runtime/provider/index.ts +2 -85
  65. package/src/runtime/provider/reasoning-builders.ts +280 -0
  66. package/src/runtime/provider/reasoning.ts +67 -264
  67. package/src/tools/adapter/events.ts +116 -0
  68. package/src/tools/adapter/execution.ts +160 -0
  69. package/src/tools/adapter/pending.ts +37 -0
  70. package/src/tools/adapter/persistence.ts +166 -0
  71. package/src/tools/adapter/results.ts +97 -0
  72. package/src/tools/adapter.ts +124 -451
@@ -0,0 +1,263 @@
1
+ import type { Hono } from 'hono';
2
+ import { openApiRoute } from '../../openapi/route.ts';
3
+ import { startMCPServer, stopMCPServer, testMCPServer } from './service.ts';
4
+ import { copilotMCPOAuthStore, copilotMCPSessions } from './state.ts';
5
+
6
+ export function registerMCPLifecycleRoutes(app: Hono) {
7
+ openApiRoute(
8
+ app,
9
+ {
10
+ method: 'post',
11
+ path: '/v1/mcp/servers/{name}/start',
12
+ tags: ['mcp'],
13
+ operationId: 'startMCPServer',
14
+ summary: 'Start an MCP server',
15
+ parameters: [
16
+ {
17
+ in: 'path',
18
+ name: 'name',
19
+ required: true,
20
+ schema: {
21
+ type: 'string',
22
+ },
23
+ description: 'MCP server name',
24
+ },
25
+ ],
26
+ responses: {
27
+ '200': {
28
+ description: 'OK',
29
+ content: {
30
+ 'application/json': {
31
+ schema: {
32
+ type: 'object',
33
+ properties: {
34
+ ok: {
35
+ type: 'boolean',
36
+ },
37
+ name: {
38
+ type: 'string',
39
+ },
40
+ connected: {
41
+ type: 'boolean',
42
+ },
43
+ tools: {
44
+ type: 'array',
45
+ items: {
46
+ type: 'object',
47
+ properties: {
48
+ name: {
49
+ type: 'string',
50
+ },
51
+ description: {
52
+ type: 'string',
53
+ },
54
+ },
55
+ },
56
+ },
57
+ authRequired: {
58
+ type: 'boolean',
59
+ },
60
+ authType: {
61
+ type: 'string',
62
+ },
63
+ sessionId: {
64
+ type: 'string',
65
+ },
66
+ userCode: {
67
+ type: 'string',
68
+ },
69
+ verificationUri: {
70
+ type: 'string',
71
+ },
72
+ interval: {
73
+ type: 'integer',
74
+ },
75
+ authUrl: {
76
+ type: 'string',
77
+ },
78
+ error: {
79
+ type: 'string',
80
+ },
81
+ },
82
+ required: ['ok'],
83
+ },
84
+ },
85
+ },
86
+ },
87
+ '404': {
88
+ description: 'Bad Request',
89
+ content: {
90
+ 'application/json': {
91
+ schema: {
92
+ type: 'object',
93
+ properties: {
94
+ error: {
95
+ type: 'string',
96
+ },
97
+ },
98
+ required: ['error'],
99
+ },
100
+ },
101
+ },
102
+ },
103
+ },
104
+ },
105
+ async (c) => {
106
+ const result = await startMCPServer({
107
+ name: c.req.param('name'),
108
+ oAuthStore: copilotMCPOAuthStore,
109
+ sessions: copilotMCPSessions,
110
+ });
111
+ return result.ok
112
+ ? c.json(result.body)
113
+ : c.json(result.body, result.status);
114
+ },
115
+ );
116
+
117
+ openApiRoute(
118
+ app,
119
+ {
120
+ method: 'post',
121
+ path: '/v1/mcp/servers/{name}/stop',
122
+ tags: ['mcp'],
123
+ operationId: 'stopMCPServer',
124
+ summary: 'Stop an MCP server',
125
+ parameters: [
126
+ {
127
+ in: 'path',
128
+ name: 'name',
129
+ required: true,
130
+ schema: {
131
+ type: 'string',
132
+ },
133
+ description: 'MCP server name',
134
+ },
135
+ ],
136
+ responses: {
137
+ '200': {
138
+ description: 'OK',
139
+ content: {
140
+ 'application/json': {
141
+ schema: {
142
+ type: 'object',
143
+ properties: {
144
+ ok: {
145
+ type: 'boolean',
146
+ },
147
+ error: {
148
+ type: 'string',
149
+ },
150
+ },
151
+ required: ['ok'],
152
+ },
153
+ },
154
+ },
155
+ },
156
+ '400': {
157
+ description: 'Bad Request',
158
+ content: {
159
+ 'application/json': {
160
+ schema: {
161
+ type: 'object',
162
+ properties: {
163
+ error: {
164
+ type: 'string',
165
+ },
166
+ },
167
+ required: ['error'],
168
+ },
169
+ },
170
+ },
171
+ },
172
+ },
173
+ },
174
+ async (c) => {
175
+ const result = await stopMCPServer(c.req.param('name'));
176
+ return result.ok
177
+ ? c.json(result.body)
178
+ : c.json(result.body, result.status);
179
+ },
180
+ );
181
+
182
+ openApiRoute(
183
+ app,
184
+ {
185
+ method: 'post',
186
+ path: '/v1/mcp/servers/{name}/test',
187
+ tags: ['mcp'],
188
+ operationId: 'testMCPServer',
189
+ summary: 'Test connection to an MCP server',
190
+ parameters: [
191
+ {
192
+ in: 'path',
193
+ name: 'name',
194
+ required: true,
195
+ schema: {
196
+ type: 'string',
197
+ },
198
+ description: 'MCP server name',
199
+ },
200
+ ],
201
+ responses: {
202
+ '200': {
203
+ description: 'OK',
204
+ content: {
205
+ 'application/json': {
206
+ schema: {
207
+ type: 'object',
208
+ properties: {
209
+ ok: {
210
+ type: 'boolean',
211
+ },
212
+ name: {
213
+ type: 'string',
214
+ },
215
+ tools: {
216
+ type: 'array',
217
+ items: {
218
+ type: 'object',
219
+ properties: {
220
+ name: {
221
+ type: 'string',
222
+ },
223
+ description: {
224
+ type: 'string',
225
+ },
226
+ },
227
+ },
228
+ },
229
+ error: {
230
+ type: 'string',
231
+ },
232
+ },
233
+ required: ['ok'],
234
+ },
235
+ },
236
+ },
237
+ },
238
+ '404': {
239
+ description: 'Bad Request',
240
+ content: {
241
+ 'application/json': {
242
+ schema: {
243
+ type: 'object',
244
+ properties: {
245
+ error: {
246
+ type: 'string',
247
+ },
248
+ },
249
+ required: ['error'],
250
+ },
251
+ },
252
+ },
253
+ },
254
+ },
255
+ },
256
+ async (c) => {
257
+ const result = await testMCPServer(c.req.param('name'));
258
+ return result.ok
259
+ ? c.json(result.body)
260
+ : c.json(result.body, result.status);
261
+ },
262
+ );
263
+ }
@@ -0,0 +1,212 @@
1
+ import type { Hono } from 'hono';
2
+ import { openApiRoute } from '../../openapi/route.ts';
3
+ import { addMCPServer, listMCPServers, removeMCPServer } from './service.ts';
4
+
5
+ export function registerMCPServerConfigRoutes(app: Hono) {
6
+ openApiRoute(
7
+ app,
8
+ {
9
+ method: 'get',
10
+ path: '/v1/mcp/servers',
11
+ tags: ['mcp'],
12
+ operationId: 'listMCPServers',
13
+ summary: 'List configured MCP servers',
14
+ responses: {
15
+ '200': {
16
+ description: 'OK',
17
+ content: {
18
+ 'application/json': {
19
+ schema: {
20
+ type: 'object',
21
+ properties: {
22
+ servers: {
23
+ type: 'array',
24
+ items: {
25
+ $ref: '#/components/schemas/MCPServer',
26
+ },
27
+ },
28
+ },
29
+ required: ['servers'],
30
+ },
31
+ },
32
+ },
33
+ },
34
+ },
35
+ },
36
+ async (c) => {
37
+ return c.json({ servers: await listMCPServers() });
38
+ },
39
+ );
40
+
41
+ openApiRoute(
42
+ app,
43
+ {
44
+ method: 'post',
45
+ path: '/v1/mcp/servers',
46
+ tags: ['mcp'],
47
+ operationId: 'addMCPServer',
48
+ summary: 'Add a new MCP server',
49
+ requestBody: {
50
+ required: true,
51
+ content: {
52
+ 'application/json': {
53
+ schema: {
54
+ type: 'object',
55
+ properties: {
56
+ name: {
57
+ type: 'string',
58
+ },
59
+ transport: {
60
+ type: 'string',
61
+ enum: ['stdio', 'http', 'sse'],
62
+ default: 'stdio',
63
+ },
64
+ command: {
65
+ type: 'string',
66
+ },
67
+ args: {
68
+ type: 'array',
69
+ items: {
70
+ type: 'string',
71
+ },
72
+ },
73
+ env: {
74
+ type: 'object',
75
+ additionalProperties: {
76
+ type: 'string',
77
+ },
78
+ },
79
+ url: {
80
+ type: 'string',
81
+ },
82
+ headers: {
83
+ type: 'object',
84
+ additionalProperties: {
85
+ type: 'string',
86
+ },
87
+ },
88
+ oauth: {
89
+ type: 'object',
90
+ },
91
+ scope: {
92
+ type: 'string',
93
+ enum: ['global', 'project'],
94
+ default: 'global',
95
+ },
96
+ },
97
+ required: ['name'],
98
+ },
99
+ },
100
+ },
101
+ },
102
+ responses: {
103
+ '200': {
104
+ description: 'OK',
105
+ content: {
106
+ 'application/json': {
107
+ schema: {
108
+ type: 'object',
109
+ properties: {
110
+ ok: {
111
+ type: 'boolean',
112
+ },
113
+ error: {
114
+ type: 'string',
115
+ },
116
+ },
117
+ required: ['ok'],
118
+ },
119
+ },
120
+ },
121
+ },
122
+ '400': {
123
+ description: 'Bad Request',
124
+ content: {
125
+ 'application/json': {
126
+ schema: {
127
+ type: 'object',
128
+ properties: {
129
+ error: {
130
+ type: 'string',
131
+ },
132
+ },
133
+ required: ['error'],
134
+ },
135
+ },
136
+ },
137
+ },
138
+ },
139
+ },
140
+ async (c) => {
141
+ const result = await addMCPServer(await c.req.json());
142
+ return result.ok
143
+ ? c.json(result.body)
144
+ : c.json(result.body, result.status);
145
+ },
146
+ );
147
+
148
+ openApiRoute(
149
+ app,
150
+ {
151
+ method: 'delete',
152
+ path: '/v1/mcp/servers/{name}',
153
+ tags: ['mcp'],
154
+ operationId: 'removeMCPServer',
155
+ summary: 'Remove an MCP server',
156
+ parameters: [
157
+ {
158
+ in: 'path',
159
+ name: 'name',
160
+ required: true,
161
+ schema: {
162
+ type: 'string',
163
+ },
164
+ description: 'MCP server name',
165
+ },
166
+ ],
167
+ responses: {
168
+ '200': {
169
+ description: 'OK',
170
+ content: {
171
+ 'application/json': {
172
+ schema: {
173
+ type: 'object',
174
+ properties: {
175
+ ok: {
176
+ type: 'boolean',
177
+ },
178
+ error: {
179
+ type: 'string',
180
+ },
181
+ },
182
+ required: ['ok'],
183
+ },
184
+ },
185
+ },
186
+ },
187
+ '404': {
188
+ description: 'Bad Request',
189
+ content: {
190
+ 'application/json': {
191
+ schema: {
192
+ type: 'object',
193
+ properties: {
194
+ error: {
195
+ type: 'string',
196
+ },
197
+ },
198
+ required: ['error'],
199
+ },
200
+ },
201
+ },
202
+ },
203
+ },
204
+ },
205
+ async (c) => {
206
+ const result = await removeMCPServer(c.req.param('name'));
207
+ return result.ok
208
+ ? c.json(result.body)
209
+ : c.json(result.body, result.status);
210
+ },
211
+ );
212
+ }