arco-workbench 0.2.6 → 0.2.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.
Files changed (33) hide show
  1. package/client/dist/assets/{PhosphorBackdrop-YsHTmZJh.js → PhosphorBackdrop-Df7xl7fv.js} +1 -1
  2. package/client/dist/assets/{ThemedBackgroundShaderImpl-BEjpgoBW.js → ThemedBackgroundShaderImpl-HQHu9fmC.js} +1 -1
  3. package/client/dist/assets/{XtermView-wh7jNKvk.js → XtermView-BlQ7QADf.js} +1 -1
  4. package/client/dist/assets/{galleryEditor-CaOS2mmM.js → galleryEditor-Db_t1HrV.js} +1 -1
  5. package/client/dist/assets/{index-j68SfA-l.js → index-BPeBsjq5.js} +109 -109
  6. package/client/dist/index.html +1 -1
  7. package/client/src/components/UpdateAction.tsx +13 -9
  8. package/client/src/help/content/cluster.tsx +1 -1
  9. package/client/src/help/content/header.tsx +7 -7
  10. package/client/src/help/content/settings.tsx +2 -2
  11. package/client/src/help/manualSections/clusters.tsx +2 -1
  12. package/client/src/help/manualSections/maintenance.tsx +8 -12
  13. package/docs/DOCKER.md +4 -3
  14. package/docs/GLOSSARY.md +1 -1
  15. package/docs/OPERATIONS.md +31 -20
  16. package/docs/PROTOCOL_CLUSTER.md +1 -1
  17. package/docs/SETTINGS.md +8 -7
  18. package/node_modules/@arco/shared/dist/clusterCoordination.js +1 -1
  19. package/node_modules/@arco/shared/package.json +1 -1
  20. package/package.json +3 -2
  21. package/scripts/packaging/arco.mjs +17 -3
  22. package/scripts/packaging/update-process.mjs +160 -0
  23. package/scripts/packaging/update.mjs +50 -11
  24. package/server/dist/clusterDirector.js +1 -2
  25. package/server/dist/providers/claude-native/worker.js +6 -5
  26. package/server/dist/updateManager.d.ts +6 -1
  27. package/server/dist/updateManager.js +87 -20
  28. package/server/package.json +1 -1
  29. package/server/src/clusterDirector.ts +1 -2
  30. package/server/src/providers/claude-native/worker.ts +6 -5
  31. package/server/src/updateManager.ts +62 -18
  32. package/shared/dist/clusterCoordination.js +1 -1
  33. package/shared/src/clusterCoordination.ts +1 -1
@@ -9,7 +9,7 @@
9
9
  <link rel="preconnect" href="https://fonts.googleapis.com" />
10
10
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
11
11
  <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Share+Tech+Mono&display=swap" rel="stylesheet" />
12
- <script type="module" crossorigin src="/assets/index-j68SfA-l.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-BPeBsjq5.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-CVJVD2Vn.css">
14
14
  </head>
15
15
  <body>
@@ -4,7 +4,7 @@ import { confirmationSurfaceSize, WorkSurfaceControls } from './workSurface/Work
4
4
  import { useEffect, useId, useRef, useState } from 'react';
5
5
  import { useAppUpdateStore } from '../stores/appUpdateStore';
6
6
 
7
- type State = { mode: 'service' | 'foreground' | 'docker'; platform?: string; packaged?: boolean; result: { outcome: string; message?: string; attemptId?: string } | null };
7
+ type State = { mode: 'service' | 'foreground' | 'docker'; canUpdate?: boolean; platform?: string; packaged?: boolean; result: { outcome: string; message?: string; attemptId?: string } | null };
8
8
  export function UpdateAction({ latest, url, autoConfirm = false }: { latest: string | null; url: string | null; autoConfirm?: boolean }) {
9
9
  const surface = useRef<HTMLDivElement>(null);
10
10
  const [state, setState] = useState<State | null>(null);
@@ -14,11 +14,11 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
14
14
  const [pending, setPending] = useState(false);
15
15
  const [message, setMessage] = useState('');
16
16
  const [resultMessage, setResultMessage] = useState('');
17
- const [fallback, setFallback] = useState(false);
18
17
  const resultSurfaceId = useId();
19
18
  const ownsResult = useAppUpdateStore((s) => s.resultSurfaces[0] === resultSurfaceId);
20
19
  const updating = useAppUpdateStore((s) => s.updating);
21
20
  const hasState = state !== null;
21
+ const canUpdate = state?.canUpdate ?? state?.mode === 'service';
22
22
  useEffect(() => {
23
23
  if (!hasState) return;
24
24
  // An open control owns the result instead of the global notice. Starting an
@@ -40,8 +40,8 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
40
40
  }, [pending]);
41
41
  const asked = useRef(false);
42
42
  useEffect(() => {
43
- if (autoConfirm && !asked.current && state?.mode === 'service' && latest) { asked.current = true; setConfirm(latest); }
44
- }, [autoConfirm, state, latest]);
43
+ if (autoConfirm && !asked.current && canUpdate && latest) { asked.current = true; setConfirm(latest); }
44
+ }, [autoConfirm, canUpdate, latest]);
45
45
  useEffect(() => {
46
46
  if (confirm !== null && confirm !== latest) setConfirm(null);
47
47
  }, [confirm, latest]);
@@ -64,7 +64,10 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
64
64
  if (next.result?.outcome === 'running') { setResultMessage(''); setPending(true); }
65
65
  else if (next.result?.outcome === 'updated' || next.result?.outcome === 'failed' || next.result?.outcome === 'unchanged') {
66
66
  if (startedAttempt.current === null || (startedAttempt.current && next.result.attemptId !== startedAttempt.current)) return;
67
- if (next.result.outcome === 'updated' && startedAttempt.current) void checkBuild();
67
+ if (next.result.outcome === 'updated' && startedAttempt.current) {
68
+ void checkBuild();
69
+ void useAppUpdateStore.getState().refresh().catch(() => {});
70
+ }
68
71
  startedAttempt.current = undefined;
69
72
  useAppUpdateStore.getState().setUpdating(false);
70
73
  setPending(false); setMessage(''); setResultMessage(next.result.message || (next.result.outcome === 'updated' ? 'Update complete.' : next.result.outcome === 'unchanged' ? 'Already on the newest release.' : 'Update failed.'));
@@ -83,13 +86,13 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
83
86
  const start = async () => {
84
87
  useAppUpdateStore.getState().showResultAt(resultSurfaceId, true);
85
88
  startedAttempt.current = null;
86
- setConfirm(null); setPending(true); setFallback(false); setResultMessage(''); setMessage('Starting update. Arco will reconnect after restart.');
89
+ setConfirm(null); setPending(true); setResultMessage(''); setMessage('Starting update. Arco will reconnect after restart.');
87
90
  try {
88
91
  const response = await fetch('/api/update-manager', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ expectedLatest: latest }) });
89
92
  const result = await response.json();
90
93
  if (!response.ok) throw new Error(result.error || 'Could not start update.');
91
94
  startedAttempt.current = typeof result.attemptId === 'string' ? result.attemptId : undefined;
92
- } catch (error) { startedAttempt.current = undefined; setPending(false); setFallback(true); setMessage(error instanceof Error ? error.message : 'Could not start update.'); }
95
+ } catch (error) { startedAttempt.current = undefined; setPending(false); setMessage(error instanceof Error ? error.message : 'Could not start update.'); }
93
96
  };
94
97
  if (pending || updating) return <div data-help="settings.update-action" style={{ marginTop: 8 }}>
95
98
  <div role="status">{message || 'Update in progress. Arco will reconnect after restart.'}</div>
@@ -110,13 +113,14 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
110
113
  void navigator.clipboard.writeText(value).then(() => setMessage('Command copied.'), () => setMessage('Could not copy the command.'));
111
114
  };
112
115
  return <div data-help="settings.update-action" style={{ marginTop: 8 }}>
113
- {state.mode === 'service' && latest ? <button type="button" disabled={pending} onClick={() => setConfirm(latest)}>UPDATE AND RESTART</button> : <>
116
+ {canUpdate && latest && <button type="button" disabled={pending} onClick={() => setConfirm(latest)}>UPDATE AND RESTART</button>}
117
+ {!canUpdate && <>
118
+ {state.mode === 'docker' && <p>Update this deployment from its container host.</p>}
114
119
  {state.mode === 'foreground' && state.platform === 'win32' && <div>Stop Arco before updating, then run {state.packaged ? 'arco start' : 'npm start'}.</div>}
115
120
  {state.mode === 'foreground' && state.platform === 'darwin' && <div>Restart the foreground process or the configured launchd job after updating.</div>}
116
121
  {command ? <><code>{command}</code>{' '}
117
122
  <button type="button" onClick={() => copy(command)}>COPY COMMAND</button>{powershellCommand && <button type="button" onClick={() => copy(powershellCommand)}>COPY POWERSHELL COMMAND</button>}</> : <span>Check for a release to get the Docker update command.</span>}
118
123
  </>}
119
- {fallback && <div><code>{state.packaged ? 'arco update' : 'npm run arco:update'}</code>{' '}<button type="button" onClick={() => copy(state.packaged ? 'arco update' : 'npm run arco:update')}>COPY COMMAND</button></div>}
120
124
  {message && <div role="status">{message}</div>}
121
125
  {ownsResult && resultMessage && <div role="status">{resultMessage}</div>}
122
126
  {confirm !== null && confirm === latest && createPortal(<div role="dialog" aria-modal="true" aria-label="Confirm update" style={{ position: 'fixed', inset: 0, zIndex: 10000, background: 'rgba(0,0,0,.6)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
@@ -647,7 +647,7 @@ export const clusterHelp: Record<string, HelpEntry> = {
647
647
  },
648
648
  'cluster.right-panel.role-set': {
649
649
  title: 'Set role',
650
- body: <><p>Opens the role list: DIRECTOR, BUILDER, REVIEWER, RESEARCHER, TESTER, DOCUMENTER, ADVISOR and DESIGNER, plus CLEAR and CUSTOM. The current role is highlighted. ADVISOR gives a second opinion on request, states uncertainty, changes no files, assigns no work and lands nothing. DESIGNER designs screens, states, wording and accessibility, prototypes and reviews UI; builders implement it. Both report via peer_send. When an Advisor is present, the Director consults it before a design decision or when evidence is thin; the Director keeps the decision. These hints guide the agent and do not enforce file access.</p><p>A bare filename in a cluster conversation also searches member artifacts when the project and current member have no match. The viewer names the owner, offers a choice for several matches, or names the folders searched.</p><p>The Director reads the diff and checks that project-required checks ran, without inventing a gate or permanent incident rule. Before blocking work, it states what a user would lose. A cluster may have only one director, so director choices are unavailable, with the reason shown, while another member holds that role.</p><p>Standard LM Studio, Strata and DeepSeek members receive their assigned role and shared plan. Blind members retain restricted context without the shared plan.</p></>,
650
+ body: <><p>Opens the role list: DIRECTOR, BUILDER, REVIEWER, RESEARCHER, TESTER, DOCUMENTER, ADVISOR and DESIGNER, plus CLEAR and CUSTOM. The current role is highlighted. ADVISOR gives a second opinion on request, states uncertainty, changes no files, assigns no work and lands nothing. DESIGNER designs screens, states, wording and accessibility, prototypes and reviews UI; builders implement it. Both report via peer_send. When an Advisor is present, the Director consults it before a design decision or when evidence is thin; the Director keeps the decision. These hints guide the agent and do not enforce file access.</p><p>A bare filename in a cluster conversation also searches member artifacts when the project and current member have no match. The viewer names the owner, offers a choice for several matches, or names the folders searched.</p><p>The Director reads the diff and checks that project-required checks ran, without inventing a gate or permanent incident rule. Before blocking work, it states what a user would lose.</p><p>Set how the Director should handle long checks and when to end its turn in the project instructions or give those directions in chat. A cluster may have only one director, so director choices are unavailable, with the reason shown, while another member holds that role.</p><p>Standard LM Studio, Strata and DeepSeek members receive their assigned role and shared plan. Blind members retain restricted context without the shared plan.</p></>,
651
651
  manualSection: 'cluster-roles',
652
652
  },
653
653
  'cluster.right-panel.role-preset': {
@@ -462,8 +462,7 @@ export const headerHelp: Record<string, HelpEntry> = {
462
462
  notice only hides the notice.
463
463
  </p>
464
464
  <p>
465
- Click it with an update available to open the Confirm update dialog
466
- (or the copyable command on installs that cannot update themselves).
465
+ Click it with an update available to open the update controls.
467
466
  Otherwise it opens the running and latest known version, the last
468
467
  check time, <C>CHECK NOW</C>, a release-notes link and a link to
469
468
  Settings &gt; Advanced &gt; CLI and runtime versions. While an update
@@ -471,11 +470,12 @@ export const headerHelp: Record<string, HelpEntry> = {
471
470
  appears here; select <C>UPDATE AND RESTART</C> to open confirmation.
472
471
  Packaged installs check npm. Source and Docker installs check GitHub.
473
472
  A failed check marks any previous release as stale. Use <C>CHECK NOW</C>{' '}
474
- to retry. If the install mode cannot be checked, use RETRY or open
475
- Update instructions for the actual installation. For an npm install,
476
- finish active turns and run <C>arco update</C> in a separate terminal
477
- on the Arco host; follow its restart instructions. A package download
478
- failure leaves Arco running.
473
+ to retry. If the install mode cannot be checked, use <C>RETRY</C> or
474
+ open Update instructions.
475
+ Global npm installs offer the action when launched through <C>arco start</C>
476
+ or the per-user service. A package download failure leaves Arco
477
+ running. After reconnect, check the running version here. Other
478
+ launch modes show a command to copy for the host.
479
479
  With release checks off it shows the
480
480
  running version only.
481
481
  </p>
@@ -606,7 +606,7 @@ export const settingsHelp: Record<string, HelpEntry> = {
606
606
  'settings.update-action': {
607
607
  title: 'Update Arco',
608
608
  manualSection: 'arco-updates',
609
- body: <p>In a packaged user service on Linux, macOS or Windows, or a Linux source user service, confirm UPDATE AND RESTART to install the newest release. Packaged services download the archive before stopping running turns. After restart, a page without unsaved work reloads automatically when needed; otherwise RELOAD stays available. On Windows, an update stops only the matching service command and home configuration, and refuses to proceed if the stop cannot be verified. Other run modes show a command to copy and run in a terminal. If the install mode cannot be checked, use RETRY. For an npm install, finish active turns and run <code>arco update</code> in a separate terminal on the Arco host; follow the restart instructions. For other installs, open Update instructions.</p>,
609
+ body: <p>In a global npm install launched through arco start or the per-user service on Linux, macOS or Windows, confirm UPDATE AND RESTART to install the newest release. The updater stages and checks the package before stopping running turns. After restart, check the running version. A page without unsaved work reloads automatically when needed; otherwise RELOAD stays available. Linux source user services also offer the action. Other launch modes show a command to copy for the host. If Arco cannot check the install mode, use RETRY or open Update instructions.</p>,
610
610
  },
611
611
  'settings.update-result': {
612
612
  title: 'Update result',
@@ -616,7 +616,7 @@ export const settingsHelp: Record<string, HelpEntry> = {
616
616
  'settings.app-updates': {
617
617
  title: 'Arco releases',
618
618
  manualSection: 'arco-updates',
619
- body: <p>Shows the running version and latest release. CHECK NOW refreshes release information. Packaged installs check npm. Source and Docker installs check GitHub. A failed check identifies the source and marks any previous release as stale. Use CHECK NOW to retry. Check for new releases controls the automatic check; ARCO_UPDATE_CHECK=0 overrides it. UPDATE AND RESTART is available in packaged user services on Linux, macOS and Windows and in Linux source user services after confirmation; other run modes show a copyable command. No update runs automatically.</p>,
619
+ body: <p>Shows the running version and latest release. CHECK NOW refreshes release information. Packaged installs check npm. Source and Docker installs check GitHub. A failed check identifies the source and marks any previous release as stale. Use CHECK NOW to retry. Check for new releases controls the automatic check; ARCO_UPDATE_CHECK=0 overrides it. UPDATE AND RESTART is available after confirmation for global npm installs using arco start or the per-user service on Linux, macOS and Windows, and for Linux source user services. No update runs automatically.</p>,
620
620
  },
621
621
  'settings.app-window-browser': {
622
622
  title: 'App window browser',
@@ -1226,7 +1226,8 @@ export const clusters: Section[] = [
1226
1226
  requested review and landing review stay unchanged.
1227
1227
  </p>
1228
1228
  <p>
1229
- The Director keeps waits under 60 seconds and delegates long checks.
1229
+ The Director stays available and follows operator and project instructions
1230
+ on how to handle long checks and when to end the turn.
1230
1231
  Other members and standalone agents wait for results their reports need,
1231
1232
  in steps of at most 120 seconds, repeated as needed. Between waits,
1232
1233
  members check peer mail and act on it. They report when the result arrives.
@@ -224,11 +224,8 @@ export const maintenance: Section[] = [
224
224
  Use CHECK NOW to retry.
225
225
  </p>
226
226
  <p>
227
- If the install mode cannot be checked, use RETRY. For an npm install, finish
228
- active turns, run <Code>arco update</Code> in a separate terminal on the Arco
229
- host, then follow its restart instructions. For source or Docker, open Update
230
- instructions and follow the steps for the actual installation.
231
- The automatic restart action appears only after the mode is known.
227
+ If the install mode cannot be checked, use RETRY or open Update instructions.
228
+ After reconnect, open the version box to check the running release.
232
229
  </p>
233
230
  <Sub>Settings row and automatic checks</Sub>
234
231
  <p>
@@ -250,17 +247,16 @@ export const maintenance: Section[] = [
250
247
  <Table
251
248
  headers={['Install mode', 'Update action']}
252
249
  rows={[
253
- ['Packaged user service on Linux, macOS or Windows', <><strong>UPDATE AND RESTART</strong> after confirmation</>],
250
+ ['Global npm install using arco start or the per-user service on Linux, macOS or Windows', <><strong>UPDATE AND RESTART</strong> after confirmation</>],
254
251
  ['Linux source user service', <><strong>UPDATE AND RESTART</strong> after confirmation</>],
255
- ['Other modes', 'A copyable command'],
252
+ ['Docker or other unsupported launches', 'Copy the update command and run it on the host'],
256
253
  ]}
257
254
  />
258
255
  <p>
259
- For a packaged service, the action runs the packaged{' '}
260
- <Code>arco update</Code> path. Arco downloads the exact package before stopping
261
- the service. A download failure leaves Arco running. If installation fails,
262
- Arco restores the previous package and restarts the service. If recovery fails,
263
- keep the snapshot identified in the result and follow its instructions.
256
+ For a global npm install, Arco stages and checks the exact package before
257
+ stopping. A download failure leaves Arco running. If the new release cannot
258
+ start, the updater attempts to restore the previous package and restart it.
259
+ If neither release starts, recovery needs access to the host.
264
260
  </p>
265
261
  <p>
266
262
  Do not start or restart Arco while an update runs. On Linux this cancels the
package/docs/DOCKER.md CHANGED
@@ -274,9 +274,10 @@ docker compose up -d --build
274
274
  ```
275
275
 
276
276
  Updates interrupt active turns; keep the existing volume and project mounts.
277
- Arco's own update action does not replace a container: in Docker it shows these
278
- host commands for the newest release tag (COPY COMMAND, COPY POWERSHELL
279
- COMMAND) instead, and the update script refuses to run inside the container.
277
+ The browser cannot replace the container. **COPY COMMAND** and
278
+ **COPY POWERSHELL COMMAND** give the commands for the newest release tag.
279
+ Run them on the container host. The update script refuses to run inside
280
+ the container.
280
281
 
281
282
  ### Verification smoke
282
283
 
package/docs/GLOSSARY.md CHANGED
@@ -79,7 +79,7 @@ Also: **inline artifact** - fenced `arco-artifact` blocks the primary emits duri
79
79
 
80
80
  **Designer** - A cluster role responsible for how screens look and read, including layout, states, wording and accessibility. It prototypes and reviews UI; builders implement the screens.
81
81
 
82
- **Director** - A cluster member whose role hint is `DIRECTOR` (one of the eight canonical `clusterRolePresets`; roles beginning with Director or Coordinator also count). By convention, the director owns the task graph: it creates and links tasks, assigns workers, monitors progress, and reads synthesis results. The director contract also requires staying available to the operator: hand the project's checks to the Tester (or a Builder when there is no Tester), hand CI watching to the change's author, and never sleep or poll inside a turn for more than 60 seconds. A cluster may have at most one director; create, role change, replace and preset save refuse a second. The Director reads the diff and checks that project-required checks ran, without inventing gates or permanent rules from one-off incidents. Before blocking work, the Director states what a user would lose. The role remains a system-prompt hint for day-to-day behavior, and a met sign-off closes a task when Board auto-done is on, while direct terminal status changes remain operator-only. See `docs/PROTOCOL_CLUSTER.md`.
82
+ **Director** - A cluster member whose role hint is `DIRECTOR` (one of the eight canonical `clusterRolePresets`; roles beginning with Director or Coordinator also count). By convention, the director owns the task graph: it creates and links tasks, assigns workers, monitors progress, and reads synthesis results. The Director stays available to the operator and follows operator and project instructions on waiting for long checks, handing them off, and ending the turn. A cluster may have at most one director; create, role change, replace and preset save refuse a second. The Director reads the diff and checks that project-required checks ran, without inventing gates or permanent rules from one-off incidents. Before blocking work, the Director states what a user would lose. The role remains a system-prompt hint for day-to-day behavior, and a met sign-off closes a task when Board auto-done is on, while direct terminal status changes remain operator-only. See `docs/PROTOCOL_CLUSTER.md`.
83
83
 
84
84
  **Dispatcher** - The operator-armed server-side daemon (`server/src/taskDispatcher.ts`) that deterministically assigns `ready` tasks to idle cluster members. Two modes: `cluster_dispatch_once` (one-shot sweep) and an armed daemon (persistent, toggled via `cluster_dispatch_toggle`). Eligibility: task status `ready`, no open run at the per-member cap, matching member capability. Creates a claim + run before firing the synthetic worker turn. Default OFF; persisted in cluster meta; no double-dispatch on server restart.
85
85
 
@@ -240,11 +240,9 @@ an up arrow and the new version, stays that way after the toast is dismissed,
240
240
  opens the update dialog on click, and shows UPDATING while an update runs.
241
241
  A release found by CHECK NOW appears in the version box; select UPDATE AND
242
242
  RESTART to open its confirmation. If Arco cannot determine the install mode,
243
- select **RETRY**. For an npm installation, finish active turns, run
244
- `arco update` from a separate terminal on the Arco host, and follow the restart
245
- instructions. For source or Docker installations, open **Update instructions**
246
- and follow the steps for the actual installation. Arco does not offer an automatic restart until the mode
247
- is known.
243
+ select **RETRY** or open **Update instructions** for the installation in use.
244
+ The browser offers an update once it identifies a supported running
245
+ installation. Other launch modes show the existing host commands.
248
246
 
249
247
  ### Packaged install
250
248
 
@@ -262,23 +260,36 @@ arco update
262
260
  The command installs the latest stable package. It refuses linked checkouts and
263
261
  downgrades, snapshots the existing package for rollback, and stops the service
264
262
  before replacement. Stopping first is required on Windows because loaded native
265
- modules cannot be replaced safely. A packaged service can instead use
266
- **UPDATE AND RESTART** from the version box, the release toast, or Settings on
267
- Linux, macOS, and Windows. The action interrupts running turns and reports
268
- completion or rollback after reconnect.
263
+ modules cannot be replaced safely. With a global npm install, use
264
+ **UPDATE AND RESTART** from the version box, the release toast, or Settings
265
+ when Arco runs as its per-user service or through `arco start` on Linux, macOS,
266
+ or Windows. Confirmation names the release and warns that running turns stop.
267
+ The updater keeps the Arco home and address and restarts through the same
268
+ service or the npm launcher. After a foreground update, the replacement
269
+ process continues outside the original terminal. After reconnect, open the
270
+ version box to see the running release.
271
+
272
+ An older packaged service that already offers **UPDATE AND RESTART** can use
273
+ that action to install the first release with foreground updates. A foreground
274
+ process running v0.2.6 or earlier has no GUI action that can install the new
275
+ updater. Its existing maintenance path must be used once. The browser also
276
+ does not update npm exec caches, project-local packages, linked installs or
277
+ custom supervisors.
269
278
 
270
279
  Packaged installs check npm's public latest version. The release notes link
271
280
  opens the matching GitHub tag. If a check fails, the version box and Settings
272
281
  identify the source that could not be checked and mark any previous release as
273
282
  stale. Use **CHECK NOW** to retry. The updater checks npm again before
274
283
  downloading. If the latest version has changed, confirm the new version first.
275
- The updater downloads the exact package archive before it stops the service.
276
- A download failure leaves Arco running and can be retried. Installation uses the
277
- downloaded archive. npm can still fetch missing dependencies during installation.
278
-
279
- If installation fails, the updater restores the previous package and restarts
280
- the service. If recovery fails, follow the result message and keep the previous
281
- package snapshot it identifies. This snapshot covers the installed program.
284
+ The GUI updater stages the exact package and checks its native runtime before
285
+ stopping Arco. A download failure leaves Arco running and can be retried.
286
+ Installation uses the downloaded archive.
287
+
288
+ If installation fails or the replacement does not become ready on the original
289
+ address, the GUI updater attempts to restore and restart the previous package.
290
+ It waits for the managed replacement to exit before restoring files. It keeps
291
+ the snapshot if it cannot confirm the exit. If both releases fail to start,
292
+ recovery needs access to the host. The snapshot covers the program.
282
293
  Arco's saved data stays in its existing home. Source and Docker installs
283
294
  continue to follow GitHub releases.
284
295
 
@@ -439,10 +450,10 @@ npm run arco:update -- --ref v1.2.3
439
450
 
440
451
  Settings > Advanced > CLI and runtime versions and the release toast also offer
441
452
  **UPDATE AND RESTART** for a Linux source user service. Confirmation names the
442
- release, links its notes and warns that running turns stop. Other source run
443
- modes show a copyable command. The browser can only request the newest release;
444
- selecting a commit is a terminal operation. If a separate service cannot be
445
- launched, use the terminal command.
453
+ release, links its notes and warns that running turns stop. Source foreground
454
+ and custom supervised launches still need their host-side update procedure.
455
+ The browser can only request the newest release. Selecting a commit is a
456
+ terminal operation.
446
457
 
447
458
  ### Docker
448
459
 
@@ -484,7 +484,7 @@ Operator edited a member's work-size hint from the Members sub-tab. `tier` is on
484
484
 
485
485
  ### `cluster_efficiency_set` ->
486
486
 
487
- Efficiency guides coordination and testing. Balanced, the default for new clusters, asks for one lowest-level test per real fault, tests for the changed area per change, and the full check once before a release. Browser tests cover journeys that need a real screen, one per journey rather than layout, theme or size permutations. New suites, gates, test tooling and CI checks need operator approval, using the operator-question tool where available. The full check should take about ten minutes; longer runs prompt a proposal to cut work before adding tests. Flaky tests are fixed or deleted, not retried. Lean runs only changed-area tests and adds tests only for faults found; the full check runs only when requested. Thorough tests new behaviour and faults, runs neighbouring tests and the full check before handover. Every level sorts product faults from test faults and states what a user would lose before a failure blocks work; product faults and faulty tests are fixed, while cosmetic or momentary faults are noted. Project rules and plans take precedence over these instructions for testing, commits, documentation and delivery alike. Safety checks, message guards, requested review and landing review remain unchanged. Supported members receive the testing directive each turn; Antigravity CLI receives the operator-visible instructions described under Gemini members. Directors assign complete outcomes, read the accepted diff and check that project-required checks ran; they do not invent gates or make one-off incidents into permanent rules or tests without the operator. Directors classify each failed check as a product fault or a fault in a test, housekeeping rule or CI service. Product faults are fixed. Faulty tests or rules are fixed, skipped on that system with a stated reason, or deleted so checks go green and can be trusted; red checks are neither ignored nor released over. A job dropped by the CI service is rerun alone. CI stays small enough to pass in one run and contains checks whose failures tell the operator something about the product. Housekeeping findings warn instead of failing a run. Peers report what was done, what ran and what remains uncovered. Before reporting work as done, a member checks it against the project's own rules (agent instructions and contributing rules: how commits land, changelog, documentation) and, where an assignment conflicts with them, follows the project's rules and says so. A Director never assigns what the project's rules forbid; it states the delivery they require and asks the operator before any exception. The Tester runs project checks and tests peer work where a real fault is likely, modifying test files only. Long checks go to peers; Directors never run builds, tests or CI waits themselves or wait more than 60 seconds inside a turn. Nudges, mail notices and auto-pickup follow the testing directive without adding checks.
487
+ Efficiency guides coordination and testing. Balanced, the default for new clusters, asks for one lowest-level test per real fault, tests for the changed area per change, and the full check once before a release. Browser tests cover journeys that need a real screen, one per journey rather than layout, theme or size permutations. New suites, gates, test tooling and CI checks need operator approval, using the operator-question tool where available. The full check should take about ten minutes; longer runs prompt a proposal to cut work before adding tests. Flaky tests are fixed or deleted, not retried. Lean runs only changed-area tests and adds tests only for faults found; the full check runs only when requested. Thorough tests new behaviour and faults, runs neighbouring tests and the full check before handover. Every level sorts product faults from test faults and states what a user would lose before a failure blocks work; product faults and faulty tests are fixed, while cosmetic or momentary faults are noted. Project rules and plans take precedence over these instructions for testing, commits, documentation and delivery alike. Safety checks, message guards, requested review and landing review remain unchanged. Supported members receive the testing directive each turn; Antigravity CLI receives the operator-visible instructions described under Gemini members. Directors assign complete outcomes, read the accepted diff and check that project-required checks ran; they do not invent gates or make one-off incidents into permanent rules or tests without the operator. Directors classify each failed check as a product fault or a fault in a test, housekeeping rule or CI service. Product faults are fixed. Faulty tests or rules are fixed, skipped on that system with a stated reason, or deleted so checks go green and can be trusted; red checks are neither ignored nor released over. A job dropped by the CI service is rerun alone. CI stays small enough to pass in one run and contains checks whose failures tell the operator something about the product. Housekeeping findings warn instead of failing a run. Peers report what was done, what ran and what remains uncovered. Before reporting work as done, a member checks it against the project's own rules (agent instructions and contributing rules: how commits land, changelog, documentation) and, where an assignment conflicts with them, follows the project's rules and says so. A Director never assigns what the project's rules forbid; it states the delivery they require and asks the operator before any exception. The Tester runs project checks and tests peer work where a real fault is likely, modifying test files only. Directors stay responsive and follow operator and project instructions on long checks and when to end a turn. They may wait for results, hand off checks, or continue other approved work as the workflow requires. Nudges, mail notices and auto-pickup follow the testing directive without adding checks.
488
488
 
489
489
  Non-Director members and standalone agents wait inside their turns for build, test or CI results needed by their reports. Each command or polling step lasts at most 120 seconds and may be repeated as long as the job needs. Between waits they check and act on new messages, using `peer_read` in a cluster. They report after the result arrives. After a progress report or an answer while assigned work remains, non-Director members and standalone agents continue that work in the same turn; they end the turn only when it is done or with one stated blocker. If blocked or if a job clearly cannot finish within a reasonable time, they name what they await and say that a nudge is needed before ending the turn. This instruction change adds no completion wake or waiting-status display. The provider prompt supplies the wait rule once. Cluster coordination and the Director contract do not repeat it. Local-provider baselines stay role-neutral until turn preparation or handoff prewarm resolves the member role.
490
490
 
package/docs/SETTINGS.md CHANGED
@@ -142,13 +142,14 @@ The release toast provides **OPEN RELEASE**, the update action and **DISMISS**.
142
142
  Dismissal saves `updateCheckDismissed` for that version globally and survives
143
143
  reloads; a newer version can notify again. The checkbox saves `updateCheck`.
144
144
  The server first checks 30 seconds after boot, then every six hours. It never
145
- downloads or installs updates automatically. Packaged services on Linux, macOS,
146
- and Windows offer **UPDATE AND RESTART** from the version box, toast, or Settings
147
- when npm reports a newer stable version. The updater rechecks the target and
148
- downloads the exact package before stopping the service. If the download fails, Arco stays running.
149
- If installation fails, the result reports whether the old package and service
150
- were restored. Linux source user services offer the same action. Other run
151
- modes show a copyable command.
145
+ downloads or installs updates automatically. Global npm installs on Linux,
146
+ macOS and Windows offer **UPDATE AND RESTART** through `arco start` or the
147
+ per-user service when npm reports a newer stable version. The updater stages
148
+ and checks the exact package before stopping Arco. After reconnect, the
149
+ version box shows the running version. If startup fails, the package updater
150
+ attempts to restore the previous release. Linux source user services also
151
+ offer **UPDATE AND RESTART**. Other launch modes show a copyable update
152
+ command for the host.
152
153
 
153
154
  ### Project location migration
154
155
 
@@ -1,7 +1,7 @@
1
1
  // Shared deterministic coordination wording for worker prompts and operator nudges.
2
2
  import { CLUSTER_EFFICIENCY_ADDENDUM_MAX } from './protocol/clusters.js';
3
3
  export const isClusterDirector = (role) => /^\s*(?:director|coordinator)\b/i.test(role ?? '');
4
- const DIRECTOR_TURN_WAIT = 'Do not wait inside a turn for long-running checks: never sleep or poll for more than 60 seconds at a time. Start long runs in the background or hand them off, report what is running, and end the turn.';
4
+ const DIRECTOR_TURN_WAIT = 'For Directors and Coordinators: stay available to the operator. Follow operator and project instructions on long checks and when to end the turn.';
5
5
  export const AGENT_TURN_WAIT = 'For standalone agents and non-Director cluster members: when a report depends on a build, test run or CI result, wait inside the turn in steps of at most 120 seconds each, repeated as many times as the job needs. Use a foreground command within the tool timeout or check a background run between steps. Between waits, check for new messages (peer_read in a cluster) and act on them. Report when the result is in. End the turn early only when blocked or when the job clearly cannot finish within a reasonable time; then state in one line what you are waiting on and that you need a nudge. When you report progress or answer a question while assigned work is unfinished, continue that work in the same turn; end the turn only when it is done or with one stated blocker.';
6
6
  /** Blocked reasons that ask the operator (not a peer) for a decision or action.
7
7
  * Shared by the board's BLOCKED badge and the Director's open-work block so
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arco/shared",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "node-pty": "1.1.0"
5
5
  },
6
6
  "name": "arco-workbench",
7
- "version": "0.2.6",
7
+ "version": "0.2.7",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/ghreprimand/arco.git"
@@ -39,6 +39,7 @@
39
39
  "scripts/packaging/service-logs.mjs",
40
40
  "scripts/packaging/native-repair.mjs",
41
41
  "scripts/packaging/update.mjs",
42
+ "scripts/packaging/update-process.mjs",
42
43
  "scripts/packaging/storage.mjs",
43
44
  "native",
44
45
  "LICENSE"
@@ -67,7 +68,7 @@
67
68
  "word-extractor": "1.0.4",
68
69
  "ws": "8.22.0",
69
70
  "xlsx": "0.20.3",
70
- "@arco/shared": "0.2.6"
71
+ "@arco/shared": "0.2.7"
71
72
  },
72
73
  "bundleDependencies": [
73
74
  "@arco/shared",
@@ -158,13 +158,26 @@ async function main() {
158
158
  return;
159
159
  }
160
160
  if (command === 'package-update') {
161
- const [expected, resultFile, task, attemptId] = args;
161
+ const [expected, resultFile, task, attemptId, runningPid, runningVersion, port, host] = args;
162
162
  if (!/^v\d+\.\d+\.\d+$/.test(expected || '') || !resultFile || basename(resultFile) !== 'update-result.json' || resolve(resultFile) !== resultFile || !/^[a-f0-9-]{36}$/.test(attemptId || '')) throw new Error('Invalid package update request.');
163
163
  const writeResult = (result) => writeUpdateResult(resultFile, attemptId, result);
164
164
  process.env.ARCO_HOME = dirname(resultFile);
165
- await new Promise((resolve) => setTimeout(resolve, 1500));
166
165
  try {
167
- const result = await updatePackage(manifest, root, { expected });
166
+ const attempt = JSON.parse(readFileSync(resultFile, 'utf8'));
167
+ if (attempt.attemptId !== attemptId || attempt.outcome !== 'running' || attempt.target !== expected) throw new Error('The update request is no longer active.');
168
+ let result;
169
+ if (runningPid) {
170
+ if (attempt.fromVersion !== runningVersion || !port || !host) throw new Error('Invalid running installation details.');
171
+ process.env.ARCO_PORT = port;
172
+ process.env.ARCO_HOST = host;
173
+ const { updateRunningPackage } = await import('./update-process.mjs');
174
+ const checkStagedNative = (entry) => {
175
+ const probe = spawnSync(process.execPath, [entry, 'package-check-native'], { timeout: 15_000, stdio: 'ignore', windowsHide: true });
176
+ if (probe.error || probe.status !== 0) throw new Error('The installed release failed the native runtime check.');
177
+ };
178
+ result = await updateRunningPackage({ root, manifest, expected, pid: Number(runningPid), runningVersion,
179
+ managed: Boolean(task), checkNative: checkStagedNative, service: serviceAction });
180
+ } else result = await updatePackage(manifest, root, { expected });
168
181
  writeResult(result);
169
182
  } catch (error) {
170
183
  try { writeResult({ outcome: 'failed', message: error instanceof Error ? error.message : String(error) }); } catch { /* retain diagnostics if the result cannot be written */ }
@@ -177,6 +190,7 @@ async function main() {
177
190
  }
178
191
  return;
179
192
  }
193
+ if (command === 'package-check-native') { requireSupportedNode(); checkNative(); return; }
180
194
  if (command === 'update') { if (args.length) throw new Error('arco update takes no arguments.'); const result = await updatePackage(manifest, root); console.log(result.message); return; }
181
195
  throw new Error(`Unknown command: ${command}. Run arco --help.`);
182
196
  }
@@ -0,0 +1,160 @@
1
+ import { spawn, spawnSync } from 'node:child_process';
2
+ import { join } from 'node:path';
3
+ import { setTimeout as delay } from 'node:timers/promises';
4
+ import { browserHost, homeFingerprint } from './ports.mjs';
5
+ import { updatePackage, verifiedPackagePrefix, waitForRecordedPid } from './update.mjs';
6
+ import { readWindowsServicePid, servicePaths } from './services.mjs';
7
+
8
+ const timeout = 45_000;
9
+
10
+ // A supervisor may acknowledge stop before the process releases package files.
11
+ // Zero means the supervisor reports no running process. An unknown owner or a
12
+ // different process leaves the snapshot in place for recovery.
13
+ export async function stopManagedReplacement(originalPid, observedPid, { servicePid, stop, waitForPid }) {
14
+ const currentPid = servicePid();
15
+ if (!Number.isSafeInteger(currentPid) || currentPid < 0 || currentPid === originalPid
16
+ || (observedPid && currentPid > 0 && currentPid !== observedPid)) return false;
17
+ if (currentPid > 0) await stop();
18
+ const stoppingPid = currentPid || observedPid;
19
+ if (stoppingPid && await waitForPid(stoppingPid)) return false;
20
+ return servicePid() === 0;
21
+ }
22
+
23
+ export async function updateRunningPackage({ root, manifest, expected, pid, runningVersion, managed, checkNative, service }) {
24
+ const home = process.env.ARCO_HOME;
25
+ const port = Number(process.env.ARCO_PORT);
26
+ if (!Number.isInteger(pid) || pid <= 0 || !Number.isInteger(port) || port < 1 || port > 65535) {
27
+ throw new Error('Could not identify the running Arco installation.');
28
+ }
29
+ const prefix = verifiedPackagePrefix(root);
30
+ const base = `http://${browserHost(process.env.ARCO_HOST || '127.0.0.1')}:${port}`;
31
+ const env = { ...process.env };
32
+ const fingerprint = homeFingerprint(home);
33
+ const rootFingerprint = homeFingerprint(root);
34
+ const cli = join(root, 'scripts', 'packaging', 'arco.mjs');
35
+ if (!managed && !process.connected) throw new Error('The updater is not connected to the running Arco process.');
36
+
37
+ function servicePid() {
38
+ if (process.platform === 'win32') {
39
+ const recorded = readWindowsServicePid(home);
40
+ if (recorded) {
41
+ try { process.kill(recorded, 0); return recorded; }
42
+ catch (error) { if (error.code !== 'ESRCH') return null; }
43
+ }
44
+ const result = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command',
45
+ "$ErrorActionPreference='Stop'; (Get-ScheduledTask -TaskName 'arco-workbench').State.ToString()"],
46
+ { encoding: 'utf8', env, timeout: 5000, windowsHide: true });
47
+ return result.status === 0 && /^(Ready|Disabled)$/i.test((result.stdout || '').trim()) ? 0 : null;
48
+ }
49
+ if (process.platform === 'linux') {
50
+ const { unit } = servicePaths('linux', env);
51
+ const result = spawnSync('systemctl', ['--user', 'show', '-p', 'MainPID', '-p', 'FragmentPath', '-p', 'ActiveState', 'arco.service'], { encoding: 'utf8', env, timeout: 5000 });
52
+ const fields = (result.stdout || '').split('\n');
53
+ if (result.status !== 0 || !fields.includes(`FragmentPath=${unit}`)) return null;
54
+ const mainPid = Number(fields.find((field) => field.startsWith('MainPID='))?.slice('MainPID='.length));
55
+ if (mainPid > 0) return mainPid;
56
+ return mainPid === 0 && (fields.includes('ActiveState=inactive') || fields.includes('ActiveState=failed')) ? 0 : null;
57
+ }
58
+ const result = spawnSync('launchctl', ['print', `gui/${process.getuid()}/arco-workbench`], { encoding: 'utf8', env, timeout: 5000 });
59
+ const path = /^\s*path = (.+)$/m.exec(result.stdout || '')?.[1];
60
+ if (result.status !== 0 || path !== servicePaths('darwin', env).unit) return null;
61
+ const { unit } = servicePaths('darwin', env);
62
+ if (/^\s*path = (.+)$/m.exec(result.stdout)?.[1] !== unit) return null;
63
+ const serviceProcess = /^\s*pid = (\d+)\s*$/m.exec(result.stdout)?.[1];
64
+ if (serviceProcess) return Number(serviceProcess);
65
+ return /^\s*state = not running\s*$/m.test(result.stdout) ? 0 : null;
66
+ }
67
+
68
+ async function request(path) {
69
+ try {
70
+ return await fetch(base + path, { signal: AbortSignal.timeout(1000), redirect: 'error' });
71
+ } catch { return null; }
72
+ }
73
+ async function live() {
74
+ try {
75
+ const response = await request('/healthz');
76
+ const status = response?.ok ? await response.json() : null;
77
+ return status?.homeFingerprint === fingerprint && status.checkoutFingerprint === rootFingerprint ? status : null;
78
+ } catch { return null; }
79
+ }
80
+ async function waitFor(version, readPid, exited = () => false) {
81
+ const deadline = Date.now() + timeout;
82
+ while (!exited() && Date.now() < deadline) {
83
+ const status = await live();
84
+ const ownerPid = readPid();
85
+ if (status && status.pid !== pid && status.version === version && status.pid === ownerPid) {
86
+ if ((await request('/readyz'))?.ok) return;
87
+ }
88
+ await delay(250);
89
+ }
90
+ throw new Error('Arco did not become ready on the original address with the expected version.');
91
+ }
92
+ let replacementStillRunning = false;
93
+ const lifecycle = {
94
+ ownsProcess: true,
95
+ canRestore: () => !replacementStillRunning,
96
+ async stop() {
97
+ const status = await live();
98
+ if (status?.pid !== pid || status.version !== runningVersion) throw new Error('The running Arco installation changed.');
99
+ if (managed) {
100
+ if (servicePid() !== pid) throw new Error('The service manager does not own the running Arco process.');
101
+ await service('stop');
102
+ } else {
103
+ await new Promise((resolve, reject) => process.send('stop-for-update', (error) => error ? reject(error) : resolve()));
104
+ }
105
+ if (await waitForRecordedPid(pid)) throw new Error('The old Arco process is still running.');
106
+ },
107
+ async start(version) {
108
+ if (managed) {
109
+ let observedPid = null;
110
+ try {
111
+ await service('start');
112
+ await waitFor(version, () => {
113
+ const ownerPid = servicePid();
114
+ if (ownerPid > 0 && ownerPid !== pid) observedPid = ownerPid;
115
+ return ownerPid;
116
+ });
117
+ } catch (error) {
118
+ try {
119
+ replacementStillRunning = !await stopManagedReplacement(pid, observedPid, {
120
+ servicePid, stop: () => service('stop'), waitForPid: waitForRecordedPid,
121
+ });
122
+ } catch { replacementStillRunning = true; }
123
+ throw error;
124
+ }
125
+ return;
126
+ }
127
+ const child = spawn(process.execPath, [cli, 'start'], { env, cwd: home, detached: true, stdio: 'ignore', windowsHide: true });
128
+ let exited = false;
129
+ child.once('error', () => { exited = true; });
130
+ child.once('exit', () => { exited = true; });
131
+ child.unref();
132
+ try {
133
+ if (!child.pid) throw new Error('Could not start Arco on the installed release.');
134
+ await waitFor(version, () => child.pid, () => exited);
135
+ } catch (error) {
136
+ if (!exited) {
137
+ child.kill();
138
+ if (await waitForRecordedPid(child.pid)) replacementStillRunning = true;
139
+ }
140
+ throw error;
141
+ }
142
+ },
143
+ };
144
+ const status = await live();
145
+ if (status?.pid !== pid || status.version !== runningVersion) throw new Error('Could not identify the running Arco installation.');
146
+ if (expected === `v${manifest.version}` && manifest.version !== runningVersion) {
147
+ await checkNative(cli);
148
+ await lifecycle.stop();
149
+ await lifecycle.start(manifest.version);
150
+ return { outcome: 'updated', message: `Arco restarted on the installed release ${expected}.` };
151
+ }
152
+ if (manifest.version !== runningVersion) throw new Error('The package on disk has changed since Arco started.');
153
+ const prepare = async (archive, scratch, npm) => {
154
+ const stagingPrefix = join(scratch, 'staging-prefix');
155
+ npm('Could not stage the new release', ['install', '--global', '--ignore-scripts', '--no-audit', '--no-fund', '--prefix', stagingPrefix, archive], { timeout: 120_000 });
156
+ const entry = process.platform === 'win32' ? join(stagingPrefix, 'node_modules') : join(stagingPrefix, 'lib', 'node_modules');
157
+ await checkNative(join(entry, 'arco-workbench', 'scripts', 'packaging', 'arco.mjs'));
158
+ };
159
+ return updatePackage(manifest, root, { expected, home, prefix, env, managed, lifecycle, prepare });
160
+ }