@yeaft/webchat-agent 0.1.598 → 0.1.599
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/package.json +1 -1
- package/unify/engine.js +29 -1
package/package.json
CHANGED
package/unify/engine.js
CHANGED
|
@@ -30,6 +30,7 @@ import { getThreadStore, MAIN_THREAD_ID } from './threads/store.js';
|
|
|
30
30
|
import { pickEffort, parseEffortPrefix } from './effort.js';
|
|
31
31
|
import { normalizeEffort } from './models.js';
|
|
32
32
|
import { attachRouterPlan, extractPriorPlan, stripMetaForWire } from './router/continuity.js';
|
|
33
|
+
import { resolveThinking } from './router/thinking.js';
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* task-324 — Turn cap removed.
|
|
@@ -743,7 +744,34 @@ export class Engine {
|
|
|
743
744
|
try {
|
|
744
745
|
// task-327b: resolve effort per-turn so the long-loop auto-bump
|
|
745
746
|
// kicks in once toolLoopTurns crosses the threshold.
|
|
746
|
-
|
|
747
|
+
let resolvedEffort = pickEffort({ scenario, toolLoopTurns, userEffort });
|
|
748
|
+
|
|
749
|
+
// DESIGN.md §9.16: thinking-mode precedence chain. When a VP
|
|
750
|
+
// persona is active, the router/continuity bookkeeping has more
|
|
751
|
+
// signal than the raw scenario tag — the prior assistant turn's
|
|
752
|
+
// routerPlan, the VP's role default, and the global config all
|
|
753
|
+
// outrank the scenario picker for `'high'|'max'`. UI/userEffort
|
|
754
|
+
// is already honoured by pickEffort (highest precedence).
|
|
755
|
+
if (vpPersona && vpPersona.vpId) {
|
|
756
|
+
const priorPlan = extractPriorPlan(conversationMessages, vpPersona.vpId);
|
|
757
|
+
const thinkingCfg = (this.#config && this.#config.thinking) || {};
|
|
758
|
+
const resolved = resolveThinking({
|
|
759
|
+
uiOverride: (userEffort === 'max' || userEffort === 'high') ? userEffort : null,
|
|
760
|
+
routerPlan: null, // PR-C scope: priorPlan continuity only;
|
|
761
|
+
// live router-plan thinking is a follow-up.
|
|
762
|
+
priorPlan: priorPlan && priorPlan.thinking ? priorPlan.thinking : null,
|
|
763
|
+
vpDefault: typeof vpPersona.thinking === 'string' ? vpPersona.thinking : null,
|
|
764
|
+
globalDefault: typeof thinkingCfg.default === 'string' ? thinkingCfg.default : null,
|
|
765
|
+
allowRouterEscalate: thinkingCfg.allowRouterEscalate !== false,
|
|
766
|
+
});
|
|
767
|
+
// Only adopt the chain's choice when it strengthens the
|
|
768
|
+
// baseline. We never weaken below pickEffort (e.g. consolidate
|
|
769
|
+
// = 'max' must not be downgraded to 'high' just because the VP
|
|
770
|
+
// default is 'high').
|
|
771
|
+
if (resolved.value === 'max' || (resolved.value === 'high' && resolvedEffort === 'low')) {
|
|
772
|
+
resolvedEffort = resolved.value;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
747
775
|
|
|
748
776
|
// Stream from adapter
|
|
749
777
|
for await (const event of this.#adapter.stream({
|