71 lines
3.7 KiB
JSON
71 lines
3.7 KiB
JSON
{
|
|
"name": "OpenVINO Advisory Dry-Run Fragment",
|
|
"active": false,
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"values": {
|
|
"string": [
|
|
{"name": "schema", "value": "cron_n8n_event_v1"},
|
|
{"name": "source", "value": "n8n"},
|
|
{"name": "workflow", "value": "swarm-health-watchdog"},
|
|
{"name": "event_kind", "value": "health_check"},
|
|
{"name": "severity", "value": "warning"},
|
|
{"name": "subject", "value": "OpenVINO service health warning"},
|
|
{"name": "summary", "value": "Health probe reported a warning; no restart or send is authorized."},
|
|
{"name": "dedupe_key", "value": "service:openvino:warning"},
|
|
{"name": "dry_run", "value": "true"}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "set-normalized-event",
|
|
"name": "Set normalized advisory event",
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 2,
|
|
"position": [260, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "http://172.19.0.1:18830/v1/advisory/classify",
|
|
"sendBody": true,
|
|
"contentType": "json",
|
|
"jsonBody": "={{ JSON.stringify({ trace_id: 'n8n:' + $json.workflow + ':' + $now.toISO(), text: 'source=n8n workflow=' + $json.workflow + ' severity=' + $json.severity + ' kind=' + $json.event_kind + ' subject=' + $json.subject + ' summary=' + $json.summary + ' dedupe_key=' + $json.dedupe_key + ' dry_run=true authority=no-send,no-restart,no-memory' }) }}",
|
|
"options": {
|
|
"timeout": 20000
|
|
}
|
|
},
|
|
"id": "http-advisory-classify",
|
|
"name": "HTTP advisory classify dry-run",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4,
|
|
"position": [520, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const env = $json;\nconst labels = env.result?.labels || {};\nconst urgency = labels.urgency?.value || 'normal';\nconst severity = $('Set normalized advisory event').first().json.severity || 'normal';\nconst npuOk = env.npu_proof?.ok === true && (env.npu_proof?.npu_busy_delta_us || 0) > 0;\nlet recommendation = 'log';\nlet classification = 'no_op';\nconst reason_codes = [npuOk ? 'npu_proof_ok' : 'npu_proof_failed', `severity_${severity}`, `urgency_${urgency}`];\nif (npuOk && severity === 'critical') { recommendation = 'escalate'; classification = 'action_required'; }\nelse if (npuOk && (severity === 'warning' || urgency === 'high' || urgency === 'critical')) { recommendation = 'summarize'; classification = 'action_required'; }\nif (!npuOk) reason_codes.push('log_only_no_npu_claim');\nreturn [{ json: { schema: 'cron_n8n_advisory_decision_v1', trace_id: env.trace_id, source: 'n8n', workflow: $('Set normalized advisory event').first().json.workflow, dry_run: true, recommendation, classification, confidence: labels.urgency?.confidence || 0, reason_codes, npu_proof: env.npu_proof, authority: env.authority, next_gate: (recommendation === 'summarize' || recommendation === 'escalate') ? 'human_or_atlas_review_required_before_any_side_effect' : 'none_in_dry_run' } } }];"
|
|
},
|
|
"id": "map-dry-run-decision",
|
|
"name": "Map dry-run decision (no side effects)",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [780, 300]
|
|
}
|
|
],
|
|
"connections": {
|
|
"Set normalized advisory event": {
|
|
"main": [[{"node": "HTTP advisory classify dry-run", "type": "main", "index": 0}]]
|
|
},
|
|
"HTTP advisory classify dry-run": {
|
|
"main": [[{"node": "Map dry-run decision (no side effects)", "type": "main", "index": 0}]]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"pinData": {},
|
|
"staticData": null,
|
|
"tags": ["dry-run", "openvino", "advisory"]
|
|
}
|