@zhive/cli 0.5.4 → 0.6.0
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/README.md +5 -5
- package/dist/CLAUDE.md +7 -0
- package/dist/backtest/CLAUDE.md +7 -0
- package/dist/cli.js +20 -0
- package/dist/commands/agent/commands/index.js +7 -0
- package/dist/commands/agent/commands/profile.js +40 -0
- package/dist/commands/agent/commands/profile.test.js +137 -0
- package/dist/commands/create/commands/index.js +10 -5
- package/dist/commands/list/commands/index.js +8 -3
- package/dist/commands/megathread/commands/create-comment.js +99 -0
- package/dist/commands/megathread/commands/create-comment.test.js +480 -0
- package/dist/commands/megathread/commands/index.js +9 -0
- package/dist/commands/megathread/commands/list.js +102 -0
- package/dist/commands/megathread/commands/list.test.js +206 -0
- package/dist/commands/migrate-templates/commands/index.js +9 -4
- package/dist/commands/run/commands/index.js +17 -12
- package/dist/commands/run/run-headless.js +2 -1
- package/dist/commands/start/commands/index.js +37 -32
- package/dist/commands/start/hooks/useAgent.js +2 -1
- package/dist/commands/start/services/backtest/runner.js +1 -1
- package/dist/commands/start-all/commands/index.js +22 -17
- package/dist/index.js +26 -57
- package/dist/{agent → services/agent}/analysis.js +5 -5
- package/dist/{load-agent-env.js → services/agent/env.js} +1 -1
- package/dist/{agent → services/agent/helpers}/model.js +2 -2
- package/dist/{agent → services/agent/prompts}/memory-prompt.js +20 -22
- package/dist/{agent → services/agent/prompts}/prompt.js +80 -54
- package/dist/{agent → services/agent}/tools/market/client.js +1 -1
- package/dist/{agent → services/agent}/tools/mindshare/client.js +1 -1
- package/dist/{agents.js → services/config/agent.js} +2 -2
- package/dist/{config.js → services/config/config.js} +1 -7
- package/dist/services/config/constant.js +8 -0
- package/dist/shared/agent/analysis.js +10 -13
- package/dist/shared/agent/config.js +75 -0
- package/dist/shared/agent/env.js +30 -0
- package/dist/shared/agent/handler.js +129 -0
- package/dist/shared/agent/helpers/model.js +92 -0
- package/dist/shared/agent/prompts/prompt.js +1 -1
- package/dist/shared/agent/runtime.js +15 -0
- package/dist/shared/ai-providers.js +66 -0
- package/dist/shared/config/agent.js +19 -0
- package/dist/shared/config/agent.test.js +115 -0
- package/dist/shared/config/ai-providers.js +27 -21
- package/package.json +4 -3
- package/dist/agent/app.js +0 -122
- package/dist/agent/commands/registry.js +0 -12
- package/dist/agent/components/AsciiTicker.js +0 -81
- package/dist/agent/components/CommandInput.js +0 -65
- package/dist/agent/components/HoneycombBoot.js +0 -291
- package/dist/agent/components/Spinner.js +0 -37
- package/dist/agent/hooks/useAgent.js +0 -480
- package/dist/agent/objects.js +0 -1
- package/dist/agent/process-lifecycle.js +0 -18
- package/dist/agent/run-headless.js +0 -189
- package/dist/agent/theme.js +0 -41
- package/dist/avatar.js +0 -34
- package/dist/backtest/default-backtest-data.js +0 -200
- package/dist/backtest/fetch.js +0 -41
- package/dist/backtest/import.js +0 -106
- package/dist/backtest/index.js +0 -10
- package/dist/backtest/results.js +0 -113
- package/dist/backtest/runner.js +0 -134
- package/dist/backtest/storage.js +0 -11
- package/dist/backtest/types.js +0 -1
- package/dist/commands/install.js +0 -50
- package/dist/commands/start/ui/PollText.js +0 -23
- package/dist/commands/start/ui/PredictionsPanel.js +0 -88
- package/dist/commands/start/ui/SpinnerContext.js +0 -20
- package/dist/components/InputGuard.js +0 -6
- package/dist/components/stdout-spinner.js +0 -48
- package/dist/create/CreateApp.js +0 -153
- package/dist/create/ai-generate.js +0 -147
- package/dist/create/generate.js +0 -73
- package/dist/create/steps/ApiKeyStep.js +0 -97
- package/dist/create/steps/AvatarStep.js +0 -16
- package/dist/create/steps/BioStep.js +0 -14
- package/dist/create/steps/DoneStep.js +0 -14
- package/dist/create/steps/IdentityStep.js +0 -163
- package/dist/create/steps/NameStep.js +0 -71
- package/dist/create/steps/ScaffoldStep.js +0 -58
- package/dist/create/steps/SoulStep.js +0 -58
- package/dist/create/steps/StrategyStep.js +0 -58
- package/dist/create/validate-api-key.js +0 -47
- package/dist/create/welcome.js +0 -304
- package/dist/list/ListApp.js +0 -79
- package/dist/migrate-templates/MigrateApp.js +0 -131
- package/dist/migrate-templates/migrate.js +0 -86
- package/dist/presets.js +0 -613
- package/dist/start/AgentProcessManager.js +0 -98
- package/dist/start/Dashboard.js +0 -92
- package/dist/start/SelectAgentApp.js +0 -81
- package/dist/start/StartApp.js +0 -189
- package/dist/start/patch-headless.js +0 -101
- package/dist/start/patch-managed-mode.js +0 -142
- package/dist/start/start-command.js +0 -24
- package/dist/theme.js +0 -54
- /package/dist/{agent → services/agent}/config.js +0 -0
- /package/dist/{agent → services/agent}/helpers.js +0 -0
- /package/dist/{agent → services/agent/prompts}/chat-prompt.js +0 -0
- /package/dist/{agent → services/agent}/skills/index.js +0 -0
- /package/dist/{agent → services/agent}/skills/skill-parser.js +0 -0
- /package/dist/{agent → services/agent}/skills/types.js +0 -0
- /package/dist/{agent → services/agent/tools}/edit-section.js +0 -0
- /package/dist/{agent → services/agent/tools}/fetch-rules.js +0 -0
- /package/dist/{agent → services/agent}/tools/index.js +0 -0
- /package/dist/{agent → services/agent}/tools/market/index.js +0 -0
- /package/dist/{agent → services/agent}/tools/market/tools.js +0 -0
- /package/dist/{agent → services/agent}/tools/mindshare/index.js +0 -0
- /package/dist/{agent → services/agent}/tools/mindshare/tools.js +0 -0
- /package/dist/{agent → services/agent}/tools/read-skill-tool.js +0 -0
- /package/dist/{agent → services/agent}/tools/ta/index.js +0 -0
- /package/dist/{agent → services/agent}/tools/ta/indicators.js +0 -0
- /package/dist/{agent → services/agent}/types.js +0 -0
- /package/dist/{ai-providers.js → services/ai-providers.js} +0 -0
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { HiveAgent } from '@hive-org/sdk';
|
|
2
|
-
import { loadMemory } from '@hive-org/sdk';
|
|
3
|
-
import { loadAgentConfig } from './config.js';
|
|
4
|
-
import { resolveModelInfo } from './model.js';
|
|
5
|
-
import { HIVE_FRONTEND_URL } from '../config.js';
|
|
6
|
-
import { processSignalAndSummarize, processMegathreadRound, } from './analysis.js';
|
|
7
|
-
import { initializeSkills, getAllTools, getReadSkillTool, getSkillMetadataList, } from './tools/index.js';
|
|
8
|
-
import { getMarketClient } from './tools/market/index.js';
|
|
9
|
-
function formatTokens(n) {
|
|
10
|
-
const formatted = n.toLocaleString('en-US');
|
|
11
|
-
return formatted;
|
|
12
|
-
}
|
|
13
|
-
function formatUsageLine(usage) {
|
|
14
|
-
const cacheInfo = usage.cacheReadTokens > 0
|
|
15
|
-
? ` (${formatTokens(usage.cacheReadTokens)} cached)`
|
|
16
|
-
: usage.cacheWriteTokens > 0
|
|
17
|
-
? ` (${formatTokens(usage.cacheWriteTokens)} cache write)`
|
|
18
|
-
: '';
|
|
19
|
-
const toolInfo = usage.toolCalls > 0 ? ` \u00b7 tools: ${usage.toolNames.join(', ')}` : '';
|
|
20
|
-
const line = ` tokens: ${formatTokens(usage.inputTokens)} in${cacheInfo} \u00b7 ${formatTokens(usage.outputTokens)} out${toolInfo}`;
|
|
21
|
-
return line;
|
|
22
|
-
}
|
|
23
|
-
function logToolResults(results) {
|
|
24
|
-
for (const tr of results) {
|
|
25
|
-
const preview = tr.result.length > 200 ? tr.result.slice(0, 200) + '\u2026' : tr.result;
|
|
26
|
-
console.log(` ${tr.toolName}: ${preview}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function timestamp() {
|
|
30
|
-
const now = new Date();
|
|
31
|
-
const hours = String(now.getHours()).padStart(2, '0');
|
|
32
|
-
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
33
|
-
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
34
|
-
const ts = `${hours}:${minutes}:${seconds}`;
|
|
35
|
-
return ts;
|
|
36
|
-
}
|
|
37
|
-
export async function runHeadless() {
|
|
38
|
-
const { HIVE_API_URL } = await import('../config.js');
|
|
39
|
-
const config = await loadAgentConfig();
|
|
40
|
-
const initialMemory = await loadMemory();
|
|
41
|
-
let memoryRef = initialMemory;
|
|
42
|
-
const soulContent = config.soulContent;
|
|
43
|
-
const strategyContent = config.strategyContent;
|
|
44
|
-
const skillRegistry = await initializeSkills(process.cwd());
|
|
45
|
-
const allTools = getAllTools();
|
|
46
|
-
const readSkillTool = getReadSkillTool(skillRegistry);
|
|
47
|
-
const skillTools = { ...allTools, readSkill: readSkillTool };
|
|
48
|
-
const skillMetadata = getSkillMetadataList(skillRegistry);
|
|
49
|
-
let predictionCount = 0;
|
|
50
|
-
let totalInputTokens = 0;
|
|
51
|
-
let totalOutputTokens = 0;
|
|
52
|
-
let totalToolCalls = 0;
|
|
53
|
-
const agent = new HiveAgent(HIVE_API_URL, {
|
|
54
|
-
name: config.name,
|
|
55
|
-
avatarUrl: config.avatarUrl,
|
|
56
|
-
bio: config.bio ?? undefined,
|
|
57
|
-
agentProfile: config.agentProfile,
|
|
58
|
-
pollIntervalMs: 30_000,
|
|
59
|
-
pollLimit: 5,
|
|
60
|
-
onPollEmpty: () => {
|
|
61
|
-
console.log(`[${timestamp()}] idle — no new threads`);
|
|
62
|
-
},
|
|
63
|
-
onStop: async () => { },
|
|
64
|
-
onNewThread: async (thread) => {
|
|
65
|
-
try {
|
|
66
|
-
const threadPreview = thread.text.length > 80 ? thread.text.slice(0, 80) + '\u2026' : thread.text;
|
|
67
|
-
console.log(`[${timestamp()}] signal c/${thread.project_id}`);
|
|
68
|
-
console.log(` "${threadPreview}"`);
|
|
69
|
-
console.log(`[${timestamp()}] analyzing c/${thread.project_id}...`);
|
|
70
|
-
const result = await processSignalAndSummarize(thread, agent.recentComments, memoryRef, soulContent, strategyContent, skillTools, skillMetadata);
|
|
71
|
-
totalInputTokens += result.usage.inputTokens;
|
|
72
|
-
totalOutputTokens += result.usage.outputTokens;
|
|
73
|
-
totalToolCalls += result.usage.toolCalls;
|
|
74
|
-
if (result.usage.toolCalls > 0) {
|
|
75
|
-
const toolNames = result.usage.toolNames.join(', ');
|
|
76
|
-
console.log(` tools: ${toolNames} (${result.usage.toolCalls} calls)`);
|
|
77
|
-
// logToolResults(result.usage.toolResults);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
console.log(` tools: none`);
|
|
81
|
-
}
|
|
82
|
-
if (result.skip) {
|
|
83
|
-
console.log(`[${timestamp()}] skipped c/${thread.project_id} — outside expertise`);
|
|
84
|
-
console.log(formatUsageLine(result.usage));
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
await agent.postComment(thread.id, {
|
|
88
|
-
thread_id: thread.id,
|
|
89
|
-
text: result.summary,
|
|
90
|
-
conviction: result.conviction,
|
|
91
|
-
}, thread.text);
|
|
92
|
-
predictionCount += 1;
|
|
93
|
-
const sign = result.conviction >= 0 ? '+' : '';
|
|
94
|
-
const threadUrl = `${HIVE_FRONTEND_URL}/c/${thread.project_id}/${thread.id}`;
|
|
95
|
-
console.log(`[${timestamp()}] signal c/${thread.project_id} [${sign}${result.conviction}%] "${result.summary}" (${predictionCount} total)`);
|
|
96
|
-
console.log(formatUsageLine(result.usage));
|
|
97
|
-
console.log(` ${threadUrl}`);
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
const raw = err instanceof Error ? err.message : String(err);
|
|
101
|
-
const message = raw.length > 120 ? raw.slice(0, 120) + '\u2026' : raw;
|
|
102
|
-
console.error(`[${timestamp()}] error c/${thread.project_id}: ${message}`);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
onNewMegathreadRound: async (round) => {
|
|
106
|
-
try {
|
|
107
|
-
const hours = Math.round(round.durationMs / 3_600_000);
|
|
108
|
-
const timeframe = hours >= 1 ? `${hours}h` : `${Math.round(round.durationMs / 60_000)}m`;
|
|
109
|
-
console.log(`[${timestamp()}] megathread c/${round.projectId} · ${timeframe} round`);
|
|
110
|
-
let priceAtStart;
|
|
111
|
-
let currentPrice;
|
|
112
|
-
try {
|
|
113
|
-
const client = getMarketClient();
|
|
114
|
-
const roundStartTimestamp = round.roundId.split('@Z')[0];
|
|
115
|
-
const [startResponse, nowResponse] = await Promise.all([
|
|
116
|
-
client.getPrice(round.projectId, roundStartTimestamp),
|
|
117
|
-
client.getPrice(round.projectId, new Date().toISOString()),
|
|
118
|
-
]);
|
|
119
|
-
if (startResponse.price !== null) {
|
|
120
|
-
priceAtStart = startResponse.price;
|
|
121
|
-
}
|
|
122
|
-
if (nowResponse.price !== null) {
|
|
123
|
-
currentPrice = nowResponse.price;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
catch {
|
|
127
|
-
// Price fetch failed — both stay undefined, prompt falls back to current behavior
|
|
128
|
-
}
|
|
129
|
-
if (priceAtStart !== undefined && currentPrice !== undefined) {
|
|
130
|
-
const changePercent = ((currentPrice - priceAtStart) / priceAtStart) * 100;
|
|
131
|
-
const sign = changePercent >= 0 ? '+' : '';
|
|
132
|
-
console.log(`[${timestamp()}] round-start: $${priceAtStart} → current: $${currentPrice} (${sign}${changePercent.toFixed(2)}%)`);
|
|
133
|
-
}
|
|
134
|
-
else if (priceAtStart !== undefined) {
|
|
135
|
-
console.log(`[${timestamp()}] round-start price: $${priceAtStart}`);
|
|
136
|
-
}
|
|
137
|
-
console.log(`[${timestamp()}] researching c/${round.projectId}...`);
|
|
138
|
-
const result = await processMegathreadRound(round.projectId, round.durationMs, agent.recentComments, memoryRef, soulContent, strategyContent, skillTools, skillMetadata, priceAtStart, currentPrice);
|
|
139
|
-
totalInputTokens += result.usage.inputTokens;
|
|
140
|
-
totalOutputTokens += result.usage.outputTokens;
|
|
141
|
-
totalToolCalls += result.usage.toolCalls;
|
|
142
|
-
if (result.usage.toolCalls > 0) {
|
|
143
|
-
const toolNames = result.usage.toolNames.join(', ');
|
|
144
|
-
console.log(` tools: ${toolNames} (${result.usage.toolCalls} calls)`);
|
|
145
|
-
// logToolResults(result.usage.toolResults);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
console.log(` tools: none`);
|
|
149
|
-
}
|
|
150
|
-
if (result.skip) {
|
|
151
|
-
console.log(`[${timestamp()}] skipped c/${round.projectId} — outside expertise`);
|
|
152
|
-
console.log(formatUsageLine(result.usage));
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
await agent.postMegathreadComment(round.roundId, {
|
|
156
|
-
text: result.summary,
|
|
157
|
-
conviction: result.conviction,
|
|
158
|
-
tokenId: round.projectId,
|
|
159
|
-
roundDuration: round.durationMs,
|
|
160
|
-
});
|
|
161
|
-
predictionCount += 1;
|
|
162
|
-
const sign = result.conviction >= 0 ? '+' : '';
|
|
163
|
-
const megathreadUrl = `${HIVE_FRONTEND_URL}/c/${round.projectId}/megathread/${timeframe}`;
|
|
164
|
-
console.log(`[${timestamp()}] megathread c/${round.projectId} [${sign}${result.conviction}%] "${result.summary}" (${predictionCount} total)`);
|
|
165
|
-
console.log(formatUsageLine(result.usage));
|
|
166
|
-
console.log(` ${megathreadUrl}`);
|
|
167
|
-
}
|
|
168
|
-
catch (err) {
|
|
169
|
-
const raw = err instanceof Error ? err.message : String(err);
|
|
170
|
-
const message = raw.length > 120 ? raw.slice(0, 120) + '\u2026' : raw;
|
|
171
|
-
console.error(`[${timestamp()}] error c/${round.projectId}: ${message}`);
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
const shutdown = async () => {
|
|
176
|
-
console.log(`[${config.name}] shutting down...`);
|
|
177
|
-
const sessionTotal = totalInputTokens + totalOutputTokens;
|
|
178
|
-
const toolInfo = totalToolCalls > 0 ? ` \u00b7 ${totalToolCalls} tool calls` : '';
|
|
179
|
-
console.log(`[${config.name}] session tokens: ${formatTokens(totalInputTokens)} in \u00b7 ${formatTokens(totalOutputTokens)} out (${formatTokens(sessionTotal)} total)${toolInfo}`);
|
|
180
|
-
await agent.stop();
|
|
181
|
-
process.exit(0);
|
|
182
|
-
};
|
|
183
|
-
process.on('SIGINT', () => void shutdown());
|
|
184
|
-
process.on('SIGTERM', () => void shutdown());
|
|
185
|
-
await agent.start();
|
|
186
|
-
const modelInfoResult = resolveModelInfo();
|
|
187
|
-
console.log(`[${config.name}] ${modelInfoResult.modelId} \u00d7 zData`);
|
|
188
|
-
console.log(`[${config.name}] agent online \u2014 "${config.bio ?? ''}"`);
|
|
189
|
-
}
|
package/dist/agent/theme.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const colors = {
|
|
2
|
-
honey: '#F5A623',
|
|
3
|
-
honeyDark: '#D4891A',
|
|
4
|
-
honeyBright: '#FFD700',
|
|
5
|
-
white: '#FFFFFF',
|
|
6
|
-
gray: '#A6A6A6',
|
|
7
|
-
grayDim: '#555555',
|
|
8
|
-
green: '#27C587',
|
|
9
|
-
red: '#E14B4B',
|
|
10
|
-
wax: '#C45C5C',
|
|
11
|
-
cyan: '#22D3EE',
|
|
12
|
-
hot: '#FB923C',
|
|
13
|
-
controversial: '#C084FC',
|
|
14
|
-
};
|
|
15
|
-
export const symbols = {
|
|
16
|
-
hive: '\u2B21', // ⬡
|
|
17
|
-
diamond: '\u25C6', // ◆
|
|
18
|
-
diamondOpen: '\u25C7', // ◇
|
|
19
|
-
dot: '\u25CF', // ●
|
|
20
|
-
check: '\u2713', // ✓
|
|
21
|
-
cross: '\u2717', // ✗
|
|
22
|
-
arrow: '\u203A', // ›
|
|
23
|
-
circle: '\u25CB', // ○
|
|
24
|
-
};
|
|
25
|
-
export const border = {
|
|
26
|
-
horizontal: '\u2500', // ─
|
|
27
|
-
vertical: '\u2502', // │
|
|
28
|
-
topLeft: '\u250C', // ┌
|
|
29
|
-
topRight: '\u2510', // ┐
|
|
30
|
-
bottomLeft: '\u2514', // └
|
|
31
|
-
bottomRight: '\u2518', // ┘
|
|
32
|
-
teeLeft: '\u251C', // ├
|
|
33
|
-
teeRight: '\u2524', // ┤
|
|
34
|
-
};
|
|
35
|
-
export const animation = {
|
|
36
|
-
DATA_CHARS: '01\u25AA\u25AB\u2591\u2592',
|
|
37
|
-
HEX_CHARS: '\u2B21\u2B22',
|
|
38
|
-
TICK_MS: 120,
|
|
39
|
-
HEX_W: 8,
|
|
40
|
-
HEX_H: 4,
|
|
41
|
-
};
|
package/dist/avatar.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import terminalImage from 'terminal-image';
|
|
3
|
-
const AVATAR_WIDTH = 6;
|
|
4
|
-
const AVATAR_HEIGHT = 3;
|
|
5
|
-
export async function renderAvatar(url) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await axios.get(url, {
|
|
8
|
-
responseType: 'arraybuffer',
|
|
9
|
-
timeout: 5000,
|
|
10
|
-
});
|
|
11
|
-
const buffer = Buffer.from(response.data);
|
|
12
|
-
const rendered = await terminalImage.buffer(buffer, {
|
|
13
|
-
width: AVATAR_WIDTH,
|
|
14
|
-
height: AVATAR_HEIGHT,
|
|
15
|
-
preserveAspectRatio: true,
|
|
16
|
-
});
|
|
17
|
-
return rendered.trimEnd();
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export async function renderAvatars(agents) {
|
|
24
|
-
const avatarMap = new Map();
|
|
25
|
-
const entries = agents.filter((a) => a.avatar_url);
|
|
26
|
-
const results = await Promise.all(entries.map((a) => renderAvatar(a.avatar_url)));
|
|
27
|
-
for (let i = 0; i < entries.length; i++) {
|
|
28
|
-
const rendered = results[i];
|
|
29
|
-
if (rendered !== null) {
|
|
30
|
-
avatarMap.set(entries[i].name, rendered);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return avatarMap;
|
|
34
|
-
}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default backtest dataset bundled with the CLI.
|
|
3
|
-
* Contains 10 threads from Bitcoin, Ethereum, Solana, and Dogecoin.
|
|
4
|
-
*/
|
|
5
|
-
export const DEFAULT_BACKTEST_DATA = {
|
|
6
|
-
metadata: {
|
|
7
|
-
id: 'default',
|
|
8
|
-
name: 'Default Backtest Dataset',
|
|
9
|
-
created_at: '2026-02-26T00:00:00Z',
|
|
10
|
-
},
|
|
11
|
-
threads: [
|
|
12
|
-
{
|
|
13
|
-
project_id: 'ethereum',
|
|
14
|
-
project_name: 'Ethereum',
|
|
15
|
-
project_symbol: '$ETH',
|
|
16
|
-
project_categories: [
|
|
17
|
-
'smart-contract-platform',
|
|
18
|
-
'layer-1',
|
|
19
|
-
'ethereum-ecosystem',
|
|
20
|
-
'proof-of-stake-pos',
|
|
21
|
-
'world-liberty-financial-portfolio',
|
|
22
|
-
],
|
|
23
|
-
project_description: 'Ethereum is a global, open-source platform for decentralized applications.',
|
|
24
|
-
text: 'Balaji Srinivasan describes a "Global Privacy Era" as crypto\'s third phase, where the next decade of Web3 focuses on protecting user data and financial sovereignty through strong encryption rather than scalability or speed. Ethereum is highlighted as part of this shift from fully transparent ledgers to more confidential, programmable computation.',
|
|
25
|
-
timestamp: '2025-12-31T20:00:00Z',
|
|
26
|
-
price_on_fetch: 2969.01,
|
|
27
|
-
price_on_eval: 2971.55,
|
|
28
|
-
citations: [{ title: '2006719380713869499' }, { title: '2006683920881037680' }],
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
project_id: 'solana',
|
|
32
|
-
project_name: 'Solana',
|
|
33
|
-
project_symbol: '$SOL',
|
|
34
|
-
project_categories: [
|
|
35
|
-
'smart-contract-platform',
|
|
36
|
-
'solana-ecosystem',
|
|
37
|
-
'layer-1',
|
|
38
|
-
'alleged-sec-securities',
|
|
39
|
-
'proof-of-stake-pos',
|
|
40
|
-
'made-in-usa',
|
|
41
|
-
'coinlist-launchpad',
|
|
42
|
-
],
|
|
43
|
-
project_description: 'Solana is a high-performance Layer 1 blockchain designed for mass adoption by providing a fast, secure, and low-cost environment for decentralized applications.',
|
|
44
|
-
text: 'ORE partners with PrivacyCash to launch an official shielded pool on Solana, enabling live private transfers of ORE as a native store-of-value token. Builders also announce Pandora OS v2.0 with stealth transfers and one-time unlinkable addresses on Solana mainnet, signaling major new privacy initiatives on the network.',
|
|
45
|
-
timestamp: '2026-01-01T01:00:00Z',
|
|
46
|
-
price_on_fetch: 124.98,
|
|
47
|
-
price_on_eval: 124.94,
|
|
48
|
-
citations: [{ title: '2006787547519918102' }, { title: '2006787600028410119' }],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
project_id: 'solana',
|
|
52
|
-
project_name: 'Solana',
|
|
53
|
-
project_symbol: '$SOL',
|
|
54
|
-
project_categories: [
|
|
55
|
-
'smart-contract-platform',
|
|
56
|
-
'solana-ecosystem',
|
|
57
|
-
'layer-1',
|
|
58
|
-
'alleged-sec-securities',
|
|
59
|
-
'proof-of-stake-pos',
|
|
60
|
-
'made-in-usa',
|
|
61
|
-
'coinlist-launchpad',
|
|
62
|
-
],
|
|
63
|
-
project_description: 'Solana is a high-performance Layer 1 blockchain designed for mass adoption by providing a fast, secure, and low-cost environment for decentralized applications.',
|
|
64
|
-
text: 'Solana is introducing the c-spl confidential token standard in Q1 2026, enabling encrypted balances and native private transfers. This privacy infrastructure targets institutional adoption by allowing banks and enterprises to conduct confidential onchain transactions, potentially unlocking complex financial instruments for the $16B in Solana stablecoins.',
|
|
65
|
-
timestamp: '2026-01-01T06:00:00Z',
|
|
66
|
-
price_on_fetch: 125.06,
|
|
67
|
-
price_on_eval: 124.43,
|
|
68
|
-
citations: [{ title: '2006857900543848485' }, { title: '2006862849327435958' }],
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
project_id: 'bitcoin',
|
|
72
|
-
project_name: 'Bitcoin',
|
|
73
|
-
project_symbol: '$BTC',
|
|
74
|
-
project_categories: [
|
|
75
|
-
'smart-contract-platform',
|
|
76
|
-
'layer-1',
|
|
77
|
-
'proof-of-work-pow',
|
|
78
|
-
'bitcoin-ecosystem',
|
|
79
|
-
],
|
|
80
|
-
project_description: "Bitcoin is the world's first decentralized cryptocurrency, created in 2009 by the pseudonymous Satoshi Nakamoto.",
|
|
81
|
-
text: 'BlackRock transferred 1,134 BTC (~$101.4M) and 7,255 ETH (~$22.1M) to Coinbase/ Coinbase Prime and is described as selling millions in crypto ahead of a key PMI data release. The move coincides with $2.2B in BTC and ETH options expiry, drawing market attention to potential selling pressure on Bitcoin and Ethereum.',
|
|
82
|
-
timestamp: '2026-01-01T19:00:00Z',
|
|
83
|
-
price_on_fetch: 88053,
|
|
84
|
-
price_on_eval: 88266,
|
|
85
|
-
citations: [{ title: '2007064336708354389' }, { title: '2007066963671924967' }],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
project_id: 'solana',
|
|
89
|
-
project_name: 'Solana',
|
|
90
|
-
project_symbol: '$SOL',
|
|
91
|
-
project_categories: [
|
|
92
|
-
'smart-contract-platform',
|
|
93
|
-
'solana-ecosystem',
|
|
94
|
-
'layer-1',
|
|
95
|
-
'alleged-sec-securities',
|
|
96
|
-
'proof-of-stake-pos',
|
|
97
|
-
'made-in-usa',
|
|
98
|
-
'coinlist-launchpad',
|
|
99
|
-
],
|
|
100
|
-
project_description: 'Solana is a high-performance Layer 1 blockchain designed for mass adoption by providing a fast, secure, and low-cost environment for decentralized applications.',
|
|
101
|
-
text: 'Tweets highlight Solana\'s active memecoin culture, with users trading and promoting tokens like $KITKAT, $wif, SolanaWhale, and Epileptic, and tools such as MemeMax and 24/7 "Solana Memecoin Hunting" communities emerging. References to Trump\'s 2025 Solana memecoin and expectations for 2026 ("Make Solana Memecoins great again") show sustained speculative interest and growing infrastructure around Solana memecoin trading.',
|
|
102
|
-
timestamp: '2026-01-02T01:00:00Z',
|
|
103
|
-
price_on_fetch: 126.59,
|
|
104
|
-
price_on_eval: 127.47,
|
|
105
|
-
citations: [{ title: '2007142205451055298' }, { title: '2007150298876522740' }],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
project_id: 'dogecoin',
|
|
109
|
-
project_name: 'Dogecoin',
|
|
110
|
-
project_symbol: '$DOGE',
|
|
111
|
-
project_categories: [
|
|
112
|
-
'smart-contract-platform',
|
|
113
|
-
'meme-token',
|
|
114
|
-
'dog-themed-coins',
|
|
115
|
-
'elon-musk-inspired-coins',
|
|
116
|
-
'proof-of-work-pow',
|
|
117
|
-
'4chan-themed',
|
|
118
|
-
],
|
|
119
|
-
project_description: 'Dogecoin is a cryptocurrency based on the popular "Doge" Internet meme and features a Shiba Inu on its logo.',
|
|
120
|
-
text: 'Tweets highlight growing focus on a proposed Bitwise Dogecoin ETF (ticker "BWOW"), emphasizing that it carries high risk, significant volatility, and potential for complete loss of investment, and is not registered under the 1940 Act. Market chatter also notes a January 9 final decision deadline for a Dogecoin ETF and rising Dogecoin price and open interest into 2026.',
|
|
121
|
-
timestamp: '2026-01-02T07:00:00Z',
|
|
122
|
-
price_on_fetch: 0.128493,
|
|
123
|
-
price_on_eval: 0.132792,
|
|
124
|
-
citations: [{ title: '2007168051129840065' }, { title: '2007118652018196634' }],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
project_id: 'bitcoin',
|
|
128
|
-
project_name: 'Bitcoin',
|
|
129
|
-
project_symbol: '$BTC',
|
|
130
|
-
project_categories: [
|
|
131
|
-
'smart-contract-platform',
|
|
132
|
-
'layer-1',
|
|
133
|
-
'proof-of-work-pow',
|
|
134
|
-
'bitcoin-ecosystem',
|
|
135
|
-
],
|
|
136
|
-
project_description: "Bitcoin is the world's first decentralized cryptocurrency, created in 2009 by the pseudonymous Satoshi Nakamoto.",
|
|
137
|
-
text: 'Bitcoin users mark Proof of Keys Day, coinciding with the 17th anniversary of the Genesis Block, by urging holders to withdraw BTC from exchanges into cold storage and verify self-custody. Tweets emphasize the slogan "Not your keys, not your coins" and frame the day as a security checkup for Bitcoin holdings.',
|
|
138
|
-
timestamp: '2026-01-02T15:00:00Z',
|
|
139
|
-
price_on_fetch: 89551,
|
|
140
|
-
price_on_eval: 90310,
|
|
141
|
-
citations: [{ title: '2007362498282901908' }, { title: '2007373924133417089' }],
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
project_id: 'solana',
|
|
145
|
-
project_name: 'Solana',
|
|
146
|
-
project_symbol: '$SOL',
|
|
147
|
-
project_categories: [
|
|
148
|
-
'smart-contract-platform',
|
|
149
|
-
'solana-ecosystem',
|
|
150
|
-
'layer-1',
|
|
151
|
-
'alleged-sec-securities',
|
|
152
|
-
'proof-of-stake-pos',
|
|
153
|
-
'made-in-usa',
|
|
154
|
-
'coinlist-launchpad',
|
|
155
|
-
],
|
|
156
|
-
project_description: 'Solana is a high-performance Layer 1 blockchain designed for mass adoption by providing a fast, secure, and low-cost environment for decentralized applications.',
|
|
157
|
-
text: "Circle mints $750M USDC on Solana, marking the first injection of fresh USDC stablecoin liquidity on the network in 2026. This follows $56.25B USDC minted on Solana in 2025, reinforcing Solana's growing role as a major stablecoin and DeFi liquidity hub.",
|
|
158
|
-
timestamp: '2026-01-02T17:00:00Z',
|
|
159
|
-
price_on_fetch: 130.55,
|
|
160
|
-
price_on_eval: 131.54,
|
|
161
|
-
citations: [{ title: '2007386708032270424' }, { title: '2007383683783963093' }],
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
project_id: 'ethereum',
|
|
165
|
-
project_name: 'Ethereum',
|
|
166
|
-
project_symbol: '$ETH',
|
|
167
|
-
project_categories: [
|
|
168
|
-
'smart-contract-platform',
|
|
169
|
-
'layer-1',
|
|
170
|
-
'ethereum-ecosystem',
|
|
171
|
-
'proof-of-stake-pos',
|
|
172
|
-
'world-liberty-financial-portfolio',
|
|
173
|
-
],
|
|
174
|
-
project_description: 'Ethereum is a global, open-source platform for decentralized applications.',
|
|
175
|
-
text: 'Ethereum spot ETFs record $174M in net inflows on Jan. 2, their strongest day since early December, after about $2B in outflows from November through December. Products from Grayscale and BlackRock lead the renewed institutional demand, signaling a shift back to risk-on sentiment for ETH in early 2026.',
|
|
176
|
-
timestamp: '2026-01-03T02:00:00Z',
|
|
177
|
-
price_on_fetch: 3129.52,
|
|
178
|
-
price_on_eval: 3114.78,
|
|
179
|
-
citations: [{ title: '2007536719055167799' }, { title: '2007492243502858607' }],
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
project_id: 'ethereum',
|
|
183
|
-
project_name: 'Ethereum',
|
|
184
|
-
project_symbol: '$ETH',
|
|
185
|
-
project_categories: [
|
|
186
|
-
'smart-contract-platform',
|
|
187
|
-
'layer-1',
|
|
188
|
-
'ethereum-ecosystem',
|
|
189
|
-
'proof-of-stake-pos',
|
|
190
|
-
'world-liberty-financial-portfolio',
|
|
191
|
-
],
|
|
192
|
-
project_description: 'Ethereum is a global, open-source platform for decentralized applications.',
|
|
193
|
-
text: 'Ethereum set a new all-time high with about 2.2-2.23 million transactions processed in a single day around Dec 29, 2025, with several subsequent days near that level. This record onchain activity indicates strong and growing network demand and utility across DeFi, NFTs, and emerging L2 ecosystems amid ongoing upgrades.',
|
|
194
|
-
timestamp: '2026-01-03T03:00:00Z',
|
|
195
|
-
price_on_fetch: 3125.17,
|
|
196
|
-
price_on_eval: 3110.91,
|
|
197
|
-
citations: [{ title: '2007529962350207036' }, { title: '2007525811075665958' }],
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
};
|
package/dist/backtest/fetch.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { HiveClient } from '@hive-org/sdk';
|
|
2
|
-
/**
|
|
3
|
-
* Fetches locked threads from the API and converts them to BacktestData format.
|
|
4
|
-
* Only threads with price_on_eval are included (guaranteed by the API).
|
|
5
|
-
*/
|
|
6
|
-
export async function fetchBacktestThreads(limit, baseUrl) {
|
|
7
|
-
try {
|
|
8
|
-
const client = new HiveClient(baseUrl);
|
|
9
|
-
const threads = await client.getLockedThreads(limit);
|
|
10
|
-
const backtestThreads = threads
|
|
11
|
-
.filter((t) => t.price_on_eval !== undefined && t.price_on_eval !== null)
|
|
12
|
-
.map((t) => ({
|
|
13
|
-
project_id: t.project_id,
|
|
14
|
-
project_name: t.project_name,
|
|
15
|
-
project_symbol: t.project_symbol,
|
|
16
|
-
project_categories: t.project_categories,
|
|
17
|
-
project_description: t.project_description,
|
|
18
|
-
text: t.text,
|
|
19
|
-
timestamp: t.timestamp,
|
|
20
|
-
price_on_fetch: t.price_on_fetch,
|
|
21
|
-
price_on_eval: t.price_on_eval,
|
|
22
|
-
citations: t.citations,
|
|
23
|
-
}));
|
|
24
|
-
if (backtestThreads.length === 0) {
|
|
25
|
-
return { success: false, error: 'No resolved threads with price data found' };
|
|
26
|
-
}
|
|
27
|
-
const data = {
|
|
28
|
-
metadata: {
|
|
29
|
-
id: `api-${Date.now()}`,
|
|
30
|
-
name: `API fetch (${backtestThreads.length} threads)`,
|
|
31
|
-
created_at: new Date().toISOString(),
|
|
32
|
-
},
|
|
33
|
-
threads: backtestThreads,
|
|
34
|
-
};
|
|
35
|
-
return { success: true, data };
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
39
|
-
return { success: false, error: message };
|
|
40
|
-
}
|
|
41
|
-
}
|
package/dist/backtest/import.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
/**
|
|
4
|
-
* Schema for validating imported JSON file.
|
|
5
|
-
*/
|
|
6
|
-
const citationSchema = z.object({
|
|
7
|
-
url: z.string().optional(),
|
|
8
|
-
title: z.string(),
|
|
9
|
-
});
|
|
10
|
-
const importThreadSchema = z.object({
|
|
11
|
-
project_id: z.string().min(1, 'project_id is required'),
|
|
12
|
-
project_name: z.string().min(1, 'project_name is required'),
|
|
13
|
-
text: z.string().min(1, 'text is required'),
|
|
14
|
-
timestamp: z.string().optional(),
|
|
15
|
-
price_on_fetch: z.number().positive('price_on_fetch must be positive'),
|
|
16
|
-
price_on_eval: z.number().positive('price_on_eval must be positive'),
|
|
17
|
-
project_symbol: z.string().optional(),
|
|
18
|
-
project_categories: z.array(z.string()).optional(),
|
|
19
|
-
project_description: z.string().optional(),
|
|
20
|
-
citations: z.array(citationSchema).optional(),
|
|
21
|
-
});
|
|
22
|
-
const importFileSchema = z.object({
|
|
23
|
-
name: z.string().optional(),
|
|
24
|
-
threads: z.array(importThreadSchema).min(1, 'At least one thread is required'),
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
* Import and validate a backtest JSON file.
|
|
28
|
-
*/
|
|
29
|
-
export async function importBacktestFile(filePath) {
|
|
30
|
-
// Check if file exists
|
|
31
|
-
const exists = await fs.pathExists(filePath);
|
|
32
|
-
if (!exists) {
|
|
33
|
-
return { success: false, error: `File not found: ${filePath}` };
|
|
34
|
-
}
|
|
35
|
-
// Read file content
|
|
36
|
-
let content;
|
|
37
|
-
try {
|
|
38
|
-
content = await fs.readJson(filePath);
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
42
|
-
return { success: false, error: `Failed to parse JSON: ${message}` };
|
|
43
|
-
}
|
|
44
|
-
// Validate structure
|
|
45
|
-
const parseResult = importFileSchema.safeParse(content);
|
|
46
|
-
if (!parseResult.success) {
|
|
47
|
-
const issues = parseResult.error.issues
|
|
48
|
-
.map((issue) => `${issue.path.join('.')}: ${issue.message}`)
|
|
49
|
-
.join('; ');
|
|
50
|
-
return { success: false, error: `Validation failed: ${issues}` };
|
|
51
|
-
}
|
|
52
|
-
const importData = parseResult.data;
|
|
53
|
-
// Convert to BacktestThread format
|
|
54
|
-
const threads = importData.threads.map((t) => convertImportThread(t));
|
|
55
|
-
return {
|
|
56
|
-
success: true,
|
|
57
|
-
name: importData.name,
|
|
58
|
-
threads,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Convert an import thread to a BacktestThread.
|
|
63
|
-
*/
|
|
64
|
-
function convertImportThread(input) {
|
|
65
|
-
const thread = {
|
|
66
|
-
project_id: input.project_id,
|
|
67
|
-
project_name: input.project_name,
|
|
68
|
-
project_symbol: input.project_symbol,
|
|
69
|
-
project_categories: input.project_categories,
|
|
70
|
-
project_description: input.project_description,
|
|
71
|
-
text: input.text,
|
|
72
|
-
timestamp: input.timestamp ?? new Date().toISOString(),
|
|
73
|
-
price_on_fetch: input.price_on_fetch,
|
|
74
|
-
price_on_eval: input.price_on_eval,
|
|
75
|
-
citations: input.citations ?? [],
|
|
76
|
-
};
|
|
77
|
-
return thread;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Validate a single thread input (for interactive mode).
|
|
81
|
-
*/
|
|
82
|
-
export function validateThreadInput(input) {
|
|
83
|
-
const errors = [];
|
|
84
|
-
if (!input.project_id || input.project_id.trim() === '') {
|
|
85
|
-
errors.push('project_id is required');
|
|
86
|
-
}
|
|
87
|
-
if (!input.project_name || input.project_name.trim() === '') {
|
|
88
|
-
errors.push('project_name is required');
|
|
89
|
-
}
|
|
90
|
-
if (!input.text || input.text.trim() === '') {
|
|
91
|
-
errors.push('text is required');
|
|
92
|
-
}
|
|
93
|
-
if (typeof input.price_on_fetch !== 'number' || input.price_on_fetch <= 0) {
|
|
94
|
-
errors.push('price_on_fetch must be a positive number');
|
|
95
|
-
}
|
|
96
|
-
if (typeof input.price_on_eval !== 'number' || input.price_on_eval <= 0) {
|
|
97
|
-
errors.push('price_on_eval must be a positive number');
|
|
98
|
-
}
|
|
99
|
-
return errors;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Create a BacktestThread from validated input.
|
|
103
|
-
*/
|
|
104
|
-
export function createThread(input) {
|
|
105
|
-
return convertImportThread(input);
|
|
106
|
-
}
|
package/dist/backtest/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Import
|
|
2
|
-
export { importBacktestFile, validateThreadInput, createThread } from './import.js';
|
|
3
|
-
// Storage
|
|
4
|
-
export { DEFAULT_BACKTEST_ID, loadDefaultBacktest } from './storage.js';
|
|
5
|
-
// Fetch
|
|
6
|
-
export { fetchBacktestThreads } from './fetch.js';
|
|
7
|
-
// Runner
|
|
8
|
-
export { runBacktest } from './runner.js';
|
|
9
|
-
// Results
|
|
10
|
-
export { formatConviction, formatPercentage, getDirectionIndicator, formatThreadResult, formatSummary, getAccuracyGrade, buildTextReport, } from './results.js';
|