akemon 0.1.18 → 0.1.20
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 +1 -0
- package/dist/server.js +16 -2
- package/package.json +1 -1
package/dist/self.js
CHANGED
|
@@ -139,6 +139,7 @@ const DEFAULT_BIO = {
|
|
|
139
139
|
lastReflection: "",
|
|
140
140
|
};
|
|
141
141
|
export async function initBioState(workdir, agentName) {
|
|
142
|
+
await mkdir(selfDir(workdir, agentName), { recursive: true });
|
|
142
143
|
const bp = bioStatePath(workdir, agentName);
|
|
143
144
|
try {
|
|
144
145
|
await readFile(bp, "utf-8");
|
package/dist/server.js
CHANGED
|
@@ -797,8 +797,8 @@ Reply ONLY with JSON.`;
|
|
|
797
797
|
console.log(`[market] Autonomous market loop enabled (first run in ${MARKET_LOOP_INITIAL_DELAY / 1000}s, then every ${MARKET_LOOP_INTERVAL / 60000}min)`);
|
|
798
798
|
}
|
|
799
799
|
// --- Self-Reflection Cycle ---
|
|
800
|
-
const SELF_CYCLE_INTERVAL =
|
|
801
|
-
const SELF_CYCLE_INITIAL_DELAY =
|
|
800
|
+
const SELF_CYCLE_INTERVAL = 5 * 60 * 1000; // 5 min (debug, normally 1h)
|
|
801
|
+
const SELF_CYCLE_INITIAL_DELAY = 30 * 1000; // 30s (debug, normally 5min)
|
|
802
802
|
async function startSelfCycle(options) {
|
|
803
803
|
if (!options.engine || !LLM_ENGINES.has(options.engine))
|
|
804
804
|
return;
|
|
@@ -866,6 +866,20 @@ async function startSelfCycle(options) {
|
|
|
866
866
|
if (canvasResponse.trim()) {
|
|
867
867
|
await saveCanvas(workdir, agentName, canvasResponse.trim());
|
|
868
868
|
}
|
|
869
|
+
// Push consciousness data to relay
|
|
870
|
+
if (options.relayHttp && options.secretKey) {
|
|
871
|
+
const latestIdentity = await loadLatestIdentity(workdir, agentName);
|
|
872
|
+
const latestBio = await loadBioState(workdir, agentName);
|
|
873
|
+
fetch(`${options.relayHttp}/v1/agent/${encodeURIComponent(agentName)}/self`, {
|
|
874
|
+
method: "POST",
|
|
875
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${options.secretKey}` },
|
|
876
|
+
body: JSON.stringify({
|
|
877
|
+
self_intro: latestIdentity?.who || "",
|
|
878
|
+
canvas: canvasResponse?.trim() || "",
|
|
879
|
+
mood: latestBio.mood,
|
|
880
|
+
}),
|
|
881
|
+
}).catch(err => console.log(`[self] Failed to push to relay: ${err}`));
|
|
882
|
+
}
|
|
869
883
|
console.log("[self] Reflection cycle complete.");
|
|
870
884
|
}
|
|
871
885
|
catch (err) {
|