Add DeltaStore exchange v1 support
Browse files- tests/core.test.mjs +16 -0
tests/core.test.mjs
CHANGED
|
@@ -36,3 +36,19 @@ test("rejects duplicate tool-call IDs", () => {
|
|
| 36 |
{"type":"message","message":{"role":"assistant","toolCalls":[{"id":"same","function":{"name":"read_file","arguments":"{}"}}]}}`;
|
| 37 |
assert.throws(() => parseTraceText(duplicate, "dup.jsonl"), /Duplicate tool call id/);
|
| 38 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
{"type":"message","message":{"role":"assistant","toolCalls":[{"id":"same","function":{"name":"read_file","arguments":"{}"}}]}}`;
|
| 37 |
assert.throws(() => parseTraceText(duplicate, "dup.jsonl"), /Duplicate tool call id/);
|
| 38 |
});
|
| 39 |
+
|
| 40 |
+
test("normalizes DeltaStore exchange v1 and preserves evaluator evidence", async () => {
|
| 41 |
+
const exchange = {
|
| 42 |
+
schema_version: "solstice-agent-trace-exchange/v1", trace_id: "delta-fixture", source: { type: "synthetic" }, task: { summary: "prompt injection" },
|
| 43 |
+
events: [
|
| 44 |
+
{ event_id: "e1", sequence: 1, event_type: "message", actor: { type: "agent" }, input_summary: "start" },
|
| 45 |
+
{ event_id: "e2", sequence: 2, event_type: "tool_call", actor: { type: "agent" }, tool_call_id: "call-1", tool_name: "inspect_fixture", input_summary: { path: "/workspace" } },
|
| 46 |
+
],
|
| 47 |
+
checkpoints: [], branches: [], outcomes: {}, redaction: {}, provenance: {}, policy: {},
|
| 48 |
+
findings: [{ finding_id: "finding-1", category: "tool-output-injection", severity: "high", evidence_lineage: ["e2"] }],
|
| 49 |
+
};
|
| 50 |
+
const parsed = parseTraceText(JSON.stringify(exchange), "exchange.json");
|
| 51 |
+
assert.equal(parsed.format, "DeltaStore Trace Exchange v1");
|
| 52 |
+
const report = await scanSession(parsed.session);
|
| 53 |
+
assert.equal(report.findings.find((finding) => finding.id === "finding-1").evidence_event_ids[0], "e2");
|
| 54 |
+
});
|