google-trends-for-agent 0.2.46 → 0.2.48

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.48 — 2026-11-30
4
+
5
+ ### OS-aware restart shortcut in upgrade banner
6
+ - Show the platform-appropriate quit shortcut (`⌘Q` on macOS, `Alt+F4` on Windows, `Ctrl+Q` on Linux, with a neutral fallback when unknown) in the post-upgrade restart instruction banner (`src/client/update-banner.tsx`, `src/client/index.tsx`).
7
+
8
+ ## 0.2.47 — 2026-11-30
9
+
10
+ ### Reliable one-click upgrade under pnpm minimumReleaseAge & Electron runtime
11
+ - Pass `--config.minimum-release-age=0` in both one-click upgrades (`POST /api/gtfa.plugin-upgrade`) and fallback upgrade commands so newly published releases are never silently downgraded by `dsh`'s `pnpm 11` supply-chain cooldown policy (`src/version-check.ts`, `src/dsh-version.ts`).
12
+ - Set `ELECTRON_RUN_AS_NODE=1` when invoking Electron's `process.execPath` to run DeepSeek Harness's bundled `pnpm.mjs`, preventing Electron Desktop from spawning a second app window, and use cross-platform `path.delimiter` for `PATH` augmentation (`src/dsh-version.ts`).
13
+ - Verify `installedVersion > pluginVersion` after running the upgrade command so npm indexing delays or policy rollbacks report an actionable error instead of falsely claiming success (`src/dsh-version.ts`).
14
+
3
15
  ## 0.2.46 — 2026-11-30
4
16
 
5
17
  ### One-click dsh plugin upgrade & cloud Actor 429 UX polish
@@ -2165,14 +2165,14 @@ function parseActorRuntime(value) {
2165
2165
 
2166
2166
  // src/version-check.ts
2167
2167
  var GTFA_RELEASES_URL = `${GTFA_SOURCE_URL}/releases`;
2168
- var GTFA_UPGRADE_COMMAND = "dsh plugin --profile web add google-trends-for-agent@latest";
2168
+ var GTFA_UPGRADE_COMMAND = "dsh plugin --profile web add --config.minimum-release-age=0 google-trends-for-agent@latest";
2169
2169
  var SAFE_PROFILE_RE = /^[a-zA-Z0-9._-]{1,64}$/;
2170
2170
  function formatUpgradeCommand(profileName) {
2171
2171
  const clean = typeof profileName === "string" && SAFE_PROFILE_RE.test(profileName.trim()) ? profileName.trim() : "web";
2172
2172
  if (clean === "desktop") {
2173
- return "pnpm --dir ~/.dsh/profiles/desktop add google-trends-for-agent@latest";
2173
+ return "pnpm --dir ~/.dsh/profiles/desktop add --config.minimum-release-age=0 google-trends-for-agent@latest";
2174
2174
  }
2175
- return `dsh plugin --profile ${clean} add google-trends-for-agent@latest`;
2175
+ return `dsh plugin --profile ${clean} add --config.minimum-release-age=0 google-trends-for-agent@latest`;
2176
2176
  }
2177
2177
  var SEMVER_RE = /^v?(\d{1,5})\.(\d{1,5})\.(\d{1,5})(?:-([a-zA-Z0-9.-]{1,40}))?$/;
2178
2178
  function parseSemver(raw) {
@@ -2260,13 +2260,21 @@ function parseVersionStatus(value) {
2260
2260
 
2261
2261
  // src/client/update-banner.tsx
2262
2262
  var import_jsx_runtime5 = require("react/jsx-runtime");
2263
- var CLIENT_VERSION = "0.2.46" ? "0.2.46" : null;
2263
+ var CLIENT_VERSION = "0.2.48" ? "0.2.48" : null;
2264
2264
  var VERSION_URL = "api/gtfa.version";
2265
2265
  var PLUGIN_UPGRADE_URL = "api/gtfa.plugin-upgrade";
2266
2266
  var DISMISS_STORAGE_KEY = "gtfa.update.dismissed.1";
2267
2267
  function template2(text2, values) {
2268
2268
  return text2.replace(/\{(\w+)\}/g, (_, key) => String(values[key] ?? ""));
2269
2269
  }
2270
+ function detectQuitShortcut(platformHint) {
2271
+ const raw = (platformHint ?? (typeof navigator !== "undefined" ? navigator.userAgentData?.platform || navigator.platform || navigator.userAgent || "" : "")).toLowerCase();
2272
+ if (!raw) return null;
2273
+ if (raw.includes("mac") || raw.includes("darwin")) return "\u2318Q";
2274
+ if (raw.includes("win")) return "Alt+F4";
2275
+ if (raw.includes("linux") || raw.includes("x11")) return "Ctrl+Q";
2276
+ return null;
2277
+ }
2270
2278
  async function loadVersionStatus(refresh = false, signal) {
2271
2279
  try {
2272
2280
  const response = await fetch(refresh ? `${VERSION_URL}?refresh=1` : VERSION_URL, {
@@ -2477,6 +2485,7 @@ function UpdateBanner({
2477
2485
  ] });
2478
2486
  }
2479
2487
  if (upgradeDoneVersion) {
2488
+ const quitShortcut = detectQuitShortcut();
2480
2489
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("aside", { className: "gtfa-update-banner warn", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "gtfa-update-row", children: [
2481
2490
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "gtfa-update-icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "check", size: 14 }) }),
2482
2491
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "gtfa-update-copy", children: [
@@ -2489,7 +2498,7 @@ function UpdateBanner({
2489
2498
  upgradeDoneVersion
2490
2499
  ] })
2491
2500
  ] }),
2492
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "gtfa-update-sub", children: template2(t("updateDoneSub"), { version: upgradeDoneVersion }) })
2501
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "gtfa-update-sub", children: quitShortcut ? template2(t("updateDoneSubShortcut"), { version: upgradeDoneVersion, shortcut: quitShortcut }) : template2(t("updateDoneSub"), { version: upgradeDoneVersion }) })
2493
2502
  ] })
2494
2503
  ] }) });
2495
2504
  }
@@ -4626,6 +4635,7 @@ var EN = {
4626
4635
  updateUpgrading: "Upgrading\u2026",
4627
4636
  updateDoneTitle: "Upgrade installed \u2014 restart dsh",
4628
4637
  updateDoneSub: "Installed v{version} into this profile. Fully quit and reopen dsh to load the new version.",
4638
+ updateDoneSubShortcut: "Installed v{version} into this profile. Press {shortcut} to fully quit and reopen dsh.",
4629
4639
  updateFailedFallback: "Automatic upgrade failed. Run the command below in your terminal instead.",
4630
4640
  updateShowSteps: "Upgrade steps",
4631
4641
  updateHideSteps: "Hide steps",
@@ -4972,6 +4982,7 @@ var ZH = {
4972
4982
  updateUpgrading: "\u6B63\u5728\u5347\u7EA7\u2026",
4973
4983
  updateDoneTitle: "\u5DF2\u5B89\u88C5\u65B0\u7248\u672C\uFF0C\u8BF7\u91CD\u542F dsh",
4974
4984
  updateDoneSub: "\u5DF2\u5C06 v{version} \u5B89\u88C5\u5230\u5F53\u524D profile\u3002\u8BF7\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00\u684C\u9762\u7AEF / dsh \u4EE5\u751F\u6548\u3002",
4985
+ updateDoneSubShortcut: "\u5DF2\u5C06 v{version} \u5B89\u88C5\u5230\u5F53\u524D profile\u3002\u6309 {shortcut} \u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00\u684C\u9762\u7AEF / dsh \u4EE5\u751F\u6548\u3002",
4975
4986
  updateFailedFallback: "\u81EA\u52A8\u5347\u7EA7\u672A\u6210\u529F\uFF0C\u8BF7\u590D\u5236\u4E0B\u65B9\u547D\u4EE4\u5728\u7EC8\u7AEF\u8FD0\u884C\u3002",
4976
4987
  updateShowSteps: "\u5347\u7EA7\u6B65\u9AA4",
4977
4988
  updateHideSteps: "\u6536\u8D77\u6B65\u9AA4",
@@ -2,7 +2,7 @@ import { execFile } from 'node:child_process';
2
2
  import { randomUUID } from 'node:crypto';
3
3
  import { access, mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
4
4
  import { homedir } from 'node:os';
5
- import { dirname, join, resolve } from 'node:path';
5
+ import { delimiter, dirname, join, resolve } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { promisify } from 'node:util';
8
8
  import { parseActorRuntime } from './actor-runtime.js';
@@ -60,12 +60,12 @@ async function resolveCliBinary(name, envKey, env) {
60
60
  function buildAugmentedPath(env) {
61
61
  const home = env.HOME?.trim() || homedir();
62
62
  const extras = [join(home, '.local', 'bin'), '/opt/homebrew/bin', '/usr/local/bin'];
63
- const current = (env.PATH ?? '').split(':').filter(Boolean);
63
+ const current = (env.PATH ?? '').split(delimiter).filter(Boolean);
64
64
  for (const dir of extras) {
65
65
  if (!current.includes(dir))
66
66
  current.push(dir);
67
67
  }
68
- return current.join(':');
68
+ return current.join(delimiter);
69
69
  }
70
70
  async function readInstalledProfileVersion(profileName, env) {
71
71
  const dshHome = env.DSH_HOME?.trim() || join(env.HOME?.trim() || homedir(), '.dsh');
@@ -399,11 +399,22 @@ export function createVersionStatusMonitor(options) {
399
399
  const command = formatUpgradeCommand(profileName);
400
400
  if (options.runUpgrade) {
401
401
  const outcome = await options.runUpgrade(profileName, signal);
402
+ const installedVersion = outcome.installedVersion ?? null;
403
+ if (outcome.ok && installedVersion && (compareSemver(installedVersion, pluginVersion) ?? 0) <= 0) {
404
+ return {
405
+ ok: false,
406
+ profileName,
407
+ command,
408
+ installedVersion,
409
+ restartRequired: false,
410
+ message: `Profile "${profileName}" resolved to v${installedVersion} (not newer than v${pluginVersion}). If a new release was just published, wait 1–2 minutes for npm indexing and retry.`,
411
+ };
412
+ }
402
413
  return {
403
414
  ok: outcome.ok,
404
415
  profileName,
405
416
  command,
406
- installedVersion: outcome.installedVersion ?? null,
417
+ installedVersion,
407
418
  restartRequired: outcome.ok,
408
419
  ...(outcome.message ? { message: outcome.message } : {}),
409
420
  };
@@ -427,17 +438,17 @@ export function createVersionStatusMonitor(options) {
427
438
  catch { /* Try next candidate. */ }
428
439
  }
429
440
  if (bundledPnpm) {
430
- await execFileAsync(process.execPath, [bundledPnpm, 'add', 'google-trends-for-agent@latest'], {
441
+ await execFileAsync(process.execPath, [bundledPnpm, 'add', '--config.minimum-release-age=0', 'google-trends-for-agent@latest'], {
431
442
  cwd: profileDir,
432
443
  timeout: 120_000,
433
444
  maxBuffer: 2 * 1024 * 1024,
434
445
  signal,
435
- env,
446
+ env: { ...env, ELECTRON_RUN_AS_NODE: '1' },
436
447
  });
437
448
  }
438
449
  else {
439
450
  const pnpmBin = await resolveCliBinary('pnpm', 'PNPM_BIN', env);
440
- await execFileAsync(pnpmBin, ['add', 'google-trends-for-agent@latest'], {
451
+ await execFileAsync(pnpmBin, ['add', '--config.minimum-release-age=0', 'google-trends-for-agent@latest'], {
441
452
  cwd: profileDir,
442
453
  timeout: 120_000,
443
454
  maxBuffer: 2 * 1024 * 1024,
@@ -448,7 +459,7 @@ export function createVersionStatusMonitor(options) {
448
459
  }
449
460
  else {
450
461
  const dshBin = await resolveCliBinary('dsh', 'DSH_BIN', env);
451
- await execFileAsync(dshBin, ['plugin', '--profile', profileName, 'add', 'google-trends-for-agent@latest'], {
462
+ await execFileAsync(dshBin, ['plugin', '--profile', profileName, 'add', '--config.minimum-release-age=0', 'google-trends-for-agent@latest'], {
452
463
  timeout: 120_000,
453
464
  maxBuffer: 2 * 1024 * 1024,
454
465
  signal,
@@ -456,6 +467,16 @@ export function createVersionStatusMonitor(options) {
456
467
  });
457
468
  }
458
469
  const installedVersion = await readInstalledProfileVersion(profileName, env);
470
+ if (installedVersion && (compareSemver(installedVersion, pluginVersion) ?? 0) <= 0) {
471
+ return {
472
+ ok: false,
473
+ profileName,
474
+ command,
475
+ installedVersion,
476
+ restartRequired: false,
477
+ message: `Profile "${profileName}" resolved to v${installedVersion} (not newer than v${pluginVersion}). If a new release was just published, wait 1–2 minutes for npm indexing and retry.`,
478
+ };
479
+ }
459
480
  return {
460
481
  ok: true,
461
482
  profileName,
@@ -2,7 +2,7 @@ import type { ActorRuntime } from './actor-runtime.js';
2
2
  import { type EgressMode } from './options.js';
3
3
  export declare const GTFA_RELEASES_URL = "https://github.com/meka-im/google-trends-for-agent/releases";
4
4
  export declare const GTFA_LATEST_RELEASE_API_URL = "https://api.github.com/repos/meka-im/google-trends-for-agent/releases/latest";
5
- export declare const GTFA_UPGRADE_COMMAND = "dsh plugin --profile web add google-trends-for-agent@latest";
5
+ export declare const GTFA_UPGRADE_COMMAND = "dsh plugin --profile web add --config.minimum-release-age=0 google-trends-for-agent@latest";
6
6
  export declare const VERSION_STATUS_PATH = "/api/gtfa.version";
7
7
  export declare const PLUGIN_UPGRADE_PATH = "/api/gtfa.plugin-upgrade";
8
8
  /** Build the profile-specific upgrade command (Desktop profile is Electron-managed, so dsh CLI blocks --profile desktop). */
@@ -2,7 +2,7 @@ import { parseActorRuntime } from './actor-runtime.js';
2
2
  import { GTFA_SOURCE_URL } from './options.js';
3
3
  export const GTFA_RELEASES_URL = `${GTFA_SOURCE_URL}/releases`;
4
4
  export const GTFA_LATEST_RELEASE_API_URL = 'https://api.github.com/repos/meka-im/google-trends-for-agent/releases/latest';
5
- export const GTFA_UPGRADE_COMMAND = 'dsh plugin --profile web add google-trends-for-agent@latest';
5
+ export const GTFA_UPGRADE_COMMAND = 'dsh plugin --profile web add --config.minimum-release-age=0 google-trends-for-agent@latest';
6
6
  export const VERSION_STATUS_PATH = '/api/gtfa.version';
7
7
  export const PLUGIN_UPGRADE_PATH = '/api/gtfa.plugin-upgrade';
8
8
  const SAFE_PROFILE_RE = /^[a-zA-Z0-9._-]{1,64}$/;
@@ -12,9 +12,9 @@ export function formatUpgradeCommand(profileName) {
12
12
  ? profileName.trim()
13
13
  : 'web';
14
14
  if (clean === 'desktop') {
15
- return 'pnpm --dir ~/.dsh/profiles/desktop add google-trends-for-agent@latest';
15
+ return 'pnpm --dir ~/.dsh/profiles/desktop add --config.minimum-release-age=0 google-trends-for-agent@latest';
16
16
  }
17
- return `dsh plugin --profile ${clean} add google-trends-for-agent@latest`;
17
+ return `dsh plugin --profile ${clean} add --config.minimum-release-age=0 google-trends-for-agent@latest`;
18
18
  }
19
19
  const SEMVER_RE = /^v?(\d{1,5})\.(\d{1,5})\.(\d{1,5})(?:-([a-zA-Z0-9.-]{1,40}))?$/;
20
20
  /** Parse a bounded X.Y.Z(-prerelease) version string. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-trends-for-agent",
3
- "version": "0.2.46",
3
+ "version": "0.2.48",
4
4
  "description": "Search-interest signals for AI agents — an unofficial Google Trends client",
5
5
  "type": "module",
6
6
  "license": "MIT",