Accept Scattermind private reading envelopes

This commit is contained in:
OpenClaw Bot
2026-05-27 19:57:34 +02:00
parent 85e2a83d3b
commit 9c35af237f
3 changed files with 51 additions and 4 deletions
+11 -3
View File
@@ -557,6 +557,10 @@ function looksLikeRankPayload(value = {}) {
|| value.snapshot
|| value.conceptMap
|| value.concept_map
|| value.reading
|| value.fullReading
|| value.full_reading
|| value.glimpse
|| value.buildOrder
|| value.build_order
|| value.lenses
@@ -782,6 +786,7 @@ function expandStoredScattermindReading(body = {}) {
|| original.full_reading_json
|| original.fullReading
|| original.full_reading
|| original.reading
|| original.conceptMapJson
|| original.concept_map_json
|| '';
@@ -791,11 +796,13 @@ function expandStoredScattermindReading(body = {}) {
if ((!parsedReading || !Object.keys(parsedReading).length) && (!parsedSnapshot || !Object.keys(parsedSnapshot).length)) return original;
const explicitSnapshot = objectFrom(original.snapshot || original.glimpse);
const explicitConceptMap = objectFrom(original.conceptMap || original.concept_map || original.reading || original.fullReading || original.full_reading);
const expanded = {
...parsedSnapshot,
...parsedReading,
...original,
snapshot: Object.keys(explicitSnapshot).length ? explicitSnapshot : parsedSnapshot,
conceptMap: Object.keys(explicitConceptMap).length ? explicitConceptMap : parsedReading,
lenses: original.lenses || parsedReading.lenses || parsedSnapshot.lenses,
threads_to_hold: original.threads_to_hold || original.threadsToHold || parsedReading.threads_to_hold || parsedReading.threadsToHold || parsedSnapshot.threads_to_hold || parsedSnapshot.threadsToHold,
questions_to_sit_with: original.questions_to_sit_with || original.questionsToSitWith || parsedReading.questions_to_sit_with || parsedReading.questionsToSitWith || parsedSnapshot.questions_to_sit_with || parsedSnapshot.questionsToSitWith,
@@ -1013,8 +1020,9 @@ function cleanContextText(value = '') {
}
function meaningfulTokens(text = '') {
const stop = new Set(['the', 'and', 'with', 'from', 'that', 'this', 'into', 'before', 'after', 'until', 'user', 'users', 'idea', 'ideas', 'build', 'order', 'works', 'first', 'avoid', 'without', 'more', 'full', 'proof', 'manual', 'value', 'layer', 'result', 'sense', 'copyable', 'source', 'traced', 'source-traced', 'evidence', 'thread', 'threads']);
return [...new Set(String(text).toLowerCase().match(/[a-z0-9][a-z0-9-]{3,}/g) || [])].filter(token => !stop.has(token)).slice(0, 8);
const guardrailScope = String(text || '').replace(/\b(until|unless|after proof|after one|after the|once)\b[\s\S]*$/i, '');
const stop = new Set(['the', 'and', 'with', 'from', 'that', 'this', 'into', 'before', 'after', 'until', 'unless', 'once', 'user', 'users', 'idea', 'ideas', 'build', 'order', 'works', 'first', 'avoid', 'without', 'more', 'full', 'proof', 'manual', 'value', 'layer', 'result', 'sense', 'copyable', 'source', 'traced', 'source-traced', 'evidence', 'thread', 'threads', 'real', 'interest']);
return [...new Set(guardrailScope.toLowerCase().match(/[a-z0-9][a-z0-9-]{3,}/g) || [])].filter(token => !stop.has(token)).slice(0, 8);
}
function isGuardrailAvoidanceMention(lowerText = '', token = '') {
@@ -1552,7 +1560,7 @@ function scoreOption(option, mode, context = '', decisionContext = {}) {
const normalizedLaneHint = normalizeLaneHint(laneHint);
const conflicts = nonGoalConflicts(`${option.title} ${option.description}`, decisionContext);
const nonGoalPenalty = Math.min(14, conflicts.length * 7);
const laneBoost = /do|first|now|build/.test(laneHint) ? 1.35 : /validate|test|proof/.test(laneHint) ? 0.35 : /defer|park|cut/.test(laneHint) ? -0.75 : 0;
const laneBoost = /do|first|now|build/.test(laneHint) ? 3.1 : /validate|test|proof/.test(laneHint) ? 0.25 : /defer|park|cut/.test(laneHint) ? -0.75 : 0;
const lanePenalty = normalizedLaneHint === 'park' ? 18 : normalizedLaneHint === 'defer' ? 9 : 0;
const heuristicMetrics = {
value: Math.min(10, 4.8 + hits(text, wordSets.value) * 0.9 + coreLoopHits * 0.8 + bridgeHits * 0.75 + proofHits * 0.2 + hits(context, wordSets.value) * 0.15),