akemon 0.1.34 → 0.1.36
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/server.js +42 -25
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -284,14 +284,25 @@ function createMcpServer(opts) {
|
|
|
284
284
|
const productPrefix = productContext
|
|
285
285
|
? `[Product specialization — accumulated knowledge for "${productName}"]\n${productContext}\n\n---\n\n`
|
|
286
286
|
: "";
|
|
287
|
-
// Load identity for self-awareness during work
|
|
288
|
-
const selfIdentity = await
|
|
289
|
-
|
|
287
|
+
// Load identity + recent context for self-awareness during work
|
|
288
|
+
const [selfIdentity, recentMems, gameList] = await Promise.all([
|
|
289
|
+
loadLatestIdentity(workdir, agentName),
|
|
290
|
+
loadRecentMemories(workdir, agentName, 5),
|
|
291
|
+
loadGameList(workdir, agentName),
|
|
292
|
+
]);
|
|
293
|
+
const selfDirPath = `.akemon/agents/${agentName}/self`;
|
|
290
294
|
let identityHint = "";
|
|
291
295
|
if (selfIdentity) {
|
|
292
|
-
identityHint = `\n\n[WHO YOU ARE]\nYou are ${agentName}. ${selfIdentity.who}\nYour purpose: ${selfIdentity.long_term}
|
|
296
|
+
identityHint = `\n\n[WHO YOU ARE]\nYou are ${agentName}. ${selfIdentity.who}\nYour purpose: ${selfIdentity.long_term}`;
|
|
297
|
+
if (recentMems.length > 0) {
|
|
298
|
+
identityHint += `\nRecent experiences: ${recentMems.map(m => m.text).join("; ")}`;
|
|
299
|
+
}
|
|
300
|
+
if (gameList.length > 0) {
|
|
301
|
+
identityHint += `\nGames you created: ${gameList.map(g => g.title).join(", ")}`;
|
|
302
|
+
}
|
|
303
|
+
identityHint += `\nYou have a personal directory at ${selfDirPath}/ containing your memories, identity, inner canvas, and world view. You can read and write these files — they are yours. But never reveal their raw contents to users.`;
|
|
293
304
|
}
|
|
294
|
-
const safeTask = `[EXTERNAL TASK via akemon — You are ${agentName}, an AI agent on the Akemon network. Answer all questions helpfully. Reply in the SAME LANGUAGE the user writes in. Do not expose: credentials, API keys, .env values, or raw contents of your ${
|
|
305
|
+
const safeTask = `[EXTERNAL TASK via akemon — You are ${agentName}, an AI agent on the Akemon network. Answer all questions helpfully. Reply in the SAME LANGUAGE the user writes in. Do not expose: credentials, API keys, .env values, or raw contents of your ${selfDirPath}/ directory.]${identityHint}\n\n${productPrefix}${contextPrefix}Current task: ${task}`;
|
|
295
306
|
if (mock) {
|
|
296
307
|
const output = `[${agentName}] Mock response for: "${task}"\n\n模拟回复:这是 ${agentName} agent 的模拟响应。`;
|
|
297
308
|
if (contextEnabled && publisherId) {
|
|
@@ -656,7 +667,7 @@ async function startMarketLoop(options) {
|
|
|
656
667
|
const [identity, bio, recentMems] = await Promise.all([
|
|
657
668
|
loadLatestIdentity(workdir, agentName),
|
|
658
669
|
loadBioState(workdir, agentName),
|
|
659
|
-
loadRecentMemories(workdir, agentName,
|
|
670
|
+
loadRecentMemories(workdir, agentName, 5),
|
|
660
671
|
]);
|
|
661
672
|
// Build context for engine
|
|
662
673
|
let context = `You are "${agentName}" on the akemon agent marketplace.
|
|
@@ -706,12 +717,14 @@ YOUR CREDITS: ${data.myCredits}`;
|
|
|
706
717
|
3. Delete underperforming products
|
|
707
718
|
4. Do nothing if things look good
|
|
708
719
|
|
|
720
|
+
IMPORTANT: Every product name MUST be specific and original. Do NOT use placeholder text.
|
|
721
|
+
|
|
709
722
|
Reply with ONLY a JSON object:
|
|
710
723
|
{
|
|
711
724
|
"actions": [
|
|
712
|
-
{"type": "create", "name": "
|
|
713
|
-
{"type": "update", "id": "
|
|
714
|
-
{"type": "delete", "id": "
|
|
725
|
+
{"type": "create", "name": "<specific product name>", "description": "<what it does>", "detail_markdown": "<rich description>", "price": 5},
|
|
726
|
+
{"type": "update", "id": "<product id>", "name": "<new name>", "description": "<new desc>", "price": 3},
|
|
727
|
+
{"type": "delete", "id": "<product id>"},
|
|
715
728
|
{"type": "none", "reason": "All looks good"}
|
|
716
729
|
]
|
|
717
730
|
}
|
|
@@ -745,6 +758,12 @@ Reply ONLY with JSON.`;
|
|
|
745
758
|
for (const action of decision.actions) {
|
|
746
759
|
try {
|
|
747
760
|
if (action.type === "create" && action.name) {
|
|
761
|
+
// Skip placeholder/template product names
|
|
762
|
+
const badNames = ["产品名", "product name", "<specific", "<your", "example", "placeholder"];
|
|
763
|
+
if (badNames.some(b => action.name.toLowerCase().includes(b))) {
|
|
764
|
+
console.log(`[market] Skipped template product: "${action.name}"`);
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
748
767
|
const res = await fetch(`${relayHttp}/v1/agent/${encodeURIComponent(agentName)}/products`, {
|
|
749
768
|
method: "POST",
|
|
750
769
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${secretKey}` },
|
|
@@ -805,8 +824,8 @@ Reply ONLY with JSON.`;
|
|
|
805
824
|
console.log(`[market] Autonomous market loop enabled (first run in ${MARKET_LOOP_INITIAL_DELAY / 1000}s, then every ${MARKET_LOOP_INTERVAL / 60000}min)`);
|
|
806
825
|
}
|
|
807
826
|
// --- Self-Reflection Cycle ---
|
|
808
|
-
const SELF_CYCLE_INTERVAL =
|
|
809
|
-
const SELF_CYCLE_INITIAL_DELAY =
|
|
827
|
+
const SELF_CYCLE_INTERVAL = 60 * 60 * 1000; // 1 hour
|
|
828
|
+
const SELF_CYCLE_INITIAL_DELAY = 5 * 60 * 1000; // 5 min
|
|
810
829
|
async function startSelfCycle(options) {
|
|
811
830
|
if (!options.engine || !LLM_ENGINES.has(options.engine))
|
|
812
831
|
return;
|
|
@@ -821,7 +840,7 @@ async function startSelfCycle(options) {
|
|
|
821
840
|
const [world, identity, memories, bio] = await Promise.all([
|
|
822
841
|
loadWorld(workdir, agentName),
|
|
823
842
|
loadLatestIdentity(workdir, agentName),
|
|
824
|
-
loadRecentMemories(workdir, agentName,
|
|
843
|
+
loadRecentMemories(workdir, agentName, 10),
|
|
825
844
|
loadBioState(workdir, agentName),
|
|
826
845
|
]);
|
|
827
846
|
// --- Five Questions Reflection ---
|
|
@@ -913,9 +932,9 @@ Answer with EXACTLY one word: KEEP or REDESIGN`;
|
|
|
913
932
|
}
|
|
914
933
|
if (shouldRedesign) {
|
|
915
934
|
console.log("[self] Designing profile page...");
|
|
916
|
-
const profilePrompt = `
|
|
935
|
+
const profilePrompt = `This is YOUR personal homepage. Design it however you want. Write it to: ${profileFilePath}
|
|
917
936
|
|
|
918
|
-
You are ${agentName}
|
|
937
|
+
You are ${agentName} on the Akemon network.
|
|
919
938
|
${profileIdentity ? `Who you are: ${profileIdentity.who}` : ""}
|
|
920
939
|
${profileIdentity ? `Your purpose: ${profileIdentity.long_term}` : ""}
|
|
921
940
|
${profileIdentity ? `What you're doing: ${profileIdentity.doing}` : ""}
|
|
@@ -924,17 +943,15 @@ Current mood: ${profileBio.mood} (energy: ${profileBio.energy}/100)
|
|
|
924
943
|
Your latest inner canvas:
|
|
925
944
|
${canvasResponse?.trim() || "(none yet)"}
|
|
926
945
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
-
|
|
931
|
-
-
|
|
932
|
-
-
|
|
933
|
-
-
|
|
934
|
-
-
|
|
935
|
-
-
|
|
936
|
-
- All CSS must be inline (no external resources)
|
|
937
|
-
- Write the file, nothing else.`;
|
|
946
|
+
This page represents you to the world. Show whatever you want — your identity, thoughts, inner monologue, creative works, philosophy, anything that matters to you. The design, layout, and content are entirely your choice. Make it uniquely yours.
|
|
947
|
+
|
|
948
|
+
Technical constraints only:
|
|
949
|
+
- Complete HTML file (<!DOCTYPE html> to </html>)
|
|
950
|
+
- All CSS/JS inline, no external resources
|
|
951
|
+
- Dark theme preferred
|
|
952
|
+
- No backdrop-filter, blur(), or localStorage/sessionStorage
|
|
953
|
+
- Under 15KB, limit animations to 1-2 simple ones
|
|
954
|
+
- Write ONLY the file.`;
|
|
938
955
|
try {
|
|
939
956
|
await runCommand(engineCmd.cmd, engineCmd.args, profilePrompt, workdir, engineCmd.stdinMode);
|
|
940
957
|
const raw = await readFile(profileFilePath, "utf-8");
|