@roo-code/types 1.2.0
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/LICENSE +21 -0
- package/README.md +58 -0
- package/index.d.ts +694 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Roo Code Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Roo Code Types
|
|
2
|
+
|
|
3
|
+
TypeScript type definitions for Roo Code.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install roo-code-types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add roo-code-types
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Import the types in your TypeScript files:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import {
|
|
23
|
+
RooCodeAPI,
|
|
24
|
+
RooCodeSettings,
|
|
25
|
+
GlobalSettings,
|
|
26
|
+
ProviderSettings,
|
|
27
|
+
ClineMessage,
|
|
28
|
+
TokenUsage,
|
|
29
|
+
RooCodeEventName,
|
|
30
|
+
RooCodeEvents,
|
|
31
|
+
} from "roo-code-types"
|
|
32
|
+
|
|
33
|
+
// Use the types in your code
|
|
34
|
+
const settings: RooCodeSettings = {
|
|
35
|
+
// Your settings here
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Example: Type an event handler
|
|
39
|
+
function handleMessage(event: RooCodeEvents["message"][0]) {
|
|
40
|
+
console.log(event.message.text)
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Available Types
|
|
45
|
+
|
|
46
|
+
- `GlobalSettings`: Global configuration settings for Roo Code
|
|
47
|
+
- `ProviderSettings`: Provider-specific settings
|
|
48
|
+
- `ProviderSettingsEntry`: Entry for a provider configuration
|
|
49
|
+
- `ClineMessage`: Message structure for Cline interactions
|
|
50
|
+
- `TokenUsage`: Structure for token usage information
|
|
51
|
+
- `RooCodeEvents`: Event types for the Roo Code API
|
|
52
|
+
- `RooCodeEventName`: Enum of event names
|
|
53
|
+
- `RooCodeSettings`: Combined global and provider settings
|
|
54
|
+
- `RooCodeAPI`: Interface for the Roo Code API
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
import { EventEmitter } from "events"
|
|
2
|
+
|
|
3
|
+
type GlobalSettings = {
|
|
4
|
+
currentApiConfigName?: string | undefined
|
|
5
|
+
listApiConfigMeta?:
|
|
6
|
+
| {
|
|
7
|
+
id: string
|
|
8
|
+
name: string
|
|
9
|
+
apiProvider?:
|
|
10
|
+
| (
|
|
11
|
+
| "anthropic"
|
|
12
|
+
| "glama"
|
|
13
|
+
| "openrouter"
|
|
14
|
+
| "bedrock"
|
|
15
|
+
| "vertex"
|
|
16
|
+
| "openai"
|
|
17
|
+
| "ollama"
|
|
18
|
+
| "vscode-lm"
|
|
19
|
+
| "lmstudio"
|
|
20
|
+
| "gemini"
|
|
21
|
+
| "openai-native"
|
|
22
|
+
| "mistral"
|
|
23
|
+
| "deepseek"
|
|
24
|
+
| "unbound"
|
|
25
|
+
| "requesty"
|
|
26
|
+
| "human-relay"
|
|
27
|
+
| "fake-ai"
|
|
28
|
+
| "xai"
|
|
29
|
+
| "groq"
|
|
30
|
+
| "chutes"
|
|
31
|
+
| "litellm"
|
|
32
|
+
)
|
|
33
|
+
| undefined
|
|
34
|
+
}[]
|
|
35
|
+
| undefined
|
|
36
|
+
pinnedApiConfigs?:
|
|
37
|
+
| {
|
|
38
|
+
[x: string]: boolean
|
|
39
|
+
}
|
|
40
|
+
| undefined
|
|
41
|
+
lastShownAnnouncementId?: string | undefined
|
|
42
|
+
customInstructions?: string | undefined
|
|
43
|
+
taskHistory?:
|
|
44
|
+
| {
|
|
45
|
+
id: string
|
|
46
|
+
number: number
|
|
47
|
+
ts: number
|
|
48
|
+
task: string
|
|
49
|
+
tokensIn: number
|
|
50
|
+
tokensOut: number
|
|
51
|
+
cacheWrites?: number | undefined
|
|
52
|
+
cacheReads?: number | undefined
|
|
53
|
+
totalCost: number
|
|
54
|
+
size?: number | undefined
|
|
55
|
+
workspace?: string | undefined
|
|
56
|
+
}[]
|
|
57
|
+
| undefined
|
|
58
|
+
autoApprovalEnabled?: boolean | undefined
|
|
59
|
+
alwaysAllowReadOnly?: boolean | undefined
|
|
60
|
+
alwaysAllowReadOnlyOutsideWorkspace?: boolean | undefined
|
|
61
|
+
alwaysAllowWrite?: boolean | undefined
|
|
62
|
+
alwaysAllowWriteOutsideWorkspace?: boolean | undefined
|
|
63
|
+
writeDelayMs?: number | undefined
|
|
64
|
+
alwaysAllowBrowser?: boolean | undefined
|
|
65
|
+
alwaysApproveResubmit?: boolean | undefined
|
|
66
|
+
requestDelaySeconds?: number | undefined
|
|
67
|
+
alwaysAllowMcp?: boolean | undefined
|
|
68
|
+
alwaysAllowModeSwitch?: boolean | undefined
|
|
69
|
+
alwaysAllowSubtasks?: boolean | undefined
|
|
70
|
+
alwaysAllowExecute?: boolean | undefined
|
|
71
|
+
allowedCommands?: string[] | undefined
|
|
72
|
+
browserToolEnabled?: boolean | undefined
|
|
73
|
+
browserViewportSize?: string | undefined
|
|
74
|
+
screenshotQuality?: number | undefined
|
|
75
|
+
remoteBrowserEnabled?: boolean | undefined
|
|
76
|
+
remoteBrowserHost?: string | undefined
|
|
77
|
+
cachedChromeHostUrl?: string | undefined
|
|
78
|
+
enableCheckpoints?: boolean | undefined
|
|
79
|
+
ttsEnabled?: boolean | undefined
|
|
80
|
+
ttsSpeed?: number | undefined
|
|
81
|
+
soundEnabled?: boolean | undefined
|
|
82
|
+
soundVolume?: number | undefined
|
|
83
|
+
maxOpenTabsContext?: number | undefined
|
|
84
|
+
maxWorkspaceFiles?: number | undefined
|
|
85
|
+
showRooIgnoredFiles?: boolean | undefined
|
|
86
|
+
maxReadFileLine?: number | undefined
|
|
87
|
+
terminalOutputLineLimit?: number | undefined
|
|
88
|
+
terminalShellIntegrationTimeout?: number | undefined
|
|
89
|
+
terminalShellIntegrationDisabled?: boolean | undefined
|
|
90
|
+
terminalCommandDelay?: number | undefined
|
|
91
|
+
terminalPowershellCounter?: boolean | undefined
|
|
92
|
+
terminalZshClearEolMark?: boolean | undefined
|
|
93
|
+
terminalZshOhMy?: boolean | undefined
|
|
94
|
+
terminalZshP10k?: boolean | undefined
|
|
95
|
+
terminalZdotdir?: boolean | undefined
|
|
96
|
+
terminalCompressProgressBar?: boolean | undefined
|
|
97
|
+
rateLimitSeconds?: number | undefined
|
|
98
|
+
diffEnabled?: boolean | undefined
|
|
99
|
+
fuzzyMatchThreshold?: number | undefined
|
|
100
|
+
experiments?:
|
|
101
|
+
| {
|
|
102
|
+
powerSteering: boolean
|
|
103
|
+
}
|
|
104
|
+
| undefined
|
|
105
|
+
language?:
|
|
106
|
+
| (
|
|
107
|
+
| "ca"
|
|
108
|
+
| "de"
|
|
109
|
+
| "en"
|
|
110
|
+
| "es"
|
|
111
|
+
| "fr"
|
|
112
|
+
| "hi"
|
|
113
|
+
| "it"
|
|
114
|
+
| "ja"
|
|
115
|
+
| "ko"
|
|
116
|
+
| "nl"
|
|
117
|
+
| "pl"
|
|
118
|
+
| "pt-BR"
|
|
119
|
+
| "ru"
|
|
120
|
+
| "tr"
|
|
121
|
+
| "vi"
|
|
122
|
+
| "zh-CN"
|
|
123
|
+
| "zh-TW"
|
|
124
|
+
)
|
|
125
|
+
| undefined
|
|
126
|
+
telemetrySetting?: ("unset" | "enabled" | "disabled") | undefined
|
|
127
|
+
mcpEnabled?: boolean | undefined
|
|
128
|
+
enableMcpServerCreation?: boolean | undefined
|
|
129
|
+
mode?: string | undefined
|
|
130
|
+
modeApiConfigs?:
|
|
131
|
+
| {
|
|
132
|
+
[x: string]: string
|
|
133
|
+
}
|
|
134
|
+
| undefined
|
|
135
|
+
customModes?:
|
|
136
|
+
| {
|
|
137
|
+
slug: string
|
|
138
|
+
name: string
|
|
139
|
+
roleDefinition: string
|
|
140
|
+
customInstructions?: string | undefined
|
|
141
|
+
groups: (
|
|
142
|
+
| ("read" | "edit" | "browser" | "command" | "mcp" | "modes")
|
|
143
|
+
| [
|
|
144
|
+
"read" | "edit" | "browser" | "command" | "mcp" | "modes",
|
|
145
|
+
{
|
|
146
|
+
fileRegex?: string | undefined
|
|
147
|
+
description?: string | undefined
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
)[]
|
|
151
|
+
source?: ("global" | "project") | undefined
|
|
152
|
+
}[]
|
|
153
|
+
| undefined
|
|
154
|
+
customModePrompts?:
|
|
155
|
+
| {
|
|
156
|
+
[x: string]:
|
|
157
|
+
| {
|
|
158
|
+
roleDefinition?: string | undefined
|
|
159
|
+
customInstructions?: string | undefined
|
|
160
|
+
}
|
|
161
|
+
| undefined
|
|
162
|
+
}
|
|
163
|
+
| undefined
|
|
164
|
+
customSupportPrompts?:
|
|
165
|
+
| {
|
|
166
|
+
[x: string]: string | undefined
|
|
167
|
+
}
|
|
168
|
+
| undefined
|
|
169
|
+
enhancementApiConfigId?: string | undefined
|
|
170
|
+
historyPreviewCollapsed?: boolean | undefined
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
type ProviderSettings = {
|
|
174
|
+
apiProvider?:
|
|
175
|
+
| (
|
|
176
|
+
| "anthropic"
|
|
177
|
+
| "glama"
|
|
178
|
+
| "openrouter"
|
|
179
|
+
| "bedrock"
|
|
180
|
+
| "vertex"
|
|
181
|
+
| "openai"
|
|
182
|
+
| "ollama"
|
|
183
|
+
| "vscode-lm"
|
|
184
|
+
| "lmstudio"
|
|
185
|
+
| "gemini"
|
|
186
|
+
| "openai-native"
|
|
187
|
+
| "mistral"
|
|
188
|
+
| "deepseek"
|
|
189
|
+
| "unbound"
|
|
190
|
+
| "requesty"
|
|
191
|
+
| "human-relay"
|
|
192
|
+
| "fake-ai"
|
|
193
|
+
| "xai"
|
|
194
|
+
| "groq"
|
|
195
|
+
| "chutes"
|
|
196
|
+
| "litellm"
|
|
197
|
+
)
|
|
198
|
+
| undefined
|
|
199
|
+
includeMaxTokens?: boolean | undefined
|
|
200
|
+
reasoningEffort?: ("low" | "medium" | "high") | undefined
|
|
201
|
+
diffEnabled?: boolean | undefined
|
|
202
|
+
fuzzyMatchThreshold?: number | undefined
|
|
203
|
+
modelTemperature?: (number | null) | undefined
|
|
204
|
+
rateLimitSeconds?: number | undefined
|
|
205
|
+
modelMaxTokens?: number | undefined
|
|
206
|
+
modelMaxThinkingTokens?: number | undefined
|
|
207
|
+
apiModelId?: string | undefined
|
|
208
|
+
apiKey?: string | undefined
|
|
209
|
+
anthropicBaseUrl?: string | undefined
|
|
210
|
+
anthropicUseAuthToken?: boolean | undefined
|
|
211
|
+
glamaModelId?: string | undefined
|
|
212
|
+
glamaApiKey?: string | undefined
|
|
213
|
+
openRouterApiKey?: string | undefined
|
|
214
|
+
openRouterModelId?: string | undefined
|
|
215
|
+
openRouterBaseUrl?: string | undefined
|
|
216
|
+
openRouterSpecificProvider?: string | undefined
|
|
217
|
+
openRouterUseMiddleOutTransform?: boolean | undefined
|
|
218
|
+
awsAccessKey?: string | undefined
|
|
219
|
+
awsSecretKey?: string | undefined
|
|
220
|
+
awsSessionToken?: string | undefined
|
|
221
|
+
awsRegion?: string | undefined
|
|
222
|
+
awsUseCrossRegionInference?: boolean | undefined
|
|
223
|
+
awsUsePromptCache?: boolean | undefined
|
|
224
|
+
awsProfile?: string | undefined
|
|
225
|
+
awsUseProfile?: boolean | undefined
|
|
226
|
+
awsCustomArn?: string | undefined
|
|
227
|
+
vertexKeyFile?: string | undefined
|
|
228
|
+
vertexJsonCredentials?: string | undefined
|
|
229
|
+
vertexProjectId?: string | undefined
|
|
230
|
+
vertexRegion?: string | undefined
|
|
231
|
+
openAiBaseUrl?: string | undefined
|
|
232
|
+
openAiApiKey?: string | undefined
|
|
233
|
+
openAiLegacyFormat?: boolean | undefined
|
|
234
|
+
openAiR1FormatEnabled?: boolean | undefined
|
|
235
|
+
openAiModelId?: string | undefined
|
|
236
|
+
openAiCustomModelInfo?:
|
|
237
|
+
| ({
|
|
238
|
+
maxTokens?: (number | null) | undefined
|
|
239
|
+
maxThinkingTokens?: (number | null) | undefined
|
|
240
|
+
contextWindow: number
|
|
241
|
+
supportsImages?: boolean | undefined
|
|
242
|
+
supportsComputerUse?: boolean | undefined
|
|
243
|
+
supportsPromptCache: boolean
|
|
244
|
+
inputPrice?: number | undefined
|
|
245
|
+
outputPrice?: number | undefined
|
|
246
|
+
cacheWritesPrice?: number | undefined
|
|
247
|
+
cacheReadsPrice?: number | undefined
|
|
248
|
+
description?: string | undefined
|
|
249
|
+
reasoningEffort?: ("low" | "medium" | "high") | undefined
|
|
250
|
+
thinking?: boolean | undefined
|
|
251
|
+
minTokensPerCachePoint?: number | undefined
|
|
252
|
+
maxCachePoints?: number | undefined
|
|
253
|
+
cachableFields?: string[] | undefined
|
|
254
|
+
tiers?:
|
|
255
|
+
| {
|
|
256
|
+
contextWindow: number
|
|
257
|
+
inputPrice?: number | undefined
|
|
258
|
+
outputPrice?: number | undefined
|
|
259
|
+
cacheWritesPrice?: number | undefined
|
|
260
|
+
cacheReadsPrice?: number | undefined
|
|
261
|
+
}[]
|
|
262
|
+
| undefined
|
|
263
|
+
} | null)
|
|
264
|
+
| undefined
|
|
265
|
+
openAiUseAzure?: boolean | undefined
|
|
266
|
+
azureApiVersion?: string | undefined
|
|
267
|
+
openAiStreamingEnabled?: boolean | undefined
|
|
268
|
+
enableReasoningEffort?: boolean | undefined
|
|
269
|
+
openAiHostHeader?: string | undefined
|
|
270
|
+
openAiHeaders?:
|
|
271
|
+
| {
|
|
272
|
+
[x: string]: string
|
|
273
|
+
}
|
|
274
|
+
| undefined
|
|
275
|
+
ollamaModelId?: string | undefined
|
|
276
|
+
ollamaBaseUrl?: string | undefined
|
|
277
|
+
vsCodeLmModelSelector?:
|
|
278
|
+
| {
|
|
279
|
+
vendor?: string | undefined
|
|
280
|
+
family?: string | undefined
|
|
281
|
+
version?: string | undefined
|
|
282
|
+
id?: string | undefined
|
|
283
|
+
}
|
|
284
|
+
| undefined
|
|
285
|
+
lmStudioModelId?: string | undefined
|
|
286
|
+
lmStudioBaseUrl?: string | undefined
|
|
287
|
+
lmStudioDraftModelId?: string | undefined
|
|
288
|
+
lmStudioSpeculativeDecodingEnabled?: boolean | undefined
|
|
289
|
+
geminiApiKey?: string | undefined
|
|
290
|
+
googleGeminiBaseUrl?: string | undefined
|
|
291
|
+
openAiNativeApiKey?: string | undefined
|
|
292
|
+
openAiNativeBaseUrl?: string | undefined
|
|
293
|
+
mistralApiKey?: string | undefined
|
|
294
|
+
mistralCodestralUrl?: string | undefined
|
|
295
|
+
deepSeekBaseUrl?: string | undefined
|
|
296
|
+
deepSeekApiKey?: string | undefined
|
|
297
|
+
unboundApiKey?: string | undefined
|
|
298
|
+
unboundModelId?: string | undefined
|
|
299
|
+
requestyApiKey?: string | undefined
|
|
300
|
+
requestyModelId?: string | undefined
|
|
301
|
+
fakeAi?: unknown | undefined
|
|
302
|
+
xaiApiKey?: string | undefined
|
|
303
|
+
groqApiKey?: string | undefined
|
|
304
|
+
chutesApiKey?: string | undefined
|
|
305
|
+
litellmBaseUrl?: string | undefined
|
|
306
|
+
litellmApiKey?: string | undefined
|
|
307
|
+
litellmModelId?: string | undefined
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type ProviderSettingsEntry = {
|
|
311
|
+
id: string
|
|
312
|
+
name: string
|
|
313
|
+
apiProvider?:
|
|
314
|
+
| (
|
|
315
|
+
| "anthropic"
|
|
316
|
+
| "glama"
|
|
317
|
+
| "openrouter"
|
|
318
|
+
| "bedrock"
|
|
319
|
+
| "vertex"
|
|
320
|
+
| "openai"
|
|
321
|
+
| "ollama"
|
|
322
|
+
| "vscode-lm"
|
|
323
|
+
| "lmstudio"
|
|
324
|
+
| "gemini"
|
|
325
|
+
| "openai-native"
|
|
326
|
+
| "mistral"
|
|
327
|
+
| "deepseek"
|
|
328
|
+
| "unbound"
|
|
329
|
+
| "requesty"
|
|
330
|
+
| "human-relay"
|
|
331
|
+
| "fake-ai"
|
|
332
|
+
| "xai"
|
|
333
|
+
| "groq"
|
|
334
|
+
| "chutes"
|
|
335
|
+
| "litellm"
|
|
336
|
+
)
|
|
337
|
+
| undefined
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
type ClineMessage = {
|
|
341
|
+
ts: number
|
|
342
|
+
type: "ask" | "say"
|
|
343
|
+
ask?:
|
|
344
|
+
| (
|
|
345
|
+
| "followup"
|
|
346
|
+
| "command"
|
|
347
|
+
| "command_output"
|
|
348
|
+
| "completion_result"
|
|
349
|
+
| "tool"
|
|
350
|
+
| "api_req_failed"
|
|
351
|
+
| "resume_task"
|
|
352
|
+
| "resume_completed_task"
|
|
353
|
+
| "mistake_limit_reached"
|
|
354
|
+
| "browser_action_launch"
|
|
355
|
+
| "use_mcp_server"
|
|
356
|
+
)
|
|
357
|
+
| undefined
|
|
358
|
+
say?:
|
|
359
|
+
| (
|
|
360
|
+
| "error"
|
|
361
|
+
| "api_req_started"
|
|
362
|
+
| "api_req_finished"
|
|
363
|
+
| "api_req_retried"
|
|
364
|
+
| "api_req_retry_delayed"
|
|
365
|
+
| "api_req_deleted"
|
|
366
|
+
| "text"
|
|
367
|
+
| "reasoning"
|
|
368
|
+
| "completion_result"
|
|
369
|
+
| "user_feedback"
|
|
370
|
+
| "user_feedback_diff"
|
|
371
|
+
| "command_output"
|
|
372
|
+
| "shell_integration_warning"
|
|
373
|
+
| "browser_action"
|
|
374
|
+
| "browser_action_result"
|
|
375
|
+
| "mcp_server_request_started"
|
|
376
|
+
| "mcp_server_response"
|
|
377
|
+
| "subtask_result"
|
|
378
|
+
| "checkpoint_saved"
|
|
379
|
+
| "rooignore_error"
|
|
380
|
+
| "diff_error"
|
|
381
|
+
)
|
|
382
|
+
| undefined
|
|
383
|
+
text?: string | undefined
|
|
384
|
+
images?: string[] | undefined
|
|
385
|
+
partial?: boolean | undefined
|
|
386
|
+
reasoning?: string | undefined
|
|
387
|
+
conversationHistoryIndex?: number | undefined
|
|
388
|
+
checkpoint?:
|
|
389
|
+
| {
|
|
390
|
+
[x: string]: unknown
|
|
391
|
+
}
|
|
392
|
+
| undefined
|
|
393
|
+
progressStatus?:
|
|
394
|
+
| {
|
|
395
|
+
icon?: string | undefined
|
|
396
|
+
text?: string | undefined
|
|
397
|
+
}
|
|
398
|
+
| undefined
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
type TokenUsage = {
|
|
402
|
+
totalTokensIn: number
|
|
403
|
+
totalTokensOut: number
|
|
404
|
+
totalCacheWrites?: number | undefined
|
|
405
|
+
totalCacheReads?: number | undefined
|
|
406
|
+
totalCost: number
|
|
407
|
+
contextTokens: number
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
type RooCodeEvents = {
|
|
411
|
+
message: [
|
|
412
|
+
{
|
|
413
|
+
taskId: string
|
|
414
|
+
action: "created" | "updated"
|
|
415
|
+
message: {
|
|
416
|
+
ts: number
|
|
417
|
+
type: "ask" | "say"
|
|
418
|
+
ask?:
|
|
419
|
+
| (
|
|
420
|
+
| "followup"
|
|
421
|
+
| "command"
|
|
422
|
+
| "command_output"
|
|
423
|
+
| "completion_result"
|
|
424
|
+
| "tool"
|
|
425
|
+
| "api_req_failed"
|
|
426
|
+
| "resume_task"
|
|
427
|
+
| "resume_completed_task"
|
|
428
|
+
| "mistake_limit_reached"
|
|
429
|
+
| "browser_action_launch"
|
|
430
|
+
| "use_mcp_server"
|
|
431
|
+
)
|
|
432
|
+
| undefined
|
|
433
|
+
say?:
|
|
434
|
+
| (
|
|
435
|
+
| "error"
|
|
436
|
+
| "api_req_started"
|
|
437
|
+
| "api_req_finished"
|
|
438
|
+
| "api_req_retried"
|
|
439
|
+
| "api_req_retry_delayed"
|
|
440
|
+
| "api_req_deleted"
|
|
441
|
+
| "text"
|
|
442
|
+
| "reasoning"
|
|
443
|
+
| "completion_result"
|
|
444
|
+
| "user_feedback"
|
|
445
|
+
| "user_feedback_diff"
|
|
446
|
+
| "command_output"
|
|
447
|
+
| "shell_integration_warning"
|
|
448
|
+
| "browser_action"
|
|
449
|
+
| "browser_action_result"
|
|
450
|
+
| "mcp_server_request_started"
|
|
451
|
+
| "mcp_server_response"
|
|
452
|
+
| "subtask_result"
|
|
453
|
+
| "checkpoint_saved"
|
|
454
|
+
| "rooignore_error"
|
|
455
|
+
| "diff_error"
|
|
456
|
+
)
|
|
457
|
+
| undefined
|
|
458
|
+
text?: string | undefined
|
|
459
|
+
images?: string[] | undefined
|
|
460
|
+
partial?: boolean | undefined
|
|
461
|
+
reasoning?: string | undefined
|
|
462
|
+
conversationHistoryIndex?: number | undefined
|
|
463
|
+
checkpoint?:
|
|
464
|
+
| {
|
|
465
|
+
[x: string]: unknown
|
|
466
|
+
}
|
|
467
|
+
| undefined
|
|
468
|
+
progressStatus?:
|
|
469
|
+
| {
|
|
470
|
+
icon?: string | undefined
|
|
471
|
+
text?: string | undefined
|
|
472
|
+
}
|
|
473
|
+
| undefined
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
]
|
|
477
|
+
taskCreated: [string]
|
|
478
|
+
taskStarted: [string]
|
|
479
|
+
taskModeSwitched: [string, string]
|
|
480
|
+
taskPaused: [string]
|
|
481
|
+
taskUnpaused: [string]
|
|
482
|
+
taskAskResponded: [string]
|
|
483
|
+
taskAborted: [string]
|
|
484
|
+
taskSpawned: [string, string]
|
|
485
|
+
taskCompleted: [
|
|
486
|
+
string,
|
|
487
|
+
{
|
|
488
|
+
totalTokensIn: number
|
|
489
|
+
totalTokensOut: number
|
|
490
|
+
totalCacheWrites?: number | undefined
|
|
491
|
+
totalCacheReads?: number | undefined
|
|
492
|
+
totalCost: number
|
|
493
|
+
contextTokens: number
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
[x: string]: {
|
|
497
|
+
attempts: number
|
|
498
|
+
failures: number
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
]
|
|
502
|
+
taskTokenUsageUpdated: [
|
|
503
|
+
string,
|
|
504
|
+
{
|
|
505
|
+
totalTokensIn: number
|
|
506
|
+
totalTokensOut: number
|
|
507
|
+
totalCacheWrites?: number | undefined
|
|
508
|
+
totalCacheReads?: number | undefined
|
|
509
|
+
totalCost: number
|
|
510
|
+
contextTokens: number
|
|
511
|
+
},
|
|
512
|
+
]
|
|
513
|
+
taskToolFailed: [
|
|
514
|
+
string,
|
|
515
|
+
(
|
|
516
|
+
| "execute_command"
|
|
517
|
+
| "read_file"
|
|
518
|
+
| "write_to_file"
|
|
519
|
+
| "apply_diff"
|
|
520
|
+
| "insert_content"
|
|
521
|
+
| "search_and_replace"
|
|
522
|
+
| "search_files"
|
|
523
|
+
| "list_files"
|
|
524
|
+
| "list_code_definition_names"
|
|
525
|
+
| "browser_action"
|
|
526
|
+
| "use_mcp_tool"
|
|
527
|
+
| "access_mcp_resource"
|
|
528
|
+
| "ask_followup_question"
|
|
529
|
+
| "attempt_completion"
|
|
530
|
+
| "switch_mode"
|
|
531
|
+
| "new_task"
|
|
532
|
+
| "fetch_instructions"
|
|
533
|
+
),
|
|
534
|
+
string,
|
|
535
|
+
]
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* RooCodeEvent
|
|
540
|
+
*/
|
|
541
|
+
declare enum RooCodeEventName {
|
|
542
|
+
Message = "message",
|
|
543
|
+
TaskCreated = "taskCreated",
|
|
544
|
+
TaskStarted = "taskStarted",
|
|
545
|
+
TaskModeSwitched = "taskModeSwitched",
|
|
546
|
+
TaskPaused = "taskPaused",
|
|
547
|
+
TaskUnpaused = "taskUnpaused",
|
|
548
|
+
TaskAskResponded = "taskAskResponded",
|
|
549
|
+
TaskAborted = "taskAborted",
|
|
550
|
+
TaskSpawned = "taskSpawned",
|
|
551
|
+
TaskCompleted = "taskCompleted",
|
|
552
|
+
TaskTokenUsageUpdated = "taskTokenUsageUpdated",
|
|
553
|
+
TaskToolFailed = "taskToolFailed",
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
type RooCodeSettings = GlobalSettings & ProviderSettings
|
|
557
|
+
interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
|
|
558
|
+
/**
|
|
559
|
+
* Starts a new task with an optional initial message and images.
|
|
560
|
+
* @param task Optional initial task message.
|
|
561
|
+
* @param images Optional array of image data URIs (e.g., "data:image/webp;base64,...").
|
|
562
|
+
* @returns The ID of the new task.
|
|
563
|
+
*/
|
|
564
|
+
startNewTask({
|
|
565
|
+
configuration,
|
|
566
|
+
text,
|
|
567
|
+
images,
|
|
568
|
+
newTab,
|
|
569
|
+
}: {
|
|
570
|
+
configuration?: RooCodeSettings
|
|
571
|
+
text?: string
|
|
572
|
+
images?: string[]
|
|
573
|
+
newTab?: boolean
|
|
574
|
+
}): Promise<string>
|
|
575
|
+
/**
|
|
576
|
+
* Resumes a task with the given ID.
|
|
577
|
+
* @param taskId The ID of the task to resume.
|
|
578
|
+
* @throws Error if the task is not found in the task history.
|
|
579
|
+
*/
|
|
580
|
+
resumeTask(taskId: string): Promise<void>
|
|
581
|
+
/**
|
|
582
|
+
* Checks if a task with the given ID is in the task history.
|
|
583
|
+
* @param taskId The ID of the task to check.
|
|
584
|
+
* @returns True if the task is in the task history, false otherwise.
|
|
585
|
+
*/
|
|
586
|
+
isTaskInHistory(taskId: string): Promise<boolean>
|
|
587
|
+
/**
|
|
588
|
+
* Returns the current task stack.
|
|
589
|
+
* @returns An array of task IDs.
|
|
590
|
+
*/
|
|
591
|
+
getCurrentTaskStack(): string[]
|
|
592
|
+
/**
|
|
593
|
+
* Clears the current task.
|
|
594
|
+
*/
|
|
595
|
+
clearCurrentTask(lastMessage?: string): Promise<void>
|
|
596
|
+
/**
|
|
597
|
+
* Cancels the current task.
|
|
598
|
+
*/
|
|
599
|
+
cancelCurrentTask(): Promise<void>
|
|
600
|
+
/**
|
|
601
|
+
* Sends a message to the current task.
|
|
602
|
+
* @param message Optional message to send.
|
|
603
|
+
* @param images Optional array of image data URIs (e.g., "data:image/webp;base64,...").
|
|
604
|
+
*/
|
|
605
|
+
sendMessage(message?: string, images?: string[]): Promise<void>
|
|
606
|
+
/**
|
|
607
|
+
* Simulates pressing the primary button in the chat interface.
|
|
608
|
+
*/
|
|
609
|
+
pressPrimaryButton(): Promise<void>
|
|
610
|
+
/**
|
|
611
|
+
* Simulates pressing the secondary button in the chat interface.
|
|
612
|
+
*/
|
|
613
|
+
pressSecondaryButton(): Promise<void>
|
|
614
|
+
/**
|
|
615
|
+
* Returns true if the API is ready to use.
|
|
616
|
+
*/
|
|
617
|
+
isReady(): boolean
|
|
618
|
+
/**
|
|
619
|
+
* Returns the current configuration.
|
|
620
|
+
* @returns The current configuration.
|
|
621
|
+
*/
|
|
622
|
+
getConfiguration(): RooCodeSettings
|
|
623
|
+
/**
|
|
624
|
+
* Sets the configuration for the current task.
|
|
625
|
+
* @param values An object containing key-value pairs to set.
|
|
626
|
+
*/
|
|
627
|
+
setConfiguration(values: RooCodeSettings): Promise<void>
|
|
628
|
+
/**
|
|
629
|
+
* Returns a list of all configured profile names
|
|
630
|
+
* @returns Array of profile names
|
|
631
|
+
*/
|
|
632
|
+
getProfiles(): string[]
|
|
633
|
+
/**
|
|
634
|
+
* Returns the profile entry for a given name
|
|
635
|
+
* @param name The name of the profile
|
|
636
|
+
* @returns The profile entry, or undefined if the profile does not exist
|
|
637
|
+
*/
|
|
638
|
+
getProfileEntry(name: string): ProviderSettingsEntry | undefined
|
|
639
|
+
/**
|
|
640
|
+
* Creates a new API configuration profile
|
|
641
|
+
* @param name The name of the profile
|
|
642
|
+
* @param profile The profile to create; defaults to an empty object
|
|
643
|
+
* @param activate Whether to activate the profile after creation; defaults to true
|
|
644
|
+
* @returns The ID of the created profile
|
|
645
|
+
* @throws Error if the profile already exists
|
|
646
|
+
*/
|
|
647
|
+
createProfile(name: string, profile?: ProviderSettings, activate?: boolean): Promise<string>
|
|
648
|
+
/**
|
|
649
|
+
* Updates an existing API configuration profile
|
|
650
|
+
* @param name The name of the profile
|
|
651
|
+
* @param profile The profile to update
|
|
652
|
+
* @param activate Whether to activate the profile after update; defaults to true
|
|
653
|
+
* @returns The ID of the updated profile
|
|
654
|
+
* @throws Error if the profile does not exist
|
|
655
|
+
*/
|
|
656
|
+
updateProfile(name: string, profile: ProviderSettings, activate?: boolean): Promise<string | undefined>
|
|
657
|
+
/**
|
|
658
|
+
* Creates a new API configuration profile or updates an existing one
|
|
659
|
+
* @param name The name of the profile
|
|
660
|
+
* @param profile The profile to create or update; defaults to an empty object
|
|
661
|
+
* @param activate Whether to activate the profile after upsert; defaults to true
|
|
662
|
+
* @returns The ID of the upserted profile
|
|
663
|
+
*/
|
|
664
|
+
upsertProfile(name: string, profile: ProviderSettings, activate?: boolean): Promise<string | undefined>
|
|
665
|
+
/**
|
|
666
|
+
* Deletes a profile by name
|
|
667
|
+
* @param name The name of the profile to delete
|
|
668
|
+
* @throws Error if the profile does not exist
|
|
669
|
+
*/
|
|
670
|
+
deleteProfile(name: string): Promise<void>
|
|
671
|
+
/**
|
|
672
|
+
* Returns the name of the currently active profile
|
|
673
|
+
* @returns The profile name, or undefined if no profile is active
|
|
674
|
+
*/
|
|
675
|
+
getActiveProfile(): string | undefined
|
|
676
|
+
/**
|
|
677
|
+
* Changes the active API configuration profile
|
|
678
|
+
* @param name The name of the profile to activate
|
|
679
|
+
* @throws Error if the profile does not exist
|
|
680
|
+
*/
|
|
681
|
+
setActiveProfile(name: string): Promise<string | undefined>
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export {
|
|
685
|
+
type ClineMessage,
|
|
686
|
+
type GlobalSettings,
|
|
687
|
+
type ProviderSettings,
|
|
688
|
+
type ProviderSettingsEntry,
|
|
689
|
+
type RooCodeAPI,
|
|
690
|
+
RooCodeEventName,
|
|
691
|
+
type RooCodeEvents,
|
|
692
|
+
type RooCodeSettings,
|
|
693
|
+
type TokenUsage,
|
|
694
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@roo-code/types",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "TypeScript type definitions for Roo Code",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"author": "Roo Code Team",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/RooCodeInc/Roo-Code-Types.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/RooCodeInc/Roo-Code-Types/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/RooCodeInc/Roo-Code-Types/tree/main/roo-code-types",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"roo",
|
|
20
|
+
"roo-code",
|
|
21
|
+
"ai"
|
|
22
|
+
],
|
|
23
|
+
"main": "index.js",
|
|
24
|
+
"types": "index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"index.d.ts",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"packageManager": "pnpm@10.8.1",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "echo \"No build required - this package only contains type definitions\"",
|
|
32
|
+
"prepublishOnly": "npm run build",
|
|
33
|
+
"check-types": "tsc --noEmit",
|
|
34
|
+
"release:test": "semantic-release --dry-run",
|
|
35
|
+
"release": "semantic-release"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"semantic-release": "^24.2.3"
|
|
39
|
+
}
|
|
40
|
+
}
|