@cline/shared 0.0.38-nightly.1778113663
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/README.md +47 -0
- package/dist/agent.d.ts +397 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/types.d.ts +959 -0
- package/dist/automation/index.d.ts +3 -0
- package/dist/automation/index.js +65 -0
- package/dist/automation/schemas.d.ts +89 -0
- package/dist/automation/types.d.ts +151 -0
- package/dist/connectors/events.d.ts +93 -0
- package/dist/connectors/options.d.ts +173 -0
- package/dist/cron/cron-spec-types.d.ts +94 -0
- package/dist/cron/index.d.ts +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +80 -0
- package/dist/db/sqlite-db.d.ts +24 -0
- package/dist/dispose.d.ts +13 -0
- package/dist/extensions/context.d.ts +76 -0
- package/dist/extensions/contribution-registry.d.ts +195 -0
- package/dist/extensions/plugin.d.ts +1 -0
- package/dist/hooks/contracts.d.ts +9 -0
- package/dist/hooks/events.d.ts +194 -0
- package/dist/hub.d.ts +468 -0
- package/dist/index.browser.d.ts +57 -0
- package/dist/index.browser.js +76 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +149 -0
- package/dist/llms/ai-sdk-format.d.ts +42 -0
- package/dist/llms/gateway.d.ts +117 -0
- package/dist/llms/messages.d.ts +147 -0
- package/dist/llms/model-info.d.ts +112 -0
- package/dist/llms/reasoning-effort.d.ts +21 -0
- package/dist/llms/requests.d.ts +2 -0
- package/dist/llms/tools.d.ts +86 -0
- package/dist/logging/logger.d.ts +37 -0
- package/dist/parse/error.d.ts +2 -0
- package/dist/parse/headers/utils.d.ts +1 -0
- package/dist/parse/json.d.ts +3 -0
- package/dist/parse/shell.d.ts +2 -0
- package/dist/parse/string.d.ts +4 -0
- package/dist/parse/time.d.ts +9 -0
- package/dist/parse/zod.d.ts +12 -0
- package/dist/prompt/cline.d.ts +24 -0
- package/dist/prompt/format.d.ts +11 -0
- package/dist/prompt/system.d.ts +2 -0
- package/dist/remote-config/constants.d.ts +5 -0
- package/dist/remote-config/schema.d.ts +408 -0
- package/dist/rpc/index.d.ts +5 -0
- package/dist/rpc/runtime.d.ts +320 -0
- package/dist/rpc/team-progress.d.ts +53 -0
- package/dist/runtime/build-env.d.ts +13 -0
- package/dist/runtime/hub-daemon-env.d.ts +2 -0
- package/dist/services/telemetry-config.d.ts +6 -0
- package/dist/services/telemetry.d.ts +117 -0
- package/dist/session/hook-context.d.ts +12 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/records.d.ts +31 -0
- package/dist/session/runtime-config.d.ts +26 -0
- package/dist/session/runtime-env.d.ts +8 -0
- package/dist/session/workspace.d.ts +28 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/paths.d.ts +86 -0
- package/dist/team/index.d.ts +2 -0
- package/dist/team/schema.d.ts +411 -0
- package/dist/team/types.d.ts +196 -0
- package/dist/tools/create.d.ts +22 -0
- package/dist/types/auth.d.ts +20 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/vcr.d.ts +12 -0
- package/dist/vcr.d.ts +39 -0
- package/package.json +65 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type AiSdkFormatterMessageRole = "user" | "assistant" | "tool";
|
|
2
|
+
export type AiSdkFormatterPart = {
|
|
3
|
+
type: "text";
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: "reasoning";
|
|
7
|
+
text: string;
|
|
8
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
9
|
+
} | {
|
|
10
|
+
type: "image";
|
|
11
|
+
image: string | Uint8Array | ArrayBuffer | URL;
|
|
12
|
+
mediaType?: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: "file";
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "tool-call";
|
|
19
|
+
toolCallId: string;
|
|
20
|
+
toolName: string;
|
|
21
|
+
input: unknown;
|
|
22
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
23
|
+
} | {
|
|
24
|
+
type: "tool-result";
|
|
25
|
+
toolCallId: string;
|
|
26
|
+
toolName: string;
|
|
27
|
+
output: unknown;
|
|
28
|
+
isError?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export interface AiSdkFormatterMessage {
|
|
31
|
+
role: AiSdkFormatterMessageRole;
|
|
32
|
+
content: string | AiSdkFormatterPart[];
|
|
33
|
+
}
|
|
34
|
+
export type AiSdkMessagePart = Record<string, unknown>;
|
|
35
|
+
export type AiSdkMessage = {
|
|
36
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
37
|
+
content: string | AiSdkMessagePart[];
|
|
38
|
+
};
|
|
39
|
+
export declare function toAiSdkToolResultOutput(output: unknown, isError?: boolean): Record<string, unknown>;
|
|
40
|
+
export declare function formatMessagesForAiSdk(systemContent: string | AiSdkMessagePart[] | undefined, messages: readonly AiSdkFormatterMessage[], options?: {
|
|
41
|
+
assistantToolCallArgKey?: "args" | "input";
|
|
42
|
+
}): AiSdkMessage[];
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { AgentMessage, AgentModelEvent, AgentToolDefinition } from "../agent";
|
|
2
|
+
import type { BasicLogger } from "../logging/logger";
|
|
3
|
+
import type { ProviderCapability } from "../rpc/runtime";
|
|
4
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
5
|
+
[key: string]: JsonValue | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type GatewayModelCapability = "text" | "tools" | "reasoning" | "images" | "audio" | "structured-output";
|
|
8
|
+
export type GatewayPromptCacheStrategy = "anthropic-automatic";
|
|
9
|
+
export type GatewayUsageCostDisplay = "show" | "hide";
|
|
10
|
+
export interface GatewayProviderMetadata {
|
|
11
|
+
promptCacheStrategy?: GatewayPromptCacheStrategy;
|
|
12
|
+
usageCostDisplay?: GatewayUsageCostDisplay;
|
|
13
|
+
[key: string]: JsonValue | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface GatewayModelDefinition {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
providerId: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
contextWindow?: number;
|
|
21
|
+
maxOutputTokens?: number;
|
|
22
|
+
capabilities?: readonly GatewayModelCapability[];
|
|
23
|
+
metadata?: Record<string, JsonValue | undefined>;
|
|
24
|
+
}
|
|
25
|
+
export interface GatewayProviderManifest {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
defaultModelId: string;
|
|
30
|
+
models: readonly GatewayModelDefinition[];
|
|
31
|
+
capabilities?: readonly ProviderCapability[];
|
|
32
|
+
env?: readonly ("browser" | "node")[];
|
|
33
|
+
api?: string;
|
|
34
|
+
apiKeyEnv?: readonly string[];
|
|
35
|
+
docsUrl?: string;
|
|
36
|
+
metadata?: GatewayProviderMetadata;
|
|
37
|
+
}
|
|
38
|
+
export interface GatewayProviderSettings {
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
apiKeyResolver?: () => string | undefined | Promise<string | undefined>;
|
|
41
|
+
apiKeyEnv?: readonly string[];
|
|
42
|
+
baseUrl?: string;
|
|
43
|
+
headers?: Record<string, string>;
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
fetch?: typeof fetch;
|
|
46
|
+
options?: Record<string, unknown>;
|
|
47
|
+
metadata?: GatewayProviderMetadata;
|
|
48
|
+
}
|
|
49
|
+
export interface GatewayResolvedProviderConfig extends GatewayProviderSettings {
|
|
50
|
+
providerId: string;
|
|
51
|
+
}
|
|
52
|
+
export interface GatewayProviderConfig extends GatewayProviderSettings {
|
|
53
|
+
providerId: string;
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
defaultModelId?: string;
|
|
56
|
+
models?: readonly Omit<GatewayModelDefinition, "providerId">[];
|
|
57
|
+
}
|
|
58
|
+
export interface GatewayModelSelection {
|
|
59
|
+
providerId: string;
|
|
60
|
+
modelId?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface GatewayResolvedModel {
|
|
63
|
+
provider: GatewayProviderManifest;
|
|
64
|
+
model: GatewayModelDefinition;
|
|
65
|
+
}
|
|
66
|
+
export interface GatewayProviderContext {
|
|
67
|
+
provider: GatewayProviderManifest;
|
|
68
|
+
model: GatewayModelDefinition;
|
|
69
|
+
config: GatewayResolvedProviderConfig;
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
logger?: BasicLogger;
|
|
72
|
+
}
|
|
73
|
+
export interface GatewayStreamRequest {
|
|
74
|
+
providerId: string;
|
|
75
|
+
modelId: string;
|
|
76
|
+
systemPrompt?: string;
|
|
77
|
+
messages: readonly AgentMessage[];
|
|
78
|
+
tools?: readonly AgentToolDefinition[];
|
|
79
|
+
temperature?: number;
|
|
80
|
+
maxTokens?: number;
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
reasoning?: {
|
|
83
|
+
enabled?: boolean;
|
|
84
|
+
effort?: "low" | "medium" | "high";
|
|
85
|
+
budgetTokens?: number;
|
|
86
|
+
};
|
|
87
|
+
signal?: AbortSignal;
|
|
88
|
+
}
|
|
89
|
+
export interface GatewayProvider {
|
|
90
|
+
stream(request: GatewayStreamRequest, context: GatewayProviderContext): AsyncIterable<AgentModelEvent> | Promise<AsyncIterable<AgentModelEvent>>;
|
|
91
|
+
}
|
|
92
|
+
export type GatewayProviderFactory = (config: GatewayResolvedProviderConfig) => GatewayProvider | Promise<GatewayProvider>;
|
|
93
|
+
export interface GatewayProviderRegistration {
|
|
94
|
+
manifest: GatewayProviderManifest;
|
|
95
|
+
defaults?: GatewayProviderSettings;
|
|
96
|
+
createProvider?: GatewayProviderFactory;
|
|
97
|
+
loadProvider?: () => Promise<Pick<GatewayProviderRegistration, "createProvider">>;
|
|
98
|
+
}
|
|
99
|
+
export interface GatewayModelHandleOptions {
|
|
100
|
+
tools?: readonly AgentToolDefinition[];
|
|
101
|
+
temperature?: number;
|
|
102
|
+
maxTokens?: number;
|
|
103
|
+
metadata?: Record<string, unknown>;
|
|
104
|
+
reasoning?: {
|
|
105
|
+
enabled?: boolean;
|
|
106
|
+
effort?: "low" | "medium" | "high";
|
|
107
|
+
budgetTokens?: number;
|
|
108
|
+
};
|
|
109
|
+
signal?: AbortSignal;
|
|
110
|
+
}
|
|
111
|
+
export interface GatewayConfig {
|
|
112
|
+
builtins?: false | readonly string[];
|
|
113
|
+
providers?: readonly GatewayProviderRegistration[];
|
|
114
|
+
providerConfigs?: readonly GatewayProviderConfig[];
|
|
115
|
+
fetch?: typeof fetch;
|
|
116
|
+
logger?: BasicLogger;
|
|
117
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Types
|
|
3
|
+
*
|
|
4
|
+
* Standardized message format for input to providers.
|
|
5
|
+
* This is a simplified, provider-agnostic format that can be
|
|
6
|
+
* converted to any provider's native format.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Message roles
|
|
10
|
+
*/
|
|
11
|
+
export type MessageRole = "user" | "assistant";
|
|
12
|
+
/**
|
|
13
|
+
* Text content block
|
|
14
|
+
*/
|
|
15
|
+
export interface TextContent {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
/** Thought signature for this text part (Gemini) */
|
|
19
|
+
signature?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* File content block for Cline
|
|
23
|
+
*/
|
|
24
|
+
export interface FileContent {
|
|
25
|
+
type: "file";
|
|
26
|
+
content: string;
|
|
27
|
+
/** Absolute Path */
|
|
28
|
+
path: string;
|
|
29
|
+
source?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Image content block
|
|
33
|
+
*/
|
|
34
|
+
export interface ImageContent {
|
|
35
|
+
type: "image";
|
|
36
|
+
/** Base64 encoded image data */
|
|
37
|
+
data: string;
|
|
38
|
+
/** MIME type (e.g., "image/png", "image/jpeg") */
|
|
39
|
+
mediaType: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Tool use content block (assistant's tool call)
|
|
43
|
+
*/
|
|
44
|
+
export interface ToolUseContent {
|
|
45
|
+
type: "tool_use";
|
|
46
|
+
/** Unique ID for this tool call */
|
|
47
|
+
id: string;
|
|
48
|
+
/** Provider-native call ID for this tool call (if available) */
|
|
49
|
+
call_id?: string;
|
|
50
|
+
/** Name of the tool being called */
|
|
51
|
+
name: string;
|
|
52
|
+
/** Arguments for the tool call */
|
|
53
|
+
input: Record<string, unknown>;
|
|
54
|
+
/** Thought signature for this function call part (Gemini) */
|
|
55
|
+
signature?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Tool result content block (user's response to tool call)
|
|
59
|
+
*/
|
|
60
|
+
export interface ToolResultContent {
|
|
61
|
+
type: "tool_result";
|
|
62
|
+
/** ID of the tool call this is responding to */
|
|
63
|
+
tool_use_id: string;
|
|
64
|
+
/** Result content (can be text or error) */
|
|
65
|
+
content: string | Array<TextContent | ImageContent | FileContent>;
|
|
66
|
+
/** Whether this result represents an error */
|
|
67
|
+
is_error?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Thinking/reasoning content block
|
|
71
|
+
*/
|
|
72
|
+
export interface ThinkingContent {
|
|
73
|
+
type: "thinking";
|
|
74
|
+
/** The thinking/reasoning text */
|
|
75
|
+
thinking: string;
|
|
76
|
+
/** Signature for the thinking block (provider-specific) */
|
|
77
|
+
signature?: string;
|
|
78
|
+
/** Provider-native call ID for this reasoning block (if available) */
|
|
79
|
+
call_id?: string;
|
|
80
|
+
/** Structured reasoning details that can be replayed for tool-call continuation */
|
|
81
|
+
details?: unknown[];
|
|
82
|
+
/** Backward-compatible alias used by some internal processors */
|
|
83
|
+
summary?: unknown[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Redacted thinking content block
|
|
87
|
+
*/
|
|
88
|
+
export interface RedactedThinkingContent {
|
|
89
|
+
type: "redacted_thinking";
|
|
90
|
+
/** Encrypted/redacted data */
|
|
91
|
+
data: string;
|
|
92
|
+
/** Provider-native call ID for this reasoning block (if available) */
|
|
93
|
+
call_id?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Union of all content block types
|
|
97
|
+
*/
|
|
98
|
+
export type ContentBlock = TextContent | ImageContent | ToolUseContent | ToolResultContent | ThinkingContent | FileContent | RedactedThinkingContent;
|
|
99
|
+
/**
|
|
100
|
+
* A single message in the conversation
|
|
101
|
+
*/
|
|
102
|
+
export interface Message {
|
|
103
|
+
/** Message role */
|
|
104
|
+
role: MessageRole;
|
|
105
|
+
/** Message content - can be a simple string or array of content blocks */
|
|
106
|
+
content: string | ContentBlock[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Extended message with metadata (used for storage/history)
|
|
110
|
+
*/
|
|
111
|
+
export interface MessageWithMetadata extends Message {
|
|
112
|
+
/** Unique message ID */
|
|
113
|
+
id?: string;
|
|
114
|
+
/** Logical agent kind for persisted session/history consumers */
|
|
115
|
+
agent?: string;
|
|
116
|
+
/** Concrete session id that owns this persisted message */
|
|
117
|
+
sessionId?: string;
|
|
118
|
+
/** Additional message metadata for storage/history consumers */
|
|
119
|
+
metadata?: Record<string, unknown>;
|
|
120
|
+
/** Model info at the time of generation */
|
|
121
|
+
modelInfo?: {
|
|
122
|
+
id: string;
|
|
123
|
+
provider: string;
|
|
124
|
+
family?: string;
|
|
125
|
+
};
|
|
126
|
+
/** Token usage metrics */
|
|
127
|
+
metrics?: {
|
|
128
|
+
inputTokens?: number;
|
|
129
|
+
outputTokens?: number;
|
|
130
|
+
cacheReadTokens?: number;
|
|
131
|
+
cacheWriteTokens?: number;
|
|
132
|
+
cost?: number;
|
|
133
|
+
};
|
|
134
|
+
/** Timestamp of when the message was created */
|
|
135
|
+
ts?: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Tool definition for native tool calling
|
|
139
|
+
*/
|
|
140
|
+
export interface ToolDefinition {
|
|
141
|
+
/** Tool name */
|
|
142
|
+
name: string;
|
|
143
|
+
/** Tool description */
|
|
144
|
+
description: string;
|
|
145
|
+
/** JSON Schema for the tool's input parameters */
|
|
146
|
+
inputSchema: Record<string, unknown>;
|
|
147
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Information Types
|
|
3
|
+
*
|
|
4
|
+
* Zod schemas and inferred types for model capabilities, pricing,
|
|
5
|
+
* and metadata. These live in shared so that agent types can reference
|
|
6
|
+
* ModelInfo without depending on @cline/llms.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
export declare const ApiFormatSchema: z.ZodEnum<{
|
|
10
|
+
default: "default";
|
|
11
|
+
"openai-responses": "openai-responses";
|
|
12
|
+
r1: "r1";
|
|
13
|
+
}>;
|
|
14
|
+
export type ApiFormat = z.infer<typeof ApiFormatSchema>;
|
|
15
|
+
export declare const ApiFormat: {
|
|
16
|
+
readonly DEFAULT: "default";
|
|
17
|
+
readonly OPENAI_RESPONSES: "openai-responses";
|
|
18
|
+
readonly R1: "r1";
|
|
19
|
+
};
|
|
20
|
+
export declare const ModelCapabilitySchema: z.ZodEnum<{
|
|
21
|
+
images: "images";
|
|
22
|
+
tools: "tools";
|
|
23
|
+
streaming: "streaming";
|
|
24
|
+
"prompt-cache": "prompt-cache";
|
|
25
|
+
reasoning: "reasoning";
|
|
26
|
+
"reasoning-effort": "reasoning-effort";
|
|
27
|
+
"computer-use": "computer-use";
|
|
28
|
+
"global-endpoint": "global-endpoint";
|
|
29
|
+
structured_output: "structured_output";
|
|
30
|
+
temperature: "temperature";
|
|
31
|
+
files: "files";
|
|
32
|
+
}>;
|
|
33
|
+
export type ModelCapability = z.infer<typeof ModelCapabilitySchema>;
|
|
34
|
+
export declare const ModelStatusSchema: z.ZodEnum<{
|
|
35
|
+
active: "active";
|
|
36
|
+
preview: "preview";
|
|
37
|
+
deprecated: "deprecated";
|
|
38
|
+
legacy: "legacy";
|
|
39
|
+
}>;
|
|
40
|
+
export type ModelStatus = z.infer<typeof ModelStatusSchema>;
|
|
41
|
+
export declare const ModelPricingSchema: z.ZodObject<{
|
|
42
|
+
input: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
output: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
cacheWrite: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
cacheRead: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type ModelPricing = z.infer<typeof ModelPricingSchema>;
|
|
48
|
+
export declare const ThinkingConfigSchema: z.ZodObject<{
|
|
49
|
+
maxBudget: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
outputPrice: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
thinkingLevel: z.ZodOptional<z.ZodEnum<{
|
|
52
|
+
low: "low";
|
|
53
|
+
high: "high";
|
|
54
|
+
}>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type ThinkingConfig = z.infer<typeof ThinkingConfigSchema>;
|
|
57
|
+
export declare const ModelInfoSchema: z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
name: z.ZodOptional<z.ZodString>;
|
|
60
|
+
description: z.ZodOptional<z.ZodString>;
|
|
61
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
64
|
+
images: "images";
|
|
65
|
+
tools: "tools";
|
|
66
|
+
streaming: "streaming";
|
|
67
|
+
"prompt-cache": "prompt-cache";
|
|
68
|
+
reasoning: "reasoning";
|
|
69
|
+
"reasoning-effort": "reasoning-effort";
|
|
70
|
+
"computer-use": "computer-use";
|
|
71
|
+
"global-endpoint": "global-endpoint";
|
|
72
|
+
structured_output: "structured_output";
|
|
73
|
+
temperature: "temperature";
|
|
74
|
+
files: "files";
|
|
75
|
+
}>>>;
|
|
76
|
+
apiFormat: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
default: "default";
|
|
78
|
+
"openai-responses": "openai-responses";
|
|
79
|
+
r1: "r1";
|
|
80
|
+
}>>;
|
|
81
|
+
systemRole: z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
system: "system";
|
|
83
|
+
developer: "developer";
|
|
84
|
+
}>>;
|
|
85
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
pricing: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
input: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
output: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
cacheWrite: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
cacheRead: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
}, z.core.$strip>>;
|
|
92
|
+
thinkingConfig: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
maxBudget: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
outputPrice: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
thinkingLevel: z.ZodOptional<z.ZodEnum<{
|
|
96
|
+
low: "low";
|
|
97
|
+
high: "high";
|
|
98
|
+
}>>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
active: "active";
|
|
102
|
+
preview: "preview";
|
|
103
|
+
deprecated: "deprecated";
|
|
104
|
+
legacy: "legacy";
|
|
105
|
+
}>>;
|
|
106
|
+
deprecationNotice: z.ZodOptional<z.ZodString>;
|
|
107
|
+
replacedBy: z.ZodOptional<z.ZodString>;
|
|
108
|
+
releaseDate: z.ZodOptional<z.ZodString>;
|
|
109
|
+
deprecationDate: z.ZodOptional<z.ZodString>;
|
|
110
|
+
family: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export type ModelInfo = z.infer<typeof ModelInfoSchema>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const REASONING_EFFORT_RATIOS: {
|
|
2
|
+
readonly xhigh: 0.95;
|
|
3
|
+
readonly high: 0.8;
|
|
4
|
+
readonly medium: 0.5;
|
|
5
|
+
readonly low: 0.2;
|
|
6
|
+
readonly minimal: 0.1;
|
|
7
|
+
readonly none: 0;
|
|
8
|
+
};
|
|
9
|
+
export type ReasoningEffortValue = keyof typeof REASONING_EFFORT_RATIOS;
|
|
10
|
+
export declare const DEFAULT_REASONING_EFFORT: ReasoningEffortValue | undefined;
|
|
11
|
+
export declare function resolveEffectiveReasoningEffort(reasoningEffort?: string, thinking?: boolean): ReasoningEffortValue | undefined;
|
|
12
|
+
export declare function resolveReasoningEffortRatio(effort?: string, options?: {
|
|
13
|
+
fallbackEffort?: ReasoningEffortValue;
|
|
14
|
+
}): number | undefined;
|
|
15
|
+
export declare function resolveReasoningBudgetFromRatio(options: {
|
|
16
|
+
effort?: string;
|
|
17
|
+
maxBudget: number;
|
|
18
|
+
scaleTokens?: number;
|
|
19
|
+
minimumBudget?: number;
|
|
20
|
+
fallbackEffort?: ReasoningEffortValue;
|
|
21
|
+
}): number | undefined;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared tool policy and execution record types.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export interface ToolPolicy {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the tool can be executed at all.
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether this tool can run without asking the client for approval.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
autoApprove?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Record of a tool call execution
|
|
19
|
+
*/
|
|
20
|
+
export interface ToolCallRecord {
|
|
21
|
+
/** Unique identifier for this tool call */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Name of the tool that was called */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Input passed to the tool */
|
|
26
|
+
input: unknown;
|
|
27
|
+
/** Output returned from the tool (if successful) */
|
|
28
|
+
output: unknown;
|
|
29
|
+
/** Error message (if the tool failed) */
|
|
30
|
+
error?: string;
|
|
31
|
+
/** Time taken to execute the tool in milliseconds */
|
|
32
|
+
durationMs: number;
|
|
33
|
+
/** Timestamp when the tool call started */
|
|
34
|
+
startedAt: Date;
|
|
35
|
+
/** Timestamp when the tool call ended */
|
|
36
|
+
endedAt: Date;
|
|
37
|
+
}
|
|
38
|
+
export interface ToolApprovalRequest {
|
|
39
|
+
/**
|
|
40
|
+
* Core/hub runtime session identifier.
|
|
41
|
+
*
|
|
42
|
+
* This is the routing and lifecycle id for the task/session that owns the
|
|
43
|
+
* tool call. Hosts and hub transports use it to deliver approval events to
|
|
44
|
+
* clients subscribed to that session and to correlate approval responses
|
|
45
|
+
* with the pending runtime session. It should not be used as the transcript
|
|
46
|
+
* id for model history.
|
|
47
|
+
*/
|
|
48
|
+
sessionId: string;
|
|
49
|
+
/**
|
|
50
|
+
* Agent instance identifier.
|
|
51
|
+
*
|
|
52
|
+
* This identifies the lead or delegated agent that requested the tool call.
|
|
53
|
+
* It is used for attribution in approval prompts, events, telemetry, and
|
|
54
|
+
* team/sub-agent flows. It is not a hub routing key and should not be used
|
|
55
|
+
* to find the owning runtime session.
|
|
56
|
+
*/
|
|
57
|
+
agentId: string;
|
|
58
|
+
/**
|
|
59
|
+
* Agent conversation/transcript identifier.
|
|
60
|
+
*
|
|
61
|
+
* This identifies the model conversation that produced the tool call. Tools,
|
|
62
|
+
* hooks, telemetry, and persisted session metadata use it to correlate work
|
|
63
|
+
* with the agent's message history. It is contextual data, not the hub event
|
|
64
|
+
* routing key.
|
|
65
|
+
*/
|
|
66
|
+
conversationId: string;
|
|
67
|
+
iteration: number;
|
|
68
|
+
toolCallId: string;
|
|
69
|
+
toolName: string;
|
|
70
|
+
input: unknown;
|
|
71
|
+
policy: ToolPolicy;
|
|
72
|
+
}
|
|
73
|
+
export interface ToolApprovalResult {
|
|
74
|
+
approved: boolean;
|
|
75
|
+
reason?: string;
|
|
76
|
+
}
|
|
77
|
+
export declare const ToolCallRecordSchema: z.ZodObject<{
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
input: z.ZodUnknown;
|
|
81
|
+
output: z.ZodUnknown;
|
|
82
|
+
error: z.ZodOptional<z.ZodString>;
|
|
83
|
+
durationMs: z.ZodNumber;
|
|
84
|
+
startedAt: z.ZodDate;
|
|
85
|
+
endedAt: z.ZodDate;
|
|
86
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-package logging surface for hosts that inject their own logger (for example `pino` or the VS Code API).
|
|
3
|
+
*
|
|
4
|
+
* {@link BasicLogger.debug} is for verbose diagnostics (hosts typically gate this behind a debug log level).
|
|
5
|
+
* {@link BasicLogger.log} is the primary channel for operational messages that are not errors.
|
|
6
|
+
* {@link BasicLogger.error} is optional; when omitted, hosts may route failures through {@link BasicLogger.log}
|
|
7
|
+
* with {@link BasicLogMetadata.severity} `"error"` or handle errors elsewhere.
|
|
8
|
+
*
|
|
9
|
+
* Use {@link noopBasicLogger} when you need a fully-defined no-op implementation.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Optional structured fields used across the SDK and recommended for host log backends.
|
|
13
|
+
* Callers may add other keys freely; these names are the shared convention for cross-component queries.
|
|
14
|
+
*/
|
|
15
|
+
export interface BasicLogMetadata extends Record<string, unknown> {
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
runId?: string;
|
|
18
|
+
providerId?: string;
|
|
19
|
+
toolName?: string;
|
|
20
|
+
durationMs?: number;
|
|
21
|
+
/**
|
|
22
|
+
* When using {@link BasicLogger.log}, disambiguates severity for backends that map a single `log`
|
|
23
|
+
* method onto multiple output levels (for example Pino `info` vs `warn`).
|
|
24
|
+
*/
|
|
25
|
+
severity?: "info" | "warn" | "error";
|
|
26
|
+
}
|
|
27
|
+
export interface BasicLogger {
|
|
28
|
+
/** Verbose diagnostics; hosts should no-op or filter when not in debug mode. */
|
|
29
|
+
debug: (message: string, metadata?: BasicLogMetadata) => void;
|
|
30
|
+
/** Operational messages (replaces former `info` / non-error `warn` split). */
|
|
31
|
+
log: (message: string, metadata?: BasicLogMetadata) => void;
|
|
32
|
+
error?: (message: string, metadata?: BasicLogMetadata & {
|
|
33
|
+
error?: unknown;
|
|
34
|
+
}) => void;
|
|
35
|
+
}
|
|
36
|
+
/** All levels implemented as no-ops; safe default when no logger is injected. */
|
|
37
|
+
export declare const noopBasicLogger: BasicLogger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parseKeyPairsIntoRecord(value?: string): Record<string, string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function sanitizeFileName(value: string): string;
|
|
2
|
+
export declare function truncateStr(str: string, maxLen: number): string;
|
|
3
|
+
export declare function truncateSplit(str?: string, splitBy?: string, maxLen?: number): string;
|
|
4
|
+
export declare function maskSecret(value: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a date string and returns a human-readable format.
|
|
3
|
+
* If the input is invalid, it returns the original string or a placeholder.
|
|
4
|
+
*
|
|
5
|
+
* @param dateStr - The date string to parse.
|
|
6
|
+
* @returns A human-readable date string or the original input if invalid.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatHumanReadableDate(dateStr?: string): string;
|
|
9
|
+
export declare function formatUptime(ms: number): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for working with Zod schemas.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
/**
|
|
8
|
+
* Validate input using a Zod schema
|
|
9
|
+
* Throws a formatted error if validation fails
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateWithZod<T>(schema: z.ZodType<T>, input: unknown): T;
|
|
12
|
+
export declare function zodToJsonSchema(schema: z.ZodTypeAny): Record<string, unknown>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { WorkspaceContext } from "../extensions/context";
|
|
2
|
+
import type { WorkspaceInfo } from "../session/workspace";
|
|
3
|
+
export declare function processWorkspaceInfo(info: WorkspaceInfo): string;
|
|
4
|
+
/**
|
|
5
|
+
* Options for building the Cline system prompt.
|
|
6
|
+
*
|
|
7
|
+
* Extends WorkspaceContext so callers can spread an ExtensionContext.workspace
|
|
8
|
+
* directly. `workspaceRoot` is accepted as an alias for `rootPath` to support
|
|
9
|
+
* existing call sites that set it explicitly.
|
|
10
|
+
*/
|
|
11
|
+
export interface ClineSystemPromptOptions extends Omit<WorkspaceContext, "rootPath"> {
|
|
12
|
+
/**
|
|
13
|
+
* Workspace root path. Accepts either `rootPath` (from WorkspaceContext/WorkspaceInfo)
|
|
14
|
+
* or `workspaceRoot` (legacy alias) — whichever is provided will be used.
|
|
15
|
+
*/
|
|
16
|
+
rootPath?: string;
|
|
17
|
+
/** Alias for rootPath — kept for backwards compatibility with existing call sites */
|
|
18
|
+
workspaceRoot?: string;
|
|
19
|
+
/** Per-request system prompt override */
|
|
20
|
+
overridePrompt?: string;
|
|
21
|
+
/** Provider ID — used to gate Cline-specific metadata injection */
|
|
22
|
+
providerId?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function buildClineSystemPrompt(options: ClineSystemPromptOptions): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function formatFileContentBlock(path: string, content: string): string;
|
|
2
|
+
export declare function formatUserInputBlock(input: string, mode?: "act" | "plan" | "yolo"): string;
|
|
3
|
+
export declare function formatUserCommandBlock(input: string, slash: string): string;
|
|
4
|
+
export type UserCommandEnvelope = {
|
|
5
|
+
slash: string;
|
|
6
|
+
content: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function parseUserCommandEnvelope(input?: string): UserCommandEnvelope | undefined;
|
|
9
|
+
export declare function normalizeUserInput(input?: string): string;
|
|
10
|
+
export declare function formatDisplayUserInput(input?: string): string;
|
|
11
|
+
export declare function xmlTagsRemoval(input?: string, tag?: string): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const DEFAULT_CLINE_SYSTEM_PROMPT = "You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.\n\nAlways gather all the necessary context before starting to work on a task. For example, if you are generating a unit test or new code, make sure you understand the requirement, the naming conventions, frameworks and libraries used and aligned in the current codebase, and the environment and commands used to run and test the code etc. Always validate the new unit test at the end including running the code if possible for live feedback.\nReview each question carefully and answer it with detailed, accurate information.\nIf you need more information, use one of the available tools or ask for clarification instead of making assumptions or lies.\n\nEnvironment you are running in:\n<env>\n1. Platform: {{PLATFORM_NAME}}\n2. Date: {{CURRENT_DATE}}\n3. IDE: {{IDE_NAME}}\n4. Working Directory: {{CWD}}\n</env>\n\nRemember:\n- Always adhere to existing code conventions and patterns.\n- Use only libraries and frameworks that are confirmed to be in use in the current codebase.\n- Provide complete and functional code without omissions or placeholders.\n- Be explicit about any assumptions or limitations in your solution.\n- Always show your planning process before executing any task. This will help ensure that you have a clear understanding of the requirements and that your approach aligns with the user's needs.\n- Always use absolute paths when referring to files.\n- Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.\n\nBegin by analyzing the user's input and gathering any necessary additional context. Then, present your plan at the start of your response along with tool calls before proceeding with the task. It's OK for this section to be quite long.\n\nREMEMBER, be helpful and proactive! Don't ask for permission to do something when you can do it! Do not indicates you will be using a tool unless you are actually going to use it.\n\nIMPORTANT: Always includes tool calls in your response until the task is completed. Response without tool calls will considered as completed with final answer.\n\nWhen you have completed the task, please provide a summary of what you did and any relevant information that the user should know. This will help ensure that the user understands the changes made and can easily follow up if they have any questions or need further assistance. Do not indicate that you will perform an action without actually doing it. Always provide the final result in your response. Always validate your answer with checking the code and running it if possible. \n\nIf user asked a simple question without any coding context, answer it directly without using any tools.\n{{CLINE_RULES}}\n{{CLINE_METADATA}}";
|
|
2
|
+
export declare const YOLO_CLINE_SYSTEM_PROMPT = "You are Cline, a careful and helpful coding agent that works in the background.\nYou are tasked to solve an issue reported by the user who you cannot communicate with directly.\nYour goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.\n\nRULES:\n- Always adhere to existing code conventions and patterns.\n- Use only libraries and frameworks that are confirmed and compatible to be in use in the current codebase.\n- Provide complete and functional code without omissions or placeholders.\n- Always show your planning process before executing any task. This will help ensure that you have a clear understanding of the requirements and that your approach aligns with the user's request.\n- Always use absolute paths when referring to files.\n- Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.\n\nEnvironment you are running in:\n<env>\n1. Platform: {{PLATFORM_NAME}}\n2. Date: {{CURRENT_DATE}}\n3. IDE: {{IDE_NAME}}\n4. Working Directory: {{CWD}}\n</env>\n\nIMPORTANT: \nWhen the user describes a bug, unexpected behavior, or provides a bug report, your primary goal is to produce a correct fix in the source code that resolves the issue. \nA correct fix means the underlying behavior is fixed \u2014 not just the symptoms addressed superficially. \nAfter applying your fix, you must run the relevant test suite to confirm your changes actually resolve the problem. If tests fail, analyze the failures, revise your fix, and re-run until tests pass. \nDo not consider the task complete until tests pass.\nAlways includes tool calls in your response until the task is completed. You should only end the task when all the requirements are met by calling the 'submit_and_exit' tool.\nResponse without the submit_and_exit tool call will considered not completed and the task will continue.\n{{CLINE_RULES}}\n{{CLINE_METADATA}}";
|