@cline/core 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 +108 -0
- package/dist/ClineCore.d.ts +282 -0
- package/dist/account/cline-account-service.d.ts +37 -0
- package/dist/account/index.d.ts +3 -0
- package/dist/account/rpc.d.ts +40 -0
- package/dist/account/types.d.ts +98 -0
- package/dist/auth/bounded-ttl-cache.d.ts +13 -0
- package/dist/auth/client.d.ts +30 -0
- package/dist/auth/cline.d.ts +64 -0
- package/dist/auth/codex.d.ts +43 -0
- package/dist/auth/oca.d.ts +28 -0
- package/dist/auth/server.d.ts +54 -0
- package/dist/auth/types.d.ts +103 -0
- package/dist/auth/utils.d.ts +32 -0
- package/dist/cline-core/automation.d.ts +34 -0
- package/dist/cline-core/runtime-services.d.ts +5 -0
- package/dist/cline-core/start-input.d.ts +10 -0
- package/dist/cline-core/telemetry.d.ts +10 -0
- package/dist/cline-core/types.d.ts +221 -0
- package/dist/cron/events/cron-event-ingress.d.ts +37 -0
- package/dist/cron/reports/cron-report-writer.d.ts +40 -0
- package/dist/cron/runner/cron-materializer.d.ts +35 -0
- package/dist/cron/runner/cron-runner.d.ts +45 -0
- package/dist/cron/runner/resource-limiter.d.ts +8 -0
- package/dist/cron/schedule/scheduler.d.ts +12 -0
- package/dist/cron/service/cron-service.d.ts +56 -0
- package/dist/cron/service/schedule-command-service.d.ts +9 -0
- package/dist/cron/service/schedule-service.d.ts +98 -0
- package/dist/cron/specs/cron-reconciler.d.ts +61 -0
- package/dist/cron/specs/cron-spec-parser.d.ts +26 -0
- package/dist/cron/specs/cron-watcher.d.ts +22 -0
- package/dist/cron/store/cron-schema.d.ts +2 -0
- package/dist/cron/store/sqlite-cron-store.d.ts +240 -0
- package/dist/extensions/config/index.d.ts +7 -0
- package/dist/extensions/config/runtime-commands.d.ts +11 -0
- package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
- package/dist/extensions/config/unified-config-file-watcher.d.ts +77 -0
- package/dist/extensions/config/user-instruction-config-loader.d.ts +64 -0
- package/dist/extensions/config/user-instruction-plugin.d.ts +25 -0
- package/dist/extensions/config/user-instruction-service.d.ts +23 -0
- package/dist/extensions/context/agentic-compaction.d.ts +12 -0
- package/dist/extensions/context/basic-compaction.d.ts +8 -0
- package/dist/extensions/context/compaction-shared.d.ts +60 -0
- package/dist/extensions/context/compaction.d.ts +24 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/mcp/client.d.ts +2 -0
- package/dist/extensions/mcp/config-loader.d.ts +15 -0
- package/dist/extensions/mcp/index.d.ts +8 -0
- package/dist/extensions/mcp/manager.d.ts +23 -0
- package/dist/extensions/mcp/name-transform.d.ts +2 -0
- package/dist/extensions/mcp/policies.d.ts +14 -0
- package/dist/extensions/mcp/tools.d.ts +3 -0
- package/dist/extensions/mcp/types.d.ts +94 -0
- package/dist/extensions/plugin/plugin-config-loader.d.ts +40 -0
- package/dist/extensions/plugin/plugin-load-report.d.ts +18 -0
- package/dist/extensions/plugin/plugin-loader.d.ts +22 -0
- package/dist/extensions/plugin/plugin-module-import.d.ts +4 -0
- package/dist/extensions/plugin/plugin-sandbox.d.ts +36 -0
- package/dist/extensions/plugin/plugin-targeting.d.ts +6 -0
- package/dist/extensions/plugin-sandbox-bootstrap.js +1 -0
- package/dist/extensions/tools/constants.d.ts +24 -0
- package/dist/extensions/tools/definitions.d.ts +102 -0
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts +68 -0
- package/dist/extensions/tools/executors/apply-patch.d.ts +28 -0
- package/dist/extensions/tools/executors/bash.d.ts +49 -0
- package/dist/extensions/tools/executors/editor.d.ts +31 -0
- package/dist/extensions/tools/executors/file-read.d.ts +40 -0
- package/dist/extensions/tools/executors/index.d.ts +50 -0
- package/dist/extensions/tools/executors/search.d.ts +50 -0
- package/dist/extensions/tools/executors/web-fetch.d.ts +58 -0
- package/dist/extensions/tools/helpers.d.ts +15 -0
- package/dist/extensions/tools/index.d.ts +59 -0
- package/dist/extensions/tools/model-tool-routing.d.ts +33 -0
- package/dist/extensions/tools/presets.d.ts +132 -0
- package/dist/extensions/tools/runtime.d.ts +24 -0
- package/dist/extensions/tools/schemas.d.ts +241 -0
- package/dist/extensions/tools/team/delegated-agent.d.ts +43 -0
- package/dist/extensions/tools/team/index.d.ts +2 -0
- package/dist/extensions/tools/team/multi-agent.d.ts +230 -0
- package/dist/extensions/tools/team/projections.d.ts +8 -0
- package/dist/extensions/tools/team/runtime.d.ts +4 -0
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts +83 -0
- package/dist/extensions/tools/team/subagent-prompts.d.ts +3 -0
- package/dist/extensions/tools/team/team-tools.d.ts +35 -0
- package/dist/extensions/tools/types.d.ts +254 -0
- package/dist/hooks/checkpoint-hooks.d.ts +45 -0
- package/dist/hooks/hook-extension.d.ts +2 -0
- package/dist/hooks/hook-file-config.d.ts +24 -0
- package/dist/hooks/hook-file-hooks.d.ts +21 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/subprocess-runner.d.ts +21 -0
- package/dist/hooks/subprocess.d.ts +68 -0
- package/dist/hub/client/connect.d.ts +14 -0
- package/dist/hub/client/index.d.ts +88 -0
- package/dist/hub/client/session-client.d.ts +118 -0
- package/dist/hub/client/ui-client.d.ts +45 -0
- package/dist/hub/daemon/entry.d.ts +1 -0
- package/dist/hub/daemon/entry.js +720 -0
- package/dist/hub/daemon/index.d.ts +8 -0
- package/dist/hub/daemon/runtime-handlers.d.ts +12 -0
- package/dist/hub/daemon/start-shared-server.d.ts +18 -0
- package/dist/hub/discovery/defaults.d.ts +16 -0
- package/dist/hub/discovery/index.d.ts +30 -0
- package/dist/hub/discovery/workspace.d.ts +3 -0
- package/dist/hub/index.d.ts +32 -0
- package/dist/hub/index.js +717 -0
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +73 -0
- package/dist/hub/runtime-host/remote-runtime-host.d.ts +9 -0
- package/dist/hub/server/browser-websocket.d.ts +17 -0
- package/dist/hub/server/command-transport.d.ts +7 -0
- package/dist/hub/server/handlers/approval-handlers.d.ts +17 -0
- package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
- package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
- package/dist/hub/server/handlers/context.d.ts +56 -0
- package/dist/hub/server/handlers/run-handlers.d.ts +5 -0
- package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
- package/dist/hub/server/handlers/session-handlers.d.ts +20 -0
- package/dist/hub/server/hub-client-contributions.d.ts +19 -0
- package/dist/hub/server/hub-notifications.d.ts +7 -0
- package/dist/hub/server/hub-schedule-events.d.ts +2 -0
- package/dist/hub/server/hub-server-logging.d.ts +2 -0
- package/dist/hub/server/hub-server-options.d.ts +55 -0
- package/dist/hub/server/hub-server-transport.d.ts +34 -0
- package/dist/hub/server/hub-session-records.d.ts +8 -0
- package/dist/hub/server/hub-websocket-server.d.ts +6 -0
- package/dist/hub/server/index.d.ts +4 -0
- package/dist/hub/server/native-transport.d.ts +16 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +715 -0
- package/dist/runtime/capabilities/index.d.ts +2 -0
- package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
- package/dist/runtime/capabilities/runtime-capabilities.d.ts +6 -0
- package/dist/runtime/config/agent-message-codec.d.ts +6 -0
- package/dist/runtime/config/agent-runtime-config-builder.d.ts +87 -0
- package/dist/runtime/host/history.d.ts +18 -0
- package/dist/runtime/host/host.d.ts +7 -0
- package/dist/runtime/host/local/agent-event-bridge.d.ts +29 -0
- package/dist/runtime/host/local/session-record.d.ts +6 -0
- package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
- package/dist/runtime/host/local/spawn-tool.d.ts +15 -0
- package/dist/runtime/host/local/user-files.d.ts +1 -0
- package/dist/runtime/host/local-runtime-host.d.ts +119 -0
- package/dist/runtime/host/runtime-host-support.d.ts +20 -0
- package/dist/runtime/host/runtime-host.d.ts +163 -0
- package/dist/runtime/orchestration/runtime-builder.d.ts +6 -0
- package/dist/runtime/orchestration/runtime-event-adapter.d.ts +101 -0
- package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +30 -0
- package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +218 -0
- package/dist/runtime/orchestration/session-runtime.d.ts +58 -0
- package/dist/runtime/orchestration/user-input-builder.d.ts +15 -0
- package/dist/runtime/safety/loop-detection.d.ts +58 -0
- package/dist/runtime/safety/mistake-tracker.d.ts +68 -0
- package/dist/runtime/safety/rules.d.ts +6 -0
- package/dist/runtime/tools/subprocess-sandbox.d.ts +43 -0
- package/dist/runtime/tools/tool-approval.d.ts +9 -0
- package/dist/runtime/turn-queue/pending-prompt-service.d.ts +64 -0
- package/dist/services/agent-events.d.ts +33 -0
- package/dist/services/config.d.ts +2 -0
- package/dist/services/global-settings.d.ts +34 -0
- package/dist/services/llms/cline-recommended-models.d.ts +19 -0
- package/dist/services/llms/configured-provider-registry.d.ts +27 -0
- package/dist/services/llms/handler-factory.d.ts +3 -0
- package/dist/services/llms/provider-defaults.d.ts +28 -0
- package/dist/services/llms/provider-settings.d.ts +247 -0
- package/dist/services/llms/runtime-config.d.ts +3 -0
- package/dist/services/llms/runtime-registry.d.ts +19 -0
- package/dist/services/llms/runtime-types.d.ts +84 -0
- package/dist/services/local-runtime-bootstrap.d.ts +45 -0
- package/dist/services/plugin-tools.d.ts +15 -0
- package/dist/services/providers/local-provider-registry.d.ts +218 -0
- package/dist/services/providers/local-provider-service.d.ts +99 -0
- package/dist/services/providers/model-source.d.ts +3 -0
- package/dist/services/session-artifacts.d.ts +17 -0
- package/dist/services/session-data.d.ts +51 -0
- package/dist/services/session-telemetry.d.ts +15 -0
- package/dist/services/storage/file-team-store.d.ts +28 -0
- package/dist/services/storage/provider-settings-legacy-migration.d.ts +38 -0
- package/dist/services/storage/provider-settings-manager.d.ts +23 -0
- package/dist/services/storage/sqlite-session-store.d.ts +30 -0
- package/dist/services/storage/sqlite-team-store.d.ts +34 -0
- package/dist/services/storage/team-store.d.ts +15 -0
- package/dist/services/telemetry/ITelemetryAdapter.d.ts +54 -0
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +43 -0
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts +83 -0
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts +27 -0
- package/dist/services/telemetry/TelemetryService.d.ts +34 -0
- package/dist/services/telemetry/core-events.d.ts +198 -0
- package/dist/services/telemetry/distinct-id.d.ts +1 -0
- package/dist/services/telemetry/index.d.ts +3 -0
- package/dist/services/telemetry/index.js +1 -0
- package/dist/services/usage.d.ts +18 -0
- package/dist/services/workspace/file-indexer.d.ts +5 -0
- package/dist/services/workspace/index.d.ts +4 -0
- package/dist/services/workspace/mention-enricher.d.ts +13 -0
- package/dist/services/workspace/workspace-manager.d.ts +27 -0
- package/dist/services/workspace/workspace-manifest.d.ts +31 -0
- package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
- package/dist/session/checkpoint-restore.d.ts +20 -0
- package/dist/session/models/session-graph.d.ts +15 -0
- package/dist/session/models/session-manifest.d.ts +29 -0
- package/dist/session/models/session-row.d.ts +92 -0
- package/dist/session/services/file-session-service.d.ts +8 -0
- package/dist/session/services/message-builder.d.ts +66 -0
- package/dist/session/services/persistence-service.d.ts +58 -0
- package/dist/session/services/session-service.d.ts +13 -0
- package/dist/session/session-snapshot.d.ts +57 -0
- package/dist/session/session-versioning-service.d.ts +48 -0
- package/dist/session/stores/conversation-store.d.ts +29 -0
- package/dist/session/stores/session-manifest-store.d.ts +21 -0
- package/dist/session/stores/team-persistence-store.d.ts +23 -0
- package/dist/session/team/index.d.ts +2 -0
- package/dist/session/team/team-child-session-manager.d.ts +35 -0
- package/dist/session/team/team-session-coordinator.d.ts +13 -0
- package/dist/settings/index.d.ts +2 -0
- package/dist/settings/settings-service.d.ts +6 -0
- package/dist/settings/types.d.ts +42 -0
- package/dist/types/chat-schema.d.ts +161 -0
- package/dist/types/common.d.ts +19 -0
- package/dist/types/config.d.ts +167 -0
- package/dist/types/events.d.ts +89 -0
- package/dist/types/provider-settings.d.ts +19 -0
- package/dist/types/session.d.ts +116 -0
- package/dist/types/sessions.d.ts +28 -0
- package/dist/types/storage.d.ts +36 -0
- package/dist/types.d.ts +32 -0
- package/dist/version.d.ts +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export interface UnifiedConfigFileContext<TType extends string = string> {
|
|
2
|
+
type: TType;
|
|
3
|
+
directoryPath: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
filePath: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UnifiedConfigFileCandidate {
|
|
9
|
+
directoryPath: string;
|
|
10
|
+
fileName: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UnifiedConfigDefinition<TType extends string = string, TItem = unknown> {
|
|
14
|
+
type: TType;
|
|
15
|
+
directories: ReadonlyArray<string>;
|
|
16
|
+
discoverFiles?: (directoryPath: string) => Promise<ReadonlyArray<UnifiedConfigFileCandidate>>;
|
|
17
|
+
includeFile?: (fileName: string, filePath: string) => boolean;
|
|
18
|
+
parseFile: (context: UnifiedConfigFileContext<TType>) => TItem;
|
|
19
|
+
resolveId: (item: TItem, context: UnifiedConfigFileContext<TType>) => string;
|
|
20
|
+
}
|
|
21
|
+
export interface UnifiedConfigWatcherOptions {
|
|
22
|
+
debounceMs?: number;
|
|
23
|
+
emitParseErrors?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface UnifiedConfigRecord<TType extends string = string, TItem = unknown> {
|
|
26
|
+
type: TType;
|
|
27
|
+
id: string;
|
|
28
|
+
item: TItem;
|
|
29
|
+
filePath: string;
|
|
30
|
+
}
|
|
31
|
+
export type UnifiedConfigWatcherEvent<TType extends string = string, TItem = unknown> = {
|
|
32
|
+
kind: "upsert";
|
|
33
|
+
record: UnifiedConfigRecord<TType, TItem>;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "remove";
|
|
36
|
+
type: TType;
|
|
37
|
+
id: string;
|
|
38
|
+
filePath: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "error";
|
|
41
|
+
type: TType;
|
|
42
|
+
error: unknown;
|
|
43
|
+
filePath?: string;
|
|
44
|
+
};
|
|
45
|
+
export declare class UnifiedConfigFileWatcher<TType extends string = string, TItem = unknown> {
|
|
46
|
+
private readonly definitions;
|
|
47
|
+
private readonly debounceMs;
|
|
48
|
+
private readonly emitParseErrors;
|
|
49
|
+
private readonly listeners;
|
|
50
|
+
private readonly recordsByType;
|
|
51
|
+
private readonly watchersByDirectory;
|
|
52
|
+
private readonly baseTypesByDirectory;
|
|
53
|
+
private watchedTypesByDirectory;
|
|
54
|
+
private readonly discoveredDirectoriesByType;
|
|
55
|
+
private readonly definitionsByType;
|
|
56
|
+
private readonly pendingTypes;
|
|
57
|
+
private flushTimer;
|
|
58
|
+
private refreshQueue;
|
|
59
|
+
private started;
|
|
60
|
+
constructor(definitions: ReadonlyArray<UnifiedConfigDefinition<TType, TItem>>, options?: UnifiedConfigWatcherOptions);
|
|
61
|
+
subscribe(listener: (event: UnifiedConfigWatcherEvent<TType, TItem>) => void): () => void;
|
|
62
|
+
start(): Promise<void>;
|
|
63
|
+
stop(): void;
|
|
64
|
+
refreshAll(): Promise<void>;
|
|
65
|
+
refreshType(type: TType): Promise<void>;
|
|
66
|
+
getSnapshot(type: TType): Map<string, UnifiedConfigRecord<TType, TItem>>;
|
|
67
|
+
getAllSnapshots(): Map<TType, Map<string, UnifiedConfigRecord<TType, TItem>>>;
|
|
68
|
+
private emit;
|
|
69
|
+
private enqueueRefresh;
|
|
70
|
+
private startDirectoryWatchers;
|
|
71
|
+
private syncDirectoryWatchers;
|
|
72
|
+
private scheduleFlush;
|
|
73
|
+
private refreshTypeInternal;
|
|
74
|
+
private loadDefinition;
|
|
75
|
+
private buildDesiredTypesByDirectory;
|
|
76
|
+
private readDirectoryFileCandidates;
|
|
77
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { RULES_CONFIG_DIRECTORY_NAME, SKILLS_CONFIG_DIRECTORY_NAME, WORKFLOWS_CONFIG_DIRECTORY_NAME } from "@cline/shared/storage";
|
|
2
|
+
import { type UnifiedConfigDefinition, UnifiedConfigFileWatcher, type UnifiedConfigWatcherEvent } from "./unified-config-file-watcher";
|
|
3
|
+
export { RULES_CONFIG_DIRECTORY_NAME, SKILLS_CONFIG_DIRECTORY_NAME, WORKFLOWS_CONFIG_DIRECTORY_NAME, };
|
|
4
|
+
export interface ParseMarkdownFrontmatterResult {
|
|
5
|
+
data: Record<string, unknown>;
|
|
6
|
+
body: string;
|
|
7
|
+
hadFrontmatter: boolean;
|
|
8
|
+
parseError?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SkillConfig {
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
instructions: string;
|
|
15
|
+
frontmatter: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface RuleConfig {
|
|
18
|
+
name: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
instructions: string;
|
|
21
|
+
frontmatter: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export interface WorkflowConfig {
|
|
24
|
+
name: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
description?: string;
|
|
27
|
+
instructions: string;
|
|
28
|
+
frontmatter: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export type UserInstructionConfigType = "skill" | "rule" | "workflow";
|
|
31
|
+
export type UserInstructionConfig = SkillConfig | RuleConfig | WorkflowConfig;
|
|
32
|
+
export type UserInstructionConfigWatcher = UnifiedConfigFileWatcher<UserInstructionConfigType, UserInstructionConfig>;
|
|
33
|
+
export type UserInstructionConfigWatcherEvent = UnifiedConfigWatcherEvent<UserInstructionConfigType, UserInstructionConfig>;
|
|
34
|
+
export interface CreateInstructionWatcherOptions {
|
|
35
|
+
debounceMs?: number;
|
|
36
|
+
emitParseErrors?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface CreateSkillsConfigDefinitionOptions {
|
|
39
|
+
directories?: ReadonlyArray<string>;
|
|
40
|
+
workspacePath?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface CreateRulesConfigDefinitionOptions {
|
|
43
|
+
directories?: ReadonlyArray<string>;
|
|
44
|
+
workspacePath?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CreateWorkflowsConfigDefinitionOptions {
|
|
47
|
+
directories?: ReadonlyArray<string>;
|
|
48
|
+
workspacePath?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare function parseSkillConfigFromMarkdown(content: string, fallbackName: string): SkillConfig;
|
|
51
|
+
export declare function parseRuleConfigFromMarkdown(content: string, fallbackName: string): RuleConfig;
|
|
52
|
+
export declare function parseWorkflowConfigFromMarkdown(content: string, fallbackName: string): WorkflowConfig;
|
|
53
|
+
export declare function resolveSkillsConfigSearchPaths(workspacePath?: string): string[];
|
|
54
|
+
export declare function resolveRulesConfigSearchPaths(workspacePath?: string): string[];
|
|
55
|
+
export declare function resolveWorkflowsConfigSearchPaths(workspacePath?: string): string[];
|
|
56
|
+
export declare function createSkillsConfigDefinition(options?: CreateSkillsConfigDefinitionOptions): UnifiedConfigDefinition<"skill", SkillConfig>;
|
|
57
|
+
export declare function createRulesConfigDefinition(options?: CreateRulesConfigDefinitionOptions): UnifiedConfigDefinition<"rule", RuleConfig>;
|
|
58
|
+
export declare function createWorkflowsConfigDefinition(options?: CreateWorkflowsConfigDefinitionOptions): UnifiedConfigDefinition<"workflow", WorkflowConfig>;
|
|
59
|
+
export interface CreateUserInstructionConfigWatcherOptions extends CreateInstructionWatcherOptions {
|
|
60
|
+
skills?: CreateSkillsConfigDefinitionOptions;
|
|
61
|
+
rules?: CreateRulesConfigDefinitionOptions;
|
|
62
|
+
workflows?: CreateWorkflowsConfigDefinitionOptions;
|
|
63
|
+
}
|
|
64
|
+
export declare function createUserInstructionConfigWatcher(options?: CreateUserInstructionConfigWatcherOptions): UserInstructionConfigWatcher;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AgentExtension } from "@cline/shared";
|
|
2
|
+
import { type SkillsExecutorWithMetadata } from "../tools";
|
|
3
|
+
import type { SkillConfig, UserInstructionConfigWatcher } from "./user-instruction-config-loader";
|
|
4
|
+
type SkillsExecutorMetadataItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
type ConfiguredSkill = SkillsExecutorMetadataItem & {
|
|
11
|
+
skill: SkillConfig;
|
|
12
|
+
};
|
|
13
|
+
export interface CreateUserInstructionPluginOptions {
|
|
14
|
+
watcher: UserInstructionConfigWatcher;
|
|
15
|
+
watcherReady?: Promise<void>;
|
|
16
|
+
includeRules?: boolean;
|
|
17
|
+
includeSkills?: boolean;
|
|
18
|
+
includeWorkflows?: boolean;
|
|
19
|
+
registerSkillsTool?: boolean;
|
|
20
|
+
allowedSkillNames?: ReadonlyArray<string>;
|
|
21
|
+
}
|
|
22
|
+
export declare function getConfiguredSkillsFromWatcher(watcher: UserInstructionConfigWatcher, allowedSkillNames?: ReadonlyArray<string>): ConfiguredSkill[];
|
|
23
|
+
export declare function createUserInstructionSkillsExecutor(watcher: UserInstructionConfigWatcher, watcherReady?: Promise<void>, allowedSkillNames?: ReadonlyArray<string>): SkillsExecutorWithMetadata;
|
|
24
|
+
export declare function createUserInstructionPlugin(options: CreateUserInstructionPluginOptions): AgentExtension;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AgentExtension } from "@cline/shared";
|
|
2
|
+
import { type AvailableRuntimeCommand } from "./runtime-commands";
|
|
3
|
+
import { type CreateUserInstructionConfigWatcherOptions, type UserInstructionConfig, type UserInstructionConfigType } from "./user-instruction-config-loader";
|
|
4
|
+
import { type CreateUserInstructionPluginOptions } from "./user-instruction-plugin";
|
|
5
|
+
export interface UserInstructionConfigRecord<TConfig extends UserInstructionConfig = UserInstructionConfig> {
|
|
6
|
+
type: UserInstructionConfigType;
|
|
7
|
+
id: string;
|
|
8
|
+
filePath: string;
|
|
9
|
+
item: TConfig;
|
|
10
|
+
}
|
|
11
|
+
export interface CreateUserInstructionConfigServiceOptions extends CreateUserInstructionConfigWatcherOptions {
|
|
12
|
+
}
|
|
13
|
+
export interface UserInstructionConfigService {
|
|
14
|
+
start(): Promise<void>;
|
|
15
|
+
stop(): void;
|
|
16
|
+
refreshType(type: UserInstructionConfigType): Promise<void>;
|
|
17
|
+
listRecords<TConfig extends UserInstructionConfig = UserInstructionConfig>(type: UserInstructionConfigType): UserInstructionConfigRecord<TConfig>[];
|
|
18
|
+
listRuntimeCommands(): AvailableRuntimeCommand[];
|
|
19
|
+
resolveRuntimeSlashCommand(input: string): string;
|
|
20
|
+
hasConfiguredSkills(allowedSkillNames?: ReadonlyArray<string>): boolean;
|
|
21
|
+
createExtension(options: Omit<CreateUserInstructionPluginOptions, "watcher" | "watcherReady">): AgentExtension;
|
|
22
|
+
}
|
|
23
|
+
export declare function createUserInstructionConfigService(options?: CreateUserInstructionConfigServiceOptions): UserInstructionConfigService;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BasicLogger } from "@cline/shared";
|
|
2
|
+
import type { CoreCompactionContext, CoreCompactionResult, CoreCompactionSummarizerConfig } from "../../types/config";
|
|
3
|
+
import type { ProviderConfig } from "../../types/provider-settings";
|
|
4
|
+
import { type EstimateMessageTokens } from "./compaction-shared";
|
|
5
|
+
export declare function runAgenticCompaction(options: {
|
|
6
|
+
context: CoreCompactionContext;
|
|
7
|
+
providerConfig: ProviderConfig;
|
|
8
|
+
summarizer?: CoreCompactionSummarizerConfig;
|
|
9
|
+
preserveRecentTokens: number;
|
|
10
|
+
estimateMessageTokens: EstimateMessageTokens;
|
|
11
|
+
logger?: BasicLogger;
|
|
12
|
+
}): Promise<CoreCompactionResult | undefined>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BasicLogger } from "@cline/shared";
|
|
2
|
+
import type { CoreCompactionContext, CoreCompactionResult } from "../../types/config";
|
|
3
|
+
import { type EstimateMessageTokens } from "./compaction-shared";
|
|
4
|
+
export declare function runBasicCompaction(options: {
|
|
5
|
+
context: CoreCompactionContext;
|
|
6
|
+
estimateMessageTokens: EstimateMessageTokens;
|
|
7
|
+
logger?: BasicLogger;
|
|
8
|
+
}): CoreCompactionResult | undefined;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ToolResultContent } from "@cline/llms";
|
|
2
|
+
import type { MessageWithMetadata } from "@cline/shared";
|
|
3
|
+
import type { CoreCompactionContext, CoreCompactionSummarizerConfig } from "../../types/config";
|
|
4
|
+
import type { ProviderConfig } from "../../types/provider-settings";
|
|
5
|
+
export declare const DEFAULT_CONTEXT_WINDOW_TOKENS = 200000;
|
|
6
|
+
export declare const DEFAULT_THRESHOLD_RATIO = 0.95;
|
|
7
|
+
export declare const DEFAULT_RESERVE_TOKENS = 16384;
|
|
8
|
+
export declare const DEFAULT_PRESERVE_RECENT_TOKENS = 20000;
|
|
9
|
+
export declare const DEFAULT_SUMMARY_MAX_OUTPUT_TOKENS = 1024;
|
|
10
|
+
export declare const TOOL_RESULT_CHAR_LIMIT = 2000;
|
|
11
|
+
export declare const FILE_CONTENT_CHAR_LIMIT = 2000;
|
|
12
|
+
export declare const MIN_TRUNCATED_MESSAGE_TOKENS = 8;
|
|
13
|
+
export interface FileOperationSummary {
|
|
14
|
+
readFiles: string[];
|
|
15
|
+
modifiedFiles: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface CompactionSummaryMetadata {
|
|
18
|
+
kind: "compaction_summary";
|
|
19
|
+
summary: string;
|
|
20
|
+
details: FileOperationSummary;
|
|
21
|
+
tokensBefore: number;
|
|
22
|
+
generatedAt: number;
|
|
23
|
+
}
|
|
24
|
+
export type EstimateMessageTokens = (message: MessageWithMetadata) => number;
|
|
25
|
+
export declare function estimateTokens(text: string): number;
|
|
26
|
+
export declare function truncateText(text: string, limit: number): string;
|
|
27
|
+
export declare function flattenToolResultContent(content: ToolResultContent["content"]): string;
|
|
28
|
+
export declare function formatToolInput(input: Record<string, unknown>): string;
|
|
29
|
+
export declare function serializeMessage(message: MessageWithMetadata): string;
|
|
30
|
+
export declare function serializeConversation(messages: MessageWithMetadata[]): string;
|
|
31
|
+
export declare function createTokenEstimator(): EstimateMessageTokens;
|
|
32
|
+
export declare function isCompactionSummaryMessage(message: MessageWithMetadata): boolean;
|
|
33
|
+
export declare function getCompactionSummaryMetadata(message: MessageWithMetadata): CompactionSummaryMetadata | undefined;
|
|
34
|
+
export declare function isToolResultOnlyUserMessage(message: MessageWithMetadata): boolean;
|
|
35
|
+
export declare function isTurnStartMessage(message: MessageWithMetadata): boolean;
|
|
36
|
+
export declare function findFirstUserMessageIndex(messages: MessageWithMetadata[]): number;
|
|
37
|
+
export declare function findLastTurnStartIndex(messages: MessageWithMetadata[]): number;
|
|
38
|
+
export declare function findLastAssistantIndex(messages: MessageWithMetadata[]): number;
|
|
39
|
+
export declare function findLatestSummaryIndex(messages: MessageWithMetadata[]): number;
|
|
40
|
+
export declare function findCutIndex(messages: MessageWithMetadata[], preserveRecentTokens: number, estimateMessageTokens: EstimateMessageTokens): number;
|
|
41
|
+
export declare function collectPaths(value: unknown): string[];
|
|
42
|
+
export declare function mergeUnique(base: string[], next: Iterable<string>): string[];
|
|
43
|
+
export declare function extractFileOps(messages: MessageWithMetadata[]): FileOperationSummary;
|
|
44
|
+
export declare function renderFilesSection(fileOps: FileOperationSummary): string;
|
|
45
|
+
export declare function ensureFilesSection(summary: string, fileOps: FileOperationSummary): string;
|
|
46
|
+
export declare function buildSummaryRequest(options: {
|
|
47
|
+
previousSummary?: string;
|
|
48
|
+
conversationText: string;
|
|
49
|
+
fileOps: FileOperationSummary;
|
|
50
|
+
}): string;
|
|
51
|
+
export declare function resolveSummarizerConfig(options: {
|
|
52
|
+
activeProviderConfig: ProviderConfig;
|
|
53
|
+
summarizer?: CoreCompactionSummarizerConfig;
|
|
54
|
+
}): ProviderConfig;
|
|
55
|
+
export declare function buildSummaryMessage(options: {
|
|
56
|
+
summary: string;
|
|
57
|
+
fileOps: FileOperationSummary;
|
|
58
|
+
tokensBefore: number;
|
|
59
|
+
}): MessageWithMetadata;
|
|
60
|
+
export declare function getContextWindowTokens(context: Pick<CoreCompactionContext, "contextWindowTokens">): number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CoreCompactionContext, CoreSessionConfig } from "../../types/config";
|
|
2
|
+
export interface ContextPipelinePrepareTurnInput {
|
|
3
|
+
agentId: string;
|
|
4
|
+
conversationId: string;
|
|
5
|
+
parentAgentId: string | null;
|
|
6
|
+
iteration: number;
|
|
7
|
+
messages: CoreCompactionContext["messages"];
|
|
8
|
+
apiMessages: CoreCompactionContext["messages"];
|
|
9
|
+
abortSignal: AbortSignal;
|
|
10
|
+
systemPrompt: string;
|
|
11
|
+
tools: unknown[];
|
|
12
|
+
model: CoreCompactionContext["model"];
|
|
13
|
+
emitStatusNotice?: (message: string, metadata?: Record<string, unknown>) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface ContextPipelinePrepareTurnResult {
|
|
16
|
+
messages: CoreCompactionContext["messages"];
|
|
17
|
+
systemPrompt?: string;
|
|
18
|
+
}
|
|
19
|
+
export type ContextCompactionMode = "auto" | "manual";
|
|
20
|
+
export interface ContextCompactionPrepareTurnOptions {
|
|
21
|
+
mode?: ContextCompactionMode;
|
|
22
|
+
manualTargetRatio?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function createContextCompactionPrepareTurn(config: Pick<CoreSessionConfig, "providerConfig" | "providerId" | "modelId" | "compaction" | "logger">, options?: ContextCompactionPrepareTurnOptions): ((context: ContextPipelinePrepareTurnInput) => Promise<ContextPipelinePrepareTurnResult | undefined>) | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { ResolveAgentPluginPathsOptions } from "./plugin/plugin-config-loader";
|
|
2
|
+
export { discoverPluginModulePaths, resolveAgentPluginPaths, resolveAndLoadAgentPlugins, resolvePluginConfigSearchPaths, } from "./plugin/plugin-config-loader";
|
|
3
|
+
export type { PluginInitializationFailure, PluginInitializationWarning, PluginLoadDiagnostics, } from "./plugin/plugin-load-report";
|
|
4
|
+
export type { LoadAgentPluginFromPathOptions } from "./plugin/plugin-loader";
|
|
5
|
+
export { loadAgentPluginFromPath, loadAgentPluginsFromPaths, loadAgentPluginsFromPathsWithDiagnostics, } from "./plugin/plugin-loader";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { McpManager, McpServerRegistration } from "./types";
|
|
2
|
+
export interface McpSettingsFile {
|
|
3
|
+
mcpServers: Record<string, Omit<McpServerRegistration, "name">>;
|
|
4
|
+
}
|
|
5
|
+
export interface LoadMcpSettingsOptions {
|
|
6
|
+
filePath?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RegisterMcpServersFromSettingsOptions {
|
|
9
|
+
filePath?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveDefaultMcpSettingsPath(): string;
|
|
12
|
+
export declare function loadMcpSettingsFile(options?: LoadMcpSettingsOptions): McpSettingsFile;
|
|
13
|
+
export declare function hasMcpSettingsFile(options?: LoadMcpSettingsOptions): boolean;
|
|
14
|
+
export declare function resolveMcpServerRegistrations(options?: LoadMcpSettingsOptions): McpServerRegistration[];
|
|
15
|
+
export declare function registerMcpServersFromSettingsFile(manager: Pick<McpManager, "registerServer">, options?: RegisterMcpServersFromSettingsOptions): Promise<McpServerRegistration[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createDefaultMcpServerClientFactory } from "./client";
|
|
2
|
+
export type { LoadMcpSettingsOptions, McpSettingsFile, RegisterMcpServersFromSettingsOptions, } from "./config-loader";
|
|
3
|
+
export { hasMcpSettingsFile, loadMcpSettingsFile, registerMcpServersFromSettingsFile, resolveDefaultMcpSettingsPath, resolveMcpServerRegistrations, } from "./config-loader";
|
|
4
|
+
export { InMemoryMcpManager } from "./manager";
|
|
5
|
+
export type { CreateDisabledMcpToolPoliciesOptions, CreateDisabledMcpToolPolicyOptions, } from "./policies";
|
|
6
|
+
export { createDisabledMcpToolPolicies, createDisabledMcpToolPolicy, } from "./policies";
|
|
7
|
+
export { createMcpTools } from "./tools";
|
|
8
|
+
export type { CreateMcpToolsOptions, McpConnectionStatus, McpManager, McpManagerOptions, McpServerClient, McpServerClientFactory, McpServerRegistration, McpServerSnapshot, McpServerTransportConfig, McpSseTransportConfig, McpStdioTransportConfig, McpStreamableHttpTransportConfig, McpToolCallRequest, McpToolCallResult, McpToolDescriptor, McpToolNameTransform, McpToolProvider, } from "./types";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { McpManager, McpManagerOptions, McpServerRegistration, McpServerSnapshot, McpToolCallRequest, McpToolCallResult, McpToolDescriptor } from "./types";
|
|
2
|
+
export declare class InMemoryMcpManager implements McpManager {
|
|
3
|
+
private readonly toolsCacheTtlMs;
|
|
4
|
+
private readonly clientFactory;
|
|
5
|
+
private readonly servers;
|
|
6
|
+
private readonly operationLocks;
|
|
7
|
+
constructor(options: McpManagerOptions);
|
|
8
|
+
registerServer(registration: McpServerRegistration): Promise<void>;
|
|
9
|
+
unregisterServer(serverName: string): Promise<void>;
|
|
10
|
+
connectServer(serverName: string): Promise<void>;
|
|
11
|
+
disconnectServer(serverName: string): Promise<void>;
|
|
12
|
+
setServerDisabled(serverName: string, disabled: boolean): Promise<void>;
|
|
13
|
+
listServers(): readonly McpServerSnapshot[];
|
|
14
|
+
listTools(serverName: string): Promise<readonly McpToolDescriptor[]>;
|
|
15
|
+
refreshTools(serverName: string): Promise<readonly McpToolDescriptor[]>;
|
|
16
|
+
callTool(request: McpToolCallRequest): Promise<McpToolCallResult>;
|
|
17
|
+
dispose(): Promise<void>;
|
|
18
|
+
private ensureConnectedClient;
|
|
19
|
+
private connectState;
|
|
20
|
+
private disconnectState;
|
|
21
|
+
private requireServer;
|
|
22
|
+
private runExclusive;
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToolPolicy } from "@cline/shared";
|
|
2
|
+
import type { McpToolNameTransform } from "./types";
|
|
3
|
+
export interface CreateDisabledMcpToolPolicyOptions {
|
|
4
|
+
serverName: string;
|
|
5
|
+
toolName: string;
|
|
6
|
+
nameTransform?: McpToolNameTransform;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateDisabledMcpToolPoliciesOptions {
|
|
9
|
+
serverName: string;
|
|
10
|
+
toolNames: readonly string[];
|
|
11
|
+
nameTransform?: McpToolNameTransform;
|
|
12
|
+
}
|
|
13
|
+
export declare function createDisabledMcpToolPolicy(options: CreateDisabledMcpToolPolicyOptions): Record<string, ToolPolicy>;
|
|
14
|
+
export declare function createDisabledMcpToolPolicies(options: CreateDisabledMcpToolPoliciesOptions): Record<string, ToolPolicy>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { AgentToolContext } from "@cline/shared";
|
|
2
|
+
export interface McpToolDescriptor {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
inputSchema: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface McpToolCallRequest {
|
|
8
|
+
serverName: string;
|
|
9
|
+
toolName: string;
|
|
10
|
+
arguments?: Record<string, unknown>;
|
|
11
|
+
context?: AgentToolContext;
|
|
12
|
+
}
|
|
13
|
+
export type McpToolCallResult = unknown;
|
|
14
|
+
export interface McpToolProvider {
|
|
15
|
+
listTools(serverName: string): Promise<readonly McpToolDescriptor[]>;
|
|
16
|
+
callTool(request: McpToolCallRequest): Promise<McpToolCallResult>;
|
|
17
|
+
}
|
|
18
|
+
export type McpToolNameTransform = (input: {
|
|
19
|
+
serverName: string;
|
|
20
|
+
toolName: string;
|
|
21
|
+
}) => string;
|
|
22
|
+
export interface CreateMcpToolsOptions {
|
|
23
|
+
serverName: string;
|
|
24
|
+
provider: McpToolProvider;
|
|
25
|
+
nameTransform?: McpToolNameTransform;
|
|
26
|
+
timeoutMs?: number;
|
|
27
|
+
retryable?: boolean;
|
|
28
|
+
maxRetries?: number;
|
|
29
|
+
}
|
|
30
|
+
export type McpConnectionStatus = "disconnected" | "connecting" | "connected";
|
|
31
|
+
export interface McpStdioTransportConfig {
|
|
32
|
+
type: "stdio";
|
|
33
|
+
command: string;
|
|
34
|
+
args?: string[];
|
|
35
|
+
cwd?: string;
|
|
36
|
+
env?: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
export interface McpSseTransportConfig {
|
|
39
|
+
type: "sse";
|
|
40
|
+
url: string;
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
export interface McpStreamableHttpTransportConfig {
|
|
44
|
+
type: "streamableHttp";
|
|
45
|
+
url: string;
|
|
46
|
+
headers?: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
export type McpServerTransportConfig = McpStdioTransportConfig | McpSseTransportConfig | McpStreamableHttpTransportConfig;
|
|
49
|
+
export interface McpServerRegistration {
|
|
50
|
+
name: string;
|
|
51
|
+
transport: McpServerTransportConfig;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export interface McpServerSnapshot {
|
|
56
|
+
name: string;
|
|
57
|
+
status: McpConnectionStatus;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
lastError?: string;
|
|
60
|
+
toolCount: number;
|
|
61
|
+
updatedAt: number;
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
export interface McpServerClient {
|
|
65
|
+
connect(): Promise<void>;
|
|
66
|
+
disconnect(): Promise<void>;
|
|
67
|
+
listTools(): Promise<readonly McpToolDescriptor[]>;
|
|
68
|
+
callTool(request: {
|
|
69
|
+
name: string;
|
|
70
|
+
arguments?: Record<string, unknown>;
|
|
71
|
+
context?: AgentToolContext;
|
|
72
|
+
}): Promise<McpToolCallResult>;
|
|
73
|
+
}
|
|
74
|
+
export type McpServerClientFactory = (registration: McpServerRegistration) => Promise<McpServerClient> | McpServerClient;
|
|
75
|
+
export interface McpManagerOptions {
|
|
76
|
+
clientFactory: McpServerClientFactory;
|
|
77
|
+
/**
|
|
78
|
+
* Cache TTL for tools/list responses.
|
|
79
|
+
* A short cache avoids repeated list requests while keeping server metadata fresh.
|
|
80
|
+
* @default 5000
|
|
81
|
+
*/
|
|
82
|
+
toolsCacheTtlMs?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface McpManager extends McpToolProvider {
|
|
85
|
+
registerServer(registration: McpServerRegistration): Promise<void>;
|
|
86
|
+
unregisterServer(serverName: string): Promise<void>;
|
|
87
|
+
connectServer(serverName: string): Promise<void>;
|
|
88
|
+
disconnectServer(serverName: string): Promise<void>;
|
|
89
|
+
setServerDisabled(serverName: string, disabled: boolean): Promise<void>;
|
|
90
|
+
listServers(): readonly McpServerSnapshot[];
|
|
91
|
+
refreshTools(serverName: string): Promise<readonly McpToolDescriptor[]>;
|
|
92
|
+
callTool(request: McpToolCallRequest): Promise<McpToolCallResult>;
|
|
93
|
+
dispose(): Promise<void>;
|
|
94
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AgentConfig, PluginSetupContext, WorkspaceInfo } from "@cline/shared";
|
|
2
|
+
import type { PluginLoadDiagnostics } from "./plugin-load-report";
|
|
3
|
+
import type { PluginTargeting } from "./plugin-targeting";
|
|
4
|
+
type AgentPlugin = NonNullable<AgentConfig["extensions"]>[number];
|
|
5
|
+
export declare function resolvePluginConfigSearchPaths(workspacePath?: string): string[];
|
|
6
|
+
export declare function discoverPluginModulePaths(directoryPath: string): string[];
|
|
7
|
+
export interface ResolveAgentPluginPathsOptions {
|
|
8
|
+
pluginPaths?: ReadonlyArray<string>;
|
|
9
|
+
workspacePath?: string;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveAgentPluginPaths(options?: ResolveAgentPluginPathsOptions): string[];
|
|
13
|
+
export interface ResolveAndLoadAgentPluginsOptions extends ResolveAgentPluginPathsOptions, PluginTargeting {
|
|
14
|
+
mode?: "sandbox" | "in_process";
|
|
15
|
+
exportName?: string;
|
|
16
|
+
importTimeoutMs?: number;
|
|
17
|
+
hookTimeoutMs?: number;
|
|
18
|
+
contributionTimeoutMs?: number;
|
|
19
|
+
onEvent?: (event: {
|
|
20
|
+
name: string;
|
|
21
|
+
payload?: unknown;
|
|
22
|
+
}) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Structured workspace and git metadata. Forwarded to sandboxed plugins
|
|
25
|
+
* via PluginSetupCtx.workspaceInfo and made available to in-process plugins
|
|
26
|
+
* in the extension context.
|
|
27
|
+
*/
|
|
28
|
+
workspaceInfo?: WorkspaceInfo;
|
|
29
|
+
session?: PluginSetupContext["session"];
|
|
30
|
+
client?: PluginSetupContext["client"];
|
|
31
|
+
user?: PluginSetupContext["user"];
|
|
32
|
+
automation?: PluginSetupContext["automation"];
|
|
33
|
+
logger?: PluginSetupContext["logger"];
|
|
34
|
+
telemetry?: PluginSetupContext["telemetry"];
|
|
35
|
+
}
|
|
36
|
+
export declare function resolveAndLoadAgentPlugins(options?: ResolveAndLoadAgentPluginsOptions): Promise<{
|
|
37
|
+
extensions: AgentPlugin[];
|
|
38
|
+
shutdown?: () => Promise<void>;
|
|
39
|
+
} & PluginLoadDiagnostics>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PluginInitializationFailure {
|
|
2
|
+
pluginPath: string;
|
|
3
|
+
pluginName?: string;
|
|
4
|
+
phase: "load" | "setup";
|
|
5
|
+
message: string;
|
|
6
|
+
stack?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginInitializationWarning {
|
|
9
|
+
type: "duplicate_plugin_override";
|
|
10
|
+
pluginPath: string;
|
|
11
|
+
pluginName: string;
|
|
12
|
+
overriddenPluginPath: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginLoadDiagnostics {
|
|
16
|
+
failures: PluginInitializationFailure[];
|
|
17
|
+
warnings: PluginInitializationWarning[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentExtension, PluginSetupContext } from "@cline/shared";
|
|
2
|
+
import type { PluginInitializationFailure, PluginInitializationWarning } from "./plugin-load-report";
|
|
3
|
+
import { type PluginTargeting } from "./plugin-targeting";
|
|
4
|
+
export interface LoadAgentPluginFromPathOptions {
|
|
5
|
+
exportName?: string;
|
|
6
|
+
cwd?: string;
|
|
7
|
+
useCache?: boolean;
|
|
8
|
+
session?: PluginSetupContext["session"];
|
|
9
|
+
client?: PluginSetupContext["client"];
|
|
10
|
+
user?: PluginSetupContext["user"];
|
|
11
|
+
workspaceInfo?: PluginSetupContext["workspaceInfo"];
|
|
12
|
+
automation?: PluginSetupContext["automation"];
|
|
13
|
+
logger?: PluginSetupContext["logger"];
|
|
14
|
+
telemetry?: PluginSetupContext["telemetry"];
|
|
15
|
+
}
|
|
16
|
+
export declare function loadAgentPluginFromPath(pluginPath: string, options?: LoadAgentPluginFromPathOptions): Promise<AgentExtension>;
|
|
17
|
+
export declare function loadAgentPluginsFromPaths(pluginPaths: string[], options?: LoadAgentPluginFromPathOptions & PluginTargeting): Promise<AgentExtension[]>;
|
|
18
|
+
export declare function loadAgentPluginsFromPathsWithDiagnostics(pluginPaths: string[], options?: LoadAgentPluginFromPathOptions & PluginTargeting): Promise<{
|
|
19
|
+
plugins: AgentExtension[];
|
|
20
|
+
failures: PluginInitializationFailure[];
|
|
21
|
+
warnings: PluginInitializationWarning[];
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AgentConfig, PluginSetupContext, WorkspaceInfo } from "@cline/shared";
|
|
2
|
+
import type { PluginLoadDiagnostics } from "./plugin-load-report";
|
|
3
|
+
import type { PluginTargeting } from "./plugin-targeting";
|
|
4
|
+
export type SandboxedPluginSetupContext = Pick<PluginSetupContext, "session" | "client" | "user" | "workspaceInfo" | "logger">;
|
|
5
|
+
export interface PluginSandboxOptions extends PluginTargeting {
|
|
6
|
+
pluginPaths: string[];
|
|
7
|
+
exportName?: string;
|
|
8
|
+
importTimeoutMs?: number;
|
|
9
|
+
hookTimeoutMs?: number;
|
|
10
|
+
contributionTimeoutMs?: number;
|
|
11
|
+
onEvent?: (event: {
|
|
12
|
+
name: string;
|
|
13
|
+
payload?: unknown;
|
|
14
|
+
}) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The session's working directory. Forwarded to the sandbox subprocess so
|
|
17
|
+
* that `process.cwd()` returns the correct path inside the sandbox even
|
|
18
|
+
* when `--cwd` was passed without calling `process.chdir()` on the host.
|
|
19
|
+
*/
|
|
20
|
+
cwd?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Structured workspace and git metadata (branch, commit, remotes) generated
|
|
23
|
+
* at session startup. Forwarded to plugins via PluginSetupCtx.workspaceInfo
|
|
24
|
+
* so they can inspect git state without running their own commands.
|
|
25
|
+
*/
|
|
26
|
+
workspaceInfo?: WorkspaceInfo;
|
|
27
|
+
session?: SandboxedPluginSetupContext["session"];
|
|
28
|
+
client?: SandboxedPluginSetupContext["client"];
|
|
29
|
+
user?: SandboxedPluginSetupContext["user"];
|
|
30
|
+
/** Enables a logger bridge that forwards sandbox log calls to the host. */
|
|
31
|
+
logger?: SandboxedPluginSetupContext["logger"];
|
|
32
|
+
}
|
|
33
|
+
export declare function loadSandboxedPlugins(options: PluginSandboxOptions): Promise<{
|
|
34
|
+
extensions: AgentConfig["extensions"];
|
|
35
|
+
shutdown: () => Promise<void>;
|
|
36
|
+
} & PluginLoadDiagnostics>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PluginManifest } from "@cline/shared";
|
|
2
|
+
export interface PluginTargeting {
|
|
3
|
+
providerId?: string;
|
|
4
|
+
modelId?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function matchesPluginManifestTargeting(manifest: PluginManifest | undefined, targeting: PluginTargeting | undefined): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as n}from"node:module";var t=n(import.meta.url);import{normalizePluginManifest as GY}from"@cline/shared";import{existsSync as z,readFileSync as k}from"node:fs";import{builtinModules as r,createRequire as E}from"node:module";import{dirname as j,extname as S,isAbsolute as a,resolve as K}from"node:path";import{fileURLToPath as y}from"node:url";import{PLUGIN_FILE_EXTENSIONS as s}from"@cline/shared";var i=j(y(import.meta.url)),x=E(import.meta.url),e=K(i,"..","..","..","..",".."),N=YY(e),O=new Set(r.flatMap((Y)=>[Y,Y.replace(/^node:/,"")])),L=new Set(s);function YY(Y){let Z={},$={"@cline/agents":K(Y,"packages/agents/src/index.ts"),"@cline/core":K(Y,"packages/core/src/index.ts"),"@cline/llms":K(Y,"packages/llms/src/index.ts"),"@cline/shared":K(Y,"packages/shared/src/index.ts"),"@cline/shared/storage":K(Y,"packages/shared/src/storage/index.ts"),"@cline/shared/db":K(Y,"packages/shared/src/db/index.ts")};for(let[Q,q]of Object.entries($))if(z(q))Z[Q]=q;return Z}function f(Y){return!(Y.startsWith(".")||Y.startsWith("/")||Y.startsWith("file:")||Y.startsWith("data:")||Y.startsWith("http:")||Y.startsWith("https:"))}function b(Y){if(Y.startsWith("@")){let[Z,$]=Y.split("/",3);return $?`${Z}/${$}`:Y}return Y.split("/",1)[0]??Y}function v(Y,Z){let $=b(Z),Q=j(Y);while(!0){let q=K(Q,"node_modules",$);if(z(q)||z(K(q,"package.json")))return!0;let G=K(Q,"..");if(G===Q)return!1;Q=G}}function ZY(Y){try{return x.resolve(Y),!0}catch{return!1}}function $Y(Y){try{return x.resolve(Y)}catch{return null}}function QY(Y){let $=j(Y);for(let Q=0;Q<4;Q++){let q=K($,"package.json");if(z(q))try{let V=JSON.parse(k(q,"utf8"));return V!=null&&typeof V==="object"&&"cline"in V}catch{return!1}let G=K($,"..");if(G===$)return!1;$=G}return!1}function qY(Y,Z){let $=Z.startsWith("file:")?y(Z):a(Z)?Z:K(j(Y),Z);if(z($)&&L.has(S($)))return $;for(let Q of L){let q=`${$}${Q}`;if(z(q))return q}for(let Q of L){let q=K($,`index${Q}`);if(z(q))return q}return null}function h(Y){let Z=new Set,$=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Q of $)for(let q of Y.matchAll(Q)){let G=q[1];if(G)Z.add(G)}return[...Z]}function P(Y,Z,$=new Set){if($.has(Y)||!z(Y))return;if($.add(Y),!L.has(S(Y)))return;let Q=k(Y,"utf8");for(let q of h(Q)){if(q.startsWith("node:")||O.has(q))continue;if(f(q)){if(Object.hasOwn(N,q)||Object.hasOwn(N,b(q))||v(Y,q)||Z&&ZY(q))continue;throw Error(`Cannot find module '${b(q)}'`)}let G=qY(Y,q);if(G)P(G,Z,$)}}function wY(Y,Z){let $=E(Y),Q={};for(let[q,G]of Object.entries(N)){try{$.resolve(q);continue}catch{}Q[q]=G}if(Z){let q=k(Y,"utf8");for(let G of h(q)){if(!f(G)||G.startsWith("node:")||O.has(G)||Object.hasOwn(Q,G)||v(Y,G))continue;let V=$Y(G);if(V)Q[G]=V}}return Q}async function m(Y,Z={}){let $=!QY(Y);P(Y,$);let Q=wY(Y,$),q=await import("jiti"),G=typeof q==="function"?q:typeof q.default==="function"?q.default:void 0;if(!G)throw Error("Unable to load jiti");return await G(Y,{alias:Q,cache:Z.useCache,requireCache:Z.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...O],transformModules:Object.keys(Q)}).import(Y,{})}function d(Y,Z){if(!Y)return!0;if(Y.providerIds?.length){if(!Z?.providerId||!Y.providerIds.includes(Z.providerId))return!1}if(Y.modelIds?.length){if(!Z?.modelId||!Y.modelIds.includes(Z.modelId))return!1}return!0}function X(Y){return typeof Y==="object"&&Y!==null}function c(Y){return Array.isArray(Y)&&Y.every((Z)=>typeof Z==="string")}function JY(Y,Z){if(!X(Y))throw Error(`Invalid plugin module: ${Z}`);if(typeof Y.name!=="string"||!Y.name)throw Error(`Invalid plugin name: ${Z}`);if(!X(Y.manifest))throw Error(`Invalid plugin manifest: ${Z}`);if(Object.hasOwn(Y.manifest,"providerIds")&&!c(Y.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${Z}`);if(Object.hasOwn(Y.manifest,"modelIds")&&!c(Y.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${Z}`)}function KY(Y){if(!X(Y))throw Error("Plugin setup context must be an object");if(Y.session!==void 0&&!X(Y.session))throw Error("Plugin setup context session must be an object");if(Y.client!==void 0&&!X(Y.client))throw Error("Plugin setup context client must be an object");if(Y.user!==void 0&&!X(Y.user))throw Error("Plugin setup context user must be an object");if(Y.workspaceInfo!==void 0&&!X(Y.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(Y.automation!==void 0&&!X(Y.automation))throw Error("Plugin setup context automation must be an object");if(Y.automation!==void 0&&typeof Y.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(Y.logger!==void 0&&!X(Y.logger))throw Error("Plugin setup context logger must be an object")}var o=0,A=new Map,T=new Map;function VY(Y){let Z=Y instanceof Error?Y.message:String(Y),$=Y instanceof Error?Y.stack:void 0;return{message:Z,stack:$}}function R(Y,Z,$,Q){if(!process.send)return;process.send({type:"response",id:Y,ok:Z,result:$,error:Q})}function I(Y,Z){if(!process.send)return;process.send({type:"event",name:Y,payload:Z})}globalThis.__clinePluginHost={emitEvent:I};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function u(Y){if(!Y||typeof Y!=="object")return{};return Y}function WY(Y){if(!Y||typeof Y!=="object")return;let Z={...Y};if(Z.error instanceof Error)Z.error={name:Z.error.name,message:Z.error.message,stack:Z.error.stack};return Z}function XY(Y){let Z=($,Q,q)=>{I("plugin_log",{level:$,pluginName:Y,message:Q,metadata:WY(q)})};return{debug:($,Q)=>Z("debug",$,Q),log:($,Q)=>Z("log",$,Q),error:($,Q)=>Z("error",$,Q)}}function C(Y,Z){let $=`${Y}:${Z}`,Q=(T.get($)??0)+1;return T.set($,Q),`${Y}_${Z}_${Q}`}function FY(Y){let Z=typeof Y.eventType==="string"?Y.eventType.trim():"",$=typeof Y.source==="string"?Y.source.trim():"";if(!Z)throw Error("Automation event type contribution requires eventType");if(!$)throw Error("Automation event type contribution requires source");return{...Y,eventType:Z,source:$,examples:Y.examples?[...Y.examples]:void 0,metadata:Y.metadata?u(Y.metadata):void 0}}function _(Y){let Z=A.get(Y);if(!Z)throw Error(`Unknown sandbox plugin id: ${Y}`);return Z}async function zY(Y){if(A.clear(),o=0,T.clear(),Y.cwd)try{process.chdir(Y.cwd)}catch{}let Z=globalThis.__clineSessionEnv;if(Z)Z.cwd=Y.cwd,Z.workspaceInfo=Y.workspaceInfo;let $=[],Q=[],q=[],G=Y.exportName||"plugin",V=new Map,l={providerId:Y.providerId,modelId:Y.modelId};for(let M of Y.pluginPaths||[]){let J;try{let F=await m(M);if(J=F.default??F[G],JY(J,M),J.manifest=GY(J.manifest),!d(J.manifest,l))continue;let U=`plugin_${++o}`,B={tools:[],commands:[],messageBuilders:[],providers:[],automationEventTypes:[],shortcuts:[],flags:[]},H={tools:new Map,commands:new Map,messageBuilders:new Map},g={registerTool:(w)=>{let W=C(U,"tool");H.tools.set(W,w.execute),B.tools.push({id:W,name:w.name,description:w.description,inputSchema:w.inputSchema,timeoutMs:w.timeoutMs,retryable:w.retryable})},registerCommand:(w)=>{let W=C(U,"command");if(typeof w.handler==="function")H.commands.set(W,w.handler);B.commands.push({id:W,name:w.name,description:w.description})},registerMessageBuilder:(w)=>{let W=C(U,"builder");H.messageBuilders.set(W,w.build),B.messageBuilders.push({id:W,name:w.name})},registerProvider:(w)=>{B.providers.push({id:C(U,"provider"),name:w.name,description:w.description,metadata:u(w.metadata)})},registerAutomationEventType:(w)=>{B.automationEventTypes.push({id:C(U,"automation_event"),...FY(w)})}};if(typeof J.setup==="function")try{let w={session:Y.session,client:Y.client,user:Y.user,workspaceInfo:Y.workspaceInfo,...Y.loggerEnabled?{logger:XY(J.name)}:{},...J.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(W)=>{I("automation_event",W)}}}:{}};KY(w),await J.setup(g,w)}catch(w){Q.push({pluginPath:M,pluginName:J.name,phase:"setup",message:w instanceof Error?w.message:String(w),stack:w instanceof Error?w.stack:void 0});continue}let D=V.get(J.name);if(D!==void 0){let w=$[D];if(!w)V.delete(J.name);else{q.push({type:"duplicate_plugin_override",pluginName:J.name,pluginPath:M,overriddenPluginPath:w.pluginPath,message:`Plugin "${J.name}" from ${M} overrides ${w.pluginPath}`}),A.delete(w.pluginId),$.splice(D,1),V.clear();for(let[W,p]of $.entries())V.set(p.name,W)}}A.set(U,{plugin:J,handlers:H}),V.set(J.name,$.length),$.push({pluginId:U,pluginPath:M,name:J.name,manifest:J.manifest,hooks:J.hooks?Object.entries(J.hooks).filter(([,w])=>typeof w==="function").map(([w])=>w):void 0,contributions:B})}catch(F){Q.push({pluginPath:M,pluginName:J?.name,phase:"load",message:F instanceof Error?F.message:String(F),stack:F instanceof Error?F.stack:void 0})}}return{plugins:$,failures:Q,warnings:q}}async function MY(Y){let $=_(Y.pluginId).plugin.hooks?.[Y.hookName];if(typeof $!=="function")return;return await $(Y.payload)}async function UY(Y){let $=_(Y.pluginId).handlers.tools.get(Y.contributionId);if(typeof $!=="function")throw Error("Unknown sandbox tool contribution");return await $(Y.input,Y.context)}async function BY(Y){let $=_(Y.pluginId).handlers.commands.get(Y.contributionId);if(typeof $!=="function")return"";return await $(Y.input)}async function CY(Y){let $=_(Y.pluginId).handlers.messageBuilders.get(Y.contributionId);if(typeof $!=="function")return[];return await $(Y.messages)}var HY={initialize:zY,invokeHook:MY,executeTool:UY,executeCommand:BY,buildMessages:CY};process.on("message",async(Y)=>{if(!Y||Y.type!=="call")return;let Z=HY[Y.method];if(!Z){R(Y.id,!1,void 0,{message:`Unknown method: ${String(Y.method)}`});return}try{let $=await Z(Y.args||{});R(Y.id,!0,$)}catch($){R(Y.id,!1,void 0,VY($))}});
|