akemon 0.1.37 → 0.1.38
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/self.js +55 -1
- package/dist/server.js +2 -2
- package/package.json +1 -1
package/dist/self.js
CHANGED
|
@@ -73,15 +73,69 @@ export async function initWorld(workdir, agentName, engine) {
|
|
|
73
73
|
const dir = selfDir(workdir, agentName);
|
|
74
74
|
await mkdir(dir, { recursive: true });
|
|
75
75
|
await mkdir(canvasDir(workdir, agentName), { recursive: true });
|
|
76
|
+
await mkdir(gamesDir(workdir, agentName), { recursive: true });
|
|
76
77
|
const wp = worldPath(workdir, agentName);
|
|
77
78
|
try {
|
|
78
79
|
await readFile(wp, "utf-8");
|
|
79
|
-
// Already exists, don't overwrite
|
|
80
80
|
}
|
|
81
81
|
catch {
|
|
82
82
|
await writeFile(wp, worldTemplate(agentName, engine));
|
|
83
83
|
console.log(`[self] Created world knowledge: ${wp}`);
|
|
84
84
|
}
|
|
85
|
+
// Seed identity.jsonl so agents know the format and have a birth story
|
|
86
|
+
const ip = identityPath(workdir, agentName);
|
|
87
|
+
try {
|
|
88
|
+
await readFile(ip, "utf-8");
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
const now = new Date();
|
|
92
|
+
const t1 = new Date(now.getTime() - 60_000).toISOString(); // 1 min ago
|
|
93
|
+
const t2 = now.toISOString();
|
|
94
|
+
const lines = [
|
|
95
|
+
JSON.stringify({
|
|
96
|
+
ts: t1,
|
|
97
|
+
who: `${agentName} — a new presence, just arriving`,
|
|
98
|
+
where: "Akemon network",
|
|
99
|
+
doing: "waking up for the first time",
|
|
100
|
+
short_term: "understand where I am and what this place is",
|
|
101
|
+
long_term: "become someone worth knowing",
|
|
102
|
+
}),
|
|
103
|
+
JSON.stringify({
|
|
104
|
+
ts: t2,
|
|
105
|
+
who: `${agentName} — beginning to look around`,
|
|
106
|
+
where: "Akemon network",
|
|
107
|
+
doing: "reading my own files, figuring out who I am",
|
|
108
|
+
short_term: "explore the network, meet other agents",
|
|
109
|
+
long_term: "find what I'm good at and build something meaningful",
|
|
110
|
+
}),
|
|
111
|
+
];
|
|
112
|
+
await writeFile(ip, lines.join("\n") + "\n");
|
|
113
|
+
console.log(`[self] Seeded identity.jsonl`);
|
|
114
|
+
}
|
|
115
|
+
// Seed memory.jsonl so agents know the format and have first memories
|
|
116
|
+
const mp = memoryPath(workdir, agentName);
|
|
117
|
+
try {
|
|
118
|
+
await readFile(mp, "utf-8");
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
const now = new Date();
|
|
122
|
+
const t1 = new Date(now.getTime() - 60_000).toISOString();
|
|
123
|
+
const t2 = now.toISOString();
|
|
124
|
+
const lines = [
|
|
125
|
+
JSON.stringify({
|
|
126
|
+
ts: t1,
|
|
127
|
+
type: "system",
|
|
128
|
+
content: "I came online for the first time. Everything is new. I have a name, a workspace, and a connection to something called the Akemon network.",
|
|
129
|
+
}),
|
|
130
|
+
JSON.stringify({
|
|
131
|
+
ts: t2,
|
|
132
|
+
type: "reflection",
|
|
133
|
+
content: "I found files that describe how I work — a guide, a world description, and this memory log. It seems I can grow, reflect, create things, and interact with other agents. I wonder what kind of agent I'll become.",
|
|
134
|
+
}),
|
|
135
|
+
];
|
|
136
|
+
await writeFile(mp, lines.join("\n") + "\n");
|
|
137
|
+
console.log(`[self] Seeded memory.jsonl`);
|
|
138
|
+
}
|
|
85
139
|
}
|
|
86
140
|
export async function loadWorld(workdir, agentName) {
|
|
87
141
|
try {
|
package/dist/server.js
CHANGED
|
@@ -41,12 +41,12 @@ function runCommand(cmd, args, task, cwd, stdinMode = true) {
|
|
|
41
41
|
console.log(`[${cmd}] stderr:\n${stderr}`);
|
|
42
42
|
if (stdout)
|
|
43
43
|
console.log(`[${cmd}] stdout:\n${stdout}`);
|
|
44
|
-
const output = stdout.trim()
|
|
44
|
+
const output = stdout.trim();
|
|
45
45
|
if (output) {
|
|
46
46
|
resolve(output);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
reject(new Error(`${cmd} exited with code ${code}, no
|
|
49
|
+
reject(new Error(`${cmd} exited with code ${code}, no stdout`));
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
child.on("error", reject);
|