mail-address-semantics/mas_modes/schema/mas-modes-v0.1.schema.json
tegwick bdf200a600 MAS-WP-0011 finished: peer authentication in mode contract v0.1
CONTRACT.md section 7 (founder-reviewed): pairwise HMAC-SHA256 over
TIMESTAMP.BODY in MAS-Modes-* headers, 300 s window; master commands only
from the configured master; statuses only at the handoff's tokenized URL
from its peer; primed webhooks must name a known peer. mas_modes.signing,
signed contract.post, authenticating json_server, EmailMode/stubs/gateway
signing. conformance/auth.json vectors + 7 authorization flows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 5787@bnt-lap001
Assistant-Session: 5db26b82-138b-40cc-9856-4d5eb0f752fd
2026-10-19 11:25:24 +02:00

694 lines
14 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://mas.coulomb.social/schema/mas-modes-v0.1.schema.json",
"title": "MAS mode contract v0.1 message",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"enum": [
"handoff.request",
"handoff.update",
"handoff.cancel",
"handoff.status",
"case.intake",
"case.assign",
"case.message",
"case.policy",
"handoff.requested",
"mail.send"
]
}
},
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "handoff.request"
}
}
},
"then": {
"$ref": "#/$defs/handoff.request"
}
},
{
"if": {
"properties": {
"type": {
"const": "handoff.update"
}
}
},
"then": {
"$ref": "#/$defs/handoff.update"
}
},
{
"if": {
"properties": {
"type": {
"const": "handoff.cancel"
}
}
},
"then": {
"$ref": "#/$defs/handoff.cancel"
}
},
{
"if": {
"properties": {
"type": {
"const": "handoff.status"
}
}
},
"then": {
"$ref": "#/$defs/handoff.status"
}
},
{
"if": {
"properties": {
"type": {
"const": "case.intake"
}
}
},
"then": {
"$ref": "#/$defs/case.intake"
}
},
{
"if": {
"properties": {
"type": {
"const": "case.assign"
}
}
},
"then": {
"$ref": "#/$defs/case.assign"
}
},
{
"if": {
"properties": {
"type": {
"const": "case.message"
}
}
},
"then": {
"$ref": "#/$defs/case.message"
}
},
{
"if": {
"properties": {
"type": {
"const": "case.policy"
}
}
},
"then": {
"$ref": "#/$defs/case.policy"
}
},
{
"if": {
"properties": {
"type": {
"const": "handoff.requested"
}
}
},
"then": {
"$ref": "#/$defs/handoff.requested"
}
},
{
"if": {
"properties": {
"type": {
"const": "mail.send"
}
}
},
"then": {
"$ref": "#/$defs/mail.send"
}
}
],
"$defs": {
"case": {
"type": "object",
"required": [
"address",
"key"
],
"properties": {
"address": {
"type": "string",
"minLength": 1
},
"key": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
},
"status": {
"enum": [
"requested",
"negotiating",
"scheduled",
"attempted",
"running",
"completed",
"failed",
"expired",
"refused",
"cancelled",
"timed-out"
]
},
"handoff.request": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case",
"handoff_id",
"mode",
"details",
"status_url"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "handoff.request"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"handoff_id": {
"type": "string",
"minLength": 1
},
"mode": {
"type": "string",
"minLength": 1
},
"details": {
"type": "object",
"additionalProperties": {
"type": [
"string",
"number",
"boolean"
]
}
},
"status_url": {
"type": "string",
"format": "uri"
},
"participant": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"handoff.update": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case",
"handoff_id",
"details"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "handoff.update"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"handoff_id": {
"type": "string",
"minLength": 1
},
"details": {
"type": "object",
"additionalProperties": {
"type": [
"string",
"number",
"boolean"
]
}
}
},
"additionalProperties": false
},
"handoff.cancel": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case",
"handoff_id"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "handoff.cancel"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"handoff_id": {
"type": "string",
"minLength": 1
},
"reason": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
},
"handoff.status": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case",
"handoff_id",
"seq",
"status"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "handoff.status"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"handoff_id": {
"type": "string",
"minLength": 1
},
"seq": {
"type": "integer",
"minimum": 1
},
"status": {
"$ref": "#/$defs/status"
},
"needs": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"minItems": 1
},
"at": {
"type": "string"
},
"outcome": {
"type": "string",
"minLength": 1
},
"reason": {
"type": "string",
"minLength": 1
},
"detail": {
"type": "string"
}
},
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"status": {
"const": "negotiating"
}
}
},
"then": {
"required": [
"needs"
]
}
},
{
"if": {
"properties": {
"status": {
"const": "refused"
}
}
},
"then": {
"required": [
"reason"
],
"properties": {
"reason": {
"enum": [
"mode-unavailable",
"mode-not-enabled",
"declined",
"out-of-hours",
"blocked"
]
}
}
}
},
{
"if": {
"properties": {
"status": {
"const": "attempted"
}
}
},
"then": {
"required": [
"outcome"
]
}
}
]
},
"case.intake": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"intake_ref",
"resource_type",
"event"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "case.intake"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"intake_ref": {
"type": "string",
"minLength": 1
},
"resource_type": {
"type": "string",
"minLength": 1
},
"event": {
"type": "object"
},
"requested_mode": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"case.assign": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"intake_ref",
"resource_id"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "case.assign"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"intake_ref": {
"type": "string",
"minLength": 1
},
"resource_id": {
"type": "string",
"minLength": 1
},
"policy": {
"$ref": "#/$defs/policy"
}
},
"additionalProperties": false
},
"case.message": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case",
"event",
"message_ref"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "case.message"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"event": {
"type": "object"
},
"message_ref": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
},
"case.policy": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "case.policy"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"autonomous_send": {
"type": "boolean"
},
"transfers": {
"$ref": "#/$defs/policy/properties/transfers"
}
},
"additionalProperties": false
},
"handoff.requested": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case",
"handoff_id",
"mode",
"forwarded"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "handoff.requested"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"handoff_id": {
"type": "string",
"minLength": 1
},
"mode": {
"type": "string",
"minLength": 1
},
"forwarded": {
"type": "boolean"
}
},
"additionalProperties": false
},
"mail.send": {
"type": "object",
"required": [
"mas_modes_version",
"type",
"id",
"case",
"in_reply_to",
"body"
],
"properties": {
"mas_modes_version": {
"const": "0.1"
},
"type": {
"const": "mail.send"
},
"id": {
"type": "string",
"minLength": 1
},
"case": {
"$ref": "#/$defs/case"
},
"in_reply_to": {
"type": "string",
"minLength": 1
},
"subject": {
"type": "string",
"minLength": 1
},
"body": {
"type": "string"
}
},
"additionalProperties": false
},
"policy": {
"type": "object",
"properties": {
"autonomous_send": {
"type": "boolean"
},
"transfers": {
"oneOf": [
{
"const": "block"
},
{
"type": "object",
"required": [
"webhook",
"peer"
],
"properties": {
"webhook": {
"type": "string",
"format": "uri"
},
"peer": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
}
]
}
},
"additionalProperties": false
}
}
}