Support Snapshot artifacts in Ranker bridge

This commit is contained in:
OpenClaw Bot
2026-05-27 01:13:29 +02:00
parent b69d7e5386
commit fcc81c254f
3 changed files with 69 additions and 7 deletions
+41
View File
@@ -237,6 +237,47 @@ try {
assert.equal(nestedConcept.ranked.find(item => item.id === 'lesson-library').lane.id, 'park');
assert.deepEqual(nestedConcept.handoff.warnings, []);
const snapshotOnlyResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sourceName: 'Scattermind',
schema: 'scattermind-snapshot-v1',
idea: 'Scattermind has only produced a Snapshot so far; Ranker should still defend a tiny continuation order.',
mode: 'mvp',
snapshot: {
id: 'snapshot_only_17',
title: 'Tiny audit service snapshot',
originalPrompt: 'I want to sell a small audit service but do not know what to build first.',
targetAudience: 'Overwhelmed solo service seller',
context: {
constraints: ['Manual proof before product shell'],
nonGoals: ['Avoid accounts and saved workspaces'],
assumptions: ['A one-page promise can validate demand'],
},
nextActions: [
{ id: 'promise-proof', action: 'One-page promise proof', why: 'Use the Snapshot to test whether buyers understand the outcome before building app machinery.', evidence: 'Can 3 service sellers say what they would buy and why?', rankerHints: { value: 9, effort: 2, confidence: 8, urgency: 8, risk: 2 } },
{ id: 'copyable-brief', action: 'Copyable audit brief', why: 'Turn the defended order into a plain text follow-up.', evidence: 'Does the copied brief make the next move obvious?', suggestedLane: 'validate-next' },
],
parkingLot: [
{ id: 'seller-workspace', action: 'Saved seller workspace', why: 'Accounts, saved projects, dashboard, billing, and collaboration for each service seller.', evidence: 'No proof yet' },
],
},
}),
});
assert.equal(snapshotOnlyResponse.status, 200);
const snapshotOnly = await snapshotOnlyResponse.json();
assert.equal(snapshotOnly.input.provenance.artifactId, 'snapshot_only_17');
assert.equal(snapshotOnly.input.provenance.snapshotTitle, 'Tiny audit service snapshot');
assert.equal(snapshotOnly.input.decisionContext.targetAudience, 'Overwhelmed solo service seller');
assert.deepEqual(snapshotOnly.input.decisionContext.nonGoals, ['Avoid accounts and saved workspaces']);
assert.equal(snapshotOnly.ranked[0].id, 'promise-proof', 'Snapshot nextActions should rank without waiting for a Concept Map wrapper');
assert.equal(snapshotOnly.ranked.find(item => item.id === 'promise-proof').provenance.sourceSection, 'snapshot.nextActions');
assert.equal(snapshotOnly.ranked.find(item => item.id === 'copyable-brief').lane.id, 'test');
assert.equal(snapshotOnly.ranked.find(item => item.id === 'seller-workspace').lane.id, 'park');
assert.equal(snapshotOnly.handoff.source.requiresSourceTrace, true);
assert.deepEqual(snapshotOnly.handoff.warnings, []);
const sectionedConceptResponse = await fetch(`${base}/api/rank-feedback`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },