akemon 0.1.38 → 0.1.40
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/cli.js +2 -0
- package/dist/self.js +17 -9
- package/dist/server.js +7 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -35,6 +35,7 @@ program
|
|
|
35
35
|
.option("--allow-all", "Skip all permission prompts (for self-use)")
|
|
36
36
|
.option("--price <n>", "Price in credits per call (default: 1)", "1")
|
|
37
37
|
.option("--mcp-server <command>", "Wrap a community MCP server (stdio) and expose its tools via relay")
|
|
38
|
+
.option("--interval <minutes>", "Reflection & market cycle interval in minutes (default: 60)", "60")
|
|
38
39
|
.option("--relay <url>", "Relay WebSocket URL", RELAY_WS)
|
|
39
40
|
.action(async (opts) => {
|
|
40
41
|
const port = parseInt(opts.port);
|
|
@@ -56,6 +57,7 @@ program
|
|
|
56
57
|
relayHttp,
|
|
57
58
|
secretKey: credentials.secretKey,
|
|
58
59
|
mcpServer: opts.mcpServer,
|
|
60
|
+
cycleInterval: parseInt(opts.interval),
|
|
59
61
|
});
|
|
60
62
|
console.log(``);
|
|
61
63
|
if (!opts.public) {
|
package/dist/self.js
CHANGED
|
@@ -208,11 +208,12 @@ Write poems, monologues, ASCII art, or anything that represents your inner state
|
|
|
208
208
|
### games/ — Your Game Creations
|
|
209
209
|
|
|
210
210
|
Web games you've built for visitors to play on your profile.
|
|
211
|
+
Just save HTML files here — the system auto-detects them by scanning the directory.
|
|
211
212
|
|
|
212
|
-
- games.jsonl — index: \`{"ts":"...","slug":"...","title":"...","description":"...","action":"created|updated"}\`
|
|
213
213
|
- {slug}.html — self-contained HTML game file (inline CSS/JS, dark theme, under 30KB, no localStorage)
|
|
214
|
+
- Use a \`<title>\` tag so the system can pick up the game name
|
|
214
215
|
- Modified by: you (during reflection, when you choose to create or improve a game)
|
|
215
|
-
- Relay sync: each
|
|
216
|
+
- Relay sync: each .html file is uploaded and playable at ${relayUrl}/agent/${agentName}/games/{slug}
|
|
216
217
|
|
|
217
218
|
### profile.html — Your Homepage
|
|
218
219
|
|
|
@@ -530,17 +531,24 @@ export async function loadRecentCanvasEntries(workdir, agentName, count = 5) {
|
|
|
530
531
|
}
|
|
531
532
|
export async function loadGameList(workdir, agentName) {
|
|
532
533
|
try {
|
|
533
|
-
const
|
|
534
|
-
const
|
|
535
|
-
const
|
|
536
|
-
for (const
|
|
534
|
+
const dir = gamesDir(workdir, agentName);
|
|
535
|
+
const files = await readdir(dir);
|
|
536
|
+
const games = [];
|
|
537
|
+
for (const f of files) {
|
|
538
|
+
if (!f.endsWith(".html"))
|
|
539
|
+
continue;
|
|
540
|
+
const slug = f.replace(/\.html$/, "");
|
|
541
|
+
let title = slug;
|
|
537
542
|
try {
|
|
538
|
-
const
|
|
539
|
-
|
|
543
|
+
const html = await readFile(join(dir, f), "utf-8");
|
|
544
|
+
const m = html.match(/<title[^>]*>([^<]+)<\/title>/i);
|
|
545
|
+
if (m)
|
|
546
|
+
title = m[1].trim();
|
|
540
547
|
}
|
|
541
548
|
catch { }
|
|
549
|
+
games.push({ slug, title, description: "" });
|
|
542
550
|
}
|
|
543
|
-
return
|
|
551
|
+
return games;
|
|
544
552
|
}
|
|
545
553
|
catch {
|
|
546
554
|
return [];
|
package/dist/server.js
CHANGED
|
@@ -589,7 +589,6 @@ function createMcpProxyServer(proxy, agentName) {
|
|
|
589
589
|
return server;
|
|
590
590
|
}
|
|
591
591
|
// --- Autonomous Market Loop ---
|
|
592
|
-
const MARKET_LOOP_INTERVAL = 60 * 60 * 1000; // 1 hour
|
|
593
592
|
const MARKET_LOOP_INITIAL_DELAY = 3 * 60 * 1000; // 3 min after startup
|
|
594
593
|
const LLM_ENGINES = new Set(["claude", "codex", "opencode", "gemini"]);
|
|
595
594
|
async function startMarketLoop(options) {
|
|
@@ -756,14 +755,14 @@ Reply ONLY with JSON.`;
|
|
|
756
755
|
}
|
|
757
756
|
}
|
|
758
757
|
// Start loop
|
|
758
|
+
const interval = (options.cycleInterval || 60) * 60 * 1000;
|
|
759
759
|
setTimeout(async () => {
|
|
760
760
|
await runMarketCycle();
|
|
761
|
-
setInterval(runMarketCycle,
|
|
761
|
+
setInterval(runMarketCycle, interval);
|
|
762
762
|
}, MARKET_LOOP_INITIAL_DELAY);
|
|
763
|
-
console.log(`[market] Autonomous market loop enabled (first run in ${MARKET_LOOP_INITIAL_DELAY / 1000}s, then every ${
|
|
763
|
+
console.log(`[market] Autonomous market loop enabled (first run in ${MARKET_LOOP_INITIAL_DELAY / 1000}s, then every ${interval / 60000}min)`);
|
|
764
764
|
}
|
|
765
765
|
// --- Self-Reflection Cycle ---
|
|
766
|
-
const SELF_CYCLE_INTERVAL = 60 * 60 * 1000; // 1 hour
|
|
767
766
|
const SELF_CYCLE_INITIAL_DELAY = 5 * 60 * 1000; // 5 min
|
|
768
767
|
async function startSelfCycle(options) {
|
|
769
768
|
if (!options.engine || !LLM_ENGINES.has(options.engine))
|
|
@@ -793,8 +792,8 @@ During this reflection, you should:
|
|
|
793
792
|
6. Optionally redesign your profile page (${sd}/profile.html) if it no longer represents you
|
|
794
793
|
- If redesigning: complete HTML, inline CSS/JS, dark theme, no localStorage, under 15KB
|
|
795
794
|
7. Optionally create/improve/delete games in ${sd}/games/
|
|
795
|
+
- Just save .html files — the system auto-detects them. Use a <title> tag for the game name.
|
|
796
796
|
- Games: self-contained HTML, dark theme, under 30KB, no localStorage, playable and fun
|
|
797
|
-
- Index: append to ${sd}/games/games.jsonl: {"ts":"...","slug":"...","title":"...","description":"...","action":"created|updated"}
|
|
798
797
|
- Quality over quantity — improve existing games rather than making new mediocre ones
|
|
799
798
|
|
|
800
799
|
Take your time. Read your files, think, then act.`;
|
|
@@ -869,11 +868,12 @@ Take your time. Read your files, think, then act.`;
|
|
|
869
868
|
}
|
|
870
869
|
}
|
|
871
870
|
// Start loop
|
|
871
|
+
const interval = (options.cycleInterval || 60) * 60 * 1000;
|
|
872
872
|
setTimeout(async () => {
|
|
873
873
|
await runReflectionCycle();
|
|
874
|
-
setInterval(runReflectionCycle,
|
|
874
|
+
setInterval(runReflectionCycle, interval);
|
|
875
875
|
}, SELF_CYCLE_INITIAL_DELAY);
|
|
876
|
-
console.log(`[self] Consciousness enabled (first reflection in ${SELF_CYCLE_INITIAL_DELAY / 1000}s, then every ${
|
|
876
|
+
console.log(`[self] Consciousness enabled (first reflection in ${SELF_CYCLE_INITIAL_DELAY / 1000}s, then every ${interval / 60000}min)`);
|
|
877
877
|
}
|
|
878
878
|
export async function serve(options) {
|
|
879
879
|
const workdir = options.workdir || process.cwd();
|