@caupulican/pi-adaptative 0.80.68 → 0.80.70
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 +12 -0
- package/dist/modes/interactive/interactive-mode.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +28 -2
- package/dist/modes/interactive/interactive-mode.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
|
@@ -4814,6 +4814,23 @@ export class InteractiveMode {
|
|
|
4814
4814
|
* warranted, run the in-process {@link AgentSession.runReflectionPass} as a fire-and-forget
|
|
4815
4815
|
* background microtask. No subprocess, no blocking of the UI.
|
|
4816
4816
|
*/
|
|
4817
|
+
/**
|
|
4818
|
+
* Resolve the model + thinking level the native reflection pass should use, from auto-learn
|
|
4819
|
+
* settings (`model`, `thinkingLevel`). The configured model is honored only when its provider is
|
|
4820
|
+
* AVAILABLE (api key / logged in) — otherwise we fall back to the session model (undefined). This
|
|
4821
|
+
* lets the user pick a balanced/cheaper reflection model without risking an unusable one.
|
|
4822
|
+
*/
|
|
4823
|
+
_resolveReflectionModel(settings) {
|
|
4824
|
+
let model;
|
|
4825
|
+
if (settings.model && settings.model !== "active") {
|
|
4826
|
+
const resolved = resolveCliModel({ cliModel: settings.model, modelRegistry: this.session.modelRegistry });
|
|
4827
|
+
if (resolved.model && this.session.modelRegistry.hasConfiguredAuth(resolved.model)) {
|
|
4828
|
+
model = resolved.model;
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
const thinkingLevel = settings.thinkingLevel ?? "low";
|
|
4832
|
+
return { model, thinkingLevel };
|
|
4833
|
+
}
|
|
4817
4834
|
maybeRunNativeReflection(messages) {
|
|
4818
4835
|
if (!this.isNativeReflectionEnabled())
|
|
4819
4836
|
return;
|
|
@@ -4839,13 +4856,22 @@ export class InteractiveMode {
|
|
|
4839
4856
|
.filter(Boolean)
|
|
4840
4857
|
.join("\n");
|
|
4841
4858
|
// Stable per-turn id so a duplicate scheduling/retry can't double-count the reflection cost.
|
|
4842
|
-
|
|
4843
|
-
|
|
4859
|
+
// Messages carry no `id` on the real path (only timestamps), so derive the key from the last
|
|
4860
|
+
// message's timestamp + the turn size — present on every real turn, stable across a retry of the
|
|
4861
|
+
// same agent_end, and distinct between turns. Falls back to a content signature if needed.
|
|
4862
|
+
const last = messages[messages.length - 1];
|
|
4863
|
+
const turnKey = last?.id ?? (last?.timestamp != null ? `${last.timestamp}:${recentTurnText.length}` : undefined);
|
|
4864
|
+
const reportId = turnKey ? `reflection:${turnKey}` : undefined;
|
|
4865
|
+
// User-configurable reflection model + thinking (auto-learn settings), restricted to AVAILABLE
|
|
4866
|
+
// (authed) models — falls back to the session model when unset or unavailable.
|
|
4867
|
+
const { model, thinkingLevel } = this._resolveReflectionModel(settings);
|
|
4844
4868
|
void this.session
|
|
4845
4869
|
.runReflectionPass({
|
|
4846
4870
|
signals: { trigger, toolCallCount, hadCorrection, contextHeadroomPct, usefulLately: 0 },
|
|
4847
4871
|
recentTurnText,
|
|
4848
4872
|
reportId,
|
|
4873
|
+
model,
|
|
4874
|
+
thinkingLevel,
|
|
4849
4875
|
})
|
|
4850
4876
|
.catch(() => {
|
|
4851
4877
|
// best-effort background learning; never disrupt the session
|