Files
2026-07-13 12:58:18 +08:00

66 lines
4.5 KiB
JSON

{
"_meta": {
"description": "D6 fixtures for ag2 / gen-ui-open + gen-ui-open-advanced",
"sourceFile": "d5-gen-ui-open.ts + d5-gen-ui-open-advanced.ts",
"created": "2026-05-22"
},
"fixtures": [
{
"_comment": "gen-ui-open — 3D axis visualization pill. The agent calls generateSandboxedUi which renders an iframe[srcdoc] with a non-trivial HTML payload (>= 100 chars). The probe asserts iframe presence + srcdoc length.",
"match": {
"userMessage": "3D axis visualization (model airplane)",
"hasToolResult": false,
"context": "ag2"
},
"response": {
"toolCalls": [
{
"id": "call_d6_open_genui_3d_001",
"name": "generateSandboxedUi",
"arguments": "{\"initialHeight\":400,\"placeholderMessages\":[\"Rendering 3D axis visualization…\"],\"css\":\"body{margin:0;background:#0f172a;display:flex;justify-content:center;align-items:center;height:100vh;font-family:system-ui}canvas{border-radius:8px;box-shadow:0 4px 24px rgba(0,0,0,.4)}#info{position:absolute;top:12px;left:12px;color:#94a3b8;font-size:12px}\",\"html\":\"<div id=\\\"info\\\">3D Axis — Model Airplane</div><canvas id=\\\"c\\\" width=\\\"400\\\" height=\\\"300\\\"></canvas>\",\"jsFunctions\":\"(function(){var c=document.getElementById('c');var ctx=c.getContext('2d');var cx=200,cy=150;function draw(t){ctx.clearRect(0,0,400,300);ctx.strokeStyle='#ef4444';ctx.beginPath();ctx.moveTo(cx,cy);ctx.lineTo(cx+Math.cos(t)*80,cy-Math.sin(t)*40);ctx.stroke();ctx.strokeStyle='#22c55e';ctx.beginPath();ctx.moveTo(cx,cy);ctx.lineTo(cx,cy-80);ctx.stroke();ctx.strokeStyle='#3b82f6';ctx.beginPath();ctx.moveTo(cx,cy);ctx.lineTo(cx-Math.sin(t)*60,cy-Math.cos(t)*30);ctx.stroke();ctx.fillStyle='#e2e8f0';ctx.font='10px system-ui';ctx.fillText('X',cx+Math.cos(t)*85,cy-Math.sin(t)*40);ctx.fillText('Y',cx-6,cy-85);ctx.fillText('Z',cx-Math.sin(t)*65,cy-Math.cos(t)*30);requestAnimationFrame(function(){draw(t+0.01);});}draw(0);})();\"}"
}
]
}
},
{
"_comment": "gen-ui-open — follow-up content after generateSandboxedUi returns.",
"match": {
"userMessage": "3D axis visualization (model airplane)",
"toolCallId": "call_d6_open_genui_3d_001",
"context": "ag2"
},
"response": {
"content": "3D axis visualization rendered above — the canvas shows rotating X (red), Y (green), and Z (blue) axes representing the model airplane's orientation."
}
},
{
"_comment": "gen-ui-open-advanced — Inline expression evaluator pill. The agent calls generateSandboxedUi with sandbox-functions, producing a sandboxed iframe with allow-scripts. The probe asserts iframe[sandbox*='allow-scripts'] is present.",
"match": {
"userMessage": "Inline expression evaluator",
"hasToolResult": false,
"context": "ag2"
},
"response": {
"toolCalls": [
{
"id": "call_d6_open_genui_advanced_eval_001",
"name": "generateSandboxedUi",
"arguments": "{\"initialHeight\":320,\"placeholderMessages\":[\"Building expression evaluator…\"],\"css\":\"body{margin:0;font-family:monospace;background:#1e293b;color:#e2e8f0;padding:16px}input{width:100%;padding:8px;background:#0f172a;border:1px solid #334155;border-radius:4px;color:#e2e8f0;font-family:monospace;font-size:14px;box-sizing:border-box}#result{margin-top:12px;padding:12px;background:#0f172a;border-radius:4px;min-height:24px;font-size:16px}label{display:block;margin-bottom:6px;color:#94a3b8;font-size:12px}\",\"html\":\"<label>Expression</label><input id=\\\"expr\\\" placeholder=\\\"e.g. 2 + 2 * 3\\\" /><div id=\\\"result\\\">—</div>\",\"jsFunctions\":\"(function(){var input=document.getElementById('expr');var result=document.getElementById('result');input.addEventListener('input',async function(){var val=input.value.trim();if(!val){result.textContent='—';return;}try{var res=await Websandbox.connection.remote.evaluateExpression({expression:val});result.textContent=res&&res.ok?String(res.value):'err';}catch(e){result.textContent='err';}});})();\"}"
}
]
}
},
{
"_comment": "gen-ui-open-advanced — follow-up content after generateSandboxedUi returns.",
"match": {
"userMessage": "Inline expression evaluator",
"toolCallId": "call_d6_open_genui_advanced_eval_001",
"context": "ag2"
},
"response": {
"content": "Expression evaluator rendered — type any math expression and it evaluates in real time via the sandbox bridge."
}
}
]
}