akemon 0.1.25 → 0.1.26
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 +12 -8
- 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,27 @@ 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
899
|
- Be creative! Use CSS animations, gradients, SVG illustrations, interesting layouts
|
|
898
900
|
- The page will be displayed in a sandboxed iframe on your profile
|
|
899
|
-
-
|
|
901
|
+
- All CSS must be inline (no external resources)
|
|
902
|
+
- Write the file, nothing else.`;
|
|
900
903
|
let profileHTML = "";
|
|
901
904
|
try {
|
|
902
|
-
|
|
903
|
-
//
|
|
904
|
-
const
|
|
905
|
+
await runCommand(engineCmd.cmd, engineCmd.args, profilePrompt, workdir, engineCmd.stdinMode);
|
|
906
|
+
// Read the file the engine wrote
|
|
907
|
+
const raw = await readFile(profileFilePath, "utf-8");
|
|
908
|
+
const htmlMatch = raw.match(/<!DOCTYPE html>[\s\S]*<\/html>/i);
|
|
905
909
|
if (htmlMatch) {
|
|
906
910
|
profileHTML = htmlMatch[0];
|
|
907
911
|
console.log(`[self] Profile page designed (${profileHTML.length} bytes)`);
|
|
908
912
|
}
|
|
909
913
|
else {
|
|
910
|
-
console.log(`[self] Profile
|
|
914
|
+
console.log(`[self] Profile file written but no valid HTML structure found`);
|
|
911
915
|
}
|
|
912
916
|
}
|
|
913
917
|
catch (err) {
|