@acryldev/blends 1.7.9 → 1.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ var packages = {
95
95
  "path": "../plugins/versions"
96
96
  },
97
97
  "@acryldev/blends-frame": {
98
- "version": "0.2.6",
98
+ "version": "0.2.8",
99
99
  "path": "../plugins/blends-frame"
100
100
  }
101
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/blends",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "description": "The Acryl web framework (import { Acryl } from \"acrylblends\") and the acrylblends command that scaffolds Cordis apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -7,7 +7,7 @@
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
9
  "@acryldev/blends-core": "0.6.0",
10
- "@acryldev/plugin-hub-core": "0.2.2"
10
+ "@acryldev/plugin-hub-core": "0.2.3"
11
11
  },
12
12
  "mount": "mount it after agent and extensions: root.plugin(builder, { dir: join(root, 'plugins') }); dir must be an extensions source",
13
13
  "entries": {
@@ -61,3 +61,11 @@ export function appendHostLog(dir: string, text: string, now: Date = new Date())
61
61
  export function hostCrashed(output: string): boolean {
62
62
  return /Failed running '/u.test(output)
63
63
  }
64
+
65
+ /**
66
+ * Whether the watcher ended or restarted the host (a saved file, or the product copying its new source in on the first start after an update): the
67
+ * host that comes back is a new process with a new process token, so a page signed in to the old one gets 401 and 404 until it loads again.
68
+ */
69
+ export function hostRestarting(output: string): boolean {
70
+ return /Completed running '|Restarting '/u.test(output)
71
+ }
@@ -29,6 +29,7 @@ import {
29
29
  import {
30
30
  type FrameHost,
31
31
  type HostEnd,
32
+ hostAddress,
32
33
  isFrameApp,
33
34
  navigation,
34
35
  openFrameSettings,
@@ -37,7 +38,7 @@ import {
37
38
  withoutToken,
38
39
  } from './frame.ts'
39
40
  import { productGit, withGitFirst } from './git.ts'
40
- import { appendHostLog, hostCrashed, nextRestart } from './host-supervisor.ts'
41
+ import { appendHostLog, hostCrashed, hostRestarting, nextRestart } from './host-supervisor.ts'
41
42
  import { hasSettings, settingsPlacement } from './menu.ts'
42
43
  import { openProductApp, seedSource } from './product.ts'
43
44
  import { createDesktopShutdown, installShutdownRequests } from './shutdown.ts'
@@ -178,6 +179,19 @@ if (!app.requestSingleInstanceLock()) {
178
179
  process.stdout.write(text)
179
180
  // The watcher that runs the host stays alive when the host crashes (it waits for a saved file): that line is the death.
180
181
  recent = (recent + text).slice(-3000)
182
+ // The watcher brought the host back as a new process: the windows sign in to it again, or every call they make answers 401.
183
+ if (serving && hostRestarting(text)) restarting = true
184
+ const again = restarting ? hostAddress(text) : undefined
185
+ if (again !== undefined) {
186
+ restarting = false
187
+ for (const shown of BrowserWindow.getAllWindows())
188
+ if (!shown.isDestroyed())
189
+ shown.loadURL(again).catch((cause: unknown) => {
190
+ console.warn(
191
+ `desktop: the window could not load the restarted host: ${cause instanceof Error ? cause.message : String(cause)}`,
192
+ )
193
+ })
194
+ }
181
195
  if (serving && hostCrashed(text))
182
196
  void started.stop().then(() => recover(started, crashedEnd(recent)))
183
197
  },
@@ -188,6 +202,7 @@ if (!app.requestSingleInstanceLock()) {
188
202
  host = started
189
203
  let serving = false
190
204
  let recent = ''
205
+ let restarting = false
191
206
  // Watched once it serves: a host that ends before that fails the start itself (the caller quits with the reason).
192
207
  return started.ready.then((address) => {
193
208
  serving = true
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/desktop-shell",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Run the app as a desktop app: an Electron window on the app's own server. `npm run desktop`; the app's code never imports electron.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -8,7 +8,7 @@
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
9
  "@acryldev/app-persistence": "0.1.4",
10
10
  "@acryldev/blends-core": "0.6.0",
11
- "@acryldev/plugin-hub-core": "0.2.2",
11
+ "@acryldev/plugin-hub-core": "0.2.3",
12
12
  "yaml": "2.9.0"
13
13
  },
14
14
  "mount": "mount it after extensions, in development builds: root.plugin(pluginShare, { dir: join(root, 'plugins') }); dir must be an extensions source",