{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.example.com/machines/consumer/v1/machines-consumer.schema.json",
  "title": "@hasna/machines consumer contract schema bundle",
  "type": "object",
  "$defs": {
    "cacheability": {
      "type": "object",
      "required": [
        "observed_at",
        "verified_at",
        "expires_at",
        "ttl_ms",
        "source_authority",
        "confidence",
        "cacheable",
        "stale",
        "reasons"
      ],
      "properties": {
        "observed_at": {
          "type": "string",
          "format": "date-time"
        },
        "verified_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "expires_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "ttl_ms": {
          "type": [
            "number",
            "null"
          ]
        },
        "source_authority": {
          "enum": [
            "machines",
            "open-machines",
            "manifest",
            "manifest_metadata",
            "live_topology",
            "argument",
            "inferred",
            "fallback",
            "unresolved",
            "mixed",
            "unknown"
          ]
        },
        "confidence": {
          "enum": [
            "exact",
            "high",
            "medium",
            "low",
            "none"
          ]
        },
        "cacheable": {
          "type": "boolean"
        },
        "stale": {
          "type": "boolean"
        },
        "reasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "contract": {
      "type": "object",
      "required": [
        "schema_version",
        "package_name",
        "entrypoint",
        "schema_uri",
        "schema_artifact",
        "capabilities",
        "field_capabilities",
        "cacheability",
        "envelopes",
        "stable_exports"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package_name": {
          "const": "@hasna/machines"
        },
        "entrypoint": {
          "const": "@hasna/machines/consumer"
        },
        "schema_uri": {
          "const": "https://schemas.example.com/machines/consumer/v1/machines-consumer.schema.json"
        },
        "schema_artifact": {
          "const": "schemas/machines-consumer.schema.json"
        },
        "capabilities": {
          "type": "object"
        },
        "field_capabilities": {
          "type": "object"
        },
        "cacheability": {
          "type": "object"
        },
        "envelopes": {
          "type": "array",
          "items": {
            "enum": [
              "topology",
              "route",
              "workspace",
              "compatibility",
              "resolver_snapshot",
              "project_assignments",
              "note_machine_context",
              "machine_trash_policies",
              "machine_details",
              "browserplan_fleet",
              "machine_health",
              "routing",
              "command_matrix",
              "loop_preflight"
            ]
          }
        },
        "stable_exports": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "agent_artifact_ref": {
      "type": "object",
      "required": [
        "kind",
        "ref",
        "format",
        "private"
      ],
      "properties": {
        "kind": {
          "enum": [
            "topology",
            "route",
            "workspace",
            "compatibility",
            "doctor",
            "command_matrix",
            "machine_health"
          ]
        },
        "ref": {
          "type": "string"
        },
        "format": {
          "enum": [
            "json",
            "text"
          ]
        },
        "private": {
          "type": "boolean"
        }
      }
    },
    "agent_detail_refs": {
      "type": "object",
      "required": [
        "cli",
        "mcp",
        "sdk"
      ],
      "properties": {
        "cli": {
          "type": "string"
        },
        "mcp": {
          "type": "string"
        },
        "sdk": {
          "type": "string"
        }
      }
    },
    "agent_summary": {
      "type": "object",
      "required": [
        "total",
        "ready",
        "degraded",
        "blocked",
        "unknown"
      ],
      "properties": {
        "total": {
          "type": "number"
        },
        "ready": {
          "type": "number"
        },
        "degraded": {
          "type": "number"
        },
        "blocked": {
          "type": "number"
        },
        "unknown": {
          "type": "number"
        }
      }
    },
    "agent_command_ref": {
      "type": "object",
      "required": [
        "provided",
        "preview",
        "sha256",
        "length",
        "redacted"
      ],
      "properties": {
        "provided": {
          "type": "boolean"
        },
        "preview": {
          "type": "string"
        },
        "sha256": {
          "type": [
            "string",
            "null"
          ]
        },
        "length": {
          "type": "number"
        },
        "redacted": {
          "type": "boolean"
        }
      }
    },
    "command_matrix_plan": {
      "type": "object",
      "required": [
        "intent",
        "label",
        "placeholder",
        "command_ref",
        "local_shell",
        "cli",
        "mcp",
        "sdk",
        "private_shell_command"
      ],
      "properties": {
        "intent": {
          "enum": [
            "placeholder",
            "provided"
          ]
        },
        "label": {
          "type": "string"
        },
        "placeholder": {
          "const": "<loop-command>"
        },
        "command_ref": {
          "$ref": "#/$defs/agent_command_ref"
        },
        "local_shell": {
          "type": [
            "string",
            "null"
          ]
        },
        "cli": {
          "type": "string"
        },
        "mcp": {
          "type": "object",
          "required": [
            "tool",
            "args"
          ],
          "properties": {
            "tool": {
              "const": "machines_ssh_resolve"
            },
            "args": {
              "type": "object",
              "required": [
                "machine_id",
                "remote_command",
                "private_metadata"
              ],
              "properties": {
                "machine_id": {
                  "type": "string"
                },
                "remote_command": {
                  "type": "string"
                },
                "private_metadata": {
                  "const": false
                }
              }
            }
          }
        },
        "sdk": {
          "type": "string"
        },
        "private_shell_command": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "command_execution_probe": {
      "type": "object",
      "required": [
        "checked",
        "ready",
        "status",
        "source",
        "exit_code"
      ],
      "properties": {
        "checked": {
          "type": "boolean"
        },
        "ready": {
          "type": "boolean"
        },
        "status": {
          "enum": [
            "ready",
            "route_unavailable",
            "authentication_denied",
            "timed_out",
            "failed"
          ]
        },
        "source": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "exit_code": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    },
    "machine_health_row": {
      "type": "object",
      "required": [
        "machine_id",
        "display_name",
        "status",
        "ok",
        "route",
        "confidence",
        "local",
        "heartbeat",
        "checks",
        "issues",
        "warnings",
        "detail_refs"
      ],
      "properties": {
        "machine_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "status": {
          "enum": [
            "ready",
            "degraded",
            "blocked",
            "unknown"
          ]
        },
        "ok": {
          "type": "boolean"
        },
        "route": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "confidence": {
          "enum": [
            "exact",
            "high",
            "medium",
            "low",
            "none"
          ]
        },
        "local": {
          "type": "boolean"
        },
        "heartbeat": {
          "type": "string"
        },
        "checks": {
          "type": "object"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "detail_refs": {
          "$ref": "#/$defs/agent_detail_refs"
        }
      }
    },
    "routing_row": {
      "type": "object",
      "required": [
        "machine_id",
        "display_name",
        "ok",
        "route",
        "source",
        "confidence",
        "local",
        "heartbeat",
        "cacheable",
        "target",
        "command_target",
        "warnings",
        "detail_refs"
      ],
      "properties": {
        "machine_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "ok": {
          "type": "boolean"
        },
        "route": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "source": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "confidence": {
          "enum": [
            "exact",
            "high",
            "medium",
            "low",
            "none"
          ]
        },
        "local": {
          "type": "boolean"
        },
        "heartbeat": {
          "type": "string"
        },
        "cacheable": {
          "type": "boolean"
        },
        "target": {
          "type": [
            "string",
            "null"
          ]
        },
        "command_target": {
          "type": [
            "string",
            "null"
          ]
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "detail_refs": {
          "$ref": "#/$defs/agent_detail_refs"
        }
      }
    },
    "command_matrix_row": {
      "type": "object",
      "required": [
        "machine_id",
        "display_name",
        "can_run",
        "readiness",
        "route",
        "source",
        "confidence",
        "local",
        "command",
        "blocked_by",
        "warnings",
        "detail_refs"
      ],
      "properties": {
        "machine_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "can_run": {
          "type": "boolean"
        },
        "readiness": {
          "enum": [
            "ready",
            "degraded",
            "blocked",
            "unknown"
          ]
        },
        "route": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "source": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "confidence": {
          "enum": [
            "exact",
            "high",
            "medium",
            "low",
            "none"
          ]
        },
        "local": {
          "type": "boolean"
        },
        "execution": {
          "$ref": "#/$defs/command_execution_probe"
        },
        "command": {
          "$ref": "#/$defs/command_matrix_plan"
        },
        "blocked_by": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "detail_refs": {
          "$ref": "#/$defs/agent_detail_refs"
        }
      }
    },
    "loop_preflight_machine": {
      "type": "object",
      "required": [
        "machine_id",
        "display_name",
        "ready",
        "status",
        "can_run",
        "route",
        "confidence",
        "local",
        "heartbeat",
        "blocked_by",
        "warnings",
        "next_steps",
        "detail_refs"
      ],
      "properties": {
        "machine_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "ready": {
          "type": "boolean"
        },
        "status": {
          "enum": [
            "ready",
            "degraded",
            "blocked",
            "unknown"
          ]
        },
        "can_run": {
          "type": "boolean"
        },
        "route": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "confidence": {
          "enum": [
            "exact",
            "high",
            "medium",
            "low",
            "none"
          ]
        },
        "local": {
          "type": "boolean"
        },
        "heartbeat": {
          "type": "string"
        },
        "blocked_by": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "next_steps": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "detail_refs": {
          "$ref": "#/$defs/agent_detail_refs"
        }
      }
    },
    "machine_health": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "kind",
        "pagination",
        "summary",
        "machines",
        "artifacts",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "kind": {
          "const": "machine_health"
        },
        "pagination": {
          "type": "object"
        },
        "summary": {
          "$ref": "#/$defs/agent_summary"
        },
        "machines": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/machine_health_row"
          }
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agent_artifact_ref"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "routing": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "kind",
        "pagination",
        "summary",
        "routes",
        "artifacts",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "kind": {
          "const": "routing"
        },
        "pagination": {
          "type": "object"
        },
        "summary": {
          "type": "object",
          "required": [
            "total",
            "routable",
            "local",
            "remote",
            "unroutable"
          ],
          "properties": {
            "total": {
              "type": "number"
            },
            "routable": {
              "type": "number"
            },
            "local": {
              "type": "number"
            },
            "remote": {
              "type": "number"
            },
            "unroutable": {
              "type": "number"
            }
          }
        },
        "routes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/routing_row"
          }
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agent_artifact_ref"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "command_matrix": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "kind",
        "mode",
        "pagination",
        "summary",
        "commands",
        "artifacts",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "kind": {
          "const": "command_matrix"
        },
        "mode": {
          "const": "plan"
        },
        "pagination": {
          "type": "object"
        },
        "summary": {
          "type": "object",
          "required": [
            "total",
            "runnable",
            "blocked",
            "local",
            "remote"
          ],
          "properties": {
            "total": {
              "type": "number"
            },
            "runnable": {
              "type": "number"
            },
            "blocked": {
              "type": "number"
            },
            "local": {
              "type": "number"
            },
            "remote": {
              "type": "number"
            }
          }
        },
        "commands": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/command_matrix_row"
          }
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agent_artifact_ref"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "loop_preflight": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "kind",
        "mode",
        "selection_mode",
        "ok",
        "pagination",
        "summary",
        "machines",
        "artifacts",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "kind": {
          "const": "loop_preflight"
        },
        "mode": {
          "const": "plan"
        },
        "selection_mode": {
          "enum": [
            "explicit",
            "discovered"
          ]
        },
        "ok": {
          "type": "boolean"
        },
        "pagination": {
          "type": "object"
        },
        "summary": {
          "type": "object",
          "required": [
            "total",
            "ready",
            "degraded",
            "blocked",
            "unknown",
            "runnable",
            "any_ready",
            "all_ready"
          ],
          "properties": {
            "total": {
              "type": "number"
            },
            "ready": {
              "type": "number"
            },
            "degraded": {
              "type": "number"
            },
            "blocked": {
              "type": "number"
            },
            "unknown": {
              "type": "number"
            },
            "runnable": {
              "type": "number"
            },
            "any_ready": {
              "type": "boolean"
            },
            "all_ready": {
              "type": "boolean"
            }
          }
        },
        "machines": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/loop_preflight_machine"
          }
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agent_artifact_ref"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "browserplan_fleet": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "kind",
        "target",
        "coverage",
        "operation_contract",
        "machines",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "kind": {
          "const": "browserplan_fleet"
        },
        "target": {
          "type": "object",
          "required": [
            "name",
            "owner",
            "machine_ids",
            "excluded_machine_ids",
            "install_target_excludes"
          ],
          "properties": {
            "name": {
              "const": "browserplan-machine001-machine011"
            },
            "owner": {
              "const": "open-chrome"
            },
            "machine_ids": {
              "const": [
                "machine001",
                "machine002",
                "machine003",
                "machine004",
                "machine005",
                "machine006",
                "machine007",
                "machine008",
                "machine009",
                "machine010",
                "machine011"
              ]
            },
            "excluded_machine_ids": {
              "const": [
                "spark01",
                "spark02"
              ]
            },
            "install_target_excludes": {
              "const": [
                "spark01",
                "spark02"
              ]
            }
          }
        },
        "coverage": {
          "type": "object",
          "required": [
            "expected",
            "returned",
            "known",
            "missing",
            "unreachable",
            "excluded_requested"
          ],
          "properties": {
            "expected": {
              "type": "number"
            },
            "returned": {
              "type": "number"
            },
            "known": {
              "type": "number"
            },
            "missing": {
              "type": "array",
              "items": {
                "enum": [
                  "machine001",
                  "machine002",
                  "machine003",
                  "machine004",
                  "machine005",
                  "machine006",
                  "machine007",
                  "machine008",
                  "machine009",
                  "machine010",
                  "machine011"
                ]
              }
            },
            "unreachable": {
              "type": "array",
              "items": {
                "enum": [
                  "machine001",
                  "machine002",
                  "machine003",
                  "machine004",
                  "machine005",
                  "machine006",
                  "machine007",
                  "machine008",
                  "machine009",
                  "machine010",
                  "machine011"
                ]
              }
            },
            "excluded_requested": {
              "type": "array",
              "items": {
                "enum": [
                  "spark01",
                  "spark02"
                ]
              }
            }
          }
        },
        "operation_contract": {
          "type": "object",
          "required": [
            "command_owner",
            "route_owner",
            "default_timeout_ms",
            "private_route_policy",
            "supported_operations",
            "stable_surfaces"
          ],
          "properties": {
            "command_owner": {
              "const": "open-chrome"
            },
            "route_owner": {
              "enum": [
                "machines",
                "open-machines"
              ]
            },
            "default_timeout_ms": {
              "type": "number"
            },
            "private_route_policy": {
              "const": "private targets are omitted unless caller explicitly requests private metadata on a trusted local operator surface"
            },
            "supported_operations": {
              "const": [
                "profile_setup",
                "headed_launch",
                "headless_launch",
                "daemon_status",
                "supervisor_status",
                "tab_inventory",
                "session_inventory",
                "app_install_update"
              ]
            },
            "stable_surfaces": {
              "type": "object",
              "required": [
                "sdk",
                "cli",
                "api",
                "mcp"
              ],
              "properties": {
                "sdk": {
                  "const": "getBrowserPlanFleet"
                },
                "cli": {
                  "const": "machines browserplan fleet --json"
                },
                "api": {
                  "const": "/api/browserplan/fleet"
                },
                "mcp": {
                  "const": "machines_browserplan_fleet"
                }
              }
            }
          }
        },
        "machines": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "machine_id",
              "slug",
              "display_name",
              "displayName",
              "known",
              "eligible",
              "status",
              "reachability",
              "install_state",
              "operation_hooks",
              "warnings"
            ],
            "properties": {
              "machine_id": {
                "enum": [
                  "machine001",
                  "machine002",
                  "machine003",
                  "machine004",
                  "machine005",
                  "machine006",
                  "machine007",
                  "machine008",
                  "machine009",
                  "machine010",
                  "machine011"
                ]
              },
              "slug": {
                "enum": [
                  "machine001",
                  "machine002",
                  "machine003",
                  "machine004",
                  "machine005",
                  "machine006",
                  "machine007",
                  "machine008",
                  "machine009",
                  "machine010",
                  "machine011"
                ]
              },
              "friendly_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "friendlyName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "display_name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "known": {
                "type": "boolean"
              },
              "eligible": {
                "type": "boolean"
              },
              "eligibility_reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "platform": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "os": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "user": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workspace": {
                "type": "object"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "object",
                "required": [
                  "state",
                  "label",
                  "online"
                ],
                "properties": {
                  "state": {
                    "enum": [
                      "online",
                      "offline",
                      "unknown"
                    ]
                  },
                  "label": {
                    "enum": [
                      "Online",
                      "Offline",
                      "Unknown"
                    ]
                  },
                  "online": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                }
              },
              "reachability": {
                "type": "object",
                "required": [
                  "ok",
                  "route",
                  "source",
                  "confidence",
                  "local",
                  "tailscale_online",
                  "cacheable",
                  "warnings"
                ],
                "properties": {
                  "ok": {
                    "type": "boolean"
                  },
                  "route": {
                    "enum": [
                      "local",
                      "lan",
                      "tailscale",
                      "ssh",
                      "unknown"
                    ]
                  },
                  "source": {
                    "enum": [
                      "local",
                      "lan",
                      "tailscale",
                      "ssh",
                      "unknown"
                    ]
                  },
                  "confidence": {
                    "enum": [
                      "exact",
                      "high",
                      "medium",
                      "low",
                      "none"
                    ]
                  },
                  "local": {
                    "type": "boolean"
                  },
                  "tailscale_online": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "cacheable": {
                    "type": "boolean"
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "install_state": {
                "type": "object",
                "required": [
                  "checked",
                  "source",
                  "browserplan_cli",
                  "machines_cli",
                  "bun",
                  "git",
                  "node",
                  "chrome",
                  "warnings"
                ],
                "properties": {
                  "checked": {
                    "type": "boolean"
                  },
                  "source": {
                    "enum": [
                      "compatibility",
                      "not_checked",
                      "failed"
                    ]
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "operation_hooks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "label",
                    "description",
                    "owner",
                    "available",
                    "readiness",
                    "required_capabilities",
                    "blocked_by",
                    "command_template",
                    "command_placeholders",
                    "safe_runner"
                  ],
                  "properties": {
                    "id": {
                      "enum": [
                        "profile_setup",
                        "headed_launch",
                        "headless_launch",
                        "daemon_status",
                        "supervisor_status",
                        "tab_inventory",
                        "session_inventory",
                        "app_install_update"
                      ]
                    },
                    "owner": {
                      "const": "open-chrome"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "readiness": {
                      "enum": [
                        "ready",
                        "blocked",
                        "unknown"
                      ]
                    },
                    "required_capabilities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "blocked_by": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "command_template": {
                      "type": "string"
                    },
                    "command_placeholders": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "safe_runner": {
                      "type": "object",
                      "required": [
                        "sdk",
                        "cli",
                        "mcp",
                        "ownership"
                      ],
                      "properties": {
                        "mcp": {
                          "type": "object",
                          "required": [
                            "tool",
                            "args",
                            "private_metadata_note"
                          ],
                          "properties": {
                            "tool": {
                              "const": "machines_ssh_resolve"
                            },
                            "args": {
                              "type": "object",
                              "required": [
                                "machine_id",
                                "remote_command",
                                "private_metadata"
                              ],
                              "properties": {
                                "machine_id": {
                                  "enum": [
                                    "machine001",
                                    "machine002",
                                    "machine003",
                                    "machine004",
                                    "machine005",
                                    "machine006",
                                    "machine007",
                                    "machine008",
                                    "machine009",
                                    "machine010",
                                    "machine011"
                                  ]
                                },
                                "remote_command": {
                                  "const": "<browserplan-owned command>"
                                },
                                "private_metadata": {
                                  "const": false
                                }
                              }
                            },
                            "private_metadata_note": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "machine_details": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "machine_id",
        "slug",
        "display_name",
        "displayName",
        "known",
        "status",
        "timestamps",
        "source",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "machine_id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "friendly_name": {
          "type": "string"
        },
        "friendlyName": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "displayName": {
          "type": "string"
        },
        "known": {
          "type": "boolean"
        },
        "status": {
          "type": "object",
          "required": [
            "state",
            "label",
            "online"
          ],
          "properties": {
            "state": {
              "enum": [
                "online",
                "offline",
                "unknown"
              ]
            },
            "label": {
              "enum": [
                "Online",
                "Offline",
                "Unknown"
              ]
            },
            "online": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "last_seen_at": {
              "type": "string",
              "format": "date-time"
            },
            "last_heartbeat_at": {
              "type": "string",
              "format": "date-time"
            }
          }
        },
        "platform": {
          "type": "string"
        },
        "machine_type": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "machine_capabilities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "last_seen_at": {
          "type": "string",
          "format": "date-time"
        },
        "timestamps": {
          "type": "object",
          "properties": {
            "updated_at": {
              "type": "string",
              "format": "date-time"
            },
            "last_seen_at": {
              "type": "string",
              "format": "date-time"
            },
            "last_heartbeat_at": {
              "type": "string",
              "format": "date-time"
            },
            "last_tailscale_seen_at": {
              "type": "string",
              "format": "date-time"
            },
            "recent_sync_at": {
              "type": "string",
              "format": "date-time"
            },
            "recent_sync_status": {
              "type": "string"
            },
            "storage_sync_status": {
              "type": "string"
            }
          }
        },
        "source": {
          "type": "object",
          "required": [
            "authority",
            "metadata_source",
            "manifest_declared",
            "heartbeat_present",
            "topology_entry",
            "local"
          ],
          "properties": {
            "authority": {
              "enum": [
                "machines",
                "open-machines"
              ]
            },
            "metadata_source": {
              "enum": [
                "manifest_metadata",
                "heartbeat",
                "topology",
                "registry",
                "fallback"
              ]
            },
            "manifest_declared": {
              "type": "boolean"
            },
            "heartbeat_present": {
              "type": "boolean"
            },
            "topology_entry": {
              "type": "boolean"
            },
            "local": {
              "type": "boolean"
            }
          }
        },
        "display_metadata": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "note_machine_reference": {
      "type": "object",
      "required": [
        "machine_id",
        "friendly_name",
        "display_name",
        "updated_at",
        "role",
        "known",
        "manifest_declared"
      ],
      "properties": {
        "machine_id": {
          "type": "string"
        },
        "friendly_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "display_name": {
          "type": "string"
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "role": {
          "enum": [
            "origin",
            "source",
            "target",
            "sync_target",
            "trash_owner"
          ]
        },
        "known": {
          "type": "boolean"
        },
        "manifest_declared": {
          "type": "boolean"
        }
      }
    },
    "note_actor_context": {
      "type": "object",
      "required": [
        "actor_type",
        "actor_id",
        "actor_name",
        "agent_id",
        "agent_name",
        "source",
        "display_name"
      ],
      "properties": {
        "actor_type": {
          "enum": [
            "human",
            "agent",
            "system",
            "unknown"
          ]
        },
        "actor_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "actor_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "agent_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "agent_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "enum": [
            "notes",
            "open-notes",
            "agent",
            "sync",
            "import",
            "machines",
            "open-machines",
            "unknown"
          ]
        },
        "display_name": {
          "type": "string"
        }
      }
    },
    "note_machine_context": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "origin_machine_id",
        "source_machine_id",
        "target_machine_id",
        "origin_machine",
        "source_machine",
        "target_machine",
        "sync_target_machine_ids",
        "sync_targets",
        "actor",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "origin_machine_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_machine_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "target_machine_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "origin_machine": {
          "anyOf": [
            {
              "$ref": "#/$defs/note_machine_reference"
            },
            {
              "type": "null"
            }
          ]
        },
        "source_machine": {
          "anyOf": [
            {
              "$ref": "#/$defs/note_machine_reference"
            },
            {
              "type": "null"
            }
          ]
        },
        "target_machine": {
          "anyOf": [
            {
              "$ref": "#/$defs/note_machine_reference"
            },
            {
              "type": "null"
            }
          ]
        },
        "sync_target_machine_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sync_targets": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "machine_id",
              "machine"
            ],
            "properties": {
              "machine_id": {
                "type": "string"
              },
              "machine": {
                "$ref": "#/$defs/note_machine_reference"
              }
            }
          }
        },
        "actor": {
          "$ref": "#/$defs/note_actor_context"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "machine_trash_policy": {
      "type": "object",
      "required": [
        "machine_id",
        "friendly_name",
        "display_name",
        "updated_at",
        "enabled",
        "retention_days",
        "delete_after_days",
        "trash_path",
        "source",
        "metadata_keys"
      ],
      "properties": {
        "machine_id": {
          "type": "string"
        },
        "friendly_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "display_name": {
          "type": "string"
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "enabled": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "retention_days": {
          "type": [
            "number",
            "null"
          ]
        },
        "delete_after_days": {
          "type": [
            "number",
            "null"
          ]
        },
        "trash_path": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "enum": [
            "manifest_metadata",
            "default"
          ]
        },
        "metadata_keys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "machine_trash_policies": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "pagination",
        "policies",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "pagination": {
          "type": "object",
          "required": [
            "limit",
            "offset",
            "total",
            "count",
            "hasMore",
            "nextOffset",
            "has_more",
            "next_offset",
            "order"
          ],
          "properties": {
            "limit": {
              "type": [
                "number",
                "null"
              ]
            },
            "offset": {
              "type": "number"
            },
            "total": {
              "type": "number"
            },
            "count": {
              "type": "number"
            },
            "hasMore": {
              "type": "boolean"
            },
            "nextOffset": {
              "type": [
                "number",
                "null"
              ]
            },
            "has_more": {
              "type": "boolean"
            },
            "next_offset": {
              "type": [
                "number",
                "null"
              ]
            },
            "order": {
              "const": "updated_at_desc"
            }
          }
        },
        "policies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/machine_trash_policy"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "topology": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "generated_at",
        "local_machine_id",
        "pagination",
        "machines",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "local_machine_id": {
          "type": "string"
        },
        "pagination": {
          "type": "object",
          "required": [
            "limit",
            "offset",
            "total",
            "count",
            "hasMore",
            "nextOffset",
            "has_more",
            "next_offset",
            "order"
          ],
          "properties": {
            "limit": {
              "type": [
                "number",
                "null"
              ]
            },
            "offset": {
              "type": "number"
            },
            "total": {
              "type": "number"
            },
            "count": {
              "type": "number"
            },
            "hasMore": {
              "type": "boolean"
            },
            "nextOffset": {
              "type": [
                "number",
                "null"
              ]
            },
            "has_more": {
              "type": "boolean"
            },
            "next_offset": {
              "type": [
                "number",
                "null"
              ]
            },
            "order": {
              "const": "updated_at_desc"
            }
          }
        },
        "machines": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "machine_id",
              "friendly_name",
              "display_name",
              "updated_at"
            ],
            "properties": {
              "machine_id": {
                "type": "string"
              },
              "aliases": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "friendly_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "display_name": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "route": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "ok",
        "machine_id",
        "requested_machine_id",
        "generated_at",
        "route",
        "source",
        "target",
        "command_target",
        "confidence",
        "local",
        "evidence",
        "cacheability",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "ok": {
          "type": "boolean"
        },
        "machine_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "requested_machine_id": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "route": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "source": {
          "enum": [
            "local",
            "lan",
            "tailscale",
            "ssh",
            "unknown"
          ]
        },
        "target": {
          "type": [
            "string",
            "null"
          ]
        },
        "command_target": {
          "type": [
            "string",
            "null"
          ]
        },
        "confidence": {
          "enum": [
            "exact",
            "high",
            "medium",
            "low",
            "none"
          ]
        },
        "local": {
          "type": "boolean"
        },
        "evidence": {
          "type": "object"
        },
        "cacheability": {
          "$ref": "#/$defs/cacheability"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "workspace": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "ok",
        "requested_machine_id",
        "machine_id",
        "generated_at",
        "project",
        "machine",
        "paths",
        "diagnostics",
        "repair_hints",
        "evidence",
        "cacheability",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "ok": {
          "type": "boolean"
        },
        "requested_machine_id": {
          "type": "string"
        },
        "machine_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "project": {
          "type": "object"
        },
        "machine": {
          "type": "object",
          "required": [
            "current",
            "primary",
            "trust_status",
            "auth_status"
          ],
          "properties": {
            "current": {
              "type": "boolean"
            },
            "primary": {
              "type": "boolean"
            },
            "trust_status": {
              "enum": [
                "trusted",
                "untrusted",
                "unknown"
              ]
            },
            "auth_status": {
              "enum": [
                "authenticated",
                "unauthenticated",
                "unknown"
              ]
            }
          }
        },
        "paths": {
          "type": "object"
        },
        "diagnostics": {
          "type": "array"
        },
        "repair_hints": {
          "type": "array"
        },
        "evidence": {
          "type": "object"
        },
        "cacheability": {
          "$ref": "#/$defs/cacheability"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "compatibility": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "capabilities",
        "ok",
        "machine_id",
        "source",
        "generated_at",
        "checks",
        "summary"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "capabilities": {
          "type": "object"
        },
        "ok": {
          "type": "boolean"
        },
        "machine_id": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "checks": {
          "type": "array"
        },
        "summary": {
          "type": "object"
        }
      }
    },
    "resolver_snapshot": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "generated_at",
        "requested_machine_id",
        "machine_id",
        "route",
        "workspace",
        "cacheability",
        "warnings",
        "provenance"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "requested_machine_id": {
          "type": "string"
        },
        "machine_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "route": {
          "type": "object"
        },
        "workspace": {
          "type": [
            "object",
            "null"
          ]
        },
        "cacheability": {
          "$ref": "#/$defs/cacheability"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "provenance": {
          "type": "object"
        }
      }
    },
    "project_assignments": {
      "type": "object",
      "required": [
        "schema_version",
        "package",
        "generated_at",
        "assignments",
        "projects",
        "machines",
        "warnings"
      ],
      "properties": {
        "schema_version": {
          "const": 1
        },
        "package": {
          "type": "object"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "assignments": {
          "type": "array"
        },
        "projects": {
          "type": "array"
        },
        "machines": {
          "type": "array"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}
