codebee 0.1.64 → 0.1.66

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +520 -507
  2. package/LICENSE +21 -21
  3. package/README.md +494 -487
  4. package/app/core/aiflavor.py +197 -197
  5. package/app/core/artifacts.py +148 -148
  6. package/app/core/attachments.py +532 -532
  7. package/app/core/automation.py +758 -758
  8. package/app/core/backup.py +470 -470
  9. package/app/core/beekeeper.py +183 -183
  10. package/app/core/board.py +209 -209
  11. package/app/core/bookmeta.py +272 -217
  12. package/app/core/bookmeta_catalog.py +180 -180
  13. package/app/core/branching.py +137 -137
  14. package/app/core/builtin_agent.py +1234 -1191
  15. package/app/core/capability.py +144 -144
  16. package/app/core/catalog.py +23 -24
  17. package/app/core/chaptersafe.py +32 -32
  18. package/app/core/cleanup.py +303 -303
  19. package/app/core/compaction.py +201 -186
  20. package/app/core/covergen.py +356 -356
  21. package/app/core/diagnostics.py +114 -114
  22. package/app/core/dispatch.py +173 -173
  23. package/app/core/dispatch_log.py +113 -113
  24. package/app/core/env_scrub.py +85 -85
  25. package/app/core/error_codes.py +220 -65
  26. package/app/core/errorlog.py +137 -137
  27. package/app/core/evaluation.py +174 -0
  28. package/app/core/failure_notify.py +290 -0
  29. package/app/core/flows.py +355 -355
  30. package/app/core/goal_service.py +167 -167
  31. package/app/core/health.py +374 -342
  32. package/app/core/history.py +38 -38
  33. package/app/core/hooks.py +162 -156
  34. package/app/core/jobs.py +1034 -1022
  35. package/app/core/knowledge.py +6 -2
  36. package/app/core/manager.py +2115 -1996
  37. package/app/core/market.py +362 -362
  38. package/app/core/market_remote.py +66 -66
  39. package/app/core/mocks.py +64 -64
  40. package/app/core/modelhub.py +3517 -3332
  41. package/app/core/notify.py +106 -106
  42. package/app/core/paihang.py +109 -109
  43. package/app/core/paths.py +2 -2
  44. package/app/core/pipeline.py +4614 -4483
  45. package/app/core/planner.py +33 -31
  46. package/app/core/portguard.py +111 -111
  47. package/app/core/preview.py +293 -293
  48. package/app/core/publish/__init__.py +7 -7
  49. package/app/core/publish/auto.py +367 -367
  50. package/app/core/publish/browser.py +533 -533
  51. package/app/core/publish/fanqie.py +128 -128
  52. package/app/core/publish/flow.py +432 -406
  53. package/app/core/publish/flows-fanqie-calibrated.json +17 -9
  54. package/app/core/publish/flows-qimao-calibrated.json +6 -2
  55. package/app/core/publish/ledger.py +198 -198
  56. package/app/core/publish/manager.py +623 -590
  57. package/app/core/publish/qimao.py +141 -141
  58. package/app/core/publish/ws.py +139 -139
  59. package/app/core/redact.py +38 -38
  60. package/app/core/repeat_guard.py +129 -124
  61. package/app/core/router.py +96 -22
  62. package/app/core/runner.py +2050 -2019
  63. package/app/core/selfupdate.py +384 -384
  64. package/app/core/session_log.py +161 -161
  65. package/app/core/sessions.py +312 -312
  66. package/app/core/settings.py +149 -149
  67. package/app/core/settings_schema.py +262 -262
  68. package/app/core/share_page.py +114 -114
  69. package/app/core/skill_scan.py +114 -106
  70. package/app/core/skillpacks/fanqie-novel.md +80 -80
  71. package/app/core/skillpacks/market/character-bible.md +66 -66
  72. package/app/core/skillpacks/market/code-risk-checklist.md +58 -58
  73. package/app/core/skillpacks/market/git-workflow.md +57 -57
  74. package/app/core/skillpacks/market/release-notes.md +72 -72
  75. package/app/core/skillpacks/market/weekly-report.md +71 -71
  76. package/app/core/skillpacks/market/worldview-consistency.md +70 -70
  77. package/app/core/skills.py +221 -72
  78. package/app/core/step_runner.py +132 -132
  79. package/app/core/store.py +23 -0
  80. package/app/core/task_compile.py +199 -199
  81. package/app/core/telemetry.py +292 -292
  82. package/app/core/tlsctx.py +64 -64
  83. package/app/core/token_meter.py +147 -147
  84. package/app/core/upstream.py +41 -0
  85. package/app/core/usage.py +114 -3
  86. package/app/core/volumes.py +355 -355
  87. package/app/core/wxdigest.py +858 -858
  88. package/app/core/zentao.py +2447 -2447
  89. package/app/main.py +2838 -2832
  90. package/app/pick_dialog.py +110 -110
  91. package/app/ui/app.js +13994 -13977
  92. package/app/ui/board.css +20 -41
  93. package/app/ui/board.html +162 -162
  94. package/app/ui/board.js +305 -305
  95. package/app/ui/i18n.js +2716 -2711
  96. package/app/ui/icons/bee.svg +79 -79
  97. package/app/ui/index.html +1 -1
  98. package/app/ui/manifest.json +16 -16
  99. package/app/ui/qrcode.js +2297 -2297
  100. package/app/ui/style.css +6107 -6125
  101. package/bin/tutti.js +147 -147
  102. package/package.json +46 -41
  103. package/tools/wx_reader.py +261 -261
  104. package/app/.playwright-cli/console-2026-09-23T08-26-03-635Z.log +0 -88
  105. package/app/.playwright-cli/page-2026-09-23T08-26-03-845Z.yml +0 -126
  106. package/app/.playwright-cli/page-2026-09-23T08-29-44-203Z.png +0 -0
  107. package/app/.playwright-cli/page-2026-09-23T08-35-42-046Z.yml +0 -210
  108. package/app/.playwright-cli/page-2026-09-23T08-36-52-858Z.png +0 -0
  109. package/app/.playwright-cli/page-2026-09-23T08-37-33-938Z.png +0 -0
  110. package/app/.playwright-cli/run-detail-after.png +0 -0
@@ -1,148 +1,148 @@
1
- """工作目录成品扫描:剪枝遍历 + 短 TTL 缓存 + 在飞合并。
2
-
3
- 历史实现用 Path.rglob("*") 全量展开再逐文件 is_file()/stat() 过滤,几万文件的
4
- 工作目录单次要 1.6~4 秒;而详情页/侧栏在任务运行中是轮询调用——每次轮询都是
5
- 一次全仓扫描,UI 整体被拖卡(2026-09-24 详情页卡顿案)。这里改为 os.walk
6
- 剪枝(跳过类目录整个不进入),并给重复轮询加 (workdir, t0, 任务状态) 键的短 TTL 缓存
7
- 与在飞合并:并发同键只扫一次,后到者等结果。
8
- """
9
- from __future__ import annotations
10
-
11
- import os
12
- import threading
13
- import time
14
-
15
- # 过滤语义与历史 rglob 版逐条对齐:
16
- # - SKIP_DIRS:任意路径段(含文件名本身)命中即剔除;
17
- # - BUILD_DIRS:仅祖先目录命中即剔除(文件名叫 dist 不受影响);
18
- # - 点开头:仅祖先目录算「隐藏」(根下的 .gitignore 这类隐藏文件仍是候选)。
19
- SKIP_DIRS = {".git", "node_modules", "__pycache__", ".venv", "venv", ".idea", ".vscode"}
20
-
21
- # 构建产物/依赖缓存目录:里面的文件是工具链再生成的,不是任务成品
22
- BUILD_DIRS = {
23
- "target", "build", "dist", "out", "bin", "obj", # 通用构建输出
24
- "surefire", "failsafe-reports", "test-output", "reports", # 测试/报告输出
25
- ".next", ".nuxt", ".output", ".gradle", ".gradle-home", # 前端/Gradle
26
- "__MACOSX",
27
- }
28
-
29
- # CLI 自身的历史/评审中间件不属于用户成果。它们通常落在工作目录根部,
30
- # 只按隐藏目录过滤会漏掉 Aider 的 .aider.* 与流程生成的 *_review.json。
31
- _PROCESS_ARTIFACT_NAMES = {
32
- ".aider.chat.history.md", ".aider.input.history", ".aider.input.history.md",
33
- ".aider.tags.cache.v4", ".aider.tags.cache.v3", ".aider.conf.yml",
34
- }
35
- _PROCESS_ARTIFACT_SUFFIXES = ("_review.json", ".review.json")
36
- _PROCESS_ARTIFACT_PREFIXES = ("tutti_prompt_", "_tutti_prompt_")
37
-
38
- SCAN_CAP = 800 # 防超大目录拖垮接口;截断后再排序取最新
39
- CACHE_TTL_RUNNING = 2.0 # 任务在跑:轮询热,新鲜期要短
40
- CACHE_TTL_IDLE = 10.0 # 终态任务:详情反复开关/检查器同刷,可稍长
41
- _CACHE_KEEP = 128 # 缓存条目上限(按时间淘汰最旧)
42
-
43
- _now = time.monotonic # 模块级别名,测试可替换时钟
44
-
45
- _LOCK = threading.Lock()
46
- _CACHE = {} # (root, t0, running) -> (时间戳, files);files 恒为全量候选
47
- _INFLIGHT = {} # (root, t0, running) -> Lock;同键并发只跑一次扫描
48
-
49
-
50
- def _is_process_artifact(rel_name):
51
- """判断工作目录文件是否为 CLI/评审过程产物,而非可交付成果。"""
52
- name = str(rel_name or "").replace("\\", "/")
53
- base = name.rsplit("/", 1)[-1].lower()
54
- if base in _PROCESS_ARTIFACT_NAMES:
55
- return True
56
- if base.startswith(".") and base.startswith(".aider"):
57
- return True
58
- if base.endswith(_PROCESS_ARTIFACT_SUFFIXES):
59
- return True
60
- if base.startswith(_PROCESS_ARTIFACT_PREFIXES):
61
- return True
62
- return False
63
-
64
-
65
- def _walk_files(root, t0):
66
- """剪枝遍历:跳过类目录整个不进入;返回 mtime>=t0 的候选(无序)。"""
67
- files = []
68
- for dp, dirnames, filenames in os.walk(root):
69
- dirnames[:] = [d for d in dirnames
70
- if d not in SKIP_DIRS and d not in BUILD_DIRS
71
- and not d.startswith(".")]
72
- done = False
73
- for name in filenames:
74
- if name in SKIP_DIRS: # 历史语义:文件名本身命中也剔除
75
- continue
76
- try:
77
- st = os.stat(os.path.join(dp, name))
78
- except OSError:
79
- continue
80
- if st.st_mtime < t0:
81
- continue
82
- rel_dir = os.path.relpath(dp, root)
83
- rel = name if rel_dir == "." else \
84
- rel_dir.replace("\\", "/") + "/" + name
85
- if _is_process_artifact(rel):
86
- continue
87
- files.append({"name": rel,
88
- "size": st.st_size, "mtime": int(st.st_mtime)})
89
- if len(files) >= SCAN_CAP:
90
- done = True
91
- break
92
- if done:
93
- break
94
- return files
95
-
96
-
97
- def _cache_get(key, ttl):
98
- with _LOCK:
99
- ent = _CACHE.get(key)
100
- if ent and _now() - ent[0] < ttl:
101
- return ent[1]
102
- return None
103
-
104
-
105
- def _cache_put(key, files):
106
- with _LOCK:
107
- _CACHE[key] = (_now(), files)
108
- while len(_CACHE) > _CACHE_KEEP:
109
- _CACHE.pop(min(_CACHE, key=lambda k: _CACHE[k][0]), None)
110
-
111
-
112
- def _inflight_lock(key):
113
- with _LOCK:
114
- lock = _INFLIGHT.get(key)
115
- if lock is None:
116
- lock = _INFLIGHT[key] = threading.Lock()
117
- return lock
118
-
119
-
120
- def scan(root, t0, limit=200, running=False, cache=False):
121
- """扫工作目录成品,按 mtime 新→旧取前 limit 条,返回文件字典列表。
122
-
123
- cache=True 时同键 (root, t0, running) 在 TTL 内直接复用上次结果,运行中
124
- 任务用短 TTL;无论是否缓存,同键在飞扫描都会合并——轮询方只会等一次扫描。
125
- """
126
- # 运行态和终态必须分开缓存:任务刚结束时不能沿用运行中缓存里的旧
127
- # 文件列表,否则终态较长 TTL 会把最后写入的产物遮住。
128
- key = (str(root), t0, bool(running))
129
- ttl = CACHE_TTL_RUNNING if running else CACHE_TTL_IDLE
130
- if cache:
131
- hit = _cache_get(key, ttl)
132
- if hit is not None:
133
- return hit[:limit]
134
- klock = _inflight_lock(key)
135
- try:
136
- with klock:
137
- if cache: # 排到锁时他人可能已扫完入缓存
138
- hit = _cache_get(key, ttl)
139
- if hit is not None:
140
- return hit[:limit]
141
- files = sorted(_walk_files(root, t0), key=lambda f: -f["mtime"])
142
- if cache:
143
- _cache_put(key, files)
144
- finally:
145
- with _LOCK:
146
- if _INFLIGHT.get(key) is klock:
147
- _INFLIGHT.pop(key, None)
148
- return files[:limit]
1
+ """工作目录成品扫描:剪枝遍历 + 短 TTL 缓存 + 在飞合并。
2
+
3
+ 历史实现用 Path.rglob("*") 全量展开再逐文件 is_file()/stat() 过滤,几万文件的
4
+ 工作目录单次要 1.6~4 秒;而详情页/侧栏在任务运行中是轮询调用——每次轮询都是
5
+ 一次全仓扫描,UI 整体被拖卡(2026-09-24 详情页卡顿案)。这里改为 os.walk
6
+ 剪枝(跳过类目录整个不进入),并给重复轮询加 (workdir, t0, 任务状态) 键的短 TTL 缓存
7
+ 与在飞合并:并发同键只扫一次,后到者等结果。
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import threading
13
+ import time
14
+
15
+ # 过滤语义与历史 rglob 版逐条对齐:
16
+ # - SKIP_DIRS:任意路径段(含文件名本身)命中即剔除;
17
+ # - BUILD_DIRS:仅祖先目录命中即剔除(文件名叫 dist 不受影响);
18
+ # - 点开头:仅祖先目录算「隐藏」(根下的 .gitignore 这类隐藏文件仍是候选)。
19
+ SKIP_DIRS = {".git", "node_modules", "__pycache__", ".venv", "venv", ".idea", ".vscode"}
20
+
21
+ # 构建产物/依赖缓存目录:里面的文件是工具链再生成的,不是任务成品
22
+ BUILD_DIRS = {
23
+ "target", "build", "dist", "out", "bin", "obj", # 通用构建输出
24
+ "surefire", "failsafe-reports", "test-output", "reports", # 测试/报告输出
25
+ ".next", ".nuxt", ".output", ".gradle", ".gradle-home", # 前端/Gradle
26
+ "__MACOSX",
27
+ }
28
+
29
+ # CLI 自身的历史/评审中间件不属于用户成果。它们通常落在工作目录根部,
30
+ # 只按隐藏目录过滤会漏掉 Aider 的 .aider.* 与流程生成的 *_review.json。
31
+ _PROCESS_ARTIFACT_NAMES = {
32
+ ".aider.chat.history.md", ".aider.input.history", ".aider.input.history.md",
33
+ ".aider.tags.cache.v4", ".aider.tags.cache.v3", ".aider.conf.yml",
34
+ }
35
+ _PROCESS_ARTIFACT_SUFFIXES = ("_review.json", ".review.json")
36
+ _PROCESS_ARTIFACT_PREFIXES = ("tutti_prompt_", "_tutti_prompt_")
37
+
38
+ SCAN_CAP = 800 # 防超大目录拖垮接口;截断后再排序取最新
39
+ CACHE_TTL_RUNNING = 2.0 # 任务在跑:轮询热,新鲜期要短
40
+ CACHE_TTL_IDLE = 10.0 # 终态任务:详情反复开关/检查器同刷,可稍长
41
+ _CACHE_KEEP = 128 # 缓存条目上限(按时间淘汰最旧)
42
+
43
+ _now = time.monotonic # 模块级别名,测试可替换时钟
44
+
45
+ _LOCK = threading.Lock()
46
+ _CACHE = {} # (root, t0, running) -> (时间戳, files);files 恒为全量候选
47
+ _INFLIGHT = {} # (root, t0, running) -> Lock;同键并发只跑一次扫描
48
+
49
+
50
+ def _is_process_artifact(rel_name):
51
+ """判断工作目录文件是否为 CLI/评审过程产物,而非可交付成果。"""
52
+ name = str(rel_name or "").replace("\\", "/")
53
+ base = name.rsplit("/", 1)[-1].lower()
54
+ if base in _PROCESS_ARTIFACT_NAMES:
55
+ return True
56
+ if base.startswith(".") and base.startswith(".aider"):
57
+ return True
58
+ if base.endswith(_PROCESS_ARTIFACT_SUFFIXES):
59
+ return True
60
+ if base.startswith(_PROCESS_ARTIFACT_PREFIXES):
61
+ return True
62
+ return False
63
+
64
+
65
+ def _walk_files(root, t0):
66
+ """剪枝遍历:跳过类目录整个不进入;返回 mtime>=t0 的候选(无序)。"""
67
+ files = []
68
+ for dp, dirnames, filenames in os.walk(root):
69
+ dirnames[:] = [d for d in dirnames
70
+ if d not in SKIP_DIRS and d not in BUILD_DIRS
71
+ and not d.startswith(".")]
72
+ done = False
73
+ for name in filenames:
74
+ if name in SKIP_DIRS: # 历史语义:文件名本身命中也剔除
75
+ continue
76
+ try:
77
+ st = os.stat(os.path.join(dp, name))
78
+ except OSError:
79
+ continue
80
+ if st.st_mtime < t0:
81
+ continue
82
+ rel_dir = os.path.relpath(dp, root)
83
+ rel = name if rel_dir == "." else \
84
+ rel_dir.replace("\\", "/") + "/" + name
85
+ if _is_process_artifact(rel):
86
+ continue
87
+ files.append({"name": rel,
88
+ "size": st.st_size, "mtime": int(st.st_mtime)})
89
+ if len(files) >= SCAN_CAP:
90
+ done = True
91
+ break
92
+ if done:
93
+ break
94
+ return files
95
+
96
+
97
+ def _cache_get(key, ttl):
98
+ with _LOCK:
99
+ ent = _CACHE.get(key)
100
+ if ent and _now() - ent[0] < ttl:
101
+ return ent[1]
102
+ return None
103
+
104
+
105
+ def _cache_put(key, files):
106
+ with _LOCK:
107
+ _CACHE[key] = (_now(), files)
108
+ while len(_CACHE) > _CACHE_KEEP:
109
+ _CACHE.pop(min(_CACHE, key=lambda k: _CACHE[k][0]), None)
110
+
111
+
112
+ def _inflight_lock(key):
113
+ with _LOCK:
114
+ lock = _INFLIGHT.get(key)
115
+ if lock is None:
116
+ lock = _INFLIGHT[key] = threading.Lock()
117
+ return lock
118
+
119
+
120
+ def scan(root, t0, limit=200, running=False, cache=False):
121
+ """扫工作目录成品,按 mtime 新→旧取前 limit 条,返回文件字典列表。
122
+
123
+ cache=True 时同键 (root, t0, running) 在 TTL 内直接复用上次结果,运行中
124
+ 任务用短 TTL;无论是否缓存,同键在飞扫描都会合并——轮询方只会等一次扫描。
125
+ """
126
+ # 运行态和终态必须分开缓存:任务刚结束时不能沿用运行中缓存里的旧
127
+ # 文件列表,否则终态较长 TTL 会把最后写入的产物遮住。
128
+ key = (str(root), t0, bool(running))
129
+ ttl = CACHE_TTL_RUNNING if running else CACHE_TTL_IDLE
130
+ if cache:
131
+ hit = _cache_get(key, ttl)
132
+ if hit is not None:
133
+ return hit[:limit]
134
+ klock = _inflight_lock(key)
135
+ try:
136
+ with klock:
137
+ if cache: # 排到锁时他人可能已扫完入缓存
138
+ hit = _cache_get(key, ttl)
139
+ if hit is not None:
140
+ return hit[:limit]
141
+ files = sorted(_walk_files(root, t0), key=lambda f: -f["mtime"])
142
+ if cache:
143
+ _cache_put(key, files)
144
+ finally:
145
+ with _LOCK:
146
+ if _INFLIGHT.get(key) is klock:
147
+ _INFLIGHT.pop(key, None)
148
+ return files[:limit]