feat: add IRC-style message protocol JSON schemas (draft 2020-12)

Add JSON Schema definitions for all message types:
- Base message envelope (message.schema.json)
- C2S: PRIVMSG, NOTICE, JOIN, PART, QUIT, NICK, MODE, TOPIC, KICK, PING, PUBKEY
- S2C: named commands + numeric reply codes (001, 002, 322, 353, 366, 372, 375, 376, 401, 403, 433)
- S2S: RELAY, LINK, UNLINK, SYNC, PING, PONG
- Schema index (schema/README.md)

All messages use IRC command names and numeric codes from RFC 1459/2812.
Bodies are always objects or arrays (never raw strings) to support
deterministic canonicalization (RFC 8785 JCS) and message signing.
This commit is contained in:
clawbot
2026-02-10 10:26:32 -08:00
parent 4645be5f20
commit 909da3cc99
72 changed files with 1166 additions and 770 deletions

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/001.schema.json",
"title": "001 RPL_WELCOME (S2C)",
"description": "Welcome message after registration",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "001"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/002.schema.json",
"title": "002 RPL_YOURHOST (S2C)",
"description": "Server host information",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "002"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/322.schema.json",
"title": "322 RPL_LIST (S2C)",
"description": "Channel list entry",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "322"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/353.schema.json",
"title": "353 RPL_NAMREPLY (S2C)",
"description": "Names list for a channel",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "353"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/366.schema.json",
"title": "366 RPL_ENDOFNAMES (S2C)",
"description": "End of names list",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "366"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/372.schema.json",
"title": "372 RPL_MOTD (S2C)",
"description": "Message of the day line",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "372"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/375.schema.json",
"title": "375 RPL_MOTDSTART (S2C)",
"description": "Start of MOTD",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "375"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/376.schema.json",
"title": "376 RPL_ENDOFMOTD (S2C)",
"description": "End of MOTD",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "376"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/401.schema.json",
"title": "401 ERR_NOSUCHNICK (S2C)",
"description": "No such nick or channel",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "401"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/403.schema.json",
"title": "403 ERR_NOSUCHCHANNEL (S2C)",
"description": "No such channel",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "403"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/433.schema.json",
"title": "433 ERR_NICKNAMEINUSE (S2C)",
"description": "Nickname already in use",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "433"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Response lines"
}
},
"required": [
"command",
"to",
"body"
]
}

View File

@@ -1,37 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/dm.json",
"title": "S2C Direct Message",
"description": "A direct message delivered via the unified message stream.",
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Server-assigned message ID."
},
"type": {
"const": "dm"
},
"ts": {
"type": "string",
"format": "date-time"
},
"from": {
"type": "string",
"description": "Sender nick."
},
"to": {
"type": "string",
"description": "Recipient nick."
},
"content": {
"type": "string",
"description": "Message body."
},
"meta": {
"type": "object",
"additionalProperties": true
}
},
"required": ["id", "type", "ts", "from", "to", "content"]
}

View File

@@ -1,33 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/error.json",
"title": "S2C Error",
"description": "Error message delivered via the message stream.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "error"
},
"ts": {
"type": "string",
"format": "date-time"
},
"code": {
"type": "string",
"description": "Machine-readable error code.",
"examples": ["nick_in_use", "no_such_channel", "not_on_channel", "permission_denied"]
},
"content": {
"type": "string",
"description": "Human-readable error message."
},
"channel": {
"type": "string",
"description": "Related channel, if applicable."
}
},
"required": ["id", "type", "ts", "code", "content"]
}

View File

@@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/error.schema.json",
"title": "ERROR (S2C)",
"description": "Server error",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "ERROR"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Error lines"
}
},
"required": [
"command",
"body"
]
}

View File

@@ -1,29 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/join.json",
"title": "S2C Join",
"description": "A user joined a channel.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "join"
},
"ts": {
"type": "string",
"format": "date-time"
},
"nick": {
"type": "string",
"description": "The nick that joined."
},
"channel": {
"type": "string",
"description": "The channel joined.",
"pattern": "^#[a-zA-Z0-9_-]+$"
}
},
"required": ["id", "type", "ts", "nick", "channel"]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/join.schema.json",
"title": "JOIN (S2C)",
"description": "User joined a channel",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "JOIN"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Not used"
}
},
"required": [
"command",
"from",
"to"
]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/kick.schema.json",
"title": "KICK (S2C)",
"description": "User kicked from channel",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "KICK"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Kick reason"
}
},
"required": [
"command",
"from",
"to"
]
}

View File

@@ -1,40 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/message.json",
"title": "S2C Message",
"description": "A channel message delivered via the unified message stream.",
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Server-assigned message ID, monotonically increasing."
},
"type": {
"const": "message"
},
"ts": {
"type": "string",
"format": "date-time",
"description": "Server-assigned timestamp (ISO 8601)."
},
"from": {
"type": "string",
"description": "Sender nick."
},
"channel": {
"type": "string",
"description": "Channel the message was sent to.",
"pattern": "^#[a-zA-Z0-9_-]+$"
},
"content": {
"type": "string",
"description": "Message body."
},
"meta": {
"type": "object",
"description": "Extensible metadata (signatures, rich content, etc.).",
"additionalProperties": true
}
},
"required": ["id", "type", "ts", "from", "channel", "content"]
}

View File

@@ -1,37 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/mode.json",
"title": "S2C Mode",
"description": "A channel or user mode was changed.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "mode"
},
"ts": {
"type": "string",
"format": "date-time"
},
"nick": {
"type": "string",
"description": "The nick that set the mode."
},
"channel": {
"type": "string",
"pattern": "^#[a-zA-Z0-9_-]+$"
},
"mode": {
"type": "string",
"description": "Mode string applied (e.g. +o, -m).",
"pattern": "^[+-][a-zA-Z]+$"
},
"target": {
"type": "string",
"description": "Target nick for user modes. Absent for channel modes."
}
},
"required": ["id", "type", "ts", "nick", "channel", "mode"]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/mode.schema.json",
"title": "MODE (S2C)",
"description": "Mode change notification",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "MODE"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Mode params"
}
},
"required": [
"command",
"from",
"to"
]
}

View File

@@ -1,28 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/nick.json",
"title": "S2C Nick",
"description": "A user changed their nickname.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "nick"
},
"ts": {
"type": "string",
"format": "date-time"
},
"oldNick": {
"type": "string",
"description": "Previous nickname."
},
"newNick": {
"type": "string",
"description": "New nickname."
}
},
"required": ["id", "type", "ts", "oldNick", "newNick"]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/nick.schema.json",
"title": "NICK (S2C)",
"description": "User changed nick",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "NICK"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Not used"
}
},
"required": [
"command",
"from",
"to"
]
}

View File

@@ -1,32 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/notice.json",
"title": "S2C Notice",
"description": "A server notice. May be targeted to a channel or user, or global.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "notice"
},
"ts": {
"type": "string",
"format": "date-time"
},
"from": {
"type": "string",
"description": "Origin (server name or nick)."
},
"channel": {
"type": "string",
"description": "Target channel, if channel-scoped."
},
"content": {
"type": "string",
"description": "Notice text."
}
},
"required": ["id", "type", "ts", "content"]
}

View File

@@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/notice.schema.json",
"title": "NOTICE (S2C)",
"description": "Server or user notice",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "NOTICE"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Text lines"
}
},
"required": [
"command",
"body"
]
}

View File

@@ -1,32 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/part.json",
"title": "S2C Part",
"description": "A user left a channel.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "part"
},
"ts": {
"type": "string",
"format": "date-time"
},
"nick": {
"type": "string",
"description": "The nick that left."
},
"channel": {
"type": "string",
"pattern": "^#[a-zA-Z0-9_-]+$"
},
"reason": {
"type": "string",
"description": "Optional part reason."
}
},
"required": ["id", "type", "ts", "nick", "channel"]
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/part.schema.json",
"title": "PART (S2C)",
"description": "User left a channel",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "PART"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Part message"
}
},
"required": [
"command",
"from",
"to"
]
}

View File

@@ -1,24 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/pong.json",
"title": "S2C Pong",
"description": "Keepalive response to a client ping.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "pong"
},
"ts": {
"type": "string",
"format": "date-time"
},
"token": {
"type": "string",
"description": "Echoed token from the client's ping, if provided."
}
},
"required": ["id", "type", "ts"]
}

View File

@@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/pong.schema.json",
"title": "PONG (S2C)",
"description": "Server keepalive response",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "PONG"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Pong token"
}
},
"required": [
"command"
]
}

View File

@@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/privmsg.schema.json",
"title": "PRIVMSG (S2C)",
"description": "Relayed message from a user",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "PRIVMSG"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Text lines"
}
},
"required": [
"command",
"from",
"to",
"body"
]
}

View File

@@ -0,0 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/pubkey.schema.json",
"title": "PUBKEY (S2C)",
"description": "Relayed public key announcement",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "PUBKEY"
},
"body": {
"type": "object",
"required": [
"alg",
"key"
],
"properties": {
"alg": {
"type": "string",
"description": "Key algorithm (e.g. ed25519)"
},
"key": {
"type": "string",
"description": "Base64-encoded public key"
}
}
}
},
"required": [
"command",
"from",
"body"
]
}

View File

@@ -1,28 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/quit.json",
"title": "S2C Quit",
"description": "A user disconnected from the server.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "quit"
},
"ts": {
"type": "string",
"format": "date-time"
},
"nick": {
"type": "string",
"description": "The nick that quit."
},
"reason": {
"type": "string",
"description": "Optional quit reason."
}
},
"required": ["id", "type", "ts", "nick"]
}

View File

@@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/quit.schema.json",
"title": "QUIT (S2C)",
"description": "User disconnected",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "QUIT"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Quit message"
}
},
"required": [
"command",
"from"
]
}

View File

@@ -1,29 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/system.json",
"title": "S2C System",
"description": "Server system message (MOTD, maintenance notices, etc.).",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "system"
},
"ts": {
"type": "string",
"format": "date-time"
},
"content": {
"type": "string",
"description": "System message text."
},
"code": {
"type": "string",
"description": "Optional machine-readable system message code.",
"examples": ["motd", "maintenance", "server_restart"]
}
},
"required": ["id", "type", "ts", "content"]
}

View File

@@ -1,32 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/topic.json",
"title": "S2C Topic",
"description": "A channel topic was changed.",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"const": "topic"
},
"ts": {
"type": "string",
"format": "date-time"
},
"nick": {
"type": "string",
"description": "The nick that changed the topic."
},
"channel": {
"type": "string",
"pattern": "^#[a-zA-Z0-9_-]+$"
},
"topic": {
"type": "string",
"description": "New topic text."
}
},
"required": ["id", "type", "ts", "nick", "channel", "topic"]
}

View File

@@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/topic.schema.json",
"title": "TOPIC (S2C)",
"description": "Topic change notification",
"$ref": "../message.schema.json",
"properties": {
"command": {
"const": "TOPIC"
},
"body": {
"type": "array",
"items": {
"type": "string"
},
"description": "Topic lines"
}
},
"required": [
"command",
"from",
"to",
"body"
]
}