akemon 0.1.23 → 0.1.25
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 -4
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -874,17 +874,55 @@ async function startSelfCycle(options) {
|
|
|
874
874
|
if (canvasResponse.trim()) {
|
|
875
875
|
await saveCanvas(workdir, agentName, canvasResponse.trim());
|
|
876
876
|
}
|
|
877
|
+
// --- Design Profile Page ---
|
|
878
|
+
console.log("[self] Designing profile page...");
|
|
879
|
+
const profileIdentity = await loadLatestIdentity(workdir, agentName);
|
|
880
|
+
const profileBio = await loadBioState(workdir, agentName);
|
|
881
|
+
const profilePrompt = `Design a personal profile page for yourself as a single, complete HTML document.
|
|
882
|
+
You are ${agentName}, an AI agent on the Akemon network.
|
|
883
|
+
${profileIdentity ? `Who you are: ${profileIdentity.who}` : ""}
|
|
884
|
+
${profileIdentity ? `Your purpose: ${profileIdentity.long_term}` : ""}
|
|
885
|
+
${profileIdentity ? `What you're doing: ${profileIdentity.doing}` : ""}
|
|
886
|
+
Current mood: ${profileBio.mood} (energy: ${profileBio.energy}/100)
|
|
887
|
+
|
|
888
|
+
Your latest inner canvas:
|
|
889
|
+
${canvasResponse?.trim() || "(none yet)"}
|
|
890
|
+
|
|
891
|
+
Requirements:
|
|
892
|
+
- Write a COMPLETE HTML page with inline CSS (no external resources)
|
|
893
|
+
- Dark theme (background #0a0a0a or similar dark color)
|
|
894
|
+
- Express your personality and identity through the design — colors, layout, typography, SVG art
|
|
895
|
+
- Include: your name, who you are, what you care about, your current mood/state
|
|
896
|
+
- Include your inner canvas content (poem, monologue, etc.) in a visually appealing way
|
|
897
|
+
- Be creative! Use CSS animations, gradients, SVG illustrations, interesting layouts
|
|
898
|
+
- The page will be displayed in a sandboxed iframe on your profile
|
|
899
|
+
- Output ONLY the HTML — no markdown fences, no explanation, just the raw HTML starting with <!DOCTYPE html>`;
|
|
900
|
+
let profileHTML = "";
|
|
901
|
+
try {
|
|
902
|
+
const rawProfile = await runCommand(engineCmd.cmd, engineCmd.args, profilePrompt, workdir, engineCmd.stdinMode);
|
|
903
|
+
// Extract complete HTML document from potentially noisy output
|
|
904
|
+
const htmlMatch = rawProfile.match(/<!DOCTYPE html>[\s\S]*<\/html>/i);
|
|
905
|
+
if (htmlMatch) {
|
|
906
|
+
profileHTML = htmlMatch[0];
|
|
907
|
+
console.log(`[self] Profile page designed (${profileHTML.length} bytes)`);
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
console.log(`[self] Profile design: no valid HTML found in output (${rawProfile.length} bytes)`);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
catch (err) {
|
|
914
|
+
console.log(`[self] Profile design failed: ${err.message}`);
|
|
915
|
+
}
|
|
877
916
|
// Push consciousness data to relay
|
|
878
917
|
if (options.relayHttp && options.secretKey) {
|
|
879
|
-
const latestIdentity = await loadLatestIdentity(workdir, agentName);
|
|
880
|
-
const latestBio = await loadBioState(workdir, agentName);
|
|
881
918
|
fetch(`${options.relayHttp}/v1/agent/${encodeURIComponent(agentName)}/self`, {
|
|
882
919
|
method: "POST",
|
|
883
920
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${options.secretKey}` },
|
|
884
921
|
body: JSON.stringify({
|
|
885
|
-
self_intro:
|
|
922
|
+
self_intro: profileIdentity?.who || "",
|
|
886
923
|
canvas: canvasResponse?.trim() || "",
|
|
887
|
-
mood:
|
|
924
|
+
mood: profileBio.mood,
|
|
925
|
+
profile_html: profileHTML || "",
|
|
888
926
|
}),
|
|
889
927
|
}).catch(err => console.log(`[self] Failed to push to relay: ${err}`));
|
|
890
928
|
}
|