@clinebot/core 0.0.36 → 0.0.37

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 (228) hide show
  1. package/dist/ClineCore.d.ts +312 -3
  2. package/dist/ClineCore.d.ts.map +1 -1
  3. package/dist/account/cline-account-service.d.ts.map +1 -1
  4. package/dist/cron/cron-event-ingress.d.ts +38 -0
  5. package/dist/cron/cron-event-ingress.d.ts.map +1 -0
  6. package/dist/cron/cron-materializer.d.ts +36 -0
  7. package/dist/cron/cron-materializer.d.ts.map +1 -0
  8. package/dist/cron/cron-reconciler.d.ts +62 -0
  9. package/dist/cron/cron-reconciler.d.ts.map +1 -0
  10. package/dist/cron/cron-report-writer.d.ts +41 -0
  11. package/dist/cron/cron-report-writer.d.ts.map +1 -0
  12. package/dist/cron/cron-runner.d.ts +43 -0
  13. package/dist/cron/cron-runner.d.ts.map +1 -0
  14. package/dist/cron/cron-schema.d.ts +3 -0
  15. package/dist/cron/cron-schema.d.ts.map +1 -0
  16. package/dist/cron/cron-service.d.ts +57 -0
  17. package/dist/cron/cron-service.d.ts.map +1 -0
  18. package/dist/cron/cron-spec-parser.d.ts +27 -0
  19. package/dist/cron/cron-spec-parser.d.ts.map +1 -0
  20. package/dist/cron/cron-watcher.d.ts +23 -0
  21. package/dist/cron/cron-watcher.d.ts.map +1 -0
  22. package/dist/cron/scheduler.d.ts +3 -1
  23. package/dist/cron/scheduler.d.ts.map +1 -1
  24. package/dist/cron/sqlite-cron-store.d.ts +230 -0
  25. package/dist/cron/sqlite-cron-store.d.ts.map +1 -0
  26. package/dist/extensions/plugin/plugin-config-loader.d.ts +7 -1
  27. package/dist/extensions/plugin/plugin-config-loader.d.ts.map +1 -1
  28. package/dist/extensions/plugin/plugin-loader.d.ts +10 -6
  29. package/dist/extensions/plugin/plugin-loader.d.ts.map +1 -1
  30. package/dist/extensions/plugin/plugin-sandbox.d.ts +7 -1
  31. package/dist/extensions/plugin/plugin-sandbox.d.ts.map +1 -1
  32. package/dist/extensions/plugin-sandbox-bootstrap.js +236 -275
  33. package/dist/extensions/tools/constants.d.ts +1 -0
  34. package/dist/extensions/tools/constants.d.ts.map +1 -1
  35. package/dist/extensions/tools/definitions.d.ts +2 -3
  36. package/dist/extensions/tools/definitions.d.ts.map +1 -1
  37. package/dist/extensions/tools/executors/editor.d.ts.map +1 -1
  38. package/dist/extensions/tools/helpers.d.ts +1 -0
  39. package/dist/extensions/tools/helpers.d.ts.map +1 -1
  40. package/dist/extensions/tools/index.d.ts +1 -2
  41. package/dist/extensions/tools/index.d.ts.map +1 -1
  42. package/dist/extensions/tools/presets.d.ts +1 -1
  43. package/dist/extensions/tools/schemas.d.ts +25 -3
  44. package/dist/extensions/tools/schemas.d.ts.map +1 -1
  45. package/dist/extensions/tools/team/delegated-agent.d.ts +2 -2
  46. package/dist/extensions/tools/team/delegated-agent.d.ts.map +1 -1
  47. package/dist/extensions/tools/team/multi-agent.d.ts +7 -3
  48. package/dist/extensions/tools/team/multi-agent.d.ts.map +1 -1
  49. package/dist/extensions/tools/team/team-tools.d.ts.map +1 -1
  50. package/dist/extensions/tools/types.d.ts +0 -5
  51. package/dist/extensions/tools/types.d.ts.map +1 -1
  52. package/dist/hooks/hook-bridge.d.ts +118 -0
  53. package/dist/hooks/hook-bridge.d.ts.map +1 -0
  54. package/dist/hooks/hook-file-hooks.d.ts +2 -1
  55. package/dist/hooks/hook-file-hooks.d.ts.map +1 -1
  56. package/dist/hooks/hook-registry.d.ts +16 -0
  57. package/dist/hooks/hook-registry.d.ts.map +1 -0
  58. package/dist/hub/browser-websocket.d.ts.map +1 -1
  59. package/dist/hub/client.d.ts +7 -1
  60. package/dist/hub/client.d.ts.map +1 -1
  61. package/dist/hub/daemon-entry.js +721 -461
  62. package/dist/hub/daemon.d.ts.map +1 -1
  63. package/dist/hub/defaults.d.ts +8 -4
  64. package/dist/hub/defaults.d.ts.map +1 -1
  65. package/dist/hub/index.js +665 -415
  66. package/dist/hub/runtime-handlers.d.ts.map +1 -1
  67. package/dist/hub/server.d.ts +18 -0
  68. package/dist/hub/server.d.ts.map +1 -1
  69. package/dist/hub/session-client.d.ts +3 -0
  70. package/dist/hub/session-client.d.ts.map +1 -1
  71. package/dist/hub/start-shared-server.d.ts.map +1 -1
  72. package/dist/hub/ui-client.d.ts +1 -0
  73. package/dist/hub/ui-client.d.ts.map +1 -1
  74. package/dist/index.d.ts +9 -7
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +756 -467
  77. package/dist/llms/cline-recommended-models.d.ts +20 -0
  78. package/dist/llms/cline-recommended-models.d.ts.map +1 -0
  79. package/dist/llms/handler-factory.d.ts +16 -0
  80. package/dist/llms/handler-factory.d.ts.map +1 -0
  81. package/dist/llms/provider-defaults.d.ts.map +1 -1
  82. package/dist/llms/provider-settings.d.ts +45 -2
  83. package/dist/llms/provider-settings.d.ts.map +1 -1
  84. package/dist/llms/runtime-registry.d.ts.map +1 -1
  85. package/dist/runtime/agent-config-adapter.d.ts +148 -0
  86. package/dist/runtime/agent-config-adapter.d.ts.map +1 -0
  87. package/dist/runtime/agent-runtime-config-builder.d.ts +96 -0
  88. package/dist/runtime/agent-runtime-config-builder.d.ts.map +1 -0
  89. package/dist/runtime/history.d.ts +6 -0
  90. package/dist/runtime/history.d.ts.map +1 -1
  91. package/dist/runtime/host.d.ts.map +1 -1
  92. package/dist/runtime/loop-detection.d.ts +59 -0
  93. package/dist/runtime/loop-detection.d.ts.map +1 -0
  94. package/dist/runtime/mistake-tracker.d.ts +69 -0
  95. package/dist/runtime/mistake-tracker.d.ts.map +1 -0
  96. package/dist/runtime/runtime-builder.d.ts.map +1 -1
  97. package/dist/runtime/runtime-event-adapter.d.ts +102 -0
  98. package/dist/runtime/runtime-event-adapter.d.ts.map +1 -0
  99. package/dist/runtime/runtime-host.d.ts +28 -3
  100. package/dist/runtime/runtime-host.d.ts.map +1 -1
  101. package/dist/runtime/session-runtime-orchestrator.d.ts +261 -0
  102. package/dist/runtime/session-runtime-orchestrator.d.ts.map +1 -0
  103. package/dist/runtime/session-runtime.d.ts +16 -3
  104. package/dist/runtime/session-runtime.d.ts.map +1 -1
  105. package/dist/runtime/user-input-builder.d.ts +24 -0
  106. package/dist/runtime/user-input-builder.d.ts.map +1 -0
  107. package/dist/services/index.js +28 -0
  108. package/dist/services/local-runtime-bootstrap.d.ts.map +1 -1
  109. package/dist/services/plugin-tools.d.ts.map +1 -1
  110. package/dist/services/providers/local-provider-registry.d.ts +197 -21
  111. package/dist/services/providers/local-provider-registry.d.ts.map +1 -1
  112. package/dist/services/providers/local-provider-service.d.ts +3 -1
  113. package/dist/services/providers/local-provider-service.d.ts.map +1 -1
  114. package/dist/services/session-data.d.ts.map +1 -1
  115. package/dist/services/session-telemetry.d.ts +7 -2
  116. package/dist/services/session-telemetry.d.ts.map +1 -1
  117. package/dist/services/storage/file-team-store.d.ts.map +1 -1
  118. package/dist/services/storage/provider-settings-legacy-migration.d.ts.map +1 -1
  119. package/dist/services/storage/provider-settings-manager.d.ts +1 -0
  120. package/dist/services/storage/provider-settings-manager.d.ts.map +1 -1
  121. package/dist/services/storage/sqlite-team-store.d.ts.map +1 -1
  122. package/dist/session/conversation-store.d.ts +30 -0
  123. package/dist/session/conversation-store.d.ts.map +1 -0
  124. package/dist/session/message-builder.d.ts +65 -0
  125. package/dist/session/message-builder.d.ts.map +1 -0
  126. package/dist/session/session-manifest.d.ts +1 -1
  127. package/dist/transports/hub.d.ts +14 -3
  128. package/dist/transports/hub.d.ts.map +1 -1
  129. package/dist/transports/local.d.ts +14 -4
  130. package/dist/transports/local.d.ts.map +1 -1
  131. package/dist/transports/remote.d.ts.map +1 -1
  132. package/dist/types/chat-schema.d.ts +5 -5
  133. package/dist/types/config.d.ts +9 -0
  134. package/dist/types/config.d.ts.map +1 -1
  135. package/dist/types/events.d.ts +7 -6
  136. package/dist/types/events.d.ts.map +1 -1
  137. package/dist/types/provider-settings.d.ts +2 -2
  138. package/dist/types/provider-settings.d.ts.map +1 -1
  139. package/dist/types/session.d.ts +5 -2
  140. package/dist/types/session.d.ts.map +1 -1
  141. package/dist/types.d.ts +4 -4
  142. package/dist/types.d.ts.map +1 -1
  143. package/package.json +4 -4
  144. package/src/ClineCore.ts +691 -6
  145. package/src/account/cline-account-service.ts +44 -6
  146. package/src/cron/cron-event-ingress.ts +357 -0
  147. package/src/cron/cron-materializer.ts +97 -0
  148. package/src/cron/cron-reconciler.ts +241 -0
  149. package/src/cron/cron-report-writer.ts +153 -0
  150. package/src/cron/cron-runner.ts +495 -0
  151. package/src/cron/cron-schema.ts +127 -0
  152. package/src/cron/cron-service.ts +163 -0
  153. package/src/cron/cron-spec-parser.ts +489 -0
  154. package/src/cron/cron-watcher.ts +102 -0
  155. package/src/cron/index.ts +10 -0
  156. package/src/cron/scheduler.ts +141 -6
  157. package/src/cron/sqlite-cron-store.ts +1286 -0
  158. package/src/extensions/plugin/plugin-config-loader.ts +21 -1
  159. package/src/extensions/plugin/plugin-loader.ts +25 -9
  160. package/src/extensions/plugin/plugin-sandbox-bootstrap.ts +151 -1
  161. package/src/extensions/plugin/plugin-sandbox.ts +131 -7
  162. package/src/extensions/tools/constants.ts +2 -0
  163. package/src/extensions/tools/definitions.ts +31 -22
  164. package/src/extensions/tools/executors/editor.ts +4 -3
  165. package/src/extensions/tools/helpers.ts +24 -0
  166. package/src/extensions/tools/index.ts +1 -2
  167. package/src/extensions/tools/presets.ts +1 -1
  168. package/src/extensions/tools/schemas.ts +13 -18
  169. package/src/extensions/tools/team/delegated-agent.ts +8 -3
  170. package/src/extensions/tools/team/multi-agent.ts +135 -19
  171. package/src/extensions/tools/team/team-tools.ts +151 -91
  172. package/src/extensions/tools/types.ts +0 -6
  173. package/src/hooks/hook-bridge.ts +489 -0
  174. package/src/hooks/hook-file-hooks.ts +58 -3
  175. package/src/hooks/hook-registry.ts +257 -0
  176. package/src/hub/browser-websocket.ts +26 -4
  177. package/src/hub/client.ts +72 -13
  178. package/src/hub/daemon-entry.ts +35 -0
  179. package/src/hub/daemon.ts +117 -14
  180. package/src/hub/defaults.ts +39 -12
  181. package/src/hub/runtime-handlers.ts +4 -3
  182. package/src/hub/server.ts +506 -77
  183. package/src/hub/session-client.ts +43 -1
  184. package/src/hub/start-shared-server.ts +3 -0
  185. package/src/hub/ui-client.ts +4 -0
  186. package/src/index.ts +46 -1
  187. package/src/llms/cline-recommended-models.ts +167 -0
  188. package/src/llms/handler-factory.ts +56 -0
  189. package/src/llms/provider-defaults.ts +17 -1
  190. package/src/llms/provider-settings.ts +48 -1
  191. package/src/llms/runtime-registry.ts +1 -0
  192. package/src/runtime/agent-config-adapter.ts +636 -0
  193. package/src/runtime/agent-runtime-config-builder.ts +205 -0
  194. package/src/runtime/error-feedback.ts +142 -0
  195. package/src/runtime/history.ts +137 -0
  196. package/src/runtime/host.ts +22 -0
  197. package/src/runtime/loop-detection.ts +162 -0
  198. package/src/runtime/mistake-tracker.ts +221 -0
  199. package/src/runtime/runtime-builder.ts +61 -5
  200. package/src/runtime/runtime-event-adapter.ts +412 -0
  201. package/src/runtime/runtime-host.ts +45 -1
  202. package/src/runtime/session-runtime-orchestrator.ts +1253 -0
  203. package/src/runtime/session-runtime.ts +16 -2
  204. package/src/runtime/user-input-builder.ts +167 -0
  205. package/src/services/local-runtime-bootstrap.ts +128 -22
  206. package/src/services/plugin-tools.ts +1 -0
  207. package/src/services/providers/local-provider-registry.ts +273 -57
  208. package/src/services/providers/local-provider-service.ts +67 -7
  209. package/src/services/session-data.ts +16 -14
  210. package/src/services/session-telemetry.ts +6 -15
  211. package/src/services/storage/file-team-store.ts +1 -5
  212. package/src/services/storage/provider-settings-legacy-migration.ts +8 -47
  213. package/src/services/storage/provider-settings-manager.ts +16 -1
  214. package/src/services/storage/sqlite-team-store.ts +1 -5
  215. package/src/session/conversation-store.ts +77 -0
  216. package/src/session/message-builder.ts +941 -0
  217. package/src/transports/hub.ts +458 -33
  218. package/src/transports/local.ts +296 -65
  219. package/src/transports/remote.ts +1 -0
  220. package/src/types/config.ts +9 -0
  221. package/src/types/events.ts +8 -6
  222. package/src/types/index.ts +3 -0
  223. package/src/types/provider-settings.ts +8 -1
  224. package/src/types/session.ts +5 -2
  225. package/src/types.ts +15 -1
  226. package/dist/cron/index.d.ts +0 -6
  227. package/dist/cron/index.d.ts.map +0 -1
  228. package/dist/services/telemetry/index.js +0 -28
@@ -1,10 +1,14 @@
1
1
  import type { AgentConfig, BasicLogger, ITelemetryService, ToolApprovalRequest, ToolApprovalResult } from "@clinebot/shared";
2
+ import type { CronEventSuppression } from "./cron/cron-event-ingress";
3
+ import type { CronEventLogRecord, CronRunRecord, CronSpecRecord } from "./cron/sqlite-cron-store";
2
4
  import type { ToolExecutors } from "./extensions/tools";
5
+ import type { SessionHistoryListOptions } from "./runtime/history";
3
6
  import type { SessionBackend } from "./runtime/host";
4
- import type { LocalRuntimeStartOptions, RuntimeHost, RuntimeHostMode, RuntimeHostSubscribeOptions, StartSessionInput, StartSessionResult } from "./runtime/runtime-host";
7
+ import type { LocalRuntimeStartOptions, PendingPromptMutationResult, PendingPromptsDeleteInput, PendingPromptsListInput, PendingPromptsUpdateInput, RuntimeHost, RuntimeHostMode, RuntimeHostSubscribeOptions, StartSessionInput, StartSessionResult } from "./runtime/runtime-host";
5
8
  import type { CoreSessionConfig } from "./types/config";
6
- import type { CoreSessionEvent } from "./types/events";
9
+ import type { CoreSessionEvent, SessionPendingPrompt } from "./types/events";
7
10
  import type { SessionMessagesArtifactUploader } from "./types/session";
11
+ import type { SessionHistoryRecord } from "./types/sessions";
8
12
  export interface HubOptions {
9
13
  endpoint?: string;
10
14
  authToken?: string;
@@ -22,7 +26,63 @@ export interface RemoteOptions {
22
26
  workspaceRoot?: string;
23
27
  cwd?: string;
24
28
  }
29
+ export interface ClineCoreAutomationOptions {
30
+ /** @deprecated Use `cronSpecsDir`. */
31
+ cronDir?: string;
32
+ cronSpecsDir?: string;
33
+ /** @deprecated Reports are written under the resolved cron specs directory. */
34
+ reportsDir?: string;
35
+ cronScope?: "global" | "user" | "workspace";
36
+ workspaceRoot?: string;
37
+ dbPath?: string;
38
+ pollIntervalMs?: number;
39
+ claimLeaseSeconds?: number;
40
+ globalMaxConcurrency?: number;
41
+ watcherDebounceMs?: number;
42
+ autoStart?: boolean;
43
+ }
44
+ export type ClineAutomationSpec = CronSpecRecord;
45
+ export type ClineAutomationRun = CronRunRecord;
46
+ export type ClineAutomationEventLog = CronEventLogRecord;
47
+ export type ClineAutomationEventSuppression = CronEventSuppression;
48
+ export type ClineAutomationRunStatus = "queued" | "running" | "done" | "failed" | "cancelled";
49
+ export interface ClineAutomationListSpecsOptions {
50
+ triggerKind?: "one_off" | "schedule" | "event";
51
+ enabled?: boolean;
52
+ parseStatus?: "valid" | "invalid";
53
+ includeRemoved?: boolean;
54
+ limit?: number;
55
+ }
56
+ export interface ClineAutomationListRunsOptions {
57
+ specId?: string;
58
+ status?: ClineAutomationRunStatus | ClineAutomationRunStatus[];
59
+ limit?: number;
60
+ }
61
+ export interface ClineAutomationListEventsOptions {
62
+ eventType?: string;
63
+ source?: string;
64
+ processingStatus?: "received" | "unmatched" | "queued" | "suppressed" | "failed";
65
+ limit?: number;
66
+ }
67
+ export interface ClineAutomationEventIngressResult {
68
+ event: ClineAutomationEventLog;
69
+ duplicate: boolean;
70
+ matchedSpecIds: string[];
71
+ queuedRuns: ClineAutomationRun[];
72
+ suppressions: ClineAutomationEventSuppression[];
73
+ }
74
+ export interface ClineCoreAutomationApi {
75
+ start(): Promise<void>;
76
+ stop(): Promise<void>;
77
+ reconcileNow(): Promise<void>;
78
+ ingestEvent(event: any): ClineAutomationEventIngressResult;
79
+ listEvents(options?: ClineAutomationListEventsOptions): ClineAutomationEventLog[];
80
+ getEvent(eventId: string): ClineAutomationEventLog | undefined;
81
+ listSpecs(options?: ClineAutomationListSpecsOptions): ClineAutomationSpec[];
82
+ listRuns(options?: ClineAutomationListRunsOptions): ClineAutomationRun[];
83
+ }
25
84
  export type { RuntimeHostMode };
85
+ export type ClineCoreListHistoryOptions = SessionHistoryListOptions;
26
86
  export interface ClineCoreStartInput extends Omit<StartSessionInput, "config" | "localRuntime"> {
27
87
  config: CoreSessionConfig;
28
88
  localRuntime?: LocalRuntimeStartOptions;
@@ -88,6 +148,12 @@ export interface ClineCoreOptions {
88
148
  * Consumers can use this to mirror session transcripts into remote storage.
89
149
  */
90
150
  messagesArtifactUploader?: SessionMessagesArtifactUploader;
151
+ /**
152
+ * Enables file-based and event-driven automation through this ClineCore
153
+ * instance. When configured, callers use `cline.automation.*` instead of
154
+ * constructing cron services directly.
155
+ */
156
+ automation?: boolean | ClineCoreAutomationOptions;
91
157
  /**
92
158
  * Custom `fetch` implementation forwarded to the AI gateway providers used
93
159
  * by local sessions. When supplied, it is threaded into each
@@ -140,30 +206,273 @@ export interface StartSessionBootstrap {
140
206
  export declare class ClineCore implements RuntimeHost {
141
207
  readonly clientName: string | undefined;
142
208
  readonly runtimeAddress: string | undefined;
209
+ readonly automation: ClineCoreAutomationApi;
143
210
  private readonly host;
144
211
  private readonly prepare;
145
212
  private readonly defaultToolExecutors;
213
+ private readonly logger;
214
+ private readonly telemetry;
215
+ private readonly distinctId;
216
+ private readonly automationService;
146
217
  private readonly activeSessionBootstraps;
147
218
  private readonly unsubscribeBootstrapCleanup;
148
219
  private constructor();
220
+ /**
221
+ * Creates a new ClineCore instance.
222
+ *
223
+ * This is the primary factory method for initializing the SDK. It sets up the runtime
224
+ * host (local, hub, or remote) based on the provided options and prepares the SDK for
225
+ * starting sessions.
226
+ *
227
+ * @param options Configuration options for the SDK instance
228
+ * @returns A promise that resolves to a new ClineCore instance
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * const cline = await ClineCore.create({
233
+ * clientName: "my-app",
234
+ * backendMode: "local",
235
+ * });
236
+ * ```
237
+ */
149
238
  static create(options?: ClineCoreOptions): Promise<ClineCore>;
239
+ private createAutomationRuntimeHandlers;
240
+ private createAutomationPluginContext;
241
+ private withAutomationExtensionContext;
150
242
  private disposeSessionBootstrap;
151
243
  private toClineCoreStartInput;
152
244
  private normalizeStartInput;
245
+ /**
246
+ * Starts a new Cline session with the provided configuration.
247
+ *
248
+ * This method initializes and begins a new agent session. It handles session setup,
249
+ * runs any preparation hooks, and returns session metadata along with event streams.
250
+ * The session continues to run until explicitly stopped or aborted.
251
+ *
252
+ * @param input The session configuration and startup parameters
253
+ * @returns A promise that resolves to session metadata and event stream
254
+ *
255
+ * @example
256
+ * ```ts
257
+ * const result = await cline.start({
258
+ * config: {
259
+ * providerId: "anthropic",
260
+ * modelId: "claude-opus-4-1",
261
+ * },
262
+ * });
263
+ *
264
+ * // Subscribe to session events
265
+ * result.subscribe((event) => {
266
+ * console.log("Session event:", event);
267
+ * });
268
+ * ```
269
+ */
153
270
  start(input: StartSessionInput): Promise<StartSessionResult>;
271
+ /**
272
+ * Starts a new Cline session with extended core-specific configuration.
273
+ * This overload allows specifying local runtime options and config overrides.
274
+ */
154
275
  start(input: ClineCoreStartInput): Promise<StartSessionResult>;
276
+ private emitSessionStartedTelemetry;
277
+ /**
278
+ * Sends a message or command to an active session.
279
+ *
280
+ * This method communicates with a running session, allowing you to send user messages,
281
+ * tool responses, or other session input while the session is in progress.
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * await cline.send(sessionId, {
286
+ * type: "user_message",
287
+ * text: "Please implement the login feature",
288
+ * });
289
+ * ```
290
+ */
155
291
  send: RuntimeHost["send"];
292
+ pendingPrompts(action: "list", input: PendingPromptsListInput): Promise<SessionPendingPrompt[]>;
293
+ pendingPrompts(action: "update", input: PendingPromptsUpdateInput): Promise<PendingPromptMutationResult>;
294
+ pendingPrompts(action: "delete", input: PendingPromptsDeleteInput): Promise<PendingPromptMutationResult>;
295
+ /**
296
+ * Retrieves accumulated token and cost usage for a session.
297
+ *
298
+ * Returns metrics about the session's resource consumption, including tokens used
299
+ * across different API providers and associated costs. Useful for monitoring and billing.
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * const usage = await cline.getAccumulatedUsage(sessionId);
304
+ * console.log(`Total cost: $${usage.totalCost}`);
305
+ * ```
306
+ */
156
307
  getAccumulatedUsage: RuntimeHost["getAccumulatedUsage"];
308
+ /**
309
+ * Aborts an in-flight tool execution without stopping the session.
310
+ *
311
+ * Interrupts the current tool operation (e.g., file read, shell command) while keeping
312
+ * the session alive. The session can continue processing after the abort. Use this for
313
+ * cancelling long-running operations.
314
+ *
315
+ * @example
316
+ * ```ts
317
+ * // Stop the current operation but keep the session running
318
+ * await cline.abort(sessionId);
319
+ * ```
320
+ */
157
321
  abort: RuntimeHost["abort"];
322
+ /**
323
+ * Stops an active session gracefully.
324
+ *
325
+ * Terminates the session and cleans up associated resources. Unlike abort, this
326
+ * completely ends the session. The session cannot be resumed after stopping.
327
+ *
328
+ * @example
329
+ * ```ts
330
+ * // Cleanly shutdown the session
331
+ * await cline.stop(sessionId);
332
+ * ```
333
+ */
158
334
  stop: RuntimeHost["stop"];
335
+ /**
336
+ * Disposes the ClineCore instance and all associated resources.
337
+ *
338
+ * Shuts down the runtime host, closes connections, and cleans up all active sessions
339
+ * and bootstraps. Call this when you're done using the SDK instance, typically at
340
+ * application shutdown. After calling dispose, the instance cannot be reused.
341
+ *
342
+ * @example
343
+ * ```ts
344
+ * // Clean up when done
345
+ * await cline.dispose();
346
+ * ```
347
+ */
159
348
  dispose: RuntimeHost["dispose"];
349
+ /**
350
+ * Retrieves information about a specific session by ID.
351
+ *
352
+ * Fetches the current metadata and state of a session, including configuration,
353
+ * status, and other session details.
354
+ *
355
+ * @example
356
+ * ```ts
357
+ * const session = await cline.get(sessionId);
358
+ * console.log("Session status:", session?.status);
359
+ * ```
360
+ */
160
361
  get: RuntimeHost["get"];
161
- list: RuntimeHost["list"];
362
+ /**
363
+ * Lists recent sessions through the shared history-listing path.
364
+ */
365
+ listHistory: (options?: ClineCoreListHistoryOptions) => Promise<SessionHistoryRecord[]>;
366
+ /**
367
+ * Lists recent sessions with inferred history display metadata.
368
+ *
369
+ * Retrieves a paginated list of recent sessions, optionally limited by the
370
+ * provided count.
371
+ *
372
+ * @param limit Maximum number of sessions to return (defaults to 200)
373
+ * @returns A promise resolving to an array of session history records
374
+ *
375
+ * @example
376
+ * ```ts
377
+ * const sessions = await cline.list(50);
378
+ * sessions.forEach((session) => {
379
+ * console.log(`Session ${session.sessionId}: ${session.metadata?.title}`);
380
+ * });
381
+ * ```
382
+ */
383
+ list: (limit?: number, options?: Omit<ClineCoreListHistoryOptions, "limit">) => Promise<SessionHistoryRecord[]>;
384
+ /**
385
+ * Permanently deletes a session and all its associated data.
386
+ *
387
+ * Removes the session from storage and cleans up any related resources. This is
388
+ * a destructive operation that cannot be undone.
389
+ *
390
+ * @param sessionId The ID of the session to delete
391
+ * @returns A promise that resolves to true if the session was deleted, false if not found
392
+ *
393
+ * @example
394
+ * ```ts
395
+ * const deleted = await cline.delete(sessionId);
396
+ * if (deleted) {
397
+ * console.log("Session deleted successfully");
398
+ * }
399
+ * ```
400
+ */
162
401
  delete: RuntimeHost["delete"];
402
+ /**
403
+ * Updates an existing session's metadata.
404
+ *
405
+ * Modifies session properties like title or other mutable metadata while preserving
406
+ * message history and other session data.
407
+ *
408
+ * @example
409
+ * ```ts
410
+ * await cline.update(sessionId, {
411
+ * title: "Updated session title",
412
+ * });
413
+ * ```
414
+ */
163
415
  update: RuntimeHost["update"];
416
+ /**
417
+ * Reads message history for a session.
418
+ *
419
+ * Retrieves the full message transcript for a specific session, including all
420
+ * user messages, agent responses, and tool interactions.
421
+ *
422
+ * @example
423
+ * ```ts
424
+ * const messages = await cline.readMessages(sessionId);
425
+ * messages.forEach((msg) => {
426
+ * console.log(`${msg.role}: ${msg.content}`);
427
+ * });
428
+ * ```
429
+ */
164
430
  readMessages: RuntimeHost["readMessages"];
431
+ /**
432
+ * Handles hook events from the runtime environment.
433
+ *
434
+ * Processes system or environment events (e.g., workspace changes, external signals)
435
+ * that may affect the current session. This is typically called by the host environment
436
+ * rather than directly by consumer code.
437
+ *
438
+ * @internal
439
+ */
165
440
  handleHookEvent: RuntimeHost["handleHookEvent"];
441
+ /**
442
+ * Subscribes to session events.
443
+ *
444
+ * Registers a listener for all session events (messages, state changes, errors, etc.).
445
+ * Returns an unsubscribe function to stop listening.
446
+ *
447
+ * @param listener Callback function invoked for each event
448
+ * @param options Optional configuration for the subscription
449
+ * @returns An unsubscribe function
450
+ *
451
+ * @example
452
+ * ```ts
453
+ * const unsubscribe = cline.subscribe((event) => {
454
+ * if (event.type === "message") {
455
+ * console.log("New message:", event.payload.message);
456
+ * }
457
+ * });
458
+ *
459
+ * // Later, stop listening
460
+ * unsubscribe();
461
+ * ```
462
+ */
166
463
  subscribe(listener: (event: CoreSessionEvent) => void, options?: RuntimeHostSubscribeOptions): () => void;
464
+ /**
465
+ * Updates the AI model used by an active session.
466
+ *
467
+ * Switches the session to use a different AI model while maintaining the session state
468
+ * and message history. This allows you to continue a conversation with a different model.
469
+ *
470
+ * @example
471
+ * ```ts
472
+ * // Switch to a different model mid-session
473
+ * await cline.updateSessionModel(sessionId, "claude-opus-4-1");
474
+ * ```
475
+ */
167
476
  updateSessionModel: RuntimeHost["updateSessionModel"];
168
477
  }
169
478
  //# sourceMappingURL=ClineCore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClineCore.d.ts","sourceRoot":"","sources":["../src/ClineCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,KAAK,EACX,wBAAwB,EACxB,WAAW,EACX,eAAe,EACf,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,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W,CAAC,oBAAoB,CAAC,CACS;CAC9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"cline-account-service.d.ts","sourceRoot":"","sources":["../../src/account/cline-account-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,wBAAwB,EACxB,+BAA+B,EAC/B,wCAAwC,EACxC,8BAA8B,EAC9B,4BAA4B,EAC5B,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,MAAM,SAAS,CAAC;AAUjB,MAAM,WAAW,0BAA0B;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,MAChB,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,GAClC,MAAM,GACN,SAAS,GACT,IAAI,CAAC;IACR,uBAAuB,CAAC,EAAE,CACzB,cAAc,EAAE,MAAM,KAClB,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACpE,UAAU,CAAC,EAAE,MACV,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,GAC3C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtB,SAAS,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CACzB;AAED,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6C;IAC5E,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAiD;IACpF,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAwD;IAClG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2C;IACxE,OAAO,CAAC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C,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO3D,sBAAsB,CAClC,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAQ7B,wBAAwB,CACpC,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,8BAA8B,EAAE,CAAC;IAQ/B,sBAAsB,IAAI,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAK7D,iBAAiB,CAC7B,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,CAAC;IAUhB,wBAAwB,CACpC,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC,+BAA+B,CAAC;IAU9B,kCAAkC,CAAC,KAAK,EAAE;QACtD,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,wCAAwC,EAAE,CAAC;IAkB1C,aAAa,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAU3D,aAAa;YAqBb,2BAA2B;YA6B3B,OAAO;CAuFrB"}
@@ -0,0 +1,38 @@
1
+ import type { AutomationEventEnvelope, BasicLogger } from "@clinebot/shared";
2
+ import type { CronEventLogRecord, CronRunRecord, CronSpecRecord, SqliteCronStore } from "./sqlite-cron-store";
3
+ /**
4
+ * Durable ingress for normalized automation events.
5
+ *
6
+ * This layer persists the incoming event before matching, then materializes
7
+ * queued `cron_runs` for matching event specs. It deliberately does not
8
+ * execute agents; the normal runner claim loop owns execution.
9
+ */
10
+ export interface CronEventIngressOptions {
11
+ store: SqliteCronStore;
12
+ now?: () => number;
13
+ logger?: BasicLogger;
14
+ }
15
+ export type CronEventSuppressionReason = "duplicate_event" | "filter_mismatch" | "dedupe_window" | "cooldown";
16
+ export interface CronEventSuppression {
17
+ specId?: string;
18
+ externalId?: string;
19
+ reason: CronEventSuppressionReason;
20
+ dedupeKey?: string;
21
+ }
22
+ export interface CronEventIngressResult {
23
+ event: CronEventLogRecord;
24
+ duplicate: boolean;
25
+ matchedSpecs: CronSpecRecord[];
26
+ queuedRuns: CronRunRecord[];
27
+ suppressions: CronEventSuppression[];
28
+ }
29
+ export declare function automationEventMatchesFilters(event: AutomationEventEnvelope, filters: Record<string, unknown> | undefined): boolean;
30
+ export declare class CronEventIngress {
31
+ private readonly store;
32
+ private readonly nowFn;
33
+ private readonly logger?;
34
+ constructor(options: CronEventIngressOptions);
35
+ ingestEvent(event: AutomationEventEnvelope): CronEventIngressResult;
36
+ private materializeForSpec;
37
+ }
38
+ //# sourceMappingURL=cron-event-ingress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-event-ingress.d.ts","sourceRoot":"","sources":["../../src/cron/cron-event-ingress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EACX,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,eAAe,EACf,MAAM,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AAEH,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,MAAM,0BAA0B,GACnC,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,UAAU,CAAC;AAEd,MAAM,WAAW,oBAAoB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,0BAA0B,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,YAAY,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAwHD,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,OAAO,CAKT;AAED,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAc;gBAE1B,OAAO,EAAE,uBAAuB;IAMrC,WAAW,CAAC,KAAK,EAAE,uBAAuB,GAAG,sBAAsB;IA2G1E,OAAO,CAAC,kBAAkB;CAmE1B"}
@@ -0,0 +1,36 @@
1
+ import type { CronSpecRecord, SqliteCronStore } from "./sqlite-cron-store";
2
+ /**
3
+ * Queue materialization rules shared between the reconciler, watcher, and
4
+ * periodic runner tick. Execution stays trigger-agnostic once a row is
5
+ * queued; this module is the only place that decides when to create a row.
6
+ */
7
+ export interface CronMaterializerOptions {
8
+ store: SqliteCronStore;
9
+ now?: () => number;
10
+ }
11
+ export interface MaterializeSummary {
12
+ oneOffQueued: number;
13
+ scheduleQueued: number;
14
+ }
15
+ export declare class CronMaterializer {
16
+ private readonly store;
17
+ private readonly nowFn;
18
+ constructor(options: CronMaterializerOptions);
19
+ /**
20
+ * Run materialization for every valid/enabled spec. Typically called at
21
+ * startup (after reconciliation) and on each runner tick.
22
+ */
23
+ materializeAll(): MaterializeSummary;
24
+ /**
25
+ * Ensure a single one-off spec has exactly one run record for its current
26
+ * revision unless an explicit rerun path creates a different trigger kind.
27
+ * Returns true if a new queued run was created.
28
+ */
29
+ materializeOneOff(spec: CronSpecRecord): boolean;
30
+ /**
31
+ * Materialize schedule runs. Implements the "one overdue catch-up on
32
+ * startup, then advance" policy described in PLAN.md.
33
+ */
34
+ materializeSchedule(spec: CronSpecRecord): boolean;
35
+ }
36
+ //# sourceMappingURL=cron-materializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-materializer.d.ts","sourceRoot":"","sources":["../../src/cron/cron-materializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3E;;;;GAIG;AAEH,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;gBAEzB,OAAO,EAAE,uBAAuB;IAK5C;;;OAGG;IACI,cAAc,IAAI,kBAAkB;IA+B3C;;;;OAIG;IACI,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO;IAevD;;;OAGG;IACI,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO;CAUzD"}
@@ -0,0 +1,62 @@
1
+ import type { CronSpecParseResult } from "@clinebot/shared";
2
+ import { type ResolveCronSpecsDirOptions } from "@clinebot/shared/storage";
3
+ import type { CronSpecRecord, SqliteCronStore, UpsertSpecResult } from "./sqlite-cron-store";
4
+ /**
5
+ * Scan the configured cron specs directory on disk, parse every file, and
6
+ * upsert spec state into the cron DB. This is the startup source of truth:
7
+ * watcher events are triggers to re-run reconciliation for one file, not a
8
+ * replacement.
9
+ */
10
+ export interface CronReconcilerOptions {
11
+ store: SqliteCronStore;
12
+ /**
13
+ * Cron spec source location. Defaults to global `~/.cline/cron`.
14
+ * Pass `{ scope: "workspace", workspaceRoot }` later to enable
15
+ * workspace-level cron sources without changing reconciler internals.
16
+ */
17
+ specs?: ResolveCronSpecsDirOptions;
18
+ /** @deprecated Use `specs: { scope: "workspace", workspaceRoot }`. */
19
+ workspaceRoot?: string;
20
+ }
21
+ export interface ReconcileChange {
22
+ relativePath: string;
23
+ result: UpsertSpecResult;
24
+ parse: CronSpecParseResult;
25
+ }
26
+ export interface ReconcileSummary {
27
+ scanned: number;
28
+ upserted: number;
29
+ invalidParses: number;
30
+ removed: number;
31
+ changes: ReconcileChange[];
32
+ }
33
+ export declare class CronReconciler {
34
+ private readonly store;
35
+ private readonly cronDir;
36
+ constructor(options: CronReconcilerOptions);
37
+ getCronDir(): string;
38
+ /**
39
+ * Reconcile every file under the cron specs directory into the DB and mark specs
40
+ * whose source files no longer exist as `removed=1`.
41
+ */
42
+ reconcileAll(): Promise<ReconcileSummary>;
43
+ /**
44
+ * Reconcile a single file (absolute path). `relativePath` is expected to
45
+ * be POSIX-relative to the cron specs directory. Returns the reconciliation change
46
+ * or undefined if the file could not be read.
47
+ */
48
+ reconcileFile(relativePath: string, absolutePath: string): Promise<ReconcileChange | undefined>;
49
+ /**
50
+ * Handle a file that disappeared from disk between reconciliations.
51
+ * Marks the spec as removed and cancels any queued runs for it.
52
+ */
53
+ handleFileDeleted(spec: CronSpecRecord): void;
54
+ /**
55
+ * Refresh next_run_at for every enabled schedule spec.
56
+ * Used at startup to handle the "one overdue catch-up on startup then
57
+ * advance to next slot" policy.
58
+ */
59
+ refreshScheduleNextRunAt(): void;
60
+ private applyScheduleNextRunAt;
61
+ }
62
+ //# sourceMappingURL=cron-reconciler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-reconciler.d.ts","sourceRoot":"","sources":["../../src/cron/cron-reconciler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACN,KAAK,0BAA0B,EAE/B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AAEH,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,0BAA0B,CAAC;IACnC,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC3B;AAmCD,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,qBAAqB;IAUnC,UAAU,IAAI,MAAM;IAI3B;;;OAGG;IACU,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAwCtD;;;;OAIG;IACU,aAAa,CACzB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IA2CvC;;;OAGG;IACI,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAKpD;;;;OAIG;IACI,wBAAwB,IAAI,IAAI;IAWvC,OAAO,CAAC,sBAAsB;CAqB9B"}
@@ -0,0 +1,41 @@
1
+ import { type ResolveCronSpecsDirOptions } from "@clinebot/shared/storage";
2
+ import type { CronEventLogRecord, CronRunRecord, CronSpecRecord } from "./sqlite-cron-store";
3
+ /**
4
+ * Writes a markdown report for a completed or failed cron run.
5
+ * Reports live under `<cron-specs-dir>/reports/<run-id>.md`.
6
+ * By default that is `~/.cline/cron/reports/<run-id>.md`.
7
+ * and are derived artifacts — the database is still the operational source
8
+ * of truth.
9
+ */
10
+ export interface CronRunReportData {
11
+ finalText?: string;
12
+ usage?: {
13
+ inputTokens?: number;
14
+ outputTokens?: number;
15
+ cacheReadTokens?: number;
16
+ cacheWriteTokens?: number;
17
+ totalCost?: number;
18
+ };
19
+ toolCalls?: Array<{
20
+ name: string;
21
+ error?: string;
22
+ durationMs?: number;
23
+ }>;
24
+ durationMs?: number;
25
+ error?: string;
26
+ triggerEvent?: CronEventLogRecord;
27
+ }
28
+ export interface WriteReportOptions {
29
+ /**
30
+ * Cron spec source/report location. Defaults to global `~/.cline/cron`.
31
+ * Pass `{ scope: "workspace", workspaceRoot }` to write reports beside a
32
+ * future workspace-scoped cron specs directory.
33
+ */
34
+ specs?: ResolveCronSpecsDirOptions;
35
+ workspaceRoot: string;
36
+ run: CronRunRecord;
37
+ spec: CronSpecRecord;
38
+ data: CronRunReportData;
39
+ }
40
+ export declare function writeCronRunReport(options: WriteReportOptions): string;
41
+ //# sourceMappingURL=cron-report-writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-report-writer.d.ts","sourceRoot":"","sources":["../../src/cron/cron-report-writer.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,0BAA0B,EAE/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACX,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,MAAM,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AAEH,MAAM,WAAW,iBAAiB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,0BAA0B,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,aAAa,CAAC;IACnB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,iBAAiB,CAAC;CACxB;AA+FD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAWtE"}
@@ -0,0 +1,43 @@
1
+ import type { BasicLogger } from "@clinebot/shared";
2
+ import type { ResolveCronSpecsDirOptions } from "@clinebot/shared/storage";
3
+ import type { CronMaterializer } from "./cron-materializer";
4
+ import type { HubScheduleRuntimeHandlers } from "./schedule-service";
5
+ import type { SqliteCronStore } from "./sqlite-cron-store";
6
+ export interface CronRunnerOptions {
7
+ store: SqliteCronStore;
8
+ materializer: CronMaterializer;
9
+ runtimeHandlers: HubScheduleRuntimeHandlers;
10
+ /** Default runtime workspace for the hub/daemon process. */
11
+ workspaceRoot: string;
12
+ /** Cron spec source/report location. Defaults to global `~/.cline/cron`. */
13
+ specs?: ResolveCronSpecsDirOptions;
14
+ logger?: BasicLogger;
15
+ pollIntervalMs?: number;
16
+ claimLeaseSeconds?: number;
17
+ globalMaxConcurrency?: number;
18
+ }
19
+ export declare class CronRunner {
20
+ private readonly store;
21
+ private readonly materializer;
22
+ private readonly options;
23
+ private readonly limiter;
24
+ private readonly claimLeaseMs;
25
+ private timer;
26
+ private started;
27
+ private ticking;
28
+ private disposed;
29
+ private stopping;
30
+ private readonly activeRuns;
31
+ constructor(options: CronRunnerOptions);
32
+ start(): Promise<void>;
33
+ stop(): Promise<void>;
34
+ dispose(): Promise<void>;
35
+ tick(): Promise<void>;
36
+ private executeClaim;
37
+ private buildPrompt;
38
+ private startClaimLeaseHeartbeat;
39
+ private loadRulesForSpec;
40
+ private buildSystemPrompt;
41
+ private buildStartRequest;
42
+ }
43
+ //# sourceMappingURL=cron-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-runner.d.ts","sourceRoot":"","sources":["../../src/cron/cron-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,WAAW,EAGX,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAIX,eAAe,EACf,MAAM,qBAAqB,CAAC;AAiG7B,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,eAAe,CAAC;IACvB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,eAAe,EAAE,0BAA0B,CAAC;IAC5C,4DAA4D;IAC5D,aAAa,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,0BAA0B,CAAC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmB;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAGvB;gBAEQ,OAAO,EAAE,iBAAiB;IAWzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAatB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAqBpB,YAAY;IA4I1B,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,wBAAwB;YAkBlB,gBAAgB;YAmBhB,iBAAiB;YA2BjB,iBAAiB;CAmC/B"}
@@ -0,0 +1,3 @@
1
+ import type { SqliteDb } from "@clinebot/shared/db";
2
+ export declare function ensureCronSchema(db: SqliteDb): void;
3
+ //# sourceMappingURL=cron-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-schema.d.ts","sourceRoot":"","sources":["../../src/cron/cron-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAuHpD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAOnD"}