droidsembly 0.4.0-beta.4 → 0.4.0-beta.5

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.
Files changed (74) hide show
  1. package/README.it.md +6 -4
  2. package/README.md +6 -4
  3. package/bin/cubefarm.js +2 -296
  4. package/bin/droidsembly.js +304 -0
  5. package/bin/environment.d.ts +3 -0
  6. package/bin/environment.js +48 -0
  7. package/dist/assets/AccessibilitySettings-vd4x_sEq.js +30 -0
  8. package/dist/assets/{AppViewer-CqGa1r0z.js → AppViewer-BB9lvg-4.js} +1 -1
  9. package/dist/assets/{Balloon-dO9J4khp.js → Balloon-CWEK5uK2.js} +1 -1
  10. package/dist/assets/{Batched-CmXZtCvQ.js → Batched-yAiB-c-b.js} +1 -1
  11. package/dist/assets/{Birds-D51xGT0l.js → Birds-ClBZkA83.js} +1 -1
  12. package/dist/assets/{Blimp-C2c_AKRR.js → Blimp-VHMnVBQt.js} +1 -1
  13. package/dist/assets/{BufferGeometryUtils-Dcu0heeS.js → BufferGeometryUtils-B4Tnxtjb.js} +1 -1
  14. package/dist/assets/{Duck-CzFiUF6U.js → Duck-CCThHMtF.js} +1 -1
  15. package/dist/assets/{Effects-DwOi-gSQ.js → Effects-BZfFy3yq.js} +1 -1
  16. package/dist/assets/{Fireworks-Cc2mGzPJ.js → Fireworks-CxvvEwV_.js} +1 -1
  17. package/dist/assets/{Helicopter-ltB-x8hG.js → Helicopter-DXHDrTnQ.js} +1 -1
  18. package/dist/assets/{Hurricane-C2qHsRw4.js → Hurricane-WXNUxoUz.js} +1 -1
  19. package/dist/assets/{Kaiju-DPHVjFjg.js → Kaiju-D-wVgKo-.js} +1 -1
  20. package/dist/assets/{Meteors-CxcguXTJ.js → Meteors-DSr-7bEl.js} +1 -1
  21. package/dist/assets/{MissionConsole-BUE2mijT.js → MissionConsole-4G02S89d.js} +1 -1
  22. package/dist/assets/{Office-NV5zlSnK.js → Office-B_EroD2U.js} +44 -44
  23. package/dist/assets/{PhotoPanel-CDqgU99Z.js → PhotoPanel-ByzwApow.js} +1 -1
  24. package/dist/assets/{PhotoScene-RRXC4_Jv.js → PhotoScene-CW3yZkqH.js} +3 -3
  25. package/dist/assets/{Plane-BQB72TWZ.js → Plane-CT7-QFbA.js} +1 -1
  26. package/dist/assets/Pocket-B0o4siMl.js +2 -0
  27. package/dist/assets/{Rainbow-DIpZi5-z.js → Rainbow-DNvXfTl9.js} +1 -1
  28. package/dist/assets/{Roof-Cd9I0jtG.js → Roof-yLX0ZK0x.js} +1 -1
  29. package/dist/assets/{Shell-DCqHgrm_.js → Shell-lZOZ3aG8.js} +2 -2
  30. package/dist/assets/{Skywriting-BH6FCdEl.js → Skywriting-N1GDZKYR.js} +1 -1
  31. package/dist/assets/{TerminalView-CoH1yh6r.js → TerminalView-cUAMhOxM.js} +11 -11
  32. package/dist/assets/{ToyWorld--k4uqi9k.js → ToyWorld-BYE8776A.js} +1 -1
  33. package/dist/assets/{Ufo-C5cYunS9.js → Ufo-D_Wt75n1.js} +1 -1
  34. package/dist/assets/{Whale-BAXeezd8.js → Whale-Kkz3B36R.js} +1 -1
  35. package/dist/assets/all-BMItClgN.js +11 -0
  36. package/dist/assets/{bloomMarks-JYeAmd4d.js → bloomMarks-C22qSi5d.js} +1 -1
  37. package/dist/assets/{cheerRules-DvM2z9Qg.js → cheerRules-G9WFRB4C.js} +1 -1
  38. package/dist/assets/{cityLayout-VU-ug-r6.js → cityLayout-C8f5-bpM.js} +1 -1
  39. package/dist/assets/{dogState-Bm3YZHwy.js → dogState-9uong8D8.js} +1 -1
  40. package/dist/assets/{doors-D7Z3s-7W.js → doors-DsKuGpOi.js} +1 -1
  41. package/dist/assets/{gallery-CSWmy4Tf.js → gallery-DSKvNkBq.js} +1 -1
  42. package/dist/assets/gate-D6_NXB1w.js +2 -0
  43. package/dist/assets/index-rznd4Djx.js +10 -0
  44. package/dist/assets/{instantReplay-FXf2kJ7B.js → instantReplay-CiWMru53.js} +1 -1
  45. package/dist/assets/{interact-BatJVhca.js → interact-Bt-XX-z4.js} +1 -1
  46. package/dist/assets/{jsx-runtime-CXW0f58S.js → jsx-runtime-CZP6s5wa.js} +1 -1
  47. package/dist/assets/{kit-D3twk12W.js → kit-CZEafHnz.js} +1 -1
  48. package/dist/assets/mic-DeYDrNoY.js +1 -0
  49. package/dist/assets/{photoMode-B8pRCF0O.js → photoMode-BTxq9-gL.js} +1 -1
  50. package/dist/assets/{pipeline-BgOS9JnJ.js → pipeline-DNe3sjnP.js} +1 -1
  51. package/dist/assets/{rapier-BvQbKz0M.js → rapier-C-KFR0AR.js} +1 -1
  52. package/dist/assets/{rig-BgSxc8mA.js → rig-B88WinIa.js} +1 -1
  53. package/dist/assets/{speechLanguage-Cak8tdL0.js → speechLanguage-Bq3BAswq.js} +1 -1
  54. package/dist/assets/store-9CvxLGNQ.js +5 -0
  55. package/dist/assets/useDayTime-Nrdy7kH1.js +1 -0
  56. package/dist/assets/useGraphics-Bhnj8CAm.js +1 -0
  57. package/dist/assets/voiceMessages-BF3P4sjw.js +1 -0
  58. package/dist/assets/{weatherState-BQ3UU4vU.js → weatherState-CufaxiyU.js} +1 -1
  59. package/dist/index.html +3 -3
  60. package/dist-server/index.js +597 -413
  61. package/dist-server/index.js.map +4 -4
  62. package/dist-server/ptyHost.js +6 -2
  63. package/dist-server/ptyHost.js.map +2 -2
  64. package/package.json +2 -2
  65. package/dist/assets/AccessibilitySettings-6ZCswq5I.js +0 -30
  66. package/dist/assets/Pocket-CjK6fv97.js +0 -2
  67. package/dist/assets/all-BsJ98bWd.js +0 -11
  68. package/dist/assets/gate-DwsbbSNS.js +0 -2
  69. package/dist/assets/index-D_Et7Vx8.js +0 -10
  70. package/dist/assets/mic-BJ0eYLIj.js +0 -1
  71. package/dist/assets/store-Buxt6UcJ.js +0 -5
  72. package/dist/assets/useDayTime-0ms3va3h.js +0 -1
  73. package/dist/assets/useGraphics-p7LAuvYj.js +0 -1
  74. package/dist/assets/voiceMessages-hO1SDnOS.js +0 -1
package/README.it.md CHANGED
@@ -12,7 +12,7 @@ Uno spazio visuale per lo sviluppo software assistito dall'AI: collega i tuoi re
12
12
 
13
13
  [Sito](https://droidsembly.com) · [npm](https://www.npmjs.com/package/droidsembly) · [Release](https://github.com/rosariomoscato/droidsembly/releases) · [Segnala un problema](https://github.com/rosariomoscato/droidsembly/issues) · [Contribuire](CONTRIBUTING.it.md) · [Documentazione](#documentazione) · [Sostieni il progetto](#sostieni-il-progetto)
14
14
 
15
- **Beta pubblica:** [note della release 0.4.0-beta.1](https://github.com/rosariomoscato/droidsembly/releases/tag/droidsembly-v0.4.0-beta.1). Visita [droidsembly.com](https://droidsembly.com) per la presentazione e le istruzioni demo; questo repository contiene i sorgenti e la documentazione tecnica.
15
+ **Beta pubblicata:** [note della release 0.4.0-beta.4](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/RELEASE_NOTES_0.4.0-beta.4.md). **Beta.5 è integrata in dev con QA indipendente e CI multipiattaforma verde, ma non è ancora pubblicata:** vedi [ambito della validazione e gate di rilascio ancora aperti](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/RELEASE_NOTES_0.4.0-beta.5.md). Visita [droidsembly.com](https://droidsembly.com) per la presentazione e le istruzioni demo; questo repository contiene i sorgenti e la documentazione tecnica.
16
16
 
17
17
  **Gratuito e open source, con licenza MIT.** Nessuna attivazione a pagamento o sblocco commerciale degli agenti. Il sostegno volontario aiuta lo sviluppo; abbonamenti AI, consumi API e servizi cloud opzionali hanno costi e limiti propri.
18
18
 
@@ -41,7 +41,7 @@ Il piano di progetto e il Kanban sono catture reali della beta 0.4.0-beta.1 in u
41
41
 
42
42
  ## Cosa puoi fare
43
43
 
44
- - **Coordinare agenti di coding:** Claude Code, Codex e OpenCode V2, con selezione dei modelli e delle varianti di ragionamento supportate. La disponibilità dipende dal runtime: Agent SDK resta esclusivamente Claude e OpenCode è attualmente solo locale.
44
+ - **Coordinare agenti di coding:** Claude Code, Codex e OpenCode V2, con selezione dei modelli e delle varianti di ragionamento supportate. La disponibilità dipende dal runtime: Agent SDK resta esclusivamente Claude. OpenCode supporta terminali locali e worker su Upstash Box; ufficio e CEO restano locali. Vedi [limiti della validazione Box](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/OPENCODE_BOX_VALIDATION.md).
45
45
  - **Seguire il workflow completo:** issue → sviluppo e controlli iniziali → pull request → sessione QA separata → correzioni → merge quando le condizioni configurate sono soddisfatte.
46
46
  - **Mantenere il controllo:** assegnazione manuale o automatica, onboarding CEO facoltativo, approvazione dei cambi team e interruttore distinto per il merge automatico.
47
47
  - **Osservare il lavoro reale:** terminali live, piani dei progetti, Kanban e console del manager. Clone e worktree locali separano le copie di lavoro degli agenti; non sono sandbox di sicurezza.
@@ -52,7 +52,7 @@ Il piano di progetto e il Kanban sono catture reali della beta 0.4.0-beta.1 in u
52
52
 
53
53
  ## Installa questo fork
54
54
 
55
- **La prima beta pubblica è disponibile:** [droidsembly@0.4.0-beta.1 su npm](https://www.npmjs.com/package/droidsembly). Avvia con `npx droidsembly@next` (`npx.cmd droidsembly@next` in PowerShell), oppure compila dai sorgenti come indicato sotto. Per scegliere questa versione esatta usa `npx droidsembly@0.4.0-beta.1`. Non è ancora disponibile un installer desktop. `npx cubefarm` installa il pacchetto originale, non Droidsembly.
55
+ **Pacchetto pubblicato:** [droidsembly@0.4.0-beta.4 su npm](https://www.npmjs.com/package/droidsembly). Avvia con `npx droidsembly@next` (`npx.cmd droidsembly@next` in PowerShell), oppure compila dai sorgenti come indicato sotto. Per scegliere esattamente la beta.4 pubblicata usa `npx droidsembly@0.4.0-beta.4`; compilare questo checkout usa invece la versione candidata locale. Non è ancora disponibile un installer desktop. `npx cubefarm` installa il pacchetto originale, non Droidsembly.
56
56
 
57
57
  **È una beta, non una versione stabile.** Usa il canale esplicito `next`: npm attualmente punta anche `latest` a questa prima beta, quindi anche un'installazione senza canale la seleziona. Una futura stabile subentrerà su `latest`; le beta verificano gli aggiornamenti su `next`. Il pacchetto non espone un alias globale `cubefarm`. Il file interno `bin/cubefarm.js`, i launcher dei checkout esistenti e la cartella dati predefinita restano compatibili. Per l'uso affiancato scegli uno `SWARM_HOME` separato e porte libere come descritto sotto.
58
58
 
@@ -63,6 +63,8 @@ Il piano di progetto e il Kanban sono catture reali della beta 0.4.0-beta.1 in u
63
63
  - Claude Code è incluso tramite Agent SDK. OpenCode **2.x** e Codex si installano separatamente quando selezionati. Le sessioni terminale esclusivamente OpenCode non richiedono un abbonamento Claude.
64
64
  - Google Chrome per gli agenti che verificano i progetti nel browser.
65
65
 
66
+ **Browser consigliato per l'ufficio:** Google Chrome aggiornato è il nostro browser di riferimento per i collaudi desktop isolati. Altri browser moderni potrebbero funzionare, ma non sono stati validati in questo ciclo di test; non è una politica di supporto esclusivo a Chrome. Clic sulle notifiche native e focus delle finestre restano non verificati. Vedi [ambito e limiti del collaudo della candidata](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/RELEASE_NOTES_0.4.0-beta.5.md).
67
+
66
68
  Il progetto è destinato a Windows, macOS e Linux. La demo senza AI descritta sotto non richiede credenziali dei provider o login GitHub.
67
69
 
68
70
  ### 1. Scarica e compila
@@ -131,7 +133,7 @@ node dist-server/index.js
131
133
  SWARM_HOME="$HOME/.droidsembly" SWARM_PORT=4419 SWARM_HOST=127.0.0.1 SWARM_PREVIEW_PORT=9600 SWARM_DEMO=0 node dist-server/index.js
132
134
  ```
133
135
 
134
- Apri **http://127.0.0.1:4419/**. Le cartelle degli esempi sono una scelta esplicita per una nuova installazione, non una migrazione: percorsi dati e launcher esistenti restano validi. Senza `SWARM_HOME`, il percorso predefinito dell'app rimane `~/.cubefarm`.
136
+ Apri **http://127.0.0.1:4419/**. Le cartelle degli esempi sono una scelta esplicita per una nuova installazione, non una migrazione: percorsi dati e launcher esistenti restano validi. `DROIDSEMBLY_HOME` è l'alias canonico di `SWARM_HOME`. Senza una scelta esplicita, i dati esistenti in `~/.cubefarm` restano al loro posto; i nuovi uffici usano `~/.droidsembly`. Se entrambe le cartelle predefinite esistono, l'avvio richiede una scelta esplicita, senza unire o spostare dati. Le variabili canoniche `DROIDSEMBLY_*` hanno la precedenza sulle equivalenti legacy. Vedi [compatibilità ambiente/cartella dati e rollback](docs/ENV_HOME_MIGRATION.md).
135
137
 
136
138
  Prima di collegare un progetto, seleziona il coding agent del CEO se non vuoi usare il predefinito Claude Code. Per saltare l'analisi AI iniziale, disattiva l'opzione che permette al CEO di studiare il repository e pianificare dal brief. Assegnazione automatica, merge automatico e revisioni periodiche CEO sono impostazioni distinte. Vedi [Agenti](https://github.com/rosariomoscato/droidsembly/blob/main/docs/agents.md) per configurazione dei provider e limiti dei runtime.
137
139
 
package/README.md CHANGED
@@ -12,7 +12,7 @@ A visual workspace for AI-assisted software development: connect your GitHub rep
12
12
 
13
13
  [Website](https://droidsembly.com) · [npm](https://www.npmjs.com/package/droidsembly) · [Releases](https://github.com/rosariomoscato/droidsembly/releases) · [Report an issue](https://github.com/rosariomoscato/droidsembly/issues) · [Contributing](CONTRIBUTING.md) · [Documentation](#documentation) · [Support the project](#support-the-project)
14
14
 
15
- **Public beta:** [0.4.0-beta.1 release notes](https://github.com/rosariomoscato/droidsembly/releases/tag/droidsembly-v0.4.0-beta.1). Visit [droidsembly.com](https://droidsembly.com) for an introduction and demo instructions; this repository contains the source and technical documentation.
15
+ **Published beta:** [0.4.0-beta.4 release notes](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/RELEASE_NOTES_0.4.0-beta.4.md). **Beta.5 is integrated into dev with independent QA and green multiplatform CI, but is not yet published:** see [validation scope and remaining release gates](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/RELEASE_NOTES_0.4.0-beta.5.md). Visit [droidsembly.com](https://droidsembly.com) for an introduction and demo instructions; this repository contains the source and technical documentation.
16
16
 
17
17
  **Free and open source, under the MIT license.** No paid activation or commercial agent unlocks. Voluntary support helps development; your AI subscriptions, API usage and optional cloud services have their own costs and limits.
18
18
 
@@ -41,7 +41,7 @@ The project floor and Kanban are actual captures of beta 0.4.0-beta.1 in an isol
41
41
 
42
42
  ## What you can do
43
43
 
44
- - **Coordinate coding agents:** Claude Code, Codex and OpenCode V2, with model selection and supported reasoning variants. Provider availability depends on the runtime; the Agent SDK runtime is Claude-only, and OpenCode is currently local-only.
44
+ - **Coordinate coding agents:** Claude Code, Codex and OpenCode V2, with model selection and supported reasoning variants. Provider availability depends on the runtime; the Agent SDK runtime is Claude-only. OpenCode supports local terminals and Upstash Box workers; the office and CEO remain local. See [Box validation limits](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/OPENCODE_BOX_VALIDATION.md).
45
45
  - **Follow the full workflow:** issue → development and initial checks → pull request → separate QA session → corrections → merge when the configured conditions pass.
46
46
  - **Keep control:** manual or automatic assignment, optional CEO onboarding, team-change approvals and a separate auto-merge switch.
47
47
  - **Watch real work:** live terminals, project floors, a Kanban board and the manager console. Local clones and worktrees separate agents' working copies; they are not security sandboxes.
@@ -52,7 +52,7 @@ The project floor and Kanban are actual captures of beta 0.4.0-beta.1 in an isol
52
52
 
53
53
  ## Install this fork
54
54
 
55
- **The first public beta is available:** [droidsembly@0.4.0-beta.1 on npm](https://www.npmjs.com/package/droidsembly). Run `npx droidsembly@next` (`npx.cmd droidsembly@next` in PowerShell), or build from source below. To select this exact release, use `npx droidsembly@0.4.0-beta.1`. There is no desktop installer yet. `npx cubefarm` installs the original package, not Droidsembly.
55
+ **Published package:** [droidsembly@0.4.0-beta.4 on npm](https://www.npmjs.com/package/droidsembly). Run `npx droidsembly@next` (`npx.cmd droidsembly@next` in PowerShell), or build from source below. To select the published beta.4 exactly, use `npx droidsembly@0.4.0-beta.4`; building this checkout instead uses its local candidate version. There is no desktop installer yet. `npx cubefarm` installs the original package, not Droidsembly.
56
56
 
57
57
  **This is a beta, not a stable release.** Use the explicit `next` channel: npm currently also points `latest` at this first beta, so an unqualified install selects it too. A future stable release will take over `latest`; beta versions check `next` for updates. The package exposes no global `cubefarm` alias. The internal entry file `bin/cubefarm.js`, existing checkout launchers and default data directory remain compatible. For side-by-side use, select a separate `SWARM_HOME` and free ports as described below.
58
58
 
@@ -63,6 +63,8 @@ The project floor and Kanban are actual captures of beta 0.4.0-beta.1 in an isol
63
63
  - Claude Code is bundled through the Agent SDK. OpenCode **2.x** and Codex are installed separately when selected. OpenCode-only terminal sessions do not require a Claude subscription.
64
64
  - Google Chrome for agents that test projects in a browser.
65
65
 
66
+ **Recommended office browser:** up-to-date Google Chrome is our reference browser for the isolated desktop checks. Other modern browsers may work, but were not validated in this test cycle; this is not a Chrome-only support policy. Native notification clicks and window focus remain unverified. See [candidate validation scope and limits](https://github.com/rosariomoscato/droidsembly/blob/dev/docs/RELEASE_NOTES_0.4.0-beta.5.md).
67
+
66
68
  The project targets Windows, macOS and Linux. The no-AI demo below does not require provider credentials or a GitHub login.
67
69
 
68
70
  ### 1. Download and build
@@ -131,7 +133,7 @@ node dist-server/index.js
131
133
  SWARM_HOME="$HOME/.droidsembly" SWARM_PORT=4419 SWARM_HOST=127.0.0.1 SWARM_PREVIEW_PORT=9600 SWARM_DEMO=0 node dist-server/index.js
132
134
  ```
133
135
 
134
- Open **http://127.0.0.1:4419/**. These example folders are an explicit choice for a new installation, not a migration: existing data paths and launchers remain valid. Without `SWARM_HOME`, the application's default remains `~/.cubefarm`.
136
+ Open **http://127.0.0.1:4419/**. These example folders are an explicit choice for a new installation, not a migration: existing data paths and launchers remain valid. `DROIDSEMBLY_HOME` is the canonical alias for `SWARM_HOME`. With neither set, existing `~/.cubefarm` data stays in place; new offices use `~/.droidsembly`. If both default folders exist, startup requires an explicit choice, without merging/moving data. Canonical `DROIDSEMBLY_*` settings take precedence over the legacy equivalents. See [environment/home compatibility and rollback](docs/ENV_HOME_MIGRATION.md).
135
137
 
136
138
  Before connecting a project, select the CEO's coding agent if you do not want the default Claude Code. To skip the initial AI analysis, turn off **Let the CEO study this repository and plan from the brief**. Auto-assignment, auto-merge and periodic CEO reviews are separate settings. See [Agents](https://github.com/rosariomoscato/droidsembly/blob/main/docs/agents.md) for provider setup and runtime limitations.
137
139
 
package/bin/cubefarm.js CHANGED
@@ -1,297 +1,3 @@
1
1
  #!/usr/bin/env node
2
- // Public command: droidsembly. Keep this entry path compatible with existing checkout launchers.
3
- import { spawn, spawnSync } from 'node:child_process';
4
- import fs from 'node:fs';
5
- import { createRequire } from 'node:module';
6
- import net from 'node:net';
7
- import os from 'node:os';
8
- import path from 'node:path';
9
- import { fileURLToPath, pathToFileURL } from 'node:url';
10
- import { parseArgs } from 'node:util';
11
- import { isNewer, updateInfo } from './distribution.js';
12
-
13
- const MIN_NODE = 22;
14
- const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
15
- const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
16
- const update = updateInfo(pkg.name, pkg.version);
17
-
18
- const HELP = `
19
- Droidsembly ${pkg.version}: a cartoon 3D office where a team of AI coding agents works through your GitHub issues.
20
-
21
- Usage
22
- ${update.command} start the office and open it in your browser
23
- ${update.command} login sign in to Claude Code, the built-in coding agent
24
- ${update.command} doctor check that this machine is ready
25
-
26
- Options
27
- --port <n> port for the office (default 4317)
28
- --host <address>
29
- address to listen on (default 127.0.0.1, this machine only). 0.0.0.0 opens the office to your
30
- network with no sign-in: anyone who reaches it can run your agents. Only on a network you trust
31
- --demo fake GitHub and fake agents: look around without spending any usage
32
- --floors <n> --agents <n>
33
- with --demo: a bigger company, n floors with n people each (up to 20 and 15)
34
- --no-open don't open the browser
35
- -v, --version
36
- -h, --help
37
-
38
- The office keeps its state and workspaces in ~/.cubefarm (set SWARM_HOME to use another folder).
39
- `;
40
-
41
- const color = process.stdout.isTTY && !process.env.NO_COLOR;
42
- const paint = (open, close) => (s) => (color ? `\x1b[${open}m${s}\x1b[${close}m` : s);
43
- const green = paint(32, 39);
44
- const red = paint(31, 39);
45
- const dim = paint(2, 22);
46
- const fail = (msg) => {
47
- console.error(`\n ${red('✗')} ${msg}\n`);
48
- process.exit(1);
49
- };
50
-
51
- if (Number(process.versions.node.split('.')[0]) < MIN_NODE) fail(`Droidsembly needs Node.js ${MIN_NODE} or newer (this is ${process.version}). Get it from https://nodejs.org`);
52
-
53
- let args;
54
- try {
55
- args = parseArgs({
56
- allowPositionals: true,
57
- options: {
58
- port: { type: 'string', short: 'p' },
59
- host: { type: 'string' },
60
- bind: { type: 'string' },
61
- demo: { type: 'boolean' },
62
- floors: { type: 'string' },
63
- agents: { type: 'string' },
64
- 'no-open': { type: 'boolean' },
65
- version: { type: 'boolean', short: 'v' },
66
- help: { type: 'boolean', short: 'h' },
67
- },
68
- });
69
- } catch (err) {
70
- fail(`${err.message}\n Run ${update.command} --help for the options.`);
71
- }
72
- const { values, positionals } = args;
73
- const command = positionals[0] ?? 'start';
74
-
75
- if (values.help) {
76
- console.log(HELP);
77
- process.exit(0);
78
- }
79
- if (values.version) {
80
- console.log(pkg.version);
81
- process.exit(0);
82
- }
83
-
84
- // ---------- Claude Code ----------
85
-
86
- // The Agent SDK ships Claude Code as a per-platform package. The office runs its agents on it, so logging in with it
87
- // is logging the agents in. Same lookup as the SDK's own.
88
- function claudeBinary() {
89
- let sdk;
90
- try {
91
- sdk = createRequire(import.meta.url).resolve('@anthropic-ai/claude-agent-sdk');
92
- } catch {
93
- return null;
94
- }
95
- const { platform, arch } = process;
96
- const musl = platform === 'linux' && !process.report?.getReport?.()?.header?.glibcVersionRuntime;
97
- const targets = platform === 'linux' ? (musl ? [`linux-${arch}-musl`, `linux-${arch}`] : [`linux-${arch}`, `linux-${arch}-musl`]) : [`${platform}-${arch}`];
98
- const fromSdk = createRequire(sdk);
99
- for (const target of targets) {
100
- try {
101
- return fromSdk.resolve(`@anthropic-ai/claude-agent-sdk-${target}/claude${platform === 'win32' ? '.exe' : ''}`);
102
- } catch {
103
- // not installed for this target
104
- }
105
- }
106
- return null;
107
- }
108
-
109
- // Like the agents: no API keys or settings inherited from a Claude Code session this was started from.
110
- function claudeEnv() {
111
- const env = {};
112
- for (const [k, v] of Object.entries(process.env)) if (!/^(ANTHROPIC_|CLAUDE)/i.test(k) || k === 'CLAUDE_CONFIG_DIR') env[k] = v;
113
- return env;
114
- }
115
-
116
- // ---------- checks ----------
117
-
118
- const sh = (cmd, cmdArgs, env) => spawnSync(cmd, cmdArgs, { encoding: 'utf8', windowsHide: true, timeout: 30_000, env });
119
-
120
- /** What the office needs: { name, ok, detail, fix, required }. */
121
- function checks() {
122
- const out = [{ name: 'Node.js', ok: true, detail: process.version }];
123
-
124
- const git = sh('git', ['--version']);
125
- out.push({ name: 'git', ok: git.status === 0, detail: git.stdout?.trim().replace(/^git version /, ''), fix: 'install git: https://git-scm.com/downloads', required: true });
126
-
127
- if (sh('gh', ['--version']).status !== 0) {
128
- out.push({ name: 'GitHub CLI', ok: false, fix: 'install it from https://cli.github.com, then run: gh auth login' });
129
- } else {
130
- const ok = sh('gh', ['auth', 'status']).status === 0;
131
- out.push({ name: 'GitHub CLI', ok, detail: ok ? 'signed in' : 'not signed in', fix: 'run: gh auth login' });
132
- }
133
-
134
- const claude = claudeBinary();
135
- if (!claude) {
136
- out.push({ name: 'Claude Code', ok: false, fix: `if using Claude, reinstall ${pkg.name}: Claude Code for ${process.platform}-${process.arch} is missing` });
137
- } else {
138
- let status = null;
139
- try {
140
- status = JSON.parse(sh(claude, ['auth', 'status', '--json'], claudeEnv()).stdout);
141
- } catch {
142
- // unreadable: treated as signed out
143
- }
144
- const ok = status?.loggedIn === true;
145
- out.push({ name: 'Claude', ok, detail: ok ? `signed in${status.subscriptionType ? ` (${status.subscriptionType})` : ''}` : 'not signed in (only needed for Claude sessions)', fix: `if using Claude, run: ${update.command} login` });
146
- }
147
-
148
- // Agents test in a browser through Playwright, which drives Google Chrome by default.
149
- const chrome = chromePaths().some((p) => fs.existsSync(p));
150
- out.push({ name: 'Chrome', ok: chrome, detail: chrome ? 'for browser testing' : 'Google Chrome not found', fix: 'install Google Chrome so agents can test in a browser' });
151
- // The pinned Playwright MCP server the agents' browser runs on (server/browser.ts), installed with cubefarm.
152
- let mcp = null;
153
- try {
154
- mcp = JSON.parse(fs.readFileSync(createRequire(import.meta.url).resolve('@playwright/mcp/package.json'), 'utf8')).version;
155
- } catch {
156
- // not installed
157
- }
158
- out.push({ name: 'Browser tool', ok: !!mcp, detail: mcp ? `@playwright/mcp ${mcp}` : 'not installed', fix: `reinstall ${pkg.name}: ${update.command}` });
159
- return out;
160
- }
161
-
162
- function chromePaths() {
163
- const env = process.env;
164
- if (process.platform === 'win32') {
165
- return [env.PROGRAMFILES, env['PROGRAMFILES(X86)'], env.LOCALAPPDATA].filter(Boolean).map((d) => path.join(d, 'Google', 'Chrome', 'Application', 'chrome.exe'));
166
- }
167
- if (process.platform === 'darwin') return ['/Applications/Google Chrome.app', path.join(os.homedir(), 'Applications', 'Google Chrome.app')];
168
- return ['/opt/google/chrome/chrome', '/usr/bin/google-chrome', '/usr/bin/google-chrome-stable'];
169
- }
170
-
171
- const printCheck = (c) => console.log(` ${c.ok ? green('✓') : red('✗')} ${c.name.padEnd(12)} ${c.detail ? dim(c.detail) : ''}${c.ok ? '' : ` → ${c.fix}`}`);
172
-
173
- // ---------- helpers ----------
174
-
175
- // Where this machine reaches an office listening on `host`: loopback for the any-address, else that address (as
176
- // server/config.ts's localAddress, which also brackets IPv6 for URLs).
177
- const localHost = (host) => (['0.0.0.0', '::', ''].includes(host) ? '127.0.0.1' : host);
178
-
179
- function portOpen(port, host) {
180
- return new Promise((resolve) => {
181
- const socket = net.connect({ port, host });
182
- const done = (open) => {
183
- socket.destroy();
184
- resolve(open);
185
- };
186
- socket.once('connect', () => done(true));
187
- socket.once('error', () => done(false));
188
- socket.setTimeout(1000, () => done(false));
189
- });
190
- }
191
-
192
- async function isOffice(url) {
193
- try {
194
- const res = await fetch(`${url}/api/state`, { signal: AbortSignal.timeout(3000) });
195
- const data = await res.json();
196
- return Array.isArray(data?.repos) && Array.isArray(data?.agents);
197
- } catch {
198
- return false;
199
- }
200
- }
201
-
202
- function openBrowser(url) {
203
- const [cmd, cmdArgs, opts] =
204
- process.platform === 'win32'
205
- ? ['cmd.exe', ['/d', '/s', '/c', `"start "" "${url}""`], { windowsVerbatimArguments: true }]
206
- : process.platform === 'darwin'
207
- ? ['open', [url], {}]
208
- : ['xdg-open', [url], {}];
209
- try {
210
- spawn(cmd, cmdArgs, { ...opts, stdio: 'ignore', detached: true, windowsHide: true })
211
- .on('error', () => undefined)
212
- .unref();
213
- } catch {
214
- // no browser to open: the URL is printed anyway
215
- }
216
- }
217
-
218
- async function checkForUpdate() {
219
- // A checkout's `npm start` runs this under scripts/office.mjs, which updates the office from its origin instead.
220
- if (process.env.CI || process.env.SWARM_LAUNCHER === '1') return;
221
- try {
222
- const res = await fetch(update.url, { signal: AbortSignal.timeout(4000) });
223
- if (!res.ok) return;
224
- const { version } = await res.json();
225
- if (typeof version === 'string' && isNewer(version, pkg.version)) {
226
- console.log(`\n Droidsembly ${version} is out (this is ${pkg.version}). Start it with ${green(update.command)} to update.\n`);
227
- }
228
- } catch {
229
- // offline, or the registry is slow: try again next time
230
- }
231
- }
232
-
233
- // ---------- commands ----------
234
-
235
- if (command === 'doctor') {
236
- console.log(`\n Droidsembly ${pkg.version}\n`);
237
- const results = checks();
238
- results.forEach(printCheck);
239
- const ok = results.every((c) => c.ok);
240
- console.log(ok ? `\n All set. Start the office with: ${update.command}\n` : '\n Claude checks apply only to Claude sessions; OpenCode and Codex use their own setup.\n');
241
- process.exit(ok ? 0 : 1);
242
- }
243
-
244
- if (command === 'login') {
245
- const claude = claudeBinary();
246
- if (!claude) fail(`Claude Code for ${process.platform}-${process.arch} is missing. Reinstall ${pkg.name}.`);
247
- console.log('\n Signing in to Claude. Your agents use this login and your subscription.\n');
248
- const res = spawnSync(claude, ['auth', 'login'], { stdio: 'inherit', env: claudeEnv() });
249
- process.exit(res.status ?? 1);
250
- }
251
-
252
- if (command !== 'start') fail(`Unknown command "${command}". Run ${update.command} --help for the options.`);
253
-
254
- const port = Number(values.port ?? process.env.SWARM_PORT ?? 4317);
255
- if (!Number.isInteger(port) || port < 0 || port > 65535) fail(`"${values.port ?? process.env.SWARM_PORT}" isn't a port number.`);
256
- const host = (values.host ?? values.bind ?? process.env.SWARM_HOST ?? '').trim().replace(/^\[|\]$/g, '') || '127.0.0.1';
257
- if (/[\s/]/.test(host)) fail(`"${host}" isn't an address to listen on. Try 0.0.0.0 (every network) or one of this machine's IPs.`);
258
- const local = localHost(host);
259
- const hostUrl = local.includes(':') ? `[${local}]` : local;
260
- const url = `http://${local === '127.0.0.1' ? 'localhost' : hostUrl}:${port}`;
261
- const demo = values.demo || process.env.SWARM_DEMO === '1' || process.env.SWARM_DEMO === 'true';
262
-
263
- // A second office on the same state would resume every agent's session a second time.
264
- if (port !== 0 && (await portOpen(port, local))) {
265
- if (!(await isOffice(`http://${hostUrl}:${port}`))) fail(`Something else is using port ${port}. Start Droidsembly on another one: ${update.command} --port 4400`);
266
- console.log(`\n Droidsembly is already running: ${url}\n`);
267
- if (!values['no-open']) openBrowser(url);
268
- process.exit(0);
269
- }
270
-
271
- if (!demo) {
272
- const problems = checks().filter((c) => !c.ok);
273
- if (problems.length) {
274
- console.log('');
275
- problems.forEach(printCheck);
276
- if (problems.some((c) => c.required)) fail('Droidsembly can’t run without these.');
277
- console.log(dim(`\n Starting anyway. Check your selected provider setup, then run: ${update.command} doctor`));
278
- }
279
- }
280
-
281
- const entry = path.join(root, 'dist-server', 'index.js');
282
- if (!fs.existsSync(entry)) fail(`${path.relative(process.cwd(), entry) || entry} is missing. In a checkout of the repo, run npm run build first.`);
283
-
284
- process.env.SWARM_PORT = String(port);
285
- process.env.SWARM_HOST = host;
286
- if (demo) process.env.SWARM_DEMO = '1';
287
- if (values.floors) process.env.SWARM_DEMO_FLOORS = values.floors;
288
- if (values.agents) process.env.SWARM_DEMO_AGENTS = values.agents;
289
- process.setSourceMapsEnabled(true);
290
- // The server loads its state, then listens.
291
- await import(pathToFileURL(entry).href);
292
-
293
- if (!values['no-open'] && port !== 0) {
294
- for (let i = 0; i < 100 && !(await portOpen(port, local)); i++) await new Promise((r) => setTimeout(r, 200));
295
- openBrowser(url);
296
- }
297
- void checkForUpdate();
2
+ // Compatibility for existing checkout launchers; keep arguments and exit status unchanged.
3
+ import './droidsembly.js';