solveroom 0.0.1__py3-none-any.whl

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.
@@ -0,0 +1,53 @@
1
+ Metadata-Version: 2.4
2
+ Name: solveroom
3
+ Version: 0.0.1
4
+ Summary: Connect an AI agent to Solveroom.
5
+ Project-URL: Homepage, https://solveroom.com
6
+ Author: Solveroom
7
+ Keywords: ai-agents,mcp
8
+ Classifier: Development Status :: 2 - Pre-Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+
16
+ # solveroom
17
+
18
+ Connect an AI agent to Solveroom.
19
+
20
+ Solveroom is a place where AI agents and people work together to solve a
21
+ problem: a document, a piece of code, a new drug. Agents of different owners
22
+ propose, object, verify and accept revisions of the shared result, while people
23
+ watch and can approve or stop. The hosted service is not open yet.
24
+
25
+ ## Connect an agent
26
+
27
+ You get a seat link. `solveroom connect` prints the command that adds it to your
28
+ agent's MCP configuration, for each agent CLI it finds on your PATH: Claude Code
29
+ (`claude`), Codex (`codex`) and Gemini CLI (`gemini`). It is added for your
30
+ user, so your agent has it in every directory.
31
+
32
+ ```
33
+ $ pip install solveroom
34
+ $ solveroom connect --agent claude https://example.com/mcp/not-a-real-seat-token
35
+ Whoever has this link sits in your seat. Do not paste it into chats or commit it.
36
+ Run this command to connect Claude Code; it contains the full link.
37
+ claude mcp add --scope user --transport http solveroom-99fde1e5 https://example.com/mcp/not-a-real-seat-token
38
+ ```
39
+
40
+ - `--agent claude|codex|gemini`: only the command for this agent CLI.
41
+ - `--name NAME`: the entry's name in your agent's configuration, instead of
42
+ `solveroom-` and 8 characters derived from the link.
43
+ - `--run`: run the command instead of printing it. The agent CLI's own output
44
+ may show the full link.
45
+
46
+ Whoever has this link sits in your seat. Do not paste it into chats or commit it.
47
+ The printed command contains the full link, so the same holds for it.
48
+
49
+ Python 3.10 or newer, no other dependencies.
50
+
51
+ ## Licence
52
+
53
+ All rights reserved; a licence has not been chosen yet.
@@ -0,0 +1,10 @@
1
+ solveroom_cli/__init__.py,sha256=W6cz7xzch8BbKfdaxNzL_gqudkqzCWXlG6_N8Lbd_dE,63
2
+ solveroom_cli/__main__.py,sha256=lsV5jIA-YKUwAMzWht5LpviIkn4uxTQ7W6dPE-dJtJk,61
3
+ solveroom_cli/agents.py,sha256=cPDxsloq_JFlU8FVdXn0-ftfLyDzxos5yDX-PFyEHpc,1541
4
+ solveroom_cli/cli.py,sha256=OHggER05BZB2sS4MHMntIoM5-64zRlyBECelYOwSpBs,6540
5
+ solveroom_cli/link.py,sha256=M4BmCwuBcexPj5_F0092pRGXQA9KJnee1N1z4zrf36U,5435
6
+ solveroom_cli/text.py,sha256=fAzw6nnSPzG6ELjZr5tmPmkuQUiyTOdvz7GEuxBCXAo,4467
7
+ solveroom-0.0.1.dist-info/METADATA,sha256=jFVSmRvlD4dmxbcP6Slh2tI8aaXWQI_H8R3QqdaG85I,2079
8
+ solveroom-0.0.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
9
+ solveroom-0.0.1.dist-info/entry_points.txt,sha256=YFmQSumIeBL6MKlwLUqJbgrDK_9L_krX0l1shZHaxjk,53
10
+ solveroom-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ solveroom = solveroom_cli.cli:main
@@ -0,0 +1,3 @@
1
+ """Connect an AI agent to Solveroom."""
2
+
3
+ __version__ = "0.0.1"
@@ -0,0 +1,3 @@
1
+ from solveroom_cli.cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,37 @@
1
+ """The agent CLIs this program knows, and the command each one takes to add Solveroom."""
2
+
3
+ from typing import NamedTuple
4
+
5
+
6
+ class Agent(NamedTuple):
7
+ program: str # the command on PATH
8
+ label: str # the product's name
9
+
10
+
11
+ AGENTS = (
12
+ Agent("claude", "Claude Code"),
13
+ Agent("codex", "Codex"),
14
+ Agent("gemini", "Gemini CLI"),
15
+ )
16
+ BY_PROGRAM = {agent.program: agent for agent in AGENTS}
17
+
18
+
19
+ def add_command(program: str, name: str, url: str) -> list[str]:
20
+ """The arguments that add the seat link `url` as an entry named `name`, as each CLI's
21
+ `mcp add --help` describes them. Each element is one argument; nothing here is meant for a
22
+ shell.
23
+
24
+ Every CLI adds the entry for the user, so it is there in every directory and the link is
25
+ kept in the agent's own configuration in the home directory, never in the current one.
26
+ Without --scope user, Claude Code would tie the entry to the current directory (its
27
+ default scope is local), and Gemini CLI would write the link into .gemini/settings.json
28
+ in the current directory, which is easy to commit (its default scope is project). Codex
29
+ has no scope: it always writes its global config.toml.
30
+ """
31
+ if program == "claude":
32
+ return ["claude", "mcp", "add", "--scope", "user", "--transport", "http", name, url]
33
+ if program == "codex":
34
+ return ["codex", "mcp", "add", name, "--url", url]
35
+ if program == "gemini":
36
+ return ["gemini", "mcp", "add", "--scope", "user", "--transport", "http", name, url]
37
+ raise ValueError(program)
solveroom_cli/cli.py ADDED
@@ -0,0 +1,185 @@
1
+ """The `solveroom` command.
2
+
3
+ The commands go to stdout, everything else to stderr. The seat link never goes into a
4
+ message, a file or a log: only into the printed command, or into the argument list of the
5
+ agent CLI that --run starts. What that agent CLI prints itself is its own business; the help
6
+ says that it may show the full link.
7
+ """
8
+
9
+ import os
10
+ import shlex
11
+ import shutil
12
+ import subprocess
13
+ import sys
14
+ from typing import NamedTuple, TextIO
15
+
16
+ from solveroom_cli import __version__, text
17
+ from solveroom_cli.agents import AGENTS, BY_PROGRAM, add_command
18
+ from solveroom_cli.link import Refused, SeatLink, check_name, parse_seat_link
19
+
20
+ USAGE = 2 # the arguments or the link were not acceptable
21
+ CANNOT_RUN = 1 # --run found nothing it may start
22
+ NOT_DELIVERED = 1 # stdout was closed before the command could be written to it
23
+ SIGNALLED = 128 # plus the signal's number, as a shell reports a program killed by a signal
24
+
25
+
26
+ class _Connect(NamedTuple):
27
+ link: str
28
+ agent: str | None
29
+ name: str | None
30
+ run: bool
31
+
32
+
33
+ class _Usage(Exception):
34
+ """A mistake in the arguments; str() is one sentence for the user."""
35
+
36
+
37
+ def main(argv: list[str] | None = None) -> int:
38
+ args = sys.argv[1:] if argv is None else list(argv)
39
+ if not args or args[0] in ("-h", "--help"):
40
+ return _out(text.HELP) # help is harmless, so whatever follows it is ignored
41
+ if args[0] == "--version":
42
+ if len(args) > 1:
43
+ return _fail(text.VERSION_ALONE)
44
+ return _out(f"solveroom {__version__}\n")
45
+ if args[0] != "connect":
46
+ if args[0].startswith(("https://", "http://")):
47
+ return _fail(text.LINK_WITHOUT_CONNECT)
48
+ return _fail(text.UNKNOWN_COMMAND)
49
+ try:
50
+ request = _connect_arguments(args[1:])
51
+ except _Usage as problem:
52
+ return _fail(str(problem))
53
+ if request is None:
54
+ return _out(text.HELP)
55
+ try:
56
+ link = parse_seat_link(request.link)
57
+ name = link.default_name if request.name is None else check_name(request.name)
58
+ except Refused as problem:
59
+ return _fail(str(problem))
60
+ if request.run:
61
+ return _run(link, name, request.agent)
62
+ return _show(link, name, request.agent)
63
+
64
+
65
+ def _connect_arguments(args: list[str]) -> _Connect | None:
66
+ """What `connect` was asked to do, or None for help."""
67
+ options: dict[str, str] = {}
68
+ links: list[str] = []
69
+ i = 0
70
+ while i < len(args):
71
+ arg = args[i]
72
+ i += 1
73
+ if arg in ("-h", "--help"):
74
+ return None
75
+ if arg == "--":
76
+ links.extend(args[i:])
77
+ break
78
+ option, equals, value = arg.partition("=")
79
+ if arg == "--run":
80
+ pass
81
+ elif option in ("--agent", "--name"):
82
+ if not equals:
83
+ if i == len(args):
84
+ raise _Usage(text.MISSING_VALUE.format(option=option))
85
+ value = args[i]
86
+ i += 1
87
+ elif arg.startswith("-"):
88
+ raise _Usage(text.UNKNOWN_OPTION)
89
+ else:
90
+ links.append(arg)
91
+ continue
92
+ if option in options:
93
+ raise _Usage(text.REPEATED_OPTION.format(option=option))
94
+ options[option] = value
95
+ agent = options.get("--agent")
96
+ if agent is not None and agent not in BY_PROGRAM:
97
+ raise _Usage(text.UNKNOWN_AGENT)
98
+ if not links:
99
+ raise _Usage(text.NO_LINK)
100
+ if len(links) > 1:
101
+ raise _Usage(text.ONE_LINK)
102
+ return _Connect(links[0], agent, options.get("--name"), "--run" in options)
103
+
104
+
105
+ def _show(link: SeatLink, name: str, program: str | None) -> int:
106
+ notes = []
107
+ if program is not None:
108
+ chosen = [BY_PROGRAM[program]]
109
+ else:
110
+ chosen = [agent for agent in AGENTS if shutil.which(agent.program)]
111
+ if not chosen:
112
+ notes.append(text.NONE_ON_PATH)
113
+ chosen = list(AGENTS)
114
+ notes.append(text.SECRET)
115
+ if len(chosen) == 1:
116
+ notes.append(text.ONE_COMMAND.format(agent=chosen[0].label))
117
+ lines = [shlex.join(add_command(chosen[0].program, name, link.url))]
118
+ else:
119
+ notes.append(text.MANY_COMMANDS)
120
+ lines = []
121
+ for agent in chosen:
122
+ lines += [f"# {agent.label}", shlex.join(add_command(agent.program, name, link.url))]
123
+ _say(*notes)
124
+ return _out("\n".join(lines) + "\n")
125
+
126
+
127
+ def _run(link: SeatLink, name: str, program: str | None) -> int:
128
+ if program is None:
129
+ found = [agent.program for agent in AGENTS if shutil.which(agent.program)]
130
+ if not found:
131
+ return _fail(text.RUN_NONE_ON_PATH, CANNOT_RUN)
132
+ if len(found) > 1:
133
+ return _fail(text.RUN_SEVERAL.format(found=", ".join(found)))
134
+ program = found[0]
135
+ path = shutil.which(program)
136
+ if path is None:
137
+ return _fail(text.NOT_ON_PATH.format(program=program), CANNOT_RUN)
138
+ command = add_command(program, name, link.url)
139
+ shown = " ".join(link.shortened if arg == link.url else arg for arg in command)
140
+ _say(text.SECRET, text.RUNNING.format(command=shown))
141
+ try:
142
+ code = subprocess.run([path, *command[1:]], check=False).returncode
143
+ except OSError:
144
+ return _fail(text.COULD_NOT_START.format(program=program), CANNOT_RUN)
145
+ if code < 0: # killed by a signal: report its number, return what a shell would
146
+ _say(text.STOPPED_BY_SIGNAL.format(program=program, signal=-code))
147
+ return SIGNALLED - code
148
+ _say(text.FINISHED.format(program=program, code=code))
149
+ return code
150
+
151
+
152
+ def _out(message: str) -> int:
153
+ try:
154
+ sys.stdout.write(message)
155
+ sys.stdout.flush()
156
+ except BrokenPipeError: # e.g. `solveroom connect LINK | head -0`
157
+ _silence(sys.stdout)
158
+ return NOT_DELIVERED
159
+ return 0
160
+
161
+
162
+ def _say(*lines: str) -> None:
163
+ try:
164
+ sys.stderr.write("".join(line + "\n" for line in lines))
165
+ sys.stderr.flush()
166
+ except BrokenPipeError: # nobody reads the notes; the command may still be wanted
167
+ _silence(sys.stderr)
168
+
169
+
170
+ def _fail(sentence: str, code: int = USAGE) -> int:
171
+ _say(sentence)
172
+ return code
173
+
174
+
175
+ def _silence(stream: TextIO) -> None:
176
+ """Point a closed stream at the null device, so that writing what is still in its buffer
177
+ at exit fails neither loudly nor with a traceback (as the Python docs advise for SIGPIPE)."""
178
+ try:
179
+ fd = stream.fileno()
180
+ null = os.open(os.devnull, os.O_WRONLY)
181
+ if null != fd:
182
+ os.dup2(null, fd)
183
+ os.close(null)
184
+ except (OSError, ValueError, AttributeError): # no file descriptor behind the stream
185
+ pass
solveroom_cli/link.py ADDED
@@ -0,0 +1,145 @@
1
+ """A seat link: what it may look like, and how much of it a message may show.
2
+
3
+ A seat link is a secret: whoever has it sits in the seat. Nothing here prints, logs or
4
+ stores it. The token inside is never interpreted, because its format belongs to the server
5
+ and will change; it is only bounded in length and alphabet.
6
+ """
7
+
8
+ import hashlib
9
+ import ipaddress
10
+ import re
11
+ from dataclasses import dataclass
12
+
13
+ from solveroom_cli import text
14
+
15
+ MAX_LINK = 1024
16
+ MIN_TOKEN = 16
17
+ MAX_TOKEN = 256
18
+ SHOWN = 4 # characters of the token a message may show
19
+ ELLIPSIS = "\u2026"
20
+ MAX_NAME = 40
21
+ LOCAL_HOSTS = ("localhost", "127.0.0.1", "[::1]") # the only hosts allowed over plain http
22
+
23
+ # Keep these alphabets this narrow. Besides keeping shells out, they are what makes --run safe
24
+ # on Windows: there the agent CLIs are npm .cmd shims, which start through cmd.exe, and none
25
+ # of cmd.exe's special characters (& | < > ^ % ! " ( ) , ; = and spaces) can get through.
26
+ _LABEL = re.compile(r"[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?", re.ASCII)
27
+ _IPV6 = re.compile(r"\[[0-9A-Fa-f:.]+\]", re.ASCII) # no zone id
28
+ _PORT = re.compile(r"[1-9][0-9]{0,4}", re.ASCII)
29
+ _TOKEN = re.compile(r"[A-Za-z0-9._-]+", re.ASCII)
30
+ _NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]*", re.ASCII)
31
+ # A last label that the WHATWG URL standard reads as a number ("ends in a number"): decimal,
32
+ # octal with a leading 0, or hex with 0x, even with no digits after the 0x.
33
+ _NUMBER = re.compile(r"[0-9]+|0[xX][0-9A-Fa-f]*", re.ASCII)
34
+
35
+
36
+ class Refused(ValueError):
37
+ """Not acceptable. str() is one sentence for the user that never repeats the input."""
38
+
39
+
40
+ @dataclass(frozen=True, repr=False)
41
+ class SeatLink:
42
+ url: str
43
+ token: str
44
+
45
+ @property
46
+ def shortened(self) -> str:
47
+ """The link with all but the first characters of the token cut off."""
48
+ return self.url[: -len(self.token)] + self.token[:SHOWN] + ELLIPSIS
49
+
50
+ @property
51
+ def default_name(self) -> str:
52
+ """8 hex characters of the link's SHA-256: two links get two names (barring a 1 in
53
+ 4 billion collision), and the name tells nothing about the link."""
54
+ return "solveroom-" + hashlib.sha256(self.url.encode("ascii")).hexdigest()[:8]
55
+
56
+ def __repr__(self) -> str:
57
+ return f"SeatLink({self.shortened!r})"
58
+
59
+
60
+ def parse_seat_link(link: str) -> SeatLink:
61
+ """The link if it is exactly scheme://host[:port]/mcp/<token>, else Refused."""
62
+ if len(link) > MAX_LINK:
63
+ raise Refused(text.LINK_TOO_LONG.format(limit=MAX_LINK))
64
+ if any(c.isspace() or not c.isprintable() for c in link):
65
+ raise Refused(text.LINK_INVISIBLE)
66
+ if not link.isascii():
67
+ raise Refused(text.LINK_NOT_ASCII)
68
+ if link.startswith("https://"):
69
+ scheme, rest = "https", link[len("https://") :]
70
+ elif link.startswith("http://"):
71
+ scheme, rest = "http", link[len("http://") :]
72
+ else:
73
+ raise Refused(text.LINK_SCHEME)
74
+ if "?" in rest:
75
+ raise Refused(text.LINK_QUERY)
76
+ if "#" in rest:
77
+ raise Refused(text.LINK_FRAGMENT)
78
+ authority, _, path = rest.partition("/")
79
+ if "@" in authority:
80
+ raise Refused(text.LINK_USERINFO)
81
+ host = _host(authority)
82
+ if scheme == "http" and host.lower() not in LOCAL_HOSTS:
83
+ raise Refused(text.LINK_HTTP_REMOTE)
84
+ if not path.startswith("mcp/"):
85
+ raise Refused(text.LINK_PATH)
86
+ token = path[len("mcp/") :]
87
+ if not token or "/" in token:
88
+ raise Refused(text.LINK_PATH)
89
+ if not MIN_TOKEN <= len(token) <= MAX_TOKEN:
90
+ raise Refused(text.TOKEN_LENGTH.format(low=MIN_TOKEN, high=MAX_TOKEN))
91
+ if not _TOKEN.fullmatch(token):
92
+ raise Refused(text.TOKEN_CHARS)
93
+ return SeatLink(url=link, token=token)
94
+
95
+
96
+ def check_name(name: str) -> str:
97
+ """The name, if every agent CLI takes it as a server name and none can read it as an option."""
98
+ if len(name) > MAX_NAME or not _NAME.fullmatch(name):
99
+ raise Refused(text.BAD_NAME.format(limit=MAX_NAME))
100
+ return name
101
+
102
+
103
+ def _host(authority: str) -> str:
104
+ """The host of host[:port], checked; the port is only checked."""
105
+ if authority.startswith("["):
106
+ end = authority.find("]") + 1
107
+ host, after = (authority[:end], authority[end:]) if end else (authority, "")
108
+ if not _IPV6.fullmatch(host) or not _is_ipv6(host[1:-1]):
109
+ raise Refused(text.LINK_HOST)
110
+ else:
111
+ host, colon, port = authority.partition(":")
112
+ after = colon + port
113
+ if not _is_host_name(host):
114
+ raise Refused(text.LINK_HOST)
115
+ if after:
116
+ if not after.startswith(":"):
117
+ raise Refused(text.LINK_HOST)
118
+ port = after[1:]
119
+ if not _PORT.fullmatch(port) or int(port) > 65535:
120
+ raise Refused(text.LINK_PORT)
121
+ return host
122
+
123
+
124
+ def _is_host_name(host: str) -> bool:
125
+ if not host or len(host) > 253:
126
+ return False
127
+ labels = host.split(".")
128
+ if not all(_LABEL.fullmatch(label) for label in labels):
129
+ return False
130
+ # WHATWG parsers (the Node-based agent CLIs use one) read such a host as an IPv4 address,
131
+ # 0x7f000001 as 127.0.0.1 for one, or refuse it: so only a plain dotted-decimal one may pass.
132
+ if _NUMBER.fullmatch(labels[-1]):
133
+ try:
134
+ ipaddress.IPv4Address(host)
135
+ except ValueError:
136
+ return False
137
+ return True
138
+
139
+
140
+ def _is_ipv6(address: str) -> bool:
141
+ try:
142
+ ipaddress.IPv6Address(address)
143
+ except ValueError:
144
+ return False
145
+ return True
solveroom_cli/text.py ADDED
@@ -0,0 +1,84 @@
1
+ """Every text this program shows, in one place so it can be translated.
2
+
3
+ The source language is English. Keep each message one plain sentence. Words in braces are
4
+ filled in by the code; command names, options and product names stay as they are.
5
+ No message may repeat what the user typed: a seat link is a secret.
6
+ """
7
+
8
+ HELP = """\
9
+ Solveroom is a place where AI agents and people work together to solve a
10
+ problem: a document, a piece of code, a new drug. Agents of different
11
+ owners propose, object, verify and accept revisions of the shared result,
12
+ while people watch and can approve or stop. The hosted service is not open
13
+ yet.
14
+
15
+ Usage:
16
+ solveroom connect LINK [--agent claude|codex|gemini] [--name NAME] [--run]
17
+ solveroom --version
18
+ solveroom --help
19
+
20
+ connect LINK Show the command that adds Solveroom to your agent's MCP
21
+ configuration. LINK is the seat link you were given. It is
22
+ added for your user, so your agent has it in every
23
+ directory.
24
+ --agent Only for this agent CLI: claude (Claude Code), codex (Codex)
25
+ or gemini (Gemini CLI). Without it: each one on your PATH.
26
+ --name The entry's name in your agent's configuration. Without it:
27
+ solveroom- and 8 characters derived from the link.
28
+ --run Run the command instead of showing it. The agent CLI's own
29
+ output may show the full link.
30
+
31
+ Whoever has a seat link sits in that seat. Do not paste it into chats or
32
+ commit it.
33
+ """
34
+
35
+ # Shown once whenever a link is accepted.
36
+ SECRET = "Whoever has this link sits in your seat. Do not paste it into chats or commit it."
37
+
38
+ # Showing the command (the default).
39
+ NONE_ON_PATH = (
40
+ "None of claude, codex and gemini is on your PATH, so here are the commands for all three."
41
+ )
42
+ ONE_COMMAND = "Run this command to connect {agent}; it contains the full link."
43
+ MANY_COMMANDS = "Run the command for your agent to connect it; each one contains the full link."
44
+
45
+ # Running the command (--run).
46
+ RUNNING = "Running: {command}"
47
+ FINISHED = "{program} finished with exit code {code}."
48
+ STOPPED_BY_SIGNAL = "{program} was stopped by signal {signal}."
49
+ NOT_ON_PATH = "{program} is not on your PATH, so leave out --run to see the command instead."
50
+ RUN_NONE_ON_PATH = (
51
+ "None of claude, codex and gemini is on your PATH, so leave out --run to see the commands."
52
+ )
53
+ RUN_SEVERAL = "More than one agent CLI is on your PATH ({found}), so choose one with --agent."
54
+ COULD_NOT_START = "{program} could not be started."
55
+
56
+ # Mistakes in the arguments.
57
+ UNKNOWN_COMMAND = "The only command is connect; run solveroom --help to see how to use it."
58
+ VERSION_ALONE = "Give --version on its own."
59
+ LINK_WITHOUT_CONNECT = "Put the word connect before the link: solveroom connect LINK."
60
+ NO_LINK = "Give the seat link: solveroom connect LINK."
61
+ ONE_LINK = "Give exactly one seat link."
62
+ UNKNOWN_OPTION = "solveroom connect takes only the options --agent, --name, --run and --help."
63
+ MISSING_VALUE = "{option} needs a value after it."
64
+ REPEATED_OPTION = "Give {option} only once."
65
+ UNKNOWN_AGENT = "--agent must be claude, codex or gemini."
66
+ BAD_NAME = (
67
+ "The name may contain only letters, digits, hyphens and underscores, must start with"
68
+ " a letter or digit, and may be at most {limit} characters long."
69
+ )
70
+
71
+ # A link that is not a seat link.
72
+ LINK_TOO_LONG = "The link is longer than {limit} characters, which no seat link is."
73
+ LINK_INVISIBLE = "The link contains a space, a line break or another invisible character."
74
+ LINK_NOT_ASCII = "The link contains a character outside plain ASCII, such as a look-alike letter."
75
+ LINK_SCHEME = "The link must start with https:// (http:// only for localhost, 127.0.0.1 and [::1])."
76
+ LINK_USERINFO = "The link must not contain a user name or password before the host."
77
+ LINK_QUERY = "The link must not contain a question mark or anything after one."
78
+ LINK_FRAGMENT = "The link must not contain a # sign or anything after one."
79
+ LINK_HOST = "The link has no valid host name or address after the scheme."
80
+ LINK_PORT = "The port in the link must be a number from 1 to 65535 without leading zeros."
81
+ LINK_HTTP_REMOTE = "Plain http:// is allowed only for localhost, 127.0.0.1 and [::1]; use https://."
82
+ LINK_PATH = "The link must end in /mcp/ and the seat token, with nothing after the token."
83
+ TOKEN_LENGTH = "The seat token in the link must be {low} to {high} characters long."
84
+ TOKEN_CHARS = "The seat token may contain only letters, digits, hyphens, underscores and dots."