Skip to content

Agent Mesh

docs: re-enroll uses the saved login session

Tomas Tormoc1ee39e09a35
diff --git a/mobile/sam-node-app/README.md b/mobile/sam-node-app/README.md
index b88842ec..b3298444 100644
--- a/mobile/sam-node-app/README.md
+++ b/mobile/sam-node-app/README.md
@@ -98,7 +98,7 @@ Exposes capabilities directly to the OS registry, allowing native assistants (li
1. **Dashboard Tab**: Displays current status, Node ID, connected peers, and DHT size.
2. **Services Tab**: Allows enabling/disabling embedded sensors (Battery/Location) and bridging external local MCP servers.
-3. **Config Tab**: The node's labels and attenuation, the app's stand-in for `sam-node.yaml`. Labels (comma-separated `key=value`) are set here; the control plane attests them into the node's Biscuit at enrollment, so changing them later means pressing Re-enroll, which runs the browser login again and keeps the node's identity. Attenuation is Datalog rules, policies and checks that limit who may call this node, one statement per line (e.g. `check if label("region", "eu-west-1");`). They are read when the node starts, and a syntax error fails the start. Same syntax and same errors as the `attenuation` block of `sam-node.yaml`; see [Node configuration §3](../../site/content/docs/user/node-configuration.md#3-defining-local-security-target-attenuation).
+3. **Config Tab**: The node's labels and attenuation, the app's stand-in for `sam-node.yaml`. Labels (comma-separated `key=value`) are set here; the control plane attests them into the node's Biscuit at enrollment, so changing them later means pressing Re-enroll, which re-attests them with the login session saved at enrollment (the browser opens only if that session has expired) and keeps the node's identity. Attenuation is Datalog rules, policies and checks that limit who may call this node, one statement per line (e.g. `check if label("region", "eu-west-1");`). They are read when the node starts, and a syntax error fails the start. Same syntax and same errors as the `attenuation` block of `sam-node.yaml`; see [Node configuration §3](../../site/content/docs/user/node-configuration.md#3-defining-local-security-target-attenuation).
---
diff --git a/site/content/docs/development/mobile.md b/site/content/docs/development/mobile.md
index 7229c45a..8d8c94f2 100644
--- a/site/content/docs/development/mobile.md
+++ b/site/content/docs/development/mobile.md
@@ -41,7 +41,7 @@ To run `sam-node` on mobile with near-zero codebase maintenance, we avoid rewrit
1. **Go FFI Binding Package (`mobile/sam-node-ffi/`)**: Contains CGO-exported functions (`StartNode`, `StopNode`, `EnrollNode`, `GetNodeID`, `FreeString`) which compile into a C-shared library (`.so`) or static archive (`.a`).
2. **Flutter App (`mobile/sam-node-app/`)**: A cross-platform app containing:
- `lib/sam_ffi.dart`: The Dart FFI wrapper loading the Go library and exposing Dart methods.
- - `lib/main.dart`: Simple control UI to enroll and start/stop the background node. The Config tab holds the node's labels and attenuation, the app's stand-in for `sam-node.yaml`. Labels (comma-separated `key=value`, the wire format of the `labels` map) are set there; the control plane mints them into the node's Biscuit at enrollment, and the app keeps a copy in its data directory and sends it again on every start. Biscuit refresh re-mints the labels stored at enrollment, so changing them means enrolling again, which the tab's Re-enroll button does through the browser login while keeping the node's identity. Unlike the CLI, which re-reads them from its config file on every run, the app remembers them. The same tab accepts local Datalog rules, policies and checks (one statement per line) in place of the CLI's `attenuation` block; the app stores them as `attenuation.json` in the same data directory and sends them on every start, and the FFI parses them with the same code path the config file uses.
+ - `lib/main.dart`: Simple control UI to enroll and start/stop the background node. The Config tab holds the node's labels and attenuation, the app's stand-in for `sam-node.yaml`. Labels (comma-separated `key=value`, the wire format of the `labels` map) are set there; the control plane mints them into the node's Biscuit at enrollment, and the app keeps a copy in its data directory and sends it again on every start. Biscuit refresh re-mints the labels stored at enrollment, so changing them means enrolling again, which the tab's Re-enroll button does while keeping the node's identity: the app asks the OIDC provider for `offline_access`, the FFI stores the refresh token like the CLI does, and `ReEnrollNode` trades it for a JWT; the browser login runs only when that fails. Unlike the CLI, which re-reads them from its config file on every run, the app remembers them. The same tab accepts local Datalog rules, policies and checks (one statement per line) in place of the CLI's `attenuation` block; the app stores them as `attenuation.json` in the same data directory and sends them on every start, and the FFI parses them with the same code path the config file uses.
3. **Local Loopback Communication**:
- The Flutter Dart environment controls the node lifecycle (construction, starting, stopping) via FFI.
- Any actual tool registration, discovery, or mesh API queries are performed using standard HTTP JSON-RPC calls over local loopback (`127.0.0.1`) to the `sam-node` sidecar API.