{"openapi":"3.1.0","info":{"title":"Vowgistics Agent Toolbox","version":"1.0.0","description":"Deterministic tools for layout validation, timeline checking, price lookup, and draft management. Authenticate with x-agent-token header."},"servers":[{"url":"/api"}],"security":[{"agentToken":[]}],"components":{"securitySchemes":{"agentToken":{"type":"apiKey","in":"header","name":"x-agent-token","description":"Agent token issued via POST /api/agent-tokens"},"clerkSession":{"type":"http","scheme":"bearer","description":"Clerk session JWT (for human users)"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"JsonPatchOp":{"type":"object","properties":{"op":{"type":"string","enum":["add","remove","replace","move","copy","test"]},"path":{"type":"string"},"value":{},"from":{"type":"string"}},"required":["op","path"]},"ValidationSummary":{"type":"object","properties":{"okCount":{"type":"integer"},"alertCount":{"type":"integer"},"criticalCount":{"type":"integer"}}},"TimelineEvent":{"type":"object","properties":{"id":{"type":"string"},"dayIndex":{"type":"integer"},"timeRange":{"type":"string","example":"4:00 PM - 7:00 PM"},"title":{"type":"string"},"location":{"type":"string"},"isEssential":{"type":"boolean"}},"required":["id","dayIndex","timeRange","title"]}}},"paths":{"/agents/layout/validate":{"post":{"operationId":"layoutValidate","summary":"Validate layout against venue constraints","tags":["Layout"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string","format":"uuid"},"sectionId":{"type":"string","format":"uuid"},"options":{"type":"object","properties":{"writeBackResults":{"type":"boolean","default":true}}}},"required":["projectId","sectionId"]}}}},"responses":{"200":{"description":"Validation results","content":{"application/json":{"schema":{"type":"object","properties":{"validationSummary":{"$ref":"#/components/schemas/ValidationSummary"},"assetResults":{"type":"array","items":{"type":"object"}},"healthScore":{"type":"number"}}}}}}}}},"/agents/layout/auto-arrange":{"post":{"operationId":"layoutAutoArrange","summary":"Deterministic auto-arrangement of assets, returns a JSON Patch","tags":["Layout"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string","format":"uuid"},"sectionId":{"type":"string","format":"uuid"},"options":{"type":"object","properties":{"marginIn":{"type":"number","default":24},"spacingIn":{"type":"number","default":18},"seed":{"type":"string"}}}},"required":["projectId","sectionId"]}}}},"responses":{"200":{"description":"Arrangement result with patch and validation","content":{"application/json":{"schema":{"type":"object","properties":{"patch":{"type":"array","items":{"$ref":"#/components/schemas/JsonPatchOp"}},"proposedPositions":{"type":"array","items":{"type":"object"}},"report":{"type":"object"},"validation":{"type":"object"}}}}}}}}},"/agents/timeline/validate":{"post":{"operationId":"timelineValidate","summary":"Check timeline for overlaps and buffer violations","tags":["Timeline"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string","format":"uuid"},"timeline":{"type":"object","description":"Optional explicit timeline. If omitted, reads from DB.","properties":{"days":{"type":"array","items":{"type":"object","properties":{"dayIndex":{"type":"integer"},"events":{"type":"array","items":{"$ref":"#/components/schemas/TimelineEvent"}}}}}}},"rules":{"type":"object","properties":{"minBufferMin":{"type":"integer","default":15}}}},"required":["projectId"]}}}},"responses":{"200":{"description":"Validation result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"violations":{"type":"array","items":{"type":"object"}}}}}}}}}},"/agents/timeline/repair":{"post":{"operationId":"timelineRepair","summary":"Suggest deterministic repairs for timeline violations","tags":["Timeline"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string","format":"uuid"},"timeline":{"type":"object"},"rules":{"type":"object"}},"required":["projectId"]}}}},"responses":{"200":{"description":"Repair result with proposed edits","content":{"application/json":{"schema":{"type":"object","properties":{"proposedEdits":{"type":"array","items":{"type":"object"}},"remainingViolations":{"type":"array","items":{"type":"object"}}}}}}}}}},"/prices/suggest":{"get":{"operationId":"pricesSuggest","summary":"Look up price candidates with provenance data","tags":["Prices"],"parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string"}},{"name":"region","in":"query","schema":{"type":"string"}},{"name":"tier","in":"query","schema":{"type":"string","enum":["budget","mid","luxury"]}},{"name":"unit","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":10}}],"responses":{"200":{"description":"Price candidates","content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"candidateCount":{"type":"integer"},"candidates":{"type":"array","items":{"type":"object"}}}}}}}}}},"/projects/{projectId}/drafts":{"post":{"operationId":"createDraft","summary":"Create a new draft from current live state","tags":["Drafts"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Draft created"}}},"get":{"operationId":"listDrafts","summary":"List active drafts for a project","tags":["Drafts"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Array of draft summaries"}}}},"/projects/{projectId}/drafts/{draftId}/apply-patch":{"post":{"operationId":"applyPatchToDraft","summary":"Apply an RFC 6902 JSON Patch to a draft","tags":["Drafts"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"patch":{"type":"array","items":{"$ref":"#/components/schemas/JsonPatchOp"}}},"required":["patch"]}}}},"responses":{"200":{"description":"Patch applied"},"409":{"description":"Idempotency key conflict"},"422":{"description":"Invalid patch"}}}},"/projects/{projectId}/drafts/{draftId}/diff":{"get":{"operationId":"getDraftDiff","summary":"Compute diff between draft and live project state","tags":["Drafts"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Diff result"}}}},"/projects/{projectId}/drafts/{draftId}/merge":{"post":{"operationId":"mergeDraft","summary":"Merge a draft into live project state (OWNER only)","tags":["Drafts"],"parameters":[{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Draft merged"}}}}}}