@aiaiaichain/agent 0.1.6 → 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.
- package/dist/api/ExtensionAPI.d.ts +0 -1
- package/dist/api/ExtensionAPI.js +3 -7
- package/dist/api/Registry.d.ts +0 -1
- package/dist/api/Registry.js +54 -57
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +683 -686
- package/dist/core/AgentDir.d.ts +1 -1
- package/dist/core/AgentDir.js +45 -39
- package/dist/core/ChainConfig.d.ts +0 -1
- package/dist/core/ChainConfig.js +51 -55
- package/dist/core/EnvLoader.d.ts +4 -1
- package/dist/core/EnvLoader.js +97 -84
- package/dist/core/SystemMonitor.d.ts +0 -1
- package/dist/core/SystemMonitor.js +72 -85
- package/dist/index.d.ts +0 -1
- package/dist/index.js +19 -26
- package/dist/loader.d.ts +0 -1
- package/dist/loader.js +64 -67
- package/dist/mcp/entry.d.ts +0 -1
- package/dist/mcp/entry.js +3 -6
- package/dist/mcp/server.d.ts +0 -1
- package/dist/mcp/server.js +152 -156
- package/dist/models/CostTracker.d.ts +0 -1
- package/dist/models/CostTracker.js +58 -61
- package/dist/models/ModelRegistry.d.ts +0 -1
- package/dist/models/ModelRegistry.js +195 -155
- package/dist/providers/ProviderRegistry.d.ts +0 -1
- package/dist/providers/ProviderRegistry.js +33 -36
- package/dist/runner/AgentRunner.d.ts +0 -1
- package/dist/runner/AgentRunner.js +180 -184
- package/dist/runner/ModelClient.d.ts +0 -1
- package/dist/runner/ModelClient.js +133 -134
- package/dist/runner/SwarmRouter.d.ts +0 -1
- package/dist/runner/SwarmRouter.js +18 -22
- package/dist/runner/ToolDispatcher.d.ts +0 -1
- package/dist/runner/ToolDispatcher.js +30 -33
- package/dist/scheduler/AgentScheduler.d.ts +0 -1
- package/dist/scheduler/AgentScheduler.js +99 -103
- package/dist/session/ContextStore.d.ts +1 -1
- package/dist/session/ContextStore.js +76 -78
- package/dist/session/GoalManager.d.ts +0 -1
- package/dist/session/GoalManager.js +96 -100
- package/dist/session/MemoryStore.d.ts +2 -1
- package/dist/session/MemoryStore.js +108 -87
- package/dist/session/SessionManager.d.ts +5 -4
- package/dist/session/SessionManager.js +83 -62
- package/dist/session/SessionStore.d.ts +0 -1
- package/dist/session/SessionStore.js +112 -116
- package/dist/setup/SetupWizard.d.ts +0 -1
- package/dist/setup/SetupWizard.js +61 -64
- package/dist/tools/CrossTools.d.ts +0 -1
- package/dist/tools/CrossTools.js +140 -144
- package/dist/tools/GmgnIntegration.d.ts +0 -1
- package/dist/tools/GmgnIntegration.js +220 -230
- package/dist/tools/MarketSentiment.d.ts +0 -1
- package/dist/tools/MarketSentiment.js +213 -195
- package/dist/tools/NewsSentiment.d.ts +0 -1
- package/dist/tools/NewsSentiment.js +126 -130
- package/dist/tools/PriceFeed.d.ts +6 -1
- package/dist/tools/PriceFeed.js +201 -133
- package/dist/tools/TechnicalAnalysis.d.ts +1 -2
- package/dist/tools/TechnicalAnalysis.js +248 -216
- package/dist/tools/TechnicalAnalysis.worker.d.ts +25 -0
- package/dist/tools/TechnicalAnalysis.worker.js +92 -0
- package/dist/tools/TokenCalendar.d.ts +0 -1
- package/dist/tools/TokenCalendar.js +63 -68
- package/dist/tools/TokenSecurityScanner.d.ts +0 -1
- package/dist/tools/TokenSecurityScanner.js +93 -96
- package/dist/tools/TransactionSim.d.ts +0 -1
- package/dist/tools/TransactionSim.js +65 -71
- package/dist/tui/App.d.ts +0 -1
- package/dist/tui/App.js +895 -824
- package/dist/tui/ModelSelector.d.ts +0 -1
- package/dist/tui/ModelSelector.js +46 -49
- package/dist/tui/REPL.d.ts +0 -1
- package/dist/tui/REPL.js +222 -210
- package/dist/tui/Sparkline.d.ts +0 -1
- package/dist/tui/Sparkline.js +36 -37
- package/dist/tui/StatusBar.d.ts +0 -1
- package/dist/tui/StatusBar.js +9 -10
- package/dist/tui/ThemePresets.d.ts +0 -1
- package/dist/tui/ThemePresets.js +99 -103
- package/dist/tui/theme.d.ts +0 -1
- package/dist/tui/theme.js +50 -31
- package/dist/util/clipboard.d.ts +0 -1
- package/dist/util/clipboard.js +16 -20
- package/dist/util/commandSuggest.d.ts +0 -1
- package/dist/util/commandSuggest.js +34 -38
- package/dist/util/confirmation.d.ts +0 -1
- package/dist/util/confirmation.js +8 -11
- package/dist/util/errorHandler.d.ts +0 -1
- package/dist/util/errorHandler.js +20 -23
- package/dist/util/errors.d.ts +59 -0
- package/dist/util/errors.js +93 -0
- package/dist/util/logger.d.ts +0 -1
- package/dist/util/logger.js +30 -33
- package/dist/util/processManager.d.ts +0 -1
- package/dist/util/processManager.js +33 -36
- package/dist/util/resilientFetch.d.ts +6 -1
- package/dist/util/resilientFetch.js +134 -80
- package/dist/util/responseCache.d.ts +0 -1
- package/dist/util/responseCache.js +36 -45
- package/dist/util/rpc.d.ts +16 -0
- package/dist/util/rpc.js +69 -0
- package/dist/util/safeLog.d.ts +0 -1
- package/dist/util/safeLog.js +52 -53
- package/dist/util/scheduler.d.ts +0 -1
- package/dist/util/scheduler.js +53 -58
- package/dist/util/webhooks.d.ts +0 -1
- package/dist/util/webhooks.js +54 -58
- package/dist/wallet/ActionFeed.d.ts +0 -1
- package/dist/wallet/ActionFeed.js +189 -200
- package/dist/wallet/AgentWallet.d.ts +7 -8
- package/dist/wallet/AgentWallet.js +117 -144
- package/dist/wallet/ProfitTracker.d.ts +0 -1
- package/dist/wallet/ProfitTracker.js +71 -74
- package/package.json +11 -6
- package/scripts/build-esbuild.mjs +40 -0
- package/scripts/bundle-dts.mjs +58 -0
- package/scripts/minify.mjs +44 -0
- package/scripts/postinstall.js +27 -0
package/dist/tui/Sparkline.js
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
package/dist/tui/StatusBar.d.ts
CHANGED
package/dist/tui/StatusBar.js
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
package/dist/tui/ThemePresets.js
CHANGED
|
@@ -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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
112
|
-
|
|
108
|
+
const themeName = getCurrentTheme();
|
|
109
|
+
return PRESETS[themeName]?.colors ?? PRESETS["solana"].colors;
|
|
113
110
|
}
|
|
114
111
|
export function listThemes() {
|
|
115
|
-
|
|
112
|
+
return Object.entries(PRESETS).map(([key, preset]) => ` ${key === getCurrentTheme() ? "★" : " "} ${key.padEnd(14)} ${preset.description}`).join("\n");
|
|
116
113
|
}
|
|
117
|
-
//# sourceMappingURL=ThemePresets.js.map
|
package/dist/tui/theme.d.ts
CHANGED
package/dist/tui/theme.js
CHANGED
|
@@ -1,38 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
package/dist/util/clipboard.d.ts
CHANGED
|
@@ -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
|
package/dist/util/clipboard.js
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
3
|
+
const encoded = Buffer.from(text).toString("base64");
|
|
4
|
+
return `\x1b]52;c;${encoded}\x07`;
|
|
8
5
|
}
|
|
9
6
|
export function copyToClipboard(text) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
7
|
+
try {
|
|
8
|
+
process.stdout.write(encodeOSC52(text));
|
|
9
|
+
return true;
|
|
17
10
|
}
|
|
18
|
-
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
19
16
|
export function clipboardSupported() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
12
|
+
return !process.stdin.isTTY || process.env.AIAIAI_YES === "1" || process.env.CI === "true";
|
|
15
13
|
}
|
|
16
|
-
//# sourceMappingURL=confirmation.js.map
|