Skip to content

Commit 08c33a4

Browse files
committed
More some helpers to packages/core for the cli and some more types
1 parent 16aa271 commit 08c33a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+307
-651
lines changed

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"type": "module",
66
"exports": {
77
".": "./src/index.ts",
8-
"./message-utils": "./src/message-utils/index.ts",
9-
"./debug-log": "./src/debug-log/index.ts"
8+
"./cli": "./src/cli.ts",
9+
"./browser": "./src/browser.ts"
1010
},
1111
"scripts": {
1212
"lint": "eslint src --ext=ts --max-warnings=0",

packages/core/src/browser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Browser-safe exports for the core package. These can safely be used
3+
* in browser environments like `webview-ui`.
4+
*/
5+
6+
export * from "./message-utils/index.js"

packages/core/src/cli.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Cli-safe exports for the core package.
3+
*/
4+
5+
export * from "./debug-log/index.js"
6+
export * from "./message-utils/index.js"

packages/core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./custom-tools/index.js"
2+
export * from "./debug-log/index.js"
23
export * from "./message-utils/index.js"

packages/types/src/embedding.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export type EmbedderProvider =
2+
| "openai"
3+
| "ollama"
4+
| "openai-compatible"
5+
| "gemini"
6+
| "mistral"
7+
| "vercel-ai-gateway"
8+
| "bedrock"
9+
| "openrouter" // Add other providers as needed.
10+
11+
export interface EmbeddingModelProfile {
12+
dimension: number
13+
scoreThreshold?: number // Model-specific minimum score threshold for semantic search.
14+
queryPrefix?: string // Optional prefix required by the model for queries.
15+
// Add other model-specific properties if needed, e.g., context window size.
16+
}
17+
18+
export type EmbeddingModelProfiles = {
19+
[provider in EmbedderProvider]?: {
20+
[modelId: string]: EmbeddingModelProfile
21+
}
22+
}

packages/types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from "./codebase-index.js"
44
export * from "./context-management.js"
55
export * from "./cookie-consent.js"
66
export * from "./custom-tool.js"
7+
export * from "./embedding.js"
78
export * from "./events.js"
89
export * from "./experiment.js"
910
export * from "./followup.js"

packages/types/src/vscode-extension-host.ts

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,3 +641,140 @@ export type WebViewMessagePayload =
641641
| InstallMarketplaceItemWithParametersPayload
642642
| UpdateTodoListPayload
643643
| EditQueuedMessagePayload
644+
645+
export interface IndexingStatus {
646+
systemStatus: string
647+
message?: string
648+
processedItems: number
649+
totalItems: number
650+
currentItemUnit?: string
651+
workspacePath?: string
652+
}
653+
654+
export interface IndexingStatusUpdateMessage {
655+
type: "indexingStatusUpdate"
656+
values: IndexingStatus
657+
}
658+
659+
export interface LanguageModelChatSelector {
660+
vendor?: string
661+
family?: string
662+
version?: string
663+
id?: string
664+
}
665+
666+
export interface ClineSayTool {
667+
tool:
668+
| "editedExistingFile"
669+
| "appliedDiff"
670+
| "newFileCreated"
671+
| "codebaseSearch"
672+
| "readFile"
673+
| "fetchInstructions"
674+
| "listFilesTopLevel"
675+
| "listFilesRecursive"
676+
| "searchFiles"
677+
| "switchMode"
678+
| "newTask"
679+
| "finishTask"
680+
| "generateImage"
681+
| "imageGenerated"
682+
| "runSlashCommand"
683+
| "updateTodoList"
684+
path?: string
685+
diff?: string
686+
content?: string
687+
// Unified diff statistics computed by the extension
688+
diffStats?: { added: number; removed: number }
689+
regex?: string
690+
filePattern?: string
691+
mode?: string
692+
reason?: string
693+
isOutsideWorkspace?: boolean
694+
isProtected?: boolean
695+
additionalFileCount?: number // Number of additional files in the same read_file request
696+
lineNumber?: number
697+
query?: string
698+
batchFiles?: Array<{
699+
path: string
700+
lineSnippet: string
701+
isOutsideWorkspace?: boolean
702+
key: string
703+
content?: string
704+
}>
705+
batchDiffs?: Array<{
706+
path: string
707+
changeCount: number
708+
key: string
709+
content: string
710+
// Per-file unified diff statistics computed by the extension
711+
diffStats?: { added: number; removed: number }
712+
diffs?: Array<{
713+
content: string
714+
startLine?: number
715+
}>
716+
}>
717+
question?: string
718+
imageData?: string // Base64 encoded image data for generated images
719+
// Properties for runSlashCommand tool
720+
command?: string
721+
args?: string
722+
source?: string
723+
description?: string
724+
}
725+
726+
// Must keep in sync with system prompt.
727+
export const browserActions = [
728+
"launch",
729+
"click",
730+
"hover",
731+
"type",
732+
"press",
733+
"scroll_down",
734+
"scroll_up",
735+
"resize",
736+
"close",
737+
"screenshot",
738+
] as const
739+
740+
export type BrowserAction = (typeof browserActions)[number]
741+
742+
export interface ClineSayBrowserAction {
743+
action: BrowserAction
744+
coordinate?: string
745+
size?: string
746+
text?: string
747+
executedCoordinate?: string
748+
}
749+
750+
export type BrowserActionResult = {
751+
screenshot?: string
752+
logs?: string
753+
currentUrl?: string
754+
currentMousePosition?: string
755+
viewportWidth?: number
756+
viewportHeight?: number
757+
}
758+
759+
export interface ClineAskUseMcpServer {
760+
serverName: string
761+
type: "use_mcp_tool" | "access_mcp_resource"
762+
toolName?: string
763+
arguments?: string
764+
uri?: string
765+
response?: string
766+
}
767+
768+
export interface ClineApiReqInfo {
769+
request?: string
770+
tokensIn?: number
771+
tokensOut?: number
772+
cacheWrites?: number
773+
cacheReads?: number
774+
cost?: number
775+
cancelReason?: ClineApiReqCancelReason
776+
streamingFailedMessage?: string
777+
apiProtocol?: "anthropic" | "openai"
778+
}
779+
780+
export type ClineApiReqCancelReason = "streaming_failed" | "user_cancelled"

src/api/providers/anthropic-vertex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import {
1111
TOOL_PROTOCOL,
1212
VERTEX_1M_CONTEXT_MODEL_IDS,
1313
} from "@roo-code/types"
14+
import { safeJsonParse } from "@roo-code/core"
1415

1516
import { ApiHandlerOptions } from "../../shared/api"
16-
import { safeJsonParse } from "../../shared/safeJsonParse"
1717

1818
import { ApiStream } from "../transform/stream"
1919
import { addCacheBreakpoints } from "../transform/caching/vertex"

src/api/providers/gemini.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ import {
1616
geminiModels,
1717
ApiProviderError,
1818
} from "@roo-code/types"
19+
import { safeJsonParse } from "@roo-code/core"
1920
import { TelemetryService } from "@roo-code/telemetry"
2021

2122
import type { ApiHandlerOptions } from "../../shared/api"
22-
import { safeJsonParse } from "../../shared/safeJsonParse"
2323

2424
import { convertAnthropicMessageToGemini } from "../transform/gemini-format"
2525
import { t } from "i18next"
2626
import type { ApiStream, GroundingSource } from "../transform/stream"
2727
import { getModelParams } from "../transform/model-params"
28-
import { handleProviderError } from "./utils/error-handler"
2928

3029
import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from "../index"
3130
import { BaseProvider } from "./base-provider"

src/core/auto-approval/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
22
type ClineAsk,
3+
type ClineSayTool,
34
type McpServerUse,
45
type FollowUpData,
56
type ExtensionState,
67
isNonBlockingAsk,
78
} from "@roo-code/types"
89

9-
import type { ClineSayTool } from "../../shared/ExtensionMessage"
1010
import { ClineAskResponse } from "../../shared/WebviewMessage"
1111

1212
import { isWriteToolAction, isReadOnlyToolAction } from "./tools"

0 commit comments

Comments
 (0)