@caupulican/pi-adaptative 0.81.20 → 0.81.22
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/CHANGELOG.md +22 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +21 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +4 -1
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +2 -0
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js +92 -6
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/intent-classifier.js +1 -1
- package/dist/core/model-router/intent-classifier.js.map +1 -1
- package/dist/core/model-router/route-judge.d.ts.map +1 -1
- package/dist/core/model-router/route-judge.js +10 -6
- package/dist/core/model-router/route-judge.js.map +1 -1
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js +2 -1
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +27 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/models/context-sizing.d.ts.map +1 -1
- package/dist/core/models/context-sizing.js +18 -26
- package/dist/core/models/context-sizing.js.map +1 -1
- package/dist/core/models/local-runtime.d.ts +56 -4
- package/dist/core/models/local-runtime.d.ts.map +1 -1
- package/dist/core/models/local-runtime.js +286 -19
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/perf-profile.d.ts +3 -0
- package/dist/core/models/perf-profile.d.ts.map +1 -1
- package/dist/core/models/perf-profile.js +42 -13
- package/dist/core/models/perf-profile.js.map +1 -1
- package/dist/core/models/runtime-arbiter.d.ts +45 -0
- package/dist/core/models/runtime-arbiter.d.ts.map +1 -1
- package/dist/core/models/runtime-arbiter.js +115 -0
- package/dist/core/models/runtime-arbiter.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +25 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +24 -6
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -31,6 +31,7 @@ import { deriveModelCapabilityProfile, filterToolNamesForCapability, } from "./m
|
|
|
31
31
|
import { formatModelRouterModel, ModelRouterController } from "./model-router-controller.js";
|
|
32
32
|
import { ModelSelectionController } from "./model-selection-controller.js";
|
|
33
33
|
import { ModelAdaptationStore } from "./models/adaptation-store.js";
|
|
34
|
+
import { HF_TRANSFORMERS_PROVIDER, OLLAMA_PROVIDER } from "./models/local-registration.js";
|
|
34
35
|
import { DEFAULT_ADAPTIVE_STREAM_IDLE_CEILING_MS, estimateContextPromptTokens, resolveAdaptiveStreamIdleOptions, withModelPerfProfile, } from "./models/perf-profile.js";
|
|
35
36
|
import { ProfileFilterController } from "./profile-filter-controller.js";
|
|
36
37
|
import { expandPromptTemplate } from "./prompt-templates.js";
|
|
@@ -266,6 +267,7 @@ export class AgentSession {
|
|
|
266
267
|
base: { ...DEFAULT_STREAM_IDLE, ...configured },
|
|
267
268
|
profile,
|
|
268
269
|
promptTokens: estimateContextPromptTokens(context),
|
|
270
|
+
localClass: this._isWarmableLocalModel(model),
|
|
269
271
|
ceilingMs: httpIdleTimeoutMs === 0
|
|
270
272
|
? DEFAULT_ADAPTIVE_STREAM_IDLE_CEILING_MS
|
|
271
273
|
: Math.max(DEFAULT_STREAM_IDLE.quietIdleMs, httpIdleTimeoutMs - 60_000),
|
|
@@ -659,6 +661,21 @@ export class AgentSession {
|
|
|
659
661
|
options.apiKey = auth.apiKey;
|
|
660
662
|
options.headers = auth.headers;
|
|
661
663
|
}
|
|
664
|
+
if (controller.signal.aborted)
|
|
665
|
+
return;
|
|
666
|
+
if (model.provider === OLLAMA_PROVIDER || model.provider === HF_TRANSFORMERS_PROVIDER) {
|
|
667
|
+
await this._localRuntimeController.ensureRouteModelReady({
|
|
668
|
+
decision: {
|
|
669
|
+
tier: "cheap",
|
|
670
|
+
risk: "read-only",
|
|
671
|
+
confidence: 1,
|
|
672
|
+
reasonCode: "prefix_warmer",
|
|
673
|
+
reasons: ["prefix warmer residency"],
|
|
674
|
+
model: `${model.provider}/${model.id}`,
|
|
675
|
+
},
|
|
676
|
+
model,
|
|
677
|
+
});
|
|
678
|
+
}
|
|
662
679
|
if (controller.signal.aborted)
|
|
663
680
|
return;
|
|
664
681
|
const stream = await this.agent.streamFn(model, {
|
|
@@ -3074,7 +3091,7 @@ export class AgentSession {
|
|
|
3074
3091
|
willRetry: false,
|
|
3075
3092
|
skipReason: "no model selected",
|
|
3076
3093
|
});
|
|
3077
|
-
return
|
|
3094
|
+
return hadQueuedMessages || this.agent.hasQueuedMessages();
|
|
3078
3095
|
}
|
|
3079
3096
|
const contextWindow = model.contextWindow;
|
|
3080
3097
|
const margin = Math.max(0, Math.floor(0.01 * contextWindow));
|
|
@@ -3163,13 +3180,13 @@ export class AgentSession {
|
|
|
3163
3180
|
if (outcome.kind === "failed") {
|
|
3164
3181
|
if (outcome.reason === "aborted") {
|
|
3165
3182
|
this._emit({ type: "compaction_end", reason, result: undefined, aborted: true, willRetry: false });
|
|
3166
|
-
return
|
|
3183
|
+
return hadQueuedMessages || this.agent.hasQueuedMessages();
|
|
3167
3184
|
}
|
|
3168
3185
|
throw new Error(outcome.reason);
|
|
3169
3186
|
}
|
|
3170
3187
|
if (extensionCancelled || signal.aborted) {
|
|
3171
3188
|
this._emit({ type: "compaction_end", reason, result: undefined, aborted: true, willRetry: false });
|
|
3172
|
-
return
|
|
3189
|
+
return hadQueuedMessages || this.agent.hasQueuedMessages();
|
|
3173
3190
|
}
|
|
3174
3191
|
const result = outcome.kind === "success" ? outcome.result : lastCompaction;
|
|
3175
3192
|
if (!result) {
|
|
@@ -3198,7 +3215,7 @@ export class AgentSession {
|
|
|
3198
3215
|
? `Context overflow recovery failed: ${errorMessage}`
|
|
3199
3216
|
: `Auto-compaction failed: ${errorMessage}`,
|
|
3200
3217
|
});
|
|
3201
|
-
return
|
|
3218
|
+
return hadQueuedMessages || this.agent.hasQueuedMessages();
|
|
3202
3219
|
}
|
|
3203
3220
|
finally {
|
|
3204
3221
|
this._autoCompactionAbortController = undefined;
|