@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,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-session `SessionRuntime` orchestrator.
|
|
3
|
+
*
|
|
4
|
+
* Owns all cross-turn state for one logical agent session:
|
|
5
|
+
*
|
|
6
|
+
* - `ConversationStore` — message transcript + session-started gate
|
|
7
|
+
* - `MistakeTracker` — per-session consecutive-mistake counter
|
|
8
|
+
* - `LoopDetectionTracker` — per-session repeated-tool-call detector
|
|
9
|
+
* - `MessageBuilder` — provider-message assembly cache
|
|
10
|
+
* - `AgentRuntimeHooks` — runtime-native hooks from config/extensions
|
|
11
|
+
* - `RuntimeEventAdapter` — per-run stateful `AgentRuntimeEvent`
|
|
12
|
+
* → legacy `AgentEvent` translator
|
|
13
|
+
* - listener registry — host subscribers see legacy `AgentEvent`s
|
|
14
|
+
* - pending tool set, abort — per-run lifecycle housekeeping
|
|
15
|
+
*
|
|
16
|
+
* A fresh `AgentRuntime` is instantiated per run via
|
|
17
|
+
* `createAgentRuntime(createAgentRuntimeConfig({...}))`. All
|
|
18
|
+
* session-level state outlives any one `AgentRuntime`, making
|
|
19
|
+
* OAuth-retry and run replay feasible.
|
|
20
|
+
*/
|
|
21
|
+
import type { AgentRuntime } from "@cline/agents";
|
|
22
|
+
import { createAgentRuntime } from "@cline/agents";
|
|
23
|
+
import { type AgentConfig, type AgentEvent, type AgentExtensionRegistry, type AgentResult, type AgentTool, type BasicLogger, type ITelemetryService, type Message, type MessageWithMetadata } from "@cline/shared";
|
|
24
|
+
import { MessageBuilder } from "../../session/services/message-builder";
|
|
25
|
+
/**
|
|
26
|
+
* Listener invoked for every legacy `AgentEvent` produced by the
|
|
27
|
+
* session runtime. Use `subscribeEvents(listener)` — it returns an
|
|
28
|
+
* `unsubscribe` function.
|
|
29
|
+
*/
|
|
30
|
+
export type SessionEventListener = (event: AgentEvent) => void;
|
|
31
|
+
/** Subset of host-side deps needed by the session orchestrator. */
|
|
32
|
+
export interface SessionRuntimeOrchestratorDeps {
|
|
33
|
+
readonly logger?: BasicLogger;
|
|
34
|
+
readonly telemetry?: ITelemetryService;
|
|
35
|
+
/**
|
|
36
|
+
* Test hook: override the `AgentRuntime` factory. Production
|
|
37
|
+
* callers leave this undefined and get the real `createAgentRuntime`.
|
|
38
|
+
*/
|
|
39
|
+
readonly createAgentRuntimeImpl?: (config: Parameters<typeof createAgentRuntime>[0]) => AgentRuntime;
|
|
40
|
+
}
|
|
41
|
+
/** Connection overrides applied via `updateConnection`. */
|
|
42
|
+
export interface ConnectionOverrides {
|
|
43
|
+
providerId?: string;
|
|
44
|
+
modelId?: string;
|
|
45
|
+
apiKey?: string;
|
|
46
|
+
baseUrl?: string;
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
providerConfig?: unknown;
|
|
49
|
+
reasoningEffort?: AgentConfig["reasoningEffort"];
|
|
50
|
+
thinking?: boolean;
|
|
51
|
+
thinkingBudgetTokens?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Per-session orchestrator. Construct once per agent session; call
|
|
55
|
+
* `run` / `continue` repeatedly. The class matches the subset of
|
|
56
|
+
* runtime-facing session surface.
|
|
57
|
+
*/
|
|
58
|
+
export declare class SessionRuntime {
|
|
59
|
+
private config;
|
|
60
|
+
private readonly agentId;
|
|
61
|
+
private readonly parentAgentId?;
|
|
62
|
+
private readonly logger?;
|
|
63
|
+
readonly telemetry?: ITelemetryService;
|
|
64
|
+
private readonly conversation;
|
|
65
|
+
private readonly mistakeTracker;
|
|
66
|
+
private readonly loopTracker;
|
|
67
|
+
/**
|
|
68
|
+
* True when `execution.loopDetection === false` at construction
|
|
69
|
+
* time. Loop inspection is skipped entirely — the tracker still
|
|
70
|
+
* exists for API compatibility but is never fed.
|
|
71
|
+
*/
|
|
72
|
+
private readonly loopDetectionDisabled;
|
|
73
|
+
readonly messageBuilder: MessageBuilder;
|
|
74
|
+
/**
|
|
75
|
+
* Contribution registry that hosts extension-provided tools,
|
|
76
|
+
* commands, message builders, and providers. Lazily initialized
|
|
77
|
+
* on first run (parity with legacy `Agent.ensureExtensionsInitialized`
|
|
78
|
+
* at `packages/agents/src/agent.ts:1122-1147`).
|
|
79
|
+
*/
|
|
80
|
+
private readonly contributionRegistry;
|
|
81
|
+
private extensionsInitialized;
|
|
82
|
+
private readonly listeners;
|
|
83
|
+
private readonly createAgentRuntimeImpl;
|
|
84
|
+
/** Stable run id for the active run. */
|
|
85
|
+
private activeRunId;
|
|
86
|
+
/** True while a run is in flight. `canStartRun()` is the negation. */
|
|
87
|
+
private running;
|
|
88
|
+
/** True once `abort()` has been requested for the active run. */
|
|
89
|
+
private abortRequested;
|
|
90
|
+
/** Last abort reason requested for the active run. */
|
|
91
|
+
private abortReason;
|
|
92
|
+
/** Reference to the current run's `AgentRuntime` so `abort` can forward. */
|
|
93
|
+
private activeRuntime;
|
|
94
|
+
/** Promise returned from the current run so shutdown can await its drain. */
|
|
95
|
+
private activeRunPromise;
|
|
96
|
+
/** Per-run `Agent → AgentEvent` adapter; `reset()` each run. */
|
|
97
|
+
private readonly eventAdapter;
|
|
98
|
+
/** Session-shutdown gate — rejects late runs. */
|
|
99
|
+
private shutdownCalled;
|
|
100
|
+
/** Running tally of tool-call records for `AgentResult.toolCalls`. */
|
|
101
|
+
private currentRunToolCalls;
|
|
102
|
+
/** Aggregated usage across the current run. */
|
|
103
|
+
private currentRunUsage;
|
|
104
|
+
/** Tool-start timestamps for `ToolCallRecord.durationMs`. */
|
|
105
|
+
private toolStartedAt;
|
|
106
|
+
/** Tool-call input snapshot for `ToolCallRecord.input`. */
|
|
107
|
+
private toolInputs;
|
|
108
|
+
/**
|
|
109
|
+
* Per-turn tool outcome counters used by the MistakeTracker wiring.
|
|
110
|
+
* Reset on every `turn-started` event; consumed on `turn-finished`
|
|
111
|
+
* to feed `mistakeTracker.record` when every tool call erred and no
|
|
112
|
+
* successful call landed. Matches legacy `agent.ts` tool-failure
|
|
113
|
+
* mistake-feed path (§3.4.6 + pre-Step-9 oracle lines 972-997).
|
|
114
|
+
*/
|
|
115
|
+
private currentTurnSuccessfulTools;
|
|
116
|
+
private currentTurnFailedTools;
|
|
117
|
+
private currentTurnFailureDetails;
|
|
118
|
+
/**
|
|
119
|
+
* Serial queue for `MistakeTracker.record(...)` + loop-detection
|
|
120
|
+
* side-effects fired from the sync `handleRuntimeEvent` stream. The
|
|
121
|
+
* tracker's `record()` is async but the runtime event stream is
|
|
122
|
+
* synchronous, so we chain tracker work onto a promise and await it
|
|
123
|
+
* in `executeRun` before returning the `AgentResult`.
|
|
124
|
+
*/
|
|
125
|
+
private activeTrackerWork;
|
|
126
|
+
/** True when tracker logic has issued an abort for the active run. */
|
|
127
|
+
private trackerAbortInFlight;
|
|
128
|
+
constructor(config: AgentConfig, deps?: SessionRuntimeOrchestratorDeps);
|
|
129
|
+
getAgentId(): string;
|
|
130
|
+
getConversationId(): string;
|
|
131
|
+
getMessages(): MessageWithMetadata[];
|
|
132
|
+
/** True when no run is currently active and the session is not shut down. */
|
|
133
|
+
canStartRun(): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Snapshot of the contribution registry (tools, commands, and other
|
|
136
|
+
* extension contributions).
|
|
137
|
+
*
|
|
138
|
+
* Before the first run, the registry is in the `validate` phase:
|
|
139
|
+
* extensions are validated but their `setup()` callbacks have not
|
|
140
|
+
* run yet, so the snapshot only reflects eagerly-declared
|
|
141
|
+
* contributions. After the first `run()`/`continue()`, the
|
|
142
|
+
* registry is initialized (§`ensureExtensionsInitialized`), and
|
|
143
|
+
* the snapshot reflects everything extensions registered via
|
|
144
|
+
* `api.registerTool` / `registerCommand` / `registerMessageBuilder`
|
|
145
|
+
* / `registerProvider` / `registerAutomationEventType`.
|
|
146
|
+
*/
|
|
147
|
+
getExtensionRegistry(): AgentExtensionRegistry<AgentTool, Message[]>;
|
|
148
|
+
/** Append additional tools to every subsequent turn's runtime config. */
|
|
149
|
+
addTools(tools: AgentTool[]): void;
|
|
150
|
+
/** Mutate provider / reasoning fields for subsequent runs. */
|
|
151
|
+
updateConnection(overrides: ConnectionOverrides): void;
|
|
152
|
+
clearHistory(): void;
|
|
153
|
+
restore(messages: readonly MessageWithMetadata[]): void;
|
|
154
|
+
private resetConversationBoundaryTrackers;
|
|
155
|
+
/**
|
|
156
|
+
* Subscribe to **legacy** `AgentEvent`s. The session runtime
|
|
157
|
+
* translates the new `AgentRuntimeEvent` stream via
|
|
158
|
+
* `RuntimeEventAdapter` before fanout, so consumers see the
|
|
159
|
+
* pre-swap shape.
|
|
160
|
+
*/
|
|
161
|
+
subscribeEvents(listener: SessionEventListener): () => void;
|
|
162
|
+
abort(reason?: unknown): void;
|
|
163
|
+
/** Shut the session down after any active run drains. */
|
|
164
|
+
shutdown(_reason?: string, _timeoutMs?: number): Promise<void>;
|
|
165
|
+
run(userMessage: string, userImages?: string[], userFiles?: string[]): Promise<AgentResult>;
|
|
166
|
+
continue(userMessage?: string, userImages?: string[], userFiles?: string[]): Promise<AgentResult>;
|
|
167
|
+
private composeSystemPrompt;
|
|
168
|
+
private executeRun;
|
|
169
|
+
private executeRunInternal;
|
|
170
|
+
/**
|
|
171
|
+
* Initialize the contribution registry once per session. Runs
|
|
172
|
+
* extension `setup()` callbacks so they can `registerTool`,
|
|
173
|
+
* `registerCommand`, `registerMessageBuilder`, and
|
|
174
|
+
* `registerProvider`. Matches legacy `Agent.ensureExtensionsInitialized`
|
|
175
|
+
* at pre-Step-9 `agent.ts:1122-1147`:
|
|
176
|
+
*
|
|
177
|
+
* - on `hookErrorMode === "throw"`, setup failures propagate;
|
|
178
|
+
* - otherwise setup failures emit a recoverable `error` event
|
|
179
|
+
* via the legacy event channel and leave the registry
|
|
180
|
+
* partially initialized.
|
|
181
|
+
*
|
|
182
|
+
* Idempotent: subsequent calls are no-ops once the registry has
|
|
183
|
+
* been activated.
|
|
184
|
+
*/
|
|
185
|
+
private ensureExtensionsInitialized;
|
|
186
|
+
private createRuntimeHooks;
|
|
187
|
+
private createRuntimePrepareTurn;
|
|
188
|
+
private prepareMessagesForModelRequest;
|
|
189
|
+
private prepareProviderMessagesForApi;
|
|
190
|
+
private handleRuntimeEvent;
|
|
191
|
+
private syncConversationFromRuntimeMessage;
|
|
192
|
+
private emitLegacyEvent;
|
|
193
|
+
/**
|
|
194
|
+
* Feed the `LoopDetectionTracker` with a tool-call and react to
|
|
195
|
+
* the returned verdict. Parity with pre-Step-9 agent.ts L917-954:
|
|
196
|
+
*
|
|
197
|
+
* - `"soft"` → append a recovery notice telling the model to
|
|
198
|
+
* change approach;
|
|
199
|
+
* - `"hard"` → feed `MistakeTracker.record` with
|
|
200
|
+
* `forceAtLimit:true`. When the tracker returns
|
|
201
|
+
* `action: "stop"`, append the stop notice and
|
|
202
|
+
* abort the active runtime.
|
|
203
|
+
*/
|
|
204
|
+
private inspectLoopForToolCall;
|
|
205
|
+
/**
|
|
206
|
+
* Enqueue a mistake-record onto the serial tracker work chain. The
|
|
207
|
+
* runtime event stream is synchronous but `MistakeTracker.record`
|
|
208
|
+
* is async — chaining onto a shared promise preserves ordering
|
|
209
|
+
* (legacy parity) and lets `executeRun` await draining before
|
|
210
|
+
* returning the `AgentResult`.
|
|
211
|
+
*
|
|
212
|
+
* When the tracker returns `action: "stop"`, append the stop notice
|
|
213
|
+
* to the conversation and abort the active runtime so the run ends
|
|
214
|
+
* with `finishReason: "aborted"`.
|
|
215
|
+
*/
|
|
216
|
+
private enqueueMistakeRecord;
|
|
217
|
+
private buildLegacyResult;
|
|
218
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { AgentConfig, AgentHooks, AgentResult, AgentTool, BasicLogger, ITelemetryService, RuntimeConfigExtensionKind } from "@cline/shared";
|
|
2
|
+
import type { UserInstructionConfigService } from "../../extensions/config";
|
|
3
|
+
import type { ToolExecutors } from "../../extensions/tools";
|
|
4
|
+
import type { AgentTeamsRuntime, DelegatedAgentConfigProvider, TeamEvent } from "../../extensions/tools/team";
|
|
5
|
+
import type { WorkspaceManager } from "../../services/workspace/workspace-manager";
|
|
6
|
+
import type { CoreSessionConfig } from "../../types/config";
|
|
7
|
+
/**
|
|
8
|
+
* Internal structural alias for the lead-agent handle that
|
|
9
|
+
* {@link BuiltRuntime.registerLeadAgent} hands off to
|
|
10
|
+
* `runtime-builder.ts`. Narrowed to only the `.addTools()` surface the
|
|
11
|
+
* callback exercises; avoids depending on `@cline/agents`' `Agent`
|
|
12
|
+
* class during the PLAN.md §3.6 Step 5 type-only migration. When
|
|
13
|
+
* SessionRuntime is rebuilt in Step 6, this field is expected to be
|
|
14
|
+
* dropped entirely per §3.5 row #2.
|
|
15
|
+
*/
|
|
16
|
+
type LeadAgentHandle = {
|
|
17
|
+
addTools(tools: AgentTool[]): unknown;
|
|
18
|
+
};
|
|
19
|
+
export interface BuiltRuntime {
|
|
20
|
+
tools: AgentTool[];
|
|
21
|
+
hooks?: AgentHooks;
|
|
22
|
+
logger?: BasicLogger;
|
|
23
|
+
telemetry?: ITelemetryService;
|
|
24
|
+
teamRuntime?: AgentTeamsRuntime;
|
|
25
|
+
teamRestoredFromPersistence?: boolean;
|
|
26
|
+
delegatedAgentConfigProvider?: DelegatedAgentConfigProvider;
|
|
27
|
+
extensions?: AgentConfig["extensions"];
|
|
28
|
+
completionPolicy?: AgentConfig["completionPolicy"];
|
|
29
|
+
registerLeadAgent?: (agent: LeadAgentHandle) => void;
|
|
30
|
+
shutdown: (reason: string) => Promise<void> | void;
|
|
31
|
+
}
|
|
32
|
+
export interface RuntimeBuilderInput {
|
|
33
|
+
config: CoreSessionConfig;
|
|
34
|
+
hooks?: AgentHooks;
|
|
35
|
+
extensions?: AgentConfig["extensions"];
|
|
36
|
+
onTeamEvent?: (event: TeamEvent) => void;
|
|
37
|
+
createSpawnTool?: () => AgentTool;
|
|
38
|
+
onTeamRestored?: () => void;
|
|
39
|
+
userInstructionService?: UserInstructionConfigService;
|
|
40
|
+
configExtensions?: RuntimeConfigExtensionKind[];
|
|
41
|
+
toolExecutors?: Partial<ToolExecutors>;
|
|
42
|
+
workspaceManager?: WorkspaceManager;
|
|
43
|
+
logger?: BasicLogger;
|
|
44
|
+
telemetry?: ITelemetryService;
|
|
45
|
+
}
|
|
46
|
+
export interface RuntimeBuilder {
|
|
47
|
+
build(input: RuntimeBuilderInput): Promise<BuiltRuntime> | BuiltRuntime;
|
|
48
|
+
}
|
|
49
|
+
export interface SessionRuntime {
|
|
50
|
+
start(config: CoreSessionConfig): Promise<{
|
|
51
|
+
sessionId: string;
|
|
52
|
+
}>;
|
|
53
|
+
send(sessionId: string, prompt: string): Promise<AgentResult | undefined>;
|
|
54
|
+
abort(sessionId: string, reason?: unknown): Promise<void>;
|
|
55
|
+
stop(sessionId: string): Promise<void>;
|
|
56
|
+
poll(): Promise<string[]>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-input / first-turn content assembler.
|
|
3
|
+
*
|
|
4
|
+
* Opens the first user content array for a turn, loading user file contents via
|
|
5
|
+
* the injected `userFileContentLoader`.
|
|
6
|
+
*/
|
|
7
|
+
import type * as LlmsProviders from "@cline/llms";
|
|
8
|
+
export declare function buildInitialUserContent(userMessage: string, userImages?: string[], userFiles?: string[], userFileContentLoader?: (path: string) => Promise<string>): Promise<string | LlmsProviders.ContentBlock[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Normalize a user message shape into a plain string when possible.
|
|
11
|
+
*
|
|
12
|
+
* Accepts either a string or a LlmsProviders.Message; returns the best-effort
|
|
13
|
+
* concatenated plain-text body. Non-text content is ignored.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeUserMessage(input: string | LlmsProviders.Message | undefined): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repeated tool-call loop detection.
|
|
3
|
+
*
|
|
4
|
+
* @see PLAN.md §3.1 — helpers moved from `packages/agents/src/context/loop-detection.ts`.
|
|
5
|
+
* @see PLAN.md §3.2.3 — public surface of `LoopDetectionTracker`.
|
|
6
|
+
*
|
|
7
|
+
* The pure helpers (`createLoopDetectionState`, `resetLoopDetectionState`,
|
|
8
|
+
* `toolCallSignature`, `checkRepeatedToolCall`) are ported verbatim. The
|
|
9
|
+
* `LoopDetectionTracker` class is a thin wrapper that owns a
|
|
10
|
+
* `LoopDetectionState` and exposes the `inspect()` / `reset()` surface that
|
|
11
|
+
* `SessionRuntime` installs as a `beforeTool` hook per §3.2.3.
|
|
12
|
+
*/
|
|
13
|
+
import type { LoopDetectionConfig } from "@cline/shared";
|
|
14
|
+
export interface LoopDetectionState {
|
|
15
|
+
lastToolName: string;
|
|
16
|
+
lastToolSignature: string;
|
|
17
|
+
consecutiveIdenticalCount: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function createLoopDetectionState(): LoopDetectionState;
|
|
20
|
+
export declare function resetLoopDetectionState(state: LoopDetectionState): void;
|
|
21
|
+
export declare function toolCallSignature(input: unknown): string;
|
|
22
|
+
export interface LoopCheckResult {
|
|
23
|
+
softWarning: boolean;
|
|
24
|
+
hardEscalation: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function checkRepeatedToolCall(state: LoopDetectionState, toolName: string, signature: string, config: LoopDetectionConfig): LoopCheckResult;
|
|
27
|
+
/**
|
|
28
|
+
* Verdict returned by {@link LoopDetectionTracker.inspect}.
|
|
29
|
+
*
|
|
30
|
+
* - `"ok"` — no repeated call detected.
|
|
31
|
+
* - `"soft"` — soft-warning threshold reached; SessionRuntime may surface a
|
|
32
|
+
* recovery notice but should not block the call.
|
|
33
|
+
* - `"hard"` — hard-escalation threshold reached; SessionRuntime should
|
|
34
|
+
* stop the run with the provided `message`.
|
|
35
|
+
*/
|
|
36
|
+
export interface LoopDetectionVerdict {
|
|
37
|
+
kind: "ok" | "soft" | "hard";
|
|
38
|
+
message?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Minimal call shape the tracker needs; matches `AgentToolCallPart` subset. */
|
|
41
|
+
export interface LoopDetectionCall {
|
|
42
|
+
name: string;
|
|
43
|
+
input: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Per-session repeated-tool-call detector.
|
|
47
|
+
*
|
|
48
|
+
* `SessionRuntime` owns the instance and installs a `beforeTool` hook
|
|
49
|
+
* (see `AgentRuntimeHooks.beforeTool`) that calls `inspect()` to decide
|
|
50
|
+
* whether to return `{ skip, stop, reason }`.
|
|
51
|
+
*/
|
|
52
|
+
export declare class LoopDetectionTracker {
|
|
53
|
+
private readonly config;
|
|
54
|
+
private readonly state;
|
|
55
|
+
constructor(config?: Partial<LoopDetectionConfig>);
|
|
56
|
+
inspect(call: LoopDetectionCall): LoopDetectionVerdict;
|
|
57
|
+
reset(): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-session consecutive-mistake tracker.
|
|
3
|
+
*
|
|
4
|
+
* @see PLAN.md §3.1 — wrapped around `recordMistake` moved from
|
|
5
|
+
* `packages/agents/src/api/error-handling.ts` lines 147–311.
|
|
6
|
+
* @see PLAN.md §3.2.3 — public surface of `MistakeTracker`.
|
|
7
|
+
*
|
|
8
|
+
* The pure procedural `recordMistake(input, deps)` becomes `record(input)`
|
|
9
|
+
* on the class; `consecutiveMistakes` is internal state. Other deps flow
|
|
10
|
+
* through the constructor instead.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: the §3.2.3 constructor shape omits some fields (agentId,
|
|
13
|
+
* conversationId/runId getters, appendRecoveryNotice). They are retained
|
|
14
|
+
* here for log + notice parity per PLAN.md §3.4.3/§3.4.5. Step 8
|
|
15
|
+
* (`impl-runtime-porter`) may refactor once SessionRuntime is wired up.
|
|
16
|
+
*/
|
|
17
|
+
import type { AgentEvent, BasicLogMetadata, ConsecutiveMistakeLimitContext, ConsecutiveMistakeLimitDecision } from "@cline/shared";
|
|
18
|
+
/**
|
|
19
|
+
* Legacy-agents-style leveled log function. The sdk-re `BasicLogger`
|
|
20
|
+
* does not carry a level argument (§shared/logging/logger.ts); callers
|
|
21
|
+
* are expected to bridge via `metadata.severity` or dispatch to
|
|
22
|
+
* `debug`/`log`/`error`. `MistakeTracker` accepts a leveled callable
|
|
23
|
+
* here so Step 8 can plug in whichever bridging shape `SessionRuntime`
|
|
24
|
+
* ends up using.
|
|
25
|
+
*/
|
|
26
|
+
export type LeveledLog = (level: "debug" | "info" | "warn" | "error", message: string, metadata?: BasicLogMetadata) => void;
|
|
27
|
+
export type MistakeReason = "api_error" | "invalid_tool_call" | "tool_execution_failed";
|
|
28
|
+
export interface RecordMistakeInput {
|
|
29
|
+
iteration: number;
|
|
30
|
+
reason: MistakeReason;
|
|
31
|
+
details?: string;
|
|
32
|
+
/** When true, jump straight to maxConsecutiveMistakes instead of incrementing by 1. */
|
|
33
|
+
forceAtLimit?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export type MistakeOutcome = {
|
|
36
|
+
action: "continue";
|
|
37
|
+
guidance?: string;
|
|
38
|
+
} | {
|
|
39
|
+
action: "stop";
|
|
40
|
+
message: string;
|
|
41
|
+
reason?: string;
|
|
42
|
+
};
|
|
43
|
+
export interface MistakeTrackerOptions {
|
|
44
|
+
readonly maxConsecutiveMistakes: number;
|
|
45
|
+
readonly onLimitReached?: (ctx: ConsecutiveMistakeLimitContext) => Promise<ConsecutiveMistakeLimitDecision> | ConsecutiveMistakeLimitDecision;
|
|
46
|
+
readonly emit: (event: AgentEvent) => void;
|
|
47
|
+
readonly log: LeveledLog;
|
|
48
|
+
readonly agentId: string;
|
|
49
|
+
readonly getConversationId: () => string;
|
|
50
|
+
readonly getActiveRunId: () => string;
|
|
51
|
+
readonly appendRecoveryNotice: (message: string, reason: MistakeReason) => void;
|
|
52
|
+
}
|
|
53
|
+
export declare class MistakeTracker {
|
|
54
|
+
private consecutiveMistakes;
|
|
55
|
+
private readonly options;
|
|
56
|
+
constructor(options: MistakeTrackerOptions);
|
|
57
|
+
record(input: RecordMistakeInput): Promise<MistakeOutcome>;
|
|
58
|
+
reset(): void;
|
|
59
|
+
get value(): number;
|
|
60
|
+
}
|
|
61
|
+
export declare function buildMistakeLimitStopMessage(input: {
|
|
62
|
+
iteration: number;
|
|
63
|
+
consecutiveMistakes: number;
|
|
64
|
+
maxConsecutiveMistakes: number;
|
|
65
|
+
reason: "api_error" | "invalid_tool_call" | "completion_without_submit" | "tool_execution_failed";
|
|
66
|
+
details?: string;
|
|
67
|
+
stopReason?: string;
|
|
68
|
+
}): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RuleConfig, UserInstructionConfigWatcher } from "../../extensions/config/user-instruction-config-loader";
|
|
2
|
+
export declare function isRuleEnabled(rule: RuleConfig): boolean;
|
|
3
|
+
export declare function formatRulesForSystemPrompt(rules: ReadonlyArray<RuleConfig>): string;
|
|
4
|
+
export declare function mergeRulesForSystemPrompt(primaryRules?: string, additionalRules?: string): string | undefined;
|
|
5
|
+
export declare function listEnabledRulesFromWatcher(watcher: UserInstructionConfigWatcher): RuleConfig[];
|
|
6
|
+
export declare function loadRulesForSystemPromptFromWatcher(watcher: UserInstructionConfigWatcher): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface SubprocessSandboxOptions {
|
|
2
|
+
/** Inline script to execute via `node -e`. Mutually exclusive with {@link bootstrapFile}. */
|
|
3
|
+
bootstrapScript?: string;
|
|
4
|
+
/** Path to a JavaScript file to execute via `node <file>`. Mutually exclusive with {@link bootstrapScript}. */
|
|
5
|
+
bootstrapFile?: string;
|
|
6
|
+
/** Runtime executable for internal JavaScript helpers. Defaults to node/bun instead of packaged CLI binaries. */
|
|
7
|
+
runtimeExecutable?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
onEvent?: (event: {
|
|
10
|
+
name: string;
|
|
11
|
+
payload?: unknown;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface SandboxCallOptions {
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const CLINE_JS_RUNTIME_PATH_ENV = "CLINE_JS_RUNTIME_PATH";
|
|
18
|
+
export declare function resolveSubprocessRuntimeExecutable(options?: {
|
|
19
|
+
env?: NodeJS.ProcessEnv;
|
|
20
|
+
execPath?: string;
|
|
21
|
+
runtimeExecutable?: string;
|
|
22
|
+
}): string;
|
|
23
|
+
export declare function buildSubprocessSandboxCommand(args: string[], options?: {
|
|
24
|
+
env?: NodeJS.ProcessEnv;
|
|
25
|
+
execArgv?: string[];
|
|
26
|
+
name?: string;
|
|
27
|
+
execPath?: string;
|
|
28
|
+
runtimeExecutable?: string;
|
|
29
|
+
}): string[];
|
|
30
|
+
export declare class SubprocessSandbox {
|
|
31
|
+
private readonly options;
|
|
32
|
+
private process;
|
|
33
|
+
private requestCounter;
|
|
34
|
+
private readonly pending;
|
|
35
|
+
constructor(options: SubprocessSandboxOptions);
|
|
36
|
+
private get processLabel();
|
|
37
|
+
private clearPendingRequest;
|
|
38
|
+
start(): void;
|
|
39
|
+
call<TResult = unknown>(method: string, args: unknown, options?: SandboxCallOptions): Promise<TResult>;
|
|
40
|
+
shutdown(): Promise<void>;
|
|
41
|
+
private onMessage;
|
|
42
|
+
private failPending;
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolApprovalRequest, ToolApprovalResult } from "@cline/shared";
|
|
2
|
+
export type DesktopToolApprovalOptions = {
|
|
3
|
+
approvalDir?: string;
|
|
4
|
+
sessionId?: string;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
pollIntervalMs?: number;
|
|
7
|
+
nowIso?: () => string;
|
|
8
|
+
};
|
|
9
|
+
export declare function requestDesktopToolApproval(request: ToolApprovalRequest, options?: DesktopToolApprovalOptions): Promise<ToolApprovalResult>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { CoreSessionEvent, SessionPendingPrompt } from "../../types/events";
|
|
2
|
+
import type { ActiveSession } from "../../types/session";
|
|
3
|
+
import type { PendingPromptMutationResult, PendingPromptsDeleteInput, PendingPromptsUpdateInput } from "../host/runtime-host";
|
|
4
|
+
export type PendingPromptDelivery = "queue" | "steer";
|
|
5
|
+
export interface PendingPromptEntry {
|
|
6
|
+
id: string;
|
|
7
|
+
prompt: string;
|
|
8
|
+
delivery: PendingPromptDelivery;
|
|
9
|
+
userImages?: string[];
|
|
10
|
+
userFiles?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface PendingPromptQueueState {
|
|
13
|
+
pendingPrompts: PendingPromptEntry[];
|
|
14
|
+
}
|
|
15
|
+
export interface PendingPromptsControllerDeps {
|
|
16
|
+
getSession(sessionId: string): ActiveSession | undefined;
|
|
17
|
+
emit(event: CoreSessionEvent): void;
|
|
18
|
+
send(input: {
|
|
19
|
+
sessionId: string;
|
|
20
|
+
prompt: string;
|
|
21
|
+
userImages?: string[];
|
|
22
|
+
userFiles?: string[];
|
|
23
|
+
}): Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface PendingPromptEnqueueInput {
|
|
26
|
+
prompt: string;
|
|
27
|
+
delivery: PendingPromptDelivery;
|
|
28
|
+
userImages?: string[];
|
|
29
|
+
userFiles?: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface PendingPromptConsumeResult {
|
|
32
|
+
entry?: PendingPromptEntry;
|
|
33
|
+
prompts: SessionPendingPrompt[];
|
|
34
|
+
}
|
|
35
|
+
export declare class PendingPromptService {
|
|
36
|
+
list(state: PendingPromptQueueState | undefined): SessionPendingPrompt[];
|
|
37
|
+
update(state: PendingPromptQueueState | undefined, input: PendingPromptsUpdateInput): PendingPromptMutationResult;
|
|
38
|
+
delete(state: PendingPromptQueueState | undefined, input: PendingPromptsDeleteInput): PendingPromptMutationResult;
|
|
39
|
+
enqueue(state: PendingPromptQueueState, input: PendingPromptEnqueueInput): SessionPendingPrompt[];
|
|
40
|
+
consumeSteer(state: PendingPromptQueueState): PendingPromptConsumeResult;
|
|
41
|
+
shiftNext(state: PendingPromptQueueState): PendingPromptConsumeResult;
|
|
42
|
+
requeueFront(state: PendingPromptQueueState, entry: PendingPromptEntry): SessionPendingPrompt[];
|
|
43
|
+
clear(state: PendingPromptQueueState): SessionPendingPrompt[];
|
|
44
|
+
}
|
|
45
|
+
export declare class PendingPromptsController {
|
|
46
|
+
private readonly deps;
|
|
47
|
+
private readonly service;
|
|
48
|
+
constructor(deps: PendingPromptsControllerDeps);
|
|
49
|
+
list(sessionId: string): SessionPendingPrompt[];
|
|
50
|
+
update(input: PendingPromptsUpdateInput): PendingPromptMutationResult;
|
|
51
|
+
delete(input: PendingPromptsDeleteInput): PendingPromptMutationResult;
|
|
52
|
+
enqueue(sessionId: string, entry: {
|
|
53
|
+
prompt: string;
|
|
54
|
+
delivery: "queue" | "steer";
|
|
55
|
+
userImages?: string[];
|
|
56
|
+
userFiles?: string[];
|
|
57
|
+
}): void;
|
|
58
|
+
consumeSteer(sessionId: string): string | undefined;
|
|
59
|
+
clearAborted(session: ActiveSession): void;
|
|
60
|
+
emitPrompts(session: ActiveSession): void;
|
|
61
|
+
scheduleDrain(sessionId: string, session: ActiveSession): void;
|
|
62
|
+
drain(sessionId: string): Promise<void>;
|
|
63
|
+
private emitSubmitted;
|
|
64
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentEvent } from "@cline/shared";
|
|
2
|
+
import type { SessionAccumulatedUsage } from "../runtime/host/runtime-host";
|
|
3
|
+
import type { CoreSessionConfig } from "../types/config";
|
|
4
|
+
import type { CoreSessionEvent } from "../types/events";
|
|
5
|
+
import type { ActiveSession } from "../types/session";
|
|
6
|
+
import { type TelemetryAgentIdentityProperties } from "./telemetry/core-events";
|
|
7
|
+
export declare function extractSkillNameFromToolInput(input: unknown): string | undefined;
|
|
8
|
+
export interface AgentEventContext {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
config: CoreSessionConfig;
|
|
11
|
+
liveSession: ActiveSession | undefined;
|
|
12
|
+
usageBySession: Map<string, SessionAccumulatedUsage>;
|
|
13
|
+
persistMessages: (sessionId: string, messages: unknown[], systemPrompt?: string) => void;
|
|
14
|
+
emit: (event: CoreSessionEvent) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface AgentTelemetryContextOverrides {
|
|
17
|
+
agentId?: string;
|
|
18
|
+
conversationId?: string;
|
|
19
|
+
parentAgentId?: string | null;
|
|
20
|
+
createdByAgentId?: string;
|
|
21
|
+
teamId?: string;
|
|
22
|
+
teamName?: string;
|
|
23
|
+
teamRole?: "lead" | "teammate";
|
|
24
|
+
teamAgentId?: string;
|
|
25
|
+
isPrimaryAgentEvent?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function extractAgentEventMetadata(event: AgentEvent): {
|
|
28
|
+
agentId?: string;
|
|
29
|
+
conversationId?: string;
|
|
30
|
+
parentAgentId?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function buildTelemetryAgentIdentity(context: AgentTelemetryContextOverrides): TelemetryAgentIdentityProperties | undefined;
|
|
33
|
+
export declare function handleAgentEvent(ctx: AgentEventContext, event: AgentEvent, overrides?: AgentTelemetryContextOverrides): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentConfig, AgentTool, ITelemetryService } from "@cline/shared";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const GlobalSettingsSchema: z.ZodPipe<z.ZodObject<{
|
|
4
|
+
telemetryOptOut: z.ZodCatch<z.ZodDefault<z.ZodBoolean>>;
|
|
5
|
+
disabledTools: z.ZodOptional<z.ZodPipe<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>, z.ZodTransform<string[] | undefined, string[] | undefined>>>;
|
|
6
|
+
disabledPlugins: z.ZodOptional<z.ZodPipe<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>, z.ZodTransform<string[] | undefined, string[] | undefined>>>;
|
|
7
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
8
|
+
telemetryOptOut: boolean;
|
|
9
|
+
disabledTools?: string[];
|
|
10
|
+
disabledPlugins?: string[];
|
|
11
|
+
}, {
|
|
12
|
+
telemetryOptOut: boolean;
|
|
13
|
+
disabledTools?: string[] | undefined;
|
|
14
|
+
disabledPlugins?: string[] | undefined;
|
|
15
|
+
}>>;
|
|
16
|
+
export type GlobalSettings = z.infer<typeof GlobalSettingsSchema>;
|
|
17
|
+
export interface WriteGlobalSettingsOptions {
|
|
18
|
+
telemetry?: ITelemetryService;
|
|
19
|
+
}
|
|
20
|
+
export declare function readGlobalSettings(): GlobalSettings;
|
|
21
|
+
export declare function writeGlobalSettings(settings: z.input<typeof GlobalSettingsSchema>, options?: WriteGlobalSettingsOptions): void;
|
|
22
|
+
export declare function isTelemetryOptedOutGlobally(): boolean;
|
|
23
|
+
export declare function setTelemetryOptOutGlobally(telemetryOptOut: boolean, options?: WriteGlobalSettingsOptions): void;
|
|
24
|
+
export declare function resolveDisabledToolNames(disabledToolNames?: ReadonlyArray<string>): Set<string>;
|
|
25
|
+
export declare function resolveDisabledPluginPaths(disabledPluginPaths?: ReadonlyArray<string>): Set<string>;
|
|
26
|
+
export declare function isToolDisabledGlobally(toolName: string): boolean;
|
|
27
|
+
export declare function toggleDisabledTool(toolName: string): boolean;
|
|
28
|
+
export declare function setDisabledTools(toolNames: ReadonlyArray<string>, disabledValue: boolean): void;
|
|
29
|
+
export declare function setToolDisabledGlobally(toolName: string, disabled: boolean): boolean;
|
|
30
|
+
export declare function isPluginDisabledGlobally(pluginPath: string): boolean;
|
|
31
|
+
export declare function setDisabledPlugin(pluginPath: string, disabledValue: boolean): void;
|
|
32
|
+
export declare function filterDisabledPluginPaths(pluginPaths: ReadonlyArray<string>, disabledPluginPaths?: ReadonlyArray<string>): string[];
|
|
33
|
+
export declare function filterDisabledTools<T extends Pick<AgentTool, "name">>(tools: ReadonlyArray<T>, disabledToolNames?: ReadonlyArray<string>): T[];
|
|
34
|
+
export declare function filterExtensionToolRegistrations(extensions: AgentConfig["extensions"], disabledToolNames?: ReadonlyArray<string>): AgentConfig["extensions"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ProviderSettingsManager } from "../storage/provider-settings-manager";
|
|
2
|
+
export interface ClineRecommendedModel {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
tags: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ClineRecommendedModelsData {
|
|
9
|
+
recommended: ClineRecommendedModel[];
|
|
10
|
+
free: ClineRecommendedModel[];
|
|
11
|
+
}
|
|
12
|
+
export interface FetchClineRecommendedModelsOptions {
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
fetchImpl?: typeof fetch;
|
|
15
|
+
providerSettingsManager?: Pick<ProviderSettingsManager, "getProviderSettings">;
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const FALLBACK_CLINE_RECOMMENDED_MODELS: ClineRecommendedModelsData;
|
|
19
|
+
export declare function fetchClineRecommendedModels(options?: FetchClineRecommendedModelsOptions): Promise<ClineRecommendedModelsData>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ProviderConfig } from "./provider-settings";
|
|
2
|
+
import type { BuiltInProviderSummary, CreateHandlerInput, ProviderConfigDefaults, ProviderSelectionConfig, RegisteredProviderSummary } from "./runtime-types";
|
|
3
|
+
interface RegisterConfiguredProviderInput {
|
|
4
|
+
id: string;
|
|
5
|
+
models: readonly string[];
|
|
6
|
+
defaultModel?: string;
|
|
7
|
+
defaults?: ProviderConfigDefaults;
|
|
8
|
+
}
|
|
9
|
+
export declare function toBuiltInProviderSummary(input: {
|
|
10
|
+
collection: BuiltInProviderSummary["id"] extends string ? {
|
|
11
|
+
provider: Pick<import("@cline/llms").ProviderInfo, "id" | "name" | "description" | "protocol" | "baseUrl" | "capabilities" | "env" | "defaultModelId">;
|
|
12
|
+
models: Record<string, unknown>;
|
|
13
|
+
} : never;
|
|
14
|
+
}): BuiltInProviderSummary;
|
|
15
|
+
export declare class ConfiguredProviderRegistry {
|
|
16
|
+
private readonly providers;
|
|
17
|
+
register(input: RegisterConfiguredProviderInput): void;
|
|
18
|
+
registerSelectionConfig(provider: ProviderSelectionConfig): void;
|
|
19
|
+
registerModel(providerId: string, modelId: string): void;
|
|
20
|
+
createHandlerConfig(input: CreateHandlerInput): ProviderConfig;
|
|
21
|
+
list(): RegisteredProviderSummary[];
|
|
22
|
+
getModels(providerId: string): string[];
|
|
23
|
+
hasProvider(providerId: string): boolean;
|
|
24
|
+
hasModel(providerId: string, modelId: string): boolean;
|
|
25
|
+
private require;
|
|
26
|
+
}
|
|
27
|
+
export {};
|