@ottocode/server 0.1.213 → 0.1.216

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.
@@ -0,0 +1,59 @@
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;
@@ -0,0 +1,227 @@
1
+ import { errorResponse, projectQueryParam } from '../helpers';
2
+
3
+ export const researchPaths = {
4
+ '/v1/sessions/{parentId}/research': {
5
+ get: {
6
+ tags: ['sessions'],
7
+ operationId: 'listResearchSessions',
8
+ summary: 'List research sessions for a parent',
9
+ parameters: [
10
+ {
11
+ in: 'path',
12
+ name: 'parentId',
13
+ required: true,
14
+ schema: { type: 'string' },
15
+ },
16
+ projectQueryParam(),
17
+ ],
18
+ responses: {
19
+ 200: {
20
+ description: 'OK',
21
+ content: {
22
+ 'application/json': {
23
+ schema: {
24
+ type: 'object',
25
+ properties: {
26
+ sessions: {
27
+ type: 'array',
28
+ items: { $ref: '#/components/schemas/Session' },
29
+ },
30
+ },
31
+ required: ['sessions'],
32
+ },
33
+ },
34
+ },
35
+ },
36
+ 404: errorResponse(),
37
+ },
38
+ },
39
+ post: {
40
+ tags: ['sessions'],
41
+ operationId: 'createResearchSession',
42
+ summary: 'Create a research session',
43
+ parameters: [
44
+ {
45
+ in: 'path',
46
+ name: 'parentId',
47
+ required: true,
48
+ schema: { type: 'string' },
49
+ },
50
+ projectQueryParam(),
51
+ ],
52
+ requestBody: {
53
+ required: false,
54
+ content: {
55
+ 'application/json': {
56
+ schema: {
57
+ type: 'object',
58
+ properties: {
59
+ provider: { type: 'string' },
60
+ model: { type: 'string' },
61
+ title: { type: 'string' },
62
+ },
63
+ },
64
+ },
65
+ },
66
+ },
67
+ responses: {
68
+ 201: {
69
+ description: 'Created',
70
+ content: {
71
+ 'application/json': {
72
+ schema: {
73
+ type: 'object',
74
+ properties: {
75
+ session: { $ref: '#/components/schemas/Session' },
76
+ parentSessionId: { type: 'string' },
77
+ },
78
+ required: ['session', 'parentSessionId'],
79
+ },
80
+ },
81
+ },
82
+ },
83
+ 404: errorResponse(),
84
+ },
85
+ },
86
+ },
87
+ '/v1/research/{researchId}': {
88
+ delete: {
89
+ tags: ['sessions'],
90
+ operationId: 'deleteResearchSession',
91
+ summary: 'Delete a research session',
92
+ parameters: [
93
+ {
94
+ in: 'path',
95
+ name: 'researchId',
96
+ required: true,
97
+ schema: { type: 'string' },
98
+ },
99
+ projectQueryParam(),
100
+ ],
101
+ responses: {
102
+ 200: {
103
+ description: 'OK',
104
+ content: {
105
+ 'application/json': {
106
+ schema: {
107
+ type: 'object',
108
+ properties: { success: { type: 'boolean' } },
109
+ required: ['success'],
110
+ },
111
+ },
112
+ },
113
+ },
114
+ 400: errorResponse(),
115
+ 404: errorResponse(),
116
+ },
117
+ },
118
+ },
119
+ '/v1/sessions/{parentId}/inject': {
120
+ post: {
121
+ tags: ['sessions'],
122
+ operationId: 'injectResearchContext',
123
+ summary: 'Inject research context into parent session',
124
+ parameters: [
125
+ {
126
+ in: 'path',
127
+ name: 'parentId',
128
+ required: true,
129
+ schema: { type: 'string' },
130
+ },
131
+ projectQueryParam(),
132
+ ],
133
+ requestBody: {
134
+ required: true,
135
+ content: {
136
+ 'application/json': {
137
+ schema: {
138
+ type: 'object',
139
+ properties: {
140
+ researchSessionId: { type: 'string' },
141
+ label: { type: 'string' },
142
+ },
143
+ required: ['researchSessionId'],
144
+ },
145
+ },
146
+ },
147
+ },
148
+ responses: {
149
+ 200: {
150
+ description: 'OK',
151
+ content: {
152
+ 'application/json': {
153
+ schema: {
154
+ type: 'object',
155
+ properties: {
156
+ content: { type: 'string' },
157
+ label: { type: 'string' },
158
+ sessionId: { type: 'string' },
159
+ parentSessionId: { type: 'string' },
160
+ tokenEstimate: { type: 'integer' },
161
+ },
162
+ required: [
163
+ 'content',
164
+ 'label',
165
+ 'sessionId',
166
+ 'parentSessionId',
167
+ 'tokenEstimate',
168
+ ],
169
+ },
170
+ },
171
+ },
172
+ },
173
+ 400: errorResponse(),
174
+ 404: errorResponse(),
175
+ },
176
+ },
177
+ },
178
+ '/v1/research/{researchId}/export': {
179
+ post: {
180
+ tags: ['sessions'],
181
+ operationId: 'exportResearchSession',
182
+ summary: 'Export research session to a new main session',
183
+ parameters: [
184
+ {
185
+ in: 'path',
186
+ name: 'researchId',
187
+ required: true,
188
+ schema: { type: 'string' },
189
+ },
190
+ projectQueryParam(),
191
+ ],
192
+ requestBody: {
193
+ required: false,
194
+ content: {
195
+ 'application/json': {
196
+ schema: {
197
+ type: 'object',
198
+ properties: {
199
+ provider: { type: 'string' },
200
+ model: { type: 'string' },
201
+ agent: { type: 'string' },
202
+ },
203
+ },
204
+ },
205
+ },
206
+ },
207
+ responses: {
208
+ 201: {
209
+ description: 'Created',
210
+ content: {
211
+ 'application/json': {
212
+ schema: {
213
+ type: 'object',
214
+ properties: {
215
+ newSession: { $ref: '#/components/schemas/Session' },
216
+ injectedContext: { type: 'string' },
217
+ },
218
+ required: ['newSession', 'injectedContext'],
219
+ },
220
+ },
221
+ },
222
+ },
223
+ 404: errorResponse(),
224
+ },
225
+ },
226
+ },
227
+ } as const;
@@ -0,0 +1,93 @@
1
+ import { errorResponse } from '../helpers';
2
+
3
+ const sessionIdParam = {
4
+ in: 'path',
5
+ name: 'id',
6
+ required: true,
7
+ schema: { type: 'string' },
8
+ } as const;
9
+
10
+ export const sessionApprovalPaths = {
11
+ '/v1/sessions/{id}/approval': {
12
+ post: {
13
+ tags: ['sessions'],
14
+ operationId: 'resolveApproval',
15
+ summary: 'Approve or deny a tool execution',
16
+ parameters: [sessionIdParam],
17
+ requestBody: {
18
+ required: true,
19
+ content: {
20
+ 'application/json': {
21
+ schema: {
22
+ type: 'object',
23
+ properties: {
24
+ callId: { type: 'string' },
25
+ approved: { type: 'boolean' },
26
+ },
27
+ required: ['callId', 'approved'],
28
+ },
29
+ },
30
+ },
31
+ },
32
+ responses: {
33
+ 200: {
34
+ description: 'OK',
35
+ content: {
36
+ 'application/json': {
37
+ schema: {
38
+ type: 'object',
39
+ properties: {
40
+ ok: { type: 'boolean' },
41
+ callId: { type: 'string' },
42
+ approved: { type: 'boolean' },
43
+ },
44
+ required: ['ok', 'callId', 'approved'],
45
+ },
46
+ },
47
+ },
48
+ },
49
+ 400: errorResponse(),
50
+ 403: errorResponse(),
51
+ 404: errorResponse(),
52
+ },
53
+ },
54
+ },
55
+ '/v1/sessions/{id}/approval/pending': {
56
+ get: {
57
+ tags: ['sessions'],
58
+ operationId: 'getPendingApprovals',
59
+ summary: 'Get pending approvals for a session',
60
+ parameters: [sessionIdParam],
61
+ responses: {
62
+ 200: {
63
+ description: 'OK',
64
+ content: {
65
+ 'application/json': {
66
+ schema: {
67
+ type: 'object',
68
+ properties: {
69
+ ok: { type: 'boolean' },
70
+ pending: {
71
+ type: 'array',
72
+ items: {
73
+ type: 'object',
74
+ properties: {
75
+ callId: { type: 'string' },
76
+ toolName: { type: 'string' },
77
+ args: { type: 'object' },
78
+ messageId: { type: 'string' },
79
+ createdAt: { type: 'integer' },
80
+ },
81
+ required: ['callId', 'toolName', 'createdAt'],
82
+ },
83
+ },
84
+ },
85
+ required: ['ok', 'pending'],
86
+ },
87
+ },
88
+ },
89
+ },
90
+ },
91
+ },
92
+ },
93
+ } as const;
@@ -0,0 +1,336 @@
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 sessionExtrasPaths = {
11
+ '/v1/sessions/{sessionId}': {
12
+ patch: {
13
+ tags: ['sessions'],
14
+ operationId: 'updateSession',
15
+ summary: 'Update session preferences',
16
+ parameters: [sessionIdParam, projectQueryParam()],
17
+ requestBody: {
18
+ required: true,
19
+ content: {
20
+ 'application/json': {
21
+ schema: {
22
+ type: 'object',
23
+ properties: {
24
+ agent: { type: 'string' },
25
+ provider: { type: 'string' },
26
+ model: { type: 'string' },
27
+ },
28
+ },
29
+ },
30
+ },
31
+ },
32
+ responses: {
33
+ 200: {
34
+ description: 'OK',
35
+ content: {
36
+ 'application/json': {
37
+ schema: { $ref: '#/components/schemas/Session' },
38
+ },
39
+ },
40
+ },
41
+ 400: errorResponse(),
42
+ 404: errorResponse(),
43
+ },
44
+ },
45
+ delete: {
46
+ tags: ['sessions'],
47
+ operationId: 'deleteSession',
48
+ summary: 'Delete a session and all its messages',
49
+ parameters: [sessionIdParam, projectQueryParam()],
50
+ responses: {
51
+ 200: {
52
+ description: 'OK',
53
+ content: {
54
+ 'application/json': {
55
+ schema: {
56
+ type: 'object',
57
+ properties: { success: { type: 'boolean' } },
58
+ required: ['success'],
59
+ },
60
+ },
61
+ },
62
+ },
63
+ 404: errorResponse(),
64
+ },
65
+ },
66
+ },
67
+ '/v1/sessions/{sessionId}/queue': {
68
+ get: {
69
+ tags: ['sessions'],
70
+ operationId: 'getSessionQueue',
71
+ summary: 'Get queue state for a session',
72
+ parameters: [sessionIdParam],
73
+ responses: {
74
+ 200: {
75
+ description: 'OK',
76
+ content: {
77
+ 'application/json': {
78
+ schema: {
79
+ type: 'object',
80
+ properties: {
81
+ currentMessageId: {
82
+ type: 'string',
83
+ nullable: true,
84
+ },
85
+ queuedMessages: {
86
+ type: 'array',
87
+ items: {
88
+ type: 'object',
89
+ properties: {
90
+ assistantMessageId: { type: 'string' },
91
+ agent: { type: 'string' },
92
+ provider: { type: 'string' },
93
+ model: { type: 'string' },
94
+ },
95
+ },
96
+ },
97
+ isRunning: { type: 'boolean' },
98
+ },
99
+ required: ['currentMessageId', 'queuedMessages', 'isRunning'],
100
+ },
101
+ },
102
+ },
103
+ },
104
+ },
105
+ },
106
+ },
107
+ '/v1/sessions/{sessionId}/queue/{messageId}': {
108
+ delete: {
109
+ tags: ['sessions'],
110
+ operationId: 'removeFromQueue',
111
+ summary: 'Remove a message from session queue',
112
+ parameters: [
113
+ sessionIdParam,
114
+ {
115
+ in: 'path',
116
+ name: 'messageId',
117
+ required: true,
118
+ schema: { type: 'string' },
119
+ },
120
+ projectQueryParam(),
121
+ ],
122
+ responses: {
123
+ 200: {
124
+ description: 'OK',
125
+ content: {
126
+ 'application/json': {
127
+ schema: {
128
+ type: 'object',
129
+ properties: {
130
+ success: { type: 'boolean' },
131
+ removed: { type: 'boolean' },
132
+ wasQueued: { type: 'boolean' },
133
+ wasRunning: { type: 'boolean' },
134
+ wasStored: { type: 'boolean' },
135
+ },
136
+ required: ['success'],
137
+ },
138
+ },
139
+ },
140
+ },
141
+ 404: errorResponse(),
142
+ },
143
+ },
144
+ },
145
+ '/v1/sessions/{sessionId}/messages/{messageId}/retry': {
146
+ post: {
147
+ tags: ['sessions'],
148
+ operationId: 'retryMessage',
149
+ summary: 'Retry a failed assistant message',
150
+ parameters: [
151
+ sessionIdParam,
152
+ {
153
+ in: 'path',
154
+ name: 'messageId',
155
+ required: true,
156
+ schema: { type: 'string' },
157
+ },
158
+ projectQueryParam(),
159
+ ],
160
+ responses: {
161
+ 200: {
162
+ description: 'OK',
163
+ content: {
164
+ 'application/json': {
165
+ schema: {
166
+ type: 'object',
167
+ properties: {
168
+ success: { type: 'boolean' },
169
+ messageId: { type: 'string' },
170
+ },
171
+ required: ['success', 'messageId'],
172
+ },
173
+ },
174
+ },
175
+ },
176
+ 400: errorResponse(),
177
+ 404: errorResponse(),
178
+ },
179
+ },
180
+ },
181
+ '/v1/sessions/{sessionId}/share': {
182
+ get: {
183
+ tags: ['sessions'],
184
+ operationId: 'getShareStatus',
185
+ summary: 'Get share status for a session',
186
+ parameters: [sessionIdParam, projectQueryParam()],
187
+ responses: {
188
+ 200: {
189
+ description: 'OK',
190
+ content: {
191
+ 'application/json': {
192
+ schema: {
193
+ type: 'object',
194
+ properties: {
195
+ shared: { type: 'boolean' },
196
+ shareId: { type: 'string' },
197
+ url: { type: 'string' },
198
+ title: { type: 'string', nullable: true },
199
+ createdAt: { type: 'integer' },
200
+ lastSyncedAt: { type: 'integer' },
201
+ lastSyncedMessageId: { type: 'string' },
202
+ syncedMessages: { type: 'integer' },
203
+ totalMessages: { type: 'integer' },
204
+ pendingMessages: { type: 'integer' },
205
+ isSynced: { type: 'boolean' },
206
+ },
207
+ required: ['shared'],
208
+ },
209
+ },
210
+ },
211
+ },
212
+ },
213
+ },
214
+ post: {
215
+ tags: ['sessions'],
216
+ operationId: 'shareSession',
217
+ summary: 'Share a session',
218
+ parameters: [sessionIdParam, projectQueryParam()],
219
+ responses: {
220
+ 200: {
221
+ description: 'OK',
222
+ content: {
223
+ 'application/json': {
224
+ schema: {
225
+ type: 'object',
226
+ properties: {
227
+ shared: { type: 'boolean' },
228
+ shareId: { type: 'string' },
229
+ url: { type: 'string' },
230
+ message: { type: 'string' },
231
+ },
232
+ required: ['shared'],
233
+ },
234
+ },
235
+ },
236
+ },
237
+ 400: errorResponse(),
238
+ 404: errorResponse(),
239
+ },
240
+ },
241
+ put: {
242
+ tags: ['sessions'],
243
+ operationId: 'syncShare',
244
+ summary: 'Sync shared session with new messages',
245
+ parameters: [sessionIdParam, projectQueryParam()],
246
+ responses: {
247
+ 200: {
248
+ description: 'OK',
249
+ content: {
250
+ 'application/json': {
251
+ schema: {
252
+ type: 'object',
253
+ properties: {
254
+ synced: { type: 'boolean' },
255
+ url: { type: 'string' },
256
+ newMessages: { type: 'integer' },
257
+ message: { type: 'string' },
258
+ },
259
+ required: ['synced'],
260
+ },
261
+ },
262
+ },
263
+ },
264
+ 400: errorResponse(),
265
+ },
266
+ },
267
+ delete: {
268
+ tags: ['sessions'],
269
+ operationId: 'deleteShare',
270
+ summary: 'Delete a shared session',
271
+ parameters: [sessionIdParam, projectQueryParam()],
272
+ responses: {
273
+ 200: {
274
+ description: 'OK',
275
+ content: {
276
+ 'application/json': {
277
+ schema: {
278
+ type: 'object',
279
+ properties: {
280
+ deleted: { type: 'boolean' },
281
+ sessionId: { type: 'string' },
282
+ },
283
+ required: ['deleted', 'sessionId'],
284
+ },
285
+ },
286
+ },
287
+ },
288
+ 404: errorResponse(),
289
+ },
290
+ },
291
+ },
292
+ '/v1/shares': {
293
+ get: {
294
+ tags: ['sessions'],
295
+ operationId: 'listShares',
296
+ summary: 'List all shared sessions for a project',
297
+ parameters: [projectQueryParam()],
298
+ responses: {
299
+ 200: {
300
+ description: 'OK',
301
+ content: {
302
+ 'application/json': {
303
+ schema: {
304
+ type: 'object',
305
+ properties: {
306
+ shares: {
307
+ type: 'array',
308
+ items: {
309
+ type: 'object',
310
+ properties: {
311
+ sessionId: { type: 'string' },
312
+ shareId: { type: 'string' },
313
+ url: { type: 'string' },
314
+ title: { type: 'string', nullable: true },
315
+ createdAt: { type: 'integer' },
316
+ lastSyncedAt: { type: 'integer' },
317
+ },
318
+ required: [
319
+ 'sessionId',
320
+ 'shareId',
321
+ 'url',
322
+ 'createdAt',
323
+ 'lastSyncedAt',
324
+ ],
325
+ },
326
+ },
327
+ },
328
+ required: ['shares'],
329
+ },
330
+ },
331
+ },
332
+ },
333
+ },
334
+ },
335
+ },
336
+ } as const;