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
457 lines
11 KiB
JSON
457 lines
11 KiB
JSON
{
|
|
"description": "Contract messages: every 'valid' message MUST validate against schema/mas-modes-v0.1.schema.json, every 'invalid' one MUST NOT.",
|
|
"valid": [
|
|
{
|
|
"case_id": "v-001",
|
|
"message": {
|
|
"id": "v-001",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.request",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"mode": "callback",
|
|
"details": {},
|
|
"status_url": "http://127.0.0.1:8030/mode-status",
|
|
"participant": {
|
|
"address": "customer@example.net"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-002",
|
|
"message": {
|
|
"id": "v-002",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.update",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"details": {
|
|
"phone": "+49 30 1234567",
|
|
"time": "tomorrow 10:00"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-003",
|
|
"message": {
|
|
"id": "v-003",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 1,
|
|
"status": "negotiating",
|
|
"needs": [
|
|
"phone",
|
|
"time"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-004",
|
|
"message": {
|
|
"id": "v-004",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 2,
|
|
"status": "scheduled",
|
|
"at": "2026-10-20T10:00:00Z"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-005",
|
|
"message": {
|
|
"id": "v-005",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 3,
|
|
"status": "attempted",
|
|
"outcome": "no-answer"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-006",
|
|
"message": {
|
|
"id": "v-006",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 4,
|
|
"status": "refused",
|
|
"reason": "out-of-hours"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-007",
|
|
"message": {
|
|
"id": "v-007",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.cancel",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"reason": "timed-out"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-008",
|
|
"message": {
|
|
"id": "v-008",
|
|
"mas_modes_version": "0.1",
|
|
"type": "case.intake",
|
|
"intake_ref": "i1",
|
|
"resource_type": "case",
|
|
"event": {
|
|
"mas_event_version": 1
|
|
},
|
|
"requested_mode": null
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-009",
|
|
"message": {
|
|
"id": "v-009",
|
|
"mas_modes_version": "0.1",
|
|
"type": "case.assign",
|
|
"intake_ref": "i1",
|
|
"resource_id": "EXT-123"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-010",
|
|
"message": {
|
|
"id": "v-010",
|
|
"mas_modes_version": "0.1",
|
|
"type": "case.message",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"event": {},
|
|
"message_ref": "m7"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-011",
|
|
"message": {
|
|
"id": "v-011",
|
|
"mas_modes_version": "0.1",
|
|
"type": "case.policy",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"autonomous_send": false,
|
|
"transfers": "block"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-012",
|
|
"message": {
|
|
"id": "v-012",
|
|
"mas_modes_version": "0.1",
|
|
"type": "case.policy",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"transfers": {
|
|
"webhook": "http://127.0.0.1:8031/handoffs",
|
|
"peer": "callback-1"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-013",
|
|
"message": {
|
|
"id": "v-013",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.requested",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h2",
|
|
"mode": "callback",
|
|
"forwarded": false
|
|
}
|
|
},
|
|
{
|
|
"case_id": "v-014",
|
|
"message": {
|
|
"id": "v-014",
|
|
"mas_modes_version": "0.1",
|
|
"type": "mail.send",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"in_reply_to": "m7",
|
|
"subject": "Re: help",
|
|
"body": "We are on it."
|
|
}
|
|
}
|
|
],
|
|
"invalid": [
|
|
{
|
|
"case_id": "x-001",
|
|
"why": "unknown type",
|
|
"message": {
|
|
"id": "x-001",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.start",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"mode": "callback",
|
|
"details": {},
|
|
"status_url": "http://127.0.0.1:8030/mode-status",
|
|
"participant": {
|
|
"address": "customer@example.net"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-002",
|
|
"why": "wrong version",
|
|
"message": {
|
|
"id": "x-002",
|
|
"mas_modes_version": "0.2",
|
|
"type": "handoff.request",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"mode": "callback",
|
|
"details": {},
|
|
"status_url": "http://127.0.0.1:8030/mode-status",
|
|
"participant": {
|
|
"address": "customer@example.net"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-003",
|
|
"why": "negotiating without needs",
|
|
"message": {
|
|
"id": "x-003",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 1,
|
|
"status": "negotiating"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-004",
|
|
"why": "refused without reason",
|
|
"message": {
|
|
"id": "x-004",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 4,
|
|
"status": "refused"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-005",
|
|
"why": "refused with an unknown reason",
|
|
"message": {
|
|
"id": "x-005",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 4,
|
|
"status": "refused",
|
|
"reason": "busy"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-006",
|
|
"why": "status not in the machine",
|
|
"message": {
|
|
"id": "x-006",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 2,
|
|
"status": "ringing",
|
|
"at": "2026-10-20T10:00:00Z"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-007",
|
|
"why": "seq must be >= 1",
|
|
"message": {
|
|
"id": "x-007",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 0,
|
|
"status": "scheduled",
|
|
"at": "2026-10-20T10:00:00Z"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-008",
|
|
"why": "attempted without outcome",
|
|
"message": {
|
|
"id": "x-008",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.status",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"seq": 3,
|
|
"status": "attempted"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-009",
|
|
"why": "mail.send without in_reply_to (replies only)",
|
|
"message": {
|
|
"id": "x-009",
|
|
"mas_modes_version": "0.1",
|
|
"type": "mail.send",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"subject": "Re: help",
|
|
"body": "We are on it."
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-010",
|
|
"why": "mail.send naming a recipient",
|
|
"message": {
|
|
"id": "x-010",
|
|
"mas_modes_version": "0.1",
|
|
"type": "mail.send",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"in_reply_to": "m7",
|
|
"subject": "Re: help",
|
|
"body": "We are on it.",
|
|
"to": "anyone@example.org"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-011",
|
|
"why": "transfers neither block nor webhook",
|
|
"message": {
|
|
"id": "x-011",
|
|
"mas_modes_version": "0.1",
|
|
"type": "case.policy",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"autonomous_send": false,
|
|
"transfers": "allow"
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-012",
|
|
"why": "handoff.request without case",
|
|
"message": {
|
|
"id": "x-012",
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.request",
|
|
"handoff_id": "h1",
|
|
"mode": "callback",
|
|
"details": {},
|
|
"status_url": "http://127.0.0.1:8030/mode-status",
|
|
"participant": {
|
|
"address": "customer@example.net"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-013",
|
|
"why": "missing idempotency id",
|
|
"message": {
|
|
"mas_modes_version": "0.1",
|
|
"type": "handoff.update",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"handoff_id": "h1",
|
|
"details": {
|
|
"phone": "+49 30 1234567",
|
|
"time": "tomorrow 10:00"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"case_id": "x-014",
|
|
"why": "webhook without the receiving mode's peer (CONTRACT.md 7.3)",
|
|
"message": {
|
|
"id": "x-014",
|
|
"mas_modes_version": "0.1",
|
|
"type": "case.policy",
|
|
"case": {
|
|
"address": "ticket=gs-1@great-service.example",
|
|
"key": "ticket=gs-1"
|
|
},
|
|
"transfers": {
|
|
"webhook": "http://127.0.0.1:8031/handoffs"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|