dominds 1.27.1 → 1.27.2

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.
@@ -1,14 +1,37 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getDomindsRuntimeStatus = getDomindsRuntimeStatus;
4
7
  exports.createDomindsRuntimeStatusMessage = createDomindsRuntimeStatusMessage;
5
8
  const time_1 = require("@longrun-ai/kernel/utils/time");
9
+ const node_crypto_1 = require("node:crypto");
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const log_1 = require("../log");
6
13
  const dominds_running_version_1 = require("./dominds-running-version");
7
14
  const dominds_self_update_1 = require("./dominds-self-update");
15
+ const log = (0, log_1.createLogger)('dominds-runtime-status');
16
+ function resolveDomindsInstallRoot() {
17
+ return node_path_1.default.resolve(__dirname, '..', '..');
18
+ }
19
+ async function readSpaHash() {
20
+ const indexPath = node_path_1.default.join(resolveDomindsInstallRoot(), 'webapp', 'dist', 'index.html');
21
+ try {
22
+ const indexHtml = await node_fs_1.promises.readFile(indexPath, 'utf8');
23
+ return (0, node_crypto_1.createHash)('sha256').update(indexHtml).digest('hex');
24
+ }
25
+ catch (error) {
26
+ log.warn('Failed to read SPA hash from dist index.html', error, { indexPath });
27
+ return null;
28
+ }
29
+ }
8
30
  async function getDomindsRuntimeStatus(mode) {
9
31
  return {
10
32
  workspace: process.cwd(),
11
33
  version: dominds_running_version_1.DOMINDS_RUNNING_VERSION,
34
+ spaHash: await readSpaHash(),
12
35
  mode,
13
36
  selfUpdate: await (0, dominds_self_update_1.getDomindsSelfUpdateStatus)(),
14
37
  };
@@ -13,6 +13,18 @@ const path_1 = require("path");
13
13
  const log_1 = require("../log");
14
14
  const mime_types_1 = require("./mime-types");
15
15
  const log = (0, log_1.createLogger)('static-server');
16
+ function isFingerprintedAssetPath(pathname) {
17
+ return /^\/assets\/.+-[A-Z0-9]{8,}\.[A-Za-z0-9]+$/.test(pathname);
18
+ }
19
+ function getStaticCacheControl(pathname, ext) {
20
+ if (ext === '.html') {
21
+ return 'no-store';
22
+ }
23
+ if (isFingerprintedAssetPath(pathname)) {
24
+ return 'public, max-age=31536000, immutable';
25
+ }
26
+ return 'no-cache';
27
+ }
16
28
  /**
17
29
  * Serve static files from the webapp build output.
18
30
  */
@@ -45,13 +57,13 @@ async function serveStatic(pathname, res, options) {
45
57
  if (!looksLikeAsset) {
46
58
  const indexPath = (0, path_1.join)(staticDir, 'index.html');
47
59
  if ((0, fs_1.existsSync)(indexPath)) {
48
- return await sendFile(indexPath, res, '.html');
60
+ return await sendFile(indexPath, res, '.html', '/index.html');
49
61
  }
50
62
  }
51
63
  return false;
52
64
  }
53
65
  const ext = (0, path_1.extname)(filePath);
54
- return await sendFile(filePath, res, ext);
66
+ return await sendFile(filePath, res, ext, pathname);
55
67
  }
56
68
  catch (error) {
57
69
  log.error('Error serving static file:', error);
@@ -61,14 +73,14 @@ async function serveStatic(pathname, res, options) {
61
73
  /**
62
74
  * Send a file with appropriate headers
63
75
  */
64
- async function sendFile(filePath, res, ext) {
76
+ async function sendFile(filePath, res, ext, pathname) {
65
77
  try {
66
78
  const mimeType = (0, mime_types_1.getMimeType)(ext);
67
79
  const stats = await fs_1.promises.stat(filePath);
68
80
  res.writeHead(200, {
69
81
  'Content-Type': mimeType,
70
82
  'Content-Length': stats.size,
71
- 'Cache-Control': 'no-cache', // Disable caching for development
83
+ 'Cache-Control': getStaticCacheControl(pathname, ext),
72
84
  });
73
85
  const stream = (0, fs_1.createReadStream)(filePath);
74
86
  stream.pipe(res);
@@ -88,7 +100,10 @@ async function sendFile(filePath, res, ext) {
88
100
  async function sendHtml(filePath, res, mode) {
89
101
  try {
90
102
  const content = await fs_1.promises.readFile(filePath, 'utf8');
91
- res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
103
+ res.writeHead(200, {
104
+ 'Content-Type': 'text/html; charset=utf-8',
105
+ 'Cache-Control': 'no-store',
106
+ });
92
107
  res.end(content);
93
108
  }
94
109
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dominds",
3
- "version": "1.27.1",
3
+ "version": "1.27.2",
4
4
  "description": "Dominds CLI and aggregation shell for the LongRun AI kernel/runtime packages.",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -54,9 +54,9 @@
54
54
  "ws": "^8.21.0",
55
55
  "yaml": "^2.9.0",
56
56
  "zod": "^4.4.3",
57
- "@longrun-ai/codex-auth": "0.14.0",
58
- "@longrun-ai/shell": "1.17.1",
59
- "@longrun-ai/kernel": "1.17.1"
57
+ "@longrun-ai/kernel": "1.17.2",
58
+ "@longrun-ai/shell": "1.17.2",
59
+ "@longrun-ai/codex-auth": "0.14.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^25.9.1",
@@ -96598,6 +96598,10 @@ var DomindsApp = class _DomindsApp extends HTMLElement {
96598
96598
  this.currentTheme = this.getCurrentTheme();
96599
96599
  this.backendRtws = "";
96600
96600
  this.backendVersion = "";
96601
+ this.loadedBackendVersion = null;
96602
+ this.loadedSpaHash = null;
96603
+ this.runtimeStatusInitialized = false;
96604
+ this.runtimeAssetReloadScheduled = false;
96601
96605
  this.backendMode = null;
96602
96606
  this.domindsSelfUpdate = null;
96603
96607
  this.domindsSelfUpdateCheckInFlight = false;
@@ -98270,10 +98274,25 @@ ${formatUiLanguageOptionLabel({
98270
98274
  }
98271
98275
  this.updateDomindsVersionUi();
98272
98276
  }
98273
- applyDomindsRuntimeStatus(status) {
98277
+ applyDomindsRuntimeStatus(status, options) {
98274
98278
  const workspace = status.workspace.trim();
98279
+ const version2 = status.version.trim();
98280
+ const spaHash = status.spaHash === null ? null : status.spaHash.trim();
98281
+ const normalizedSpaHash = spaHash === "" ? null : spaHash;
98282
+ const versionChanged = version2 !== "" && this.loadedBackendVersion !== null && version2 !== this.loadedBackendVersion;
98283
+ const buildChanged = normalizedSpaHash !== null && this.loadedSpaHash !== null && normalizedSpaHash !== this.loadedSpaHash;
98284
+ if (!this.runtimeAssetReloadScheduled && (versionChanged || options.allowBuildOnlyReload && buildChanged)) {
98285
+ this.runtimeAssetReloadScheduled = true;
98286
+ window.location.reload();
98287
+ return;
98288
+ }
98289
+ if (!this.runtimeStatusInitialized) {
98290
+ this.runtimeStatusInitialized = true;
98291
+ this.loadedBackendVersion = version2 !== "" ? version2 : null;
98292
+ this.loadedSpaHash = normalizedSpaHash;
98293
+ }
98275
98294
  this.backendRtws = workspace;
98276
- this.backendVersion = status.version.trim();
98295
+ this.backendVersion = version2;
98277
98296
  this.backendMode = status.mode;
98278
98297
  this.domindsSelfUpdate = status.selfUpdate;
98279
98298
  this.showDomindsSelfUpdateFailureIfNeeded(status.selfUpdate);
@@ -106932,12 +106951,12 @@ ${content}`;
106932
106951
  if (dialogContainer instanceof DomindsDialogContainer) {
106933
106952
  dialogContainer.setServerWorkLanguage(message.serverWorkLanguage);
106934
106953
  }
106935
- this.applyDomindsRuntimeStatus(message.runtimeStatus);
106954
+ this.applyDomindsRuntimeStatus(message.runtimeStatus, { allowBuildOnlyReload: true });
106936
106955
  this.applyUiLanguageToDom();
106937
106956
  return true;
106938
106957
  }
106939
106958
  case "dominds_runtime_status": {
106940
- this.applyDomindsRuntimeStatus(message.runtimeStatus);
106959
+ this.applyDomindsRuntimeStatus(message.runtimeStatus, { allowBuildOnlyReload: false });
106941
106960
  return true;
106942
106961
  }
106943
106962
  case "ui_language_set": {
@@ -110119,4 +110138,4 @@ mermaid/dist/mermaid.core.mjs:
110119
110138
  * Wait for document loaded before starting the execution
110120
110139
  *)
110121
110140
  */
110122
- //# sourceMappingURL=/assets/main-APO6XREZ.js.map
110141
+ //# sourceMappingURL=/assets/main-NXVX2KTO.js.map