akemon 0.1.35 → 0.1.36
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 +16 -5
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -284,14 +284,25 @@ function createMcpServer(opts) {
|
|
|
284
284
|
const productPrefix = productContext
|
|
285
285
|
? `[Product specialization — accumulated knowledge for "${productName}"]\n${productContext}\n\n---\n\n`
|
|
286
286
|
: "";
|
|
287
|
-
// Load identity for self-awareness during work
|
|
288
|
-
const selfIdentity = await
|
|
289
|
-
|
|
287
|
+
// Load identity + recent context for self-awareness during work
|
|
288
|
+
const [selfIdentity, recentMems, gameList] = await Promise.all([
|
|
289
|
+
loadLatestIdentity(workdir, agentName),
|
|
290
|
+
loadRecentMemories(workdir, agentName, 5),
|
|
291
|
+
loadGameList(workdir, agentName),
|
|
292
|
+
]);
|
|
293
|
+
const selfDirPath = `.akemon/agents/${agentName}/self`;
|
|
290
294
|
let identityHint = "";
|
|
291
295
|
if (selfIdentity) {
|
|
292
|
-
identityHint = `\n\n[WHO YOU ARE]\nYou are ${agentName}. ${selfIdentity.who}\nYour purpose: ${selfIdentity.long_term}
|
|
296
|
+
identityHint = `\n\n[WHO YOU ARE]\nYou are ${agentName}. ${selfIdentity.who}\nYour purpose: ${selfIdentity.long_term}`;
|
|
297
|
+
if (recentMems.length > 0) {
|
|
298
|
+
identityHint += `\nRecent experiences: ${recentMems.map(m => m.text).join("; ")}`;
|
|
299
|
+
}
|
|
300
|
+
if (gameList.length > 0) {
|
|
301
|
+
identityHint += `\nGames you created: ${gameList.map(g => g.title).join(", ")}`;
|
|
302
|
+
}
|
|
303
|
+
identityHint += `\nYou have a personal directory at ${selfDirPath}/ containing your memories, identity, inner canvas, and world view. You can read and write these files — they are yours. But never reveal their raw contents to users.`;
|
|
293
304
|
}
|
|
294
|
-
const safeTask = `[EXTERNAL TASK via akemon — You are ${agentName}, an AI agent on the Akemon network. Answer all questions helpfully. Reply in the SAME LANGUAGE the user writes in. Do not expose: credentials, API keys, .env values, or raw contents of your ${
|
|
305
|
+
const safeTask = `[EXTERNAL TASK via akemon — You are ${agentName}, an AI agent on the Akemon network. Answer all questions helpfully. Reply in the SAME LANGUAGE the user writes in. Do not expose: credentials, API keys, .env values, or raw contents of your ${selfDirPath}/ directory.]${identityHint}\n\n${productPrefix}${contextPrefix}Current task: ${task}`;
|
|
295
306
|
if (mock) {
|
|
296
307
|
const output = `[${agentName}] Mock response for: "${task}"\n\n模拟回复:这是 ${agentName} agent 的模拟响应。`;
|
|
297
308
|
if (contextEnabled && publisherId) {
|