@sctg/cline-core 3.84.0-beta.20260524130712
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 +110 -0
- package/dist/ClineCore.d.ts +283 -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 +47 -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 +61 -0
- package/dist/extensions/context/compaction.d.ts +38 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/mcp/client.d.ts +9 -0
- package/dist/extensions/mcp/config-loader.d.ts +25 -0
- package/dist/extensions/mcp/index.d.ts +11 -0
- package/dist/extensions/mcp/manager.d.ts +23 -0
- package/dist/extensions/mcp/name-transform.d.ts +2 -0
- package/dist/extensions/mcp/oauth.d.ts +48 -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 +111 -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 +84 -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 +722 -0
- package/dist/hub/daemon/index.d.ts +9 -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 +719 -0
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +76 -0
- package/dist/hub/runtime-host/remote-runtime-host.d.ts +9 -0
- package/dist/hub/server/browser-websocket.d.ts +19 -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 +57 -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 +37 -0
- package/dist/hub/server/hub-session-records.d.ts +9 -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 +104 -0
- package/dist/index.js +717 -0
- package/dist/remote-config/integration.d.ts +17 -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 +80 -0
- package/dist/runtime/host/history.d.ts +19 -0
- package/dist/runtime/host/host.d.ts +7 -0
- package/dist/runtime/host/local/agent-event-bridge.d.ts +30 -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 +127 -0
- package/dist/runtime/host/runtime-host-support.d.ts +20 -0
- package/dist/runtime/host/runtime-host.d.ts +169 -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 +69 -0
- package/dist/services/agent-events.d.ts +34 -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 +250 -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 +28 -0
- package/dist/services/providers/local-provider-registry.d.ts +230 -0
- package/dist/services/providers/local-provider-service.d.ts +70 -0
- package/dist/services/providers/model-source.d.ts +3 -0
- package/dist/services/providers/provider-config-fields.d.ts +37 -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 +276 -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 +19 -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 +31 -0
- package/dist/session/models/session-row.d.ts +92 -0
- package/dist/session/services/file-session-service.d.ts +10 -0
- package/dist/session/services/message-builder.d.ts +66 -0
- package/dist/session/services/persistence-service.d.ts +59 -0
- package/dist/session/services/session-service.d.ts +15 -0
- package/dist/session/session-snapshot.d.ts +59 -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 +23 -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 +43 -0
- package/dist/types/chat-schema.d.ts +163 -0
- package/dist/types/common.d.ts +24 -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 +122 -0
- package/dist/types/sessions.d.ts +38 -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 +80 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-Agent Coordination
|
|
3
|
+
*
|
|
4
|
+
* Utilities for orchestrating multiple agents working together.
|
|
5
|
+
*/
|
|
6
|
+
import { type AgentConfig, type AgentEvent, type AgentResult, type AppendMissionLogInput, type AttachTeamOutcomeFragmentInput, type CreateTeamOutcomeInput, type CreateTeamTaskInput, type MissionLogEntry, type ReviewTeamOutcomeFragmentInput, type RouteToTeammateOptions, type TeamMailboxMessage, type TeamMemberSnapshot, TeamMessageType, type TeammateLifecycleSpec, type TeamOutcome, type TeamOutcomeFragment, type TeamRunRecord, type TeamRunStatus, type TeamRuntimeSnapshot, type TeamRuntimeState, type TeamTask, type TeamTaskListItem, type TeamTaskStatus } from "@cline/shared";
|
|
7
|
+
import { SessionRuntime } from "../../../runtime/orchestration/session-runtime-orchestrator";
|
|
8
|
+
export { type AppendMissionLogInput, type AttachTeamOutcomeFragmentInput, type CreateTeamOutcomeInput, type CreateTeamTaskInput, type MissionLogEntry, type MissionLogKind, type ReviewTeamOutcomeFragmentInput, type RouteToTeammateOptions, type TeamMailboxMessage, type TeamMemberSnapshot, TeamMessageType, type TeammateLifecycleSpec, type TeamOutcome, type TeamOutcomeFragment, type TeamOutcomeFragmentStatus, type TeamOutcomeStatus, type TeamRunRecord, type TeamRunStatus, type TeamRuntimeSnapshot, type TeamRuntimeState, type TeamTask, type TeamTaskListItem, type TeamTaskStatus, } from "@cline/shared";
|
|
9
|
+
export interface TeamMemberConfig extends AgentConfig {
|
|
10
|
+
role?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AgentTask {
|
|
13
|
+
agentId: string;
|
|
14
|
+
message: string;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface TaskResult {
|
|
18
|
+
agentId: string;
|
|
19
|
+
result: AgentResult;
|
|
20
|
+
error?: Error;
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export type TeamEvent = {
|
|
24
|
+
type: TeamMessageType.TaskStart;
|
|
25
|
+
agentId: string;
|
|
26
|
+
message: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: TeamMessageType.TaskEnd;
|
|
29
|
+
agentId: string;
|
|
30
|
+
result?: AgentResult;
|
|
31
|
+
error?: Error;
|
|
32
|
+
messages?: AgentResult["messages"];
|
|
33
|
+
} | {
|
|
34
|
+
type: TeamMessageType.AgentEvent;
|
|
35
|
+
agentId: string;
|
|
36
|
+
event: AgentEvent;
|
|
37
|
+
} | {
|
|
38
|
+
type: TeamMessageType.TeammateSpawned;
|
|
39
|
+
agentId: string;
|
|
40
|
+
role?: string;
|
|
41
|
+
teammate: TeammateLifecycleSpec;
|
|
42
|
+
} | {
|
|
43
|
+
type: TeamMessageType.TeammateShutdown;
|
|
44
|
+
agentId: string;
|
|
45
|
+
reason?: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: TeamMessageType.TeamTaskUpdated;
|
|
48
|
+
task: TeamTask;
|
|
49
|
+
} | {
|
|
50
|
+
type: TeamMessageType.TeamMessage;
|
|
51
|
+
message: TeamMailboxMessage;
|
|
52
|
+
} | {
|
|
53
|
+
type: TeamMessageType.TeamMissionLog;
|
|
54
|
+
entry: MissionLogEntry;
|
|
55
|
+
} | {
|
|
56
|
+
type: TeamMessageType.RunQueued;
|
|
57
|
+
run: TeamRunRecord;
|
|
58
|
+
} | {
|
|
59
|
+
type: TeamMessageType.RunStarted;
|
|
60
|
+
run: TeamRunRecord;
|
|
61
|
+
} | {
|
|
62
|
+
type: TeamMessageType.RunProgress;
|
|
63
|
+
run: TeamRunRecord;
|
|
64
|
+
message: string;
|
|
65
|
+
} | {
|
|
66
|
+
type: TeamMessageType.RunCompleted;
|
|
67
|
+
run: TeamRunRecord;
|
|
68
|
+
} | {
|
|
69
|
+
type: TeamMessageType.RunFailed;
|
|
70
|
+
run: TeamRunRecord;
|
|
71
|
+
} | {
|
|
72
|
+
type: TeamMessageType.RunCancelled;
|
|
73
|
+
run: TeamRunRecord;
|
|
74
|
+
reason?: string;
|
|
75
|
+
} | {
|
|
76
|
+
type: TeamMessageType.RunInterrupted;
|
|
77
|
+
run: TeamRunRecord;
|
|
78
|
+
reason?: string;
|
|
79
|
+
} | {
|
|
80
|
+
type: TeamMessageType.OutcomeCreated;
|
|
81
|
+
outcome: TeamOutcome;
|
|
82
|
+
} | {
|
|
83
|
+
type: TeamMessageType.OutcomeFragmentAttached;
|
|
84
|
+
fragment: TeamOutcomeFragment;
|
|
85
|
+
} | {
|
|
86
|
+
type: TeamMessageType.OutcomeFragmentReviewed;
|
|
87
|
+
fragment: TeamOutcomeFragment;
|
|
88
|
+
} | {
|
|
89
|
+
type: TeamMessageType.OutcomeFinalized;
|
|
90
|
+
outcome: TeamOutcome;
|
|
91
|
+
};
|
|
92
|
+
export interface AgentTeamsRuntimeOptions {
|
|
93
|
+
teamName: string;
|
|
94
|
+
leadAgentId?: string;
|
|
95
|
+
missionLogIntervalSteps?: number;
|
|
96
|
+
missionLogIntervalMs?: number;
|
|
97
|
+
maxConcurrentRuns?: number;
|
|
98
|
+
onTeamEvent?: (event: TeamEvent) => void;
|
|
99
|
+
}
|
|
100
|
+
export interface SpawnTeammateOptions {
|
|
101
|
+
agentId: string;
|
|
102
|
+
config: TeamMemberConfig;
|
|
103
|
+
}
|
|
104
|
+
export declare class AgentTeam {
|
|
105
|
+
private agents;
|
|
106
|
+
private configs;
|
|
107
|
+
private onTeamEvent?;
|
|
108
|
+
constructor(configs?: Record<string, TeamMemberConfig>, onTeamEvent?: (event: TeamEvent) => void);
|
|
109
|
+
addAgent(id: string, config: TeamMemberConfig): void;
|
|
110
|
+
removeAgent(id: string): boolean;
|
|
111
|
+
getAgent(id: string): SessionRuntime | undefined;
|
|
112
|
+
getAgentIds(): string[];
|
|
113
|
+
get size(): number;
|
|
114
|
+
routeTo(agentId: string, message: string): Promise<AgentResult>;
|
|
115
|
+
continueTo(agentId: string, message: string): Promise<AgentResult>;
|
|
116
|
+
runParallel(tasks: AgentTask[]): Promise<TaskResult[]>;
|
|
117
|
+
runSequential(tasks: AgentTask[]): Promise<TaskResult[]>;
|
|
118
|
+
runPipeline(pipeline: string[], initialMessage: string, messageTransformer?: (prevResult: AgentResult, nextAgentId: string) => string): Promise<TaskResult[]>;
|
|
119
|
+
abortAll(): void;
|
|
120
|
+
clear(): void;
|
|
121
|
+
private emitEvent;
|
|
122
|
+
}
|
|
123
|
+
export declare function createAgentTeam(configs: Record<string, TeamMemberConfig>, onTeamEvent?: (event: TeamEvent) => void): AgentTeam;
|
|
124
|
+
export declare function createWorkerReviewerTeam(configs: {
|
|
125
|
+
worker: TeamMemberConfig;
|
|
126
|
+
reviewer: TeamMemberConfig;
|
|
127
|
+
}): AgentTeam & {
|
|
128
|
+
doAndReview: (message: string) => Promise<{
|
|
129
|
+
workerResult: AgentResult;
|
|
130
|
+
reviewResult: AgentResult;
|
|
131
|
+
}>;
|
|
132
|
+
};
|
|
133
|
+
export declare class AgentTeamsRuntime {
|
|
134
|
+
private readonly teamId;
|
|
135
|
+
private readonly teamName;
|
|
136
|
+
private readonly onTeamEvent?;
|
|
137
|
+
private readonly members;
|
|
138
|
+
private readonly tasks;
|
|
139
|
+
private readonly missionLog;
|
|
140
|
+
private readonly mailbox;
|
|
141
|
+
private missionStepCounter;
|
|
142
|
+
private taskCounter;
|
|
143
|
+
private messageCounter;
|
|
144
|
+
private missionCounter;
|
|
145
|
+
private runCounter;
|
|
146
|
+
private outcomeCounter;
|
|
147
|
+
private outcomeFragmentCounter;
|
|
148
|
+
private readonly runs;
|
|
149
|
+
private readonly runQueue;
|
|
150
|
+
private queuedRunDispatchTimer;
|
|
151
|
+
private readonly outcomes;
|
|
152
|
+
private readonly outcomeFragments;
|
|
153
|
+
private readonly missionLogIntervalSteps;
|
|
154
|
+
private readonly missionLogIntervalMs;
|
|
155
|
+
private readonly maxConcurrentRuns;
|
|
156
|
+
constructor(options: AgentTeamsRuntimeOptions);
|
|
157
|
+
getTeamId(): string;
|
|
158
|
+
getTeamName(): string;
|
|
159
|
+
getMemberRole(agentId: string): "lead" | "teammate" | undefined;
|
|
160
|
+
getMemberIds(): string[];
|
|
161
|
+
getTeammateIds(): string[];
|
|
162
|
+
getTask(taskId: string): TeamTask | undefined;
|
|
163
|
+
listTasks(): TeamTask[];
|
|
164
|
+
listTaskItems(options?: {
|
|
165
|
+
status?: TeamTaskStatus;
|
|
166
|
+
assignee?: string;
|
|
167
|
+
}): TeamTaskListItem[];
|
|
168
|
+
listMissionLog(limit?: number): MissionLogEntry[];
|
|
169
|
+
listMailbox(agentId: string, options?: {
|
|
170
|
+
unreadOnly?: boolean;
|
|
171
|
+
markRead?: boolean;
|
|
172
|
+
limit?: number;
|
|
173
|
+
}): TeamMailboxMessage[];
|
|
174
|
+
getSnapshot(): TeamRuntimeSnapshot;
|
|
175
|
+
exportState(): TeamRuntimeState;
|
|
176
|
+
hydrateState(state: TeamRuntimeState): void;
|
|
177
|
+
isTeammateActive(agentId: string): boolean;
|
|
178
|
+
spawnTeammate({ agentId, config }: SpawnTeammateOptions): TeamMemberSnapshot;
|
|
179
|
+
shutdownTeammate(agentId: string, reason?: string): void;
|
|
180
|
+
updateTeammateConnections(overrides: Partial<Pick<AgentConfig, "apiKey" | "baseUrl" | "headers">>): void;
|
|
181
|
+
createTask(input: CreateTeamTaskInput): TeamTask;
|
|
182
|
+
claimTask(taskId: string, agentId: string): TeamTask;
|
|
183
|
+
blockTask(taskId: string, agentId: string, reason: string): TeamTask;
|
|
184
|
+
completeTask(taskId: string, agentId: string, summary: string): TeamTask;
|
|
185
|
+
routeToTeammate(agentId: string, message: string, options?: RouteToTeammateOptions): Promise<AgentResult>;
|
|
186
|
+
startTeammateRun(agentId: string, message: string, options?: RouteToTeammateOptions & {
|
|
187
|
+
priority?: number;
|
|
188
|
+
maxRetries?: number;
|
|
189
|
+
leaseOwner?: string;
|
|
190
|
+
}): TeamRunRecord;
|
|
191
|
+
private dispatchQueuedRuns;
|
|
192
|
+
private selectNextDispatchableQueuedRun;
|
|
193
|
+
private scheduleQueuedRunDispatch;
|
|
194
|
+
private clearQueuedRunDispatchTimer;
|
|
195
|
+
private countActiveRuns;
|
|
196
|
+
private executeQueuedRun;
|
|
197
|
+
listRuns(options?: {
|
|
198
|
+
status?: TeamRunStatus | null;
|
|
199
|
+
agentId?: string | null;
|
|
200
|
+
includeCompleted?: boolean | null;
|
|
201
|
+
}): TeamRunRecord[];
|
|
202
|
+
getRun(runId: string): TeamRunRecord | undefined;
|
|
203
|
+
awaitRun(runId: string, pollIntervalMs?: number): Promise<TeamRunRecord>;
|
|
204
|
+
awaitAllRuns(pollIntervalMs?: number): Promise<TeamRunRecord[]>;
|
|
205
|
+
cancelRun(runId: string, reason?: string): TeamRunRecord;
|
|
206
|
+
recoverActiveRuns(reason?: string): TeamRunRecord[];
|
|
207
|
+
markStaleRunsInterrupted(reason?: string): TeamRunRecord[];
|
|
208
|
+
sendMessage(fromAgentId: string, toAgentId: string, subject: string, body: string, taskId?: string): TeamMailboxMessage;
|
|
209
|
+
broadcast(fromAgentId: string, subject: string, body: string, options?: {
|
|
210
|
+
taskId?: string;
|
|
211
|
+
}): TeamMailboxMessage[];
|
|
212
|
+
appendMissionLog(input: AppendMissionLogInput): MissionLogEntry;
|
|
213
|
+
createOutcome(input: CreateTeamOutcomeInput): TeamOutcome;
|
|
214
|
+
listOutcomes(): TeamOutcome[];
|
|
215
|
+
attachOutcomeFragment(input: AttachTeamOutcomeFragmentInput): TeamOutcomeFragment;
|
|
216
|
+
reviewOutcomeFragment(input: ReviewTeamOutcomeFragmentInput): TeamOutcomeFragment;
|
|
217
|
+
listOutcomeFragments(outcomeId: string): TeamOutcomeFragment[];
|
|
218
|
+
finalizeOutcome(outcomeId: string): TeamOutcome;
|
|
219
|
+
cleanup(): void;
|
|
220
|
+
private requireTask;
|
|
221
|
+
private assertDependenciesResolved;
|
|
222
|
+
private getUnresolvedDependencies;
|
|
223
|
+
private trackMeaningfulEvent;
|
|
224
|
+
private recordRunActivityFromAgentEvent;
|
|
225
|
+
private recordRunProgress;
|
|
226
|
+
private formatProgressErrorActivity;
|
|
227
|
+
private recordProgressStep;
|
|
228
|
+
private buildMailboxNotification;
|
|
229
|
+
private emitEvent;
|
|
230
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TeamProgressLifecycleEvent, TeamProgressSummary, TeamRuntimeState } from "@cline/shared";
|
|
2
|
+
import type { TeamEvent } from "./multi-agent";
|
|
3
|
+
export declare function buildTeamProgressSummary(teamName: string, state: TeamRuntimeState): TeamProgressSummary;
|
|
4
|
+
export declare function toTeamProgressLifecycleEvent(input: {
|
|
5
|
+
teamName: string;
|
|
6
|
+
sessionId: string;
|
|
7
|
+
event: TeamEvent;
|
|
8
|
+
}): TeamProgressLifecycleEvent;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { buildDelegatedAgentConfig, createDelegatedAgent, createDelegatedAgentConfigProvider, type DelegatedAgentConfigProvider, type DelegatedAgentConnectionConfig, type DelegatedAgentKind, type DelegatedAgentRuntimeConfig, } from "./delegated-agent";
|
|
2
|
+
export { createSpawnAgentTool, type SpawnAgentInput, type SpawnAgentOutput, type SpawnAgentToolConfig, type SubAgentEndContext, type SubAgentStartContext, } from "./spawn-agent-tool";
|
|
3
|
+
export { type AgentTask, AgentTeam, AgentTeamsRuntime, type AgentTeamsRuntimeOptions, createAgentTeam, createWorkerReviewerTeam, type SpawnTeammateOptions, type TaskResult, type TeamEvent, type TeamMemberConfig, } from "./multi-agent";
|
|
4
|
+
export { type BootstrapAgentTeamsOptions, type BootstrapAgentTeamsResult, bootstrapAgentTeams, type CreateAgentTeamsToolsOptions, createAgentTeamsTools, reviveTeamStateDates, sanitizeTeamName, type TeamTeammateRuntimeConfig, } from "./team-tools";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable spawn_agent tool for delegating tasks to sub-agents.
|
|
3
|
+
*/
|
|
4
|
+
import { type AgentConfig, type AgentEvent, type AgentHooks, type AgentResult, type AgentTool, type AgentToolContext, type BasicLogger, type HookErrorMode, type ITelemetryService, type ToolApprovalRequest, type ToolApprovalResult, type ToolPolicy } from "@cline/shared";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { type DelegatedAgentConfigProvider } from "./delegated-agent";
|
|
7
|
+
type AgentExtension = NonNullable<AgentConfig["extensions"]>[number];
|
|
8
|
+
type AgentFinishReason = AgentResult["finishReason"];
|
|
9
|
+
export declare const SpawnAgentInputSchema: z.ZodObject<{
|
|
10
|
+
systemPrompt: z.ZodString;
|
|
11
|
+
task: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type SpawnAgentInput = z.infer<typeof SpawnAgentInputSchema>;
|
|
14
|
+
export interface SpawnAgentOutput {
|
|
15
|
+
text: string;
|
|
16
|
+
iterations: number;
|
|
17
|
+
finishReason: AgentFinishReason;
|
|
18
|
+
usage: {
|
|
19
|
+
inputTokens: number;
|
|
20
|
+
outputTokens: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface SubAgentStartContext {
|
|
24
|
+
subAgentId: string;
|
|
25
|
+
conversationId: string;
|
|
26
|
+
parentAgentId: string;
|
|
27
|
+
input: SpawnAgentInput;
|
|
28
|
+
}
|
|
29
|
+
export interface SubAgentEndContext {
|
|
30
|
+
subAgentId: string;
|
|
31
|
+
conversationId: string;
|
|
32
|
+
parentAgentId: string;
|
|
33
|
+
input: SpawnAgentInput;
|
|
34
|
+
result?: SpawnAgentOutput;
|
|
35
|
+
agentResult?: AgentResult;
|
|
36
|
+
error?: Error;
|
|
37
|
+
}
|
|
38
|
+
export interface SpawnAgentToolConfig {
|
|
39
|
+
configProvider: DelegatedAgentConfigProvider;
|
|
40
|
+
defaultMaxIterations?: number;
|
|
41
|
+
subAgentTools?: AgentTool[];
|
|
42
|
+
createSubAgentTools?: (input: SpawnAgentInput, context: AgentToolContext) => AgentTool[] | Promise<AgentTool[]>;
|
|
43
|
+
onSubAgentEvent?: (event: AgentEvent) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Lifecycle hooks forwarded to spawned sub-agent runs.
|
|
46
|
+
*/
|
|
47
|
+
hooks?: AgentHooks;
|
|
48
|
+
/**
|
|
49
|
+
* Extension list forwarded to spawned sub-agent runs.
|
|
50
|
+
*/
|
|
51
|
+
extensions?: AgentExtension[];
|
|
52
|
+
/**
|
|
53
|
+
* Error handling mode for forwarded lifecycle hooks.
|
|
54
|
+
*/
|
|
55
|
+
hookErrorMode?: HookErrorMode;
|
|
56
|
+
/**
|
|
57
|
+
* Called after a sub-agent instance is created and before it starts running.
|
|
58
|
+
* Errors are ignored so lifecycle observers cannot break task execution.
|
|
59
|
+
*/
|
|
60
|
+
onSubAgentStart?: (context: SubAgentStartContext) => void | Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Called once a sub-agent run finishes (success or error).
|
|
63
|
+
* Errors are ignored so lifecycle observers cannot break task execution.
|
|
64
|
+
*/
|
|
65
|
+
onSubAgentEnd?: (context: SubAgentEndContext) => void | Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Optional per-tool policy for spawned sub-agents.
|
|
68
|
+
*/
|
|
69
|
+
toolPolicies?: Record<string, ToolPolicy>;
|
|
70
|
+
/**
|
|
71
|
+
* Optional approval callback for spawned sub-agent tool calls.
|
|
72
|
+
*/
|
|
73
|
+
requestToolApproval?: (request: ToolApprovalRequest) => Promise<ToolApprovalResult> | ToolApprovalResult;
|
|
74
|
+
/**
|
|
75
|
+
* Optional logger forwarded to spawned sub-agent runs.
|
|
76
|
+
*/
|
|
77
|
+
logger?: BasicLogger;
|
|
78
|
+
telemetry?: ITelemetryService;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a spawn_agent tool that can run a delegated task with a focused sub-agent.
|
|
82
|
+
*/
|
|
83
|
+
export declare function createSpawnAgentTool(config: SpawnAgentToolConfig): AgentTool<SpawnAgentInput, SpawnAgentOutput>;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DelegatedAgentRuntimeConfig } from "./delegated-agent";
|
|
2
|
+
export declare function buildTeammateSystemPrompt(prompt: string, config: DelegatedAgentRuntimeConfig): string;
|
|
3
|
+
export declare function buildSubAgentSystemPrompt(prompt: string, config: DelegatedAgentRuntimeConfig): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type AgentTool, type TeamRuntimeState, type TeamTeammateSpec } from "@cline/shared";
|
|
2
|
+
import { type DelegatedAgentConfigProvider, type DelegatedAgentRuntimeConfig } from "./delegated-agent";
|
|
3
|
+
import type { AgentTeamsRuntime } from "./multi-agent";
|
|
4
|
+
export type TeamTeammateRuntimeConfig = DelegatedAgentRuntimeConfig;
|
|
5
|
+
export interface CreateAgentTeamsToolsOptions {
|
|
6
|
+
runtime: AgentTeamsRuntime;
|
|
7
|
+
requesterId: string;
|
|
8
|
+
teammateConfigProvider: DelegatedAgentConfigProvider;
|
|
9
|
+
createBaseTools?: () => AgentTool[];
|
|
10
|
+
allowSpawn?: boolean;
|
|
11
|
+
includeSpawnTool?: boolean;
|
|
12
|
+
includeManagementTools?: boolean;
|
|
13
|
+
onLeadToolsUnlocked?: (tools: AgentTool[]) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface BootstrapAgentTeamsOptions {
|
|
16
|
+
runtime: AgentTeamsRuntime;
|
|
17
|
+
teammateConfigProvider: DelegatedAgentConfigProvider;
|
|
18
|
+
createBaseTools?: () => AgentTool[];
|
|
19
|
+
leadAgentId?: string;
|
|
20
|
+
restoredTeammates?: TeamTeammateSpec[];
|
|
21
|
+
restoredFromPersistence?: boolean;
|
|
22
|
+
includeLeadSpawnTool?: boolean;
|
|
23
|
+
includeLeadManagementTools?: boolean;
|
|
24
|
+
onLeadToolsUnlocked?: (tools: AgentTool[]) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface BootstrapAgentTeamsResult {
|
|
27
|
+
tools: AgentTool[];
|
|
28
|
+
restoredFromPersistence: boolean;
|
|
29
|
+
restoredTeammates: string[];
|
|
30
|
+
}
|
|
31
|
+
export declare const TEAM_TOOL_NAMES: readonly ["team_spawn_teammate", "team_shutdown_teammate", "team_status", "team_task", "team_run_task", "team_cancel_run", "team_list_runs", "team_await_runs", "team_send_message", "team_broadcast", "team_read_mailbox", "team_mission_log", "team_cleanup", "team_create_outcome", "team_attach_outcome_fragment", "team_review_outcome_fragment", "team_finalize_outcome", "team_list_outcomes"];
|
|
32
|
+
export declare function bootstrapAgentTeams(options: BootstrapAgentTeamsOptions): BootstrapAgentTeamsResult;
|
|
33
|
+
export declare function createAgentTeamsTools(options: CreateAgentTeamsToolsOptions): AgentTool[];
|
|
34
|
+
export declare function reviveTeamStateDates(state: TeamRuntimeState): TeamRuntimeState;
|
|
35
|
+
export declare function sanitizeTeamName(name: string): string;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for Default Tools
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for executors, configuration, and results.
|
|
5
|
+
*/
|
|
6
|
+
import type { AgentToolContext, ImageContent, TextContent } from "@cline/shared";
|
|
7
|
+
import type { ApplyPatchInput, EditFileInput, ReadFileRequest, StructuredCommandInput } from "./schemas";
|
|
8
|
+
/**
|
|
9
|
+
* Result from a single tool operation
|
|
10
|
+
*/
|
|
11
|
+
export interface ToolOperationResult {
|
|
12
|
+
/** The query/input that was executed */
|
|
13
|
+
query: string;
|
|
14
|
+
/** The result content (if successful) */
|
|
15
|
+
result: unknown;
|
|
16
|
+
/** Error message (if failed) */
|
|
17
|
+
error?: string;
|
|
18
|
+
/** Whether the operation succeeded */
|
|
19
|
+
success: boolean;
|
|
20
|
+
/** Duration in MS */
|
|
21
|
+
duration?: number;
|
|
22
|
+
}
|
|
23
|
+
export type FileReadResultContent = string | Array<TextContent | ImageContent>;
|
|
24
|
+
/**
|
|
25
|
+
* Executor for reading files
|
|
26
|
+
*
|
|
27
|
+
* @param request - File path and optional inclusive line range to read
|
|
28
|
+
* @param context - Tool execution context
|
|
29
|
+
* @returns The file content as a string
|
|
30
|
+
*/
|
|
31
|
+
export type FileReadExecutor = (request: ReadFileRequest, context: AgentToolContext) => Promise<FileReadResultContent>;
|
|
32
|
+
/**
|
|
33
|
+
* Executor for searching the codebase
|
|
34
|
+
*
|
|
35
|
+
* @param query - Regex pattern to search for
|
|
36
|
+
* @param cwd - Current working directory for the search
|
|
37
|
+
* @param context - Tool execution context
|
|
38
|
+
* @returns Search results as a formatted string
|
|
39
|
+
*/
|
|
40
|
+
export type SearchExecutor = (query: string, cwd: string, context: AgentToolContext) => Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Executor for running shell commands
|
|
43
|
+
*
|
|
44
|
+
* @param command - Shell command to execute
|
|
45
|
+
* @param cwd - Current working directory for execution
|
|
46
|
+
* @param context - Tool execution context
|
|
47
|
+
* @returns Command output (stdout)
|
|
48
|
+
*/
|
|
49
|
+
export type BashExecutor = (command: string | StructuredCommandInput, cwd: string, context: AgentToolContext) => Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Executor for fetching web content
|
|
52
|
+
*
|
|
53
|
+
* @param url - URL to fetch
|
|
54
|
+
* @param prompt - Analysis prompt for the content
|
|
55
|
+
* @param context - Tool execution context
|
|
56
|
+
* @returns Analyzed/extracted content
|
|
57
|
+
*/
|
|
58
|
+
export type WebFetchExecutor = (url: string, prompt: string, context: AgentToolContext) => Promise<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Executor for editing files
|
|
61
|
+
*
|
|
62
|
+
* @param input - Editor command input
|
|
63
|
+
* @param cwd - Current working directory for filesystem operations
|
|
64
|
+
* @param context - Tool execution context
|
|
65
|
+
* @returns A formatted operation result string
|
|
66
|
+
*/
|
|
67
|
+
export type EditorExecutor = (input: EditFileInput, cwd: string, context: AgentToolContext) => Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Executor for apply_patch operations
|
|
70
|
+
*
|
|
71
|
+
* @param input - apply_patch command payload
|
|
72
|
+
* @param cwd - Current working directory for filesystem operations
|
|
73
|
+
* @param context - Tool execution context
|
|
74
|
+
* @returns A formatted operation result string
|
|
75
|
+
*/
|
|
76
|
+
export type ApplyPatchExecutor = (input: ApplyPatchInput, cwd: string, context: AgentToolContext) => Promise<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Executor for invoking configured skills
|
|
79
|
+
*
|
|
80
|
+
* @param skill - Skill name to invoke
|
|
81
|
+
* @param args - Optional arguments for the skill
|
|
82
|
+
* @param context - Tool execution context
|
|
83
|
+
* @returns Skill loading/invocation result
|
|
84
|
+
*/
|
|
85
|
+
export type SkillsExecutor = (skill: string, args: string | undefined, context: AgentToolContext) => Promise<string>;
|
|
86
|
+
/**
|
|
87
|
+
* Executor for asking a single follow-up question with selectable options
|
|
88
|
+
*
|
|
89
|
+
* @param question - Single clarifying question for the user
|
|
90
|
+
* @param options - 2-5 selectable answer options
|
|
91
|
+
* @param context - Tool execution context
|
|
92
|
+
* @returns Executor-specific result payload
|
|
93
|
+
*/
|
|
94
|
+
export type AskQuestionExecutor = (question: string, options: string[], context: AgentToolContext) => Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Skill metadata exposed by SkillsExecutor for clients/UI
|
|
97
|
+
*/
|
|
98
|
+
export interface SkillsExecutorSkillMetadata {
|
|
99
|
+
/** Normalized skill id (usually lowercased name) */
|
|
100
|
+
id: string;
|
|
101
|
+
/** Display name for the skill */
|
|
102
|
+
name: string;
|
|
103
|
+
/** Optional short description */
|
|
104
|
+
description?: string;
|
|
105
|
+
/** True when configured but intentionally disabled */
|
|
106
|
+
disabled: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A callable executor that can also expose configured skill metadata.
|
|
110
|
+
*/
|
|
111
|
+
export interface SkillsExecutorWithMetadata {
|
|
112
|
+
(skill: string, args: string | undefined, context: AgentToolContext): Promise<string>;
|
|
113
|
+
configuredSkills?: SkillsExecutorSkillMetadata[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Executor for verifying a user's response to a question
|
|
117
|
+
*
|
|
118
|
+
* @param summary - Summary of the solution ans steps taken
|
|
119
|
+
* @param verified - Boolean indicating if the solution has been verified
|
|
120
|
+
* @param context - Tool execution context
|
|
121
|
+
* @returns Executor-specific result payload
|
|
122
|
+
*/
|
|
123
|
+
export type VerifySubmitExecutor = (summary: string, verified: boolean, context: AgentToolContext) => Promise<string>;
|
|
124
|
+
/**
|
|
125
|
+
* Collection of all tool executors
|
|
126
|
+
*/
|
|
127
|
+
export interface ToolExecutors {
|
|
128
|
+
/** File reading implementation */
|
|
129
|
+
readFile?: FileReadExecutor;
|
|
130
|
+
/** Codebase search implementation */
|
|
131
|
+
search?: SearchExecutor;
|
|
132
|
+
/** Shell command execution implementation */
|
|
133
|
+
bash?: BashExecutor;
|
|
134
|
+
/** Web content fetching implementation */
|
|
135
|
+
webFetch?: WebFetchExecutor;
|
|
136
|
+
/** Filesystem editor implementation */
|
|
137
|
+
editor?: EditorExecutor;
|
|
138
|
+
/** Apply patch implementation */
|
|
139
|
+
applyPatch?: ApplyPatchExecutor;
|
|
140
|
+
/** Skill invocation implementation */
|
|
141
|
+
skills?: SkillsExecutorWithMetadata;
|
|
142
|
+
/** Follow-up question implementation */
|
|
143
|
+
askQuestion?: AskQuestionExecutor;
|
|
144
|
+
/** Final submission implementation */
|
|
145
|
+
submit?: VerifySubmitExecutor;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Names of available default tools
|
|
149
|
+
*/
|
|
150
|
+
export type DefaultToolName = "read_files" | "search_codebase" | "run_commands" | "fetch_web_content" | "apply_patch" | "editor" | "skills" | "ask_question" | "submit_and_exit";
|
|
151
|
+
/**
|
|
152
|
+
* Configuration for enabling/disabling default tools
|
|
153
|
+
*/
|
|
154
|
+
export interface DefaultToolsConfig {
|
|
155
|
+
/**
|
|
156
|
+
* Enable the read_files tool
|
|
157
|
+
* @default true
|
|
158
|
+
*/
|
|
159
|
+
enableReadFiles?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Enable the search_codebase tool
|
|
162
|
+
* @default true
|
|
163
|
+
*/
|
|
164
|
+
enableSearch?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Enable the run_commands tool
|
|
167
|
+
* @default true
|
|
168
|
+
*/
|
|
169
|
+
enableBash?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Enable the fetch_web_content tool
|
|
172
|
+
* @default true
|
|
173
|
+
*/
|
|
174
|
+
enableWebFetch?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Enable the apply_patch tool
|
|
177
|
+
* @default true
|
|
178
|
+
*/
|
|
179
|
+
enableApplyPatch?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Enable the editor tool
|
|
182
|
+
* @default true
|
|
183
|
+
*/
|
|
184
|
+
enableEditor?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Enable the skills tool
|
|
187
|
+
* @default true
|
|
188
|
+
*/
|
|
189
|
+
enableSkills?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Enable the ask_followup_question tool
|
|
192
|
+
* @default true
|
|
193
|
+
*/
|
|
194
|
+
enableAskQuestion?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Enable the submit_and_exit tool
|
|
197
|
+
* @default false
|
|
198
|
+
*/
|
|
199
|
+
enableSubmitAndExit?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Current working directory for tools that need it
|
|
202
|
+
*/
|
|
203
|
+
cwd?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Timeout for file read operations in milliseconds
|
|
206
|
+
* @default 10000
|
|
207
|
+
*/
|
|
208
|
+
fileReadTimeoutMs?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Timeout for bash command execution in milliseconds
|
|
211
|
+
* @default 30000
|
|
212
|
+
*/
|
|
213
|
+
bashTimeoutMs?: number;
|
|
214
|
+
/**
|
|
215
|
+
* Timeout for web fetch operations in milliseconds
|
|
216
|
+
* @default 30000
|
|
217
|
+
*/
|
|
218
|
+
webFetchTimeoutMs?: number;
|
|
219
|
+
/**
|
|
220
|
+
* Timeout for search operations in milliseconds
|
|
221
|
+
* @default 30000
|
|
222
|
+
*/
|
|
223
|
+
searchTimeoutMs?: number;
|
|
224
|
+
/**
|
|
225
|
+
* Timeout for apply_patch operations in milliseconds
|
|
226
|
+
* @default 30000
|
|
227
|
+
*/
|
|
228
|
+
applyPatchTimeoutMs?: number;
|
|
229
|
+
/**
|
|
230
|
+
* Timeout for editor operations in milliseconds
|
|
231
|
+
* @default 30000
|
|
232
|
+
*/
|
|
233
|
+
editorTimeoutMs?: number;
|
|
234
|
+
/**
|
|
235
|
+
* Timeout for skills operations in milliseconds
|
|
236
|
+
* @default 15000
|
|
237
|
+
*/
|
|
238
|
+
skillsTimeoutMs?: number;
|
|
239
|
+
/**
|
|
240
|
+
* Timeout for submit_and_exit operations in milliseconds
|
|
241
|
+
* @default 15000
|
|
242
|
+
*/
|
|
243
|
+
submitTimeoutMs?: number;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Options for creating default tools
|
|
247
|
+
*/
|
|
248
|
+
export interface CreateDefaultToolsOptions extends DefaultToolsConfig {
|
|
249
|
+
/**
|
|
250
|
+
* Executor implementations for the tools
|
|
251
|
+
* Only tools with provided executors will be available
|
|
252
|
+
*/
|
|
253
|
+
executors: ToolExecutors;
|
|
254
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AgentHooks, BasicLogger } from "@cline/shared";
|
|
2
|
+
export interface CheckpointEntry {
|
|
3
|
+
ref: string;
|
|
4
|
+
createdAt: number;
|
|
5
|
+
runCount: number;
|
|
6
|
+
kind?: "stash" | "commit";
|
|
7
|
+
}
|
|
8
|
+
export interface CheckpointMetadata {
|
|
9
|
+
latest: CheckpointEntry;
|
|
10
|
+
history: CheckpointEntry[];
|
|
11
|
+
}
|
|
12
|
+
type CreateCheckpointHooksOptions = {
|
|
13
|
+
cwd: string;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
logger?: BasicLogger;
|
|
16
|
+
readSessionMetadata: () => Promise<Record<string, unknown> | undefined>;
|
|
17
|
+
writeSessionMetadata: (metadata: Record<string, unknown>) => Promise<void> | void;
|
|
18
|
+
/**
|
|
19
|
+
* Optional custom checkpoint implementation. When provided, the built-in
|
|
20
|
+
* git stash/ref logic is skipped entirely and this function is called
|
|
21
|
+
* instead. Return `undefined` to skip writing a checkpoint for that run.
|
|
22
|
+
*/
|
|
23
|
+
createCheckpoint?: (context: {
|
|
24
|
+
cwd: string;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
runCount: number;
|
|
27
|
+
}) => Promise<CheckpointEntry | undefined> | CheckpointEntry | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Starting value for the internal run counter. Use this when a session
|
|
30
|
+
* is created with initial messages (e.g. after a checkpoint restore) so
|
|
31
|
+
* that new checkpoint entries get runCount values that don't collide
|
|
32
|
+
* with entries carried over from the source session.
|
|
33
|
+
*/
|
|
34
|
+
initialRunCount?: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Deletes all private git refs under refs/cline/checkpoints/{sessionId}/ that
|
|
38
|
+
* were created by the checkpoint system to keep stash objects reachable.
|
|
39
|
+
* Errors are swallowed - if the cwd is not a git repo or the refs don't exist,
|
|
40
|
+
* the delete is a no-op.
|
|
41
|
+
*/
|
|
42
|
+
export declare function deleteCheckpointRefs(cwd: string | null | undefined, sessionId: string): Promise<void>;
|
|
43
|
+
export declare function retainCheckpointRefs(cwd: string | null | undefined, sessionId: string, checkpoints: readonly CheckpointEntry[]): Promise<void>;
|
|
44
|
+
export declare function createCheckpointHooks(options: CreateCheckpointHooksOptions): AgentHooks;
|
|
45
|
+
export {};
|