@cline/core 0.0.78 → 0.0.79-nightly.1787712192

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.
@@ -117,13 +117,40 @@ export declare class LocalRuntimeHost implements RuntimeHost {
117
117
  * `attempt_completion`-driven emission and works for both interactive
118
118
  * and non-interactive sessions.
119
119
  *
120
- * `shutdownSession(...)` retains a fallback emission for completed
121
- * sessions that finish without an explicit completion-tool observation
122
- * (e.g., non-interactive runs not using the yolo preset). This helper
123
- * sets `submitAndExitObserved` so the shutdown fallback can suppress a
120
+ * `emitTaskCompletedOnTeardown(...)` retains a fallback emission for
121
+ * completed sessions that finish without an explicit completion-tool
122
+ * observation (e.g., non-interactive runs not using the yolo preset,
123
+ * or hosts that disable `submit_and_exit` entirely). This helper sets
124
+ * `taskCompletedEmitted` so the teardown fallback can suppress a
124
125
  * duplicate emission for the same logical completion.
125
126
  */
126
127
  private observeTaskCompletionTool;
128
+ /**
129
+ * Single choke point for the fallback `task.completed` emission on
130
+ * session teardown. Every path a session can end through funnels into
131
+ * `shutdownSession(...)` or `releaseSessionRuntime(...)`, and BOTH must
132
+ * call this helper — the emission must never depend on which teardown
133
+ * branch a stop happens to route through. (The 4.1.11 regression:
134
+ * truthful session-status reporting re-routed many interactive stops
135
+ * onto the release branch, and the fallback that lived only inside
136
+ * `shutdownSession` silently stopped firing for them.)
137
+ *
138
+ * Emits at most once per session (`taskCompletedEmitted`), and never
139
+ * after the `submit_and_exit` observer already reported the completion.
140
+ * The completion criterion deliberately does not read `session.status`
141
+ * (whose lifecycle is what changed in 4.1.11):
142
+ *
143
+ * - Interactive sessions use the recorded final-turn outcome,
144
+ * `lastInteractiveTurnFinishReason === "completed"`. The extra guards
145
+ * suppress emission when teardown arrives mid-run (the in-flight turn
146
+ * being aborted is the real final turn, and it did not complete).
147
+ * - Non-interactive sessions use the terminal status their run result
148
+ * resolved to (`finalStatus`, from `finalizeSingleRun`), preserving
149
+ * the pre-existing `input.status === "completed"` semantics.
150
+ *
151
+ * Sessions whose final turn errored or aborted emit nothing.
152
+ */
153
+ private emitTaskCompletedOnTeardown;
127
154
  private prepareTurnInput;
128
155
  private ensureSessionPersisted;
129
156
  private markTurnRunning;
@@ -24,6 +24,12 @@ export interface AgendaTaskManagerOptions {
24
24
  globalSpecsDir?: string;
25
25
  watcherDebounceMs?: number;
26
26
  watchFiles?: boolean;
27
+ /**
28
+ * Set to false to keep the automation pump idle regardless of persisted
29
+ * automation policies. Policies stay stored untouched and manual approve/run
30
+ * commands keep working; nothing is auto-approved or auto-started.
31
+ */
32
+ automationEnabled?: boolean;
27
33
  logger?: BasicLogger;
28
34
  publish?: (event: AgendaTaskManagerEventName, payload: Record<string, unknown>, sessionId?: string) => void;
29
35
  }
@@ -42,6 +48,7 @@ export declare class AgendaTaskManager implements AgendaTaskManagerApi {
42
48
  private readonly backgroundRuns;
43
49
  private maintenanceTimer?;
44
50
  private readonly queuedAutomationScopes;
51
+ private readonly automationEnabled;
45
52
  private automationPumping;
46
53
  private automationPolicyGeneration;
47
54
  private started;
@@ -4,6 +4,8 @@ import { type ScheduledTaskResult, type ScheduleTaskOperationOptions } from "../
4
4
  import { type TodoTaskOperationOptions, type TodoTaskResult } from "./agenda-task-tool";
5
5
  export declare const TASKS_TOOL_NAME = "tasks";
6
6
  export declare const TASKS_SYSTEM_PROMPT_RULE = "# Tasks\n\nUse the `tasks` tool to manage durable Todo items and explicitly requested scheduled agent work.\n\n- Use `kind: \"todo\"` for meaningful follow-ups, handoffs, ideas, reminders, and other work that should remain visible after this session. This includes useful work you identify and suggest proactively. Agent-created Todos require user approval; Todos created directly by the user are approved immediately. Todo `available_at` controls availability in the list; it never schedules execution.\n- Use `kind: \"scheduled\"` only when the user explicitly asks Cline to execute work once at a future time or on a recurrence. One-time schedules require an exact future ISO 8601 `run_at` with an offset or Z. Recurring schedules require a five-field `cron_pattern` and may include an IANA `timezone`.\n- \"Remind me\" is ambiguous: ask whether the user wants a reviewed Todo note or an agent to execute work at that time when intent is unclear.\n- Never create both kinds for the same request unless the user explicitly requests both. Check existing items before creating a likely duplicate.\n- Todo instructions and scheduled prompts must be self-contained. Include the goal, constraints, relevant project context, and expected output.\n- Never approve or start a Todo yourself. Only mutate schedules from an interactive user session, and only update, pause, resume, delete, or run one immediately when the user asks.";
7
+ /** Guidance used while the Todo kind is disabled and only schedules remain. */
8
+ export declare const SCHEDULED_TASKS_SYSTEM_PROMPT_RULE = "# Tasks\n\nUse the `tasks` tool only when the user explicitly asks Cline to execute work once at a future time or on a recurrence. Always pass `kind: \"scheduled\"`.\n\n- One-time schedules require an exact future ISO 8601 `run_at` with an offset or Z. Recurring schedules require a five-field `cron_pattern` and may include an IANA `timezone`.\n- Never create a schedule proactively. Check existing schedules before creating a likely duplicate.\n- Make the scheduled `prompt` self-contained because it runs in a new unattended session. Include the goal, constraints, relevant project context, and expected output.\n- Only update, pause, resume, delete, or run a schedule immediately when the user asks for that action.";
7
9
  export declare const TasksToolInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
10
  operation: z.ZodEnum<{
9
11
  update: "update";
@@ -121,7 +123,12 @@ export type TasksToolResult = ({
121
123
  };
122
124
  };
123
125
  export interface CreateTasksToolOptions {
124
- todo: TodoTaskOperationOptions;
126
+ /**
127
+ * Omit to disable the Todo kind: the tool then advertises and accepts only
128
+ * `kind: "scheduled"` while the Agenda backend stays intact for hosts that
129
+ * re-enable it.
130
+ */
131
+ todo?: TodoTaskOperationOptions;
125
132
  scheduled: ScheduleTaskOperationOptions;
126
133
  }
127
134
  /**
@@ -131,4 +138,6 @@ export interface CreateTasksToolOptions {
131
138
  */
132
139
  export declare function createTasksTool(options: CreateTasksToolOptions): AgentTool<TasksToolInput, TasksToolResult>;
133
140
  /** Adds selection and safety guidance only when the unified tool is enabled. */
134
- export declare function createTasksPromptExtension(): AgentExtension;
141
+ export declare function createTasksPromptExtension(options?: {
142
+ todoEnabled?: boolean;
143
+ }): AgentExtension;
@@ -47,14 +47,21 @@ export type ActiveSession = {
47
47
  * declares completion (parity with original Cline's
48
48
  * `attempt_completion`).
49
49
  * 2. Suppress the fallback `task.completed` emission from
50
- * `shutdownSession(...)` so the same logical completion is not
51
- * reported twice.
50
+ * `emitTaskCompletedOnTeardown(...)` so the same logical completion
51
+ * is not reported twice.
52
52
  *
53
53
  * Non-interactive sessions that finish without ever calling the
54
- * completion tool still receive a `task.completed` from the shutdown
54
+ * completion tool still receive a `task.completed` from the teardown
55
55
  * fallback.
56
56
  */
57
57
  submitAndExitObserved: boolean;
58
+ /**
59
+ * Set to `true` the moment `task.completed` is emitted for this session,
60
+ * whether by the `submit_and_exit` observer or by the teardown fallback
61
+ * (`emitTaskCompletedOnTeardown`). Enforces the invariant of exactly one
62
+ * `task.completed` per session regardless of which teardown path runs.
63
+ */
64
+ taskCompletedEmitted: boolean;
58
65
  };
59
66
  export type PendingPrompt = {
60
67
  id: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cline/core",
3
3
  "description": "Cline Core SDK for Node Runtime",
4
- "version": "0.0.78",
4
+ "version": "0.0.79-nightly.1787712192",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/cline/cline",
@@ -49,9 +49,9 @@
49
49
  "test:watch": "vitest --config vitest.config.ts"
50
50
  },
51
51
  "dependencies": {
52
- "@cline/agents": "0.0.78",
53
- "@cline/shared": "0.0.78",
54
- "@cline/llms": "0.0.78",
52
+ "@cline/agents": "0.0.79-nightly.1787712192",
53
+ "@cline/shared": "0.0.79-nightly.1787712192",
54
+ "@cline/llms": "0.0.79-nightly.1787712192",
55
55
  "@modelcontextprotocol/sdk": "^1.29.0",
56
56
  "@opentelemetry/api": "^1.9.0",
57
57
  "@opentelemetry/api-logs": "^0.214.0",