Spaces:
Running
Running
Download interlink.ts from DJ-Goanna-Coding/Oppo-TIA: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/spaces/DJ-Goanna-Coding/Oppo-TIA/resolve/main/interlink.ts
- Command line
-
hf download hf://spaces/DJ-Goanna-Coding/Oppo-TIA/interlink.ts
-
curl -L -o interlink.ts https://huggingface.co/spaces/DJ-Goanna-Coding/Oppo-TIA/resolve/main/interlink.ts
1.17 kB
| /** | |
| * QGTNL Interlink Core | |
| * Connects TIA-∞, AION, and ORACLE through a shared message bus. | |
| * Enables safe, structured communication between the Three Pillars. | |
| */ | |
| export type Pillar = "TIA" | "AION" | "ORACLE"; | |
| export interface InterlinkMessage { | |
| from: Pillar; | |
| to: Pillar | "ALL"; | |
| timestamp: number; | |
| type: string; | |
| payload: any; | |
| } | |
| export interface InterlinkState { | |
| history: InterlinkMessage[]; | |
| lastMessage: InterlinkMessage | null; | |
| } | |
| const state: InterlinkState = { | |
| history: [], | |
| lastMessage: null, | |
| }; | |
| export function sendMessage( | |
| from: Pillar, | |
| to: Pillar | "ALL", | |
| type: string, | |
| payload: any | |
| ) { | |
| const msg: InterlinkMessage = { | |
| from, | |
| to, | |
| type, | |
| payload, | |
| timestamp: Date.now(), | |
| }; | |
| state.history.push(msg); | |
| state.lastMessage = msg; | |
| console.log(`\n[INTERLINK] ${from} → ${to}`); | |
| console.log(`Type: ${type}`); | |
| console.log("Payload:", payload); | |
| return msg; | |
| } | |
| export function getInterlinkState(): InterlinkState { | |
| return state; | |
| } | |
| export function broadcast(type: string, payload: any) { | |
| return sendMessage("TIA", "ALL", type, payload); | |
| } | |