@ours.network/install 1.2.1-nightly.2 → 1.2.1-nightly.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/GATEWAY_SETUP.md +178 -0
  2. package/README.md +337 -12
  3. package/ROOTLESS_PODMAN_VALIDATION.md +210 -0
  4. package/assets/Dockerfile +16 -12
  5. package/assets/Dockerfile.gateway +5 -0
  6. package/assets/docker-compose.yaml +21 -1
  7. package/assets/fleet-settings.example.json +48 -0
  8. package/assets/gateway-entrypoint.sh +37 -0
  9. package/assets/release-lock.json +1111 -4265
  10. package/assets/release.json +33 -19
  11. package/assets/scripts/build/build-common.mjs +1 -1
  12. package/assets/scripts/build/build-sdk.mjs +6 -1
  13. package/assets/scripts/maintenance/build-context.mjs +1 -1
  14. package/assets/scripts/maintenance/daemon-owner.mjs +15 -0
  15. package/assets/scripts/maintenance/docker-layout-conversion.mjs +7 -3
  16. package/assets/scripts/maintenance/release-graph.mjs +18 -1
  17. package/assets/scripts/maintenance/state-operation.mjs +4 -2
  18. package/assets/scripts/runtime/client-setup.mjs +3 -3
  19. package/assets/scripts/runtime/entrypoint.sh +1 -1
  20. package/assets/scripts/runtime/legacy-import.mjs +103 -0
  21. package/assets/sources.json +46 -28
  22. package/install.mjs +5 -1
  23. package/lib/build-transition.mjs +1 -0
  24. package/lib/client-cli.mjs +127 -0
  25. package/lib/container-engine.mjs +127 -0
  26. package/lib/docker-conversion-runtime.mjs +3 -2
  27. package/lib/docker-layout-installation.mjs +2 -1
  28. package/lib/docker-runtime-repair.mjs +152 -0
  29. package/lib/effects.mjs +264 -125
  30. package/lib/gateway-transition.mjs +87 -0
  31. package/lib/gateway.mjs +142 -0
  32. package/lib/legacy-migration.mjs +213 -0
  33. package/lib/legacy-state.mjs +205 -0
  34. package/lib/managed-cli.mjs +164 -0
  35. package/lib/orchestrate.mjs +114 -38
  36. package/lib/plan.mjs +22 -9
  37. package/lib/podman-preflight.mjs +40 -0
  38. package/lib/prompt.mjs +113 -119
  39. package/lib/server-onboarding.mjs +63 -16
  40. package/lib/setup-options.mjs +137 -35
  41. package/lib/setup.mjs +30 -16
  42. package/lib/target.mjs +24 -8
  43. package/lib/uninstall.mjs +2 -2
  44. package/lib/usage.mjs +9 -4
  45. package/lib/workspace-setup.mjs +83 -0
  46. package/package.json +4 -2
@@ -0,0 +1,178 @@
1
+ # Set up Ours with one client connection
2
+
3
+ Fleet, the `ours` CLI and MCP clients share `~/.ours-client/profile.json`.
4
+ Set the server address once. The address is the HTTP gateway: clients append
5
+ `/daemon`, `/cowork`, `/messenger` or `/tg-connector` as needed. They do not
6
+ connect to server Unix sockets, discover server state directories, or try port
7
+ 3050 after a connection failure. Fleet's local supervisor/harness sockets still
8
+ control local processes; they do not carry server management requests.
9
+
10
+ ## Release availability
11
+
12
+ The nightly manifest selects one published dependency graph: SDK
13
+ `3.8.1-nightly.14`, CLI `2.8.1-nightly.12`, daemon `3.8.1-nightly.6`,
14
+ Fleet `1.2.0-nightly.17`, MCP/Codex/Claude Code `1.2.0-nightly.9`,
15
+ Telegram `1.0.1-nightly.8`, Messenger `1.0.31-nightly.8`, and Cowork
16
+ `1.3.3-nightly.20260926.ceab465`. Exact archive checksums are retained in
17
+ `releases/nightly.json`; the host CLI uses the same SDK/CLI pair.
18
+
19
+ The coordinated installer release must include these pins before using the
20
+ commands below. Its release gate verifies the actual registry and vendored
21
+ package graphs, client acquisition/retry, and rejection of dependency drift.
22
+ These checks do not deploy or certify an existing server installation.
23
+
24
+ The daemon includes ADAPT SDK/native `0.12.1` and the shutdown socket-reset
25
+ correction from [SDK PR70](https://github.com/adapt-toolkit/ours-sdk/pull/70).
26
+ Client profile commands do not control server processes.
27
+
28
+ ## Fresh full-stack setup on localhost:4050
29
+
30
+ For an agent asked to “put the daemon on localhost port 4050”, use **4050 as the
31
+ public gateway port**. The daemon's internal container port stays 3050. Docker
32
+ publishes only the gateway. Run as the user who will run Fleet and the harnesses.
33
+ Use Node.js 22+ and a working Docker Compose installation.
34
+
35
+ ```sh
36
+ npm install -g @ours.network/install@nightly
37
+ ours-install all install --mode docker \
38
+ --state-dir "$HOME/ours-server" --identity-name "Your Name" \
39
+ --port 4050 --integrations codex,claude-code
40
+ ```
41
+
42
+ The installer starts the server, retains or creates its Human identity, issues a
43
+ separate client credential, and imports the connection into `~/.ours-client`.
44
+ For Fleet, add `fleet` to `--integrations` and provide
45
+ `--fleet-settings /absolute/path/fleet-settings.json`; see the Fleet settings
46
+ example in [assets/fleet-settings.example.json](assets/fleet-settings.example.json).
47
+ The example selects Codex for all three jobs; review its model and subscription
48
+ against the installed Fleet catalog before use. The installer prepares Fleet but leaves it
49
+ stopped for review. Use `--dry-run` first to inspect a complete preset.
50
+
51
+ Do not set `OURS_PORT=4050` in a client shell, Fleet role, or user service. The
52
+ single profile contains `serverUrl: "http://127.0.0.1:4050"`, with daemon requests
53
+ at `http://127.0.0.1:4050/daemon` and Cowork management at
54
+ `http://127.0.0.1:4050/cowork/management/rpc`.
55
+
56
+ ## Existing or remote server
57
+
58
+ An older Docker installation needs its gateway enabled on the **server host**:
59
+
60
+ ```sh
61
+ ours-install server gateway-enable --state-dir "$HOME/ours-server"
62
+ ```
63
+
64
+ This is a server migration that may restart its services; perform it in an
65
+ approved maintenance window. Do not change identities or reinstall a populated
66
+ server to change a client address. `--port` on an existing installation cannot
67
+ silently move the retained public port.
68
+
69
+ For a remote host, expose the gateway through an authenticated HTTPS entrypoint
70
+ and select that URL when installing the server, for example
71
+ `--server-url https://ours.example.net/base`. The reverse proxy must preserve the
72
+ base prefix, streaming responses and WebSocket upgrades. Do not expose the
73
+ individual service ports.
74
+
75
+ Obtain an issued credential using `ours-install server access-issue --state-dir
76
+ /absolute/server/root --output /private/credential` on the server. Transfer it
77
+ privately to the client user. Never print the credential or put it into command
78
+ arguments, source control, chat, or a service unit. Use a private directory
79
+ (mode 0700) and credential/profile files (mode 0600).
80
+
81
+ Prepare a client profile (the UUID must be the selected server's actual instance):
82
+
83
+ ```json
84
+ {
85
+ "serverUrl": "https://ours.example.net/base",
86
+ "endpoint": "https://ours.example.net/base/daemon",
87
+ "expectedInstanceId": "11111111-2222-3333-4444-555555555555",
88
+ "credentialPath": "/absolute/private/credential"
89
+ }
90
+ ```
91
+
92
+ `endpoint` is optional for the client resolver; when present it must exactly match
93
+ `serverUrl + "/daemon"` after trailing-slash normalization. Older endpoint-only
94
+ profiles must be migrated explicitly: supply the actual gateway URL, not a
95
+ guessed address derived from a direct daemon port.
96
+
97
+ ```sh
98
+ ours-install client --config /absolute/private/profile.json \
99
+ --integrations codex,claude-code
100
+ ```
101
+
102
+ This imports the profile and issued credential into `~/.ours-client`. All new
103
+ clients use that default without an environment export. A conflicting existing
104
+ server instance is refused and retained; do not delete it to bypass that check.
105
+ To change only the gateway address of the same server, prepare a private profile
106
+ with the new `serverUrl` and matching `/daemon` endpoint, keep its actual
107
+ `expectedInstanceId`, and run the same `ours-install client --config ...` command.
108
+ The installer validates authenticated access before importing the new address;
109
+ it preserves imported Fleet settings. New processes use the new address. A
110
+ failed verification leaves the old selection intact. A different server UUID
111
+ requires a separately planned migration, not an address edit.
112
+
113
+ Changing the retained Docker public listening port in place is not currently
114
+ supported. `--port 4050` above is for a fresh server. For an existing server,
115
+ configure an administered reverse proxy to its gateway at the desired address,
116
+ then use the same-instance client address procedure. Do not edit installation
117
+ state or recreate containers with new identities to work around this limitation.
118
+ Native server installations currently need a separately administered gateway;
119
+ the integrated gateway setup above uses Docker (or supported Podman Compose).
120
+
121
+ ## Fleet and systemd
122
+
123
+ For a new Fleet setup, save the linked JSON example as an absolute private file
124
+ and run as the same user after importing the client profile:
125
+
126
+ ```sh
127
+ ours-fleet init --settings /absolute/path/fleet-settings.json
128
+ ```
129
+
130
+ If the installer already imported Fleet settings, reuse them explicitly:
131
+
132
+ ```sh
133
+ ours-fleet init --settings "$HOME/.ours-client/fleet-settings.json"
134
+ ```
135
+
136
+ These commands work without a terminal. A bare `ours-fleet init` is interactive.
137
+ The installer also accepts `--fleet-settings /absolute/path/fleet-settings.json`
138
+ and passes it to this same noninteractive path. Generated systemd and launchd services persist only the common
139
+ profile path, not a service URL, port, or token. Lingering user services therefore
140
+ use the same selection as CLI and MCP after logout/reboot. Detached Fleet task
141
+ workers inherit the common profile and do not inherit legacy service selectors.
142
+
143
+ `OURS_CONFIG` is an explicit override for the **whole client profile**. Use it only
144
+ when all relevant clients intentionally share that same alternate file. It is
145
+ not a per-service address override. For the normal setup, leave it unset.
146
+
147
+ When migrating existing units, inspect `systemctl --user cat 'ours-fleet-agent@.service'`
148
+ and any per-role drop-ins. Remove stale `OURS_PORT`, `OURS_STATE_DIR`,
149
+ `OURS_API_TOKEN`, `OURS_DAEMON_ID` and Cowork-local overrides from their owning
150
+ configuration. Regenerate Fleet units with `ours-fleet init --settings /absolute/path/fleet-settings.json`
151
+ in the intended profile environment, then restart affected client roles only after approval.
152
+ Already-running clients retain their current connection until restarted; editing
153
+ a profile does not rebind running identities. Do not restart the server for a
154
+ client-only profile correction.
155
+
156
+ ## Verify and diagnose
157
+
158
+ ```sh
159
+ curl --fail http://127.0.0.1:4050/.well-known/ours
160
+ ours config show --json
161
+ ours identity list --json
162
+ ours-fleet doctor
163
+ ours-fleet room list
164
+ ```
165
+
166
+ Discovery must advertise the gateway and expected instance. `ours config show`
167
+ shows only connection metadata and a credential path, never the token. For a
168
+ remote server use its exact prefix in the discovery URL. Test both daemon
169
+ identity access and Cowork room listing: one succeeding does not prove the other.
170
+ Check `command -v ours-mcp` and `ours-mcp version` as well as the MCP binary launched
171
+ by the harness; Fleet can bundle a different MCP version than the global binary.
172
+
173
+ Missing/unsafe profiles, mismatched instances, rejected credentials, HTTP errors
174
+ and timeouts fail on the selected gateway. Fix that selection or service; do not
175
+ add localhost/socket fallbacks. If a task reports `room_probe_unavailable`, check
176
+ Cowork through the gateway. `control_unavailable` means Fleet could not query its
177
+ local role supervisor after its room checks; inspect the role's supervisor and
178
+ control channel separately. An active room alone does not establish agent readiness.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ See [one-connection setup, localhost:4050 and systemd migration](GATEWAY_SETUP.md) for the gateway-only client workflow.
2
+
1
3
  # @ours.network/install — one installer for the whole stack
2
4
 
3
5
  Requires Node.js 22+ and npm. Install the selected release channel:
@@ -7,10 +9,11 @@ npm install -g @ours.network/install@nightly
7
9
  ours-install
8
10
  ```
9
11
 
10
- With no arguments, the console form collects the installation choices: server
11
- and clients (default), runtime mode, installation directory, install/update,
12
- Human identity name, ports, client integrations and Fleet settings. Linux x64
13
- recommends native mode; macOS and Windows recommend Docker. On Windows run the
12
+ With no arguments, the wizard explains each step and offers keyboard choices.
13
+ Use arrow keys and Enter to choose, and Space to select integrations. Recommended
14
+ settings keep advanced ports and package overrides out of the usual flow. Text
15
+ input is used for your name and explicitly customized paths or ports. Docker is recommended for the integrated full-stack gateway on every platform;
16
+ native packages remain available for server-only setup. On Windows run the
14
17
  installer inside WSL with Docker Desktop integration. This recommendation concerns
15
18
  packaging and isolation, not a guarantee that emulated x64 is faster on ARM Macs.
16
19
 
@@ -44,7 +47,7 @@ installers. `--integrations none` explicitly skips client integrations. Use
44
47
  Fleet's own wizard is available only in interactive setup; CLI Fleet setup requires
45
48
  its JSON settings file. Fleet stays stopped until you review and activate it.
46
49
 
47
- The server installs the daemon/SDK/CLI, main MCP, Telegram, Cowork and Messenger.
50
+ The server installs the daemon/SDK/CLI, Telegram, Cowork and Messenger.
48
51
  It starts the daemon, preserves the existing Human identity (or creates it once),
49
52
  then starts its applications. Full-stack setup issues a separate local client
50
53
  credential and configures the selected Codex, Claude Code and Fleet integrations.
@@ -55,6 +58,66 @@ The installer embeds exact component versions and SHA-512 values for its release
55
58
  An existing server's retained release selects matching local clients. Secrets are
56
59
  read from protected files, and client setup never copies the daemon API master.
57
60
 
61
+ ## Runtime and client packages
62
+
63
+ Server selections include `@ours.network/daemon`, whose `ours-daemon` binary owns
64
+ runtime startup and service administration. Docker runs `ours-daemon serve`;
65
+ native installations install its systemd/launchd service. Existing retained
66
+ installations can still stop and restore their older CLI-owned runtime.
67
+
68
+ Client selections contain the thin SDK and CLI, plus MCP when a harness needs
69
+ it. They exclude the daemon and its native database/ADAPT dependencies. Fleet
70
+ runs beside the harnesses on the client machine and calls the daemon HTTP API.
71
+ Client commands report an unavailable server and never start one automatically.
72
+
73
+ The checked-in source policy and packed installer retain the existing server
74
+ release set (SDK `3.8.1-nightly.11`, CLI `2.8.1-nightly.9`, daemon
75
+ `3.8.1-nightly.3`). The isolated host CLI uses published SDK
76
+ `3.8.1-nightly.13` and CLI `2.8.1-nightly.11`, including the shared gateway
77
+ profile resolver. `releases/nightly.json` binds both selections to verified
78
+ SHA512 integrities. Gateway-only Fleet/MCP release adoption is still pending;
79
+ see [GATEWAY_SETUP.md](GATEWAY_SETUP.md). Mixed or unselected nested ours
80
+ versions remain rejected within each selected graph. An explicit `--sources`
81
+ override remains available for development.
82
+
83
+ ## Migrate an existing global installation
84
+
85
+ The wizard detects the old `~/.ours/config.json` and offers to keep its identities,
86
+ messages, keys and settings in the new installation. It follows the configured
87
+ state directory, including a custom location. An equivalent unattended preset is:
88
+
89
+ ```sh
90
+ ours-install all --mode docker --state-dir "$HOME/ours-docker" \
91
+ --migrate-from "$HOME/.ours/config.json" --compatible --integrations codex
92
+ ```
93
+
94
+ Run the old daemon before the first migration so the installer can record and
95
+ verify its identities. The new runtime is downloaded/built first. Then the old
96
+ boot service and daemon stop, and the complete daemon state is copied while its
97
+ writer lock is held. Docker migration imports that copy into its named storage
98
+ volume. Existing Human/role names and CIDs must match before applications start;
99
+ migration never creates a replacement Human.
100
+
101
+ The original state/configuration remain unchanged. A private `legacy-backup`
102
+ directory stores the original config/service definition, and
103
+ `legacy-client/profile.json` is a prepared connection profile for the new server.
104
+ Selected integrations are configured by the usual client setup. The global `ours` command is switched to a launcher for the managed installation
105
+ only after verifying ownership of its existing npm entry; foreign or read-only
106
+ commands are refused before migration. Ordinary `ours identity list` is checked
107
+ after cutover. Lifecycle commands manage the new installation, and selection
108
+ overrides cannot accidentally return to the old daemon. The old configuration is
109
+ not reinterpreted as a client profile. Do not start the old state alongside the
110
+ migrated daemon. Reinstalling the global CLI with npm can replace the launcher;
111
+ repeat the same migration command to verify and repair that routing.
112
+
113
+ Repeat the same command after an interruption. Once the destination has started,
114
+ retries repair it in place instead of replacing it with an older source snapshot.
115
+ The source is kept stopped after an activation failure to avoid diverging identity
116
+ sessions. Migration requires local Linux/macOS (or WSL) with `node:sqlite` support,
117
+ a verifiable old CLI/service, and a separate target directory. External PostgreSQL
118
+ history or unsupported external MCP/token-delivery paths are refused before
119
+ shutdown. Unrelated application data outside the daemon tree is not copied.
120
+
58
121
  ## Selected network installations (2.0)
59
122
 
60
123
  The installed package carries its compatible `assets/sources.json` policy.
@@ -71,7 +134,7 @@ ours-install server start --state-dir /private/ours-install
71
134
  ours-install server restart --state-dir /private/ours-install
72
135
  ```
73
136
 
74
- Choose one mode for a private installation root. The private `installation.json`
137
+ Choose one mode and a folder for its programs and data. The private `installation.json`
75
138
  records mode, instance selection, configuration/source paths and service selection;
76
139
  it never records master bytes or an issued-token registry. The selected policy
77
140
  is resolved to an exact, role-filtered `sources.json` before acquisition.
@@ -98,8 +161,8 @@ native package acquisition, and reports completion only after service readiness.
98
161
  If a Docker service fails, the error includes its last 50 log lines (bounded in
99
162
  size) and a command to inspect the logs. A failed daemon prevents consumers from
100
163
  starting; a failed consumer does not prevent checks of unrelated consumers.
101
- Server runtime installation selects SDK/CLI, main MCP, Telegram, Cowork and
102
- Messenger. Main MCP is injected into the daemon, not started as a second daemon.
164
+ Server runtime installation selects SDK/CLI, Telegram, Cowork and
165
+ Messenger. MCP runs locally with the Codex and Claude Code plugins and calls the daemon API through the SDK.
103
166
  The daemon starts first; consumers are checked through their owning readiness
104
167
  interfaces. Messenger uses its existing identity prerequisite and never creates an
105
168
  identity. Its failure is reported after attempting unrelated consumers. Package
@@ -156,9 +219,9 @@ relative to the profile file. Select any nonempty subset of integrations; Fleet
156
219
  When Fleet settings are supplied, the installer passes them to Fleet's strict
157
220
  noninteractive `init --settings`; otherwise it opens Fleet's existing wizard.
158
221
  Fleet validates and publishes its own configuration. Client setup verifies the selected
159
- daemon and packaged OURS MCP before registering native integrations. It acquires
222
+ authenticated daemon API before registering native integrations. It acquires
160
223
  only selected integration packages and their actual client dependencies. It does
161
- not install main MCP, administer daemon state or invoke Docker. Exact npm client
224
+ not administer daemon state or invoke Docker. Codex and Claude Code include the local stdio MCP server as a dependency. Exact npm client
162
225
  installation needs no Python; Git source builds use the supplied source recipes
163
226
  and their build prerequisites. Normal native clients need neither Docker nor
164
227
  server maintenance tools.
@@ -174,7 +237,8 @@ an existing override and does not edit shell configuration or running sessions.
174
237
  Repeat with `ours-install client install` to reuse imported inputs and installed
175
238
  package records. Existing settings and Fleet-generated files are preserved. A
176
239
  prepared profile for the same endpoint/instance may supply a valid replacement
177
- issued token; another server is refused without changing the default. Invalid
240
+ issued token; a different server instance is refused without changing the default. A verified
241
+ new gateway address for the same instance updates the shared profile for new clients. Invalid
178
242
  server access is rejected before import. An acquisition or component failure
179
243
  reports incomplete setup and keeps the saved configuration for retry. Selected
180
244
  native integrations whose executable is unavailable are incomplete, not installed.
@@ -185,7 +249,7 @@ Interactive no-argument installation asks for package/Docker server mode, a
185
249
  prepared client profile, or `client`. Client setup offers the saved server when
186
250
  present. On first setup it asks for the server HTTP endpoint, issued-token file,
187
251
  source manifest and integration choices, obtains the instance UUID from
188
- `/selection`, displays it, then checks authenticated daemon and MCP access before
252
+ `/.well-known/ours` at the gateway, displays it, then checks authenticated daemon API access before
189
253
  saving anything. No UUID must be entered manually. The 2.0 HTTP flow assumes the
190
254
  approved trusted same-host deployment; selection metadata is not cryptographic
191
255
  server authentication. Fleet collects missing setup answers through its own wizard.
@@ -242,3 +306,264 @@ maintenance reads both formats. Format2 is not readable by older maintenance too
242
306
  so this change does not promise executable downgrade support. Restore validates the
243
307
  original archive records unchanged, then writes markers for the active target runtime.
244
308
  Mixed/incomplete context and component record sets are refused before activation.
309
+
310
+ ### Retrying a Docker installation after a source-policy permission failure
311
+
312
+ Setup verifies the selected Docker image before reusing it, including when the image
313
+ already exists. If an older installer left a root-owned, mode-0600
314
+ `/opt/ours/sources.json`, setup repairs only that image file's permissions and
315
+ continues. The selected package bytes, build provenance, image execution settings,
316
+ credentials and stored data are retained. The old materialized Dockerfile's known
317
+ COPY instruction is also corrected for future builds. No manual image or volume
318
+ deletion is required; repeat the original setup with the updated installer.
319
+
320
+ The repair runs isolated verification containers without state mounts or network
321
+ access. Other image verification failures stop setup without replacing the image.
322
+ An interrupted repair can be retried, including after the image tag was replaced.
323
+
324
+ ### Remote clients over HTTPS
325
+
326
+ A client may select an `https://` origin backed by a TLS reverse proxy. Keep the
327
+ daemon listener private and configure the proxy separately with a certificate
328
+ trusted by the client and matching the hostname. Node uses its normal trust
329
+ store; a private CA may be supplied through `NODE_EXTRA_CA_CERTS` before starting
330
+ the client. Certificate verification must remain enabled.
331
+
332
+ The existing issued client credential works over either transport; changing the
333
+ URL scheme does not require a new credential. Keep the server's master on the
334
+ server. Forward `x-ours-api-token` and the `x-ours-*` session headers unchanged,
335
+ and support streamed request/response bodies and long polling. Client requests
336
+ refuse redirects, including HTTPS-to-HTTP redirects: configure the final HTTPS
337
+ origin directly. UUID/capability checks still precede credential-bearing calls.
338
+
339
+ This adds client HTTPS support, not an HTTPS daemon listener, certificate
340
+ provisioning or automatic reverse-proxy configuration. Existing local HTTP and
341
+ SSH-tunnel profiles continue to work.
342
+
343
+ ## One-URL Docker gateway
344
+
345
+ New Docker installations use one loopback-published nginx port (default 3050).
346
+ Clients import one `serverUrl`; their daemon endpoint is `<serverUrl>/daemon` and
347
+ Fleet derives `<serverUrl>/cowork/management/rpc`. Cowork, Messenger and Telegram
348
+ backend ports are internal only. Existing installations retain their prior layout
349
+ on ordinary install/update. Select compatible releases before explicitly migrating:
350
+
351
+ ```sh
352
+ ours-install server gateway-enable --state-dir /private/ours
353
+ ```
354
+
355
+ Migration checks the installed Cowork, Messenger and Telegram capabilities before
356
+ stopping services, verifies authenticated daemon and read-only Cowork management,
357
+ and preserves the existing credential and client integration settings. Failure
358
+ restores routing, client profile and prior service selection. An interrupted
359
+ migration blocks other mutations: repeat `gateway-enable` to finish rollback,
360
+ then run it again to attempt migration. The private `gateway-transition.json`
361
+ retains recovery state until rollback or migration completes. Back up the whole
362
+ installation using the normal server backup procedure before maintenance.
363
+
364
+ For a nested external URL, pass `--server-url https://ours.example/base` during
365
+ Docker install or `gateway-enable`. This sets browser origin and path configuration;
366
+ it does **not** publish a public listener, provide TLS, or install external
367
+ credentials. Configure the authenticated entry first and retain the `/base` path
368
+ when proxying. A compatible release must contain these capabilities:
369
+ `cowork.http-management-v1`, `messenger.gateway-prefix-v1`, and
370
+ `telegram.gateway-listener-v1`. Older releases are rejected without enabling the
371
+ new listener; no package version is silently substituted.
372
+
373
+ ### Authenticated external entry
374
+
375
+ Messenger has no application authentication. Loopback access trusts local users;
376
+ never forward this gateway publicly without authentication. All applications on
377
+ this origin share one trust boundary: scripts or XSS in any application can make
378
+ requests to the others. Cowork's entered server credential grants operator room
379
+ administration and stays in memory until reload. Path prefixes do not isolate
380
+ applications. Only expose this origin to trusted operators.
381
+
382
+ A supported external entry is nginx TLS plus HTTP Basic authentication for browser
383
+ paths, with machine paths left to their existing server-token checks. Create the
384
+ password file using an interactive `htpasswd` prompt and make it readable by the
385
+ proxy worker. Use real certificates and the matching `--server-url`. The inner
386
+ gateway remains bound to `127.0.0.1:3050`; neither backend ports nor the inner
387
+ listener should be externally forwarded. Example for `/base`:
388
+
389
+ ```nginx
390
+ # In http {}:
391
+ map $http_upgrade $ours_connection { default upgrade; '' close; }
392
+ server {
393
+ listen 443 ssl;
394
+ server_name ours.example;
395
+ ssl_certificate /private/tls/fullchain.pem;
396
+ ssl_certificate_key /private/tls/key.pem;
397
+ auth_basic "ours operators";
398
+ auth_basic_user_file /private/ours-users;
399
+ access_log off;
400
+ proxy_set_header Host $http_host;
401
+ proxy_set_header Upgrade $http_upgrade;
402
+ proxy_set_header Connection $ours_connection;
403
+ proxy_http_version 1.1;
404
+ proxy_read_timeout 300s;
405
+ proxy_buffering off;
406
+ location = /base/.well-known/ours { auth_basic off; proxy_pass http://127.0.0.1:3050; }
407
+ location /base/daemon/ { auth_basic off; proxy_pass http://127.0.0.1:3050; }
408
+ location = /base/cowork/management/rpc { auth_basic off; proxy_pass http://127.0.0.1:3050; }
409
+ location /base/tg-connector/ { auth_basic off; proxy_pass http://127.0.0.1:3050; }
410
+ location /base/ { proxy_pass http://127.0.0.1:3050; }
411
+ location / { return 404; }
412
+ }
413
+ ```
414
+
415
+ Browser requests include same-origin proxy credentials. Fleet/SDK use the issued
416
+ `X-Ours-Api-Token`, require no browser login, and reject redirects. An SSH tunnel
417
+ to the loopback gateway is another private transport option, but every client must
418
+ establish its own tunnel and use a URL/origin matching that tunnel; it is not
419
+ automatic remote access. Do not treat a token entered in Cowork as Messenger auth.
420
+
421
+ Publish compatible Cowork, Messenger, Telegram and Fleet artifacts before enabling
422
+ gateway defaults in a qualified installer release. Gateway client setup acquires
423
+ and checks Fleet before activating the managed profile or publishing native
424
+ commands. Migration also checks the installed `ours-fleet version --json`
425
+ capability before stopping services when the selected managed profile includes
426
+ Fleet. Upgrade that executable first. The gate does not inventory differently pinned
427
+ running Fleet instances or remote clients: upgrade every client using this server
428
+ to a compatible Fleet release before cutover.
429
+
430
+ ### Cross-repository gateway qualification
431
+
432
+ Build Cowork, Fleet, Messenger and Telegram checkouts with their locked dependencies.
433
+ The real-service test uses disposable local daemon state, a local test broker,
434
+ nginx Docker containers and Chromium; it never uses installed identities or tokens.
435
+ It requires Linux Docker host networking and `openssl`. Set:
436
+
437
+ ```sh
438
+ OURS_TEST_GATEWAY_SERVICES=1 \
439
+ OURS_TEST_COWORK_ROOT=/checkouts/ours-cowork \
440
+ OURS_TEST_FLEET_ROOT=/checkouts/ours-fleet \
441
+ OURS_TEST_MESSENGER_ROOT=/checkouts/ours-messenger-server \
442
+ OURS_TEST_TELEGRAM_ROOT=/checkouts/ours-tg-connector \
443
+ OURS_TEST_BROWSER=/opt/google/chrome/chrome \
444
+ node --test packages/installer/test/gateway-services.test.mjs
445
+ ```
446
+
447
+ Run `OURS_TEST_DOCKER=1 node --test packages/installer/test/gateway-docker.test.mjs`
448
+ separately for Compose port isolation with a client container. That routing test
449
+ uses echo upstreams; the real-service test covers Fleet room operations, browser
450
+ paths, external authentication and Messenger WebSocket access. Neither test is
451
+ cross-platform Docker Desktop qualification or a live deployment test.
452
+
453
+ ### Rootless Podman (qualification in progress)
454
+
455
+ Container installations can select a local Linux rootless backend explicitly:
456
+
457
+ ```sh
458
+ export PODMAN_COMPOSE_PROVIDER=/absolute/path/to/docker-compose
459
+ ours-install server install --mode docker --container-engine podman \
460
+ --state-dir "$HOME/.ours-server-podman" --identity-name "Your Name"
461
+ ```
462
+
463
+ `mode: docker` remains the legacy container-layout name. `containerEngine` and
464
+ `containerBinding` retain Podman, the invoking UID, native storage paths, socket
465
+ and standalone Compose provider, plus the UID/GID mapping fingerprint. Records without `containerEngine` continue to
466
+ use Docker. Package/client installs reject the engine option. Existing records
467
+ cannot change engines through a flag or ambient connection change; automatic
468
+ Docker-to-Podman data migration is not provided. Legacy local-daemon migration
469
+ (`--migrate-from`) to Podman is also unsupported and is refused before source
470
+ shutdown or managed CLI publication, including migration retries. Use a fresh
471
+ Podman installation, or migrate the legacy daemon with Docker/packages.
472
+
473
+ Podman uses its native build command, with the same resolved Compose build
474
+ context, target, architecture, arguments and secret references, followed by
475
+ Compose `--no-build` startup. It does not require the Docker CLI or daemon.
476
+ The selected standalone Docker Compose provider must be version 2.35 or newer;
477
+ version checks do not replace the behavioral capability probe. `podman-compose`
478
+ is not an interchangeable provider for this implementation. Secrets sourced
479
+ from environment variables use Podman's native build-secret mechanism, never
480
+ build arguments or temporary copies.
481
+
482
+ Prerequisites include a working rootless API socket, sufficient subordinate
483
+ UID/GID mappings, and native volume-subpath isolation. Before setup/start, an
484
+ isolated disposable project tests Compose `!reset`, health waiting, JSON status,
485
+ service DNS, private UID-1000 storage and subpath isolation. A failed check stops
486
+ installation rather than substituting the whole volume. Existing volumes must
487
+ have this installation's project and volume labels. Docker contexts, unrelated
488
+ containers and host directory ownership are not changed.
489
+
490
+ Server boot recovery requires an enabled user `podman.socket`, an enabled
491
+ `podman-restart.service` using `--filter should-start-on-boot=true`, and user
492
+ linger. The standard user-service environment/default socket must select the
493
+ same storage; custom XDG paths and sockets are rejected for server startup.
494
+ The installer diagnoses missing prerequisites and never runs hidden sudo or
495
+ rewrites the vendor unit. Long-running Podman services get `unless-stopped`;
496
+ administration jobs do not. Stop/status remain available when boot prerequisites
497
+ are missing, provided the retained backend is accessible. Runtime-only test
498
+ harnesses may select a separate local socket with `OURS_PODMAN_SOCKET`; its
499
+ storage must match native Podman and the selection cannot change afterward.
500
+
501
+ Gateway images read and validate IPv4/IPv6 nameservers from their container at
502
+ startup. Only the resolver placeholder is replaced; nginx variables and existing
503
+ authentication/routes remain intact. UID 101, read-only rootfs, dropped
504
+ capabilities and tmpfs are retained. Setup and start verify authenticated
505
+ upstream requests in addition to liveness.
506
+
507
+ This change is **not yet a fully qualified server-support release**. Debian's
508
+ Podman 5.4.2 with Compose 5.5.1 failed subpath isolation and has incompatible boot
509
+ recovery semantics. Podman 6.1.2 passed the isolated capability probe on native
510
+ Linux amd64; production and prerelease-source builds, service lifecycle, rebuild and scoped maintenance also passed. See [validation evidence](ROOTLESS_PODMAN_VALIDATION.md). The full public installer/maintenance matrix,
511
+ SELinux Enforcing, logout/reboot, explicit-stop recovery, and Docker regression
512
+ matrix must all be recorded before declaring a supported engine/provider pair.
513
+ The supplied ARM VM results are historical feasibility evidence, not this
514
+ release's qualification.
515
+
516
+ Opt-in gateway fixture (isolated project, only owned resources removed):
517
+
518
+ ```sh
519
+ OURS_TEST_DOCKER=1 node --test test/gateway-docker.test.mjs
520
+ PODMAN_COMPOSE_PROVIDER=/absolute/path/to/docker-compose \
521
+ OURS_TEST_PODMAN=1 node --test test/gateway-docker.test.mjs
522
+ ```
523
+
524
+ ## Account workspace enrollment (task build)
525
+
526
+ The unmerged account onboarding feature requires matching reviewed installer,
527
+ Fleet and Messenger task builds. Do not advertise it as available in `@latest`.
528
+ Use an owned private directory and a 0600 downloaded payload:
529
+
530
+ ```sh
531
+ node /absolute/task-ours-network/packages/installer/install.mjs \
532
+ --setup-workspace-file /absolute/private/workspace.payload \
533
+ --workspace-fleet-bin /absolute/task-ours-fleet/dist/cli.js \
534
+ --sources /absolute/private/task-sources.json
535
+ ```
536
+
537
+ The wrapper defaults fresh hosts to the full Docker stack and retains existing
538
+ Human roots through the installed SDK with exact instance/private credential
539
+ selection. For an existing supported gateway add `--scope client --config` with
540
+ its private profile. It clears competing inherited daemon selectors before Fleet
541
+ initialization and enrollment; it never copies a browser device bearer to the
542
+ account server. A private stdin payload is also accepted by `--setup-workspace -`.
543
+ Encoding is not encryption; command arguments can enter history/process listings.
544
+ Cloudflare management tokens are forbidden in these payloads.
545
+
546
+ Docker and `cloudflared` are required for the fresh workflow. Supply a complete
547
+ `--fleet-settings` JSON for noninteractive Fleet initialization, or answer its
548
+ terminal prompts. Dry-run never initializes or enrolls Fleet. Read the matching
549
+ ours-app `server/DEPLOYMENT.md` for exact task source-policy generation, external
550
+ Google/Cloudflare prerequisites and account-server setup. On uncertain enrollment
551
+ check account status before requesting a new payload; do not reset identities or
552
+ replay a consumed invitation.
553
+
554
+ Workspace setup accepts exactly https://app.ours.network and the controlled test
555
+ account origin https://app.ours-tunnel.com. To move an existing same workspace to
556
+ the other origin, obtain a fresh payload from the moved account server and add
557
+ `--workspace-migrate-app-origin`. Fleet verifies the signed binding receipt before
558
+ changing local origin trust, preserves identities/config/device records, and
559
+ restarts the runtime. An implicit origin change is rejected. Browser account
560
+ cookies/device IndexedDB must be linked anew on the new origin. See the app
561
+ server/DEPLOYMENT.md switching procedure.
562
+
563
+ Workspace setup automatically reuses the saved managed gateway profile (or explicit `--config`/`OURS_CONFIG`), including a host with a non-default server state directory. It does not reinstall server/client state, create a root, or initialize an existing Fleet configuration. It requires Fleet capability `workspace.enroll.preserve-profile-v1` and passes `--preserve-profile`; Fleet requires the matching Messenger capability before posting signed enrollment. Hosts running older Messenger must first update that host service through its supported installer lifecycle; this wrapper never guesses or replaces its server directory. After Owner releases Messenger/Fleet/installer, app bootstrap pins must be updated before removing the preview guard.
564
+
565
+ ### Private-context Docker script permissions
566
+
567
+ Fresh image builds explicitly make non-secret maintenance/runtime scripts readable by the container user even when the host build context was copied under umask077. Host scripts, selected source policy and state retain their private permissions.
568
+
569
+ For a pending installation using an older image, run the corrected installer against the same pending workspace. It recognizes older shipped script COPY instructions combined with private host script modes, updates those image COPY modes and rebuilds the daemon image from the retained source selection. It leaves host data and enrollment state intact and qualifies the rebuilt image before preparing services. A private retry marker retains the rebuild requirement after interruption; it is removed only after verification succeeds. This rebuild resolves third-party transitive dependencies using the existing testing-delivery rules; selected Ours versions and integrity remain release-checked. It is not a byte-identical image permission-layer repair.