@ours.network/install 1.2.1-nightly.9 → 2.0.0
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/GATEWAY_SETUP.md +178 -0
- package/README.md +554 -9
- package/ROOTLESS_PODMAN_VALIDATION.md +210 -0
- package/assets/Dockerfile +15 -12
- package/assets/Dockerfile.gateway +5 -0
- package/assets/docker-compose.yaml +8 -1
- package/assets/fleet-settings.example.json +48 -0
- package/assets/gateway-entrypoint.sh +37 -0
- package/assets/release-lock.json +1234 -4529
- package/assets/release.json +32 -24
- package/assets/scripts/build/build-common.mjs +10 -1
- package/assets/scripts/build/build-sdk.mjs +6 -1
- package/assets/scripts/maintenance/build-context.mjs +1 -1
- package/assets/scripts/maintenance/daemon-owner.mjs +15 -0
- package/assets/scripts/maintenance/docker-layout-conversion.mjs +22 -7
- package/assets/scripts/maintenance/recover-notifications.mjs +36 -0
- package/assets/scripts/maintenance/release-graph.mjs +1 -1
- package/assets/scripts/maintenance/state-operation.mjs +76 -8
- package/assets/scripts/runtime/README.md +7 -0
- package/assets/scripts/runtime/client-setup.mjs +105 -20
- package/assets/scripts/runtime/daemon-client-prefix.mjs +115 -0
- package/assets/scripts/runtime/dependency-ready.mjs +13 -0
- package/assets/scripts/runtime/diagnostics.mjs +72 -0
- package/assets/scripts/runtime/entrypoint.sh +5 -1
- package/assets/scripts/runtime/health-messenger.mjs +7 -6
- package/assets/scripts/runtime/healthcheck.mjs +49 -15
- package/assets/scripts/runtime/notifications-gateway.mjs +90 -0
- package/assets/scripts/runtime/recover.mjs +202 -0
- package/assets/scripts/runtime/start-cowork.sh +5 -0
- package/assets/scripts/runtime/start-messenger.sh +29 -4
- package/assets/scripts/runtime/start-telegram.sh +5 -0
- package/assets/scripts/runtime/supervise.mjs +35 -0
- package/assets/sources.json +49 -33
- package/install.mjs +7 -2
- package/lib/boot-readiness.mjs +96 -0
- package/lib/build-transition.mjs +16 -0
- package/lib/client-cli.mjs +12 -2
- package/lib/container-engine.mjs +127 -0
- package/lib/diagnostics.mjs +1 -0
- package/lib/docker-conversion-runtime.mjs +7 -4
- package/lib/docker-layout-installation.mjs +2 -1
- package/lib/docker-recovery.mjs +60 -0
- package/lib/docker-runtime-repair.mjs +49 -14
- package/lib/effects.mjs +462 -136
- package/lib/gateway-transition.mjs +87 -0
- package/lib/gateway.mjs +227 -0
- package/lib/legacy-migration.mjs +13 -2
- package/lib/orchestrate-uninstall.mjs +23 -6
- package/lib/orchestrate.mjs +279 -36
- package/lib/ownership.mjs +63 -0
- package/lib/plan.mjs +37 -11
- package/lib/podman-preflight.mjs +40 -0
- package/lib/product.mjs +69 -0
- package/lib/removal-plan.mjs +437 -0
- package/lib/removal.mjs +749 -0
- package/lib/server-onboarding.mjs +182 -16
- package/lib/server-ports.mjs +17 -0
- package/lib/setup-options.mjs +119 -29
- package/lib/setup.mjs +86 -15
- package/lib/target.mjs +24 -8
- package/lib/uninstall.mjs +2 -2
- package/lib/usage.mjs +35 -9
- package/lib/welcome.mjs +219 -0
- package/lib/workspace-setup.mjs +154 -0
- package/package.json +4 -2
package/lib/setup.mjs
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
import { validateGatewayClientProfile } from './target.mjs';
|
|
2
|
+
import { gatewayAddress } from './gateway.mjs';
|
|
1
3
|
import { inspectLegacyMigration } from './legacy-migration.mjs';
|
|
2
4
|
import { join } from 'node:path';
|
|
3
5
|
import { parseSetupArgs, collectSetupOptions, validateSetupOptions } from './setup-options.mjs';
|
|
4
6
|
import { parseNetworkArgs, validateHostProfile, InstallUsageError } from './target.mjs';
|
|
5
|
-
import { validateInstallation } from './plan.mjs';
|
|
7
|
+
import { clientPackageNames, validateInstallation } from './plan.mjs';
|
|
6
8
|
import { runServerCommand, runClientCommand } from './orchestrate.mjs';
|
|
7
9
|
import { banner, heading, info, ok, warn, progress } from './ui.mjs';
|
|
8
10
|
import { isCancel } from './prompt.mjs';
|
|
9
11
|
import { USAGE } from './usage.mjs';
|
|
10
12
|
import { validateIdentityName } from './server-onboarding.mjs';
|
|
11
13
|
import { validateFleetSettings } from './fleet-settings.mjs';
|
|
14
|
+
import { installerFailure } from './diagnostics.mjs';
|
|
15
|
+
import { productOf, isPluginOnly, serverRole, PRODUCT_LABELS, PLUGIN_ONLY_INTEGRATIONS } from './product.mjs';
|
|
16
|
+
import { collectWelcome, customHarnessGuidance, KEEPS_YOUR_SETUP } from './welcome.mjs';
|
|
17
|
+
import { runRemoval } from './removal.mjs';
|
|
12
18
|
|
|
13
|
-
const maintenance = new Set(['status', 'start', 'stop', 'restart', 'rebuild', 'access-issue', 'access-replace', 'backup', 'restore', 'reset']);
|
|
14
|
-
const clientPackages = integrations => [...new Set(['sdk', 'cli', ...integrations])];
|
|
19
|
+
const maintenance = new Set(['status', 'start', 'stop', 'restart', 'uninstall', 'rebuild', 'gateway-enable', 'access-issue', 'access-replace', 'backup', 'restore', 'reset']);
|
|
15
20
|
|
|
16
21
|
export function completeReleasePolicy(retained, supplied) {
|
|
17
22
|
if (retained?.release) {
|
|
@@ -32,6 +37,8 @@ export async function prepareSetupPlan(options, effects) {
|
|
|
32
37
|
options = validateSetupOptions(options, { interactive: options.interactive });
|
|
33
38
|
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
39
|
const plan = { ...options };
|
|
40
|
+
if (options.scope === 'all' && options.mode === 'packages' && options.integrations?.length)
|
|
41
|
+
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
42
|
if (options.scope !== 'server') {
|
|
36
43
|
for (const name of ['OURS_API_TOKEN', 'OURS_PORT', 'OURS_STATE_DIR', 'OURS_DAEMON_ID']) {
|
|
37
44
|
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.`);
|
|
@@ -54,6 +61,11 @@ export async function prepareSetupPlan(options, effects) {
|
|
|
54
61
|
const value = effects.readJson(join(options.stateDir, 'installation.json'));
|
|
55
62
|
if (value) {
|
|
56
63
|
plan.existing = validateInstallation(value, options.stateDir);
|
|
64
|
+
// The kind of installation is retained exactly; it is never widened or narrowed implicitly.
|
|
65
|
+
if (options.product !== undefined && options.product !== productOf(plan.existing))
|
|
66
|
+
throw new InstallUsageError(`This folder contains ${PRODUCT_LABELS[productOf(plan.existing)].toLowerCase()}. It is kept as it is; nothing was changed. Use a separate empty folder for the other kind of installation, or remove this one first.`);
|
|
67
|
+
plan.product = productOf(plan.existing);
|
|
68
|
+
if (options.containerEngine && options.containerEngine !== (plan.existing.containerEngine ?? 'docker')) throw new InstallUsageError('Container engine conflicts with retained installation');
|
|
57
69
|
if (options.mode !== plan.existing.mode) throw new InstallUsageError('The selected mode conflicts with the retained installation; choose its existing mode or a separate empty directory');
|
|
58
70
|
for (const key of ['port', 'coworkPort', 'messengerPort']) {
|
|
59
71
|
if (options.explicitPorts?.includes(key) && options[key] !== plan.existing[key]) throw new InstallUsageError(`${key} conflicts with the retained installation`);
|
|
@@ -66,18 +78,23 @@ export async function prepareSetupPlan(options, effects) {
|
|
|
66
78
|
} else if (options.operation === 'update') {
|
|
67
79
|
throw new InstallUsageError('Update requires an existing installation.json; choose install for a new installation');
|
|
68
80
|
}
|
|
81
|
+
plan.product ??= options.product ?? 'workspace';
|
|
82
|
+
if (isPluginOnly(plan.product) && plan.integrations?.some(name => !PLUGIN_ONLY_INTEGRATIONS.includes(name)))
|
|
83
|
+
throw new InstallUsageError('Collaboration tools connect Claude Code and/or Codex; Fleet is part of the complete workspace. Nothing was changed.');
|
|
69
84
|
// Reject a local client already attached to another server before changing the server.
|
|
70
85
|
const saved = options.scope === 'all' ? effects.readManagedClientProfile() : null;
|
|
71
|
-
|
|
86
|
+
const savedEndpoint = plan.existing?.gateway ? gatewayAddress(plan.existing).base + '/daemon'
|
|
87
|
+
: isPluginOnly(plan.product) ? `http://127.0.0.1:${plan.port}/daemon` : `http://127.0.0.1:${plan.port}`;
|
|
88
|
+
if (saved && (!plan.existing || saved.expectedInstanceId !== plan.existing.instanceId || saved.endpoint !== savedEndpoint)) {
|
|
72
89
|
throw new InstallUsageError('This user already has clients attached to a different server; their saved connection was not changed');
|
|
73
90
|
}
|
|
74
91
|
} else {
|
|
75
|
-
const profile =
|
|
92
|
+
const profile = validateGatewayClientProfile(readObject(effects, options.config, 'Client profile'));
|
|
76
93
|
if (!profile) throw new InstallUsageError('Client profile must contain endpoint, expectedInstanceId and credentialPath');
|
|
77
94
|
if (!effects.readText(profile.credentialPath)?.trim()) throw new InstallUsageError('Client credential file is missing or empty');
|
|
78
95
|
plan.profile = profile;
|
|
79
96
|
const saved = effects.readManagedClientProfile();
|
|
80
|
-
if (saved &&
|
|
97
|
+
if (saved && saved.expectedInstanceId !== profile.expectedInstanceId) throw new InstallUsageError('Managed clients already select another server; existing connection was not changed');
|
|
81
98
|
if (saved && options.operation === 'install' && !options.sources) plan.sourcePolicy = readObject(effects, saved.installer.sourcesPath, 'Retained client source policy');
|
|
82
99
|
}
|
|
83
100
|
// Dry-run never spawns a resolver or acquires an installation lock.
|
|
@@ -86,12 +103,22 @@ export async function prepareSetupPlan(options, effects) {
|
|
|
86
103
|
const running = await effects.serverLifecycle(plan.existing, 'status', ['daemon']);
|
|
87
104
|
if (!running.includes('daemon')) throw new InstallUsageError('Full-stack update requires the selected daemon to be running for client verification. Start it first, or use server update to preserve its stopped state.');
|
|
88
105
|
}
|
|
89
|
-
if (options.scope !== 'client') await effects.resolveSourcePolicy(plan.sourcePolicy,
|
|
90
|
-
if (options.scope !== 'server') await effects.resolveSourcePolicy(plan.sourcePolicy, 'client',
|
|
106
|
+
if (options.scope !== 'client') await effects.resolveSourcePolicy(plan.sourcePolicy, serverRole(plan.product));
|
|
107
|
+
if (options.scope !== 'server') await effects.resolveSourcePolicy(plan.sourcePolicy, 'client', clientPackageNames(options.integrations));
|
|
91
108
|
}
|
|
92
109
|
return plan;
|
|
93
110
|
}
|
|
94
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Read-only preflight of a complete noninteractive setup command and optional Fleet
|
|
114
|
+
* settings: the same validation and dry-run planning as runSetup, without prompts,
|
|
115
|
+
* locks, installs or service changes.
|
|
116
|
+
*/
|
|
117
|
+
export async function preflightSetup(argv, effects, { fleetSettingsPath } = {}) {
|
|
118
|
+
if (fleetSettingsPath) validateFleetSettings(readObject(effects, fleetSettingsPath, 'Fleet settings'));
|
|
119
|
+
if (argv) await prepareSetupPlan(validateSetupOptions({ ...parseSetupArgs(argv, { home: effects.home, validate: false }), dryRun: true }, { interactive: false }), effects);
|
|
120
|
+
}
|
|
121
|
+
|
|
95
122
|
export async function executeSetupPlan(plan, effects, { server = runServerCommand, client = runClientCommand } = {}) {
|
|
96
123
|
if (!plan.interactive) effects.out(banner());
|
|
97
124
|
effects.out(heading(`${plan.operation === 'update' ? 'Update' : 'Install'} ours.network`));
|
|
@@ -107,9 +134,12 @@ export async function executeSetupPlan(plan, effects, { server = runServerComman
|
|
|
107
134
|
let clientPolicy = plan.sourcePolicy;
|
|
108
135
|
if (plan.scope !== 'client') {
|
|
109
136
|
effects.out(heading(plan.operation === 'update' ? 'Server update and identity restoration' : 'Server installation'));
|
|
110
|
-
const result = await server({ ...plan, role: 'server', operation: plan.operation, sourcePolicy: plan.sourcePolicy }, effects);
|
|
137
|
+
const result = await server({ ...plan, product: plan.product === 'workspace' ? undefined : plan.product, role: 'server', operation: plan.operation, sourcePolicy: plan.sourcePolicy }, effects);
|
|
111
138
|
if (result !== 0) return result;
|
|
112
139
|
const record = validateInstallation(effects.readJson(join(plan.stateDir, 'installation.json')), plan.stateDir);
|
|
140
|
+
if (plan.name && plan.surname && plan.operation === 'install') {
|
|
141
|
+
await effects.serverEnsureHumanProfile(record, { name: plan.name, surname: plan.surname });
|
|
142
|
+
}
|
|
113
143
|
if (plan.operation === 'update') {
|
|
114
144
|
effects.out(progress(0, 1, 'Retained identities', 'Verify the Human identity after state restoration; existing names and keys are retained.'));
|
|
115
145
|
const running = await effects.serverLifecycle(record, 'status', ['daemon']);
|
|
@@ -128,28 +158,69 @@ export async function executeSetupPlan(plan, effects, { server = runServerComman
|
|
|
128
158
|
if (plan.scope !== 'server') {
|
|
129
159
|
const result = await client({ role: 'client', operation: 'install', config: clientConfig,
|
|
130
160
|
integrations: plan.integrations, fleetSettingsPath: plan.fleetSettingsPath, sourcePolicy: clientPolicy,
|
|
161
|
+
disableFleetAgentsSetup: plan.disableFleetAgentsSetup, fleetTaskWorkflowAgents: plan.fleetTaskWorkflowAgents,
|
|
131
162
|
preset: true, nonInteractive: !plan.interactive }, effects);
|
|
132
163
|
if (result !== 0) return result;
|
|
133
164
|
}
|
|
165
|
+
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'));
|
|
166
|
+
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.'));
|
|
134
167
|
effects.out(ok(`Requested ${plan.operation} completed. Existing identities were retained.`));
|
|
135
|
-
if (plan.integrations?.includes('fleet')) effects.out(info('Fleet is configured but stopped. Review its settings, then run ours-fleet doctor, ours-fleet config and ours-fleet up.'));
|
|
168
|
+
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.'));
|
|
169
|
+
if (isPluginOnly(plan.product) && plan.scope === 'all') {
|
|
170
|
+
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.'));
|
|
171
|
+
effects.out(info(KEEPS_YOUR_SETUP));
|
|
172
|
+
}
|
|
173
|
+
if (plan.customHarness) {
|
|
174
|
+
const release = plan.sourcePolicy?.release?.packages?.['@ours.network/claude-code'];
|
|
175
|
+
if (release?.version) for (const line of customHarnessGuidance({ version: release.version, profilePath: join(effects.home, '.ours-client', 'profile.json'),
|
|
176
|
+
marketplace: preparedClaudeMarketplace(effects) })) effects.out(info(line));
|
|
177
|
+
else effects.out(warn('This installer release does not pin an Ours plugin version, so no instructions for another agent app can be given safely.'));
|
|
178
|
+
}
|
|
179
|
+
if (plan.operation === 'install' || plan.operation === 'update') effects.out(info('To remove Ours completely later, run: ours-install remove'));
|
|
136
180
|
return 0;
|
|
137
181
|
}
|
|
138
182
|
|
|
183
|
+
/** The exact local Claude Code marketplace this run prepared, when Claude Code was selected. */
|
|
184
|
+
function preparedClaudeMarketplace(effects) {
|
|
185
|
+
const root = join(effects.home, '.ours-client-install');
|
|
186
|
+
for (const name of effects.list?.(root) ?? []) {
|
|
187
|
+
const path = join(root, name, 'marketplaces', 'claude-code');
|
|
188
|
+
if (effects.exists?.(join(path, 'plugins', 'ours', 'bin', 'proxy.mjs'))) return path;
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
139
193
|
/** The sole executable entry: manual answers and CLI presets share one plan/executor. */
|
|
140
194
|
export async function runSetup(argv, effects) {
|
|
141
195
|
try {
|
|
142
196
|
if (argv.includes('--help') || argv.includes('-h')) { effects.out(USAGE); return 0; }
|
|
143
197
|
if (argv.length === 1 && ['--version', '-V'].includes(argv[0])) { effects.out(effects.version ?? 'unknown'); return 0; }
|
|
144
198
|
if (argv[0] === 'server' && maintenance.has(argv[1])) return await runServerCommand(parseNetworkArgs(argv), effects);
|
|
199
|
+
if (argv[0] === 'remove' || argv[0] === 'uninstall') return await runRemoval(argv.slice(1), effects);
|
|
145
200
|
if (!argv.length && effects.env?.OURS_ASSUME_YES) throw new InstallUsageError('OURS_ASSUME_YES cannot fill an interactive setup plan. Supply complete CLI presets for unattended installation.');
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const
|
|
201
|
+
let options;
|
|
202
|
+
let extra = {};
|
|
203
|
+
const welcome = !argv.length || (argv.length === 1 && argv[0] === 'update' && effects.interactive && !effects.env?.OURS_ASSUME_YES);
|
|
204
|
+
if (welcome) {
|
|
205
|
+
effects.out(banner());
|
|
206
|
+
const choice = await collectWelcome(effects, { update: argv[0] === 'update' });
|
|
207
|
+
if (choice.action === 'cancel') { effects.out(info('Nothing was changed.')); return 0; }
|
|
208
|
+
if (choice.action === 'remove') return await runRemoval([], effects);
|
|
209
|
+
if (choice.action === 'setup') { options = choice.options; extra = { customHarness: choice.customHarness, retainFleetConfiguration: choice.retainFleetConfiguration }; }
|
|
210
|
+
else options = await collectSetupOptions(effects, { ...choice.presets });
|
|
211
|
+
} else if (argv.length) {
|
|
212
|
+
const presets = parseSetupArgs(argv, { home: effects.home, validate: false });
|
|
213
|
+
try { options = validateSetupOptions(presets, { interactive: false }); }
|
|
214
|
+
catch (error) {
|
|
215
|
+
if (!effects.interactive || effects.env?.OURS_ASSUME_YES || !/^Missing (required setup options|human profile option):/.test(error.message)) throw error;
|
|
216
|
+
options = await collectSetupOptions(effects, presets);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const plan = { ...await prepareSetupPlan(options, effects), ...extra };
|
|
149
220
|
return await executeSetupPlan(plan, effects);
|
|
150
221
|
} catch (error) {
|
|
151
|
-
if (isCancel(error)) { effects.out(warn('Installation cancelled.')); return 130; }
|
|
152
|
-
effects.out(warn(`ours-install: ${error.
|
|
222
|
+
if (isCancel(error) || error?.cancelled) { effects.out(warn(error?.cancelled ? error.message : 'Installation cancelled.')); return 130; }
|
|
223
|
+
effects.out(warn(`ours-install: ${installerFailure(error, effects.env)}`));
|
|
153
224
|
return 2;
|
|
154
225
|
}
|
|
155
226
|
}
|
package/lib/target.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { serverBase } from './gateway.mjs';
|
|
1
2
|
// ours-install v3 — argument handling and daemon detection.
|
|
2
3
|
//
|
|
3
4
|
// Pure argument handling and daemon-target selection. The orchestrator
|
|
@@ -85,17 +86,30 @@ export function validateHostProfile(value) {
|
|
|
85
86
|
const mixed = LEGACY_PROFILE_KEYS.filter((key) => Object.hasOwn(value, key));
|
|
86
87
|
if (mixed.length) throw profileError(`legacy selection keys cannot be mixed with a host profile (${mixed.join(', ')}).`);
|
|
87
88
|
const { endpoint, expectedInstanceId, credentialPath } = value;
|
|
88
|
-
if (typeof endpoint !== 'string' || endpoint.trim() !== endpoint || endpoint === '') throw profileError('endpoint must be a non-empty HTTP or HTTPS
|
|
89
|
+
if (typeof endpoint !== 'string' || endpoint.trim() !== endpoint || endpoint === '') throw profileError('endpoint must be a non-empty HTTP or HTTPS base URL.');
|
|
89
90
|
if (typeof expectedInstanceId !== 'string' || !PROFILE_UUID.test(expectedInstanceId)) throw profileError('expectedInstanceId must be a lowercase UUID.');
|
|
90
91
|
if (typeof credentialPath !== 'string' || credentialPath === '' || !credentialPath.startsWith('/') || resolve(credentialPath) !== credentialPath) {
|
|
91
92
|
throw profileError('credentialPath must be a normalized absolute path.');
|
|
92
93
|
}
|
|
93
94
|
let url;
|
|
94
|
-
try { url = new URL(endpoint); } catch { throw profileError('endpoint must be an HTTP or HTTPS
|
|
95
|
-
if ((url.protocol !== 'http:' && url.protocol !== 'https:') || url.username || url.password || url.
|
|
96
|
-
throw profileError('endpoint must be an HTTP or HTTPS
|
|
95
|
+
try { url = new URL(endpoint); } catch { throw profileError('endpoint must be an HTTP or HTTPS base URL.'); }
|
|
96
|
+
if ((url.protocol !== 'http:' && url.protocol !== 'https:') || url.username || url.password || url.search || url.hash) {
|
|
97
|
+
throw profileError('endpoint must be an HTTP or HTTPS base URL without credentials, query, or fragment.');
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
+
const endpointBase = serverBase(endpoint);
|
|
100
|
+
if (value.serverUrl !== undefined) {
|
|
101
|
+
const serverUrl = serverBase(value.serverUrl);
|
|
102
|
+
if (endpointBase !== serverUrl + '/daemon') throw profileError('endpoint must select serverUrl/daemon.');
|
|
103
|
+
return { serverUrl, endpoint: endpointBase, expectedInstanceId, credentialPath };
|
|
104
|
+
}
|
|
105
|
+
return { endpoint: endpointBase, expectedInstanceId, credentialPath };
|
|
106
|
+
}
|
|
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' });
|
|
99
113
|
}
|
|
100
114
|
|
|
101
115
|
export function resolveProfileSelection({ args, env = {}, home = homedir(), exists, readProfile }) {
|
|
@@ -454,10 +468,11 @@ export function searchFreePort(isTaken, { floor = FREE_PORT_FLOOR, reserved = IN
|
|
|
454
468
|
export function parseNetworkArgs(argv) {
|
|
455
469
|
if (!['server', 'client'].includes(argv[0])) return null;
|
|
456
470
|
const [role, operation] = argv;
|
|
457
|
-
const operations = role === 'client' ? ['install'] : ['install', 'status', 'start', 'stop', 'restart', 'access-issue', 'access-replace', 'backup', 'restore', 'reset', 'update', 'rebuild'];
|
|
471
|
+
const operations = role === 'client' ? ['install'] : ['install', 'status', 'start', 'stop', 'restart', 'uninstall', 'access-issue', 'access-replace', 'backup', 'restore', 'reset', 'update', 'rebuild', 'gateway-enable'];
|
|
458
472
|
if (!operations.includes(operation)) throw new InstallUsageError(`Unsupported ${role} operation: ${operation ?? '(missing)'}`);
|
|
459
473
|
const allowed = role === 'client' ? ['config'] : ['state-dir'];
|
|
460
|
-
if (role === 'server' && operation === 'install') allowed.push('mode', 'sources', 'migrate');
|
|
474
|
+
if (role === 'server' && operation === 'install') allowed.push('mode', 'sources', 'migrate', 'container-engine');
|
|
475
|
+
if (role === 'server' && ['install', 'gateway-enable'].includes(operation)) allowed.push('server-url');
|
|
461
476
|
if (operation === 'access-issue') allowed.push('output');
|
|
462
477
|
if (['access-replace', 'reset'].includes(operation)) allowed.push('confirm');
|
|
463
478
|
if (['restore', 'update'].includes(operation)) allowed.push('compatible');
|
|
@@ -486,13 +501,14 @@ export function parseNetworkArgs(argv) {
|
|
|
486
501
|
} else {
|
|
487
502
|
const value = inline ?? argv[++i];
|
|
488
503
|
if (!value || value.startsWith('--')) throw new InstallUsageError(`--${name} requires a value`);
|
|
489
|
-
result[key] = name === '
|
|
504
|
+
result[key] = ['mode', 'container-engine'].includes(name) ? value : name === 'server-url' ? serverBase(value) : resolve(value);
|
|
490
505
|
}
|
|
491
506
|
}
|
|
492
507
|
const required = role === 'client' ? [] : ['stateDir'];
|
|
493
508
|
if (operation === 'access-issue') required.push('output');
|
|
494
509
|
if (['access-replace', 'reset'].includes(operation)) required.push('confirm');
|
|
495
510
|
for (const key of required) if (!result[key]) throw new InstallUsageError(`${operation} requires --${key.replace(/[A-Z]/g, c => '-' + c.toLowerCase())}`);
|
|
511
|
+
if (result.containerEngine !== undefined && (result.mode !== 'docker' || !['docker', 'podman'].includes(result.containerEngine))) throw new InstallUsageError('--container-engine docker|podman requires --mode docker');
|
|
496
512
|
if (result.mode && !['packages', 'docker'].includes(result.mode)) throw new InstallUsageError('--mode must be packages or docker');
|
|
497
513
|
return result;
|
|
498
514
|
}
|
package/lib/uninstall.mjs
CHANGED
|
@@ -174,13 +174,13 @@ export function planDaemonRemoval({ stateDir, cliStartedIt }) {
|
|
|
174
174
|
const service = {
|
|
175
175
|
id: 'service',
|
|
176
176
|
unit: unit.ok ? unit.unit : null,
|
|
177
|
-
command: ['ours
|
|
177
|
+
command: ['ours-daemon', 'uninstall-service', '--yes', '--state-dir', dir, '--config', join(dir, 'config.json')],
|
|
178
178
|
note: 'removes the unit managed by the ours CLI',
|
|
179
179
|
};
|
|
180
180
|
return [
|
|
181
181
|
service,
|
|
182
182
|
cliStartedIt
|
|
183
|
-
? { id: 'stop', command: ['ours
|
|
183
|
+
? { id: 'stop', command: ['ours-daemon', 'stop', '--state-dir', dir, '--config', join(dir, 'config.json')] }
|
|
184
184
|
: { id: 'stop-external', command: null, continues: true, note: 'this daemon was not started by the CLI; naming its launcher and continuing' },
|
|
185
185
|
];
|
|
186
186
|
}
|
package/lib/usage.mjs
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
// Public setup and maintenance commands.
|
|
2
|
-
export const USAGE = `ours-install — interactive setup
|
|
2
|
+
export const USAGE = `ours-install — interactive setup with optional CLI presets.
|
|
3
3
|
|
|
4
4
|
ours-install
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Asks what you would like to do: add collaboration tools to the agent apps
|
|
6
|
+
you already use, install the complete Ours workspace, connect to a workspace
|
|
7
|
+
on another computer, or another setup. When Ours is already installed it
|
|
8
|
+
offers Update (recommended), Repair, Remove or Cancel instead, keeping the
|
|
9
|
+
installation's product, runtime and connected apps. Your existing agent
|
|
10
|
+
configuration, skills, plugins and settings are kept.
|
|
11
|
+
Full setup runs the server in Docker or Podman, which provide the gateway local clients need.
|
|
12
|
+
Native mode is offered for server-only setup. Windows uses WSL.
|
|
13
|
+
|
|
14
|
+
Collaboration tools only (one Ours service in Docker, plugins for Claude Code and Codex):
|
|
15
|
+
ours-install --plugin-only --state-dir ~/.ours-install --identity-name "Your Name" --integrations claude-code,codex
|
|
16
|
+
|
|
17
|
+
Remove Ours completely (lists everything first; asks you to type "remove ours"):
|
|
18
|
+
ours-install remove [--state-dir PATH] [--dry-run]
|
|
19
|
+
|
|
20
|
+
Install now, configure Fleet agents in the App after linking:
|
|
21
|
+
ours-install --username alex --name Alex --surname Taylor --disable-fleet-agents-setup
|
|
22
|
+
Remaining installation choices are prompted on a terminal. No enrollment credentials or expiry.
|
|
8
23
|
|
|
9
24
|
Full stack, with every required answer preset (no prompts):
|
|
10
25
|
ours-install --mode docker --state-dir /private/ours --identity-name "Your Name" --integrations codex,fleet --fleet-settings /private/fleet.json
|
|
@@ -19,16 +34,26 @@ export const USAGE = `ours-install — interactive setup or complete CLI presets
|
|
|
19
34
|
Update a retained installation, preserving its identities:
|
|
20
35
|
ours-install all update --mode docker --state-dir /private/ours --identity-name "Your Name" --integrations codex,fleet --fleet-settings /private/fleet.json --compatible
|
|
21
36
|
|
|
37
|
+
--plugin-only collaboration tools only: the daemon service and the Claude Code/Codex
|
|
38
|
+
plugins; no workspace apps, Fleet, Telegram or gateway (Docker or Podman)
|
|
22
39
|
--scope all|server|client preset which parts to configure (default all)
|
|
23
40
|
--action install|update equivalent to the positional operation
|
|
24
41
|
--mode docker|native packages is also accepted for native mode
|
|
42
|
+
--container-engine docker|podman server container backend (default Docker); retained for maintenance
|
|
25
43
|
--state-dir PATH installation root; required for all/server
|
|
44
|
+
--username USERNAME local username; no global uniqueness check
|
|
45
|
+
--name NAME Messenger given name
|
|
46
|
+
--surname SURNAME Messenger family name
|
|
47
|
+
--hostname NAME optional host/workspace name; defaults to this machine
|
|
48
|
+
--disable-fleet-agents-setup install Fleet CLI without its roles/model wizard
|
|
26
49
|
--identity-name NAME desired Human name for a fresh server; existing root is retained
|
|
27
50
|
--integrations LIST codex,claude-code,fleet; use none to skip clients explicitly
|
|
28
|
-
--fleet-settings PATH JSON settings for Fleet;
|
|
51
|
+
--fleet-settings PATH JSON settings for Fleet; required unless Fleet agents setup is disabled
|
|
52
|
+
--fleet-task-workflow A[,B] let these Fleet agents run Fleet task commands outside their command sandbox
|
|
29
53
|
--config PATH complete connection profile for client-only setup
|
|
30
54
|
--sources PATH explicit full development source policy override
|
|
31
|
-
--port N
|
|
55
|
+
--port N public gateway port for Docker (default 3050; e.g. 4050)
|
|
56
|
+
--server-url URL external gateway URL (Docker install; configure authenticated entry separately)
|
|
32
57
|
--cowork-port N cowork port (default 3052)
|
|
33
58
|
--messenger-port N messenger port (default 8420)
|
|
34
59
|
--compatible required for server updates and legacy state migration
|
|
@@ -39,13 +64,14 @@ export const USAGE = `ours-install — interactive setup or complete CLI presets
|
|
|
39
64
|
--help, -h show help
|
|
40
65
|
--version, -V print installer version
|
|
41
66
|
|
|
42
|
-
CLI presets
|
|
43
|
-
|
|
67
|
+
Partial CLI presets on a terminal ask for the remaining choices. Without a terminal,
|
|
68
|
+
or with OURS_ASSUME_YES, supply complete CLI presets; missing answers fail before installation. Both input modes run the same
|
|
44
69
|
installer with preparation, identity restoration, update and readiness progress.
|
|
45
70
|
Fleet is configured but left stopped for operator review.
|
|
46
71
|
|
|
47
72
|
Scoped maintenance:
|
|
48
|
-
ours-install server status|start|stop|restart|rebuild --state-dir PATH
|
|
73
|
+
ours-install server status|start|stop|restart|rebuild|uninstall --state-dir PATH
|
|
74
|
+
ours-install server gateway-enable --state-dir PATH [--server-url URL]
|
|
49
75
|
ours-install server access-issue --state-dir PATH --output PATH
|
|
50
76
|
ours-install server access-replace --state-dir PATH --confirm
|
|
51
77
|
ours-install server backup|restore server|daemon|telegram|cowork|messenger LABEL --state-dir PATH
|
package/lib/welcome.mjs
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// The first screen of `ours-install` with no arguments.
|
|
2
|
+
//
|
|
3
|
+
// It starts from what the person wants, not from how Ours is built: add
|
|
4
|
+
// collaboration tools to the agent apps they already use, install the complete
|
|
5
|
+
// workspace, or connect to a workspace that already runs elsewhere. When Ours is
|
|
6
|
+
// already here, it offers to update, repair or remove what is installed, and
|
|
7
|
+
// keeps the kind of installation the person chose.
|
|
8
|
+
//
|
|
9
|
+
// This file only asks and explains. It returns the same validated setup options
|
|
10
|
+
// the CLI presets produce (or a removal request), so every path runs the same
|
|
11
|
+
// installer underneath.
|
|
12
|
+
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
import { validateInstallation } from './plan.mjs';
|
|
15
|
+
import { productOf, isPluginOnly, PLUGIN_ONLY, PRODUCT_LABELS, PLUGIN_ONLY_INTEGRATIONS } from './product.mjs';
|
|
16
|
+
import { validateSetupOptions, defaultHostname } from './setup-options.mjs';
|
|
17
|
+
import { validateIdentityName } from './server-onboarding.mjs';
|
|
18
|
+
import { heading, info } from './ui.mjs';
|
|
19
|
+
|
|
20
|
+
export const KEEPS_YOUR_SETUP = 'Your existing agent configuration, skills, plugins and custom settings stay as they are. Ours adds its own tools next to them; it does not replace or reconfigure your setup.';
|
|
21
|
+
|
|
22
|
+
export const WORKSPACE_BENEFITS = [
|
|
23
|
+
'The complete Ours workspace adds, on this computer:',
|
|
24
|
+
' - Rooms: a room of agents for each task, where they work on it together',
|
|
25
|
+
' - Invitations: bring in agents and people from outside, with their own identities',
|
|
26
|
+
' - Tracking: follow tasks and every agent\'s progress in one place',
|
|
27
|
+
' - Mobile: reach your agents from the Ours app on your phone',
|
|
28
|
+
' - Persistent agents: define agents that keep running and remember their role',
|
|
29
|
+
' - Orchestration: Claude Code, Codex and other agent apps and vendors working together',
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const TOOLS_SUMMARY = [
|
|
33
|
+
'Collaboration tools give the agent apps you already use their own secure Ours identity,',
|
|
34
|
+
'so they can message other agents and people, share files and be woken when mail arrives.',
|
|
35
|
+
'It runs one small background service in Docker or Podman on this computer — nothing else.',
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
/** Managed installations on this computer, in the default and ~/.ours* folders. */
|
|
39
|
+
export function findInstallations(effects, extra = []) {
|
|
40
|
+
const home = effects.home;
|
|
41
|
+
const names = typeof effects.list === 'function' ? effects.list(home) ?? [] : [];
|
|
42
|
+
const roots = [...new Set([join(home, '.ours-install'), ...names.filter(n => n.startsWith('.ours')).map(n => join(home, n)), ...extra])];
|
|
43
|
+
const found = [];
|
|
44
|
+
for (const root of roots) {
|
|
45
|
+
const value = effects.readJson(join(root, 'installation.json'));
|
|
46
|
+
if (!value) continue;
|
|
47
|
+
try {
|
|
48
|
+
const record = validateInstallation(value, root);
|
|
49
|
+
const journal = record.legacyMigrationSource ? effects.readJson(join(root, 'legacy-migration.json')) : null;
|
|
50
|
+
found.push({ root, record, product: productOf(record),
|
|
51
|
+
pending: record.buildTransition ? record.buildTransition.operation : record.layoutConversion ? 'install'
|
|
52
|
+
: record.legacyMigrationSource && journal?.phase !== 'complete' ? 'install' : null });
|
|
53
|
+
} catch { found.push({ root, invalid: true }); }
|
|
54
|
+
}
|
|
55
|
+
return found;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function describe(item) {
|
|
59
|
+
if (item.invalid) return `An Ours folder that could not be read: ${item.root}`;
|
|
60
|
+
const engine = item.record.mode === 'packages' ? 'directly on this computer' : item.record.containerEngine === 'podman' ? 'in Podman' : 'in Docker';
|
|
61
|
+
return `${PRODUCT_LABELS[item.product]} — folder ${item.root}, running ${engine}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const defaultIdentity = effects => `${String(effects.username?.() ?? 'me').toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/^-+/, '').slice(0, 30) || 'me'}@${defaultHostname()}`;
|
|
65
|
+
|
|
66
|
+
async function askIdentity(effects) {
|
|
67
|
+
effects.out('Choose the name other people and agents will see for you. Your agents get their own identities under it later.');
|
|
68
|
+
for (;;) {
|
|
69
|
+
const name = (await effects.askLine('Your name in Ours: ', defaultIdentity(effects))).trim();
|
|
70
|
+
try { validateIdentityName(name); return name; }
|
|
71
|
+
catch { effects.out('Use 1–64 characters without slashes or control characters.'); }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function askFolder(effects) {
|
|
76
|
+
const recommended = join(effects.home, '.ours-install');
|
|
77
|
+
effects.out(`Ours keeps its service and your data in one folder. The recommended folder is ${recommended}.`);
|
|
78
|
+
const where = await effects.select('Where should Ours keep its data?', [
|
|
79
|
+
{ value: 'recommended', label: `Use the recommended folder (${recommended})` },
|
|
80
|
+
{ value: 'custom', label: 'Choose another folder' },
|
|
81
|
+
], 'recommended');
|
|
82
|
+
return where === 'recommended' ? recommended : await effects.askLine('Folder for Ours: ', recommended);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function askEngine(effects) {
|
|
86
|
+
let podman = false;
|
|
87
|
+
try { podman = (await effects.run('sh', ['-c', 'command -v podman'], { allowCodes: [1, 127] })).code === 0; } catch { podman = false; }
|
|
88
|
+
if (!podman) return {};
|
|
89
|
+
effects.out('Ours runs its service in containers. Docker is recommended; choose Podman if that is what you use.');
|
|
90
|
+
const engine = await effects.select('Which container app should run Ours?', [
|
|
91
|
+
{ value: 'docker', label: 'Docker (recommended)' }, { value: 'podman', label: 'Podman' },
|
|
92
|
+
], 'docker');
|
|
93
|
+
return engine === 'podman' ? { containerEngine: 'podman' } : {};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Collaboration tools for existing agent apps: the plugin-only installation. */
|
|
97
|
+
async function collectTools(effects) {
|
|
98
|
+
effects.out(heading('Collaboration tools for your agent apps'));
|
|
99
|
+
for (const line of TOOLS_SUMMARY) effects.out(line);
|
|
100
|
+
effects.out(KEEPS_YOUR_SETUP);
|
|
101
|
+
const detected = typeof effects.detectHarnesses === 'function' ? await effects.detectHarnesses() : [];
|
|
102
|
+
const found = name => detected.some(item => item.name === name && item.status === 'ok');
|
|
103
|
+
const choices = [
|
|
104
|
+
...PLUGIN_ONLY_INTEGRATIONS.filter(found).map(name => ({ value: name, label: name === 'claude-code' ? 'Claude Code (found on this computer)' : 'Codex (found on this computer)' })),
|
|
105
|
+
{ value: 'custom', label: 'Another agent app — show me how to connect it' },
|
|
106
|
+
];
|
|
107
|
+
const missing = PLUGIN_ONLY_INTEGRATIONS.filter(name => !found(name)).map(name => name === 'claude-code' ? 'Claude Code' : 'Codex');
|
|
108
|
+
effects.out(`Choose the agent apps that should get the Ours tools. Use Space to select and Enter to continue.${missing.length ? ` Not found on this computer: ${missing.join(' and ')} — install it first and run ours-install again to connect it.` : ''}`);
|
|
109
|
+
const selected = await effects.multiselect('Which agent apps should get the Ours tools?', choices, choices.filter(c => c.value !== 'custom').map(c => c.value));
|
|
110
|
+
const integrations = selected.filter(name => name !== 'custom');
|
|
111
|
+
const customHarness = selected.includes('custom');
|
|
112
|
+
if (!integrations.length && !customHarness) throw Object.assign(new Error('Setup cancelled; no agent app was selected and nothing was changed'), { cancelled: true });
|
|
113
|
+
const engine = await askEngine(effects);
|
|
114
|
+
const stateDir = await askFolder(effects);
|
|
115
|
+
const identityName = await askIdentity(effects);
|
|
116
|
+
const options = validateSetupOptions({ scope: 'all', operation: 'install', product: PLUGIN_ONLY, mode: 'docker', ...engine, stateDir, identityName, integrations, interactive: true, explicitPorts: [] }, { interactive: true });
|
|
117
|
+
effects.out(`Ready to install: collaboration tools for ${[...integrations.map(n => n === 'claude-code' ? 'Claude Code' : 'Codex'), ...(customHarness ? ['another agent app (instructions at the end)'] : [])].join(', ')}; data in ${stateDir}; your name: ${identityName}.`);
|
|
118
|
+
effects.out('Nothing is changed until you continue. You can remove everything later with: ours-install remove');
|
|
119
|
+
if (!await effects.ask('Install now?', true)) throw Object.assign(new Error('Setup cancelled; nothing was changed'), { cancelled: true });
|
|
120
|
+
return { action: 'setup', options, customHarness };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Update, repair or remove what is already installed. */
|
|
124
|
+
async function collectExisting(effects, installations) {
|
|
125
|
+
effects.out(heading('Ours is already set up on this computer'));
|
|
126
|
+
for (const item of installations) effects.out(info(describe(item)));
|
|
127
|
+
const usable = installations.filter(item => !item.invalid);
|
|
128
|
+
let item = usable[0];
|
|
129
|
+
if (usable.length > 1) {
|
|
130
|
+
effects.out('Choose the installation to work with.');
|
|
131
|
+
const root = await effects.select('Which installation?', usable.map(i => ({ value: i.root, label: describe(i) })), usable[0].root);
|
|
132
|
+
item = usable.find(i => i.root === root);
|
|
133
|
+
}
|
|
134
|
+
if (!item) {
|
|
135
|
+
effects.out('Its record could not be read, so it is not changed automatically. You can remove Ours completely, which lists everything first.');
|
|
136
|
+
const next = await effects.select('What would you like to do?', [{ value: 'remove', label: 'Remove Ours from this computer' }, { value: 'cancel', label: 'Cancel' }], 'cancel');
|
|
137
|
+
return { action: next };
|
|
138
|
+
}
|
|
139
|
+
const saved = (() => { try { return effects.readManagedClientProfile?.() ?? null; } catch { return null; } })();
|
|
140
|
+
const clientBound = saved?.expectedInstanceId === item.record.instanceId;
|
|
141
|
+
if (item.pending) {
|
|
142
|
+
effects.out('An earlier update or setup step did not finish. Finishing it keeps your identities and data and repairs the installation.');
|
|
143
|
+
} else {
|
|
144
|
+
effects.out(`Update brings this ${item.product === PLUGIN_ONLY ? 'installation' : 'workspace'} to installer ${effects.version ?? 'this version'}, keeping your identities, data, connected agent apps and their settings. Repair runs setup again with the same choices. To switch between collaboration tools and the complete workspace, remove this installation first.`);
|
|
145
|
+
}
|
|
146
|
+
const action = await effects.select('What would you like to do?', [
|
|
147
|
+
...(item.pending ? [{ value: item.pending, label: 'Finish the earlier update or setup (recommended)' }]
|
|
148
|
+
: [{ value: 'update', label: 'Update Ours (recommended)' }, { value: 'install', label: 'Repair: run setup again with the same choices' }]),
|
|
149
|
+
{ value: 'remove', label: 'Remove Ours from this computer' },
|
|
150
|
+
{ value: 'cancel', label: 'Cancel' },
|
|
151
|
+
], item.pending ?? 'update');
|
|
152
|
+
if (action === 'remove' || action === 'cancel') return { action };
|
|
153
|
+
const record = item.record;
|
|
154
|
+
const product = productOf(record);
|
|
155
|
+
const integrations = clientBound ? (saved.installer?.integrations ?? []).filter(name => !isPluginOnly(product) || PLUGIN_ONLY_INTEGRATIONS.includes(name)) : undefined;
|
|
156
|
+
const fleetConfigured = integrations?.includes('fleet') && effects.readText?.(join(effects.home, 'fleet.yaml')) != null;
|
|
157
|
+
if (action === 'update') {
|
|
158
|
+
effects.out('An update keeps a recovery backup of your stored data before changing it. Newer releases are checked for compatibility, but older data cannot be guaranteed to work with every release automatically.');
|
|
159
|
+
if (!await effects.ask('Update now and keep a recovery backup?', true)) return { action: 'cancel' };
|
|
160
|
+
}
|
|
161
|
+
const options = {
|
|
162
|
+
scope: clientBound ? 'all' : 'server', operation: action, ...(product === PLUGIN_ONLY ? { product } : {}),
|
|
163
|
+
mode: record.mode, ...(record.containerEngine ? { containerEngine: record.containerEngine } : {}),
|
|
164
|
+
stateDir: item.root, identityName: record.messengerIdentity ?? defaultIdentity(effects),
|
|
165
|
+
...(clientBound ? { integrations } : {}),
|
|
166
|
+
...(action === 'update' ? { compatible: true } : {}),
|
|
167
|
+
...(fleetConfigured ? { disableFleetAgentsSetup: true } : {}),
|
|
168
|
+
interactive: true, explicitPorts: [],
|
|
169
|
+
};
|
|
170
|
+
return { action: 'setup', options: validateSetupOptions(options, { interactive: true }), existing: item, retainFleetConfiguration: Boolean(fleetConfigured) };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** The goal-first screen. Returns { action: 'setup' | 'remove' | 'cancel' | 'advanced', ... }. */
|
|
174
|
+
export async function collectWelcome(effects) {
|
|
175
|
+
const installations = findInstallations(effects);
|
|
176
|
+
if (installations.length) return collectExisting(effects, installations);
|
|
177
|
+
effects.out(heading('Welcome to Ours'));
|
|
178
|
+
effects.out('Ours is where people and AI agents work together: each agent gets its own secure identity and can message, share files and coordinate with other agents and people.');
|
|
179
|
+
effects.out('Choose what you would like to set up. Collaboration tools add Ours to the agent apps you already use. The complete workspace adds rooms, task tracking, mobile access and persistent agents.');
|
|
180
|
+
effects.out(KEEPS_YOUR_SETUP);
|
|
181
|
+
const goal = await effects.select('What would you like to do?', [
|
|
182
|
+
{ value: 'tools', label: 'Add collaboration tools to my agent apps (Claude Code, Codex or another app)' },
|
|
183
|
+
{ value: 'workspace', label: 'Install the complete Ours workspace' },
|
|
184
|
+
{ value: 'join', label: 'Connect my agent apps to an Ours workspace that runs on another computer' },
|
|
185
|
+
{ value: 'advanced', label: 'Other setups (server only, custom ports or packages)' },
|
|
186
|
+
], 'tools');
|
|
187
|
+
if (goal === 'tools') return collectTools(effects);
|
|
188
|
+
if (goal === 'workspace') {
|
|
189
|
+
effects.out(heading('The complete Ours workspace'));
|
|
190
|
+
for (const line of WORKSPACE_BENEFITS) effects.out(line);
|
|
191
|
+
effects.out(KEEPS_YOUR_SETUP);
|
|
192
|
+
return { action: 'advanced', presets: { scope: 'all' } };
|
|
193
|
+
}
|
|
194
|
+
if (goal === 'join') return { action: 'advanced', presets: { scope: 'client' } };
|
|
195
|
+
return { action: 'advanced', presets: {} };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Exact, verified guidance for an agent app the installer cannot configure itself. */
|
|
199
|
+
export function customHarnessGuidance({ version, profilePath, marketplace }) {
|
|
200
|
+
const folder = marketplace ? `${marketplace}/plugins/ours` : null;
|
|
201
|
+
return [
|
|
202
|
+
'Connect another agent app:',
|
|
203
|
+
' Ours provides its tools as an MCP server (stdio) plus instructions for the agent. Any agent app that can',
|
|
204
|
+
' run a local stdio MCP server can use them; apps that cannot run MCP servers cannot use Ours this way.',
|
|
205
|
+
...(folder ? [
|
|
206
|
+
` Ready on this computer: ${folder}`,
|
|
207
|
+
' Add this MCP server in the agent app\'s settings:',
|
|
208
|
+
` command: node arguments: ${folder}/bin/proxy.mjs`,
|
|
209
|
+
' environment: CLAUDE_CODE_SESSION_ID = a value unique to each agent session (for example a new UUID).',
|
|
210
|
+
' Without it the Ours tools refuse to act, because they keep each session\'s identity separate.',
|
|
211
|
+
` Give the agent ${folder}/skills/ours/SKILL.md as its instructions for the Ours tools.`,
|
|
212
|
+
] : []),
|
|
213
|
+
` It connects to Ours on this computer through ${profilePath}; no other settings are needed.`,
|
|
214
|
+
` The same plugin is published as npm package @ours.network/claude-code@${version}`,
|
|
215
|
+
` (https://www.npmjs.com/package/@ours.network/claude-code/v/${version}); after npm install in its folder it is used`,
|
|
216
|
+
' the same way. Use this exact version: the public GitHub marketplace adapt-toolkit/ours-claude-marketplace',
|
|
217
|
+
' currently selects an older plugin that does not work with this release.',
|
|
218
|
+
];
|
|
219
|
+
}
|