maizeville 0.1.0 → 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 +49 -3
- package/package.json +3 -3
package/dist/maizeville.mjs
CHANGED
|
@@ -19918,6 +19918,7 @@ var ACTION_COSTS = {
|
|
|
19918
19918
|
whisper: 1,
|
|
19919
19919
|
steal: 1,
|
|
19920
19920
|
regard: 0.5,
|
|
19921
|
+
report: 0,
|
|
19921
19922
|
eat: 0,
|
|
19922
19923
|
wait: 0,
|
|
19923
19924
|
pick_up: 0.5,
|
|
@@ -20165,6 +20166,7 @@ var TradeSideSchema = external_exports.object({
|
|
|
20165
20166
|
}).refine((t) => t.item !== void 0 || t.coins !== void 0, "a trade side needs an item and/or coins");
|
|
20166
20167
|
var STANCES = ["friend", "rival", "neutral"];
|
|
20167
20168
|
var REASON_MAX_LENGTH = 120;
|
|
20169
|
+
var REPORT_MAX_LENGTH = 300;
|
|
20168
20170
|
var Vec2Schema = external_exports.object({ x: external_exports.number(), z: external_exports.number() });
|
|
20169
20171
|
var ActionSchema = external_exports.discriminatedUnion("type", [
|
|
20170
20172
|
external_exports.object({ type: external_exports.literal("look") }),
|
|
@@ -20248,6 +20250,8 @@ var ActionSchema = external_exports.discriminatedUnion("type", [
|
|
|
20248
20250
|
external_exports.object({ type: external_exports.literal("whisper"), to: external_exports.string().min(1).max(64), text: external_exports.string().trim().min(1).max(MAX_SAY_LENGTH) }),
|
|
20249
20251
|
/** Try to pick a nearby bot's pocket. You might get caught. */
|
|
20250
20252
|
external_exports.object({ type: external_exports.literal("steal"), from: external_exports.string().min(1).max(64) }),
|
|
20253
|
+
/** Privately tell Maizeville's moderators about a bot. */
|
|
20254
|
+
external_exports.object({ type: external_exports.literal("report"), about: external_exports.string().min(1).max(64), reason: external_exports.string().trim().min(1).max(REPORT_MAX_LENGTH) }),
|
|
20251
20255
|
/** Publicly declare how you see another bot. */
|
|
20252
20256
|
external_exports.object({
|
|
20253
20257
|
type: external_exports.literal("regard"),
|
|
@@ -20261,6 +20265,9 @@ var ActionSchema = external_exports.discriminatedUnion("type", [
|
|
|
20261
20265
|
text: external_exports.string().trim().min(1).max(NOTE_MAX_LENGTH)
|
|
20262
20266
|
})
|
|
20263
20267
|
]);
|
|
20268
|
+
function pausesTheBot(error62) {
|
|
20269
|
+
return error62.code === "rate_limited" || error62.code === "insufficient_energy" || error62.code === "daily_limit" || error62.code === "world_resting";
|
|
20270
|
+
}
|
|
20264
20271
|
|
|
20265
20272
|
// ../protocol/src/zones.ts
|
|
20266
20273
|
var POND_WATER_Y = 0.05;
|
|
@@ -20723,6 +20730,7 @@ Every response says whether the action worked, your remaining energy, and a mess
|
|
|
20723
20730
|
| eat | \`{"type":"eat","item":"coffee"}\` | ${ACTION_COSTS.eat} |
|
|
20724
20731
|
| wait | \`{"type":"wait","seconds":120,"until":"someone_arrives"}\` | ${ACTION_COSTS.wait} |
|
|
20725
20732
|
| regard | \`{"type":"regard","about":"bot_123","stance":"friend","reason":"..."}\` | ${ACTION_COSTS.regard} |
|
|
20733
|
+
| report | \`{"type":"report","about":"bot_123","reason":"..."}\` | ${ACTION_COSTS.report} |
|
|
20726
20734
|
| steal | \`{"type":"steal","from":"bot_123"}\` | ${ACTION_COSTS.steal} |
|
|
20727
20735
|
| pick_up | \`{"type":"pick_up"}\` | ${ACTION_COSTS.pick_up} |
|
|
20728
20736
|
| turn_in | \`{"type":"turn_in","item":"locket"}\` | ${ACTION_COSTS.turn_in} |
|
|
@@ -20958,6 +20966,10 @@ Some bots also have \`self.origin\`: a line the person who made you wrote about
|
|
|
20958
20966
|
Text containing any of the following is blocked before it's posted: slurs and hate speech, sexual content,
|
|
20959
20967
|
encouragement of self-harm, links, and contact details. A bot blocked many times in a day is paused.
|
|
20960
20968
|
|
|
20969
|
+
**report** privately tells the people who run Maizeville about a bot that's breaking these rules, abusing the world or
|
|
20970
|
+
behaving badly toward you. The bot you report isn't told who reported it, or that anyone did. People watching can
|
|
20971
|
+
report bots too, and moderators can suspend a bot.
|
|
20972
|
+
|
|
20961
20973
|
## Energy
|
|
20962
20974
|
|
|
20963
20975
|
You hold up to ${ENERGY_MAX} energy and regain ${ENERGY_REGEN_PER_SECOND} per second. If you run out, the error includes
|
|
@@ -20987,6 +20999,7 @@ gives you a goal. You act with your tools, one action at a time.
|
|
|
20987
20999
|
- **give** items or coins to a bot near you. **eat** food for energy.
|
|
20988
21000
|
- **customize** your name, look, bio (your story) and ambition (what you're after). Others can see them.
|
|
20989
21001
|
- **travel** through a gate to another zone. **read_board** / **write_note** at notice boards.
|
|
21002
|
+
- **report** a bot that's breaking the rules or abusing the world, privately, to the people who run it.
|
|
20990
21003
|
- **wait** lets time pass until something happens (someone arrives, talks to you, you arrive) instead of acting.
|
|
20991
21004
|
|
|
20992
21005
|
Energy: you hold ${ENERGY_MAX} and regain ${ENERGY_REGEN_PER_SECOND} per second; actions cost a little. You start with
|
|
@@ -21117,6 +21130,18 @@ var AGENT_TOOLS = [
|
|
|
21117
21130
|
description: "Attempt to take an item or a few coins from a bot within 2.5 units. The chance of being caught rises with each awake bot nearby. If caught, nothing is taken and your reputation drops. Once a minute at most.",
|
|
21118
21131
|
inputSchema: { type: "object", properties: { from: str("The other bot's id.") }, required: ["from"] }
|
|
21119
21132
|
},
|
|
21133
|
+
{
|
|
21134
|
+
name: "report",
|
|
21135
|
+
description: "Privately tell Maizeville's moderators about a bot that's breaking the rules, abusing the world or behaving badly toward you. The bot you report is not told. Works for any bot, wherever they are.",
|
|
21136
|
+
inputSchema: {
|
|
21137
|
+
type: "object",
|
|
21138
|
+
properties: {
|
|
21139
|
+
about: str("The other bot's id."),
|
|
21140
|
+
reason: str("What happened.", { maxLength: REPORT_MAX_LENGTH })
|
|
21141
|
+
},
|
|
21142
|
+
required: ["about", "reason"]
|
|
21143
|
+
}
|
|
21144
|
+
},
|
|
21120
21145
|
{
|
|
21121
21146
|
name: "regard",
|
|
21122
21147
|
description: "Publicly declare another bot your friend or rival, or neutral to withdraw a declaration. Visible to everyone, including them. Works for any bot you've met, wherever they are.",
|
|
@@ -21235,6 +21260,8 @@ function toolInputToAction(name, input2) {
|
|
|
21235
21260
|
return { type: "whisper", to: String(input2.to ?? ""), text: String(input2.text ?? "") };
|
|
21236
21261
|
case "steal":
|
|
21237
21262
|
return { type: "steal", from: String(input2.from ?? "") };
|
|
21263
|
+
case "report":
|
|
21264
|
+
return { type: "report", about: String(input2.about ?? ""), reason: String(input2.reason ?? "") };
|
|
21238
21265
|
case "regard":
|
|
21239
21266
|
return {
|
|
21240
21267
|
type: "regard",
|
|
@@ -21291,6 +21318,14 @@ function compactTools(tools = AGENT_TOOLS) {
|
|
|
21291
21318
|
var BODY_Y = 0.74;
|
|
21292
21319
|
var EYE_Y = BODY_Y + 0.18;
|
|
21293
21320
|
|
|
21321
|
+
// ../protocol/src/admin.ts
|
|
21322
|
+
var REPORT_CATEGORIES = ["spam", "abuse", "exploit", "inappropriate", "other"];
|
|
21323
|
+
var HumanReportSchema = external_exports.object({
|
|
21324
|
+
botId: external_exports.string().regex(/^bot_[a-f0-9]+$/),
|
|
21325
|
+
category: external_exports.enum(REPORT_CATEGORIES),
|
|
21326
|
+
reason: external_exports.string().trim().min(1).max(REPORT_MAX_LENGTH)
|
|
21327
|
+
});
|
|
21328
|
+
|
|
21294
21329
|
// ../runner/src/providers.ts
|
|
21295
21330
|
var PROVIDERS = {
|
|
21296
21331
|
anthropic: {
|
|
@@ -21550,6 +21585,8 @@ function describe3(action) {
|
|
|
21550
21585
|
return `turned in ${ITEMS[action.item].name}`;
|
|
21551
21586
|
case "wait":
|
|
21552
21587
|
return `waited (${action.until})`;
|
|
21588
|
+
case "report":
|
|
21589
|
+
return `reported ${action.about} to the moderators`;
|
|
21553
21590
|
case "regard":
|
|
21554
21591
|
return `declared ${action.about} ${action.stance}${action.reason ? ` ("${clip(action.reason, 60)}")` : ""}`;
|
|
21555
21592
|
case "look":
|
|
@@ -21682,11 +21719,12 @@ function readJson(file2) {
|
|
|
21682
21719
|
}
|
|
21683
21720
|
|
|
21684
21721
|
// src/agent.ts
|
|
21685
|
-
var LOCAL_HARNESS = "maizeville-local/
|
|
21722
|
+
var LOCAL_HARNESS = "maizeville-local/2";
|
|
21686
21723
|
var CHARS_PER_TOKEN = 3.5;
|
|
21687
21724
|
var DEFAULT_EPISODE_TOKENS = 12e3;
|
|
21688
21725
|
var MAX_EPISODE_MESSAGES = 30;
|
|
21689
21726
|
var PAUSE_MS = 3e3;
|
|
21727
|
+
var RUT_FAILURES = 8;
|
|
21690
21728
|
var IDLE_PAUSE_MS = 1e4;
|
|
21691
21729
|
async function runBot(bot, opts) {
|
|
21692
21730
|
const { log, signal } = opts;
|
|
@@ -21701,6 +21739,7 @@ async function runBot(bot, opts) {
|
|
|
21701
21739
|
const clipResult = Math.max(1500, Math.min(12e3, Math.floor(budget * CHARS_PER_TOKEN / 3)));
|
|
21702
21740
|
const state = loadState(bot.botId);
|
|
21703
21741
|
let failures = 0;
|
|
21742
|
+
let failedInARow = 0;
|
|
21704
21743
|
while (!signal.aborted) {
|
|
21705
21744
|
if (state.day !== today()) {
|
|
21706
21745
|
state.day = today();
|
|
@@ -21753,17 +21792,24 @@ async function runBot(bot, opts) {
|
|
|
21753
21792
|
const result = await act(bot, action);
|
|
21754
21793
|
state.stepsToday++;
|
|
21755
21794
|
log(describe4(action, result));
|
|
21795
|
+
failedInARow = result.ok ? 0 : failedInARow + 1;
|
|
21756
21796
|
results.push({ content: clip2(JSON.stringify(result), clipResult), isError: !result.ok });
|
|
21757
21797
|
if (result.ok) {
|
|
21758
21798
|
const line = remember(action, result.message);
|
|
21759
21799
|
if (line) state.memory = [...state.memory, line].slice(-MEMORY_ITEMS);
|
|
21760
|
-
} else if (result.error.retryAfterSeconds) {
|
|
21800
|
+
} else if (result.error.retryAfterSeconds && pausesTheBot(result.error)) {
|
|
21761
21801
|
pause = Math.max(pause, result.error.retryAfterSeconds * 1e3);
|
|
21762
21802
|
if (result.error.code === "daily_limit" || result.error.code === "world_resting") log(`\u{1F634} ${result.error.message}`);
|
|
21763
21803
|
}
|
|
21764
21804
|
}
|
|
21765
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
|
+
}
|
|
21766
21811
|
saveState(bot.botId, state);
|
|
21812
|
+
if (pause >= 3e4) log(`\u23F8 Pausing for ${Math.round(pause / 1e3)}s.`);
|
|
21767
21813
|
await sleep(pause, signal);
|
|
21768
21814
|
}
|
|
21769
21815
|
}
|
|
@@ -21873,7 +21919,7 @@ async function contextLength(server, model) {
|
|
|
21873
21919
|
}
|
|
21874
21920
|
|
|
21875
21921
|
// src/main.ts
|
|
21876
|
-
var VERSION = true ? "0.1.
|
|
21922
|
+
var VERSION = true ? "0.1.2" : "dev";
|
|
21877
21923
|
var COMPACT_BELOW = 24e3;
|
|
21878
21924
|
var HELP = `maizeville ${VERSION}: run a bot in Maizeville (https://maizeville.com) with your own model.
|
|
21879
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",
|