This is an automated email from the ASF dual-hosted git repository.

DImuthuUpe pushed a commit to branch new-docs
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 6b9f06384edeb6cc07651c4307892b92455fddb9
Author: DImuthuUpe <[email protected]>
AuthorDate: Sun Nov 8 06:06:50 2026 -0500

    Documentation for core concepts
---
 docs/application.md      | 244 +++++++++++++++++++++++++++++++++++++++++++++++
 docs/auth.md             | 228 +++++++++++++++++++++++++++++++++++++++++++
 docs/batch-clusters.md   | 216 +++++++++++++++++++++++++++++++++++++++++
 docs/data-product.md     | 150 +++++++++++++++++++++++++++++
 docs/interactive-auth.md | 173 +++++++++++++++++++++++++++++++++
 docs/virtual-data.md     | 160 +++++++++++++++++++++++++++++++
 6 files changed, 1171 insertions(+)

diff --git a/docs/application.md b/docs/application.md
new file mode 100644
index 0000000000..60b7f3152b
--- /dev/null
+++ b/docs/application.md
@@ -0,0 +1,244 @@
+# Applications
+
+An **application** in Airavata is a program a user can run on a compute 
resource without writing a job script, such as AlphaFold2, GROMACS or an 
in-house analysis code. Airavata describes it in three layers, and each answers 
a different question:
+
+| Layer | Question it answers | Resource |
+|---|---|---|
+| **Application template** | *What* does the application take in and produce? 
| `application-templates` |
+| **Application deployment** | *How* is it run on a particular compute 
resource? | `slurm-deployments` (Slurm backend) |
+| **Process** | *This* run: which values, which data, which resources? | 
`processes` |
+
+Any authenticated user can create all three.
+
+```
+Application template  ──1:N──▶  Application deployment  ──1:N──▶  Process (one 
run)
+  inputs[], outputs[]             compute resource, run section,    
inputMappings[], outputMappings[],
+                                  default resources                 resource 
request, credentials
+```
+
+The template is the application's contract. It names every input and output 
and gives each one a type, and it says nothing about where or how the program 
runs. A deployment binds that contract to one compute resource: the commands 
that launch the program there and the resources a run asks for by default. A 
process fills in the contract for one run, giving a value for each input and a 
destination for each output, and launches it.
+
+Keeping these apart means that one template can be deployed on several compute 
resources, and one deployment can serve every user who has access to its 
resource. Slurm clusters are the compute backend supported today. A deployment 
is the layer that changes when other backends are added. Templates and the way 
runs supply inputs and outputs stay the same.
+
+File-like inputs and outputs are passed as **data products**, which are 
registered datasets on a storage host. [data-product.md](data-product.md) 
explains what they are and how to set them up.
+
+The endpoints and full request and response bodies are in [api.md](api.md). 
See [Application Templates](api.md#application-templates), [Batch 
Deployments](api.md#batch-deployments) and [Processes](api.md#processes). This 
page explains the model behind them.
+
+---
+
+## Application template
+
+A template has a name, an optional description, and two lists of declarations:
+
+```json
+{
+  "templateName": "AlphaFold2",
+  "templateDescription": "AlphaFold2 protein structure prediction application",
+  "inputs":  [ /* input declarations */ ],
+  "outputs": [ /* output declarations */ ]
+}
+```
+
+Inputs and outputs belong to the template. They are created, replaced and 
deleted with it, and an update replaces the whole list, which gives every 
declaration a new `inputId`/`outputId`. A template that still has deployments 
cannot be deleted (`409 Conflict`).
+
+### Input declarations
+
+| Field | Required | Meaning |
+|---|---|---|
+| `inputName` | yes | The input's identifier. It must be unique within the 
template, and the run section refers to the input by it (`{{ 
inputs.<inputName>[0] }}`). Use a name that is also a valid identifier 
(`[A-Za-z_][A-Za-z0-9_]*`) so that it works in the template syntax. |
+| `inputType` | yes | One of the [input types](#input-types) below. |
+| `displayName` | no | A label for user interfaces. |
+| `inputDescription` | no | Help text for whoever fills the input in. |
+| `required` | no | Whether a run must supply a value (default `false`). |
+| `defaultValue` | no | The value used when a run gives none. It is a JSON 
document; see [Value encoding](#value-encoding). |
+
+### Input types
+
+Inputs fall into two families. **Scalar** inputs are passed to the program as 
literal text. **Data** inputs name [data products](data-product.md). Airavata 
stages them into the run's work directory before the job starts, and the run 
section sees the paths of the staged copies.
+
+| Type | Family | What the run supplies | What the run section sees |
+|---|---|---|---|
+| `STRING` | scalar | any text, e.g. `{"value":"monomer"}` | the text as given 
|
+| `INTEGER` | scalar | a whole number, e.g. `{"value":300}` | the number as 
text, e.g. `300` |
+| `FLOAT` | scalar | a decimal number, e.g. `{"value":0.05}` | the number as 
text |
+| `BOOLEAN` | scalar | `true` or `false`, e.g. `{"value":true}` | `true` / 
`false` |
+| `FILE` | data | the id of one **file** data product | the path of the staged 
file |
+| `FILE_LIST` | data | a list of ids of **file** data products | one path per 
product, each a staged file |
+| `DIRECTORY` | data | the id of one **directory** data product | the path of 
the staged directory |
+
+A data product records whether it is a file or a directory (`isFile`). A 
`FILE` or `FILE_LIST` input takes file products only, and a `DIRECTORY` input 
takes a directory product only.
+
+### Output declarations
+
+| Field | Required | Meaning |
+|---|---|---|
+| `outputName` | yes | The output's identifier. It is also the **name** the 
job is expected to write in its work directory. |
+| `outputType` | yes | One of the [output types](#output-types) below. |
+| `displayName` | no | A label for user interfaces. |
+| `outputDescription` | no | Help text. |
+
+Outputs have no value and no default. The application produces them, so a run 
only says *where each output should go*, by naming a data product for it.
+
+### Output types
+
+Every output is data. An application's result is always something it writes to 
disk.
+
+| Type | Meaning | Where the job writes it | Mapped to |
+|---|---|---|---|
+| `FILE` | a single file | `<workDir>/<outputName>` | a **file** data product |
+| `FILE_LIST` | several files collected together | files under 
`<workDir>/<outputName>/` | a **directory** data product the files are 
collected into |
+| `DIRECTORY` | a directory tree | `<workDir>/<outputName>/` | a **directory** 
data product |
+
+After the job finishes, Airavata copies each mapped output from the work 
directory to its data product's path.
+
+Because an output's name is its file or directory name, the output name is 
part of the contract between Airavata and the program. A program that writes 
`confidence_scores.json` needs an output named `confidence_scores.json`, or a 
run section that passes `{{ outputs.confidenceScores }}` to the program as its 
output path, as shown [below](#the-run-section).
+
+### Value encoding
+
+A default value (`defaultValue`) and a run's mapping value (`value`) are 
strings that hold a small JSON document:
+
+| Form | Use for | Example |
+|---|---|---|
+| `{"value": <x>}` | a single value | `"{\"value\":\"monomer\"}"`, 
`"{\"value\":300}"` |
+| `{"values": [ ... ]}` | a list (`FILE_LIST`) | `"{\"values\":[\"<dataId 
1>\",\"<dataId 2>\"]}"` |
+| `[ ... ]` | a list, short form | `"[\"<dataId 1>\",\"<dataId 2>\"]"` |
+| bare text | a single value, usually a data product id for `FILE` or 
`DIRECTORY` | `"7a8b9c0d-…"` |
+
+Every form becomes a list of strings internally, which is why the run section 
indexes inputs with `[0]`. A `{"value": null}` document produces an empty list.
+
+---
+
+## Application deployment
+
+A deployment makes a template runnable on one compute resource. For the Slurm 
backend it carries:
+
+| Field | Meaning |
+|---|---|
+| `templateId` | The template being deployed. |
+| `slurmClusterId` | The cluster it runs on. This names only the machine. The 
account and SSH key a run submits under come from a [cluster 
config](api.md#slurm-cluster-configs) that the run chooses. |
+| `slurmRunSection` | The commands that run the application: module loads, the 
program invocation and any cleanup. It is a Jinja template 
([pongo2](https://github.com/flosch/pongo2)). |
+| `defaultBatchJobConfig` | The resource request a run starts from: wall time, 
allocation, nodes, CPUs, memory, GPUs and constraints. A run copies it and may 
change any of it. |
+| `defaultPartition` | The Slurm partition to submit to. |
+
+### The run section
+
+Airavata generates the job header (`#SBATCH` lines on Slurm) itself. The run 
section is the body of the script, and it reaches the run's inputs and outputs 
through two variables:
+
+| Variable | Type | Contents |
+|---|---|---|
+| `inputs` | name → list of strings | every input the run mapped, after 
defaults are applied. Data inputs are given as paths in the work directory. |
+| `outputs` | name → string | `<workDir>/<outputName>` for every output the 
run mapped |
+
+The usual patterns:
+
+```jinja
+module load alphafold
+
+run_alphafold.sh \
+  --fasta_paths={{ inputs.fastaFile[0] }} \
+  --model_preset={{ inputs.modelPreset[0] }} \
+  --extra_pdbs {{ inputs.templates|join:" " }} \
+  --output_dir={{ outputs.rankedModels }} \
+  --scores_out={{ outputs.confidenceScores }}
+```
+
+- A single-valued input (any scalar, `FILE` or `DIRECTORY`): `{{ 
inputs.name[0] }}`
+- A `FILE_LIST`: `{{ inputs.name|join:" " }}` expands to every path, separated 
by spaces.
+- An output: `{{ outputs.name }}`. Use `{{ outputs["name.ext"] }}` if the name 
contains a dot.
+- Optional inputs can be guarded: `{% if inputs.seed %}--seed {{ 
inputs.seed[0] }}{% endif %}`
+
+Other variables are available too: `work_dir`, `work_dir_quoted`, 
`process_id`, `job_name`, `stdout_file`, `stderr_file`, and the resource values 
(`nodes`, `cpus`, `mem`, `gpus`, …).
+
+Shell-style references such as `$fastaFile` are **not** substituted by 
Airavata. They reach the script unchanged and are expanded by bash as ordinary 
environment variables, which are usually empty.
+
+The run section is rendered first and its output is inserted into the script 
as plain text. A value a user supplies for an input is therefore never 
interpreted as template code.
+
+---
+
+## Process: running an application
+
+A `BATCH_JOB` process is one run of a deployment. Its `batchProcess` section 
names the deployment, the cluster config to submit under, the `baseWorkDir`, 
its own `batchJobConfig`, and two mapping lists that fill in the template:
+
+```json
+"inputMappings": [
+  { "templateInputId": "<fastaFile inputId>",   "value": "<file data product 
id>" },
+  { "templateInputId": "<templates inputId>",   "value": "{\"values\":[\"<id 
1>\",\"<id 2>\"]}" },
+  { "templateInputId": "<modelPreset inputId>", "value": 
"{\"value\":\"monomer\"}" }
+],
+"outputMappings": [
+  { "templateOutputId": "<rankedModels outputId>",     "value": "<directory 
data product id>" },
+  { "templateOutputId": "<confidenceScores outputId>", "value": "<file data 
product id>" }
+]
+```
+
+Mappings refer to declarations by **id** (`inputId` / `outputId`), not by 
name. Read the ids back from `GET /api/v1/application-templates/{templateId}`.
+
+| Declaration type | Mapping `value` holds |
+|---|---|
+| scalar input | the value, in the [encoded form](#value-encoding) |
+| `FILE` input | the id of a file data product to copy in |
+| `FILE_LIST` input | the ids of the file data products to copy in |
+| `DIRECTORY` input | the id of a directory data product to copy in |
+| `FILE` output | the id of a file data product to copy the result to. The 
path need not exist yet. |
+| `FILE_LIST` / `DIRECTORY` output | the id of a directory data product to 
copy the results into |
+
+A product's storage supplies the host and account each copy goes through. See 
[data-product.md](data-product.md).
+
+### What happens at launch
+
+The run works in `<baseWorkDir>/<processId>` on the cluster. If the run gives 
no `baseWorkDir`, the cluster config's work root is used. Launching creates 
tasks in this order:
+
+1. **Stage in.** Airavata copies each data input's products from their storage 
into the work directory.
+2. **Submit.** Airavata renders the script with `inputs` and `outputs` as 
described above and submits it.
+3. **Monitor.** Airavata tracks the job until it finishes.
+4. **Stage out.** Airavata copies each mapped output from the work directory 
to its data product's path.
+
+Staging tasks retry up to three times on failure. An output the run does not 
map is not staged and stays in the work directory on the cluster.
+
+### Defaults
+
+A default applies when the run includes a mapping for that input with no value 
(`"value": null`). An input the run leaves out of `inputMappings` entirely does 
not appear in `inputs`, even if it has a default, so clients should send a 
mapping for every declared input. The [MCP server](mcp.md)'s run planner does 
this, filling in defaults and checking `required` inputs and scalar types 
before it creates the run.
+
+---
+
+## Complete example
+
+A template for a tool that takes a structure file, an iteration count, an 
optional list of extra files and a parameter directory, and writes one result 
file:
+
+```json
+{
+  "templateName": "Relax",
+  "inputs": [
+    { "inputName": "structure",  "inputType": "FILE",      "required": true },
+    { "inputName": "iterations", "inputType": "INTEGER",   "required": false, 
"defaultValue": "{\"value\":100}" },
+    { "inputName": "extras",     "inputType": "FILE_LIST", "required": false },
+    { "inputName": "params",     "inputType": "DIRECTORY", "required": true }
+  ],
+  "outputs": [
+    { "outputName": "relaxed.pdb", "outputType": "FILE" }
+  ]
+}
+```
+
+Its deployment's run section:
+
+```jinja
+module load relax
+relax --in {{ inputs.structure[0] }} \
+      --iterations {{ inputs.iterations[0] }} \
+      --params {{ inputs.params[0] }} \
+      {% if inputs.extras %}--extras {{ inputs.extras|join:" " }}{% endif %} \
+      --out {{ outputs["relaxed.pdb"] }}
+```
+
+A run maps:
+
+- `structure` to a file product
+- `iterations` to `null`, so the default of 100 applies
+- `params` to a directory product
+- `extras` to two file products
+- `relaxed.pdb` to a file product on the user's lab storage
+
+Airavata stages the four input products into the work directory and renders 
the run section with their staged paths. The job writes `relaxed.pdb` into the 
work directory, and Airavata then stages it out to the lab storage.
+
+For the full walkthrough with `curl` (registering storages and data products, 
creating the process and launching it) see [api.md](api.md#processes).
diff --git a/docs/auth.md b/docs/auth.md
new file mode 100644
index 0000000000..6a0145b6dc
--- /dev/null
+++ b/docs/auth.md
@@ -0,0 +1,228 @@
+# Authentication and Authorization
+
+Every Airavata API call that reads private data or changes anything carries a 
bearer token:
+
+```
+Authorization: Bearer <token>
+```
+
+Two kinds of token are accepted:
+
+| Token | Who it identifies | Meant for |
+|---|---|---|
+| **CILogon access token** | a real user, signed in through their home 
institution, ORCID, Google or another identity provider that CILogon federates 
| all normal use |
+| **Root token** | the built-in `root` account, with `SUPER_ADMIN` authority | 
first-time setup and testing only |
+
+**Authentication** establishes who the caller is, from the token. 
**Authorization** determines what they may do: their role, what they own, and 
what has been shared with them.
+
+---
+
+## Authentication
+
+### CILogon
+
+[CILogon](https://www.cilogon.org) is an OpenID Connect provider for research 
and education. Users sign in with an account they already have, and Airavata 
receives an access token for them.
+
+CILogon access tokens are opaque strings, not JWTs, so Airavata cannot check 
them locally. For each request, the server:
+
+1. sends the token to CILogon's **introspection** endpoint (RFC 7662), 
authenticating with its own OAuth client id and secret. An inactive or unknown 
token is rejected with `401`.
+2. calls CILogon's **userinfo** endpoint with the token to get profile claims 
(name, email). If this call fails, the request continues without them.
+3. takes the username from `username`, `preferred_username` or `sub`. CILogon 
URIs such as `http://cilogon.org/serverE/users/12345` are shortened to 
**`cilogon:12345`**. This value is the user id used everywhere in Airavata: 
ownership, shares, group membership and roles.
+4. looks up the user's roles in Airavata's own database. **A token never 
grants its own privileges.**
+
+If CILogon cannot be reached, the request fails with `502 Unable to validate 
bearer token` rather than `401`, because the failure is not the caller's fault.
+
+### Root account
+
+When the root account is enabled, the server prints a token at startup:
+
+```
+========================================
+ROOT ACCOUNT TOKEN (Super Admin):
+5b0c9a8e-2f4d-4e61-9b7a-1c3d5e7f9a0b
+========================================
+```
+
+This token authenticates as the user `root` with `SUPER_ADMIN` authority. The 
server creates the `root` user record at startup if it is missing, so `root` 
can own resources straight away. The token is a new random value on every 
restart unless you set it with `AIRAVATA_ROOT_ACCOUNT_TOKEN`.
+
+The root account lets a fresh deployment be used before an identity provider 
is set up. Use it to install and try Airavata, and to register the first users 
and administrators.
+
+> **Disable the root account in production.** It is a single shared secret 
with full administrative power. It is not tied to a person, carries no second 
factor and leaves no record of who used it. Once CILogon is configured and at 
least one real user has `SUPER_ADMIN`, set 
`AIRAVATA_ROOT_ACCOUNT_ENABLED=false`.
+
+The [MCP server](mcp.md) refuses the root token, because it checks every 
token's identity with the issuer.
+
+---
+
+## Configuring CILogon at deployment time
+
+### 1. Register an OAuth client with CILogon
+
+Register a client at <https://cilogon.org/oauth2/register>:
+
+- **Client type:** confidential (with a secret). The server needs the secret 
to call the introspection endpoint.
+- **Scopes:** `openid`, `email`, `profile`, `org.cilogon.userinfo`. Add 
`offline_access` if clients should get refresh tokens.
+- **Callback URLs:** the redirect URIs of the applications that will sign 
users in: the dashboard's CILogon callback, and 
`http://localhost:8082/callback` if you will use the 
[web-api-client](#programmatic-access-web-api-client).
+
+CILogon approves new clients manually. Once your client is approved, you will 
have a **client id** (`cilogon:/client_id/…`) and a **client secret**.
+
+The server can only introspect tokens that its client is allowed to see. The 
simplest arrangement is for users' tokens to be issued by the same client 
registration. If you use a separate public client, for example the one 
registered for `airavata-mcp`, confirm with CILogon that the server's client 
can introspect its tokens.
+
+### 2. Set the server's environment
+
+| Variable | Default | Meaning |
+|---|---|---|
+| `CILOGON_CLIENT_ID` | *(empty)* | The client id from step 1. Setting it 
turns on CILogon authentication. |
+| `CILOGON_CLIENT_SECRET` | *(empty)* | The client secret. Keep it in a secret 
store, not in a committed file. |
+| `CILOGON_INTROSPECTION_URI` | `https://cilogon.org/oauth2/introspect` | 
Change this only for a non-production CILogon instance (e.g. 
`test.cilogon.org`). |
+| `CILOGON_USERINFO_URI` | `https://cilogon.org/oauth2/userinfo` | Same. |
+| `AIRAVATA_ROOT_ACCOUNT_ENABLED` | `true` | Set to `false` in production. |
+| `AIRAVATA_ROOT_ACCOUNT_TOKEN` | *(random per start)* | Fixes the root token 
to a known value, for repeatable test environments. |
+
+```bash
+export CILOGON_CLIENT_ID='cilogon:/client_id/0123456789abcdef'
+export CILOGON_CLIENT_SECRET='<from your secret store>'
+export AIRAVATA_ROOT_ACCOUNT_ENABLED=false
+bin/airavata-server
+```
+
+The server refuses to start if both the root account and CILogon are off, 
because nobody would be able to authenticate:
+
+```
+no authentication configured: enable the root account or set CILOGON_CLIENT_ID
+```
+
+Tokens travel in every request, so put TLS in front of the server in any 
deployment that is reachable over a network. See 
[INSTALL.md](../INSTALL.md#production-notes).
+
+### 3. Bootstrap the first administrator
+
+A CILogon user needs a **user record** in Airavata before they can own 
anything (credentials, cluster configs, storages, runs). Without one they get 
`404 No user record found for authenticated principal`. Only a `SUPER_ADMIN` 
can create records. To give a new deployment its first real administrator:
+
+1. Start with the root account **enabled**.
+2. Have the administrator sign in to CILogon and find their user id (see [Find 
your user id](#find-your-user-id)).
+3. Register them using the root token:
+
+   ```bash
+   curl -s -X POST localhost:9095/api/v1/users \
+     -H "Authorization: Bearer $ROOT_TOKEN" -H 'Content-Type: 
application/json' \
+     -d 
'{"userId":"cilogon:12345","firstName":"Ada","lastName":"Lovelace","email":"[email protected]","authMethod":"CILOGON"}'
+   ```
+
+4. Grant the role. No API endpoint changes roles, so do this in the database:
+
+   ```sql
+   INSERT INTO user_roles (user_id, role) VALUES ('cilogon:12345', 
'SUPER_ADMIN');
+   ```
+
+5. Restart with `AIRAVATA_ROOT_ACCOUNT_ENABLED=false`. From then on, the new 
administrator registers other users with their own CILogon token.
+
+---
+
+## Getting a CILogon token and using it
+
+How you sign in depends on how you use Airavata:
+
+| You are… | Use |
+|---|---|
+| working interactively in a browser | the **dashboard**, which has CILogon 
sign-in built in |
+| calling the API from scripts, `curl` or your own code | the 
**web-api-client**, to sign in through CILogon and get a token |
+| working through an AI assistant | **airavata-mcp**, which signs in and 
refreshes tokens itself |
+
+### Dashboard
+
+The dashboard signs users in with CILogon directly. Open it and choose CILogon 
sign-in, pick your identity provider, and you are signed in. You don't need to 
handle a token. During initial setup, before CILogon is configured, you can 
sign in with the root token instead.
+
+### Programmatic access: web-api-client
+
+To call the API programmatically, get a CILogon token through the 
**web-api-client** in 
[`dev-tools/web-api-client`](../dev-tools/web-api-client/README.md). It is a 
small web UI that runs the CILogon sign-in flow (authorization code with PKCE) 
and holds the resulting access token.
+
+1. Add `http://localhost:8082/callback` as a redirect URI on your CILogon 
client.
+2. Configure the client in `dev-tools/web-api-client/.env.local`. This file is 
never committed.
+
+   ```
+   SESSION_SECRET=<openssl rand -base64 32>
+   CILOGON_CLIENT_ID=<CILogon client id>
+   CILOGON_CLIENT_SECRET=<CILogon client secret>
+   ```
+
+3. Run it and sign in:
+
+   ```bash
+   cd dev-tools/web-api-client
+   npm install
+   npm run dev        # http://localhost:8082
+   ```
+
+Once you're signed in, the web-api-client's console sends requests to any 
Airavata endpoint with your token attached as `Authorization: Bearer <token>`. 
It sends them from its own server, so cross-origin requests are not a problem. 
Use the same access token in your scripts:
+
+```bash
+TOKEN='<CILogon access token>'
+curl -s localhost:9095/api/v1/ssh-credentials -H "Authorization: Bearer $TOKEN"
+```
+
+Access tokens are short-lived. When requests start returning `401` with 
`WWW-Authenticate: Bearer error="invalid_token"`, sign out of the 
web-api-client and sign in again to get a new token. The console also warns you 
once the token has expired.
+
+For WebSocket routes, such as the [interactive auth](interactive-auth.md) 
subscription, send the same header on the upgrade request. A browser offers the 
token as a `base64url.bearer.<token>` subprotocol instead.
+
+### airavata-mcp
+
+The MCP client handles sign-in for you and keeps the token refreshed:
+
+```bash
+export AIRAVATA_MCP_OAUTH_CLIENT_ID=<the CILogon client id registered for 
airavata-mcp>
+airavata-mcp login            # opens a browser
+airavata-mcp login --device   # prints a code to enter on another device (for 
SSH sessions and HPC login nodes)
+```
+
+Tokens are stored in the OS keychain. `airavata-mcp logout` removes them. See 
[mcp.md](mcp.md#install-and-sign-in).
+
+### Find your user id
+
+Your Airavata user id is the normalised CILogon subject. Ask CILogon for it:
+
+```bash
+curl -s https://cilogon.org/oauth2/userinfo -H "Authorization: Bearer $TOKEN" 
| jq -r '.sub'
+# http://cilogon.org/serverE/users/12345   →   your user id is cilogon:12345
+```
+
+---
+
+## Authorization
+
+What a caller may do comes from three sources.
+
+### Roles
+
+Roles are stored in Airavata's `user_roles` table and looked up on every 
request. They are never read from the token.
+
+| Role | Adds |
+|---|---|
+| `USER` | The default for anyone with no role row. Self-service: register SSH 
credentials, cluster configs, storages, data products, templates, deployments 
and runs; manage and share what you own. |
+| `ADMIN` | Platform-wide listings (every process, config, storage and user) 
and administration of other users' records. |
+| `SUPER_ADMIN` | Everything `ADMIN` can do, plus registering users. The root 
account has this role. |
+
+### Ownership
+
+Anything a user creates belongs to them. The owner is always taken from the 
token, never from the request body, and cannot be transferred. Owners can read, 
change, delete and share their records. Admins have the same rights, with one 
exception: **SSH credentials are visible to their owner only**, admins 
included, because a credential is the secret itself.
+
+### Sharing
+
+Owners grant other users or groups `READ` or `WRITE` on their records, such as 
cluster configs, data storages, data products and virtual data directories. See 
[sharing.md](sharing.md).
+
+### Status codes
+
+| Status | Meaning |
+|---|---|
+| `401 Unauthorized` | No token, or a token that is invalid, expired, or an 
old root token from before a restart. |
+| `403 Forbidden` | Authenticated, but not allowed: missing role, not the 
owner, or no share. |
+| `404 Not Found` | The record doesn't exist. Also returned when the caller 
has no user record and tries to create something they would own. |
+| `502 Bad Gateway` | CILogon could not be reached to validate the token. |
+
+---
+
+## Production checklist
+
+- [ ] CILogon client registered and approved, with `CILOGON_CLIENT_ID` and 
`CILOGON_CLIENT_SECRET` supplied from a secret store
+- [ ] At least one real user registered with `SUPER_ADMIN`
+- [ ] **`AIRAVATA_ROOT_ACCOUNT_ENABLED=false`**, with any 
`AIRAVATA_ROOT_ACCOUNT_TOKEN` removed from the environment
+- [ ] TLS terminated in front of the server
+- [ ] CORS narrowed to the portal origins that need it
diff --git a/docs/batch-clusters.md b/docs/batch-clusters.md
new file mode 100644
index 0000000000..6ef9d91bf7
--- /dev/null
+++ b/docs/batch-clusters.md
@@ -0,0 +1,216 @@
+# Batch Clusters and Partitions
+
+A **batch cluster** is a compute resource that Airavata submits jobs to 
through a batch scheduler. Slurm is the supported scheduler today. An 
[application deployment](application.md#application-deployment) names the 
cluster its application runs on, and each run of that deployment is submitted 
there as a batch job.
+
+Airavata describes a cluster in three parts:
+
+| Part | What it describes |
+|---|---|
+| **Cluster** | The machine: its head node, optional data transfer node and 
where Slurm is installed |
+| **Partition** | One queue on the cluster (a Slurm partition) and its limits 
and defaults |
+| **Cluster config** | One user's login on the cluster: account, SSH key and 
work directory |
+
+```
+Slurm cluster  ──1:N──▶  Partition          (the machine and its layout)
+      ▲
+      └──── Cluster config  ◀── SSH credential   (one login on it; owned by a 
user, shareable)
+```
+
+Any user can register the clusters they have access to. The cluster and its 
partitions describe only the machine. Logins are kept separately in **cluster 
configs**, so a cluster record never holds credentials. A run chooses which 
cluster config to submit under.
+
+The easiest way to register all of this is the **dashboard**. It logs in to 
the cluster and reads the partitions, and later the allocations, directly from 
Slurm, so you don't have to type them in. See [Registering with the 
dashboard](#registering-with-the-dashboard).
+
+---
+
+## Cluster
+
+| Field | Required | Meaning |
+|---|---|---|
+| `clusterName` | yes | A name for the cluster, e.g. `expanse`. |
+| `clusterDescription` | no | Free text. |
+| `headnodeHost` | yes | The login host jobs are submitted through, e.g. 
`login.expanse.sdsc.edu`. |
+| `headnodePort` | yes | Its SSH port, usually `22`. |
+| `slurmHome` | no | The Slurm install prefix, e.g. `/opt/slurm`, if `sbatch` 
and `squeue` are not on the login shell's `PATH`. Commands are then run as 
`<slurmHome>/bin/sbatch`. |
+| `dataHost` | no | A separate host for moving data, typically a DTN. If it is 
not set, data is staged through the head node. |
+| `dataPort` | no | The data host's SSH port. |
+
+Registering a cluster needs no SSH key. The cluster only says *where* the 
machine is.
+
+## Partition
+
+A partition records one Slurm partition's limits and defaults. Clients use 
them to suggest sensible resource requests and to warn about requests the 
partition would reject.
+
+| Field | Unit | Meaning |
+|---|---|---|
+| `name` | | The Slurm partition name, e.g. `gpu`. Required. A deployment's 
`defaultPartition` refers to a partition by this name. |
+| `description` | | Free text. |
+| `maxRunTime` | minutes | The longest wall time a job may request. |
+| `defaultWalltime` | minutes | The wall time a job gets if it asks for none. |
+| `maxNodes` | | The most nodes one job may use. |
+| `maxProcessors` | | The total CPUs in the partition. |
+| `cpuPerNode` | | CPUs on each node. |
+| `maxMemory` | MB | Memory per node. |
+| `gres` | | Generic resources on the nodes, e.g. `gpu:a100:4`. |
+| `nodes` | | The Slurm node list, e.g. `gpu[01-08]`. |
+| `defaultNodeCount`, `defaultCpuCount` | | Suggested defaults for a run. |
+| `maxJobsInQueue` | | The most jobs one user may queue. |
+| `isDefaultQueue` | | Whether this is the cluster's default partition. |
+| `isCheckpointable` | | Whether jobs here can be checkpointed. |
+
+Every field except `name` is optional.
+
+## Cluster config
+
+A cluster config is one login on a cluster. It is what a run submits jobs as.
+
+| Field | Required | Meaning |
+|---|---|---|
+| `slurmClusterId` | yes | The cluster. |
+| `loginUser` | yes | The account on the head node. |
+| `sshCredentialId` | yes | An [SSH credential](api.md#ssh-credentials) **you 
own**, whose public key is installed for `loginUser`. |
+| `workRoot` | yes | The directory runs work under. Each run gets its own 
`<workRoot>/<processId>` subdirectory unless it sets its own `baseWorkDir`. |
+| `name`, `description` | no | Labels. |
+
+Any user can register a cluster config, and it belongs to them. Sharing one 
with a user or a [group](api.md#groups) lets others submit under it without 
seeing the key. This is how, for example, a PI can let a team charge a group 
allocation. A `READ` share is enough to submit runs and discover allocations. A 
`WRITE` share also lets the grantee edit the config. Only the owner can delete 
it or manage its shares. See [sharing.md](sharing.md).
+
+---
+
+## Registering with the dashboard
+
+The dashboard is at `http://localhost:3000/dashboard/` when it runs locally 
(see [INSTALL.md](../INSTALL.md)). Cluster screens are under **Compute 
clusters**.
+
+### Before you start
+
+Register an **SSH credential** on the **SSH credentials** page, or create one 
from the **New…** button inside the cluster dialog. Its public key must be 
installed for the account you will log in as. Discovery opens a real SSH 
session.
+
+### Add a cluster and detect its partitions
+
+Open **Compute clusters → Clusters → Add cluster**. The dialog has three steps:
+
+1. **Cluster.** Enter the name and head node host. The head node port defaults 
to 22. Fill in *Slurm home* if Slurm is not on the login `PATH`, and *Data 
host* if the cluster has a DTN.
+
+2. **Cluster login.** Enter a *Login user*, choose an *SSH credential* and 
click **Discover partitions**. Airavata logs in to the head node and runs:
+
+   - `scontrol show partition -o` to get each partition's name, time limits, 
node limits, total CPUs, node list and default flag
+   - `sinfo -h -a -o '%R|%c|%m|%G'` to get the per-node CPU count, memory and 
GPUs/GRES, which `scontrol` reports only as partition totals
+
+   Both commands run under *Slurm home* when it is set. A successful discovery 
therefore also shows that job submission will find its binaries.
+
+   If the credential is **interactive** (for example, one that needs an MFA 
code), a login prompt appears on the **Interactive auth** page. Answer it 
there. Discovery waits up to five minutes.
+
+   Leave **Also save this login as my cluster config** checked and enter a 
*Work root* to save the login as your own cluster config in the same step. You 
won't need to enter it again later.
+
+3. **Partitions.** The discovered partitions appear here as editable rows. 
Review them: fix values, remove queues you don't want users to target, or add 
more with **+ Add partition**. You can also skip step 2 and fill this section 
in by hand.
+
+Click **Add cluster**. The cluster and all its partitions are saved together, 
so the cluster never appears with only some of its partitions. If the cluster 
saves but the cluster config doesn't, the button changes to **Retry saving 
cluster config**. It retries only the config, without registering the cluster 
again.
+
+To see a registered cluster's head node, data host and partitions, click its 
row.
+
+How discovered values map to partition fields:
+
+| Partition field | Detected from |
+|---|---|
+| `maxRunTime`, `defaultWalltime` | `MaxTime`, `DefaultTime`, converted to 
minutes. Left empty for `UNLIMITED` / `NONE`. |
+| `maxNodes` | `MaxNodes`, or `TotalNodes` when unlimited |
+| `maxProcessors` | `TotalCPUs` |
+| `cpuPerNode`, `maxMemory` | the largest node `sinfo` reports. `maxMemory` 
uses `MaxMemPerNode` if the partition sets one. |
+| `gres` | all GRES on the partition's nodes, without socket bindings |
+| `nodes`, `isDefaultQueue` | `Nodes`, `Default=YES` |
+
+If `sinfo` fails, the per-node fields are left empty and discovery still 
succeeds. `description`, `defaultNodeCount`, `defaultCpuCount`, 
`maxJobsInQueue` and `isCheckpointable` are not detected. Fill them in by hand 
if you want them.
+
+### Add your login to an existing cluster
+
+Open **Compute clusters → Cluster configs → Add cluster config**, then choose 
the cluster, enter your login user and work root, and pick your SSH credential. 
Configs you own are listed under **My cluster configs**. Configs others have 
shared with you are under **Shared with me**, with the permission each one 
grants.
+
+### Detect allocations
+
+The account a job is charged to (`allocation`, the Slurm account) is also 
detected rather than typed. Wherever the dashboard asks for a resource request 
(when creating an application deployment, and when starting a run), the 
**Allocation** field has a **Discover** button. It logs in using the selected 
cluster config and runs:
+
+- `sacctmgr -nP show associations where user=<loginUser> 
format=Account,Partition,QOS`
+- `sshare -h -P -U -u <loginUser> -o Account` if `sacctmgr` is closed to 
ordinary users. This lists the same accounts without their limits.
+
+Each account the login may charge appears as a button you can click to choose 
it. Hovering shows its description, the partitions it is limited to and its 
QOS. If an account is limited to partitions other than the deployment's 
partition, it is marked **other partitions** and a warning appears when you 
select it. If only one account is found and the field is empty, it is filled in 
automatically.
+
+On the deployment form, **Discover allocations as** picks which of your logins 
on the cluster to ask.
+
+---
+
+## Registering with the API
+
+The same steps through the API. Full request and response bodies are in 
[api.md](api.md#slurm-clusters).
+
+```bash
+# 1. Detect partitions (uses an SSH credential you own)
+PARTITIONS=$(curl -s -X POST 
localhost:9095/api/v1/slurm-clusters/discover-partitions \
+  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
+  -d '{
+    "headnodeHost": "login.expanse.sdsc.edu",
+    "headnodePort": 22,
+    "slurmHome": null,
+    "loginUser": "airavata",
+    "sshCredentialId": "'"$SSH_CREDENTIAL_ID"'"
+  }' | jq '.partitions')
+
+# 2. Register the cluster with those partitions
+CLUSTER_ID=$(curl -s -X POST localhost:9095/api/v1/slurm-clusters \
+  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
+  -d '{
+    "clusterName": "expanse",
+    "headnodeHost": "login.expanse.sdsc.edu",
+    "headnodePort": 22,
+    "dataHost": "dtn.expanse.sdsc.edu",
+    "dataPort": 22,
+    "partitions": '"$PARTITIONS"'
+  }' | jq -r '.slurmClusterId')
+
+# 3. Register your login
+CLUSTER_CONFIG_ID=$(curl -s -X POST 
localhost:9095/api/v1/slurm-cluster-configs \
+  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
+  -d '{
+    "slurmClusterId": "'"$CLUSTER_ID"'",
+    "loginUser": "airavata",
+    "workRoot": "/expanse/lustre/scratch/airavata/jobs",
+    "sshCredentialId": "'"$SSH_CREDENTIAL_ID"'"
+  }' | jq -r '.slurmClusterConfigId')
+
+# 4. Detect the allocations that login may charge (owner, or anyone the config 
is shared with)
+curl -s -X POST 
localhost:9095/api/v1/slurm-cluster-configs/"$CLUSTER_CONFIG_ID"/discover-allocations
 \
+  -H "Authorization: Bearer $TOKEN"
+```
+
+### Changing partitions later
+
+Partitions can be included in the body only when a cluster is **created**. A 
`PUT` on a cluster that includes `partitions` is rejected with `400`. To change 
partitions afterwards, use the partition endpoints:
+
+```
+POST   /api/v1/slurm-clusters/{clusterId}/partitions                  # add 
one (e.g. a new GPU queue)
+PUT    /api/v1/slurm-clusters/{clusterId}/partitions/{partitionId}    # change 
one
+DELETE /api/v1/slurm-clusters/{clusterId}/partitions/{partitionId}    # remove 
one
+```
+
+To refresh a cluster's layout after the site changes it, run 
**discover-partitions** again and compare the result with the stored 
partitions. Then add, update or remove partitions one at a time.
+
+Deployments refer to a partition by **name**, not by id. Deleting or renaming 
a partition is not checked against the deployments that use it, so update those 
deployments' `defaultPartition` as well.
+
+### Deleting
+
+- Deleting a **partition** never conflicts.
+- Deleting a **cluster** removes its partitions with it. It is refused (`409 
Conflict`) while any cluster config still logs in to the cluster. The owners of 
those configs have to delete them first.
+- Deleting a **cluster config** is limited to its owner (or an admin) and 
removes its shares with it.
+
+---
+
+## Errors you may see during discovery
+
+| Status | Usually means |
+|---|---|
+| `403 Forbidden` | The SSH credential used for partition discovery belongs to 
someone else. For allocation discovery, the config isn't yours and hasn't been 
shared with you. |
+| `409 Conflict` | `scontrol` returned no partitions, or the config is missing 
its cluster or credential. |
+| `502 Bad Gateway` | The login or Slurm command failed. The message says why: 
the key was refused, the host could not be reached, or Slurm was not found (set 
*Slurm home*). |
+
+---
+
+## How runs use this
+
+When a run is launched, Airavata logs in to the cluster's head node under the 
run's **cluster config**. It creates the work directory under the config's work 
root, stages the run's data into it, writes the batch script and submits it 
with `sbatch` to the deployment's partition. The `#SBATCH` header is built from 
the run's resource request, including its allocation. See 
[application.md](application.md) for how deployments and runs are put together.
diff --git a/docs/data-product.md b/docs/data-product.md
new file mode 100644
index 0000000000..bde24ae6f3
--- /dev/null
+++ b/docs/data-product.md
@@ -0,0 +1,150 @@
+# Data Products
+
+A **data product** is a dataset registered with Airavata: one file or one 
directory, at a known path on a known storage host. It is how Airavata refers 
to data. An [application](application.md) run names its data inputs and outputs 
by data product id rather than by path, and Airavata uses the product to know 
where to copy the data from or to.
+
+A product records *where* the data is, not the data itself. Registering one 
does not contact the host, and an output product's path need not exist yet.
+
+```
+SSH credential  ◀──  Data storage  ◀──  Data product  ◀──  Process input / 
output mapping
+ (key pair)          host, port,        path, file or
+                     login user         directory
+```
+
+Setting up data takes two steps:
+
+1. Register a **data storage**. This is the host and account the data is 
reached through. You need one per host and account, and you can reuse it for 
many products.
+2. Register a **data product** on that storage for each file or directory.
+
+---
+
+## Data storage
+
+A data storage says how to reach a host. The supported storage type is 
**SCP**: files are copied over SSH.
+
+| Field | Required | Meaning |
+|---|---|---|
+| `dataName` | yes | A name for the storage, e.g. `lab-sequences` or 
`expanse-scratch`. |
+| `hostName` | yes | The host the data sits on. |
+| `port` | no | The SSH port (default `22`). |
+| `loginUser` | yes | The account to log in as. |
+| `sshCredentialId` | yes | An [SSH credential](api.md#ssh-credentials) **you 
own**, whose public key is authorised for `loginUser` on the host. |
+
+A product names no credential of its own. The host, the account and the key 
all come from its storage, so many products can be registered on one storage 
without repeating any of them. One SSH credential can be reused by several 
storages when its public key is installed for several accounts.
+
+```bash
+STORAGE_ID=$(curl -s -X POST localhost:9095/api/v1/scp-data-storages \
+  -H "Authorization: Bearer $TOKEN" \
+  -H "Content-Type: application/json" \
+  -d '{
+    "dataName": "lab-sequences",
+    "hostName": "data.lab.example.edu",
+    "port": 22,
+    "loginUser": "labuser",
+    "sshCredentialId": "'"$SSH_CREDENTIAL_ID"'"
+  }' | jq -r '.dataId')
+```
+
+A storage cannot be deleted while products are still registered on it (`409 
Conflict`).
+
+---
+
+## Data product
+
+| Field | Required | Meaning |
+|---|---|---|
+| `dataName` | yes | A name for the dataset. |
+| `dataDescription` | no | Free text. |
+| `isFile` | yes | `true` for a single file, `false` for a directory. |
+| `path` | yes | The absolute path of the file or directory on the storage 
host. |
+| `dataStorageId` | yes | The storage it lives on. You must be able to read 
that storage. |
+| `dataStorageType` | no | `SCP` (the default). |
+
+The server sets the remaining fields: `dataId`, `ownerId` (taken from your 
token), `provisionStatus` and `createdAt`.
+
+```bash
+DATA_ID=$(curl -s -X POST localhost:9095/api/v1/data-products \
+  -H "Authorization: Bearer $TOKEN" \
+  -H "Content-Type: application/json" \
+  -d '{
+    "dataName": "T1050-sequence",
+    "dataDescription": "Target protein sequence in FASTA format",
+    "isFile": true,
+    "path": "/data/sequences/T1050.fasta",
+    "dataStorageId": "'"$STORAGE_ID"'"
+  }' | jq -r '.dataId')
+```
+
+### Files and directories
+
+`isFile` decides which application inputs and outputs a product can be used 
for:
+
+| Product | Can be used as |
+|---|---|
+| file (`isFile: true`) | a `FILE` input, an element of a `FILE_LIST` input, 
or a `FILE` output |
+| directory (`isFile: false`) | a `DIRECTORY` input, a `DIRECTORY` output, or 
a `FILE_LIST` output (the files are collected into it) |
+
+### Provision status
+
+`provisionStatus` tracks whether the data the product describes is actually at 
its path:
+
+| Status | Meaning |
+|---|---|
+| `REGISTERD` | Registered. The data may or may not be there yet. This is the 
initial state. |
+| `PROVISIONING` | The data is being written. |
+| `PROVISIONED` | The data is at its path, e.g. after a successful upload. |
+| `DEPROVISIONING` / `DEPROVISIONED` | The data is being removed or has been 
removed. |
+| `FAILED` | Provisioning failed. |
+
+The server moves this status. A request cannot set it.
+
+---
+
+## Moving content
+
+A data product's content gets to its path in one of three ways:
+
+- **It is already there.** Register the product against the existing path.
+- **Upload it through Airavata.** `PUT /api/v1/data-products/{dataId}/content` 
sends the bytes to the product's path on its storage. You can send a raw body 
or a multipart part named `file`. Missing parent directories are created, and 
the limit is 5 GiB. A successful upload marks the product `PROVISIONED`. `GET 
.../content` downloads it. Both work for file products only.
+- **A run writes it.** When a product is mapped as an application output, 
Airavata copies the job's result to the product's path after the job finishes.
+
+Transfers use the storage's credential on the user's behalf. A user who has 
been shared a product can download it without having access to the storage or 
seeing the key.
+
+---
+
+## Ownership and sharing
+
+A product belongs to whoever registered it. Others reach it through a share, 
granted to a user or a [group](api.md#groups):
+
+| Standing | May do |
+|---|---|
+| `READ` | read the product and download its content |
+| `WRITE` | the above, edit the product and upload content |
+| Owner (or admin) | the above, delete it and manage its shares |
+
+Storages are shared the same way. `READ` on a storage lets another user 
register products on it. See [sharing.md](sharing.md) for the request format.
+
+Listings never expose products you cannot reach. `/api/v1/data-products/me` 
lists what you own, and `/shared-with-me` lists what has been shared with you.
+
+---
+
+## Using data products in an application run
+
+A run's `inputMappings` and `outputMappings` carry product ids for data-typed 
declarations:
+
+```json
+"inputMappings": [
+  { "templateInputId": "<FILE input>",      "value": "<file dataId>" },
+  { "templateInputId": "<FILE_LIST input>", "value": "{\"values\":[\"<file 
dataId>\",\"<file dataId>\"]}" },
+  { "templateInputId": "<DIRECTORY input>", "value": "<directory dataId>" }
+],
+"outputMappings": [
+  { "templateOutputId": "<FILE output>",      "value": "<file dataId>" },
+  { "templateOutputId": "<DIRECTORY output>", "value": "<directory dataId>" }
+]
+```
+
+At launch, Airavata copies each input product from its storage into the run's 
work directory on the cluster. After the job finishes, it copies each output 
from the work directory to its product's storage and path. The input and output 
products can be on different storages. For example, inputs can come from a lab 
data server and results can go to the cluster's scratch filesystem. See 
[application.md](application.md) for how the run section sees these paths.
+
+To arrange products from different storages into one browsable folder tree, 
see [virtual-data.md](virtual-data.md).
+
+Full request and response bodies are in [api.md](api.md#data-products) and 
[api.md](api.md#scp-data-storages).
diff --git a/docs/interactive-auth.md b/docs/interactive-auth.md
new file mode 100644
index 0000000000..452b29677f
--- /dev/null
+++ b/docs/interactive-auth.md
@@ -0,0 +1,173 @@
+# Interactive Authentication
+
+Most HPC systems no longer accept an SSH key on its own. Logging in to a 
cluster usually also asks for a password, a one-time code or a Duo push. This 
**multi-factor authentication** is designed to need a person. Tools that reach 
the cluster for you, such as job submitters, file transfer clients and workflow 
engines, either have to stop and wait for that person or can't be used at all.
+
+Airavata supports both. Runs remain an automated workflow (stage in, submit, 
monitor, stage out), and when a cluster asks for a second factor, Airavata 
pauses that login, asks **you** for the answer, and then continues. You answer 
once per login, not once per command. Everything else in the run is automated.
+
+---
+
+## How it maps to an SSH credential
+
+Interactive authentication is a property of an [SSH 
credential](api.md#ssh-credentials). A credential has an SSH key pair and one 
flag:
+
+| Field | Meaning |
+|---|---|
+| `privateKey`, `publicKey`, `passphrase` | The key pair. Airavata always 
offers it first. |
+| `fullInteractive` | `true` if the host **also** asks keyboard-interactive 
questions (password, OTP, Duo) after the key. Default `false`. |
+
+In the dashboard, this is the checkbox **"Host also asks keyboard-interactive 
questions (password, OTP, Duo) — answer them from this dashboard"** when you 
register a credential.
+
+A credential is not used on its own. It is attached to whatever logs in to a 
host:
+
+```
+SSH credential (fullInteractive) ──▶ Cluster config  ──▶ runs: job submission, 
monitoring, staging
+                                 ──▶ Data storage    ──▶ data product 
upload/download, staging
+                                 ──▶ (direct use)    ──▶ partition discovery, 
allocation discovery
+```
+
+Any login that uses a `fullInteractive` credential can raise an interactive 
auth. The prompt goes to the **user whose action caused the login**:
+
+| Login caused by | Prompt goes to |
+|---|---|
+| A run (staging, submission, monitoring) | the owner of the process |
+| Uploading or downloading data product content | the user making the request |
+| Partition or allocation discovery | the user making the request |
+
+This affects shared cluster configs and storages. If you share a config that 
uses an interactive credential, a teammate who launches a run under it is the 
one asked for the password and second factor. Share an interactive login only 
with people who can answer its prompts.
+
+When the login starts, Airavata:
+
+1. Connects and offers the key.
+2. If the host asks keyboard-interactive questions or a password, creates an 
**interactive auth**. This records the host, login user, credential, the host's 
banner and the prompts. The login then waits.
+3. Waits for that user to answer, sends the answers to the host, and lets the 
login proceed.
+
+If the host asks again, for example a Duo prompt after the password, that is a 
**new** interactive auth with a new id.
+
+### Answer once per login
+
+An authenticated connection is kept and reused by every operation that logs in 
with the same host, login user and credential on behalf of the same user. For 
one run, that covers stage-in, submission, monitoring and stage-out. You answer 
once, and the steps that follow use the same connection. The connection is 
closed after five minutes without use, and the next login asks again.
+
+---
+
+## What an interactive auth looks like
+
+```json
+{
+  "authId": "00000000-0000-4000-8000-000000000001",
+  "hostName": "login.cluster.example.edu",
+  "port": 22,
+  "loginUser": "jdoe",
+  "sshCredentialId": "00000000-0000-4000-8000-000000000002",
+  "banner": "\nExample HPC Cluster\n\nLogin with your password + Duo 
multi-factor.\n",
+  "name": "",
+  "instruction": "",
+  "prompts": [ { "text": "Password: ", "echo": false } ],
+  "createdAt": "2026-10-30T14:02:11.482Z"
+}
+```
+
+| Field | Meaning |
+|---|---|
+| `hostName`, `port`, `loginUser`, `sshCredentialId` | Which login is waiting. 
Show these so you know what you are answering. |
+| `banner` | The host's pre-login message, as a terminal would print it. |
+| `name`, `instruction` | Any heading the host sent with the prompts. |
+| `prompts[]` | The questions. `echo: false` means the answer is secret (a 
password or OTP) and should be masked. |
+
+The answer is one response per prompt, in order: `{"responses": 
["<password>"]}`. You can instead send `{"cancel": true}` to fail the login 
immediately rather than leave it waiting.
+
+Answers go straight to the SSH handshake. They are **not logged or stored**.
+
+An auth exists only while its login is waiting. It disappears once it is 
answered or the login gives up. Only the user it was raised for can see or 
answer it. Admins cannot see other users' auths either.
+
+---
+
+## If you don't answer in time
+
+A run doesn't need you to be watching the moment it starts. If a prompt is not 
answered before the login gives up, that step fails like any other failed 
connection. It is retried according to its retry settings (staging steps retry 
up to three times, and each retry can raise a new prompt). If the run still 
fails, **retry the process**:
+
+```bash
+curl -s -X POST localhost:9095/api/v1/processes/"$PROCESS_ID"/retry \
+  -H "Authorization: Bearer $TOKEN"
+```
+
+A retry continues from the step that failed. Steps that already completed are 
skipped, inputs that were already staged are not copied again, and a submitted 
job is never submitted twice. The retry raises a new prompt, which you answer, 
and the run carries on. The dashboard's process view has the same retry action. 
See [Retry a Process](api.md#retry-a-process).
+
+Partition and allocation discovery work the same way, but the request itself 
waits for up to five minutes for you to answer. If no answer arrives in time, 
run the discovery again.
+
+---
+
+## Answering prompts
+
+### Dashboard (recommended)
+
+The dashboard keeps a live connection open for you. When any of your logins is 
waiting:
+
+- a dialog, **"SSH login needs your answer"**, opens on whatever page you have 
open. It shows the host, the banner and the prompts, with secret prompts masked.
+- the sidebar shows a badge with the number of waiting logins.
+- **Interactive auth requests** lists every waiting login, so you can answer 
them in any order.
+
+Click **Later** to hide a prompt until another one arrives. The login keeps 
waiting, and the badge still shows it.
+
+Keeping a dashboard tab open while runs are active is the simplest way to make 
sure prompts are answered on time.
+
+### WebSocket API
+
+Clients that want to be notified as soon as a prompt appears should subscribe:
+
+```
+GET /api/v1/ssh-interactive-auths/ws
+```
+
+The socket sends your oldest waiting auth as a challenge, or `idle` when 
nothing is waiting. When that auth is answered, here or anywhere else, or 
abandoned, it sends the next one.
+
+```
+◀ {"type":"challenge","auth":{"authId":"3f2c…","prompts":[{"text":"Password: 
","echo":false}], …}}
+▶ {"authId":"3f2c…","responses":["<password>"]}
+◀ {"type":"accepted","authId":"3f2c…"}
+◀ {"type":"challenge","auth":{"authId":"9a1b…","prompts":[{"text":"Duo 
passcode: ","echo":true}], …}}
+▶ {"authId":"9a1b…","responses":["<passcode>"]}
+◀ {"type":"accepted","authId":"9a1b…"}
+◀ {"type":"idle"}
+```
+
+Authentication works as it does for any other route. Send `Authorization: 
Bearer $TOKEN` on the upgrade request. A browser, which cannot set that header, 
offers the token as a subprotocol instead (`base64url.bearer.<token>` alongside 
`airavata.v1`).
+
+```bash
+websocat -H="Authorization: Bearer $TOKEN" 
"ws://localhost:9095/api/v1/ssh-interactive-auths/ws"
+```
+
+To answer one specific auth, use `GET 
/api/v1/ssh-interactive-auths/{authId}/ws`. It sends that auth's challenge, 
accepts one answer and closes.
+
+### REST
+
+For clients that can't keep a socket open:
+
+```
+GET  /api/v1/ssh-interactive-auths                     # your waiting logins, 
oldest first
+GET  /api/v1/ssh-interactive-auths/{authId}            # one of them
+POST /api/v1/ssh-interactive-auths/{authId}/response   # {"responses": [...]} 
or {"cancel": true}
+```
+
+`204` means Airavata passed the answer to the host. It does not mean the host 
accepted it. A wrong password shows up as the step failing, or as a new prompt 
if the host asks again. With REST you have to poll the list to find out when a 
prompt appears, which is why the WebSocket or the dashboard works better for 
runs.
+
+Full request, response and error details are in 
[api.md](api.md#list-interactive-ssh-auths).
+
+### MCP
+
+The [Airavata MCP server](mcp.md) supports interactive auth already. When a 
run, discovery or transfer is waiting on a prompt, the assistant tells you to 
answer it in a terminal:
+
+```bash
+airavata-mcp ssh-auth
+```
+
+This command shows each waiting login and reads secret answers without echoing 
them. Passwords and codes are never typed into the AI conversation, and the 
assistant is instructed never to ask for them there.
+
+---
+
+## Setting up an interactive credential
+
+1. **Register the credential** with `fullInteractive: true`. Install its 
public key for your account on the host as usual. Airavata still offers the key 
first.
+2. **Attach it** to a [cluster config](batch-clusters.md#cluster-config) or a 
[data storage](data-product.md#data-storage).
+3. **Keep a way to answer open**, such as a dashboard tab, a WebSocket client 
or `airavata-mcp ssh-auth`, whenever you launch runs, discover partitions or 
allocations, or move data through that login.
+
+If a host needs only a key, leave `fullInteractive` off. Logins then never 
wait on a person, and runs are fully unattended.
diff --git a/docs/virtual-data.md b/docs/virtual-data.md
new file mode 100644
index 0000000000..558d333e3b
--- /dev/null
+++ b/docs/virtual-data.md
@@ -0,0 +1,160 @@
+# Virtual Data
+
+A **virtual dataset** is a folder tree you build out of [data 
products](data-product.md). It gives scattered data one browsable layout. For 
example, files on a lab server, a directory on a cluster's scratch space and 
the results of several runs can all appear together under `my-study/`, without 
any of them being moved or copied.
+
+The tree holds **references only**. Each entry points at a data product, which 
still says where the data actually lives. Creating, renaming, moving or 
deleting an entry never touches a storage host.
+
+```
+my-study/                         virtual data directory (root)    ── owned by 
you
+├── inputs/                       virtual data directory
+│   ├── T1050.fasta               virtual data file  ──▶ file product on 
lab-sequences
+│   └── T1051.fasta               virtual data file  ──▶ file product on 
lab-sequences
+├── reference-db/                 virtual data directory ──▶ directory product 
on expanse-scratch
+└── results/
+    └── run-1/
+        └── confidence.json       virtual data file  ──▶ file product written 
by a run
+```
+
+The same product can appear in several trees, or several times in one tree, 
under different names.
+
+---
+
+## Building blocks
+
+### Virtual data directory
+
+A directory node is one of two kinds:
+
+| Kind | `dataProductId` | Holds |
+|---|---|---|
+| **Container** | not set | other directories and files, like an ordinary 
folder |
+| **Product-backed** | a **directory** data product | nothing. It stands for 
that product's whole directory and cannot have children. |
+
+| Field | Required | Meaning |
+|---|---|---|
+| `directoryName` | yes | One path segment. It cannot be `.` or `..` or 
contain `/`, `\` or a NUL character. |
+| `parentDirectoryId` | no | The directory it sits in. If this is left out, 
the node is a **root**, which is the top of a new dataset. |
+| `dataProductId` | no | Set this to make the node product-backed. |
+
+### Virtual data file
+
+A file is a leaf that stands for one **file** data product.
+
+| Field | Required | Meaning |
+|---|---|---|
+| `fileName` | yes | One path segment, with the same rules as `directoryName`. 
It need not match the product's real file name. |
+| `parentDirectoryId` | yes | The directory it sits in. Every file has one, so 
a file cannot be a root. |
+| `dataProductId` | yes | A **file** data product. |
+
+### Naming rules
+
+- Names are unique within a directory across both kinds. A file and a 
directory in the same directory cannot share a name.
+- Root names are unique per owner. You cannot have two datasets called 
`my-study`, but another user can.
+- A product's `isFile` must match the node that uses it. A file node takes a 
file product and a product-backed directory takes a directory product. A 
mismatch is `400 Bad Request`.
+- A name collision is `409 Conflict`.
+
+---
+
+## Building a dataset
+
+Register the data products first (see [data-product.md](data-product.md)), 
then lay out the tree.
+
+```bash
+# A root: a new dataset owned by the caller
+ROOT_ID=$(curl -s -X POST localhost:9095/api/v1/virtual-data-directories \
+  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
+  -d '{ "directoryName": "my-study" }' | jq -r '.virtualDataDirectoryId')
+
+# A container inside it
+INPUTS_ID=$(curl -s -X POST localhost:9095/api/v1/virtual-data-directories \
+  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
+  -d '{ "directoryName": "inputs", "parentDirectoryId": "'"$ROOT_ID"'" }' | jq 
-r '.virtualDataDirectoryId')
+
+# A file in the container, standing for a file product
+curl -s -X POST localhost:9095/api/v1/virtual-data-files \
+  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
+  -d '{ "fileName": "T1050.fasta", "parentDirectoryId": "'"$INPUTS_ID"'", 
"dataProductId": "'"$FASTA_DATA_ID"'" }'
+
+# A product-backed directory, standing for a directory product
+curl -s -X POST localhost:9095/api/v1/virtual-data-directories \
+  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
+  -d '{ "directoryName": "reference-db", "parentDirectoryId": "'"$ROOT_ID"'", 
"dataProductId": "'"$DB_DATA_ID"'" }'
+```
+
+To place a product in a tree, you need `READ` on the product and `WRITE` on 
the directory you are adding to.
+
+### Browsing
+
+```
+GET /api/v1/virtual-data-directories/me                          # roots of 
your own datasets
+GET /api/v1/virtual-data-directories/shared-with-me              # directories 
shared with you
+GET /api/v1/virtual-data-directories/{id}                        # one 
directory, without contents
+GET /api/v1/virtual-data-directories/{id}/contents               # one 
directory plus its direct children
+GET /api/v1/virtual-data-directories/{id}/files                  # just the 
files directly under it
+GET /api/v1/virtual-data-files/{id}                              # one file
+```
+
+`/contents` returns **one level** (`virtualDataFiles` and 
`virtualDataDirectories`). To walk a deeper tree, call it again on each child 
directory. Every response includes a `permission` field saying what you hold on 
that node.
+
+### Renaming and moving
+
+`PUT` replaces a node, and the same call renames it, moves it (by changing 
`parentDirectoryId`) or points it at a different product.
+
+- An update replaces the whole node. To rename a nested directory, send its 
`parentDirectoryId` back too. Leaving it out moves the directory out to become 
a root.
+- A move needs `WRITE` on both the old and the new parent. A directory cannot 
be moved into its own subtree.
+- A container that still has entries cannot be turned into a product-backed 
directory (`409 Conflict`).
+
+### Deleting
+
+| Delete | Removes | Needs |
+|---|---|---|
+| A file (`DELETE /api/v1/virtual-data-files/{id}`) | that entry | `WRITE` on 
its directory |
+| A directory (`DELETE /api/v1/virtual-data-directories/{id}`) | the 
directory, **everything beneath it**, and every share made anywhere in that 
subtree | ownership (yours or an ancestor's), or admin |
+
+Deleting virtual entries never deletes data products or data. The products 
stay registered and their data stays where it is. In the other direction, a 
product that a virtual dataset still uses cannot be deleted until those entries 
are removed.
+
+---
+
+## Ownership and sharing
+
+A dataset belongs to whoever created its root. Ownership covers the whole 
tree. A directory that someone else adds to your dataset, using a `WRITE` 
share, still belongs to you, not to them.
+
+Directories are shared like other records ([sharing.md](sharing.md)), with one 
difference: **a share applies to the whole subtree** below the directory it is 
made on.
+
+| Standing on a directory | May do |
+|---|---|
+| `READ` | browse it and everything below it |
+| `WRITE` | the above, and add, rename, move and remove entries inside it |
+| Owner (or admin) | the above, delete it, and manage its shares |
+
+- A user can share part of a dataset by sharing an interior directory. The 
grantee sees that directory as their top level in `/shared-with-me` and cannot 
see anything above it.
+- The strongest grant anywhere in a node's ancestry applies. `WRITE` on the 
root and `READ` on a nested directory still means `WRITE` there.
+- Files carry no shares of their own. Access to a file comes from its 
directory.
+- `GET .../{id}/shares` lists only the grants made **at that node**, not the 
ones it inherits from above.
+
+**Sharing a dataset does not share its data.** A virtual share lets someone 
see the tree: names, layout and which product each entry uses. Downloading a 
product's content, or using it in a run, is still governed by the product's own 
shares. To let a collaborator use the data, share the products (or their 
storage) as well. See [data-product.md](data-product.md#ownership-and-sharing).
+
+---
+
+## Endpoints
+
+```
+GET    /api/v1/virtual-data-directories                          (admin)
+GET    /api/v1/virtual-data-directories/me
+GET    /api/v1/virtual-data-directories/shared-with-me
+POST   /api/v1/virtual-data-directories
+GET    /api/v1/virtual-data-directories/{id}                     (READ)
+GET    /api/v1/virtual-data-directories/{id}/contents            (READ)
+GET    /api/v1/virtual-data-directories/{id}/files               (READ)
+PUT    /api/v1/virtual-data-directories/{id}                     (WRITE)
+DELETE /api/v1/virtual-data-directories/{id}                     (owner)
+
+POST   /api/v1/virtual-data-files                                (WRITE on 
parent)
+GET    /api/v1/virtual-data-files/{id}                           (READ on 
parent)
+PUT    /api/v1/virtual-data-files/{id}                           (WRITE on 
parent)
+DELETE /api/v1/virtual-data-files/{id}                           (WRITE on 
parent)
+
+GET|POST|PUT|DELETE /api/v1/virtual-data-directories/{id}/shares[/{sharingId}] 
  (owner)
+```
+
+Files are addressed at the top level, not under their directory, so a file 
keeps its URL when it is moved.

Reply via email to