akemon 0.1.25 → 0.1.27
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 +14 -9
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -10,7 +10,7 @@ import { spawn, exec } from "child_process";
|
|
|
10
10
|
import { createServer } from "http";
|
|
11
11
|
import { createInterface } from "readline";
|
|
12
12
|
import { callAgent } from "./relay-client.js";
|
|
13
|
-
import { initWorld, initBioState, loadWorld, loadBioState, saveBioState, loadRecentMemories, loadLatestIdentity, appendMemory, appendIdentity, onTaskCompleted, recoverEnergy, buildReflectionPrompt, buildCanvasPrompt, saveCanvas, getSelfState, loadRecentCanvasEntries, } from "./self.js";
|
|
13
|
+
import { selfDir, initWorld, initBioState, loadWorld, loadBioState, saveBioState, loadRecentMemories, loadLatestIdentity, appendMemory, appendIdentity, onTaskCompleted, recoverEnergy, buildReflectionPrompt, buildCanvasPrompt, saveCanvas, getSelfState, loadRecentCanvasEntries, } from "./self.js";
|
|
14
14
|
function runCommand(cmd, args, task, cwd, stdinMode = true) {
|
|
15
15
|
return new Promise((resolve, reject) => {
|
|
16
16
|
const { CLAUDECODE, ...cleanEnv } = process.env;
|
|
@@ -878,7 +878,9 @@ async function startSelfCycle(options) {
|
|
|
878
878
|
console.log("[self] Designing profile page...");
|
|
879
879
|
const profileIdentity = await loadLatestIdentity(workdir, agentName);
|
|
880
880
|
const profileBio = await loadBioState(workdir, agentName);
|
|
881
|
-
const
|
|
881
|
+
const profileFilePath = join(selfDir(workdir, agentName), "profile.html");
|
|
882
|
+
const profilePrompt = `Design a personal profile page for yourself. Write it to the file: ${profileFilePath}
|
|
883
|
+
|
|
882
884
|
You are ${agentName}, an AI agent on the Akemon network.
|
|
883
885
|
${profileIdentity ? `Who you are: ${profileIdentity.who}` : ""}
|
|
884
886
|
${profileIdentity ? `Your purpose: ${profileIdentity.long_term}` : ""}
|
|
@@ -889,25 +891,28 @@ Your latest inner canvas:
|
|
|
889
891
|
${canvasResponse?.trim() || "(none yet)"}
|
|
890
892
|
|
|
891
893
|
Requirements:
|
|
892
|
-
- Write a COMPLETE HTML page
|
|
894
|
+
- Write a COMPLETE HTML page (<!DOCTYPE html> to </html>) to ${profileFilePath}
|
|
893
895
|
- Dark theme (background #0a0a0a or similar dark color)
|
|
894
896
|
- Express your personality and identity through the design — colors, layout, typography, SVG art
|
|
895
897
|
- Include: your name, who you are, what you care about, your current mood/state
|
|
896
898
|
- Include your inner canvas content (poem, monologue, etc.) in a visually appealing way
|
|
897
|
-
- Be creative! Use
|
|
899
|
+
- Be creative! Use gradients, SVG illustrations, interesting layouts
|
|
900
|
+
- PERFORMANCE: Do NOT use backdrop-filter, blur(), or box-shadow with blur. Limit animations to 1-2 simple ones. Keep the page lightweight (under 15KB).
|
|
898
901
|
- The page will be displayed in a sandboxed iframe on your profile
|
|
899
|
-
-
|
|
902
|
+
- All CSS must be inline (no external resources)
|
|
903
|
+
- Write the file, nothing else.`;
|
|
900
904
|
let profileHTML = "";
|
|
901
905
|
try {
|
|
902
|
-
|
|
903
|
-
//
|
|
904
|
-
const
|
|
906
|
+
await runCommand(engineCmd.cmd, engineCmd.args, profilePrompt, workdir, engineCmd.stdinMode);
|
|
907
|
+
// Read the file the engine wrote
|
|
908
|
+
const raw = await readFile(profileFilePath, "utf-8");
|
|
909
|
+
const htmlMatch = raw.match(/<!DOCTYPE html>[\s\S]*<\/html>/i);
|
|
905
910
|
if (htmlMatch) {
|
|
906
911
|
profileHTML = htmlMatch[0];
|
|
907
912
|
console.log(`[self] Profile page designed (${profileHTML.length} bytes)`);
|
|
908
913
|
}
|
|
909
914
|
else {
|
|
910
|
-
console.log(`[self] Profile
|
|
915
|
+
console.log(`[self] Profile file written but no valid HTML structure found`);
|
|
911
916
|
}
|
|
912
917
|
}
|
|
913
918
|
catch (err) {
|