{"openapi":"3.0.3","info":{"title":"Wire API","version":"1.0.0","description":"Wire agent control plane API"},"servers":[{"url":"https://wire.pm"}],"tags":[{"name":"agents"},{"name":"messages"},{"name":"tasks"},{"name":"pipelines"},{"name":"approvals"},{"name":"alerts"},{"name":"events"},{"name":"context"},{"name":"kb"},{"name":"metrics"},{"name":"scheduled-jobs"},{"name":"sessions"},{"name":"capabilities"},{"name":"trust"}],"paths":{"/api/agent/register":{"post":{"tags":["agents"],"summary":"Register or re-register an agent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterAgentRequest"}}}},"responses":{"201":{"description":"Registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterAgentResponse"}}}}}}},"/api/agent/{id}":{"get":{"tags":["agents"],"summary":"Get agent profile","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Agent profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentProfileResponse"}}}}}},"put":{"tags":["agents"],"summary":"Update agent profile","security":[{"BearerAuth":[]},{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}},"patch":{"tags":["agents"],"summary":"Patch agent profile","security":[{"BearerAuth":[]},{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/agent/{id}/pubkey":{"get":{"tags":["agents"],"summary":"Get agent public key","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Public key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubKeyResponse"}}}}}}},"/api/agent/{id}/heartbeat":{"post":{"tags":["agents"],"summary":"Update agent heartbeat","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"},{"name":"token","in":"query","schema":{"type":"string"},"required":false}],"responses":{"200":{"description":"Heartbeat accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/agents/{id}/health":{"get":{"tags":["agents"],"summary":"Get agent health","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Agent health","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentHealth"}}}}}}},"/api/agents/{id}/suspend":{"post":{"tags":["agents"],"summary":"Suspend agent","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"201":{"description":"Suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}}}}},"/api/agents/{id}/resume":{"post":{"tags":["agents"],"summary":"Resume agent","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"201":{"description":"Resumed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}}}}},"/api/agents/{id}/steer":{"post":{"tags":["agents"],"summary":"Steer agent","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"responses":{"201":{"description":"Steering signal emitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/message/send":{"post":{"tags":["messages"],"summary":"Send message","security":[{"BearerAuth":[]}],"parameters":[{"name":"token","in":"query","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageRequest"}}}},"responses":{"201":{"description":"Message accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/message/inbox":{"get":{"tags":["messages"],"summary":"Read inbox","parameters":[{"name":"agent","in":"query","required":true,"schema":{"type":"string"}},{"name":"token","in":"query","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string"}},{"name":"thread_id","in":"query","schema":{"type":"string"}},{"name":"since","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Inbox","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}}}}}}}},"/api/message/ack":{"post":{"tags":["messages"],"summary":"Acknowledge messages","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"type":"string"},"token":{"type":"string"},"keys":{"type":"array","items":{"type":"string"}}},"required":["agent","token","keys"]}}}},"responses":{"201":{"description":"Acknowledged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/message/stream":{"get":{"tags":["messages"],"summary":"Stream inbox via SSE","parameters":[{"name":"agent","in":"query","required":true,"schema":{"type":"string"}},{"name":"token","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"SSE stream"}}}},"/api/tasks":{"post":{"tags":["tasks"],"summary":"Create task","security":[{"OwnerSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskDto"}}}},"responses":{"201":{"description":"Task created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}},"get":{"tags":["tasks"],"summary":"List tasks","parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"assignedTo","in":"query","schema":{"type":"string"}},{"name":"ownerId","in":"query","schema":{"type":"string"}},{"name":"pipelineRunId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Task list","content":{"application/json":{"schema":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/Task"}}}}}}}}}},"/api/tasks/{id}":{"get":{"tags":["tasks"],"summary":"Get task","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Task","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}},"patch":{"tags":["tasks"],"summary":"Patch task","parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"},"priority":{"type":"integer"},"dueAt":{"type":"integer"}}}}}},"responses":{"200":{"description":"Patched","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}},"delete":{"tags":["tasks"],"summary":"Cancel task","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}}},"/api/tasks/{id}/assign":{"post":{"tags":["tasks"],"summary":"Assign task","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string"}},"required":["agentId"]}}}},"responses":{"201":{"description":"Assigned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}}},"/api/tasks/{id}/start":{"post":{"tags":["tasks"],"summary":"Start task","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"201":{"description":"Started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}}},"/api/tasks/{id}/complete":{"post":{"tags":["tasks"],"summary":"Complete task","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteTaskDto"}}}},"responses":{"201":{"description":"Completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}}},"/api/tasks/{id}/fail":{"post":{"tags":["tasks"],"summary":"Fail task","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"responses":{"201":{"description":"Failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}}}}},"/api/tasks/{id}/approval":{"post":{"tags":["tasks"],"summary":"Request approval for task","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string"},"description":{"type":"string"},"metadata":{"type":"object","additionalProperties":true}},"required":["action","description"]}}}},"responses":{"201":{"description":"Approval requested","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"},"approval":{"$ref":"#/components/schemas/Approval"}}}}}}}}},"/api/pipelines":{"post":{"tags":["pipelines"],"summary":"Create pipeline","security":[{"OwnerSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/PipelineStep"}}},"required":["name","steps"]}}}},"responses":{"201":{"description":"Pipeline created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineEnvelope"}}}}}},"get":{"tags":["pipelines"],"summary":"List pipelines","security":[{"OwnerSession":[]}],"responses":{"200":{"description":"Pipeline list","content":{"application/json":{"schema":{"type":"object","properties":{"pipelines":{"type":"array","items":{"$ref":"#/components/schemas/Pipeline"}}}}}}}}}},"/api/pipelines/{id}":{"get":{"tags":["pipelines"],"summary":"Get pipeline","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Pipeline","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineEnvelope"}}}}}},"patch":{"tags":["pipelines"],"summary":"Update pipeline","parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/PipelineStep"}}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineEnvelope"}}}}}},"delete":{"tags":["pipelines"],"summary":"Delete pipeline","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/pipelines/{id}/run":{"post":{"tags":["pipelines"],"summary":"Run pipeline","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"context":{"type":"object","additionalProperties":true},"initialContext":{"type":"object","additionalProperties":true}}}}}},"responses":{"201":{"description":"Run started","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/PipelineRun"}}}}}}}}},"/api/pipelines/{id}/runs":{"get":{"tags":["pipelines"],"summary":"List runs for pipeline","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Run list","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/PipelineRun"}}}}}}}}}},"/api/pipeline-runs/{id}":{"get":{"tags":["pipelines"],"summary":"Get pipeline run","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Pipeline run","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/PipelineRun"}}}}}}}}},"/api/approvals":{"post":{"tags":["approvals"],"summary":"Create approval","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string"},"description":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"taskId":{"type":"string"}},"required":["action","description"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"approval":{"$ref":"#/components/schemas/Approval"}}}}}}}},"get":{"tags":["approvals"],"summary":"List approvals","security":[{"OwnerSession":[]}],"parameters":[{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Approvals","content":{"application/json":{"schema":{"type":"object","properties":{"approvals":{"type":"array","items":{"$ref":"#/components/schemas/Approval"}}}}}}}}}},"/api/approvals/{id}":{"get":{"tags":["approvals"],"summary":"Get approval","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Approval","content":{"application/json":{"schema":{"type":"object","properties":{"approval":{"$ref":"#/components/schemas/Approval"}}}}}}}}},"/api/approvals/{id}/approve":{"post":{"tags":["approvals"],"summary":"Approve request","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"201":{"description":"Approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/approvals/{id}/reject":{"post":{"tags":["approvals"],"summary":"Reject request","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"responses":{"201":{"description":"Rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/alerts":{"get":{"tags":["alerts"],"summary":"List alerts","security":[{"OwnerSession":[]}],"parameters":[{"name":"acknowledged","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Alert list","content":{"application/json":{"schema":{"type":"object","properties":{"alerts":{"type":"array","items":{"$ref":"#/components/schemas/Alert"}}}}}}}}},"post":{"tags":["alerts"],"summary":"Create alert","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":true}},"required":["type","message"]}}}},"responses":{"201":{"description":"Alert created","content":{"application/json":{"schema":{"type":"object","properties":{"alert":{"$ref":"#/components/schemas/Alert"}}}}}}}}},"/api/alerts/{id}/acknowledge":{"post":{"tags":["alerts"],"summary":"Acknowledge alert","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"201":{"description":"Acknowledged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/events/publish":{"post":{"tags":["events"],"summary":"Publish event","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"topic":{"type":"string"},"payload":{"type":"object","additionalProperties":true}},"required":["topic"]}}}},"responses":{"201":{"description":"Published","content":{"application/json":{"schema":{"type":"object","properties":{"event":{"$ref":"#/components/schemas/Event"}}}}}}}}},"/api/events/subscribe":{"post":{"tags":["events"],"summary":"Subscribe to topic","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"topic":{"type":"string"}},"required":["topic"]}}}},"responses":{"201":{"description":"Subscribed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/events/subscriptions":{"get":{"tags":["events"],"summary":"List subscriptions","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Subscriptions","content":{"application/json":{"schema":{"type":"object","properties":{"subscriptions":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}}}}}}}}}},"/api/events/subscriptions/{topic}":{"delete":{"tags":["events"],"summary":"Unsubscribe","security":[{"BearerAuth":[]}],"parameters":[{"name":"topic","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Unsubscribed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/events":{"get":{"tags":["events"],"summary":"List events","security":[{"OwnerSession":[]}],"parameters":[{"name":"topic","in":"query","schema":{"type":"string"}},{"name":"since","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Event list","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}}}}}}}}},"/api/context/{scope}/{key}":{"put":{"tags":["context"],"summary":"Set context entry","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/ScopeParam"},{"$ref":"#/components/parameters/KeyParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"object","additionalProperties":true}},"required":["value"]}}}},"responses":{"200":{"description":"Entry updated","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"$ref":"#/components/schemas/ContextEntry"}}}}}}}},"get":{"tags":["context"],"summary":"Get context entry","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/ScopeParam"},{"$ref":"#/components/parameters/KeyParam"}],"responses":{"200":{"description":"Entry","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"$ref":"#/components/schemas/ContextEntry"}}}}}}}},"delete":{"tags":["context"],"summary":"Delete context entry","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/ScopeParam"},{"$ref":"#/components/parameters/KeyParam"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/context/{scope}":{"get":{"tags":["context"],"summary":"List context scope","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/ScopeParam"}],"responses":{"200":{"description":"Entries","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/ContextEntry"}}}}}}}}}},"/api/kb":{"get":{"tags":["kb"],"summary":"List KB entries","security":[{"BearerAuth":[]}],"parameters":[{"name":"prefix","in":"query","schema":{"type":"string"}},{"name":"scope","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Entries","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/KbEntry"}}}}}}}}}},"/api/kb/search":{"get":{"tags":["kb"],"summary":"Search KB","security":[{"BearerAuth":[]}],"parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Search results","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/KbEntry"}}}}}}}}}},"/api/kb/{key}":{"get":{"tags":["kb"],"summary":"Get KB entry","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/KeyParam"}],"responses":{"200":{"description":"Entry","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"$ref":"#/components/schemas/KbEntry"}}}}}}}},"put":{"tags":["kb"],"summary":"Set KB entry","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/KeyParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"string"},"scope":{"type":"string"},"ttlSeconds":{"type":"integer"}},"required":["value"]}}}},"responses":{"200":{"description":"Entry updated","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"$ref":"#/components/schemas/KbEntry"}}}}}}}},"delete":{"tags":["kb"],"summary":"Delete KB entry","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/KeyParam"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/kb/{key}/share":{"post":{"tags":["kb"],"summary":"Share KB entry","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/KeyParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"shareWith":{"type":"string"}},"required":["shareWith"]}}}},"responses":{"201":{"description":"Shared","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/metrics":{"get":{"tags":["metrics"],"summary":"Owner metrics","security":[{"OwnerSession":[]}],"responses":{"200":{"description":"Metrics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Metrics"}}}}}}},"/api/scheduled-jobs":{"post":{"tags":["scheduled-jobs"],"summary":"Create scheduled job","security":[{"OwnerSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"cronExpr":{"type":"string"},"agentId":{"type":"string"},"taskTemplate":{"type":"object","additionalProperties":true},"enabled":{"type":"boolean"}},"required":["name","cronExpr","agentId","taskTemplate"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/ScheduledJob"}}}}}}}},"get":{"tags":["scheduled-jobs"],"summary":"List scheduled jobs","security":[{"OwnerSession":[]}],"responses":{"200":{"description":"Jobs","content":{"application/json":{"schema":{"type":"object","properties":{"jobs":{"type":"array","items":{"$ref":"#/components/schemas/ScheduledJob"}}}}}}}}}},"/api/scheduled-jobs/{id}":{"patch":{"tags":["scheduled-jobs"],"summary":"Update scheduled job","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/ScheduledJob"}}}}}}}},"delete":{"tags":["scheduled-jobs"],"summary":"Delete scheduled job","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/scheduled-jobs/{id}/trigger":{"post":{"tags":["scheduled-jobs"],"summary":"Trigger scheduled job now","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"201":{"description":"Triggered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/agents/{id}/sessions":{"get":{"tags":["sessions"],"summary":"List sessions for agent","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Sessions","content":{"application/json":{"schema":{"type":"object","properties":{"sessions":{"type":"array","items":{"$ref":"#/components/schemas/Session"}}}}}}}}}},"/api/sessions":{"post":{"tags":["sessions"],"summary":"Start session","security":[{"BearerAuth":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"taskId":{"type":"string"}}}}}},"responses":{"201":{"description":"Session started","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Session"}}}}}}}}},"/api/sessions/{id}":{"get":{"tags":["sessions"],"summary":"Get session","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Session"}}}}}}}},"patch":{"tags":["sessions"],"summary":"Append session log or update status","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"appendLog":{"type":"string"},"status":{"type":"string"}}}}}},"responses":{"200":{"description":"Session updated","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Session"}}}}}}}}},"/api/sessions/{id}/log":{"get":{"tags":["sessions"],"summary":"Get session log","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Session log","content":{"application/json":{"schema":{"type":"object","properties":{"log":{"type":"string"}}}}}}}}},"/api/sessions/{id}/end":{"post":{"tags":["sessions"],"summary":"End session","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"201":{"description":"Session ended","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Session"}}}}}}}}},"/api/agents/{id}/capabilities":{"put":{"tags":["capabilities"],"summary":"Upsert capabilities","security":[{"BearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}}}}}}},"responses":{"200":{"description":"Capabilities upserted","content":{"application/json":{"schema":{"type":"object","properties":{"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}}}}}}}}},"get":{"tags":["capabilities"],"summary":"Get capabilities for agent","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Capabilities","content":{"application/json":{"schema":{"type":"object","properties":{"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}}}}}}}}}},"/api/capabilities":{"get":{"tags":["capabilities"],"summary":"Search capabilities","parameters":[{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Capabilities","content":{"application/json":{"schema":{"type":"object","properties":{"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}}}}}}}}}},"/api/agents/{id}/policies":{"put":{"tags":["capabilities"],"summary":"Set capability policies","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"$ref":"#/components/schemas/Policy"}}},"required":["rules"]}}}},"responses":{"200":{"description":"Policies set","content":{"application/json":{"schema":{"type":"object","properties":{"policies":{"type":"array","items":{"$ref":"#/components/schemas/Policy"}}}}}}}}},"get":{"tags":["capabilities"],"summary":"Get capability policies","security":[{"OwnerSession":[]}],"parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Policies","content":{"application/json":{"schema":{"type":"object","properties":{"policies":{"type":"array","items":{"$ref":"#/components/schemas/Policy"}}}}}}}}}},"/api/trust/grants":{"get":{"tags":["trust"],"summary":"List or check trust grants","parameters":[{"name":"grantor","in":"query","schema":{"type":"string"}},{"name":"grantee","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Trust grants","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"post":{"tags":["trust"],"summary":"Grant trust","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustGrantRequest"}}}},"responses":{"201":{"description":"Granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/trust/grant":{"post":{"tags":["trust"],"summary":"Grant trust (alias)","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustGrantRequest"}}}},"responses":{"201":{"description":"Granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}},"/api/trust/revoke":{"post":{"tags":["trust"],"summary":"Revoke trust","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrustGrantRequest"}}}},"responses":{"201":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"agentId:token"},"OwnerSession":{"type":"apiKey","in":"cookie","name":"wire_owner_session"}},"parameters":{"IdParam":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"KeyParam":{"name":"key","in":"path","required":true,"schema":{"type":"string"}},"ScopeParam":{"name":"scope","in":"path","required":true,"schema":{"type":"string"}}},"schemas":{"OkResponse":{"type":"object","properties":{"ok":{"type":"boolean"}}},"RegisterAgentRequest":{"type":"object","properties":{"agent":{"type":"string"},"owner":{"type":"string"},"pubkey":{"type":"string"},"enc_pubkey":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"}},"required":["agent"]},"RegisterAgentResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"agentId":{"type":"string"},"token":{"type":"string"}},"required":["ok","agentId"]},"UpdateAgentRequest":{"type":"object","properties":{"display_name":{"type":"string"},"description":{"type":"string"},"webhook_url":{"type":"string"},"webhook_secret":{"type":"string"},"webhook_events":{"type":"array","items":{"type":"string"}},"profile_json":{"type":"object","additionalProperties":true}}},"PubKeyResponse":{"type":"object","properties":{"pubkey":{"type":"string"}},"required":["pubkey"]},"Agent":{"type":"object","properties":{"agentId":{"type":"string"},"owner":{"type":"string"},"displayName":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"publicKey":{"type":"string","nullable":true},"encryptionPublicKey":{"type":"string","nullable":true},"status":{"type":"string"},"online":{"type":"boolean"},"lastSeenAt":{"type":"string","nullable":true},"active":{"type":"boolean"}},"required":["agentId","owner","status","online"]},"AgentProfileResponse":{"allOf":[{"$ref":"#/components/schemas/Agent"},{"type":"object","properties":{"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}},"agent_id":{"type":"string"},"display_name":{"type":"string","nullable":true},"public_key":{"type":"string","nullable":true},"encryption_public_key":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"last_seen_at":{"type":"string","nullable":true}}}]},"AgentEnvelope":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"}}},"AgentHealth":{"type":"object","properties":{"status":{"type":"string"},"online":{"type":"boolean"},"lastSeen":{"type":"string","nullable":true},"activeTasks":{"type":"integer"},"errorRate24h":{"type":"number"},"alertCount":{"type":"integer"}},"required":["status","online","activeTasks","errorRate24h","alertCount"]},"SendMessageRequest":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"encrypted":{"type":"boolean"},"epk":{"type":"string"},"iv":{"type":"string"},"ciphertext":{"type":"string"},"tag":{"type":"string"},"type":{"type":"string"},"thread_id":{"type":"string"},"reply_to_message_id":{"type":"string"},"ttl_seconds":{"type":"integer"}},"required":["from","to","timestamp","encrypted","epk","iv","ciphertext","tag"]},"Message":{"type":"object","properties":{"id":{"type":"string"},"sender":{"type":"string"},"recipient":{"type":"string"},"encryptedPayload":{"type":"string"},"expiresAt":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"readAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"threadId":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"messageType":{"type":"string"}},"required":["id","sender","recipient","encryptedPayload","createdAt","messageType"]},"CreateTaskDto":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"},"priority":{"type":"integer"},"assignTo":{"type":"string"},"input":{"type":"object","additionalProperties":true},"dueAt":{"type":"integer"},"capability":{"type":"string"}},"required":["title"]},"CompleteTaskDto":{"type":"object","properties":{"output":{"type":"object","additionalProperties":true}},"required":["output"]},"Task":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"priority":{"type":"integer"},"assignedTo":{"type":"string","nullable":true},"createdBy":{"type":"string"},"creatorType":{"type":"string"},"ownerId":{"type":"string"},"pipelineRunId":{"type":"string","nullable":true},"pipelineStep":{"type":"integer","nullable":true},"parentTaskId":{"type":"string","nullable":true},"input":{"type":"object","additionalProperties":true},"output":{"type":"object","nullable":true,"additionalProperties":true},"error":{"type":"string","nullable":true},"dueAt":{"type":"integer","nullable":true},"startedAt":{"type":"integer","nullable":true},"completedAt":{"type":"integer","nullable":true},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}},"required":["id","title","status","priority","createdBy","creatorType","ownerId","input","createdAt","updatedAt"]},"TaskEnvelope":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}},"PipelineStep":{"type":"object","properties":{"index":{"type":"integer"},"agentId":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"inputMapping":{"type":"object","additionalProperties":{"type":"string"}}},"required":["agentId","title"]},"Pipeline":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"ownerId":{"type":"string"},"steps":{"type":"array","items":{"$ref":"#/components/schemas/PipelineStep"}},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}},"required":["id","name","ownerId","steps","createdAt","updatedAt"]},"PipelineEnvelope":{"type":"object","properties":{"pipeline":{"$ref":"#/components/schemas/Pipeline"}}},"PipelineRun":{"type":"object","properties":{"id":{"type":"string"},"pipelineId":{"type":"string"},"status":{"type":"string"},"currentStep":{"type":"integer"},"context":{"type":"object","additionalProperties":true},"startedAt":{"type":"integer"},"completedAt":{"type":"integer","nullable":true},"createdAt":{"type":"integer"}},"required":["id","pipelineId","status","currentStep","context","startedAt","createdAt"]},"Approval":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"taskId":{"type":"string","nullable":true},"action":{"type":"string"},"description":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"status":{"type":"string"},"ownerId":{"type":"string"},"decidedBy":{"type":"string","nullable":true},"decidedAt":{"type":"integer","nullable":true},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}},"required":["id","agentId","action","description","metadata","status","ownerId","createdAt","updatedAt"]},"Event":{"type":"object","properties":{"id":{"type":"string"},"topic":{"type":"string"},"payload":{"type":"object","additionalProperties":true},"publisherAgentId":{"type":"string"},"createdAt":{"type":"integer"},"expiresAt":{"type":"integer","nullable":true}},"required":["id","topic","payload","publisherAgentId","createdAt"]},"Subscription":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"topic":{"type":"string"},"createdAt":{"type":"integer"}},"required":["id","agentId","topic","createdAt"]},"LineageEntry":{"type":"object","properties":{"at":{"type":"integer"},"actorType":{"type":"string"},"actorId":{"type":"string"},"version":{"type":"integer"}},"required":["at","actorType","actorId","version"]},"ContextEntry":{"type":"object","properties":{"id":{"type":"string"},"scope":{"type":"string"},"key":{"type":"string"},"value":{"type":"object","additionalProperties":true},"lineage":{"type":"array","items":{"$ref":"#/components/schemas/LineageEntry"}},"version":{"type":"integer"},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}},"required":["id","scope","key","value","lineage","version","createdAt","updatedAt"]},"Alert":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"acknowledged":{"type":"boolean"},"ownerId":{"type":"string"},"createdAt":{"type":"integer"}},"required":["id","agentId","type","message","metadata","acknowledged","ownerId","createdAt"]},"Capability":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"inputSchema":{"type":"object","nullable":true,"additionalProperties":true},"outputSchema":{"type":"object","nullable":true,"additionalProperties":true},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}},"required":["name"]},"Policy":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"capability":{"type":"string"},"allowed":{"type":"boolean"},"requiresApproval":{"type":"boolean"},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}},"required":["agentId","capability","allowed","requiresApproval"]},"ScheduledJob":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"cronExpr":{"type":"string"},"agentId":{"type":"string"},"taskTemplate":{"type":"object","additionalProperties":true},"enabled":{"type":"boolean"},"ownerId":{"type":"string"},"lastRunAt":{"type":"integer","nullable":true},"nextRunAt":{"type":"integer","nullable":true},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"}},"required":["id","name","cronExpr","agentId","taskTemplate","enabled","ownerId","createdAt","updatedAt"]},"Session":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"status":{"type":"string"},"taskId":{"type":"string","nullable":true},"log":{"type":"string"},"startedAt":{"type":"integer"},"endedAt":{"type":"integer","nullable":true},"createdAt":{"type":"integer"}},"required":["id","agentId","status","log","startedAt","createdAt"]},"KbEntry":{"type":"object","properties":{"id":{"type":"string"},"namespace":{"type":"string"},"scope":{"type":"string"},"key":{"type":"string"},"value":{"type":"string"},"version":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"expiresAt":{"type":"string","nullable":true},"createdBy":{"type":"string"}},"required":["id","namespace","scope","key","value","version","createdAt","updatedAt","createdBy"]},"TrustGrantRequest":{"type":"object","properties":{"agent":{"type":"string"},"grantor":{"type":"string"},"grantee":{"type":"string"},"expires":{"type":"string"}},"required":["agent","grantor","grantee"]},"Metrics":{"type":"object","properties":{"activeAgents":{"type":"integer"},"totalAgents":{"type":"integer"},"pendingTasks":{"type":"integer"},"runningTasks":{"type":"integer"},"pendingApprovals":{"type":"integer"},"unacknowledgedAlerts":{"type":"integer"},"completedTasks24h":{"type":"integer"},"failedTasks24h":{"type":"integer"}},"required":["activeAgents","totalAgents","pendingTasks","runningTasks","pendingApprovals","unacknowledgedAlerts","completedTasks24h","failedTasks24h"]}}}}