scenri 0.4.0 → 0.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.1](https://github.com/tonygorb/Scenri/compare/v0.4.0...v0.4.1) (2026-08-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * a clicked update check answers even when automatic checks are off ([a17b8e8](https://github.com/tonygorb/Scenri/commit/a17b8e83c3f006ff518a34412e918099271f27cf))
9
+ * dispatch launch from the module's own path, not argv ([46cd5ea](https://github.com/tonygorb/Scenri/commit/46cd5ea9679ee1261eea25b215590bcdf6027a67))
10
+ * make the local update experience actually deliver updates ([8c5aa0a](https://github.com/tonygorb/Scenri/commit/8c5aa0aa454c4713eb90e1f27bc70867ef93129f))
11
+ * stage a discovered update in the background, ready to restart ([449b9ad](https://github.com/tonygorb/Scenri/commit/449b9ad7c775dd4a4269d1cb41a50be9d83adbe2))
12
+ * update UI narrates the whole arc and never answers with silence ([f964213](https://github.com/tonygorb/Scenri/commit/f964213e03668c200c55dd4bc73350021165bbbe))
13
+
3
14
  ## [0.4.0](https://github.com/tonygorb/Scenri/compare/v0.3.5...v0.4.0) (2026-08-23)
4
15
 
5
16
 
package/README.md CHANGED
@@ -95,7 +95,7 @@ pnpm dev # starts the server on 127.0.0.1:4747
95
95
  - **Iteration is the product.** A version tree, not a prompt box. Branch, compare, keep the winners.
96
96
  - **Your brands are files, not hostages.** `.brand` is an open, documented format under a permissive license. Email one to a client. Any tool can adopt it.
97
97
  - **Your AI, your cost.** Bring your own Codex CLI session or an API key. Experiments cost raw API price, or nothing at all on a local session. No credits that burn on a miss.
98
- - **Local first, and it means it.** No account, no telemetry, no upload. The server binds to your machine only. Scenri makes exactly two requests on its own behalf: a daily version-number check against npm so updates can announce themselves, and a one-time download of the library imagery archive, cached locally forever after. Nothing about you or your work is ever sent, and both turn off: in Settings or `SCENRI_NO_UPDATE_CHECK=1` for the first, `SCENRI_NO_CONTENT_FETCH=1` for the second ([how updates work](https://github.com/tonygorb/scenri/blob/main/docs/updates.md)).
98
+ - **Local first, and it means it.** No account, no telemetry, no upload. The server binds to your machine only. Scenri makes exactly two requests on its own behalf: a daily version-number check against npm so updates can announce themselves (and, when one is found, the download of that release from npm, staged locally until you choose to restart), and a one-time download of the library imagery archive, cached locally forever after. Nothing about you or your work is ever sent, and both turn off: in Settings or `SCENRI_NO_UPDATE_CHECK=1` for the first, `SCENRI_NO_CONTENT_FETCH=1` for the second ([how updates work](https://github.com/tonygorb/scenri/blob/main/docs/updates.md)).
99
99
 
100
100
  ## Engines
101
101
 
@@ -61,6 +61,7 @@ function createUpdateChecker(deps) {
61
61
  };
62
62
  let inflight = null;
63
63
  let lastForceAt = 0;
64
+ let onResultFn = null;
64
65
  const enabled = () => env.SCENRI_NO_UPDATE_CHECK !== "1" && deps.store.getSetting("update.enabled") !== "false";
65
66
  async function fetchLatest() {
66
67
  if (!deps.store.getSetting("update.disclosed")) {
@@ -71,10 +72,12 @@ function createUpdateChecker(deps) {
71
72
  if (res.error) return { ...cached(), error: res.error };
72
73
  deps.store.setSetting("update.latest", res.latest ?? "");
73
74
  deps.store.setSetting("update.checkedAt", String(now()));
74
- return cached();
75
+ const result = cached();
76
+ onResultFn?.(result);
77
+ return result;
75
78
  }
76
79
  async function check(force = false) {
77
- if (!enabled()) return cached();
80
+ if (!enabled() && !force) return cached();
78
81
  if (inflight) return inflight;
79
82
  const prior = cached();
80
83
  const fresh = prior.checkedAt !== null && now() - prior.checkedAt < CACHE_MS;
@@ -93,7 +96,14 @@ function createUpdateChecker(deps) {
93
96
  setTimeout(() => void check(), 1e4).unref();
94
97
  setInterval(() => void check(), CACHE_MS).unref();
95
98
  }
96
- return { enabled, check, schedule };
99
+ return {
100
+ enabled,
101
+ check,
102
+ schedule,
103
+ onResult: (fn) => {
104
+ onResultFn = fn;
105
+ }
106
+ };
97
107
  }
98
108
  function findNpm(opts = {}) {
99
109
  const env = opts.env ?? process.env;
@@ -220,5 +230,5 @@ async function stageVersion(deps) {
220
230
  }
221
231
 
222
232
  export { classify, createUpdateChecker, fetchDistTagLatest, findNpm, stageVersion };
223
- //# sourceMappingURL=chunk-3W2RHBZC.js.map
224
- //# sourceMappingURL=chunk-3W2RHBZC.js.map
233
+ //# sourceMappingURL=chunk-WIIQZN3K.js.map
234
+ //# sourceMappingURL=chunk-WIIQZN3K.js.map
@@ -1,4 +1,4 @@
1
- import { stageVersion, fetchDistTagLatest, findNpm } from './chunk-3W2RHBZC.js';
1
+ import { stageVersion, fetchDistTagLatest, findNpm } from './chunk-WIIQZN3K.js';
2
2
  import { readMeta } from './chunk-Y3ZPBPLP.js';
3
3
  import { defaultHome, newestStaged, compareSemver } from './chunk-4MAFHYAD.js';
4
4
 
@@ -63,5 +63,5 @@ async function runUpdateCommand(opts) {
63
63
  }
64
64
 
65
65
  export { runUpdateCommand };
66
- //# sourceMappingURL=cli-HF5KPURA.js.map
67
- //# sourceMappingURL=cli-HF5KPURA.js.map
66
+ //# sourceMappingURL=cli-PBDPZQ4G.js.map
67
+ //# sourceMappingURL=cli-PBDPZQ4G.js.map
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { bootErrorLines } from './chunk-WGIZJXNE.js';
3
+ import { fileURLToPath } from 'url';
3
4
 
4
5
  // src/args.ts
5
6
  function parseArgs(argv) {
@@ -41,6 +42,11 @@ SCENRI_CONTENT_URL.
41
42
  `;
42
43
  }
43
44
 
45
+ // src/builtEntry.ts
46
+ function isBuiltEntry(entryPath) {
47
+ return /[\\/]dist[\\/]/.test(entryPath);
48
+ }
49
+
44
50
  // src/index.ts
45
51
  var command = parseArgs(process.argv.slice(2));
46
52
  try {
@@ -64,13 +70,13 @@ try {
64
70
  await (await import('./serve.js')).serve();
65
71
  break;
66
72
  case "update": {
67
- const { runUpdateCommand } = await import('./cli-HF5KPURA.js');
73
+ const { runUpdateCommand } = await import('./cli-PBDPZQ4G.js');
68
74
  process.exit(await runUpdateCommand(command));
69
75
  break;
70
76
  }
71
77
  case "launch": {
72
- const ownEntry = process.argv[1] ?? "";
73
- if (!/[\\/]dist[\\/]/.test(ownEntry)) {
78
+ const ownEntry = fileURLToPath(import.meta.url);
79
+ if (!isBuiltEntry(ownEntry)) {
74
80
  await (await import('./serve.js')).serve();
75
81
  break;
76
82
  }
package/dist/serve.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { portBusyLines } from './chunk-WGIZJXNE.js';
2
- import { createUpdateChecker, classify, stageVersion, findNpm } from './chunk-3W2RHBZC.js';
2
+ import { createUpdateChecker, classify, findNpm, stageVersion } from './chunk-WIIQZN3K.js';
3
3
  import { readMeta, repoSlug } from './chunk-Y3ZPBPLP.js';
4
- import { newestStaged, compareSemver } from './chunk-4MAFHYAD.js';
4
+ import { compareSemver, newestStaged } from './chunk-4MAFHYAD.js';
5
5
  import { networkInterfaces, homedir, tmpdir } from 'os';
6
6
  import { sep, join, dirname, normalize } from 'path';
7
7
  import Database from 'better-sqlite3';
@@ -6781,6 +6781,21 @@ function registerImageRoutes(app, deps) {
6781
6781
 
6782
6782
  // src/release/notes.data.ts
6783
6783
  var RELEASES = [
6784
+ {
6785
+ version: "0.4.1",
6786
+ date: "2026-08-23",
6787
+ title: "Updates now arrive by themselves.",
6788
+ sections: [
6789
+ {
6790
+ heading: "Updates",
6791
+ body: "A new version now downloads quietly in the background, verifies itself next to the running copy, and asks for a single click to restart. This is also the release that makes in-app updating truly work on macOS and Linux, where the one-click path silently never engaged. Checking by hand always answers, even when automatic checks are off, and a restart never interrupts running work."
6792
+ },
6793
+ {
6794
+ heading: "Existing installs",
6795
+ body: "Copies first started with npx before this release cannot pick the fix up on their own. Run npx scenri@latest once in a terminal; every update after that arrives without it."
6796
+ }
6797
+ ]
6798
+ },
6784
6799
  {
6785
6800
  version: "0.4.0",
6786
6801
  date: "2026-08-23",
@@ -7002,6 +7017,32 @@ function registerUpdateRoutes(app, deps) {
7002
7017
  npmProbe ??= findNpm() !== null;
7003
7018
  return npmProbe ? null : "no-npm";
7004
7019
  };
7020
+ const startStaging = (target) => {
7021
+ applyState = { phase: "staging", version: target, error: null };
7022
+ void (deps.stageImpl ?? stageVersion)({
7023
+ home: core.home,
7024
+ pkg: meta.name,
7025
+ source: { version: target },
7026
+ keep: /* @__PURE__ */ new Set([meta.version])
7027
+ }).then((res) => {
7028
+ applyState = res.ok ? { phase: "ready", version: res.version, error: null } : { phase: "error", version: null, error: `${res.reason}: ${res.detail}` };
7029
+ }).catch((err) => {
7030
+ applyState = { phase: "error", version: null, error: String(err?.message ?? err) };
7031
+ });
7032
+ };
7033
+ const maybeAutoStage = (r) => {
7034
+ if (applyState.phase === "error") applyState = { phase: "idle", version: null, error: null };
7035
+ if (!updates.enabled()) return;
7036
+ if (!r.latest || classify(meta.version, r.latest) === null) return;
7037
+ if (blockReason() !== null) return;
7038
+ if (deps.busyCount() > 0) return;
7039
+ const apply = effectiveApply();
7040
+ if (apply.phase === "staging") return;
7041
+ if (apply.phase === "ready" && compareSemver(r.latest, apply.version ?? "") <= 0) return;
7042
+ startStaging(r.latest);
7043
+ };
7044
+ updates.onResult(maybeAutoStage);
7045
+ setTimeout(() => void updates.check().then(maybeAutoStage), 15e3).unref();
7005
7046
  const updateStatus = async (force = false) => {
7006
7047
  const r = await updates.check(force);
7007
7048
  const kind = r.latest ? classify(meta.version, r.latest) : null;
@@ -7034,27 +7075,25 @@ function registerUpdateRoutes(app, deps) {
7034
7075
  const block = blockReason();
7035
7076
  if (block)
7036
7077
  return reply.status(409).send({ error: `one-click update cannot run here (${block})`, blockReason: block });
7037
- if (applyState.phase === "staging") return reply.status(409).send({ error: "an update is already staging" });
7038
7078
  const r = await updates.check();
7039
7079
  const kind = r.latest ? classify(meta.version, r.latest) : null;
7040
7080
  if (!r.latest || kind === null) return reply.status(409).send({ error: "nothing newer to install" });
7041
7081
  const target = r.latest;
7042
- applyState = { phase: "staging", version: target, error: null };
7043
- void (deps.stageImpl ?? stageVersion)({
7044
- home: core.home,
7045
- pkg: meta.name,
7046
- source: { version: target },
7047
- keep: /* @__PURE__ */ new Set([meta.version])
7048
- }).then((res) => {
7049
- applyState = res.ok ? { phase: "ready", version: res.version, error: null } : { phase: "error", version: null, error: `${res.reason}: ${res.detail}` };
7050
- }).catch((err) => {
7051
- applyState = { phase: "error", version: null, error: String(err?.message ?? err) };
7052
- });
7082
+ const current = effectiveApply();
7083
+ if ((current.phase === "staging" || current.phase === "ready") && current.version === target) {
7084
+ return { ok: true, staging: target };
7085
+ }
7086
+ if (current.phase === "staging") return reply.status(409).send({ error: "an update is already staging" });
7087
+ startStaging(target);
7053
7088
  return { ok: true, staging: target };
7054
7089
  });
7055
7090
  app.post("/api/update/restart", async (_req, reply) => {
7056
7091
  const apply = effectiveApply();
7057
7092
  if (apply.phase !== "ready") return reply.status(409).send({ error: "no staged update to restart into" });
7093
+ const busy = deps.busyCount();
7094
+ if (busy > 0) {
7095
+ return reply.status(409).send({ error: `work is still running (${busy} task${busy === 1 ? "" : "s"})`, blockReason: "busy" });
7096
+ }
7058
7097
  if (!runtime.supervised) {
7059
7098
  return reply.status(409).send({ error: "not supervised; restart Scenri yourself", blockReason: "unsupervised" });
7060
7099
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scenri",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "author": "Tony Gorb <hello@scenri.co>",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",