@wildshard/engine 0.1.21 → 0.1.22
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 +8 -0
- package/lint/engine-sides.json +3 -0
- package/lint/shardfile-boundaries.mjs +4 -2
- package/lint/wildshard-plugin.js +1 -1
- package/package.json +2 -1
- package/scripts/audio-download-proof.mjs +1 -1
- package/scripts/check-spelled-paths.mjs +6 -3
- package/scripts/committed-fast-checks.mjs +2 -2
- package/scripts/failmode-cases.mjs +1 -1
- package/scripts/failmode-proof.mjs +35 -11
- package/scripts/grid-crossing-walk-proof.mjs +3 -3
- package/scripts/hover-speed-probe.mjs +2 -2
- package/scripts/mmo-bots.mjs +7 -3
- package/scripts/net-lag-proof.mjs +1 -1
- package/scripts/online-rig.mjs +7 -7
- package/scripts/parity/boot-smoke.mjs +1 -1
- package/scripts/release-cook.mjs +6 -2
- package/scripts/test-products.json +0 -21
- package/scripts/vps/cook-follow.d.mts +6 -0
- package/scripts/vps/cook-follow.mjs +45 -0
- package/scripts/vps/harden-apply.sh +10 -1
- package/scripts/vps/rebuild.sh +104 -36
- package/scripts/vps/wildshard-config +0 -2
- package/src/client/app/entry.ts +2 -3
- package/src/client/engine/boot/contentRead.ts +24 -4
- package/src/client/engine/boot/downloadGiveUp.ts +34 -0
- package/src/client/engine/combat/EquipmentService.ts +2 -0
- package/src/client/engine/core/Game.ts +6 -2
- package/src/client/engine/ui/downloadFailed.ts +54 -0
- package/src/client/game/boot/spawnDownload.ts +12 -1
- package/src/client/game/grid/copyPrompts.ts +3 -4
- package/src/client/game/grid/dataCellKit.ts +91 -0
- package/src/client/game/grid/enteredEquipment.ts +11 -2
- package/src/client/game/grid/live.ts +9 -299
- package/src/client/game/grid/liveSession.ts +31 -8
- package/src/client/game/grid/neighbourLife.ts +50 -32
- package/src/client/game/grid/reveal.ts +7 -2
- package/src/client/game/grid/session.ts +4 -70
- package/src/client/game/plugin/weaponFamily.ts +6 -0
- package/src/client/game/shardfile/clientWorker.ts +13 -3
- package/src/client/host/online/shell.ts +37 -13
- package/src/server/game/grid/room.ts +2 -38
- package/src/server/game/shardfile/declaredKitItems.ts +8 -2
- package/src/server/host/dedicated/cellHost.ts +2 -2
- package/src/server/host/dedicated/cellProtocol.ts +1 -1
- package/src/server/host/dedicated/cellWorker.ts +1 -1
- package/src/server/host/dedicated/dedicatedRoom.ts +8 -3
- package/src/server/host/dedicated/gridCells.ts +5 -3
- package/src/server/host/dedicated/main.ts +6 -4
- package/src/server/host/dedicated/workerTable.ts +0 -10
- package/src/server/host/dedicated/world.ts +39 -5
- package/src/server/host/standalone/cellWorld.ts +1 -1
- package/src/shared/engine/saves/shape.ts +17 -2
- package/src/shared/engine/strings.ts +10 -0
- package/src/shared/game/grid/placementRows.ts +4 -3
- package/src/client/game/grid/cellLoading.ts +0 -110
- package/src/client/game/grid/cellScreens.ts +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,14 @@ run `../repo-kit/release.sh vX.Y.Z --prepare` and `--finish` as before (the help
|
|
|
9
9
|
`scripts/changelog.mjs` checks the format; the pre-push hook and CI refuse a push whose `package.json` version has no
|
|
10
10
|
valid section, and a `vX.Y.Z` tag whose commit has none.
|
|
11
11
|
|
|
12
|
+
## v0.1.22 (2026-11-15)
|
|
13
|
+
|
|
14
|
+
- Brasscap Mesa: you walk in with the lever-action in hand, its rack restocks your rounds, and every bandit and beast in the cell is drawn.
|
|
15
|
+
- A shard placed on the grid after a release keeps its road speed limit on the server too.
|
|
16
|
+
- When the world's files fail to download, the game says so and offers Try again instead of waiting forever.
|
|
17
|
+
- Reloading for a new version brings you back into the game rather than to the title.
|
|
18
|
+
- Behind the scenes: the server swaps out a stuck or drained worker without dropping players, and the cook follows staging by itself.
|
|
19
|
+
|
|
12
20
|
## v0.1.21 (2026-11-15)
|
|
13
21
|
|
|
14
22
|
- The hoverboard is faster online too: 14 m/s in a shard and 30 on the road, and boost is four times that (56 and 120).
|
package/lint/engine-sides.json
CHANGED
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"src/client/engine/boot/contentBase.ts": "client",
|
|
77
77
|
"src/client/engine/boot/contentRead.ts": "client",
|
|
78
78
|
"src/client/engine/boot/download.ts": "client",
|
|
79
|
+
"src/client/engine/boot/downloadGiveUp.ts": "client",
|
|
79
80
|
"src/client/engine/boot/dropNotice.ts": "client",
|
|
80
81
|
"src/client/engine/boot/earlyPrograms.ts": "client",
|
|
81
82
|
"src/client/engine/boot/extras.ts": "client",
|
|
@@ -433,6 +434,7 @@
|
|
|
433
434
|
"src/client/engine/ui/authoredDebugRows.ts": "client",
|
|
434
435
|
"src/client/engine/ui/BootSettings.ts": "client",
|
|
435
436
|
"src/client/engine/ui/backGuard.ts": "client",
|
|
437
|
+
"src/client/engine/ui/downloadFailed.ts": "client",
|
|
436
438
|
"src/client/engine/ui/graphicsBlock.ts": "client",
|
|
437
439
|
"src/client/engine/ui/BossBar.ts": "client",
|
|
438
440
|
"src/client/engine/ui/buildCheck.ts": "client",
|
|
@@ -633,6 +635,7 @@
|
|
|
633
635
|
"src/client/game/grid/copyIdentity.ts": "client",
|
|
634
636
|
"src/client/game/grid/copyLayout.ts": "client",
|
|
635
637
|
"src/client/game/grid/copyPrompts.ts": "client",
|
|
638
|
+
"src/client/game/grid/dataCellKit.ts": "client",
|
|
636
639
|
"src/client/game/grid/edgeSources.ts": "client",
|
|
637
640
|
"src/client/game/grid/enteredEquipment.ts": "client",
|
|
638
641
|
"src/client/game/grid/enteredInteract.ts": "client",
|
|
@@ -18,9 +18,11 @@ const packages = new Map();
|
|
|
18
18
|
|
|
19
19
|
function publicPackage(root, source) {
|
|
20
20
|
if (source === 'three' || source.startsWith('three/') || source === 'valibot') return true;
|
|
21
|
-
const pkg = /^@wildshard\/(engine|game|sdk|
|
|
21
|
+
const pkg = /^@wildshard\/(engine|game|sdk|format)(?:\/(.+))?$/u.exec(source);
|
|
22
22
|
if (pkg === null) return false;
|
|
23
|
-
const file =
|
|
23
|
+
const file = pkg[1] === 'engine'
|
|
24
|
+
? resolve(root, 'package.json')
|
|
25
|
+
: resolve(root, 'node_modules', '@wildshard', pkg[1], 'package.json');
|
|
24
26
|
if (!packages.has(file)) packages.set(file, existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')).exports ?? {} : {});
|
|
25
27
|
const sub = pkg.at(2);
|
|
26
28
|
return Object.hasOwn(packages.get(file), sub === undefined ? '.' : `./${sub}`);
|
package/lint/wildshard-plugin.js
CHANGED
|
@@ -1140,7 +1140,7 @@ export const TEST_DOMAIN_RUNTIME_RULES = [
|
|
|
1140
1140
|
'runtime-performance', 'no-raw-random-time', 'no-runtime-generator',
|
|
1141
1141
|
];
|
|
1142
1142
|
/** @param {string} path */
|
|
1143
|
-
const testFixtures = path => /^src\/(?:engine|game|sdk|sharddev)\/test\//u.test(path);
|
|
1143
|
+
const testFixtures = path => /^(?:src\/(?:test\/(?:engine|game|sdk)|(?:engine|game|sdk|sharddev)\/test)|@wildshard\/(?:engine|game|sdk|sharddev)\/test)\//u.test(path);
|
|
1144
1144
|
/** @param {string} path */
|
|
1145
1145
|
const testModule = path => path.endsWith('.test.ts') || testFixtures(path);
|
|
1146
1146
|
const testDomain = context => testModule(pathOf(context));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "The Wildshard engine: one repo with shared, client, server and cook code and three build targets (client, dedicated server, standalone listen server), shaped like Unreal or Source.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -730,6 +730,7 @@
|
|
|
730
730
|
"./boot/prefetchQuota": "./src/client/engine/boot/prefetchQuota.ts",
|
|
731
731
|
"./boot/readContentResponse": "./src/client/engine/boot/readContentResponse.ts",
|
|
732
732
|
"./boot/contentRead": "./src/client/engine/boot/contentRead.ts",
|
|
733
|
+
"./boot/downloadGiveUp": "./src/client/engine/boot/downloadGiveUp.ts",
|
|
733
734
|
"./sim/readiness": "./src/shared/engine/sim/readiness.ts",
|
|
734
735
|
"./sim/shore": "./src/shared/engine/sim/shore.ts",
|
|
735
736
|
"./physics/readinessWalls": "./src/shared/engine/physics/readinessWalls.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// card, so they take `client`. The warm visit must fetch its route's own phone manifest; a later visit may read it from the
|
|
11
11
|
// page's store and fetch none, so it is judged against the manifest its warm visit fetched.
|
|
12
12
|
// `cross` (preview only) is a player's way into an Open Plot: Shard select, its deck neighbour (CROSS_IN), ENTER WORLD, then a
|
|
13
|
-
// walk across the road into the plot through the in-page server.
|
|
13
|
+
// walk across the road into the plot through the in-page server. The production path now uses zone entry; this historical
|
|
14
14
|
// local build's world door refuses it, so only preview runs it. Its sound window is the first 10 s after the crossing, and the
|
|
15
15
|
// plot's own score must become the music's score in it; its manifest is the neighbour's grid one.
|
|
16
16
|
//
|
|
@@ -20,9 +20,12 @@ export function spelledPathFailures(files, read) {
|
|
|
20
20
|
const failures = [], paths = [...files.keys()], folders = new Set(['src']);
|
|
21
21
|
for (const path of paths) for (let at = path.indexOf('/'); at !== -1; at = path.indexOf('/', at + 1)) folders.add(path.slice(0, at));
|
|
22
22
|
for (const file of paths) {
|
|
23
|
-
const isolated = /^src\/(engine|game)\/isolated-[^/]+\.test\.ts$/u.exec(file)
|
|
24
|
-
if (isolated !==
|
|
25
|
-
|
|
23
|
+
const isolated = /^src\/(client|cook|server|shared)\/(engine|game)\/isolated-[^/]+\.test\.ts$/u.exec(file);
|
|
24
|
+
if (isolated !== null) for (const [, rel] of read(file).matchAll(ROOTED)) {
|
|
25
|
+
const [side, ...rest] = rel.split('/');
|
|
26
|
+
const target = side === undefined || rest.length === 0 ? `src/${isolated[1]}/${isolated[2]}/${rel}` : `src/${side}/${isolated[2]}/${rest.join('/')}`;
|
|
27
|
+
if (!exists(files, folders, target)) failures.push(`${file}: no module at ${target}: the isolated test spells a side the file left`);
|
|
28
|
+
}
|
|
26
29
|
if (/^scripts\/.*\.[cm]?[jt]s$/u.test(file) && !file.includes('.test.')) for (const match of read(file).matchAll(EMITTED))
|
|
27
30
|
if (!exists(files, folders, `src/${match[2]}/${match[3]}`.replace(/[./]+$/u, ''))) failures.push(`${file}: no module at src/${match[2]}/${match[3]}: an emitted import spells a side the file left`);
|
|
28
31
|
if (MAP_FILE.test(file)) for (const input of JSON.parse(read(file)).inputs ?? []) {
|
|
@@ -164,7 +164,7 @@ export async function committedFastChecks(root,base,tip,phase,paths) {
|
|
|
164
164
|
const policy=json(view,'lint/ratchet.json');
|
|
165
165
|
if(view.files.has('scripts/check-spelled-paths.mjs')) {
|
|
166
166
|
const {spelledPathFailures}=/** @type {typeof import('./check-spelled-paths.mjs')} */(await module('scripts/check-spelled-paths.mjs'));
|
|
167
|
-
view.prime([...view.files.keys()].filter(path=>/^src\/(?:engine|game)\/isolated-[^/]+\.test\.ts$|^scripts\/.*\.[cm]?[jt]s$|^src\/shards\/[^/]+\/(?:data|look)\/map\.json$/u.test(path)));
|
|
167
|
+
view.prime([...view.files.keys()].filter(path=>/^src\/(?:client|cook|server|shared)\/(?:engine|game)\/isolated-[^/]+\.test\.ts$|^scripts\/.*\.[cm]?[jt]s$|^src\/shards\/[^/]+\/(?:data|look)\/map\.json$/u.test(path)));
|
|
168
168
|
failures.push(...spelledPathFailures(view.files,path=>view.read(path).toString('utf8')));
|
|
169
169
|
}
|
|
170
170
|
// The folder rule of check-paths, over committed paths: a new file in a shard's root needs the layout's word.
|
|
@@ -237,7 +237,7 @@ export async function committedFastChecks(root,base,tip,phase,paths) {
|
|
|
237
237
|
} else if(phase==='census') {
|
|
238
238
|
// The census ratchets of CI's prepare job, over the tip's blobs, last so they spend only what the budget leaves.
|
|
239
239
|
// One that runs out of time is CI's, not a verdict.
|
|
240
|
-
if(view.files.has('scripts/sort-sides.mjs')&&view.files.has('scripts/check-sim-players.mjs')&&paths.some(path=>/^(?:src\/(?:engine|game|
|
|
240
|
+
if(view.files.has('scripts/sort-sides.mjs')&&view.files.has('scripts/check-sim-players.mjs')&&paths.some(path=>/^(?:src\/(?:client|cook|server|shared)\/(?:engine|game|host)|lint)\//u.test(path))) {
|
|
241
241
|
const census=async(/** @type {string} */ script)=>{
|
|
242
242
|
const child=spawn(process.execPath,[resolve(root,'scripts/sort-sides.mjs'),'--view',tip,script],{cwd:root,timeout:25_000,stdio:['ignore','pipe','pipe']});
|
|
243
243
|
const closed=once(child,'close'),[stdout,stderr]=await Promise.all([text(child.stdout),text(child.stderr)]);
|
|
@@ -41,7 +41,7 @@ export const CASES = Object.freeze([
|
|
|
41
41
|
{ mode: '19b', id: 'resuming/blocked', parent: 'resuming', owner: 'FM4', phase: 'play', screen: 'resuming-blocked', inject: 'an action after 35 s down', recover: 'closes on the first frame', blocked: 'the harness drives no in-world tap under a banner yet' },
|
|
42
42
|
{ mode: '20', id: 'lost', owner: 'FM4', phase: 'play', screen: 'lost', inject: 'drop, then refuse-upgrade 503 for 122 s', recover: 'heal, Try again: seated', run: 'socketDown' },
|
|
43
43
|
{ mode: '21', id: 'slow', owner: 'FM4b', phase: 'play', screen: 'slow', inject: 'delay-frames 160 ms both ways (RTT over 250 ms)', recover: 'heal: clears after 10 good seconds', run: 'linkQuality' },
|
|
44
|
-
{ mode: '22', id: 'lossy', owner: 'FM4b', phase: 'play', screen: 'lossy', inject: 'delay-frames 20 ms
|
|
44
|
+
{ mode: '22', id: 'lossy', owner: 'FM4b', phase: 'play', screen: 'lossy', inject: 'downstream delay-frames swinging 20 ms / 420 ms every 2.5 s (RTT span over 250 ms)', recover: 'heal: clears after 10 good seconds', run: 'linkQuality' },
|
|
45
45
|
{ mode: '23', id: 'version-skew', owner: 'FM5', phase: 'play', screen: 'version-skew', inject: 'socket close 4000 (reload) on every connection', recover: 'one reload, then the page', run: 'socketDown' },
|
|
46
46
|
{ mode: '24', id: 'too-old', owner: 'FM5b', phase: 'play', screen: 'too-old-warning', inject: 'verified retention metadata excluding this build', recover: 'next load: too-old page', blocked: 'FM7 retention metadata not built' },
|
|
47
47
|
{ mode: '25', id: 'full', owner: 'FM4', phase: 'play', screen: 'full', inject: 'socket close 4002 on every connection for 3 s (FM7b queue numbers not built)', recover: 'heal: seated on the next 30 s retry', run: 'socketDown' },
|
|
@@ -121,7 +121,9 @@ try {
|
|
|
121
121
|
if (init !== undefined) await context.addInitScript(init);
|
|
122
122
|
const page = await context.newPage();
|
|
123
123
|
page.on('pageerror', error => { errors.push(error.message.slice(0, 240)); });
|
|
124
|
-
page.on('console', line => { if (line.type() === 'error') errors.push(line.text().slice(0, 240)); });
|
|
124
|
+
page.on('console', line => { if (line.type() === 'error') errors.push(line.text().slice(0, 240)); if (process.env.FM_TRACE === '1') console.log(` [page ${line.type()}] ${line.text().slice(0, 300)}`); });
|
|
125
|
+
page.on('response', response => { if (process.env.FM_TRACE === '1' && response.status() >= 400) console.log(` [http ${String(response.status())}] ${response.url().slice(0, 200)}`); });
|
|
126
|
+
page.on('framenavigated', frame => { if (frame === page.mainFrame() && process.env.FM_TRACE === '1') console.log(` [nav] ${frame.url()}`); });
|
|
125
127
|
return { page, context, errors };
|
|
126
128
|
};
|
|
127
129
|
/** Through the Name box (if it asks) into the world, to 30 frames. @param {Entered} entered @param {number} [timeout] */
|
|
@@ -189,6 +191,18 @@ try {
|
|
|
189
191
|
};
|
|
190
192
|
/** Clicks a button on the case's screen. @param {import('playwright').Page} page @param {string} id @param {string} label */
|
|
191
193
|
const press = (page, id, label) => page.locator(`[data-failmode~="${id}"] button`, { hasText: label }).first().click({ timeout: 5000 });
|
|
194
|
+
/** WebKit's setOffline (Playwright) leaves loopback sockets up, so a WebKit page "offline" kept playing on the rig (opus-fm1's mode 1).
|
|
195
|
+
* There the proxy cuts the world door too while the browser is offline: a live link drops and new upgrades are refused. Labelled in
|
|
196
|
+
* the receipt as `loopbackCut`; Chromium needs none (its offline mode closes the socket itself). @param {boolean} live */
|
|
197
|
+
const cutLoopback = async live => {
|
|
198
|
+
if (engine !== 'webkit') return false;
|
|
199
|
+
if (live) {
|
|
200
|
+
const before = await control(); await arm('webkit-offline', [{ route: 'socket', kind: 'drop-after', afterMs: 0 }]);
|
|
201
|
+
for (let tries = 0; tries < 40 && await matchedSince(before, 'socket') === 0; tries++) await sleep(100);
|
|
202
|
+
}
|
|
203
|
+
await arm('webkit-offline-held', [{ route: 'socket', kind: 'refuse-upgrade', code: 503 }]);
|
|
204
|
+
return true;
|
|
205
|
+
};
|
|
192
206
|
|
|
193
207
|
/** @type {Record<string, (item: Case) => Promise<Result>>} */
|
|
194
208
|
const runners = {
|
|
@@ -317,12 +331,13 @@ try {
|
|
|
317
331
|
try {
|
|
318
332
|
await page.goto(URL_PLAY); await intoWorld(entered);
|
|
319
333
|
const started = Date.now(); await context.setOffline(true);
|
|
334
|
+
const loopbackCut = await cutLoopback(true), injection = { setOffline: true, ...loopbackCut ? { loopbackCut } : {} };
|
|
320
335
|
const seen = await screen(page, item.screen, 8000, started), shot = seen === null ? undefined : await shoot(page, item.id, 'card');
|
|
321
|
-
await sleep(2000); await context.setOffline(false);
|
|
336
|
+
await sleep(2000); await context.setOffline(false); if (loopbackCut) await heal();
|
|
322
337
|
const result = await judged(seen, item, page);
|
|
323
338
|
const back = result.outcome === 'pass' && await recovered(page, 30_000);
|
|
324
|
-
return result.outcome !== 'pass' ? { ...result, injection
|
|
325
|
-
} finally { await context.setOffline(false).catch(() => undefined); await entered.context.close(); }
|
|
339
|
+
return result.outcome !== 'pass' ? { ...result, injection } : back ? { ...result, ...shot === undefined ? {} : { shot }, injection, recovery: 'online: a frame, no card' } : { outcome: 'ui-fail', reason: 'no recovery online', seen, notes: await onScreen(page) };
|
|
340
|
+
} finally { await context.setOffline(false).catch(() => undefined); await heal().catch(() => undefined); await entered.context.close(); }
|
|
326
341
|
},
|
|
327
342
|
// J298: a world the device holds loads offline and says so
|
|
328
343
|
offlineLaunch: async item => {
|
|
@@ -337,14 +352,15 @@ try {
|
|
|
337
352
|
if (!controlled) return { outcome: 'unsupported', reason: `${engine}: no controlling service worker after the warm visit, so nothing can launch offline` };
|
|
338
353
|
await sleep(3000);
|
|
339
354
|
await context.setOffline(true);
|
|
355
|
+
const loopbackCut = await cutLoopback(false), injection = { warmed: true, setOffline: true, ...loopbackCut ? { loopbackCut } : {} };
|
|
340
356
|
const started = Date.now(); await page.goto(URL_PLAY).catch(() => undefined);
|
|
341
357
|
await intoWorld(entered, 60_000).catch(() => undefined);
|
|
342
358
|
const seen = await screen(page, item.screen, 15_000, started), shot = seen === null ? await shoot(page, item.id, 'missing') : await shoot(page, item.id, 'card');
|
|
343
|
-
await context.setOffline(false);
|
|
359
|
+
await context.setOffline(false); if (loopbackCut) await heal();
|
|
344
360
|
const result = await judged(seen, item, page);
|
|
345
|
-
if (result.outcome !== 'pass') return { ...result, shot };
|
|
346
|
-
return await recovered(page, 45_000) ? { ...result, shot, injection
|
|
347
|
-
} finally { await context.setOffline(false).catch(() => undefined); await entered.context.close(); }
|
|
361
|
+
if (result.outcome !== 'pass') return { ...result, shot, injection };
|
|
362
|
+
return await recovered(page, 45_000) ? { ...result, shot, injection, recovery: 'online: a frame, no card' } : { outcome: 'ui-fail', reason: 'no recovery online', seen, shot, notes: await onScreen(page) };
|
|
363
|
+
} finally { await context.setOffline(false).catch(() => undefined); await heal().catch(() => undefined); await entered.context.close(); }
|
|
348
364
|
},
|
|
349
365
|
// the page frozen (CDP), with or without a visibility change
|
|
350
366
|
freeze: async item => {
|
|
@@ -372,8 +388,14 @@ try {
|
|
|
372
388
|
try {
|
|
373
389
|
await page.goto(URL_PLAY); await intoWorld(entered);
|
|
374
390
|
const before = await control(), started = Date.now();
|
|
375
|
-
|
|
376
|
-
|
|
391
|
+
// Mode 22 (opus-of18): the proxy keeps a socket's frames in order, so per-frame jitter on a 60 Hz stream queues every frame behind
|
|
392
|
+
// the slowest and the pong RTT sits flat near the jitter's top (seen: no screen under ±200 ms). An unstable link is one whose
|
|
393
|
+
// delay swings: the driver moves the downstream delay between 20 ms and 420 ms every 2.5 s, so the last five pongs span over 250 ms.
|
|
394
|
+
const waving = { on: item.id === 'lossy' };
|
|
395
|
+
const wave = (async () => { for (let high = true; waving.on; high = !high) { await arm(item.id, [{ route: 'socket', kind: 'delay-frames', direction: 'down', ms: high ? 420 : 20, jitterMs: 0, seed: 7 }]); await sleep(2500); } })();
|
|
396
|
+
if (item.id === 'slow') await arm(item.id, [{ route: 'socket', kind: 'delay-frames', direction: 'both', ms: 160, jitterMs: 0, seed: 7 }]);
|
|
397
|
+
const seen = await screen(page, item.screen, 15_000, started).finally(() => { waving.on = false; }), shot = seen === null ? undefined : await shoot(page, item.id, 'chip');
|
|
398
|
+
await wave;
|
|
377
399
|
const injection = { socketMatches: await matchedSince(before, 'socket') };
|
|
378
400
|
await heal();
|
|
379
401
|
if (injection.socketMatches === 0) return { outcome: 'harness-fail', reason: 'the delay matched no frame', injection };
|
|
@@ -439,7 +461,9 @@ try {
|
|
|
439
461
|
const result = await judged(seen, item, page);
|
|
440
462
|
if (result.outcome !== 'pass') return { ...result, injection, shot };
|
|
441
463
|
// the budgeted retries were spent before the line showed: healed, the card's Retry is the player's way on
|
|
442
|
-
|
|
464
|
+
// mode 36's page covers the card: its Try again is the same RETRY
|
|
465
|
+
const retry = item.id === 'download-failed' ? page.locator('[data-failmode~="download-failed"] button', { hasText: 'Try again' }).first() : page.locator('.ws-load-retry:visible').first();
|
|
466
|
+
const pressed = await retry.click({ timeout: 5000 }).then(() => true, () => false);
|
|
443
467
|
await intoWorld(entered, 90_000).catch(() => undefined);
|
|
444
468
|
return await recovered(page, 30_000) ? { ...result, injection, shot, recovery: pressed ? 'heal, Retry: the world loads' : 'heal: the world loads' } : { outcome: 'ui-fail', reason: 'no recovery after heal', seen, injection, shot, notes: await onScreen(page) };
|
|
445
469
|
} finally { await heal(); await entered.context.close(); }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// GC15 (GRID-CROSSING): the first page walk across a cell border online, on this Mac. The rig's server runs WORLD_CELLS=grid with
|
|
3
|
-
//
|
|
3
|
+
// the always-on road on staging's two workers (Nalati alone; Driftwood, Pine Hollow, Sunscar and Far Reach and their road on the other), its origin carries the grid pack, and a real browser enters Driftwood
|
|
4
4
|
// from the deck's card, then walks into a same-worker neighbour (Sunscar, or Pine Hollow), boosts back into Driftwood and boosts out again, by
|
|
5
5
|
// real input. Each leg passes with no stop (no 1.5 s under 0.15 m a sample while the key is held), no page reload, and control in the
|
|
6
6
|
// target cell (the page inside it, gameplay ready, the player moving). It writes time-to-control per leg beside GC1's baseline.
|
|
@@ -69,10 +69,10 @@ if (served !== '' && !/^https:\/\/(staging|preview)\.wildshard\.io\/?$|^http:\/\
|
|
|
69
69
|
const workers = Number(process.argv.find(arg => arg.startsWith('--workers='))?.slice(10) ?? 2);
|
|
70
70
|
if (!Number.isInteger(workers) || workers < 1) throw new Error('--workers takes a whole number from 1');
|
|
71
71
|
const rig = served !== '' ? { base: served.replace(/\/$/, ''), close: () => Promise.resolve() }
|
|
72
|
-
: await openRig({ dist, work, keyFile, pgBin: 'memory:', pgData: '', shard: HOME, more: ['pine-hollow', 'far-reach', 'sunscar-dunes', 'nalati-grasslands'], cells: 'grid',
|
|
72
|
+
: await openRig({ dist, work, keyFile, pgBin: 'memory:', pgData: '', shard: HOME, more: ['pine-hollow', 'far-reach', 'sunscar-dunes', 'nalati-grasslands'], cells: 'grid', workers });
|
|
73
73
|
let code = 1, browser = /** @type {import('playwright').Browser | null} */ (null);
|
|
74
74
|
/** @type {Record<string, unknown>} */
|
|
75
|
-
const result = { lane: 'opus-gc15c', engine: engineName, layout: phone ? 'phone 402x874 touch' : `desktop ${String(desk[0])}x${String(desk[1])}@${String(desk[2])}`, site: served !== '' ? served : 'local rig, WORLD_CELLS=grid,
|
|
75
|
+
const result = { lane: 'opus-gc15c', engine: engineName, layout: phone ? 'phone 402x874 touch' : `desktop ${String(desk[0])}x${String(desk[1])}@${String(desk[2])}`, site: served !== '' ? served : 'local rig, WORLD_CELLS=grid, WORLD_WORKERS=2 (staging: Nalati alone, Driftwood with Pine Hollow, Sunscar and Far Reach)' };
|
|
76
76
|
try {
|
|
77
77
|
let open = served !== '' ? { cells: 25 } : null;
|
|
78
78
|
for (let tries = 0; tries < 300 && open === null; tries++) { open = await fetch(`http://127.0.0.1:${String(WORLD_PORT)}/health`).then(found => found.ok ? found.json() : null).catch(() => null); if (open === null) await sleep(200); }
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// QA 11-15 row 9: `--shots` also shoots the left edge riding with boost off and on (the HOVER tab on a phone, the tag on desktop).
|
|
9
9
|
// scripts/browser-lane.sh node scripts/hover-speed-probe.mjs --base=<staging, preview or loopback url> --out=<dir> [--layout=phone] [--shots]
|
|
10
10
|
// scripts/browser-lane.sh node scripts/hover-speed-probe.mjs --rig=<app dist>,<work dir>,<key.json> --out=<dir> (engine's loopback
|
|
11
|
-
// world, online-rig.mjs: the built dedicated server
|
|
11
|
+
// world, online-rig.mjs: the built dedicated server and 2 workers; the dist stamped for its release file)
|
|
12
12
|
// J205: staging, preview or a loopback page only, never production. Chromium runs headless and muted; the page is closed at the end.
|
|
13
13
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
14
14
|
import { join, resolve as absolute } from 'node:path';
|
|
@@ -31,7 +31,7 @@ let rig = /** @type {{ base: string, close: () => Promise<unknown> } | null} */
|
|
|
31
31
|
if (rigArg !== '') {
|
|
32
32
|
const [dist = '', work = '', keyFile = ''] = rigArg.split(',');
|
|
33
33
|
const { openRig, WORLD_PORT } = await import('./online-rig.mjs');
|
|
34
|
-
rig = await openRig({ dist, work: absolute(work), keyFile, pgBin: 'memory:', pgData: '', shard: 'driftwood-isle', more: ['pine-hollow', 'far-reach', 'sunscar-dunes', 'nalati-grasslands'], cells: 'grid',
|
|
34
|
+
rig = await openRig({ dist, work: absolute(work), keyFile, pgBin: 'memory:', pgData: '', shard: 'driftwood-isle', more: ['pine-hollow', 'far-reach', 'sunscar-dunes', 'nalati-grasslands'], cells: 'grid', workers: 2 });
|
|
35
35
|
for (let tries = 0; tries < 300 && !(await fetch(`http://127.0.0.1:${String(WORLD_PORT)}/health`).then(found => found.ok).catch(() => false)); tries++) await sleep(200);
|
|
36
36
|
base = rig.base;
|
|
37
37
|
}
|
package/scripts/mmo-bots.mjs
CHANGED
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
// code, built here under the release's build name, so the release's packs still match it. The bots are built from the same
|
|
26
26
|
// commit, so their code and wire are the server's exactly. It must descend from the release's build; the report names it
|
|
27
27
|
// (`serverFrom`). Every value that reaches the host's shell is a checked slug, number, hex or fixed path.
|
|
28
|
-
// Everything goes in tmp/mmo-bots/<stamp
|
|
28
|
+
// Everything goes in tmp/mmo-bots/<stamp>/ by default, or in the bounded `--work-dir tmp/<lane>/...` path; the release tree is
|
|
29
|
+
// removed after the run and the report stays.
|
|
29
30
|
import { execFileSync, spawn } from 'node:child_process';
|
|
30
31
|
import { createHash, createPublicKey, generateKeyPairSync, randomBytes, sign, verify } from 'node:crypto';
|
|
31
32
|
import { copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
@@ -47,7 +48,8 @@ const [mode = '', ...rest] = process.argv.slice(2);
|
|
|
47
48
|
const { values } = parseArgs({ args: rest, options: { bots: { type: 'string' }, seconds: { type: 'string' }, seats: { type: 'string', default: '32' }, workers: { type: 'string', default: '4' },
|
|
48
49
|
cells: { type: 'string', default: 'driftwood-isle' }, database: { type: 'string', default: 'memory:' }, keep: { type: 'boolean', default: false },
|
|
49
50
|
remote: { type: 'string' }, cpus: { type: 'string', default: '9-13' }, 'server-from': { type: 'string' },
|
|
50
|
-
'bots-on-host': { type: 'boolean', default: false }, 'bot-cpus': { type: 'string', default: '14-15' }, tailnet: { type: 'boolean', default: false }
|
|
51
|
+
'bots-on-host': { type: 'boolean', default: false }, 'bot-cpus': { type: 'string', default: '14-15' }, tailnet: { type: 'boolean', default: false },
|
|
52
|
+
'work-dir': { type: 'string' } } });
|
|
51
53
|
const serverFrom = values['server-from'];
|
|
52
54
|
if (serverFrom !== undefined && (mode !== 'replica' || !/^[0-9a-f]{40}$/u.test(serverFrom))) throw new Error('--server-from is a full commit, for a replica');
|
|
53
55
|
// These reach the host's shell inside the replica's env line: only slugs and whole numbers.
|
|
@@ -60,7 +62,9 @@ if (botsOnHost && remote === undefined) throw new Error('--bots-on-host needs --
|
|
|
60
62
|
if (mode !== 'replica' && mode !== 'staging') { console.error('usage: mmo-bots.mjs replica|staging [--bots N] [--seconds S]'); process.exit(2); }
|
|
61
63
|
const bots = Number(values.bots ?? (mode === 'replica' ? 32 : 2)), seconds = Number(values.seconds ?? (mode === 'replica' ? 120 : 60));
|
|
62
64
|
if (!Number.isInteger(bots) || bots < 1 || bots > 64 || !Number.isFinite(seconds) || seconds < 5 || seconds > 3600) throw new Error('--bots 1..64, --seconds 5..3600');
|
|
63
|
-
const
|
|
65
|
+
const workRoot = absolute(ROOT, 'tmp'), workBase = absolute(ROOT, values['work-dir'] ?? 'tmp/mmo-bots');
|
|
66
|
+
if (workBase !== workRoot && !workBase.startsWith(`${workRoot}/`)) throw new Error('--work-dir stays under tmp/');
|
|
67
|
+
const stamp = new Date().toISOString().replaceAll(/[-:]/gu, '').replace(/\..*/u, 'Z'), work = join(workBase, stamp), tag = `${mode === 'replica' ? 'r' : 's'}${stamp.slice(9, 15)}`;
|
|
64
68
|
mkdirSync(work, { recursive: true });
|
|
65
69
|
/** @param {Record<string, unknown>} line */
|
|
66
70
|
const note = line => { const text = JSON.stringify({ at: 'mmo-bots', ...line }); console.info(text); writeFileSync(join(work, 'run.log'), `${text}\n`, { flag: 'a' }); };
|
|
@@ -200,7 +200,7 @@ for (const engineName of engines) {
|
|
|
200
200
|
let site = { base, close: () => Promise.resolve() }, socket = /^https:\/\/(staging|preview)\./u.test(base) ? arg('socket', 'wss://rooms-staging.wildshard.io') : arg('socket', '');
|
|
201
201
|
if (rigArg !== '') {
|
|
202
202
|
const [dist = '', work = '', keyFile = ''] = rigArg.split(','), { openRig, WORLD_PORT } = await import('./online-rig.mjs');
|
|
203
|
-
site = await openRig({ dist: absolute(dist), work: absolute(work, slug), keyFile, pgBin: 'memory:', pgData: '', shard: slug
|
|
203
|
+
site = await openRig({ dist: absolute(dist), work: absolute(work, slug), keyFile, pgBin: 'memory:', pgData: '', shard: slug });
|
|
204
204
|
socket = `ws://127.0.0.1:${String(WORLD_PORT)}`;
|
|
205
205
|
}
|
|
206
206
|
try {
|
package/scripts/online-rig.mjs
CHANGED
|
@@ -46,12 +46,12 @@ export async function intoWorld(page) {
|
|
|
46
46
|
|
|
47
47
|
/** `pgBin` 'memory:' keeps the saves in the server's memory, for a proof that never reads them back (voice-proof.mjs): no Postgres.
|
|
48
48
|
* `more` are other shards the release names, `cells` the server's `WORLD_CELLS` (default `shard`), and `socket` the address the
|
|
49
|
-
* release names when a proof puts its own front door before the server (grid-gate-proof.mjs).
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param {{ dist: string, nextDist?: string, work: string, keyFile: string, pgBin: string, pgData: string, shard?: string, seats?: number, more?: string[], cells?: string, socket?: string,
|
|
54
|
-
export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgData, shard = 'driftwood-isle', seats, more = [], cells = shard, socket = `ws://127.0.0.1:${String(WORLD_PORT)}/`,
|
|
49
|
+
* release names when a proof puts its own front door before the server (grid-gate-proof.mjs). Every rig has the road;
|
|
50
|
+
* J353 removed the continuous-crossing switch. `workers` sets `WORLD_WORKERS` (the rig's release is production's,
|
|
51
|
+
* 4 by default; staging runs 2). FM3: `origins` are loopback page origins the server also lets in, and `channel`
|
|
52
|
+
* is the release file's channel (`production`).
|
|
53
|
+
* @param {{ dist: string, nextDist?: string, work: string, keyFile: string, pgBin: string, pgData: string, shard?: string, seats?: number, more?: string[], cells?: string, socket?: string, workers?: number, origins?: string[], channel?: string }} options */
|
|
54
|
+
export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgData, shard = 'driftwood-isle', seats, more = [], cells = shard, socket = `ws://127.0.0.1:${String(WORLD_PORT)}/`, workers, origins = [], channel = 'production' }) {
|
|
55
55
|
if (origins.some(origin => new URL(origin).origin !== origin || new URL(origin).hostname !== '127.0.0.1')) throw new Error('A rig lets in loopback page origins only');
|
|
56
56
|
const memory = pgBin === 'memory:';
|
|
57
57
|
const key = JSON.parse(readFileSync(keyFile, 'utf8')), build = buildOf(dist), nextBuild = nextDist === '' ? '' : buildOf(nextDist), DATABASE = memory ? 'memory:' : database('saves_online');
|
|
@@ -83,7 +83,7 @@ export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgDat
|
|
|
83
83
|
|
|
84
84
|
const world = (running = build) => {
|
|
85
85
|
const room = spawn(process.execPath, [join(server, 'main.mjs')], { cwd: ROOT, stdio: ['ignore', 'pipe', 'pipe'],
|
|
86
|
-
env: { ...process.env, RELEASE_URL: `http://127.0.0.1:${String(RELEASE_PORT)}/release.json`, RELEASE_PUBLIC_KEY: key.public, PACK_ORIGIN: `file://${origin}/`, PACK_CACHE: join(work, 'packs'), DATABASE_URL: DATABASE, SEAT_SECRET: 'online-proof', HOST: '127.0.0.1', PORT: String(WORLD_PORT), ALLOWED_ORIGINS: [`http://127.0.0.1:${String(PAGE_PORT)}`, ...origins].join(','), WILDSHARD_BUILD: running, WORLD_CELLS: cells, RELEASE_POLL_MS: '500', GRACE_MS: '6000', ...seats === undefined ? {} : { WORLD_SEATS: String(seats) },
|
|
86
|
+
env: { ...process.env, RELEASE_URL: `http://127.0.0.1:${String(RELEASE_PORT)}/release.json`, RELEASE_PUBLIC_KEY: key.public, PACK_ORIGIN: `file://${origin}/`, PACK_CACHE: join(work, 'packs'), DATABASE_URL: DATABASE, SEAT_SECRET: 'online-proof', HOST: '127.0.0.1', PORT: String(WORLD_PORT), ALLOWED_ORIGINS: [`http://127.0.0.1:${String(PAGE_PORT)}`, ...origins].join(','), WILDSHARD_BUILD: running, WORLD_CELLS: cells, RELEASE_POLL_MS: '500', GRACE_MS: '6000', ...seats === undefined ? {} : { WORLD_SEATS: String(seats) }, ...workers === undefined ? {} : { WORLD_WORKERS: String(workers) } } });
|
|
87
87
|
room.stdout.pipe(log, { end: false }); room.stderr.pipe(log, { end: false });
|
|
88
88
|
return room;
|
|
89
89
|
};
|
|
@@ -273,7 +273,7 @@ export function bootRoadCompletionState() {
|
|
|
273
273
|
return {at, timeOrigin: performance.timeOrigin, stop: stop ?? null,
|
|
274
274
|
compact: compact === null ? null : {inside: field(compact, 'inside'), current: field(live, 'current'), ready: field(live, 'gameplayReady'),
|
|
275
275
|
pendingCount: Array.isArray(pending) ? pending.length : null, phase: field(crossing, 'phase')},
|
|
276
|
-
observer: ids === null ? null : {present: ids.
|
|
276
|
+
observer: ids === null ? null : {present: ids.some((id) => id.startsWith('harness.walk')), systems: ids.length},
|
|
277
277
|
owner: scope === undefined ? null : {name: scope.name, disposed: scope.disposed, disposing: scope.disposing},
|
|
278
278
|
view: {coverage: ui?.presentation, still: ui?.still, blocking: ui?.blocking, top: ui?.top,
|
|
279
279
|
visibility: typeof document === 'undefined' ? null : document.visibilityState,
|
package/scripts/release-cook.mjs
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
// 1. Production's signed release must name vX.Y.Z (read from packs.wildshard.io, public; the box checks the signature).
|
|
6
6
|
// 2. If the box's wildshard-config has no `cook` verb yet, it is installed from a signed tag that carries it, by the
|
|
7
7
|
// allowlisted `wildshard-apply <tag> harden` (which refreshes /usr/local/sbin and /opt/wildshard-vps). Only after
|
|
8
|
-
// `wildshard-harden --check` shows no `fail` row, so the apply changes no sshd, ufw or Tailscale
|
|
8
|
+
// `wildshard-harden --check` shows no `fail` row outside OFF_SSH_ROWS, so the apply changes no sshd, ufw or Tailscale
|
|
9
|
+
// setting. An OFF_SSH_ROWS fail is one the apply fixes away from them (v0.1.21: SC2, Prometheus down on a root-only
|
|
10
|
+
// /etc/prometheus, fixed by the tag's harden).
|
|
9
11
|
// 3. `sudo -n wildshard-config cook vX.Y.Z`: the box verifies the tag, writes cook.settings, rebuilds the cook step alone,
|
|
10
12
|
// waits for its /health and rolls back if it does not come up. Then `show cook` and the worker's /health.
|
|
11
13
|
// --dry-run reads the box and says what it would do; it writes nothing. Output never carries an address or a secret.
|
|
@@ -16,6 +18,8 @@ const RELEASES = 'https://packs.wildshard.io/releases';
|
|
|
16
18
|
const TAG = /^v\d{1,4}\.\d{1,4}\.\d{1,4}$/u;
|
|
17
19
|
const SIGNED_TAG = /^(?:v\d{1,4}\.\d{1,4}\.\d{1,4}|server-(?:staging|production)-[0-9a-f]{40})$/u, COMMIT = /^[0-9a-f]{40}$/u;
|
|
18
20
|
const MARK = 'cook <tag>';
|
|
21
|
+
// harden --check rows whose fix never touches sshd, ufw or Tailscale: SC2 is the box-local Prometheus on loopback.
|
|
22
|
+
const OFF_SSH_ROWS = new Set(['SC2']);
|
|
19
23
|
|
|
20
24
|
/** @param {string} what @param {string} message */
|
|
21
25
|
function say(what, message) { console.info(`${what.padEnd(7)} ${redact(message)}`); }
|
|
@@ -69,7 +73,7 @@ async function main() {
|
|
|
69
73
|
const source = carries(production.build) ? production : carries(staging.build) ? staging : null;
|
|
70
74
|
if (source === null) stop('no signed release carries `wildshard-config cook` yet: it rides the next staging serial (AUTO-RELEASE AR8)');
|
|
71
75
|
const check = box('sudo -n /usr/local/sbin/wildshard-harden --check');
|
|
72
|
-
const fails = check.out.split('\n').filter(line => line.startsWith('fail'));
|
|
76
|
+
const fails = check.out.split('\n').filter(line => line.startsWith('fail') && !OFF_SSH_ROWS.has(line.split(/\s+/u)[1] ?? ''));
|
|
73
77
|
if (fails.length > 0) stop(`harden --check has ${String(fails.length)} fail row(s) (${fails.map(line => line.split(/\s+/u)[1]).join(', ')}): applying would change the box, so no auto-install`);
|
|
74
78
|
if (dry) { say('would', `install the cook verb by: sudo -n wildshard-apply ${source.tag} harden`); }
|
|
75
79
|
else {
|
|
@@ -139,10 +139,6 @@
|
|
|
139
139
|
"test/sdk-rigged-hull-files.test.ts": [],
|
|
140
140
|
"test/frame-floor-output-entry.test.ts": [],
|
|
141
141
|
"test/texture-scope-lifetime.test.ts": [],
|
|
142
|
-
"test/chapter-director-product.test.ts": [
|
|
143
|
-
"pine-hollow",
|
|
144
|
-
"driftwood-isle"
|
|
145
|
-
],
|
|
146
142
|
"test/director-shipping-product.test.ts": [
|
|
147
143
|
"pine-hollow",
|
|
148
144
|
"driftwood-isle"
|
|
@@ -221,9 +217,6 @@
|
|
|
221
217
|
"sunscar-dunes",
|
|
222
218
|
"far-reach"
|
|
223
219
|
],
|
|
224
|
-
"test/pine-npc-figure-product.test.ts": [
|
|
225
|
-
"pine-hollow"
|
|
226
|
-
],
|
|
227
220
|
"test/scripts/_template-boss.test.ts": [
|
|
228
221
|
"_template"
|
|
229
222
|
],
|
|
@@ -272,10 +265,6 @@
|
|
|
272
265
|
"test/keyed-sky-platform.test.ts": [],
|
|
273
266
|
"test/streamed-cover-platform.test.ts": [],
|
|
274
267
|
"test/toon-look-platform.test.ts": [],
|
|
275
|
-
"test/pine-quest-actions-product.test.ts": [
|
|
276
|
-
"pine-hollow",
|
|
277
|
-
"driftwood-isle"
|
|
278
|
-
],
|
|
279
268
|
"test/world-scene-batch.test.ts": [],
|
|
280
269
|
"test/pine-crag-scenes.test.ts": [
|
|
281
270
|
"pine-hollow"
|
|
@@ -285,9 +274,6 @@
|
|
|
285
274
|
"driftwood-isle"
|
|
286
275
|
],
|
|
287
276
|
"test/world-scene-baked-model.test.ts": [],
|
|
288
|
-
"test/pine-prop-product.test.ts": [
|
|
289
|
-
"pine-hollow"
|
|
290
|
-
],
|
|
291
277
|
"test/driftwood-foliage-scenes.test.ts": [],
|
|
292
278
|
"test/quest-catalogue-sites.test.ts": [
|
|
293
279
|
"pine-hollow",
|
|
@@ -332,10 +318,6 @@
|
|
|
332
318
|
"test/quest-page-refs.test.ts": [],
|
|
333
319
|
"test/scene-motion-refs.test.ts": [],
|
|
334
320
|
"test/scene-buffers.test.ts": [],
|
|
335
|
-
"test/native-runtime-plan.test.ts": [
|
|
336
|
-
"far-reach",
|
|
337
|
-
"sunscar-dunes"
|
|
338
|
-
],
|
|
339
321
|
"test/native-runtime-observation.test.ts": [
|
|
340
322
|
"far-reach"
|
|
341
323
|
],
|
|
@@ -356,9 +338,6 @@
|
|
|
356
338
|
"test/boss-arena-room.test.ts": [],
|
|
357
339
|
"test/grapple-platform.test.ts": [],
|
|
358
340
|
"test/nalati-layout-bake.test.ts": [],
|
|
359
|
-
"test/template-map-generation.test.ts": [
|
|
360
|
-
"_template"
|
|
361
|
-
],
|
|
362
341
|
"test/stealth-detection.test.ts": [],
|
|
363
342
|
"test/held-weapon-laws.test.ts": [],
|
|
364
343
|
"test/nalati-riding-rules.test.ts": ["pine-hollow", "nalati-grasslands"],
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// MMO-SERVER MS2.4a: turn staging's signed release into the root-owned state
|
|
3
|
+
// that selects the cook checkout. cook.env deliberately contains credentials only.
|
|
4
|
+
import { createPublicKey, verify } from 'node:crypto';
|
|
5
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { dirname } from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const BUILD = /^[0-9a-f]{40}$/u, TAG = /^server-staging-([0-9a-f]{40})$/u;
|
|
10
|
+
/** @param {string} text @param {string} name */
|
|
11
|
+
const value = (text, name) => [...text.matchAll(new RegExp(`^${name}=(.*)$`, 'gmu'))].pop()?.[1]?.trim().replaceAll(/^["']|["']$/gu, '') ?? '';
|
|
12
|
+
/** @param {string} name */
|
|
13
|
+
const argument = name => { const index = process.argv.indexOf(name), next = process.argv[index + 1]; if (index === -1 || next === undefined) throw new Error(`Missing ${name}`); return next; };
|
|
14
|
+
|
|
15
|
+
/** @param {string} text @param {string} key */
|
|
16
|
+
export function signedCookRelease(text, key) {
|
|
17
|
+
const signed = JSON.parse(text);
|
|
18
|
+
if (typeof signed?.body !== 'string' || typeof signed?.signature !== 'string' || !/^(?:[0-9a-f]{2})+$/u.test(signed.signature)) throw new Error('Invalid signed release');
|
|
19
|
+
const publicKey = createPublicKey({ key: Buffer.from(key, 'hex'), format: 'der', type: 'spki' });
|
|
20
|
+
if (!verify(null, Buffer.from(signed.body), publicKey, Buffer.from(signed.signature, 'hex'))) throw new Error('A release file has a bad signature');
|
|
21
|
+
const release = JSON.parse(signed.body), tag = typeof release?.bundle?.name === 'string' ? release.bundle.name.split('/')[0] : '';
|
|
22
|
+
if (release?.channel !== 'staging' || typeof release.engineBuild !== 'string' || !BUILD.test(release.engineBuild) || !TAG.test(tag) || tag.slice('server-staging-'.length) !== release.engineBuild) throw new Error('The signed staging release has no matching server tag and build');
|
|
23
|
+
return { tag, build: release.engineBuild };
|
|
24
|
+
}
|
|
25
|
+
/** @param {string} path @param {string} text */
|
|
26
|
+
function atomic(path, text) {
|
|
27
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o750 });
|
|
28
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
29
|
+
try { writeFileSync(temporary, text, { mode: 0o600 }); renameSync(temporary, path); }
|
|
30
|
+
finally { rmSync(temporary, { force: true }); }
|
|
31
|
+
}
|
|
32
|
+
async function main() {
|
|
33
|
+
const env = argument('--env'), state = argument('--state'), envText = readFileSync(env, 'utf8');
|
|
34
|
+
const check = process.argv.includes('--check');
|
|
35
|
+
const url = value(envText, 'RELEASE_URL'), key = value(envText, 'RELEASE_PUBLIC_KEY');
|
|
36
|
+
if (!url.startsWith('https://') || key === '') throw new Error('staging.env has no HTTPS signed release configuration');
|
|
37
|
+
const response = await fetch(url, { cache: 'no-store', signal: AbortSignal.timeout(20_000), redirect: 'error' });
|
|
38
|
+
if (!response.ok) throw new Error(`The signed staging release answered ${response.status}`);
|
|
39
|
+
const next = signedCookRelease(await response.text(), key), text = `COOK_ENGINE_REF=${next.tag}\nWILDSHARD_BUILD=${next.build}\n`;
|
|
40
|
+
if (check) { console.info('would'); return; }
|
|
41
|
+
let held = ''; try { held = readFileSync(state, 'utf8'); } catch (error) { if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) throw error; }
|
|
42
|
+
if (held === text) { console.info('unchanged'); return; }
|
|
43
|
+
atomic(state, text); console.info('changed');
|
|
44
|
+
}
|
|
45
|
+
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) await main();
|
|
@@ -363,9 +363,18 @@ if put /usr/local/sbin/wildshard-alert 755 root:root VH14 <<'EOF'
|
|
|
363
363
|
# sudo runs PAM with an empty environment, so the path is its own.
|
|
364
364
|
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
|
365
365
|
[ "${PAM_TYPE:-open_session}" = open_session ] || exit 0
|
|
366
|
+
# SENTRY-TRIAGE S16: an SSH login over the tailnet (100.64.0.0/10, fd7a:115c:a1e0::/48) is our own operator or agent, so it sends
|
|
367
|
+
# nothing. A login from any other address, sudo, the console and fail2ban's bans (the failed logins) still report.
|
|
368
|
+
if [ $# -eq 0 ] && [ "${PAM_SERVICE:-}" = sshd ]; then
|
|
369
|
+
case ${PAM_RHOST:-} in
|
|
370
|
+
100.6[4-9].*|100.[7-9][0-9].*|100.1[01][0-9].*|100.12[0-7].*|[Ff][Dd]7[Aa]:115[Cc]:[Aa]1[Ee]0:*) exit 0 ;;
|
|
371
|
+
esac
|
|
372
|
+
fi
|
|
373
|
+
line=${1:-"${PAM_SERVICE:-?}: ${PAM_USER:-?}${PAM_RUSER:+ (by $PAM_RUSER)} from ${PAM_RHOST:-the box}"}
|
|
374
|
+
# Tests only: print the line instead of sending it. PAM and fail2ban never set it.
|
|
375
|
+
[ -z "${WILDSHARD_ALERT_PRINT:-}" ] || { printf '%s\n' "$line"; exit 0; }
|
|
366
376
|
dsn=$(sed -n 's/^SENTRY_CRON_DSN=//p' /etc/wildshard/ops.env 2>/dev/null | tail -n 1)
|
|
367
377
|
[ -n "$dsn" ] || exit 0
|
|
368
|
-
line=${1:-"${PAM_SERVICE:-?}: ${PAM_USER:-?}${PAM_RUSER:+ (by $PAM_RUSER)} from ${PAM_RHOST:-the box}"}
|
|
369
378
|
key=${dsn#*://} key=${key%%@*} rest=${dsn#*@}
|
|
370
379
|
body=$(python3 -I -c 'import json, sys, socket, uuid; print(json.dumps({"event_id": uuid.uuid4().hex, "level": "warning", "logger": "wildshard-auth", "platform": "other", "server_name": socket.gethostname(), "environment": "production", "message": {"formatted": sys.argv[1]}, "tags": {"kind": "auth"}}))' "$line" 2>/dev/null) || exit 0
|
|
371
380
|
( curl -fsS -m 5 -o /dev/null -H 'Content-Type: application/json' \
|