@ours.network/install 2.1.6 → 2.1.7
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 +2 -2
- package/assets/images.json +16 -16
- package/assets/release-lock.json +7 -7
- package/assets/release.json +1 -1
- package/assets/sources.json +1 -1
- package/lib/prompt.mjs +2 -2
- package/lib/server-onboarding.mjs +6 -6
- package/lib/setup-options.mjs +151 -64
- package/lib/setup.mjs +57 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,10 +93,10 @@ New images use Node.js 24.22.1. Existing images, retained Dockerfiles, running p
|
|
|
93
93
|
## Install first, connect the App afterwards
|
|
94
94
|
|
|
95
95
|
```sh
|
|
96
|
-
ours-install --username alex --name Alex --surname Taylor --disable-fleet-agents-setup
|
|
96
|
+
ours-install --scope all --username alex --name Alex --surname Taylor --disable-fleet-agents-setup
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
This permanent command contains no tunnel credentials or enrollment expiry. On a terminal it
|
|
99
|
+
This permanent command contains no tunnel credentials or enrollment expiry. `--scope all` installs everything on this computer, so no server/client choice is asked. On a terminal it first offers **Install recommended setup** (the default: `~/.ours-install`, Docker, Fleet and the detected agent apps) or **Customize** (folder, Docker or Podman, apps, ports). An installation already found in `~/.ours-install` or another `~/.ours*` folder, or elsewhere through its Docker/Podman containers, is updated in place with its runtime, ports and connected apps, after the usual recovery-backup consent; several installations, one that cannot be read, or a native Ours service from another folder are refused until `--state-dir` selects one. Valid supplied profile values are used without asking; missing or invalid ones are asked. The username is local and has no global uniqueness check. A fresh root is named `<username>@<hostname>`; the optional `--hostname` defaults to the machine name. Messenger stores Name and Surname through its supported profile API. Retried setup retains root identities and existing Messenger profiles.
|
|
100
100
|
|
|
101
101
|
`--disable-fleet-agents-setup` installs the Fleet CLI and saves the choice without opening its agent/model wizard or rewriting existing Fleet configuration. Configure agents in the App after device linking. Complete presets still work unattended; partial presets require a terminal and cannot use `OURS_ASSUME_YES`.
|
|
102
102
|
|
package/assets/images.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"channel": "stable",
|
|
4
|
-
"installerVersion": "2.1.
|
|
5
|
-
"commit": "
|
|
4
|
+
"installerVersion": "2.1.7",
|
|
5
|
+
"commit": "f1fd3d6bf1fea97569f1d4c078f2d224b55a51e5",
|
|
6
6
|
"platform": "linux/amd64",
|
|
7
7
|
"variants": {
|
|
8
8
|
"server": {
|
|
9
|
-
"policySha256": "
|
|
9
|
+
"policySha256": "acacb6496d107d01dcbcbe091728c739091a96db91ae5422f47be99a78d50f65",
|
|
10
10
|
"runtime": {
|
|
11
11
|
"repository": "docker.io/adaptframework/ours-runtime",
|
|
12
|
-
"index": "sha256:
|
|
13
|
-
"manifest": "sha256:
|
|
14
|
-
"config": "sha256:
|
|
12
|
+
"index": "sha256:265427765003b69f874315d9b318a05d24ceaafafac1859709f6f767a57723aa",
|
|
13
|
+
"manifest": "sha256:70cbe60abcd21d57f66aa547ac82cc1587f3cdeba5ff17568942660d3b3b7fd4",
|
|
14
|
+
"config": "sha256:b271099020409420f03d50f4bb2c04a48deb78b1d56d6075fddbec0ec3cb3cc9"
|
|
15
15
|
},
|
|
16
16
|
"maintenance": {
|
|
17
17
|
"repository": "docker.io/adaptframework/ours-maintenance",
|
|
18
|
-
"index": "sha256:
|
|
19
|
-
"manifest": "sha256:
|
|
20
|
-
"config": "sha256:
|
|
18
|
+
"index": "sha256:3ff94bc245f340f9c77920d44d46d3c461564927b18693dfb7066279728db26a",
|
|
19
|
+
"manifest": "sha256:52e89e1f813d8239329f09fe15b12037110ded31682f3012ed1a09d07c7d6ab6",
|
|
20
|
+
"config": "sha256:1575df92f5ce1433c391e97e0bbfffdd2a7e6f10405bf5bd462a4e773b6ebf7b"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"daemon": {
|
|
24
|
-
"policySha256": "
|
|
24
|
+
"policySha256": "6a1ef78d3de12b36b3ed699a5ecf009d2d911b4cda506b4208fbea9b25b36589",
|
|
25
25
|
"runtime": {
|
|
26
26
|
"repository": "docker.io/adaptframework/ours-runtime",
|
|
27
|
-
"index": "sha256:
|
|
28
|
-
"manifest": "sha256:
|
|
29
|
-
"config": "sha256:
|
|
27
|
+
"index": "sha256:997e2cf86e9407d8617d67f2c41f042344ed21d2c4773dbdf7925b65d1627181",
|
|
28
|
+
"manifest": "sha256:5000de96f42aa672db7b7615c682d61e7513135fc3af395796bb81fd6078934d",
|
|
29
|
+
"config": "sha256:d80acefd57bf4593b4304abba4c32f39f9d5dcfb5e46f2814a4cc14e6d3e479e"
|
|
30
30
|
},
|
|
31
31
|
"maintenance": {
|
|
32
32
|
"repository": "docker.io/adaptframework/ours-maintenance",
|
|
33
|
-
"index": "sha256:
|
|
34
|
-
"manifest": "sha256:
|
|
35
|
-
"config": "sha256:
|
|
33
|
+
"index": "sha256:664d6118713b229a1545bd8098c6cf7fc0c8a09c2515116385094f88b9a826a6",
|
|
34
|
+
"manifest": "sha256:e8403a0c371f155d9df80fc2b93a6619f4cf71a9241b081106049deab7a50ce3",
|
|
35
|
+
"config": "sha256:edf50438bfaebc6c55ad5101bad908ce45eafae8c432225d79504f6acefdcabe"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
package/assets/release-lock.json
CHANGED
|
@@ -671,9 +671,9 @@
|
|
|
671
671
|
"license": "MIT"
|
|
672
672
|
},
|
|
673
673
|
"node_modules/@fastify/fast-json-stringify-compiler": {
|
|
674
|
-
"version": "5.
|
|
675
|
-
"resolved": "https://registry.npmjs.org/@fastify/fast-json-stringify-compiler/-/fast-json-stringify-compiler-5.
|
|
676
|
-
"integrity": "sha512-
|
|
674
|
+
"version": "5.2.0",
|
|
675
|
+
"resolved": "https://registry.npmjs.org/@fastify/fast-json-stringify-compiler/-/fast-json-stringify-compiler-5.2.0.tgz",
|
|
676
|
+
"integrity": "sha512-LPTVA0w4oPITWHAvox9NgI1rDSrjUnjxX6QN5MCb9FY+HqvDsUmgLucbj9eQakqC8lYwO7UgkDPHEQLJNl9vtg==",
|
|
677
677
|
"funding": [
|
|
678
678
|
{
|
|
679
679
|
"type": "github",
|
|
@@ -686,7 +686,7 @@
|
|
|
686
686
|
],
|
|
687
687
|
"license": "MIT",
|
|
688
688
|
"dependencies": {
|
|
689
|
-
"fast-json-stringify": "^7.
|
|
689
|
+
"fast-json-stringify": "^7.3.0"
|
|
690
690
|
}
|
|
691
691
|
},
|
|
692
692
|
"node_modules/@fastify/forwarded": {
|
|
@@ -766,9 +766,9 @@
|
|
|
766
766
|
}
|
|
767
767
|
},
|
|
768
768
|
"node_modules/@hono/node-server": {
|
|
769
|
-
"version": "2.1.
|
|
770
|
-
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.
|
|
771
|
-
"integrity": "sha512-
|
|
769
|
+
"version": "2.1.8",
|
|
770
|
+
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.8.tgz",
|
|
771
|
+
"integrity": "sha512-jdf7FHh6A1lzjpHHQUgxsg2GeER2vMetnAOfeActzcoli6jamlK+NAwL6Dsr5Fl3BS3tYUQzCdtZjU8Qxv7bEA==",
|
|
772
772
|
"license": "MIT",
|
|
773
773
|
"engines": {
|
|
774
774
|
"node": ">=20"
|
package/assets/release.json
CHANGED
package/assets/sources.json
CHANGED
package/lib/prompt.mjs
CHANGED
|
@@ -132,11 +132,11 @@ function choose(write, fd, question, choices, defaults, multiple, {
|
|
|
132
132
|
drawn = true;
|
|
133
133
|
choices.forEach((choice, i) => {
|
|
134
134
|
const marker = multiple ? (selected[i] ? c.green('[x]') : '[ ]') : (i === current ? c.green('(●)') : '( )');
|
|
135
|
-
write(`\r\x1b[K ${i === current ? c.cyan('> ') : ' '}${marker} ${choice.label}\n`);
|
|
135
|
+
write(`\r\x1b[K ${i === current ? c.cyan('> ') : ' '}${marker} ${i === current ? c.bold(choice.label) : choice.label}\n`);
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
138
|
try {
|
|
139
|
-
write(`\x1b[?25l ${question}\n ${c.
|
|
139
|
+
write(`\x1b[?25l\n ${c.bold(question)}\n ${c.gray(`↑/↓ move${multiple ? ', Space toggle' : ''}, Enter confirm`)}\n`);
|
|
140
140
|
redraw();
|
|
141
141
|
for (;;) {
|
|
142
142
|
const byte = next();
|
|
@@ -112,7 +112,7 @@ process.stdout.write(JSON.stringify(output));
|
|
|
112
112
|
return { rows, root: roots[0] };
|
|
113
113
|
}
|
|
114
114
|
function retained({ rows, root }) {
|
|
115
|
-
effects.out?.(`Retained ${rows.length} existing ${rows.length === 1 ? 'identity' : 'identities'}
|
|
115
|
+
effects.out?.(`Retained ${rows.length} existing ${rows.length === 1 ? 'identity' : 'identities'}, including your Human identity.`);
|
|
116
116
|
return { name: root.name, cid: root.cid, created: false };
|
|
117
117
|
}
|
|
118
118
|
return {
|
|
@@ -123,7 +123,7 @@ process.stdout.write(JSON.stringify(output));
|
|
|
123
123
|
const prior = await identities(record);
|
|
124
124
|
if (prior.root) return retained(prior);
|
|
125
125
|
if (prior.rows.some(row => row.name === name)) throw new Error('Requested Human identity name already exists; no identity was changed');
|
|
126
|
-
effects.out?.(`Creating Human identity
|
|
126
|
+
effects.out?.(`Creating your Human identity; retaining ${prior.rows.length} existing identities.`);
|
|
127
127
|
try {
|
|
128
128
|
await identityCommand(record, 'create-root', name);
|
|
129
129
|
} catch (error) {
|
|
@@ -137,7 +137,7 @@ process.stdout.write(JSON.stringify(output));
|
|
|
137
137
|
const after = await identities(record);
|
|
138
138
|
if (!after.root) throw new Error('Human identity creation completed without a visible root');
|
|
139
139
|
if (after.root.name !== name) return retained(after);
|
|
140
|
-
effects.out?.(
|
|
140
|
+
effects.out?.('Your Human identity is ready.');
|
|
141
141
|
return { name: after.root.name, cid: after.root.cid, created: true };
|
|
142
142
|
},
|
|
143
143
|
/**
|
|
@@ -166,10 +166,10 @@ process.stdout.write(JSON.stringify(output));
|
|
|
166
166
|
};
|
|
167
167
|
if (prior.rows.some(row => row.name === name)) {
|
|
168
168
|
const row = await adopt(prior);
|
|
169
|
-
effects.out?.(
|
|
169
|
+
effects.out?.('Retained your Messenger identity.');
|
|
170
170
|
return { name, cid: row.cid, created: false };
|
|
171
171
|
}
|
|
172
|
-
effects.out?.(`Creating Messenger identity
|
|
172
|
+
effects.out?.(`Creating your Messenger identity; retaining ${prior.rows.length} existing identities.`);
|
|
173
173
|
let result;
|
|
174
174
|
try {
|
|
175
175
|
result = await identityCommand(record, 'create-role', name);
|
|
@@ -187,7 +187,7 @@ process.stdout.write(JSON.stringify(output));
|
|
|
187
187
|
if (result?.created?.hierarchy !== 'role' || result.created.underRoot !== prior.root.name || after.root?.cid !== prior.root.cid
|
|
188
188
|
|| !listed(row) || result.created.info?.cid !== row.cid || !under(result.current, row))
|
|
189
189
|
throw new Error('Messenger identity creation completed without a usable identity under the Human identity');
|
|
190
|
-
effects.out?.(
|
|
190
|
+
effects.out?.('Your Messenger identity is ready.');
|
|
191
191
|
return { name, cid: row.cid, created: true };
|
|
192
192
|
},
|
|
193
193
|
async serverEnsureHumanProfile(record, human) {
|
package/lib/setup-options.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { join, resolve } from 'node:path';
|
|
|
4
4
|
import { PRODUCTS, PLUGIN_ONLY, PLUGIN_ONLY_INTEGRATIONS } from './product.mjs';
|
|
5
5
|
import { MIGRATE_FROM_UNSUPPORTED, refuseOldLayout } from './plan.mjs';
|
|
6
6
|
import { InstallUsageError } from './target.mjs';
|
|
7
|
+
import { heading, info, warn } from './ui.mjs';
|
|
7
8
|
|
|
8
9
|
const scopes = ['all', 'server', 'client'];
|
|
9
10
|
const integrations = ['codex', 'claude-code', 'fleet'];
|
|
@@ -178,6 +179,92 @@ export function defaultHostname() {
|
|
|
178
179
|
return hostname().toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/^[^a-z0-9]+/, '').slice(0, 30) || 'workspace';
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
const personText = /[\\/\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/u;
|
|
183
|
+
const personPart = value => nonempty(value) && value.trim().length <= 100 && !personText.test(value.trim());
|
|
184
|
+
const profileChecks = {
|
|
185
|
+
localUsername: value => /^[a-z0-9][a-z0-9-]{0,29}$/.test(value),
|
|
186
|
+
name: personPart, surname: personPart,
|
|
187
|
+
hostname: value => value === '' || /^[a-z0-9][a-z0-9-]{0,29}$/.test(value.trim()),
|
|
188
|
+
};
|
|
189
|
+
// The same joined-name rule validateSetupOptions applies.
|
|
190
|
+
const personValid = (name, surname) => {
|
|
191
|
+
const person = `${name.trim()} ${surname.trim()}`;
|
|
192
|
+
return [...person].length <= 64 && person === person.normalize('NFC') && !personText.test(person);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// Valid supplied profile values are used silently; only missing or invalid ones are asked.
|
|
196
|
+
async function collectProfile(effects, options) {
|
|
197
|
+
const fields = [
|
|
198
|
+
['localUsername', 'Local username: ', () => (effects.username?.() ?? 'me').toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30)],
|
|
199
|
+
['name', 'Name: ', () => ''], ['surname', 'Surname: ', () => ''], ['hostname', 'Host / machine name (optional): ', () => ''],
|
|
200
|
+
];
|
|
201
|
+
const valid = key => typeof options[key] === 'string' && profileChecks[key](options[key]);
|
|
202
|
+
const joined = () => !valid('name') || !valid('surname') || personValid(options.name, options.surname);
|
|
203
|
+
fields.splice(0, fields.length, ...fields.filter(([key]) => !valid(key) || (!joined() && (key === 'name' || key === 'surname'))));
|
|
204
|
+
if (!fields.length) return;
|
|
205
|
+
const invalid = fields.filter(([key]) => options[key] !== undefined).map(([key]) => key);
|
|
206
|
+
effects.out(invalid.length ? warn(`Not valid: ${invalid.map(key => ({ localUsername: 'Local username', name: 'Name', surname: 'Surname', hostname: 'Host name' })[key]).join(', ')}. Please enter again.`) : info('Your Ours identity: Name and Surname appear in Messenger.'));
|
|
207
|
+
for (const [key, question, fallback] of fields) {
|
|
208
|
+
for (let attempt = 1; ; attempt++) {
|
|
209
|
+
const value = await effects.askLine(question, fallback());
|
|
210
|
+
if (profileChecks[key](value) && (key !== 'surname' || personValid(options.name, value))) { options[key] = value; break; }
|
|
211
|
+
if (attempt === 3) throw new Error(`Invalid ${key}; nothing was changed`);
|
|
212
|
+
effects.out(warn(key === 'localUsername' || key === 'hostname' ? 'Use 1–30 lowercase letters, digits or hyphens.'
|
|
213
|
+
: 'Use up to 64 characters for Name and Surname together, without slashes or control characters.'));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
async function integrationDefaults(effects, existing, fleetRequired) {
|
|
219
|
+
const detected = typeof effects.detectHarnesses === 'function' ? await effects.detectHarnesses() : [];
|
|
220
|
+
// A retained full setup keeps the apps it already connected.
|
|
221
|
+
let saved = null;
|
|
222
|
+
try { saved = existing ? effects.readManagedClientProfile?.() : null; } catch { saved = null; }
|
|
223
|
+
const keep = saved && saved.expectedInstanceId === existing.instanceId ? saved.installer?.integrations : undefined;
|
|
224
|
+
const choices = [{ value: 'codex', label: 'Codex' }, { value: 'claude-code', label: 'Claude Code' }, ...(fleetRequired ? [] : [{ value: 'fleet', label: 'Fleet — persistent agents' }])];
|
|
225
|
+
const selected = keep ?? integrations.filter(name => name === 'fleet' || detected.some(item => item.name === name && item.status === 'ok'));
|
|
226
|
+
return { choices, selected };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** The recommended full local setup: a retained installation keeps its folder, runtime and apps; a fresh one uses the defaults. */
|
|
230
|
+
async function recommendedSetup(effects, options, fleetRequired) {
|
|
231
|
+
const stateDir = expandPaths({ stateDir: options.stateDir ?? join(effects.home, '.ours-install') }, effects.home).stateDir;
|
|
232
|
+
const existing = refuseOldLayout(effects.readJson(join(stateDir, 'installation.json')), stateDir, effects.readJson);
|
|
233
|
+
if (existing?.mode === 'packages')
|
|
234
|
+
throw new Error('This installation runs natively, which supports the server only. Choose the server-only setup to maintain it (ours-install server); local clients need an installation that runs in Docker or Podman. Nothing was changed.');
|
|
235
|
+
const engine = existing ? (existing.containerEngine === 'podman' ? 'Podman' : 'Docker') : options.containerEngine === 'podman' ? 'Podman' : 'Docker';
|
|
236
|
+
effects.out(heading(existing ? 'Update Ours on this computer' : 'Install Ours on this computer'));
|
|
237
|
+
effects.out(info(existing ? `Recommended: update your existing Ours in ${stateDir} (${engine}), keeping its identities, data and apps.`
|
|
238
|
+
: `Recommended: the server, Fleet and your detected agent apps, in ${stateDir}, running in ${engine}.`));
|
|
239
|
+
const choice = await effects.select('How would you like to continue?', [
|
|
240
|
+
{ value: 'recommended', label: existing ? 'Update with recommended setup' : 'Install recommended setup' },
|
|
241
|
+
{ value: 'customize', label: 'Customize' },
|
|
242
|
+
], 'recommended');
|
|
243
|
+
if (choice !== 'recommended') return null;
|
|
244
|
+
options.stateDir = stateDir;
|
|
245
|
+
options.operation ??= existing ? 'update' : 'install';
|
|
246
|
+
options.mode ??= 'docker';
|
|
247
|
+
if (existing) {
|
|
248
|
+
options.mode = existing.mode;
|
|
249
|
+
if (existing.containerEngine) options.containerEngine = existing.containerEngine;
|
|
250
|
+
}
|
|
251
|
+
const human = ['localUsername', 'name', 'surname'].some(key => options[key] !== undefined);
|
|
252
|
+
// Supplied profile inputs never rename a retained root.
|
|
253
|
+
if (existing?.messengerIdentity && !human) options.identityName ??= existing.messengerIdentity;
|
|
254
|
+
else if (human || options.identityName === undefined) await collectProfile(effects, options);
|
|
255
|
+
for (const [key, fallback] of Object.entries(defaults)) options[key] ??= existing?.[key] ?? fallback;
|
|
256
|
+
if (options.integrations === undefined) {
|
|
257
|
+
const { selected } = await integrationDefaults(effects, existing, fleetRequired);
|
|
258
|
+
options.integrations = fleetRequired || !existing ? [...selected.filter(name => name !== 'fleet'), 'fleet'] : selected;
|
|
259
|
+
}
|
|
260
|
+
if (options.operation === 'update') {
|
|
261
|
+
effects.out(info('The update keeps identities and messages and makes a recovery backup first.'));
|
|
262
|
+
options.compatible ??= await effects.ask('Update now and keep a recovery backup?', true);
|
|
263
|
+
if (!options.compatible) throw new Error('Update cancelled; nothing was changed');
|
|
264
|
+
}
|
|
265
|
+
return validateSetupOptions(expandPaths(options, effects.home), { interactive: true });
|
|
266
|
+
}
|
|
267
|
+
|
|
181
268
|
export async function collectSetupOptions(effects, presets = {}) {
|
|
182
269
|
if (effects.interactive !== true) throw new Error('Interactive setup requires a TTY; provide the complete CLI options instead');
|
|
183
270
|
const options = { ...presets, interactive: true, explicitPorts: presets.explicitPorts ?? [] };
|
|
@@ -186,99 +273,100 @@ export async function collectSetupOptions(effects, presets = {}) {
|
|
|
186
273
|
{ value: 'server', label: 'Server only' },
|
|
187
274
|
{ value: 'client', label: 'Connect this computer to an existing server' },
|
|
188
275
|
];
|
|
189
|
-
|
|
190
|
-
|
|
276
|
+
if (options.scope === undefined) {
|
|
277
|
+
effects.out(info('Everything runs the server here and connects your apps; client-only uses a server you already have.'));
|
|
278
|
+
options.scope = await effects.select('What would you like to set up?', scopeChoices, 'all');
|
|
279
|
+
}
|
|
191
280
|
if (!scopes.includes(options.scope)) throw new Error('Scope must be all, server, or client');
|
|
281
|
+
// A full local setup started for the complete workspace (--disable-fleet-agents-setup) always includes Fleet.
|
|
282
|
+
const fleetRequired = options.scope === 'all' && options.disableFleetAgentsSetup === true;
|
|
283
|
+
// A preset full local setup (the App command) starts with one choice: the recommended setup or Customize.
|
|
284
|
+
if (presets.scope === 'all') {
|
|
285
|
+
const recommended = await recommendedSetup(effects, options, fleetRequired);
|
|
286
|
+
if (recommended) return recommended;
|
|
287
|
+
}
|
|
192
288
|
let existing;
|
|
193
289
|
if (options.scope !== 'client') {
|
|
194
290
|
const recommendedRoot = join(effects.home, '.ours-install');
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
291
|
+
if (!options.stateDir) {
|
|
292
|
+
effects.out(info('Ours keeps its programs and data (identities, messages) in one folder.'));
|
|
293
|
+
const location = await effects.select('Where should server programs and data be stored?', [
|
|
294
|
+
{ value: 'recommended', label: `${recommendedRoot} (recommended)` },
|
|
295
|
+
{ value: 'custom', label: 'Choose another folder' },
|
|
296
|
+
], 'recommended');
|
|
297
|
+
options.stateDir = location === 'recommended' ? recommendedRoot : await effects.askLine('Folder for server programs and data: ', recommendedRoot);
|
|
298
|
+
}
|
|
201
299
|
options.stateDir = expandPaths({ stateDir: options.stateDir }, effects.home).stateDir;
|
|
202
300
|
existing = refuseOldLayout(effects.readJson(join(options.stateDir, 'installation.json')), options.stateDir, effects.readJson);
|
|
203
301
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
302
|
+
if (options.operation === undefined) {
|
|
303
|
+
if (existing || options.scope === 'client') {
|
|
304
|
+
effects.out(info(existing ? `Ours is already installed in ${options.stateDir}. Update keeps your identities and data; repair reruns setup.`
|
|
305
|
+
: 'Install connects your apps; update refreshes them and keeps the server connection.'));
|
|
306
|
+
options.operation = await effects.select('What should happen?', [
|
|
307
|
+
{ value: 'install', label: existing ? 'Repair this installation' : 'Install and configure' },
|
|
308
|
+
{ value: 'update', label: existing ? 'Update (recommended)' : 'Update an existing installation' },
|
|
309
|
+
], existing ? 'update' : 'install');
|
|
310
|
+
} else options.operation = 'install';
|
|
311
|
+
}
|
|
212
312
|
if (options.scope !== 'client') {
|
|
213
|
-
const recommendation = recommendedMode({ ...effects.platform, arch: effects.platform?.arch ?? process.arch });
|
|
214
313
|
// Native runs the server only: local clients need the container gateway. A retained
|
|
215
314
|
// native installation keeps its mode, so a full setup of it cannot finish.
|
|
216
315
|
if (options.scope === 'all' && existing?.mode === 'packages')
|
|
217
316
|
throw new Error('This installation runs natively, which supports the server only. Choose the server-only setup to maintain it (ours-install server); local clients need an installation that runs in Docker or Podman. Nothing was changed.');
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
317
|
+
// A retained installation keeps its runtime, so there is nothing to choose.
|
|
318
|
+
const retained = existing ? (existing.mode === 'docker' && existing.containerEngine === 'podman' ? 'podman' : existing.mode) : undefined;
|
|
319
|
+
let runtime = options.mode ?? retained;
|
|
320
|
+
if (runtime === undefined) {
|
|
321
|
+
const nativeOffered = options.scope === 'server';
|
|
322
|
+
effects.out(info(nativeOffered ? 'Native runs directly on this computer; Docker and Podman run in containers and must be installed and running.'
|
|
323
|
+
: 'Ours runs in containers; Docker or Podman must be installed and running.'));
|
|
324
|
+
runtime = await effects.select('How should the server run?', [
|
|
325
|
+
{ value: 'docker', label: 'Docker (recommended)' }, { value: 'podman', label: 'Podman' },
|
|
326
|
+
...(nativeOffered ? [{ value: 'packages', label: 'Native packages' }] : []),
|
|
327
|
+
], recommendedMode({ ...effects.platform, arch: effects.platform?.arch ?? process.arch }).mode);
|
|
328
|
+
}
|
|
225
329
|
options.mode = runtime === 'podman' ? 'docker' : runtime;
|
|
226
330
|
if (runtime === 'podman') options.containerEngine = 'podman';
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
} else if (options.identityName === undefined || options.localUsername !== undefined) {
|
|
232
|
-
effects.out('Choose a local username (no global uniqueness check). Name and Surname appear in Messenger; the optional host name identifies this workspace.');
|
|
233
|
-
options.localUsername ??= await effects.askLine('Local username: ', (effects.username?.() ?? 'me').toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30));
|
|
234
|
-
options.name ??= await effects.askLine('Name: ', '');
|
|
235
|
-
options.surname ??= await effects.askLine('Surname: ', '');
|
|
236
|
-
options.hostname ??= await effects.askLine('Host / machine name (optional): ', '');
|
|
237
|
-
}
|
|
238
|
-
if (['localUsername', 'name', 'surname'].some(key => options[key] !== undefined)) {
|
|
239
|
-
// Partial profile presets still collect missing fields on the retained
|
|
240
|
-
// path; these inputs never replace its authoritative root.
|
|
241
|
-
effects.out('Name and Surname initialize a missing Messenger profile; an existing profile is retained.');
|
|
242
|
-
options.localUsername ??= await effects.askLine('Local username: ', (effects.username?.() ?? 'me').toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30));
|
|
243
|
-
options.name ??= await effects.askLine('Name: ', '');
|
|
244
|
-
options.surname ??= await effects.askLine('Surname: ', '');
|
|
245
|
-
options.hostname ??= await effects.askLine('Host / machine name (optional): ', '');
|
|
246
|
-
}
|
|
331
|
+
const human = ['localUsername', 'name', 'surname'].some(key => options[key] !== undefined);
|
|
332
|
+
// Supplied profile inputs never rename a retained root.
|
|
333
|
+
if (existing?.messengerIdentity && !human) options.identityName ??= existing.messengerIdentity;
|
|
334
|
+
else if (human || options.identityName === undefined) await collectProfile(effects, options);
|
|
247
335
|
for (const [key, fallback] of Object.entries(defaults)) options[key] ??= existing?.[key] ?? fallback;
|
|
248
336
|
if (options.operation === 'update') {
|
|
249
|
-
effects.out('The update
|
|
337
|
+
effects.out(info('The update keeps identities and messages and makes a recovery backup first; compatibility with older data is not guaranteed.'));
|
|
250
338
|
options.compatible ??= await effects.ask('Proceed with this update and keep a recovery backup?', false);
|
|
251
339
|
}
|
|
252
340
|
} else {
|
|
253
341
|
const savedProfile = join(effects.home, '.ours-client', 'profile.json');
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
342
|
+
if (!options.config) {
|
|
343
|
+
effects.out(info('A connection profile names the server and its private access credential.'));
|
|
344
|
+
const connection = await effects.select('Which server connection should this computer use?', [
|
|
345
|
+
{ value: 'saved', label: 'Use the saved server connection' }, { value: 'file', label: 'Choose a connection profile file' },
|
|
346
|
+
], effects.readJson(savedProfile) ? 'saved' : 'file');
|
|
347
|
+
options.config = connection === 'saved' ? savedProfile : await effects.askLine('Connection profile file: ', savedProfile);
|
|
348
|
+
}
|
|
259
349
|
}
|
|
260
|
-
if (options.scope !== 'server') {
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
effects.
|
|
264
|
-
options.integrations
|
|
265
|
-
{ value: 'codex', label: 'Codex' }, { value: 'claude-code', label: 'Claude Code' }, { value: 'fleet', label: 'Fleet — persistent agents' },
|
|
266
|
-
], selected);
|
|
350
|
+
if (options.scope !== 'server' && options.integrations === undefined) {
|
|
351
|
+
const { choices, selected } = await integrationDefaults(effects, existing, fleetRequired);
|
|
352
|
+
effects.out(info(fleetRequired ? 'Fleet is included. Choose agent apps to connect.' : 'Choose apps to connect. Fleet agents stay stopped until you start them.'));
|
|
353
|
+
const chosen = await effects.multiselect('Which integrations should be configured?', choices, selected.filter(name => choices.some(choice => choice.value === name)));
|
|
354
|
+
options.integrations = fleetRequired ? [...chosen.filter(name => name !== 'fleet'), 'fleet'] : chosen;
|
|
267
355
|
if (options.integrations.includes('fleet') && !options.disableFleetAgentsSetup && !options.fleetSettingsPath) {
|
|
268
|
-
effects.out('Fleet needs model and agent settings
|
|
356
|
+
effects.out(info('Fleet needs model and agent settings; its roles will not start automatically.'));
|
|
269
357
|
const fleetMode = await effects.select('How should Fleet be configured?', [
|
|
270
358
|
{ value: 'wizard', label: 'Configure interactively with Fleet' }, { value: 'file', label: 'Use a prepared settings file' },
|
|
271
359
|
], 'wizard');
|
|
272
360
|
if (fleetMode === 'file') options.fleetSettingsPath = await effects.askLine('Fleet settings file: ', '');
|
|
273
361
|
}
|
|
274
362
|
}
|
|
275
|
-
effects.out('Recommended settings use the standard
|
|
363
|
+
effects.out(info('Recommended settings use the standard ports and this installer’s release.'));
|
|
276
364
|
const advanced = await effects.select('Installation settings', [
|
|
277
365
|
{ value: 'recommended', label: 'Use recommended settings' }, { value: 'custom', label: 'Customize' },
|
|
278
366
|
], 'recommended');
|
|
279
367
|
if (advanced === 'custom') {
|
|
280
368
|
if (options.scope !== 'client') {
|
|
281
|
-
effects.out('
|
|
369
|
+
effects.out(info('Use three different available ports; an existing installation keeps its recorded ports.'));
|
|
282
370
|
for (const key of Object.keys(defaults)) {
|
|
283
371
|
const label = { port: 'Daemon', coworkPort: 'Cowork', messengerPort: 'Messenger' }[key];
|
|
284
372
|
const value = await effects.askLine(`${label} port: `, String(options[key]));
|
|
@@ -286,14 +374,13 @@ export async function collectSetupOptions(effects, presets = {}) {
|
|
|
286
374
|
options[key] = Number(value); options.explicitPorts.push(key);
|
|
287
375
|
}
|
|
288
376
|
}
|
|
289
|
-
effects.out('A source override replaces the packaged release
|
|
377
|
+
effects.out(info('A source override replaces the packaged release; leave it empty unless you are developing Ours.'));
|
|
290
378
|
const sources = await effects.askLine('Source policy override file (optional): ', '');
|
|
291
379
|
if (sources.trim()) options.sources = sources;
|
|
292
380
|
}
|
|
293
381
|
const validated = validateSetupOptions(expandPaths(options, effects.home), { interactive: true });
|
|
294
382
|
const scopeLabel = scopeChoices.find(choice => choice.value === validated.scope).label;
|
|
295
|
-
effects.out(`Setup: ${scopeLabel}; ${validated.operation}${validated.mode ? ` using ${validated.mode === 'packages' ? 'native packages' : 'Docker'} in ${validated.stateDir}` : ` from ${validated.config}`}; integrations: ${validated.integrations?.join(', ') || 'none'}.`);
|
|
296
|
-
effects.
|
|
297
|
-
if (!await effects.ask('Continue with this setup?', false)) throw new Error('Setup cancelled; nothing was changed');
|
|
383
|
+
effects.out(info(`Setup: ${scopeLabel}; ${validated.operation}${validated.mode ? ` using ${validated.mode === 'packages' ? 'native packages' : validated.containerEngine === 'podman' ? 'Podman' : 'Docker'} in ${validated.stateDir}` : ` from ${validated.config}`}; integrations: ${validated.integrations?.join(', ') || 'none'}. Nothing changes until you continue.`));
|
|
384
|
+
if (!await effects.ask('Continue with this setup?', true)) throw new Error('Setup cancelled; nothing was changed');
|
|
298
385
|
return validated;
|
|
299
386
|
}
|
package/lib/setup.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { validateGatewayClientProfile } from './target.mjs';
|
|
2
2
|
import { gatewayAddress } from './gateway.mjs';
|
|
3
|
-
import { join } from 'node:path';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
4
|
import { parseSetupArgs, collectSetupOptions, validateSetupOptions } from './setup-options.mjs';
|
|
5
5
|
import { parseNetworkArgs, validateHostProfile, InstallUsageError } from './target.mjs';
|
|
6
|
-
import { clientPackageNames, validateInstallation, refuseOldLayout } from './plan.mjs';
|
|
6
|
+
import { clientPackageNames, validateInstallation, refuseOldLayout, installationPaths, unitNameForStateDir, launchdLabelForStateDir } from './plan.mjs';
|
|
7
7
|
import { runServerCommand, runClientCommand } from './orchestrate.mjs';
|
|
8
|
-
import { banner, heading, info, ok, warn, progress } from './ui.mjs';
|
|
8
|
+
import { banner, c, heading, info, ok, warn, progress } from './ui.mjs';
|
|
9
9
|
import { isCancel } from './prompt.mjs';
|
|
10
10
|
import { USAGE } from './usage.mjs';
|
|
11
11
|
import { validateIdentityName } from './server-onboarding.mjs';
|
|
12
12
|
import { validateFleetSettings } from './fleet-settings.mjs';
|
|
13
13
|
import { installerFailure } from './diagnostics.mjs';
|
|
14
14
|
import { productOf, isPluginOnly, serverRole, PRODUCT_LABELS, PLUGIN_ONLY_INTEGRATIONS } from './product.mjs';
|
|
15
|
-
import { collectWelcome, customHarnessGuidance, KEEPS_YOUR_SETUP } from './welcome.mjs';
|
|
15
|
+
import { collectWelcome, customHarnessGuidance, findInstallations, KEEPS_YOUR_SETUP } from './welcome.mjs';
|
|
16
16
|
import { runRemoval } from './removal.mjs';
|
|
17
17
|
|
|
18
18
|
const maintenance = new Set(['status', 'start', 'stop', 'restart', 'uninstall', 'rebuild', 'gateway-enable', 'access-issue', 'access-replace', 'backup', 'restore', 'reset']);
|
|
@@ -152,9 +152,12 @@ export async function executeSetupPlan(plan, effects, { server = runServerComman
|
|
|
152
152
|
preset: true, nonInteractive: !plan.interactive }, effects);
|
|
153
153
|
if (result !== 0) return result;
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
else if (plan.disableFleetAgentsSetup && plan.integrations?.includes('fleet')) effects.out(info('Fleet is installed. Run ours-fleet setup-tunnel with the expiring one-use payload from the App command; a compatible Fleet prints the QR and connection code automatically. Configure agents and models in the App after linking.'));
|
|
155
|
+
effects.out(heading('Your installation summary'));
|
|
157
156
|
effects.out(ok(`Requested ${plan.operation} completed. Existing identities were retained.`));
|
|
157
|
+
if (plan.scope !== 'client') effects.out(info(`Ours: ${plan.stateDir}, running ${plan.mode === 'packages' ? 'natively' : plan.containerEngine === 'podman' ? 'in Podman' : 'in Docker'}`));
|
|
158
|
+
if (plan.scope !== 'server') effects.out(info(`Connected: ${plan.integrations.map(name => ({ codex: 'Codex', 'claude-code': 'Claude Code', fleet: 'Fleet' })[name]).join(', ') || 'none'}`));
|
|
159
|
+
if (plan.retainFleetConfiguration && plan.integrations?.includes('fleet')) effects.out(info('Fleet was updated; your existing Fleet agents and their configuration were kept. Restart running agents when convenient: ours-fleet restart'));
|
|
160
|
+
else if (plan.disableFleetAgentsSetup && plan.integrations?.includes('fleet')) effects.out(`\n ${c.bold('Next:')} return to the Ours App in your browser and continue to connect this workspace. Agents and models are configured there.\n`);
|
|
158
161
|
if (plan.integrations?.includes('fleet') && !plan.disableFleetAgentsSetup) effects.out(info('Fleet is configured but stopped. Review its settings, then run ours-fleet doctor, ours-fleet config and ours-fleet up.'));
|
|
159
162
|
if (isPluginOnly(plan.product) && plan.scope === 'all') {
|
|
160
163
|
effects.out(info('Collaboration tools are ready. Restart Claude Code and start a new Codex session so they load the Ours tools; then ask your agent to create its Ours identity.'));
|
|
@@ -180,6 +183,52 @@ function preparedClaudeMarketplace(effects) {
|
|
|
180
183
|
return null;
|
|
181
184
|
}
|
|
182
185
|
|
|
186
|
+
/** Partial presets without --state-dir reuse the one installation already here, as the welcome screen does. */
|
|
187
|
+
async function retainedRoot(presets, effects) {
|
|
188
|
+
if (!['all', 'server'].includes(presets.scope) || presets.stateDir !== undefined) return {};
|
|
189
|
+
const found = findInstallations(effects);
|
|
190
|
+
const usable = found.filter(item => !item.invalid);
|
|
191
|
+
if (usable.length === 1) return { stateDir: usable[0].root };
|
|
192
|
+
if (usable.length > 1) throw new InstallUsageError(`Several Ours installations are on this computer (${usable.map(item => item.root).join(', ')}). Choose one with --state-dir; nothing was changed.`);
|
|
193
|
+
if (found.length) throw new InstallUsageError(`An Ours installation here could not be read (${found.map(item => item.root).join(', ')}). Run ours-install without options to review it; nothing was changed.`);
|
|
194
|
+
return outsideRoot(effects);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* An installation in a folder outside ~/.ours*, found from what it runs: Compose labels name its
|
|
199
|
+
* runtime folder (<root>/runtime), and every native installation uses the same daemon service name.
|
|
200
|
+
*/
|
|
201
|
+
async function outsideRoot(effects) {
|
|
202
|
+
const daemon = installationPaths({ root: effects.home }).daemon;
|
|
203
|
+
const service = effects.platform?.platform === 'darwin'
|
|
204
|
+
? join(effects.home, 'Library/LaunchAgents', `${launchdLabelForStateDir(daemon).label}.plist`)
|
|
205
|
+
: join(effects.home, '.config/systemd/user', unitNameForStateDir(daemon).unit);
|
|
206
|
+
if (effects.exists?.(service)) throw new InstallUsageError(`An Ours service from another folder is set up for your user (${service}). Re-run with --state-dir <its folder> to update it; nothing was changed.`);
|
|
207
|
+
const roots = new Set(), unknown = new Set();
|
|
208
|
+
for (const engine of ['docker', 'podman']) {
|
|
209
|
+
let listed;
|
|
210
|
+
try { listed = await effects.run(engine, ['ps', '-a', '--format', '{{.Label "com.docker.compose.project"}}\t{{.Label "com.docker.compose.project.working_dir"}}']); }
|
|
211
|
+
catch (error) {
|
|
212
|
+
if (error?.code === 'ENOENT') continue;
|
|
213
|
+
// An installed engine that cannot be inspected could hide an installation: never assume there is none.
|
|
214
|
+
throw new InstallUsageError(`Could not check ${engine === 'docker' ? 'Docker' : 'Podman'} for an existing Ours installation. Start it (or fix access for your user) and retry, or re-run with --state-dir <folder>; nothing was changed.`);
|
|
215
|
+
}
|
|
216
|
+
for (const line of listed.stdout.split('\n')) {
|
|
217
|
+
const [project = '', workDir = ''] = line.trim().split('\t');
|
|
218
|
+
// Only Compose-created containers name a project folder; images inherit the project label alone.
|
|
219
|
+
if (!/^ours-/.test(project) || !workDir) continue;
|
|
220
|
+
const root = dirname(workDir);
|
|
221
|
+
let record = null;
|
|
222
|
+
try { record = validateInstallation(effects.readJson(join(root, 'installation.json')), root); } catch { record = null; }
|
|
223
|
+
if (record?.project === project && record.workDir === workDir) roots.add(root);
|
|
224
|
+
else unknown.add(project);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (unknown.size) throw new InstallUsageError(`Ours containers without a readable installation are on this computer (${[...unknown].join(', ')}). Re-run with --state-dir <its folder> to update it; nothing was changed.`);
|
|
228
|
+
if (roots.size > 1) throw new InstallUsageError(`Several Ours installations are on this computer (${[...roots].join(', ')}). Choose one with --state-dir; nothing was changed.`);
|
|
229
|
+
return roots.size ? { stateDir: [...roots][0] } : {};
|
|
230
|
+
}
|
|
231
|
+
|
|
183
232
|
/** The sole executable entry: manual answers and CLI presets share one plan/executor. */
|
|
184
233
|
export async function runSetup(argv, effects) {
|
|
185
234
|
try {
|
|
@@ -202,8 +251,8 @@ export async function runSetup(argv, effects) {
|
|
|
202
251
|
const presets = parseSetupArgs(argv, { home: effects.home, validate: false });
|
|
203
252
|
try { options = validateSetupOptions(presets, { interactive: false }); }
|
|
204
253
|
catch (error) {
|
|
205
|
-
if (!effects.interactive || effects.env?.OURS_ASSUME_YES || !/^Missing (required setup options|human profile option)
|
|
206
|
-
options = await collectSetupOptions(effects, presets);
|
|
254
|
+
if (!effects.interactive || effects.env?.OURS_ASSUME_YES || !/^(Missing (required setup options|human profile option):|Local username must|Hostname must|(name|surname) must contain|Name and Surname together)/.test(error.message)) throw error;
|
|
255
|
+
options = await collectSetupOptions(effects, { ...presets, ...await retainedRoot(presets, effects) });
|
|
207
256
|
}
|
|
208
257
|
}
|
|
209
258
|
const plan = { ...await prepareSetupPlan(options, effects), ...extra };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/install",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
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",
|