UNPKG

@openfloor/protocol

Version:

Open Floor Protocol implementation for JavaScript/TypeScript - enables interoperable multi-agent conversations

410 lines (400 loc) 15.5 kB
{ "$id": "https://github.com/open-voice-interoperability/docs/tree/main/schemas/conversation-envelope/1.0.0/conversation-envelope-schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "A representation of a 'dialogue envelope' - the universal data exchange format for an Open-Floor compliant interoperable agent.", "type": "object", "required": [ "openFloor" ], "properties": { "openFloor": { "required": ["schema" , "conversation", "sender", "events" ], "properties": { "schema": { "type": "object", "required": ["version" ], "properties": { "version": { "type": "string", "description": "The version of the dialog envelope specification matching this envelope." }, "url": { "$ref": "#/$defs/url" } } }, "conversation": { "required": [ "id" ], "properties": { "id": { "type": "string", "description": "Unique identifier for the current conversation with the user." }, "conversants" : { "type": "array", "items" : { "type" : "object", "properties" : { "identification": { "required": ["speakerUri", "serviceUrl" , "organization", "conversationalName", "synopsis" ], "properties": { "speakerUri": { "$ref": "#/$defs/uri", "description": "The unique identity of the agent." }, "serviceUrl": { "$ref": "#/$defs/url", "description": "The endpoint of the conversational assistant." }, "organization": { "type": "string", "description": "The name of the organization administering this assistant." }, "conversationalName": { "type": "string", "description": "The 'given name' of the conversational agent." }, "department": { "type": "string", "description": "The department within the organization." }, "role": { "type": "string", "description": "The 'job title', or 'role' of the assistant." }, "synopsis": { "type": "string", "description": "A sentence signposting the who the assistant is and their area of expertise." } }, "additionalProperties": false }, "persistent_state": { "type": "object", "description": "Container for an arbitrary set of key value pairs to be persisted.", "additionalProperties" : { "type" : "object" } }, "additionalProperties": false } } } } }, "sender": { "type": "object", "required": ["speakerUri"], "properties" : { "speakerUri": { "$ref": "#/$defs/uri", "description": "The URI of the sender of the envelope." }, "serviceUrl": { "$ref": "#/$defs/url", "description": "The endpoint of the conversational assistant." } } }, "events": { "type": "array", "items" : { "type" : "object", "properties" : { "eventType": { "type" : "string", "enum": [ "invite", "uninvite", "declineInvite", "utterance", "bye", "context", "getManifests", "publishManifests", "findAssistant", "proposeAssistant", "requestFloor", "grantFloor", "revokeFloor", "yieldFloor" ] }, "to" : { "type" : "object", "properties": { "speakerUri" : { "$ref": "#/$defs/uri", "description": "The URI of the agent to be invited." }, "serviceUrl" : { "$ref": "#/$defs/url", "description": "The URL of the agent to be invited." }, "private" : { "type" : "boolean", "description" : "Set to true if the event is intended for the 'to' particpant only." } } }, "reason": { "type": "string", "description": "Optional reason for the event." } }, "allOf": [ { "if": { "properties": { "eventType": { "const": "utterance" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters": { "description": "Parameters for the utterance event.", "type" : "object", "properties" : { "dialogEvent": { "ref": "https://github.com/open-voice-interoperability/lib-interop/tree/main/schemas/dialog-event/1.0.2/dialog-event-schema.json" } }, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "context" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters": { "description": "Parameters for the context event.", "type" : "object", "properties" : { "dialogHistory": { "type": "array", "items": { "type": "object", "ref": "https://github.com/open-voice-interoperability/lib-interop/tree/main/schemas/dialog-event/1.0.2/dialog-event-schema.json" } } }, "additionalProperties": true } } } }, { "if": { "properties": { "eventType": { "const": "invite" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the invite event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "uninvite" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the uninvite event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "declineInvite" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the declineInvite event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "bye" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the bye event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "getManifests" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the requestManifest event.", "type": "object", "properties": { "recommendScope": { "type": "string", "description": "The scope of the recommendation." } }, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "publishManifests" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the publishManifests event.", "type": "object", "properties" : { "servicingManifests": { "ref": "https://github.com/open-voice-interoperability/docs/tree/main/schemas/assistant-manifest/1.0.0/assistant-manifest-schema.json" }, "discoveryManifests": { "ref": "https://github.com/open-voice-interoperability/docs/tree/main/schemas/assistant-manifest/1.0.0/assistant-manifest-schema.json" } }, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "requestFloor" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the requestFloor event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "grantFloor" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the grantFloor event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "yieldFloor" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the yieldFloor event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } }, { "if": { "properties": { "eventType": { "const": "revokeFloor" } }, "required": ["eventType"] }, "then" : { "properties": { "parameters" : { "description": "Parameters for the revokeFloor event.", "type": "object", "maxProperties": 0, "additionalProperties": false } } } } ] } } } } }, "$defs": { "url": { "type": "string", "description": "Any valid URL" }, "uri": { "type": "string", "description": "Any valid URI" } } }