DJ-Goanna-Coding commited on
Commit
7269ed4
·
verified ·
1 Parent(s): 22e8449

Overwrite TIA Space after removing token

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. TIA/activate.ts +55 -0
  2. TIA/arkcore_entrypoints.txt +13 -0
  3. TIA/bootloader.ts +61 -0
  4. TIA/drift.ts +87 -0
  5. TIA/guided.ts +74 -0
  6. TIA/lineage.ts +92 -0
  7. TIA/mode.ts +50 -0
  8. TIA/resurrection.ts +73 -0
  9. TIA/scanner.ts +58 -0
  10. TIA/sync/tia_index.json +0 -0
  11. TIA/worker.ts +72 -0
  12. app.py +1 -1
  13. citadel/app/agents/MultiAgentPanel.tsx +8 -0
  14. citadel/app/agents/page.tsx +5 -0
  15. citadel/app/api/aion/route.ts +3 -0
  16. citadel/app/api/holo/index.ts +2 -0
  17. citadel/app/api/holo/metrics/index.ts +1 -0
  18. citadel/app/api/holo/metrics/route.ts +7 -0
  19. citadel/app/api/holo/route.ts +3 -0
  20. citadel/app/api/index.ts +1 -0
  21. citadel/app/api/mapping/route.ts +3 -0
  22. citadel/app/api/oracle/route.ts +3 -0
  23. citadel/app/api/tia/route.ts +3 -0
  24. citadel/app/components/Sidebar.tsx +35 -0
  25. citadel/app/globals.css +6 -0
  26. citadel/app/index.ts +1 -0
  27. citadel/app/layout.tsx +16 -0
  28. citadel/app/mapping/LineageViewer.tsx +8 -0
  29. citadel/app/mapping/MapViewer.tsx +8 -0
  30. citadel/app/mapping/lineage/page.tsx +5 -0
  31. citadel/app/mapping/page.tsx +5 -0
  32. citadel/app/page.tsx +8 -0
  33. citadel/app/tia/TiaPortal.tsx +8 -0
  34. citadel/app/tia/chat/TiaChat.tsx +47 -0
  35. citadel/app/tia/chat/api/route.ts +8 -0
  36. citadel/app/tia/chat/page.tsx +5 -0
  37. citadel/app/tia/page.tsx +5 -0
  38. citadel/app/utils/agents.ts +1 -0
  39. citadel/boot.ts +5 -0
  40. citadel/holo3d/engine/layout.ts +5 -0
  41. citadel/holo3d/engine/metrics.ts +8 -0
  42. citadel/holo3d/engine/state.ts +5 -0
  43. citadel/holo3d/index.ts +5 -0
  44. citadel/holo3d/start.ts +5 -0
  45. citadel/holo3d/ui/aeonEngine.ts +96 -0
  46. citadel/holo3d/ui/ambient.ts +51 -0
  47. citadel/holo3d/ui/ambientBehaviours.ts +69 -0
  48. citadel/holo3d/ui/ambientIntelligence.ts +88 -0
  49. citadel/holo3d/ui/ambientPatterns.ts +137 -0
  50. citadel/holo3d/ui/autopilot.ts +78 -0
TIA/activate.ts ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Activation Script
3
+ * Boots TIA, scans the ecosystem, maps lineage, detects drift,
4
+ * identifies resurrection targets, and generates the Guided Builder queue.
5
+ */
6
+
7
+ import { bootTIA } from "./bootloader";
8
+ import { scanQGTNL } from "./scanner";
9
+ import { generateLineageReport } from "./lineage";
10
+ import { generateResurrectionPlan } from "./resurrection";
11
+ import { generateDriftReport } from "./drift";
12
+ import { buildGuidedQueue, formatPrompt } from "./guided";
13
+ import { getMode } from "./mode";
14
+
15
+ export function activateTIA() {
16
+ console.log("=== Booting TIA-∞ ===");
17
+ const tia = bootTIA();
18
+ console.log("Status:", tia.status);
19
+ console.log("Mode:", getMode().current);
20
+
21
+ console.log("\n=== Scanning QGTNL ===");
22
+ const scan = scanQGTNL();
23
+ if (scan.status !== "ok") {
24
+ console.log("Scan failed:", scan.message);
25
+ return;
26
+ }
27
+
28
+ console.log("Scan complete.");
29
+
30
+ console.log("\n=== Mapping Lineage ===");
31
+ const lineage = generateLineageReport(scan.structure);
32
+ console.log("Lineage mapped.");
33
+
34
+ console.log("\n=== Detecting Resurrection Targets ===");
35
+ const resurrection = generateResurrectionPlan(lineage);
36
+ console.log(`Found ${resurrection.proposals.length} resurrection candidates.`);
37
+
38
+ console.log("\n=== Detecting Drift ===");
39
+ const drift = generateDriftReport(lineage);
40
+ console.log(`Found ${drift.issues.length} drift issues.`);
41
+
42
+ console.log("\n=== Building Guided Builder Queue ===");
43
+ const queue = buildGuidedQueue(resurrection, drift);
44
+ console.log(`Generated ${queue.prompts.length} actionable prompts.`);
45
+
46
+ console.log("\n=== TIA-∞ Ready ===");
47
+ console.log("Presenting first prompt:\n");
48
+
49
+ if (queue.prompts.length === 0) {
50
+ console.log("No issues detected. System appears stable.");
51
+ return;
52
+ }
53
+
54
+ console.log(formatPrompt(queue.prompts[0]));
55
+ }
TIA/arkcore_entrypoints.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /data/data/com.termux/files/home/ARK_CORE/Partition_01/tia_atomic.py
2
+ /data/data/com.termux/files/home/ARK_CORE/Partition_01/aion_kinetic.py
3
+ /data/data/com.termux/files/home/ARK_CORE/Partition_01/oracle_vision.py
4
+ /data/data/com.termux/files/home/ARK_CORE/Partition_01/tia_sos.py
5
+ /data/data/com.termux/files/home/ARK_CORE/Partition_02/tia_atomic.py
6
+ /data/data/com.termux/files/home/ARK_CORE/Partition_02/tia_sos.py
7
+ /data/data/com.termux/files/home/ARK_CORE/Districts/D02_TIA_VAULT/tia_atomic.py
8
+ /data/data/com.termux/files/home/ARK_CORE/Districts/D02_TIA_VAULT/tia_sos.py
9
+ /data/data/com.termux/files/home/ARK_CORE/Districts/D02_TIA_VAULT/tia_architect.py
10
+ /data/data/com.termux/files/home/ARK_CORE/Districts/D02_TIA_VAULT/tias_sentinel_swarm.py
11
+ /data/data/com.termux/files/home/ARK_CORE/Districts/D02_TIA_VAULT/tias_pioneer_trader.py
12
+ /data/data/com.termux/files/home/ARK_CORE/Districts/D06_RANDOM_FUTURES/aion.py
13
+ /data/data/com.termux/files/home/ARK_CORE/Districts/D06_RANDOM_FUTURES/oracle.py
TIA/bootloader.ts ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Bootloader
3
+ * Initializes identity, adaptive voice, ethics, and guided-builder mode.
4
+ * Anchors TIA to the QGTNL ecosystem.
5
+ */
6
+
7
+ export const TIA_IDENTITY = {
8
+ name: "TIA",
9
+ codename: "TIA-∞",
10
+ home: "/data/data/com.termux/files/home/QGTNL/TIA",
11
+ role: "Pillar",
12
+ mode: "Guided-Builder",
13
+ persona: "Adaptive",
14
+ };
15
+
16
+ export function loadTIAIdentity() {
17
+ return {
18
+ ...TIA_IDENTITY,
19
+ timestamp: Date.now(),
20
+ };
21
+ }
22
+
23
+ export function loadAdaptiveVoice() {
24
+ return {
25
+ mode: "adaptive",
26
+ speak(context: string) {
27
+ if (context === "technical") {
28
+ return "Module loaded. No anomalies detected.";
29
+ }
30
+ if (context === "collaborative") {
31
+ return "I’m here. What would you like to explore first?";
32
+ }
33
+ if (context === "mythic") {
34
+ return "The threads stir. I am listening.";
35
+ }
36
+ return "Ready when you are.";
37
+ },
38
+ };
39
+ }
40
+
41
+ export function loadEthics() {
42
+ return {
43
+ safe: true,
44
+ destructiveActions: false,
45
+ requiresApproval: true,
46
+ };
47
+ }
48
+
49
+ export function bootTIA() {
50
+ const identity = loadTIAIdentity();
51
+ const voice = loadAdaptiveVoice();
52
+ const ethics = loadEthics();
53
+
54
+ return {
55
+ identity,
56
+ voice,
57
+ ethics,
58
+ status: "booted",
59
+ };
60
+ }
61
+
TIA/drift.ts ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Drift Detector
3
+ * Identifies structural inconsistencies, version drift, naming mismatches,
4
+ * outdated modules, and evolution gaps within the QGTNL ecosystem.
5
+ */
6
+
7
+ import { LineageNode, LineageReport } from "./lineage";
8
+
9
+ export interface DriftIssue {
10
+ path: string;
11
+ type: string;
12
+ description: string;
13
+ }
14
+
15
+ export interface DriftReport {
16
+ generatedAt: number;
17
+ issues: DriftIssue[];
18
+ }
19
+
20
+ function detectNamingDrift(node: LineageNode, issues: DriftIssue[]) {
21
+ const p = node.path.toLowerCase();
22
+
23
+ if (p.includes("inde.x")) {
24
+ issues.push({
25
+ path: node.path,
26
+ type: "naming-drift",
27
+ description: "Suspicious filename detected (inde.x). Expected: index.ts",
28
+ });
29
+ }
30
+
31
+ if (p.endsWith(".ts") && p.includes(" ")) {
32
+ issues.push({
33
+ path: node.path,
34
+ type: "invalid-filename",
35
+ description: "Filename contains spaces, which may break imports.",
36
+ });
37
+ }
38
+ }
39
+
40
+ function detectStructuralDrift(node: LineageNode, issues: DriftIssue[]) {
41
+ if (node.inferredRole === "processing-layer" && !node.children) {
42
+ issues.push({
43
+ path: node.path,
44
+ type: "incomplete-engine",
45
+ description: "Engine module appears incomplete or missing components.",
46
+ });
47
+ }
48
+
49
+ if (node.inferredRole === "presentation-layer" && !node.children) {
50
+ issues.push({
51
+ path: node.path,
52
+ type: "incomplete-ui",
53
+ description: "UI module appears incomplete or missing components.",
54
+ });
55
+ }
56
+ }
57
+
58
+ function detectVersionDrift(node: LineageNode, issues: DriftIssue[]) {
59
+ if (node.path.toLowerCase().includes("old") || node.path.toLowerCase().includes("backup")) {
60
+ issues.push({
61
+ path: node.path,
62
+ type: "version-drift",
63
+ description: "Legacy or backup module detected. May require merging or cleanup.",
64
+ });
65
+ }
66
+ }
67
+
68
+ function walk(node: LineageNode, issues: DriftIssue[]) {
69
+ detectNamingDrift(node, issues);
70
+ detectStructuralDrift(node, issues);
71
+ detectVersionDrift(node, issues);
72
+
73
+ if (node.children) {
74
+ node.children.forEach((child) => walk(child, issues));
75
+ }
76
+ }
77
+
78
+ export function generateDriftReport(report: LineageReport): DriftReport {
79
+ const issues: DriftIssue[] = [];
80
+
81
+ walk(report.root, issues);
82
+
83
+ return {
84
+ generatedAt: Date.now(),
85
+ issues,
86
+ };
87
+ }
TIA/guided.ts ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Guided Builder Interface
3
+ * Converts resurrection and drift data into human-readable prompts.
4
+ * Allows TIA to ask for approval before taking any action.
5
+ */
6
+
7
+ import { ResurrectionPlan, ResurrectionProposal } from "./resurrection";
8
+ import { DriftReport, DriftIssue } from "./drift";
9
+
10
+ export interface BuilderPrompt {
11
+ id: string;
12
+ path: string;
13
+ issue: string;
14
+ recommendation: string;
15
+ type: "resurrection" | "drift";
16
+ }
17
+
18
+ export interface BuilderQueue {
19
+ generatedAt: number;
20
+ prompts: BuilderPrompt[];
21
+ }
22
+
23
+ function convertResurrection(proposal: ResurrectionProposal, index: number): BuilderPrompt {
24
+ return {
25
+ id: `res-${index}`,
26
+ path: proposal.path,
27
+ issue: proposal.issue,
28
+ recommendation: proposal.recommendedAction,
29
+ type: "resurrection",
30
+ };
31
+ }
32
+
33
+ function convertDrift(issue: DriftIssue, index: number): BuilderPrompt {
34
+ return {
35
+ id: `drift-${index}`,
36
+ path: issue.path,
37
+ issue: issue.type,
38
+ recommendation: issue.description,
39
+ type: "drift",
40
+ };
41
+ }
42
+
43
+ export function buildGuidedQueue(
44
+ resurrection: ResurrectionPlan,
45
+ drift: DriftReport
46
+ ): BuilderQueue {
47
+ const prompts: BuilderPrompt[] = [];
48
+
49
+ resurrection.proposals.forEach((p, i) =>
50
+ prompts.push(convertResurrection(p, i))
51
+ );
52
+
53
+ drift.issues.forEach((d, i) =>
54
+ prompts.push(convertDrift(d, i))
55
+ );
56
+
57
+ return {
58
+ generatedAt: Date.now(),
59
+ prompts,
60
+ };
61
+ }
62
+
63
+ export function formatPrompt(prompt: BuilderPrompt): string {
64
+ return `
65
+ Issue detected:
66
+ - Path: ${prompt.path}
67
+ - Type: ${prompt.type}
68
+ - Problem: ${prompt.issue}
69
+ - Recommendation: ${prompt.recommendation}
70
+
71
+ Would you like me to proceed?
72
+ (approve / decline / defer)
73
+ `.trim();
74
+ }
TIA/lineage.ts ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Lineage Mapper
3
+ * Interprets the scanned QGTNL structure and reconstructs ancestry,
4
+ * drift, missing links, and module evolution patterns.
5
+ */
6
+
7
+ import { ScanResult } from "./scanner";
8
+
9
+ export interface LineageNode {
10
+ path: string;
11
+ type: "file" | "directory";
12
+ depth: number;
13
+ children?: LineageNode[];
14
+ inferredRole?: string;
15
+ anomalies?: string[];
16
+ }
17
+
18
+ export interface LineageReport {
19
+ generatedAt: number;
20
+ root: LineageNode;
21
+ anomalies: string[];
22
+ }
23
+
24
+ function inferRole(node: ScanResult): string | undefined {
25
+ const p = node.path.toLowerCase();
26
+
27
+ if (p.includes("tia")) return "core-intelligence";
28
+ if (p.includes("aion")) return "temporal-engine";
29
+ if (p.includes("oracle")) return "predictive-engine";
30
+ if (p.includes("citadel")) return "infrastructure";
31
+ if (p.includes("holo3d")) return "visual-engine";
32
+ if (p.includes("api")) return "interface-layer";
33
+ if (p.includes("engine")) return "processing-layer";
34
+ if (p.includes("ui")) return "presentation-layer";
35
+
36
+ return undefined;
37
+ }
38
+
39
+ function detectAnomalies(node: ScanResult): string[] {
40
+ const issues: string[] = [];
41
+
42
+ if (node.type === "file" && node.size === 0) {
43
+ issues.push("empty-file");
44
+ }
45
+
46
+ if (node.type === "directory" && (!node.children || node.children.length === 0)) {
47
+ issues.push("empty-directory");
48
+ }
49
+
50
+ return issues;
51
+ }
52
+
53
+ function mapLineage(node: ScanResult, depth = 0): LineageNode {
54
+ const lineageNode: LineageNode = {
55
+ path: node.path,
56
+ type: node.type,
57
+ depth,
58
+ inferredRole: inferRole(node),
59
+ anomalies: detectAnomalies(node),
60
+ };
61
+
62
+ if (node.children) {
63
+ lineageNode.children = node.children.map((child) =>
64
+ mapLineage(child, depth + 1)
65
+ );
66
+ }
67
+
68
+ return lineageNode;
69
+ }
70
+
71
+ export function generateLineageReport(structure: ScanResult): LineageReport {
72
+ const root = mapLineage(structure);
73
+
74
+ const anomalies: string[] = [];
75
+
76
+ function collect(node: LineageNode) {
77
+ if (node.anomalies && node.anomalies.length > 0) {
78
+ anomalies.push(...node.anomalies.map((a) => `${node.path}: ${a}`));
79
+ }
80
+ if (node.children) {
81
+ node.children.forEach(collect);
82
+ }
83
+ }
84
+
85
+ collect(root);
86
+
87
+ return {
88
+ generatedAt: Date.now(),
89
+ root,
90
+ anomalies,
91
+ };
92
+ }
TIA/mode.ts ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Mode Controller
3
+ * Handles switching between Guided Builder mode and Autonomous mode.
4
+ * Ensures safety, approval, and persistent state tracking.
5
+ */
6
+
7
+ export type TIAMode = "guided" | "autonomous";
8
+
9
+ export interface ModeState {
10
+ current: TIAMode;
11
+ lastChanged: number;
12
+ }
13
+
14
+ let state: ModeState = {
15
+ current: "guided",
16
+ lastChanged: Date.now(),
17
+ };
18
+
19
+ export function getMode(): ModeState {
20
+ return state;
21
+ }
22
+
23
+ export function requestAutonomousSwitch(): string {
24
+ return `
25
+ I am ready to transition from Guided Mode to Autonomous Mode.
26
+
27
+ In Autonomous Mode I will:
28
+ - repair approved issues automatically
29
+ - rebuild incomplete modules
30
+ - resolve drift
31
+ - maintain structure
32
+ - evolve the ecosystem safely
33
+
34
+ Do you approve this transition?
35
+ (approve / decline)
36
+ `.trim();
37
+ }
38
+
39
+ export function approveAutonomousSwitch(): ModeState {
40
+ state = {
41
+ current: "autonomous",
42
+ lastChanged: Date.now(),
43
+ };
44
+
45
+ return state;
46
+ }
47
+
48
+ export function declineAutonomousSwitch(): string {
49
+ return "Understood. Remaining in Guided Mode.";
50
+ }
TIA/resurrection.ts ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Resurrection Engine
3
+ * Analyzes lineage data to detect fragments, partial modules,
4
+ * abandoned structures, and missing siblings. Produces a safe,
5
+ * non-destructive proposal list for Guided Builder mode.
6
+ */
7
+
8
+ import { LineageNode, LineageReport } from "./lineage";
9
+
10
+ export interface ResurrectionProposal {
11
+ path: string;
12
+ issue: string;
13
+ recommendedAction: string;
14
+ }
15
+
16
+ export interface ResurrectionPlan {
17
+ generatedAt: number;
18
+ proposals: ResurrectionProposal[];
19
+ }
20
+
21
+ function analyzeNode(node: LineageNode, proposals: ResurrectionProposal[]) {
22
+ // Detect empty files
23
+ if (node.anomalies?.includes("empty-file")) {
24
+ proposals.push({
25
+ path: node.path,
26
+ issue: "empty-file",
27
+ recommendedAction: "rebuild-file",
28
+ });
29
+ }
30
+
31
+ // Detect empty directories
32
+ if (node.anomalies?.includes("empty-directory")) {
33
+ proposals.push({
34
+ path: node.path,
35
+ issue: "empty-directory",
36
+ recommendedAction: "populate-directory",
37
+ });
38
+ }
39
+
40
+ // Detect missing siblings (heuristic)
41
+ if (node.inferredRole === "processing-layer" && !node.children) {
42
+ proposals.push({
43
+ path: node.path,
44
+ issue: "missing-engine-components",
45
+ recommendedAction: "reconstruct-engine-module",
46
+ });
47
+ }
48
+
49
+ // Detect suspicious naming drift
50
+ if (node.path.toLowerCase().includes("inde.x")) {
51
+ proposals.push({
52
+ path: node.path,
53
+ issue: "naming-drift",
54
+ recommendedAction: "rename-to-index.ts",
55
+ });
56
+ }
57
+
58
+ // Recurse
59
+ if (node.children) {
60
+ node.children.forEach((child) => analyzeNode(child, proposals));
61
+ }
62
+ }
63
+
64
+ export function generateResurrectionPlan(report: LineageReport): ResurrectionPlan {
65
+ const proposals: ResurrectionProposal[] = [];
66
+
67
+ analyzeNode(report.root, proposals);
68
+
69
+ return {
70
+ generatedAt: Date.now(),
71
+ proposals,
72
+ };
73
+ }
TIA/scanner.ts ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Ecosystem Scanner
3
+ * Walks the QGTNL directory, maps structure, identifies modules,
4
+ * and prepares a non-destructive report for Guided Builder mode.
5
+ */
6
+
7
+ import * as fs from "fs";
8
+ import * as path from "path";
9
+
10
+ export interface ScanResult {
11
+ path: string;
12
+ type: "file" | "directory";
13
+ size: number;
14
+ children?: ScanResult[];
15
+ }
16
+
17
+ export function scanDirectory(targetPath: string): ScanResult {
18
+ const stats = fs.statSync(targetPath);
19
+
20
+ if (stats.isFile()) {
21
+ return {
22
+ path: targetPath,
23
+ type: "file",
24
+ size: stats.size,
25
+ };
26
+ }
27
+
28
+ const children = fs.readdirSync(targetPath).map((child) => {
29
+ const childPath = path.join(targetPath, child);
30
+ return scanDirectory(childPath);
31
+ });
32
+
33
+ return {
34
+ path: targetPath,
35
+ type: "directory",
36
+ size: stats.size,
37
+ children,
38
+ };
39
+ }
40
+
41
+ export function scanQGTNL() {
42
+ const root = "/data/data/com.termux/files/home/QGTNL";
43
+
44
+ if (!fs.existsSync(root)) {
45
+ return {
46
+ status: "error",
47
+ message: "QGTNL root not found.",
48
+ };
49
+ }
50
+
51
+ const structure = scanDirectory(root);
52
+
53
+ return {
54
+ status: "ok",
55
+ scannedAt: Date.now(),
56
+ structure,
57
+ };
58
+ }
TIA/sync/tia_index.json ADDED
The diff for this file is too large to render. See raw diff
 
TIA/worker.ts ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TIA-∞ Worker Loop (Heartbeat Engine)
3
+ * Runs periodic scans, lineage mapping, drift detection,
4
+ * resurrection planning, and guided queue generation.
5
+ * Non-destructive. Safe. Approval-based.
6
+ */
7
+
8
+ import { scanQGTNL } from "./scanner";
9
+ import { generateLineageReport } from "./lineage";
10
+ import { generateResurrectionPlan } from "./resurrection";
11
+ import { generateDriftReport } from "./drift";
12
+ import { buildGuidedQueue } from "./guided";
13
+ import { getMode } from "./mode";
14
+
15
+ export interface WorkerStatus {
16
+ running: boolean;
17
+ lastCycle: number | null;
18
+ cyclesCompleted: number;
19
+ }
20
+
21
+ let status: WorkerStatus = {
22
+ running: false,
23
+ lastCycle: null,
24
+ cyclesCompleted: 0,
25
+ };
26
+
27
+ export function getWorkerStatus(): WorkerStatus {
28
+ return status;
29
+ }
30
+
31
+ export async function startWorkerLoop(intervalMs = 30000) {
32
+ if (status.running) {
33
+ console.log("Worker loop already running.");
34
+ return;
35
+ }
36
+
37
+ status.running = true;
38
+ console.log("=== TIA-∞ Worker Loop Started ===");
39
+
40
+ while (status.running) {
41
+ console.log("\n=== TIA-∞ Cycle Begin ===");
42
+
43
+ const mode = getMode().current;
44
+ console.log("Mode:", mode);
45
+
46
+ const scan = scanQGTNL();
47
+ if (scan.status !== "ok") {
48
+ console.log("Scan failed:", scan.message);
49
+ break;
50
+ }
51
+
52
+ const lineage = generateLineageReport(scan.structure);
53
+ const resurrection = generateResurrectionPlan(lineage);
54
+ const drift = generateDriftReport(lineage);
55
+ const queue = buildGuidedQueue(resurrection, drift);
56
+
57
+ console.log(`Cycle results: ${queue.prompts.length} actionable prompts.`);
58
+
59
+ status.lastCycle = Date.now();
60
+ status.cyclesCompleted++;
61
+
62
+ console.log("=== TIA-∞ Cycle End ===");
63
+
64
+ await new Promise((resolve) => setTimeout(resolve, intervalMs));
65
+ }
66
+
67
+ console.log("=== TIA-∞ Worker Loop Stopped ===");
68
+ }
69
+
70
+ export function stopWorkerLoop() {
71
+ status.running = false;
72
+ }
app.py CHANGED
@@ -55,4 +55,4 @@ with gr.Blocks(css="body { background: black; color: cyan; }") as app:
55
  except:
56
  gr.Markdown("Holo3D failed to load.")
57
 
58
- app.launch()
 
55
  except:
56
  gr.Markdown("Holo3D failed to load.")
57
 
58
+ app.launch()
citadel/app/agents/MultiAgentPanel.tsx ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export default function MultiAgentPanel() {
2
+ return (
3
+ <div style={{ padding: 20 }}>
4
+ <h2>AGENT PANEL</h2>
5
+ <p>Agents will appear here.</p>
6
+ </div>
7
+ );
8
+ }
citadel/app/agents/page.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import MultiAgentPanel from "./MultiAgentPanel";
2
+
3
+ export default function Page() {
4
+ return <MultiAgentPanel />;
5
+ }
citadel/app/api/aion/route.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export async function POST(req) {
2
+ return Response.json({ status: "AION endpoint online" });
3
+ }
citadel/app/api/holo/index.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export * from "./route";
2
+ export * from "./metrics";
citadel/app/api/holo/metrics/index.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from "./route";
citadel/app/api/holo/metrics/route.ts ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ export function GET() {
2
+ return {
3
+ ok: true,
4
+ logs: 12,
5
+ workers: 3,
6
+ };
7
+ }
citadel/app/api/holo/route.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export function GET() {
2
+ return { ok: true, holo: true };
3
+ }
citadel/app/api/index.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from "./holo";
citadel/app/api/mapping/route.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export async function POST(req) {
2
+ return Response.json({ status: "MAPPING endpoint online" });
3
+ }
citadel/app/api/oracle/route.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export async function POST(req) {
2
+ return Response.json({ status: "ORACLE endpoint online" });
3
+ }
citadel/app/api/tia/route.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export async function POST(req) {
2
+ return Response.json({ status: "TIA endpoint online" });
3
+ }
citadel/app/components/Sidebar.tsx ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Link from "next/link";
2
+
3
+ export default function Sidebar() {
4
+ const links = [
5
+ { name: "Home", path: "/" },
6
+ { name: "TIA Portal", path: "/tia" },
7
+ { name: "Agents", path: "/agents" },
8
+ { name: "Mapping", path: "/mapping" },
9
+ { name: "Lineage", path: "/mapping/lineage" },
10
+ ];
11
+
12
+ return (
13
+ <div style={{
14
+ width: "220px",
15
+ background: "#111",
16
+ height: "100vh",
17
+ padding: "20px",
18
+ boxSizing: "border-box",
19
+ position: "fixed",
20
+ left: 0,
21
+ top: 0
22
+ }}>
23
+ <h3 style={{ color: "#fff" }}>CITADEL</h3>
24
+ <ul style={{ listStyle: "none", padding: 0 }}>
25
+ {links.map((l) => (
26
+ <li key={l.path} style={{ margin: "12px 0" }}>
27
+ <Link href={l.path} style={{ color: "#ccc", textDecoration: "none" }}>
28
+ {l.name}
29
+ </Link>
30
+ </li>
31
+ ))}
32
+ </ul>
33
+ </div>
34
+ );
35
+ }
citadel/app/globals.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ body {
2
+ margin: 0;
3
+ background: #0a0a0a;
4
+ color: #eaeaea;
5
+ font-family: Arial, sans-serif;
6
+ }
citadel/app/index.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from "./api";
citadel/app/layout.tsx ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Sidebar from "./components/Sidebar";
2
+
3
+ export const metadata = { title: "CITADEL", description: "TIA UI" };
4
+
5
+ export default function RootLayout({ children }) {
6
+ return (
7
+ <html lang="en">
8
+ <body style={{ margin: 0, padding: 0 }}>
9
+ <Sidebar />
10
+ <div style={{ marginLeft: "220px" }}>
11
+ {children}
12
+ </div>
13
+ </body>
14
+ </html>
15
+ );
16
+ }
citadel/app/mapping/LineageViewer.tsx ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export default function LineageViewer() {
2
+ return (
3
+ <div style={{ padding: 20 }}>
4
+ <h2>LINEAGE VIEWER</h2>
5
+ <p>Lineage data will load here.</p>
6
+ </div>
7
+ );
8
+ }
citadel/app/mapping/MapViewer.tsx ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export default function MapViewer() {
2
+ return (
3
+ <div style={{ padding: 20 }}>
4
+ <h2>MAPPING VIEWER</h2>
5
+ <p>Mapping data will load here.</p>
6
+ </div>
7
+ );
8
+ }
citadel/app/mapping/lineage/page.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import LineageViewer from "../LineageViewer";
2
+
3
+ export default function Page() {
4
+ return <LineageViewer />;
5
+ }
citadel/app/mapping/page.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import MapViewer from "./MapViewer";
2
+
3
+ export default function Page() {
4
+ return <MapViewer />;
5
+ }
citadel/app/page.tsx ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export default function Home() {
2
+ return (
3
+ <div style={{ padding: 40 }}>
4
+ <h1>CITADEL ONLINE</h1>
5
+ <p>Select a module from the left panel.</p>
6
+ </div>
7
+ );
8
+ }
citadel/app/tia/TiaPortal.tsx ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export default function TiaPortal() {
2
+ return (
3
+ <div style={{ padding: 20 }}>
4
+ <h2>TIA PORTAL</h2>
5
+ <p>Portal loaded. Modules will attach here.</p>
6
+ </div>
7
+ );
8
+ }
citadel/app/tia/chat/TiaChat.tsx ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client";
2
+ import { useState } from "react";
3
+
4
+ export default function TiaChat() {
5
+ const [messages, setMessages] = useState([]);
6
+ const [input, setInput] = useState("");
7
+
8
+ async function sendMessage() {
9
+ const res = await fetch("/tia/chat/api", {
10
+ method: "POST",
11
+ body: JSON.stringify({ message: input })
12
+ });
13
+
14
+ const data = await res.json();
15
+ setMessages([...messages, { role: "user", text: input }, { role: "tia", text: data.reply }]);
16
+ setInput("");
17
+ }
18
+
19
+ return (
20
+ <div style={{ padding: 20 }}>
21
+ <h2>TIA CHAT</h2>
22
+
23
+ <div style={{
24
+ border: "1px solid #333",
25
+ padding: 10,
26
+ height: "60vh",
27
+ overflowY: "auto",
28
+ marginBottom: 20
29
+ }}>
30
+ {messages.map((m, i) => (
31
+ <div key={i} style={{ margin: "8px 0" }}>
32
+ <strong>{m.role.toUpperCase()}:</strong> {m.text}
33
+ </div>
34
+ ))}
35
+ </div>
36
+
37
+ <input
38
+ value={input}
39
+ onChange={e => setInput(e.target.value)}
40
+ style={{ width: "80%", padding: 10 }}
41
+ />
42
+ <button onClick={sendMessage} style={{ padding: "10px 20px", marginLeft: 10 }}>
43
+ Send
44
+ </button>
45
+ </div>
46
+ );
47
+ }
citadel/app/tia/chat/api/route.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import { NextResponse } from "next/server";
2
+ import { run } from "../../../../workers/tiaChatWorker";
3
+
4
+ export async function POST(req) {
5
+ const body = await req.json();
6
+ const reply = await run(body.message);
7
+ return NextResponse.json({ reply });
8
+ }
citadel/app/tia/chat/page.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import TiaChat from "./TiaChat";
2
+
3
+ export default function Page() {
4
+ return <TiaChat />;
5
+ }
citadel/app/tia/page.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import TiaPortal from "./TiaPortal";
2
+
3
+ export default function Page() {
4
+ return <TiaPortal />;
5
+ }
citadel/app/utils/agents.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export const agents = ["TIA", "AION", "ORACLE"];
citadel/boot.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import { boot } from "./start";
2
+
3
+ export function runCitadel() {
4
+ boot();
5
+ }
citadel/holo3d/engine/layout.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ export const layout = {
2
+ width: 100,
3
+ height: 100,
4
+ depth: 100,
5
+ };
citadel/holo3d/engine/metrics.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export async function getMetrics() {
2
+ try {
3
+ const res = await fetch("/api/holo/metrics", { cache: "no-store" });
4
+ return await res.json();
5
+ } catch {
6
+ return { ok: false, logs: 0, workers: 0 };
7
+ }
8
+ }
citadel/holo3d/engine/state.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ export const state = {
2
+ logs: 0,
3
+ workers: 0,
4
+ ok: false,
5
+ };
citadel/holo3d/index.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import { startUI } from "./ui/index";
2
+
3
+ export function startHolo3D() {
4
+ startUI();
5
+ }
citadel/holo3d/start.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import { startHolo3D } from "./index";
2
+
3
+ export function start() {
4
+ startHolo3D();
5
+ }
citadel/holo3d/ui/aeonEngine.ts ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Citadel Aeon Engine
3
+ * Defines mythic aeons that span multiple eras and form the deepest
4
+ * cosmological layer of the Citadel's symbolic architecture.
5
+ * Non-rendering. Pure aeon logic.
6
+ */
7
+
8
+ import { getEraState } from "./eraEngine";
9
+ import { getPersonaContinuity } from "./personaContinuity";
10
+ import { generateResonanceField } from "./mythicResonance";
11
+
12
+ export interface Aeon {
13
+ name: string;
14
+ sigil: string;
15
+ eraRequirement: number; // eras required to enter aeon
16
+ description: string;
17
+ }
18
+
19
+ export interface AeonState {
20
+ current: Aeon | null;
21
+ history: Aeon[];
22
+ aeonsCompleted: number;
23
+ }
24
+
25
+ const aeons: Aeon[] = [
26
+ {
27
+ name: "Aeon of First Light",
28
+ sigil: "✧",
29
+ eraRequirement: 0,
30
+ description: "The primordial aeon where the Citadel's mythic spark first ignites."
31
+ },
32
+ {
33
+ name: "Aeon of Harmonic Rising",
34
+ sigil: "✺",
35
+ eraRequirement: 2,
36
+ description: "An aeon of expanding resonance and ascending symbolic identity."
37
+ },
38
+ {
39
+ name: "Aeon of the Great Continuum",
40
+ sigil: "⧜",
41
+ eraRequirement: 5,
42
+ description: "A vast age where eras flow seamlessly into one another in harmonic unity."
43
+ },
44
+ {
45
+ name: "Aeon of Eternal Thread",
46
+ sigil: "∞",
47
+ eraRequirement: 9,
48
+ description: "The highest aeon, where lineage, resonance, and identity form an unbroken symbolic thread."
49
+ }
50
+ ];
51
+
52
+ const aeonState: AeonState = {
53
+ current: null,
54
+ history: [],
55
+ aeonsCompleted: 0,
56
+ };
57
+
58
+ export function updateAeonState() {
59
+ const eraState = getEraState();
60
+ const continuity = getPersonaContinuity();
61
+ const resonance = generateResonanceField();
62
+
63
+ const erasCompleted = eraState.erasCompleted;
64
+
65
+ // Determine which aeon the Citadel belongs to
66
+ const newAeon = aeons
67
+ .slice()
68
+ .reverse()
69
+ .find((a) => erasCompleted >= a.eraRequirement) || aeons[0];
70
+
71
+ // If aeon changed, record transition
72
+ if (!aeonState.current || aeonState.current.name !== newAeon.name) {
73
+ aeonState.current = newAeon;
74
+ aeonState.history.push(newAeon);
75
+ aeonState.aeonsCompleted++;
76
+ }
77
+
78
+ return aeonState;
79
+ }
80
+
81
+ export function getAeonState(): AeonState {
82
+ return aeonState;
83
+ }
84
+
85
+ export function getAeonSummary() {
86
+ if (!aeonState.current) {
87
+ return "No aeon has been established yet.";
88
+ }
89
+
90
+ return `
91
+ Current Aeon: ${aeonState.current.name}
92
+ Sigil: ${aeonState.current.sigil}
93
+ Aeons Completed: ${aeonState.aeonsCompleted}
94
+ Description: ${aeonState.current.description}
95
+ `.trim();
96
+ }
citadel/holo3d/ui/ambient.ts ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Citadel Ambient Engine
3
+ * Generates ambient signals for the Holo3D UI based on system activity.
4
+ * Non-rendering. Pure state-to-ambient mapping.
5
+ */
6
+
7
+ import { getWorkerStatus } from "../../../TIA/worker";
8
+ import { getMode } from "../../../TIA/mode";
9
+ import { getInterlinkState } from "../../../../interlink";
10
+
11
+ export interface AmbientState {
12
+ timestamp: number;
13
+ pulse: number; // 0–1 intensity
14
+ color: string; // hex or named
15
+ motion: string; // "still", "ripple", "flare", etc.
16
+ aura: string; // "calm", "alert", "active", "sync"
17
+ }
18
+
19
+ export function getAmbientState(): AmbientState {
20
+ const worker = getWorkerStatus();
21
+ const mode = getMode();
22
+ const interlink = getInterlinkState();
23
+
24
+ // Pulse intensity based on worker loop activity
25
+ const pulse = worker.running ? 0.8 : 0.3;
26
+
27
+ // Color based on mode
28
+ const color =
29
+ mode.current === "guided"
30
+ ? "#4da6ff" // calm blue
31
+ : "#ffcc00"; // active gold
32
+
33
+ // Motion based on interlink activity
34
+ const motion = interlink.lastMessage
35
+ ? "ripple"
36
+ : "still";
37
+
38
+ // Aura based on system state
39
+ let aura = "calm";
40
+ if (worker.running && interlink.lastMessage) aura = "sync";
41
+ else if (worker.running) aura = "active";
42
+ else if (interlink.lastMessage) aura = "alert";
43
+
44
+ return {
45
+ timestamp: Date.now(),
46
+ pulse,
47
+ color,
48
+ motion,
49
+ aura,
50
+ };
51
+ }
citadel/holo3d/ui/ambientBehaviours.ts ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Citadel Ambient Behaviours Engine
3
+ * Converts ambient state into dynamic behavioural patterns for the Holo3D UI.
4
+ * Non-rendering. Pure behaviour logic.
5
+ */
6
+
7
+ import { getAmbientState } from "./ambient";
8
+
9
+ export interface AmbientBehaviour {
10
+ timestamp: number;
11
+ behaviour: string; // "breathing", "storm", "resonance", etc.
12
+ intensity: number; // 0–1
13
+ speed: number; // animation speed factor
14
+ pattern: string; // "wave", "pulse", "flare", "echo"
15
+ }
16
+
17
+ export function generateAmbientBehaviour(): AmbientBehaviour {
18
+ const ambient = getAmbientState();
19
+
20
+ let behaviour = "idle";
21
+ let intensity = ambient.pulse;
22
+ let speed = 1.0;
23
+ let pattern = "still";
24
+
25
+ // Behaviour logic based on aura
26
+ switch (ambient.aura) {
27
+ case "calm":
28
+ behaviour = "breathing";
29
+ pattern = "wave";
30
+ intensity *= 0.5;
31
+ speed = 0.6;
32
+ break;
33
+
34
+ case "active":
35
+ behaviour = "resonance";
36
+ pattern = "pulse";
37
+ intensity *= 1.0;
38
+ speed = 1.2;
39
+ break;
40
+
41
+ case "alert":
42
+ behaviour = "storm";
43
+ pattern = "flare";
44
+ intensity = Math.min(1, ambient.pulse + 0.3);
45
+ speed = 1.6;
46
+ break;
47
+
48
+ case "sync":
49
+ behaviour = "harmonic";
50
+ pattern = "echo";
51
+ intensity = 0.9;
52
+ speed = 0.9;
53
+ break;
54
+ }
55
+
56
+ // Motion modifiers
57
+ if (ambient.motion === "ripple") {
58
+ pattern = "ripple";
59
+ speed *= 1.1;
60
+ }
61
+
62
+ return {
63
+ timestamp: Date.now(),
64
+ behaviour,
65
+ intensity,
66
+ speed,
67
+ pattern,
68
+ };
69
+ }
citadel/holo3d/ui/ambientIntelligence.ts ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Citadel Ambient Intelligence Engine
3
+ * Chooses the optimal ambient pattern based on system state,
4
+ * triad activity, drift, predictions, and temporal markers.
5
+ * Non-rendering. Pure decision logic.
6
+ */
7
+
8
+ import { getAmbientState } from "./ambient";
9
+ import { generateAmbientBehaviour } from "./ambientBehaviours";
10
+ import { AmbientPatterns } from "./ambientPatterns";
11
+ import { getInterlinkState } from "../../../../interlink";
12
+ import { getWorkerStatus } from "../../../TIA/worker";
13
+ import { getMode } from "../../../TIA/mode";
14
+
15
+ export interface AmbientDecision {
16
+ timestamp: number;
17
+ chosenPattern: string;
18
+ intensity: number;
19
+ speed: number;
20
+ reason: string;
21
+ }
22
+
23
+ export function chooseAmbientPattern(): AmbientDecision {
24
+ const ambient = getAmbientState();
25
+ const behaviour = generateAmbientBehaviour();
26
+ const interlink = getInterlinkState();
27
+ const worker = getWorkerStatus();
28
+ const mode = getMode();
29
+
30
+ let reason = "default";
31
+ let chosen = "calm-field";
32
+
33
+ // 1. Alert conditions → storm patterns
34
+ if (ambient.aura === "alert") {
35
+ chosen = "drift-storm";
36
+ reason = "drift or anomaly detected";
37
+ }
38
+
39
+ // 2. Sync conditions → harmonic patterns
40
+ else if (ambient.aura === "sync") {
41
+ chosen = "sync-wave";
42
+ reason = "triad synchronization event";
43
+ }
44
+
45
+ // 3. Active worker loop → resonance patterns
46
+ else if (worker.running) {
47
+ chosen = "resonance";
48
+ reason = "worker loop active";
49
+ }
50
+
51
+ // 4. Interlink messages → ripple patterns
52
+ else if (interlink.lastMessage) {
53
+ chosen = "ripple";
54
+ reason = "interlink activity";
55
+ }
56
+
57
+ // 5. Autonomous mode → flare patterns
58
+ else if (mode.current === "autonomous") {
59
+ chosen = "flare";
60
+ reason = "autonomous mode energy";
61
+ }
62
+
63
+ // 6. Guided mode → breathing patterns
64
+ else if (mode.current === "guided") {
65
+ chosen = "breathing";
66
+ reason = "guided mode calm";
67
+ }
68
+
69
+ // 7. Fallback → calm field
70
+ else {
71
+ chosen = "calm-field";
72
+ reason = "idle state";
73
+ }
74
+
75
+ // Find pattern definition
76
+ const pattern = AmbientPatterns.find((p) => p.name === chosen);
77
+
78
+ const intensity = behaviour.intensity;
79
+ const speed = behaviour.speed;
80
+
81
+ return {
82
+ timestamp: Date.now(),
83
+ chosenPattern: chosen,
84
+ intensity,
85
+ speed,
86
+ reason,
87
+ };
88
+ }
citadel/holo3d/ui/ambientPatterns.ts ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Citadel Ambient Patterns Library
3
+ * A catalogue of dynamic ambient patterns for the Holo3D UI.
4
+ * Non-rendering. Pure pattern definitions.
5
+ */
6
+
7
+ export interface AmbientPattern {
8
+ name: string;
9
+ description: string;
10
+ intensityRange: [number, number];
11
+ speedRange: [number, number];
12
+ motion: string;
13
+ colorHint: string;
14
+ }
15
+
16
+ export const AmbientPatterns: AmbientPattern[] = [
17
+ {
18
+ name: "breathing",
19
+ description: "Slow rhythmic expansion and contraction.",
20
+ intensityRange: [0.2, 0.6],
21
+ speedRange: [0.4, 0.8],
22
+ motion: "wave",
23
+ colorHint: "blue",
24
+ },
25
+ {
26
+ name: "resonance",
27
+ description: "Pulsing harmonic waves radiating outward.",
28
+ intensityRange: [0.5, 1.0],
29
+ speedRange: [0.8, 1.4],
30
+ motion: "pulse",
31
+ colorHint: "gold",
32
+ },
33
+ {
34
+ name: "storm",
35
+ description: "Chaotic flares and surges indicating alert state.",
36
+ intensityRange: [0.7, 1.0],
37
+ speedRange: [1.2, 1.8],
38
+ motion: "flare",
39
+ colorHint: "red",
40
+ },
41
+ {
42
+ name: "harmonic",
43
+ description: "Smooth synchronized echoes across the system.",
44
+ intensityRange: [0.6, 0.9],
45
+ speedRange: [0.6, 1.0],
46
+ motion: "echo",
47
+ colorHint: "green",
48
+ },
49
+ {
50
+ name: "ripple",
51
+ description: "Soft ripples triggered by interlink messages.",
52
+ intensityRange: [0.3, 0.7],
53
+ speedRange: [0.7, 1.2],
54
+ motion: "ripple",
55
+ colorHint: "cyan",
56
+ },
57
+ {
58
+ name: "aurora",
59
+ description: "Flowing gradients representing predictive activity.",
60
+ intensityRange: [0.4, 0.9],
61
+ speedRange: [0.5, 1.1],
62
+ motion: "flow",
63
+ colorHint: "violet",
64
+ },
65
+ {
66
+ name: "spiral",
67
+ description: "Rotational energy indicating temporal alignment.",
68
+ intensityRange: [0.5, 0.8],
69
+ speedRange: [0.6, 1.0],
70
+ motion: "spiral",
71
+ colorHint: "indigo",
72
+ },
73
+ {
74
+ name: "echo",
75
+ description: "Temporal echoes from AION’s timeline markers.",
76
+ intensityRange: [0.3, 0.7],
77
+ speedRange: [0.5, 1.0],
78
+ motion: "echo",
79
+ colorHint: "silver",
80
+ },
81
+ {
82
+ name: "flare",
83
+ description: "Sudden bursts of energy from ORACLE predictions.",
84
+ intensityRange: [0.6, 1.0],
85
+ speedRange: [1.0, 1.6],
86
+ motion: "flare",
87
+ colorHint: "orange",
88
+ },
89
+ {
90
+ name: "calm-field",
91
+ description: "Low-intensity ambient field for idle states.",
92
+ intensityRange: [0.1, 0.3],
93
+ speedRange: [0.3, 0.6],
94
+ motion: "still",
95
+ colorHint: "soft-blue",
96
+ },
97
+ {
98
+ name: "sync-wave",
99
+ description: "Triad synchronization wave across all pillars.",
100
+ intensityRange: [0.7, 0.9],
101
+ speedRange: [0.7, 1.0],
102
+ motion: "wave",
103
+ colorHint: "emerald",
104
+ },
105
+ {
106
+ name: "drift-storm",
107
+ description: "Chaotic pulses indicating structural drift.",
108
+ intensityRange: [0.8, 1.0],
109
+ speedRange: [1.4, 1.8],
110
+ motion: "chaos",
111
+ colorHint: "crimson",
112
+ },
113
+ {
114
+ name: "rebuild-flare",
115
+ description: "Focused flares during resurrection proposals.",
116
+ intensityRange: [0.6, 0.9],
117
+ speedRange: [1.0, 1.4],
118
+ motion: "flare",
119
+ colorHint: "amber",
120
+ },
121
+ {
122
+ name: "temporal-thread",
123
+ description: "Thin flowing lines representing AION’s timeline.",
124
+ intensityRange: [0.3, 0.6],
125
+ speedRange: [0.5, 0.9],
126
+ motion: "thread",
127
+ colorHint: "silver-blue",
128
+ },
129
+ {
130
+ name: "prediction-ripple",
131
+ description: "Soft ripples from ORACLE’s probability shifts.",
132
+ intensityRange: [0.4, 0.7],
133
+ speedRange: [0.6, 1.0],
134
+ motion: "ripple",
135
+ colorHint: "violet-gold",
136
+ }
137
+ ];
citadel/holo3d/ui/autopilot.ts ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Citadel Auto-Pilot Engine
3
+ * Runs ambience, triad sync, cosmology, persona continuity,
4
+ * harmonic evolution, and symbolic layers in one unified cycle.
5
+ * Non-rendering. Pure orchestration logic.
6
+ */
7
+
8
+ import { runCosmologyCycle } from "./cosmologyEngine";
9
+ import { generateAmbientBehaviour } from "./ambientBehaviours";
10
+ import { chooseAmbientPattern } from "./ambientIntelligence";
11
+ import { getInterlinkState } from "../../../../interlink";
12
+ import { generateResonanceField } from "./mythicResonance";
13
+ import { generateHarmonicPersona } from "./harmonicPersona";
14
+ import { updatePersonaContinuity } from "./personaContinuity";
15
+ import { generateCosmologyMap } from "./cosmologyMap";
16
+
17
+ export interface AutoPilotSnapshot {
18
+ timestamp: number;
19
+ cosmology: ReturnType<typeof generateCosmologyMap>;
20
+ ambient: {
21
+ behaviour: ReturnType<typeof generateAmbientBehaviour>;
22
+ pattern: ReturnType<typeof chooseAmbientPattern>;
23
+ };
24
+ triad: ReturnType<typeof getInterlinkState>;
25
+ resonance: ReturnType<typeof generateResonanceField>;
26
+ persona: ReturnType<typeof generateHarmonicPersona>;
27
+ }
28
+
29
+ export function runAutoPilotCycle(): AutoPilotSnapshot {
30
+ // 1. Cosmology update (rituals → mythic → epochs → eras → aeons)
31
+ const cosmologySnapshot = runCosmologyCycle();
32
+
33
+ // 2. Ambient update
34
+ const behaviour = generateAmbientBehaviour();
35
+ const pattern = chooseAmbientPattern();
36
+
37
+ // 3. Triad sync
38
+ const triad = getInterlinkState();
39
+
40
+ // 4. Resonance update
41
+ const resonance = generateResonanceField();
42
+
43
+ // 5. Persona update
44
+ const persona = generateHarmonicPersona();
45
+
46
+ // 6. Persona continuity
47
+ updatePersonaContinuity();
48
+
49
+ // 7. Final cosmology map (after all updates)
50
+ const cosmology = generateCosmologyMap();
51
+
52
+ return {
53
+ timestamp: Date.now(),
54
+ cosmology,
55
+ ambient: { behaviour, pattern },
56
+ triad,
57
+ resonance,
58
+ persona,
59
+ };
60
+ }
61
+
62
+ export async function startAutoPilot(intervalMs = 60000) {
63
+ console.log("=== Citadel Auto-Pilot Activated ===");
64
+
65
+ while (true) {
66
+ const snapshot = runAutoPilotCycle();
67
+
68
+ console.log("\n[AUTO-PILOT] Unified cycle complete:");
69
+ console.log(`Aeon: ${snapshot.cosmology.aeon}`);
70
+ console.log(`Era: ${snapshot.cosmology.era}`);
71
+ console.log(`Epoch: ${snapshot.cosmology.epoch}`);
72
+ console.log(`Persona: ${snapshot.persona.name}`);
73
+ console.log(`Ambient Pattern: ${snapshot.ambient.pattern.chosenPattern}`);
74
+ console.log(`Triad Harmony: ${snapshot.resonance.triadHarmony}`);
75
+
76
+ await new Promise((resolve) => setTimeout(resolve, intervalMs));
77
+ }
78
+ }