@homie-rocks/studio 0.58.27 → 0.58.29
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/CHANGELOG.md +45 -0
- package/README.md +5 -0
- package/lib/template-history.json +84 -0
- package/lib/tools-cli.mjs +1 -1
- package/netplay/NETPLAY.md +2 -2
- package/package.json +1 -1
- package/tools/TOOLS.md +8 -0
- package/tools/tools.ts +6 -0
- package/worker/build-id.mjs +1 -1
- package/worker/mcp-tools.mjs +18 -0
- package/worker/mcp.mjs +1 -1
- package/worker/room.mjs +11 -6
- package/worker/table.mjs +1 -0
- package/worker/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,51 @@ To bring a studio up to date, tell Claude: "Upgrade my studio to the newest Homi
|
|
|
17
17
|
`npx -y @homie-rocks/studio@latest upgrade`, which shows what's new since the version your studio pins (from this
|
|
18
18
|
file) and what the upgrade would change, and changes nothing until you agree.
|
|
19
19
|
|
|
20
|
+
## [0.58.29] - 2026-10-30
|
|
21
|
+
|
|
22
|
+
**Plugin 0.58.15**
|
|
23
|
+
|
|
24
|
+
Every studio tool now says whether it only reads or changes things, using the standard MCP tool annotations, so
|
|
25
|
+
your AI client (Claude, Cursor, Grok Bot, your studio's Homie chat) asks you exactly when its own approval settings
|
|
26
|
+
say to.
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Every built-in studio tool carries accurate MCP annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`,
|
|
31
|
+
`openWorldHint`). Reads such as `studio_info`, `studio_stats`, `app_schema` and `studio_office_read` are marked
|
|
32
|
+
read-only; `app_records`, `studio_office_action` and `room_close` are marked destructive.
|
|
33
|
+
- Your own tools (`defineTool`) take `annotations` and pass them to every AI client. `homie-studio tool new` writes
|
|
34
|
+
`readOnlyHint: true`, and tools/TOOLS.md says to set them accurately.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- The README says `/mcp` and `/mcp/auth` are for outside AIs; the studio's own Homie chat never needs them.
|
|
39
|
+
|
|
40
|
+
### Upgrade notes
|
|
41
|
+
|
|
42
|
+
- Set `annotations` on your own tools: `readOnlyHint: true` on every tool that only reads. A tool without it is
|
|
43
|
+
treated as one that changes the studio.
|
|
44
|
+
|
|
45
|
+
## [0.58.28] - 2026-10-30
|
|
46
|
+
|
|
47
|
+
**Plugin 0.58.15**
|
|
48
|
+
|
|
49
|
+
Security fix for the multiplayer rooms (GHSA-px89-jm6h-gwww, medium). Thanks to @bmoconnor1969-ai for the report,
|
|
50
|
+
the fixes and the tests.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- A visitor who sends a different made-up message type each time is now paced and then disconnected for flooding,
|
|
55
|
+
like any other flood. Before, each new type got its own allowance, so the socket was never slowed down and the
|
|
56
|
+
room's memory grew with every message.
|
|
57
|
+
- A public room (`pub-N`, or a server's `s-<id>-<n>`) now keeps the studio's seat count. Before, its first visitor
|
|
58
|
+
could send `hello.max: 1` and turn everyone after them into a spectator. A named room (`?room=`) still lets its
|
|
59
|
+
first visitor lower the count, as NETPLAY.md says.
|
|
60
|
+
|
|
61
|
+
### Upgrade notes
|
|
62
|
+
|
|
63
|
+
- Upgrade studios that run multiplayer games: "Upgrade my studio to the newest Homie."
|
|
64
|
+
|
|
20
65
|
## [0.58.27] - 2026-10-30
|
|
21
66
|
|
|
22
67
|
**Plugin 0.58.15**
|
package/README.md
CHANGED
|
@@ -127,6 +127,11 @@ overwriting the matching studio’s edits. Office links sign in directly and ret
|
|
|
127
127
|
|
|
128
128
|
For signed-in staff AI connectors use `/mcp/auth`; it returns a 401 OAuth discovery
|
|
129
129
|
challenge without a token. `/mcp` continues to serve public tools anonymously.
|
|
130
|
+
These addresses are for outside AIs. The studio's own Homie chat is already inside the
|
|
131
|
+
studio and never needs them. Every tool carries standard MCP annotations
|
|
132
|
+
(`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`); the connecting
|
|
133
|
+
client's own approval settings decide when a person confirms. Set them on your own tools
|
|
134
|
+
(see tools/TOOLS.md).
|
|
130
135
|
|
|
131
136
|
## The site: the hub's shape, and a landing for every game
|
|
132
137
|
|
|
@@ -5118,6 +5118,90 @@
|
|
|
5118
5118
|
}
|
|
5119
5119
|
}
|
|
5120
5120
|
}
|
|
5121
|
+
},
|
|
5122
|
+
"0.58.28": {
|
|
5123
|
+
"files": {
|
|
5124
|
+
"CLAUDE.md": "ddf2b2a0376202f6",
|
|
5125
|
+
"README.md": "684b3cca8001673c",
|
|
5126
|
+
"HANDOFF.md": "29337e2ace95b2e7",
|
|
5127
|
+
"games/README.md": "5ad32fe80c61f117",
|
|
5128
|
+
"music/README.md": "a3dc042dadd39df8",
|
|
5129
|
+
"videos/README.md": "16babc3437d5545b",
|
|
5130
|
+
"posts/README.md": "37841aae476bd540",
|
|
5131
|
+
"site/README.md": "1dbdf22c03a1e505",
|
|
5132
|
+
"site/src/worker.mjs": "6cc5c6131eaf6fd0"
|
|
5133
|
+
},
|
|
5134
|
+
"sections": {
|
|
5135
|
+
"AGENTS.md": {
|
|
5136
|
+
"(intro)": "af7f2f732505d379",
|
|
5137
|
+
"## Version-matched authoring guides": "f6261a0e5801b96b",
|
|
5138
|
+
"## Layout": "f3a280b8c96cd068",
|
|
5139
|
+
"## Apps: one screen, roles and parts": "2ecf713305fd26f5",
|
|
5140
|
+
"## Commands (all through the pinned CLI in node_modules)": "661cbdf5d6a9dbae",
|
|
5141
|
+
"## The site": "0cb8dd9a6f8a0096",
|
|
5142
|
+
"## Making games": "644c1e7608bb9740",
|
|
5143
|
+
"## The Game Codex and progress": "0738ef719cef3a4c",
|
|
5144
|
+
"## Art direction and models": "a48fff7bf0a5f2fc",
|
|
5145
|
+
"## Running live games (the back office)": "51ebf2ab756f6e4d",
|
|
5146
|
+
"## Servers and AI seats": "1904f45b599a33e4",
|
|
5147
|
+
"## Selling things (the shop)": "e5bd380cb77f2b11",
|
|
5148
|
+
"## Continuing a build from the Claude app": "0d68081e924ca419",
|
|
5149
|
+
"## Rules": "b2234d80f6cbe71d",
|
|
5150
|
+
"## Telling Homie": "80b46fdd9e578db8",
|
|
5151
|
+
"## Beta": "9d02638207a26e73"
|
|
5152
|
+
}
|
|
5153
|
+
},
|
|
5154
|
+
"named": {
|
|
5155
|
+
"Homie Arcade": {
|
|
5156
|
+
"sections": {
|
|
5157
|
+
"AGENTS.md": {
|
|
5158
|
+
"## Commands (all through the pinned CLI in node_modules)": "0a7b2c36414a29a0"
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5162
|
+
}
|
|
5163
|
+
},
|
|
5164
|
+
"0.58.29": {
|
|
5165
|
+
"files": {
|
|
5166
|
+
"CLAUDE.md": "ddf2b2a0376202f6",
|
|
5167
|
+
"README.md": "684b3cca8001673c",
|
|
5168
|
+
"HANDOFF.md": "29337e2ace95b2e7",
|
|
5169
|
+
"games/README.md": "5ad32fe80c61f117",
|
|
5170
|
+
"music/README.md": "a3dc042dadd39df8",
|
|
5171
|
+
"videos/README.md": "16babc3437d5545b",
|
|
5172
|
+
"posts/README.md": "37841aae476bd540",
|
|
5173
|
+
"site/README.md": "1dbdf22c03a1e505",
|
|
5174
|
+
"site/src/worker.mjs": "6cc5c6131eaf6fd0"
|
|
5175
|
+
},
|
|
5176
|
+
"sections": {
|
|
5177
|
+
"AGENTS.md": {
|
|
5178
|
+
"(intro)": "af7f2f732505d379",
|
|
5179
|
+
"## Version-matched authoring guides": "f6261a0e5801b96b",
|
|
5180
|
+
"## Layout": "f3a280b8c96cd068",
|
|
5181
|
+
"## Apps: one screen, roles and parts": "2ecf713305fd26f5",
|
|
5182
|
+
"## Commands (all through the pinned CLI in node_modules)": "661cbdf5d6a9dbae",
|
|
5183
|
+
"## The site": "0cb8dd9a6f8a0096",
|
|
5184
|
+
"## Making games": "644c1e7608bb9740",
|
|
5185
|
+
"## The Game Codex and progress": "0738ef719cef3a4c",
|
|
5186
|
+
"## Art direction and models": "a48fff7bf0a5f2fc",
|
|
5187
|
+
"## Running live games (the back office)": "51ebf2ab756f6e4d",
|
|
5188
|
+
"## Servers and AI seats": "1904f45b599a33e4",
|
|
5189
|
+
"## Selling things (the shop)": "e5bd380cb77f2b11",
|
|
5190
|
+
"## Continuing a build from the Claude app": "0d68081e924ca419",
|
|
5191
|
+
"## Rules": "b2234d80f6cbe71d",
|
|
5192
|
+
"## Telling Homie": "80b46fdd9e578db8",
|
|
5193
|
+
"## Beta": "9d02638207a26e73"
|
|
5194
|
+
}
|
|
5195
|
+
},
|
|
5196
|
+
"named": {
|
|
5197
|
+
"Homie Arcade": {
|
|
5198
|
+
"sections": {
|
|
5199
|
+
"AGENTS.md": {
|
|
5200
|
+
"## Commands (all through the pinned CLI in node_modules)": "0a7b2c36414a29a0"
|
|
5201
|
+
}
|
|
5202
|
+
}
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5121
5205
|
}
|
|
5122
5206
|
}
|
|
5123
5207
|
}
|
package/lib/tools-cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ export function newTool(root,name,{app=null}={}) {
|
|
|
8
8
|
if(!/^[a-z][a-z0-9-]{0,39}$/.test(name??'') || app!==null&&!/^[a-z][a-z0-9-]{0,39}$/.test(app))throw new Error('name uses lowercase letters, numbers and hyphens');
|
|
9
9
|
if(app&&!existsSync(join(root,'apps',app,'app.json')))throw new Error('unknown app');
|
|
10
10
|
const file=join(root,...(app?['apps',app,'tools']:['tools']),name+'.ts');if(existsSync(file))throw new Error('tool already exists');
|
|
11
|
-
mkdirSync(dirname(file),{recursive:true});writeFileSync(file,`import { defineTool } from '@homie-rocks/studio/tools';\n\nexport default defineTool<{ message: string }>({\n name: '${name.replaceAll('-','_')}',\n description: 'Describe what this tool does and when to use it.',\n audience: ${app?JSON.stringify({app,role:'staff'}):"'owner'"},\n inputSchema: { type: 'object', properties: { message: { type: 'string', maxLength: 200 } }, required: ['message'], additionalProperties: false },\n async handler({ message }, context) {\n return { message, by: context.caller.id };\n },\n});\n`);
|
|
11
|
+
mkdirSync(dirname(file),{recursive:true});writeFileSync(file,`import { defineTool } from '@homie-rocks/studio/tools';\n\nexport default defineTool<{ message: string }>({\n name: '${name.replaceAll('-','_')}',\n description: 'Describe what this tool does and when to use it.',\n audience: ${app?JSON.stringify({app,role:'staff'}):"'owner'"},\n annotations: { readOnlyHint: true },\n inputSchema: { type: 'object', properties: { message: { type: 'string', maxLength: 200 } }, required: ['message'], additionalProperties: false },\n async handler({ message }, context) {\n return { message, by: context.caller.id };\n },\n});\n`);
|
|
12
12
|
return {ok:true,command:'tool new',file,next:'Edit the definition, then homie-studio dev. Call it with homie-studio tool call '+name.replaceAll('-','_')+' --input \'{"message":"Hello"}\' --url http://localhost:8787'};
|
|
13
13
|
}
|
|
14
14
|
/** The official SDK owns discovery, registration, PKCE, refresh and issuer checks. */
|
package/netplay/NETPLAY.md
CHANGED
|
@@ -268,8 +268,8 @@ code.
|
|
|
268
268
|
`netplay.maxPlayers`, or a `netplay.json` beside game.json or in the game's build
|
|
269
269
|
(`maxPlayers` or `players.max`), else game.json's `players.max`, else 8. **A room holds
|
|
270
270
|
chosen by the studio** (`players.max`). `homie-studio build` writes the number into the catalogue and
|
|
271
|
-
the site's Table takes it from there; the first visitor of an empty room may lower it
|
|
272
|
-
(`hello.max`), never raise it.
|
|
271
|
+
the site's Table takes it from there; the first visitor of an empty named room may lower it
|
|
272
|
+
(`hello.max`), never raise it; a public room (`pub-N`, `s-<id>-<n>`) always keeps the studio's number.
|
|
273
273
|
- **A dropped seat is held 60 s** for its token, which covers a reload or a network blip.
|
|
274
274
|
**A visitor who is present beats one who left:** when no seat is free, the relay
|
|
275
275
|
reclaims the seat that has been absent longest. Visitors who leave can never lock a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homie-rocks/studio",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.29",
|
|
4
4
|
"description": "Open-source tools that let your AI build and run a multiplayer game studio on its own Cloudflare: an MCP server, multiplayer starters, Workers and Durable Objects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
package/tools/TOOLS.md
CHANGED
|
@@ -23,6 +23,7 @@ export default defineTool<{ message: string }>({
|
|
|
23
23
|
name: 'tonight_special',
|
|
24
24
|
description: "Set tonight's special on the taproom wall",
|
|
25
25
|
audience: { app: 'taproom', role: 'staff' },
|
|
26
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
26
27
|
inputSchema: {
|
|
27
28
|
type: 'object',
|
|
28
29
|
properties: { message: { type: 'string', maxLength: 200 } },
|
|
@@ -38,6 +39,13 @@ export default defineTool<{ message: string }>({
|
|
|
38
39
|
|
|
39
40
|
Use the built-in `app_schema` to discover record fields, valid values and your available roles before a remote record change.
|
|
40
41
|
|
|
42
|
+
Always set standard MCP `annotations`, accurately. Set `readOnlyHint: true` on every
|
|
43
|
+
tool that only reads; without it a tool is treated as one that changes the studio. On a
|
|
44
|
+
change, set `destructiveHint` (deletes or overwrites), `idempotentHint` (safe to repeat)
|
|
45
|
+
and `openWorldHint` (reaches people or services outside the studio). Homie has no
|
|
46
|
+
proposal or confirmation step of its own: each AI client (Claude, Cursor, Grok Bot, the
|
|
47
|
+
owner's Homie chat) asks its person for approval from these hints and its own settings.
|
|
48
|
+
|
|
41
49
|
Choose `owner`, `signed-in`, `public` or an explicit `{ app, role }` audience. Never
|
|
42
50
|
choose public just to avoid sign-in. The server checks this on every invocation;
|
|
43
51
|
app records check their own role capabilities too. Update with the record's current
|
package/tools/tools.ts
CHANGED
|
@@ -48,6 +48,12 @@ export interface StudioTool<Input = Record<string, unknown>> {
|
|
|
48
48
|
description: string;
|
|
49
49
|
audience: Audience;
|
|
50
50
|
inputSchema: Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Standard MCP tool annotations. Set them accurately: callers (Claude, Cursor, Grok Bot,
|
|
53
|
+
* the owner's own Homie) decide human approval from them. Set `readOnlyHint: true` on
|
|
54
|
+
* every tool that only reads; a tool without it is treated as one that changes the studio.
|
|
55
|
+
*/
|
|
56
|
+
annotations?: { title?: string; readOnlyHint?: boolean; destructiveHint?: boolean; idempotentHint?: boolean; openWorldHint?: boolean };
|
|
51
57
|
/** Price in currency minor units; uses the studio purchase settlement and refund path. */
|
|
52
58
|
price?: { amount: number; currency: string; refund?: string; refundWindowDays?: number; taxCode?: string; automaticTax?: boolean; taxBehavior?: 'inclusive' | 'exclusive' | 'unspecified' };
|
|
53
59
|
/** Tools sharing an explicitly named namespace share only this studio's tool data. */
|
package/worker/build-id.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by lib/build-identity.mjs; identifies the bundled runtime sources.
|
|
2
|
-
export const STUDIO_BUILD = Object.freeze({"version":"0.58.
|
|
2
|
+
export const STUDIO_BUILD = Object.freeze({"version":"0.58.29","sha256":"5d8c32ab4c91f64389e286860d365ed9e111bb037d03b772e967620649d82664"});
|
package/worker/mcp-tools.mjs
CHANGED
|
@@ -114,6 +114,23 @@ export function services(env, cat, origin, caller, namespace, definition = {}) {
|
|
|
114
114
|
async ai(model,input){if((!caller.owner&&!cat.studio?.mcp?.aiTools?.includes(definition.name))||!env.AI)throw new Error('Workers AI unavailable');return env.AI.run(model,input);},
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
+
// Standard MCP annotations (spec defaults: readOnlyHint false, destructiveHint true,
|
|
118
|
+
// idempotentHint false, openWorldHint true). Clients decide human approval from them.
|
|
119
|
+
const READ={readOnlyHint:true,openWorldHint:false};
|
|
120
|
+
const WRITE={readOnlyHint:false,destructiveHint:false,openWorldHint:false};
|
|
121
|
+
const DESTROY={readOnlyHint:false,destructiveHint:true,openWorldHint:false};
|
|
122
|
+
export const ANNOTATIONS=Object.freeze({
|
|
123
|
+
studio_info:READ,studio_office:READ,studio_shop:READ,studio_players:READ,studio_stats:READ,studio_posts:READ,studio_parts:READ,app_schema:READ,
|
|
124
|
+
studio_availability:READ,studio_events_read:READ,studio_events_webhook_status:READ,studio_function_runs:READ,studio_office_read:READ,
|
|
125
|
+
studio_catalogue:READ,studio_my_orders:READ,agent_look:READ,
|
|
126
|
+
studio_check_session:{...WRITE,idempotentHint:false},studio_events_clear:DESTROY,studio_events_webhook_test:{...WRITE,openWorldHint:true},
|
|
127
|
+
studio_function_replay:WRITE,studio_schedule_fire:WRITE,studio_function_fire:WRITE,app_role:{...WRITE,idempotentHint:true},
|
|
128
|
+
studio_book:WRITE,studio_holds:DESTROY,app_records:DESTROY,studio_office_action:DESTROY,
|
|
129
|
+
room_announce:{...WRITE,openWorldHint:true},room_kick:DESTROY,room_mute:WRITE,room_close:DESTROY,studio_game:WRITE,shop_refund:{...DESTROY,openWorldHint:true},
|
|
130
|
+
agent_sit:WRITE,agent_act:WRITE,agent_speak:{...WRITE,openWorldHint:true},agent_stand:WRITE,
|
|
131
|
+
studio_cart:WRITE,studio_checkout:{...WRITE,openWorldHint:true},studio_purchase:{...WRITE,openWorldHint:true},
|
|
132
|
+
studio_customer_refund:{...WRITE,openWorldHint:true},studio_purchase_refund:{...WRITE,openWorldHint:true},
|
|
133
|
+
});
|
|
117
134
|
export function builtins(env,cat,origin) {
|
|
118
135
|
const tool=(name,description,audience,inputSchema,handler)=>({name,description,audience,inputSchema,handler});
|
|
119
136
|
const tools=[
|
|
@@ -228,5 +245,6 @@ export function builtins(env,cat,origin) {
|
|
|
228
245
|
tools.push(tool('studio_office_action','Use an existing office control. Destructive changes return a browser confirmation for the owner.','owner',object({operation:{enum:actions},action:{type:'object'}},['operation','action']),({operation,action},ctx)=>ctx.office('/_studio/api/'+operation,action)));
|
|
229
246
|
for (const op of ['sit','look','act','speak','stand']) tools.push(tool('agent_'+op, 'A marked AI guide: '+op+'. Room policy and declared vocabulary apply.', 'signed-in', object({game:str,role:str,server:str,room:str,goal:str,line:str,args:{type:'object'}},['game']), async (args,ctx)=>(await import('./mcp-room.mjs')).remoteSeat(env,cat,ctx.caller,op,args)));
|
|
230
247
|
tools.push(...selling.customerTools(env,cat,origin));
|
|
248
|
+
for(const tool of tools)if(!tool.annotations&&ANNOTATIONS[tool.name])tool.annotations=ANNOTATIONS[tool.name];
|
|
231
249
|
return tools.map(tool => tool.name==='studio_function_runs'?tool:({...tool, delegateOffice:Object.hasOwn(cat.studio?.mcp?.audiences??{},tool.name), audience: cat.studio?.mcp?.audiences?.[tool.name] ?? tool.audience}));
|
|
232
250
|
}
|
package/worker/mcp.mjs
CHANGED
|
@@ -177,7 +177,7 @@ export async function remoteMcp(request,env,ctx,{catalogueOf,definitions=[]}) {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
|
-
s.registerTool(tool.name,{description:tool.description,inputSchema:fromJsonSchema(schema,validator)},handler);
|
|
180
|
+
s.registerTool(tool.name,{description:tool.description,inputSchema:fromJsonSchema(schema,validator),...(tool.annotations?{annotations:tool.annotations}:{})},handler);
|
|
181
181
|
dispatch.set(tool.name,{schema,handler});
|
|
182
182
|
}
|
|
183
183
|
// Payment binding errors are JSON-RPC errors, not tool failures. The SDK's
|
package/worker/room.mjs
CHANGED
|
@@ -29,7 +29,7 @@ export class NetRoom {
|
|
|
29
29
|
* each stamped `at` (ISO time) with its room; never a token, a ticket, a browser key or a frame's contents
|
|
30
30
|
*/
|
|
31
31
|
constructor({
|
|
32
|
-
code, rules = false, tickHz = 20, maxPlayers = 8, maxScreens = 16, perIp = 12, stallMs = 1500, silentMs = 2500, idleMs = 10_000,
|
|
32
|
+
code, rules = false, tickHz = 20, maxPlayers = 8, lowerable = true, maxScreens = 16, perIp = 12, stallMs = 1500, silentMs = 2500, idleMs = 10_000,
|
|
33
33
|
holdMs = 60_000, forgetMs = 60_000, persistMs = 30_000, store = null, now = Date.now, log = () => {},
|
|
34
34
|
rates = null, agentsAloneMs = AGENTS_ALONE_MS, voteMs = VOTE.ms, voteCooldownMs = VOTE.cooldownMs, autoVoteMs = VOTE.autoMs,
|
|
35
35
|
}) {
|
|
@@ -61,6 +61,8 @@ export class NetRoom {
|
|
|
61
61
|
this.rules = rules === true;
|
|
62
62
|
this.tickHz = tickHz;
|
|
63
63
|
this.seatCap = maxPlayers;
|
|
64
|
+
// A room strangers are matched into (a pool room: pub-N, s-<id>-<n>) keeps its seats: only a named room's first visitor may lower them.
|
|
65
|
+
this.lowerable = lowerable;
|
|
64
66
|
this.maxPlayers = maxPlayers;
|
|
65
67
|
this.maxScreens = maxScreens;
|
|
66
68
|
this.perIp = perIp;
|
|
@@ -675,10 +677,13 @@ export class NetRoom {
|
|
|
675
677
|
// (speech, chat, reactions) keeps its pace, and so does every room a player's own browser hosts, where the
|
|
676
678
|
// caps are what stands between that phone and the rest of the room.
|
|
677
679
|
const social = t === 'say' || t === 'react' || t === 'ev' && SPEECH.test(kind ?? '');
|
|
678
|
-
|
|
679
|
-
|
|
680
|
+
// A type the relay does not know shares the "other" bucket: a socket that invents a new type for every
|
|
681
|
+
// message must not get a fresh allowance (and a fresh map entry) each time.
|
|
682
|
+
const bucket = Object.hasOwn(RATES, t) || (this.rates && Object.hasOwn(this.rates, t)) ? t : 'other';
|
|
683
|
+
const preset = this.server && !social ? null : t === 'ev' ? EV_RATES[view ? (c.seat === null ? 'screen' : 'replica') : this.roleOf(c)] : (RATES[bucket] ?? RATES.other);
|
|
684
|
+
const limit = (this.rates && Object.hasOwn(this.rates, bucket) ? this.rates[bucket] : undefined) ?? preset;
|
|
680
685
|
if (!(Number.isFinite(limit) && limit > 0)) return true;
|
|
681
|
-
const rateKey = view ? `${
|
|
686
|
+
const rateKey = view ? `${bucket}:view` : bucket;
|
|
682
687
|
const list = c.rates.get(rateKey) ?? [];
|
|
683
688
|
while (list.length && list[0] <= now - 1000) list.shift();
|
|
684
689
|
c.rates.set(rateKey, list);
|
|
@@ -969,7 +974,7 @@ export class NetRoom {
|
|
|
969
974
|
c.typed = c.agent || this.policy.kids ? '' : typeof m.name === 'string' ? stripAi(m.name.replace(/\s+/g, ' ').trim()).slice(0, 24) : '';
|
|
970
975
|
if (Array.isArray(m.caps)) for (const k of m.caps) if (CAPS.includes(k)) c.caps.add(k);
|
|
971
976
|
// The manifest's player count, from the first visitor of an empty room (the site's Table reads the manifest).
|
|
972
|
-
if (!this.server && !this.rules && Number.isInteger(m.max) && !this.seats.size && !live.length) { this.askedMax = m.max; this.maxPlayers = Math.max(1, Math.min(this.seatCap, m.max)); }
|
|
977
|
+
if (this.lowerable && !this.server && !this.rules && Number.isInteger(m.max) && !this.seats.size && !live.length) { this.askedMax = m.max; this.maxPlayers = Math.max(1, Math.min(this.seatCap, m.max)); }
|
|
973
978
|
this.reapSeats(now);
|
|
974
979
|
// The verified pass names one AI. Reopening its socket resumes that seat and replaces the old socket.
|
|
975
980
|
const agentStay = c.agent?.pass ? [...this.seats.values()].find(s => s.agent?.pass === c.agent.pass) : null;
|
|
@@ -1761,7 +1766,7 @@ export class NetRoom {
|
|
|
1761
1766
|
restore(saved, graceMs = 3000) {
|
|
1762
1767
|
const now = this.now();
|
|
1763
1768
|
if (!saved || saved.v !== NET_VERSION || !(now - Number(saved.savedAt) < 120_000)) return false;
|
|
1764
|
-
if (!this.server && !this.rules && saved.hosted !== 'server' && Number.isInteger(saved.maxPlayers)) this.maxPlayers = Math.max(1, Math.min(this.seatCap, saved.maxPlayers));
|
|
1769
|
+
if (this.lowerable && !this.server && !this.rules && saved.hosted !== 'server' && Number.isInteger(saved.maxPlayers)) this.maxPlayers = Math.max(1, Math.min(this.seatCap, saved.maxPlayers));
|
|
1765
1770
|
if (Number.isFinite(saved.openedAt) && saved.openedAt > 0) this.openedAt = saved.openedAt;
|
|
1766
1771
|
for (const [seat, token, name, agent, occ, since] of saved.seats ?? []) this.seats.set(seat, { token, name, since: saved.durable && Number.isFinite(since) ? since : now, present: false, agent: agent && typeof agent === 'object' ? agent : null, ...(Number.isInteger(occ) ? { occ } : {}) });
|
|
1767
1772
|
// A stay's number is never given twice while a checkpoint may still name it.
|
package/worker/table.mjs
CHANGED
package/worker/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The @homie-rocks/studio version this Worker code is (package.json's; a test keeps them equal). Cache-busts /_homie/site.js. */
|
|
2
|
-
export const STUDIO_VERSION_TAG = '0.58.
|
|
2
|
+
export const STUDIO_VERSION_TAG = '0.58.29';
|