{
  "openapi": "3.1.0",
  "info": {
    "title": "Pi Daemon Dash browser API",
    "version": "1.0.0",
    "description": "One same-origin browser protocol for embedded and dedicated Pi Daemon Dash servers. The daemon service bearer is server-to-server only and never appears on this wire."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:7464/dash/v1",
      "description": "Provisional authenticated loopback Dash endpoint; non-loopback deployments require HTTPS or explicit insecure-development policy."
    }
  ],
  "security": [
    {
      "dashSession": []
    }
  ],
  "paths": {
    "/login": {
      "post": {
        "operationId": "loginDashboard",
        "summary": "Exchange an input-only web credential for an HttpOnly browser session",
        "security": [],
        "x-origin-check-required": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/loginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authenticated browser session metadata; the session cookie is emitted only as Set-Cookie",
            "headers": {
              "Set-Cookie": {
                "$ref": "#/components/headers/SetCookie"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/loginEnvelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/Capacity"
          }
        }
      }
    },
    "/logout": {
      "post": {
        "operationId": "logoutDashboard",
        "summary": "Revoke the current browser session",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "responses": {
          "204": {
            "description": "Browser session revoked"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/bootstrap": {
      "get": {
        "operationId": "getDashboardBootstrap",
        "summary": "Fetch capabilities, effective settings, one workspace, and persisted-index rows without hydrating a Pi runtime",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded preview-first bootstrap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/bootstrapEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/sessions": {
      "get": {
        "operationId": "listDashboardSessions",
        "summary": "List the merged managed/external inventory without canonical source paths",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          },
          {
            "$ref": "#/components/parameters/PageCursor"
          },
          {
            "$ref": "#/components/parameters/PageLimit"
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Stable bounded inventory page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/inventoryEnvelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/sessions/{inventoryId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InventoryId"
        },
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/ClientId"
        },
        {
          "$ref": "#/components/parameters/WorkspaceId"
        }
      ],
      "get": {
        "operationId": "getDashboardSessionInfo",
        "summary": "Get authenticated safe metadata, ownership, and diagnostics for one inventory item",
        "responses": {
          "200": {
            "description": "Full information resource; unlike inventory pages it may include an authenticated canonical source path",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/sessionInfoEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sessions/{inventoryId}/transcript": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InventoryId"
        },
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/ClientId"
        },
        {
          "$ref": "#/components/parameters/WorkspaceId"
        },
        {
          "$ref": "#/components/parameters/PageCursor"
        },
        {
          "$ref": "#/components/parameters/TranscriptLimit"
        }
      ],
      "get": {
        "operationId": "getDashboardTranscript",
        "summary": "Read a bounded transcript resource or truthful source-unavailable empty state without runtime hydration",
        "responses": {
          "200": {
            "description": "Identity-matched normalized page with explicit availability, freshness, quarantine, and observer-attach metadata; unprojectable rows return records=[]",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/transcriptEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          }
        }
      }
    },
    "/sessions/{inventoryId}/activate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/InventoryId"
        },
        {
          "$ref": "#/components/parameters/ClientId"
        },
        {
          "$ref": "#/components/parameters/WorkspaceId"
        },
        {
          "$ref": "#/components/parameters/IdempotencyKey"
        }
      ],
      "post": {
        "operationId": "activateDashboardSession",
        "summary": "Durably admit explicit reuse, direct/co-opt, fork/import, or preview-only activation",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/activationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Activation admitted or joined by idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/activationTicketEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "412": {
            "$ref": "#/components/responses/Precondition"
          },
          "429": {
            "$ref": "#/components/responses/Capacity"
          }
        }
      }
    },
    "/activation/{ticketId}": {
      "get": {
        "operationId": "getDashboardActivation",
        "summary": "Inspect a retained activation ticket",
        "parameters": [
          {
            "$ref": "#/components/parameters/TicketId"
          },
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Current activation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/activationTicketEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sessions/{sessionRef}/export": {
      "post": {
        "operationId": "exportDashboardSession",
        "summary": "Durably export as a new Pi session or guarded unchanged-prefix append",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/SessionRef"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/exportRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Export admitted or joined by idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/exportTicketEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "412": {
            "$ref": "#/components/responses/Precondition"
          }
        }
      }
    },
    "/export/{ticketId}": {
      "get": {
        "operationId": "getDashboardExport",
        "summary": "Inspect a retained export ticket",
        "parameters": [
          {
            "$ref": "#/components/parameters/TicketId"
          },
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Current export state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/exportTicketEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/workspaces/{workspaceId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/WorkspacePathId"
        },
        {
          "$ref": "#/components/parameters/ClientId"
        }
      ],
      "get": {
        "operationId": "getDashboardWorkspace",
        "summary": "Read the authoritative split-tree workspace and seen cursors",
        "responses": {
          "200": {
            "description": "Current workspace",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/workspaceEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "updateDashboardWorkspace",
        "summary": "Optimistically replace one bounded split-tree workspace",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/workspaceUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated workspace",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/workspaceEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "412": {
            "$ref": "#/components/responses/Precondition"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          }
        }
      }
    },
    "/workspaces": {
      "get": {
        "operationId": "listAuthorizedDashboardWorkspaces",
        "summary": "List a bounded set of workspaces visible to the authenticated identity",
        "responses": {
          "200": { "description": "Authorized workspaces only" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/workspaces/select": {
      "post": {
        "operationId": "selectAuthorizedDashboardWorkspace",
        "summary": "Bind the current browser session to one authorized workspace",
        "security": [{ "dashSession": [], "csrfHeader": [] }],
        "x-origin-check-required": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["requestId", "workspaceId"],
                "properties": {
                  "requestId": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" },
                  "workspaceId": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Browser session rebound to the selected workspace" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/authorization/{kind}/{resourceId}": {
      "parameters": [
        { "name": "kind", "in": "path", "required": true, "schema": { "enum": ["session", "workspace"] } },
        { "name": "resourceId", "in": "path", "required": true, "schema": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" } }
      ],
      "get": {
        "operationId": "getDashboardAuthorizationPolicy",
        "summary": "Read a resource policy as its administrator",
        "responses": {
          "200": { "description": "Revisioned central policy", "headers": { "ETag": { "$ref": "#/components/headers/ETag" } }, "content": { "application/json": { "schema": { "$ref": "./dashboard-api.schema.json#/$defs/authorizationPolicyEnvelope" } } } },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/authorization/{kind}/{resourceId}/grants/{identityId}": {
      "parameters": [
        { "name": "kind", "in": "path", "required": true, "schema": { "enum": ["session", "workspace"] } },
        { "name": "resourceId", "in": "path", "required": true, "schema": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" } },
        { "name": "identityId", "in": "path", "required": true, "schema": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" } },
        { "$ref": "#/components/parameters/IfMatch" },
        { "$ref": "#/components/parameters/IdempotencyKey" }
      ],
      "put": {
        "operationId": "setDashboardAuthorizationGrant",
        "summary": "Set one identity grant with revision and idempotency guards",
        "security": [{ "dashSession": [], "csrfHeader": [] }],
        "x-origin-check-required": true,
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "./dashboard-api.schema.json#/$defs/authorizationGrantRequest" } } } },
        "responses": {
          "200": { "description": "Updated policy" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" }
        }
      },
      "delete": {
        "operationId": "revokeDashboardAuthorizationGrant",
        "summary": "Revoke one identity grant and live authority",
        "security": [{ "dashSession": [], "csrfHeader": [] }],
        "x-origin-check-required": true,
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "./dashboard-api.schema.json#/$defs/authorizationMutationRequest" } } } },
        "responses": {
          "200": { "description": "Updated policy" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" }
        }
      }
    },
    "/authorization/{kind}/{resourceId}/transfer": {
      "parameters": [
        { "name": "kind", "in": "path", "required": true, "schema": { "enum": ["session", "workspace"] } },
        { "name": "resourceId", "in": "path", "required": true, "schema": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" } },
        { "$ref": "#/components/parameters/IfMatch" },
        { "$ref": "#/components/parameters/IdempotencyKey" }
      ],
      "post": {
        "operationId": "transferDashboardAuthorizationOwnership",
        "summary": "Atomically transfer central policy ownership",
        "security": [{ "dashSession": [], "csrfHeader": [] }],
        "x-origin-check-required": true,
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "./dashboard-api.schema.json#/$defs/authorizationOwnershipTransferRequest" } } } },
        "responses": {
          "200": { "description": "Transferred policy" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" }
        }
      }
    },
    "/authorization/{kind}/{resourceId}/audit": {
      "parameters": [
        { "name": "kind", "in": "path", "required": true, "schema": { "enum": ["session", "workspace"] } },
        { "name": "resourceId", "in": "path", "required": true, "schema": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" } }
      ],
      "get": {
        "operationId": "listDashboardAuthorizationAudit",
        "summary": "Read bounded content-free policy audit facts",
        "responses": {
          "200": { "description": "Content-free audit events" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/authorization/{kind}/{resourceId}/controller": {
      "parameters": [
        { "name": "kind", "in": "path", "required": true, "schema": { "enum": ["session", "workspace"] } },
        { "name": "resourceId", "in": "path", "required": true, "schema": { "$ref": "./dashboard-api.schema.json#/$defs/identifier" } }
      ],
      "get": {
        "operationId": "getDashboardControllerState",
        "summary": "Read active controller participants as a resource administrator",
        "responses": {
          "200": { "description": "Bounded live controller state", "headers": { "ETag": { "$ref": "#/components/headers/ETag" } }, "content": { "application/json": { "schema": { "$ref": "./dashboard-api.schema.json#/$defs/controllerStateEnvelope" } } } },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "operationId": "transferDashboardController",
        "summary": "Release the old controller before granting an authorized active target",
        "security": [{ "dashSession": [], "csrfHeader": [] }],
        "x-origin-check-required": true,
        "parameters": [
          { "$ref": "#/components/parameters/IfMatch" },
          { "$ref": "#/components/parameters/IdempotencyKey" },
          { "name": "X-Controller-If-Match", "in": "header", "required": true, "schema": { "type": "string", "maxLength": 1024 } }
        ],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "./dashboard-api.schema.json#/$defs/controllerTransferRequest" } } } },
        "responses": {
          "200": { "description": "Audited controller handoff" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "409": { "$ref": "#/components/responses/Conflict" }
        }
      }
    },
    "/settings": {
      "get": {
        "operationId": "getDashboardSettings",
        "summary": "Read effective UI settings and source provenance",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Effective UI settings",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/settingsEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "patch": {
        "operationId": "patchDashboardSettings",
        "summary": "Update only the allowlisted mutable UI overlay",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/settingsPatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated effective settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/settingsEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "412": {
            "$ref": "#/components/responses/Precondition"
          },
          "422": {
            "$ref": "#/components/responses/Unsupported"
          }
        }
      },
      "delete": {
        "operationId": "resetDashboardSettings",
        "summary": "Delete the mutable UI overlay and restore configured defaults",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Configured defaults after reset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/settingsEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "412": {
            "$ref": "#/components/responses/Precondition"
          }
        }
      }
    },
    "/diagnostics": {
      "get": {
        "operationId": "getDashboardDiagnostics",
        "summary": "Read bounded browser-safe daemon configuration and failure events as a global administrator",
        "description": "Returns normalized allowlisted metadata only. Raw log lines, prompts, model output, paths, credentials, environment values, and daemon bearer material are never exposed.",
        "parameters": [
          { "$ref": "#/components/parameters/RequestId" },
          { "$ref": "#/components/parameters/ClientId" },
          { "$ref": "#/components/parameters/WorkspaceId" }
        ],
        "responses": {
          "200": {
            "description": "Bounded no-store diagnostics snapshot",
            "headers": { "Cache-Control": { "schema": { "type": "string", "const": "no-store" } } },
            "content": { "application/json": { "schema": { "$ref": "./dashboard-api.schema.json#/$defs/diagnosticsEnvelope" } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "501": { "$ref": "#/components/responses/Unsupported" }
        }
      }
    },
    "/stream": {
      "get": {
        "operationId": "attachDashboardStream",
        "summary": "Upgrade to one bounded browser stream multiplexing pane subscriptions",
        "x-websocket-subprotocol": "pi-daemon-dash.v1",
        "x-daemon-service-bearer-exposed": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          }
        ],
        "responses": {
          "101": {
            "description": "Authenticated multiplexed browser WebSocket; messages validate as streamClientFrame or streamServerFrame"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "426": {
            "$ref": "#/components/responses/UpgradeRequired"
          },
          "429": {
            "$ref": "#/components/responses/Capacity"
          }
        }
      }
    },
    "/schedules": {
      "get": {
        "operationId": "listDashboardSchedules",
        "summary": "List bounded prompt-redacted schedules",
        "parameters": [
          {
            "name": "session",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Prompt-redacted schedules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/scheduleListEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "post": {
        "operationId": "createDashboardSchedule",
        "summary": "Create a schedule; prompt content is input-only",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/scheduleMutationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created prompt-redacted schedule",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/scheduleEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/schedules/capabilities": {
      "get": {
        "operationId": "getDashboardScheduleCapabilities",
        "summary": "Get effective schedule validation limits",
        "responses": {
          "200": {
            "description": "Schedule capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/scheduleCapabilitiesEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/schedules/status": {
      "get": {
        "operationId": "getDashboardScheduleStatus",
        "summary": "Get content-free schedule runtime status",
        "responses": {
          "200": {
            "description": "Schedule status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/scheduleStatusEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/schedules/{scheduleId}": {
      "parameters": [
        {
          "name": "scheduleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          }
        }
      ],
      "get": {
        "operationId": "getDashboardSchedule",
        "summary": "Get one prompt-redacted schedule",
        "responses": {
          "200": {
            "description": "Prompt-redacted schedule",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/scheduleEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "put": {
        "operationId": "updateDashboardSchedule",
        "summary": "Update with exact revision; omitted prompt retains private content",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/scheduleMutationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated prompt-redacted schedule",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "./dashboard-api.schema.json#/$defs/scheduleEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "412": {
            "description": "Revision precondition failed"
          }
        }
      },
      "delete": {
        "operationId": "deleteDashboardSchedule",
        "summary": "Delete with exact revision and idempotency",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-api.schema.json#/$defs/scheduleDeleteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "412": {
            "description": "Revision precondition failed"
          }
        }
      }
    },
    "/session-drafts": {
      "post": {
        "operationId": "createDashboardSessionDraft",
        "summary": "Persist a validated new-session draft without hydrating Pi",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-session-draft.schema.json#/$defs/createRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Durable no-runtime session draft",
            "headers": {
              "ETag": {
                "description": "Draft revision tag",
                "schema": {
                  "type": "string"
                }
              },
              "Location": {
                "description": "Draft resource URL",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "./dashboard-api.schema.json#/$defs/httpEnvelopeBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "data"
                      ],
                      "properties": {
                        "ok": {
                          "const": true
                        },
                        "data": {
                          "$ref": "./dashboard-session-draft.schema.json#/$defs/resource"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/Capacity"
          }
        }
      }
    },
    "/session-drafts/{draftId}": {
      "parameters": [
        {
          "name": "draftId",
          "in": "path",
          "required": true,
          "description": "Opaque dashboard session draft ID",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
          }
        }
      ],
      "get": {
        "operationId": "getDashboardSessionDraft",
        "summary": "Inspect a lazy session draft without runtime hydration",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Current draft resource",
            "headers": {
              "ETag": {
                "description": "Draft revision tag",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "./dashboard-api.schema.json#/$defs/httpEnvelopeBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "data"
                      ],
                      "properties": {
                        "ok": {
                          "const": true
                        },
                        "data": {
                          "$ref": "./dashboard-session-draft.schema.json#/$defs/resource"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "cancelDashboardSessionDraft",
        "summary": "Cancel an unsent draft with phase-aware first-send truth",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-session-draft.schema.json#/$defs/cancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancelled or cancellation-indeterminate draft",
            "headers": {
              "ETag": {
                "description": "Updated draft revision tag",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "./dashboard-api.schema.json#/$defs/httpEnvelopeBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "data"
                      ],
                      "properties": {
                        "ok": {
                          "const": true
                        },
                        "data": {
                          "$ref": "./dashboard-session-draft.schema.json#/$defs/resource"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "412": {
            "$ref": "#/components/responses/Precondition"
          }
        }
      }
    },
    "/session-drafts/{draftId}/send": {
      "parameters": [
        {
          "name": "draftId",
          "in": "path",
          "required": true,
          "description": "Opaque dashboard session draft ID",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
          }
        }
      ],
      "post": {
        "operationId": "sendDashboardSessionDraft",
        "summary": "Admit one durable exact-once first message",
        "security": [
          {
            "dashSession": [],
            "csrfHeader": []
          }
        ],
        "x-origin-check-required": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "./dashboard-session-draft.schema.json#/$defs/sendRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable first-send ticket",
            "headers": {
              "Location": {
                "description": "First-send ticket URL",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "./dashboard-api.schema.json#/$defs/httpEnvelopeBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "data"
                      ],
                      "properties": {
                        "ok": {
                          "const": true
                        },
                        "data": {
                          "$ref": "./dashboard-session-draft.schema.json#/$defs/sendTicket"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "412": {
            "$ref": "#/components/responses/Precondition"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/session-draft-send/{ticketId}": {
      "parameters": [
        {
          "name": "ticketId",
          "in": "path",
          "required": true,
          "description": "Durable dashboard first-send ticket ID",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
          }
        }
      ],
      "get": {
        "operationId": "getDashboardSessionDraftSend",
        "summary": "Inspect durable first-send terminal or indeterminate truth",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/WorkspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Current first-send ticket",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "./dashboard-api.schema.json#/$defs/httpEnvelopeBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "data"
                      ],
                      "properties": {
                        "ok": {
                          "const": true
                        },
                        "data": {
                          "$ref": "./dashboard-session-draft.schema.json#/$defs/sendTicket"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "dashSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Host-pi-daemon-dash",
        "description": "Opaque revocable HttpOnly SameSite=Strict browser session. Never returned in JSON or JavaScript-readable storage."
      },
      "csrfHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Pi-Daemon-CSRF"
      }
    },
    "parameters": {
      "RequestId": {
        "name": "X-Request-Id",
        "in": "header",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "ClientId": {
        "name": "X-Pi-Daemon-Client-Id",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "WorkspaceId": {
        "name": "X-Pi-Daemon-Workspace-Id",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "PageCursor": {
        "name": "cursor",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      },
      "PageLimit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50
        }
      },
      "TranscriptLimit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200,
          "default": 100
        }
      },
      "InventoryId": {
        "name": "inventoryId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "SessionRef": {
        "name": "sessionRef",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "TicketId": {
        "name": "ticketId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "WorkspacePathId": {
        "name": "workspaceId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 128
        }
      },
      "IfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 1024
        }
      }
    },
    "headers": {
      "ETag": {
        "description": "Strong nonsecret resource revision tag",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "SetCookie": {
        "description": "Owner-private opaque browser session cookie; Secure is required whenever TLS is used",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "InvalidRequest": {
        "$ref": "#/components/responses/Error"
      },
      "Unauthorized": {
        "$ref": "#/components/responses/Error"
      },
      "Forbidden": {
        "$ref": "#/components/responses/Error"
      },
      "NotFound": {
        "$ref": "#/components/responses/Error"
      },
      "Conflict": {
        "$ref": "#/components/responses/Error"
      },
      "Precondition": {
        "$ref": "#/components/responses/Error"
      },
      "TooLarge": {
        "$ref": "#/components/responses/Error"
      },
      "Unsupported": {
        "$ref": "#/components/responses/Error"
      },
      "Capacity": {
        "$ref": "#/components/responses/Error"
      },
      "UpgradeRequired": {
        "$ref": "#/components/responses/Error"
      },
      "Unavailable": {
        "$ref": "#/components/responses/Error"
      },
      "Error": {
        "description": "Safe typed error envelope; authentication failures reveal no session existence",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "./dashboard-api.schema.json#/$defs/errorEnvelope"
            }
          }
        }
      }
    }
  }
}
