summrise-agent 1.2.452 → 1.2.453

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/bin/summrise.js CHANGED
@@ -57,6 +57,9 @@ exports.autostartArgv = autostartArgv;
57
57
  exports.playwrightProbePs = playwrightProbePs;
58
58
  exports.busyIsFresh = busyIsFresh;
59
59
  exports.latestCdnVersion = latestCdnVersion;
60
+ exports.latestNpmVersion = latestNpmVersion;
61
+ exports.newestOf = newestOf;
62
+ exports.latestReleaseVersion = latestReleaseVersion;
60
63
  exports.statusReport = statusReport;
61
64
  exports.isBehind = isBehind;
62
65
  exports.behindBy = behindBy;
@@ -740,6 +743,60 @@ function latestCdnVersion() {
740
743
  return null;
741
744
  }
742
745
  }
746
+ /**
747
+ * The registry's own answer to "what is latest", asked in the smallest way npm
748
+ * offers: `/-/package/<name>/dist-tags` is a few bytes, where the packument is a
749
+ * document. Same 3 s cap and the same rule as the CDN read — a failure is
750
+ * `null`, which the report renders as "could NOT be checked", never as
751
+ * agreement.
752
+ */
753
+ function latestNpmVersion() {
754
+ const r = (0, child_process_1.spawnSync)("curl", [
755
+ "-s",
756
+ "-m",
757
+ "3",
758
+ "https://registry.npmjs.org/-/package/summrise-agent/dist-tags",
759
+ ], { encoding: "utf8", timeout: 5000 });
760
+ if (r.status !== 0 || !r.stdout)
761
+ return null;
762
+ try {
763
+ const j = JSON.parse(r.stdout);
764
+ const v = j && typeof j.latest === "string" ? j.latest.trim() : "";
765
+ // A dist-tag can point at a prerelease; the device's update path only
766
+ // understands x.y.z, and a tag it cannot parse is not a version.
767
+ return /^\d+\.\d+\.\d+$/.test(v) ? v : null;
768
+ }
769
+ catch {
770
+ return null;
771
+ }
772
+ }
773
+ /** The newer of two release versions; either may be unknown. */
774
+ function newestOf(a, b) {
775
+ if (!a)
776
+ return b;
777
+ if (!b)
778
+ return a;
779
+ const ta = versionTriple(a);
780
+ const tb = versionTriple(b);
781
+ if (!ta)
782
+ return b;
783
+ if (!tb)
784
+ return a;
785
+ for (let i = 0; i < 3; i++) {
786
+ if (ta[i] !== tb[i])
787
+ return ta[i] > tb[i] ? a : b;
788
+ }
789
+ return a;
790
+ }
791
+ /**
792
+ * What "latest" means now that there are TWO channels: the newer of the CDN's
793
+ * `version.json` and the registry's dist-tag. `null` only when NEITHER
794
+ * answered — one silent channel must not be reported as agreement, which is the
795
+ * property the CDN-only version already had.
796
+ */
797
+ function latestReleaseVersion() {
798
+ return newestOf(latestCdnVersion(), latestNpmVersion());
799
+ }
743
800
  function statusReport(f) {
744
801
  const out = [];
745
802
  out.push(f.agentRunning === null
@@ -1726,13 +1783,14 @@ const commands = {
1726
1783
  catch {
1727
1784
  /* best-effort */
1728
1785
  }
1729
- // What the CDN advertises, so `status` can answer "is this device current" —
1730
- // the question every round of this project's log answered by hand. Bounded
1731
- // HARD (3 s): `status` is the command an operator runs when something is
1732
- // already wrong, and a status that hangs on a network blip is worse than one
1733
- // that says it could not check. A failure yields `null`, which the report
1734
- // renders as "could NOT be checked" — never as agreement.
1735
- const latestVersion = latestCdnVersion();
1786
+ // What the TWO channels advertise, so `status` can answer "is this device
1787
+ // current" — the question every round of this project's log answered by
1788
+ // hand. Bounded HARD (3 s each): `status` is the command an operator runs
1789
+ // when something is already wrong, and a status that hangs on a network
1790
+ // blip is worse than one that says it could not check. `null` only when
1791
+ // BOTH are silent, which the report renders as "could NOT be checked" —
1792
+ // never as agreement.
1793
+ const latestVersion = latestReleaseVersion();
1736
1794
  for (const line of statusReport({
1737
1795
  agentRunning: agentState === "unknown" ? null : agentState === "yes",
1738
1796
  installDir: DIR,
@@ -1853,15 +1911,15 @@ const commands = {
1853
1911
  // `agent_update` reads that file as its LOCAL version. An older CLI therefore stamps the install with the version it
1854
1912
  // already has, the swap installs the same build, and nothing moves. Refuse before touching the device, and say the
1855
1913
  // thing that works — the release flow has always been two steps.
1856
- const cdnLatest = latestCdnVersion();
1914
+ const latest = latestReleaseVersion();
1857
1915
  const selfVersion = String(require("../package.json").version || "");
1858
- if (cdnLatest && selfVersion && isBehind(selfVersion, cdnLatest)) {
1859
- console.error(`update: this CLI is ${selfVersion} and the CDN has ${cdnLatest}.` +
1916
+ if (latest && selfVersion && isBehind(selfVersion, latest)) {
1917
+ console.error(`update: this CLI is ${selfVersion} and the release channel has ${latest}.` +
1860
1918
  "\n Updating from here would stamp the device with " +
1861
1919
  selfVersion +
1862
1920
  " and change nothing, because the device reads <install>/.summrise-release (written by this package) as its version." +
1863
1921
  "\n Install the new CLI first, then update again:" +
1864
- '\n npm i -g --prefix (Split-Path (Get-Command summrise).Source) https://agent.saisi.online/summrise-agent/summrise-agent-latest.tgz' +
1922
+ "\n npm i -g summrise-agent" +
1865
1923
  "\n summrise update");
1866
1924
  process.exit(1);
1867
1925
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "summrise-agent",
3
- "version": "1.2.452",
3
+ "version": "1.2.453",
4
4
  "description": "Summrise Agent — Windows device MCP server (terminal/SSH/serial) + panel. Self-hosted npm distribution.",
5
5
  "//build": "唯一构建路径:在本目录执行 npm run build。它是自包含的:经 npm exec 按需拉取 typescript@5,无需预装任何 node_modules(干净检出可跑;旧脚本引用 ../summrise-desktop-electron/node_modules/.bin/tsc,干净检出必 ENOENT)。必须用 npm exec --package … -- tsc 的形式:npx 会吃掉传给 tsc 的 -p/--outDir 等参数(round-435:npx 写法从未真正跑通过)。先编 electron TS(--noCheck 纯 emit,与 release.yml 一致)同步两处 src/*.js,再编 src/summrise.ts 到 bin/summrise.js 并校验 round-298 标记(弱 oracle,只证某次构建发生,新鲜性由 publish-release.sh 的 tsc 重编 + cmp 门保证)。",
6
6
  "bin": {
Binary file