akemon 0.1.31 → 0.1.33
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 +24 -6
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -165,7 +165,7 @@ function buildContextPayload(prevContext, task, response) {
|
|
|
165
165
|
return context;
|
|
166
166
|
}
|
|
167
167
|
// --- Product context helpers ---
|
|
168
|
-
import { readFile, writeFile, mkdir, appendFile } from "fs/promises";
|
|
168
|
+
import { readFile, writeFile, mkdir, appendFile, unlink } from "fs/promises";
|
|
169
169
|
import { join } from "path";
|
|
170
170
|
function sanitizeProductDir(name) {
|
|
171
171
|
return name.replace(/[^a-zA-Z0-9\u4e00-\u9fff_\- ]/g, "_").slice(0, 80);
|
|
@@ -967,14 +967,15 @@ Requirements:
|
|
|
967
967
|
Your games so far:
|
|
968
968
|
${gameListStr}
|
|
969
969
|
|
|
970
|
-
|
|
970
|
+
What do you want to do?
|
|
971
971
|
A) Create a brand new game
|
|
972
972
|
B) Improve an existing game (say which one)
|
|
973
|
-
C)
|
|
973
|
+
C) Delete a game you're not happy with (say which one)
|
|
974
|
+
D) Nothing right now
|
|
974
975
|
|
|
975
|
-
|
|
976
|
+
Quality matters more than quantity. Each game on your profile represents your abilities — make it polished and deep, even if it's small. Prefer improving existing games over creating new mediocre ones. Delete games you're not proud of. Only create something new when you have a genuinely good idea.
|
|
976
977
|
|
|
977
|
-
Answer A, B, or
|
|
978
|
+
Answer A, B, C, or D (and the game name for B or C).`;
|
|
978
979
|
const gameDecision = await runCommand(engineCmd.cmd, engineCmd.args, gameCheckPrompt, workdir, engineCmd.stdinMode);
|
|
979
980
|
const decisionUpper = gameDecision.toUpperCase().trim();
|
|
980
981
|
if (decisionUpper.startsWith("A")) {
|
|
@@ -1067,8 +1068,25 @@ Improve it — add features, fix bugs, make it more fun, or redesign the UI. Kee
|
|
|
1067
1068
|
}
|
|
1068
1069
|
}
|
|
1069
1070
|
}
|
|
1071
|
+
else if (decisionUpper.startsWith("C") && existingGames.length > 0) {
|
|
1072
|
+
// Delete a game
|
|
1073
|
+
const target = existingGames.find(g => gameDecision.toLowerCase().includes(g.slug) || gameDecision.toLowerCase().includes(g.title.toLowerCase())) || existingGames[existingGames.length - 1];
|
|
1074
|
+
console.log(`[self] Deleting game: ${target.title} (${target.slug})`);
|
|
1075
|
+
try {
|
|
1076
|
+
await unlink(join(gamesDir(workdir, agentName), `${target.slug}.html`));
|
|
1077
|
+
}
|
|
1078
|
+
catch { }
|
|
1079
|
+
// Push delete to relay
|
|
1080
|
+
if (options.relayHttp && options.secretKey) {
|
|
1081
|
+
fetch(`${options.relayHttp}/v1/agent/${encodeURIComponent(agentName)}/games/${encodeURIComponent(target.slug)}`, {
|
|
1082
|
+
method: "DELETE",
|
|
1083
|
+
headers: { Authorization: `Bearer ${options.secretKey}` },
|
|
1084
|
+
}).catch(err => console.log(`[self] Failed to delete game on relay: ${err}`));
|
|
1085
|
+
}
|
|
1086
|
+
console.log(`[self] Game deleted: ${target.title}`);
|
|
1087
|
+
}
|
|
1070
1088
|
else {
|
|
1071
|
-
console.log("[self] No game
|
|
1089
|
+
console.log("[self] No game action this cycle");
|
|
1072
1090
|
}
|
|
1073
1091
|
}
|
|
1074
1092
|
catch (err) {
|