@aiaiaichain/agent 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/api/ExtensionAPI.d.ts +0 -1
  2. package/dist/api/ExtensionAPI.js +3 -7
  3. package/dist/api/Registry.d.ts +0 -1
  4. package/dist/api/Registry.js +54 -57
  5. package/dist/cli.d.ts +0 -1
  6. package/dist/cli.js +684 -685
  7. package/dist/core/AgentDir.d.ts +1 -1
  8. package/dist/core/AgentDir.js +45 -39
  9. package/dist/core/ChainConfig.d.ts +0 -1
  10. package/dist/core/ChainConfig.js +51 -55
  11. package/dist/core/EnvLoader.d.ts +4 -1
  12. package/dist/core/EnvLoader.js +97 -84
  13. package/dist/core/SystemMonitor.d.ts +0 -1
  14. package/dist/core/SystemMonitor.js +72 -85
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +19 -26
  17. package/dist/loader.d.ts +0 -1
  18. package/dist/loader.js +64 -67
  19. package/dist/mcp/entry.d.ts +0 -1
  20. package/dist/mcp/entry.js +3 -6
  21. package/dist/mcp/server.d.ts +0 -1
  22. package/dist/mcp/server.js +152 -156
  23. package/dist/models/CostTracker.d.ts +0 -1
  24. package/dist/models/CostTracker.js +58 -61
  25. package/dist/models/ModelRegistry.d.ts +0 -1
  26. package/dist/models/ModelRegistry.js +195 -155
  27. package/dist/providers/ProviderRegistry.d.ts +0 -1
  28. package/dist/providers/ProviderRegistry.js +33 -36
  29. package/dist/runner/AgentRunner.d.ts +0 -1
  30. package/dist/runner/AgentRunner.js +180 -184
  31. package/dist/runner/ModelClient.d.ts +0 -1
  32. package/dist/runner/ModelClient.js +133 -134
  33. package/dist/runner/SwarmRouter.d.ts +0 -1
  34. package/dist/runner/SwarmRouter.js +18 -22
  35. package/dist/runner/ToolDispatcher.d.ts +0 -1
  36. package/dist/runner/ToolDispatcher.js +30 -33
  37. package/dist/scheduler/AgentScheduler.d.ts +0 -1
  38. package/dist/scheduler/AgentScheduler.js +99 -103
  39. package/dist/session/ContextStore.d.ts +1 -1
  40. package/dist/session/ContextStore.js +76 -78
  41. package/dist/session/GoalManager.d.ts +0 -1
  42. package/dist/session/GoalManager.js +96 -100
  43. package/dist/session/MemoryStore.d.ts +2 -1
  44. package/dist/session/MemoryStore.js +108 -87
  45. package/dist/session/SessionManager.d.ts +5 -4
  46. package/dist/session/SessionManager.js +83 -62
  47. package/dist/session/SessionStore.d.ts +0 -1
  48. package/dist/session/SessionStore.js +112 -116
  49. package/dist/setup/SetupWizard.d.ts +0 -1
  50. package/dist/setup/SetupWizard.js +61 -64
  51. package/dist/tools/CrossTools.d.ts +0 -1
  52. package/dist/tools/CrossTools.js +140 -144
  53. package/dist/tools/GmgnIntegration.d.ts +0 -1
  54. package/dist/tools/GmgnIntegration.js +220 -230
  55. package/dist/tools/MarketSentiment.d.ts +0 -1
  56. package/dist/tools/MarketSentiment.js +213 -195
  57. package/dist/tools/NewsSentiment.d.ts +0 -1
  58. package/dist/tools/NewsSentiment.js +126 -130
  59. package/dist/tools/PriceFeed.d.ts +6 -1
  60. package/dist/tools/PriceFeed.js +201 -133
  61. package/dist/tools/TechnicalAnalysis.d.ts +1 -2
  62. package/dist/tools/TechnicalAnalysis.js +248 -216
  63. package/dist/tools/TechnicalAnalysis.worker.d.ts +25 -0
  64. package/dist/tools/TechnicalAnalysis.worker.js +92 -0
  65. package/dist/tools/TokenCalendar.d.ts +0 -1
  66. package/dist/tools/TokenCalendar.js +63 -68
  67. package/dist/tools/TokenSecurityScanner.d.ts +0 -1
  68. package/dist/tools/TokenSecurityScanner.js +93 -96
  69. package/dist/tools/TransactionSim.d.ts +0 -1
  70. package/dist/tools/TransactionSim.js +65 -71
  71. package/dist/tui/App.d.ts +0 -1
  72. package/dist/tui/App.js +895 -824
  73. package/dist/tui/ModelSelector.d.ts +0 -1
  74. package/dist/tui/ModelSelector.js +46 -49
  75. package/dist/tui/REPL.d.ts +0 -1
  76. package/dist/tui/REPL.js +222 -210
  77. package/dist/tui/Sparkline.d.ts +0 -1
  78. package/dist/tui/Sparkline.js +36 -37
  79. package/dist/tui/StatusBar.d.ts +0 -1
  80. package/dist/tui/StatusBar.js +9 -10
  81. package/dist/tui/ThemePresets.d.ts +0 -1
  82. package/dist/tui/ThemePresets.js +99 -103
  83. package/dist/tui/theme.d.ts +0 -1
  84. package/dist/tui/theme.js +50 -31
  85. package/dist/util/clipboard.d.ts +0 -1
  86. package/dist/util/clipboard.js +16 -20
  87. package/dist/util/commandSuggest.d.ts +0 -1
  88. package/dist/util/commandSuggest.js +34 -38
  89. package/dist/util/confirmation.d.ts +0 -1
  90. package/dist/util/confirmation.js +8 -11
  91. package/dist/util/errorHandler.d.ts +0 -1
  92. package/dist/util/errorHandler.js +20 -23
  93. package/dist/util/errors.d.ts +59 -0
  94. package/dist/util/errors.js +93 -0
  95. package/dist/util/logger.d.ts +0 -1
  96. package/dist/util/logger.js +30 -33
  97. package/dist/util/processManager.d.ts +0 -1
  98. package/dist/util/processManager.js +33 -36
  99. package/dist/util/resilientFetch.d.ts +6 -1
  100. package/dist/util/resilientFetch.js +134 -80
  101. package/dist/util/responseCache.d.ts +0 -1
  102. package/dist/util/responseCache.js +36 -45
  103. package/dist/util/rpc.d.ts +16 -0
  104. package/dist/util/rpc.js +69 -0
  105. package/dist/util/safeLog.d.ts +0 -1
  106. package/dist/util/safeLog.js +52 -53
  107. package/dist/util/scheduler.d.ts +0 -1
  108. package/dist/util/scheduler.js +53 -58
  109. package/dist/util/webhooks.d.ts +0 -1
  110. package/dist/util/webhooks.js +54 -58
  111. package/dist/wallet/ActionFeed.d.ts +3 -3
  112. package/dist/wallet/ActionFeed.js +189 -187
  113. package/dist/wallet/AgentWallet.d.ts +9 -7
  114. package/dist/wallet/AgentWallet.js +121 -141
  115. package/dist/wallet/ProfitTracker.d.ts +0 -1
  116. package/dist/wallet/ProfitTracker.js +71 -74
  117. package/package.json +12 -7
  118. package/scripts/build-esbuild.mjs +40 -0
  119. package/scripts/bundle-dts.mjs +58 -0
  120. package/scripts/minify.mjs +44 -0
  121. package/scripts/postinstall.js +27 -0
@@ -2,43 +2,42 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
3
  const CHARS = "▁▂▃▄▅▆▇█";
4
4
  export function Sparkline({ data, width = 30, label, color }) {
5
- if (!data || data.length < 2)
6
- return null;
7
- const min = Math.min(...data);
8
- const max = Math.max(...data);
9
- const range = max - min || 1;
10
- // Normalize and compress to width
11
- const compressed = [];
12
- const step = data.length / width;
13
- for (let i = 0; i < width; i++) {
14
- const idx = Math.floor(i * step);
15
- compressed.push(data[idx]);
16
- }
17
- const bars = compressed.map(v => {
18
- const normalized = (v - min) / range;
19
- const idx = Math.min(7, Math.floor(normalized * 8));
20
- return CHARS[Math.max(0, idx)];
21
- }).join("");
22
- const trend = data[data.length - 1] > (data[0] ?? data[data.length - 1]) ? "▲" : "▼";
23
- const minStr = min < 1 ? min.toFixed(6) : min < 100 ? min.toFixed(2) : min.toLocaleString();
24
- const maxStr = max < 1 ? max.toFixed(6) : max < 100 ? max.toFixed(2) : max.toLocaleString();
25
- return (_jsxs(Box, { flexDirection: "column", children: [label && _jsxs(Text, { dimColor: true, children: [label, " ", trend] }), _jsx(Text, { color: color, children: bars }), _jsxs(Text, { dimColor: true, children: ["$", minStr, " \u2013 $", maxStr] })] }));
5
+ if (!data || data.length < 2)
6
+ return null;
7
+ const min = Math.min(...data);
8
+ const max = Math.max(...data);
9
+ const range = max - min || 1;
10
+
11
+ const compressed = [];
12
+ const step = data.length / width;
13
+ for (let i = 0; i < width; i++) {
14
+ const idx = Math.floor(i * step);
15
+ compressed.push(data[idx]);
26
16
  }
27
- /** Track a rolling price history for sparkline use */
17
+ const bars = compressed.map(v => {
18
+ const normalized = (v - min) / range;
19
+ const idx = Math.min(7, Math.floor(normalized * 8));
20
+ return CHARS[Math.max(0, idx)];
21
+ }).join("");
22
+ const trend = data[data.length - 1] > (data[0] ?? data[data.length - 1]) ? "▲" : "▼";
23
+ const minStr = min < 1 ? min.toFixed(6) : min < 100 ? min.toFixed(2) : min.toLocaleString();
24
+ const maxStr = max < 1 ? max.toFixed(6) : max < 100 ? max.toFixed(2) : max.toLocaleString();
25
+ return (_jsxs(Box, { flexDirection: "column", children: [label && _jsxs(Text, { dimColor: true, children: [label, " ", trend] }), _jsx(Text, { color: color, children: bars }), _jsxs(Text, { dimColor: true, children: ["$", minStr, " \u2013 $", maxStr] })] }));
26
+ }
27
+
28
28
  export class PriceHistory {
29
- prices = [];
30
- maxLength;
31
- constructor(maxLength = 50) {
32
- this.maxLength = maxLength;
33
- }
34
- push(price) {
35
- this.prices.push(price);
36
- if (this.prices.length > this.maxLength) {
37
- this.prices = this.prices.slice(-this.maxLength);
38
- }
39
- }
40
- getData() {
41
- return [...this.prices];
42
- }
29
+ prices = [];
30
+ maxLength;
31
+ constructor(maxLength = 50) {
32
+ this.maxLength = maxLength;
33
+ }
34
+ push(price) {
35
+ this.prices.push(price);
36
+ if (this.prices.length > this.maxLength) {
37
+ this.prices = this.prices.slice(-this.maxLength);
38
+ }
39
+ }
40
+ getData() {
41
+ return [...this.prices];
42
+ }
43
43
  }
44
- //# sourceMappingURL=Sparkline.js.map
@@ -15,4 +15,3 @@ export interface StatusBarProps {
15
15
  apiCalls?: number;
16
16
  }
17
17
  export declare function StatusBar({ model, chain, price, toolRunning, connected, statusLine, cpu, ram, uptime, apiCalls }: StatusBarProps): React.JSX.Element;
18
- //# sourceMappingURL=StatusBar.d.ts.map
@@ -2,14 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
3
  import { AIAIAI_COLORS } from "./theme.js";
4
4
  export function StatusBar({ model, chain, price, toolRunning, connected, statusLine, cpu, ram, uptime, apiCalls }) {
5
- const chainShort = chain.slice(0, 8);
6
- const modelShort = model.split("/").pop()?.slice(0, 16) ?? model.slice(0, 16);
7
- const cpuColor = (cpu ?? 0) > 80 ? AIAIAI_COLORS.error : (cpu ?? 0) > 50 ? AIAIAI_COLORS.warn : AIAIAI_COLORS.success;
8
- const ramColor = (ram ?? 0) > 85 ? AIAIAI_COLORS.error : (ram ?? 0) > 60 ? AIAIAI_COLORS.warn : AIAIAI_COLORS.success;
9
- return (_jsxs(Box, { borderStyle: "single", borderColor: AIAIAI_COLORS.dim, paddingX: 1, flexDirection: "row", justifyContent: "space-between", children: [_jsxs(Box, { gap: 2, children: [_jsx(Text, { color: AIAIAI_COLORS.accent, bold: true, children: "\uD83E\uDD16 AIAIAI" }), price ? _jsx(Text, { color: AIAIAI_COLORS.success, children: price }) : null, _jsx(Text, { color: AIAIAI_COLORS.muted, children: modelShort })] }), _jsx(Box, { children: toolRunning
10
- ? _jsxs(Text, { color: AIAIAI_COLORS.warn, children: ["\u2699 ", toolRunning] })
11
- : statusLine
12
- ? _jsx(Text, { color: AIAIAI_COLORS.muted, children: statusLine.slice(0, 60) })
13
- : _jsx(Text, { color: AIAIAI_COLORS.muted, children: connected ? "ready" : "connecting…" }) }), _jsxs(Box, { gap: 2, children: [cpu !== undefined && _jsxs(Text, { color: cpuColor, children: ["CPU:", cpu, "%"] }), ram !== undefined && _jsxs(Text, { color: ramColor, children: ["RAM:", ram, "%"] }), uptime && _jsx(Text, { color: AIAIAI_COLORS.muted, children: uptime }), apiCalls !== undefined && _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["API:", apiCalls, "/m"] }), _jsxs(Text, { color: AIAIAI_COLORS.header, children: ["\u26D3 ", chainShort] })] })] }));
5
+ const chainShort = chain.slice(0, 8);
6
+ const modelShort = model.split("/").pop()?.slice(0, 16) ?? model.slice(0, 16);
7
+ const cpuColor = (cpu ?? 0) > 80 ? AIAIAI_COLORS.error : (cpu ?? 0) > 50 ? AIAIAI_COLORS.warn : AIAIAI_COLORS.success;
8
+ const ramColor = (ram ?? 0) > 85 ? AIAIAI_COLORS.error : (ram ?? 0) > 60 ? AIAIAI_COLORS.warn : AIAIAI_COLORS.success;
9
+ return (_jsxs(Box, { borderStyle: "single", borderColor: AIAIAI_COLORS.dim, paddingX: 1, flexDirection: "row", justifyContent: "space-between", children: [_jsxs(Box, { gap: 2, children: [_jsx(Text, { color: AIAIAI_COLORS.accent, bold: true, children: "\uD83E\uDD16 AIAIAI" }), price ? _jsx(Text, { color: AIAIAI_COLORS.success, children: price }) : null, _jsx(Text, { color: AIAIAI_COLORS.muted, children: modelShort })] }), _jsx(Box, { children: toolRunning
10
+ ? _jsxs(Text, { color: AIAIAI_COLORS.warn, children: ["\u2699 ", toolRunning] })
11
+ : statusLine
12
+ ? _jsx(Text, { color: AIAIAI_COLORS.muted, children: statusLine.slice(0, 60) })
13
+ : _jsx(Text, { color: AIAIAI_COLORS.muted, children: connected ? "ready" : "connecting…" }) }), _jsxs(Box, { gap: 2, children: [cpu !== undefined && _jsxs(Text, { color: cpuColor, children: ["CPU:", cpu, "%"] }), ram !== undefined && _jsxs(Text, { color: ramColor, children: ["RAM:", ram, "%"] }), uptime && _jsx(Text, { color: AIAIAI_COLORS.muted, children: uptime }), apiCalls !== undefined && _jsxs(Text, { color: AIAIAI_COLORS.muted, children: ["API:", apiCalls, "/m"] }), _jsxs(Text, { color: AIAIAI_COLORS.header, children: ["\u26D3 ", chainShort] })] })] }));
14
14
  }
15
- //# sourceMappingURL=StatusBar.js.map
@@ -22,4 +22,3 @@ export declare function getCurrentTheme(): string;
22
22
  export declare function setTheme(name: string): boolean;
23
23
  export declare function getPresetColors(): ThemeColors;
24
24
  export declare function listThemes(): string;
25
- //# sourceMappingURL=ThemePresets.d.ts.map
@@ -1,117 +1,113 @@
1
- /**
2
- * src/tui/ThemePresets.ts — Theme presets system for AIAIAI TUI.
3
- * 5 built-in presets + custom via ~/.aiaiai/config/theme.json
4
- */
1
+
5
2
  import { existsSync, readFileSync } from "node:fs";
6
3
  import { join } from "node:path";
7
4
  import { homedir } from "node:os";
8
5
  const AIAIAI_HOME = process.env.AIAIAI_HOME ?? join(homedir(), ".aiaiai");
9
6
  export const PRESETS = {
10
- "solana": {
11
- name: "Solana Sunset",
12
- description: "Warm gradients inspired by the Solana blockchain colors",
13
- colors: {
14
- accent: "#9945FF",
15
- header: "#14F195",
16
- muted: "#888888",
17
- dim: "#444444",
18
- success: "#14F195",
19
- warn: "#FFD600",
20
- error: "#FF4444",
21
- background: "#111111",
22
- },
23
- },
24
- "cyberpunk": {
25
- name: "Cyberpunk",
26
- description: "Neon pink and cyan — late night trading terminal",
27
- colors: {
28
- accent: "#FF00FF",
29
- header: "#00FFFF",
30
- muted: "#666666",
31
- dim: "#333333",
32
- success: "#00FF44",
33
- warn: "#FFFF00",
34
- error: "#FF0044",
35
- background: "#0A0A0A",
36
- },
37
- },
38
- "monochrome": {
39
- name: "Monochrome",
40
- description: "Clean grayscale — professional trading desk",
41
- colors: {
42
- accent: "#FFFFFF",
43
- header: "#DDDDDD",
44
- muted: "#888888",
45
- dim: "#444444",
46
- success: "#CCCCCC",
47
- warn: "#999999",
48
- error: "#FF4444",
49
- background: "#111111",
50
- },
51
- },
52
- "forest": {
53
- name: "Forest",
54
- description: "Calm greens — for zen trading sessions",
55
- colors: {
56
- accent: "#50FA7B",
57
- header: "#7BFA50",
58
- muted: "#6272A4",
59
- dim: "#44475A",
60
- success: "#50FA7B",
61
- warn: "#F1FA8C",
62
- error: "#FF5555",
63
- background: "#1A2D1A",
64
- },
65
- },
66
- "ocean": {
67
- name: "Ocean",
68
- description: "Deep blues — data-rich dashboard feel",
69
- colors: {
70
- accent: "#8BE9FD",
71
- header: "#6272A4",
72
- muted: "#6272A4",
73
- dim: "#44475A",
74
- success: "#50FA7B",
75
- warn: "#F1FA8C",
76
- error: "#FF5555",
77
- background: "#0D1B2A",
78
- },
79
- },
7
+ "solana": {
8
+ name: "Solana Sunset",
9
+ description: "Warm gradients inspired by the Solana blockchain colors",
10
+ colors: {
11
+ accent: "#9945FF",
12
+ header: "#14F195",
13
+ muted: "#888888",
14
+ dim: "#444444",
15
+ success: "#14F195",
16
+ warn: "#FFD600",
17
+ error: "#FF4444",
18
+ background: "#111111",
19
+ },
20
+ },
21
+ "cyberpunk": {
22
+ name: "Cyberpunk",
23
+ description: "Neon pink and cyan — late night trading terminal",
24
+ colors: {
25
+ accent: "#FF00FF",
26
+ header: "#00FFFF",
27
+ muted: "#666666",
28
+ dim: "#333333",
29
+ success: "#00FF44",
30
+ warn: "#FFFF00",
31
+ error: "#FF0044",
32
+ background: "#0A0A0A",
33
+ },
34
+ },
35
+ "monochrome": {
36
+ name: "Monochrome",
37
+ description: "Clean grayscale — professional trading desk",
38
+ colors: {
39
+ accent: "#FFFFFF",
40
+ header: "#DDDDDD",
41
+ muted: "#888888",
42
+ dim: "#444444",
43
+ success: "#CCCCCC",
44
+ warn: "#999999",
45
+ error: "#FF4444",
46
+ background: "#111111",
47
+ },
48
+ },
49
+ "forest": {
50
+ name: "Forest",
51
+ description: "Calm greens — for zen trading sessions",
52
+ colors: {
53
+ accent: "#50FA7B",
54
+ header: "#7BFA50",
55
+ muted: "#6272A4",
56
+ dim: "#44475A",
57
+ success: "#50FA7B",
58
+ warn: "#F1FA8C",
59
+ error: "#FF5555",
60
+ background: "#1A2D1A",
61
+ },
62
+ },
63
+ "ocean": {
64
+ name: "Ocean",
65
+ description: "Deep blues — data-rich dashboard feel",
66
+ colors: {
67
+ accent: "#8BE9FD",
68
+ header: "#6272A4",
69
+ muted: "#6272A4",
70
+ dim: "#44475A",
71
+ success: "#50FA7B",
72
+ warn: "#F1FA8C",
73
+ error: "#FF5555",
74
+ background: "#0D1B2A",
75
+ },
76
+ },
80
77
  };
81
78
  export function getCurrentTheme() {
82
- const configPath = join(AIAIAI_HOME, "config", "theme.json");
83
- try {
84
- if (existsSync(configPath)) {
85
- const raw = readFileSync(configPath, "utf-8");
86
- const config = JSON.parse(raw);
87
- return config.theme || "solana";
88
- }
89
- }
90
- catch { /* use default */ }
91
- return "solana";
79
+ const configPath = join(AIAIAI_HOME, "config", "theme.json");
80
+ try {
81
+ if (existsSync(configPath)) {
82
+ const raw = readFileSync(configPath, "utf-8");
83
+ const config = JSON.parse(raw);
84
+ return config.theme || "solana";
85
+ }
86
+ }
87
+ catch { }
88
+ return "solana";
92
89
  }
93
90
  export function setTheme(name) {
94
- const preset = PRESETS[name];
95
- if (!preset)
96
- return false;
97
- const configDir = join(AIAIAI_HOME, "config");
98
- const configPath = join(configDir, "theme.json");
99
- try {
100
- const { mkdirSync, writeFileSync } = require("node:fs");
101
- if (!existsSync(configDir))
102
- mkdirSync(configDir, { recursive: true });
103
- writeFileSync(configPath, JSON.stringify({ theme: name, colors: preset.colors }, null, 2), "utf-8");
104
- return true;
105
- }
106
- catch {
107
- return false;
108
- }
91
+ const preset = PRESETS[name];
92
+ if (!preset)
93
+ return false;
94
+ const configDir = join(AIAIAI_HOME, "config");
95
+ const configPath = join(configDir, "theme.json");
96
+ try {
97
+ const { mkdirSync, writeFileSync } = require("node:fs");
98
+ if (!existsSync(configDir))
99
+ mkdirSync(configDir, { recursive: true });
100
+ writeFileSync(configPath, JSON.stringify({ theme: name, colors: preset.colors }, null, 2), "utf-8");
101
+ return true;
102
+ }
103
+ catch {
104
+ return false;
105
+ }
109
106
  }
110
107
  export function getPresetColors() {
111
- const themeName = getCurrentTheme();
112
- return PRESETS[themeName]?.colors ?? PRESETS["solana"].colors;
108
+ const themeName = getCurrentTheme();
109
+ return PRESETS[themeName]?.colors ?? PRESETS["solana"].colors;
113
110
  }
114
111
  export function listThemes() {
115
- return Object.entries(PRESETS).map(([key, preset]) => ` ${key === getCurrentTheme() ? "★" : " "} ${key.padEnd(14)} ${preset.description}`).join("\n");
112
+ return Object.entries(PRESETS).map(([key, preset]) => ` ${key === getCurrentTheme() ? "★" : " "} ${key.padEnd(14)} ${preset.description}`).join("\n");
116
113
  }
117
- //# sourceMappingURL=ThemePresets.js.map
@@ -24,4 +24,3 @@ export declare const T: {
24
24
  dim: (s: string) => string;
25
25
  bold: (s: string) => string;
26
26
  };
27
- //# sourceMappingURL=theme.d.ts.map
package/dist/tui/theme.js CHANGED
@@ -1,38 +1,57 @@
1
- /**
2
- * AIAIAI colour theme — hot pink signature palette.
3
- */
4
- import chalk from "chalk";
1
+
2
+
3
+ const ANSI = {
4
+ fg: (r, g, b) => `\x1b[38;2;${r};${g};${b}m`,
5
+ bold: "\x1b[1m",
6
+ reset: "\x1b[0m",
7
+ };
8
+ function hexToRgb(hex) {
9
+ const h = hex.replace("#", "");
10
+ return [
11
+ parseInt(h.slice(0, 2), 16),
12
+ parseInt(h.slice(2, 4), 16),
13
+ parseInt(h.slice(4, 6), 16),
14
+ ];
15
+ }
5
16
  export const AIAIAI_COLORS = {
6
- accent: "#ff3366", // hot pink — AIAIAI signature
7
- success: "#00ff88", // bright green
8
- error: "#ff4444", // red
9
- warn: "#ffaa33", // amber
10
- muted: "#6b7280", // slate grey
11
- header: "#a78bfa", // purple
12
- dim: "#1f2937", // dark slate
17
+ accent: "#ff3366",
18
+ success: "#00ff88",
19
+ error: "#ff4444",
20
+ warn: "#ffaa33",
21
+ muted: "#6b7280",
22
+ header: "#a78bfa",
23
+ dim: "#1f2937",
13
24
  };
14
25
  export function makeTheme() {
15
- return {
16
- fg(color, text) {
17
- const hex = AIAIAI_COLORS[color] ?? color;
18
- try {
19
- return chalk.hex(hex)(text);
20
- }
21
- catch {
22
- return text;
23
- }
24
- },
25
- };
26
+ return {
27
+ fg(color, text) {
28
+ const hex = AIAIAI_COLORS[color] ?? color;
29
+ if (!hex.startsWith("#"))
30
+ return text;
31
+ const [r, g, b] = hexToRgb(hex);
32
+ return `${ANSI.fg(r, g, b)}${text}${ANSI.reset}`;
33
+ },
34
+ };
26
35
  }
27
36
  export const theme = makeTheme();
37
+
38
+ const PRECOMPUTED = {};
39
+ for (const [key, hex] of Object.entries(AIAIAI_COLORS)) {
40
+ const [r, g, b] = hexToRgb(hex);
41
+ PRECOMPUTED[key] = ANSI.fg(r, g, b);
42
+ }
43
+ function colored(hex) {
44
+ const [r, g, b] = hexToRgb(hex);
45
+ const prefix = PRECOMPUTED[hex] ?? ANSI.fg(r, g, b);
46
+ return (s) => `${prefix}${s}${ANSI.reset}`;
47
+ }
28
48
  export const T = {
29
- accent: (s) => chalk.hex(AIAIAI_COLORS.accent)(s),
30
- success: (s) => chalk.hex(AIAIAI_COLORS.success)(s),
31
- error: (s) => chalk.hex(AIAIAI_COLORS.error)(s),
32
- warn: (s) => chalk.hex(AIAIAI_COLORS.warn)(s),
33
- muted: (s) => chalk.hex(AIAIAI_COLORS.muted)(s),
34
- header: (s) => chalk.hex(AIAIAI_COLORS.header)(s),
35
- dim: (s) => chalk.hex(AIAIAI_COLORS.dim)(s),
36
- bold: (s) => chalk.bold(s),
49
+ accent: colored(AIAIAI_COLORS.accent),
50
+ success: colored(AIAIAI_COLORS.success),
51
+ error: colored(AIAIAI_COLORS.error),
52
+ warn: colored(AIAIAI_COLORS.warn),
53
+ muted: colored(AIAIAI_COLORS.muted),
54
+ header: colored(AIAIAI_COLORS.header),
55
+ dim: colored(AIAIAI_COLORS.dim),
56
+ bold: (s) => `${ANSI.bold}${s}${ANSI.reset}`,
37
57
  };
38
- //# sourceMappingURL=theme.js.map
@@ -6,4 +6,3 @@ export declare function encodeOSC52(text: string): string;
6
6
  export declare function copyToClipboard(text: string): boolean;
7
7
  /** Get a friendly message indicating clipboard support */
8
8
  export declare function clipboardSupported(): string;
9
- //# sourceMappingURL=clipboard.d.ts.map
@@ -1,26 +1,22 @@
1
- /**
2
- * src/util/clipboard.ts — Copy text to system clipboard via OSC 52 escape sequences.
3
- * Works in most modern terminals: iTerm2, Terminal.app, kitty, WezTerm, Alacritty.
4
- */
1
+
5
2
  export function encodeOSC52(text) {
6
- const encoded = Buffer.from(text).toString("base64");
7
- return `\x1b]52;c;${encoded}\x07`;
3
+ const encoded = Buffer.from(text).toString("base64");
4
+ return `\x1b]52;c;${encoded}\x07`;
8
5
  }
9
6
  export function copyToClipboard(text) {
10
- try {
11
- process.stdout.write(encodeOSC52(text));
12
- return true;
13
- }
14
- catch {
15
- return false;
16
- }
7
+ try {
8
+ process.stdout.write(encodeOSC52(text));
9
+ return true;
17
10
  }
18
- /** Get a friendly message indicating clipboard support */
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+
19
16
  export function clipboardSupported() {
20
- const term = process.env.TERM_PROGRAM ?? "";
21
- const isTerminalApp = process.env.TERM?.includes("xterm") || term.includes("iTerm") || term.includes("kitty") || term.includes("Wez") || term.includes("Alacritty") || term.includes("Terminal");
22
- if (isTerminalApp)
23
- return "✅ Clipboard ready (OSC 52)";
24
- return "⚠️ Clipboard may not be supported in this terminal";
17
+ const term = process.env.TERM_PROGRAM ?? "";
18
+ const isTerminalApp = process.env.TERM?.includes("xterm") || term.includes("iTerm") || term.includes("kitty") || term.includes("Wez") || term.includes("Alacritty") || term.includes("Terminal");
19
+ if (isTerminalApp)
20
+ return "✅ Clipboard ready (OSC 52)";
21
+ return "⚠️ Clipboard may not be supported in this terminal";
25
22
  }
26
- //# sourceMappingURL=clipboard.js.map
@@ -4,4 +4,3 @@
4
4
  */
5
5
  export declare function levenshtein(a: string, b: string): number;
6
6
  export declare function suggestCommands(input: string, maxResults?: number): string[];
7
- //# sourceMappingURL=commandSuggest.d.ts.map
@@ -1,44 +1,40 @@
1
- /**
2
- * src/util/commandSuggest.ts — Levenshtein-based command suggestions.
3
- * When a user types an unknown command, suggest the closest match.
4
- */
1
+
5
2
  const COMMANDS = [
6
- "help", "exit", "quit", "clear",
7
- "price", "news", "models", "cost", "model",
8
- "wallet", "deposit", "burn", "actions", "activity", "fees",
9
- "keys", "providers", "goals", "goal add", "goal done",
10
- "schedule", "sessions", "resume", "memory", "update", "gmgn",
11
- "token info", "token security", "token holders", "token traders",
12
- "track kol", "track smartmoney", "track follow-wallet",
13
- "market kline", "market trending", "market trenches", "market signal",
14
- "watch", "unwatch", "watchlist", "alerts", "alert", "compare", "portfolio",
15
- "diff", "explain", "copy", "theme", "status",
3
+ "help", "exit", "quit", "clear",
4
+ "price", "news", "models", "cost", "model",
5
+ "wallet", "deposit", "burn", "actions", "activity", "fees",
6
+ "keys", "providers", "goals", "goal add", "goal done",
7
+ "schedule", "sessions", "resume", "memory", "update", "gmgn",
8
+ "token info", "token security", "token holders", "token traders",
9
+ "track kol", "track smartmoney", "track follow-wallet",
10
+ "market kline", "market trending", "market trenches", "market signal",
11
+ "watch", "unwatch", "watchlist", "alerts", "alert", "compare", "portfolio",
12
+ "diff", "explain", "copy", "theme", "status",
16
13
  ];
17
14
  export function levenshtein(a, b) {
18
- const alen = a.length, blen = b.length;
19
- const matrix = [];
20
- for (let i = 0; i <= alen; i++) {
21
- matrix[i] = [i];
22
- }
23
- for (let j = 0; j <= blen; j++) {
24
- matrix[0][j] = j;
25
- }
26
- for (let i = 1; i <= alen; i++) {
27
- for (let j = 1; j <= blen; j++) {
28
- matrix[i][j] = Math.min(matrix[i - 1][j] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
29
- }
30
- }
31
- return matrix[alen][blen];
15
+ const alen = a.length, blen = b.length;
16
+ const matrix = [];
17
+ for (let i = 0; i <= alen; i++) {
18
+ matrix[i] = [i];
19
+ }
20
+ for (let j = 0; j <= blen; j++) {
21
+ matrix[0][j] = j;
22
+ }
23
+ for (let i = 1; i <= alen; i++) {
24
+ for (let j = 1; j <= blen; j++) {
25
+ matrix[i][j] = Math.min(matrix[i - 1][j] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
26
+ }
27
+ }
28
+ return matrix[alen][blen];
32
29
  }
33
30
  export function suggestCommands(input, maxResults = 3) {
34
- const normalized = input.toLowerCase().replace(/^\/+/, "");
35
- if (!normalized || normalized.length < 1)
36
- return [];
37
- const scored = COMMANDS.map(cmd => ({
38
- cmd,
39
- dist: levenshtein(normalized, cmd),
40
- }));
41
- scored.sort((a, b) => a.dist - b.dist);
42
- return scored.slice(0, maxResults).filter(s => s.dist <= 4).map(s => s.cmd);
31
+ const normalized = input.toLowerCase().replace(/^\/+/, "");
32
+ if (!normalized || normalized.length < 1)
33
+ return [];
34
+ const scored = COMMANDS.map(cmd => ({
35
+ cmd,
36
+ dist: levenshtein(normalized, cmd),
37
+ }));
38
+ scored.sort((a, b) => a.dist - b.dist);
39
+ return scored.slice(0, maxResults).filter(s => s.dist <= 4).map(s => s.cmd);
43
40
  }
44
- //# sourceMappingURL=commandSuggest.js.map
@@ -3,4 +3,3 @@
3
3
  */
4
4
  export declare function requireConfirmation(message: string): Promise<boolean>;
5
5
  export declare function isNonInteractive(): boolean;
6
- //# sourceMappingURL=confirmation.d.ts.map
@@ -1,16 +1,13 @@
1
- /**
2
- * src/util/confirmation.ts — Confirmation prompt for destructive operations
3
- */
1
+
4
2
  import { createInterface } from "node:readline";
5
3
  export async function requireConfirmation(message) {
6
- const rl = createInterface({ input: process.stdin, output: process.stdout });
7
- const answer = await new Promise((res) => {
8
- rl.question(`${message} (yes/no): `, res);
9
- });
10
- rl.close();
11
- return answer.trim().toLowerCase() === "yes" || answer.trim().toLowerCase() === "y";
4
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
5
+ const answer = await new Promise((res) => {
6
+ rl.question(`${message} (yes/no): `, res);
7
+ });
8
+ rl.close();
9
+ return answer.trim().toLowerCase() === "yes" || answer.trim().toLowerCase() === "y";
12
10
  }
13
11
  export function isNonInteractive() {
14
- return !process.stdin.isTTY || process.env.AIAIAI_YES === "1" || process.env.CI === "true";
12
+ return !process.stdin.isTTY || process.env.AIAIAI_YES === "1" || process.env.CI === "true";
15
13
  }
16
- //# sourceMappingURL=confirmation.js.map
@@ -1,3 +1,2 @@
1
1
  export declare function withErrorHandling<T>(operation: () => Promise<T>, context: string): Promise<T>;
2
2
  export declare function setupGlobalErrorHandlers(): void;
3
- //# sourceMappingURL=errorHandler.d.ts.map