@cline/agents 0.0.82 → 0.0.83-nightly.1789612722
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.
- package/dist/agent-runtime.d.ts +45 -0
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/index.js +45 -40
- package/package.json +3 -3
package/dist/agent-runtime.d.ts
CHANGED
|
@@ -73,11 +73,14 @@ export declare class AgentRuntime {
|
|
|
73
73
|
private overflowRecoveryAttempted;
|
|
74
74
|
private initialization?;
|
|
75
75
|
private abortController?;
|
|
76
|
+
private modelSteerController?;
|
|
76
77
|
private readonly telemetryProviderId?;
|
|
77
78
|
private readonly telemetryModelId?;
|
|
78
79
|
constructor(config: AgentRuntimeConfig);
|
|
79
80
|
run(input: AgentRunInput): Promise<AgentRunResult>;
|
|
80
81
|
continue(input?: AgentRunInput): Promise<AgentRunResult>;
|
|
82
|
+
/** Interrupt only the current model request; running tools finish normally. */
|
|
83
|
+
notifyPendingUserMessage(): void;
|
|
81
84
|
abort(reason?: unknown): void;
|
|
82
85
|
subscribe(listener: AgentEventListener): () => void;
|
|
83
86
|
/**
|
|
@@ -100,6 +103,47 @@ export declare class AgentRuntime {
|
|
|
100
103
|
private execute;
|
|
101
104
|
private callBeforeRunHooks;
|
|
102
105
|
private callAfterRunHooks;
|
|
106
|
+
/**
|
|
107
|
+
* Run a model turn, retrying transient provider/API failures with backoff.
|
|
108
|
+
*
|
|
109
|
+
* A turn whose model stream fails with a retryable provider error (rate
|
|
110
|
+
* limit, 5xx, network hiccup, or OpenRouter's generic "Provider returned
|
|
111
|
+
* error") is re-issued up to {@link PROVIDER_ERROR_MAX_RETRIES} times, with
|
|
112
|
+
* exponential backoff between attempts, before the error is allowed to
|
|
113
|
+
* propagate and end the run. Non-retryable errors (auth, context-window
|
|
114
|
+
* overflow, other client errors) and any attempt that already produced
|
|
115
|
+
* visible output or provider tool activity are returned unchanged for the
|
|
116
|
+
* caller to handle, so this only adds
|
|
117
|
+
* resilience and never changes behavior for a turn that would otherwise
|
|
118
|
+
* succeed. Context-window overflow recovery still runs inside each attempt.
|
|
119
|
+
*/
|
|
120
|
+
private generateAssistantMessageWithProviderRetry;
|
|
121
|
+
/**
|
|
122
|
+
* True when a turn failed with a transient provider error that a retry
|
|
123
|
+
* could plausibly recover, and the failed attempt left nothing behind that
|
|
124
|
+
* a second stream would duplicate or repeat:
|
|
125
|
+
* - no content at all (text, reasoning, media, or local tool calls): those
|
|
126
|
+
* deltas were already emitted to the UI and there is no event to retract
|
|
127
|
+
* them, so re-streaming would show the output twice;
|
|
128
|
+
* - no provider-executed tool activity (recorded in message metadata, not
|
|
129
|
+
* content): re-issuing the request could run those side effects again;
|
|
130
|
+
* - not an auth or context-window failure, which the same request cannot fix.
|
|
131
|
+
*/
|
|
132
|
+
private isRetryableProviderErrorTurn;
|
|
133
|
+
/**
|
|
134
|
+
* Clear the last-error fields. Called at the start of every turn and before
|
|
135
|
+
* every provider-error retry, so a `finish` event that omits `error` (allowed
|
|
136
|
+
* by the public AgentModel contract) cannot inherit the class or retryability
|
|
137
|
+
* of an earlier attempt. Deliberately not called inside overflow recovery,
|
|
138
|
+
* whose "nothing to compact" error reports the first attempt's provider
|
|
139
|
+
* message.
|
|
140
|
+
*/
|
|
141
|
+
private resetLastError;
|
|
142
|
+
/**
|
|
143
|
+
* Sleep for `ms`, rejecting early with the abort error if the run is
|
|
144
|
+
* aborted while waiting, so a retry backoff never blocks cancellation.
|
|
145
|
+
*/
|
|
146
|
+
private abortableDelay;
|
|
103
147
|
/**
|
|
104
148
|
* Run a model turn, recovering once per run from a provider-rejected
|
|
105
149
|
* context-window overflow: force a compaction through `prepareTurn` and
|
|
@@ -109,6 +153,7 @@ export declare class AgentRuntime {
|
|
|
109
153
|
private generateAssistantMessageWithOverflowRecovery;
|
|
110
154
|
private isRecoverableOverflowTurn;
|
|
111
155
|
private generateAssistantMessage;
|
|
156
|
+
private generateAssistantMessageForRequest;
|
|
112
157
|
private openTaskLifecycleStream;
|
|
113
158
|
private captureTaskLifecycleFailure;
|
|
114
159
|
private captureTaskLifecycle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runtime.d.ts","sourceRoot":"","sources":["../src/agent-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"agent-runtime.d.ts","sourceRoot":"","sources":["../src/agent-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,uBAAuB,EAE5B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAIX,YAAY,EAEZ,UAAU,EAKV,cAAc,EACd,iBAAiB,EAEjB,yBAAyB,EAOzB,kBAAkB,IAAI,sBAAsB,EAM5C,MAAM,eAAe,CAAC;AAsCvB;;;;GAIG;AACH,eAAO,MAAM,kDAAkD,sPACgL,CAAC;AAEhP;;;GAGG;AACH,eAAO,MAAM,+CAA+C,0JAC4F,CAAC;AAEzJ;;;GAGG;AACH,eAAO,MAAM,2CAA2C,2JACiG,CAAC;AAuB1J,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,YAAY,EAAE,CAAC;AAC5E,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IAC1E,KAAK,EAAE,UAAU,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAChB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAC7C,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAA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