@cerebriline/core 4.100.246 → 4.100.247

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 (116) hide show
  1. package/assets/prompt-templates/claude.md +2 -0
  2. package/assets/prompt-templates/deepseek.md +1 -0
  3. package/assets/prompt-templates/default.md +2 -1
  4. package/assets/prompt-templates/kimi-k3.md +1 -0
  5. package/assets/prompt-templates/kimi.md +1 -0
  6. package/assets/prompt-templates/minimax.md +2 -0
  7. package/assets/prompt-templates/nemotron.md +1 -0
  8. package/assets/skills/browser-automation/SKILL.md +113 -0
  9. package/dist/ClineCore.d.ts +9 -0
  10. package/dist/account/index.d.ts +1 -0
  11. package/dist/account/telemetry.d.ts +22 -0
  12. package/dist/cloud/api.d.ts +122 -0
  13. package/dist/cloud/controller.d.ts +172 -0
  14. package/dist/cloud/index.d.ts +9 -0
  15. package/dist/cloud/index.js +21 -0
  16. package/dist/cloud/models.d.ts +9 -0
  17. package/dist/cloud/repositories.d.ts +21 -0
  18. package/dist/cloud/snapshots.d.ts +22 -0
  19. package/dist/cloud/state.d.ts +13 -0
  20. package/dist/cloud/types.d.ts +84 -0
  21. package/dist/cron/events/cron-event-ingress.d.ts +4 -2
  22. package/dist/cron/runner/cron-runner.d.ts +5 -2
  23. package/dist/cron/service/cron-service.d.ts +2 -1
  24. package/dist/cron/service/schedule-service.d.ts +2 -1
  25. package/dist/cron/store/sqlite-cron-store.d.ts +7 -1
  26. package/dist/extensions/composio/composio-meta-tools.d.ts +39 -0
  27. package/dist/extensions/composio/composio-tools-extension.d.ts +13 -0
  28. package/dist/extensions/context/agentic-compaction.d.ts +1 -1
  29. package/dist/extensions/context/cap-thoughts.d.ts +39 -0
  30. package/dist/extensions/context/compaction-shared.d.ts +76 -1
  31. package/dist/extensions/context/compaction.d.ts +75 -3
  32. package/dist/extensions/mcp/client.d.ts +1 -1
  33. package/dist/extensions/tools/definitions.d.ts +5 -5
  34. package/dist/extensions/tools/executors/bash.d.ts +26 -0
  35. package/dist/extensions/tools/executors/index.d.ts +1 -1
  36. package/dist/extensions/tools/index.d.ts +1 -1
  37. package/dist/extensions/tools/task-progress.d.ts +37 -0
  38. package/dist/extensions/tools/team/index.d.ts +1 -0
  39. package/dist/extensions/tools/team/multi-agent.d.ts +48 -0
  40. package/dist/extensions/tools/team/persistence-policy.d.ts +56 -0
  41. package/dist/extensions/tools/team/runtime.d.ts +1 -1
  42. package/dist/extensions/tools/team/sanitize-team-name.d.ts +5 -0
  43. package/dist/extensions/tools/team/team-tools.d.ts +1 -1
  44. package/dist/hooks/checkpoint-hooks.d.ts +23 -1
  45. package/dist/hooks/hook-file-hooks.d.ts +27 -0
  46. package/dist/hooks/subprocess-runner.d.ts +23 -0
  47. package/dist/hooks/subprocess.d.ts +10 -0
  48. package/dist/hub/client/index.d.ts +29 -3
  49. package/dist/hub/client/session-client.d.ts +0 -3
  50. package/dist/hub/daemon/bind-diagnostics.d.ts +16 -0
  51. package/dist/hub/daemon/entry.js +689 -640
  52. package/dist/hub/daemon/index.d.ts +17 -8
  53. package/dist/hub/discovery/index.d.ts +1 -0
  54. package/dist/hub/index.js +675 -627
  55. package/dist/hub/runtime-host/hub-runtime-host.d.ts +4 -2
  56. package/dist/hub/server/handlers/session-handlers.d.ts +6 -1
  57. package/dist/index.d.ts +21 -11
  58. package/dist/index.js +1032 -964
  59. package/dist/remote/remote-environments.d.ts +155 -0
  60. package/dist/remote/remote-helper-entry.d.ts +1 -0
  61. package/dist/remote/remote-helper-entry.js +5 -0
  62. package/dist/remote/remote-helper.d.ts +29 -0
  63. package/dist/remote/remote-helper.js +4 -0
  64. package/dist/remote/shell-path.d.ts +88 -0
  65. package/dist/runtime/host/local-runtime-host.d.ts +2 -2
  66. package/dist/runtime/host/runtime-host.d.ts +13 -1
  67. package/dist/runtime/orchestration/oauth-refresh-lock.d.ts +6 -0
  68. package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +7 -0
  69. package/dist/runtime/orchestration/team-persistence-writer.d.ts +65 -0
  70. package/dist/runtime/safety/rules.d.ts +11 -0
  71. package/dist/runtime/turn-queue/pending-prompt-service.d.ts +1 -0
  72. package/dist/services/agent-events.d.ts +1 -0
  73. package/dist/services/cloud-handoff/git-preflight.d.ts +24 -0
  74. package/dist/services/cloud-handoff/index.d.ts +4 -0
  75. package/dist/services/cloud-handoff/metadata.d.ts +7 -0
  76. package/dist/services/cloud-handoff/transcript.d.ts +5 -0
  77. package/dist/services/cloud-handoff/types.d.ts +35 -0
  78. package/dist/services/feature-flags/FeatureFlagsService.d.ts +2 -0
  79. package/dist/services/feature-flags/cline-account-feature-flags.d.ts +5 -0
  80. package/dist/services/llms/cline-recommended-models.d.ts +1 -0
  81. package/dist/services/llms/handler-factory.d.ts +12 -0
  82. package/dist/services/llms/provider-defaults.d.ts +1 -1
  83. package/dist/services/llms/provider-settings.d.ts +19 -17
  84. package/dist/services/local-runtime-bootstrap.d.ts +7 -0
  85. package/dist/services/mcp-install.d.ts +9 -0
  86. package/dist/services/plugin-commands.d.ts +28 -0
  87. package/dist/services/providers/local-provider-registry.d.ts +8 -3
  88. package/dist/services/providers/local-provider-service.d.ts +20 -10
  89. package/dist/services/providers/model-source.d.ts +6 -1
  90. package/dist/services/providers/provider-config-fields.d.ts +11 -0
  91. package/dist/services/session-import/claude-code.d.ts +1 -1
  92. package/dist/services/session-import/paths.d.ts +9 -0
  93. package/dist/services/storage/file-team-store.d.ts +10 -4
  94. package/dist/services/storage/sqlite-team-store.d.ts +48 -5
  95. package/dist/services/storage/team-store.d.ts +1 -0
  96. package/dist/services/telemetry/core-events.d.ts +97 -5
  97. package/dist/services/telemetry/index.d.ts +1 -0
  98. package/dist/services/telemetry/index.js +1 -1
  99. package/dist/services/telemetry/scoped-telemetry.d.ts +31 -0
  100. package/dist/services/workspace/workspace-manifest.d.ts +34 -0
  101. package/dist/services/workspace/workspace-telemetry.d.ts +5 -0
  102. package/dist/session/fork-metadata.d.ts +7 -0
  103. package/dist/session/models/session-compaction.d.ts +8 -1
  104. package/dist/session/services/message-builder.d.ts +8 -1
  105. package/dist/session/services/persistence-service.d.ts +4 -1
  106. package/dist/session/services/tool-result-cache.d.ts +30 -0
  107. package/dist/session/session-versioning-service.d.ts +8 -0
  108. package/dist/session/stores/session-manifest-store.d.ts +2 -4
  109. package/dist/session/team/team-session-coordinator.d.ts +3 -1
  110. package/dist/tasks/task-tool.d.ts +2 -2
  111. package/dist/types/provider-settings.d.ts +11 -0
  112. package/dist/types/session.d.ts +2 -0
  113. package/dist/types/storage.d.ts +22 -1
  114. package/package.json +16 -4
  115. package/dist/cron/runner/resource-limiter.d.ts +0 -8
  116. package/dist/services/storage/team-events-retention.d.ts +0 -25
@@ -2,5 +2,5 @@ export { type AgentSlotGate, type AgentSlotGateRegistry, agentEndpointKey, agent
2
2
  export { buildDelegatedAgentConfig, createDelegatedAgent, createDelegatedAgentConfigProvider, type DelegatedAgentConfigProvider, type DelegatedAgentConnectionConfig, type DelegatedAgentKind, type DelegatedAgentRuntimeConfig, type DelegatedPrepareTurnTarget, } from "./delegated-agent";
3
3
  export { buildSubagentLayout, pinConversationHead, SUBAGENT_BASE_PROMPT, type SubagentKnowledge, type SubagentLayout, } from "./subagent-layout";
4
4
  export { createSpawnAgentTool, type SpawnAgentInput, type SpawnAgentOutput, type SpawnAgentToolConfig, type SubAgentEndContext, type SubAgentStartContext, } from "./spawn-agent-tool";
5
- export { type AgentTask, AgentTeam, AgentTeamsRuntime, type AgentTeamsRuntimeOptions, createAgentTeam, createWorkerReviewerTeam, type SpawnTeammateOptions, type TaskResult, type TeamEvent, type TeamMemberConfig, } from "./multi-agent";
5
+ export { type AgentTask, AgentTeam, AgentTeamsRuntime, type AgentTeamsRuntimeOptions, createAgentTeam, createWorkerReviewerTeam, type SpawnTeammateOptions, type TaskResult, type TeamEvent, type TeamMemberConfig, type TeamRuntimeStateDelta, } from "./multi-agent";
6
6
  export { type BootstrapAgentTeamsOptions, type BootstrapAgentTeamsResult, bootstrapAgentTeams, type CreateAgentTeamsToolsOptions, createAgentTeamsTools, reviveTeamStateDates, sanitizeTeamName, type TeamTeammateRuntimeConfig, } from "./team-tools";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Normalizes a team name into a safe storage key: lowercase, runs of
3
+ * disallowed characters collapsed to `-`, leading/trailing `-` trimmed.
4
+ */
5
+ export declare function sanitizeTeamName(name: string): string;
@@ -1,3 +1,4 @@
1
+ export { sanitizeTeamName } from "./sanitize-team-name";
1
2
  import { type AgentTool, type TeamTeammateSpec } from "@cerebriline/shared";
2
3
  import { type DelegatedAgentConfigProvider, type DelegatedAgentRuntimeConfig } from "./delegated-agent";
3
4
  import type { AgentTeamsRuntime } from "./multi-agent";
@@ -53,4 +54,3 @@ export declare const TEAMMATE_TEAM_TOOL_NAMES: ReadonlySet<string>;
53
54
  export declare function bootstrapAgentTeams(options: BootstrapAgentTeamsOptions): BootstrapAgentTeamsResult;
54
55
  export declare function createAgentTeamsTools(options: CreateAgentTeamsToolsOptions): AgentTool[];
55
56
  export { reviveTeamStateDates } from "./team-state-dates";
56
- export declare function sanitizeTeamName(name: string): string;
@@ -1,5 +1,20 @@
1
- import type { AgentHooks, BasicLogger } from "@cerebriline/shared";
1
+ import type { AgentHooks, BasicLogger, ITelemetryService } from "@cerebriline/shared";
2
2
  export declare function isCheckpointStashMessage(message: string): boolean;
3
+ /**
4
+ * Per-session scratch directory holding the persistent `GIT_INDEX_FILE` used
5
+ * to snapshot untracked files. Persisting the index across turns lets git's
6
+ * stat cache skip re-reading (and re-hashing) untracked files that have not
7
+ * changed since the previous checkpoint — without it, every turn re-hashes
8
+ * every untracked byte in the workspace.
9
+ *
10
+ * Lives under the user's Cline data dir (never the world-shared OS tmpdir:
11
+ * the index and pathspec files enumerate workspace paths) and is keyed by a
12
+ * hash of cwd + session id: hashing avoids sanitization collisions between
13
+ * distinct ids, and folding in cwd keeps a session restored against a
14
+ * different workspace from inheriting a foreign index. Removed by
15
+ * `deleteCheckpointRefs` and by the age-based reaper.
16
+ */
17
+ export declare function checkpointScratchDir(cwd: string, sessionId: string): string;
3
18
  export interface CheckpointEntry {
4
19
  ref: string;
5
20
  createdAt: number;
@@ -26,6 +41,13 @@ type CreateCheckpointHooksOptions = {
26
41
  sessionId: string;
27
42
  runCount: number;
28
43
  }) => Promise<CheckpointEntry | undefined> | CheckpointEntry | undefined;
44
+ /**
45
+ * Emits one `checkpoint.snapshot` event per built-in snapshot attempt so
46
+ * snapshot cost and degradations (HEAD fallbacks, skipped turns) are
47
+ * observable in the field, not only in local logs. Properties carry
48
+ * outcome and duration — never file paths or contents.
49
+ */
50
+ telemetry?: Pick<ITelemetryService, "capture">;
29
51
  };
30
52
  /**
31
53
  * Deletes all private git refs under refs/cline/checkpoints/{sessionId}/ that
@@ -1,4 +1,19 @@
1
1
  import type { AgentExtension, AgentHooks, BasicLogger, WorkspaceInfo } from "@cerebriline/shared";
2
+ import { type HookEventName } from "./subprocess";
3
+ /**
4
+ * Reports how long a fire-and-forget hook actually ran, once per hook. Hosts
5
+ * use it to learn the real runtime distribution of detached hooks —
6
+ * unmeasurable while nothing awaits them — before deciding to run any of them
7
+ * blocking. `exited: false` is a censored observation (the hook was still
8
+ * running after the observation window, so it ran at least `durationMs`),
9
+ * which is what keeps the sample from covering only hooks that finish.
10
+ */
11
+ export type HookRuntimeObserver = (event: {
12
+ hookName: HookEventName;
13
+ durationMs: number;
14
+ exitCode: number | null;
15
+ exited: boolean;
16
+ }) => void;
2
17
  type HookRuntimeOptions = {
3
18
  cwd: string;
4
19
  workspacePath: string;
@@ -7,6 +22,18 @@ type HookRuntimeOptions = {
7
22
  toolCallTimeoutMs?: number;
8
23
  /** Keep asynchronous hooks attached until exit. Intended for deterministic tests. */
9
24
  detachAsyncHooks?: boolean;
25
+ /**
26
+ * Run agent_start/agent_resume hooks blocking, honoring their control
27
+ * output (cancel, contextModification). Off by default: these hooks have
28
+ * always been fire-and-forget with stdio ignored, so an existing
29
+ * long-running script would otherwise stall every run start until the
30
+ * timeout. A host that flips this on must tell hook authors that
31
+ * long-running run-start hooks need to background themselves (spawn a
32
+ * detached child and exit).
33
+ */
34
+ blockingRunStartHooks?: boolean;
35
+ /** Observes how long detached hooks run. See {@link HookRuntimeObserver}. */
36
+ onHookRuntime?: HookRuntimeObserver;
10
37
  /** Structured git + path metadata forwarded into every hook payload. */
11
38
  workspaceInfo?: WorkspaceInfo;
12
39
  };
@@ -9,6 +9,29 @@ export interface RunSubprocessEventOptions {
9
9
  pid?: number;
10
10
  detached: boolean;
11
11
  }) => void;
12
+ /**
13
+ * Reports a detached hook's runtime exactly once. The run never waits on
14
+ * this: detached hooks are fire-and-forget by contract, and this only
15
+ * observes them so hosts can measure how long they actually take.
16
+ *
17
+ * `exited: true` means the hook finished and `durationMs` is its runtime.
18
+ * `exited: false` is a censored observation: the hook was still running
19
+ * after the observation window, and `durationMs` is that window, so read
20
+ * it as "ran at least this long" and count these separately — the
21
+ * case that matters most, since those are the hooks that would stall a
22
+ * blocking run. Without it the sample would only contain hooks that
23
+ * finished.
24
+ *
25
+ * Nothing is reported if the parent exits before either happens.
26
+ */
27
+ onDetachedSettled?: (event: {
28
+ command: string[];
29
+ durationMs: number;
30
+ exitCode: number | null;
31
+ exited: boolean;
32
+ }) => void;
33
+ /** Overrides the censoring window for `onDetachedSettled`. */
34
+ detachedObservationMs?: number;
12
35
  }
13
36
  export interface RunSubprocessEventResult {
14
37
  exitCode: number | null;
@@ -49,6 +49,16 @@ export interface SubprocessHooksOptions {
49
49
  workspaceInfo?: WorkspaceInfo;
50
50
  env?: NodeJS.ProcessEnv;
51
51
  timeoutMs?: number;
52
+ /**
53
+ * Run agent_start/agent_resume hooks blocking, honoring their control
54
+ * output (cancel, contextModification). Off by default: these hooks have
55
+ * always been fire-and-forget with stdio ignored, so an existing
56
+ * long-running script would otherwise stall every run start until the
57
+ * timeout. A host that flips this on must tell hook authors that
58
+ * long-running run-start hooks need to background themselves (spawn a
59
+ * detached child and exit).
60
+ */
61
+ blockingRunStartHooks?: boolean;
52
62
  onDispatchError?: (error: Error, payload: HookEventPayload) => void;
53
63
  onDispatch?: (event: {
54
64
  payload: HookEventPayload;
@@ -1,13 +1,33 @@
1
1
  import { type HubClientRegistration, type HubCommandEnvelope, type HubEventEnvelope, type HubReplyEnvelope } from "@cerebriline/shared";
2
2
  import { type HubOwnerContext } from "../discovery";
3
+ type HubCommandOptions = {
4
+ timeoutMs?: number | null;
5
+ /** Synchronous local guard, checked after connection before each dispatch. */
6
+ beforeDispatch?: () => void;
7
+ /** Observes this attempt's correlation id after the local guard, before sending.
8
+ * Dispatch alone does not confirm that the server accepted the command. */
9
+ onDispatch?: (requestId: string) => void;
10
+ };
3
11
  export interface HubClientOptions {
4
12
  url: string;
5
13
  clientId?: string;
6
14
  clientType?: string;
7
15
  displayName?: string;
16
+ /** Version reported to the hub; defaults to the @cline/core version. */
17
+ clientVersion?: string;
18
+ /** Additional registration metadata; version and pid are owned by the client. */
19
+ metadata?: Record<string, unknown>;
8
20
  workspaceRoot?: string;
9
21
  cwd?: string;
22
+ /** Hub token sent with the `cline-hub-auth.*` WebSocket subprotocol. */
10
23
  authToken?: string;
24
+ /**
25
+ * Resolves HTTP headers for each new WebSocket, including reconnects.
26
+ * This Node-only transport option is mutually exclusive with `authToken`.
27
+ * Resolver failures are surfaced by `connect()` and `getConnectionError()`;
28
+ * `Sec-WebSocket-Protocol` must be configured through `authToken` instead.
29
+ */
30
+ resolveConnectionHeaders?: () => Readonly<Record<string, string>> | Promise<Readonly<Record<string, string>>>;
11
31
  capabilities?: HubClientRegistration["capabilities"];
12
32
  }
13
33
  export interface LocalHubResolutionOptions {
@@ -15,6 +35,11 @@ export interface LocalHubResolutionOptions {
15
35
  strategy?: "prefer-hub" | "require-hub";
16
36
  workspaceRoot?: string;
17
37
  cwd?: string;
38
+ /**
39
+ * Called with the error when starting a detached Hub fails. The function
40
+ * still resolves `undefined` in that case; this lets a caller report why.
41
+ */
42
+ onStartupError?: (error: unknown) => void;
18
43
  }
19
44
  export type HubTransportErrorCode = "hub_connect_timeout" | "hub_connect_failed" | "hub_connection_closed" | "hub_connection_not_open";
20
45
  export declare class HubTransportError extends Error {
@@ -57,6 +82,7 @@ export declare class NodeHubClient {
57
82
  private reconnectTimer;
58
83
  private reconnectAttempt;
59
84
  private closedByClient;
85
+ private connectGeneration;
60
86
  private lastCloseError;
61
87
  private sawSocketClose;
62
88
  private registered;
@@ -68,12 +94,11 @@ export declare class NodeHubClient {
68
94
  getConnectionError(): HubTransportError | null;
69
95
  updateCapabilities(capabilities: NonNullable<HubClientRegistration["capabilities"]>): Promise<void>;
70
96
  connect(): Promise<void>;
97
+ private openSocket;
71
98
  subscribe(listener: (event: HubEventEnvelope) => void, options?: {
72
99
  sessionId?: string;
73
100
  }): () => void;
74
- command(command: HubCommandEnvelope["command"], payload?: Record<string, unknown>, sessionId?: string, options?: {
75
- timeoutMs?: number | null;
76
- }): Promise<HubReplyEnvelope>;
101
+ command(command: HubCommandEnvelope["command"], payload?: Record<string, unknown>, sessionId?: string, options?: HubCommandOptions): Promise<HubReplyEnvelope>;
77
102
  private commandOnce;
78
103
  private recoverLocalHubTransport;
79
104
  private hasActiveSubscriptions;
@@ -144,3 +169,4 @@ export declare function restartLocalHubIfIdleAfterStartupTimeout(options: {
144
169
  workspaceRoot?: string;
145
170
  cwd?: string;
146
171
  }): Promise<string | undefined>;
172
+ export {};
@@ -56,11 +56,8 @@ export interface HubTeamProgressHandlers {
56
56
  onError?: (error: Error) => void;
57
57
  }
58
58
  export declare class HubSessionClient {
59
- private readonly options;
60
59
  private readonly client;
61
- private metadataApplied;
62
60
  constructor(options: HubSessionClientOptions);
63
- private ensureMetadataApplied;
64
61
  connect(): Promise<void>;
65
62
  private taskCommand;
66
63
  close(): void;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Best-effort description of who holds the Hub port when the daemon dies with
3
+ * `EADDRINUSE`. The daemon takes the owner instance lock before binding, so an
4
+ * occupant on the port is never a live Hub for this owner; these details tell
5
+ * us what it actually is (an older pre-lock Hub, a leaked handle, another
6
+ * owner context, or an unrelated program) so the fix can target that case.
7
+ */
8
+ import type { TelemetryProperties } from "@cerebriline/shared";
9
+ /** `lsof -Fpc` emits `p<pid>` then `c<command>` per process. */
10
+ export declare function parseLsofOwners(output: string): string[];
11
+ /** Telemetry context for a `hub.daemon.startup` failure caused by `EADDRINUSE`. */
12
+ export declare function describeAddressInUse(error: unknown, endpoint: {
13
+ host: string;
14
+ port: number;
15
+ pathname: string;
16
+ }): Promise<TelemetryProperties>;