{
  "components": {
    "schemas": {
      "AgentCreateRequest": {
        "properties": {
          "vague_input": {
            "title": "Vague Input",
            "type": "string"
          }
        },
        "required": [
          "vague_input"
        ],
        "title": "AgentCreateRequest",
        "type": "object"
      },
      "AgentCreateResponse": {
        "description": "Response after creating an agent through the pipeline.",
        "properties": {
          "artifact_id": {
            "default": "",
            "title": "Artifact Id",
            "type": "string"
          },
          "color": {
            "default": "#6366f1",
            "title": "Color",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "inferred_fields": {
            "$ref": "#/components/schemas/InferredFields"
          },
          "name": {
            "default": "",
            "title": "Name",
            "type": "string"
          },
          "spec": {
            "$ref": "#/components/schemas/AgentSpec"
          },
          "system_prompt": {
            "default": "",
            "title": "System Prompt",
            "type": "string"
          },
          "vague_input": {
            "default": "",
            "title": "Vague Input",
            "type": "string"
          }
        },
        "title": "AgentCreateResponse",
        "type": "object"
      },
      "AgentMemory": {
        "properties": {
          "long_term": {
            "$ref": "#/components/schemas/MemoryConfig"
          },
          "rag": {
            "$ref": "#/components/schemas/MemoryConfig"
          },
          "short_term": {
            "$ref": "#/components/schemas/MemoryConfig"
          }
        },
        "title": "AgentMemory",
        "type": "object"
      },
      "AgentMessage": {
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "content": {
            "default": "",
            "title": "Content",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": true,
            "title": "Metadata",
            "type": "object"
          },
          "phase": {
            "$ref": "#/components/schemas/OrchestrationPhase"
          },
          "timestamp": {
            "title": "Timestamp",
            "type": "string"
          }
        },
        "required": [
          "phase"
        ],
        "title": "AgentMessage",
        "type": "object"
      },
      "AgentSpec": {
        "description": "YAML-serializable agent spec, field-compatible with framework's AgentDefinition.",
        "properties": {
          "goal": {
            "default": "",
            "title": "Goal",
            "type": "string"
          },
          "handoffs": {
            "items": {
              "type": "string"
            },
            "title": "Handoffs",
            "type": "array"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "memory": {
            "$ref": "#/components/schemas/AgentMemory"
          },
          "output_schema_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Output Schema Ref"
          },
          "role": {
            "default": "",
            "title": "Role",
            "type": "string"
          },
          "tools": {
            "items": {
              "type": "string"
            },
            "title": "Tools",
            "type": "array"
          }
        },
        "title": "AgentSpec",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "InferredFields": {
        "properties": {
          "agent_title": {
            "default": "",
            "title": "Agent Title",
            "type": "string"
          },
          "anti_patterns": {
            "default": "",
            "title": "Anti Patterns",
            "type": "string"
          },
          "constraints": {
            "default": "",
            "title": "Constraints",
            "type": "string"
          },
          "core_objective": {
            "default": "",
            "title": "Core Objective",
            "type": "string"
          },
          "domain_context": {
            "default": "",
            "title": "Domain Context",
            "type": "string"
          },
          "tone_personality": {
            "default": "",
            "title": "Tone Personality",
            "type": "string"
          },
          "unique_superpower": {
            "default": "",
            "title": "Unique Superpower",
            "type": "string"
          },
          "unique_value": {
            "default": "",
            "title": "Unique Value",
            "type": "string"
          }
        },
        "title": "InferredFields",
        "type": "object"
      },
      "MemoryConfig": {
        "properties": {
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "max_tokens": {
            "default": 0,
            "title": "Max Tokens",
            "type": "integer"
          },
          "source": {
            "default": "",
            "title": "Source",
            "type": "string"
          },
          "strategy": {
            "default": "",
            "title": "Strategy",
            "type": "string"
          },
          "top_k": {
            "default": 0,
            "title": "Top K",
            "type": "integer"
          }
        },
        "title": "MemoryConfig",
        "type": "object"
      },
      "OrchestrationPhase": {
        "enum": [
          "planning",
          "delegation",
          "discussion",
          "synthesis"
        ],
        "title": "OrchestrationPhase",
        "type": "string"
      },
      "OrchestrationRequest": {
        "properties": {
          "agent_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Ids"
          },
          "conversation_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conversation Id"
          },
          "max_discussion_rounds": {
            "default": 2,
            "title": "Max Discussion Rounds",
            "type": "integer"
          },
          "objective": {
            "title": "Objective",
            "type": "string"
          },
          "use_graph": {
            "default": false,
            "title": "Use Graph",
            "type": "boolean"
          }
        },
        "required": [
          "objective"
        ],
        "title": "OrchestrationRequest",
        "type": "object"
      },
      "OrchestrationResult": {
        "properties": {
          "agents_used": {
            "items": {
              "type": "string"
            },
            "title": "Agents Used",
            "type": "array"
          },
          "conversation_id": {
            "default": "",
            "title": "Conversation Id",
            "type": "string"
          },
          "final_synthesis": {
            "default": "",
            "title": "Final Synthesis",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "objective": {
            "title": "Objective",
            "type": "string"
          },
          "phases": {
            "items": {
              "$ref": "#/components/schemas/AgentMessage"
            },
            "title": "Phases",
            "type": "array"
          },
          "timestamp": {
            "title": "Timestamp",
            "type": "string"
          }
        },
        "required": [
          "objective"
        ],
        "title": "OrchestrationResult",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Agentic Hub HTTP surface — the orchestrator work-store sensor API (Linear-webhook + work-item reads) and the dashboard-facing backend. Two FastAPI apps merged into one reference: routes tagged `sensors` come from orchestrator.work_store.sensors:app; routes tagged `backend` come from backend.main:app.",
    "title": "Agentic Hub",
    "version": "0.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/agents": {
      "get": {
        "operationId": "list_agents_api_agents_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Agents",
        "tags": [
          "backend",
          "agents"
        ]
      },
      "post": {
        "operationId": "create_agent_api_agents_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentCreateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Agent",
        "tags": [
          "backend",
          "agents"
        ]
      }
    },
    "/api/agents/search": {
      "get": {
        "description": "Search for agents by capability, role, or description.\n\nUses semantic search when available, falls back to text matching.",
        "operationId": "search_agents_api_agents_search_get",
        "parameters": [
          {
            "description": "Search query for agent capabilities",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "description": "Search query for agent capabilities",
              "minLength": 1,
              "title": "Q",
              "type": "string"
            }
          },
          {
            "description": "Maximum results to return",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "description": "Maximum results to return",
              "maximum": 50,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Agents",
        "tags": [
          "backend",
          "agents"
        ]
      }
    },
    "/api/agents/{agent_id}": {
      "delete": {
        "operationId": "delete_agent_api_agents__agent_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Agent",
        "tags": [
          "backend",
          "agents"
        ]
      },
      "get": {
        "operationId": "get_agent_api_agents__agent_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "agent_id",
            "required": true,
            "schema": {
              "title": "Agent Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Agent",
        "tags": [
          "backend",
          "agents"
        ]
      }
    },
    "/api/orchestrate": {
      "post": {
        "description": "Execute orchestration with multiple agents.\n\nSupports two modes:\n- Sequential pipeline (default): Linear 4-phase execution\n- Graph-based state machine (use_graph=True): LangGraph-style topology with\n  conditional transitions, backtracking support, and explicit state management",
        "operationId": "run_orchestration_api_orchestrate_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrchestrationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrchestrationResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Run Orchestration",
        "tags": [
          "backend",
          "orchestration"
        ]
      }
    },
    "/clarify/reply": {
      "post": {
        "description": "Forward a user's clarification answer to a paused ProductFeedbackWorkflow.\n\n074-C reply path: Hermes captures the user's Slack-thread reply and POSTs it\nhere; we signal the named workflow's ``clarification_reply`` handler so its\nbounded clarification loop can resume. Harmless if the workflow already\nadvanced or completed (signalling a finished workflow is a no-op error we\nsurface as 200 with ``signaled=False`` only on a missing handle).\n\nBody (JSON):\n    workflow_id  str   required — the Temporal ProductFeedbackWorkflow id\n    answer       str   required — the user's reply text\n    question     str   optional — the question it answers (forwarded for context)\n\nSecurity: same ``LINEAR_WEBHOOK_SECRET`` HMAC + ``Linear-Signature`` header as\nthe other authenticated routes; in-VPC only (Cloud Map).\n\nReturns ``{\"received\": True, \"workflow_id\": <id>}``; 422 when a required\nfield is missing.",
        "operationId": "clarify_reply_clarify_reply_post",
        "parameters": [
          {
            "in": "header",
            "name": "Linear-Signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Linear-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Clarify Reply Clarify Reply Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Clarify Reply",
        "tags": [
          "sensors"
        ]
      }
    },
    "/health": {
      "get": {
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Health",
        "tags": [
          "backend",
          "health"
        ]
      }
    },
    "/healthz": {
      "get": {
        "description": "Liveness check used by uvicorn + future Fargate health probes.",
        "operationId": "healthz_healthz_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Healthz Healthz Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Healthz",
        "tags": [
          "sensors"
        ]
      }
    },
    "/linear/webhook": {
      "post": {
        "description": "Receive a Linear webhook → signal the drainTierGraph workflow.\n\nReturns a small JSON body so an operator hitting curl can see what\nhappened. Returns 200 even when the event is ignored (not an\nissue.update or status != Done) so Linear doesn't retry pointlessly.",
        "operationId": "linear_webhook_linear_webhook_post",
        "parameters": [
          {
            "in": "header",
            "name": "Linear-Signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Linear-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Linear Webhook Linear Webhook Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Linear Webhook",
        "tags": [
          "sensors"
        ]
      }
    },
    "/plan/decompose": {
      "post": {
        "description": "Decompose a completed spec into Linear issues; optionally signal the drain.\n\nBody (JSON):\n    goal             str   required — the COMPLETE spec string. The caller\n                                      (e.g. the /build:plan-lifecycle command)\n                                      authors the full spec upstream and folds\n                                      success criteria / constraints / repos /\n                                      operator INTO this string before posting.\n    plan_id          str   required — e.g. ``\"hub-058\"``\n    repo             str   required — git remote URL\n    ref              str   required — git ref (e.g. ``\"main\"``)\n    budget_usd       float optional — approved spend ceiling; when present\n                                      the drain is signalled to refill\n\nNB: this route consumes ONLY the fields above. There are no separately-parsed\n``success_criteria`` / ``constraints`` / ``operator`` / ``repos`` fields — an\nearlier docstring advertised them as \"forwarded to spec\", but no code read\nthem and no caller sends them discretely (they live inside ``goal``). Any extra\nkeys in the body are ignored. Per-dimension intake is the caller's job\n(registry/spec_intake), not this seam's.\n\nSecurity: same ``LINEAR_WEBHOOK_SECRET`` + ``Linear-Signature`` HMAC as\nthe ``/linear/webhook`` route.  In-VPC only (Cloud Map); HMAC is\ndefense-in-depth not the perimeter.\n\nReturns:\n    ``{\"created_issue_ids\": [...], \"phase_ids\": [...], \"signaled\": bool}``\n\nError codes mirror the webhook handler:\n    503 — ``LINEAR_WEBHOOK_SECRET`` unset\n    401 — bad or missing signature\n    422 — missing required fields (plan_id, repo, ref, goal)",
        "operationId": "plan_decompose_plan_decompose_post",
        "parameters": [
          {
            "in": "header",
            "name": "Linear-Signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Linear-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Plan Decompose Plan Decompose Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Plan Decompose",
        "tags": [
          "sensors"
        ]
      }
    },
    "/runs": {
      "get": {
        "description": "AGE-235 — list recent runs (read-only).\n\nEach run is one ``RunRecord`` spine (``run_id`` == the drain correlation id).\nReturns the latest record's summary per run (kind, producer, status, plan_id,\nphase_id, started/ended, spend, pr_url), newest-first by ``ended``.\n\nREAD-ONLY: only reads ``record.json`` from the artifact store. Optional bearer\nvia ``WORK_READ_API_TOKEN``; in-VPC posture otherwise. Returns\n``{count, runs:[...]}``; ``runs`` is empty when no runs exist yet.",
        "operationId": "runs_runs_get",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Runs Runs Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Runs",
        "tags": [
          "sensors"
        ]
      }
    },
    "/runs/{run_id}": {
      "get": {
        "description": "AGE-235 — one run's detail: every phase record + aggregates (read-only).\n\nReturns the run's manifest (all ``RunRecord``s under this ``run_id`` — its\nphases, statuses, PRs, spend, ac_met_count, notes), the ``plan_id`` (deep-link\nto its task-DAG via ``GET /work/dag?plan=``), and aggregates (phase_count,\ntotal_spend_usd, statuses). 404 when the run is unknown.\n\nNOTE: the raw phase *spec* text is not stored on the RunRecord (it lives in the\nwork-item body / staged S3 phase spec); the run surfaces ``plan_id`` so the UI\nlinks to the DAG instead.",
        "operationId": "run_detail_runs__run_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Run Detail Runs  Run Id  Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Run Detail",
        "tags": [
          "sensors"
        ]
      }
    },
    "/runs/{run_id}/bundle": {
      "get": {
        "description": "AGE-235 — the per-run artifact-bundle URL (read-only).\n\nReturns a presigned GET URL to the run's ``manifest.json`` (the durable index of\nevery record + its ``artifact_keys``) as the bundle entry point, plus the\naggregated ``artifact_keys`` the run produced. S3 prefixes can't be presigned as\none object, so the manifest IS the bundle handle. On the LocalFs backend (tests/\ndev) there is no presigning: ``bundle_url`` is ``None`` and ``presigned`` False,\nbut ``artifact_keys`` are still listed. 404 when the run is unknown.",
        "operationId": "run_bundle_runs__run_id__bundle_get",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "expires",
            "required": false,
            "schema": {
              "default": 3600,
              "title": "Expires",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Run Bundle Runs  Run Id  Bundle Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Run Bundle",
        "tags": [
          "sensors"
        ]
      }
    },
    "/work": {
      "post": {
        "description": "#34 — the natural-language front-door: a Slack sentence → a drainable plan.\n\nWhere ``/plan/decompose`` is for a *pre-authored* spec (explicit plan_id +\nrepo), ``/work`` is for a *bare sentence*: only ``goal`` is required. The\nplan_id is auto-derived (idempotently from the goal text), no repo is needed,\nand ``route_repos=True`` is forced so the decomposer routes each phase to its\nown repo. It reuses the same ``DecomposeAndDispatchWorkflow`` on the drain\nqueue, so the heavy decompose runs on the credentialed worker, not here.\n\nBody (JSON):\n    goal       str   required — the natural-language request (one sentence)\n    budget_usd float optional — surfaced for drain-signal gating\n    plan_id    str   optional — override the auto-derived ``work-<hash>`` id\n\nSecurity: same ``LINEAR_WEBHOOK_SECRET`` HMAC + ``Linear-Signature`` header as\n``/plan/decompose``; in-VPC only (Cloud Map), HMAC is defense-in-depth.\n\nSAFETY: this only *files* drainable ``[phase]`` issues (Todo). It never\nexecutes or merges anything — execution stays gated behind the supervised\ndrain (the operator triggers it). Filing ≠ executing.\n\nReturns ``{\"accepted\", \"plan_id\", \"workflow_id\", \"message\"}``. 503/401/422 as\nfor ``/plan/decompose``; 422 when ``goal`` is missing.",
        "operationId": "work_work_post",
        "parameters": [
          {
            "in": "header",
            "name": "Linear-Signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Linear-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Work Work Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Work",
        "tags": [
          "sensors"
        ]
      }
    },
    "/work/approve": {
      "post": {
        "description": "Approve a paused workflow (e.g. a human-gate checkpoint).\n\nSends an ``approve`` signal to the named Temporal workflow so it can\nproceed past a human-gate activity. Idempotent: signalling an already-\nrunning (or already-approved) workflow is harmless.\n\nBody (JSON):\n    workflow_id  str   required — the Temporal workflow id to signal\n    comment      str   optional — operator note (logged, not forwarded)\n\nSecurity: same ``LINEAR_WEBHOOK_SECRET`` HMAC + ``Linear-Signature`` header\nas ``/plan/decompose`` and ``/work``; in-VPC only (Cloud Map).\n\nReturns ``{\"approved\": True, \"workflow_id\": <id>}``.\n503/401/422 as for ``/plan/decompose``; 422 when ``workflow_id`` is missing.",
        "operationId": "work_approve_work_approve_post",
        "parameters": [
          {
            "in": "header",
            "name": "Linear-Signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Linear-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Work Approve Work Approve Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Work Approve",
        "tags": [
          "sensors"
        ]
      }
    },
    "/work/dag": {
      "get": {
        "description": "AGE-234 — read-only task-DAG view for the Atlas Admin UI.\n\nWithout ``?plan=``: returns the plans available to visualize\n(``{team, plans:[{plan_id, phase_count}]}``).\n\nWith ``?plan=<plan_id>``: returns that plan's DAG — ``nodes`` (the drainable\n``[phase]`` items with status/tier/repo/planner) + ``edges`` (the\n``depends-on:`` prerequisite relations). Shows HOW work was decomposed (and,\nwhen stamped, by which planner).\n\nREAD-ONLY: only ``list_existing_issues`` is touched (via ``work_ls.build_dag`` /\n``list_plans``) — it cannot change work or runs. Team/auth resolution mirrors\n``GET /work/items``. 401 on a bad token (when configured); 404 on an\nunresolvable team.\n\nNOTE: planner provenance is ``None`` for every phase today — the decomposition\ndoes not yet stamp a ``planner:`` label (see ``_planner_of``); surfaced for free\nonce it does.",
        "operationId": "work_dag_work_dag_get",
        "parameters": [
          {
            "in": "query",
            "name": "plan",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Plan"
            }
          },
          {
            "in": "query",
            "name": "team",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Team"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Work Dag Work Dag Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Work Dag",
        "tags": [
          "sensors"
        ]
      }
    },
    "/work/items": {
      "get": {
        "description": "AGE-233 — read-only work-items view for the Atlas Admin UI.\n\nReturns each work item in the team with its resolved dependencies (the\n``depends-on:<phase_id>`` labels resolved to each dep's current state), the\nparent epic/project it belongs to, and the workflow metadata the drain\nencodes as labels (tier, tags, drainable). Optional ``state``/``tier``/\n``label`` filters + ``phases_only`` mirror the ``work ls`` CLI.\n\nREAD-ONLY: it only calls ``list_existing_issues`` (via ``work_ls.build_view``)\nand never a mutating method — it cannot change work or runs.\n\nTeam: ``?team=`` overrides; otherwise ``ORCHESTRATOR_WORKSPACE_TEAM_ID``.\n\nSecurity: in-VPC only (Cloud Map, no public ingress). If\n``WORK_READ_API_TOKEN`` is set, a matching ``Authorization: Bearer`` is\nrequired (defense-in-depth); otherwise open, like ``/healthz``.\n\nReturns ``{\"team\", \"count\", \"items\": [...]}``. 401 on a bad token (when one is\nconfigured), 404 when the team can't be resolved.",
        "operationId": "work_items_work_items_get",
        "parameters": [
          {
            "in": "query",
            "name": "team",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Team"
            }
          },
          {
            "in": "query",
            "name": "state",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "State"
            }
          },
          {
            "in": "query",
            "name": "tier",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tier"
            }
          },
          {
            "in": "query",
            "name": "label",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Label"
            }
          },
          {
            "in": "query",
            "name": "phases_only",
            "required": false,
            "schema": {
              "default": false,
              "title": "Phases Only",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Work Items Work Items Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Work Items",
        "tags": [
          "sensors"
        ]
      }
    },
    "/work/progress": {
      "post": {
        "description": "workux-C — forward an incremental progress update to a running drain workflow.\n\nAn in-flight ``executePhase`` child (or any other caller with the shared\nsecret) can POST here to append a one-line progress note to the drain's\nin-memory ``_progress_log``.  The drain workflow receives the note via its\n``report_progress`` signal handler and logs it to Temporal workflow history.\n\nBody (JSON):\n    workflow_id  str   required — the Temporal drain workflow id to signal\n                                  (typically ``\"drain-tier-graph\"``)\n    phase_id     str   required — the phase whose progress is being reported\n    message      str   required — one-line free-text progress note\n\nSecurity: same ``LINEAR_WEBHOOK_SECRET`` HMAC + ``Linear-Signature`` header\nas ``/work/approve``; in-VPC only (Cloud Map), HMAC is defense-in-depth.\n\nReturns ``{\"reported\": True, \"workflow_id\": <id>, \"phase_id\": <id>}``.\n503/401/422 as for ``/plan/decompose``; 422 when any required field is missing.",
        "operationId": "work_progress_work_progress_post",
        "parameters": [
          {
            "in": "header",
            "name": "Linear-Signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Linear-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Work Progress Work Progress Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Work Progress",
        "tags": [
          "sensors"
        ]
      }
    }
  },
  "tags": [
    {
      "description": "orchestrator.work_store.sensors:app — work-store sensor API",
      "name": "sensors"
    },
    {
      "description": "backend.main:app — dashboard-facing backend",
      "name": "backend"
    }
  ]
}