@leanandmean/coding-agent 0.74.1-scramjet.19 → 0.74.1-scramjet.21

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.
@@ -165,6 +165,8 @@ export declare class AgentSession {
165
165
  private _unsubscribeAgent?;
166
166
  private _eventListeners;
167
167
  private _agentEventQueue;
168
+ private _disposed;
169
+ private readonly _harnessPersistenceAcks;
168
170
  /** Tracks pending steering messages for UI display. Removed when delivered. */
169
171
  private _steeringMessages;
170
172
  /** Tracks pending follow-up messages for UI display. Removed when delivered. */
@@ -227,6 +229,8 @@ export declare class AgentSession {
227
229
  private _handleAgentEvent;
228
230
  private _createRetryPromiseForAgentEnd;
229
231
  private _findLastAssistantInMessages;
232
+ private _processAgentEventTracked;
233
+ private _harnessAckIdForEvent;
230
234
  private _processAgentEvent;
231
235
  /** Resolve the pending retry promise */
232
236
  private _resolveRetry;
@@ -298,8 +302,26 @@ export declare class AgentSession {
298
302
  * run/turn framing. The idle-vs-mid-run branch lives in `runHarnessTool` (keyed on the agent's
299
303
  * active run, which tracks `isStreaming`): idle calls execute immediately, mid-run calls queue
300
304
  * and drain before the next intra-run LLM call.
305
+ *
306
+ * **Persisted settlement (#341).** This is a strictly stronger boundary than
307
+ * {@link Agent.runHarnessTool}: the returned promise resolves only after (1) the Agent-core
308
+ * pipeline fulfills *and* (2) `_processAgentEvent` has persisted the matching tool-result
309
+ * `message_end` via `SessionManager.appendMessage`. Because the event queue preserves order,
310
+ * that also proves the preceding synthetic assistant tool-call message was persisted first. It
311
+ * rejects on Agent-core failure, on failure to process/persist a matching event, on disposal
312
+ * before settlement, on a post-disposal call, on an unknown tool, or on a duplicate explicit
313
+ * tool-call id that is already pending. **Rejection means the promised pipeline did not complete —
314
+ * it does not prove artifact absence** (Agent state and persistence may have partially or fully
315
+ * completed before a late failure), so callers must not blindly retry. A tool's own `execute()`
316
+ * error is *not* a rejection: it becomes a normal `isError: true` result and the promise resolves
317
+ * after that error-result pipeline is persisted.
318
+ *
319
+ * **Reentrancy.** As with `runHarnessTool`, do not `await` this from work whose return is required
320
+ * for the Agent to reach the drain point or for the event queue to persist the matching result.
301
321
  */
302
322
  invokeHarnessTool(name: string, args: unknown, options?: InvokeHarnessToolOptions): Promise<void>;
323
+ private _allocateHarnessToolCallId;
324
+ private _registerHarnessPersistenceAck;
303
325
  /** Whether compaction or branch summarization is currently running */
304
326
  get isCompacting(): boolean;
305
327
  /** All messages including custom types like BashExecutionMessage */