@balpal4495/quorum 3.1.0 → 3.1.1
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/bin/commands/compass.js +31 -12
- package/package.json +1 -1
package/bin/commands/compass.js
CHANGED
|
@@ -270,18 +270,19 @@ function summarizeBehaviorMap(map) {
|
|
|
270
270
|
|
|
271
271
|
function computeScore(dims) {
|
|
272
272
|
const d = dims ?? {}
|
|
273
|
+
const n = (v) => { const f = parseFloat(v); return isNaN(f) ? 0 : f }
|
|
273
274
|
const raw =
|
|
274
|
-
(d.strategic_fit
|
|
275
|
-
(d.user_problem_clarity
|
|
276
|
-
(d.evidence_strength
|
|
277
|
-
(d.leverage
|
|
278
|
-
(d.feasibility
|
|
279
|
-
(d.time_to_signal
|
|
280
|
-
(d.reversibility
|
|
281
|
-
(d.complexity_penalty
|
|
282
|
-
(d.dependency_penalty
|
|
283
|
-
(d.contradiction_penalty
|
|
284
|
-
(d.evidence_gap_penalty
|
|
275
|
+
n(d.strategic_fit) * 20 +
|
|
276
|
+
n(d.user_problem_clarity) * 15 +
|
|
277
|
+
n(d.evidence_strength) * 20 +
|
|
278
|
+
n(d.leverage) * 10 +
|
|
279
|
+
n(d.feasibility) * 15 +
|
|
280
|
+
n(d.time_to_signal) * 10 +
|
|
281
|
+
n(d.reversibility) * 10 -
|
|
282
|
+
n(d.complexity_penalty) * 10 -
|
|
283
|
+
n(d.dependency_penalty) * 8 -
|
|
284
|
+
n(d.contradiction_penalty) * 15 -
|
|
285
|
+
n(d.evidence_gap_penalty) * 12
|
|
285
286
|
return { ...d, total: Math.max(0, Math.min(100, Math.round(raw))) }
|
|
286
287
|
}
|
|
287
288
|
|
|
@@ -393,7 +394,25 @@ Score total = strategic_fit*20 + user_problem_clarity*15 + evidence_strength*20
|
|
|
393
394
|
|
|
394
395
|
function parseLLMJson(raw) {
|
|
395
396
|
const cleaned = raw.replace(/^```(?:json)?\s*/m, "").replace(/\s*```$/m, "").trim()
|
|
396
|
-
|
|
397
|
+
try {
|
|
398
|
+
return JSON.parse(cleaned)
|
|
399
|
+
} catch (firstErr) {
|
|
400
|
+
// Salvage truncated responses: trim to last complete object boundary
|
|
401
|
+
const lastBrace = cleaned.lastIndexOf('},')
|
|
402
|
+
if (lastBrace !== -1) {
|
|
403
|
+
const salvaged = cleaned.slice(0, lastBrace + 1)
|
|
404
|
+
// Find the outermost container and close it
|
|
405
|
+
const openBracket = salvaged.indexOf('[')
|
|
406
|
+
const openBrace = salvaged.indexOf('{')
|
|
407
|
+
try {
|
|
408
|
+
if (openBracket !== -1 && (openBrace === -1 || openBracket < openBrace)) {
|
|
409
|
+
return JSON.parse(salvaged + ']}')
|
|
410
|
+
}
|
|
411
|
+
return JSON.parse(salvaged + '}')
|
|
412
|
+
} catch { /* fall through to original error */ }
|
|
413
|
+
}
|
|
414
|
+
throw firstErr
|
|
415
|
+
}
|
|
397
416
|
}
|
|
398
417
|
|
|
399
418
|
async function callLLM(llm, userPrompt) {
|