@cline/core 0.0.78 → 0.0.79

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;
@@ -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",
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",
53
+ "@cline/shared": "0.0.79",
54
+ "@cline/llms": "0.0.79",
55
55
  "@modelcontextprotocol/sdk": "^1.29.0",
56
56
  "@opentelemetry/api": "^1.9.0",
57
57
  "@opentelemetry/api-logs": "^0.214.0",