lynkr 9.14.21 → 9.14.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/package.json
CHANGED
|
@@ -113,9 +113,30 @@ const FORCE_REASONING_PATTERNS = [
|
|
|
113
113
|
// and generic nouns (module/api/database) that misfire on non-technical
|
|
114
114
|
// asks. Known overlap: "explain the deployment plan" fires — accepted,
|
|
115
115
|
// deployment planning benefits from the strong model anyway.
|
|
116
|
-
|
|
116
|
+
// NOTE: the frontier-planning trigger lives below as two independent
|
|
117
|
+
// regexes (PLANNING_ASK_RE / TECHNICAL_SCOPE_RE), not in this array.
|
|
117
118
|
];
|
|
118
119
|
|
|
120
|
+
// Frontier planning (the removed array entry above): asking FOR a
|
|
121
|
+
// plan/strategy/design of technical work — a plan word AND a technical
|
|
122
|
+
// scope word must both be present, so "plan my vacation", "lesson plan"
|
|
123
|
+
// and "business plan" stay quiet while "give me a plan to refactor X"
|
|
124
|
+
// escalates. Implemented as two independent whole-content tests instead of
|
|
125
|
+
// a single (?=.*A)(?=.*B) lookahead regex: `.` never crosses a newline, so
|
|
126
|
+
// on long lines every start position rescans `.*` to end-of-line — O(n²).
|
|
127
|
+
// A single 200KB line measured 61s per call, ×2 calls per request via
|
|
128
|
+
// determineProviderSmart → 150s+ end-to-end (live incident 2026-10-15:
|
|
129
|
+
// /v1/messages 50k-token single-line probe). Two linear passes preserve
|
|
130
|
+
// the documented intent: co-occurrence anywhere in the ask, either order.
|
|
131
|
+
const PLANNING_ASK_RE =
|
|
132
|
+
/\b(plans?|roadmaps?|strateg(y|ies)|blueprints?|proposals?|rfcs?|design\s+docs?)\b/i;
|
|
133
|
+
const TECHNICAL_SCOPE_RE =
|
|
134
|
+
/\b(refactor\w*|implement\w*|migrat\w+|architect\w+|redesign\w*|restructur\w+|rewrit\w+|overhaul\w*|codebases?|infrastructure|pipelines?|deploy\w*|systems?)\b/i;
|
|
135
|
+
|
|
136
|
+
function isFrontierPlanningAsk(content) {
|
|
137
|
+
return PLANNING_ASK_RE.test(content) && TECHNICAL_SCOPE_RE.test(content);
|
|
138
|
+
}
|
|
139
|
+
|
|
119
140
|
// Force COMPLEX patterns - route to COMPLEX (GLM in config B) regardless of
|
|
120
141
|
// score. Architecture/refactor/code-review are substantial but not
|
|
121
142
|
// security-critical, so GLM is appropriate.
|
|
@@ -506,6 +527,10 @@ function scoreTaskType(content) {
|
|
|
506
527
|
}
|
|
507
528
|
}
|
|
508
529
|
|
|
530
|
+
if (isFrontierPlanningAsk(content)) {
|
|
531
|
+
return { score: 100, reason: 'force_reasoning', pattern: 'frontier_planning_two_sided' };
|
|
532
|
+
}
|
|
533
|
+
|
|
509
534
|
for (const pattern of FORCE_LOCAL_PATTERNS) {
|
|
510
535
|
if (pattern.test(content)) {
|
|
511
536
|
return { score: 0, reason: 'force_local', pattern: 'greeting_or_simple' };
|
|
@@ -1005,7 +1030,8 @@ function shouldForceCloud(payload) {
|
|
|
1005
1030
|
function shouldForceReasoning(payload) {
|
|
1006
1031
|
if (process.env.FORCE_TIER_PATTERNS === "false") return false;
|
|
1007
1032
|
const content = extractContent(payload);
|
|
1008
|
-
|
|
1033
|
+
let matched = FORCE_REASONING_PATTERNS.find((pattern) => pattern.test(content));
|
|
1034
|
+
if (!matched && isFrontierPlanningAsk(content)) matched = PLANNING_ASK_RE;
|
|
1009
1035
|
if (matched) {
|
|
1010
1036
|
logger.debug({ pattern: matched.source.slice(0, 50), text: content.slice(0, 100) }, '[Force] force_reasoning matched');
|
|
1011
1037
|
}
|
|
@@ -1159,6 +1185,9 @@ module.exports = {
|
|
|
1159
1185
|
FORCE_REASONING_PATTERNS,
|
|
1160
1186
|
FORCE_CLOUD_PATTERNS,
|
|
1161
1187
|
FORCE_LOCAL_PATTERNS,
|
|
1188
|
+
PLANNING_ASK_RE,
|
|
1189
|
+
TECHNICAL_SCOPE_RE,
|
|
1190
|
+
isFrontierPlanningAsk,
|
|
1162
1191
|
DIMENSION_WEIGHTS,
|
|
1163
1192
|
TOOL_COMPLEXITY_WEIGHTS,
|
|
1164
1193
|
DOMAIN_KEYWORDS,
|