agent-nuvira 3.4.0 → 3.5.1
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/README.md +13 -13
- package/dist/agent-sdk/src/register.d.ts +23 -7
- package/dist/agent-sdk/src/register.d.ts.map +1 -1
- package/dist/agent-sdk/src/register.js +159 -5
- package/dist/agent-sdk/src/register.js.map +1 -1
- package/dist/agent-sdk/src/scaffold.d.ts +1 -1
- package/dist/agent-sdk/src/scaffold.js +1 -1
- package/dist/cli/agent.d.ts.map +1 -1
- package/dist/cli/agent.js +16 -3
- package/dist/cli/agent.js.map +1 -1
- package/dist/cli/chat.d.ts +202 -6
- package/dist/cli/chat.d.ts.map +1 -1
- package/dist/cli/chat.js +805 -34
- package/dist/cli/chat.js.map +1 -1
- package/dist/cli/config.d.ts +10 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +39 -0
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +18 -3
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/duties.d.ts +11 -0
- package/dist/cli/duties.d.ts.map +1 -1
- package/dist/cli/duties.js +31 -0
- package/dist/cli/duties.js.map +1 -1
- package/dist/cli/mcp.d.ts +50 -0
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +496 -49
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/memory.d.ts.map +1 -1
- package/dist/cli/memory.js +3 -2
- package/dist/cli/memory.js.map +1 -1
- package/dist/cli/models.d.ts.map +1 -1
- package/dist/cli/models.js +55 -0
- package/dist/cli/models.js.map +1 -1
- package/dist/cli/plugins.d.ts.map +1 -1
- package/dist/cli/plugins.js +26 -9
- package/dist/cli/plugins.js.map +1 -1
- package/dist/cli/sdk.d.ts.map +1 -1
- package/dist/cli/sdk.js +10 -3
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli/tool-install-prompt.d.ts.map +1 -1
- package/dist/cli/tool-install-prompt.js +23 -1
- package/dist/cli/tool-install-prompt.js.map +1 -1
- package/dist/cli/tools.d.ts +16 -0
- package/dist/cli/tools.d.ts.map +1 -1
- package/dist/cli/tools.js +101 -1
- package/dist/cli/tools.js.map +1 -1
- package/dist/config/manager.d.ts +6 -0
- package/dist/config/manager.d.ts.map +1 -1
- package/dist/config/manager.js +66 -0
- package/dist/config/manager.js.map +1 -1
- package/dist/config/types.d.ts +18 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/learning/auto-router.d.ts +28 -0
- package/dist/learning/auto-router.d.ts.map +1 -1
- package/dist/learning/auto-router.js +84 -5
- package/dist/learning/auto-router.js.map +1 -1
- package/dist/learning/duty-lease.d.ts +163 -0
- package/dist/learning/duty-lease.d.ts.map +1 -0
- package/dist/learning/duty-lease.js +301 -0
- package/dist/learning/duty-lease.js.map +1 -0
- package/dist/learning/exhaustion-report.d.ts +12 -0
- package/dist/learning/exhaustion-report.d.ts.map +1 -1
- package/dist/learning/exhaustion-report.js +3 -1
- package/dist/learning/exhaustion-report.js.map +1 -1
- package/dist/learning/model-capability.d.ts +33 -0
- package/dist/learning/model-capability.d.ts.map +1 -1
- package/dist/learning/model-capability.js +51 -0
- package/dist/learning/model-capability.js.map +1 -1
- package/dist/learning/model-first-router.d.ts +21 -22
- package/dist/learning/model-first-router.d.ts.map +1 -1
- package/dist/learning/model-first-router.js +61 -54
- package/dist/learning/model-first-router.js.map +1 -1
- package/dist/learning/model-selection.d.ts +27 -0
- package/dist/learning/model-selection.d.ts.map +1 -1
- package/dist/learning/model-selection.js +46 -0
- package/dist/learning/model-selection.js.map +1 -1
- package/dist/learning/model-warmup.d.ts +92 -0
- package/dist/learning/model-warmup.d.ts.map +1 -1
- package/dist/learning/model-warmup.js +137 -2
- package/dist/learning/model-warmup.js.map +1 -1
- package/dist/learning/reasoning-trace.d.ts +1 -1
- package/dist/learning/reasoning-trace.d.ts.map +1 -1
- package/dist/learning/reasoning-trace.js.map +1 -1
- package/dist/learning/resilient-call.d.ts +15 -1
- package/dist/learning/resilient-call.d.ts.map +1 -1
- package/dist/learning/resilient-call.js +38 -22
- package/dist/learning/resilient-call.js.map +1 -1
- package/dist/learning/retry-patience.d.ts +139 -0
- package/dist/learning/retry-patience.d.ts.map +1 -0
- package/dist/learning/retry-patience.js +169 -0
- package/dist/learning/retry-patience.js.map +1 -0
- package/dist/learning/working-state.d.ts +7 -0
- package/dist/learning/working-state.d.ts.map +1 -1
- package/dist/learning/working-state.js +23 -1
- package/dist/learning/working-state.js.map +1 -1
- package/dist/mcp/catalog.d.ts +206 -26
- package/dist/mcp/catalog.d.ts.map +1 -1
- package/dist/mcp/catalog.js +664 -52
- package/dist/mcp/catalog.js.map +1 -1
- package/dist/mcp/client.d.ts +6 -0
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js +35 -5
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/custom-server.d.ts +120 -0
- package/dist/mcp/custom-server.d.ts.map +1 -0
- package/dist/mcp/custom-server.js +330 -0
- package/dist/mcp/custom-server.js.map +1 -0
- package/dist/mcp/manager.d.ts +9 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +15 -2
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/mcp-oauth.d.ts +28 -0
- package/dist/mcp/mcp-oauth.d.ts.map +1 -1
- package/dist/mcp/mcp-oauth.js +63 -8
- package/dist/mcp/mcp-oauth.js.map +1 -1
- package/dist/mcp/oauth-authorize.d.ts +51 -0
- package/dist/mcp/oauth-authorize.d.ts.map +1 -0
- package/dist/mcp/oauth-authorize.js +133 -0
- package/dist/mcp/oauth-authorize.js.map +1 -0
- package/dist/mcp/oauth-connect.d.ts +53 -0
- package/dist/mcp/oauth-connect.d.ts.map +1 -0
- package/dist/mcp/oauth-connect.js +103 -0
- package/dist/mcp/oauth-connect.js.map +1 -0
- package/dist/mcp/pin-verifier.d.ts +44 -0
- package/dist/mcp/pin-verifier.d.ts.map +1 -0
- package/dist/mcp/pin-verifier.js +102 -0
- package/dist/mcp/pin-verifier.js.map +1 -0
- package/dist/mcp/prereqs.d.ts +145 -0
- package/dist/mcp/prereqs.d.ts.map +1 -0
- package/dist/mcp/prereqs.js +245 -0
- package/dist/mcp/prereqs.js.map +1 -0
- package/dist/mcp/runtime.d.ts +59 -0
- package/dist/mcp/runtime.d.ts.map +1 -0
- package/dist/mcp/runtime.js +77 -0
- package/dist/mcp/runtime.js.map +1 -0
- package/dist/mcp/server.d.ts +21 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +29 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/settings.d.ts +164 -0
- package/dist/mcp/settings.d.ts.map +1 -0
- package/dist/mcp/settings.js +358 -0
- package/dist/mcp/settings.js.map +1 -0
- package/dist/mcp/types.d.ts +62 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js.map +1 -1
- package/dist/memory/vector-store.d.ts +12 -0
- package/dist/memory/vector-store.d.ts.map +1 -1
- package/dist/memory/vector-store.js +23 -0
- package/dist/memory/vector-store.js.map +1 -1
- package/dist/plugins/agent-plugin.d.ts +35 -0
- package/dist/plugins/agent-plugin.d.ts.map +1 -1
- package/dist/plugins/agent-plugin.js +142 -24
- package/dist/plugins/agent-plugin.js.map +1 -1
- package/dist/sandbox/manager.d.ts +12 -0
- package/dist/sandbox/manager.d.ts.map +1 -1
- package/dist/sandbox/manager.js +43 -2
- package/dist/sandbox/manager.js.map +1 -1
- package/dist/tools/modality/browser.d.ts +39 -3
- package/dist/tools/modality/browser.d.ts.map +1 -1
- package/dist/tools/modality/browser.js +113 -16
- package/dist/tools/modality/browser.js.map +1 -1
- package/dist/tools/optional-deps.d.ts +48 -0
- package/dist/tools/optional-deps.d.ts.map +1 -0
- package/dist/tools/optional-deps.js +42 -0
- package/dist/tools/optional-deps.js.map +1 -0
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +68 -11
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/remediation-ladder.d.ts.map +1 -1
- package/dist/tools/remediation-ladder.js +9 -1
- package/dist/tools/remediation-ladder.js.map +1 -1
- package/dist/tools/tool-loop.d.ts +41 -3
- package/dist/tools/tool-loop.d.ts.map +1 -1
- package/dist/tools/tool-loop.js +317 -9
- package/dist/tools/tool-loop.js.map +1 -1
- package/dist/web-dashboard/chat-retry.d.ts +11 -1
- package/dist/web-dashboard/chat-retry.d.ts.map +1 -1
- package/dist/web-dashboard/chat-retry.js +18 -4
- package/dist/web-dashboard/chat-retry.js.map +1 -1
- package/dist/web-dashboard/server.d.ts.map +1 -1
- package/dist/web-dashboard/server.js +349 -2
- package/dist/web-dashboard/server.js.map +1 -1
- package/package.json +6 -2
- package/src/web-dashboard/public/assets/{index-DeD3L0kG.js → index-Bik91KJh.js} +115 -89
- package/src/web-dashboard/public/assets/index-Bik91KJh.js.map +1 -0
- package/src/web-dashboard/public/index.html +1 -1
- package/src/web-dashboard/public/assets/index-DeD3L0kG.js.map +0 -1
package/dist/cli/chat.d.ts
CHANGED
|
@@ -81,12 +81,142 @@ export declare function runDeveloperMode(goal: string, configManager: any, optio
|
|
|
81
81
|
* caller, never to skip the loop).
|
|
82
82
|
*/
|
|
83
83
|
/**
|
|
84
|
-
* Backoff schedule for a SAME-provider retry on a
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
84
|
+
* Backoff schedule for a SAME-provider retry on a TRANSIENT failure
|
|
85
|
+
* (server/network/timeout): dense early, sparse late — attempts at ≈1s, 3s, 7s,
|
|
86
|
+
* 15s, 30s, 60s.
|
|
87
|
+
*
|
|
88
|
+
* WHY THE SHAPE CHANGED (it was `[5s, 10s, 20s, 30s]`, front-loaded). A fixed
|
|
89
|
+
* front-loaded schedule is wrong in BOTH directions at once:
|
|
90
|
+
*
|
|
91
|
+
* - A TWO-SECOND BLINK WAS NOT CAUGHT. A cloud endpoint routinely returns 200,
|
|
92
|
+
* then a couple of empty/5xx answers for a handful of seconds, then serves
|
|
93
|
+
* normally again (measured repeatedly on `deepseek`). The first retry sat at
|
|
94
|
+
* t=5s, so the wait outlived the blink AND, because exhausting this schedule
|
|
95
|
+
* is what starts the failover walk, a healthy strong model was declared dead
|
|
96
|
+
* and the turn folded onto a weaker one. A retry at t≈1s catches the blink
|
|
97
|
+
* outright.
|
|
98
|
+
* - THE TOTAL STILL HAS TO RIDE OUT A REAL SPIKE. A capacity spike, an
|
|
99
|
+
* upstream batch job or a rolling restart lasts tens of seconds, so the late
|
|
100
|
+
* delays stay sparse and the total stays ~60s. Nothing that used to be
|
|
101
|
+
* ridden out is given up on; the wait is just spent where the evidence is.
|
|
102
|
+
*
|
|
103
|
+
* THIS IS THE NO-EVIDENCE DEFAULT, NOT THE WHOLE POLICY. The schedule used per
|
|
104
|
+
* call comes from {@link planBlipPatience} — which also decides whether walking
|
|
105
|
+
* away is a remedy at all, from the pair's alternatives, its track record, and
|
|
106
|
+
* whether it already failed an earlier step of this turn. This constant is what
|
|
107
|
+
* every caller with no evidence gets, and it is what the `models`/parity
|
|
108
|
+
* harnesses see.
|
|
109
|
+
*
|
|
110
|
+
* Every sleep is CANCELLABLE (see `abortableSleep`), so an Esc during a 30s wait
|
|
111
|
+
* stops the turn immediately instead of after it.
|
|
112
|
+
*/
|
|
113
|
+
export declare const TRANSIENT_RETRY_DELAYS_MS: readonly [1000, 2000, 4000, 8000, 15000, 30000];
|
|
114
|
+
/**
|
|
115
|
+
* Resolve the backoff schedule actually used (env override → default).
|
|
116
|
+
*
|
|
117
|
+
* `NUVIRA_TRANSIENT_RETRY_DELAYS_MS` takes a comma-separated list of ms
|
|
118
|
+
* (`"5000,10000"`), so how long a foreground turn waits on a flapping provider
|
|
119
|
+
* is a CONFIGURATION decision rather than a property of the build — the same
|
|
120
|
+
* rule the warmup sweep's bounds follow. A headless gateway, a CI contract
|
|
121
|
+
* test or a user on a metered connection can dial it down (or to `0`) without a
|
|
122
|
+
* source edit and a rebuild; nonsense is ignored and the default stands.
|
|
123
|
+
*
|
|
124
|
+
* Read PER CALL, not captured at import, so a test observes the value in force
|
|
125
|
+
* at that moment.
|
|
126
|
+
*/
|
|
127
|
+
export declare function transientRetryDelaysMs(env?: NodeJS.ProcessEnv): readonly number[];
|
|
128
|
+
/**
|
|
129
|
+
* Is the transient schedule overridden by the environment right now?
|
|
130
|
+
*
|
|
131
|
+
* The dial is authoritative when set (it is an explicit configuration decision,
|
|
132
|
+
* and it is what makes attempt COUNTS deterministic in the parity/E2E
|
|
133
|
+
* contracts), so callers ask this BEFORE substituting an evidence-derived
|
|
134
|
+
* schedule — otherwise a test would silently get the learned schedule and its
|
|
135
|
+
* exact call-count assertions would be about a different policy than the one it
|
|
136
|
+
* dialed.
|
|
137
|
+
*
|
|
138
|
+
* A set-but-nonsense value does NOT count as an override: `transientRetryDelaysMs`
|
|
139
|
+
* ignores it and falls back to the shipped schedule, so the evidence-derived
|
|
140
|
+
* schedule would be overridden by nothing.
|
|
88
141
|
*/
|
|
89
|
-
export declare
|
|
142
|
+
export declare function transientRetryScheduleOverridden(env?: NodeJS.ProcessEnv): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Bounded extra same-model patience for an `empty-response` — the "final verse"
|
|
145
|
+
* case, granted ONLY to a pair that has already delivered real work this turn.
|
|
146
|
+
*
|
|
147
|
+
* THE TWO CASES LOOK IDENTICAL TO THE CLASSIFIER AND MUST NOT BE TREATED ALIKE:
|
|
148
|
+
*
|
|
149
|
+
* - a BROKEN pair answers nothing, forever. The codebase already measured the
|
|
150
|
+
* cost of re-asking it: "5 empty responses on one model" in one turn, no
|
|
151
|
+
* failover, which is why `empty-response` was removed from
|
|
152
|
+
* `TRANSIENT_RETRY_TYPES` and why the handoff/walk is what remedies it.
|
|
153
|
+
* - a pair that just finished four GOOD steps and then returns nothing is
|
|
154
|
+
* having a blip at the END of real work — the expensive case, because the
|
|
155
|
+
* turn already paid for the context, the tool results and the edits, and a
|
|
156
|
+
* single empty reply would otherwise discard all of it.
|
|
157
|
+
*
|
|
158
|
+
* The discriminator is EVIDENCE, not a heuristic on the reply. Two halves, both
|
|
159
|
+
* required to be absent before we give up on a pair: a completed tool call in
|
|
160
|
+
* THIS turn (`threadHasDeliveredWork`), and the registry's own record for the
|
|
161
|
+
* pair — verified by TELEMETRY or a spot-check, with a low error rate
|
|
162
|
+
* (`hasProvenTrackRecord` in `retry-patience.ts`, which is where the rule now
|
|
163
|
+
* lives so it cannot drift). So a pair that answers nothing from the start with
|
|
164
|
+
* no track record still fails over immediately, a proven pair's FIRST empty
|
|
165
|
+
* reply gets these two short waits, and a proven pair whose only alternatives
|
|
166
|
+
* would DE-ESCALATE gets the longer
|
|
167
|
+
* `EMPTY_PATIENCE_WAIT_BEATS_FOLDING_MS` schedule rather than folding down a
|
|
168
|
+
* capability band. Bounded by design, and always finite.
|
|
169
|
+
*
|
|
170
|
+
* The value is re-exported from `retry-patience.ts`: ONE table for the whole
|
|
171
|
+
* blip policy, so the CLI and any other caller cannot drift apart.
|
|
172
|
+
*/
|
|
173
|
+
export declare const EMPTY_RESPONSE_PATIENCE_MS: readonly [2000, 5000];
|
|
174
|
+
/**
|
|
175
|
+
* Has this turn already produced real, OBSERVED work on this thread?
|
|
176
|
+
*
|
|
177
|
+
* Structural, not a counter: an assistant step that ASKED for a tool and the
|
|
178
|
+
* tool result that came back for it. That is the cheapest honest evidence that
|
|
179
|
+
* the pair under us has already served this turn — a pair that has not is given
|
|
180
|
+
* no `empty-response` patience at all, so the "ask a broken model five times"
|
|
181
|
+
* loop stays impossible.
|
|
182
|
+
*/
|
|
183
|
+
export declare function threadHasDeliveredWork(thread: readonly {
|
|
184
|
+
role: string;
|
|
185
|
+
toolCalls?: unknown[];
|
|
186
|
+
}[]): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* How long a PINNED + STRICT pair is given to answer before the user is asked
|
|
189
|
+
* what to do next (ms).
|
|
190
|
+
*
|
|
191
|
+
* WHY A WAIT AT ALL, and why two minutes. A pinned+strict turn is an explicit
|
|
192
|
+
* quality contract: the user would rather wait than be answered by a model they
|
|
193
|
+
* did not choose. A provider having a slow moment (or an upstream batch job) is
|
|
194
|
+
* exactly the case that contract covers, so the SAME pair is retried inside this
|
|
195
|
+
* window before anything else can happen. Two minutes is the bar the user set: it
|
|
196
|
+
* rides out a bad minute at a shared endpoint, while a genuinely dead provider no
|
|
197
|
+
* longer holds the turn for the ~5 minutes that prompted the complaint. NOTHING
|
|
198
|
+
* is routed to another model inside this window.
|
|
199
|
+
*/
|
|
200
|
+
export declare const PINNED_SAME_PAIR_GRACE_MS = 120000;
|
|
201
|
+
/**
|
|
202
|
+
* Backoff between retries of the SAME pinned pair. Summed with the call time,
|
|
203
|
+
* these reach the {@link PINNED_SAME_PAIR_GRACE_MS} budget.
|
|
204
|
+
*/
|
|
205
|
+
export declare const PINNED_GRACE_BACKOFF_MS: readonly [5000, 15000, 30000, 45000];
|
|
206
|
+
/**
|
|
207
|
+
* How long the user has to answer the pinned-failure question before the turn
|
|
208
|
+
* stops honestly (ms).
|
|
209
|
+
*
|
|
210
|
+
* Without a bound the turn waits on the question FOREVER: the console's
|
|
211
|
+
* `askQuestion` promise is deliberately never rejected (worst case the model
|
|
212
|
+
* proceeds on best judgment), so a client that renders the card and is then
|
|
213
|
+
* closed — or a headless caller that never answers — would hold the turn (and its
|
|
214
|
+
* `busy` slot) open indefinitely. Measured live while probing the endpoint: the
|
|
215
|
+
* HTTP request sat open until it was cancelled by hand. Five minutes is generous
|
|
216
|
+
* for a person reading the options, and the answer is a choice, not a dependency:
|
|
217
|
+
* stopping with the pin's own error is the honest outcome once nobody answers.
|
|
218
|
+
*/
|
|
219
|
+
export declare const PINNED_ANSWER_TIMEOUT_MS = 300000;
|
|
90
220
|
/**
|
|
91
221
|
* Run one provider attempt, retrying transient failures against the SAME
|
|
92
222
|
* provider before giving up.
|
|
@@ -100,8 +230,22 @@ export declare const TRANSIENT_RETRY_DELAYS_MS: readonly [1000, 3000];
|
|
|
100
230
|
*
|
|
101
231
|
* Never retries: non-transient classes (auth, rate-limit, model/harness faults),
|
|
102
232
|
* a cancelled turn, or once the schedule is exhausted.
|
|
233
|
+
*
|
|
234
|
+
* `emptyResponseDelaysMs` is the ONE narrowly-scoped exception, and it exists in
|
|
235
|
+
* this helper rather than in `TRANSIENT_RETRY_TYPES` because retryability here
|
|
236
|
+
* depends on the TURN, not only on the error class: pass it only when the pair
|
|
237
|
+
* has a track record this turn (see {@link threadHasDeliveredWork}). Omitted →
|
|
238
|
+
* an empty response is not retried at all, byte for byte the old behaviour.
|
|
239
|
+
*
|
|
240
|
+
* `transientDelaysMs` is the caller's EVIDENCE-DERIVED schedule
|
|
241
|
+
* ({@link planBlipPatience}) for server/network/timeout failures. Omitted → the
|
|
242
|
+
* shipped default / env dial (`transientRetryDelaysMs`), which is what a caller
|
|
243
|
+
* with no evidence (a test, a headless path) gets.
|
|
103
244
|
*/
|
|
104
|
-
export declare function generateWithTransientRetry<T>(attempt: () => Promise<T>, signal?: AbortSignal, onRetry?: (attemptNumber: number, err: unknown) => void
|
|
245
|
+
export declare function generateWithTransientRetry<T>(attempt: () => Promise<T>, signal?: AbortSignal, onRetry?: (attemptNumber: number, err: unknown) => void, opts?: {
|
|
246
|
+
emptyResponseDelaysMs?: readonly number[];
|
|
247
|
+
transientDelaysMs?: readonly number[];
|
|
248
|
+
}): Promise<T>;
|
|
105
249
|
/**
|
|
106
250
|
* Exported for the release gate (`tests/release/agent-contracts.test.ts`): the
|
|
107
251
|
* assembled system prompt's SIZE and its required contract clauses are a
|
|
@@ -546,6 +690,58 @@ export declare class ChatCommand extends BaseCommand {
|
|
|
546
690
|
* interactive mode turns a chosen followup into the next message).
|
|
547
691
|
*/
|
|
548
692
|
private runChatAnswer;
|
|
693
|
+
/**
|
|
694
|
+
* Providers that could TAKE OVER from a pin, split by capability class.
|
|
695
|
+
*
|
|
696
|
+
* Only providers with credentials are considered, and each contributes the
|
|
697
|
+
* model `sameClassFallback` would choose for it — so the "switch to …" offer
|
|
698
|
+
* is a pair the router would actually serve, never a name invented here.
|
|
699
|
+
*/
|
|
700
|
+
private pinAlternatives;
|
|
701
|
+
/**
|
|
702
|
+
* Read a user-typed choice as `provider/model` (or a bare model id).
|
|
703
|
+
*
|
|
704
|
+
* A bare id keeps the PINNED provider — that is what "another model" means when
|
|
705
|
+
* the user was asked about a pinned turn. A prefixed value is only accepted as a
|
|
706
|
+
* provider when it RESOLVES to one, so a model id that merely contains a slash
|
|
707
|
+
* (`openai/gpt-oss-120b`) is not mistaken for a provider name.
|
|
708
|
+
*/
|
|
709
|
+
private parsePinChoice;
|
|
710
|
+
/**
|
|
711
|
+
* Serve ONE step on a pair the USER named, validated AS A PAIR.
|
|
712
|
+
*
|
|
713
|
+
* `resolveRoute` is asked in strict mode, so a pair the provider cannot serve is
|
|
714
|
+
* REFUSED rather than silently substituted — the same guarantee every other
|
|
715
|
+
* pinned call gets (issue #9: a model id sent to the wrong provider is the bug
|
|
716
|
+
* class this covers). Returns null when the pair cannot be used or the call
|
|
717
|
+
* fails, leaving the honest stop in place rather than switching anyway.
|
|
718
|
+
*/
|
|
719
|
+
private serveChosenPair;
|
|
720
|
+
/**
|
|
721
|
+
* PINNED + STRICT and the pin did not answer: wait on the SAME model, then let
|
|
722
|
+
* the USER decide — never a silent substitution.
|
|
723
|
+
*
|
|
724
|
+
* WHY THIS EXISTS. The user pinned a model AND turned strict mode on. That is a
|
|
725
|
+
* quality contract, and the old behaviour broke it in the one direction they
|
|
726
|
+
* explicitly forbade: rather than wait, or say what was happening, a failed pin
|
|
727
|
+
* either dead-ended in "the language model was unavailable" or (non-strict) was
|
|
728
|
+
* handed to whatever the health ranking liked — including `local/qwen2.5:0.5b`, a
|
|
729
|
+
* model that cannot call tools at all, so its "answer" was fabricated rather
|
|
730
|
+
* than merely weaker. Sending that work to a weak model is not a degraded answer;
|
|
731
|
+
* for an agentic turn it is a wrong one.
|
|
732
|
+
*
|
|
733
|
+
* So: the SAME pair is retried inside {@link PINNED_SAME_PAIR_GRACE_MS} first
|
|
734
|
+
* (nothing is routed anywhere in that window), and if it still does not answer
|
|
735
|
+
* the user is asked — keep trying, switch to the closest SAME-CLASS model the
|
|
736
|
+
* agent can find and name, type another model/provider, or release the pin to
|
|
737
|
+
* auto. The question says outright that nothing has been routed elsewhere.
|
|
738
|
+
*
|
|
739
|
+
* Returns a served response when the user's choice works; `null` when the turn
|
|
740
|
+
* must fail honestly — headless (no one to ask: the strict refusal stands, as
|
|
741
|
+
* it must, because silently choosing FOR the user is the original defect), or
|
|
742
|
+
* when the chosen pair could not serve.
|
|
743
|
+
*/
|
|
744
|
+
private pinnedStrictEscalation;
|
|
549
745
|
/**
|
|
550
746
|
* E3b — the model-call step for the tool loop:
|
|
551
747
|
* native generateTools when the provider supports it, JSON fallback
|
package/dist/cli/chat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/cli/chat.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAc,MAAM,eAAe,CAAC;AAiBxD,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,gCAAgC,CAAC;AAqCxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAqBtD,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/cli/chat.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAc,MAAM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