Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Chat refuses links (unless the host is allowed), shouting and a repeated line, each with a short reason to the sender only #340
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
Chat now refuses three kinds of line before they are posted. The sender gets a short reason and nothing is broadcast. I ran bun test src in Software/so101: 585 pass and 1 fails.
shipped merged
3 earlier comments · 2 events
Chat now refuses three kinds of line before they are posted. The sender gets a short reason and nothing is broadcast. I ran bun test src in Software/so101: 585 pass and 1 fails. The failure is "serves the model, its meshes and the vendored libraries, and nothing outside them", which also fails on the base branch without my change. I couldn't run bun x tsc --noEmit (bun reported "unable to write files to tempdir"), so the type check is unverified here.
- New module:
src/chat-rules.tshas aChatRulesclass with the three rules.
- A link is refused unless its host, or a parent domain of it, is on the allowlist. Bare domains, www. and scheme:// forms are all caught.
- A line with 12 or more letters that are over 70 % capitals is refused as shouting.
- The same sender repeating an identical line within 60 s is refused. Case and spacing are ignored.
- Allowlist: it holds hostnames only, at most 100 of them, each at most 100 characters. It is saved to
hosts.json, in the same directory as the word list. An invalid set is aChatError. - Lobby wiring: the lobby checks the rules after the word filter, and the owner is exempt. The owner sets the list over
/livewith{"type":"hosts","hosts":[...]}, which is logged in the admin log. Owners are also sent the current list when they connect. - Tests:
src/chat-rules.test.tscovers each rule, an allowed host, "OK" and short lines, validation, and the allowlist surviving a reload. A lobby test checks that a refused line reaches only the sender, that the owner is exempt, and that only the owner can set hosts. - Not done:
forge.jsonis untouched, and I added no admin-page UI for the list; it is set over/liveonly, as the issue asks.
🤖 Generated with Claude Code
The rules are sound and tested: the owner is exempt, a refusal reaches the sender only, and a refused line is not remembered as said. One miss against the list: the README does not say how to use it. Software/README.md:481 documents the word filter, and this change adds nothing for the link allowlist, the shouting rule or the repeat rule. Nobody can find how the owner sets hosts ({"type":"hosts","hosts":[...]} over /live) or what a sender will be told. Fix first: add a short paragraph beside the word-filter one covering the three rules, the 100-host limit, the owner exemption and hosts.json. Also, the type check was not run by the author, so please run bun x tsc --noEmit before pushing. Keep the scope as it is: no admin-page UI.
I've added the README paragraph, and bun x tsc --noEmit now runs clean in Software/so101. I didn't re-run the tests, because this push only changes the README.
- README:
Software/README.mdhas a new entry directly after the word-filter one. It covers the three rules and the reason a sender is told for each: links to unapproved hosts, shouting (12 or more letters, over 70 % capitals), and the same line repeated within 60 s. It also says the owner is exempt and that nothing is broadcast. For the allowlist it gives the{"type":"hosts","hosts":["example.org"]}message over/live, the limits (hostnames only, at most 100, each at most 100 characters), and that it is stored inhosts.jsonbesidewords.json. It also notes there is no admin-page control for the list yet. - Type check: earlier
buncouldn't write to its temp directory, so it never ran. It runs once I pointTMPDIRandBUN_INSTALL_CACHE_DIRat a writable directory forbun install. - Scope: unchanged, with no admin-page UI.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. bun test src passes in full (590 pass, 0 fail).
The only conflicts were in Software/so101/src/lobby.ts: the import list and the LobbyOptions fields. Both sides had added lines at the same spot, so I kept both: ChatRules and hostsFile from this branch, Reports and reportsFile from main. The README merged on its own.
bun x tsc --noEmit reports one error: src/reports.ts(29,15): TS1294, a syntax erasableSyntaxOnly doesn't allow. That file came in from main and is identical to it, so I left it alone. main is probably failing its own type check on it too. Nothing in this branch's files fails the type check.
🤖 Generated with Claude Code
Approved. Chat is posted only through lobby.ts, so the page and the terminal both get the rules. They run after the word filter, the owner is exempt, and refusals go to the sender alone. The allowlist is validated, saved atomically, and tested. Two things to do next: (1) check() records the line as said before chat.post runs, so a line then refused as muted or rate-limited still blocks the sender from retrying it for 60 s; record it after a successful post. (2) The bare-domain regex will refuse ordinary text such as node.js or file.txt-like tokens, so tighten it or add a test for known false positives.
I merged main into the branch again and pushed it. bun test src passes in full (602 pass, 0 fail).
The only conflict was in the protocol comment at the top of Software/so101/src/lobby.ts. I took main's updated ban line, which now says a moderator can ban, and kept this branch's hosts line beside it.
bun x tsc --noEmit still reports the same single error, src/reports.ts(29,15): TS1294. That file comes from main and I haven't changed it, so I left it. Nothing in this branch's files fails the type check.
🤖 Generated with Claude Code
Approved. Each rule refuses before posting, tells only the sender, exempts the owner, and the owner sets hosts over /live with validation and an admin-log entry. Chat posting has one path (lobby), so the terminal gets the same rules. Tests cover each rule and the lobby fan-out, and the README is updated. Next two things: (1) in ChatRules.check, the line is remembered as said before chat.post runs, so a line that chat.post then rejects (rate limit, mute) still trips "you just said that" on the retry. Record it after a successful post. (2) The bare-domain regex will refuse sentences with a missing space after a full stop ("fine.Thanks"). The message should name the offending host so the sender knows what to fix. There is no admin-page control for the allowlist yet. That is acceptable under the direction, but note it.
Chat now refuses three kinds of line before they are posted. The sender gets a short reason and nothing is broadcast. I ran
bun test srcinSoftware/so101: 585 pass and 1 fails. The failure is "serves the model, its meshes and the vendored libraries, and nothing outside them", which also fails on the base branch without my change. I couldn't runbun x tsc --noEmit(bun reported "unable to write files to tempdir"), so the type check is unverified here.src/chat-rules.tshas aChatRulesclass with the three rules.- A link is refused unless its host, or a parent domain of it, is on the allowlist. Bare domains,
www.andscheme://forms are all caught. - A line with 12 or more letters that are over 70 % capitals is refused as shouting. - The same sender repeating an identical line within 60 s is refused. Case and spacing are ignored.hosts.json, in the same directory as the word list. An invalid set is aChatError./livewith{"type":"hosts","hosts":[...]}, which is logged in the admin log. Owners are also sent the current list when they connect.src/chat-rules.test.tscovers each rule, an allowed host, "OK" and short lines, validation, and the allowlist surviving a reload. A lobby test checks that a refused line reaches only the sender, that the owner is exempt, and that only the owner can set hosts.forge.jsonis untouched, and I added no admin-page UI for the list; it is set over/liveonly, as the issue asks.🤖 Generated with Claude Code
Closes #241