arco-workbench 0.2.5 → 0.2.6

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.
@@ -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-BfPp1Oup.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-j68SfA-l.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-CVJVD2Vn.css">
14
14
  </head>
15
15
  <body>
@@ -8,6 +8,8 @@ type State = { mode: 'service' | 'foreground' | 'docker'; platform?: string; pac
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);
11
+ const [lookup, setLookup] = useState<'checking' | 'failed'>('checking');
12
+ const [retry, setRetry] = useState(0);
11
13
  const [confirm, setConfirm] = useState<string | null>(null);
12
14
  const [pending, setPending] = useState(false);
13
15
  const [message, setMessage] = useState('');
@@ -15,6 +17,7 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
15
17
  const [fallback, setFallback] = useState(false);
16
18
  const resultSurfaceId = useId();
17
19
  const ownsResult = useAppUpdateStore((s) => s.resultSurfaces[0] === resultSurfaceId);
20
+ const updating = useAppUpdateStore((s) => s.updating);
18
21
  const hasState = state !== null;
19
22
  useEffect(() => {
20
23
  if (!hasState) return;
@@ -44,27 +47,39 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
44
47
  }, [confirm, latest]);
45
48
  useEffect(() => {
46
49
  let live = true; let request = 0;
50
+ let controller: AbortController | undefined;
47
51
  const refresh = async () => {
52
+ if (controller) return;
48
53
  const sequence = ++request;
54
+ const current = new AbortController();
55
+ controller = current;
56
+ const timeout = setTimeout(() => current.abort(), 8000);
49
57
  try {
50
- const response = await fetch('/api/update-manager');
51
- if (!response.ok) return;
58
+ const response = await fetch('/api/update-manager', { signal: current.signal });
59
+ if (!response.ok) throw new Error('Install mode unavailable');
52
60
  const next = await response.json() as State;
53
- if (!live || sequence !== request || !['service', 'foreground', 'docker'].includes(next.mode)) return;
61
+ if (!live || sequence !== request) return;
62
+ if (!next || !['service', 'foreground', 'docker'].includes(next.mode)) throw new Error('Install mode unavailable');
54
63
  setState(next);
55
64
  if (next.result?.outcome === 'running') { setResultMessage(''); setPending(true); }
56
65
  else if (next.result?.outcome === 'updated' || next.result?.outcome === 'failed' || next.result?.outcome === 'unchanged') {
57
66
  if (startedAttempt.current === null || (startedAttempt.current && next.result.attemptId !== startedAttempt.current)) return;
58
67
  if (next.result.outcome === 'updated' && startedAttempt.current) void checkBuild();
59
68
  startedAttempt.current = undefined;
69
+ useAppUpdateStore.getState().setUpdating(false);
60
70
  setPending(false); setMessage(''); setResultMessage(next.result.message || (next.result.outcome === 'updated' ? 'Update complete.' : next.result.outcome === 'unchanged' ? 'Already on the newest release.' : 'Update failed.'));
61
71
  } else setResultMessage('');
62
- } catch { /* reconnect retries on the next poll */ }
72
+ } catch {
73
+ if (live && sequence === request) {
74
+ if (!pending && !useAppUpdateStore.getState().updating) setState(null);
75
+ setConfirm(null); setLookup('failed');
76
+ }
77
+ } finally { clearTimeout(timeout); if (controller === current) controller = undefined; }
63
78
  };
64
79
  void refresh();
65
80
  const timer = setInterval(() => { void refresh(); }, pending ? 2000 : 30_000);
66
- return () => { live = false; clearInterval(timer); };
67
- }, [pending]);
81
+ return () => { live = false; controller?.abort(); clearInterval(timer); };
82
+ }, [pending, retry]);
68
83
  const start = async () => {
69
84
  useAppUpdateStore.getState().showResultAt(resultSurfaceId, true);
70
85
  startedAttempt.current = null;
@@ -76,7 +91,15 @@ export function UpdateAction({ latest, url, autoConfirm = false }: { latest: str
76
91
  startedAttempt.current = typeof result.attemptId === 'string' ? result.attemptId : undefined;
77
92
  } catch (error) { startedAttempt.current = undefined; setPending(false); setFallback(true); setMessage(error instanceof Error ? error.message : 'Could not start update.'); }
78
93
  };
79
- if (!state) return null;
94
+ if (pending || updating) return <div data-help="settings.update-action" style={{ marginTop: 8 }}>
95
+ <div role="status">{message || 'Update in progress. Arco will reconnect after restart.'}</div>
96
+ </div>;
97
+ if (!state) return <div data-help="settings.update-action" style={{ marginTop: 8 }}>
98
+ <div role="status">{lookup === 'checking' ? 'Checking how Arco is installed...' : 'Could not check how Arco is installed.'}</div>
99
+ <p>If installed with npm, finish active turns, then run <code>arco update</code> in a separate terminal on the Arco host and follow its restart instructions. For other installations, see Update instructions.</p>
100
+ <button type="button" onClick={() => { setLookup('checking'); setRetry(value => value + 1); }}>RETRY</button>{' '}
101
+ <a href="https://github.com/ghreprimand/arco/blob/main/docs/OPERATIONS.md#updating-arco" target="_blank" rel="noopener noreferrer">Update instructions</a>
102
+ </div>;
80
103
  const dockerTag = latest && /^v\d+\.\d+\.\d+$/.test(latest) ? latest : null;
81
104
  const command = state.mode === 'docker'
82
105
  ? dockerTag ? `git fetch --tags origin && git checkout --detach ${dockerTag} && docker compose up -d --build` : null
@@ -471,7 +471,11 @@ export const headerHelp: Record<string, HelpEntry> = {
471
471
  appears here; select <C>UPDATE AND RESTART</C> to open confirmation.
472
472
  Packaged installs check npm. Source and Docker installs check GitHub.
473
473
  A failed check marks any previous release as stale. Use <C>CHECK NOW</C>{' '}
474
- to retry. A package download failure leaves Arco running.
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.
475
479
  With release checks off it shows the
476
480
  running version only.
477
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.</p>,
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>,
610
610
  },
611
611
  'settings.update-result': {
612
612
  title: 'Update result',
@@ -223,6 +223,13 @@ export const maintenance: Section[] = [
223
223
  lookup fails, Arco names the source and marks any previous result as stale.
224
224
  Use CHECK NOW to retry.
225
225
  </p>
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.
232
+ </p>
226
233
  <Sub>Settings row and automatic checks</Sub>
227
234
  <p>
228
235
  Settings &gt; Advanced &gt; CLI and runtime versions includes an{' '}
@@ -239,7 +239,12 @@ running version. When a newer release is known it turns into an accent box with
239
239
  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
- RESTART to open its confirmation.
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
248
 
244
249
  ### Packaged install
245
250
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arco/shared",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
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.5",
7
+ "version": "0.2.6",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/ghreprimand/arco.git"
@@ -67,7 +67,7 @@
67
67
  "word-extractor": "1.0.4",
68
68
  "ws": "8.22.0",
69
69
  "xlsx": "0.20.3",
70
- "@arco/shared": "0.2.5"
70
+ "@arco/shared": "0.2.6"
71
71
  },
72
72
  "bundleDependencies": [
73
73
  "@arco/shared",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arco/server",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }