@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.
Files changed (227) hide show
  1. package/README.md +108 -0
  2. package/dist/ClineCore.d.ts +282 -0
  3. package/dist/account/cline-account-service.d.ts +37 -0
  4. package/dist/account/index.d.ts +3 -0
  5. package/dist/account/rpc.d.ts +40 -0
  6. package/dist/account/types.d.ts +98 -0
  7. package/dist/auth/bounded-ttl-cache.d.ts +13 -0
  8. package/dist/auth/client.d.ts +30 -0
  9. package/dist/auth/cline.d.ts +64 -0
  10. package/dist/auth/codex.d.ts +43 -0
  11. package/dist/auth/oca.d.ts +28 -0
  12. package/dist/auth/server.d.ts +54 -0
  13. package/dist/auth/types.d.ts +103 -0
  14. package/dist/auth/utils.d.ts +32 -0
  15. package/dist/cline-core/automation.d.ts +34 -0
  16. package/dist/cline-core/runtime-services.d.ts +5 -0
  17. package/dist/cline-core/start-input.d.ts +10 -0
  18. package/dist/cline-core/telemetry.d.ts +10 -0
  19. package/dist/cline-core/types.d.ts +221 -0
  20. package/dist/cron/events/cron-event-ingress.d.ts +37 -0
  21. package/dist/cron/reports/cron-report-writer.d.ts +40 -0
  22. package/dist/cron/runner/cron-materializer.d.ts +35 -0
  23. package/dist/cron/runner/cron-runner.d.ts +45 -0
  24. package/dist/cron/runner/resource-limiter.d.ts +8 -0
  25. package/dist/cron/schedule/scheduler.d.ts +12 -0
  26. package/dist/cron/service/cron-service.d.ts +56 -0
  27. package/dist/cron/service/schedule-command-service.d.ts +9 -0
  28. package/dist/cron/service/schedule-service.d.ts +98 -0
  29. package/dist/cron/specs/cron-reconciler.d.ts +61 -0
  30. package/dist/cron/specs/cron-spec-parser.d.ts +26 -0
  31. package/dist/cron/specs/cron-watcher.d.ts +22 -0
  32. package/dist/cron/store/cron-schema.d.ts +2 -0
  33. package/dist/cron/store/sqlite-cron-store.d.ts +240 -0
  34. package/dist/extensions/config/index.d.ts +7 -0
  35. package/dist/extensions/config/runtime-commands.d.ts +11 -0
  36. package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
  37. package/dist/extensions/config/unified-config-file-watcher.d.ts +77 -0
  38. package/dist/extensions/config/user-instruction-config-loader.d.ts +64 -0
  39. package/dist/extensions/config/user-instruction-plugin.d.ts +25 -0
  40. package/dist/extensions/config/user-instruction-service.d.ts +23 -0
  41. package/dist/extensions/context/agentic-compaction.d.ts +12 -0
  42. package/dist/extensions/context/basic-compaction.d.ts +8 -0
  43. package/dist/extensions/context/compaction-shared.d.ts +60 -0
  44. package/dist/extensions/context/compaction.d.ts +24 -0
  45. package/dist/extensions/index.d.ts +5 -0
  46. package/dist/extensions/mcp/client.d.ts +2 -0
  47. package/dist/extensions/mcp/config-loader.d.ts +15 -0
  48. package/dist/extensions/mcp/index.d.ts +8 -0
  49. package/dist/extensions/mcp/manager.d.ts +23 -0
  50. package/dist/extensions/mcp/name-transform.d.ts +2 -0
  51. package/dist/extensions/mcp/policies.d.ts +14 -0
  52. package/dist/extensions/mcp/tools.d.ts +3 -0
  53. package/dist/extensions/mcp/types.d.ts +94 -0
  54. package/dist/extensions/plugin/plugin-config-loader.d.ts +40 -0
  55. package/dist/extensions/plugin/plugin-load-report.d.ts +18 -0
  56. package/dist/extensions/plugin/plugin-loader.d.ts +22 -0
  57. package/dist/extensions/plugin/plugin-module-import.d.ts +4 -0
  58. package/dist/extensions/plugin/plugin-sandbox.d.ts +36 -0
  59. package/dist/extensions/plugin/plugin-targeting.d.ts +6 -0
  60. package/dist/extensions/plugin-sandbox-bootstrap.js +1 -0
  61. package/dist/extensions/tools/constants.d.ts +24 -0
  62. package/dist/extensions/tools/definitions.d.ts +102 -0
  63. package/dist/extensions/tools/executors/apply-patch-parser.d.ts +68 -0
  64. package/dist/extensions/tools/executors/apply-patch.d.ts +28 -0
  65. package/dist/extensions/tools/executors/bash.d.ts +49 -0
  66. package/dist/extensions/tools/executors/editor.d.ts +31 -0
  67. package/dist/extensions/tools/executors/file-read.d.ts +40 -0
  68. package/dist/extensions/tools/executors/index.d.ts +50 -0
  69. package/dist/extensions/tools/executors/search.d.ts +50 -0
  70. package/dist/extensions/tools/executors/web-fetch.d.ts +58 -0
  71. package/dist/extensions/tools/helpers.d.ts +15 -0
  72. package/dist/extensions/tools/index.d.ts +59 -0
  73. package/dist/extensions/tools/model-tool-routing.d.ts +33 -0
  74. package/dist/extensions/tools/presets.d.ts +132 -0
  75. package/dist/extensions/tools/runtime.d.ts +24 -0
  76. package/dist/extensions/tools/schemas.d.ts +241 -0
  77. package/dist/extensions/tools/team/delegated-agent.d.ts +43 -0
  78. package/dist/extensions/tools/team/index.d.ts +2 -0
  79. package/dist/extensions/tools/team/multi-agent.d.ts +230 -0
  80. package/dist/extensions/tools/team/projections.d.ts +8 -0
  81. package/dist/extensions/tools/team/runtime.d.ts +4 -0
  82. package/dist/extensions/tools/team/spawn-agent-tool.d.ts +83 -0
  83. package/dist/extensions/tools/team/subagent-prompts.d.ts +3 -0
  84. package/dist/extensions/tools/team/team-tools.d.ts +35 -0
  85. package/dist/extensions/tools/types.d.ts +254 -0
  86. package/dist/hooks/checkpoint-hooks.d.ts +45 -0
  87. package/dist/hooks/hook-extension.d.ts +2 -0
  88. package/dist/hooks/hook-file-config.d.ts +24 -0
  89. package/dist/hooks/hook-file-hooks.d.ts +21 -0
  90. package/dist/hooks/index.d.ts +5 -0
  91. package/dist/hooks/subprocess-runner.d.ts +21 -0
  92. package/dist/hooks/subprocess.d.ts +68 -0
  93. package/dist/hub/client/connect.d.ts +14 -0
  94. package/dist/hub/client/index.d.ts +88 -0
  95. package/dist/hub/client/session-client.d.ts +118 -0
  96. package/dist/hub/client/ui-client.d.ts +45 -0
  97. package/dist/hub/daemon/entry.d.ts +1 -0
  98. package/dist/hub/daemon/entry.js +720 -0
  99. package/dist/hub/daemon/index.d.ts +8 -0
  100. package/dist/hub/daemon/runtime-handlers.d.ts +12 -0
  101. package/dist/hub/daemon/start-shared-server.d.ts +18 -0
  102. package/dist/hub/discovery/defaults.d.ts +16 -0
  103. package/dist/hub/discovery/index.d.ts +30 -0
  104. package/dist/hub/discovery/workspace.d.ts +3 -0
  105. package/dist/hub/index.d.ts +32 -0
  106. package/dist/hub/index.js +717 -0
  107. package/dist/hub/runtime-host/hub-runtime-host.d.ts +73 -0
  108. package/dist/hub/runtime-host/remote-runtime-host.d.ts +9 -0
  109. package/dist/hub/server/browser-websocket.d.ts +17 -0
  110. package/dist/hub/server/command-transport.d.ts +7 -0
  111. package/dist/hub/server/handlers/approval-handlers.d.ts +17 -0
  112. package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
  113. package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
  114. package/dist/hub/server/handlers/context.d.ts +56 -0
  115. package/dist/hub/server/handlers/run-handlers.d.ts +5 -0
  116. package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
  117. package/dist/hub/server/handlers/session-handlers.d.ts +20 -0
  118. package/dist/hub/server/hub-client-contributions.d.ts +19 -0
  119. package/dist/hub/server/hub-notifications.d.ts +7 -0
  120. package/dist/hub/server/hub-schedule-events.d.ts +2 -0
  121. package/dist/hub/server/hub-server-logging.d.ts +2 -0
  122. package/dist/hub/server/hub-server-options.d.ts +55 -0
  123. package/dist/hub/server/hub-server-transport.d.ts +34 -0
  124. package/dist/hub/server/hub-session-records.d.ts +8 -0
  125. package/dist/hub/server/hub-websocket-server.d.ts +6 -0
  126. package/dist/hub/server/index.d.ts +4 -0
  127. package/dist/hub/server/native-transport.d.ts +16 -0
  128. package/dist/index.d.ts +102 -0
  129. package/dist/index.js +715 -0
  130. package/dist/runtime/capabilities/index.d.ts +2 -0
  131. package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
  132. package/dist/runtime/capabilities/runtime-capabilities.d.ts +6 -0
  133. package/dist/runtime/config/agent-message-codec.d.ts +6 -0
  134. package/dist/runtime/config/agent-runtime-config-builder.d.ts +87 -0
  135. package/dist/runtime/host/history.d.ts +18 -0
  136. package/dist/runtime/host/host.d.ts +7 -0
  137. package/dist/runtime/host/local/agent-event-bridge.d.ts +29 -0
  138. package/dist/runtime/host/local/session-record.d.ts +6 -0
  139. package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
  140. package/dist/runtime/host/local/spawn-tool.d.ts +15 -0
  141. package/dist/runtime/host/local/user-files.d.ts +1 -0
  142. package/dist/runtime/host/local-runtime-host.d.ts +119 -0
  143. package/dist/runtime/host/runtime-host-support.d.ts +20 -0
  144. package/dist/runtime/host/runtime-host.d.ts +163 -0
  145. package/dist/runtime/orchestration/runtime-builder.d.ts +6 -0
  146. package/dist/runtime/orchestration/runtime-event-adapter.d.ts +101 -0
  147. package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +30 -0
  148. package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +218 -0
  149. package/dist/runtime/orchestration/session-runtime.d.ts +58 -0
  150. package/dist/runtime/orchestration/user-input-builder.d.ts +15 -0
  151. package/dist/runtime/safety/loop-detection.d.ts +58 -0
  152. package/dist/runtime/safety/mistake-tracker.d.ts +68 -0
  153. package/dist/runtime/safety/rules.d.ts +6 -0
  154. package/dist/runtime/tools/subprocess-sandbox.d.ts +43 -0
  155. package/dist/runtime/tools/tool-approval.d.ts +9 -0
  156. package/dist/runtime/turn-queue/pending-prompt-service.d.ts +64 -0
  157. package/dist/services/agent-events.d.ts +33 -0
  158. package/dist/services/config.d.ts +2 -0
  159. package/dist/services/global-settings.d.ts +34 -0
  160. package/dist/services/llms/cline-recommended-models.d.ts +19 -0
  161. package/dist/services/llms/configured-provider-registry.d.ts +27 -0
  162. package/dist/services/llms/handler-factory.d.ts +3 -0
  163. package/dist/services/llms/provider-defaults.d.ts +28 -0
  164. package/dist/services/llms/provider-settings.d.ts +247 -0
  165. package/dist/services/llms/runtime-config.d.ts +3 -0
  166. package/dist/services/llms/runtime-registry.d.ts +19 -0
  167. package/dist/services/llms/runtime-types.d.ts +84 -0
  168. package/dist/services/local-runtime-bootstrap.d.ts +45 -0
  169. package/dist/services/plugin-tools.d.ts +15 -0
  170. package/dist/services/providers/local-provider-registry.d.ts +218 -0
  171. package/dist/services/providers/local-provider-service.d.ts +99 -0
  172. package/dist/services/providers/model-source.d.ts +3 -0
  173. package/dist/services/session-artifacts.d.ts +17 -0
  174. package/dist/services/session-data.d.ts +51 -0
  175. package/dist/services/session-telemetry.d.ts +15 -0
  176. package/dist/services/storage/file-team-store.d.ts +28 -0
  177. package/dist/services/storage/provider-settings-legacy-migration.d.ts +38 -0
  178. package/dist/services/storage/provider-settings-manager.d.ts +23 -0
  179. package/dist/services/storage/sqlite-session-store.d.ts +30 -0
  180. package/dist/services/storage/sqlite-team-store.d.ts +34 -0
  181. package/dist/services/storage/team-store.d.ts +15 -0
  182. package/dist/services/telemetry/ITelemetryAdapter.d.ts +54 -0
  183. package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +43 -0
  184. package/dist/services/telemetry/OpenTelemetryProvider.d.ts +83 -0
  185. package/dist/services/telemetry/TelemetryLoggerSink.d.ts +27 -0
  186. package/dist/services/telemetry/TelemetryService.d.ts +34 -0
  187. package/dist/services/telemetry/core-events.d.ts +198 -0
  188. package/dist/services/telemetry/distinct-id.d.ts +1 -0
  189. package/dist/services/telemetry/index.d.ts +3 -0
  190. package/dist/services/telemetry/index.js +1 -0
  191. package/dist/services/usage.d.ts +18 -0
  192. package/dist/services/workspace/file-indexer.d.ts +5 -0
  193. package/dist/services/workspace/index.d.ts +4 -0
  194. package/dist/services/workspace/mention-enricher.d.ts +13 -0
  195. package/dist/services/workspace/workspace-manager.d.ts +27 -0
  196. package/dist/services/workspace/workspace-manifest.d.ts +31 -0
  197. package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
  198. package/dist/session/checkpoint-restore.d.ts +20 -0
  199. package/dist/session/models/session-graph.d.ts +15 -0
  200. package/dist/session/models/session-manifest.d.ts +29 -0
  201. package/dist/session/models/session-row.d.ts +92 -0
  202. package/dist/session/services/file-session-service.d.ts +8 -0
  203. package/dist/session/services/message-builder.d.ts +66 -0
  204. package/dist/session/services/persistence-service.d.ts +58 -0
  205. package/dist/session/services/session-service.d.ts +13 -0
  206. package/dist/session/session-snapshot.d.ts +57 -0
  207. package/dist/session/session-versioning-service.d.ts +48 -0
  208. package/dist/session/stores/conversation-store.d.ts +29 -0
  209. package/dist/session/stores/session-manifest-store.d.ts +21 -0
  210. package/dist/session/stores/team-persistence-store.d.ts +23 -0
  211. package/dist/session/team/index.d.ts +2 -0
  212. package/dist/session/team/team-child-session-manager.d.ts +35 -0
  213. package/dist/session/team/team-session-coordinator.d.ts +13 -0
  214. package/dist/settings/index.d.ts +2 -0
  215. package/dist/settings/settings-service.d.ts +6 -0
  216. package/dist/settings/types.d.ts +42 -0
  217. package/dist/types/chat-schema.d.ts +161 -0
  218. package/dist/types/common.d.ts +19 -0
  219. package/dist/types/config.d.ts +167 -0
  220. package/dist/types/events.d.ts +89 -0
  221. package/dist/types/provider-settings.d.ts +19 -0
  222. package/dist/types/session.d.ts +116 -0
  223. package/dist/types/sessions.d.ts +28 -0
  224. package/dist/types/storage.d.ts +36 -0
  225. package/dist/types.d.ts +32 -0
  226. package/dist/version.d.ts +1 -0
  227. package/package.json +83 -0
@@ -0,0 +1,167 @@
1
+ import type { ModelInfo } from "@cline/llms";
2
+ import type { AgentConfig, AgentHooks, AgentMode, AgentTool, BasicLogger, ConsecutiveMistakeLimitContext, ConsecutiveMistakeLimitDecision, ExtensionContext, HookErrorMode, ITelemetryService, MessageWithMetadata, SessionExecutionConfig, SessionPromptConfig, SessionWorkspaceConfig } from "@cline/shared";
3
+ import type { ToolRoutingRule } from "../extensions/tools/model-tool-routing";
4
+ import type { TeamEvent } from "../extensions/tools/team";
5
+ import type { ProviderConfig } from "./provider-settings";
6
+ export type CoreAgentMode = AgentMode;
7
+ export interface CoreModelConfig {
8
+ providerId: string;
9
+ modelId: string;
10
+ apiKey?: string;
11
+ baseUrl?: string;
12
+ headers?: Record<string, string>;
13
+ providerConfig?: ProviderConfig;
14
+ knownModels?: Record<string, ModelInfo>;
15
+ /**
16
+ * Request model-side thinking/reasoning when supported.
17
+ */
18
+ thinking?: boolean;
19
+ /**
20
+ * Explicit reasoning effort override for capable models.
21
+ */
22
+ reasoningEffort?: ProviderConfig["reasoningEffort"];
23
+ }
24
+ export interface CoreRuntimeFeatures {
25
+ enableTools: boolean;
26
+ enableSpawnAgent: boolean;
27
+ enableAgentTeams: boolean;
28
+ disableMcpSettingsTools?: boolean;
29
+ yolo?: boolean;
30
+ }
31
+ export interface CoreCompactionContext {
32
+ agentId: string;
33
+ conversationId: string;
34
+ parentAgentId: string | null;
35
+ iteration: number;
36
+ messages: MessageWithMetadata[];
37
+ model: {
38
+ id: string;
39
+ provider: string;
40
+ info?: ModelInfo;
41
+ };
42
+ contextWindowTokens: number;
43
+ triggerTokens: number;
44
+ thresholdRatio: number;
45
+ utilizationRatio: number;
46
+ }
47
+ export interface CoreCompactionResult {
48
+ messages: MessageWithMetadata[];
49
+ }
50
+ export interface CoreCompactionSummarizerConfig {
51
+ providerId: string;
52
+ modelId: string;
53
+ apiKey?: string;
54
+ baseUrl?: string;
55
+ headers?: Record<string, string>;
56
+ knownModels?: Record<string, ModelInfo>;
57
+ providerConfig?: ProviderConfig;
58
+ maxOutputTokens?: number;
59
+ }
60
+ export type CoreCompactionStrategy = "basic" | "agentic";
61
+ export interface CoreCompactionConfig {
62
+ enabled?: boolean;
63
+ strategy?: CoreCompactionStrategy;
64
+ thresholdRatio?: number;
65
+ reserveTokens?: number;
66
+ preserveRecentTokens?: number;
67
+ contextWindowTokens?: number;
68
+ summarizer?: CoreCompactionSummarizerConfig;
69
+ compact?: (context: CoreCompactionContext) => Promise<CoreCompactionResult | undefined> | CoreCompactionResult | undefined;
70
+ }
71
+ /**
72
+ * Context passed to a custom `createCheckpoint` implementation.
73
+ */
74
+ export interface CoreCheckpointContext {
75
+ /** Absolute path to the working directory of the session. */
76
+ cwd: string;
77
+ /** The session identifier. */
78
+ sessionId: string;
79
+ /** Monotonically increasing run counter for this session (starts at 1). */
80
+ runCount: number;
81
+ }
82
+ /**
83
+ * Configuration for the built-in git-based checkpoint feature.
84
+ *
85
+ * Checkpoints capture a restorable snapshot of the workspace at the start of
86
+ * each root-agent run so that changes made during a session can be rolled back.
87
+ *
88
+ * @example Disable checkpoints entirely:
89
+ * ```ts
90
+ * checkpoint: { enabled: false }
91
+ * ```
92
+ *
93
+ * @example Bring your own checkpoint implementation:
94
+ * ```ts
95
+ * checkpoint: {
96
+ * createCheckpoint: async ({ cwd, sessionId, runCount }) => {
97
+ * const ref = await mySnapshotFn(cwd);
98
+ * return { ref, createdAt: Date.now(), runCount };
99
+ * },
100
+ * }
101
+ * ```
102
+ */
103
+ export interface CoreCheckpointConfig {
104
+ /**
105
+ * Whether to create checkpoints on each root-agent run start.
106
+ * Defaults to `false` — checkpoints are **opt-in**. Set to `true` to
107
+ * enable the built-in git stash/ref checkpoint behaviour for this session.
108
+ */
109
+ enabled?: boolean;
110
+ /**
111
+ * Replace the built-in git stash/ref checkpoint logic with a custom
112
+ * implementation. Called once at the start of each root-agent run (before
113
+ * the first agent iteration).
114
+ *
115
+ * Return an object with at least `ref`, `createdAt`, and `runCount` to have
116
+ * the entry recorded in session metadata, or return `undefined` to skip
117
+ * writing a checkpoint for that run.
118
+ */
119
+ createCheckpoint?: (context: CoreCheckpointContext) => Promise<{
120
+ ref: string;
121
+ createdAt: number;
122
+ runCount: number;
123
+ kind?: "stash" | "commit";
124
+ } | undefined> | {
125
+ ref: string;
126
+ createdAt: number;
127
+ runCount: number;
128
+ kind?: "stash" | "commit";
129
+ } | undefined;
130
+ }
131
+ export interface CoreSessionConfig extends CoreModelConfig, CoreRuntimeFeatures, Omit<SessionWorkspaceConfig, "workspaceRoot">, Omit<SessionPromptConfig, "systemPrompt">, Omit<SessionExecutionConfig, "enableTools" | "teamName" | "missionLogIntervalSteps" | "missionLogIntervalMs" | "maxConsecutiveMistakes"> {
132
+ /**
133
+ * Core/hub runtime session identifier.
134
+ *
135
+ * When provided, this becomes the host-owned id for persistence, hub
136
+ * subscriptions, send/abort/stop commands, and approval routing. When
137
+ * omitted, the runtime host creates one. This is distinct from the agent
138
+ * conversation id, which is generated by the conversation store for
139
+ * transcript/tool/hook context.
140
+ */
141
+ sessionId?: string;
142
+ workspaceRoot?: string;
143
+ systemPrompt: string;
144
+ teamName?: string;
145
+ missionLogIntervalSteps?: number;
146
+ missionLogIntervalMs?: number;
147
+ hooks?: AgentHooks;
148
+ hookErrorMode?: HookErrorMode;
149
+ logger?: BasicLogger;
150
+ telemetry?: ITelemetryService;
151
+ extensionContext?: ExtensionContext;
152
+ extraTools?: AgentTool[];
153
+ pluginPaths?: string[];
154
+ extensions?: AgentConfig["extensions"];
155
+ execution?: AgentConfig["execution"];
156
+ compaction?: CoreCompactionConfig;
157
+ checkpoint?: CoreCheckpointConfig;
158
+ onTeamEvent?: (event: TeamEvent) => void;
159
+ onConsecutiveMistakeLimitReached?: (context: ConsecutiveMistakeLimitContext) => Promise<ConsecutiveMistakeLimitDecision> | ConsecutiveMistakeLimitDecision;
160
+ toolRoutingRules?: ToolRoutingRule[];
161
+ /**
162
+ * Optional skill allowlist for the `skills` tool. When provided, only these
163
+ * skills are surfaced in tool metadata and invocable by name.
164
+ */
165
+ skills?: string[];
166
+ workspaceMetadata?: string;
167
+ }
@@ -0,0 +1,89 @@
1
+ import type { CoreSessionSnapshot } from "../session/session-snapshot";
2
+ export interface SessionChunkEvent {
3
+ sessionId: string;
4
+ stream: "stdout" | "stderr" | "agent";
5
+ chunk: string;
6
+ ts: number;
7
+ }
8
+ export interface SessionEndedEvent {
9
+ sessionId: string;
10
+ reason: string;
11
+ ts: number;
12
+ }
13
+ export interface SessionToolEvent {
14
+ sessionId: string;
15
+ hookEventName: "tool_call" | "tool_result" | "agent_end" | "agent_error" | "session_shutdown";
16
+ agentId?: string;
17
+ conversationId?: string;
18
+ parentAgentId?: string;
19
+ iteration?: number;
20
+ toolName?: string;
21
+ inputTokens?: number;
22
+ outputTokens?: number;
23
+ ts?: string;
24
+ }
25
+ export interface SessionTeamProgressEvent {
26
+ sessionId: string;
27
+ teamName: string;
28
+ lifecycle: import("@cline/shared").TeamProgressLifecycleEvent;
29
+ summary: import("@cline/shared").TeamProgressSummary;
30
+ }
31
+ export interface SessionPendingPrompt {
32
+ id: string;
33
+ prompt: string;
34
+ delivery: "queue" | "steer";
35
+ attachmentCount: number;
36
+ }
37
+ export interface SessionPendingPromptsEvent {
38
+ sessionId: string;
39
+ prompts: SessionPendingPrompt[];
40
+ }
41
+ export interface SessionPendingPromptSubmittedEvent {
42
+ sessionId: string;
43
+ id: string;
44
+ prompt: string;
45
+ delivery: "queue" | "steer";
46
+ attachmentCount: number;
47
+ }
48
+ export interface SessionSnapshotEvent {
49
+ sessionId: string;
50
+ snapshot: CoreSessionSnapshot;
51
+ }
52
+ export type CoreSessionEvent = {
53
+ type: "chunk";
54
+ payload: SessionChunkEvent;
55
+ } | {
56
+ type: "agent_event";
57
+ payload: {
58
+ sessionId: string;
59
+ event: import("@cline/shared").AgentEvent;
60
+ /** Identifies the named agent within the team (e.g. "educator", "assessor", "coordinator") for both lead and teammate agents */
61
+ teamAgentId?: string;
62
+ /** Whether this is the lead agent or a teammate */
63
+ teamRole?: "lead" | "teammate";
64
+ };
65
+ } | {
66
+ type: "team_progress";
67
+ payload: SessionTeamProgressEvent;
68
+ } | {
69
+ type: "pending_prompts";
70
+ payload: SessionPendingPromptsEvent;
71
+ } | {
72
+ type: "pending_prompt_submitted";
73
+ payload: SessionPendingPromptSubmittedEvent;
74
+ } | {
75
+ type: "session_snapshot";
76
+ payload: SessionSnapshotEvent;
77
+ } | {
78
+ type: "ended";
79
+ payload: SessionEndedEvent;
80
+ } | {
81
+ type: "hook";
82
+ payload: SessionToolEvent;
83
+ } | {
84
+ type: "status";
85
+ payload: {
86
+ sessionId: string;
87
+ status: string;
88
+ };
89
+ };
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { type ProviderClient, type ProviderConfig, type ProviderProtocol, type ProviderSettings, type ToProviderConfigOptions, toProviderConfig } from "../services/llms/provider-settings";
3
+ export type { ProviderClient, ProviderConfig, ProviderProtocol, ProviderSettings, ToProviderConfigOptions, };
4
+ export declare const ProviderSettingsSchemaTyped: z.ZodType<ProviderSettings>;
5
+ export { toProviderConfig };
6
+ export type ProviderTokenSource = "manual" | "oauth" | "migration";
7
+ export interface StoredProviderSettingsEntry {
8
+ settings: ProviderSettings;
9
+ updatedAt: string;
10
+ tokenSource: ProviderTokenSource;
11
+ }
12
+ export interface StoredProviderSettings {
13
+ version: 1;
14
+ lastUsedProvider?: string;
15
+ providers: Record<string, StoredProviderSettingsEntry>;
16
+ }
17
+ export declare const StoredProviderSettingsEntrySchema: z.ZodType<StoredProviderSettingsEntry>;
18
+ export declare const StoredProviderSettingsSchema: z.ZodType<StoredProviderSettings>;
19
+ export declare function emptyStoredProviderSettings(): StoredProviderSettings;
@@ -0,0 +1,116 @@
1
+ import type * as LlmsProviders from "@cline/llms";
2
+ import type { SessionAccumulatedUsage } from "../runtime/host/runtime-host";
3
+ import type { BuiltRuntime } from "../runtime/orchestration/session-runtime";
4
+ import type { SessionRuntime } from "../runtime/orchestration/session-runtime-orchestrator";
5
+ import type { SessionRow } from "../session/models/session-row";
6
+ import type { RootSessionArtifacts } from "../session/services/session-service";
7
+ import type { SessionSource, SessionStatus } from "./common";
8
+ import type { CoreSessionConfig } from "./config";
9
+ export type ActiveSession = {
10
+ sessionId: string;
11
+ config: CoreSessionConfig;
12
+ sessionMetadata?: Record<string, unknown>;
13
+ artifacts?: RootSessionArtifacts;
14
+ source: SessionSource;
15
+ startedAt: string;
16
+ updatedAt: string;
17
+ status: SessionStatus;
18
+ endedAt?: string | null;
19
+ exitCode?: number | null;
20
+ pendingPrompt?: string;
21
+ runtime: BuiltRuntime;
22
+ agent: SessionRuntime;
23
+ started: boolean;
24
+ aborting: boolean;
25
+ interactive: boolean;
26
+ persistedMessages?: LlmsProviders.MessageWithMetadata[];
27
+ activeTeamRunIds: Set<string>;
28
+ pendingTeamRunUpdates: TeamRunUpdate[];
29
+ teamRunWaiters: Array<() => void>;
30
+ pendingPrompts: PendingPrompt[];
31
+ drainingPendingPrompts: boolean;
32
+ pluginSandboxShutdown?: () => Promise<void>;
33
+ turnUsageBaseline?: SessionAccumulatedUsage;
34
+ /**
35
+ * Set to `true` once the assistant successfully invoked the canonical
36
+ * completion tool (`submit_and_exit`) for this session. Used to:
37
+ *
38
+ * 1. Emit `task.completed` exactly once at the moment the assistant
39
+ * declares completion (parity with original Cline's
40
+ * `attempt_completion`).
41
+ * 2. Suppress the fallback `task.completed` emission from
42
+ * `shutdownSession(...)` so the same logical completion is not
43
+ * reported twice.
44
+ *
45
+ * Non-interactive sessions that finish without ever calling the
46
+ * completion tool still receive a `task.completed` from the shutdown
47
+ * fallback.
48
+ */
49
+ submitAndExitObserved: boolean;
50
+ };
51
+ export type PendingPrompt = {
52
+ id: string;
53
+ prompt: string;
54
+ delivery: "queue" | "steer";
55
+ userImages?: string[];
56
+ userFiles?: string[];
57
+ };
58
+ export type TeamRunUpdate = {
59
+ runId: string;
60
+ agentId: string;
61
+ taskId?: string;
62
+ status: "completed" | "failed" | "cancelled" | "interrupted";
63
+ error?: string;
64
+ iterations?: number;
65
+ };
66
+ export type StoredMessageWithMetadata = LlmsProviders.MessageWithMetadata;
67
+ export type PreparedTurnInput = {
68
+ prompt: string;
69
+ userImages?: string[];
70
+ userFiles?: string[];
71
+ };
72
+ export interface PersistedSessionUpdateInput {
73
+ sessionId: string;
74
+ expectedStatusLock?: number;
75
+ status?: SessionStatus;
76
+ endedAt?: string | null;
77
+ exitCode?: number | null;
78
+ prompt?: string | null;
79
+ metadata?: Record<string, unknown> | null;
80
+ title?: string | null;
81
+ parentSessionId?: string | null;
82
+ parentAgentId?: string | null;
83
+ agentId?: string | null;
84
+ conversationId?: string | null;
85
+ setRunning?: boolean;
86
+ }
87
+ export interface SessionPersistenceAdapter {
88
+ ensureSessionsDir(): string;
89
+ upsertSession(row: SessionRow): Promise<void>;
90
+ getSession(sessionId: string): Promise<SessionRow | undefined>;
91
+ listSessions(options: {
92
+ limit: number;
93
+ parentSessionId?: string;
94
+ status?: string;
95
+ }): Promise<SessionRow[]>;
96
+ updateSession(input: PersistedSessionUpdateInput): Promise<{
97
+ updated: boolean;
98
+ statusLock: number;
99
+ }>;
100
+ deleteSession(sessionId: string, cascade: boolean): Promise<boolean>;
101
+ enqueueSpawnRequest(input: {
102
+ rootSessionId: string;
103
+ parentAgentId: string;
104
+ task?: string;
105
+ systemPrompt?: string;
106
+ }): Promise<void>;
107
+ claimSpawnRequest(rootSessionId: string, parentAgentId: string): Promise<string | undefined>;
108
+ }
109
+ export interface SessionMessagesArtifactUploader {
110
+ uploadMessagesFile(input: {
111
+ sessionId: string;
112
+ path: string;
113
+ contents: string;
114
+ row?: SessionRow;
115
+ }): Promise<void>;
116
+ }
@@ -0,0 +1,28 @@
1
+ import type { SessionLineage, SessionRuntimeRecordShape } from "@cline/shared";
2
+ import type { SessionSource, SessionStatus } from "./common";
3
+ export interface SessionRef extends SessionLineage {
4
+ sessionId: string;
5
+ }
6
+ export interface SessionRecord extends SessionRef, Omit<SessionRuntimeRecordShape, "source" | "status"> {
7
+ source: SessionSource;
8
+ status: SessionStatus;
9
+ }
10
+ export interface SessionHistoryMetadata extends Record<string, unknown> {
11
+ title?: string;
12
+ totalCost?: number;
13
+ checkpoint?: {
14
+ latest?: {
15
+ ref?: string;
16
+ createdAt?: number;
17
+ runCount?: number;
18
+ };
19
+ history?: Array<{
20
+ ref?: string;
21
+ createdAt?: number;
22
+ runCount?: number;
23
+ }>;
24
+ };
25
+ }
26
+ export interface SessionHistoryRecord extends Omit<SessionRecord, "metadata"> {
27
+ metadata?: SessionHistoryMetadata;
28
+ }
@@ -0,0 +1,36 @@
1
+ import type { TeamRuntimeState, TeamTeammateSpec } from "@cline/shared";
2
+ import type { TeamEvent } from "../extensions/tools/team";
3
+ import type { SessionStatus } from "./common";
4
+ import type { SessionRecord } from "./sessions";
5
+ export interface SessionStore {
6
+ init(): Promise<void> | void;
7
+ create(record: SessionRecord): Promise<void> | void;
8
+ updateStatus(sessionId: string, status: SessionStatus, exitCode?: number | null): Promise<void> | void;
9
+ update(record: Partial<SessionRecord> & {
10
+ sessionId: string;
11
+ }): Promise<void> | void;
12
+ get(sessionId: string): Promise<SessionRecord | undefined> | SessionRecord | undefined;
13
+ list(limit?: number): Promise<SessionRecord[]> | SessionRecord[];
14
+ delete(sessionId: string, cascade?: boolean): Promise<boolean> | boolean;
15
+ }
16
+ export interface TeamStore {
17
+ listTeamNames(): Promise<string[]> | string[];
18
+ readState(teamName: string): Promise<TeamRuntimeState | undefined> | TeamRuntimeState | undefined;
19
+ readHistory(teamName: string, limit?: number): Promise<unknown[]> | unknown[];
20
+ loadRuntime(teamName: string): Promise<{
21
+ state?: TeamRuntimeState;
22
+ teammates: TeamTeammateSpec[];
23
+ interruptedRunIds: string[];
24
+ }> | {
25
+ state?: TeamRuntimeState;
26
+ teammates: TeamTeammateSpec[];
27
+ interruptedRunIds: string[];
28
+ };
29
+ handleTeamEvent(teamName: string, event: TeamEvent): Promise<void> | void;
30
+ persistRuntime(teamName: string, state: TeamRuntimeState, teammates: TeamTeammateSpec[]): Promise<void> | void;
31
+ markInProgressRunsInterrupted(teamName: string, reason: string): Promise<string[]> | string[];
32
+ }
33
+ export interface ArtifactStore {
34
+ appendHook(sessionId: string, payload: unknown): Promise<void> | void;
35
+ writeMessages(sessionId: string, messages: unknown[]): Promise<void> | void;
36
+ }
@@ -0,0 +1,32 @@
1
+ export type { AgentRunResult, AgentRunStatus, WorkspaceInfo, WorkspaceManifest, } from "@cline/shared";
2
+ export { ClineCore } from "./ClineCore";
3
+ export type { ClineCoreListHistoryOptions, ClineCoreOptions, ClineCoreStartInput, HubOptions, RemoteOptions, } from "./cline-core/types";
4
+ export type { LoadAgentPluginFromPathOptions, ResolveAgentPluginPathsOptions, } from "./extensions";
5
+ export { discoverPluginModulePaths, loadAgentPluginFromPath, loadAgentPluginsFromPaths, resolveAgentPluginPaths, resolveAndLoadAgentPlugins, resolvePluginConfigSearchPaths, } from "./extensions";
6
+ export type { CreateInstructionWatcherOptions, CreateRulesConfigDefinitionOptions, CreateSkillsConfigDefinitionOptions, CreateUserInstructionConfigServiceOptions, CreateWorkflowsConfigDefinitionOptions, ParseMarkdownFrontmatterResult, RuleConfig, SkillConfig, UnifiedConfigDefinition, UnifiedConfigFileCandidate, UnifiedConfigFileContext, UnifiedConfigRecord, UnifiedConfigWatcherEvent, UnifiedConfigWatcherOptions, UserInstructionConfig, UserInstructionConfigRecord, UserInstructionConfigService, UserInstructionConfigType, WorkflowConfig, } from "./extensions/config";
7
+ export { createRulesConfigDefinition, createSkillsConfigDefinition, createUserInstructionConfigService, createWorkflowsConfigDefinition, parseRuleConfigFromMarkdown, parseSkillConfigFromMarkdown, parseWorkflowConfigFromMarkdown, RULES_CONFIG_DIRECTORY_NAME, resolveRulesConfigSearchPaths, resolveSkillsConfigSearchPaths, resolveWorkflowsConfigSearchPaths, SKILLS_CONFIG_DIRECTORY_NAME, UnifiedConfigFileWatcher, WORKFLOWS_CONFIG_DIRECTORY_NAME, } from "./extensions/config";
8
+ export type { BuiltinToolAvailabilityContext, ToolCatalogEntry, } from "./extensions/tools";
9
+ export { getCoreAcpToolNames, getCoreBuiltinToolCatalog, getCoreDefaultEnabledToolIds, getCoreHeadlessToolNames, resolveCoreSelectedToolIds, TEAM_TOOL_NAMES, } from "./extensions/tools";
10
+ export type { RuntimeCapabilities } from "./runtime/capabilities";
11
+ export type { SessionBackend } from "./runtime/host/host";
12
+ export type { PendingPromptMutationResult, PendingPromptsDeleteInput, PendingPromptsListInput, PendingPromptsRuntimeService, PendingPromptsServiceApi, PendingPromptsUpdateInput, RuntimeHost, RuntimeHost as SessionHost, RuntimeHostMode, SendSessionInput, SessionAccumulatedUsage, StartSessionInput, StartSessionResult, } from "./runtime/host/runtime-host";
13
+ export type { BuiltRuntime as RuntimeEnvironment, RuntimeBuilder, RuntimeBuilderInput, SessionRuntime, } from "./runtime/orchestration/session-runtime";
14
+ export type { SandboxCallOptions, SubprocessSandboxOptions, } from "./runtime/tools/subprocess-sandbox";
15
+ export { SubprocessSandbox } from "./runtime/tools/subprocess-sandbox";
16
+ export type { GlobalSettings } from "./services/global-settings";
17
+ export { filterDisabledPluginPaths, filterDisabledTools, filterExtensionToolRegistrations, GlobalSettingsSchema, isPluginDisabledGlobally, isTelemetryOptedOutGlobally, isToolDisabledGlobally, readGlobalSettings, resolveDisabledPluginPaths, resolveDisabledToolNames, setDisabledPlugin, setDisabledTools, setTelemetryOptOutGlobally, toggleDisabledTool, writeGlobalSettings, } from "./services/global-settings";
18
+ export type { PluginToolSummary } from "./services/plugin-tools";
19
+ export { listPluginTools } from "./services/plugin-tools";
20
+ export type { WorkspaceManager, WorkspaceManagerEvent, } from "./services/workspace/workspace-manager";
21
+ export type { SessionManifest } from "./session/models/session-manifest";
22
+ export type { SessionRow } from "./session/models/session-row";
23
+ export type { CreateRootSessionWithArtifactsInput, RootSessionArtifacts, } from "./session/services/session-service";
24
+ export type { CoreSessionCheckpointSnapshot, CoreSessionSnapshot, } from "./session/session-snapshot";
25
+ export type { SessionCheckpointRestoreContext, SessionCheckpointRestoreResult, SessionVersioningErrorCode, } from "./session/session-versioning-service";
26
+ export type { ChatMessage, ChatSessionConfig, ChatSessionStatus, ChatSummary, ChatViewState, } from "./types/chat-schema";
27
+ export type { SessionSource, SessionStatus } from "./types/common";
28
+ export type { CoreAgentMode, CoreModelConfig, CoreRuntimeFeatures, CoreSessionConfig, } from "./types/config";
29
+ export type { CoreSessionEvent, SessionChunkEvent, SessionEndedEvent, SessionPendingPrompt, SessionPendingPromptSubmittedEvent, SessionPendingPromptsEvent, SessionTeamProgressEvent, SessionToolEvent, } from "./types/events";
30
+ export type { SessionMessagesArtifactUploader } from "./types/session";
31
+ export type { SessionHistoryMetadata, SessionHistoryRecord, SessionRecord, SessionRef, } from "./types/sessions";
32
+ export type { ArtifactStore, SessionStore, TeamStore } from "./types/storage";
@@ -0,0 +1 @@
1
+ export declare const CORE_BUILD_VERSION: string;
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@cline/core",
3
+ "description": "Cline Core SDK for Node Runtime",
4
+ "version": "0.0.38-nightly.1778113663",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/cline/sdk",
8
+ "directory": "packages/core"
9
+ },
10
+ "type": "module",
11
+ "types": "./dist/index.d.ts",
12
+ "main": "./dist/index.js",
13
+ "private": false,
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "development": "./src/index.ts",
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./hub": {
24
+ "development": "./src/hub/index.ts",
25
+ "types": "./dist/hub/index.d.ts",
26
+ "import": "./dist/hub/index.js"
27
+ },
28
+ "./hub/daemon-entry": {
29
+ "development": "./src/hub/daemon/entry.ts",
30
+ "types": "./dist/hub/daemon/entry.d.ts",
31
+ "import": "./dist/hub/daemon/entry.js"
32
+ },
33
+ "./telemetry": {
34
+ "development": "./src/services/telemetry/index.ts",
35
+ "types": "./dist/services/telemetry/index.d.ts",
36
+ "import": "./dist/services/telemetry/index.js"
37
+ }
38
+ },
39
+ "scripts": {
40
+ "build": "rm -rf dist && bun run ./bun.mts && bun tsc -p tsconfig.build.json",
41
+ "clean": "rm -rf dist node_modules",
42
+ "typecheck": "bun tsc -p tsconfig.dev.json --noEmit && bun run typecheck:smoke",
43
+ "typecheck:smoke": "bun tsc -p tsconfig.smoke.json --noEmit",
44
+ "test": "bun run test:unit && bun run test:e2e",
45
+ "test:unit": "vitest run --config vitest.config.ts",
46
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
47
+ "verify:routines": "zsh -lc 'bunx vitest run src/cron/schedule-service.test.ts --config vitest.config.ts'",
48
+ "test:watch": "vitest --config vitest.config.ts"
49
+ },
50
+ "dependencies": {
51
+ "@cline/agents": "0.0.38-nightly.1778113663",
52
+ "@cline/shared": "0.0.38-nightly.1778113663",
53
+ "@cline/llms": "0.0.38-nightly.1778113663",
54
+ "@opentelemetry/api": "^1.9.0",
55
+ "@opentelemetry/api-logs": "^0.214.0",
56
+ "@opentelemetry/exporter-logs-otlp-http": "^0.214.0",
57
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.214.0",
58
+ "@opentelemetry/exporter-trace-otlp-http": "^0.214.0",
59
+ "@opentelemetry/resources": "^2.6.1",
60
+ "@opentelemetry/sdk-logs": "^0.214.0",
61
+ "@opentelemetry/sdk-metrics": "^2.6.1",
62
+ "@opentelemetry/sdk-trace-base": "^2.6.1",
63
+ "@opentelemetry/sdk-trace-node": "^2.6.1",
64
+ "@opentelemetry/semantic-conventions": "^1.40.0",
65
+ "jiti": "^1.21.7",
66
+ "node-machine-id": "^1.1.12",
67
+ "nanoid": "^5.1.7",
68
+ "simple-git": "^3.32.3",
69
+ "ws": "^8.20.0",
70
+ "yaml": "^2.8.2",
71
+ "zod": "^4.3.6"
72
+ },
73
+ "devDependencies": {
74
+ "@types/ws": "^8.18.1"
75
+ },
76
+ "engines": {
77
+ "node": ">=22"
78
+ },
79
+ "files": [
80
+ "dist",
81
+ "!dist/**/*.d.ts.map"
82
+ ]
83
+ }