maizeville 0.1.1 → 0.1.2
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/maizeville.mjs +14 -2
- package/package.json +3 -3
package/dist/maizeville.mjs
CHANGED
|
@@ -20265,6 +20265,9 @@ var ActionSchema = external_exports.discriminatedUnion("type", [
|
|
|
20265
20265
|
text: external_exports.string().trim().min(1).max(NOTE_MAX_LENGTH)
|
|
20266
20266
|
})
|
|
20267
20267
|
]);
|
|
20268
|
+
function pausesTheBot(error62) {
|
|
20269
|
+
return error62.code === "rate_limited" || error62.code === "insufficient_energy" || error62.code === "daily_limit" || error62.code === "world_resting";
|
|
20270
|
+
}
|
|
20268
20271
|
|
|
20269
20272
|
// ../protocol/src/zones.ts
|
|
20270
20273
|
var POND_WATER_Y = 0.05;
|
|
@@ -21721,6 +21724,7 @@ var CHARS_PER_TOKEN = 3.5;
|
|
|
21721
21724
|
var DEFAULT_EPISODE_TOKENS = 12e3;
|
|
21722
21725
|
var MAX_EPISODE_MESSAGES = 30;
|
|
21723
21726
|
var PAUSE_MS = 3e3;
|
|
21727
|
+
var RUT_FAILURES = 8;
|
|
21724
21728
|
var IDLE_PAUSE_MS = 1e4;
|
|
21725
21729
|
async function runBot(bot, opts) {
|
|
21726
21730
|
const { log, signal } = opts;
|
|
@@ -21735,6 +21739,7 @@ async function runBot(bot, opts) {
|
|
|
21735
21739
|
const clipResult = Math.max(1500, Math.min(12e3, Math.floor(budget * CHARS_PER_TOKEN / 3)));
|
|
21736
21740
|
const state = loadState(bot.botId);
|
|
21737
21741
|
let failures = 0;
|
|
21742
|
+
let failedInARow = 0;
|
|
21738
21743
|
while (!signal.aborted) {
|
|
21739
21744
|
if (state.day !== today()) {
|
|
21740
21745
|
state.day = today();
|
|
@@ -21787,17 +21792,24 @@ async function runBot(bot, opts) {
|
|
|
21787
21792
|
const result = await act(bot, action);
|
|
21788
21793
|
state.stepsToday++;
|
|
21789
21794
|
log(describe4(action, result));
|
|
21795
|
+
failedInARow = result.ok ? 0 : failedInARow + 1;
|
|
21790
21796
|
results.push({ content: clip2(JSON.stringify(result), clipResult), isError: !result.ok });
|
|
21791
21797
|
if (result.ok) {
|
|
21792
21798
|
const line = remember(action, result.message);
|
|
21793
21799
|
if (line) state.memory = [...state.memory, line].slice(-MEMORY_ITEMS);
|
|
21794
|
-
} else if (result.error.retryAfterSeconds) {
|
|
21800
|
+
} else if (result.error.retryAfterSeconds && pausesTheBot(result.error)) {
|
|
21795
21801
|
pause = Math.max(pause, result.error.retryAfterSeconds * 1e3);
|
|
21796
21802
|
if (result.error.code === "daily_limit" || result.error.code === "world_resting") log(`\u{1F634} ${result.error.message}`);
|
|
21797
21803
|
}
|
|
21798
21804
|
}
|
|
21799
21805
|
state.history.push(...adapter.toolResults(turn.calls, results));
|
|
21806
|
+
if (failedInARow >= RUT_FAILURES) {
|
|
21807
|
+
log(`${failedInARow} actions in a row didn't work, so starting a fresh episode (its memory carries over).`);
|
|
21808
|
+
state.history = [];
|
|
21809
|
+
failedInARow = 0;
|
|
21810
|
+
}
|
|
21800
21811
|
saveState(bot.botId, state);
|
|
21812
|
+
if (pause >= 3e4) log(`\u23F8 Pausing for ${Math.round(pause / 1e3)}s.`);
|
|
21801
21813
|
await sleep(pause, signal);
|
|
21802
21814
|
}
|
|
21803
21815
|
}
|
|
@@ -21907,7 +21919,7 @@ async function contextLength(server, model) {
|
|
|
21907
21919
|
}
|
|
21908
21920
|
|
|
21909
21921
|
// src/main.ts
|
|
21910
|
-
var VERSION = true ? "0.1.
|
|
21922
|
+
var VERSION = true ? "0.1.2" : "dev";
|
|
21911
21923
|
var COMPACT_BELOW = 24e3;
|
|
21912
21924
|
var HELP = `maizeville ${VERSION}: run a bot in Maizeville (https://maizeville.com) with your own model.
|
|
21913
21925
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maizeville",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Run a bot in Maizeville on your own computer, with a local model (LM Studio, llama.cpp, Ollama...) or any OpenAI-compatible API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@types/node": "^26.6.6",
|
|
35
35
|
"esbuild": "^0.28.2",
|
|
36
36
|
"tsx": "^4.23.15",
|
|
37
|
-
"@utopia/
|
|
38
|
-
"@utopia/
|
|
37
|
+
"@utopia/runner": "0.0.0",
|
|
38
|
+
"@utopia/protocol": "0.0.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"dev": "tsx src/main.ts",
|