@cline/core 0.0.82 → 0.0.83
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/dist/ClineCore.d.ts +9 -0
- package/dist/account/index.d.ts +1 -0
- package/dist/account/telemetry.d.ts +22 -0
- package/dist/cron/events/cron-event-ingress.d.ts +4 -2
- package/dist/cron/runner/cron-runner.d.ts +5 -2
- package/dist/cron/service/cron-service.d.ts +2 -1
- package/dist/cron/service/schedule-service.d.ts +2 -1
- package/dist/cron/store/sqlite-cron-store.d.ts +7 -1
- package/dist/extensions/agent-plugin/agent-skill.d.ts +21 -0
- package/dist/extensions/agent-plugin/index.d.ts +4 -0
- package/dist/extensions/agent-plugin/loader.d.ts +10 -0
- package/dist/extensions/agent-plugin/types.d.ts +67 -0
- package/dist/extensions/config/index.d.ts +1 -1
- package/dist/extensions/config/user-instruction-config-loader.d.ts +9 -0
- package/dist/extensions/config/user-instruction-plugin.d.ts +1 -0
- package/dist/extensions/config/user-instruction-service.d.ts +7 -1
- package/dist/extensions/context/compaction.d.ts +20 -0
- package/dist/extensions/index.d.ts +2 -0
- package/dist/extensions/mcp/client.d.ts +2 -0
- package/dist/extensions/mcp/oauth.d.ts +6 -0
- package/dist/extensions/tools/definitions.d.ts +5 -5
- package/dist/hooks/checkpoint-hooks.d.ts +23 -1
- package/dist/hub/client/index.d.ts +10 -0
- package/dist/hub/daemon/entry.js +434 -457
- package/dist/hub/daemon/index.d.ts +9 -8
- package/dist/hub/index.js +303 -327
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +3 -2
- package/dist/hub/server/handlers/session-handlers.d.ts +5 -1
- package/dist/index.d.ts +10 -7
- package/dist/index.js +271 -249
- package/dist/remote/remote-environments.d.ts +155 -0
- package/dist/remote/remote-helper-entry.d.ts +1 -0
- package/dist/remote/remote-helper-entry.js +5 -0
- package/dist/remote/remote-helper.d.ts +29 -0
- package/dist/remote/remote-helper.js +4 -0
- package/dist/remote/shell-path.d.ts +88 -0
- package/dist/runtime/host/local-runtime-host.d.ts +2 -2
- package/dist/runtime/host/runtime-host.d.ts +11 -1
- package/dist/runtime/orchestration/session-runtime.d.ts +3 -0
- package/dist/services/global-settings.d.ts +6 -0
- package/dist/services/llms/provider-defaults.d.ts +1 -1
- package/dist/services/llms/provider-settings.d.ts +20 -18
- package/dist/services/local-runtime-bootstrap.d.ts +7 -0
- package/dist/services/providers/local-provider-registry.d.ts +3 -3
- package/dist/services/providers/local-provider-service.d.ts +3 -1
- package/dist/services/providers/provider-config-fields.d.ts +11 -0
- package/dist/services/session-import/claude-code.d.ts +1 -1
- package/dist/services/session-import/paths.d.ts +9 -0
- package/dist/services/telemetry/core-events.d.ts +29 -5
- package/dist/services/telemetry/index.d.ts +1 -0
- package/dist/services/telemetry/index.js +1 -1
- package/dist/services/telemetry/scoped-telemetry.d.ts +31 -0
- package/dist/services/workspace/workspace-telemetry.d.ts +5 -0
- package/dist/session/models/session-manifest.d.ts +1 -1
- package/dist/session/services/persistence-service.d.ts +3 -1
- package/dist/session/session-versioning-service.d.ts +8 -0
- package/dist/settings/types.d.ts +8 -0
- package/dist/tasks/agenda-task-tool.d.ts +1 -1
- package/dist/tasks/task-tool.d.ts +3 -3
- package/dist/types/chat-schema.d.ts +2 -2
- package/dist/types/config.d.ts +5 -0
- package/dist/types/session.d.ts +2 -0
- package/dist/types.d.ts +4 -4
- package/package.json +12 -4
- package/dist/cron/runner/resource-limiter.d.ts +0 -8
|
@@ -17,23 +17,23 @@ export declare const ProviderIdSchema: z.ZodString;
|
|
|
17
17
|
export declare const ProviderProtocolSchema: z.ZodEnum<{
|
|
18
18
|
anthropic: "anthropic";
|
|
19
19
|
gemini: "gemini";
|
|
20
|
-
"openai-chat": "openai-chat";
|
|
21
|
-
"openai-responses": "openai-responses";
|
|
22
20
|
"openai-r1": "openai-r1";
|
|
23
21
|
"ai-sdk": "ai-sdk";
|
|
22
|
+
"openai-responses": "openai-responses";
|
|
23
|
+
"openai-chat": "openai-chat";
|
|
24
24
|
}>;
|
|
25
25
|
export declare const ProviderClientSchema: z.ZodEnum<{
|
|
26
26
|
custom: "custom";
|
|
27
27
|
anthropic: "anthropic";
|
|
28
|
+
bedrock: "bedrock";
|
|
28
29
|
gemini: "gemini";
|
|
30
|
+
vertex: "vertex";
|
|
31
|
+
"openai-compatible": "openai-compatible";
|
|
32
|
+
openai: "openai";
|
|
29
33
|
"openai-r1": "openai-r1";
|
|
30
34
|
"ai-sdk": "ai-sdk";
|
|
31
35
|
"ai-sdk-community": "ai-sdk-community";
|
|
32
|
-
openai: "openai";
|
|
33
|
-
"openai-compatible": "openai-compatible";
|
|
34
|
-
bedrock: "bedrock";
|
|
35
36
|
fetch: "fetch";
|
|
36
|
-
vertex: "vertex";
|
|
37
37
|
}>;
|
|
38
38
|
export declare const AuthSettingsSchema: z.ZodObject<{
|
|
39
39
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
@@ -68,10 +68,10 @@ export declare const AwsSettingsSchema: z.ZodObject<{
|
|
|
68
68
|
region: z.ZodOptional<z.ZodString>;
|
|
69
69
|
profile: z.ZodOptional<z.ZodString>;
|
|
70
70
|
authentication: z.ZodOptional<z.ZodEnum<{
|
|
71
|
-
profile: "profile";
|
|
72
71
|
iam: "iam";
|
|
73
72
|
"api-key": "api-key";
|
|
74
73
|
apikey: "apikey";
|
|
74
|
+
profile: "profile";
|
|
75
75
|
}>>;
|
|
76
76
|
usePromptCache: z.ZodOptional<z.ZodBoolean>;
|
|
77
77
|
useCrossRegionInference: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -106,14 +106,15 @@ export declare const SapSettingsSchema: z.ZodObject<{
|
|
|
106
106
|
export type SapSettings = z.infer<typeof SapSettingsSchema>;
|
|
107
107
|
export declare const OcaSettingsSchema: z.ZodObject<{
|
|
108
108
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
109
|
-
internal: "internal";
|
|
110
109
|
external: "external";
|
|
110
|
+
internal: "internal";
|
|
111
111
|
}>>;
|
|
112
112
|
usePromptCache: z.ZodOptional<z.ZodBoolean>;
|
|
113
113
|
}, z.core.$strip>;
|
|
114
114
|
export type OcaSettings = z.infer<typeof OcaSettingsSchema>;
|
|
115
115
|
export declare const ModelCatalogSettingsSchema: z.ZodObject<{
|
|
116
116
|
loadLatestOnInit: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
includeClineCloudModels: z.ZodOptional<z.ZodBoolean>;
|
|
117
118
|
loadPrivateOnAuth: z.ZodOptional<z.ZodBoolean>;
|
|
118
119
|
url: z.ZodOptional<z.ZodString>;
|
|
119
120
|
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -139,23 +140,23 @@ export declare const ProviderSettingsSchema: z.ZodObject<{
|
|
|
139
140
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
140
141
|
anthropic: "anthropic";
|
|
141
142
|
gemini: "gemini";
|
|
142
|
-
"openai-chat": "openai-chat";
|
|
143
|
-
"openai-responses": "openai-responses";
|
|
144
143
|
"openai-r1": "openai-r1";
|
|
145
144
|
"ai-sdk": "ai-sdk";
|
|
145
|
+
"openai-responses": "openai-responses";
|
|
146
|
+
"openai-chat": "openai-chat";
|
|
146
147
|
}>>;
|
|
147
148
|
client: z.ZodOptional<z.ZodEnum<{
|
|
148
149
|
custom: "custom";
|
|
149
150
|
anthropic: "anthropic";
|
|
151
|
+
bedrock: "bedrock";
|
|
150
152
|
gemini: "gemini";
|
|
153
|
+
vertex: "vertex";
|
|
154
|
+
"openai-compatible": "openai-compatible";
|
|
155
|
+
openai: "openai";
|
|
151
156
|
"openai-r1": "openai-r1";
|
|
152
157
|
"ai-sdk": "ai-sdk";
|
|
153
158
|
"ai-sdk-community": "ai-sdk-community";
|
|
154
|
-
openai: "openai";
|
|
155
|
-
"openai-compatible": "openai-compatible";
|
|
156
|
-
bedrock: "bedrock";
|
|
157
159
|
fetch: "fetch";
|
|
158
|
-
vertex: "vertex";
|
|
159
160
|
}>>;
|
|
160
161
|
routingProviderId: z.ZodOptional<z.ZodString>;
|
|
161
162
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -183,10 +184,10 @@ export declare const ProviderSettingsSchema: z.ZodObject<{
|
|
|
183
184
|
region: z.ZodOptional<z.ZodString>;
|
|
184
185
|
profile: z.ZodOptional<z.ZodString>;
|
|
185
186
|
authentication: z.ZodOptional<z.ZodEnum<{
|
|
186
|
-
profile: "profile";
|
|
187
187
|
iam: "iam";
|
|
188
188
|
"api-key": "api-key";
|
|
189
189
|
apikey: "apikey";
|
|
190
|
+
profile: "profile";
|
|
190
191
|
}>>;
|
|
191
192
|
usePromptCache: z.ZodOptional<z.ZodBoolean>;
|
|
192
193
|
useCrossRegionInference: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -217,8 +218,8 @@ export declare const ProviderSettingsSchema: z.ZodObject<{
|
|
|
217
218
|
}, z.core.$strip>>;
|
|
218
219
|
oca: z.ZodOptional<z.ZodObject<{
|
|
219
220
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
220
|
-
internal: "internal";
|
|
221
221
|
external: "external";
|
|
222
|
+
internal: "internal";
|
|
222
223
|
}>>;
|
|
223
224
|
usePromptCache: z.ZodOptional<z.ZodBoolean>;
|
|
224
225
|
}, z.core.$strip>>;
|
|
@@ -230,15 +231,16 @@ export declare const ProviderSettingsSchema: z.ZodObject<{
|
|
|
230
231
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
231
232
|
tools: "tools";
|
|
232
233
|
reasoning: "reasoning";
|
|
233
|
-
"prompt-cache": "prompt-cache";
|
|
234
234
|
streaming: "streaming";
|
|
235
|
-
|
|
235
|
+
"prompt-cache": "prompt-cache";
|
|
236
236
|
"computer-use": "computer-use";
|
|
237
|
+
vision: "vision";
|
|
237
238
|
oauth: "oauth";
|
|
238
239
|
popular: "popular";
|
|
239
240
|
}>>>;
|
|
240
241
|
modelCatalog: z.ZodOptional<z.ZodObject<{
|
|
241
242
|
loadLatestOnInit: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
+
includeClineCloudModels: z.ZodOptional<z.ZodBoolean>;
|
|
242
244
|
loadPrivateOnAuth: z.ZodOptional<z.ZodBoolean>;
|
|
243
245
|
url: z.ZodOptional<z.ZodString>;
|
|
244
246
|
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -3,6 +3,7 @@ import type { SubAgentEndContext, SubAgentStartContext, TeamEvent } from "../ext
|
|
|
3
3
|
import type { RuntimeCapabilities } from "../runtime/capabilities";
|
|
4
4
|
import type { LocalRuntimeStartOptions, ResolvedStartSessionInput } from "../runtime/host/runtime-host";
|
|
5
5
|
import type { RuntimeBuilderInput } from "../runtime/orchestration/session-runtime";
|
|
6
|
+
import type { SessionHistoryOriginMetadata } from "../session/history-origin";
|
|
6
7
|
import type { CoreSessionConfig } from "../types/config";
|
|
7
8
|
import { type ProviderConfig } from "../types/provider-settings";
|
|
8
9
|
import type { ProviderSettingsManager } from "./storage/provider-settings-manager";
|
|
@@ -11,6 +12,12 @@ export interface PrepareLocalRuntimeBootstrapOptions {
|
|
|
11
12
|
input: ResolvedStartSessionInput;
|
|
12
13
|
localRuntime?: LocalRuntimeStartOptions;
|
|
13
14
|
sessionId: string;
|
|
15
|
+
/**
|
|
16
|
+
* How the session was initiated (user, automation, import, ...). Stamped
|
|
17
|
+
* on every telemetry event the session emits so errors can be filtered by
|
|
18
|
+
* provenance, e.g. transcripts imported from another agent.
|
|
19
|
+
*/
|
|
20
|
+
sessionOrigin?: SessionHistoryOriginMetadata;
|
|
14
21
|
providerSettingsManager: ProviderSettingsManager;
|
|
15
22
|
defaultTelemetry?: ITelemetryService;
|
|
16
23
|
defaultLogger?: BasicLogger;
|
|
@@ -70,9 +70,9 @@ export declare const StoredProviderMetadataSchema: z.ZodObject<{
|
|
|
70
70
|
defaultModelId: z.ZodOptional<z.ZodString>;
|
|
71
71
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
72
72
|
"openai-responses": "openai-responses";
|
|
73
|
+
"openai-chat": "openai-chat";
|
|
73
74
|
anthropic: "anthropic";
|
|
74
75
|
gemini: "gemini";
|
|
75
|
-
"openai-chat": "openai-chat";
|
|
76
76
|
"openai-r1": "openai-r1";
|
|
77
77
|
"ai-sdk": "ai-sdk";
|
|
78
78
|
}>>;
|
|
@@ -112,9 +112,9 @@ export declare const StoredProviderEntrySchema: z.ZodObject<{
|
|
|
112
112
|
defaultModelId: z.ZodOptional<z.ZodString>;
|
|
113
113
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
114
114
|
"openai-responses": "openai-responses";
|
|
115
|
+
"openai-chat": "openai-chat";
|
|
115
116
|
anthropic: "anthropic";
|
|
116
117
|
gemini: "gemini";
|
|
117
|
-
"openai-chat": "openai-chat";
|
|
118
118
|
"openai-r1": "openai-r1";
|
|
119
119
|
"ai-sdk": "ai-sdk";
|
|
120
120
|
}>>;
|
|
@@ -219,9 +219,9 @@ export declare const StoredModelsFileSchema: z.ZodObject<{
|
|
|
219
219
|
defaultModelId: z.ZodOptional<z.ZodString>;
|
|
220
220
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
221
221
|
"openai-responses": "openai-responses";
|
|
222
|
+
"openai-chat": "openai-chat";
|
|
222
223
|
anthropic: "anthropic";
|
|
223
224
|
gemini: "gemini";
|
|
224
|
-
"openai-chat": "openai-chat";
|
|
225
225
|
"openai-r1": "openai-r1";
|
|
226
226
|
"ai-sdk": "ai-sdk";
|
|
227
227
|
}>>;
|
|
@@ -71,7 +71,9 @@ export declare function listLocalProviders(manager: ProviderSettingsManager, opt
|
|
|
71
71
|
settingsPath: string;
|
|
72
72
|
voiceInput?: VoiceInputSelection;
|
|
73
73
|
}>;
|
|
74
|
-
export declare function getLocalProviderModels(providerId: string, config?: ProviderConfig
|
|
74
|
+
export declare function getLocalProviderModels(providerId: string, config?: ProviderConfig, options?: {
|
|
75
|
+
loadLatest?: boolean;
|
|
76
|
+
}): Promise<{
|
|
75
77
|
providerId: string;
|
|
76
78
|
models: ProviderModel[];
|
|
77
79
|
}>;
|
|
@@ -34,4 +34,15 @@ export interface ProviderConfigFields {
|
|
|
34
34
|
* input, no default base URL) so callers can render a reasonable configure
|
|
35
35
|
* dialog without per-id branches.
|
|
36
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* Whether a provider authenticates through credentials already stored on the
|
|
39
|
+
* machine by a local CLI (Codex CLI, Claude Code, ...) instead of an API key
|
|
40
|
+
* or an OAuth flow.
|
|
41
|
+
*
|
|
42
|
+
* Read from the provider registry's `local-auth` capability rather than a
|
|
43
|
+
* hardcoded id list, so tagging a provider in `@cline/llms` is all it takes
|
|
44
|
+
* for configure UIs to route it to their local-readiness flow. Mirrors
|
|
45
|
+
* `isOAuthProvider` for the OAuth side.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isLocalAuthProvider(providerId: string): boolean;
|
|
37
48
|
export declare function getProviderConfigFields(providerId: string): ProviderConfigFields;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ConvertedImportedSession, type ImportableSessionSummary, type SessionImportAdapter } from "./types";
|
|
2
2
|
export interface ClaudeCodeAdapterOptions {
|
|
3
|
-
/** Defaults to ~/.claude/projects */
|
|
3
|
+
/** Defaults to $CLAUDE_CONFIG_DIR/projects or ~/.claude/projects */
|
|
4
4
|
projectsDir?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare class ClaudeCodeImportAdapter implements SessionImportAdapter {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SessionImportPathEnvironment {
|
|
2
|
+
platform: NodeJS.Platform;
|
|
3
|
+
homeDir: string;
|
|
4
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
5
|
+
joinPath: (...paths: string[]) => string;
|
|
6
|
+
}
|
|
7
|
+
export declare function claudeCodeProjectsDir(environment?: SessionImportPathEnvironment): string;
|
|
8
|
+
export declare function codexHomeDir(environment?: SessionImportPathEnvironment): string;
|
|
9
|
+
export declare function opencodeDataDir(environment?: SessionImportPathEnvironment): string;
|
|
@@ -14,6 +14,10 @@ export interface TelemetryAgentIdentityProperties {
|
|
|
14
14
|
teamAgentId?: string;
|
|
15
15
|
}
|
|
16
16
|
export declare const CORE_TELEMETRY_EVENTS: {
|
|
17
|
+
readonly SCHEDULE: {
|
|
18
|
+
readonly RUN_STARTED: "schedule.run_started";
|
|
19
|
+
readonly RUN_FINISHED: "schedule.run_finished";
|
|
20
|
+
};
|
|
17
21
|
readonly CLIENT: {
|
|
18
22
|
readonly EXTENSION_ACTIVATED: "user.extension_activated";
|
|
19
23
|
};
|
|
@@ -181,15 +185,23 @@ export declare function identifyAccount(telemetry: ITelemetryService | undefined
|
|
|
181
185
|
organizationName?: string;
|
|
182
186
|
memberId?: string;
|
|
183
187
|
}): void;
|
|
188
|
+
/**
|
|
189
|
+
* Restore anonymous process identity after an account signs out.
|
|
190
|
+
*
|
|
191
|
+
* Account properties are explicitly set to undefined so they replace values
|
|
192
|
+
* previously merged into a long-lived telemetry service. Implementations
|
|
193
|
+
* remove undefined attributes before export.
|
|
194
|
+
*/
|
|
195
|
+
export declare function clearAccountTelemetryIdentity(telemetry: ITelemetryService | undefined, anonymousDistinctId?: string): void;
|
|
184
196
|
export declare function captureTaskCreated(telemetry: ITelemetryService | undefined, properties: {
|
|
185
197
|
ulid: string;
|
|
186
|
-
|
|
187
|
-
|
|
198
|
+
provider?: string;
|
|
199
|
+
model?: string;
|
|
188
200
|
} & Partial<TelemetryAgentIdentityProperties>): void;
|
|
189
201
|
export declare function captureTaskRestarted(telemetry: ITelemetryService | undefined, properties: {
|
|
190
202
|
ulid: string;
|
|
191
|
-
|
|
192
|
-
|
|
203
|
+
provider?: string;
|
|
204
|
+
model?: string;
|
|
193
205
|
} & Partial<TelemetryAgentIdentityProperties>): void;
|
|
194
206
|
/**
|
|
195
207
|
* Distinguishes the trigger that produced a `task.completed` telemetry event.
|
|
@@ -206,7 +218,7 @@ export type TaskCompletedSource = "submit_and_exit" | "shutdown";
|
|
|
206
218
|
export declare function captureTaskCompleted(telemetry: ITelemetryService | undefined, properties: {
|
|
207
219
|
ulid: string;
|
|
208
220
|
provider?: string;
|
|
209
|
-
|
|
221
|
+
model?: string;
|
|
210
222
|
mode?: string;
|
|
211
223
|
durationMs?: number;
|
|
212
224
|
source?: TaskCompletedSource;
|
|
@@ -394,3 +406,15 @@ export interface CaptureCompactionBudgetEmergencyProperties {
|
|
|
394
406
|
modelId?: string;
|
|
395
407
|
}
|
|
396
408
|
export declare function captureCompactionBudgetEmergency(telemetry: ITelemetryService | undefined, properties: CaptureCompactionBudgetEmergencyProperties & Partial<TelemetryAgentIdentityProperties>): void;
|
|
409
|
+
/** Bounded scheduler diagnostics; never include prompts, paths, or raw errors. */
|
|
410
|
+
export declare function captureScheduleRun(telemetry: ITelemetryService | undefined, input: {
|
|
411
|
+
triggerKind: "one_off" | "schedule" | "event" | "manual" | "retry";
|
|
412
|
+
attemptCount: number;
|
|
413
|
+
startDelayMs: number;
|
|
414
|
+
} & ({
|
|
415
|
+
phase: "started";
|
|
416
|
+
} | {
|
|
417
|
+
phase: "finished";
|
|
418
|
+
outcome: "success" | "failed" | "timeout" | "superseded" | "cancelled";
|
|
419
|
+
durationMs: number;
|
|
420
|
+
})): void;
|
|
@@ -2,3 +2,4 @@ export { resolveCoreDeviceId, resolveCoreDistinctId } from "./distinct-id";
|
|
|
2
2
|
export type { ITelemetryAdapter, TelemetryArray, TelemetryMetadata, TelemetryObject, TelemetryPrimitive, TelemetryProperties, TelemetryValue, } from "./ITelemetryAdapter";
|
|
3
3
|
export { OpenTelemetryAdapter, type OpenTelemetryAdapterOptions, } from "./OpenTelemetryAdapter";
|
|
4
4
|
export { type ConfiguredTelemetryHandle, type CreateOpenTelemetryTelemetryServiceOptions, createConfiguredTelemetryHandle, createConfiguredTelemetryService, createOpenTelemetryTelemetryService, OpenTelemetryProvider, type OpenTelemetryProviderOptions, } from "./OpenTelemetryProvider";
|
|
5
|
+
export { type ClientTelemetryContext, createClientScopedTelemetryService, createScopedTelemetryService, resolveClientTelemetryProperties, } from "./scoped-telemetry";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as x,mkdirSync as v,readFileSync as G,writeFileSync as g}from"node:fs";import{resolve as u}from"node:path";import{resolveSessionDataDir as b}from"@cline/shared/storage";import{nanoid as S}from"nanoid";import*as m from"node-machine-id";var c="machine-id",M,h=!1;function B(){if(!h)M=w(),h=!0;return M??C()}function X(f){let P=f?.trim();if(P)return P;let A=w();if(A)return A;return C()}function d(){let f=m;return f.machineIdSync??f.default?.machineIdSync}function w(){try{let f=d();if(!f)return;return f().trim()||void 0}catch{return}}function C(){let f=b(),P=u(f,c);try{if(x(P)){let O=G(P,"utf8").trim();if(O.length>0)return O}}catch{}let A=`cl-${S()}`;try{v(f,{recursive:!0}),g(P,A,"utf8")}catch{}return A}class Y{name;metadata;meter;logger;enabled;distinctId;commonProperties;counters=new Map;histograms=new Map;gauges=new Map;gaugeValues=new Map;meterProvider;loggerProvider;constructor(f){this.name=f.name??"OpenTelemetryAdapter",this.metadata={...f.metadata},this.meterProvider=f.meterProvider,this.loggerProvider=f.loggerProvider,this.meter=f.meterProvider?.getMeter("cline")??null,this.logger=f.loggerProvider?.getLogger("cline")??null,this.enabled=f.enabled??!0,this.distinctId=f.distinctId,this.commonProperties=f.commonProperties?{...f.commonProperties}:{}}emit(f,P){if(!this.isEnabled())return;this.emitLog(f,P,!1)}emitRequired(f,P){this.emitLog(f,P,!0)}recordCounter(f,P,A,O,j=!1){if(!this.meter||!j&&!this.isEnabled())return;let H=this.counters.get(f);if(!H)H=this.meter.createCounter(f,O?{description:O}:void 0),this.counters.set(f,H);H.add(P,this.flattenProperties(this.buildAttributes(A)))}recordHistogram(f,P,A,O,j=!1){if(!this.meter||!j&&!this.isEnabled())return;let H=this.histograms.get(f);if(!H)H=this.meter.createHistogram(f,O?{description:O}:void 0),this.histograms.set(f,H);H.record(P,this.flattenProperties(this.buildAttributes(A)))}recordGauge(f,P,A,O,j=!1){if(!this.meter||!j&&!this.isEnabled())return;let H=this.buildAttributes(A),$=JSON.stringify(H),K=this.gaugeValues.get(f);if(P===null){if(K){if(K.delete($),K.size===0)this.gaugeValues.delete(f),this.gauges.delete(f)}return}let T=K;if(!T)T=new Map,this.gaugeValues.set(f,T);if(!this.gauges.has(f)){let J=this.meter.createObservableGauge(f,O?{description:O}:void 0);J.addCallback((V)=>{for(let k of this.snapshotGaugeSeries(f))V.observe(k.value,this.flattenProperties(k.attributes))}),this.gauges.set(f,J)}T.set($,{value:P,attributes:H})}isEnabled(){return typeof this.enabled==="function"?this.enabled():this.enabled}setDistinctId(f){this.distinctId=f}setCommonProperties(f){this.commonProperties={...f}}updateCommonProperties(f){this.commonProperties={...this.commonProperties,...f}}async flush(){await Promise.all([this.meterProvider?.forceFlush?.(),this.loggerProvider?.forceFlush?.()])}async dispose(){await Promise.all([this.meterProvider?.shutdown?.(),this.loggerProvider?.shutdown?.()])}emitLog(f,P,A){if(!this.logger)return;let O=this.flattenProperties(this.buildAttributes(P,A));this.logger.emit({severityText:"INFO",body:f,attributes:O})}buildAttributes(f,P=!1){return{...this.commonProperties,...this.metadata,...f,...this.distinctId?{distinct_id:this.distinctId}:{},...P?{_required:!0}:{}}}snapshotGaugeSeries(f){let P=this.gaugeValues.get(f);if(!P)return[];return Array.from(P.values(),(A)=>({value:A.value,attributes:A.attributes?{...A.attributes}:void 0}))}flattenProperties(f,P="",A=new WeakSet,O=0){if(!f)return{};let j={},H=100,$=10;for(let[K,T]of Object.entries(f)){if(K==="__proto__"||K==="constructor"||K==="prototype")continue;let J=P?`${P}.${K}`:K;if(T===null||T===void 0){j[J]=String(T);continue}if(Array.isArray(T)){let V=T.length>H?T.slice(0,H):T;try{j[J]=JSON.stringify(V)}catch{j[J]="[UnserializableArray]"}if(T.length>H)j[`${J}_truncated`]=!0,j[`${J}_original_length`]=T.length;continue}if(typeof T==="object"){if(T instanceof Date){j[J]=T.toISOString();continue}if(T instanceof Error){j[J]=T.message;continue}if(A.has(T)){j[J]="[Circular]";continue}if(O>=$){j[J]="[MaxDepthExceeded]";continue}A.add(T),Object.assign(j,this.flattenProperties(T,J,A,O+1));continue}if(r(T)){j[J]=T;continue}try{j[J]=JSON.stringify(T)}catch{j[J]=String(T)}}return j}}function r(f){return typeof f==="string"||typeof f==="number"||typeof f==="boolean"}import{metrics as Af,trace as Of}from"@opentelemetry/api";import{logs as jf}from"@opentelemetry/api-logs";import{OTLPLogExporter as Hf}from"@opentelemetry/exporter-logs-otlp-http";import{OTLPMetricExporter as Tf}from"@opentelemetry/exporter-metrics-otlp-http";import{OTLPTraceExporter as $f}from"@opentelemetry/exporter-trace-otlp-http";import{resourceFromAttributes as Jf}from"@opentelemetry/resources";import{BatchLogRecordProcessor as Wf,ConsoleLogRecordExporter as Kf,LoggerProvider as Xf}from"@opentelemetry/sdk-logs";import{ConsoleMetricExporter as Yf,MeterProvider as Zf,PeriodicExportingMetricReader as y}from"@opentelemetry/sdk-metrics";import{BatchSpanProcessor as Qf,ConsoleSpanExporter as Vf,SimpleSpanProcessor as Bf}from"@opentelemetry/sdk-trace-base";import{NodeTracerProvider as Rf}from"@opentelemetry/sdk-trace-node";import{ATTR_SERVICE_NAME as Ff,ATTR_SERVICE_VERSION as Uf}from"@opentelemetry/semantic-conventions";import{mkdirSync as df,readFileSync as l,statSync as n,writeFileSync as rf}from"node:fs";import{CONFIGURABLE_MODEL_TOOL_NAMES as a}from"@cline/shared";import{resolveGlobalSettingsPath as p}from"@cline/shared/storage";import{z as W}from"zod";import{AGENT_UNEXPECTED_REASONING_TOKENS_EVENT as zf,captureAgentUnexpectedReasoningTokens as Df,captureTaskLifecycleEvent as Nf,SDK_ERROR_TELEMETRY_EVENT as xf,TASK_CANCELLED_EVENT as vf,TASK_FIRST_CHUNK_RECEIVED_EVENT as Gf,TASK_PROVIDER_REQUEST_STARTED_EVENT as gf,TASK_PROVIDER_STREAM_FAILED_EVENT as uf,TASK_PROVIDER_STREAM_STARTED_EVENT as bf}from"@cline/shared";var q=W.preprocess((f)=>Array.isArray(f)?f.filter((P)=>typeof P==="string").map((P)=>P.trim()).filter(Boolean):void 0,W.array(W.string()).optional()).transform((f)=>{if(!f)return;let P=[...new Set(f)].sort((A,O)=>A.localeCompare(O));return P.length>0?P:void 0}),i=W.enum(["basic","agentic"]).catch("agentic"),s=W.partialRecord(W.enum(a),W.object({enabled:W.boolean()}).strip()).optional(),o=W.enum(["plan","act"]),E=W.object({telemetryOptOut:W.boolean().default(!1).catch(!1),autoUpdateEnabled:W.boolean().default(!0).catch(!0),compactionStrategy:i.optional(),compactionEnabled:W.boolean().optional().catch(void 0),planActMode:o.optional().catch(void 0),toolAutoApprove:W.boolean().optional().catch(void 0),tuiTheme:W.string().optional().catch(void 0),disabledTools:q.optional(),tools:s,disabledPlugins:q.optional()}).strip().transform((f)=>{let P={autoUpdateEnabled:f.autoUpdateEnabled,telemetryOptOut:f.telemetryOptOut};if(f.compactionStrategy)P.compactionStrategy=f.compactionStrategy;if(f.compactionEnabled!==void 0)P.compactionEnabled=f.compactionEnabled;if(f.planActMode)P.planActMode=f.planActMode;if(f.toolAutoApprove!==void 0)P.toolAutoApprove=f.toolAutoApprove;if(f.tuiTheme?.trim())P.tuiTheme=f.tuiTheme.trim();if(f.disabledTools?.length)P.disabledTools=f.disabledTools;if(f.tools&&Object.keys(f.tools).length>0)P.tools=f.tools;if(f.disabledPlugins?.length)P.disabledPlugins=f.disabledPlugins;return P});function Z(){return E.parse({})}var R;function t(f){if(f.disabledTools)Object.freeze(f.disabledTools);if(f.tools){for(let P of Object.values(f.tools))Object.freeze(P);Object.freeze(f.tools)}if(f.disabledPlugins)Object.freeze(f.disabledPlugins);return Object.freeze(f)}function e(f){let P;try{P=l(f,"utf8")}catch{return Z()}try{let A=E.safeParse(JSON.parse(P));return A.success?A.data:Z()}catch{return Z()}}function ff(){let f=p(),P=n(f,{throwIfNoEntry:!1}),A=P?.mtimeMs??0,O=P?.size??0,j=R;if(j&&j.path===f&&j.mtimeMs===A&&j.size===O)return j;let H=t(P?e(f):Z());return R={path:f,mtimeMs:A,size:O,value:H},R}function Pf(){return ff().value}function I(){return Pf().telemetryOptOut}class F{name;logger;enabled;constructor(f={}){this.name=f.name??"TelemetryLoggerSink",this.logger=f.logger,this.enabled=f.enabled??!0}emit(f,P){if(!this.isEnabled())return;this.logger?.log("telemetry.event",{telemetrySink:this.name,event:f,properties:P})}emitRequired(f,P){this.logger?.log("telemetry.required_event",{telemetrySink:this.name,severity:"warn",event:f,properties:P})}recordCounter(f,P,A,O,j){if(!j&&!this.isEnabled())return;this.logger?.debug("telemetry.metric",{telemetrySink:this.name,instrument:"counter",name:f,value:P,attributes:A,description:O,required:j===!0})}recordHistogram(f,P,A,O,j){if(!j&&!this.isEnabled())return;this.logger?.debug("telemetry.metric",{telemetrySink:this.name,instrument:"histogram",name:f,value:P,attributes:A,description:O,required:j===!0})}recordGauge(f,P,A,O,j){if(!j&&!this.isEnabled())return;this.logger?.debug("telemetry.metric",{telemetrySink:this.name,instrument:"gauge",name:f,value:P,attributes:A,description:O,required:j===!0})}isEnabled(){return typeof this.enabled==="function"?this.enabled():this.enabled}async flush(){}async dispose(){}}class Q{adapters;metadata;distinctId;deviceId;commonProperties;constructor(f={}){if(this.adapters=[...f.adapters??[]],f.logger)this.adapters.push(new F({logger:f.logger}));this.metadata={...f.metadata??{}},this.distinctId=f.distinctId,this.deviceId=f.deviceId??B(),this.commonProperties={...f.commonProperties??{}}}addAdapter(f){this.adapters.push(f)}setDistinctId(f){this.distinctId=f}setMetadata(f){this.metadata={...f}}updateMetadata(f){this.metadata={...this.metadata,...f}}setCommonProperties(f){this.commonProperties={...f}}updateCommonProperties(f){this.commonProperties={...this.commonProperties,...f}}isEnabled(){return this.adapters.some((f)=>f.isEnabled())}capture(f){let P=this.buildAttributes(f.properties);for(let A of this.adapters)A.emit(f.event,P)}captureRequired(f,P){let A=this.buildAttributes(P);for(let O of this.adapters)O.emitRequired(f,A)}recordCounter(f,P,A,O,j=!1){let H=this.buildAttributes(A);for(let $ of this.adapters)$.recordCounter(f,P,H,O,j)}recordHistogram(f,P,A,O,j=!1){let H=this.buildAttributes(A);for(let $ of this.adapters)$.recordHistogram(f,P,H,O,j)}recordGauge(f,P,A,O,j=!1){let H=this.buildAttributes(A);for(let $ of this.adapters)$.recordGauge(f,P,H,O,j)}async flush(){await Promise.all(this.adapters.map((f)=>f.flush()))}async dispose(){await Promise.all(this.adapters.map((f)=>f.dispose()))}buildAttributes(f){return{...this.commonProperties,...f,...this.metadata,...this.distinctId?{distinct_id:this.distinctId}:{},device_id:this.deviceId}}}class z{distinctId;metadata;commonProperties;constructor(f={}){this.distinctId=f.distinctId,this.metadata={...f.metadata??{}},this.commonProperties={...f.commonProperties??{}}}setDistinctId(f){this.distinctId=f}setMetadata(f){this.metadata={...f}}updateMetadata(f){this.metadata={...this.metadata,...f}}setCommonProperties(f){this.commonProperties={...f}}updateCommonProperties(f){this.commonProperties={...this.commonProperties,...f}}isEnabled(){return!1}capture(f){this.resolveProperties(f.properties)}captureRequired(f,P){this.resolveProperties(P)}recordCounter(){}recordHistogram(){}recordGauge(){}async flush(){}async dispose(){}resolveProperties(f){return{...this.commonProperties,...f,...this.metadata,...this.distinctId?{distinct_id:this.distinctId}:{}}}}class L{meterProvider;loggerProvider;tracerProvider;options;constructor(f={}){this.options=f;let P=Jf({[Ff]:f.serviceName??"cline",...f.serviceVersion?{[Uf]:f.serviceVersion}:{}});if(this.meterProvider=this.createMeterProvider(P),this.loggerProvider=this.createLoggerProvider(P),this.tracerProvider=this.createTracerProvider(P),this.meterProvider)Af.setGlobalMeterProvider(this.meterProvider);if(this.loggerProvider)jf.setGlobalLoggerProvider(this.loggerProvider);if(this.tracerProvider)this.tracerProvider.register()}getTracer(f="cline",P){return Of.getTracer(f,P??this.options.serviceVersion)}createAdapter(f){return new Y({...f,meterProvider:this.meterProvider,loggerProvider:this.loggerProvider})}createTelemetryService(f){let P=this.createAdapter({name:f.name,enabled:this.options.enabled,metadata:f.metadata});return new Q({...f,adapters:[P],distinctId:X(f.distinctId)})}async forceFlush(){await Promise.all([this.meterProvider?.forceFlush?.(),this.loggerProvider?.forceFlush?.(),this.tracerProvider?.forceFlush?.()])}async dispose(){await Promise.all([this.meterProvider?.shutdown?.(),this.loggerProvider?.shutdown?.(),this.tracerProvider?.shutdown?.()])}createMeterProvider(f){let P=U(this.options.metricsExporter);if(P.length===0)return null;let A=Math.max(1000,this.options.metricExportIntervalMs??this.options.metricExportInterval??60000),O=Math.min(30000,Math.floor(A*0.8)),j=P.map((H)=>Mf(H,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json",interval:A,timeout:O})).filter((H)=>H!==null);if(j.length===0)return null;return new Zf({resource:f,readers:j})}createTracerProvider(f){let P=U(this.options.tracesExporter);if(P.length===0)return null;let A=this.options.otlpTracesEndpoint??this.options.otlpEndpoint,O=this.options.otlpTracesHeaders??this.options.otlpHeaders,j=[];for(let H of P){let $=kf(H,{endpoint:A,headers:O,insecure:this.options.otlpInsecure??!1,protocol:"http/json"});if($)j.push($)}if(j.length===0)return null;return new Rf({resource:f,spanProcessors:j})}createLoggerProvider(f){let P=U(this.options.logsExporter);if(P.length===0)return null;let A=P.map((O)=>{let j=_f(O,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json"});if(!j)return null;return new Wf(j,{maxQueueSize:this.options.logMaxQueueSize??2048,maxExportBatchSize:this.options.logBatchSize??512,scheduledDelayMillis:this.options.logBatchTimeoutMs??this.options.logBatchTimeout??5000})}).filter((O)=>O!==null);if(A.length===0)return null;return new Xf({resource:f,processors:A})}}function D(f){let P=new L(f),A=P.createTelemetryService(f),O=()=>{A.captureRequired("telemetry.provider_created",{provider:"opentelemetry",enabled:f.enabled??!0,logsExporter:Array.isArray(f.logsExporter)?f.logsExporter.join(","):f.logsExporter,metricsExporter:Array.isArray(f.metricsExporter)?f.metricsExporter.join(","):f.metricsExporter,tracesExporter:Array.isArray(f.tracesExporter)?f.tracesExporter.join(","):f.tracesExporter,otlpProtocol:f.otlpProtocol,hasOtlpEndpoint:Boolean(f.otlpEndpoint),serviceName:f.serviceName,serviceVersion:f.serviceVersion})};if(!f.deferProviderCreatedEvent)O();return{provider:P,telemetry:A,emitProviderCreated:O}}function N(f){if(I())return{telemetry:new z(f)};if(f.enabled!==!0)return{telemetry:new Q({...f,distinctId:X(f.distinctId)})};return D(f)}function Lf(f){let{telemetry:P,provider:A,emitProviderCreated:O}=N(f);return{telemetry:P,provider:A,flush:async()=>{let $=A;if($&&typeof $.forceFlush==="function")try{await $.forceFlush()}catch{}},dispose:async()=>{await Promise.allSettled([P.dispose(),A?.dispose()])},...f.deferProviderCreatedEvent&&O?{emitProviderCreated:O}:{}}}function U(f){if(!f)return[];return(Array.isArray(f)?f:f.split(",")).map((A)=>A.trim()).filter((A)=>A==="console"||A==="otlp")}function _f(f,P){if(f==="console")return new Kf;if(!P.endpoint)return null;let A=_(P.endpoint,"/v1/logs");return new Hf({url:A,headers:P.headers})}function kf(f,P){if(f==="console")return new Bf(new Vf);if(!P.endpoint)return null;let A=_(P.endpoint,"/v1/traces");return new Qf(new $f({url:A,headers:P.headers}))}function Mf(f,P){if(f==="console")return new y({exporter:new Yf,exportIntervalMillis:P.interval,exportTimeoutMillis:P.timeout});if(!P.endpoint)return null;let A=_(P.endpoint,"/v1/metrics");return new y({exporter:new Tf({url:A,headers:P.headers}),exportIntervalMillis:P.interval,exportTimeoutMillis:P.timeout})}function _(f,P){let A=new URL(f),O=A.pathname.endsWith("/")?A.pathname.slice(0,-1):A.pathname;return A.pathname=O.endsWith(P)?O:`${O}${P}`,A.toString()}export{X as resolveCoreDistinctId,B as resolveCoreDeviceId,D as createOpenTelemetryTelemetryService,N as createConfiguredTelemetryService,Lf as createConfiguredTelemetryHandle,L as OpenTelemetryProvider,Y as OpenTelemetryAdapter};
|
|
1
|
+
import{existsSync as v,mkdirSync as u,readFileSync as c,writeFileSync as m}from"node:fs";import{resolve as d}from"node:path";import{resolveSessionDataDir as l}from"@cline/shared/storage";import{nanoid as r}from"nanoid";import*as p from"node-machine-id";var n="machine-id",M,w=!1;function Q(){if(!w)M=h(),w=!0;return M??q()}function H(f){let T=f?.trim();if(T)return T;let A=h();if(A)return A;return q()}function a(){let f=p;return f.machineIdSync??f.default?.machineIdSync}function h(){try{let f=a();if(!f)return;return f().trim()||void 0}catch{return}}function q(){let f=l(),T=d(f,n);try{if(v(T)){let O=c(T,"utf8").trim();if(O.length>0)return O}}catch{}let A=`cl-${r()}`;try{u(f,{recursive:!0}),m(T,A,"utf8")}catch{}return A}class X{name;metadata;meter;logger;enabled;distinctId;commonProperties;counters=new Map;histograms=new Map;gauges=new Map;gaugeValues=new Map;meterProvider;loggerProvider;constructor(f){this.name=f.name??"OpenTelemetryAdapter",this.metadata={...f.metadata},this.meterProvider=f.meterProvider,this.loggerProvider=f.loggerProvider,this.meter=f.meterProvider?.getMeter("cline")??null,this.logger=f.loggerProvider?.getLogger("cline")??null,this.enabled=f.enabled??!0,this.distinctId=f.distinctId,this.commonProperties=f.commonProperties?{...f.commonProperties}:{}}emit(f,T){if(!this.isEnabled())return;this.emitLog(f,T,!1)}emitRequired(f,T){this.emitLog(f,T,!0)}recordCounter(f,T,A,O,j=!1){if(!this.meter||!j&&!this.isEnabled())return;let J=this.counters.get(f);if(!J)J=this.meter.createCounter(f,O?{description:O}:void 0),this.counters.set(f,J);J.add(T,this.flattenProperties(this.buildAttributes(A)))}recordHistogram(f,T,A,O,j=!1){if(!this.meter||!j&&!this.isEnabled())return;let J=this.histograms.get(f);if(!J)J=this.meter.createHistogram(f,O?{description:O}:void 0),this.histograms.set(f,J);J.record(T,this.flattenProperties(this.buildAttributes(A)))}recordGauge(f,T,A,O,j=!1){if(!this.meter||!j&&!this.isEnabled())return;let J=this.buildAttributes(A),_=JSON.stringify(J),W=this.gaugeValues.get(f);if(T===null){if(W){if(W.delete(_),W.size===0)this.gaugeValues.delete(f),this.gauges.delete(f)}return}let K=W;if(!K)K=new Map,this.gaugeValues.set(f,K);if(!this.gauges.has(f)){let $=this.meter.createObservableGauge(f,O?{description:O}:void 0);$.addCallback((R)=>{for(let C of this.snapshotGaugeSeries(f))R.observe(C.value,this.flattenProperties(C.attributes))}),this.gauges.set(f,$)}K.set(_,{value:T,attributes:J})}isEnabled(){return typeof this.enabled==="function"?this.enabled():this.enabled}setDistinctId(f){this.distinctId=f}setCommonProperties(f){this.commonProperties={...f}}updateCommonProperties(f){this.commonProperties={...this.commonProperties,...f}}async flush(){await Promise.all([this.meterProvider?.forceFlush?.(),this.loggerProvider?.forceFlush?.()])}async dispose(){await Promise.all([this.meterProvider?.shutdown?.(),this.loggerProvider?.shutdown?.()])}emitLog(f,T,A){if(!this.logger)return;let O=this.flattenProperties(this.buildAttributes(T,A));this.logger.emit({severityText:"INFO",body:f,attributes:O})}buildAttributes(f,T=!1){return{...this.commonProperties,...this.metadata,...f,...this.distinctId?{distinct_id:this.distinctId}:{},...T?{_required:!0}:{}}}snapshotGaugeSeries(f){let T=this.gaugeValues.get(f);if(!T)return[];return Array.from(T.values(),(A)=>({value:A.value,attributes:A.attributes?{...A.attributes}:void 0}))}flattenProperties(f,T="",A=new WeakSet,O=0){if(!f)return{};let j={},J=100,_=10;for(let[W,K]of Object.entries(f)){if(W==="__proto__"||W==="constructor"||W==="prototype")continue;let $=T?`${T}.${W}`:W;if(K===null||K===void 0){j[$]=String(K);continue}if(Array.isArray(K)){let R=K.length>J?K.slice(0,J):K;try{j[$]=JSON.stringify(R)}catch{j[$]="[UnserializableArray]"}if(K.length>J)j[`${$}_truncated`]=!0,j[`${$}_original_length`]=K.length;continue}if(typeof K==="object"){if(K instanceof Date){j[$]=K.toISOString();continue}if(K instanceof Error){j[$]=K.message;continue}if(A.has(K)){j[$]="[Circular]";continue}if(O>=_){j[$]="[MaxDepthExceeded]";continue}A.add(K),Object.assign(j,this.flattenProperties(K,$,A,O+1));continue}if(s(K)){j[$]=K;continue}try{j[$]=JSON.stringify(K)}catch{j[$]=String(K)}}return j}}function s(f){return typeof f==="string"||typeof f==="number"||typeof f==="boolean"}import{markOtlpTraceRelayProvider as Kf}from"@cline/shared";import{metrics as Wf,trace as $f}from"@opentelemetry/api";import{logs as Bf}from"@opentelemetry/api-logs";import{OTLPLogExporter as Pf}from"@opentelemetry/exporter-logs-otlp-http";import{OTLPMetricExporter as Rf}from"@opentelemetry/exporter-metrics-otlp-http";import{OTLPTraceExporter as Uf}from"@opentelemetry/exporter-trace-otlp-http";import{resourceFromAttributes as Hf}from"@opentelemetry/resources";import{BatchLogRecordProcessor as Xf,ConsoleLogRecordExporter as Yf,LoggerProvider as Zf}from"@opentelemetry/sdk-logs";import{ConsoleMetricExporter as Qf,MeterProvider as Sf,PeriodicExportingMetricReader as z}from"@opentelemetry/sdk-metrics";import{BatchSpanProcessor as Vf,ConsoleSpanExporter as Lf,SimpleSpanProcessor as Ff}from"@opentelemetry/sdk-trace-base";import{NodeTracerProvider as kf}from"@opentelemetry/sdk-trace-node";import{ATTR_SERVICE_NAME as Ef,ATTR_SERVICE_VERSION as Cf}from"@opentelemetry/semantic-conventions";import{mkdirSync as of,readFileSync as i,statSync as o,writeFileSync as tf}from"node:fs";import{CONFIGURABLE_MODEL_TOOL_NAMES as t}from"@cline/shared";import{resolveGlobalSettingsPath as e}from"@cline/shared/storage";import{z as B}from"zod";import{AGENT_UNEXPECTED_REASONING_TOKENS_EVENT as gf,captureAgentUnexpectedReasoningTokens as vf,captureTaskLifecycleEvent as uf,SDK_ERROR_TELEMETRY_EVENT as cf,TASK_CANCELLED_EVENT as mf,TASK_FIRST_CHUNK_RECEIVED_EVENT as df,TASK_PROVIDER_REQUEST_STARTED_EVENT as lf,TASK_PROVIDER_STREAM_FAILED_EVENT as rf,TASK_PROVIDER_STREAM_STARTED_EVENT as pf}from"@cline/shared";var S=B.preprocess((f)=>Array.isArray(f)?f.filter((T)=>typeof T==="string").map((T)=>T.trim()).filter(Boolean):void 0,B.array(B.string()).optional()).transform((f)=>{if(!f)return;let T=[...new Set(f)].sort((A,O)=>A.localeCompare(O));return T.length>0?T:void 0}),ff=B.enum(["basic","agentic"]).catch("agentic"),Tf=B.partialRecord(B.enum(t),B.object({enabled:B.boolean()}).strip()).optional(),Af=B.enum(["plan","act"]),I=B.object({telemetryOptOut:B.boolean().default(!1).catch(!1),autoUpdateEnabled:B.boolean().default(!0).catch(!0),compactionStrategy:ff.optional(),compactionEnabled:B.boolean().optional().catch(void 0),planActMode:Af.optional().catch(void 0),toolAutoApprove:B.boolean().optional().catch(void 0),tuiTheme:B.string().optional().catch(void 0),disabledTools:S.optional(),tools:Tf,disabledPlugins:S.optional(),disabledAgentPlugins:S.optional()}).strip().transform((f)=>{let T={autoUpdateEnabled:f.autoUpdateEnabled,telemetryOptOut:f.telemetryOptOut};if(f.compactionStrategy)T.compactionStrategy=f.compactionStrategy;if(f.compactionEnabled!==void 0)T.compactionEnabled=f.compactionEnabled;if(f.planActMode)T.planActMode=f.planActMode;if(f.toolAutoApprove!==void 0)T.toolAutoApprove=f.toolAutoApprove;if(f.tuiTheme?.trim())T.tuiTheme=f.tuiTheme.trim();if(f.disabledTools?.length)T.disabledTools=f.disabledTools;if(f.tools&&Object.keys(f.tools).length>0)T.tools=f.tools;if(f.disabledPlugins?.length)T.disabledPlugins=f.disabledPlugins;if(f.disabledAgentPlugins?.length)T.disabledAgentPlugins=f.disabledAgentPlugins;return T});function Y(){return I.parse({})}var V;function Of(f){if(f.disabledTools)Object.freeze(f.disabledTools);if(f.tools){for(let T of Object.values(f.tools))Object.freeze(T);Object.freeze(f.tools)}if(f.disabledPlugins)Object.freeze(f.disabledPlugins);if(f.disabledAgentPlugins)Object.freeze(f.disabledAgentPlugins);return Object.freeze(f)}function jf(f){let T;try{T=i(f,"utf8")}catch{return{value:Y(),loadFailed:!0}}try{let A=I.safeParse(JSON.parse(T));return A.success?{value:A.data,loadFailed:!1}:{value:Y(),loadFailed:!0}}catch{return{value:Y(),loadFailed:!0}}}function _f(){let f=e(),T=o(f,{throwIfNoEntry:!1}),A=T?.mtimeMs??0,O=T?.size??0,j=V;if(j&&j.path===f&&j.mtimeMs===A&&j.size===O)return j;let J=T?jf(f):{value:Y(),loadFailed:!1},_=Of(J.value);return V={path:f,mtimeMs:A,size:O,value:_,loadFailed:J.loadFailed},V}function Jf(){return _f().value}function N(){return Jf().telemetryOptOut}class L{name;logger;enabled;constructor(f={}){this.name=f.name??"TelemetryLoggerSink",this.logger=f.logger,this.enabled=f.enabled??!0}emit(f,T){if(!this.isEnabled())return;this.logger?.log("telemetry.event",{telemetrySink:this.name,event:f,properties:T})}emitRequired(f,T){this.logger?.log("telemetry.required_event",{telemetrySink:this.name,severity:"warn",event:f,properties:T})}recordCounter(f,T,A,O,j){if(!j&&!this.isEnabled())return;this.logger?.debug("telemetry.metric",{telemetrySink:this.name,instrument:"counter",name:f,value:T,attributes:A,description:O,required:j===!0})}recordHistogram(f,T,A,O,j){if(!j&&!this.isEnabled())return;this.logger?.debug("telemetry.metric",{telemetrySink:this.name,instrument:"histogram",name:f,value:T,attributes:A,description:O,required:j===!0})}recordGauge(f,T,A,O,j){if(!j&&!this.isEnabled())return;this.logger?.debug("telemetry.metric",{telemetrySink:this.name,instrument:"gauge",name:f,value:T,attributes:A,description:O,required:j===!0})}isEnabled(){return typeof this.enabled==="function"?this.enabled():this.enabled}async flush(){}async dispose(){}}class Z{adapters;metadata;distinctId;deviceId;commonProperties;constructor(f={}){if(this.adapters=[...f.adapters??[]],f.logger)this.adapters.push(new L({logger:f.logger}));this.metadata={...f.metadata??{}},this.distinctId=f.distinctId,this.deviceId=f.deviceId??Q(),this.commonProperties={...f.commonProperties??{}}}addAdapter(f){this.adapters.push(f)}setDistinctId(f){this.distinctId=f}setMetadata(f){this.metadata={...f}}updateMetadata(f){this.metadata={...this.metadata,...f}}setCommonProperties(f){this.commonProperties={...f}}updateCommonProperties(f){this.commonProperties={...this.commonProperties,...f}}isEnabled(){return this.adapters.some((f)=>f.isEnabled())}capture(f){let T=this.buildAttributes(f.properties);for(let A of this.adapters)A.emit(f.event,T)}captureRequired(f,T){let A=this.buildAttributes(T);for(let O of this.adapters)O.emitRequired(f,A)}recordCounter(f,T,A,O,j=!1){let J=this.buildAttributes(A);for(let _ of this.adapters)_.recordCounter(f,T,J,O,j)}recordHistogram(f,T,A,O,j=!1){let J=this.buildAttributes(A);for(let _ of this.adapters)_.recordHistogram(f,T,J,O,j)}recordGauge(f,T,A,O,j=!1){let J=this.buildAttributes(A);for(let _ of this.adapters)_.recordGauge(f,T,J,O,j)}async flush(){await Promise.all(this.adapters.map((f)=>f.flush()))}async dispose(){await Promise.all(this.adapters.map((f)=>f.dispose()))}buildAttributes(f){let T=typeof f?.distinct_id==="string"&&f.distinct_id.trim()?f.distinct_id.trim():this.distinctId,A={...this.commonProperties,...this.metadata,...f,...T?{distinct_id:T}:{},device_id:this.deviceId};return Object.fromEntries(Object.entries(A).filter(([,O])=>O!==void 0))}}class D{distinctId;metadata;commonProperties;constructor(f={}){this.distinctId=f.distinctId,this.metadata={...f.metadata??{}},this.commonProperties={...f.commonProperties??{}}}setDistinctId(f){this.distinctId=f}setMetadata(f){this.metadata={...f}}updateMetadata(f){this.metadata={...this.metadata,...f}}setCommonProperties(f){this.commonProperties={...f}}updateCommonProperties(f){this.commonProperties={...this.commonProperties,...f}}isEnabled(){return!1}capture(f){this.resolveProperties(f.properties)}captureRequired(f,T){this.resolveProperties(T)}recordCounter(){}recordHistogram(){}recordGauge(){}async flush(){}async dispose(){}resolveProperties(f){let T=typeof f?.distinct_id==="string"&&f.distinct_id.trim()?f.distinct_id.trim():this.distinctId,A={...this.commonProperties,...this.metadata,...f,...T?{distinct_id:T}:{}};return Object.fromEntries(Object.entries(A).filter(([,O])=>O!==void 0))}}class k{meterProvider;loggerProvider;tracerProvider;options;constructor(f={}){this.options=f;let T=Hf({[Ef]:f.serviceName??"cline",...f.serviceVersion?{[Cf]:f.serviceVersion}:{}});if(this.meterProvider=this.createMeterProvider(T),this.loggerProvider=this.createLoggerProvider(T),this.tracerProvider=this.createTracerProvider(T),this.meterProvider)Wf.setGlobalMeterProvider(this.meterProvider);if(this.loggerProvider)Bf.setGlobalLoggerProvider(this.loggerProvider);if(this.tracerProvider)this.tracerProvider.register()}getTracer(f="cline",T){return $f.getTracer(f,T??this.options.serviceVersion)}createAdapter(f){return new X({...f,meterProvider:this.meterProvider,loggerProvider:this.loggerProvider})}createTelemetryService(f){let T=this.createAdapter({name:f.name,enabled:this.options.enabled,metadata:f.metadata});return new Z({...f,adapters:[T],distinctId:H(f.distinctId)})}async forceFlush(){await Promise.all([this.meterProvider?.forceFlush?.(),this.loggerProvider?.forceFlush?.(),this.tracerProvider?.forceFlush?.()])}async dispose(){await Promise.all([this.meterProvider?.shutdown?.(),this.loggerProvider?.shutdown?.(),this.tracerProvider?.shutdown?.()])}createMeterProvider(f){let T=F(this.options.metricsExporter);if(T.length===0)return null;let A=Math.max(1000,this.options.metricExportIntervalMs??this.options.metricExportInterval??60000),O=Math.min(30000,Math.floor(A*0.8)),j=T.map((J)=>qf(J,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json",interval:A,timeout:O})).filter((J)=>J!==null);if(j.length===0)return null;return new Sf({resource:f,readers:j})}createTracerProvider(f){let T=F(this.options.tracesExporter);if(T.length===0)return null;let A=this.options.otlpTracesEndpoint??this.options.otlpEndpoint,O=this.options.otlpTracesHeaders??this.options.otlpHeaders,j=[],J=!1;for(let W of T){let K=hf(W,{endpoint:A,headers:O,insecure:this.options.otlpInsecure??!1,protocol:"http/json"});if(K){if(j.push(K),W!=="console")J=!0}}if(j.length===0)return null;let _=new kf({resource:f,spanProcessors:j});if(J)Kf(_);return _}createLoggerProvider(f){let T=F(this.options.logsExporter);if(T.length===0)return null;let A=T.map((O)=>{let j=wf(O,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json"});if(!j)return null;return new Xf(j,{maxQueueSize:this.options.logMaxQueueSize??2048,maxExportBatchSize:this.options.logBatchSize??512,scheduledDelayMillis:this.options.logBatchTimeoutMs??this.options.logBatchTimeout??5000})}).filter((O)=>O!==null);if(A.length===0)return null;return new Zf({resource:f,processors:A})}}function x(f){let T=new k(f),A=T.createTelemetryService(f),O=()=>{A.captureRequired("telemetry.provider_created",{provider:"opentelemetry",enabled:f.enabled??!0,logsExporter:Array.isArray(f.logsExporter)?f.logsExporter.join(","):f.logsExporter,metricsExporter:Array.isArray(f.metricsExporter)?f.metricsExporter.join(","):f.metricsExporter,tracesExporter:Array.isArray(f.tracesExporter)?f.tracesExporter.join(","):f.tracesExporter,otlpProtocol:f.otlpProtocol,hasOtlpEndpoint:Boolean(f.otlpEndpoint),serviceName:f.serviceName,serviceVersion:f.serviceVersion})};if(!f.deferProviderCreatedEvent)O();return{provider:T,telemetry:A,emitProviderCreated:O}}function G(f){if(N())return{telemetry:new D(f)};if(f.enabled!==!0)return{telemetry:new Z({...f,distinctId:H(f.distinctId)})};return x(f)}function Mf(f){let{telemetry:T,provider:A,emitProviderCreated:O}=G(f);return{telemetry:T,provider:A,flush:async()=>{let _=A;if(_&&typeof _.forceFlush==="function")try{await _.forceFlush()}catch{}},dispose:async()=>{await Promise.allSettled([T.dispose(),A?.dispose()])},...f.deferProviderCreatedEvent&&O?{emitProviderCreated:O}:{}}}function F(f){if(!f)return[];return(Array.isArray(f)?f:f.split(",")).map((A)=>A.trim()).filter((A)=>A==="console"||A==="otlp")}function wf(f,T){if(f==="console")return new Yf;if(!T.endpoint)return null;let A=E(T.endpoint,"/v1/logs");return new Pf({url:A,headers:T.headers})}function hf(f,T){if(f==="console")return new Ff(new Lf);if(!T.endpoint)return null;let A=E(T.endpoint,"/v1/traces");return new Vf(new Uf({url:A,headers:T.headers}))}function qf(f,T){if(f==="console")return new z({exporter:new Qf,exportIntervalMillis:T.interval,exportTimeoutMillis:T.timeout});if(!T.endpoint)return null;let A=E(T.endpoint,"/v1/metrics");return new z({exporter:new Rf({url:A,headers:T.headers}),exportIntervalMillis:T.interval,exportTimeoutMillis:T.timeout})}function E(f,T){let A=new URL(f),O=A.pathname.endsWith("/")?A.pathname.slice(0,-1):A.pathname;return A.pathname=O.endsWith(T)?O:`${O}${T}`,A.toString()}import{SESSION_STATUS_VALUES as MT}from"@cline/shared";var U={CORE:"core",CLI:"cli",SUBAGENT:"subagent",DESKTOP:"desktop",KANBAN:"kanban",API:"api",WEB:"web",VSCODE:"vscode",ENTERPRISE:"enterprise",IDE:"ide",JETBRAINS:"jetbrains",NEOVIM:"neovim",UNKNOWN:"unknown"};function y(f){let T=[f?.name,f?.platform].filter((A)=>typeof A==="string").join(" ").toLowerCase();if(!T)return;if(T.includes("vscode")||T.includes("visual studio code"))return U.VSCODE;if(T.includes("jetbrains")||T.includes("webstorm")||T.includes("intellij")||T.includes("pycharm")||T.includes("goland")||T.includes("clion")||T.includes("rider")||T.includes("android studio"))return U.JETBRAINS;if(T.includes("neovim"))return U.NEOVIM;if(T.includes("kanban"))return U.KANBAN;if(T.includes("desktop"))return U.DESKTOP;if(T.includes("cline-platform"))return U.WEB;if(T.includes("cline-cli")||T.includes("cline-acp"))return U.CLI;if(T.includes("cline-sdk")||T.includes("cline-core"))return U.CORE;return}function P(f){let T=f?.trim();return T?T:void 0}function b(f){let T=f.client,A=y(T)??P(f.source),O=P(T.version),j=P(T.platform)??P(T.name),J=P(T.platformVersion)??O,_={cline_type:A,extension_version:O,platform:j,platform_version:J};if(f.user?.accountId===void 0)return _;let W=typeof f.user.accountId==="string"?P(f.user.accountId):void 0;return{..._,distinct_id:W??P(f.user.distinctId),user_id:W,account_id:W,account_email:W?P(f.user.email):void 0,organization_id:W?P(f.user.organizationId):void 0}}function g(f,T){let A={},O={},j,J=(_)=>({...T,...O,...A,..._,...j?{distinct_id:j}:{}});return{setDistinctId(_){j=P(_)},setMetadata(_){A={..._}},updateMetadata(_){A={...A,..._}},setCommonProperties(_){O={..._}},updateCommonProperties(_){O={...O,..._}},isEnabled:()=>f.isEnabled(),capture:(_)=>f.capture({event:_.event,properties:J(_.properties)}),captureRequired:(_,W)=>f.captureRequired(_,J(W)),recordCounter:(_,W,K,$,R)=>f.recordCounter(_,W,J(K),$,R),recordHistogram:(_,W,K,$,R)=>f.recordHistogram(_,W,J(K),$,R),recordGauge:(_,W,K,$,R)=>f.recordGauge(_,W,J(K),$,R),flush:()=>f.flush(),dispose:async()=>{}}}function If(f,T){return g(f,b(T))}export{H as resolveCoreDistinctId,Q as resolveCoreDeviceId,b as resolveClientTelemetryProperties,g as createScopedTelemetryService,x as createOpenTelemetryTelemetryService,G as createConfiguredTelemetryService,Mf as createConfiguredTelemetryHandle,If as createClientScopedTelemetryService,k as OpenTelemetryProvider,X as OpenTelemetryAdapter};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ClientContext, ITelemetryService, TelemetryProperties, UserContext } from "@cline/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Client identity that can safely cross a runtime boundary and be attached to
|
|
4
|
+
* telemetry emitted by the process that actually executes a session.
|
|
5
|
+
*/
|
|
6
|
+
export interface ClientTelemetryContext {
|
|
7
|
+
client: ClientContext;
|
|
8
|
+
source?: string;
|
|
9
|
+
user?: UserContext;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Converts the shared client context into the established cross-surface
|
|
13
|
+
* analytics dimensions. Event-specific fields still take precedence.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveClientTelemetryProperties(context: ClientTelemetryContext): TelemetryProperties;
|
|
16
|
+
/**
|
|
17
|
+
* A non-owning view over a host telemetry service. It adds immutable
|
|
18
|
+
* per-session properties without mutating the host singleton, which is
|
|
19
|
+
* essential for a Hub process that can execute sessions from several clients
|
|
20
|
+
* concurrently.
|
|
21
|
+
*
|
|
22
|
+
* The returned view never disposes the parent. The process that created the
|
|
23
|
+
* parent telemetry service remains responsible for its lifecycle.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createScopedTelemetryService(parent: ITelemetryService, properties: TelemetryProperties): ITelemetryService;
|
|
26
|
+
/**
|
|
27
|
+
* Scopes a host telemetry singleton to one runtime client. This is the
|
|
28
|
+
* reusable bridge used by Hub-hosted sessions; local clients that already
|
|
29
|
+
* provide their own telemetry service do not need it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createClientScopedTelemetryService(parent: ITelemetryService, context: ClientTelemetryContext): ITelemetryService;
|
|
@@ -2,6 +2,11 @@ import type { ITelemetryService, WorkspaceInfo } from "@cline/shared";
|
|
|
2
2
|
export interface WorkspaceLifecycleTelemetryInput {
|
|
3
3
|
telemetry?: ITelemetryService;
|
|
4
4
|
rootPath: string;
|
|
5
|
+
/**
|
|
6
|
+
* Optional client identity used for de-duplication in a shared runtime
|
|
7
|
+
* process. The same workspace still emits once per client surface.
|
|
8
|
+
*/
|
|
9
|
+
dedupeScope?: string;
|
|
5
10
|
workspaceInfo?: WorkspaceInfo;
|
|
6
11
|
rootCount?: number;
|
|
7
12
|
vcsType?: "git" | "none";
|
|
@@ -8,8 +8,8 @@ export declare const SessionManifestSchema: z.ZodObject<{
|
|
|
8
8
|
ended_at: z.ZodOptional<z.ZodString>;
|
|
9
9
|
exit_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
10
10
|
status: z.ZodEnum<{
|
|
11
|
-
failed: "failed";
|
|
12
11
|
completed: "completed";
|
|
12
|
+
failed: "failed";
|
|
13
13
|
idle: "idle";
|
|
14
14
|
running: "running";
|
|
15
15
|
cancelled: "cancelled";
|
|
@@ -55,7 +55,9 @@ export declare class UnifiedSessionPersistenceService {
|
|
|
55
55
|
handleSubAgentEnd(rootSessionId: string, context: SubAgentEndContext): Promise<void>;
|
|
56
56
|
private isPidAlive;
|
|
57
57
|
private reconcileDeadRunningSession;
|
|
58
|
-
listSessions(limit?: number
|
|
58
|
+
listSessions(limit?: number, options?: {
|
|
59
|
+
rootOnly?: boolean;
|
|
60
|
+
}): Promise<SessionRow[]>;
|
|
59
61
|
/**
|
|
60
62
|
* Lightweight, effectively unbounded listing of session ids + metadata
|
|
61
63
|
* (no manifest reads, no dead-session reconciliation). listSessions caps
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as LlmsProviders from "@cline/llms";
|
|
2
|
+
import type { ITelemetryService } from "@cline/shared";
|
|
2
3
|
import type { CheckpointEntry, CheckpointMetadata } from "../hooks/checkpoint-hooks";
|
|
3
4
|
import type { RestoreSessionInput } from "../runtime/host/runtime-host";
|
|
4
5
|
import type { SessionRecord } from "../types/sessions";
|
|
@@ -44,6 +45,13 @@ export interface SessionCheckpointRestoreInput<TRestoreStartInput, TStartInput,
|
|
|
44
45
|
applyWorkspaceCheckpoint?: (cwd: string, checkpoint: CheckpointEntry) => Promise<void>;
|
|
45
46
|
beginWorkspaceRestoreTransaction?: (cwd: string) => Promise<WorktreeRestoreTransaction>;
|
|
46
47
|
retainCheckpointRefs?: (cwd: string, sessionId: string, history: CheckpointEntry[]) => Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Emits one `checkpoint.restore` event per restore attempt. Restores are
|
|
50
|
+
* rare and destructive, so field visibility matters: outcome, duration
|
|
51
|
+
* (the worktree transaction hashes all untracked files), and the
|
|
52
|
+
* checkpoint kind. Never file paths or contents.
|
|
53
|
+
*/
|
|
54
|
+
telemetry?: Pick<ITelemetryService, "capture">;
|
|
47
55
|
}
|
|
48
56
|
export declare class SessionVersioningService {
|
|
49
57
|
restoreCheckpoint<TRestoreStartInput, TStartInput, TStartResult>(input: SessionCheckpointRestoreInput<TRestoreStartInput, TStartInput, TStartResult>): Promise<SessionCheckpointRestoreResult<TStartResult>>;
|
package/dist/settings/types.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export interface CoreSettingsItem {
|
|
|
14
14
|
toggleable?: boolean;
|
|
15
15
|
pluginName?: string;
|
|
16
16
|
pluginPath?: string;
|
|
17
|
+
/** True when this item comes from the portable agent-plugins.org format. */
|
|
18
|
+
agentPlugin?: boolean;
|
|
19
|
+
/** Loader diagnostics associated with this item, if any. */
|
|
20
|
+
loadError?: string;
|
|
17
21
|
contributions?: CorePluginContributions;
|
|
18
22
|
}
|
|
19
23
|
export interface CorePluginContributions {
|
|
@@ -55,6 +59,10 @@ export interface CoreSettingsSnapshot {
|
|
|
55
59
|
export interface CoreSettingsListInput {
|
|
56
60
|
cwd?: string;
|
|
57
61
|
workspaceRoot?: string;
|
|
62
|
+
/** Optional explicit portable Agent Plugin roots, resolved by the host. */
|
|
63
|
+
agentPluginPaths?: string[];
|
|
64
|
+
/** Whether inspecting Cline plugins should execute their setup for tool metadata. */
|
|
65
|
+
includePluginTools?: boolean;
|
|
58
66
|
userInstructionService?: UserInstructionConfigService;
|
|
59
67
|
availabilityContext?: BuiltinToolAvailabilityContext;
|
|
60
68
|
}
|
|
@@ -46,8 +46,8 @@ export declare const TodoTaskInputSchema: z.ZodObject<{
|
|
|
46
46
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
47
47
|
automation_eligible: z.ZodOptional<z.ZodBoolean>;
|
|
48
48
|
statuses: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
49
|
-
failed: "failed";
|
|
50
49
|
completed: "completed";
|
|
50
|
+
failed: "failed";
|
|
51
51
|
cancelled: "cancelled";
|
|
52
52
|
in_progress: "in_progress";
|
|
53
53
|
approved: "approved";
|
|
@@ -3,9 +3,9 @@ import { z } from "zod";
|
|
|
3
3
|
import { type ScheduledTaskResult, type ScheduleTaskOperationOptions } from "../cron/service/schedule-tool";
|
|
4
4
|
import { type TodoTaskOperationOptions, type TodoTaskResult } from "./agenda-task-tool";
|
|
5
5
|
export declare const TASKS_TOOL_NAME = "tasks";
|
|
6
|
-
export declare const TASKS_SYSTEM_PROMPT_RULE = "# Tasks\n\nUse the `tasks` tool to manage durable Todo items and explicitly requested scheduled agent work.\n\n- Use `kind: \"todo\"` for meaningful follow-ups, handoffs, ideas, reminders, and other work that should remain visible after this session. This includes useful work you identify and suggest proactively. Agent-created Todos require user approval; Todos created directly by the user are approved immediately. Todo `available_at` controls availability in the list; it never schedules execution.\n- Use `kind: \"scheduled\"` only when the user explicitly asks Cline to execute work once at a future time or on a recurrence. One-time schedules require an exact future ISO 8601 `run_at` with an offset or Z. Recurring schedules require a five-field `cron_pattern` and
|
|
6
|
+
export declare const TASKS_SYSTEM_PROMPT_RULE = "# Tasks\n\nUse the `tasks` tool to manage durable Todo items and explicitly requested scheduled agent work.\n\n- Use `kind: \"todo\"` for meaningful follow-ups, handoffs, ideas, reminders, and other work that should remain visible after this session. This includes useful work you identify and suggest proactively. Agent-created Todos require user approval; Todos created directly by the user are approved immediately. Todo `available_at` controls availability in the list; it never schedules execution.\n- Use `kind: \"scheduled\"` only when the user explicitly asks Cline to execute work once at a future time or on a recurrence. One-time schedules require an exact future ISO 8601 `run_at` with an offset or Z. Recurring schedules require a five-field `cron_pattern` and default to the local timezone. Omit `timezone` unless the user explicitly requests a different timezone; never guess EST, UTC, or another zone. When a timezone is requested, use its IANA name (for example, America/New_York) so daylight-saving changes are handled.\n- \"Remind me\" is ambiguous: ask whether the user wants a reviewed Todo note or an agent to execute work at that time when intent is unclear.\n- Never create both kinds for the same request unless the user explicitly requests both. Check existing items before creating a likely duplicate.\n- Todo instructions and scheduled prompts must be self-contained. Include the goal, constraints, relevant project context, and expected output.\n- Scheduled sessions run in the user's schedules home workspace, not this conversation's folder. Include absolute paths in the scheduled `prompt` for any project files or repositories the work must touch.\n- Never approve or start a Todo yourself. Only mutate schedules from an interactive user session, and only update, pause, resume, delete, or run one immediately when the user asks.";
|
|
7
7
|
/** Guidance used while the Todo kind is disabled and only schedules remain. */
|
|
8
|
-
export declare const SCHEDULED_TASKS_SYSTEM_PROMPT_RULE = "# Tasks\n\nUse the `tasks` tool only when the user explicitly asks Cline to execute work once at a future time or on a recurrence. Always pass `kind: \"scheduled\"`.\n\n- One-time schedules require an exact future ISO 8601 `run_at` with an offset or Z. Recurring schedules require a five-field `cron_pattern` and
|
|
8
|
+
export declare const SCHEDULED_TASKS_SYSTEM_PROMPT_RULE = "# Tasks\n\nUse the `tasks` tool only when the user explicitly asks Cline to execute work once at a future time or on a recurrence. Always pass `kind: \"scheduled\"`.\n\n- One-time schedules require an exact future ISO 8601 `run_at` with an offset or Z. Recurring schedules require a five-field `cron_pattern` and default to the local timezone. Omit `timezone` unless the user explicitly requests a different timezone; never guess EST, UTC, or another zone. When a timezone is requested, use its IANA name (for example, America/New_York) so daylight-saving changes are handled.\n- Never create a schedule proactively. Check existing schedules before creating a likely duplicate.\n- Make the scheduled `prompt` self-contained because it runs in a new unattended session in the user's schedules home workspace, not this conversation's folder. Include the goal, constraints, expected output, and absolute paths for any project files or repositories the work must touch.\n- Only update, pause, resume, delete, or run a schedule immediately when the user asks for that action.";
|
|
9
9
|
export declare const TasksToolInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
10
|
operation: z.ZodEnum<{
|
|
11
11
|
update: "update";
|
|
@@ -51,8 +51,8 @@ export declare const TasksToolInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
51
51
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
52
52
|
automation_eligible: z.ZodOptional<z.ZodBoolean>;
|
|
53
53
|
statuses: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
54
|
-
failed: "failed";
|
|
55
54
|
completed: "completed";
|
|
55
|
+
failed: "failed";
|
|
56
56
|
cancelled: "cancelled";
|
|
57
57
|
in_progress: "in_progress";
|
|
58
58
|
approved: "approved";
|
|
@@ -21,8 +21,8 @@ export declare const ChatSessionConfigSchema: z.ZodObject<{
|
|
|
21
21
|
}, z.core.$strip>;
|
|
22
22
|
export declare const ChatSessionStatusSchema: z.ZodEnum<{
|
|
23
23
|
error: "error";
|
|
24
|
-
failed: "failed";
|
|
25
24
|
completed: "completed";
|
|
25
|
+
failed: "failed";
|
|
26
26
|
idle: "idle";
|
|
27
27
|
running: "running";
|
|
28
28
|
cancelled: "cancelled";
|
|
@@ -103,8 +103,8 @@ export declare const ChatViewStateSchema: z.ZodObject<{
|
|
|
103
103
|
sessionId: z.ZodNullable<z.ZodString>;
|
|
104
104
|
status: z.ZodEnum<{
|
|
105
105
|
error: "error";
|
|
106
|
-
failed: "failed";
|
|
107
106
|
completed: "completed";
|
|
107
|
+
failed: "failed";
|
|
108
108
|
idle: "idle";
|
|
109
109
|
running: "running";
|
|
110
110
|
cancelled: "cancelled";
|
package/dist/types/config.d.ts
CHANGED
|
@@ -205,6 +205,11 @@ export interface CoreSessionConfig extends CoreModelConfig, CoreRuntimeFeatures,
|
|
|
205
205
|
extensionContext?: ExtensionContext;
|
|
206
206
|
extraTools?: AgentTool[];
|
|
207
207
|
pluginPaths?: string[];
|
|
208
|
+
/**
|
|
209
|
+
* Additional Agent Plugins v1 package roots. Paths are resolved by the
|
|
210
|
+
* execution host, so hub clients do not load package contents themselves.
|
|
211
|
+
*/
|
|
212
|
+
agentPluginPaths?: string[];
|
|
208
213
|
extensions?: AgentConfig["extensions"];
|
|
209
214
|
execution?: AgentConfig["execution"];
|
|
210
215
|
compaction?: CoreCompactionConfig;
|
package/dist/types/session.d.ts
CHANGED
|
@@ -108,6 +108,8 @@ export interface SessionPersistenceAdapter {
|
|
|
108
108
|
limit: number;
|
|
109
109
|
parentSessionId?: string;
|
|
110
110
|
status?: string;
|
|
111
|
+
/** Only root sessions: excludes subagent and team-task child rows. */
|
|
112
|
+
rootOnly?: boolean;
|
|
111
113
|
}): Promise<SessionRow[]>;
|
|
112
114
|
updateSession(input: PersistedSessionUpdateInput): Promise<{
|
|
113
115
|
updated: boolean;
|
package/dist/types.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ export type { AgentRunResult, AgentRunStatus, FeatureFlag, FeatureFlagPayload, F
|
|
|
2
2
|
export { FEATURE_FLAGS, FeatureFlagDefaultValue, } from "@cline/shared";
|
|
3
3
|
export { ClineCore } from "./ClineCore";
|
|
4
4
|
export type { ClineCoreListHistoryOptions, ClineCoreOptions, ClineCoreStartInput, HubOptions, RemoteOptions, } from "./cline-core/types";
|
|
5
|
-
export type { LoadAgentPluginFromPathOptions, ResolveAgentPluginPathsOptions, } from "./extensions";
|
|
6
|
-
export { discoverPluginModulePaths, loadAgentPluginFromPath, loadAgentPluginsFromPaths, resolveAgentPluginPaths, resolveAndLoadAgentPlugins, resolvePluginConfigSearchPaths, resolvePluginSkillDirectoriesFromPaths, } from "./extensions";
|
|
5
|
+
export type { AgentPluginPackageDiagnostic, AgentPluginPackageDiagnosticScope, AgentPluginPackageLoadReport, AgentPluginPackageManifest, AgentPluginPackageMcpServer, AgentPluginPackageSkill, AgentSkillMetadata, LoadAgentPluginFromPathOptions, LoadAgentPluginPackagesOptions, LoadedAgentPluginPackage, ParsedAgentSkill, ResolveAgentPluginPathsOptions, } from "./extensions";
|
|
6
|
+
export { AGENT_PLUGINS_V1_MANIFEST_SCHEMA, AGENT_PLUGINS_V1_MCP_SCHEMA, discoverPluginModulePaths, loadAgentPluginFromPath, loadAgentPluginPackages, loadAgentPluginsFromPaths, parseAgentSkillMarkdown, resolveAgentPluginPaths, resolveAndLoadAgentPlugins, resolvePluginConfigSearchPaths, resolvePluginSkillDirectoriesFromPaths, } from "./extensions";
|
|
7
7
|
export type { CreateInstructionWatcherOptions, CreateRulesConfigDefinitionOptions, CreateSkillsConfigDefinitionOptions, CreateUserInstructionConfigServiceOptions, CreateWorkflowsConfigDefinitionOptions, ParseMarkdownFrontmatterResult, RuleConfig, SkillConfig, UnifiedConfigDefinition, UnifiedConfigFileCandidate, UnifiedConfigFileContext, UnifiedConfigRecord, UnifiedConfigWatcherEvent, UnifiedConfigWatcherOptions, UserInstructionConfig, UserInstructionConfigRecord, UserInstructionConfigService, UserInstructionConfigType, WorkflowConfig, } from "./extensions/config";
|
|
8
|
-
export { createRulesConfigDefinition, createSkillsConfigDefinition, createUserInstructionConfigService, createWorkflowsConfigDefinition, parseRuleConfigFromMarkdown, parseSkillConfigFromMarkdown, parseWorkflowConfigFromMarkdown, RULES_CONFIG_DIRECTORY_NAME, resolveRulesConfigSearchPaths, resolveSkillsConfigSearchPaths, resolveWorkflowsConfigSearchPaths, SKILLS_CONFIG_DIRECTORY_NAME, UnifiedConfigFileWatcher, WORKFLOWS_CONFIG_DIRECTORY_NAME, } from "./extensions/config";
|
|
8
|
+
export { combineUserInstructionConfigServices, createRulesConfigDefinition, createSkillsConfigDefinition, createUserInstructionConfigService, createWorkflowsConfigDefinition, parseRuleConfigFromMarkdown, parseSkillConfigFromMarkdown, parseWorkflowConfigFromMarkdown, RULES_CONFIG_DIRECTORY_NAME, resolveRulesConfigSearchPaths, resolveSkillsConfigSearchPaths, resolveWorkflowsConfigSearchPaths, SKILLS_CONFIG_DIRECTORY_NAME, UnifiedConfigFileWatcher, WORKFLOWS_CONFIG_DIRECTORY_NAME, } from "./extensions/config";
|
|
9
9
|
export type { BuiltinToolAvailabilityContext, ToolCatalogEntry, ToolClientType, } from "./extensions/tools";
|
|
10
10
|
export { getCoreAcpToolNames, getCoreBuiltinToolCatalog, getCoreDefaultEnabledToolIds, getCoreHeadlessToolNames, resolveCoreSelectedToolIds, TEAM_TOOL_NAMES, } from "./extensions/tools";
|
|
11
11
|
export type { RuntimeCapabilities } from "./runtime/capabilities";
|
|
@@ -16,7 +16,7 @@ export type { SandboxCallOptions, SubprocessSandboxOptions, } from "./runtime/to
|
|
|
16
16
|
export { SubprocessSandbox } from "./runtime/tools/subprocess-sandbox";
|
|
17
17
|
export { FeatureFlagsService, type FeatureFlagsServiceOptions, NoOpFeatureFlagsProvider, } from "./services/feature-flags";
|
|
18
18
|
export type { GlobalCompactionMode, GlobalCompactionStrategy, GlobalPlanActMode, GlobalSettings, } from "./services/global-settings";
|
|
19
|
-
export { filterDisabledPluginPaths, filterDisabledTools, filterExtensionToolRegistrations, GlobalSettingsSchema, isAutoUpdateEnabledGlobally, isModelToolEnabledGlobally, isPluginDisabledGlobally, isTelemetryOptedOutGlobally, isToolDisabledGlobally, readCompactionModeGlobally, readCompactionStrategyGlobally, readGlobalSettings, readPlanActModeGlobally, readToolAutoApproveGlobally, resolveDisabledPluginPaths, resolveDisabledToolNames, resolveModelToolSettings, setAutoUpdateEnabledGlobally, setCompactionModeGlobally, setCompactionStrategyGlobally, setDisabledPlugin, setDisabledTools, setModelToolEnabledGlobally, setPlanActModeGlobally, setTelemetryOptOutGlobally, setToolAutoApproveGlobally, toggleDisabledTool, writeGlobalSettings, } from "./services/global-settings";
|
|
19
|
+
export { filterDisabledPluginPaths, filterDisabledTools, filterExtensionToolRegistrations, GlobalSettingsSchema, isAgentPluginDisabledGlobally, isAutoUpdateEnabledGlobally, isModelToolEnabledGlobally, isPluginDisabledGlobally, isTelemetryOptedOutGlobally, isToolDisabledGlobally, readCompactionModeGlobally, readCompactionStrategyGlobally, readGlobalSettings, readPlanActModeGlobally, readToolAutoApproveGlobally, resolveDisabledAgentPluginNames, resolveDisabledPluginPaths, resolveDisabledToolNames, resolveModelToolSettings, setAutoUpdateEnabledGlobally, setCompactionModeGlobally, setCompactionStrategyGlobally, setDisabledAgentPlugin, setDisabledPlugin, setDisabledTools, setModelToolEnabledGlobally, setPlanActModeGlobally, setTelemetryOptOutGlobally, setToolAutoApproveGlobally, toggleDisabledTool, writeGlobalSettings, } from "./services/global-settings";
|
|
20
20
|
export type { ListPluginToolsResult, PluginToolSummary, } from "./services/plugin-tools";
|
|
21
21
|
export { listPluginTools, listPluginToolsWithDiagnostics, } from "./services/plugin-tools";
|
|
22
22
|
export type { WorkspaceManager, WorkspaceManagerEvent, } from "./services/workspace/workspace-manager";
|