| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| import { createHash } from 'crypto'
|
|
|
| const ABZU_URL = process.env.ABZU_URL || 'http://localhost:4000'
|
| const ABZU_SECRET = process.env.ABZU_SECRET || 'sovereign-abzu-bridge'
|
|
|
|
|
|
|
| export async function pushToAbzu(payload) {
|
| const ts = Date.now()
|
| const sig = createHash('sha256')
|
| .update(`${ABZU_SECRET}:${ts}:${JSON.stringify(payload)}`)
|
| .digest('hex')
|
| .slice(0, 16)
|
|
|
| const body = {
|
| channel: 'sovereign:gitlab',
|
| event: 'pipeline_result',
|
| payload,
|
| ts,
|
| sig,
|
| worm_hash: payload.worm,
|
| seal: '⬑ Ω ⺠Ψ ΠΠΣ Φ α',
|
| }
|
|
|
| try {
|
| const res = await fetch(`${ABZU_URL}/api/pipeline_event`, {
|
| method: 'POST',
|
| headers: {
|
| 'Content-Type': 'application/json',
|
| 'X-Sovereign-Sig': sig,
|
| 'X-Sovereign-Ts': ts.toString(),
|
| },
|
| body: JSON.stringify(body),
|
| signal: AbortSignal.timeout(5_000),
|
| })
|
|
|
| if (res.ok) {
|
| console.log(`[ABZU] Pipeline result pushed β ${ABZU_URL} β`)
|
| } else {
|
| console.warn(`[ABZU] Push failed: HTTP ${res.status}`)
|
| }
|
| } catch (err) {
|
|
|
| console.warn(`[ABZU] IDE offline (${err.message}) β result logged to WORM only`)
|
| }
|
| }
|
|
|
|
|
| export function formatForAbzu(frankensteinResult, gitlabContext) {
|
| const steps = frankensteinResult.steps || []
|
| return {
|
| pipeline_id: Date.now(),
|
| event: gitlabContext,
|
| brain: {
|
| output: steps.find(s => s.step === 'BRAIN')?.output || '',
|
| ms: steps.find(s => s.step === 'BRAIN')?.ms || 0,
|
| worm: steps.find(s => s.step === 'BRAIN')?.worm || '',
|
| },
|
| hands: {
|
| output: steps.find(s => s.step === 'HANDS')?.output || '',
|
| ms: steps.find(s => s.step === 'HANDS')?.ms || 0,
|
| },
|
| legs: {
|
| output: steps.find(s => s.step === 'LEGS')?.output || '',
|
| ms: steps.find(s => s.step === 'LEGS')?.ms || 0,
|
| worm: steps.find(s => s.step === 'LEGS')?.worm || '',
|
| model: steps.find(s => s.step === 'LEGS')?.model || '',
|
| },
|
| review: {
|
| output: frankensteinResult.final_out || '',
|
| worm: steps.find(s => s.step === 'REVIEW')?.worm || '',
|
| },
|
| chain_hash: frankensteinResult.worm?.hash || '',
|
| total_seals: frankensteinResult.worm?.seals || 0,
|
| }
|
| }
|
|
|