@cobola/dsh-geo 0.3.1 → 0.4.0

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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0 - 2026-11-29
4
+
5
+ ### Changed
6
+
7
+ - Audit results now appear as a card in the transcript, under the tool call that
8
+ produced them: score, five dimensions, platform reference scores and the top
9
+ fixes, plus the delta against the previous scan.
10
+ - `geo_scan` and `geo_fix_plan` publish a bounded `presentationMeta` payload, so
11
+ the card renders structured facts instead of parsing model-facing prose.
12
+ - The Settings panel now holds configuration only. The dashboard page it used to
13
+ contain was removed along with its cross-session site guessing.
14
+ - Plugin and Settings labels use the brand name `dsh-geo` instead of a
15
+ translated product name.
16
+
17
+
3
18
  ## 0.3.1 - 2026-11-29
4
19
 
5
20
  ### Fixes
package/README.md CHANGED
@@ -8,8 +8,6 @@
8
8
  [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
9
9
  [![GitHub release](https://img.shields.io/github/v/release/cobola/dsh-geo)](https://github.com/cobola/dsh-geo/releases)
10
10
 
11
- `dsh-geo` 是一个面向网站维护者、内容团队、SEO/GEO 顾问和开发者的只读、可复现网站可见性体检工具。
12
-
13
11
  `dsh-geo` 是一个只读、可复现的网站 GEO/SEO 结构体检工具:它读取网站实际返回的 HTML、robots.txt、sitemap 和结构化数据,找出影响可见性的具体问题,生成可以直接执行的修复清单,并在修改后用同一套规则复查结果。
14
12
 
15
13
  它适合维护官网、内容站、文档站和数据产品的产品负责人、内容负责人、SEO/GEO 顾问与开发者。工具不承诺排名,也不猜测任何平台的黑盒算法;它只报告能够从网站和公开平台文档中验证的事实。
@@ -18,7 +16,8 @@
18
16
 
19
17
  | 入口 | 能力 |
20
18
  |---|---|
21
- | `geo_scan`(DSH 工具) | 抓取并评分一个站点,报告写入 `.dsh-geo/`,自动与上次扫描对比 |
19
+ | `geo_scan`(DSH 工具) | 抓取并评分一个站点,报告写入 `.dsh-geo/`,自动与上次扫描对比;结果以卡片形式出现在该次对话里 |
20
+ | 会话内结果卡 | 模型调用 `geo_scan` / `geo_fix_plan` 后,对话中直接显示分数、五维、平台参考分与优先修复,不用另开页面 |
22
21
  | `geo_fix_plan`(DSH 工具) | 把最近一次(或指定的)报告变成按影响力排序的修复清单 |
23
22
  | **设置 → GEO 体检**(面板) | 修改抓取页数、robots 策略、限速、超时、体积上限、报告目录、私有目标开关 |
24
23
  | CLI(`dsh-geo`) | `scan` / `fix-plan` / `history` / `diff`,支持 `--json` 与 `--fail-under`,可直接进 CI |
@@ -77,7 +76,7 @@ npm install # 安装唯一的运行时依赖 @deepseek-ai/schemastery
77
76
 
78
77
  安装后:
79
78
 
80
- 1. 在**设置 → 网站可见性体检**里确认默认值(尤其“允许本机/私网目标”,默认关闭);
79
+ 1. 在**设置 → dsh-geo** 里确认默认值(尤其“允许本机/私网目标”,默认关闭);
81
80
  2. 新开一个会话,让 agent 跑一次 `geo_scan`;
82
81
  3. 首次安装显示成功但工具没出现时,重启 DSH(替换已安装的 JS 需要重启加载新模块)。
83
82
 
@@ -193,7 +192,7 @@ fixture 基线(参考时间 `2026-06-15T00:00:00Z`,由测试锁定):
193
192
  - **只读原始 HTML**:不执行 JavaScript,这是与检索管线对齐的设计;它不测渲染后的 DOM、Core Web Vitals、搜索排名、流量或真实 AI 引用。
194
193
  - **不自动改代码**:`geo_fix_plan` 只产出清单;修改由 agent 或人完成,再用 `geo_scan` 验证。
195
194
  - **评规则不是真理**:分数用于同站点纵向对比,不适合跨站点绝对排名。规则可审计、可改,带版本号 `geo-rubric@1`。
196
- - **面板只编辑默认值**:历史与 diff 目前通过 `.dsh-geo/` 文件、CLI 或 agent 查看,尚未做图表 UI。
195
+ - **面板只编辑默认值**:扫描结果出现在对话卡片中;趋势与历史通过 `.dsh-geo/`、CLI 或 `dsh-geo history` 查看,尚未做图标趋势图。
197
196
  - **npm 上仅发布命令行与库**:作为 DSH 插件仍建议本地目录链接安装,确保读到当前 checkout。
198
197
 
199
198
  ## 开发与发布
package/client.js CHANGED
@@ -18,8 +18,8 @@ window.__ModuleLoader__.load({
18
18
 
19
19
  const DICT = {
20
20
  zh: {
21
- nav: '网站可见性体检',
22
- title: '网站可见性体检设置',
21
+ nav: 'dsh-geo',
22
+ title: 'dsh-geo 扫描设置',
23
23
  lede: '这里只配置扫描行为和报告位置,不对应任何具体网站;站点数据由每次 geo_scan 产生。改动立即生效,不影响评分规则。',
24
24
  tools: '可用工具',
25
25
  toolsHint: '在对话里让 agent 扫描站点、生成修复清单,改完代码后再扫一次对比分数。报告写入工作区里配置的报告目录(默认 .dsh-geo/)。',
@@ -54,34 +54,16 @@ window.__ModuleLoader__.load({
54
54
  saveError: '保存失败',
55
55
  unavailable: '设置服务不可用,无法在面板中修改。',
56
56
  badge: '可复现规则评分 · 不预测排名',
57
- navDashboard: '可见性效果看板',
58
- dashTitle: '可见性效果看板',
59
- dashSite: '体检站点',
60
- dashLede: '下面所有数据都针对上方这一个站点,来自本地 .dsh-geo/ 扫描历史。这不是 GSC 或 Perplexity 的流量数据,真实曝光与点击请到对应平台查看。',
61
- dashScore: '总分',
62
- dashDelta: '较上次',
63
- dashDimensions: '五维',
64
- dashTrend: '分数趋势',
65
- dashRecent: '最近扫描',
66
- dashFixed: '已修复',
67
- dashRegressed: '回归',
68
- dashStill: '仍未通过',
69
- dashActions: '优先修复',
70
- dashEmpty: '还没有体检记录',
71
- dashEmptyHint: '在会话里让 agent 运行 geo_scan,或执行 dsh-geo scan --save;之后这里会显示分数趋势与五维变化。',
72
- dashNoSession: '没有可用的会话工作区',
73
- dashNoSessionHint: '先打开一个会话,在其中运行 geo_scan。',
74
- dashError: '读取看板失败',
75
- dashRefresh: '刷新',
76
- dashWorkspace: '工作区',
77
- dashUpdated: '更新于',
78
- dashNoData: '暂无数据',
79
- dashScans: '次扫描',
80
- dashPlatforms: '平台适配(参考,不计入总分)',
57
+ cardScanning: '正在扫描站点…',
58
+ cardPlanning: '正在生成修复清单…',
59
+ cardFailed: '体检没有完成',
60
+ cardDelta: '较上次',
61
+ cardPlatforms: '平台参考分(不计入总分)',
62
+ cardActions: '优先修复',
81
63
  },
82
64
  en: {
83
- nav: 'Website visibility audit',
84
- title: 'Website visibility audit settings',
65
+ nav: 'dsh-geo',
66
+ title: 'dsh-geo scan settings',
85
67
  lede: 'These settings configure scan behaviour and report location only — they are not tied to any site. Site data comes from each geo_scan run, and these values never change the rubric.',
86
68
  tools: 'Tools',
87
69
  toolsHint: 'Ask the agent to audit a site, generate a fix plan, then audit again after the code changes. Reports live in the configured report directory (default .dsh-geo/).',
@@ -116,30 +98,12 @@ window.__ModuleLoader__.load({
116
98
  saveError: 'Could not save',
117
99
  unavailable: 'The settings service is unavailable; the panel cannot edit values.',
118
100
  badge: 'Reproducible checks · no ranking prediction',
119
- navDashboard: 'Visibility dashboard',
120
- dashTitle: 'Visibility dashboard',
121
- dashSite: 'Audited site',
122
- dashLede: 'Everything below describes the single site above, from local .dsh-geo/ scan history. This is not GSC or Perplexity traffic data; see those platforms for real impressions and clicks.',
123
- dashScore: 'Score',
124
- dashDelta: 'vs previous',
125
- dashDimensions: 'Dimensions',
126
- dashTrend: 'Score trend',
127
- dashRecent: 'Recent scans',
128
- dashFixed: 'Fixed',
129
- dashRegressed: 'Regressed',
130
- dashStill: 'Still failing',
131
- dashActions: 'Top fixes',
132
- dashEmpty: 'No audits yet',
133
- dashEmptyHint: 'Ask the agent to run geo_scan, or run dsh-geo scan --save; the trend and dimension history will appear here.',
134
- dashNoSession: 'No session workspace available',
135
- dashNoSessionHint: 'Open a session and run geo_scan there first.',
136
- dashError: 'Could not read the dashboard',
137
- dashRefresh: 'Refresh',
138
- dashWorkspace: 'Workspace',
139
- dashUpdated: 'Updated',
140
- dashNoData: 'No data yet',
141
- dashScans: 'scans',
142
- dashPlatforms: 'Platform profiles (reference, not in Core score)',
101
+ cardScanning: 'Scanning the site…',
102
+ cardPlanning: 'Building the fix plan…',
103
+ cardFailed: 'The audit did not complete',
104
+ cardDelta: 'vs previous',
105
+ cardPlatforms: 'Platform scores (not in Core total)',
106
+ cardActions: 'Top fixes',
143
107
  },
144
108
  };
145
109
 
@@ -210,24 +174,24 @@ window.__ModuleLoader__.load({
210
174
  ok: { fontSize: 12, color: 'var(--dsw-alias-state-success-primary, #1a7f37)' },
211
175
  error: { fontSize: 12, color: 'var(--dsw-alias-state-error-primary, #cf222e)' },
212
176
  mono: { fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace', fontSize: 12 },
213
- dashGrid: { display: 'flex', flexWrap: 'wrap', gap: 12 },
214
- dashCard: {
177
+ cardGrid: { display: 'flex', flexWrap: 'wrap', gap: 12 },
178
+ cardBox: {
215
179
  flex: '1 1 180px', minWidth: 160, padding: '14px 16px', borderRadius: 10,
216
180
  border: '1px solid var(--dsw-alias-border-l2, #d0d7de)',
217
181
  background: 'var(--dsw-alias-bg-layer-1, #ffffff)',
218
182
  },
219
- dashValue: { fontSize: 30, fontWeight: 700, lineHeight: 1.1, color: 'var(--dsw-alias-label-primary, #1f2328)' },
220
- dashCap: { fontSize: 12, color: 'var(--dsw-alias-label-tertiary, #6e7781)', marginBottom: 6 },
221
- dashDelta: { fontSize: 12, marginTop: 4 },
183
+ cardValue: { fontSize: 30, fontWeight: 700, lineHeight: 1.1, color: 'var(--dsw-alias-label-primary, #1f2328)' },
184
+ cardCap: { fontSize: 12, color: 'var(--dsw-alias-label-tertiary, #6e7781)', marginBottom: 6 },
185
+ cardDelta: { fontSize: 12, marginTop: 4 },
222
186
  barTrack: {
223
187
  height: 8, borderRadius: 999, overflow: 'hidden',
224
188
  background: 'var(--dsw-alias-bg-layer-2, #f6f8fa)', width: '100%',
225
189
  },
226
190
  barFill: { height: '100%', borderRadius: 999, background: 'var(--dsw-alias-brand-primary, #0969da)' },
227
- dashRow: { display: 'grid', gridTemplateColumns: '88px 1fr 72px', gap: 10, alignItems: 'center', padding: '5px 0' },
228
- dashList: { display: 'flex', flexDirection: 'column', gap: 6 },
229
- dashItem: { fontSize: 12, lineHeight: 1.5, color: 'var(--dsw-alias-label-secondary, #59636e)' },
230
- dashStrong: { fontWeight: 600, color: 'var(--dsw-alias-label-primary, #1f2328)' },
191
+ cardRow: { display: 'grid', gridTemplateColumns: '88px 1fr 72px', gap: 10, alignItems: 'center', padding: '5px 0' },
192
+ cardList: { display: 'flex', flexDirection: 'column', gap: 6 },
193
+ cardItem: { fontSize: 12, lineHeight: 1.5, color: 'var(--dsw-alias-label-secondary, #59636e)' },
194
+ cardStrong: { fontWeight: 600, color: 'var(--dsw-alias-label-primary, #1f2328)' },
231
195
  };
232
196
 
233
197
  function Field(props) {
@@ -422,192 +386,90 @@ window.__ModuleLoader__.load({
422
386
  return h('div', { style: styles.page }, children);
423
387
  }
424
388
 
425
- function formatTime(value) {
426
- if (!value) return '—';
427
- return String(value).replace('T', ' ').replace(/\.\d+Z$/, ' UTC').replace(/Z$/, ' UTC');
428
- }
429
-
430
- function signed(value) {
431
- if (value === 0) return '0';
432
- return value > 0 ? `+${value}` : String(value);
433
- }
434
-
435
- function Sparkline(props) {
436
- const { trend, label } = props;
437
- const values = trend.map((entry) => entry.total);
438
- if (values.length < 2) {
439
- return h('div', { style: { ...styles.hint, padding: '18px 0' } }, props.emptyLabel);
440
- }
441
- const width = 640;
442
- const height = 160;
443
- const pad = 18;
444
- const x = (index) => pad + (index * (width - pad * 2)) / (values.length - 1);
445
- const y = (value) => height - pad - (Math.max(0, Math.min(100, value)) / 100) * (height - pad * 2);
446
- const points = values.map((value, index) => `${x(index).toFixed(1)},${y(value).toFixed(1)}`).join(' ');
447
- const area = `M ${pad},${height - pad} L ${points.replaceAll(' ', ' L ')} L ${width - pad},${height - pad} Z`;
448
- const first = trend[0];
449
- const last = trend[trend.length - 1];
450
- const children = [
451
- h('path', { key: 'area', d: area, fill: 'var(--dsw-alias-brand-primary, #0969da)', opacity: 0.12 }),
452
- h('polyline', {
453
- key: 'line', points, fill: 'none',
454
- stroke: 'var(--dsw-alias-brand-primary, #0969da)', strokeWidth: 2.5,
455
- strokeLinejoin: 'round', strokeLinecap: 'round',
456
- }),
457
- h('circle', { key: 'dot', cx: x(values.length - 1), cy: y(last.total), r: 4, fill: 'var(--dsw-alias-brand-primary, #0969da)' }),
458
- h('text', { key: 'start', x: pad, y: height - 2, fontSize: 10, fill: 'var(--dsw-alias-label-tertiary, #6e7781)' }, formatTime(first.scannedAt).slice(0, 10)),
459
- h('text', { key: 'end', x: width - pad, y: height - 2, textAnchor: 'end', fontSize: 10, fill: 'var(--dsw-alias-label-tertiary, #6e7781)' }, formatTime(last.scannedAt).slice(0, 10)),
460
- h('text', { key: 'value', x: width - pad, y: 14, textAnchor: 'end', fontSize: 11, fill: 'var(--dsw-alias-label-secondary, #59636e)' }, `${last.total} / 100`),
461
- ];
462
- return h('svg', {
463
- viewBox: `0 0 ${width} ${height}`,
464
- role: 'img',
465
- 'aria-label': label,
466
- style: { width: '100%', height: 160, display: 'block' },
467
- }, children);
468
- }
469
-
470
- function GeoDashboard(props) {
389
+ /**
390
+ * The tool call's own card in the transcript: score, dimensions, platform
391
+ * profile and the top fixes, plus the delta when a previous scan exists.
392
+ * Rendering stops at the payload the Host already computed.
393
+ * @param props - tool view props: phase, block, and the presentation meta.
394
+ */
395
+ function GeoToolCard(props) {
471
396
  const t = typeof props.t === 'function' ? props.t : (key) => key;
472
- const [state, setState] = React.useState({ status: 'loading', data: null, error: null, session: null, workspace: null });
473
- const [refreshing, setRefreshing] = React.useState(false);
397
+ const phase = props.phase;
398
+ const block = props.block;
474
399
 
475
- const load = React.useCallback(async (manual = false) => {
476
- if (manual) setRefreshing(true);
477
- try {
478
- const next = await props.loadDashboard();
479
- setState(next);
480
- } catch (error) {
481
- setState((previous) => ({ ...previous, status: 'error', error: error && error.message ? error.message : String(error) }));
482
- } finally {
483
- if (manual) setRefreshing(false);
484
- }
485
- }, [props]);
400
+ if (phase === 'preparing' || phase === 'start') {
401
+ return h('div', { style: styles.card },
402
+ h('div', { style: styles.sectionLabel }, props.toolName === 'geo_scan' ? t('cardScanning') : t('cardPlanning')),
403
+ h('div', { style: styles.hint }, block && block.args ? summarizeArgs(block.args) : ''));
404
+ }
405
+ if (!block || block.isError) {
406
+ const reason = block && block.error && block.error.reason ? block.error.reason : t('cardFailed');
407
+ return h('div', { ...{ style: { ...styles.card, ...styles.error } }, role: 'alert' },
408
+ h('div', { style: styles.sectionLabel }, t('cardFailed')),
409
+ h('div', { style: styles.hint }, reason));
410
+ }
486
411
 
487
- React.useEffect(() => {
488
- void load();
489
- const timer = setInterval(() => { void load(); }, 15000);
490
- return () => clearInterval(timer);
491
- }, []);
412
+ const meta = block.meta && block.meta.kind ? block.meta : null;
413
+ if (!meta) return null;
492
414
 
493
415
  const children = [];
494
- const auditedSite = state.data && state.data.url ? state.data.url : null;
495
- children.push(h('div', { key: 'head', style: { display: 'flex', flexDirection: 'column', gap: 8 } },
496
- h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 } },
497
- h('h2', { style: styles.title }, t('dashTitle')),
498
- h('button', {
499
- type: 'button', style: styles.ghost, disabled: refreshing,
500
- onClick: () => { void load(true); },
501
- }, refreshing ? t('loading') : t('dashRefresh'))),
502
- auditedSite
503
- ? h('div', { style: { display: 'flex', alignItems: 'baseline', gap: 8, flexWrap: 'wrap' } },
504
- h('span', { style: styles.dashCap }, `${t('dashSite')}:`),
505
- h('a', {
506
- href: auditedSite,
507
- target: '_blank',
508
- rel: 'noreferrer',
509
- style: { ...styles.mono, fontSize: 14, fontWeight: 600, color: 'var(--dsw-alias-brand-primary, #0969da)' },
510
- }, auditedSite))
511
- : null,
512
- h('p', { style: styles.lede }, t('dashLede')),
513
- state.session && state.session.cwd
514
- ? h('div', { style: styles.hint },
515
- `${t('dashWorkspace')}: `,
516
- h('span', { style: styles.mono }, state.session.cwd.split('/').filter(Boolean).pop() || state.session.cwd))
517
- : null));
518
-
519
- if (state.status === 'loading' && !state.data) {
520
- children.push(h('div', { key: 'loading', style: { ...styles.hint, padding: 8 } }, t('loading')));
521
- return h('div', { style: styles.page }, children);
522
- }
523
- if (state.status === 'error') {
524
- children.push(h('div', { key: 'error', role: 'alert', style: { ...styles.card, ...styles.error } },
525
- `${t('dashError')}: ${state.error}`));
526
- return h('div', { style: styles.page }, children);
527
- }
528
- if (state.status === 'no-session') {
529
- children.push(h('div', { key: 'no-session', style: styles.card },
530
- h('div', { style: { ...styles.label, marginBottom: 4 } }, t('dashNoSession')),
531
- h('div', { style: styles.hint }, t('dashNoSessionHint'))));
532
- return h('div', { style: styles.page }, children);
533
- }
534
- if (state.status === 'empty') {
535
- children.push(h('div', { key: 'empty', style: styles.card },
536
- h('div', { style: { ...styles.label, marginBottom: 4 } }, t('dashEmpty')),
537
- h('div', { style: styles.hint }, t('dashEmptyHint'))));
538
- return h('div', { style: styles.page }, children);
416
+ const dimensionRows = (meta.dimensions ?? []).map((dimension) => h('div', { key: dimension.title, style: styles.cardRow },
417
+ h('span', { style: styles.label }, dimension.title),
418
+ h('div', { style: styles.barTrack },
419
+ h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, dimension.score))}%` } })),
420
+ h('span', { style: { ...styles.hint, textAlign: 'right' } }, `${dimension.score}`)));
421
+
422
+ const platformRows = (meta.platforms ?? []).map((platform) => h('div', { key: platform.title, style: styles.cardRow },
423
+ h('span', { style: styles.label }, platform.title),
424
+ h('div', { style: styles.barTrack },
425
+ h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, platform.total))}%` } })),
426
+ h('span', { style: { ...styles.hint, textAlign: 'right' } }, `${platform.total}`)));
427
+
428
+ const actionRows = (meta.actions ?? []).map((action) => h('div', { key: action.ruleId, style: styles.cardItem },
429
+ h('span', { style: styles.cardStrong }, `${action.dimensionTitle} · ${action.title}`),
430
+ ` — ${action.evidence}`));
431
+
432
+ const delta = meta.comparison;
433
+ children.push(h('div', { key: 'head', style: { display: 'flex', alignItems: 'baseline', gap: 10, flexWrap: 'wrap' } },
434
+ h('span', { style: styles.cardValue }, meta.kind === 'geo-fix-plan' ? `${meta.actionCount}` : `${meta.total}`),
435
+ h('span', { style: styles.cardCap }, meta.kind === 'geo-fix-plan' ? t('cardActions') : `${meta.grade} · / 100`),
436
+ h('a', {
437
+ href: meta.url, target: '_blank', rel: 'noreferrer',
438
+ style: { ...styles.mono, fontSize: 12, color: 'var(--dsw-alias-brand-primary, #0969da)' },
439
+ }, meta.url)));
440
+
441
+ if (delta && typeof delta.totalDelta === 'number') {
442
+ children.push(h('div', {
443
+ key: 'delta',
444
+ style: { ...styles.hint, color: delta.totalDelta >= 0 ? 'var(--dsw-alias-state-success-primary, #1a7f37)' : 'var(--dsw-alias-state-error-primary, #cf222e)' },
445
+ }, `${t('cardDelta')} ${delta.before} → ${delta.after}(${delta.totalDelta >= 0 ? '+' : ''}${delta.totalDelta})`));
539
446
  }
540
447
 
541
- const dashboard = state.data;
542
- const current = dashboard.current;
543
- const delta = dashboard.delta;
544
- const moduleCard = (key, caption, value, extra) => h('div', { key, style: styles.dashCard },
545
- h('div', { style: styles.dashCap }, caption),
546
- h('div', { style: styles.dashValue }, value),
547
- extra ?? null);
548
-
549
- children.push(h('div', { key: 'cards', style: styles.dashGrid },
550
- moduleCard('score', t('dashScore'), `${current.total} / 100`, h('div', {
551
- style: { ...styles.dashDelta, color: delta && delta.total !== 0 ? (delta.total > 0 ? 'var(--dsw-alias-state-success-primary, #1a7f37)' : 'var(--dsw-alias-state-error-primary, #cf222e)') : 'var(--dsw-alias-label-tertiary, #6e7781)' },
552
- }, `${current.grade} · ${delta ? `${t('dashDelta')} ${signed(delta.total)}` : t('dashNoData')}`)),
553
- moduleCard('fixed', t('dashFixed'), delta ? String(delta.fixed.length) : '—'),
554
- moduleCard('regressed', t('dashRegressed'), delta ? String(delta.regressed.length) : '—'),
555
- moduleCard('still', t('dashStill'), delta ? String(delta.stillFailing) : '—')));
556
-
557
- children.push(h('div', { key: 'trend', style: styles.card },
558
- h('div', { style: styles.sectionLabel }, t('dashTrend')),
559
- h(Sparkline, {
560
- trend: dashboard.trend ?? [],
561
- label: t('dashTrend'),
562
- emptyLabel: t('dashNoData'),
563
- }),
564
- h('div', { style: { ...styles.hint, marginTop: 4 } }, `${(dashboard.trend ?? []).length} ${t('dashScans')}`)));
565
-
566
- const dimensionMap = new Map((dashboard.previous?.dimensions ?? []).map((dimension) => [dimension.id, dimension]));
567
- children.push(h('div', { key: 'dimensions', style: styles.card },
568
- h('div', { style: styles.sectionLabel }, t('dashDimensions')),
569
- (current.dimensions ?? []).map((dimension) => {
570
- const before = dimensionMap.get(dimension.id);
571
- const diff = before ? before.after - before.before : null;
572
- return h('div', { key: dimension.id, style: styles.dashRow },
573
- h('span', { style: styles.label }, dimension.title),
574
- h('div', { style: styles.barTrack },
575
- h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, dimension.score))}%` } })),
576
- h('span', { style: { ...styles.hint, textAlign: 'right' } },
577
- dimension.scored === false ? '—' : `${dimension.score}`,
578
- diff === null || dimension.scored === false ? '' : ` (${signed(diff)})`));
579
- })));
580
-
581
- if ((current.platforms ?? []).length > 0) {
582
- children.push(h('div', { key: 'platforms', style: styles.card },
583
- h('div', { style: styles.sectionLabel }, t('dashPlatforms')),
584
- current.platforms.map((platform) => h('div', { key: platform.id, style: styles.dashRow },
585
- h('span', { style: styles.label }, platform.title),
586
- h('div', { style: styles.barTrack },
587
- h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, platform.total))}%` } })),
588
- h('span', { style: { ...styles.hint, textAlign: 'right' } }, `${platform.total}`)))));
448
+ if (dimensionRows.length > 0) children.push(h('div', { key: 'dimensions' }, dimensionRows));
449
+ if (platformRows.length > 0) {
450
+ children.push(h('div', { key: 'platforms', style: { marginTop: 6 } },
451
+ h('div', { style: styles.sectionLabel }, t('cardPlatforms')),
452
+ platformRows));
589
453
  }
590
-
591
- if ((dashboard.actions ?? []).length > 0) {
592
- children.push(h('div', { key: 'actions', style: styles.card },
593
- h('div', { style: styles.sectionLabel }, t('dashActions')),
594
- h('div', { style: styles.dashList },
595
- dashboard.actions.map((action) => h('div', { key: action.ruleId, style: styles.dashItem },
596
- h('span', { style: styles.dashStrong }, `${action.dimensionTitle} · ${action.title}`),
597
- ` — ${action.evidence}`)))));
454
+ if (actionRows.length > 0) {
455
+ children.push(h('div', { key: 'actions', style: { marginTop: 8, display: 'flex', flexDirection: 'column', gap: 4 } },
456
+ h('div', { style: styles.sectionLabel }, t('cardActions')),
457
+ actionRows));
598
458
  }
599
-
600
- const recent = [...(dashboard.trend ?? [])].reverse().slice(0, 8);
601
- if (recent.length > 0) {
602
- children.push(h('div', { key: 'recent', style: styles.card },
603
- h('div', { style: styles.sectionLabel }, t('dashRecent')),
604
- h('div', { style: styles.dashList },
605
- recent.map((entry) => h('div', { key: `${entry.scannedAt}-${entry.total}`, style: { ...styles.dashItem, display: 'flex', justifyContent: 'space-between', gap: 12 } },
606
- h('span', null, formatTime(entry.scannedAt)),
607
- h('span', null, h('span', { style: styles.dashStrong }, `${entry.total}`), ` ${entry.grade}`))))));
459
+ if (meta.paths && meta.paths.report) {
460
+ children.push(h('div', { key: 'paths', style: { ...styles.hint, marginTop: 6 } },
461
+ h('span', { style: styles.mono }, meta.paths.report)));
608
462
  }
463
+ return h('div', { style: styles.card }, children);
464
+ }
609
465
 
610
- return h('div', { style: styles.page }, children);
466
+ function summarizeArgs(args) {
467
+ try {
468
+ const parsed = typeof args === 'string' ? JSON.parse(args) : args;
469
+ return parsed && parsed.url ? parsed.url : '';
470
+ } catch {
471
+ return '';
472
+ }
611
473
  }
612
474
 
613
475
  function remoteSettings(ctx) {
@@ -621,42 +483,6 @@ window.__ModuleLoader__.load({
621
483
  return /not.?found|ENOENT|lookup-not-found/i.test(text);
622
484
  }
623
485
 
624
- async function readDashboard(ctx) {
625
- if (!ctx.remote || !ctx.remote.workspaceFiles || !ctx.sessions) {
626
- throw new Error('workspace file service unavailable');
627
- }
628
- const snapshot = ctx.sessions.list.getSnapshot();
629
- const sessions = Object.values(snapshot.byId)
630
- .filter((session) => session.cwd)
631
- .sort((a, b) => b.updatedAt - a.updatedAt)
632
- .slice(0, 6);
633
- if (sessions.length === 0) return { status: 'no-session', data: null, error: null, session: null };
634
-
635
- let lastError = null;
636
- for (const session of sessions) {
637
- const result = await ctx.remote.workspaceFiles.readBytes(session.id, '.dsh-geo/dashboard.json', {});
638
- if (!result || result.ok !== true) {
639
- lastError = result && result.error ? result.error : { message: 'workspace read failed' };
640
- if (isNotFound(lastError)) continue;
641
- throw new Error(lastError.message || 'workspace read failed');
642
- }
643
- const bytes = result.value && result.value.data !== undefined ? result.value.data : result.value;
644
- const text = new TextDecoder().decode(bytes);
645
- return {
646
- status: 'ready',
647
- data: JSON.parse(text),
648
- error: null,
649
- session: { id: session.id, cwd: session.cwd },
650
- };
651
- }
652
- return {
653
- status: 'empty',
654
- data: null,
655
- error: lastError ? lastError.message : null,
656
- session: { id: sessions[0].id, cwd: sessions[0].cwd },
657
- };
658
- }
659
-
660
486
  async function readNamespace(ctx) {
661
487
  const result = await remoteSettings(ctx).describe();
662
488
  if (!result || result.ok !== true) {
@@ -692,17 +518,16 @@ window.__ModuleLoader__.load({
692
518
  ctx.effect(() => ctx.locale.register(NS, DICT), 'dsh-geo: settings dictionaries');
693
519
  const t = ctx.locale.bind(NS);
694
520
 
695
- ctx.slots.inject('settings.section', () => ctx.slots.register({
696
- name: 'settings.section',
697
- id: 'geo-dashboard',
698
- order: 34,
699
- label: () => t('navDashboard'),
700
- locale: NS,
701
- inject: () => ({
702
- loadDashboard: () => readDashboard(ctx),
703
- }),
704
- }, GeoDashboard));
521
+ // The card appears where the model's call appears: inside the transcript.
522
+ // It renders from the tool's presentation payload, so it never parses prose.
523
+ for (const toolName of ['geo_scan', 'geo_fix_plan']) {
524
+ ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({
525
+ name: 'tool.call.toolview',
526
+ key: toolName,
527
+ }, (props) => GeoToolCard({ ...props, toolName })));
528
+ }
705
529
 
530
+ // Settings holds configuration only; the results live in the transcript.
706
531
  ctx.slots.inject('settings.section', () => ctx.slots.register({
707
532
  name: 'settings.section',
708
533
  id: NS,
package/docs/index.json CHANGED
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "versions": [
29
29
  {
30
- "version": "0.3.1",
30
+ "version": "0.4.0",
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
package/index.js CHANGED
@@ -252,6 +252,65 @@ function planRender(args, value) {
252
252
  return [{ type: 'text', text: lines.join('\n') }];
253
253
  }
254
254
 
255
+
256
+ /**
257
+ * Bounded facts for the in-chat tool card. The card renders this instead of
258
+ * parsing model-facing prose, so the numbers a developer sees in the transcript
259
+ * are the same ones the tool returned.
260
+ * @param value - the tool's canonical output value.
261
+ */
262
+ export function scanPresentation(value) {
263
+ return {
264
+ kind: 'geo-scan',
265
+ url: value.url,
266
+ total: value.total,
267
+ grade: value.grade,
268
+ gradeLabel: value.gradeLabel,
269
+ pages: value.pages,
270
+ counts: value.counts,
271
+ blockedByRobots: value.blockedByRobots,
272
+ dimensions: (value.dimensions ?? []).map((dimension) => ({
273
+ title: dimension.title,
274
+ score: dimension.score,
275
+ weight: dimension.weight,
276
+ })),
277
+ platforms: (value.platforms ?? []).map((platform) => ({
278
+ title: platform.title,
279
+ total: platform.total,
280
+ })),
281
+ actions: (value.topActions ?? []).slice(0, 3).map((action) => ({
282
+ ruleId: action.ruleId,
283
+ dimensionTitle: action.dimensionTitle,
284
+ title: action.title,
285
+ evidence: action.evidence,
286
+ fix: action.fix,
287
+ })),
288
+ comparison: value.comparison ?? null,
289
+ paths: value.paths ?? {},
290
+ };
291
+ }
292
+
293
+ /** Presentation payload for the fix-plan card. */
294
+ export function planPresentation(value) {
295
+ return {
296
+ kind: 'geo-fix-plan',
297
+ url: value.url,
298
+ total: value.total,
299
+ grade: value.grade,
300
+ actionCount: value.actionCount,
301
+ actions: (value.topActions ?? []).slice(0, 3).map((action) => ({
302
+ ruleId: action.ruleId,
303
+ dimensionTitle: action.dimensionTitle,
304
+ title: action.title,
305
+ evidence: action.evidence,
306
+ fix: action.fix,
307
+ })),
308
+ comparison: value.comparison ?? null,
309
+ planPath: value.planPath,
310
+ jsonPath: value.jsonPath,
311
+ };
312
+ }
313
+
255
314
  export function apply(ctx, config) {
256
315
  const scanDefinition = {
257
316
  name: 'geo_scan',
@@ -262,7 +321,7 @@ export function apply(ctx, config) {
262
321
  'It never edits the site, measures rankings or traffic, or guarantees AI citations. Review the evidence, apply changes in your normal workflow, then re-run with the same reference time to verify repairs.',
263
322
  ].join(' '),
264
323
  parameters: scanParameters,
265
- output: { schema: scanOutputSchema, render: scanRender },
324
+ output: { schema: scanOutputSchema, render: scanRender, presentationMeta: (args, value) => scanPresentation(value) },
266
325
  timeoutMs: 180_000,
267
326
  async execute(args, exec) {
268
327
  if (exec.signal.aborted) throw exec.signal.reason ?? new Error('scan aborted');
@@ -340,7 +399,7 @@ export function apply(ctx, config) {
340
399
  'Writes .dsh-geo/fix-plan.md and .dsh-geo/fix-plan.json. It never edits the site; apply the changes with your own tools, then run geo_scan again.',
341
400
  ].join(' '),
342
401
  parameters: planParameters,
343
- output: { schema: planOutputSchema, render: planRender },
402
+ output: { schema: planOutputSchema, render: planRender, presentationMeta: (args, value) => planPresentation(value) },
344
403
  async execute(args, exec) {
345
404
  if (exec.signal.aborted) throw exec.signal.reason ?? new Error('plan aborted');
346
405
  const input = args !== null && typeof args === 'object' ? args : {};
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "title": "Website visibility audit",
4
- "description": "A read-only, reproducible GEO/SEO readiness audit: 45 auditable checks across five dimensions, with evidence and prioritized fixes. It never edits your site; re-run with the same reference time to verify changes."
3
+ "title": "dsh-geo",
4
+ "description": "Read-only, reproducible GEO/SEO site audits: 45 auditable checks across five dimensions, with evidence and prioritized fixes. Never edits your site; re-run with the same reference time to verify changes."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "title": "网站可见性体检",
4
- "description": "只读、可复现的生成式搜索与 SEO 结构体检:45 条可审计检查、五维评分、证据和按影响排序的修复清单。扫描不改站点;改动后可用同一参考时间复扫验证。"
3
+ "title": "dsh-geo",
4
+ "description": "只读、可复现的 GEO/SEO 站点体检:45 条可审计检查、五维评分、证据和按影响排序的修复清单。扫描不改站点;改动后可用同一参考时间复扫验证。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobola/dsh-geo",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Read-only, reproducible GEO/SEO website audits for DeepSeek Harness: inspect crawlability and citation-ready structure, return evidence and prioritized fixes, and never edit the site or promise rankings.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {