@ottocode/server 0.1.173
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.
- package/package.json +42 -0
- package/src/events/bus.ts +43 -0
- package/src/events/types.ts +32 -0
- package/src/index.ts +281 -0
- package/src/openapi/helpers.ts +64 -0
- package/src/openapi/paths/ask.ts +70 -0
- package/src/openapi/paths/config.ts +218 -0
- package/src/openapi/paths/files.ts +72 -0
- package/src/openapi/paths/git.ts +457 -0
- package/src/openapi/paths/messages.ts +92 -0
- package/src/openapi/paths/sessions.ts +90 -0
- package/src/openapi/paths/setu.ts +154 -0
- package/src/openapi/paths/stream.ts +26 -0
- package/src/openapi/paths/terminals.ts +226 -0
- package/src/openapi/schemas.ts +345 -0
- package/src/openapi/spec.ts +49 -0
- package/src/presets.ts +85 -0
- package/src/routes/ask.ts +113 -0
- package/src/routes/auth.ts +592 -0
- package/src/routes/branch.ts +106 -0
- package/src/routes/config/agents.ts +44 -0
- package/src/routes/config/cwd.ts +21 -0
- package/src/routes/config/defaults.ts +45 -0
- package/src/routes/config/index.ts +16 -0
- package/src/routes/config/main.ts +73 -0
- package/src/routes/config/models.ts +139 -0
- package/src/routes/config/providers.ts +46 -0
- package/src/routes/config/utils.ts +120 -0
- package/src/routes/files.ts +218 -0
- package/src/routes/git/branch.ts +75 -0
- package/src/routes/git/commit.ts +209 -0
- package/src/routes/git/diff.ts +137 -0
- package/src/routes/git/index.ts +18 -0
- package/src/routes/git/push.ts +160 -0
- package/src/routes/git/schemas.ts +48 -0
- package/src/routes/git/staging.ts +208 -0
- package/src/routes/git/status.ts +83 -0
- package/src/routes/git/types.ts +31 -0
- package/src/routes/git/utils.ts +249 -0
- package/src/routes/openapi.ts +6 -0
- package/src/routes/research.ts +392 -0
- package/src/routes/root.ts +5 -0
- package/src/routes/session-approval.ts +63 -0
- package/src/routes/session-files.ts +387 -0
- package/src/routes/session-messages.ts +170 -0
- package/src/routes/session-stream.ts +61 -0
- package/src/routes/sessions.ts +814 -0
- package/src/routes/setu.ts +346 -0
- package/src/routes/terminals.ts +227 -0
- package/src/runtime/agent/registry.ts +351 -0
- package/src/runtime/agent/runner-reasoning.ts +108 -0
- package/src/runtime/agent/runner-setup.ts +257 -0
- package/src/runtime/agent/runner.ts +375 -0
- package/src/runtime/agent-registry.ts +6 -0
- package/src/runtime/ask/service.ts +369 -0
- package/src/runtime/context/environment.ts +202 -0
- package/src/runtime/debug/index.ts +117 -0
- package/src/runtime/debug/state.ts +140 -0
- package/src/runtime/errors/api-error.ts +192 -0
- package/src/runtime/errors/handling.ts +199 -0
- package/src/runtime/message/compaction-auto.ts +154 -0
- package/src/runtime/message/compaction-context.ts +101 -0
- package/src/runtime/message/compaction-detect.ts +26 -0
- package/src/runtime/message/compaction-limits.ts +37 -0
- package/src/runtime/message/compaction-mark.ts +111 -0
- package/src/runtime/message/compaction-prune.ts +75 -0
- package/src/runtime/message/compaction.ts +21 -0
- package/src/runtime/message/history-builder.ts +266 -0
- package/src/runtime/message/service.ts +468 -0
- package/src/runtime/message/tool-history-tracker.ts +204 -0
- package/src/runtime/prompt/builder.ts +167 -0
- package/src/runtime/provider/anthropic.ts +50 -0
- package/src/runtime/provider/copilot.ts +12 -0
- package/src/runtime/provider/google.ts +8 -0
- package/src/runtime/provider/index.ts +60 -0
- package/src/runtime/provider/moonshot.ts +8 -0
- package/src/runtime/provider/oauth-adapter.ts +237 -0
- package/src/runtime/provider/openai.ts +18 -0
- package/src/runtime/provider/opencode.ts +7 -0
- package/src/runtime/provider/openrouter.ts +7 -0
- package/src/runtime/provider/selection.ts +118 -0
- package/src/runtime/provider/setu.ts +126 -0
- package/src/runtime/provider/zai.ts +16 -0
- package/src/runtime/session/branch.ts +280 -0
- package/src/runtime/session/db-operations.ts +285 -0
- package/src/runtime/session/manager.ts +99 -0
- package/src/runtime/session/queue.ts +243 -0
- package/src/runtime/stream/abort-handler.ts +65 -0
- package/src/runtime/stream/error-handler.ts +371 -0
- package/src/runtime/stream/finish-handler.ts +101 -0
- package/src/runtime/stream/handlers.ts +5 -0
- package/src/runtime/stream/step-finish.ts +93 -0
- package/src/runtime/stream/types.ts +25 -0
- package/src/runtime/tools/approval.ts +180 -0
- package/src/runtime/tools/context.ts +83 -0
- package/src/runtime/tools/mapping.ts +154 -0
- package/src/runtime/tools/setup.ts +44 -0
- package/src/runtime/topup/manager.ts +110 -0
- package/src/runtime/utils/cwd.ts +69 -0
- package/src/runtime/utils/token.ts +35 -0
- package/src/tools/adapter.ts +634 -0
- package/src/tools/database/get-parent-session.ts +183 -0
- package/src/tools/database/get-session-context.ts +161 -0
- package/src/tools/database/index.ts +42 -0
- package/src/tools/database/present-session-links.ts +47 -0
- package/src/tools/database/query-messages.ts +160 -0
- package/src/tools/database/query-sessions.ts +126 -0
- package/src/tools/database/search-history.ts +135 -0
- package/src/types/sql-imports.d.ts +5 -0
- package/sst-env.d.ts +8 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
default: { $ref: '#/components/schemas/Provider' },
|
|
95
|
+
},
|
|
96
|
+
required: ['providers', 'default'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
'/v1/config/providers/{provider}/models': {
|
|
105
|
+
get: {
|
|
106
|
+
tags: ['config'],
|
|
107
|
+
operationId: 'getProviderModels',
|
|
108
|
+
summary: 'Get available models for a provider',
|
|
109
|
+
parameters: [
|
|
110
|
+
projectQueryParam(),
|
|
111
|
+
{
|
|
112
|
+
in: 'path',
|
|
113
|
+
name: 'provider',
|
|
114
|
+
required: true,
|
|
115
|
+
schema: { $ref: '#/components/schemas/Provider' },
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
responses: {
|
|
119
|
+
200: {
|
|
120
|
+
description: 'OK',
|
|
121
|
+
content: {
|
|
122
|
+
'application/json': {
|
|
123
|
+
schema: {
|
|
124
|
+
type: 'object',
|
|
125
|
+
properties: {
|
|
126
|
+
models: {
|
|
127
|
+
type: 'array',
|
|
128
|
+
items: { $ref: '#/components/schemas/Model' },
|
|
129
|
+
},
|
|
130
|
+
default: { type: 'string', nullable: true },
|
|
131
|
+
},
|
|
132
|
+
required: ['models'],
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
403: {
|
|
138
|
+
description: 'Provider not authorized',
|
|
139
|
+
content: {
|
|
140
|
+
'application/json': {
|
|
141
|
+
schema: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
properties: { error: { type: 'string' } },
|
|
144
|
+
required: ['error'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
404: {
|
|
150
|
+
description: 'Provider not found',
|
|
151
|
+
content: {
|
|
152
|
+
'application/json': {
|
|
153
|
+
schema: {
|
|
154
|
+
type: 'object',
|
|
155
|
+
properties: { error: { type: 'string' } },
|
|
156
|
+
required: ['error'],
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
'/v1/config/defaults': {
|
|
165
|
+
patch: {
|
|
166
|
+
tags: ['config'],
|
|
167
|
+
operationId: 'updateDefaults',
|
|
168
|
+
summary: 'Update default configuration',
|
|
169
|
+
description: 'Update the default agent, provider, and/or model',
|
|
170
|
+
parameters: [projectQueryParam()],
|
|
171
|
+
requestBody: {
|
|
172
|
+
required: true,
|
|
173
|
+
content: {
|
|
174
|
+
'application/json': {
|
|
175
|
+
schema: {
|
|
176
|
+
type: 'object',
|
|
177
|
+
properties: {
|
|
178
|
+
agent: { type: 'string' },
|
|
179
|
+
provider: { type: 'string' },
|
|
180
|
+
model: { type: 'string' },
|
|
181
|
+
scope: {
|
|
182
|
+
type: 'string',
|
|
183
|
+
enum: ['global', 'local'],
|
|
184
|
+
default: 'local',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
responses: {
|
|
192
|
+
200: {
|
|
193
|
+
description: 'OK',
|
|
194
|
+
content: {
|
|
195
|
+
'application/json': {
|
|
196
|
+
schema: {
|
|
197
|
+
type: 'object',
|
|
198
|
+
properties: {
|
|
199
|
+
success: { type: 'boolean' },
|
|
200
|
+
defaults: {
|
|
201
|
+
type: 'object',
|
|
202
|
+
properties: {
|
|
203
|
+
agent: { type: 'string' },
|
|
204
|
+
provider: { type: 'string' },
|
|
205
|
+
model: { type: 'string' },
|
|
206
|
+
},
|
|
207
|
+
required: ['agent', 'provider', 'model'],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
required: ['success', 'defaults'],
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
} as const;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { projectQueryParam } from '../helpers';
|
|
2
|
+
|
|
3
|
+
export const filesPaths = {
|
|
4
|
+
'/v1/files': {
|
|
5
|
+
get: {
|
|
6
|
+
tags: ['files'],
|
|
7
|
+
operationId: 'listFiles',
|
|
8
|
+
summary: 'List project files',
|
|
9
|
+
description:
|
|
10
|
+
'Returns list of files in the project directory, excluding common build artifacts and dependencies',
|
|
11
|
+
parameters: [
|
|
12
|
+
projectQueryParam(),
|
|
13
|
+
{
|
|
14
|
+
in: 'query',
|
|
15
|
+
name: 'maxDepth',
|
|
16
|
+
required: false,
|
|
17
|
+
schema: { type: 'integer', default: 10 },
|
|
18
|
+
description: 'Maximum directory depth to traverse',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
in: 'query',
|
|
22
|
+
name: 'limit',
|
|
23
|
+
required: false,
|
|
24
|
+
schema: { type: 'integer', default: 1000 },
|
|
25
|
+
description: 'Maximum number of files to return',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
responses: {
|
|
29
|
+
200: {
|
|
30
|
+
description: 'OK',
|
|
31
|
+
content: {
|
|
32
|
+
'application/json': {
|
|
33
|
+
schema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
files: {
|
|
37
|
+
type: 'array',
|
|
38
|
+
items: { type: 'string' },
|
|
39
|
+
},
|
|
40
|
+
changedFiles: {
|
|
41
|
+
type: 'array',
|
|
42
|
+
items: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
properties: {
|
|
45
|
+
path: { type: 'string' },
|
|
46
|
+
status: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
enum: [
|
|
49
|
+
'added',
|
|
50
|
+
'modified',
|
|
51
|
+
'deleted',
|
|
52
|
+
'renamed',
|
|
53
|
+
'untracked',
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
required: ['path', 'status'],
|
|
58
|
+
},
|
|
59
|
+
description:
|
|
60
|
+
'List of files with uncommitted changes (from git status)',
|
|
61
|
+
},
|
|
62
|
+
truncated: { type: 'boolean' },
|
|
63
|
+
},
|
|
64
|
+
required: ['files', 'changedFiles', 'truncated'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
} as const;
|