AiFile ai.file@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
ai
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/ai/file.v1.json

ai.file@1: a person attachment or model-produced artifact stored by Media. The reference is metadata only; file bytes are never embedded in an AI turn.

Fields

FieldTypeRequiredDescriptionConstraints
idstringyes
  • minLength 1
  • maxLength 200
namestringyes
  • minLength 1
  • maxLength 255
media_typestringyes
  • minLength 1
  • maxLength 255
sizeintegeryes
  • minimum 0
storageobjectyes
  • no other fields
storage.providerconstyes
  • = "media"
storage.keystringyes
  • minLength 1
  • maxLength 500
accessobjectyes
  • no other fields
access.readersarray of stringyes
  • minItems 1
  • unique items
  • items: minLength 1
  • items: maxLength 200
readone ofyes
roleenum
  • one of "input", "artifact"

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: text-attachment
{
  "id": "med_file_01",
  "name": "notes.txt",
  "media_type": "text/plain",
  "size": 12,
  "storage": {
    "provider": "media",
    "key": "files/usr_01/med_file_01"
  },
  "access": {
    "readers": [
      "usr_01"
    ]
  },
  "read": {
    "method": "text",
    "content": "hello world"
  },
  "role": "input"
}
Rejected: inline-data
{
  "id": "med_file_01",
  "name": "notes.txt",
  "media_type": "text/plain",
  "size": 12,
  "storage": {
    "provider": "media",
    "key": "files/usr_01/med_file_01"
  },
  "access": {
    "readers": [
      "usr_01"
    ]
  },
  "read": {
    "method": "text"
  },
  "bytes": "not allowed"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('ai.file@1', value);   // { valid, errors: [{ path, message }] }