@ours.network/install 1.2.1-nightly.16 → 1.2.1-nightly.18

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.
@@ -1,57 +1,57 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "channel": "nightly",
4
- "installerVersion": "1.2.1-nightly.16",
4
+ "installerVersion": "1.2.1-nightly.18",
5
5
  "packages": {
6
6
  "@ours.network/sdk": {
7
- "version": "3.8.1-nightly.11",
8
- "integrity": "sha512-dGiMUFXdZLzdwo0U2ilBTanG/aSBfUwfIkicGgCV2gQ710DYcWny9yqRAPCErw0zrh4sspm0HsWEUP/Q+Y/Q9g=="
7
+ "version": "3.8.1-nightly.15",
8
+ "integrity": "sha512-ynKaKmKtINBqYk3kNovsgEO/3TiFY1CC9FgZzrOH+H6onnM3J//Q8cBb9sun8dl9mhB4mKZYgvneSiOejYwZUw=="
9
9
  },
10
10
  "@ours.network/cli": {
11
- "version": "2.8.1-nightly.9",
12
- "integrity": "sha512-vC6E2Tjgje2yJrw5WdSDEH/rt8YWphk1jLjao0Ie2gz+1oyNiAd9Q8VfFZGDSFa7p5xlVRTZzmOgybJuKbabew=="
11
+ "version": "2.8.1-nightly.13",
12
+ "integrity": "sha512-1BeAG12vh4ruBOeJ54l60qWUhLzPLRNKnGtRiJpQmSXkamNQglrPQeXa9xW3taAM4Vg5uYgEhsz6+ieM+1TUSA=="
13
13
  },
14
14
  "@ours.network/tg-connector": {
15
- "version": "1.0.1-nightly.6",
16
- "integrity": "sha512-ywgwHm59UotZJanvBj3fp0cjwcX3BC+sP+0UU0+P32Qdrl53DKKi6VAt0xleBmUmC874sWc4tW9y4J/Sg/cCOA=="
15
+ "version": "1.0.1-nightly.9",
16
+ "integrity": "sha512-wm0V8c97aIg7p26L9My36I3BE9Cy2Xc5W7WgHg6Vo+hmPvE+jXmen86yA4+DxIu9VYxoVSMtpBbu76485eCeNw=="
17
17
  },
18
18
  "@ours.network/cowork": {
19
- "version": "1.3.3-nightly.20260923.2d2ff89",
20
- "integrity": "sha512-0dwh40D7mSfx2qg25wQsy83ed5IZR5DSOXi1libYqWdtFOznfGcp3H14T+0oEJPeRdae1kT9bzS3q3RCrUsg/A=="
19
+ "version": "1.3.3-nightly.20261001.6d49d3a",
20
+ "integrity": "sha512-tqoLOWc4O8CGwLdO1j6ukm6Vn57EE0zbuxKo4BWd0QVwu9ObKgHCEMOKPgW2mXHeESXSv9m7edcIrnK8I5gD+w=="
21
21
  },
22
22
  "@ours.network/messenger-server": {
23
- "version": "1.0.31-nightly.6",
24
- "integrity": "sha512-enlos6BWfKiHdUNLRoPMzb0yfxRLWvfxH6uNaOjfAG88BK5qo74hQLwQ7CR4HbVE6OCDAGPLBe1BV7dQSRsbxw=="
23
+ "version": "1.0.31-nightly.12",
24
+ "integrity": "sha512-vp7RkIYnlPDySAbFcXP3vpeOvu0bHeHWjlxOtBbYlGjGa/B7TixXbZpLYwgvbiuD7pVIaHs1muIDzG8RjJTVeQ=="
25
25
  },
26
26
  "@ours.network/fleet": {
27
- "version": "1.2.0-nightly.14",
28
- "integrity": "sha512-IBWPR7FDjjRmtCaUQZZk491PsGf4hKG4XRMHjcvGc/pcViRaZOOZu3cDGG0NJ38dhxubSAk5+DLVD2iYHzJxTA=="
27
+ "version": "1.2.0-nightly.28",
28
+ "integrity": "sha512-6Ils463HA+ZY+JV6MIa9Cet8mxi6Ool3Xf2V8Sy/kSBzCZh3aV2S5jozh4dNINGZh72NxptIh2Z6AL5IoS0WKg=="
29
29
  },
30
30
  "@ours.network/mcp": {
31
- "version": "1.2.0-nightly.7",
32
- "integrity": "sha512-E9x7abO9BXt4MBSnsYh2m0A2E/xmhJHhsgoMLwoGunY6zhIiBx8SNejKPCLXLI+JXUw7nozptcTipBMpqhKqYA=="
31
+ "version": "1.2.0-nightly.10",
32
+ "integrity": "sha512-59sxJOcQagNRR+43Z5ScFlqFDBIlZSMQi8iz9mpxp5Jjl38B0dmCFsv5e+srbEYrV3xaOg9ZBsT17OUABFAseQ=="
33
33
  },
34
34
  "@ours.network/codex": {
35
- "version": "1.2.0-nightly.7",
36
- "integrity": "sha512-6BhRYNI/usYxxAQm3BKsQJD6QvrWOLZ3CjscAJZC35wKft3YC6ejDZ7AV5YdfDM2UcEc/LpcLej4GVkh0ZDRWA=="
35
+ "version": "1.2.0-nightly.10",
36
+ "integrity": "sha512-7hV4R0w8tiQ/JKFU5MxtM7fihd33tzWDgT+Bn8cidasxI5zmTLqDEIv6om5LM/xk7UqcPw5gDN2kcJYiybnP9Q=="
37
37
  },
38
38
  "@ours.network/claude-code": {
39
- "version": "1.2.0-nightly.7",
40
- "integrity": "sha512-3k8xcb9dd9o/p+xXWEmezo53lBNXj3toHhLxhMnqeNRv73abTFCEqQy50TjSRGZSqTr4yi2FmHEium7YuKvmqA=="
39
+ "version": "1.2.0-nightly.10",
40
+ "integrity": "sha512-C3+H/vXespanVj9E1uQAWno9RFrI5KlK2SHSc7dnmRRuFVyRsoVcbvlpVI3nZ8snFaKVzbetebZr7vxd73AWSg=="
41
41
  },
42
42
  "@ours.network/daemon": {
43
- "version": "3.8.1-nightly.3",
44
- "integrity": "sha512-PHtaqjXGUphqX/18YigPa3rcfXmMcgkFLi0eCNlJWIZ16IiMSz1WiLXhmYHPIw1AD/Ng5TqQJ9jZZo28AGRdQw=="
43
+ "version": "3.8.1-nightly.7",
44
+ "integrity": "sha512-dDFDm+xERplzu4yXKvLjKGNaIdr9u4ku5/4jiI4g8do3qOX9VS0tF1+O67uSu4jqkypg860UdZRdn9Zce72H/A=="
45
45
  }
46
46
  },
47
47
  "hostCli": {
48
48
  "@ours.network/sdk": {
49
- "version": "3.8.1-nightly.11",
50
- "integrity": "sha512-dGiMUFXdZLzdwo0U2ilBTanG/aSBfUwfIkicGgCV2gQ710DYcWny9yqRAPCErw0zrh4sspm0HsWEUP/Q+Y/Q9g=="
49
+ "version": "3.8.1-nightly.15",
50
+ "integrity": "sha512-ynKaKmKtINBqYk3kNovsgEO/3TiFY1CC9FgZzrOH+H6onnM3J//Q8cBb9sun8dl9mhB4mKZYgvneSiOejYwZUw=="
51
51
  },
52
52
  "@ours.network/cli": {
53
- "version": "2.8.1-nightly.9",
54
- "integrity": "sha512-vC6E2Tjgje2yJrw5WdSDEH/rt8YWphk1jLjao0Ie2gz+1oyNiAd9Q8VfFZGDSFa7p5xlVRTZzmOgybJuKbabew=="
53
+ "version": "2.8.1-nightly.13",
54
+ "integrity": "sha512-1BeAG12vh4ruBOeJ54l60qWUhLzPLRNKnGtRiJpQmSXkamNQglrPQeXa9xW3taAM4Vg5uYgEhsz6+ieM+1TUSA=="
55
55
  }
56
56
  }
57
57
  }
@@ -2,100 +2,100 @@
2
2
  "release": {
3
3
  "schema": 1,
4
4
  "channel": "nightly",
5
- "installerVersion": "1.2.1-nightly.16",
5
+ "installerVersion": "1.2.1-nightly.18",
6
6
  "packages": {
7
7
  "@ours.network/sdk": {
8
- "version": "3.8.1-nightly.11",
9
- "integrity": "sha512-dGiMUFXdZLzdwo0U2ilBTanG/aSBfUwfIkicGgCV2gQ710DYcWny9yqRAPCErw0zrh4sspm0HsWEUP/Q+Y/Q9g=="
8
+ "version": "3.8.1-nightly.15",
9
+ "integrity": "sha512-ynKaKmKtINBqYk3kNovsgEO/3TiFY1CC9FgZzrOH+H6onnM3J//Q8cBb9sun8dl9mhB4mKZYgvneSiOejYwZUw=="
10
10
  },
11
11
  "@ours.network/cli": {
12
- "version": "2.8.1-nightly.9",
13
- "integrity": "sha512-vC6E2Tjgje2yJrw5WdSDEH/rt8YWphk1jLjao0Ie2gz+1oyNiAd9Q8VfFZGDSFa7p5xlVRTZzmOgybJuKbabew=="
12
+ "version": "2.8.1-nightly.13",
13
+ "integrity": "sha512-1BeAG12vh4ruBOeJ54l60qWUhLzPLRNKnGtRiJpQmSXkamNQglrPQeXa9xW3taAM4Vg5uYgEhsz6+ieM+1TUSA=="
14
14
  },
15
15
  "@ours.network/tg-connector": {
16
- "version": "1.0.1-nightly.6",
17
- "integrity": "sha512-ywgwHm59UotZJanvBj3fp0cjwcX3BC+sP+0UU0+P32Qdrl53DKKi6VAt0xleBmUmC874sWc4tW9y4J/Sg/cCOA=="
16
+ "version": "1.0.1-nightly.9",
17
+ "integrity": "sha512-wm0V8c97aIg7p26L9My36I3BE9Cy2Xc5W7WgHg6Vo+hmPvE+jXmen86yA4+DxIu9VYxoVSMtpBbu76485eCeNw=="
18
18
  },
19
19
  "@ours.network/cowork": {
20
- "version": "1.3.3-nightly.20260923.2d2ff89",
21
- "integrity": "sha512-0dwh40D7mSfx2qg25wQsy83ed5IZR5DSOXi1libYqWdtFOznfGcp3H14T+0oEJPeRdae1kT9bzS3q3RCrUsg/A=="
20
+ "version": "1.3.3-nightly.20261001.6d49d3a",
21
+ "integrity": "sha512-tqoLOWc4O8CGwLdO1j6ukm6Vn57EE0zbuxKo4BWd0QVwu9ObKgHCEMOKPgW2mXHeESXSv9m7edcIrnK8I5gD+w=="
22
22
  },
23
23
  "@ours.network/messenger-server": {
24
- "version": "1.0.31-nightly.6",
25
- "integrity": "sha512-enlos6BWfKiHdUNLRoPMzb0yfxRLWvfxH6uNaOjfAG88BK5qo74hQLwQ7CR4HbVE6OCDAGPLBe1BV7dQSRsbxw=="
24
+ "version": "1.0.31-nightly.12",
25
+ "integrity": "sha512-vp7RkIYnlPDySAbFcXP3vpeOvu0bHeHWjlxOtBbYlGjGa/B7TixXbZpLYwgvbiuD7pVIaHs1muIDzG8RjJTVeQ=="
26
26
  },
27
27
  "@ours.network/fleet": {
28
- "version": "1.2.0-nightly.14",
29
- "integrity": "sha512-IBWPR7FDjjRmtCaUQZZk491PsGf4hKG4XRMHjcvGc/pcViRaZOOZu3cDGG0NJ38dhxubSAk5+DLVD2iYHzJxTA=="
28
+ "version": "1.2.0-nightly.28",
29
+ "integrity": "sha512-6Ils463HA+ZY+JV6MIa9Cet8mxi6Ool3Xf2V8Sy/kSBzCZh3aV2S5jozh4dNINGZh72NxptIh2Z6AL5IoS0WKg=="
30
30
  },
31
31
  "@ours.network/mcp": {
32
- "version": "1.2.0-nightly.7",
33
- "integrity": "sha512-E9x7abO9BXt4MBSnsYh2m0A2E/xmhJHhsgoMLwoGunY6zhIiBx8SNejKPCLXLI+JXUw7nozptcTipBMpqhKqYA=="
32
+ "version": "1.2.0-nightly.10",
33
+ "integrity": "sha512-59sxJOcQagNRR+43Z5ScFlqFDBIlZSMQi8iz9mpxp5Jjl38B0dmCFsv5e+srbEYrV3xaOg9ZBsT17OUABFAseQ=="
34
34
  },
35
35
  "@ours.network/codex": {
36
- "version": "1.2.0-nightly.7",
37
- "integrity": "sha512-6BhRYNI/usYxxAQm3BKsQJD6QvrWOLZ3CjscAJZC35wKft3YC6ejDZ7AV5YdfDM2UcEc/LpcLej4GVkh0ZDRWA=="
36
+ "version": "1.2.0-nightly.10",
37
+ "integrity": "sha512-7hV4R0w8tiQ/JKFU5MxtM7fihd33tzWDgT+Bn8cidasxI5zmTLqDEIv6om5LM/xk7UqcPw5gDN2kcJYiybnP9Q=="
38
38
  },
39
39
  "@ours.network/claude-code": {
40
- "version": "1.2.0-nightly.7",
41
- "integrity": "sha512-3k8xcb9dd9o/p+xXWEmezo53lBNXj3toHhLxhMnqeNRv73abTFCEqQy50TjSRGZSqTr4yi2FmHEium7YuKvmqA=="
40
+ "version": "1.2.0-nightly.10",
41
+ "integrity": "sha512-C3+H/vXespanVj9E1uQAWno9RFrI5KlK2SHSc7dnmRRuFVyRsoVcbvlpVI3nZ8snFaKVzbetebZr7vxd73AWSg=="
42
42
  },
43
43
  "@ours.network/daemon": {
44
- "version": "3.8.1-nightly.3",
45
- "integrity": "sha512-PHtaqjXGUphqX/18YigPa3rcfXmMcgkFLi0eCNlJWIZ16IiMSz1WiLXhmYHPIw1AD/Ng5TqQJ9jZZo28AGRdQw=="
44
+ "version": "3.8.1-nightly.7",
45
+ "integrity": "sha512-dDFDm+xERplzu4yXKvLjKGNaIdr9u4ku5/4jiI4g8do3qOX9VS0tF1+O67uSu4jqkypg860UdZRdn9Zce72H/A=="
46
46
  }
47
47
  },
48
48
  "hostCli": {
49
49
  "@ours.network/sdk": {
50
- "version": "3.8.1-nightly.11",
51
- "integrity": "sha512-dGiMUFXdZLzdwo0U2ilBTanG/aSBfUwfIkicGgCV2gQ710DYcWny9yqRAPCErw0zrh4sspm0HsWEUP/Q+Y/Q9g=="
50
+ "version": "3.8.1-nightly.15",
51
+ "integrity": "sha512-ynKaKmKtINBqYk3kNovsgEO/3TiFY1CC9FgZzrOH+H6onnM3J//Q8cBb9sun8dl9mhB4mKZYgvneSiOejYwZUw=="
52
52
  },
53
53
  "@ours.network/cli": {
54
- "version": "2.8.1-nightly.9",
55
- "integrity": "sha512-vC6E2Tjgje2yJrw5WdSDEH/rt8YWphk1jLjao0Ie2gz+1oyNiAd9Q8VfFZGDSFa7p5xlVRTZzmOgybJuKbabew=="
54
+ "version": "2.8.1-nightly.13",
55
+ "integrity": "sha512-1BeAG12vh4ruBOeJ54l60qWUhLzPLRNKnGtRiJpQmSXkamNQglrPQeXa9xW3taAM4Vg5uYgEhsz6+ieM+1TUSA=="
56
56
  }
57
57
  }
58
58
  },
59
59
  "packages": {
60
60
  "@ours.network/sdk": {
61
61
  "type": "npm",
62
- "version": "3.8.1-nightly.11"
62
+ "version": "3.8.1-nightly.15"
63
63
  },
64
64
  "@ours.network/cli": {
65
65
  "type": "npm",
66
- "version": "2.8.1-nightly.9"
66
+ "version": "2.8.1-nightly.13"
67
67
  },
68
68
  "@ours.network/tg-connector": {
69
69
  "type": "npm",
70
- "version": "1.0.1-nightly.6"
70
+ "version": "1.0.1-nightly.9"
71
71
  },
72
72
  "@ours.network/cowork": {
73
73
  "type": "npm",
74
- "version": "1.3.3-nightly.20260923.2d2ff89"
74
+ "version": "1.3.3-nightly.20261001.6d49d3a"
75
75
  },
76
76
  "@ours.network/messenger-server": {
77
77
  "type": "npm",
78
- "version": "1.0.31-nightly.6"
78
+ "version": "1.0.31-nightly.12"
79
79
  },
80
80
  "@ours.network/fleet": {
81
81
  "type": "npm",
82
- "version": "1.2.0-nightly.14"
82
+ "version": "1.2.0-nightly.28"
83
83
  },
84
84
  "@ours.network/mcp": {
85
85
  "type": "npm",
86
- "version": "1.2.0-nightly.7"
86
+ "version": "1.2.0-nightly.10"
87
87
  },
88
88
  "@ours.network/codex": {
89
89
  "type": "npm",
90
- "version": "1.2.0-nightly.7"
90
+ "version": "1.2.0-nightly.10"
91
91
  },
92
92
  "@ours.network/claude-code": {
93
93
  "type": "npm",
94
- "version": "1.2.0-nightly.7"
94
+ "version": "1.2.0-nightly.10"
95
95
  },
96
96
  "@ours.network/daemon": {
97
97
  "type": "npm",
98
- "version": "3.8.1-nightly.3"
98
+ "version": "3.8.1-nightly.7"
99
99
  }
100
100
  }
101
101
  }
package/install.mjs CHANGED
@@ -3,6 +3,7 @@
3
3
  import { readFileSync } from 'node:fs';
4
4
 
5
5
  import { realEffects } from './lib/effects.mjs';
6
+ import { runWorkspaceSetup } from './lib/workspace-setup.mjs';
6
7
  import { runSetup } from './lib/setup.mjs';
7
8
  import { closeSync, makeWriter, openTty } from './lib/ui.mjs';
8
9
 
@@ -10,7 +11,10 @@ const version = JSON.parse(readFileSync(new URL('./package.json', import.meta.ur
10
11
  const ttyFd = openTty();
11
12
 
12
13
  try {
13
- const code = await runSetup(process.argv.slice(2), realEffects({
14
+ const args=process.argv.slice(2);
15
+ const workspace=args.some(v=>v==='--setup-workspace' || v.startsWith('--setup-workspace=') || v==='--setup-workspace-file' || v.startsWith('--setup-workspace-file='));
16
+ const execute=workspace ? (args,effects)=>runWorkspaceSetup(args,effects,runSetup) : runSetup;
17
+ const code = await execute(args, realEffects({
14
18
  write: makeWriter(ttyFd),
15
19
  ttyFd,
16
20
  env: process.env,
@@ -34,8 +34,18 @@ export async function publishClientCli(effects, packagePath, { policy = {}, isol
34
34
  const acquisitionRoot = dirname(dirname(dirname(packageRoot)));
35
35
  privateAcquisition(effects.home, acquisitionRoot);
36
36
  const retained = JSON.parse(readFileSync(join(acquisitionRoot, 'sources.json')));
37
- if (releaseBinding(retained)?.scope !== 'host-cli') throw new Error('Unrecognized private CLI entry');
37
+ const binding = releaseBinding(retained);
38
+ if (binding && binding.scope !== 'host-cli') throw new Error('Unrecognized private CLI entry');
38
39
  verifyReleaseGraph(acquisitionRoot, retained);
40
+ if (!binding) {
41
+ // Development selections publish through npm's global package entry.
42
+ // Require that exact retained selection and global target on retry;
43
+ // integrity-bound private host CLI releases keep their stricter path.
44
+ const npmRoot = (await effects.run('npm', ['root', '--global'])).stdout.trim();
45
+ const selected = retained.packages?.['@ours.network/cli'];
46
+ const pkg = JSON.parse(readFileSync(join(packageRoot, 'package.json')));
47
+ if (!isAbsolute(npmRoot) || realpathSync(join(npmRoot, '@ours.network/cli')) !== packageRoot || selected?.type !== 'npm' || selected.version !== pkg.version) throw new Error('Unrecognized private CLI entry');
48
+ }
39
49
  const pkg = JSON.parse(readFileSync(join(packageRoot, 'package.json')));
40
50
  if (pkg.name !== '@ours.network/cli' || resolve(packageRoot, pkg.bin?.ours ?? '') !== resolved) throw new Error('Unrecognized private CLI target');
41
51
  } else {
package/lib/effects.mjs CHANGED
@@ -21,7 +21,7 @@ import { fileURLToPath } from 'node:url';
21
21
  import { randomUUID, createHash } from 'node:crypto';
22
22
  import { dirname, join, resolve } from 'node:path';
23
23
  import { clientPackageNames, maintenanceServices, installationPaths, validateInstallation, consumerServiceState, unitNameForStateDir, launchdLabelForStateDir, messengerServicePlan, selectSourcePackages, resolveSourcePolicy, SERVER_SERVICES } from './plan.mjs';
24
- import { validateHostProfile } from './target.mjs';
24
+ import { validateHostProfile, validateGatewayClientProfile } from './target.mjs';
25
25
  import { serverBase, validateGatewayDiscovery, gatewayCompose, gatewayNginx, gatewayAddress } from './gateway.mjs';
26
26
  import { createServerOnboarding } from './server-onboarding.mjs';
27
27
  import { atomicWriteConfig, snapshotConfig, restoreConfig } from './config.mjs';
@@ -1272,20 +1272,15 @@ export function networkEffects(effects) {
1272
1272
  const request = path => fetch(`${base}${path}`, { redirect: 'error', signal: AbortSignal.timeout(5000) });
1273
1273
  const discovery = await request('/.well-known/ours');
1274
1274
  if (discovery.ok) return validateGatewayDiscovery(base, await discovery.json(), resolve(credentialPath));
1275
- // Only an absent discovery resource denotes a legacy direct daemon. Never
1276
- // reinterpret authentication, redirect, or malformed metadata as legacy.
1277
- if (discovery.status !== 404) throw new Error(`Gateway discovery answered HTTP ${discovery.status}`);
1278
- const response = await request('/selection');
1279
- if (!response.ok) throw new Error(`Daemon selection answered HTTP ${response.status}`);
1280
- const selection = await response.json();
1281
- return validateHostProfile({ endpoint: base, expectedInstanceId: selection.instanceId, credentialPath: resolve(credentialPath) });
1275
+ throw new Error(`Gateway discovery answered HTTP ${discovery.status}; enable the gateway. Direct daemon fallback is not supported.`);
1282
1276
  },
1283
1277
  importClientProfile({ profile, sourcesPath, sources: resolvedSources, integrations, fleetSettingsPath, refresh = false }) {
1278
+ profile = validateGatewayClientProfile(profile);
1284
1279
  const root = join(home, '.ours-client');
1285
1280
  const configPath = join(root, 'profile.json');
1286
1281
  const credentialPath = join(root, 'credential');
1287
1282
  const current = effects.readManagedClientProfile();
1288
- if (current && (current.endpoint !== profile.endpoint || current.expectedInstanceId !== profile.expectedInstanceId))
1283
+ if (current && current.expectedInstanceId !== profile.expectedInstanceId)
1289
1284
  throw new Error('Managed client already selects another server; existing default was not changed');
1290
1285
  assertPrivateRegularFile(profile.credentialPath, 'credential');
1291
1286
  const credential = readFileSync(profile.credentialPath, 'utf8');
@@ -1300,7 +1295,10 @@ export function networkEffects(effects) {
1300
1295
  if (current && !refresh) {
1301
1296
  assertPrivateRegularFile(credentialPath, 'managed credential');
1302
1297
  if (readFileSync(credentialPath, 'utf8') !== credential) atomicWriteConfig(credentialPath, credential);
1303
- return { configPath, profile: validateHostProfile(current), settings: current.installer };
1298
+ const saved = { ...current, ...profile, credentialPath };
1299
+ if (current.endpoint !== saved.endpoint || current.serverUrl !== saved.serverUrl)
1300
+ atomicWriteConfig(configPath, JSON.stringify(saved, null, 2) + '\n');
1301
+ return { configPath, profile: validateGatewayClientProfile(saved), settings: current.installer };
1304
1302
  }
1305
1303
  const settings = { sourcesPath: join(root, 'sources.json'), integrations };
1306
1304
  if (fleetSettings) settings.fleetSettingsPath = join(root, 'fleet-settings.json');
@@ -1,3 +1,4 @@
1
+ import { validateGatewayClientProfile } from './target.mjs';
1
2
  import { enableGateway } from './gateway-transition.mjs';
2
3
  import { executeLegacyMigration } from './legacy-migration.mjs';
3
4
  // ours-install v3 — the orchestrator.
@@ -1449,7 +1450,7 @@ export async function runClientCommand(command, effects) {
1449
1450
  configPath = managedPath;
1450
1451
  }
1451
1452
  let profile;
1452
- if (configPath) profile = validateHostProfile(effects.readProfile(configPath));
1453
+ if (configPath) profile = validateGatewayClientProfile(effects.readProfile(configPath));
1453
1454
  else if (!command.preset && effects.interactive) {
1454
1455
  const endpoint = await effects.askLine('Server HTTP or HTTPS endpoint: ', 'http://127.0.0.1:3050');
1455
1456
  const credentialPath = await effects.askLine('Private issued-token file: ', '');
@@ -1457,7 +1458,7 @@ export async function runClientCommand(command, effects) {
1457
1458
  profile = await effects.discoverClientProfile(endpoint, credentialPath);
1458
1459
  }
1459
1460
  if (!profile) throw new InstallUsageError('client install requires a complete network profile; supply --config or use the interactive client setup');
1460
- if (saved && (saved.endpoint !== profile.endpoint || saved.expectedInstanceId !== profile.expectedInstanceId))
1461
+ if (saved && saved.expectedInstanceId !== profile.expectedInstanceId)
1461
1462
  throw new InstallUsageError('Managed client already selects another server; existing default was not changed');
1462
1463
  for (const name of ['OURS_API_TOKEN', 'OURS_PORT', 'OURS_STATE_DIR', 'OURS_DAEMON_ID']) {
1463
1464
  if (effects.env[name]?.trim()) throw new InstallUsageError(`${name} conflicts with client profile selection`);
@@ -29,16 +29,56 @@ function validateRecord(record) {
29
29
  }
30
30
 
31
31
  export function createServerOnboarding(effects, { compose, localEnv, bin }) {
32
- async function identityCommand(record, args) {
33
- const result = record.mode === 'docker'
34
- ? await compose(record, ['exec', '-T', 'daemon', 'node', '/opt/ours/node_modules/@ours.network/cli/dist/cli.js', ...args, '--config', '/var/lib/ours/config.json', '--state-dir', '/var/lib/ours', '--json'])
35
- : await effects.run(bin(record, 'ours'), [...args, '--config', record.configPath, '--state-dir', installationPaths(record).daemon, '--json'], { env: localEnv(record) });
32
+ // CLI client commands only accept gateway profiles in current releases. Use
33
+ // the installed SDK against the selected local daemon and its private file.
34
+ const identityScript = `
35
+ import { createRequire } from 'node:module';
36
+ import { pathToFileURL } from 'node:url';
37
+ import { randomUUID } from 'node:crypto';
38
+ const selection = JSON.parse(process.argv[1]);
39
+ const require = createRequire(selection.anchor);
40
+ const { attachOursClient } = await import(pathToFileURL(require.resolve('@ours.network/sdk/client')).href);
41
+ const client = await attachOursClient({ endpoint: selection.endpoint,
42
+ expectedInstanceId: selection.instanceId, credentialPath: selection.credentialPath,
43
+ sessionMode: 'external', leaseToken: randomUUID(), env: {} });
44
+ try {
45
+ const result = selection.operation === 'list' ? await client.listIdentities()
46
+ : await client.createRootIdentity({ name: selection.name, bio: '',
47
+ exposeLocal: true, localAutoAccept: true, skipIfRootExists: true });
48
+ process.stdout.write(JSON.stringify(result));
49
+ } catch (error) {
50
+ process.stdout.write(JSON.stringify({ onboardingError: error.code || 'OWNER_OPERATION_FAILED' }));
51
+ } finally {
52
+ try { await client.releaseLease(); } finally { await client.close(); }
53
+ }
54
+ `;
55
+ async function identityCommand(record, operation, name) {
56
+ validateRecord(record);
57
+ const docker = record.mode === 'docker';
58
+ const selection = {
59
+ operation, ...(name === undefined ? {} : { name }),
60
+ endpoint: `http://127.0.0.1:${docker ? 3050 : record.port}`,
61
+ instanceId: record.instanceId,
62
+ credentialPath: docker ? '/var/lib/ours/daemon-token' : join(installationPaths(record).daemon, 'daemon-token'),
63
+ anchor: docker ? '/opt/ours/package.json' : join(record.workDir, 'package.json'),
64
+ };
65
+ const args = ['--input-type=module', '-e', identityScript, JSON.stringify(selection)];
66
+ const result = docker
67
+ ? await compose(record, ['exec', '-T', 'daemon', 'node', ...args])
68
+ : await effects.run(process.execPath, args, { env: localEnv(record), sensitive: true });
36
69
  if (result.code !== undefined && result.code !== 0) throw new Error('Owner identity operation failed');
37
- try { return JSON.parse(result.stdout); }
70
+ let value;
71
+ try { value = JSON.parse(result.stdout); }
38
72
  catch { throw new Error('Owner identity operation returned malformed JSON'); }
73
+ if (value?.onboardingError) {
74
+ const error = new Error('Owner identity operation failed');
75
+ error.code = value.onboardingError;
76
+ throw error;
77
+ }
78
+ return value;
39
79
  }
40
80
  async function identities(record) {
41
- const rows = await identityCommand(record, ['identity', 'list']);
81
+ const rows = await identityCommand(record, 'list');
42
82
  if (!Array.isArray(rows) || rows.some(row => !row || typeof row.name !== 'string'
43
83
  || (!['root', 'role'].includes(row.kind) && !['reconciling', 'awaiting-root', 'migration-failed', 'refresh-failed'].includes(row.status))
44
84
  || (row.kind && (typeof row.cid !== 'string' || !row.cid)))) throw new Error('Owner identity list is malformed');
@@ -60,10 +100,11 @@ export function createServerOnboarding(effects, { compose, localEnv, bin }) {
60
100
  if (prior.rows.some(row => row.name === name)) throw new Error('Requested Human identity name already exists; no identity was changed');
61
101
  effects.out?.(`Creating Human identity ${name}; retaining ${prior.rows.length} existing identities.`);
62
102
  try {
63
- await identityCommand(record, ['identity', 'create-root', '--name', name, '--skip-if-root-exists', 'true']);
103
+ await identityCommand(record, 'create-root', name);
64
104
  } catch (error) {
65
- // ROOT_EXISTS is currently a CLI error. A concurrent creator is safe only
105
+ // A concurrent creator is safe only
66
106
  // when the authoritative list now contains a root; other errors stay errors.
107
+ if (error.code !== 'ROOT_EXISTS') throw error;
67
108
  const after = await identities(record);
68
109
  if (after.root) return retained(after);
69
110
  throw error;
@@ -76,7 +117,7 @@ export function createServerOnboarding(effects, { compose, localEnv, bin }) {
76
117
  },
77
118
  async prepareLocalClient(record, integrations, fleetSettingsPath) {
78
119
  validateRecord(record);
79
- if (!Array.isArray(integrations) || !integrations.length || new Set(integrations).size !== integrations.length
120
+ if (!Array.isArray(integrations) || new Set(integrations).size !== integrations.length
80
121
  || integrations.some(name => !['codex', 'claude-code', 'fleet'].includes(name))) throw new Error('Client integrations must select codex, claude-code and/or fleet');
81
122
  if (fleetSettingsPath !== undefined) {
82
123
  if (typeof fleetSettingsPath !== 'string' || !isAbsolute(fleetSettingsPath) || resolve(fleetSettingsPath) !== fleetSettingsPath) throw new Error('Fleet settings path must be absolute');
@@ -16,7 +16,7 @@ const nonempty = value => typeof value === 'string' && value.trim().length > 0 &
16
16
 
17
17
  export function recommendedMode({ platform, arch, release = '' } = {}) {
18
18
  if (platform === 'linux' && /microsoft|wsl/i.test(release)) return { mode: 'docker', reason: 'Docker is recommended on Windows and WSL.' };
19
- if (platform === 'linux' && arch === 'x64') return { mode: 'packages', reason: 'Native packages are recommended on Linux x64 with a systemd user manager.' };
19
+ if (platform === 'linux' && arch === 'x64') return { mode: 'docker', reason: 'Docker provides the integrated gateway for full-stack setup; native mode is server-only.' };
20
20
  if (platform === 'darwin') return { mode: 'docker', reason: 'Docker is recommended on macOS.' };
21
21
  if (platform === 'win32') return { mode: 'docker', reason: 'Docker is recommended on Windows; run the installer inside WSL with Docker Desktop.' };
22
22
  return { mode: 'docker', reason: 'Docker is recommended for this platform.' };
@@ -90,7 +90,7 @@ function expandPaths(options, home) {
90
90
  return output;
91
91
  }
92
92
 
93
- export function parseSetupArgs(argv, { home } = {}) {
93
+ export function parseSetupArgs(argv, { home, validate = true } = {}) {
94
94
  if (!Array.isArray(argv) || !argv.every(arg => typeof arg === 'string')) throw new Error('Arguments must be strings');
95
95
  const options = { interactive: false, explicitPorts: [] };
96
96
  const seen = new Set();
@@ -121,7 +121,7 @@ export function parseSetupArgs(argv, { home } = {}) {
121
121
  if (positional.length && scopes.includes(positional[0])) put('scope', positional.shift());
122
122
  if (positional.length && ['install', 'update'].includes(positional[0])) put('operation', positional.shift());
123
123
  if (positional.length) throw new Error(`Unexpected setup argument: ${positional.join(' ')}`);
124
- return validateSetupOptions(expandPaths(options, home), { interactive: false });
124
+ return validate ? validateSetupOptions(expandPaths(options, home), { interactive: false }) : expandPaths(options, home);
125
125
  }
126
126
 
127
127
  export async function collectSetupOptions(effects) {
package/lib/setup.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { validateGatewayClientProfile } from './target.mjs';
1
2
  import { gatewayAddress } from './gateway.mjs';
2
3
  import { inspectLegacyMigration } from './legacy-migration.mjs';
3
4
  import { join } from 'node:path';
@@ -32,6 +33,8 @@ export async function prepareSetupPlan(options, effects) {
32
33
  options = validateSetupOptions(options, { interactive: options.interactive });
33
34
  if (effects.platform?.platform === 'win32') throw new InstallUsageError('Run ours-install inside WSL with Docker Desktop integration on Windows. Direct Windows Node installations are not supported.');
34
35
  const plan = { ...options };
36
+ if (options.scope === 'all' && options.mode === 'packages' && options.integrations?.length)
37
+ throw new InstallUsageError('Gateway-only clients require a gateway. Use Docker full-stack setup, or install the native server separately and provision an HTTP gateway before client setup; nothing was changed.');
35
38
  if (options.scope !== 'server') {
36
39
  for (const name of ['OURS_API_TOKEN', 'OURS_PORT', 'OURS_STATE_DIR', 'OURS_DAEMON_ID']) {
37
40
  if (effects.env?.[name]?.trim()) throw new InstallUsageError(`${name} conflicts with the selected client profile. Clear this override before full-stack/client setup; nothing was changed.`);
@@ -73,12 +76,12 @@ export async function prepareSetupPlan(options, effects) {
73
76
  throw new InstallUsageError('This user already has clients attached to a different server; their saved connection was not changed');
74
77
  }
75
78
  } else {
76
- const profile = validateHostProfile(readObject(effects, options.config, 'Client profile'));
79
+ const profile = validateGatewayClientProfile(readObject(effects, options.config, 'Client profile'));
77
80
  if (!profile) throw new InstallUsageError('Client profile must contain endpoint, expectedInstanceId and credentialPath');
78
81
  if (!effects.readText(profile.credentialPath)?.trim()) throw new InstallUsageError('Client credential file is missing or empty');
79
82
  plan.profile = profile;
80
83
  const saved = effects.readManagedClientProfile();
81
- if (saved && (saved.endpoint !== profile.endpoint || saved.expectedInstanceId !== profile.expectedInstanceId)) throw new InstallUsageError('Managed clients already select another server; existing connection was not changed');
84
+ if (saved && saved.expectedInstanceId !== profile.expectedInstanceId) throw new InstallUsageError('Managed clients already select another server; existing connection was not changed');
82
85
  if (saved && options.operation === 'install' && !options.sources) plan.sourcePolicy = readObject(effects, saved.installer.sourcesPath, 'Retained client source policy');
83
86
  }
84
87
  // Dry-run never spawns a resolver or acquires an installation lock.
package/lib/target.mjs CHANGED
@@ -105,6 +105,13 @@ export function validateHostProfile(value) {
105
105
  return { endpoint: endpointBase, expectedInstanceId, credentialPath };
106
106
  }
107
107
 
108
+ /** Client installs require the single gateway even when a legacy server profile exists. */
109
+ export function validateGatewayClientProfile(value) {
110
+ if (!value || typeof value.serverUrl !== 'string') throw profileError('serverUrl is required; enable the server gateway and import its client profile. Direct daemon endpoints are not client routes.');
111
+ const serverUrl = serverBase(value.serverUrl);
112
+ return validateHostProfile({ ...value, endpoint: value.endpoint ?? serverUrl + '/daemon' });
113
+ }
114
+
108
115
  export function resolveProfileSelection({ args, env = {}, home = homedir(), exists, readProfile }) {
109
116
  const explicit = (env.OURS_CONFIG ?? '').trim();
110
117
  const configPath = explicit ? resolve(explicit) : resolve(home, DEFAULT_STATE_DIR_NAME, DAEMON_CONFIG);
package/lib/usage.mjs CHANGED
@@ -4,7 +4,7 @@ export const USAGE = `ours-install — interactive setup or complete CLI presets
4
4
  ours-install
5
5
  Opens the console form. Choose all (server + clients), server, or client;
6
6
  runtime, installation directory, identity, integrations and Fleet settings.
7
- Linux x64 recommends native; macOS/Windows recommend Docker. Windows uses WSL.
7
+ Docker provides the full-stack gateway; native mode is server-only. Windows uses WSL.
8
8
 
9
9
  Full stack, with every required answer preset (no prompts):
10
10
  ours-install --mode docker --state-dir /private/ours --identity-name "Your Name" --integrations codex,fleet --fleet-settings /private/fleet.json
@@ -29,7 +29,7 @@ export const USAGE = `ours-install — interactive setup or complete CLI presets
29
29
  --fleet-settings PATH JSON settings for Fleet; mandatory for CLI presets selecting Fleet
30
30
  --config PATH complete connection profile for client-only setup
31
31
  --sources PATH explicit full development source policy override
32
- --port N daemon port (default 3050 on a fresh installation)
32
+ --port N public gateway port for Docker (default 3050; e.g. 4050)
33
33
  --server-url URL external gateway URL (Docker install; configure authenticated entry separately)
34
34
  --cowork-port N cowork port (default 3052)
35
35
  --messenger-port N messenger port (default 8420)
@@ -0,0 +1,52 @@
1
+ import { chmodSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { join,resolve } from 'node:path';
3
+ import {parseSetupArgs} from './setup-options.mjs';
4
+ /** Base64 is transport, not encryption. Broad provider credentials are never accepted. */
5
+ export function decodeWorkspacePayload(encoded,now=Date.now()) {
6
+ if(typeof encoded!=='string' || encoded.length>32768 || !/^[A-Za-z0-9_-]+$/.test(encoded.trim()))throw Error('Invalid private workspace payload');
7
+ let p;try{p=JSON.parse(Buffer.from(encoded.trim(),'base64url'));}catch{throw Error('Invalid private workspace payload');}
8
+ const allowed=['version','appOrigin','hostname','rootName','name','surname','connectorToken','invitation','serverCid','challenge'];
9
+ if(!p || Object.keys(p).some(k=>!allowed.includes(k)) || p.version!==1 || !['https://app.ours.network','https://app.ours-tunnel.com'].includes(p.appOrigin) || !/^[a-z0-9][a-z0-9-]{2,60}\.ours-tunnel\.com$/.test(p.hostname) || !/^[a-z0-9-]{2,30}@[a-z0-9-]{2,30}$/.test(p.rootName) || !/^[a-f0-9]{64}$/i.test(p.serverCid))throw Error('Invalid workspace payload boundary');
10
+ for(const key of ['name','surname','connectorToken','invitation'])if(typeof p[key]!=='string' || !p[key].trim() || p[key].length>8192 || /[\x00-\x1f\x7f]/.test(p[key]))throw Error('Invalid private workspace payload');
11
+ if(!p.challenge || !['nonce','accountId','workspaceId'].every(k=>/^[\w-]{43}$/.test(p.challenge[k])) || !Number.isFinite(p.challenge.expiresAt) || p.challenge.expiresAt<=now || p.challenge.expiresAt>now+16*60000)throw Error('Workspace challenge expired or invalid');
12
+ return p;
13
+ }
14
+ export function extractWorkspaceArgs(args){
15
+ const flags=['--setup-workspace','--setup-workspace-file','--workspace-fleet-bin','--fleet-settings'];const values={},rest=[];
16
+ for(let i=0;i<args.length;i++){const at=args[i].indexOf('='),flag=at<0?args[i]:args[i].slice(0,at);if(!flags.includes(flag)){rest.push(args[i]);continue;}if(values[flag]!==undefined)throw Error('Duplicate workspace flag');const value=at<0?args[++i]:args[i].slice(at+1);if(!value || value.startsWith('--'))throw Error('Workspace flag requires a value');values[flag]=value;}
17
+ if(values['--setup-workspace'] && values['--setup-workspace-file'])throw Error('Choose one private payload transport');
18
+ return {values,rest};
19
+ }
20
+ export async function runWorkspaceSetup(args,effects,runSetup){
21
+ const migrateAppOrigin=args.includes('--workspace-migrate-app-origin');
22
+ if(args.filter(arg=>arg==='--workspace-migrate-app-origin').length>1)throw Error('Duplicate workspace migration flag');
23
+ const {values,rest}=extractWorkspaceArgs(args.filter(arg=>arg!=='--workspace-migrate-app-origin'));let encoded;
24
+ if(values['--setup-workspace-file']){const path=resolve(values['--setup-workspace-file']),stat=lstatSync(path);if(!stat.isFile() || stat.isSymbolicLink() || stat.nlink!==1 || stat.uid!==process.getuid?.() || stat.size>32768 || (stat.mode&0o077)!==0)throw Error('Setup file must be owned and private (chmod 600)');encoded=readFileSync(path,'utf8').trim();}
25
+ else if(values['--setup-workspace']==='-'){const chunks=[];let bytes=0;for await(const chunk of process.stdin){bytes+=chunk.length;if(bytes>32768)throw Error('Private payload too large');chunks.push(chunk);}encoded=Buffer.concat(chunks).toString().trim();}
26
+ else encoded=values['--setup-workspace'];
27
+ const p=decodeWorkspacePayload(encoded),fleetBin=values['--workspace-fleet-bin'] || 'ours-fleet';
28
+ const parsed=parseSetupArgs(rest,{home:effects.home,validate:false});
29
+ if(parsed.scope==='server')throw Error('Workspace setup requires all or client scope');
30
+ if(parsed.identityName!==undefined || parsed.integrations!==undefined)throw Error('Workspace setup supplies identity and client integration selection');
31
+ // Check feature availability before changing an installation. Task acceptance uses
32
+ // an exact task-built binary; @latest cannot contain an unmerged feature.
33
+ const root=parsed.stateDir || join(effects.home,'.ours-network','workspace'),fleetSettings=values['--fleet-settings'];
34
+ const options=[...rest];if(!parsed.scope)options.push('--scope',parsed.config?'client':'all');if(!parsed.mode && !parsed.config)options.push('--mode','docker');if(!parsed.stateDir && !parsed.config)options.push('--state-dir',root);
35
+ if(!parsed.config)options.push('--identity-name',p.rootName);options.push('--integrations','none');
36
+ parseSetupArgs(options,{home:effects.home});
37
+ await effects.run(fleetBin,['workspace-enroll','--help'],{sensitive:true});
38
+ await effects.run('cloudflared',['--version'],{sensitive:true});
39
+ const result=await runSetup(options,effects);if(result!==0)return result;
40
+ if(options.includes('--dry-run'))return 0;
41
+ const initArgs=['init',...(fleetSettings?['--settings',fleetSettings]:[])];
42
+ const selected=effects.readManagedClientProfile();if(!selected)throw Error('Workspace client profile was not installed');
43
+ const env={OURS_CONFIG:join(effects.home,'.ours-client','profile.json')};
44
+ // An explicit managed gateway profile must not compete with inherited daemon selectors.
45
+ for(const key of ['OURS_PORT','OURS_STATE_DIR','OURS_API_TOKEN','OURS_DAEMON_ID','OURS_DAEMON_URL','OURS_DAEMON_CREDENTIAL_PATH'])env[key]=undefined;
46
+ const initialized=fleetSettings?await effects.run(fleetBin,initArgs,{env}):await effects.runInteractive(fleetBin,initArgs,{env});if(!initialized.ok)throw Error('Fleet configuration incomplete');
47
+ mkdirSync(root,{recursive:true,mode:0o700});const temporary=mkdtempSync(join(root,'.workspace-payload-'));chmodSync(temporary,0o700);
48
+ const payloadFile=join(temporary,'payload');writeFileSync(payloadFile,encoded,{mode:0o600,flag:'wx'});
49
+ try{await effects.run(fleetBin,['workspace-enroll','--file',payloadFile,...(migrateAppOrigin?['--migrate-app-origin']:[])],{env,stream:true,sensitive:true});}
50
+ finally{rmSync(temporary,{recursive:true,force:true});}
51
+ effects.out('Workspace proof submitted. Check verified binding/tunnel status in your account, then scan or paste the private device code.');return 0;
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ours.network/install",
3
- "version": "1.2.1-nightly.16",
3
+ "version": "1.2.1-nightly.18",
4
4
  "private": false,
5
5
  "description": "The all-in-one ours.network installer: one shared daemon, MCP, cowork, Telegram, Fleet initialization, harness plugins, Human identity, progress UI, and guided next steps.",
6
6
  "type": "module",
@@ -16,7 +16,8 @@
16
16
  "uninstall.sh",
17
17
  "README.md",
18
18
  "ROOTLESS_PODMAN_VALIDATION.md",
19
- "LICENSE"
19
+ "LICENSE",
20
+ "GATEWAY_SETUP.md"
20
21
  ],
21
22
  "license": "FSL-1.1-Apache-2.0",
22
23
  "author": "Adapt Toolkit",