@cline/agents 0.0.82 → 0.0.83-nightly.1789525793
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 +41 -0
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/index.js +40 -35
- package/package.json +3 -3
package/dist/agent-runtime.d.ts
CHANGED
|
@@ -100,6 +100,47 @@ export declare class AgentRuntime {
|
|
|
100
100
|
private execute;
|
|
101
101
|
private callBeforeRunHooks;
|
|
102
102
|
private callAfterRunHooks;
|
|
103
|
+
/**
|
|
104
|
+
* Run a model turn, retrying transient provider/API failures with backoff.
|
|
105
|
+
*
|
|
106
|
+
* A turn whose model stream fails with a retryable provider error (rate
|
|
107
|
+
* limit, 5xx, network hiccup, or OpenRouter's generic "Provider returned
|
|
108
|
+
* error") is re-issued up to {@link PROVIDER_ERROR_MAX_RETRIES} times, with
|
|
109
|
+
* exponential backoff between attempts, before the error is allowed to
|
|
110
|
+
* propagate and end the run. Non-retryable errors (auth, context-window
|
|
111
|
+
* overflow, other client errors) and any attempt that already produced
|
|
112
|
+
* visible output or provider tool activity are returned unchanged for the
|
|
113
|
+
* caller to handle, so this only adds
|
|
114
|
+
* resilience and never changes behavior for a turn that would otherwise
|
|
115
|
+
* succeed. Context-window overflow recovery still runs inside each attempt.
|
|
116
|
+
*/
|
|
117
|
+
private generateAssistantMessageWithProviderRetry;
|
|
118
|
+
/**
|
|
119
|
+
* True when a turn failed with a transient provider error that a retry
|
|
120
|
+
* could plausibly recover, and the failed attempt left nothing behind that
|
|
121
|
+
* a second stream would duplicate or repeat:
|
|
122
|
+
* - no content at all (text, reasoning, media, or local tool calls): those
|
|
123
|
+
* deltas were already emitted to the UI and there is no event to retract
|
|
124
|
+
* them, so re-streaming would show the output twice;
|
|
125
|
+
* - no provider-executed tool activity (recorded in message metadata, not
|
|
126
|
+
* content): re-issuing the request could run those side effects again;
|
|
127
|
+
* - not an auth or context-window failure, which the same request cannot fix.
|
|
128
|
+
*/
|
|
129
|
+
private isRetryableProviderErrorTurn;
|
|
130
|
+
/**
|
|
131
|
+
* Clear the last-error fields. Called at the start of every turn and before
|
|
132
|
+
* every provider-error retry, so a `finish` event that omits `error` (allowed
|
|
133
|
+
* by the public AgentModel contract) cannot inherit the class or retryability
|
|
134
|
+
* of an earlier attempt. Deliberately not called inside overflow recovery,
|
|
135
|
+
* whose "nothing to compact" error reports the first attempt's provider
|
|
136
|
+
* message.
|
|
137
|
+
*/
|
|
138
|
+
private resetLastError;
|
|
139
|
+
/**
|
|
140
|
+
* Sleep for `ms`, rejecting early with the abort error if the run is
|
|
141
|
+
* aborted while waiting, so a retry backoff never blocks cancellation.
|
|
142
|
+
*/
|
|
143
|
+
private abortableDelay;
|
|
103
144
|
/**
|
|
104
145
|
* Run a model turn, recovering once per run from a provider-rejected
|
|
105
146
|
* context-window overflow: force a compaction through `prepareTurn` and
|
|
@@ -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,EAA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