@agentsdock/server 1.0.9 → 1.0.10-beta.4

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/npm/cli.cjs CHANGED
@@ -66,7 +66,8 @@ function ensureFreshInstall(context) {
66
66
  if (context.uid === 0) throw new Error('Run as the user who will own the server, without sudo.')
67
67
  if (!['darwin', 'linux'].includes(context.platform)) throw new Error('Server installation requires Linux or Apple silicon macOS.')
68
68
  for (const name of ROOT_SELECTORS) if (context.env[name]) throw new Error(`Custom installation selector ${name} is unsupported by the fresh-install CLI. Use the existing server's managed updater.`)
69
- const existingInstall = () => new Error('An existing server installation or state was found. Use AgentsDock or agentsdock-server update; no installer was started.')
69
+ const existingInstall = (message = 'An existing server installation or state was found. Use AgentsDock or agentsdock-server update; no installer was started.') =>
70
+ Object.assign(new Error(message), { code: 'AGENTSDOCK_EXISTING_INSTALLATION' })
70
71
  const safeDirectory = info => info.isDirectory() && !info.isSymbolicLink() && info.uid === context.uid && (info.mode & 0o022) === 0 && (info.mode & 0o500) === 0o500
71
72
  const allowEmptyScaffold = (relative, child) => {
72
73
  const root = path.join(context.home, relative)
@@ -100,11 +101,14 @@ function ensureFreshInstall(context) {
100
101
  }
101
102
  if (context.platform === 'darwin') {
102
103
  const check = context.spawn('/bin/launchctl', ['print', `gui/${context.uid}/com.agentsdock.server`], { encoding: 'utf8', timeout: 10000 })
103
- if (check.status === 0) throw new Error('An AgentsServer service already exists. Use its managed updater.')
104
+ if (check.status === 0) throw existingInstall('An AgentsServer service already exists. Use its managed updater.')
104
105
  if (check.error || !/could not find service|service.*not found/i.test(`${check.stdout || ''} ${check.stderr || ''}`)) throw new Error('Could not verify the user service is absent. No installer was started.')
105
106
  } else {
106
107
  for (const unit of ['agents-server.service', 'zenithbot-agent.service']) {
107
108
  const check = context.spawn('systemctl', ['--user', 'show', unit, '--property=LoadState', '--value'], { encoding: 'utf8', timeout: 10000 })
109
+ if (!check.error && check.status === 0 && String(check.stdout).trim() && String(check.stdout).trim() !== 'not-found') {
110
+ throw existingInstall('An existing user service was found. Use its managed updater.')
111
+ }
108
112
  if (check.error || String(check.stdout).trim() !== 'not-found') throw new Error('An existing user service was found or its absence could not be verified. Use its managed updater.')
109
113
  }
110
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsdock/server",
3
- "version": "1.0.9",
3
+ "version": "1.0.10-beta.4",
4
4
  "description": "AgentsDock's self-hosted Python server and explicit installation CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/server/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.9
1
+ 1.0.10-beta.4