google-trends-for-agent 0.2.43 → 0.2.44

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.44 — 2026-11-26
4
+
5
+ ### dsh UI polish, local-failure Actor CTA & 1-click settings
6
+ - Keep the plugin details README separated from the settings form (`plugins.row.config`) while adding a 1-click in-panel Settings view (`renderSettings` with a back button) accessible from **Plugin settings**, the topbar route pill, and failure CTAs (`src/client/index.tsx`, `src/client/dashboard.tsx`, docs aligned).
7
+ - Restore the blue gradient `$5` monthly free-credit card with trend-curve artwork in Apify Actor settings (`src/client/theme.ts`, `src/client/index.tsx`).
8
+ - Add a compact **Local direct request** failure alert banner (`RATE_LIMITED`, `BLOCKED`, and generic local failures) with a 1-click **Switch Actor** CTA that automatically hides once current egress is switched away from `local`, plus a dedicated Actor auth/config setup banner (`INVALID_INPUT`) with a **Go to settings** CTA (`src/client/dashboard.tsx`, `src/client/dashboard-locale.ts`, `src/client/dashboard-theme.ts`).
9
+ - Add the MEKA baseline dataset source link (`https://meka.im/datasets/google-trends-anchors`) to calibration anchor cards, and immediately clear prior query results and reset `metric` to `interest` with a 2-column loading skeleton on new query submission (`src/client/dashboard-state.ts`, `src/client/dashboard.tsx`).
10
+ - Polish failed-query and dark-mode details: remove the `.gd-error` `!important` margin override, keep **Query details** labels single-line with raw error tucked inside expanded details, scope ChoicePicker overrides to dashboard toolbars, and update `GTFA_UPGRADE_COMMAND` to `dsh plugin --profile web add google-trends-for-agent@latest` (`src/client/dashboard-theme.ts`, `src/version-check.ts`).
11
+
3
12
  ## 0.2.43 — 2026-11-26
4
13
 
5
14
  ### dsh install walkthrough & docs alignment
package/README.md CHANGED
@@ -185,7 +185,7 @@ Use `: true` under `allowBuilds:` rather than an `onlyBuiltDependencies:` list;
185
185
 
186
186
  </details>
187
187
 
188
- The plugin is enabled by default after install and provides four native tools plus a `gtfa` skill. In dsh 0.2.2-rc.1, open **dsh web → Plugins → Google Trends** (the installed-plugin card), then under **Components** click the **Google Trends / gtfa** row to open the settings page. Choose **Local (this machine)**, **Public Actor**, or **My own Actor** under **Egress**, then click **Save**; login itself needs no Save. When the Host provides its credentials service, both Actor routes offer **Sign in with Apify**: the page shows Apify's official authorization link and user code, checks pending status every 2 seconds while honoring Apify's polling interval (including `slow_down`), pauses when closed, resumes when reopened, and restarts an expired attempt. Apify's only current device OAuth scope is `full_api_access`—full Apify API access, not access limited to this Actor or tool.
188
+ The plugin is enabled by default after install and provides four native tools plus a `gtfa` skill. Click **Plugin settings** (or the route pill) inside the **Google Trends** sidebar panel—or open **Plugins → Google Trends → Components → Google Trends / gtfa**—to open the standalone settings page. Choose **Local (this machine)**, **Public Actor**, or **My own Actor** under **Egress**, then click **Save**; login itself needs no Save. When the Host provides its credentials service, both Actor routes offer **Sign in with Apify**: the page shows Apify's official authorization link and user code, checks pending status every 2 seconds while honoring Apify's polling interval (including `slow_down`), pauses when closed, resumes when reopened, and restarts an expired attempt. Apify's only current device OAuth scope is `full_api_access`—full Apify API access, not access limited to this Actor or tool.
189
189
 
190
190
  The settings page uses three egress cards, with OAuth status and usage directly below. Expand **Usage details** for billing-cycle and proxy details. **Advanced** groups **Calibration baselines**, **Manual Token** (Actor routes only), and **Files and charts**. **Save** and **Discard** float above the page while scrolling; **Test connection** checks the current connection, including unsaved Actor or manual-token changes, without saving them. Use the account menu beside the connection check to sign out. The layout follows the Host's light/dark theme and stacks on narrow screens.
191
191
 
package/README.zh-CN.md CHANGED
@@ -183,7 +183,7 @@ allowBuilds:
183
183
 
184
184
  </details>
185
185
 
186
- 插件安装后默认启用,提供四个原生工具和 `gtfa` skill。在 dsh 0.2.2-rc.1 中,打开 **dsh web → Plugins → Google Trends** 已安装插件卡片,在详情页 **Components** 下点击 **Google Trends / gtfa** 行进入设置页。在 **Connection(连接方式)** 区块选择 **本机直连**、**公共 Actor** 或 **我自己的 Actor**,再点 **Save(保存)** 应用 egress;登录本身不需要 Save。Host 提供 credentials service 时,两条 Actor 路线都提供 **Sign in with Apify(登录 Apify)**:页面显示 Apify 官方授权链接和 user code;pending 时每 2 秒查询一次状态并遵守 Apify 的 polling interval(包括 `slow_down`),关闭页面暂停、重新打开继续,过期后重新发起。Apify 当前的 device OAuth scope 只有 `full_api_access`——这是完整 Apify API 访问权限,不是仅限本 Actor 或本工具的权限。
186
+ 插件安装后默认启用,提供四个原生工具和 `gtfa` skill。在侧边栏 **Google Trends** 面板右上角直接点击 **插件设置**(或连接路线标签)即可一步进入独立设置页;也可以通过 **插件 → Google Trends → 组件 → Google Trends / gtfa** 打开。在 **Connection(连接方式)** 区块选择 **本机直连**、**公共 Actor** 或 **我自己的 Actor**,再点 **Save(保存)** 应用 egress;登录本身不需要 Save。Host 提供 credentials service 时,两条 Actor 路线都提供 **Sign in with Apify(登录 Apify)**:页面显示 Apify 官方授权链接和 user code;pending 时每 2 秒查询一次状态并遵守 Apify 的 polling interval(包括 `slow_down`),关闭页面暂停、重新打开继续,过期后重新发起。Apify 当前的 device OAuth scope 只有 `full_api_access`——这是完整 Apify API 访问权限,不是仅限本 Actor 或本工具的权限。
187
187
 
188
188
  每次操作都会重新解析凭据:优先使用已存储的 OAuth session;只有在没有存储 session 时才使用已保存 config token,再回退到 `APIFY_TOKEN`。已存储的 session 若过期或损坏且无法 refresh,必须重新登录,不能静默回退或当作成功。OAuth 凭据不会进入浏览器可见状态,也不会进入模型可见的 tool input/output;Host 内部代码通过 credentials service 解析后调用 Apify。Host 没有该服务时,OAuth 不可用,但本机 egress、手动 token 和 `APIFY_TOKEN` 仍可使用。对 dsh device flow,当前 access token 是长效 token,不签发 refresh token;若 Apify 未来返回标准过期/刷新响应,插件可兼容处理。
189
189
 
@@ -812,24 +812,37 @@ var SETTINGS_CSS = `
812
812
  .gtfa-account-menu button:not(:disabled):hover { background:var(--gtfa-hover); }
813
813
  .gtfa-oauth-foot { padding:0 16px 14px; display:grid; gap:8px; }
814
814
  .gtfa-oauth-code-row { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
815
- .gtfa-free-credit,.gtfa-usage-banner { --gtfa-card-ink:var(--gtfa-ink); --gtfa-card-muted:var(--gtfa-muted); --gtfa-card-accent:var(--gtfa-accent); --gtfa-card-line:var(--gtfa-line); --gtfa-card-progress:var(--gtfa-accent); --gtfa-card-warning:#d97706; --gtfa-card-error:#dc2626; position:relative; isolation:isolate; overflow:hidden; container:gtfa-credit / inline-size; margin:0; padding:12px 15px; border:0; border-top:1px solid var(--gtfa-card-line); border-radius:0; color:var(--gtfa-card-ink); background:var(--gtfa-surface); }
816
- .gtfa-free-credit-copy { position:relative; z-index:1; width:100%; }
815
+ .gtfa-free-credit {
816
+ --gtfa-card-ink:#fff; --gtfa-card-muted:rgba(219,234,254,.92); --gtfa-card-accent:#fff; --gtfa-card-line:rgba(255,255,255,.16);
817
+ position:relative; isolation:isolate; overflow:hidden; container:gtfa-credit / inline-size;
818
+ margin:12px 15px 14px; padding:16px 18px;
819
+ border:1px solid rgba(255,255,255,.18); border-radius:12px;
820
+ color:#fff; background:linear-gradient(135deg,#1d4ed8 0%,#2563eb 56%,#3b82f6 100%);
821
+ box-shadow:0 8px 22px rgba(37,99,235,.22);
822
+ }
823
+ .gtfa-usage-banner { --gtfa-card-ink:var(--gtfa-ink); --gtfa-card-muted:var(--gtfa-muted); --gtfa-card-accent:var(--gtfa-accent); --gtfa-card-line:var(--gtfa-line); --gtfa-card-progress:var(--gtfa-accent); --gtfa-card-warning:#d97706; --gtfa-card-error:#dc2626; position:relative; isolation:isolate; overflow:hidden; container:gtfa-credit / inline-size; margin:0; padding:12px 15px; border:0; border-top:1px solid var(--gtfa-card-line); border-radius:0; color:var(--gtfa-card-ink); background:var(--gtfa-surface); }
824
+ .gtfa-free-credit-copy { position:relative; z-index:1; width:100%; display:flex; align-items:center; justify-content:space-between; gap:16px; }
825
+ .gtfa-free-credit-main { min-width:0; }
817
826
  .gtfa-credit-eyebrow { display:block; color:var(--gtfa-card-muted); font-size:10.5px; font-weight:600; letter-spacing:.8px; }
818
- .gtfa-credit-value { display:flex; align-items:baseline; flex-wrap:wrap; gap:10px; margin-top:6px; }
819
- .gtfa-credit-value strong { color:var(--gtfa-card-accent); font-size:30px; font-weight:720; letter-spacing:-.03em; line-height:1.15; font-variant-numeric:tabular-nums; }
820
- .gtfa-credit-value>span { color:var(--gtfa-card-ink); font-size:13.5px; font-weight:550; }
821
- .gtfa-free-credit-estimate { margin:5px 0 12px; font-size:12px; color:var(--gtfa-card-muted); }
822
- .gtfa-free-credit-copy small { display:block; margin-top:9px; font-size:10.5px; color:var(--gtfa-quiet); }
823
- .gtfa-free-credit-actions { display:flex; align-items:center; gap:14px; font-size:12px; }
824
- .gtfa-settings a.gtfa-credit-cta { display:inline-flex; align-items:center; padding:7px 14px; border-radius:8px; background:var(--gtfa-card-accent); color:#fff; font-weight:600; text-decoration:none; }
825
- .gtfa-settings a.gtfa-credit-cta:hover { background:#1d4ed8; }
826
- .gtfa-settings a.gtfa-credit-pricing { color:var(--gtfa-card-muted); text-decoration:none; }
827
+ .gtfa-credit-value { display:flex; align-items:baseline; flex-wrap:wrap; gap:10px; margin-top:5px; }
828
+ .gtfa-credit-value strong { color:var(--gtfa-card-accent); font-size:28px; font-weight:740; letter-spacing:-.03em; line-height:1.1; font-variant-numeric:tabular-nums; }
829
+ .gtfa-credit-value>span { color:var(--gtfa-card-ink); font-size:13.5px; font-weight:600; }
830
+ .gtfa-free-credit-estimate { margin:5px 0 0; font-size:12px; color:var(--gtfa-card-muted); }
831
+ .gtfa-free-credit-copy small { display:block; margin-top:6px; font-size:10.5px; color:rgba(191,219,254,.82); }
832
+ .gtfa-free-credit-actions { display:flex; align-items:center; gap:14px; font-size:12px; flex-shrink:0; }
833
+ .gtfa-settings a.gtfa-credit-cta { display:inline-flex; align-items:center; padding:8px 15px; border-radius:9px; background:#fff; color:#1d4ed8; font-weight:650; text-decoration:none; box-shadow:0 2px 8px rgba(15,23,42,.12); white-space:nowrap; }
834
+ .gtfa-settings a.gtfa-credit-cta:hover { background:#eff6ff; }
835
+ .gtfa-settings a.gtfa-credit-pricing { color:rgba(239,246,255,.94); font-weight:550; text-decoration:none; white-space:nowrap; }
827
836
  .gtfa-settings a.gtfa-credit-pricing:hover { text-decoration:underline; }
828
837
  .gtfa-free-credit a:focus-visible,.gtfa-usage-banner button:focus-visible,.gtfa-usage-banner summary:focus-visible { outline-color:var(--gtfa-card-accent); }
829
- .gtfa-credit-art { display:none; }
838
+ .gtfa-credit-art { display:block; position:absolute; right:0; top:0; bottom:0; width:260px; height:100%; pointer-events:none; z-index:0; opacity:.85; }
839
+ .gtfa-usage-banner .gtfa-credit-art { display:block; }
840
+ @container gtfa-credit (max-width:460px) {
841
+ .gtfa-free-credit-copy { flex-direction:column; align-items:flex-start; gap:12px; }
842
+ }
830
843
  @container gtfa-credit (max-width:340px) {
831
844
  .gtfa-credit-value { gap:8px; }
832
- .gtfa-credit-value strong { font-size:26px; }
845
+ .gtfa-credit-value strong { font-size:24px; }
833
846
  .gtfa-credit-value>span { font-size:12.5px; }
834
847
  }
835
848
  .gtfa-defaults-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@@ -1209,7 +1222,11 @@ var DASHBOARD_CSS = `
1209
1222
  .gd-button.primary:not(:disabled):hover{background:#1d4ed8;border-color:#1d4ed8}
1210
1223
  .gd-button.ghost{border-color:transparent;background:transparent;color:var(--gtfa-muted);padding:0 9px}
1211
1224
  .gd-button.ghost:not(:disabled):hover{background:var(--gtfa-soft);color:var(--gtfa-ink);border-color:transparent}
1225
+ .gd-button.active{border-color:var(--gtfa-accent);background:var(--gtfa-accent-soft);color:var(--gtfa-accent)}
1212
1226
  .gd-button.compact{height:32px;min-height:32px;max-height:32px;padding:0 11px;font-size:12px!important}
1227
+ .gd-settings-view{max-width:820px;margin:0 auto}
1228
+ .gd-settings-bar{display:flex;align-items:center;gap:12px;margin-bottom:14px}
1229
+ .gd-settings-bar h2{font-size:15px;font-weight:650;letter-spacing:-.015em;color:var(--gtfa-ink)}
1213
1230
  .gd-input{padding:0 12px;width:100%;min-width:0}
1214
1231
  .gd-input::placeholder{color:var(--gtfa-quiet)}
1215
1232
 
@@ -1226,17 +1243,17 @@ var DASHBOARD_CSS = `
1226
1243
  .gd-check>input:focus-visible+.gd-check-box{border-color:var(--gtfa-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--gtfa-accent) 18%,transparent)}
1227
1244
  .gd-check-box.checked,.gd-check-box.indeterminate{background:var(--gtfa-accent);border-color:var(--gtfa-accent)}
1228
1245
 
1229
- /* Upgraded ChoicePicker inside Dashboard (preserves 40px height & 0px left padding test contract) */
1230
- .gtfa-dashboard .gtfa-choice-field{gap:0;min-width:0}
1231
- .gtfa-dashboard .gtfa-choice-field.compact .gtfa-choice-control{
1246
+ /* Upgraded ChoicePicker inside Dashboard Query Bar (preserves 40px height & 0px left padding test contract) */
1247
+ .gd-command-bar .gtfa-choice-field,.gd-record-tools .gtfa-choice-field{gap:0;min-width:0}
1248
+ .gd-command-bar .gtfa-choice-field.compact .gtfa-choice-control,.gd-record-tools .gtfa-choice-field.compact .gtfa-choice-control{
1232
1249
  height:40px;min-height:40px;max-height:40px;padding:0;gap:0;
1233
1250
  border-radius:8px;background:var(--gtfa-surface);
1234
1251
  }
1235
- .gtfa-dashboard .gtfa-choice-control input{
1252
+ .gd-command-bar .gtfa-choice-control input,.gd-record-tools .gtfa-choice-control input{
1236
1253
  height:38px;min-height:38px;flex:1;width:0;min-width:0;
1237
1254
  font-size:12.5px;font-weight:500;padding:0 12px;text-overflow:ellipsis;
1238
1255
  }
1239
- .gtfa-dashboard .gtfa-choice-field.compact .gtfa-choice-toggle{height:38px;width:30px;flex:0 0 30px}
1256
+ .gd-command-bar .gtfa-choice-field.compact .gtfa-choice-toggle,.gd-record-tools .gtfa-choice-field.compact .gtfa-choice-toggle{height:38px;width:30px;flex:0 0 30px}
1240
1257
  .gtfa-dashboard .gtfa-choice-option{min-height:34px;font-size:12.5px;padding:7px 10px;border-radius:7px}
1241
1258
  .gtfa-dashboard .gtfa-choice-popover{
1242
1259
  border-radius:12px;padding:5px;min-width:178px;
@@ -1340,10 +1357,26 @@ var DASHBOARD_CSS = `
1340
1357
  .gd-progress-track>i{display:block;height:100%;width:30%;border-radius:inherit;background:var(--gtfa-accent);animation:gd-progress 1.6s ease-in-out infinite}
1341
1358
  .gd-spinner{display:flex;color:var(--gtfa-accent);animation:gtfa-spin 1.2s linear infinite}
1342
1359
  @keyframes gd-progress{from{transform:translateX(-110%)}to{transform:translateX(440%)}}
1343
- @media(prefers-reduced-motion:reduce){.gd-progress-track>i,.gd-spinner{animation:none}}
1360
+ @keyframes gd-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}
1361
+ @media(prefers-reduced-motion:reduce){.gd-progress-track>i,.gd-spinner,.gd-skel{animation:none}}
1362
+
1363
+ /* Loading Skeleton while new query runs */
1364
+ .gd-loading-grid{display:grid;grid-template-columns:minmax(0,1.88fr) minmax(300px,1fr);gap:16px;align-items:start}
1365
+ .gd-skeleton-card{padding:20px;display:grid;gap:12px}
1366
+ .gd-skel{
1367
+ border-radius:8px;
1368
+ background:linear-gradient(90deg,var(--gtfa-soft) 25%,color-mix(in srgb,var(--gtfa-ink) 6%,var(--gtfa-surface)) 50%,var(--gtfa-soft) 75%);
1369
+ background-size:200% 100%;animation:gd-shimmer 1.5s ease-in-out infinite;
1370
+ }
1371
+ .gd-skel.title{height:22px;width:36%;border-radius:7px}
1372
+ .gd-skel.sub{height:14px;width:54%;border-radius:6px}
1373
+ .gd-skel.chart{height:240px;border-radius:11px;margin-top:4px}
1374
+ .gd-skel.row{height:38px;border-radius:9px}
1375
+ .gd-skel.side-title{height:18px;width:44%;border-radius:6px}
1376
+ .gd-skel.side-btn{height:38px;border-radius:9px}
1344
1377
 
1345
1378
  /* Result 2-Column Workspace */
1346
- .gd-results{margin-top:0}
1379
+ .gd-results{display:flex;flex-direction:column;gap:16px;margin-top:0}
1347
1380
  .gd-result-grid{display:grid;grid-template-columns:minmax(0,1.88fr) minmax(300px,1fr);gap:16px;align-items:start}
1348
1381
  .gd-chart-card{overflow:hidden}
1349
1382
  .gd-result-head{
@@ -1432,6 +1465,9 @@ var DASHBOARD_CSS = `
1432
1465
  .gd-anchor-round{font-size:10.5px;font-weight:600;color:var(--gtfa-muted);background:var(--gtfa-surface);padding:1px 6px;border-radius:4px}
1433
1466
  .gd-anchor-line b{overflow-wrap:anywhere;font-weight:600}
1434
1467
  .gd-anchor-line>span:last-child{font-variant-numeric:tabular-nums;color:var(--gtfa-muted)}
1468
+ .gd-anchor-source{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:1px solid var(--gtfa-line);font-size:11px;color:var(--gtfa-muted)}
1469
+ .gd-anchor-source a{display:inline-flex;align-items:center;gap:4px;color:var(--gtfa-accent);font-weight:550;text-decoration:none}
1470
+ .gd-anchor-source a:hover{text-decoration:underline}
1435
1471
 
1436
1472
  /* Legacy / Individual Volume Cards */
1437
1473
  .gd-volume-note{font-size:12px;color:var(--gtfa-muted);line-height:1.65;padding:12px;border-radius:10px;background:var(--gtfa-soft)}
@@ -1448,21 +1484,22 @@ var DASHBOARD_CSS = `
1448
1484
  .gd-meta-cost{color:var(--gtfa-accent);font-weight:600;font-variant-numeric:tabular-nums}
1449
1485
  /* Details Disclosure */
1450
1486
  .gd-query-details{margin-top:12px;border-top:1px solid var(--gtfa-line);padding-top:10px;font-size:11.5px;color:var(--gtfa-muted)}
1487
+ .gd-query-details:first-child{margin-top:0;border-top:0;padding-top:0}
1451
1488
  .gd-query-details summary{cursor:pointer;list-style:none;display:flex;align-items:center;justify-content:space-between;color:var(--gtfa-muted)}
1452
1489
  .gd-query-details summary::-webkit-details-marker{display:none}
1453
1490
  .gd-query-details[open] .gd-chevron{transform:rotate(180deg)}
1454
1491
  .gd-chevron{transition:transform .16s ease}
1455
1492
  .gd-query-details dl{margin:10px 0 0;display:grid;gap:7px}
1456
1493
  .gd-query-details dl>div{display:flex;justify-content:space-between;gap:12px}
1457
- .gd-query-details dt{color:var(--gtfa-quiet)}
1458
- .gd-query-details dd{margin:0;color:var(--gtfa-ink);text-align:right;font-variant-numeric:tabular-nums}
1494
+ .gd-query-details dt{color:var(--gtfa-quiet);white-space:nowrap;flex:none}
1495
+ .gd-query-details dd{margin:0;color:var(--gtfa-ink);text-align:right;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
1459
1496
  .gd-detail-runs{margin-top:11px;padding-top:10px;border-top:1px dashed var(--gtfa-line);display:grid;gap:6px}
1460
1497
  .gd-detail-runs-head{font-size:11px;font-weight:600;color:var(--gtfa-muted)}
1461
1498
  .gd-detail-run-row{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:11px;padding:4px 8px;border-radius:7px;background:var(--gtfa-soft)}
1462
1499
  .gd-detail-run-meta{display:flex;align-items:center;gap:6px;min-width:0;flex-wrap:wrap;color:var(--gtfa-ink);font-weight:500}
1463
1500
  .gd-detail-run-meta code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:var(--gtfa-muted);font-weight:400}
1464
1501
  .gd-detail-run-cost{font-variant-numeric:tabular-nums;font-weight:650;color:var(--gtfa-ink);white-space:nowrap}
1465
- .gd-warnings{padding:12px 16px;border:1px solid var(--gtfa-line);border-radius:12px;margin-top:14px;font-size:11.5px;color:var(--gtfa-muted);background:var(--gtfa-surface)}
1502
+ .gd-warnings{padding:12px 16px;border:1px solid var(--gtfa-line);border-radius:12px;margin:0;font-size:11.5px;color:var(--gtfa-muted);background:var(--gtfa-surface)}
1466
1503
  .gd-warnings summary{cursor:pointer}
1467
1504
  .gd-warnings p{margin-top:8px;overflow-wrap:anywhere}
1468
1505
 
@@ -1490,13 +1527,77 @@ var DASHBOARD_CSS = `
1490
1527
  }
1491
1528
  .gd-related-row:hover .gd-related-add,.gd-related-add:focus-visible{opacity:1;color:var(--gtfa-muted)}
1492
1529
  .gd-related-add:not(:disabled):hover{color:var(--gtfa-accent);background:var(--gtfa-accent-soft)}
1493
- .gd-related{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:16px}
1530
+ .gd-related{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:0}
1494
1531
  .gd-related .gd-card{padding-bottom:10px}
1495
1532
  .gd-related p{display:flex;justify-content:space-between;gap:16px;padding:8px 20px;font-size:12px;border-top:1px solid var(--gtfa-soft)}
1496
1533
 
1497
- /* Error & Empty */
1498
- .gd-error{padding:11px 15px;border-radius:10px;background:color-mix(in srgb,#dc2626 8%,var(--gtfa-surface));color:var(--dsw-alias-state-error-primary,#c53d47);font-size:12px;margin:0 0 16px!important;display:flex;align-items:center;justify-content:space-between;gap:14px}
1499
- .gd-error-code{font-size:11.5px;color:var(--dsw-alias-state-error-primary,#c53d47);background:color-mix(in srgb,#dc2626 8%,var(--gtfa-surface));padding:9px 11px;border-radius:8px;margin:10px 0!important}
1534
+ /* Error, Local Egress Alert & Empty */
1535
+ .gd-error{
1536
+ padding:12px 16px;border-radius:12px;
1537
+ border:1px solid color-mix(in srgb,#dc2626 22%,var(--gtfa-line));
1538
+ background:color-mix(in srgb,#dc2626 6%,var(--gtfa-surface));
1539
+ color:var(--dsw-alias-state-error-primary,#c53d47);
1540
+ font-size:12.5px;line-height:1.55;margin:0;
1541
+ display:flex;align-items:center;justify-content:space-between;gap:14px;
1542
+ }
1543
+ .gd-workspace>.gd-error{margin-bottom:16px}
1544
+ .gd-error-code{
1545
+ font-size:11.5px;color:var(--dsw-alias-state-error-primary,#c53d47);
1546
+ background:color-mix(in srgb,#dc2626 7%,var(--gtfa-surface));
1547
+ border:1px solid color-mix(in srgb,#dc2626 18%,var(--gtfa-line));
1548
+ padding:9px 11px;border-radius:8px;margin:10px 0 0;
1549
+ }
1550
+ .gd-local-alert{
1551
+ display:flex;align-items:center;justify-content:space-between;gap:16px;
1552
+ padding:13px 16px;border-radius:13px;
1553
+ border:1px solid color-mix(in srgb,#dc2626 24%,var(--gtfa-line));
1554
+ background:color-mix(in srgb,#dc2626 5%,var(--gtfa-surface));
1555
+ box-shadow:0 2px 8px rgba(220,38,38,.04);
1556
+ }
1557
+ .gd-local-alert-main{display:flex;align-items:center;gap:12px;min-width:0;flex:1}
1558
+ .gd-local-alert-icon{
1559
+ width:32px;height:32px;border-radius:9px;flex:none;
1560
+ display:inline-flex;align-items:center;justify-content:center;
1561
+ background:color-mix(in srgb,#dc2626 12%,var(--gtfa-surface));
1562
+ color:var(--dsw-alias-state-error-primary,#dc2626);
1563
+ }
1564
+ .gd-local-alert-copy{min-width:0;flex:1}
1565
+ .gd-local-alert-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
1566
+ .gd-local-alert-head h3{font-size:13.5px;font-weight:650;color:var(--gtfa-ink);padding:0}
1567
+ .gd-local-alert-code{
1568
+ font-size:10.5px;font-weight:600;padding:1.5px 7px;border-radius:6px;
1569
+ background:color-mix(in srgb,#dc2626 11%,var(--gtfa-surface));
1570
+ color:var(--dsw-alias-state-error-primary,#c53d47);
1571
+ font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
1572
+ }
1573
+ .gd-local-alert-copy>p{font-size:12px;color:var(--gtfa-muted);line-height:1.5;margin-top:2px}
1574
+ .gd-local-alert-cta{flex:none;height:34px;min-height:34px;max-height:34px;padding:0 14px;border-radius:8px;font-weight:600}
1575
+ .gd-failed-empty{
1576
+ min-height:208px;display:flex;flex-direction:column;align-items:center;justify-content:center;
1577
+ gap:8px;padding:28px 24px 32px;text-align:center;border-top:1px solid var(--gtfa-line);
1578
+ background:color-mix(in srgb,var(--gtfa-soft) 35%,var(--gtfa-surface));
1579
+ }
1580
+ .gd-failed-empty-icon{
1581
+ width:40px;height:40px;border-radius:12px;margin-bottom:2px;
1582
+ display:inline-flex;align-items:center;justify-content:center;
1583
+ background:color-mix(in srgb,#dc2626 9%,var(--gtfa-surface));
1584
+ color:var(--dsw-alias-state-error-primary,#c53d47);
1585
+ }
1586
+ .gd-failed-empty h4{font-size:14px;font-weight:650;color:var(--gtfa-ink)}
1587
+ .gd-failed-empty p{font-size:12.5px;color:var(--gtfa-muted);max-width:460px;line-height:1.6}
1588
+ .gd-failed-terms{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px;margin-top:6px}
1589
+ .gd-failed-terms span{
1590
+ display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;
1591
+ border:1px solid var(--gtfa-line);background:var(--gtfa-surface);font-size:11.5px;font-weight:500;color:var(--gtfa-ink);
1592
+ }
1593
+ .gd-failed-terms i{width:7px;height:7px;border-radius:2px;display:inline-block}
1594
+ .gd-status-box{
1595
+ display:flex;align-items:center;justify-content:space-between;gap:10px;
1596
+ padding:10px 12px;border-radius:10px;margin-bottom:12px;
1597
+ background:color-mix(in srgb,#dc2626 6%,var(--gtfa-surface));
1598
+ border:1px solid color-mix(in srgb,#dc2626 18%,var(--gtfa-line));
1599
+ font-size:12px;color:var(--gtfa-muted);
1600
+ }
1500
1601
  .gd-empty{min-height:240px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;color:var(--gtfa-quiet);padding:40px 20px;text-align:center}
1501
1602
  .gd-empty h3{font-size:14.5px;padding:0;color:var(--gtfa-ink)}
1502
1603
  .gd-empty p{font-size:12px;color:var(--gtfa-muted)}
@@ -1575,9 +1676,13 @@ var DASHBOARD_CSS = `
1575
1676
  .gd-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}
1576
1677
  .gd-dialog-actions>.gd-button:last-child{color:#fff;background:#dc2626;border-color:#dc2626}
1577
1678
 
1679
+ @media(prefers-color-scheme:dark){
1680
+ .gd-purpose-pill.batch-round,.gd-purpose-pill.single-retry,.gd-purpose-pill.estimate{background:color-mix(in srgb,#8b5cf6 18%,var(--gtfa-surface));color:#c4b5fd}
1681
+ .gd-local-alert-icon,.gd-local-alert-code,.gd-error,.gd-error-code,.gd-badge.blocked,.gd-badge.error{color:var(--dsw-alias-state-error-primary,#f87171)}
1682
+ }
1578
1683
  @container gd (max-width:1060px){
1579
1684
  .gd-workspace{padding:18px 20px 24px}
1580
- .gd-result-grid{grid-template-columns:1fr}
1685
+ .gd-result-grid,.gd-loading-grid{grid-template-columns:1fr}
1581
1686
  }
1582
1687
  @container gd (max-width:780px){
1583
1688
  .gd-topbar{padding:0 14px;grid-template-columns:auto 1fr auto;gap:10px}
@@ -1592,6 +1697,8 @@ var DASHBOARD_CSS = `
1592
1697
  .gd-record-tools>.gd-input{max-width:none;flex-basis:100%}
1593
1698
  .gd-record-tools>.gd-record-clear{margin-left:0;width:100%}
1594
1699
  .gd-record-tools>.gd-record-clear>.gd-button{flex:1}
1700
+ .gd-local-alert{flex-direction:column;align-items:stretch;gap:14px;padding:15px 16px}
1701
+ .gd-local-alert-cta{width:100%}
1595
1702
  }
1596
1703
  @container gd (max-width:520px){
1597
1704
  .gd-brand h1{display:none}
@@ -1746,13 +1853,13 @@ var DashboardController = class {
1746
1853
  if (!this.disposed && !signal.aborted && this.value.operation?.requestId === requestId) this.pollProgress(requestId, signal);
1747
1854
  }, 1e3);
1748
1855
  }
1749
- async operate(terms, send) {
1856
+ async operate(terms, send, initialPatch) {
1750
1857
  if (this.queryController || this.disposed) return false;
1751
1858
  this.viewController?.abort();
1752
1859
  const operation = new AbortController(), requestId = crypto.randomUUID(), startedAt = Date.now();
1753
1860
  this.queryController = operation;
1754
1861
  const signal = AbortSignal.any([operation.signal, AbortSignal.timeout(13e4)]);
1755
- this.commit({ fieldError: "", error: "", operation: { requestId, startedAt, phase: "requesting", terms } }, true);
1862
+ this.commit({ ...initialPatch, fieldError: "", error: "", operation: { requestId, startedAt, phase: "requesting", terms } }, true);
1756
1863
  this.pollProgress(requestId, signal);
1757
1864
  try {
1758
1865
  await send(signal, requestId, startedAt);
@@ -1803,7 +1910,7 @@ var DashboardController = class {
1803
1910
  costUsd: null,
1804
1911
  errorCode: null
1805
1912
  }, result: output.result }, metric: "interest" }, true);
1806
- });
1913
+ }, { result: null, metric: "interest" });
1807
1914
  }
1808
1915
  async estimate(term, action = "estimate") {
1809
1916
  const id = this.value.result?.record.id;
@@ -2058,7 +2165,7 @@ function parseActorRuntime(value) {
2058
2165
 
2059
2166
  // src/version-check.ts
2060
2167
  var GTFA_RELEASES_URL = `${GTFA_SOURCE_URL}/releases`;
2061
- var GTFA_UPGRADE_COMMAND = "dsh plugin --profile web add github:meka-im/google-trends-for-agent";
2168
+ var GTFA_UPGRADE_COMMAND = "dsh plugin --profile web add google-trends-for-agent@latest";
2062
2169
  var SEMVER_RE = /^v?(\d{1,5})\.(\d{1,5})\.(\d{1,5})(?:-([a-zA-Z0-9.-]{1,40}))?$/;
2063
2170
  function parseSemver(raw) {
2064
2171
  if (typeof raw !== "string") return null;
@@ -2141,7 +2248,7 @@ function parseVersionStatus(value) {
2141
2248
 
2142
2249
  // src/client/update-banner.tsx
2143
2250
  var import_jsx_runtime5 = require("react/jsx-runtime");
2144
- var CLIENT_VERSION = "0.2.43" ? "0.2.43" : null;
2251
+ var CLIENT_VERSION = "0.2.44" ? "0.2.44" : null;
2145
2252
  var VERSION_URL = "api/gtfa.version";
2146
2253
  var DISMISS_STORAGE_KEY = "gtfa.update.dismissed.1";
2147
2254
  function template2(text2, values) {
@@ -2772,7 +2879,7 @@ function HistorySummaryStrip({ records, actorRuns, mode, days, setDays, loading,
2772
2879
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { compact: true, ghost: true, disabled: loading, onClick: refresh, label: t("dashRefresh"), title: t("dashRefresh"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "refresh", size: 14 }) })
2773
2880
  ] });
2774
2881
  }
2775
- function Dashboard({ t, openSettings, controller: supplied }) {
2882
+ function Dashboard({ t, openSettings, renderSettings, controller: supplied }) {
2776
2883
  const own = (0, import_react5.useRef)(null);
2777
2884
  if (!supplied && !own.current) own.current = new DashboardController();
2778
2885
  const controller = supplied ?? own.current;
@@ -2797,6 +2904,7 @@ function Dashboard({ t, openSettings, controller: supplied }) {
2797
2904
  const setRunSource = (value) => controller.set("runSource", value);
2798
2905
  const setRunPage = (value) => controller.set("runPage", value);
2799
2906
  const [clearing, setClearing] = (0, import_react5.useState)(null), [deleting, setDeleting] = (0, import_react5.useState)(false);
2907
+ const [settingsOpen, setSettingsOpen] = (0, import_react5.useState)(false);
2800
2908
  const [versionStatus, setVersionStatus] = (0, import_react5.useState)(null);
2801
2909
  const [dismissedKey, setDismissedKey] = (0, import_react5.useState)(() => readDismissedUpdateKey());
2802
2910
  const [copiedRunId, setCopiedRunId] = (0, import_react5.useState)(null);
@@ -2884,12 +2992,20 @@ function Dashboard({ t, openSettings, controller: supplied }) {
2884
2992
  writeDismissedUpdateKey(currentDismissKey);
2885
2993
  setDismissedKey(currentDismissKey);
2886
2994
  };
2995
+ const canOpenSettings = Boolean(renderSettings || openSettings);
2996
+ const handleOpenSettings = renderSettings ? () => {
2997
+ setSettingsOpen(true);
2998
+ } : openSettings;
2999
+ const closeSettings = () => {
3000
+ setSettingsOpen(false);
3001
+ void refresh();
3002
+ };
2887
3003
  const reopenUpdate = () => {
2888
3004
  if (updateDismissed) {
2889
3005
  writeDismissedUpdateKey(null);
2890
3006
  setDismissedKey(null);
2891
- } else if (updateMode !== "up-to-date" && openSettings) {
2892
- openSettings();
3007
+ } else if (updateMode !== "up-to-date" && handleOpenSettings) {
3008
+ handleOpenSettings();
2893
3009
  }
2894
3010
  };
2895
3011
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gtfa-settings gtfa-dashboard", children: [
@@ -2904,9 +3020,12 @@ function Dashboard({ t, openSettings, controller: supplied }) {
2904
3020
  event.preventDefault();
2905
3021
  const tabs = ["query", "records"], index = tabs.indexOf(tab);
2906
3022
  const next = event.key === "Home" ? 0 : event.key === "End" ? 1 : (index + 1) % 2;
3023
+ if (settingsOpen) closeSettings();
3024
+ else setSettingsOpen(false);
2907
3025
  setTab(tabs[next]);
2908
3026
  event.currentTarget.querySelectorAll("[role=tab]")[next]?.focus();
2909
- }, children: ["query", "records"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", role: "tab", id: `gd-tab-${key}`, "aria-controls": `gd-panel-${key}`, "aria-selected": tab === key, tabIndex: tab === key ? 0 : -1, onClick: () => {
3027
+ }, children: ["query", "records"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", role: "tab", id: `gd-tab-${key}`, "aria-controls": `gd-panel-${key}`, "aria-selected": !settingsOpen && tab === key, tabIndex: !settingsOpen && tab === key ? 0 : -1, onClick: () => {
3028
+ setSettingsOpen(false);
2910
3029
  setTab(key);
2911
3030
  void refresh();
2912
3031
  }, children: [
@@ -2914,17 +3033,39 @@ function Dashboard({ t, openSettings, controller: supplied }) {
2914
3033
  key === "records" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { children: records.length }) : null
2915
3034
  ] }, key)) }),
2916
3035
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-topbar-right", children: [
2917
- state ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "gd-route-pill", disabled: !openSettings, onClick: openSettings, children: [
3036
+ state ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "gd-route-pill", disabled: !canOpenSettings, onClick: handleOpenSettings, children: [
2918
3037
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { className: `gd-route-dot${actorWarnDot ? " warn" : ""}` }),
2919
3038
  egressLabel(state.settings.egress, t)
2920
3039
  ] }) : null,
2921
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { compact: true, disabled: !openSettings, onClick: openSettings, children: [
2922
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "sliders", size: 14 }),
2923
- t("dashSettings")
2924
- ] })
3040
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3041
+ "button",
3042
+ {
3043
+ type: "button",
3044
+ className: `gd-button compact${settingsOpen ? " active" : ""}`,
3045
+ disabled: !canOpenSettings,
3046
+ "aria-pressed": renderSettings ? settingsOpen : void 0,
3047
+ onClick: renderSettings ? () => {
3048
+ if (settingsOpen) closeSettings();
3049
+ else setSettingsOpen(true);
3050
+ } : openSettings,
3051
+ children: [
3052
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "sliders", size: 14 }),
3053
+ t("dashSettings")
3054
+ ]
3055
+ }
3056
+ )
2925
3057
  ] })
2926
3058
  ] }),
2927
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-workspace", children: [
3059
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-workspace", children: settingsOpen && renderSettings ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "gd-settings-view", "aria-label": t("dashSettings"), children: [
3060
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-settings-bar", children: [
3061
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "gd-button compact", onClick: closeSettings, children: [
3062
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m15 18-6-6 6-6" }) }),
3063
+ t("dashBackToQuery")
3064
+ ] }),
3065
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { children: t("dashSettings") })
3066
+ ] }),
3067
+ renderSettings()
3068
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
2928
3069
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2929
3070
  UpdateBanner,
2930
3071
  {
@@ -2935,8 +3076,8 @@ function Dashboard({ t, openSettings, controller: supplied }) {
2935
3076
  egressOverride: state?.settings.egress,
2936
3077
  dismissed: updateDismissed,
2937
3078
  onDismiss: dismissUpdate,
2938
- onUpdateActor: openSettings,
2939
- onSwitchPublic: openSettings
3079
+ onUpdateActor: handleOpenSettings,
3080
+ onSwitchPublic: handleOpenSettings
2940
3081
  }
2941
3082
  ),
2942
3083
  error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-error", role: "alert", children: [
@@ -2982,7 +3123,19 @@ function Dashboard({ t, openSettings, controller: supplied }) {
2982
3123
  operation && tab === "query" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(QueryProgressCard, { operation, t, cancel: controller.cancel }) : null,
2983
3124
  result ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Result, { saved: operation?.batch && operation.recordId === result.record.id ? { ...result, result: { ...result.result, batchVolume: operation.batch } } : result, actorRuns: resultRuns, metric, setMetric, busy, currentTerms: terms, egress: state?.settings.egress, estimate: (term, action) => void controller.estimate(term, action), onRunRelated: (term) => {
2984
3125
  void runTerm(term);
2985
- }, onAddCompare: appendCompare, t }, result.record.id) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-card gd-empty", children: [
3126
+ }, onAddCompare: appendCompare, openSettings: handleOpenSettings, t }, result.record.id) : operation ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-loading-grid", "aria-hidden": "true", children: [
3127
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-card gd-skeleton-card", children: [
3128
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-skel title" }),
3129
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-skel sub" }),
3130
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-skel chart" }),
3131
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-skel row" })
3132
+ ] }),
3133
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-card gd-skeleton-card", children: [
3134
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-skel side-title" }),
3135
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-skel side-btn" }),
3136
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-skel row" })
3137
+ ] })
3138
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-card gd-empty", children: [
2986
3139
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "chart", size: 30 }),
2987
3140
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: t("dashEmptyResult") }),
2988
3141
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t("dashEmptyHint") }),
@@ -3275,7 +3428,7 @@ function Dashboard({ t, openSettings, controller: supplied }) {
3275
3428
  }, confirm: () => {
3276
3429
  void clear();
3277
3430
  } }) : null
3278
- ] })
3431
+ ] }) })
3279
3432
  ] });
3280
3433
  }
3281
3434
  function volumeRows(saved) {
@@ -3340,6 +3493,14 @@ var reasonKey = {
3340
3493
  };
3341
3494
  function VolumeCards({ saved, t, egress, estimate, busy }) {
3342
3495
  const { record: record2, result } = saved;
3496
+ if (!result.ok) {
3497
+ const calibration = object(result.calibration);
3498
+ const batch = result.batchVolume;
3499
+ const hasCalibration = Array.isArray(calibration.series) && calibration.series.length > 0;
3500
+ const hasBatch = Boolean(batch?.series?.some((item) => item.traffic?.average != null));
3501
+ const hasFollowUps = Array.isArray(saved.volumeChecks) && saved.volumeChecks.some((c) => c.estimate?.traffic?.average != null || c.estimate?.range);
3502
+ if (!hasCalibration && !hasBatch && !hasFollowUps) return null;
3503
+ }
3343
3504
  if (result.onDemand && result.ok && supportsVolumeWindow(record2.time)) {
3344
3505
  const batch = result.batchVolume;
3345
3506
  const current = batch?.rounds.at(-1);
@@ -3397,7 +3558,14 @@ function VolumeCards({ saved, t, egress, estimate, busy }) {
3397
3558
  " ",
3398
3559
  t("dashPerDay")
3399
3560
  ] })
3400
- ] }, step.round))
3561
+ ] }, step.round)),
3562
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-anchor-source", children: [
3563
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("dashAnchorSource") }),
3564
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { href: BASELINE_REFERENCE_URL, target: "_blank", rel: "noopener noreferrer", title: BASELINE_REFERENCE_URL, children: [
3565
+ t("dashAnchorSourceLink"),
3566
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "external", size: 11 })
3567
+ ] })
3568
+ ] })
3401
3569
  ] }),
3402
3570
  batch?.error && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { role: "alert", className: "gd-error-code", children: [
3403
3571
  t(batch.error === "NETWORK_ERROR" ? "dashBatchNetwork" : "dashEstimateFailed"),
@@ -3456,10 +3624,48 @@ function VolumeCards({ saved, t, egress, estimate, busy }) {
3456
3624
  ] }) : null
3457
3625
  ] }, term);
3458
3626
  }),
3459
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { children: t("dashEstimateNote") })
3627
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { children: t("dashEstimateNote") }),
3628
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-anchor-source", children: [
3629
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("dashAnchorSource") }),
3630
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { href: BASELINE_REFERENCE_URL, target: "_blank", rel: "noopener noreferrer", title: BASELINE_REFERENCE_URL, children: [
3631
+ t("dashAnchorSourceLink"),
3632
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "external", size: 11 })
3633
+ ] })
3634
+ ] })
3460
3635
  ] });
3461
3636
  }
3462
- function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy, currentTerms, onRunRelated, onAddCompare }) {
3637
+ function ActionAlertBanner({ title, body, badge, ctaLabel, onAction }) {
3638
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "gd-local-alert", role: "alert", children: [
3639
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-local-alert-main", children: [
3640
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "gd-local-alert-icon", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "alert", size: 17 }) }),
3641
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-local-alert-copy", children: [
3642
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-local-alert-head", children: [
3643
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: title }),
3644
+ badge ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "gd-local-alert-code", children: badge }) : null
3645
+ ] }),
3646
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: body })
3647
+ ] })
3648
+ ] }),
3649
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "gd-button primary gd-local-alert-cta", disabled: !onAction, onClick: onAction, children: [
3650
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "sliders", size: 14 }),
3651
+ ctaLabel
3652
+ ] })
3653
+ ] });
3654
+ }
3655
+ function LocalFailureBanner({ errorCode, t, openSettings }) {
3656
+ const titleKey = errorCode === "RATE_LIMITED" ? "dashLocalFailRateLimited" : errorCode === "BLOCKED" ? "dashLocalFailBlocked" : "dashLocalFailGeneric";
3657
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3658
+ ActionAlertBanner,
3659
+ {
3660
+ title: t(titleKey),
3661
+ body: t("dashLocalFailBody"),
3662
+ badge: errorCode,
3663
+ ctaLabel: t("dashLocalFailCta"),
3664
+ onAction: openSettings
3665
+ }
3666
+ );
3667
+ }
3668
+ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy, currentTerms, onRunRelated, onAddCompare, openSettings }) {
3463
3669
  const { record: record2, result } = saved, meta = object(result.meta);
3464
3670
  const costInfo = summarizeQueryCost(actorRuns);
3465
3671
  const costSummaryValue = record2.egress === "local" ? t("dashRunFreeLocal") : record2.cached ? t("dashRunFreeCache") : costInfo.runs.length === 0 ? t("dashRunUnused") : costInfo.pricedCount > 0 ? `${runCountText(costInfo.runs.length, t)} \xB7 ${formatCostUsd(costInfo.totalCost)}` : `${runCountText(costInfo.runs.length, t)} \xB7 ${t("dashCostPending")}`;
@@ -3477,6 +3683,13 @@ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy
3477
3683
  const comparison = record2.tool === "trends_compare";
3478
3684
  const warnings = [.../* @__PURE__ */ new Set([...arrayOfStrings(meta.warnings), ...arrayOfStrings(result.warnings)])];
3479
3685
  const error = object(result.error), tables = object(result.tables);
3686
+ const errorCode = typeof error.code === "string" ? error.code : null;
3687
+ const errorMessage = typeof error.message === "string" ? error.message : null;
3688
+ const isLocalFailure = !result.ok && record2.egress === "local" && errorCode !== "INVALID_INPUT";
3689
+ const showLocalSwitchBanner = isLocalFailure && (!egress || egress === "local");
3690
+ const isActorConfigError = !result.ok && record2.egress !== "local" && errorCode === "INVALID_INPUT" && Boolean(errorMessage && /apify|actor|token|oauth|sign in/i.test(errorMessage));
3691
+ const actionBanner = showLocalSwitchBanner ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LocalFailureBanner, { errorCode, t, openSettings }) : isActorConfigError ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ActionAlertBanner, { title: t("dashActorSetupTitle"), body: t("dashActorSetupBody"), badge: errorCode, ctaLabel: t("dashActorSetupCta"), onAction: openSettings }) : null;
3692
+ const failedEmpty = !result.ok && chartSeries.length === 0;
3480
3693
  const hasRelated = !comparison && (array(tables.popular).length > 0 || array(tables.rising).length > 0);
3481
3694
  const isZh = t("dashGeo") === "\u5730\u533A";
3482
3695
  const copySummary = () => {
@@ -3509,6 +3722,7 @@ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy
3509
3722
  setTimeout(() => URL.revokeObjectURL(url), 1e3);
3510
3723
  };
3511
3724
  if (record2.tool === "trends_now") return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-results", children: [
3725
+ actionBanner,
3512
3726
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
3513
3727
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("h2", { children: [
3514
3728
  t("dashNow"),
@@ -3535,10 +3749,11 @@ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy
3535
3749
  ] }, i)),
3536
3750
  !array(region.items).length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-muted", children: t("dashUnavailable") }) : null
3537
3751
  ] }, index)) }),
3538
- typeof error.message === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-error", role: "alert", children: error.message }) : null
3752
+ errorMessage && !isLocalFailure && !isActorConfigError ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-error", role: "alert", children: errorMessage }) : null
3539
3753
  ] });
3540
- const showLegend = legend.length > 1 || legend.some((row2) => !hasChartPoints(row2) || row2.range?.points.length);
3754
+ const showLegend = !failedEmpty && (legend.length > 1 || legend.some((row2) => !hasChartPoints(row2) || row2.range?.points.length));
3541
3755
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-results", children: [
3756
+ actionBanner,
3542
3757
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-result-grid", children: [
3543
3758
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("article", { className: "gd-card gd-chart-card", children: [
3544
3759
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-result-head", children: [
@@ -3569,7 +3784,7 @@ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy
3569
3784
  ] }) : null
3570
3785
  ] })
3571
3786
  ] }),
3572
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-result-tools", children: [
3787
+ !failedEmpty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-result-tools", children: [
3573
3788
  (!result.onDemand || hasTraffic) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-metric-switch", children: ["interest", "traffic"].map(
3574
3789
  (value) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3575
3790
  "button",
@@ -3588,7 +3803,7 @@ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy
3588
3803
  ) }),
3589
3804
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { compact: true, ghost: true, onClick: copySummary, title: t("dashCopySummary"), children: copied ? t("dashCopiedSummary") : t("dashCopySummary") }),
3590
3805
  chartSeries.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { compact: true, ghost: true, onClick: downloadCsv, title: t("dashExportCsv"), children: t("dashExportCsv") }) : null
3591
- ] })
3806
+ ] }) : null
3592
3807
  ] }),
3593
3808
  showLegend ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-legend gd-chart-legend", children: legend.map((row2) => {
3594
3809
  const available = hasChartPoints(row2);
@@ -3618,51 +3833,64 @@ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy
3618
3833
  row2.term
3619
3834
  );
3620
3835
  }) }) : null,
3621
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3622
- TrendChart,
3623
- {
3624
- perDay: t("dashPerDay"),
3625
- series: visible,
3626
- traffic: currentMetric === "traffic",
3627
- label: t(currentMetric === "traffic" ? "dashTraffic" : "dashTrend"),
3628
- empty: t("dashUnavailable"),
3629
- logLabel: t("dashLogScale")
3630
- }
3631
- ),
3632
- currentMetric === "interest" && object(result.calibration).weakComparison === true ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-chart-note", children: t("dashWeakComparison") }) : null,
3633
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { className: "gd-result-stats", children: [
3634
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("tr", { children: [
3635
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashKeyword") }),
3636
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashAverage") }),
3637
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t(currentMetric === "traffic" ? "dashLatestUsable" : "dashLatest") }),
3638
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashPeak") }),
3639
- hasTraffic && currentMetric === "interest" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashVolumeEstimate") }) : null
3640
- ] }) }),
3641
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tbody", { children: series.map((row2, index) => {
3642
- const vol = trafficSeries[index];
3643
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("tr", { children: [
3644
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "gd-stat-term", children: [
3645
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { style: { background: colors[index] } }),
3646
- row2.term
3647
- ] }) }),
3648
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: row2.range ? compactVolume.format(row2.range.low) + "\u2013" + compactVolume.format(row2.range.high) : format(row2.average) }),
3649
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: format(row2.latest) }),
3650
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: format(row2.peak) }),
3651
- hasTraffic && currentMetric === "interest" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { className: vol?.average != null ? "gd-stat-vol" : "gd-muted", children: vol?.range ? compactVolume.format(vol.range.low) + "\u2013" + compactVolume.format(vol.range.high) : formatVolume(vol?.average) }) : null
3652
- ] }, row2.term);
3653
- }) })
3836
+ failedEmpty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-failed-empty", children: [
3837
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "gd-failed-empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "chart", size: 20 }) }),
3838
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: t("dashFailedEmptyTitle") }),
3839
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t(showLocalSwitchBanner ? "dashFailedEmptyHintLocal" : isLocalFailure ? "dashFailedEmptyHintSwitched" : "dashFailedEmptyHintActor") }),
3840
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "gd-failed-terms", children: record2.terms.map((term, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
3841
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { style: { background: colors[index] } }),
3842
+ term
3843
+ ] }, term)) })
3844
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
3845
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3846
+ TrendChart,
3847
+ {
3848
+ perDay: t("dashPerDay"),
3849
+ series: visible,
3850
+ traffic: currentMetric === "traffic",
3851
+ label: t(currentMetric === "traffic" ? "dashTraffic" : "dashTrend"),
3852
+ empty: t("dashUnavailable"),
3853
+ logLabel: t("dashLogScale")
3854
+ }
3855
+ ),
3856
+ currentMetric === "interest" && object(result.calibration).weakComparison === true ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-chart-note", children: t("dashWeakComparison") }) : null,
3857
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { className: "gd-result-stats", children: [
3858
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("tr", { children: [
3859
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashKeyword") }),
3860
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashAverage") }),
3861
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t(currentMetric === "traffic" ? "dashLatestUsable" : "dashLatest") }),
3862
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashPeak") }),
3863
+ hasTraffic && currentMetric === "interest" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { children: t("dashVolumeEstimate") }) : null
3864
+ ] }) }),
3865
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tbody", { children: series.map((row2, index) => {
3866
+ const vol = trafficSeries[index];
3867
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("tr", { children: [
3868
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "gd-stat-term", children: [
3869
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { style: { background: colors[index] } }),
3870
+ row2.term
3871
+ ] }) }),
3872
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: row2.range ? compactVolume.format(row2.range.low) + "\u2013" + compactVolume.format(row2.range.high) : format(row2.average) }),
3873
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: format(row2.latest) }),
3874
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { children: format(row2.peak) }),
3875
+ hasTraffic && currentMetric === "interest" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("td", { className: vol?.average != null ? "gd-stat-vol" : "gd-muted", children: vol?.range ? compactVolume.format(vol.range.low) + "\u2013" + compactVolume.format(vol.range.high) : formatVolume(vol?.average) }) : null
3876
+ ] }, row2.term);
3877
+ }) })
3878
+ ] })
3654
3879
  ] })
3655
3880
  ] }),
3656
3881
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("aside", { className: "gd-side-stack", children: [
3657
3882
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-card gd-result-info", children: [
3658
3883
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(VolumeCards, { saved, t, busy, egress, estimate }),
3659
- typeof error.code === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-error-code", children: error.code }) : null,
3660
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "gd-query-details", children: [
3884
+ !result.ok && errorCode ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "gd-status-box", children: [
3885
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("dashQueryStatus") }),
3886
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "gd-badge blocked", children: errorCode })
3887
+ ] }) : null,
3888
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "gd-query-details", open: !result.ok, children: [
3661
3889
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("summary", { children: [
3662
3890
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t("dashQueryDetails") }),
3663
3891
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { className: "gd-chevron", width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m6 9 6 6 6-6" }) })
3664
3892
  ] }),
3665
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("dl", { children: [[t("dashFetchedAt"), dateText(record2.fetchedAt, true)], [t("dashCalledAt"), dateText(record2.createdAt, true)], [t("dashRunDuration"), duration(record2.durationMs)], [t("dashEgress"), egressLabel(record2.egress, t)], [t("dashSources"), t(record2.source === "manual" ? "dashManual" : "dashAgent")], [t("dashDetailActorCost"), costSummaryValue]].map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
3893
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("dl", { children: [[t("dashFetchedAt"), dateText(record2.fetchedAt, true)], [t("dashCalledAt"), dateText(record2.createdAt, true)], [t("dashRunDuration"), duration(record2.durationMs)], [t("dashEgress"), egressLabel(record2.egress, t)], [t("dashSources"), t(record2.source === "manual" ? "dashManual" : "dashAgent")], [t("dashDetailActorCost"), costSummaryValue], ...errorMessage ? [[t("dashRawErrorLabel"), errorMessage]] : []].map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
3666
3894
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("dt", { children: key }),
3667
3895
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("dd", { children: value })
3668
3896
  ] }, key)) }),
@@ -3708,7 +3936,7 @@ function Result({ saved, actorRuns, metric, setMetric, t, egress, estimate, busy
3708
3936
  ] }) : null
3709
3937
  ] })
3710
3938
  ] }),
3711
- typeof error.message === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-error", style: { marginTop: 14 }, role: "alert", children: error.message }) : null,
3939
+ errorMessage && !isLocalFailure && !isActorConfigError ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "gd-error", role: "alert", children: errorMessage }) : null,
3712
3940
  warnings.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "gd-warnings", children: [
3713
3941
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("summary", { children: [
3714
3942
  t("dashResultInfo"),
@@ -3968,7 +4196,24 @@ var DASHBOARD_EN = {
3968
4196
  dashLedgerNote: "Tracks Actor runs started by this plugin (latest 2,000). Settings Apify total also includes builds and other clients.",
3969
4197
  dashDetailActorCost: "Actor cost",
3970
4198
  dashDetailRunsList: "Linked Actor runs",
3971
- dashAnchorTag: "Anchor"
4199
+ dashAnchorTag: "Anchor",
4200
+ dashLocalFailRateLimited: "Local request rate-limited by Google Trends",
4201
+ dashLocalFailBlocked: "Local request blocked by Google Trends",
4202
+ dashLocalFailGeneric: "Local direct request failed",
4203
+ dashLocalFailBody: "Local IPs hit limits easily. Switch to Public Actor (zero deploy) or your own Actor.",
4204
+ dashLocalFailCta: "Switch to Actor",
4205
+ dashActorSetupTitle: "Apify sign-in or Actor setup required",
4206
+ dashActorSetupBody: "Sign in with Apify or select/deploy an Actor in Plugin settings, then retry.",
4207
+ dashActorSetupCta: "Open settings",
4208
+ dashBackToQuery: "Back",
4209
+ dashQueryStatus: "Query status",
4210
+ dashFailedEmptyTitle: "No trend data returned",
4211
+ dashFailedEmptyHintLocal: "Local requests hit limits easily. Switch to an Actor for stable fetches.",
4212
+ dashFailedEmptyHintSwitched: 'Switched to Actor. Click "Query trends" above to run again.',
4213
+ dashFailedEmptyHintActor: "The request did not return usable series. Check Query details or retry.",
4214
+ dashAnchorSource: "Baseline source",
4215
+ dashAnchorSourceLink: "MEKA Anchors",
4216
+ dashRawErrorLabel: "Error detail"
3972
4217
  };
3973
4218
  var DASHBOARD_ZH = {
3974
4219
  dashPhaseRequesting: "\u6B63\u5728\u8BF7\u6C42\u8D8B\u52BF\u6570\u636E",
@@ -4193,7 +4438,24 @@ var DASHBOARD_ZH = {
4193
4438
  dashLedgerNote: "\u4EC5\u7EDF\u8BA1\u672C\u63D2\u4EF6\u53D1\u8D77\u7684 Actor \u8C03\u7528\uFF08\u4FDD\u7559\u6700\u8FD1 2,000 \u6761\uFF09\uFF1B\u8BBE\u7F6E\u9875 Apify \u603B\u7528\u91CF\u8FD8\u5305\u542B\u6784\u5EFA\u4E0E\u5176\u4ED6\u7AEF\u8C03\u7528\u3002",
4194
4439
  dashDetailActorCost: "Actor \u6D88\u8D39",
4195
4440
  dashDetailRunsList: "\u5173\u8054 Actor \u8C03\u7528",
4196
- dashAnchorTag: "\u951A\u70B9"
4441
+ dashAnchorTag: "\u951A\u70B9",
4442
+ dashLocalFailRateLimited: "\u672C\u673A\u76F4\u8FDE\u5DF2\u88AB Google Trends \u9650\u6D41",
4443
+ dashLocalFailBlocked: "\u672C\u673A\u76F4\u8FDE\u5DF2\u88AB Google Trends \u62E6\u622A",
4444
+ dashLocalFailGeneric: "\u672C\u673A\u76F4\u8FDE\u8BF7\u6C42\u5931\u8D25",
4445
+ dashLocalFailBody: "\u672C\u5730 IP \u6613\u89E6\u53D1\u98CE\u63A7\uFF0C\u5EFA\u8BAE\u5207\u6362\u81F3\u516C\u5171 Actor\uFF08\u514D\u90E8\u7F72\uFF09\u6216\u81EA\u5EFA Actor\u3002",
4446
+ dashLocalFailCta: "\u5207\u6362 Actor",
4447
+ dashActorSetupTitle: "\u8BF7\u5148\u5B8C\u6210 Apify \u767B\u5F55\u6216 Actor \u914D\u7F6E",
4448
+ dashActorSetupBody: "\u8BF7\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u767B\u5F55 Apify \u6216\u9009\u62E9 / \u90E8\u7F72 Actor \u540E\u91CD\u8BD5\u3002",
4449
+ dashActorSetupCta: "\u524D\u5F80\u8BBE\u7F6E",
4450
+ dashBackToQuery: "\u8FD4\u56DE",
4451
+ dashQueryStatus: "\u672C\u6B21\u67E5\u8BE2\u72B6\u6001",
4452
+ dashFailedEmptyTitle: "\u672C\u6B21\u672A\u83B7\u53D6\u5230\u8D8B\u52BF\u6570\u636E",
4453
+ dashFailedEmptyHintLocal: "\u672C\u673A\u76F4\u8FDE\u6613\u89E6\u53D1\u9650\u6D41\uFF0C\u5207\u6362\u81F3 Actor \u540E\u53EF\u7A33\u5B9A\u53D6\u6570\u3002",
4454
+ dashFailedEmptyHintSwitched: "\u5F53\u524D\u5DF2\u5207\u6362\u81F3 Actor\uFF0C\u70B9\u51FB\u4E0A\u65B9\u300C\u67E5\u8BE2\u8D8B\u52BF\u300D\u5373\u53EF\u91CD\u8BD5\u3002",
4455
+ dashFailedEmptyHintActor: "\u672C\u6B21\u8BF7\u6C42\u672A\u8FD4\u56DE\u53EF\u7528\u8D8B\u52BF\u6570\u636E\uFF0C\u53EF\u67E5\u770B\u8C03\u7528\u8BE6\u60C5\u6216\u91CD\u8BD5\u3002",
4456
+ dashAnchorSource: "\u57FA\u51C6\u6765\u6E90",
4457
+ dashAnchorSourceLink: "MEKA \u57FA\u51C6\u6570\u636E\u96C6",
4458
+ dashRawErrorLabel: "\u9519\u8BEF\u8BE6\u60C5"
4197
4459
  };
4198
4460
 
4199
4461
  // src/connection-check.ts
@@ -5885,22 +6147,35 @@ function ApifyOAuthCard({
5885
6147
  ] });
5886
6148
  }
5887
6149
  function ApifySignupBar({ t }) {
5888
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("aside", { className: "gtfa-free-credit", "aria-label": template3(t("signupCredit"), { amount: APIFY_FREE_MONTHLY_CREDIT_USD }), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gtfa-free-credit-copy", children: [
5889
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "gtfa-credit-eyebrow", children: t("signupPlan") }),
5890
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gtfa-credit-value", children: [
5891
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
5892
- "$",
5893
- APIFY_FREE_MONTHLY_CREDIT_USD
5894
- ] }),
5895
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: t("signupMonthly") })
5896
- ] }),
5897
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "gtfa-free-credit-estimate", children: t("signupEstimate") }),
5898
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gtfa-free-credit-actions", children: [
5899
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { className: "gtfa-credit-cta", href: APIFY_SIGNUP_URL, target: "_blank", rel: "noopener noreferrer", children: t("signupAction") }),
5900
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { className: "gtfa-credit-pricing", href: APIFY_PRICING_URL, target: "_blank", rel: "noopener noreferrer", children: t("pricingAction") })
6150
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("aside", { className: "gtfa-free-credit", "aria-label": template3(t("signupCredit"), { amount: APIFY_FREE_MONTHLY_CREDIT_USD }), children: [
6151
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { className: "gtfa-credit-art", viewBox: "0 0 260 120", fill: "none", "aria-hidden": "true", children: [
6152
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("linearGradient", { id: "gtfa-credit-fill", x1: "0", y1: "0", x2: "0", y2: "1", children: [
6153
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("stop", { offset: "0%", stopColor: "#fff", stopOpacity: "0.24" }),
6154
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("stop", { offset: "100%", stopColor: "#fff", stopOpacity: "0" })
6155
+ ] }) }),
6156
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M18 96 L64 78 L108 86 L154 52 L198 62 L248 22 L248 120 L18 120 Z", fill: "url(#gtfa-credit-fill)" }),
6157
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M18 96 L64 78 L108 86 L154 52 L198 62 L248 22", stroke: "rgba(255,255,255,.32)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6158
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "248", cy: "22", r: "3.5", fill: "rgba(255,255,255,.65)" })
5901
6159
  ] }),
5902
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: t("signupCreditNote") })
5903
- ] }) });
6160
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gtfa-free-credit-copy", children: [
6161
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gtfa-free-credit-main", children: [
6162
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "gtfa-credit-eyebrow", children: t("signupPlan") }),
6163
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gtfa-credit-value", children: [
6164
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
6165
+ "$",
6166
+ APIFY_FREE_MONTHLY_CREDIT_USD
6167
+ ] }),
6168
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: t("signupMonthly") })
6169
+ ] }),
6170
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "gtfa-free-credit-estimate", children: t("signupEstimate") }),
6171
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: t("signupCreditNote") })
6172
+ ] }),
6173
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "gtfa-free-credit-actions", children: [
6174
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { className: "gtfa-credit-cta", href: APIFY_SIGNUP_URL, target: "_blank", rel: "noopener noreferrer", children: t("signupAction") }),
6175
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { className: "gtfa-credit-pricing", href: APIFY_PRICING_URL, target: "_blank", rel: "noopener noreferrer", children: t("pricingAction") })
6176
+ ] })
6177
+ ] })
6178
+ ] });
5904
6179
  }
5905
6180
  function actorErrorText(state, t) {
5906
6181
  if (state.code === "no-token") return t("testNoToken");
@@ -6259,7 +6534,7 @@ function SectionHeader({ title, description, icon }) {
6259
6534
  ] })
6260
6535
  ] });
6261
6536
  }
6262
- function ConfigPage({ ctx, t, initialDraft, initialUsage, initialActors, initialOAuth, initialAdvancedTab = "anchors", initialAdvancedOpen = false }) {
6537
+ function ConfigPage({ ctx, t, onSaved, initialDraft, initialUsage, initialActors, initialOAuth, initialAdvancedTab = "anchors", initialAdvancedOpen = false }) {
6263
6538
  const form = (0, import_react6.useMemo)(() => ctx.configForms.get(ENTRY), [ctx]);
6264
6539
  const describe = (0, import_react6.useMemo)(() => ctx.configForms.describe(), [ctx]);
6265
6540
  const snapshot = useStore(form);
@@ -6669,6 +6944,7 @@ function ConfigPage({ ctx, t, initialDraft, initialUsage, initialActors, initial
6669
6944
  setDraft(cleaned);
6670
6945
  setBaseline(draftKey(cleaned));
6671
6946
  setNotice(t("saved"));
6947
+ onSaved?.();
6672
6948
  if (draft.egress !== "local" && (tokenChanged || egressChanged)) {
6673
6949
  requestUsage(false);
6674
6950
  if (draft.egress === "actor-own") requestActors(true);
@@ -7436,7 +7712,7 @@ function ConfigPage({ ctx, t, initialDraft, initialUsage, initialActors, initial
7436
7712
  ] });
7437
7713
  }
7438
7714
  function ConfigView({ ctx, t, view }) {
7439
- return view === "page" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ConfigPage, { ctx, t }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: t("summary") });
7715
+ return view === "summary" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: t("summary") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ConfigPage, { ctx, t });
7440
7716
  }
7441
7717
  function apply(ctx) {
7442
7718
  ctx.effect(() => ctx.locale.register(NS, { en: { ...EN, ...DASHBOARD_EN }, zh: { ...ZH, ...DASHBOARD_ZH } }), "gtfa: dictionaries");
@@ -7453,10 +7729,20 @@ function apply(ctx) {
7453
7729
  ctx.effect(() => {
7454
7730
  ctx.slots.inject("main", () => ctx.slots.register(
7455
7731
  { name: "main", key: "google-trends", locale: NS },
7456
- () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Dashboard, { t, controller: dashboard, openSettings: () => {
7457
- const navigation = ctx.get?.("pluginNavigation");
7458
- navigation?.openBundle?.(PACKAGE);
7459
- } })
7732
+ () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
7733
+ Dashboard,
7734
+ {
7735
+ t,
7736
+ controller: dashboard,
7737
+ renderSettings: () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ConfigPage, { ctx, t, onSaved: () => {
7738
+ void dashboard.refresh();
7739
+ } }),
7740
+ openSettings: () => {
7741
+ const navigation = ctx.get?.("pluginNavigation");
7742
+ navigation?.openBundle?.(PACKAGE);
7743
+ }
7744
+ }
7745
+ )
7460
7746
  ));
7461
7747
  ctx.slots.inject("sidebar.panellist", () => ctx.slots.register(
7462
7748
  { name: "sidebar.panellist", id: "google-trends", order: 25, label: () => t("dashboardTitle"), locale: NS },
@@ -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 github:meka-im/google-trends-for-agent";
5
+ export declare const GTFA_UPGRADE_COMMAND = "dsh plugin --profile web add google-trends-for-agent@latest";
6
6
  export declare const VERSION_STATUS_PATH = "/api/gtfa.version";
7
7
  export interface ReleaseInfo {
8
8
  version: string;
@@ -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 github:meka-im/google-trends-for-agent';
5
+ export const GTFA_UPGRADE_COMMAND = 'dsh plugin --profile web add google-trends-for-agent@latest';
6
6
  export const VERSION_STATUS_PATH = '/api/gtfa.version';
7
7
  const SEMVER_RE = /^v?(\d{1,5})\.(\d{1,5})\.(\d{1,5})(?:-([a-zA-Z0-9.-]{1,40}))?$/;
8
8
  /** Parse a bounded X.Y.Z(-prerelease) version string. */
@@ -42,7 +42,7 @@ allowBuilds:
42
42
 
43
43
  ## Configure egress & Apify OAuth
44
44
 
45
- 1. Open **dsh → Plugins → Google Trends → Components → Google Trends / gtfa**.
45
+ 1. Open the **Google Trends** sidebar panel and click **Plugin settings** (or go to **Plugins → Google Trends → Components → Google Trends / gtfa**).
46
46
  2. Choose an **Egress** mode and click **Save**:
47
47
  - **Local (this machine)**: direct from your machine (honors `HTTPS_PROXY` / `HTTP_PROXY`).
48
48
  - **Public Actor** *(recommended if local IP is rate-limited)*: runs `meka.im/google-trends-for-agent` on demand with Apify residential proxy.
package/docs/reference.md CHANGED
@@ -123,7 +123,7 @@ allowBuilds:
123
123
  "google-trends-for-agent@https://codeload.github.com/meka-im/google-trends-for-agent/tar.gz/<commit>": true
124
124
  ```
125
125
 
126
- The plugin is enabled by default after install. In dsh 0.2.2-rc.1, open **dsh web → Plugins → Google Trends** (the installed-plugin card), then under **Components** click the **Google Trends / gtfa** row to open the settings page. In the **Connection** section, use the three-way **Egress** control to pick **Local (this machine)**, **Public Actor**, or **My own Actor**. Click **Save** to apply egress changes; no restart is needed.
126
+ The plugin is enabled by default after install. Click **Plugin settings** directly in the **Google Trends** panel—or open **Plugins → Google Trends → Components → Google Trends / gtfa**—for the standalone settings page. In the **Connection** section, use the three-way **Egress** control to pick **Local (this machine)**, **Public Actor**, or **My own Actor**. Click **Save** to apply egress changes; no restart is needed.
127
127
 
128
128
  ### Apify OAuth and credential resolution
129
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-trends-for-agent",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
4
4
  "description": "Search-interest signals for AI agents — an unofficial Google Trends client",
5
5
  "type": "module",
6
6
  "license": "MIT",