@oh-story/dsh 0.1.14 → 0.1.15
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/README.md +4 -4
- package/lib/oh-story/manifest.json +72 -72
- package/lib/oh-story/skills/story/SKILL.md +1 -1
- package/lib/oh-story/skills/story/VERSION +1 -1
- package/lib/oh-story/skills/story/references/author-memory-maintenance.md +2 -2
- package/lib/oh-story/skills/story/references/author-memory.md +4 -4
- package/lib/oh-story/skills/story/scripts/author_memory_commit.py +61 -58
- package/lib/oh-story/skills/story-deslop/SKILL.md +1 -1
- package/lib/oh-story/skills/story-deslop/references/agent-calls.md +1 -1
- package/lib/oh-story/skills/story-deslop/references/author-memory-maintenance.md +2 -2
- package/lib/oh-story/skills/story-deslop/references/author-memory.md +4 -4
- package/lib/oh-story/skills/story-deslop/scripts/author_memory_commit.py +61 -58
- package/lib/oh-story/skills/story-long-scan/SKILL.md +2 -7
- package/lib/oh-story/skills/story-long-scan/references/platform-qidian.md +11 -1
- package/lib/oh-story/skills/story-long-scan/references/platform-qimao.md +12 -2
- package/lib/oh-story/skills/story-long-write/SKILL.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/agent-calls.md +2 -2
- package/lib/oh-story/skills/story-long-write/references/author-memory-maintenance.md +2 -2
- package/lib/oh-story/skills/story-long-write/references/author-memory.md +4 -4
- package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +1 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +2 -1
- package/lib/oh-story/skills/story-long-write/references/writer-prompt-fallback.md +1 -1
- package/lib/oh-story/skills/story-long-write/scripts/author_memory_commit.py +61 -58
- package/lib/oh-story/skills/story-long-write/scripts/build_writer_prompt.py +87 -20
- package/lib/oh-story/skills/story-review/SKILL.md +1 -1
- package/lib/oh-story/skills/story-review/references/author-memory-maintenance.md +2 -2
- package/lib/oh-story/skills/story-review/references/author-memory.md +4 -4
- package/lib/oh-story/skills/story-review/scripts/author_memory_commit.py +61 -58
- package/lib/oh-story/skills/story-short-write/SKILL.md +1 -1
- package/lib/oh-story/skills/story-short-write/references/agent-calls.md +2 -2
- package/lib/oh-story/skills/story-short-write/references/author-memory-maintenance.md +2 -2
- package/lib/oh-story/skills/story-short-write/references/author-memory.md +4 -4
- package/lib/oh-story/skills/story-short-write/scripts/author_memory_commit.py +61 -58
- package/package.json +1 -1
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
## 写正文
|
|
6
6
|
|
|
7
|
-
spawn `Agent(subagent_type: "narrative-writer", prompt: ...)`,只传项目目录、输出文件、目标情绪、题材风格包、小节大纲、角色、主/副对标召回摘要、本书文风全文路径与 style_resolution、作者偏好 query
|
|
7
|
+
spawn `Agent(subagent_type: "narrative-writer", prompt: ...)`,只传项目目录、输出文件、目标情绪、题材风格包、小节大纲、角色、主/副对标召回摘要、本书文风全文路径与 style_resolution、作者偏好 query 输出的 lines、格式硬约束和写作硬约束,并传入检查分工:本批只做内容覆盖与格式自检,完整语义去味由 Phase 4 负责,最终文件扫描由主会话负责。
|
|
8
8
|
|
|
9
9
|
不把本 skill 整段规则塞进 prompt;细节以 `short-format.md`、题材包、`short-craft.md` 与 `scene-craft.md` 为准。收回后按 workflow-draft.md 的格式规范重排再写入 `正文.md`。
|
|
10
10
|
|
|
11
11
|
## 精修去味
|
|
12
12
|
|
|
13
|
-
spawn `Agent(subagent_type: "narrative-writer", prompt: "项目目录:{dir}\n任务描述:去AI味+格式检查\n检查分工:你负责本次语义去味及原定自检;最终文件扫描由主会话执行,不在子代理内重复\n检查范围:{正文文件}\nstyle_resolution:{与写作一致的本次文风裁决,含全文路径}\n作者偏好:{query
|
|
13
|
+
spawn `Agent(subagent_type: "narrative-writer", prompt: "项目目录:{dir}\n任务描述:去AI味+格式检查\n检查分工:你负责本次语义去味及原定自检;最终文件扫描由主会话执行,不在子代理内重复\n检查范围:{正文文件}\nstyle_resolution:{与写作一致的本次文风裁决,含全文路径}\n作者偏好:{query 输出的 lines}\n篇幅:短篇\n卖点保留:第一人称审判句、火葬场预告、心死式章尾留,只删中立作者讲解与空洞升华\nAI味等级:{轻度/中度/重度;未分级按轻度}\n删除优先:每条 AI 味项先判能否删除——删后不丢伏笔/钩子/角色/情节/必要信息的直接删,会丢才润色(删除受比例上限与本次字数范围下沿约束,跌破改降AI重写)\n必须检查:检查是否连续使用头皮发紧/眼皮一跳/心口一沉/胃里翻涌等精致戏剧反应,能写普通动作/普通感觉就写普通动作/普通感觉;已有手机/聊天记录/公告/账单/病历/证据截图等信息,保留为角色看到或处理的场内载体,不改成叙述者解释;任务卡点只在角色本来有要办的事且能加重情绪/证据/关系/反转时使用,不为自然感补流程")`
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
|
|
33
33
|
## 注入预算与容量
|
|
34
34
|
|
|
35
|
-
- **写入不因注入预算失败**:`record` / `commit` 照常成功、给回执;工具按上表四类任务组合估算最坏查询情形(全局条目+各 scope
|
|
35
|
+
- **写入不因注入预算失败**:`record` / `commit` 照常成功、给回执;工具按上表四类任务组合估算最坏查询情形(全局条目+各 scope 维度最重的单一切片,切片按大小写无关归并、轻重按执行者真正读到的行算,与真实查询同一把尺),装不进 2048 字节的组合在返回的 `warnings` 里点名将被略过的条目及其断言首句。2048 字节量的是交给执行者的 `lines`(每条一行「- 断言(编号)」,含换行),不是 JSON 外壳:`items` 里的编号、类型、范围只给主会话和脚本判断用,不进执行者 prompt。
|
|
36
36
|
- 写入落盘后另一级 store 读不出来(书目录不存在、`--book` 与书级记录不符等)也照常给回执,`warnings` 注明本次提醒没算上它。写书级条目时「本书+全局」按实际条目精确计算;写项目级条目时只看得到项目级 store,顺手传 `--book-root` 就把当前这本书也算进提醒。
|
|
37
|
-
- 查询按 **重要度 → 本书例外 → 最近更新** 排序装填(同一范围的条目必在同一 store,「最近」按该 store 的修订号比,不跨 store 比较),先丢的恒是重要度较低的条目——`importance` 决定超编时谁留在 prompt 里。装不下的条目跳过而不中断(一条长的不挡后面的短条),漏下的 ID
|
|
37
|
+
- 查询按 **重要度 → 本书例外 → 最近更新** 排序装填(同一范围的条目必在同一 store,「最近」按该 store 的修订号比,不跨 store 比较),先丢的恒是重要度较低的条目——`importance` 决定超编时谁留在 prompt 里。装不下的条目跳过而不中断(一条长的不挡后面的短条),漏下的 ID 按同一优先级全数报进 `omitted_ids`,断言首句报进 `omitted_summaries`、重要度报进 `omitted_importance`,供主会话用原话告诉作者哪几条没带上;长篇写章由组装脚本把这句话拼好写进核对报告,章末汇报照模板原样说。
|
|
38
38
|
- 注入预算之外还有一道硬上限:`作者画像.md` 超过 12288 字节时写入会直接失败并要求先整理。active 条目攒到几十上百条才会碰到(远在注入预算之后),碰到就走「整理作者记忆」;`forget` 这类减量操作在满编时照常可用。
|
|
39
39
|
|
|
40
40
|
## 整理作者记忆
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
按表达维度取最窄适用要求:低优先级只补缺项,不与高优先级要求并列执行。通用 references 自称“必须/禁用”不改变此顺序;审稿不因作者有意采用的表达本身扣分,真实可读性与因果问题仍照常评价。
|
|
17
17
|
|
|
18
|
-
作者记忆不能把本书事实写进 `.story
|
|
18
|
+
作者记忆不能把本书事实写进 `.story/作者记忆/`,不能降低审稿 rubric,也不能让去 AI 味改动剧情意图。小说事实继续由各书的 `追踪/` 和 `设定/` 管理。
|
|
19
19
|
|
|
20
20
|
## 存放与路由
|
|
21
21
|
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
|
|
29
29
|
## 查询
|
|
30
30
|
|
|
31
|
-
各 skill 入口已写好本任务的 `query` 命令(长篇正文由组装脚本代查);没写命令的长篇设定、大纲等任务查 `story_design` + `workflow` + `interaction`,结果只给主会话、不传正文 agent。四类任务的映射表见维护文件。state 存在才查(两级都不存在时返回空结果、零写入);结果合并项目级与 `--book-root` 所指书级(不传就拿不到本书条目),`--kind`
|
|
31
|
+
各 skill 入口已写好本任务的 `query` 命令(长篇正文由组装脚本代查);没写命令的长篇设定、大纲等任务查 `story_design` + `workflow` + `interaction`,结果只给主会话、不传正文 agent。四类任务的映射表见维护文件。state 存在才查(两级都不存在时返回空结果、零写入);结果合并项目级与 `--book-root` 所指书级(不传就拿不到本书条目),`--kind` 必传;交给执行者的只有 `lines`(每条一行原话+编号,单次查询 ≤2048 字节)。
|
|
32
32
|
|
|
33
|
-
普通创作只做一次本地 `query`,完整画像、证据、候选和 journal 不进 prompt。查询项是低优先级倾向,不是逐条打卡清单:自然吸收,不复述画像、不刻意提高词面命中率,不为命中牺牲连贯、节奏、字数或本书既定笔调。**`omitted_ids`
|
|
33
|
+
普通创作只做一次本地 `query`,完整画像、证据、候选和 journal 不进 prompt。查询项是低优先级倾向,不是逐条打卡清单:自然吸收,不复述画像、不刻意提高词面命中率,不为命中牺牲连贯、节奏、字数或本书既定笔调。**`omitted_ids` 非空=记忆超编**,不是「没有更多了」:照 `omitted_summaries` 转告作者并建议「整理作者记忆」,不得改读完整画像规避预算。待确认项不进 prompt,也不为确认它们中断任务;只在作者主动查看、候选积累到适合回顾的节点,或新偏好与 active 条目冲突时集中呈现。
|
|
34
34
|
|
|
35
35
|
## 记不记、记成什么
|
|
36
36
|
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
回复就两行纯文本,不加代码块或引用格式:第一行用一句人话说记住了什么、管哪本书或哪类场合,如「记住了:《{书名}》的对话一律用「」,以后写这本书都照这个来;想改随时说。」;第二行是机器回执作凭证,如「技术备注:Author Memory Receipt: r1 · BP001」。
|
|
67
67
|
|
|
68
68
|
- 确认、替换、忘掉同理:「好,这条生效了:……」「换成了:……,原来的「……」不再用」「忘掉了:……」。只进待确认时说「这条先记在待确认里,你说"确认"才生效」;有冲突时用原话说明跟哪条旧习惯冲突。
|
|
69
|
-
- `warnings` / `omitted_ids`
|
|
69
|
+
- `warnings` / `omitted_ids` 不原样贴:说「你的习惯攒得有点多,写正文时这几条会带不上:「……」」(`warnings` 是最坏估算,改说「可能带不上」),并建议说「整理作者记忆」。不提字节、prompt、kind、scope;编号只能跟着原话出现。
|
|
70
70
|
|
|
71
71
|
## 运行工具
|
|
72
72
|
|
|
@@ -34,21 +34,22 @@ PENDING_MAX_BYTES = 12288
|
|
|
34
34
|
JOURNAL_MAX_BYTES = 24576
|
|
35
35
|
QUERY_MAX_BYTES = 2048
|
|
36
36
|
ASSERTION_MAX_BYTES = 120 # 新建条目的断言限一句话;解释进 reason(不进 query 载荷)。
|
|
37
|
-
OMITTED_IDS_MAX = 20 # omitted_ids 封顶,omitted 保留真实总数——漏项列表不许把载荷本身挤炸。
|
|
38
37
|
LEGACY_ASSERTION_MAX_BYTES = 768 # 存量条目的读取上限;强化老条目不受新上限约束。
|
|
39
38
|
|
|
40
|
-
# query
|
|
41
|
-
# 是它在 prompt
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
39
|
+
# query 输出里的 lines(每条一行「- 断言(编号)」)是交给执行 agent 的注入
|
|
40
|
+
# 载荷,QUERY_MAX_BYTES 是它在 prompt 里的注意力预算,不该放大;量的是执行者
|
|
41
|
+
# 真正读到的这几行,不是 JSON 外壳(编号、kind、scope 只给主会话和脚本看)。
|
|
42
|
+
# 防「作者以为载入了、实际被静默挤掉」靠三层:①新建条目的断言限
|
|
43
|
+
# ASSERTION_MAX_BYTES,从源头短(强化已有条目不受限,否则存量长断言再也无法
|
|
44
|
+
# 被确认,只会派生重复条目);②写入端按下列任务组合(与
|
|
45
|
+
# references/author-memory-maintenance.md 的映射表同包跟版)估算最坏查询情形——
|
|
46
|
+
# 全局条目+各 scope 维度上最重的单一切片(一次查询只带一个 book/genre/workflow,
|
|
47
|
+
# 不同书的条目不会同现;切片按 casefold 归并,与 same_scope_value 同一口径,
|
|
48
|
+
# 轻重按渲染后的行字节算,与真实载荷同一把尺),装不下时在返回的 warnings 里
|
|
49
|
+
# 点名将被略过的条目、指向「整理作者记忆」,写入本身永不因注入预算失败;
|
|
50
|
+
# ③查询按 重要度→本书例外→最近更新 排序装填,被略过的恒是重要度较低的条目,
|
|
51
|
+
# 漏下的 ID 按同一优先级全数报进 omitted_ids,首句报进 omitted_summaries,
|
|
52
|
+
# 供主会话用原话告诉作者哪几条没带上。
|
|
52
53
|
QUERY_COMBOS: dict[str, tuple[str, ...]] = {
|
|
53
54
|
"正文初稿/续写": ("prose_style", "story_design"),
|
|
54
55
|
"去AI味/改写": ("prose_style",),
|
|
@@ -1086,12 +1087,19 @@ def summarize_assertion(assertion: str, *, limit: int = 14) -> str:
|
|
|
1086
1087
|
|
|
1087
1088
|
|
|
1088
1089
|
def compact_item(item: dict[str, Any]) -> dict[str, Any]:
|
|
1089
|
-
"""query
|
|
1090
|
+
"""query 的 items 只带这四个字段,给主会话和脚本按 kind/scope 判断用;
|
|
1091
|
+
reason、evidence 等一律不出 store。"""
|
|
1090
1092
|
return {"id": item["id"], "kind": item["kind"], "scope": item["scope"], "assertion": item["assertion"]}
|
|
1091
1093
|
|
|
1092
1094
|
|
|
1093
|
-
def
|
|
1094
|
-
|
|
1095
|
+
def render_line(item: dict[str, Any]) -> str:
|
|
1096
|
+
"""执行者读到的一行:断言原文+编号。注入预算量的就是这几行。"""
|
|
1097
|
+
return f"- {item['assertion']}({item['id']})"
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
def line_bytes(item: dict[str, Any]) -> int:
|
|
1101
|
+
"""一行在注入载荷里的占位,含行尾换行——估算与真实装填只用这一把尺。"""
|
|
1102
|
+
return len((render_line(item) + "\n").encode("utf-8"))
|
|
1095
1103
|
|
|
1096
1104
|
|
|
1097
1105
|
SCOPE_RANK = {"book": 0, "genre": 1, "workflow": 2, "global": 3}
|
|
@@ -1121,48 +1129,38 @@ def fit_items(
|
|
|
1121
1129
|
*,
|
|
1122
1130
|
extra: dict[str, Any] | None = None,
|
|
1123
1131
|
) -> tuple[dict[str, Any], list[str]]:
|
|
1124
|
-
"""
|
|
1125
|
-
|
|
1126
|
-
OMITTED_IDS_MAX 条,omitted 保留真实总数)。返回 (结果文档, 全部漏下 ID)。
|
|
1132
|
+
"""按渲染后的行把条目装进 QUERY_MAX_BYTES:装不下的跳过而不中断(一条长的
|
|
1133
|
+
不挡后面的短条)。返回 (结果文档, 全部漏下 ID)。
|
|
1127
1134
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1135
|
+
只有 lines 计入预算;items、漏项清单和 `extra`(book_revision 等)是给主会话
|
|
1136
|
+
和脚本看的,不进执行者 prompt,所以漏项全数列出、不封顶,并按候选优先级
|
|
1137
|
+
排序——排在前面的就是作者最该知道没带上的那几条。
|
|
1131
1138
|
"""
|
|
1139
|
+
kept: list[dict[str, Any]] = []
|
|
1140
|
+
dropped: list[dict[str, Any]] = []
|
|
1141
|
+
used = 0
|
|
1142
|
+
for item in sorted_items:
|
|
1143
|
+
size = line_bytes(item)
|
|
1144
|
+
if used + size > QUERY_MAX_BYTES:
|
|
1145
|
+
dropped.append(item)
|
|
1146
|
+
continue
|
|
1147
|
+
kept.append(item)
|
|
1148
|
+
used += size
|
|
1132
1149
|
result: dict[str, Any] = {
|
|
1133
1150
|
"ok": True,
|
|
1134
1151
|
"command": "query",
|
|
1135
1152
|
"initialized": True,
|
|
1136
1153
|
"revision": revision,
|
|
1137
|
-
"items": [],
|
|
1138
|
-
"
|
|
1139
|
-
"
|
|
1154
|
+
"items": [compact_item(item) for item in kept],
|
|
1155
|
+
"lines": [render_line(item) for item in kept],
|
|
1156
|
+
"omitted": len(dropped),
|
|
1157
|
+
"omitted_ids": [item["id"] for item in dropped],
|
|
1158
|
+
"omitted_summaries": {item["id"]: summarize_assertion(item["assertion"]) for item in dropped},
|
|
1159
|
+
# 组装脚本按题材×流程查好几次再合并,合并后只能按重要度重排漏项,所以把它带出来。
|
|
1160
|
+
"omitted_importance": {item["id"]: item["importance"] for item in dropped},
|
|
1140
1161
|
}
|
|
1141
1162
|
result.update(extra or {})
|
|
1142
|
-
|
|
1143
|
-
kept: list[dict[str, Any]] = []
|
|
1144
|
-
dropped: set[str] = set()
|
|
1145
|
-
|
|
1146
|
-
def ordered_omitted() -> list[str]:
|
|
1147
|
-
return sorted(dropped, key=order.__getitem__)
|
|
1148
|
-
|
|
1149
|
-
def envelope_bytes() -> int:
|
|
1150
|
-
omitted = ordered_omitted()
|
|
1151
|
-
result["items"] = [compact_item(item) for item in kept]
|
|
1152
|
-
result["omitted"] = len(omitted)
|
|
1153
|
-
result["omitted_ids"] = omitted[:OMITTED_IDS_MAX]
|
|
1154
|
-
return len((json.dumps(result, ensure_ascii=False, sort_keys=True) + "\n").encode("utf-8"))
|
|
1155
|
-
|
|
1156
|
-
for item in sorted_items:
|
|
1157
|
-
kept.append(item)
|
|
1158
|
-
if envelope_bytes() > QUERY_MAX_BYTES:
|
|
1159
|
-
kept.pop()
|
|
1160
|
-
dropped.add(item["id"])
|
|
1161
|
-
# omitted 计数落定后包可能恰好贴边超出一两个字节,回吐条目直到装下。
|
|
1162
|
-
while kept and envelope_bytes() > QUERY_MAX_BYTES:
|
|
1163
|
-
dropped.add(kept.pop()["id"])
|
|
1164
|
-
envelope_bytes()
|
|
1165
|
-
return result, ordered_omitted()
|
|
1163
|
+
return result, result["omitted_ids"]
|
|
1166
1164
|
|
|
1167
1165
|
|
|
1168
1166
|
def build_query_result(
|
|
@@ -1170,8 +1168,8 @@ def build_query_result(
|
|
|
1170
1168
|
project_state: dict[str, Any] | None,
|
|
1171
1169
|
book_state: dict[str, Any] | None,
|
|
1172
1170
|
) -> tuple[dict[str, Any], list[str]]:
|
|
1173
|
-
"""
|
|
1174
|
-
book_revision
|
|
1171
|
+
"""真实查询与写入端估算共用的唯一装填入口:候选已按优先级排好,这里补上
|
|
1172
|
+
book_revision 等附加字段再装填。两处装填口径一旦分叉就是假阴性——回执
|
|
1175
1173
|
说没事、query 照样丢条。"""
|
|
1176
1174
|
extra: dict[str, Any] = {}
|
|
1177
1175
|
if book_state is not None:
|
|
@@ -1208,12 +1206,13 @@ def merged_query(
|
|
|
1208
1206
|
|
|
1209
1207
|
|
|
1210
1208
|
def slice_weight(items: list[dict[str, Any]]) -> int:
|
|
1211
|
-
"""
|
|
1209
|
+
"""切片在真实载荷里的占位:按渲染后的行(含换行)计。
|
|
1212
1210
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1211
|
+
必须与 fit_items 同一把尺。按 JSON 字节挑会挑错切片——scope 取值长、断言
|
|
1212
|
+
短的切片 JSON 更重,渲染出的行却更轻,于是估算判「装得下」而真实查询溢出
|
|
1213
|
+
(warnings 假阴性)。
|
|
1215
1214
|
"""
|
|
1216
|
-
return sum(
|
|
1215
|
+
return sum(line_bytes(item) for item in items)
|
|
1217
1216
|
|
|
1218
1217
|
|
|
1219
1218
|
def active_of_kinds(state: dict[str, Any] | None, kinds: tuple[str, ...]) -> list[dict[str, Any]]:
|
|
@@ -1419,16 +1418,20 @@ def command_query(
|
|
|
1419
1418
|
project_state = load_state(project_store(workspace))
|
|
1420
1419
|
book_state = load_state(book_store(workspace, book_root, book)) if book_root is not None else None
|
|
1421
1420
|
if project_state is None and book_state is None:
|
|
1422
|
-
return {"ok": True, "command": "query", "initialized": False, "revision": 0, "items": [], "
|
|
1421
|
+
return {"ok": True, "command": "query", "initialized": False, "revision": 0, "items": [], "lines": [],
|
|
1422
|
+
"omitted": 0, "omitted_ids": [], "omitted_summaries": {}, "omitted_importance": {}}
|
|
1423
1423
|
requested_scopes = {
|
|
1424
1424
|
"genre": optional_text(genre, "query.genre", max_bytes=180),
|
|
1425
1425
|
"workflow": optional_text(workflow, "query.workflow", max_bytes=180),
|
|
1426
1426
|
}
|
|
1427
1427
|
# 装不下的**跳过而不中断**(一条长的不挡后面的短条),漏下的 ID 报进
|
|
1428
1428
|
# omitted_ids:非空=记忆超编该整理了,不是「没有更多了」。写入端的
|
|
1429
|
-
# warnings 与这里共用 build_query_result
|
|
1429
|
+
# warnings 与这里共用 build_query_result 同一把尺,估算即实况。
|
|
1430
1430
|
result, _ = merged_query(project_state, book_state, set(kinds), requested_scopes)
|
|
1431
|
-
require(
|
|
1431
|
+
require(
|
|
1432
|
+
sum(len((line + "\n").encode("utf-8")) for line in result["lines"]) <= QUERY_MAX_BYTES,
|
|
1433
|
+
"query lines exceed their fixed byte budget",
|
|
1434
|
+
)
|
|
1432
1435
|
return result
|
|
1433
1436
|
|
|
1434
1437
|
|