@backedrelay/relay 0.0.0-stage → 0.3.8
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.
- package/README.md +6 -2
- package/bin/relay.mjs +40 -0
- package/package.json +24 -4
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Relay installer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Installs isolated local Runtime, Composer, PostgreSQL, Auth and REST API, and creates your first private owner/workspace. Requires Linux AMD64 Docker/Compose, Python3.9+, OpenSSL, zstd, Node20+ and authenticated GitHub CLI access to the invite-only release.
|
|
4
|
+
|
|
5
|
+
Run `relay install --email you@example.com`, then use the printed local URLs and protected login file. Inference stays off until explicitly enrolled; no model weights or credentials are bundled. Run `relay health`, `relay stop`, `relay start`, or `relay snapshot --destination PRIVATE_PATH`.
|
|
6
|
+
|
|
7
|
+
Runtime downloads remain invite-only. See the release START-HERE.md for setup, inference and recovery instructions.
|
package/bin/relay.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createHash} from 'node:crypto';
|
|
3
|
+
import {closeSync,copyFileSync,existsSync,linkSync,mkdirSync,openSync,readFileSync,readSync,renameSync,statSync} from 'node:fs';
|
|
4
|
+
import {homedir} from 'node:os';
|
|
5
|
+
import {join,resolve,dirname} from 'node:path';
|
|
6
|
+
import {spawnSync} from 'node:child_process';
|
|
7
|
+
const REPO='jtravelsworld/relay-hybrid-private-release',TAG='relay-hybrid-0.3.8-private';
|
|
8
|
+
const DIST_SHA='1bedae10ef02c5bc9b3979370b70ece278ff7d705ea87335f8c2e9130b53635d';
|
|
9
|
+
const cache=join(homedir(),'.local','share','relay-private','0.3.8');
|
|
10
|
+
function hash(path){const h=createHash('sha256'),fd=openSync(path,'r'),buf=Buffer.alloc(1024*1024);try{let n;while((n=readSync(fd,buf,0,buf.length,null))>0)h.update(buf.subarray(0,n));}finally{closeSync(fd);}return h.digest('hex');}
|
|
11
|
+
function run(cmd,args){const r=spawnSync(cmd,args,{stdio:'inherit'});if(r.error)throw r.error;if(r.status!==0)throw new Error(`${cmd} failed (${r.status})`);}
|
|
12
|
+
function privateDir(path){mkdirSync(path,{recursive:true,mode:0o700});}
|
|
13
|
+
function checked(path,want){return existsSync(path)&&hash(path)===want;}
|
|
14
|
+
function releaseFiles(dir){const manifest=JSON.parse(readFileSync(join(dir,'FILE-MANIFEST.json'),'utf8'));if(manifest.schema!=='relay.private-release-file-manifest/v3.3')throw new Error('Unknown release manifest');for(const [name,entry] of Object.entries(manifest.files)){if(name.startsWith('/')||name.split('/').includes('..')||!checked(join(dir,name),entry.sha256))throw new Error(`Release file hash mismatch: ${name}`);}return manifest;}
|
|
15
|
+
function downloadAsset(name,dir,tag=TAG){run('gh',['release','download',tag,'--repo',REPO,'--pattern',name,'--dir',dir,'--clobber']);}
|
|
16
|
+
function fetchRelease(){
|
|
17
|
+
privateDir(cache);const downloads=join(cache,'downloads'),release=join(cache,'release');privateDir(downloads);
|
|
18
|
+
if(existsSync(join(release,'FILE-MANIFEST.json'))&&existsSync(join(downloads,'DISTRIBUTION.json'))&&hash(join(downloads,'DISTRIBUTION.json'))===DIST_SHA){try{releaseFiles(release);if(hash(join(release,'FILE-MANIFEST.json'))===JSON.parse(readFileSync(join(downloads,'DISTRIBUTION.json'),'utf8')).fileManifestSha256)return release;}catch{}}
|
|
19
|
+
downloadAsset('DISTRIBUTION.json',downloads);const distPath=join(downloads,'DISTRIBUTION.json');if(hash(distPath)!==DIST_SHA)throw new Error('Distribution manifest hash mismatch');
|
|
20
|
+
const dist=JSON.parse(readFileSync(distPath,'utf8'));if(dist.schema!=='relay.private-distribution/v2'||dist.repository!==REPO||dist.tag!==TAG)throw new Error('Distribution identity mismatch');
|
|
21
|
+
for(const [name,entry] of Object.entries(dist.assets)){
|
|
22
|
+
if(name.startsWith('/')||name.includes('..')||name.includes('/'))throw new Error('Unsafe asset name');
|
|
23
|
+
const tag=entry.releaseTag??TAG;if(![TAG,'relay-hybrid-0.3.0-private','relay-hybrid-0.3.6-private'].includes(tag))throw new Error('Unexpected asset release');
|
|
24
|
+
const path=join(downloads,name);
|
|
25
|
+
if(!existsSync(path)&&tag!==TAG){const prior=join(homedir(),'.local','share','relay-private','0.3.0','release',name);if(checked(prior,entry.sha256)){try{linkSync(prior,path);}catch{copyFileSync(prior,path);}}}
|
|
26
|
+
if(!checked(path,entry.sha256))downloadAsset(name,downloads,tag);
|
|
27
|
+
if(!checked(path,entry.sha256)||statSync(path).size!==entry.bytes)throw new Error(`Downloaded asset mismatch: ${name}`);
|
|
28
|
+
}
|
|
29
|
+
privateDir(release);run('tar',['-xzf',join(downloads,'relay-private-0.3.8-payload.tar.gz'),'-C',release]);
|
|
30
|
+
for(const name of ['images-linux-amd64.tar.zst','parent-history-035-source.tar.gz','composer-owner-inference-038-source.tar.gz']){const to=join(release,name);if(!checked(to,dist.assets[name].sha256))renameSync(join(downloads,name),to);}
|
|
31
|
+
if(hash(join(release,'FILE-MANIFEST.json'))!==dist.fileManifestSha256||hash(join(release,'release.json'))!==dist.releaseManifestSha256)throw new Error('Release manifest mismatch');releaseFiles(release);return release;
|
|
32
|
+
}
|
|
33
|
+
let args=process.argv.slice(2),dir=process.env.RELAY_RELEASE_DIR;
|
|
34
|
+
const index=args.indexOf('--release-dir');if(index>=0){if(!args[index+1])throw new Error('--release-dir requires a path');dir=args[index+1];args.splice(index,2);}
|
|
35
|
+
if(args.length===1&&['--version','-v'].includes(args[0])){process.stdout.write('0.3.8\n');process.exit(0);}
|
|
36
|
+
if(args.length===1&&['--help','-h','help'].includes(args[0])){process.stdout.write('Relay 0.3.8: install/setup, doctor, health, status, start, stop, snapshot, restore-local, inference-ollama, inference-configure. Invite-only Runtime downloads require authenticated gh access. See START-HERE.md.'+'\n');process.exit(0);}
|
|
37
|
+
if(args[0]==='fetch'){const path=fetchRelease();process.stdout.write(path+'\n');process.exit(0);}
|
|
38
|
+
if(!args.length)args=['install'];
|
|
39
|
+
if(!args.length){process.stderr.write('Usage: relay [--release-dir PATH] <doctor|install|health|status|start|stop|backup|restore|upgrade|rollback|inference-doctor|inference-ollama|inference-configure|inference-recover> ...\n');process.exit(2);}
|
|
40
|
+
const release=dir?resolve(dir):fetchRelease();if(!existsSync(join(release,'relayctl.py')))throw new Error('Private release installer missing');run('python3',[join(release,'relayctl.py'),...args]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backedrelay/relay",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.8",
|
|
4
|
+
"description": "Relay local Runtime and Composer installer",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"relay": "bin/relay.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/relay.mjs",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"registry": "https://registry.npmjs.org",
|
|
19
|
+
"access": "public",
|
|
20
|
+
"tag": "latest"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/jtravelsworld/relay-hybrid-private-release.git"
|
|
25
|
+
}
|
|
26
|
+
}
|