@cline/core 0.0.81 → 0.0.82

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 (43) hide show
  1. package/dist/cron/runner/cron-runner.d.ts +14 -1
  2. package/dist/cron/service/schedule-service.d.ts +9 -1
  3. package/dist/cron/specs/cron-reconciler.d.ts +1 -1
  4. package/dist/cron/store/sqlite-cron-store.d.ts +17 -0
  5. package/dist/extensions/mcp/client.d.ts +1 -0
  6. package/dist/extensions/tools/executors/line-endings.d.ts +14 -2
  7. package/dist/extensions/tools/team/multi-agent.d.ts +7 -0
  8. package/dist/hub/client/index.d.ts +20 -3
  9. package/dist/hub/client/managed-hub-build-watcher.d.ts +8 -0
  10. package/dist/hub/client/session-client.d.ts +6 -1
  11. package/dist/hub/client/ui-client.d.ts +6 -1
  12. package/dist/hub/daemon/entry.js +297 -223
  13. package/dist/hub/daemon/index.d.ts +72 -0
  14. package/dist/hub/index.js +286 -212
  15. package/dist/hub/server/command-transport.d.ts +6 -0
  16. package/dist/hub/server/handlers/context.d.ts +2 -0
  17. package/dist/hub/server/handlers/session-handlers.d.ts +1 -0
  18. package/dist/hub/server/hub-server-options.d.ts +3 -0
  19. package/dist/hub/server/hub-server-transport.d.ts +1 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.js +289 -215
  22. package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +1 -0
  23. package/dist/services/global-settings.d.ts +2 -2
  24. package/dist/services/providers/local-provider-service.d.ts +1 -1
  25. package/dist/services/providers/provider-readiness.d.ts +10 -0
  26. package/dist/services/session-import/claude-code.d.ts +16 -0
  27. package/dist/services/session-import/codex.d.ts +34 -0
  28. package/dist/services/session-import/index.d.ts +6 -0
  29. package/dist/services/session-import/opencode.d.ts +25 -0
  30. package/dist/services/session-import/sanitize.d.ts +16 -0
  31. package/dist/services/session-import/service.d.ts +31 -0
  32. package/dist/services/session-import/types.d.ts +87 -0
  33. package/dist/services/workspace/agent-schedules-workspace.d.ts +8 -0
  34. package/dist/services/workspace/index.d.ts +1 -0
  35. package/dist/session/models/session-manifest.d.ts +1 -1
  36. package/dist/session/models/session-row.d.ts +10 -0
  37. package/dist/session/search/index.d.ts +1 -0
  38. package/dist/session/search/session-history-search.d.ts +51 -0
  39. package/dist/session/services/persistence-service.d.ts +10 -0
  40. package/dist/tasks/agenda-task-tool.d.ts +1 -1
  41. package/dist/tasks/task-tool.d.ts +3 -3
  42. package/dist/types/chat-schema.d.ts +2 -2
  43. package/package.json +4 -4
@@ -1,8 +1,21 @@
1
1
  import type { BasicLogger } from "@cline/shared";
2
2
  import type { ResolveCronSpecsDirOptions } from "@cline/shared/storage";
3
3
  import type { HubScheduleRuntimeHandlers } from "../service/schedule-service";
4
- import type { CronRunRecord, SqliteCronStore } from "../store/sqlite-cron-store";
4
+ import type { CronRunRecord, CronSpecRecord, SqliteCronStore } from "../store/sqlite-cron-store";
5
5
  import type { CronMaterializer } from "./cron-materializer";
6
+ /**
7
+ * Session metadata keys that identify the automation run a session belongs
8
+ * to. Clients (e.g. the desktop sidebar) read these to group a schedule's
9
+ * runs together and label each one, so they are part of the session
10
+ * metadata contract; keep them in sync with the readers.
11
+ */
12
+ export declare const RUN_SESSION_METADATA_KEYS: {
13
+ readonly scheduleId: "scheduleId";
14
+ readonly scheduleName: "scheduleName";
15
+ readonly scheduleExecutionId: "scheduleExecutionId";
16
+ readonly scheduleRunNumber: "scheduleRunNumber";
17
+ };
18
+ export declare function buildRunSessionMetadata(spec: Pick<CronSpecRecord, "externalId" | "title">, run: Pick<CronRunRecord, "runId">, runNumber: number | undefined): Record<string, unknown>;
6
19
  export interface CronRunnerOptions {
7
20
  store: SqliteCronStore;
8
21
  materializer: CronMaterializer;
@@ -22,8 +22,16 @@ type HubScheduleTurnResult = {
22
22
  durationMs?: number;
23
23
  }>;
24
24
  };
25
+ export interface HubScheduleStartSessionOptions {
26
+ /**
27
+ * Provenance the runner knows about the automation run that is starting
28
+ * this session (schedule id/name, run id, run number). Handlers merge it
29
+ * into the session metadata so clients can group runs by schedule.
30
+ */
31
+ sessionMetadata?: Record<string, unknown>;
32
+ }
25
33
  export interface HubScheduleRuntimeHandlers {
26
- startSession(request: ChatStartSessionRequest): Promise<{
34
+ startSession(request: ChatStartSessionRequest, options?: HubScheduleStartSessionOptions): Promise<{
27
35
  sessionId: string;
28
36
  startResult?: ChatStartSessionArtifacts;
29
37
  }>;
@@ -1,6 +1,6 @@
1
1
  import type { CronSpecParseResult } from "@cline/shared";
2
2
  import { type ResolveCronSpecsDirOptions } from "@cline/shared/storage";
3
- import type { CronSpecRecord, SqliteCronStore, UpsertSpecResult } from "../store/sqlite-cron-store";
3
+ import { type CronSpecRecord, type SqliteCronStore, type UpsertSpecResult } from "../store/sqlite-cron-store";
4
4
  /**
5
5
  * Scan the configured cron specs directory on disk, parse every file, and
6
6
  * upsert spec state into the cron DB. This is the startup source of truth:
@@ -106,6 +106,15 @@ export interface UpsertSpecResult {
106
106
  export interface SqliteCronStoreOptions {
107
107
  dbPath?: string;
108
108
  }
109
+ /**
110
+ * DB-native hub schedules (created via the schedule tools/UI) live only in
111
+ * cron.db under a virtual sourcePath that never exists on disk. File-backed
112
+ * specs can spoof `source: hub-schedule` in frontmatter — even inside a
113
+ * physical `hub/schedules/` directory — but reconciliation always records
114
+ * their source file's mtime, which DB-native rows never have. All three
115
+ * markers are required to identify a DB-native hub schedule.
116
+ */
117
+ export declare function isHubManagedSpec(spec: Pick<CronSpecRecord, "source" | "sourcePath" | "sourceMtimeMs">): boolean;
109
118
  export interface ListSpecsOptions {
110
119
  triggerKind?: CronTriggerKind;
111
120
  enabled?: boolean;
@@ -189,6 +198,14 @@ export declare class SqliteCronStore {
189
198
  nowMs: number;
190
199
  }): MaterializeScheduleRunResult;
191
200
  getRun(runId: string): CronRunRecord | undefined;
201
+ /**
202
+ * 1-based position of a run among every run ever created for its spec,
203
+ * in creation order. Counts runs of every status (including cancelled and
204
+ * failed ones) so the number is stable: a later cancellation never shifts
205
+ * the numbers already stamped onto earlier sessions. Returns undefined
206
+ * for an unknown run.
207
+ */
208
+ getRunOrdinal(runId: string): number | undefined;
192
209
  insertEventLog(event: AutomationEventEnvelope, options?: {
193
210
  receivedAtIso?: string;
194
211
  }): InsertEventLogResult;
@@ -1,6 +1,7 @@
1
1
  import type { FetchLike } from "@modelcontextprotocol/sdk/shared/transport.js";
2
2
  import type { McpServerClientFactory } from "./types";
3
3
  export declare const DEFAULT_MCP_CONNECT_TIMEOUT_MS = 3000;
4
+ export declare const DEFAULT_HTTP_MCP_CONNECT_TIMEOUT_MS = 10000;
4
5
  export interface DefaultMcpServerClientFactoryOptions {
5
6
  settingsPath?: string;
6
7
  clientName?: string;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Line-ending normalization for files created from scratch, shared by the
3
- * file-writing executors (editor, apply_patch). Internal to the executors.
2
+ * Line-ending helpers shared by the file-writing executors (editor,
3
+ * apply_patch). Internal to the executors.
4
4
  *
5
5
  * Models emit LF-only text (reads strip "\r", so they never see a file's
6
6
  * CRLF endings). Existing files keep their own detected EOL, but a new file
@@ -9,3 +9,15 @@
9
9
  * (github.com/cline/cline/issues/13504). No-op on LF platforms.
10
10
  */
11
11
  export declare function normalizeNewFileLineEndings(content: string): string;
12
+ export type LineEnding = "\r\n" | "\n";
13
+ /**
14
+ * Returns "\r\n" if "\r\n" appears anywhere in the content, otherwise "\n" —
15
+ * including for content with no line breaks at all. Files are uniformly CRLF
16
+ * or uniformly LF in practice; the mixed case that matters is a CRLF file
17
+ * with LF-only lines inserted by earlier releases of these tools, and any
18
+ * surviving "\r\n" — wherever it sits — should pull such a file back to
19
+ * CRLF, which is why this checks for "\r\n" anywhere rather than looking at
20
+ * the first line break.
21
+ */
22
+ export declare function detectLineEnding(content: string): LineEnding;
23
+ export declare function normalizeLineEndings(text: string, eol: LineEnding): string;
@@ -20,6 +20,7 @@ export interface TaskResult {
20
20
  error?: Error;
21
21
  metadata?: Record<string, unknown>;
22
22
  }
23
+ type TeamTaskEndStatus = "completed" | "failed" | "cancelled";
23
24
  export type TeamEvent = {
24
25
  type: TeamMessageType.TaskStart;
25
26
  agentId: string;
@@ -27,6 +28,7 @@ export type TeamEvent = {
27
28
  } | {
28
29
  type: TeamMessageType.TaskEnd;
29
30
  agentId: string;
31
+ status?: TeamTaskEndStatus;
30
32
  result?: AgentResult;
31
33
  error?: Error;
32
34
  messages?: AgentResult["messages"];
@@ -202,6 +204,11 @@ export declare class AgentTeamsRuntime {
202
204
  getRun(runId: string): TeamRunRecord | undefined;
203
205
  awaitRun(runId: string, pollIntervalMs?: number): Promise<TeamRunRecord>;
204
206
  awaitAllRuns(pollIntervalMs?: number): Promise<TeamRunRecord[]>;
207
+ /**
208
+ * Cancel work owned by this team runtime without removing teammate or
209
+ * conversation state. Used when the owning lead session is aborted.
210
+ */
211
+ cancelOutstandingWork(reason?: unknown): void;
205
212
  cancelRun(runId: string, reason?: string): TeamRunRecord;
206
213
  recoverActiveRuns(reason?: string): TeamRunRecord[];
207
214
  markStaleRunsInterrupted(reason?: string): TeamRunRecord[];
@@ -91,10 +91,17 @@ export declare class NodeHubClient {
91
91
  }
92
92
  export declare function normalizeHubWebSocketUrl(url: string): string;
93
93
  export declare function verifyHubConnection(url: string, options?: Pick<HubClientOptions, "workspaceRoot" | "cwd" | "authToken">): Promise<boolean>;
94
+ export interface HubSessionActivity {
95
+ /** Sessions with at least one live participant attached. */
96
+ activeSessionCount: number;
97
+ /** Distinct client ids attached to those sessions. */
98
+ participantClientCount: number;
99
+ }
94
100
  /**
95
- * Whether any client is attached to a session on the hub - the one signal
96
- * that cannot go stale, because participants are live socket subscriptions
97
- * the hub drops the moment a client's connection closes.
101
+ * Summarize live activity from a `session.list` payload. A session counts as
102
+ * active only while a client is attached to it - the one signal that cannot
103
+ * go stale, because participants are live socket subscriptions the hub drops
104
+ * the moment a client's connection closes.
98
105
  *
99
106
  * Deliberately NOT based on session status: a client that dies without
100
107
  * stopping its session leaves the hub-side runtime behind in a non-terminal
@@ -104,7 +111,17 @@ export declare function verifyHubConnection(url: string, options?: Pick<HubClien
104
111
  * exact moment of a hub swap dies with the old hub - rare, and its next
105
112
  * scheduled tick runs normally on the replacement.
106
113
  */
114
+ export declare function summarizeHubSessionActivity(payload: unknown): HubSessionActivity;
107
115
  export declare function hasActiveHubSessions(payload: unknown): boolean;
116
+ /**
117
+ * Ask a hub how much live work it is serving. Throws when the hub cannot
118
+ * answer (unreachable, auth rejected, or too old to serve `session.list`),
119
+ * because the safe default points in opposite directions per caller: a
120
+ * replacement path treats an unanswerable hub as idle and retires it, while
121
+ * a recovery path treats it as busy and leaves it alone. Callers pick their
122
+ * own fallback instead of inheriting a hidden one.
123
+ */
124
+ export declare function queryHubSessionActivity(url: string, authToken?: string, options?: Pick<HubClientOptions, "workspaceRoot" | "cwd">): Promise<HubSessionActivity>;
108
125
  export declare function localHubHasNoActiveSessions(url: string, authToken?: string, options?: Pick<HubClientOptions, "workspaceRoot" | "cwd">): Promise<boolean>;
109
126
  export declare function resolveCompatibleLocalHubUrl(options?: LocalHubResolutionOptions): Promise<string | undefined>;
110
127
  export declare function ensureCompatibleLocalHubUrl(options?: LocalHubResolutionOptions): Promise<string | undefined>;
@@ -17,6 +17,14 @@ export interface ManagedHubBuildMismatchEvent {
17
17
  hubCoreVersion?: string;
18
18
  /** Build identity this client expects a managed Hub to match. */
19
19
  expectedBuildId: string;
20
+ /**
21
+ * Sessions with live participants on the Hub (best-effort, `outdated_hub`
22
+ * only): the work that replacing the Hub would interrupt. Unset when the
23
+ * Hub cannot answer the query.
24
+ */
25
+ activeSessionCount?: number;
26
+ /** Distinct clients attached to those sessions (best-effort, `outdated_hub` only). */
27
+ participantClientCount?: number;
20
28
  }
21
29
  /**
22
30
  * Probe the managed local Hub once and report whether a live Hub is running
@@ -1,5 +1,5 @@
1
1
  import type * as LlmsProviders from "@cline/llms";
2
- import type { AgendaAutomationPolicy, AgendaTaskListInput, AgendaTaskRecord, AgendaTaskRunRecord, ChatRunTurnRequest, ChatStartSessionRequest, ChatStartSessionResponse, ChatTurnResult, HubTaskCreateInput, HubTaskUpdateInput, TeamProgressProjectionEvent } from "@cline/shared";
2
+ import type { AgendaAutomationPolicy, AgendaTaskListInput, AgendaTaskRecord, AgendaTaskRunRecord, ChatRunTurnRequest, ChatStartSessionRequest, ChatStartSessionResponse, ChatTurnResult, HubSessionSearchHit, HubTaskCreateInput, HubTaskUpdateInput, TeamProgressProjectionEvent } from "@cline/shared";
3
3
  import type { CheckpointEntry } from "../../hooks/checkpoint-hooks";
4
4
  type ScheduleClientRecord = Record<string, unknown> & {
5
5
  metadata?: Record<string, unknown>;
@@ -89,6 +89,11 @@ export declare class HubSessionClient {
89
89
  listSessions(input?: {
90
90
  limit?: number;
91
91
  }): Promise<HubSessionRow[]>;
92
+ searchSessions(input: {
93
+ query: string;
94
+ limit?: number;
95
+ workspaceRoot?: string;
96
+ }): Promise<HubSessionSearchHit[]>;
92
97
  deleteSession(sessionId: string, deleteCheckpointRefs?: boolean): Promise<boolean>;
93
98
  respondToolApproval(input: {
94
99
  approvalId: string;
@@ -1,4 +1,4 @@
1
- import type { HubClientRecord, HubUINotifyPayload, HubUIShowWindowPayload, SessionRecord } from "@cline/shared";
1
+ import type { HubClientRecord, HubSessionSearchHit, HubUINotifyPayload, HubUIShowWindowPayload, SessionRecord } from "@cline/shared";
2
2
  import type { CoreSettingsMutationResult, CoreSettingsToggleInput } from "../../settings";
3
3
  export interface HubUIClientOptions {
4
4
  address: string;
@@ -30,6 +30,11 @@ export declare class HubUIClient {
30
30
  sendShowWindow(payload?: HubUIShowWindowPayload): Promise<void>;
31
31
  listClients(): Promise<HubClientRecord[]>;
32
32
  listSessions(limit?: number): Promise<SessionRecord[]>;
33
+ searchSessions(input: {
34
+ query: string;
35
+ limit?: number;
36
+ workspaceRoot?: string;
37
+ }): Promise<HubSessionSearchHit[]>;
33
38
  toggleSetting(input: CoreSettingsToggleInput): Promise<CoreSettingsMutationResult>;
34
39
  /**
35
40
  * Subscribe to UI-relevant hub events.