Harden pasted Scattermind JSON handoff

This commit is contained in:
OpenClaw Bot
2026-05-27 00:31:53 +02:00
parent c2f61bc959
commit fd0bb3857e
2 changed files with 64 additions and 4 deletions
+27 -1
View File
@@ -583,7 +583,33 @@ try {
assert.ok(embeddedJson.input.decisionContext.nonGoals.includes('Avoid saved workspaces before one copyable result lands'));
assert.deepEqual(embeddedJson.handoff.warnings, []);
console.log(JSON.stringify({ ok: true, top: data.ranked[0].id, hintedTop: hinted.ranked[0].id, actionTop: actions.ranked[0].id, nestedConceptTop: nestedConcept.ranked[0].id, nonGoalTop: nonGoal.ranked[0].id, structuredContextTop: structuredContext.ranked[0].id, lensOnlyTop: lensOnly.ranked[0].id, scattermindPaidShapeTop: scattermindPaidShape.ranked[0].id, mergedContextTop: mergedContext.ranked[0].id, embeddedJsonTop: embeddedJson.ranked[0].id, duplicateIds: duplicateIds.ranked.map(item => item.id), provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2));
const fencedJsonResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
optionsText: `Here is the Scattermind export I copied:\n\n\`\`\`json\n${JSON.stringify({
reference_code: 'SM-FENCE1',
working_name: 'Fenced pasted Concept Map',
ideaText: 'The user copied a fenced Scattermind JSON export plus surrounding prose.',
lenses: {
risk: 'Avoid saved workspaces and account dashboard before the first manual proof.',
channel: 'Build first: Fenced JSON handoff - detect the pasted Concept Map and defend the first move. Test manually: Copy the ranked brief into notes and ask one user what they would do next. Probably noise: Account dashboard with saved workspaces and collaboration.',
},
})}\n\`\`\`\n\nPlease rank this.`,
mode: 'mvp',
}),
});
assert.equal(fencedJsonResponse.status, 200);
const fencedJson = await fencedJsonResponse.json();
assert.equal(fencedJson.input.embeddedPayloadSource, 'optionsText');
assert.equal(fencedJson.input.provenance.artifactId, 'SM-FENCE1');
assert.equal(fencedJson.input.optionCount, 3);
assert.equal(fencedJson.ranked[0].id, 'build-order-1');
assert.equal(fencedJson.ranked.find(item => item.id === 'build-order-3').lane.id, 'park');
assert.ok(fencedJson.input.decisionContext.nonGoals.includes('Avoid saved workspaces and account dashboard before the first manual proof'));
assert.deepEqual(fencedJson.handoff.warnings, []);
console.log(JSON.stringify({ ok: true, top: data.ranked[0].id, hintedTop: hinted.ranked[0].id, actionTop: actions.ranked[0].id, nestedConceptTop: nestedConcept.ranked[0].id, nonGoalTop: nonGoal.ranked[0].id, structuredContextTop: structuredContext.ranked[0].id, lensOnlyTop: lensOnly.ranked[0].id, scattermindPaidShapeTop: scattermindPaidShape.ranked[0].id, mergedContextTop: mergedContext.ranked[0].id, embeddedJsonTop: embeddedJson.ranked[0].id, fencedJsonTop: fencedJson.ranked[0].id, duplicateIds: duplicateIds.ranked.map(item => item.id), provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2));
} finally {
server.kill('SIGTERM');
}