Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## 2026-11

- 11-20 简报页多了「这次是怎么生成的」:链路(WSL 里的 Claude Code 版本、模型、权限模式)、每个相关 MCP 服务器的状态和这次用没用到(没登录的直接给登录命令)、每次工具调用、那个账号跑的 hooks、完整命令和提示词原文;失败的那次也留。设置里新增「额外放行的工具」:连接器换了名字时自己补一行,不用等改代码
- 11-19 工作简报改在浏览器里看:岛上的小文档按钮、早上提醒的「查看」、右键「查看最近一份」都打开配置全景服务的简报页(概要、用量、全文、「重新生成」,生成中页面自己更新)。右键菜单里的「生成时间」子菜单拿掉,换成「简报设置…」翻到配置全景;笔记 / Slack 关注仍在原来的窗口里
- 11-19 配置全景的待处理里,「联动开着但没有 hooks」那一条有了「修复」按钮:确认一次就把 hooks 装回去,图上那条断线随即变回来(WSL 那条在后台装,装完自己更新)。从页面或设置进程关掉联动通道时,肥鱼自己装的 hooks 也会一起卸掉,和右键菜单关闭一样
- 11-19 Claude Code 联动、会话小鱼、「最近的对话」的设置搬到了配置全景(四块磁贴各带「设置」)。「最近的对话」最多留几天 / 几条这两项以前只能手改 config.json,现在也能改了。右键「Agent 联动」里只剩开关:上限 / 保留天数 / 配色 / 字号 / 桂冠 / 行数那六个子菜单换成一条「会话小鱼设置…」
Expand Down
5 changes: 4 additions & 1 deletion docs/config-panorama.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@ flowchart LR

- **登记**:应用构造 `PanoramaService` 时传 `reports={"work_briefing": provider}`(`reports.py`)。provider 在**界面线程**上被调
(它读 Qt 对象),返回固定字段的字典:`title / theme / summary / generated / usage[] / html / busy / busy_text / empty_text /
error / action{name, report, label, hint} / available`。页面(`report.js`)只按字段摆,不认识功能。
error / action{name, report, label, hint} / available / details[] / settings_focus`。页面(`report.js`)只按字段摆,不认识功能。
`details` 是「这次是怎么生成的」那几段 `{title, html}`(服务端渲染、全部转义,见[公司侧助理](work-assistant.md)的
「运行记录」),页面折叠着摆在全文下面、第一段默认展开;里面的 `__SETTINGS_URL__` 占位由页面换成
`/#<令牌>&settings=<settings_focus>`(同一个服务、同一个令牌)。
- **数据怎么到页面**:每份报告自己一个 `Feed`。第一次 `GET /api/report/<名字>` 时还没发布过,请求线程经 `on_gui` 让界面线程做一份
(`publish_report(force=True)`);之后页面带编号等更新。简报服务 `started` / `finished` 时应用调 `publish_report(name)`——
**没人打开过页面就什么都不做**(provider 不白跑)。`report_watched(name)` = 有请求挂在那份报告上 = 用户正开着看,
Expand Down
27 changes: 25 additions & 2 deletions docs/work-assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

| 文件 | 职责 |
|---|---|
| `pet/work_briefing.py` | 零 Qt。配置 `normalize`、`is_due`、放行 / 拒绝名单、`claude_command`、`pr_command` / `format_pull_requests`、提示词模板与 `render_template`、`parse_output`、`linkify`、状态文件 |
| `pet/work_briefing.py` | 零 Qt。配置 `normalize`、`is_due`、放行 / 拒绝名单(含设置里的 `extra_allowed_tools`)、`claude_command`、`pr_command` / `format_pull_requests`、提示词模板与 `render_template`、`parse_output`、`parse_trace`(运行记录)、`linkify`、状态文件 |
| `pet/work_briefing_service.py` | `WorkBriefingService`:每分钟 `check()`,到点在 daemon 线程里 `generate`,信号排队回 GUI 线程落盘 |
| `pet/work_briefing_ui.py` | `WorkBriefingController`(提醒气泡、岛按钮状态、`tab_providers`;「查看」开浏览器里的简报页)、`WorkBriefingWindow`(Metro 窗口壳:笔记 / Slack 关注 / 个人助理还在用;工作简报的那一页 2026-11-19 起不再加进去) |
| `pet/panorama/reports.py` / `markdown.py` | 浏览器里的简报页:把 `WorkBriefingService` 的最近一份翻成页面数据,Markdown → HTML。见[配置全景](config-panorama.md)「报告页」 |
Expand Down Expand Up @@ -60,8 +60,10 @@ flowchart LR

### 那一行命令(三个功能共用,红线)

`cd ~ && BIG_FAT_FISH_HEADLESS=1 claude -p --model … --effort … --output-format json --no-session-persistence
`cd ~ && BIG_FAT_FISH_HEADLESS=1 claude -p --model … --effort … --output-format stream-json --verbose --no-session-persistence
--max-turns N --tools '' --allowedTools … --disallowedTools …`,经 `wsl.exe -e bash -lc` 跑,提示词从标准输入进去。
`stream-json`(2026-11-19 起):一行一个事件——`init` 里有每个 MCP 服务器的名字 / 状态和工具清单,之后每次工具调用一行,
最后一行才是结果;`_result_record` 只认带 `result` 键的那一行,所以共用这行命令的工作笔记不用改解析。

- **权限三层,缺一层都不算只读**:① 无界面模式下没放行的工具一律被拒;② `--tools ''` 让内置工具(Bash、读写文件)整个
不存在,那个账号自己设置里放行过的 Bash 规则也就无从生效;③ 写入类连接器工具**点名拒绝**(`_WRITE_TOOLS`,外加整个网盘
Expand All @@ -73,10 +75,31 @@ flowchart LR
stdio 型服务器,插件的 HTTP OAuth 服务器不出现(2026-11-19 在 2.1.329 上实测,上游 anthropics/claude-code#36309):
实际在用的是连接器那一套,插件前缀留着只为将来它修好;连接器要重新登录时按[排障手册](troubleshooting.md)的
「无界面 `claude -p` 里的连接器」一节做,重新认证插件没有用。
- **额外放行的工具**(设置 `extra_allowed_tools`,一行一个全名或 `mcp__服务器__*` 前缀)接在内置名单后面,拒绝名单仍压过它。
用途:连接器换了名字 / 多了一条(例如 `claude.ai Atlassian MCP` → `mcp__claude_ai_Atlassian_MCP__…`)时用户自己补一行。
也会拼进 shell 命令,所以 `normalize_tools` 只认 `mcp__` 开头、字母数字和 `. _ -`、`*` 只能在末尾,坏行丢掉。
- **模型名和 effort 会拼进 shell 命令**:`normalize_model` 只认字母数字和 `. _ -`,`normalize_effort` 只认四档,其余退回默认。
effort 显式传,是因为结果 JSON 不报它。
- 用登录 shell(`-l`):`claude` 通常在 `~/.local/bin`,由 `~/.profile` 加进 `PATH`。不用交互 shell(`-i`)。
- `--no-session-persistence`:这次运行不在那个账号的会话列表里留一条。

### 运行记录:这次是怎么生成的

简报本来是个黑盒(只剩一段正文);2026-11-19 起每次尝试都留一份运行记录(`work_briefing.parse_trace` + `generate` 填的几项),
存在 `work-briefing.json` 的 `trace` 键下(每次尝试都换,**失败的也留**——失败时最想看的就是它;简报本体里不带,免得存两遍),
简报页在全文下面折叠着摆出来(`reports.trace_sections`):

- **链路**:肥鱼 → WSL → Claude Code 版本(`init.claude_code_version`)· 实际模型 · 权限模式 · 轮数 → MCP 服务器。
- **服务器表**:只列和简报有关的——放行名单覆盖到的(按 Claude Code 的命名规则 `mcp__<服务器名>__…`,名字里非字母数字的字符
换成 `_`,`server_slug`)或这次真调过的;每行:名字 · 状态(已连接 / 没登录 / 连不上)· 这次调了几次 / 放行了没用到 /
没放行但用到了。没登录的那行直接给修法(`claude mcp login "<名字>"`)。其余只数个数。另有一句「放行名单 N 条,这次实际存在
的工具 M 个」:放行了不存在的名字没有任何效果,这里看得出来。
- **工具调用**:每次 `tool_use` 一行——短名、服务器、参数摘要(每个值 80 字、整行 200 字)、✓ / ✗(由对应 `tool_result` 的
`is_error` 定);结果里的 `permission_denials` 另列。
- **那个账号的 hooks**(`hook_started` 事件的名字去重)、**命令**(gh 那两条 + claude 那一行)、**提示词原文**(带
「到设置里改模板」的链接:页面把 `__SETTINGS_URL__` 占位换成配置全景带令牌的地址)。
- 隐私同简报正文:提示词里有 PR 列表,整份记录只在本地状态文件里、只经带令牌的接口给本机浏览器,不进日志、不进快照。
- 老版本生成的简报没有这份记录:页面上什么都不摆。
- `BIG_FAT_FISH_HEADLESS`(`claude_hooks.HEADLESS_ENV`):sh 版 hook 脚本读到它非空就直接返回,什么都不上报,所以这次运行
不冒[会话小鱼](session-fish.md);会话存活探测也经 `/proc/<pid>/environ` 认它。普通的 Claude Code 会话照常上报。
[会话记忆蒸馏](memory-distill.md)的公司侧走的也是这条通道。
Expand Down
23 changes: 23 additions & 0 deletions pet/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,29 @@
"settings.distill_work.prompt_en": "Work-side distill prompt (used when the interface is English)",
"briefing.settings.priority_rules": "Priority preferences",
"briefing.settings.priority_rules_hint": "Claude rates every line ★★★ / ★★ / ★. Write your own rules here (e.g. “bugs reported by QA are always ★★★”, “documentation issues at most ★”); they are appended to the prompt as “my priority preferences”. Leave empty to let it judge alone.",
"briefing.settings.extra_tools": "Extra allowed tools",
"briefing.settings.extra_tools_hint": "One per line: a full tool name (mcp__server__tool) or a prefix ending in * (e.g. mcp__claude_ai_Atlassian_MCP__*). The source toggles allow the built-in list; add a line here when a connector is renamed or a new one appears, without waiting for a code change. Only names starting with mcp__ with letters, digits and . _ - are accepted; the deny list still wins. The briefing page's “How this run went” shows every server's real name, status and whether it was used.",
"briefing.trace.section": "How this run went ({when}{state})",
"briefing.trace.failed_mark": " · failed",
"briefing.trace.chain": "Fish → WSL → Claude Code {version} ({model} · permission mode {mode} · {turns} turns) → MCP servers:",
"briefing.trace.status.connected": "connected",
"briefing.trace.status.needs_auth": "not logged in",
"briefing.trace.status.failed": "unreachable",
"briefing.trace.used": "called {n} times",
"briefing.trace.allowed_unused": "allowed, not used this time",
"briefing.trace.not_allowed": "not allowed, yet used this time",
"briefing.trace.needs_auth": "Log in: run claude mcp login \"{name}\" in WSL, then regenerate",
"briefing.trace.no_servers": "This run reported no MCP servers",
"briefing.trace.others": "{n} more MCP servers are unrelated to the briefing (not allowed, not used)",
"briefing.trace.tools_present": "{allowed} allow-list entries; {present} tools actually existed this time (allowing a name that does not exist has no effect)",
"briefing.trace.calls": "Tool calls ({n})",
"briefing.trace.no_calls": "No tool was called",
"briefing.trace.denied": "Refused: {names}",
"briefing.trace.hooks": "That account's own hooks",
"briefing.trace.no_hooks": "No hooks ran",
"briefing.trace.command": "Command (run by the fish in the WSL login shell)",
"briefing.trace.prompt": "Prompt (exactly as sent)",
"briefing.trace.edit_template": "Edit the template in settings",
"briefing.settings.section": "Work briefing",
"settings.moved.title": "Where the settings are",
"settings.moved.hint": "The {name} settings moved to Config panorama; change them there.",
Expand Down
23 changes: 23 additions & 0 deletions pet/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,29 @@
"settings.distill_work.prompt_en": "公司侧蒸馏提示词(界面是英文时用)",
"briefing.settings.priority_rules": "优先级偏好",
"briefing.settings.priority_rules_hint": "简报里每条前面的 ★★★ / ★★ / ★ 由 Claude 判断;在这里写你的规矩(例如「QA 报的 bug 一律 ★★★」「文档类工单最多 ★」),会作为「我的优先级偏好」追加进提示词。留空 = 全凭它判断。",
"briefing.settings.extra_tools": "额外放行的工具",
"briefing.settings.extra_tools_hint": "一行一个:工具全名(mcp__服务器__工具)或以 * 结尾的前缀(例如 mcp__claude_ai_Atlassian_MCP__*)。来源开关放行的是内置名单;连接器换了名字、多了一条时在这里补,不用等改代码。只认 mcp__ 开头、字母数字和 . _ -;拒绝名单仍压过放行。简报页「这次是怎么生成的」里能看到每个服务器实际的名字、状态和这次用没用到。",
"briefing.trace.section": "这次是怎么生成的({when}{state})",
"briefing.trace.failed_mark": " · 失败",
"briefing.trace.chain": "肥鱼 → WSL → Claude Code {version}({model} · 权限模式 {mode} · {turns} 轮)→ MCP 服务器:",
"briefing.trace.status.connected": "已连接",
"briefing.trace.status.needs_auth": "没登录",
"briefing.trace.status.failed": "连不上",
"briefing.trace.used": "这次调了 {n} 次",
"briefing.trace.allowed_unused": "放行了,这次没用到",
"briefing.trace.not_allowed": "没放行,但这次用到了",
"briefing.trace.needs_auth": "要登录:在 WSL 里跑 claude mcp login \"{name}\",再重新生成",
"briefing.trace.no_servers": "这次运行没有报告任何 MCP 服务器",
"briefing.trace.others": "另有 {n} 个 MCP 服务器与简报无关(没放行、也没用到)",
"briefing.trace.tools_present": "放行名单 {allowed} 条;这次实际存在的工具 {present} 个(放行了不存在的名字没有任何效果)",
"briefing.trace.calls": "工具调用({n} 次)",
"briefing.trace.no_calls": "没有调用任何工具",
"briefing.trace.denied": "被拒的:{names}",
"briefing.trace.hooks": "那个账号自己的 hooks",
"briefing.trace.no_hooks": "没有 hooks 运行",
"briefing.trace.command": "命令(肥鱼在 WSL 登录 shell 里跑的)",
"briefing.trace.prompt": "提示词(发出去的原文)",
"briefing.trace.edit_template": "到设置里改模板",
"briefing.settings.section": "工作简报",
"settings.moved.title": "设置在哪",
"settings.moved.hint": "「{name}」的设置搬到配置全景了,在那里改。",
Expand Down
14 changes: 14 additions & 0 deletions pet/panorama/page/report.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ article code.chip{background:var(--chip);color:var(--chip-text);padding:1px 6px;
article .star{font-size:13px;letter-spacing:.05em}
article .star.s3{color:var(--p1);font-weight:700}article .star.s2{color:var(--p2)}article .star.s1{color:var(--p3)}
article .note{color:var(--m-muted)}
/* 「这次是怎么生成的」:几段折叠块,内容由 reports.trace_sections 渲染 */
.details{margin-top:14px}
.details details{background:var(--m-tile);margin:0 0 8px;padding:8px 16px;box-shadow:0 4px 14px rgba(0,0,0,.12)}
.details summary{cursor:pointer;font-weight:600;color:var(--m-title);font-size:14px}
.details .d{font-size:13.5px;padding:6px 0 4px}
.details .d p{margin:6px 0}.details .d .note{color:var(--m-muted)}.details .d .bad{color:var(--p1)}.details .d .ok{color:#3cb371}
.details .d table.servers{border-collapse:collapse;width:100%;margin:6px 0}
.details .d td{padding:3px 10px 3px 0;vertical-align:top;border-bottom:1px solid rgba(128,128,128,.18)}
.details .d td.st{white-space:nowrap}.details .d td.st.connected{color:#3cb371}.details .d td.st.needs-auth{color:var(--p2)}.details .d td.st.failed{color:var(--p1)}
.details .d ol.calls{margin:4px 0;padding-left:24px}.details .d ol.calls li{margin:3px 0}
.details .d code{background:var(--chip);color:var(--chip-text);padding:1px 6px;font-size:12.5px}
.details .d .srv{color:var(--m-muted);font-size:12px}
.details .d pre{white-space:pre-wrap;word-break:break-word;background:var(--chip);color:var(--chip-text);padding:8px 10px;font-size:12.5px;max-height:380px;overflow:auto;margin:4px 0}
.details .d a{color:var(--link);text-decoration:none}.details .d a:hover{text-decoration:underline}
.foot{display:flex;align-items:center;gap:14px;margin-top:14px}
.status{flex:1;color:var(--m-muted);font-size:13px;min-height:1.5em}.status.bad{color:var(--p1)}
.btn{background:var(--m-accent);color:var(--m-selected-text);border:0;padding:8px 18px;font:inherit;font-size:14px;cursor:pointer;box-shadow:0 6px 18px rgba(0,0,0,.22)}
Expand Down
1 change: 1 addition & 0 deletions pet/panorama/page/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ <h1 id="title"></h1>
<p class="summary" id="summary" hidden></p>
<div class="usage" id="usage"></div>
<article id="body"></article>
<section class="details" id="details"></section>
<div class="foot">
<span class="status" id="status"></span>
<button class="btn" id="action" hidden></button>
Expand Down
11 changes: 9 additions & 2 deletions pet/panorama/page/report.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* 报告页的脚本(/report/<名字>,现在只有工作简报):取令牌 → 向 /api/report/<名字> 要数据 → 摆到页面上 →
带着编号去「等更新的」(服务把请求挂住,生成开始 / 结束那一刻才回),页面原地重画。

页面不认识具体功能:标题、概要、用量、全文、按钮都是服务给的字段。全文是服务端渲染好的 HTML(markdown.py 只会产出
页面不认识具体功能:标题、概要、用量、全文、按钮、「这次是怎么生成的」几段都是服务给的字段。全文是服务端渲染好的 HTML(markdown.py 只会产出
那几个标签,别的全转义过了),直接放进 article;概要、用量这类纯文字这里转义。
「重新生成」:POST /api/actions/<动作名> {report};服务回 started 之后不动按钮——生成开始的信号会让页面重画成忙碌,
结束再重画成新内容。回 busy 时按钮保持灰,别的回答把原因写在状态栏、按钮放开。 */
Expand All @@ -11,7 +11,7 @@ import {takeToken, makeApi} from './client.js';
(function () {
var RETRY_MS = 1000; /* 服务说「这段时间没有新数据」之后隔多久再去等:只为防止出错时空转 */
var name = location.pathname.split('/').pop();
var api = makeApi(takeToken('report-token').token);
var token = takeToken('report-token').token, api = makeApi(token);
var el = function (id) { return document.getElementById(id); };
var revision = 0, waiting = false, dead = false, S = {};

Expand All @@ -31,6 +31,13 @@ import {takeToken, makeApi} from './client.js';
if (r.available === false) el('body').innerHTML = '<p class="note">' + esc(S.report_unavailable) + '</p>';
else if (r.html) el('body').innerHTML = r.html;
else el('body').innerHTML = '<p class="note">' + esc(r.busy ? r.busy_text : r.empty_text) + '</p>';
/* 详情几段也是服务端渲染好的 HTML(reports.trace_sections),第一段默认展开;里面「到设置里改」的占位换成
配置全景带令牌的地址(同一个服务、同一个令牌) */
var settingsUrl = location.origin + '/#' + token + (r.settings_focus ? '&settings=' + encodeURIComponent(r.settings_focus) : '');
el('details').innerHTML = (r.details || []).map(function (d, i) {
return '<details' + (i === 0 ? ' open' : '') + '><summary>' + esc(d.title) + '</summary><div class="d">' +
String(d.html || '').split('__SETTINGS_URL__').join(settingsUrl) + '</div></details>';
}).join('');
el('status').textContent = r.busy ? r.busy_text : (r.error || '');
el('status').className = 'status' + (r.error && !r.busy ? ' bad' : '');
var btn = el('action');
Expand Down
Loading
Loading