- K8s deployment (2 replicas, PVC, initContainer для server_name) - Streams definitions (MM_ONLINE, MM_OFFLINE, MM_WRITE, MM_EVENTS) - Job payload schema (JSON v1 з idempotency) - Worker contract (capabilities + ack/retry) - Init streams script - Оновлено ARCHITECTURE-150-NODES.md (Control-plane vs Data-plane) TODO: Auth (nkeys), 3+ replicas для prod, worker-daemon implementation
204 lines
4.8 KiB
JSON
204 lines
4.8 KiB
JSON
{
|
||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||
"title": "Memory Module Job Payload v1",
|
||
"description": "Стандартний формат job для NATS JetStream",
|
||
"type": "object",
|
||
"required": ["job_id", "idempotency_key", "type", "priority", "tenant", "timestamps"],
|
||
"properties": {
|
||
"job_id": {
|
||
"type": "string",
|
||
"format": "ulid",
|
||
"description": "Унікальний ID job (ULID)"
|
||
},
|
||
"idempotency_key": {
|
||
"type": "string",
|
||
"pattern": "^sha256:",
|
||
"description": "Idempotency key для safe retries (SHA256 hash)"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"enum": [
|
||
"embed",
|
||
"retrieve",
|
||
"summarize",
|
||
"qdrant_upsert",
|
||
"pg_write",
|
||
"neo4j_write",
|
||
"index"
|
||
],
|
||
"description": "Тип job"
|
||
},
|
||
"priority": {
|
||
"type": "string",
|
||
"enum": ["online", "offline"],
|
||
"description": "Пріоритет: online (low latency) або offline (batch)"
|
||
},
|
||
"tenant": {
|
||
"type": "object",
|
||
"required": ["org_id"],
|
||
"properties": {
|
||
"org_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"workspace_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
},
|
||
"scope": {
|
||
"type": "object",
|
||
"properties": {
|
||
"user_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"agent_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"thread_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
},
|
||
"requirements": {
|
||
"type": "object",
|
||
"properties": {
|
||
"needs_gpu": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"min_vram_gb": {
|
||
"type": "integer",
|
||
"minimum": 0
|
||
},
|
||
"max_latency_ms": {
|
||
"type": "integer",
|
||
"minimum": 0
|
||
},
|
||
"trust_zone": {
|
||
"type": "string",
|
||
"enum": ["A", "B", "C"]
|
||
},
|
||
"tier": {
|
||
"type": "string",
|
||
"enum": ["A", "B", "C"]
|
||
}
|
||
}
|
||
},
|
||
"input": {
|
||
"type": "object",
|
||
"properties": {
|
||
"text": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"input_type": {
|
||
"type": "string",
|
||
"enum": ["search_query", "search_document", "classification", "clustering"]
|
||
},
|
||
"model": {
|
||
"type": "string",
|
||
"enum": [
|
||
"cohere/embed-multilingual-v3.0",
|
||
"bge-m3",
|
||
"custom"
|
||
]
|
||
},
|
||
"dims": {
|
||
"type": "integer",
|
||
"enum": [1024, 768, 512]
|
||
}
|
||
}
|
||
},
|
||
"refs": {
|
||
"type": "object",
|
||
"properties": {
|
||
"event_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"memory_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"artifact_uri": {
|
||
"type": "string",
|
||
"format": "uri"
|
||
}
|
||
}
|
||
},
|
||
"trace": {
|
||
"type": "object",
|
||
"properties": {
|
||
"trace_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"parent_span_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"timestamps": {
|
||
"type": "object",
|
||
"required": ["created_at"],
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"deadline": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"examples": [
|
||
{
|
||
"job_id": "01J8X9Y2Z3A4B5C6D7E8F9G0H1",
|
||
"idempotency_key": "sha256:abc123...",
|
||
"type": "embed",
|
||
"priority": "online",
|
||
"tenant": {
|
||
"org_id": "550e8400-e29b-41d4-a716-446655440000",
|
||
"workspace_id": "660e8400-e29b-41d4-a716-446655440000"
|
||
},
|
||
"scope": {
|
||
"user_id": "770e8400-e29b-41d4-a716-446655440000",
|
||
"agent_id": "880e8400-e29b-41d4-a716-446655440000",
|
||
"thread_id": "990e8400-e29b-41d4-a716-446655440000"
|
||
},
|
||
"requirements": {
|
||
"needs_gpu": true,
|
||
"min_vram_gb": 8,
|
||
"max_latency_ms": 300,
|
||
"trust_zone": "A",
|
||
"tier": "A"
|
||
},
|
||
"input": {
|
||
"text": ["Привіт, це тестовий текст для embedding"],
|
||
"input_type": "search_document",
|
||
"model": "cohere/embed-multilingual-v3.0",
|
||
"dims": 1024
|
||
},
|
||
"refs": {
|
||
"event_id": "aa0e8400-e29b-41d4-a716-446655440000"
|
||
},
|
||
"trace": {
|
||
"trace_id": "bb0e8400-e29b-41d4-a716-446655440000"
|
||
},
|
||
"timestamps": {
|
||
"created_at": "2026-01-10T19:30:00Z",
|
||
"deadline": "2026-01-10T19:35:00Z"
|
||
}
|
||
}
|
||
]
|
||
}
|