codebee 0.1.25 → 0.1.26
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 +13 -3
- package/README.md +10 -0
- package/app/core/pipeline.py +112 -10
- package/app/core/prefs.py +70 -0
- package/app/main.py +13 -1
- package/app/pet.py +85 -1
- package/app/ui/app.js +139 -11
- package/app/ui/i18n.js +23 -0
- package/app/ui/index.html +9 -0
- package/app/ui/style.css +52 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,19 @@ CodeBee 的用户可感知变更记录。发布新版时:最上面加一节,
|
|
|
4
4
|
`<!-- relnotes:start -->…<!-- relnotes:end -->` 段(那段会被 `npm view` 的
|
|
5
5
|
README 元数据带回,供老版本在「发现新版本」时展示新版更新内容)。
|
|
6
6
|
|
|
7
|
-
## 未发布
|
|
8
|
-
|
|
9
|
-
## v0.1.
|
|
7
|
+
## 未发布
|
|
8
|
+
|
|
9
|
+
## v0.1.26(2026-09-21)
|
|
10
|
+
|
|
11
|
+
### ✨ 新功能
|
|
12
|
+
|
|
13
|
+
- 顶栏新增统一操作状态中心:创建、删除、绑定、插件等用户写操作会显示进行中、完成或失败状态,并保留时间与错误原因,慢请求不再像页面卡死。
|
|
14
|
+
|
|
15
|
+
### 🛠 问题修复
|
|
16
|
+
|
|
17
|
+
- 后台维护写请求、任务澄清探测和轮询请求默认静默,避免把后台动作误显示成用户操作;移动端状态弹层自适应屏幕并支持减少动画。
|
|
18
|
+
|
|
19
|
+
## v0.1.25(2026-09-21)
|
|
10
20
|
|
|
11
21
|
### ✨ 新功能
|
|
12
22
|
|
package/README.md
CHANGED
|
@@ -23,6 +23,16 @@ Kimi Code、MiMo Code、Grok Build、Pi、DeepSeek Harness……),提供
|
|
|
23
23
|
<!-- relnotes:start -->
|
|
24
24
|
### ✨ 新功能 · New
|
|
25
25
|
|
|
26
|
+
- 顶栏新增统一操作状态中心:创建、删除、绑定、插件等写操作会显示进行中、完成或失败状态,并保留时间与错误原因。
|
|
27
|
+
- A unified operation center now shows create, delete, binding, and plugin actions as running, completed, or failed, with timestamps and error details.
|
|
28
|
+
|
|
29
|
+
### 🛠 问题修复 · Fixes
|
|
30
|
+
|
|
31
|
+
- 后台维护、澄清探测和轮询请求默认静默,移动端状态弹层自适应屏幕并支持减少动画。
|
|
32
|
+
- Background maintenance, clarification probes, and polling stay quiet by default; the mobile operation panel adapts to the viewport and respects reduced-motion settings.
|
|
33
|
+
|
|
34
|
+
### 上一版亮点 · Previous release
|
|
35
|
+
|
|
26
36
|
- 文档类任务更专业:汇报先给结论、邮件先答复再铺陈、技术方案从问题开场并保留被否决的真实备选、文档验收标准可逐条勾选。
|
|
27
37
|
- Smarter document tasks: reports lead with conclusions, emails answer first, proposals open at the problem and keep a real rejected alternative, docs get testable acceptance criteria.
|
|
28
38
|
|
package/app/core/pipeline.py
CHANGED
|
@@ -1091,10 +1091,25 @@ def _run_code(run, task, agents, ev, stats, mode):
|
|
|
1091
1091
|
|
|
1092
1092
|
def review_and_score():
|
|
1093
1093
|
verify_pass, verify_ran = _run_verify(run_id, task, workdir, ev)
|
|
1094
|
+
# gate 验证(借鉴 pi-subagents 的 gate:"npm test"):verify 失败时先跳过
|
|
1095
|
+
# 模型评审直接进修复轮——评审此时只能复述「验证没过」,白烧一次调用。
|
|
1096
|
+
# 连续失败 >=2 轮后恢复评审参与诊断(模型能看出编译错误之外的病灶)。
|
|
1097
|
+
if not verify_pass and verify_ran:
|
|
1098
|
+
verify_fail_streak[0] += 1
|
|
1099
|
+
if verify_fail_streak[0] < 2:
|
|
1100
|
+
return {"pass": False, "scores": {},
|
|
1101
|
+
"issues": [{"severity": "high", "title": "验证命令未通过",
|
|
1102
|
+
"detail": "验证命令 `%s` 未通过:先修复使验证转绿,无需等评审。"
|
|
1103
|
+
% task.get("verify_command")}],
|
|
1104
|
+
"summary": "gate:验证未通过,跳过模型评审直接修复"}, verify_pass, verify_ran
|
|
1105
|
+
else:
|
|
1106
|
+
verify_fail_streak[0] = 0
|
|
1094
1107
|
# 先让确定性验证落盘,再执行模型评审;终态判断会同时使用两份证据。
|
|
1095
1108
|
review_json = _run_review(run_id, task, workdir, modelhub.bind_agent(reviewer, difficulty), ev)
|
|
1096
1109
|
return review_json, verify_pass, verify_ran
|
|
1097
1110
|
|
|
1111
|
+
verify_fail_streak = [0] # gate:verify 连败计数(>=2 轮恢复评审参与诊断)
|
|
1112
|
+
|
|
1098
1113
|
attempt_note = route.get("implementer", "") if mode == "auto" else ""
|
|
1099
1114
|
round_no = 0
|
|
1100
1115
|
review_json, verify_pass, verify_ran = None, True, False
|
|
@@ -1707,6 +1722,43 @@ def _plot_modules(workdir):
|
|
|
1707
1722
|
"鼓励化用,不要照抄原句)\n\n" + txt)
|
|
1708
1723
|
|
|
1709
1724
|
|
|
1725
|
+
LEDGER_FILE = os.path.join(".codebee", "resource-ledger.md")
|
|
1726
|
+
_LEDGER_MAX_CHARS = 6000 # 账本注入上限:太老的状态让评审官收敛 recent 优先
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
def _parse_tagged_lines(text, tag):
|
|
1730
|
+
"""从模型回复提取 <tag>...</tag> 块的非空行列表(缺失/空块返回 [])。"""
|
|
1731
|
+
m = re.search(r"<%s>([\s\S]*?)</%s>" % (tag, tag), text or "")
|
|
1732
|
+
if not m:
|
|
1733
|
+
return []
|
|
1734
|
+
return [ln.strip(" -*") for ln in m.group(1).splitlines() if ln.strip(" -*")]
|
|
1735
|
+
|
|
1736
|
+
|
|
1737
|
+
def _append_ledger(workdir, chapter, lines):
|
|
1738
|
+
"""资源账本追加:本章评审提炼的道具/伤情/承诺/伏笔增量,供下章起草注入。"""
|
|
1739
|
+
p = os.path.abspath(os.path.join(str(workdir or ""), LEDGER_FILE))
|
|
1740
|
+
if not _inside(workdir, p):
|
|
1741
|
+
raise ValueError("ledger 路径越界")
|
|
1742
|
+
os.makedirs(os.path.dirname(p), exist_ok=True)
|
|
1743
|
+
with open(p, "a", encoding="utf-8") as f:
|
|
1744
|
+
if f.tell() == 0:
|
|
1745
|
+
f.write("# 资源账本(每章评审自动追加:道具/伤情/承诺/伏笔的现状,"
|
|
1746
|
+
"写新章前必须核对,防止跨章穿帮)\n\n")
|
|
1747
|
+
f.write("## 第 %d 章\n%s\n" % (chapter, "\n".join("- " + x for x in lines)))
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
def _read_ledger(workdir):
|
|
1751
|
+
"""读取资源账本注入文本(截至上一章)。不存在返回「(暂无记录)」。"""
|
|
1752
|
+
p = os.path.abspath(os.path.join(str(workdir or ""), LEDGER_FILE))
|
|
1753
|
+
if not _inside(workdir, p) or not os.path.isfile(p):
|
|
1754
|
+
return "(暂无记录,本章建立的新道具/伤情/承诺/伏笔会被账本自动登记)"
|
|
1755
|
+
try:
|
|
1756
|
+
txt = _read_text_any_enc(p)[-_LEDGER_MAX_CHARS:].strip()
|
|
1757
|
+
except OSError:
|
|
1758
|
+
return "(暂无记录)"
|
|
1759
|
+
return txt or "(暂无记录)"
|
|
1760
|
+
|
|
1761
|
+
|
|
1710
1762
|
def _shrink_context_block(sk_block, bible, budget=12000):
|
|
1711
1763
|
"""分层上下文降级(长提示词在容量受限通道上会挂起/秒拒,2026-09-17 讯飞实测)。
|
|
1712
1764
|
|
|
@@ -1793,6 +1845,9 @@ __OUTLINE__
|
|
|
1793
1845
|
## 前情提要(此前各章结尾摘录,衔接用)
|
|
1794
1846
|
__PREV__
|
|
1795
1847
|
|
|
1848
|
+
## 资源账本(道具/伤情/承诺/伏笔的现状登记,写本章前必须核对)
|
|
1849
|
+
__LEDGER__
|
|
1850
|
+
|
|
1796
1851
|
- 写完文件后,最终回复只输出一行:`第 __I__ 章完成(约 __WORDS__ 字)`——不要在回复里复述或解释正文。"""
|
|
1797
1852
|
|
|
1798
1853
|
SERIAL_REVISE_PROMPT = """你是一名网文作者。第 __I__ 章没有通过评审,请修订文件 `__FILE__`(直接改写该文件)。文件必须以 UTF-8 编码保存(PowerShell 显式加 -Encoding UTF8,禁止依赖默认编码)。
|
|
@@ -1992,12 +2047,15 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
1992
2047
|
bible = task["context"] + ("\n\n" + bible if bible else "")
|
|
1993
2048
|
|
|
1994
2049
|
|
|
1995
|
-
def crit_prompt_for(text, note=""):
|
|
2050
|
+
def crit_prompt_for(text, note="", event_check=""):
|
|
1996
2051
|
tpl = _ensure_critique_placeholders(
|
|
1997
2052
|
_tpl(task, "critique_prompt", NOVEL_CRITIQUE_PROMPT))
|
|
1998
2053
|
if note:
|
|
1999
2054
|
tpl = tpl.replace("你是严格的评审",
|
|
2000
2055
|
"你是严格的评审(背景:%s,请结合全书目标评审本章节)" % note, 1)
|
|
2056
|
+
if event_check:
|
|
2057
|
+
# 逐项目标审稿(借鉴 AI-Novel-Writer v1.1):本章大纲要点逐项核对
|
|
2058
|
+
tpl = tpl.replace("## 待评审稿件", "%s\n\n## 待评审稿件" % event_check, 1)
|
|
2001
2059
|
# stable_order:评审分轮次调用,hits 中途变化会打碎前缀缓存(§07 T1.2')
|
|
2002
2060
|
sk, _ = skills.block_for(task, stable_order=True)
|
|
2003
2061
|
if sk:
|
|
@@ -2074,6 +2132,22 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
2074
2132
|
i = start + k - 1 # 全书章号:文件名/步骤角色/评分记录都按全书编号
|
|
2075
2133
|
ch = outline["chapters"][k - 1]
|
|
2076
2134
|
ch_file = "chapter-%02d.md" % i
|
|
2135
|
+
# 逐项目标审稿(借鉴 AI-Novel-Writer):本章大纲要点随评审下发,评审
|
|
2136
|
+
# 以 <event_check> 回逐项判定;资源账本(借鉴角色资源账本)以 <ledger>
|
|
2137
|
+
# 回本章道具/伤情/承诺/伏笔增量,评审达标后追加账本文件供下章注入。
|
|
2138
|
+
event_block = (
|
|
2139
|
+
"## 本章大纲核对(逐项目标审稿)\n"
|
|
2140
|
+
"本章按大纲应完成:\n- 剧情要点:%s\n- 章末钩子:%s\n"
|
|
2141
|
+
"评审时逐项判定「已完成 / 未完成 / 待核实」,判定必须引用正文证据"
|
|
2142
|
+
"(原文短句或位置),写在回复末尾的 <event_check> 块内(每项一行)。"
|
|
2143
|
+
"「铺垫了但没发生」不算已完成;未完成的项必须反映到对应维度评分。\n"
|
|
2144
|
+
"另在 <event_check> 块之后输出 <ledger> 块(没有新变化就整个省略):"
|
|
2145
|
+
"逐行列出本章新出现或状态变化的 道具/伤情/承诺/伏笔,格式:"
|
|
2146
|
+
"类型|名称|现状(一句话)。\n\n"
|
|
2147
|
+
% (ch.get("beats") or "按大纲推进", ch.get("hook") or "留下悬念"))
|
|
2148
|
+
ev_check_lines = [[]] # 每章重置:第一份非空评审的逐项判定
|
|
2149
|
+
ledger_lines = [] # 本章全部评审的账本增量并集
|
|
2150
|
+
ledger_txt = _read_ledger(workdir) # 截至上一章的资源账本(起草注入)
|
|
2077
2151
|
prev = ""
|
|
2078
2152
|
draft_sid = "" # §07 T1.1:本轮 draft/复用章的会话 id(revise 复用;reuse 时为空)
|
|
2079
2153
|
if i > 1:
|
|
@@ -2101,8 +2175,14 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
2101
2175
|
rounds_used = 1
|
|
2102
2176
|
means = {}
|
|
2103
2177
|
|
|
2104
|
-
|
|
2105
|
-
|
|
2178
|
+
# 逐项目标审稿 + 资源账本的每章聚合桶(run_critique 内解析填充;
|
|
2179
|
+
# event_check 取第一份非空,ledger 全评审增量求并)
|
|
2180
|
+
ev_check_lines = [[]]
|
|
2181
|
+
ledger_lines = []
|
|
2182
|
+
|
|
2183
|
+
def run_critique(text, rnd, note_extra="", critic_sids=None, event_check=""):
|
|
2184
|
+
"""一轮多维评审:返回 (cj_by_agent, scored)。变体赛马与主循环共用。
|
|
2185
|
+
event_check:本章大纲核对块(逐项目标审稿),随评审下发并回收标记块。"""
|
|
2106
2186
|
cj_map, sids = {}, dict(critic_sids or {})
|
|
2107
2187
|
scored = 0 # 真正给出分数的评审数;失败/不可解析不得当成 0 分计入
|
|
2108
2188
|
for agent in critics:
|
|
@@ -2125,12 +2205,20 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
2125
2205
|
note=("小说第 %d 章" % i) + (
|
|
2126
2206
|
"|你的专属评审视角:%s(其他评审会覆盖其余视角,"
|
|
2127
2207
|
"请深挖你的镜头,但所有维度仍需打分)" % lens)
|
|
2128
|
-
if lens else ""
|
|
2208
|
+
if lens else "",
|
|
2209
|
+
event_check=event_check) + note_extra,
|
|
2129
2210
|
workdir, readonly=True, ev=ev,
|
|
2130
2211
|
resume=sids.get(agent["id"]))
|
|
2131
2212
|
cj = _critique_json(res, dims)
|
|
2132
2213
|
if cj.get("scores"):
|
|
2133
2214
|
scored += 1
|
|
2215
|
+
# 逐项目标审稿 + 资源账本:解析评审回复里的标记块(借鉴
|
|
2216
|
+
# AI-Novel-Writer 逐项核对/角色资源账本)。多评审取第一份
|
|
2217
|
+
# 非空即可,聚合时已在前两处赋值处去重。
|
|
2218
|
+
evl = _parse_tagged_lines(res.get("text"), "event_check")
|
|
2219
|
+
if evl and not ev_check_lines[0]:
|
|
2220
|
+
ev_check_lines[0] = evl
|
|
2221
|
+
ledger_lines.extend(_parse_tagged_lines(res.get("text"), "ledger"))
|
|
2134
2222
|
# §07 T1.1:记录该评审的会话 id(第 2 轮复用)
|
|
2135
2223
|
csid = _resume_sid(agent, res.get("sid"))
|
|
2136
2224
|
if csid:
|
|
@@ -2150,7 +2238,8 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
2150
2238
|
res = _run_step(run_id, role, modelhub.bind_agent(spare, difficulty),
|
|
2151
2239
|
crit_prompt_for(
|
|
2152
2240
|
text,
|
|
2153
|
-
note="小说第 %d 章" % i
|
|
2241
|
+
note="小说第 %d 章" % i,
|
|
2242
|
+
event_check=event_check) + note_extra,
|
|
2154
2243
|
workdir, readonly=True, ev=ev)
|
|
2155
2244
|
cj = runner.extract_json(res.get("text") or "")
|
|
2156
2245
|
if isinstance(cj, dict) and isinstance(cj.get("scores"), dict) \
|
|
@@ -2222,6 +2311,7 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
2222
2311
|
.replace("__GOAL__", task["goal"])
|
|
2223
2312
|
.replace("__OUTLINE__", outline_txt)
|
|
2224
2313
|
.replace("__PREV__", prev)
|
|
2314
|
+
.replace("__LEDGER__", ledger_txt)
|
|
2225
2315
|
.replace("__TITLE__", ch["title"])
|
|
2226
2316
|
.replace("__BEATS__", ch["beats"] or "按大纲推进")
|
|
2227
2317
|
.replace("__HOOK__", ch.get("hook") or "留下悬念")
|
|
@@ -2474,7 +2564,8 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
2474
2564
|
if rnd == 1 and race_cj is not None:
|
|
2475
2565
|
cj_by_agent, scored = race_cj, race_scored
|
|
2476
2566
|
else:
|
|
2477
|
-
cj_by_agent, scored, sids_now = run_critique(
|
|
2567
|
+
cj_by_agent, scored, sids_now = run_critique(
|
|
2568
|
+
text, rnd, critic_sids=critic_sids, event_check=event_block)
|
|
2478
2569
|
critic_sids.update(sids_now)
|
|
2479
2570
|
if not scored:
|
|
2480
2571
|
# 「评不上」≠「评了 0 分」:全部评审失败时中止本轮,
|
|
@@ -2538,12 +2629,23 @@ def _run_serial_review(run, task, agents, ev, stats, mode, critics, impl, route,
|
|
|
2538
2629
|
impl, implement_reason="章节修订:%s" %
|
|
2539
2630
|
(impl.get("label") or impl.get("id")))
|
|
2540
2631
|
_check_cancel(ev)
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2632
|
+
cs_new = {"chapter": i, "title": ch["title"], "means": means,
|
|
2633
|
+
"passed": bool(means) and all(v >= threshold_ch for v in means.values()),
|
|
2634
|
+
"rounds": rounds_used,
|
|
2635
|
+
"words": _wc(_read_chapter(workdir, i))}
|
|
2636
|
+
if ev_check_lines[0]:
|
|
2637
|
+
cs_new["event_check"] = ev_check_lines[0][:8] # 逐项目标审稿结果
|
|
2638
|
+
chapter_scores.append(cs_new)
|
|
2545
2639
|
# 每章即时持久化:长篇中断/超时后可断点续跑,不丢已完成章的分数
|
|
2546
2640
|
store.update_run(run_id, chapter_scores=chapter_scores)
|
|
2641
|
+
# 资源账本(借鉴角色资源账本):评审提出的道具/伤情/承诺/伏笔增量
|
|
2642
|
+
# 追加到 .codebee/resource-ledger.md,下一章起草时注入,防跨章穿帮。
|
|
2643
|
+
# 失败静默——账本是增强不是硬依赖。
|
|
2644
|
+
if ledger_lines:
|
|
2645
|
+
try:
|
|
2646
|
+
_append_ledger(workdir, i, ledger_lines)
|
|
2647
|
+
except Exception:
|
|
2648
|
+
pass
|
|
2547
2649
|
# findings 沉淀(借鉴 agentmemory 持久记忆):章节标题+要点追加到
|
|
2548
2650
|
# .codebee/findings.md——后续章节起草时随圣经/模块库注入,弥补
|
|
2549
2651
|
# 前情提要只看近 2 章结尾的中期记忆空洞。失败静默。
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""偏好记忆(借鉴 chinese-novelist-skill 的偏好记忆,2026-09-21):记住用户
|
|
3
|
+
上次创建任务时选择的类型与参数,新建任务时预填「最近一次的选择」而不是
|
|
4
|
+
写死的出厂默认——高频用户不用每次重调轮数/阈值/章节。
|
|
5
|
+
|
|
6
|
+
只记参数不记内容(目标/标题绝不落库);单文件带锁读写,损坏即弃。
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import threading
|
|
12
|
+
|
|
13
|
+
from . import paths
|
|
14
|
+
|
|
15
|
+
_LOCK = threading.Lock()
|
|
16
|
+
_FILE = paths.DATA_DIR / "last-prefs.json"
|
|
17
|
+
|
|
18
|
+
SAVE_KEYS = ("type", "rounds", "threshold", "best_of", "chapters",
|
|
19
|
+
"words_per_chapter", "variants")
|
|
20
|
+
_LIMITS = {"rounds": (1, 5), "threshold": (1.0, 10.0), "best_of": (1, 3),
|
|
21
|
+
"chapters": (1, 2000), "words_per_chapter": (200, 20000),
|
|
22
|
+
"variants": (1, 3)}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _clamp(key, value):
|
|
26
|
+
"""数值钳制:历史文件被手改出天际值时按参数合法域兜底。"""
|
|
27
|
+
lo, hi = _LIMITS.get(key), (0, 10 ** 9)
|
|
28
|
+
lo, hi = lo if lo else hi
|
|
29
|
+
try:
|
|
30
|
+
return max(lo, min(hi, type(lo)(value) if isinstance(lo, int)
|
|
31
|
+
else float(value)))
|
|
32
|
+
except (TypeError, ValueError):
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def record(payload):
|
|
37
|
+
"""从创建任务的 payload 提取可复用参数(存在才覆盖,单键独立保留)。"""
|
|
38
|
+
if not isinstance(payload, dict):
|
|
39
|
+
return
|
|
40
|
+
with _LOCK:
|
|
41
|
+
cur = load()
|
|
42
|
+
for key in SAVE_KEYS:
|
|
43
|
+
v = payload.get(key)
|
|
44
|
+
if v is None:
|
|
45
|
+
continue
|
|
46
|
+
if key == "type":
|
|
47
|
+
v = str(v)[:32]
|
|
48
|
+
if v:
|
|
49
|
+
cur["type"] = v
|
|
50
|
+
continue
|
|
51
|
+
c = _clamp(key, v)
|
|
52
|
+
if c is not None:
|
|
53
|
+
cur[key] = c
|
|
54
|
+
tmp = _FILE.with_suffix(".tmp")
|
|
55
|
+
try:
|
|
56
|
+
paths.DATA_DIR.mkdir(parents=True, exist_ok=True)
|
|
57
|
+
tmp.write_text(json.dumps(cur, ensure_ascii=False, indent=2),
|
|
58
|
+
encoding="utf-8")
|
|
59
|
+
tmp.replace(_FILE)
|
|
60
|
+
except OSError:
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def load():
|
|
65
|
+
"""读最近偏好;文件缺失/损坏返回 {}。"""
|
|
66
|
+
try:
|
|
67
|
+
data = json.loads(_FILE.read_text(encoding="utf-8"))
|
|
68
|
+
return data if isinstance(data, dict) else {}
|
|
69
|
+
except (OSError, ValueError):
|
|
70
|
+
return {}
|
package/app/main.py
CHANGED
|
@@ -308,6 +308,10 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
308
308
|
# 一键反馈 Issue 的预填摘要(标题+正文,全程脱敏,用户亲手提交)
|
|
309
309
|
from core import telemetry
|
|
310
310
|
return self._json(200, telemetry.issue_report(days=30))
|
|
311
|
+
if path == "/api/prefs":
|
|
312
|
+
# 偏好记忆:上次创建任务的类型/参数(新建表单预填用)
|
|
313
|
+
from core import prefs
|
|
314
|
+
return self._json(200, {"prefs": prefs.load()})
|
|
311
315
|
if path == "/api/ports":
|
|
312
316
|
# 端口占用诊断(借鉴 leftopen):谁在听、PID/进程/项目归属、
|
|
313
317
|
# 是否仅本机。?port=N 只看单端口。只读,不碰任何进程。
|
|
@@ -2051,7 +2055,15 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
2051
2055
|
return 200, {"task_id": task["id"], "run_id": run["id"]}
|
|
2052
2056
|
|
|
2053
2057
|
def _api_create_task(self):
|
|
2054
|
-
|
|
2058
|
+
body = self._body()
|
|
2059
|
+
status, resp = self._create_and_start(body)
|
|
2060
|
+
if status == 200:
|
|
2061
|
+
# 偏好记忆(借鉴 chinese-novelist-skill):记住本次选择,下次新建预填
|
|
2062
|
+
try:
|
|
2063
|
+
from core import prefs
|
|
2064
|
+
prefs.record(body)
|
|
2065
|
+
except Exception:
|
|
2066
|
+
pass
|
|
2055
2067
|
return self._json(status, resp)
|
|
2056
2068
|
|
|
2057
2069
|
def _api_task_clarify(self):
|
package/app/pet.py
CHANGED
|
@@ -359,6 +359,85 @@ def global_lock_held():
|
|
|
359
359
|
return False
|
|
360
360
|
|
|
361
361
|
|
|
362
|
+
# 浏览器进程白名单:找已打开的 CodeBee 窗口时只认这些主进程的顶层窗口,
|
|
363
|
+
# 避免把桌宠自身(标题也是 CodeBee)或 start-public.bat 起的「CodeBee」
|
|
364
|
+
# 控制台窗口误当成浏览器置前。
|
|
365
|
+
_BROWSER_EXES = {
|
|
366
|
+
"msedge.exe", "chrome.exe", "chromium.exe", "firefox.exe",
|
|
367
|
+
"iexplore.exe", "opera.exe", "brave.exe", "vivaldi.exe",
|
|
368
|
+
"browser.exe", "waterfox.exe", "palemoon.exe", "seamonkey.exe",
|
|
369
|
+
"centbrowser.exe", "360chrome.exe", "qqbrowser.exe",
|
|
370
|
+
"sogouexplorer.exe", "maxthon.exe",
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def _window_process_name(hwnd):
|
|
375
|
+
"""取顶层窗口所属进程的可执行文件名(小写);失败返回空串。"""
|
|
376
|
+
try:
|
|
377
|
+
import ctypes
|
|
378
|
+
from ctypes import wintypes
|
|
379
|
+
user32 = ctypes.windll.user32
|
|
380
|
+
kernel32 = ctypes.windll.kernel32
|
|
381
|
+
pid = wintypes.DWORD()
|
|
382
|
+
user32.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
|
|
383
|
+
if not pid.value:
|
|
384
|
+
return ""
|
|
385
|
+
kernel32.OpenProcess.restype = wintypes.HANDLE
|
|
386
|
+
# PROCESS_QUERY_LIMITED_INFORMATION=0x1000:只需取映像路径
|
|
387
|
+
h = kernel32.OpenProcess(0x1000, False, pid.value)
|
|
388
|
+
if not h:
|
|
389
|
+
return ""
|
|
390
|
+
try:
|
|
391
|
+
buf = ctypes.create_unicode_buffer(1024)
|
|
392
|
+
size = wintypes.DWORD(1024)
|
|
393
|
+
if kernel32.QueryFullProcessImageNameW(h, 0, buf,
|
|
394
|
+
ctypes.byref(size)):
|
|
395
|
+
return Path(buf.value).name.lower()
|
|
396
|
+
finally:
|
|
397
|
+
kernel32.CloseHandle(h)
|
|
398
|
+
except Exception:
|
|
399
|
+
pass
|
|
400
|
+
return ""
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def _focus_codebee_window(ignore_hwnd=None):
|
|
404
|
+
"""Windows:已打开过 CodeBee 浏览器页时,把那个窗口找出来还原并置前,
|
|
405
|
+
避免每点一次桌宠就新开一个浏览器窗口。返回 True 表示已找到并尝试置前;
|
|
406
|
+
False 表示没有现成窗口,调用方应回退 webbrowser.open 新开。"""
|
|
407
|
+
try:
|
|
408
|
+
import ctypes
|
|
409
|
+
from ctypes import wintypes
|
|
410
|
+
user32 = ctypes.windll.user32
|
|
411
|
+
EnumWindowsProc = ctypes.WINFUNCTYPE(
|
|
412
|
+
wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
|
|
413
|
+
found = []
|
|
414
|
+
|
|
415
|
+
def _cb(hwnd, _lp):
|
|
416
|
+
if hwnd == ignore_hwnd or not user32.IsWindowVisible(hwnd):
|
|
417
|
+
return True
|
|
418
|
+
if _window_process_name(hwnd) not in _BROWSER_EXES:
|
|
419
|
+
return True
|
|
420
|
+
length = user32.GetWindowTextLengthW(hwnd)
|
|
421
|
+
if length <= 0:
|
|
422
|
+
return True
|
|
423
|
+
buf = ctypes.create_unicode_buffer(length + 1)
|
|
424
|
+
user32.GetWindowTextW(hwnd, buf, length + 1)
|
|
425
|
+
if "CodeBee" in buf.value:
|
|
426
|
+
found.append(hwnd)
|
|
427
|
+
return True
|
|
428
|
+
|
|
429
|
+
user32.EnumWindows(EnumWindowsProc(_cb), 0)
|
|
430
|
+
if not found:
|
|
431
|
+
return False
|
|
432
|
+
target = found[0]
|
|
433
|
+
if user32.IsIconic(target):
|
|
434
|
+
user32.ShowWindow(target, 9) # SW_RESTORE:最小化先还原
|
|
435
|
+
user32.SetForegroundWindow(target)
|
|
436
|
+
return True
|
|
437
|
+
except Exception:
|
|
438
|
+
return False
|
|
439
|
+
|
|
440
|
+
|
|
362
441
|
class PetApp:
|
|
363
442
|
"""蜜蜂窗口:蜜蜂本体(精灵/手绘)+ 状态机动画 + 悬停任务清单 + 右键菜单。"""
|
|
364
443
|
|
|
@@ -1296,7 +1375,12 @@ class PetApp:
|
|
|
1296
1375
|
|
|
1297
1376
|
def _open_ui(self):
|
|
1298
1377
|
try:
|
|
1299
|
-
|
|
1378
|
+
url = "http://127.0.0.1:%d" % self.port
|
|
1379
|
+
# 已开过就不新开:Windows 上先找现有 CodeBee 浏览器窗口置前,
|
|
1380
|
+
# 找不到(没开/标签不在前台)才回退 webbrowser.open 新开。
|
|
1381
|
+
if os.name == "nt" and _focus_codebee_window(self.root.winfo_id()):
|
|
1382
|
+
return
|
|
1383
|
+
webbrowser.open(url)
|
|
1300
1384
|
except Exception:
|
|
1301
1385
|
pass
|
|
1302
1386
|
|
package/app/ui/app.js
CHANGED
|
@@ -43,11 +43,12 @@ function flowDesc(f) {
|
|
|
43
43
|
function renderTypeOptions() {
|
|
44
44
|
const sel = $("f-type");
|
|
45
45
|
if (!sel || !S.flows) return;
|
|
46
|
-
const prev = sel.value;
|
|
47
|
-
sel.innerHTML = (S.flows || []).map((f) => {
|
|
46
|
+
const prev = sel.value; sel.innerHTML = (S.flows || []).map((f) => {
|
|
48
47
|
return '<option value="' + esc(f.id) + '">' + esc(t(f.name)) + t("(") + flowDesc(f) + (f.builtin ? "" : t(" · 自定义")) + t(")") + "</option>";
|
|
49
48
|
}).join("");
|
|
50
49
|
if (prev && flowById(prev)) sel.value = prev;
|
|
50
|
+
// 偏好记忆:上次创建用的类型优先于出厂默认「直接执行」(老数据/已删流程回落)
|
|
51
|
+
else if (S.lastPrefs && S.lastPrefs.type && flowById(S.lastPrefs.type)) sel.value = S.lastPrefs.type;
|
|
51
52
|
// 首屏默认落在「直接执行」(快档位:单 CLI 直达,无拆解/评审);
|
|
52
53
|
// 老数据或该流程被删时保持首项,不硬造一个不存在的值
|
|
53
54
|
else if (flowById("direct")) sel.value = "direct";
|
|
@@ -160,9 +161,11 @@ function onTypeChange() {
|
|
|
160
161
|
if (goal && flow && flow.goal_hint) goal.placeholder = t(flow.goal_hint);
|
|
161
162
|
if (isReview && flow) {
|
|
162
163
|
if (flow.manuscript) $("f-manuscript").value = flow.manuscript;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
// 偏好记忆(借鉴 chinese-novelist-skill):上次创建用过的参数优先于流程出厂默认
|
|
165
|
+
const lp = S.lastPrefs || {};
|
|
166
|
+
$("f-rounds").value = lp.rounds || flow.rounds || 2;
|
|
167
|
+
$("f-threshold").value = (lp.threshold != null ? lp.threshold : (flow.threshold || 7.0));
|
|
168
|
+
$("f-bestof").value = lp.best_of || flow.best_of || 1;
|
|
166
169
|
const rubric = $("f-rubric");
|
|
167
170
|
const previousFlow = rubric.dataset.flowId || "";
|
|
168
171
|
if (!S.flowRubricDrafts) S.flowRubricDrafts = {};
|
|
@@ -175,10 +178,10 @@ function onTypeChange() {
|
|
|
175
178
|
: (flow.rubric || []).join(", ");
|
|
176
179
|
rubric.dataset.flowId = flow.id;
|
|
177
180
|
}
|
|
178
|
-
// 连载参数预填(用户可改/可清空 =
|
|
181
|
+
// 连载参数预填(用户可改/可清空 = 单稿件模式);偏好记忆的最近值优先
|
|
179
182
|
if (flow.serial) {
|
|
180
|
-
if (!$("f-chapters").value) $("f-chapters").value = flow.serial.chapters || "";
|
|
181
|
-
if (!$("f-words-per-ch").value) $("f-words-per-ch").value = flow.serial.words_per_chapter || "";
|
|
183
|
+
if (!$("f-chapters").value) $("f-chapters").value = lp.chapters || flow.serial.chapters || "";
|
|
184
|
+
if (!$("f-words-per-ch").value) $("f-words-per-ch").value = lp.words_per_chapter || flow.serial.words_per_chapter || "";
|
|
182
185
|
} else clearSerialFields();
|
|
183
186
|
} else {
|
|
184
187
|
// 隐藏控件仍保留 DOM 值;换流程时清理,避免章节/圣经状态污染下一次提交。
|
|
@@ -301,6 +304,124 @@ let _requestBusyCount = 0;
|
|
|
301
304
|
let _lastActionButton = null;
|
|
302
305
|
let _lastActionAt = 0;
|
|
303
306
|
const _requestBusyButtons = new WeakMap();
|
|
307
|
+
const _operations = [];
|
|
308
|
+
let _operationSeq = 0;
|
|
309
|
+
|
|
310
|
+
function operationLabel(path, opts) {
|
|
311
|
+
if (opts && opts.operation === false) return "";
|
|
312
|
+
if (opts && typeof opts.operation === "string") return t(opts.operation);
|
|
313
|
+
if (opts && opts.busy === false && opts.operation !== true) return "";
|
|
314
|
+
const method = String((opts && opts.method) || "GET").toUpperCase();
|
|
315
|
+
if (method === "GET" || method === "HEAD") return "";
|
|
316
|
+
// 只自动记录刚由用户点击触发的写操作;后台维护请求需显式传 operation 才显示。
|
|
317
|
+
if (!(opts && opts.operation === true) && performance.now() - _lastActionAt >= 2000) return "";
|
|
318
|
+
const clean = String(path || "").split("?")[0];
|
|
319
|
+
const rules = [
|
|
320
|
+
[/^\/api\/tasks$/, "创建任务"],
|
|
321
|
+
[/\/tasks\/[^/]+\/delete$/, "删除任务"],
|
|
322
|
+
[/\/tasks\/[^/]+\/archive$/, "归档任务"],
|
|
323
|
+
[/\/tasks\/[^/]+\/retry$/, "重试任务"],
|
|
324
|
+
[/\/tasks\/[^/]+\/continue$/, "创建续写任务"],
|
|
325
|
+
[/\/tasks\/[^/]+\/rename$/, "重命名任务"],
|
|
326
|
+
[/\/runs\/[^/]+\/cancel$/, "取消运行"],
|
|
327
|
+
[/\/runs\/[^/]+\/delete$/, "删除运行"],
|
|
328
|
+
[/\/runs\/(delete-batch|clear)$/, "清理运行记录"],
|
|
329
|
+
[/\/attachments(?:\/[^/]+)?$/, "上传附件"],
|
|
330
|
+
[/\/selfupdate\/apply$/, "升级 CodeBee"],
|
|
331
|
+
[/\/market\//, "更新插件"],
|
|
332
|
+
[/\/models\/binding$/, "更新智能体绑定"],
|
|
333
|
+
[/\/models\//, "更新模型配置"],
|
|
334
|
+
];
|
|
335
|
+
const hit = rules.find((it) => it[0].test(clean));
|
|
336
|
+
return t(hit ? hit[1] : "提交操作");
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function operationStart(path, opts) {
|
|
340
|
+
const label = operationLabel(path, opts);
|
|
341
|
+
if (!label) return null;
|
|
342
|
+
const op = { id: ++_operationSeq, label, status: "running", at: Date.now(), error: "" };
|
|
343
|
+
_operations.unshift(op);
|
|
344
|
+
if (_operations.length > 12) _operations.length = 12;
|
|
345
|
+
renderOperationCenter();
|
|
346
|
+
return op.id;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function operationFinish(id, status, error) {
|
|
350
|
+
if (!id) return;
|
|
351
|
+
const op = _operations.find((it) => it.id === id);
|
|
352
|
+
if (!op) return;
|
|
353
|
+
op.status = status;
|
|
354
|
+
op.error = String(error || "").slice(0, 240);
|
|
355
|
+
op.endedAt = Date.now();
|
|
356
|
+
renderOperationCenter();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function operationTime(ts) {
|
|
360
|
+
try { return new Date(ts).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); }
|
|
361
|
+
catch (e) { return ""; }
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function renderOperationCenter() {
|
|
365
|
+
const button = $("btn-ops");
|
|
366
|
+
const list = $("op-list");
|
|
367
|
+
if (!button || !list) return;
|
|
368
|
+
button.classList.toggle("hidden", !_operations.length);
|
|
369
|
+
const running = _operations.filter((it) => it.status === "running").length;
|
|
370
|
+
const failed = _operations.filter((it) => it.status === "failed").length;
|
|
371
|
+
button.classList.toggle("running", running > 0);
|
|
372
|
+
button.classList.toggle("failed", !running && failed > 0);
|
|
373
|
+
button.classList.toggle("done", !running && !failed && _operations.length > 0);
|
|
374
|
+
const pill = $("op-pill-text");
|
|
375
|
+
if (pill) pill.textContent = running ? t("{0} 项处理中").replace("{0}", running)
|
|
376
|
+
: failed ? t("{0} 项失败").replace("{0}", failed) : t("操作完成");
|
|
377
|
+
list.innerHTML = _operations.map((op) => {
|
|
378
|
+
const status = op.status === "running" ? t("处理中")
|
|
379
|
+
: op.status === "failed" ? t("失败") : t("已完成");
|
|
380
|
+
const remove = op.status === "running" ? "" :
|
|
381
|
+
'<button type="button" class="op-dismiss" aria-label="' + esc(t("移除")) +
|
|
382
|
+
'" title="' + esc(t("移除")) + '" onclick="dismissOperation(event,' + op.id + ')">' +
|
|
383
|
+
'<svg class="ico" aria-hidden="true"><use href="#i-x"></use></svg></button>';
|
|
384
|
+
return '<div class="op-row ' + op.status + '"><span class="op-state" aria-hidden="true"></span>' +
|
|
385
|
+
'<div class="op-copy"><div><b>' + esc(op.label) + '</b><span>' + esc(status) + " · " +
|
|
386
|
+
esc(operationTime(op.endedAt || op.at)) + '</span></div>' +
|
|
387
|
+
(op.error ? '<p title="' + esc(op.error) + '">' + esc(op.error) + "</p>" : "") +
|
|
388
|
+
"</div>" + remove + "</div>";
|
|
389
|
+
}).join("");
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function toggleOperationCenter(force) {
|
|
393
|
+
const panel = $("op-center");
|
|
394
|
+
const button = $("btn-ops");
|
|
395
|
+
if (!panel || !button) return;
|
|
396
|
+
const open = force === undefined ? panel.classList.contains("hidden") : !!force;
|
|
397
|
+
panel.classList.toggle("hidden", !open);
|
|
398
|
+
button.setAttribute("aria-expanded", open ? "true" : "false");
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function clearFinishedOperations() {
|
|
402
|
+
for (let i = _operations.length - 1; i >= 0; i--) {
|
|
403
|
+
if (_operations[i].status === "done") _operations.splice(i, 1);
|
|
404
|
+
}
|
|
405
|
+
renderOperationCenter();
|
|
406
|
+
if (!_operations.length) toggleOperationCenter(false);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function dismissOperation(event, id) {
|
|
410
|
+
if (event) event.stopPropagation();
|
|
411
|
+
const i = _operations.findIndex((it) => it.id === id && it.status !== "running");
|
|
412
|
+
if (i >= 0) _operations.splice(i, 1);
|
|
413
|
+
renderOperationCenter();
|
|
414
|
+
if (!_operations.length) toggleOperationCenter(false);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
window.toggleOperationCenter = toggleOperationCenter;
|
|
418
|
+
window.clearFinishedOperations = clearFinishedOperations;
|
|
419
|
+
window.dismissOperation = dismissOperation;
|
|
420
|
+
|
|
421
|
+
document.addEventListener("click", (e) => {
|
|
422
|
+
const wrap = $("op-wrap");
|
|
423
|
+
if (wrap && !wrap.contains(e.target)) toggleOperationCenter(false);
|
|
424
|
+
});
|
|
304
425
|
|
|
305
426
|
/* 记录发起请求的按钮。写请求统一在 api() 里挂忙碌态,避免每个业务入口各写一套;
|
|
306
427
|
* 确认框的按钮不覆盖原始操作按钮,但会续期,使“确认后执行”仍反馈在原按钮上。 */
|
|
@@ -394,10 +515,12 @@ async function api(path, opts) {
|
|
|
394
515
|
var timer = setTimeout(() => ctrl.abort(), opts.timeout);
|
|
395
516
|
}
|
|
396
517
|
const busyToken = requestBusyStart(opts);
|
|
518
|
+
const operationToken = operationStart(path, opts);
|
|
397
519
|
const fetchOpts = Object.assign({}, opts);
|
|
398
520
|
delete fetchOpts.timeout;
|
|
399
521
|
delete fetchOpts.busy;
|
|
400
522
|
delete fetchOpts.busyElement;
|
|
523
|
+
delete fetchOpts.operation;
|
|
401
524
|
try {
|
|
402
525
|
let res;
|
|
403
526
|
try {
|
|
@@ -412,7 +535,11 @@ async function api(path, opts) {
|
|
|
412
535
|
try { data = await res.json(); } catch (e) { /* ignore */ }
|
|
413
536
|
if (res.status === 423 && data && data.control) setControl(data.control);
|
|
414
537
|
if (!res.ok) throw new Error((data && data.error) || ("HTTP " + res.status));
|
|
538
|
+
operationFinish(operationToken, "done");
|
|
415
539
|
return data;
|
|
540
|
+
} catch (e) {
|
|
541
|
+
operationFinish(operationToken, "failed", e && e.message ? e.message : e);
|
|
542
|
+
throw e;
|
|
416
543
|
} finally {
|
|
417
544
|
if (timer) clearTimeout(timer);
|
|
418
545
|
requestBusyEnd(busyToken);
|
|
@@ -2027,7 +2154,7 @@ async function createTask() {
|
|
|
2027
2154
|
try {
|
|
2028
2155
|
const cq = await api("/api/tasks/clarify", {
|
|
2029
2156
|
// 澄清只是增强,不能让建任务被模型调用拖住;超时后直接按原目标开跑。
|
|
2030
|
-
method: "POST", timeout: 8000,
|
|
2157
|
+
method: "POST", timeout: 8000, operation: false,
|
|
2031
2158
|
body: JSON.stringify({ goal: payload.goal, type: payload.type }) });
|
|
2032
2159
|
const qs = (cq && cq.questions) || [];
|
|
2033
2160
|
if (qs.length) {
|
|
@@ -2089,7 +2216,7 @@ async function createTask() {
|
|
|
2089
2216
|
if (critics.length) payload.critics = critics;
|
|
2090
2217
|
}
|
|
2091
2218
|
try {
|
|
2092
|
-
const r = await api("/api/tasks", { method: "POST", timeout: 30000,
|
|
2219
|
+
const r = await api("/api/tasks", { method: "POST", timeout: 30000, operation: "创建任务",
|
|
2093
2220
|
body: JSON.stringify(payload) });
|
|
2094
2221
|
msg.textContent = t("已创建,跳转运行页…");
|
|
2095
2222
|
// 先把新任务刷进 state 再跳:chatEngineIsDirect 靠 S.state.tasks 判引擎,
|
|
@@ -2383,7 +2510,8 @@ async function deleteTask(id) {
|
|
|
2383
2510
|
let gone = false;
|
|
2384
2511
|
try {
|
|
2385
2512
|
toast(t("正在删除任务…"));
|
|
2386
|
-
await api("/api/tasks/" + encodeURIComponent(id) + "/delete",
|
|
2513
|
+
await api("/api/tasks/" + encodeURIComponent(id) + "/delete",
|
|
2514
|
+
{ method: "POST", operation: "删除任务" });
|
|
2387
2515
|
} catch (e) {
|
|
2388
2516
|
// 任务已不在(他端删过 / 重复点):不报错晾着,照常把视图清掉
|
|
2389
2517
|
if (!/任务不存在/.test(e.message)) { toast(t("删除失败:") + e.message, true); return; }
|
package/app/ui/i18n.js
CHANGED
|
@@ -1276,6 +1276,29 @@
|
|
|
1276
1276
|
"正在下载安装,插件包较大时需要约一分钟…": "Downloading and installing — large plugin packages can take about a minute…",
|
|
1277
1277
|
"请求超时,请重试或检查网络": "Request timed out — try again or check your network",
|
|
1278
1278
|
"操作处理中": "Working on it",
|
|
1279
|
+
"操作状态": "Operations",
|
|
1280
|
+
"清除已完成": "Clear completed",
|
|
1281
|
+
"创建任务": "Create task",
|
|
1282
|
+
"删除任务": "Delete task",
|
|
1283
|
+
"归档任务": "Archive task",
|
|
1284
|
+
"重试任务": "Retry task",
|
|
1285
|
+
"创建续写任务": "Create continuation",
|
|
1286
|
+
"重命名任务": "Rename task",
|
|
1287
|
+
"取消运行": "Cancel run",
|
|
1288
|
+
"删除运行": "Delete run",
|
|
1289
|
+
"清理运行记录": "Clear run history",
|
|
1290
|
+
"上传附件": "Upload attachment",
|
|
1291
|
+
"升级 CodeBee": "Upgrade CodeBee",
|
|
1292
|
+
"更新插件": "Update plugin",
|
|
1293
|
+
"更新模型配置": "Update model settings",
|
|
1294
|
+
"更新智能体绑定": "Update agent binding",
|
|
1295
|
+
"提交操作": "Submit operation",
|
|
1296
|
+
"{0} 项处理中": "{0} in progress",
|
|
1297
|
+
"{0} 项失败": "{0} failed",
|
|
1298
|
+
"操作完成": "Operation complete",
|
|
1299
|
+
"处理中": "In progress",
|
|
1300
|
+
"失败": "Failed",
|
|
1301
|
+
"已完成": "Completed",
|
|
1279
1302
|
"该插件含脚本/钩子/MCP 组件,仅支持纯技能类插件": "Contains scripts/hooks/MCP components — only pure skill plugins are supported",
|
|
1280
1303
|
" 个供应商(google 等协议)仅登记,不支持注入 CLI,未出现在上面的下拉中。": " provider(s) (google etc.) are registry-only, can't inject into CLIs, and are hidden from the dropdown above.",
|
|
1281
1304
|
" 个降级备选)。": " fallback(s)).",
|
package/app/ui/index.html
CHANGED
|
@@ -214,6 +214,15 @@
|
|
|
214
214
|
<div id="health-banner" class="health-banner hidden" onclick="healthBannerClick()" title="供应商健康告警" aria-label="供应商健康告警" data-i18n-title="供应商健康告警" data-i18n-aria="供应商健康告警"></div>
|
|
215
215
|
<div class="top-actions">
|
|
216
216
|
<button id="ctrl-pill" class="pill ctrl icon-only hidden" onclick="ctrlClick()" title="多端控制权" aria-label="多端控制权" data-i18n-aria="多端控制权" data-i18n-title="多端控制权"><svg class="ico" aria-hidden="true"><use href="#i-unlock"></use></svg></button>
|
|
217
|
+
<div id="op-wrap" class="op-wrap">
|
|
218
|
+
<button id="btn-ops" class="pill op-pill hidden" type="button" onclick="toggleOperationCenter()" title="操作状态" aria-label="操作状态" aria-haspopup="dialog" aria-expanded="false" aria-controls="op-center" data-i18n-title="操作状态" data-i18n-aria="操作状态">
|
|
219
|
+
<svg class="ico" aria-hidden="true"><use href="#i-history"></use></svg><span id="op-pill-text"></span>
|
|
220
|
+
</button>
|
|
221
|
+
<div id="op-center" class="op-center hidden" role="dialog" aria-label="操作状态" data-i18n-aria="操作状态">
|
|
222
|
+
<div class="op-center-head"><b data-i18n="操作状态">操作状态</b><button type="button" class="ghost small" onclick="clearFinishedOperations()" data-i18n="清除已完成">清除已完成</button></div>
|
|
223
|
+
<div id="op-list" class="op-list" aria-live="polite"></div>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
217
226
|
<!-- 语言快捷切换:语言名用母语写死(中文/English),刻意不做 i18n——任何母语的人都要能读懂并选中 -->
|
|
218
227
|
<div class="lang-wrap">
|
|
219
228
|
<button id="btn-lang" class="pill icon-only" type="button" onclick="toggleLangMenu()" title="语言 / Language" aria-label="切换语言" aria-haspopup="listbox" aria-controls="lang-menu" data-i18n-title="语言 / Language" data-i18n-aria="切换语言"><svg class="ico" aria-hidden="true"><use href="#i-globe"></use></svg></button>
|
package/app/ui/style.css
CHANGED
|
@@ -5456,3 +5456,55 @@ button.request-busy > * { opacity: .18; }
|
|
|
5456
5456
|
.rd-route-row { grid-template-columns: 38px minmax(72px, 1fr); }
|
|
5457
5457
|
.rd-route-reason { grid-column: 2; }
|
|
5458
5458
|
}
|
|
5459
|
+
|
|
5460
|
+
/* ---------------- 统一操作状态中心(所有用户触发的写请求) ---------------- */
|
|
5461
|
+
.op-wrap { position: relative; }
|
|
5462
|
+
.op-pill { min-width: 118px; justify-content: center; }
|
|
5463
|
+
.op-pill.running { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
|
|
5464
|
+
.op-pill.failed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); }
|
|
5465
|
+
.op-pill.done { color: var(--ok); }
|
|
5466
|
+
.op-pill.running .ico { animation: op-center-spin 1.1s linear infinite; }
|
|
5467
|
+
@keyframes op-center-spin { to { transform: rotate(-360deg); } }
|
|
5468
|
+
.op-center {
|
|
5469
|
+
position: absolute; z-index: 140; top: calc(100% + 9px); right: 0;
|
|
5470
|
+
width: min(370px, calc(100vw - 24px)); max-height: min(480px, calc(100vh - 88px));
|
|
5471
|
+
overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px;
|
|
5472
|
+
background: var(--panel); box-shadow: var(--shadow-lg);
|
|
5473
|
+
}
|
|
5474
|
+
.op-center.hidden { display: none; }
|
|
5475
|
+
.op-center-head {
|
|
5476
|
+
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
|
5477
|
+
min-height: 48px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border);
|
|
5478
|
+
}
|
|
5479
|
+
.op-center-head b { font-size: 13px; }
|
|
5480
|
+
.op-list { max-height: min(430px, calc(100vh - 140px)); overflow: auto; }
|
|
5481
|
+
.op-row {
|
|
5482
|
+
display: grid; grid-template-columns: 10px minmax(0, 1fr) 28px; gap: 9px;
|
|
5483
|
+
align-items: start; min-height: 52px; padding: 10px 9px 10px 14px;
|
|
5484
|
+
border-bottom: 1px solid var(--border);
|
|
5485
|
+
}
|
|
5486
|
+
.op-row:last-child { border-bottom: 0; }
|
|
5487
|
+
.op-state { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--ok); }
|
|
5488
|
+
.op-row.running .op-state { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
|
|
5489
|
+
.op-row.failed .op-state { background: var(--bad); }
|
|
5490
|
+
.op-copy { min-width: 0; }
|
|
5491
|
+
.op-copy > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
|
|
5492
|
+
.op-copy b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
|
|
5493
|
+
.op-copy span { flex: none; color: var(--muted); font-size: 10.5px; }
|
|
5494
|
+
.op-copy p {
|
|
5495
|
+
margin: 4px 0 0; color: var(--bad); font-size: 11px; line-height: 1.4;
|
|
5496
|
+
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
|
|
5497
|
+
}
|
|
5498
|
+
.op-dismiss {
|
|
5499
|
+
width: 26px; height: 26px; padding: 5px; border: 0; border-radius: 6px;
|
|
5500
|
+
color: var(--muted); background: transparent; cursor: pointer;
|
|
5501
|
+
}
|
|
5502
|
+
.op-dismiss:hover { color: var(--text); background: var(--panel2); }
|
|
5503
|
+
@media (max-width: 720px) {
|
|
5504
|
+
.op-pill { min-width: 34px; width: 34px; height: 32px; padding: 5px; }
|
|
5505
|
+
.op-pill #op-pill-text { display: none; }
|
|
5506
|
+
.op-center { position: fixed; top: 58px; right: 8px; width: calc(100vw - 16px); }
|
|
5507
|
+
}
|
|
5508
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5509
|
+
.op-pill.running .ico, .op-row.running .op-state { animation: none; }
|
|
5510
|
+
}
|
package/package.json
CHANGED