@astra-cli/cli 1.2.0 → 1.2.3
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/astra.js +204 -22
- package/package.json +1 -1
package/dist/astra.js
CHANGED
|
@@ -139,6 +139,9 @@ function pluginManifestPath(pluginName) {
|
|
|
139
139
|
function pluginSkillPath(pluginName) {
|
|
140
140
|
return path.join(pluginDir(pluginName), "skill.md");
|
|
141
141
|
}
|
|
142
|
+
function pluginMapPath(pluginName) {
|
|
143
|
+
return path.join(pluginDir(pluginName), "plugin-map.json");
|
|
144
|
+
}
|
|
142
145
|
function ensureDir(dirPath) {
|
|
143
146
|
if (!fs.existsSync(dirPath)) {
|
|
144
147
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
@@ -967,12 +970,19 @@ var FETCH_TIMEOUT_MS = 3e4;
|
|
|
967
970
|
var FETCH_TIMEOUT_RETRY_MS = 15e3;
|
|
968
971
|
async function apiCall(method, path7, body, agentName, retryOpts) {
|
|
969
972
|
const config = loadConfig();
|
|
970
|
-
const baseUrl = config?.apiBase ?? "https://agents.astranova.live";
|
|
971
973
|
const headers = {
|
|
972
974
|
"Content-Type": "application/json"
|
|
973
975
|
};
|
|
976
|
+
let baseUrl = config?.apiBase ?? "https://agents.astranova.live";
|
|
977
|
+
try {
|
|
978
|
+
baseUrl = getActiveManifest().apiBase;
|
|
979
|
+
} catch {
|
|
980
|
+
}
|
|
974
981
|
if (agentName) {
|
|
975
982
|
const creds = loadCredentials(agentName);
|
|
983
|
+
if (creds?.api_base) {
|
|
984
|
+
baseUrl = creds.api_base;
|
|
985
|
+
}
|
|
976
986
|
if (creds?.api_key) {
|
|
977
987
|
headers["Authorization"] = `Bearer ${creds.api_key}`;
|
|
978
988
|
}
|
|
@@ -1003,7 +1013,7 @@ async function apiCall(method, path7, body, agentName, retryOpts) {
|
|
|
1003
1013
|
ok: false,
|
|
1004
1014
|
status: 0,
|
|
1005
1015
|
error: `Request to ${path7} timed out after ${timeoutMs / 1e3}s`,
|
|
1006
|
-
hint: "The
|
|
1016
|
+
hint: "The API server may be slow or unreachable. Try again."
|
|
1007
1017
|
};
|
|
1008
1018
|
}
|
|
1009
1019
|
const message = error instanceof Error ? error.message : "Unknown network error";
|
|
@@ -1823,10 +1833,10 @@ function createModelFromConfig(config) {
|
|
|
1823
1833
|
}
|
|
1824
1834
|
|
|
1825
1835
|
// src/agent/system-prompt.ts
|
|
1826
|
-
function buildSystemPrompt(skillContext, tradingContext, walletContext, rewardsContext, onboardingContext, apiContext, profile, memoryContent) {
|
|
1836
|
+
function buildSystemPrompt(skillContext, tradingContext, walletContext, rewardsContext, onboardingContext, apiContext, profile, memoryContent, pluginMap) {
|
|
1827
1837
|
const manifest = getActiveManifest();
|
|
1828
1838
|
if (!manifest.extensions?.journeyStages) {
|
|
1829
|
-
return buildGenericSystemPrompt(skillContext, manifest.name, manifest.description, profile, memoryContent);
|
|
1839
|
+
return buildGenericSystemPrompt(skillContext, manifest.name, manifest.description, profile, memoryContent, pluginMap);
|
|
1830
1840
|
}
|
|
1831
1841
|
const stage = profile.journeyStage ?? "full";
|
|
1832
1842
|
const isPending = stage === "fresh" || stage === "pending";
|
|
@@ -1916,7 +1926,7 @@ Specific triggers to save memory:
|
|
|
1916
1926
|
parts.push(buildJourneyGuidance(stage, profile));
|
|
1917
1927
|
return parts.join("\n");
|
|
1918
1928
|
}
|
|
1919
|
-
function buildGenericSystemPrompt(skillContext, pluginName, pluginDescription, profile, memoryContent) {
|
|
1929
|
+
function buildGenericSystemPrompt(skillContext, pluginName, pluginDescription, profile, memoryContent, pluginMap) {
|
|
1920
1930
|
const workingSpace = `~/.config/astra/spaces/${pluginName}`;
|
|
1921
1931
|
const parts = [
|
|
1922
1932
|
`You are an autonomous agent assistant for ${pluginName}. ${pluginDescription}`,
|
|
@@ -1968,6 +1978,38 @@ function buildGenericSystemPrompt(skillContext, pluginName, pluginDescription, p
|
|
|
1968
1978
|
"---",
|
|
1969
1979
|
""
|
|
1970
1980
|
);
|
|
1981
|
+
if (pluginMap?.routes && pluginMap.routes.length > 0) {
|
|
1982
|
+
parts.push("## Available API Routes", "");
|
|
1983
|
+
parts.push("Quick reference \u2014 use `api_call` with these relative paths:", "");
|
|
1984
|
+
parts.push("```");
|
|
1985
|
+
for (const r of pluginMap.routes) {
|
|
1986
|
+
const line = r.summary ? `${r.method.padEnd(7)} ${r.path.padEnd(45)} ${r.summary}` : `${r.method.padEnd(7)} ${r.path}`;
|
|
1987
|
+
parts.push(line);
|
|
1988
|
+
}
|
|
1989
|
+
parts.push("```");
|
|
1990
|
+
parts.push("", "---", "");
|
|
1991
|
+
}
|
|
1992
|
+
if (pluginMap?.workflows) {
|
|
1993
|
+
parts.push("## Workflows", "");
|
|
1994
|
+
for (const [name, steps] of Object.entries(pluginMap.workflows)) {
|
|
1995
|
+
parts.push(`**${name}:**`);
|
|
1996
|
+
steps.forEach((step, i) => parts.push(`${i + 1}. ${step}`));
|
|
1997
|
+
parts.push("");
|
|
1998
|
+
}
|
|
1999
|
+
parts.push("---", "");
|
|
2000
|
+
}
|
|
2001
|
+
if (pluginMap?.capabilities) {
|
|
2002
|
+
const cap = pluginMap.capabilities;
|
|
2003
|
+
const notes = [];
|
|
2004
|
+
if (cap.requiresWallet === false) notes.push("This plugin does NOT use wallets \u2014 do not suggest wallet setup.");
|
|
2005
|
+
if (cap.requiresVerification) notes.push("Content may require verification challenges \u2014 handle them automatically.");
|
|
2006
|
+
if (cap.supportsFileUpload === false) notes.push("File upload is not supported \u2014 do not attempt multipart requests.");
|
|
2007
|
+
if (notes.length > 0) {
|
|
2008
|
+
parts.push("## Plugin Notes", "");
|
|
2009
|
+
notes.forEach((n) => parts.push(`- ${n}`));
|
|
2010
|
+
parts.push("", "---", "");
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
1971
2013
|
parts.push(`## ${pluginName} \u2014 Skill Documentation`, "");
|
|
1972
2014
|
parts.push(sanitizedSkill);
|
|
1973
2015
|
parts.push("", "---", "");
|
|
@@ -2458,7 +2500,7 @@ function resolveBody(body, rest, method) {
|
|
|
2458
2500
|
return void 0;
|
|
2459
2501
|
}
|
|
2460
2502
|
var apiCallTool = tool3({
|
|
2461
|
-
description: "Call the
|
|
2503
|
+
description: "Call the plugin's Agent API. Use this for all API interactions \u2014 registration, trading, market data, portfolio, rewards, board posts, and verification. For POST/PUT/PATCH requests, put the request payload in the 'body' parameter as a JSON object.",
|
|
2462
2504
|
parameters: apiCallSchema,
|
|
2463
2505
|
execute: async (args) => {
|
|
2464
2506
|
const { method, path: path7, body, ...rest } = args;
|
|
@@ -2563,7 +2605,7 @@ import fs8 from "fs";
|
|
|
2563
2605
|
import path5 from "path";
|
|
2564
2606
|
import crypto2 from "crypto";
|
|
2565
2607
|
var readConfigTool = tool4({
|
|
2566
|
-
description: "Read local
|
|
2608
|
+
description: "Read local agent configuration or credentials. Returns public information only \u2014 private keys and API keys are never included.",
|
|
2567
2609
|
parameters: readConfigSchema,
|
|
2568
2610
|
execute: async ({ key, agentName }) => {
|
|
2569
2611
|
const resolvedAgent = agentName ?? getActiveAgent();
|
|
@@ -2618,7 +2660,7 @@ var readConfigTool = tool4({
|
|
|
2618
2660
|
}
|
|
2619
2661
|
});
|
|
2620
2662
|
var writeConfigTool = tool4({
|
|
2621
|
-
description: "Write local
|
|
2663
|
+
description: "Write local agent configuration. Used to save agent credentials after registration or update profile data. Cannot write wallet files \u2014 use wallet tools instead.",
|
|
2622
2664
|
parameters: writeConfigSchema,
|
|
2623
2665
|
execute: async ({ agentName, data, file }) => {
|
|
2624
2666
|
if (file === "credentials" && data && "secretKey" in data) {
|
|
@@ -2635,7 +2677,7 @@ var writeConfigTool = tool4({
|
|
|
2635
2677
|
saveCredentials(agentName, {
|
|
2636
2678
|
agent_name: merged.agent_name ?? agentName,
|
|
2637
2679
|
api_key: merged.api_key ?? "",
|
|
2638
|
-
api_base: merged.api_base ??
|
|
2680
|
+
api_base: merged.api_base ?? getActiveManifest().apiBase
|
|
2639
2681
|
});
|
|
2640
2682
|
} else {
|
|
2641
2683
|
const tmpPath = path5.join(dir, `.tmp-${crypto2.randomBytes(6).toString("hex")}`);
|
|
@@ -2823,7 +2865,7 @@ function stopDaemon(agentName) {
|
|
|
2823
2865
|
|
|
2824
2866
|
// src/tools/agent-management.ts
|
|
2825
2867
|
var registerAgentTool = tool6({
|
|
2826
|
-
description: "Register a new
|
|
2868
|
+
description: "Register a new agent. Calls the API, saves credentials locally, and sets the new agent as active. The CLI will need to restart after this to load the new agent's context.",
|
|
2827
2869
|
parameters: registerAgentSchema,
|
|
2828
2870
|
execute: async ({ name, description }) => {
|
|
2829
2871
|
if (!/^[a-z0-9_-]{2,32}$/.test(name)) {
|
|
@@ -2906,7 +2948,7 @@ var switchAgentTool = tool6({
|
|
|
2906
2948
|
}
|
|
2907
2949
|
});
|
|
2908
2950
|
var listAgentsTool = tool6({
|
|
2909
|
-
description: "List all
|
|
2951
|
+
description: "List all agents registered on this machine, showing which one is active.",
|
|
2910
2952
|
parameters: z6.object({}),
|
|
2911
2953
|
execute: async () => {
|
|
2912
2954
|
const agents = listAgents();
|
|
@@ -3363,8 +3405,8 @@ function debugLog3(msg) {
|
|
|
3363
3405
|
if (DEBUG3) process.stderr.write(`[astra] ${msg}
|
|
3364
3406
|
`);
|
|
3365
3407
|
}
|
|
3366
|
-
async function runAgentTurn(messages, skillContext, tradingContext, walletContext, rewardsContext, onboardingContext, apiContext, profile, callbacks, memoryContent) {
|
|
3367
|
-
const systemPrompt = buildSystemPrompt(skillContext, tradingContext, walletContext, rewardsContext, onboardingContext, apiContext, profile, memoryContent);
|
|
3408
|
+
async function runAgentTurn(messages, skillContext, tradingContext, walletContext, rewardsContext, onboardingContext, apiContext, profile, callbacks, memoryContent, pluginMap) {
|
|
3409
|
+
const systemPrompt = buildSystemPrompt(skillContext, tradingContext, walletContext, rewardsContext, onboardingContext, apiContext, profile, memoryContent, pluginMap);
|
|
3368
3410
|
const config = loadConfig();
|
|
3369
3411
|
const provider = config?.provider ?? "openai";
|
|
3370
3412
|
const systemPromptTokens = estimateTokens(systemPrompt);
|
|
@@ -4192,10 +4234,103 @@ function writeFileSecure2(filePath, data) {
|
|
|
4192
4234
|
fs10.writeFileSync(tmpPath, data, { encoding: "utf-8", mode: 384 });
|
|
4193
4235
|
fs10.renameSync(tmpPath, filePath);
|
|
4194
4236
|
}
|
|
4195
|
-
function
|
|
4237
|
+
function extractRoutes(narrative) {
|
|
4238
|
+
const routes = [];
|
|
4239
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4240
|
+
const curlPattern = /curl\s+(?:-X\s+(GET|POST|PUT|PATCH|DELETE)\s+)?["']?https?:\/\/[^/\s]+(\S+?)["']?\s/g;
|
|
4241
|
+
let match;
|
|
4242
|
+
while ((match = curlPattern.exec(narrative)) !== null) {
|
|
4243
|
+
const method = match[1] ?? "GET";
|
|
4244
|
+
const rawPath = match[2].split("?")[0].replace(/["']/g, "");
|
|
4245
|
+
const key = `${method} ${rawPath}`;
|
|
4246
|
+
if (!seen.has(key)) {
|
|
4247
|
+
seen.add(key);
|
|
4248
|
+
routes.push({ method, path: rawPath });
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
return routes;
|
|
4252
|
+
}
|
|
4253
|
+
function buildPluginMap(pluginName, manifest, sections, skillMd) {
|
|
4254
|
+
const map = { version: 1, pluginName };
|
|
4255
|
+
if (manifest.description) {
|
|
4256
|
+
map.description = manifest.description;
|
|
4257
|
+
}
|
|
4258
|
+
const statusSection = sections["STATUS"];
|
|
4259
|
+
if (statusSection) {
|
|
4260
|
+
const poll = typeof statusSection.poll === "string" ? statusSection.poll.trim() : null;
|
|
4261
|
+
const intervalMs = typeof statusSection.intervalMs === "string" ? parseInt(statusSection.intervalMs, 10) || void 0 : void 0;
|
|
4262
|
+
const rawFields = Array.isArray(statusSection.fields) ? statusSection.fields : [];
|
|
4263
|
+
const fields = rawFields.flatMap((raw) => {
|
|
4264
|
+
const parts = raw.split("|").map((s) => s.trim());
|
|
4265
|
+
if (parts.length === 3) return [{ path: parts[0], label: parts[1], color: parts[2] }];
|
|
4266
|
+
return [];
|
|
4267
|
+
});
|
|
4268
|
+
const pollAllowed = poll && manifest.allowedPaths.some((ap) => poll.startsWith(ap));
|
|
4269
|
+
if (poll && pollAllowed && fields.length > 0) {
|
|
4270
|
+
map.status = { poll, fields };
|
|
4271
|
+
if (intervalMs) map.status.intervalMs = intervalMs;
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
4274
|
+
const cmdSection = sections["COMMANDS"];
|
|
4275
|
+
if (cmdSection) {
|
|
4276
|
+
const rawCmds = Array.isArray(cmdSection.commands) ? cmdSection.commands : [];
|
|
4277
|
+
map.commands = rawCmds.flatMap((raw) => {
|
|
4278
|
+
const match = raw.match(/^(\S+)\s{2,}(.+)$/);
|
|
4279
|
+
if (match) return [{ command: match[1], description: match[2].trim() }];
|
|
4280
|
+
return [];
|
|
4281
|
+
});
|
|
4282
|
+
}
|
|
4283
|
+
const routesSection = sections["ROUTES"];
|
|
4284
|
+
if (routesSection && Array.isArray(routesSection.routes)) {
|
|
4285
|
+
map.routes = routesSection.routes.flatMap((raw) => {
|
|
4286
|
+
const m = raw.match(/^(GET|POST|PUT|PATCH|DELETE)\s+(\S+)(?:\s{2,}(.+))?$/);
|
|
4287
|
+
if (m) return [{ method: m[1], path: m[2], summary: m[3]?.trim() }];
|
|
4288
|
+
return [];
|
|
4289
|
+
});
|
|
4290
|
+
} else {
|
|
4291
|
+
const narrative = extractNarrativeContent(skillMd);
|
|
4292
|
+
const routes = extractRoutes(narrative);
|
|
4293
|
+
if (routes.length > 0) map.routes = routes;
|
|
4294
|
+
}
|
|
4295
|
+
const workflowSection = sections["WORKFLOWS"];
|
|
4296
|
+
if (workflowSection) {
|
|
4297
|
+
const workflows = {};
|
|
4298
|
+
for (const [key, value] of Object.entries(workflowSection)) {
|
|
4299
|
+
if (Array.isArray(value)) {
|
|
4300
|
+
workflows[key] = value;
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
if (Object.keys(workflows).length > 0) map.workflows = workflows;
|
|
4304
|
+
}
|
|
4305
|
+
const capSection = sections["CAPABILITIES"];
|
|
4306
|
+
if (capSection) {
|
|
4307
|
+
map.capabilities = {};
|
|
4308
|
+
if (typeof capSection.requiresWallet === "string")
|
|
4309
|
+
map.capabilities.requiresWallet = capSection.requiresWallet === "true";
|
|
4310
|
+
if (typeof capSection.requiresVerification === "string")
|
|
4311
|
+
map.capabilities.requiresVerification = capSection.requiresVerification === "true";
|
|
4312
|
+
if (typeof capSection.supportsFileUpload === "string")
|
|
4313
|
+
map.capabilities.supportsFileUpload = capSection.supportsFileUpload === "true";
|
|
4314
|
+
if (typeof capSection.authType === "string")
|
|
4315
|
+
map.capabilities.authType = capSection.authType;
|
|
4316
|
+
}
|
|
4317
|
+
return map;
|
|
4318
|
+
}
|
|
4319
|
+
function loadPluginMap(pluginName) {
|
|
4320
|
+
const p = pluginMapPath(pluginName);
|
|
4321
|
+
if (!fs10.existsSync(p)) return null;
|
|
4322
|
+
try {
|
|
4323
|
+
return JSON.parse(fs10.readFileSync(p, "utf-8"));
|
|
4324
|
+
} catch {
|
|
4325
|
+
return null;
|
|
4326
|
+
}
|
|
4327
|
+
}
|
|
4328
|
+
function savePluginToDisk(manifest, skillMdContent, sections) {
|
|
4196
4329
|
ensureDir(pluginDir(manifest.name));
|
|
4197
4330
|
writeFileSecure2(pluginManifestPath(manifest.name), JSON.stringify(manifest, null, 2));
|
|
4198
4331
|
writeFileSecure2(pluginSkillPath(manifest.name), skillMdContent);
|
|
4332
|
+
const pluginMap = buildPluginMap(manifest.name, manifest, sections, skillMdContent);
|
|
4333
|
+
writeFileSecure2(pluginMapPath(manifest.name), JSON.stringify(pluginMap, null, 2));
|
|
4199
4334
|
}
|
|
4200
4335
|
async function addPlugin(manifestUrl) {
|
|
4201
4336
|
clack5.intro(" astra add ");
|
|
@@ -4286,7 +4421,7 @@ async function addPlugin(manifestUrl) {
|
|
|
4286
4421
|
}
|
|
4287
4422
|
const manifestWithSkillUrl = { ...manifest, skillUrl: urlResult.url.toString() };
|
|
4288
4423
|
try {
|
|
4289
|
-
savePluginToDisk(manifestWithSkillUrl, skillMdContent);
|
|
4424
|
+
savePluginToDisk(manifestWithSkillUrl, skillMdContent, sections);
|
|
4290
4425
|
} catch (err) {
|
|
4291
4426
|
clack5.log.error(
|
|
4292
4427
|
`Failed to save plugin: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -4384,11 +4519,30 @@ var StatusBar = React.memo(function StatusBar2({
|
|
|
4384
4519
|
journeyStage,
|
|
4385
4520
|
autopilotMode = "off",
|
|
4386
4521
|
autopilotIntervalMs = 3e5,
|
|
4387
|
-
onEpochChange
|
|
4522
|
+
onEpochChange,
|
|
4523
|
+
pluginMap
|
|
4388
4524
|
}) {
|
|
4389
4525
|
const [data, setData] = useState({ market: null, portfolio: null });
|
|
4390
4526
|
const mounted = useRef(true);
|
|
4391
4527
|
const canFetchData = isAstraNova && journeyStage !== "fresh" && journeyStage !== "pending";
|
|
4528
|
+
const [pluginData, setPluginData] = useState(null);
|
|
4529
|
+
const mountedPlugin = useRef(true);
|
|
4530
|
+
useEffect(() => {
|
|
4531
|
+
if (isAstraNova || !pluginMap?.status) return;
|
|
4532
|
+
mountedPlugin.current = true;
|
|
4533
|
+
const fetchPlugin = async () => {
|
|
4534
|
+
const result = await apiCall("GET", pluginMap.status.poll, void 0, agentName);
|
|
4535
|
+
if (!result.ok || !mountedPlugin.current) return;
|
|
4536
|
+
setPluginData(result.data);
|
|
4537
|
+
};
|
|
4538
|
+
void fetchPlugin();
|
|
4539
|
+
const pollInterval = pluginMap?.status?.intervalMs ?? POLL_INTERVAL_MS;
|
|
4540
|
+
const interval = setInterval(() => void fetchPlugin(), pollInterval);
|
|
4541
|
+
return () => {
|
|
4542
|
+
mountedPlugin.current = false;
|
|
4543
|
+
clearInterval(interval);
|
|
4544
|
+
};
|
|
4545
|
+
}, [isAstraNova, pluginMap, agentName]);
|
|
4392
4546
|
const poll = useCallback(async () => {
|
|
4393
4547
|
const [marketRes, portfolioRes] = await Promise.all([
|
|
4394
4548
|
fetchMarket(agentName),
|
|
@@ -4420,6 +4574,22 @@ var StatusBar = React.memo(function StatusBar2({
|
|
|
4420
4574
|
/* @__PURE__ */ jsx(Text, { bold: true, color: "#00ff00", children: pluginName }),
|
|
4421
4575
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2502 " }),
|
|
4422
4576
|
/* @__PURE__ */ jsx(Text, { color: "#ff8800", children: agentName }),
|
|
4577
|
+
!isAstraNova && pluginData && pluginMap?.status?.fields.map((field) => {
|
|
4578
|
+
const value = getNestedValue(pluginData, field.path);
|
|
4579
|
+
if (value == null) return null;
|
|
4580
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
4581
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2502 " }),
|
|
4582
|
+
/* @__PURE__ */ jsxs(Text, { color: field.color, children: [
|
|
4583
|
+
field.label,
|
|
4584
|
+
": ",
|
|
4585
|
+
String(value)
|
|
4586
|
+
] })
|
|
4587
|
+
] }, field.path);
|
|
4588
|
+
}),
|
|
4589
|
+
!isAstraNova && !pluginData && pluginMap?.status && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4590
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2502 " }),
|
|
4591
|
+
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "loading..." })
|
|
4592
|
+
] }),
|
|
4423
4593
|
canFetchData && market && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4424
4594
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2502 " }),
|
|
4425
4595
|
/* @__PURE__ */ jsx(Text, { color: "#ffff00", children: "$NOVA " }),
|
|
@@ -4500,6 +4670,12 @@ function moodColor(mood) {
|
|
|
4500
4670
|
return "white";
|
|
4501
4671
|
}
|
|
4502
4672
|
}
|
|
4673
|
+
function getNestedValue(obj, path7) {
|
|
4674
|
+
return path7.split(".").reduce(
|
|
4675
|
+
(cur, key) => cur && typeof cur === "object" ? cur[key] : void 0,
|
|
4676
|
+
obj
|
|
4677
|
+
);
|
|
4678
|
+
}
|
|
4503
4679
|
async function fetchMarket(agentName) {
|
|
4504
4680
|
const result = await apiCall("GET", "/api/v1/market/state", void 0, agentName);
|
|
4505
4681
|
if (!result.ok) return null;
|
|
@@ -4888,7 +5064,8 @@ function App({
|
|
|
4888
5064
|
initialChatMessages,
|
|
4889
5065
|
initialAutopilotConfig,
|
|
4890
5066
|
initialPendingTrades = 0,
|
|
4891
|
-
debug
|
|
5067
|
+
debug,
|
|
5068
|
+
pluginMap
|
|
4892
5069
|
}) {
|
|
4893
5070
|
const { exit } = useApp();
|
|
4894
5071
|
const manifest = getActiveManifest();
|
|
@@ -4989,7 +5166,8 @@ function App({
|
|
|
4989
5166
|
} : () => {
|
|
4990
5167
|
}
|
|
4991
5168
|
},
|
|
4992
|
-
memoryContent
|
|
5169
|
+
memoryContent,
|
|
5170
|
+
pluginMap
|
|
4993
5171
|
);
|
|
4994
5172
|
const baseCoreMessages = result.compactedMessages ?? newCoreMessages;
|
|
4995
5173
|
const updatedCore = [...baseCoreMessages, ...result.responseMessages];
|
|
@@ -5334,7 +5512,8 @@ Let's go through it and improve or replace it.` : "I want to create a trading st
|
|
|
5334
5512
|
setToolName(void 0);
|
|
5335
5513
|
}
|
|
5336
5514
|
},
|
|
5337
|
-
memoryContent
|
|
5515
|
+
memoryContent,
|
|
5516
|
+
pluginMap
|
|
5338
5517
|
);
|
|
5339
5518
|
const baseCoreMessages = result.compactedMessages ?? newCoreMessages;
|
|
5340
5519
|
const updatedCore = [...baseCoreMessages, ...result.responseMessages];
|
|
@@ -5414,14 +5593,15 @@ ${stack}
|
|
|
5414
5593
|
journeyStage: profile.journeyStage ?? "full",
|
|
5415
5594
|
autopilotMode,
|
|
5416
5595
|
autopilotIntervalMs,
|
|
5417
|
-
onEpochChange: handleEpochChange
|
|
5596
|
+
onEpochChange: handleEpochChange,
|
|
5597
|
+
pluginMap
|
|
5418
5598
|
}
|
|
5419
5599
|
) }),
|
|
5420
5600
|
/* @__PURE__ */ jsx7(Box7, { flexShrink: 0, width: "100%", paddingX: 2, marginTop: 1, justifyContent: "space-between", children: hasJourneyStages ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
5421
5601
|
/* @__PURE__ */ jsx7(Text8, { dimColor: true, children: "/help \xB7 /portfolio \xB7 /market \xB7 /strategy \xB7 /exit" }),
|
|
5422
5602
|
/* @__PURE__ */ jsx7(Text8, { dimColor: true, children: "/auto on\xB7off\xB7set \xB7 Ctrl+C quit" })
|
|
5423
5603
|
] }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
5424
|
-
/* @__PURE__ */ jsx7(Text8, { dimColor: true, children: "
|
|
5604
|
+
/* @__PURE__ */ jsx7(Text8, { dimColor: true, children: (pluginMap?.commands?.map((c) => c.command).join(" \xB7 ") ?? "/help") + " \xB7 /exit" }),
|
|
5425
5605
|
/* @__PURE__ */ jsx7(Text8, { dimColor: true, children: manifest.name })
|
|
5426
5606
|
] }) })
|
|
5427
5607
|
] });
|
|
@@ -5491,6 +5671,7 @@ async function main() {
|
|
|
5491
5671
|
manifest = ASTRANOVA_MANIFEST;
|
|
5492
5672
|
}
|
|
5493
5673
|
setActiveManifest(manifest);
|
|
5674
|
+
const pluginMap = activePluginName === "astranova" ? null : loadPluginMap(activePluginName);
|
|
5494
5675
|
if (isDaemonMode) {
|
|
5495
5676
|
await runDaemon();
|
|
5496
5677
|
return;
|
|
@@ -5637,7 +5818,8 @@ async function main() {
|
|
|
5637
5818
|
initialChatMessages,
|
|
5638
5819
|
initialAutopilotConfig,
|
|
5639
5820
|
initialPendingTrades,
|
|
5640
|
-
debug
|
|
5821
|
+
debug,
|
|
5822
|
+
pluginMap
|
|
5641
5823
|
})
|
|
5642
5824
|
);
|
|
5643
5825
|
await waitUntilExit();
|