@sakanano-moe/agenthelm 6.13.1 → 6.14.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.
Files changed (117) hide show
  1. package/package.json +1 -1
  2. package/runtime/index.json +6 -6
  3. package/runtime/plugins/agent-pack/.codex-plugin/plugin.json +1 -1
  4. package/runtime/plugins/agent-pack/plugin.json +1 -1
  5. package/runtime/plugins/agent-pack/references/capability-config.md +10 -0
  6. package/runtime/plugins/agent-pack/references/check-opinion-migrate.en.md +31 -0
  7. package/runtime/plugins/agent-pack/references/check-opinion-migrate.md +31 -0
  8. package/runtime/plugins/agent-pack/references/dedupe-contract.en.md +27 -0
  9. package/runtime/plugins/agent-pack/references/dedupe-contract.md +27 -0
  10. package/runtime/plugins/agent-pack/references/inventory-contract.en.md +83 -0
  11. package/runtime/plugins/agent-pack/references/inventory-contract.md +83 -0
  12. package/runtime/plugins/agent-pack/references/nudge.en.md +10 -2
  13. package/runtime/plugins/agent-pack/references/nudge.md +10 -2
  14. package/runtime/plugins/agent-pack/references/relocate-contract.en.md +41 -0
  15. package/runtime/plugins/agent-pack/references/relocate-contract.md +41 -0
  16. package/runtime/plugins/agent-pack/runtime/agent_pack_claude.py +572 -30
  17. package/runtime/plugins/agent-pack/runtime/agent_pack_clients.py +233 -0
  18. package/runtime/plugins/agent-pack/runtime/agent_pack_config.py +112 -4
  19. package/runtime/plugins/agent-pack/runtime/agent_pack_dedupe.py +502 -0
  20. package/runtime/plugins/agent-pack/runtime/agent_pack_desktop.py +92 -0
  21. package/runtime/plugins/agent-pack/runtime/agent_pack_ext_common.py +251 -0
  22. package/runtime/plugins/agent-pack/runtime/agent_pack_inventory.py +989 -0
  23. package/runtime/plugins/agent-pack/runtime/agent_pack_mcp_write.py +447 -0
  24. package/runtime/plugins/agent-pack/runtime/agent_pack_nudge.py +29 -4
  25. package/runtime/plugins/agent-pack/runtime/agent_pack_relocate.py +385 -0
  26. package/runtime/plugins/agent-pack/runtime/agent_pack_scope.py +233 -0
  27. package/runtime/plugins/agent-pack/runtime/agenthelm.py +183 -14
  28. package/runtime/plugins/agent-pack/runtime/locale/en.json +250 -1
  29. package/runtime/plugins/agent-pack/runtime/mcp_server.py +12 -0
  30. package/runtime/plugins/agent-pack/runtime/nudge_text.py +8 -2
  31. package/runtime/plugins/agent-pack/runtime/user_settings.py +2 -1
  32. package/runtime/plugins/agent-pack/skills/agent-pack/SKILL.md +15 -0
  33. package/runtime/plugins/agents-init/.codex-plugin/plugin.json +1 -1
  34. package/runtime/plugins/agents-init/content.json +4 -2
  35. package/runtime/plugins/agents-init/plugin.json +1 -1
  36. package/runtime/plugins/agents-init/skills/agents-init/SKILL.md +2 -0
  37. package/runtime/plugins/agents-init/skills/agents-init/launcher.en.sh +93 -0
  38. package/runtime/plugins/agents-init/skills/agents-init/project.schema.json +27 -0
  39. package/runtime/plugins/agents-init/skills/agents-init/scripts/baseline.py +4 -1
  40. package/runtime/plugins/agents-init/skills/agents-init/scripts/init_project.py +24 -9
  41. package/runtime/plugins/agents-init/skills/agents-init/skill.json +1 -1
  42. package/runtime/plugins/opinion-manager/.codex-plugin/plugin.json +1 -1
  43. package/runtime/plugins/opinion-manager/catalog/README.md +3 -1
  44. package/runtime/plugins/opinion-manager/catalog/rules/om.align-requirements/versions/1.1.0.json +34 -0
  45. package/runtime/plugins/opinion-manager/catalog/rules/om.assumptions-authority/versions/1.1.0.json +34 -0
  46. package/runtime/plugins/opinion-manager/catalog/rules/om.batch-questions/versions/1.1.0.json +34 -0
  47. package/runtime/plugins/opinion-manager/catalog/rules/om.bilingual-terms/versions/1.1.0.json +34 -0
  48. package/runtime/plugins/opinion-manager/catalog/rules/om.calculations/versions/1.1.0.json +34 -0
  49. package/runtime/plugins/opinion-manager/catalog/rules/om.chinese-response/versions/1.1.0.json +34 -0
  50. package/runtime/plugins/opinion-manager/catalog/rules/om.clean-deliverable/versions/1.1.0.json +34 -0
  51. package/runtime/plugins/opinion-manager/catalog/rules/om.complete-options/versions/1.1.0.json +34 -0
  52. package/runtime/plugins/opinion-manager/catalog/rules/om.conclusion-first/versions/1.1.0.json +34 -0
  53. package/runtime/plugins/opinion-manager/catalog/rules/om.concrete-titles/versions/1.1.0.json +34 -0
  54. package/runtime/plugins/opinion-manager/catalog/rules/om.consistent-items/versions/1.1.0.json +34 -0
  55. package/runtime/plugins/opinion-manager/catalog/rules/om.device-readable/versions/1.1.0.json +34 -0
  56. package/runtime/plugins/opinion-manager/catalog/rules/om.editable-diagrams/versions/1.1.0.json +34 -0
  57. package/runtime/plugins/opinion-manager/catalog/rules/om.evidence-inference/versions/1.1.0.json +34 -0
  58. package/runtime/plugins/opinion-manager/catalog/rules/om.maintenance-chinese/versions/1.1.0.json +34 -0
  59. package/runtime/plugins/opinion-manager/catalog/rules/om.maintenance-project-language/versions/1.1.0.json +34 -0
  60. package/runtime/plugins/opinion-manager/catalog/rules/om.markdown-structure/versions/1.1.0.json +34 -0
  61. package/runtime/plugins/opinion-manager/catalog/rules/om.portable-files/versions/1.1.0.json +34 -0
  62. package/runtime/plugins/opinion-manager/catalog/rules/om.report-context/versions/1.1.0.json +34 -0
  63. package/runtime/plugins/opinion-manager/catalog/rules/om.report-formats/versions/1.1.0.json +34 -0
  64. package/runtime/plugins/opinion-manager/catalog/rules/om.report-review/versions/1.1.0.json +34 -0
  65. package/runtime/plugins/opinion-manager/catalog/rules/om.response-brief/versions/1.1.0.json +34 -0
  66. package/runtime/plugins/opinion-manager/catalog/rules/om.response-dense/versions/1.1.0.json +34 -0
  67. package/runtime/plugins/opinion-manager/catalog/rules/om.rules-tools/versions/1.1.0.json +34 -0
  68. package/runtime/plugins/opinion-manager/catalog/rules/om.semantic-wrap/versions/1.1.0.json +34 -0
  69. package/runtime/plugins/opinion-manager/catalog/rules/om.solutions-proportional/versions/1.1.0.json +34 -0
  70. package/runtime/plugins/opinion-manager/catalog/rules/om.solutions-three-level/versions/1.1.0.json +34 -0
  71. package/runtime/plugins/opinion-manager/catalog/rules/om.tables-compact/versions/1.1.0.json +34 -0
  72. package/runtime/plugins/opinion-manager/catalog/rules/om.tables-list-first/versions/1.1.0.json +34 -0
  73. package/runtime/plugins/opinion-manager/catalog/rules/om.test-evidence/versions/1.1.0.json +34 -0
  74. package/runtime/plugins/opinion-manager/catalog/rules/om.versioned-files/versions/1.1.0.json +34 -0
  75. package/runtime/plugins/opinion-manager/catalog/templates/delivery-standard/compact-tables/versions/1.1.0.json +32 -0
  76. package/runtime/plugins/opinion-manager/catalog/templates/delivery-standard/list-first/versions/1.1.0.json +32 -0
  77. package/runtime/plugins/opinion-manager/catalog/templates/development-standard/chinese-maintenance/versions/1.1.0.json +26 -0
  78. package/runtime/plugins/opinion-manager/catalog/templates/development-standard/project-language/versions/1.1.0.json +26 -0
  79. package/runtime/plugins/opinion-manager/catalog/templates/response-style/brief-chinese/versions/1.1.0.json +30 -0
  80. package/runtime/plugins/opinion-manager/catalog/templates/response-style/dense-chinese/versions/1.1.0.json +30 -0
  81. package/runtime/plugins/opinion-manager/catalog/templates/scenario/concise-project/versions/1.1.0.json +181 -0
  82. package/runtime/plugins/opinion-manager/catalog/templates/scenario/reviewed-project/versions/1.1.0.json +179 -0
  83. package/runtime/plugins/opinion-manager/catalog/templates/work-method/proportional/versions/1.1.0.json +31 -0
  84. package/runtime/plugins/opinion-manager/catalog/templates/work-method/three-level/versions/1.1.0.json +31 -0
  85. package/runtime/plugins/opinion-manager/content.json +44 -3
  86. package/runtime/plugins/opinion-manager/plugin.json +1 -1
  87. package/runtime/plugins/opinion-manager/references/inbox.en.md +25 -4
  88. package/runtime/plugins/opinion-manager/references/inbox.md +25 -4
  89. package/runtime/plugins/opinion-manager/references/profile.schema.json +19 -2
  90. package/runtime/plugins/opinion-manager/references/rule.schema.json +25 -3
  91. package/runtime/plugins/opinion-manager/references/versioned-template.schema.json +5 -4
  92. package/runtime/plugins/opinion-manager/references/versioning.md +89 -4
  93. package/runtime/plugins/opinion-manager/runtime/context.py +26 -19
  94. package/runtime/plugins/opinion-manager/runtime/inbox.py +400 -25
  95. package/runtime/plugins/opinion-manager/runtime/inbox_relations.py +106 -0
  96. package/runtime/plugins/opinion-manager/runtime/inbox_routes.py +132 -0
  97. package/runtime/plugins/opinion-manager/runtime/inbox_text.py +117 -11
  98. package/runtime/plugins/opinion-manager/runtime/lifecycle.py +35 -5
  99. package/runtime/plugins/opinion-manager/runtime/locale/en.json +137 -2
  100. package/runtime/plugins/opinion-manager/runtime/migrate.py +582 -0
  101. package/runtime/plugins/opinion-manager/runtime/opinion_manager.py +9 -4
  102. package/runtime/plugins/opinion-manager/runtime/rule_lines.py +247 -0
  103. package/runtime/plugins/opinion-manager/runtime/tags.py +217 -0
  104. package/runtime/plugins/opinion-manager/runtime/versioned.py +289 -41
  105. package/runtime/plugins/opinion-manager/skills/opinion-manager/SKILL.md +8 -7
  106. package/runtime/plugins/project-orchestrator/.codex-plugin/plugin.json +1 -1
  107. package/runtime/plugins/project-orchestrator/plugin.json +1 -1
  108. package/runtime/plugins/project-orchestrator/runtime/locale/en.json +305 -3
  109. package/runtime/plugins/project-orchestrator/runtime/private_paths.py +11 -1
  110. package/runtime/plugins/project-orchestrator/runtime/project_cli.py +101 -1
  111. package/runtime/plugins/project-orchestrator/runtime/project_demo.py +13 -1
  112. package/runtime/plugins/project-orchestrator/runtime/project_ext_actions.py +415 -0
  113. package/runtime/plugins/project-orchestrator/runtime/project_extensions.py +971 -0
  114. package/runtime/plugins/project-orchestrator/runtime/project_extensions_demo.py +86 -0
  115. package/runtime/plugins/project-orchestrator/runtime/project_menu.py +345 -2
  116. package/runtime/plugins/project-orchestrator/runtime/project_real.py +17 -1
  117. package/runtime/plugins/project-orchestrator/skills/project-orchestrator/SKILL.md +2 -0
@@ -12,6 +12,7 @@ from typing import Any
12
12
 
13
13
  from constants import KNOWN_PLACEHOLDERS
14
14
  from i18n_opinion import _ # noqa: E402
15
+ from rule_lines import RULE_WORDS # noqa: E402
15
16
 
16
17
 
17
18
  PUBLIC_CATALOG = Path(__file__).resolve().parents[1] / "catalog"
@@ -19,11 +20,20 @@ IDENTIFIER = re.compile(r"[a-z0-9]+(?:[.-][a-z0-9]+)*\Z")
19
20
  VERSION = re.compile(r"(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\Z")
20
21
  EDITABLE = {"title", "level", "scopes", "text"}
21
22
  RULE_FIELDS = EDITABLE | {"id", "version", "slot"}
23
+ RULE_OPTIONAL_FIELDS = {"trigger", "purpose", "exclude"} # 可选:何时适用、为什么、何时不适用(可本地化)
22
24
  TEMPLATE_FIELDS = {"family", "variant", "version", "name", "description", "scopes", "rules"}
25
+ TEMPLATE_OPTIONAL_FIELDS = {"loading"} # 可选:本模板规则的标签选择声明(与 Profile 2.2 的 loading 同形,只涉及本模板的规则)
23
26
  PROFILE_FIELDS = {"schema_version", "id", "version", "templates", "rules", "sources", "overrides", "custom", "derived_from"}
24
27
  PROFILE_OPTIONAL_FIELDS = {"loading"}
25
28
  LOADING_FIELDS = {"core", "signals", "bundles"}
26
29
  BUNDLE_FIELDS = {"family", "trigger", "exclude", "routes"}
30
+ # schema 2.2:标签选择声明。loading 只含这三项;与 2.1 的 core / signals / bundles 互斥。
31
+ TAG_LOADING_FIELDS = {"always", "tags", "members"}
32
+ TAG_FIELDS = {"id", "name", "trigger", "exclude"}
33
+ TAG_ID = re.compile(r"[a-z0-9]+(?:-[a-z0-9]+)*\Z") # 纯 ASCII;中文只能写在 name / trigger / exclude 里
34
+ RESERVED_TAGS = ("core", "none", "all")
35
+ MAX_TAG = 32
36
+ PROFILE_SCHEMAS = ("2.0", "2.1", "2.2")
27
37
 
28
38
 
29
39
  class OpinionVersionError(RuntimeError):
@@ -72,8 +82,8 @@ def read_object(path: Path) -> dict[str, Any]:
72
82
  return value
73
83
 
74
84
 
75
- def fields(value: Any, expected: set[str], label: str) -> None:
76
- if not isinstance(value, dict) or set(value) != expected:
85
+ def fields(value: Any, expected: set[str], label: str, optional: set[str] = frozenset()) -> None:
86
+ if not isinstance(value, dict) or not expected <= set(value) <= expected | optional:
77
87
  fail(_("{0} 字段必须为:{1}").format(label, sorted(expected)))
78
88
 
79
89
 
@@ -115,11 +125,34 @@ def parse_ref(ref: str, kind: str) -> tuple[str, str]:
115
125
  return identity, release
116
126
 
117
127
 
128
+ def localized(value: Any, label: str, *, many: bool = False) -> None:
129
+ """发布内容里可本地化的字段:旧格式(字符串,scopes 为字符串数组,视为 zh)或 {"zh": …, "en": …}(至少一种语言)。"""
130
+ if isinstance(value, dict):
131
+ if not value or set(value) - set(PROJECT_LANGUAGES):
132
+ fail(_("{0} 的本地化写法只能包含 zh、en,且至少一种语言").format(label))
133
+ parts = list(value.values())
134
+ else:
135
+ parts = [value]
136
+ for part in parts:
137
+ strings(part, label) if many else string(part, label)
138
+
139
+
140
+ def pick(value: Any, language: str) -> tuple[Any, bool]:
141
+ """按项目语言取本地化字段的文字:(文字, 是否有该语言的译文)。旧格式字符串视为 zh;缺少该语言时回退到另一种语言。"""
142
+ if isinstance(value, dict):
143
+ if language in value:
144
+ return value[language], True
145
+ return value[next(iter(value))], False
146
+ return value, language == "zh"
147
+
148
+
118
149
  def validate_edit(value: Any) -> None:
119
- fields(value, EDITABLE, _("规则内容"))
120
- string(value["title"], "title")
121
- string(value["text"], "text")
122
- strings(value["scopes"], "scopes")
150
+ fields(value, EDITABLE, _("规则内容"), optional=RULE_OPTIONAL_FIELDS)
151
+ localized(value["title"], "title")
152
+ localized(value["text"], "text")
153
+ localized(value["scopes"], "scopes", many=True)
154
+ for name in RULE_OPTIONAL_FIELDS & set(value):
155
+ localized(value[name], name)
123
156
  if value["level"] not in ("required", "preferred"):
124
157
  fail(_("level 必须为 required 或 preferred"))
125
158
 
@@ -133,21 +166,23 @@ def validate_release(value: Any) -> str:
133
166
  if not isinstance(value, dict):
134
167
  fail(_("发布内容必须是对象"))
135
168
  kind = "rules" if "id" in value else "templates"
136
- fields(value, RULE_FIELDS if kind == "rules" else TEMPLATE_FIELDS, _("发布内容"))
169
+ fields(value, RULE_FIELDS if kind == "rules" else TEMPLATE_FIELDS, _("发布内容"), optional=RULE_OPTIONAL_FIELDS if kind == "rules" else TEMPLATE_OPTIONAL_FIELDS)
137
170
  version(value["version"])
138
171
  if kind == "rules":
139
172
  identifier(value["id"])
140
173
  identifier(value["slot"])
141
- validate_edit({key: value[key] for key in EDITABLE})
174
+ validate_edit({key: value[key] for key in EDITABLE | (RULE_OPTIONAL_FIELDS & set(value))})
142
175
  else:
143
176
  identifier(value["family"])
144
177
  identifier(value["variant"])
145
- string(value["name"], "name")
146
- string(value["description"], "description")
147
- strings(value["scopes"], "scopes")
178
+ localized(value["name"], "name")
179
+ localized(value["description"], "description")
180
+ localized(value["scopes"], "scopes", many=True)
148
181
  strings(value["rules"], "rules")
149
182
  for ref in value["rules"]:
150
183
  parse_ref(ref, "rules")
184
+ if "loading" in value:
185
+ check_tag_loading(value["loading"], {parse_ref(ref, "rules")[0] for ref in value["rules"]})
151
186
  return kind
152
187
 
153
188
 
@@ -268,11 +303,107 @@ def validate_loading(profile: dict[str, Any]) -> None:
268
303
  fail(_("路由使用了未声明的信号:{0}.{1}").format(family, key))
269
304
 
270
305
 
306
+ def tag_identifier(value: Any, label: str) -> None:
307
+ if not isinstance(value, str) or len(value) > MAX_TAG or not TAG_ID.fullmatch(value):
308
+ fail(_("{0} 必须是 ASCII 标签 id(小写字母、数字、连字符,1 到 {1} 字符):{2!r}").format(label, MAX_TAG, value))
309
+ if value in RESERVED_TAGS:
310
+ fail(_("{0} 不能使用保留名:{1}").format(label, _("、").join(RESERVED_TAGS)))
311
+
312
+
313
+ def tag_text(value: Any, label: str) -> None:
314
+ """标签的 name / trigger / exclude:必须同时给出 zh 与 en 两种语言的非空文字。"""
315
+ if not isinstance(value, dict) or set(value) != {"zh", "en"}:
316
+ fail(_("{0} 必须是只含 zh、en 的对象").format(label))
317
+ for text in value.values():
318
+ string(text, label)
319
+
320
+
321
+ def validate_tag_loading(profile: dict[str, Any]) -> None:
322
+ """schema 2.2 的 loading。停用规则使标签没有有效规则不算校验失败(读取时该标签不可用)。"""
323
+ check_tag_loading(profile["loading"], set(base_rules(profile)))
324
+
325
+
326
+ def check_tag_loading(loading: Any, known: set[str]) -> None:
327
+ """标签声明的结构校验;Profile 与模板共用,known 是声明可以引用的规则编号。"""
328
+ fields(loading, TAG_LOADING_FIELDS, "loading")
329
+ strings(loading["always"], "loading.always", empty=True)
330
+ for identity in loading["always"]:
331
+ if identity not in known:
332
+ fail(_("loading.always 引用了不存在的规则:{0}").format(identity))
333
+ if not isinstance(loading["tags"], list) or not loading["tags"]:
334
+ fail(_("loading.tags 至少包含一个标签"))
335
+ tags: list[str] = []
336
+ for tag in loading["tags"]:
337
+ fields(tag, TAG_FIELDS, _("loading.tags 项"))
338
+ tag_identifier(tag["id"], "loading.tags.id")
339
+ if tag["id"] in tags:
340
+ fail(_("标签 id 重复:{0}").format(tag["id"]))
341
+ tags.append(tag["id"])
342
+ for name in ("name", "trigger", "exclude"):
343
+ tag_text(tag[name], f"loading.tags.{name}")
344
+ if not isinstance(loading["members"], dict):
345
+ fail(_("loading.members 必须是对象"))
346
+ used: set[str] = set()
347
+ for identity, names in loading["members"].items():
348
+ if identity not in known:
349
+ fail(_("loading.members 引用了不存在的规则:{0}").format(identity))
350
+ strings(names, f"loading.members.{identity}")
351
+ unknown = [name for name in names if name not in tags]
352
+ if unknown:
353
+ fail(_("loading.members 使用了未知标签:{0};有效标签:{1}").format(_("、").join(unknown), _("、").join(tags)))
354
+ used.update(names)
355
+ unused = [name for name in tags if name not in used]
356
+ if unused:
357
+ fail(_("标签没有任何成员规则:{0}").format(_("、").join(unused)))
358
+
359
+
360
+ def template_loading(sources: dict[str, Any]) -> dict[str, Any] | None:
361
+ """由所选模板声明合并出 Profile 的标签 loading;没有任何模板声明(或合并后没有按需标签)返回 None,保持完整读取。
362
+
363
+ 词表按 id 合并,同一 id 的定义必须逐字相同;always 与 members 取并集;没有声明的模板,其规则全部常驻
364
+ (同一规则同时被其他模板标记时归常驻);规则同时在 always 与标签里时归常驻,标签因此没有成员则不收录。
365
+ """
366
+ templates = sorted(sources["templates"], key=lambda source: source["ref"])
367
+ declared = [source for source in templates if "loading" in source["value"]]
368
+ if not declared:
369
+ return None
370
+ definitions: dict[str, tuple[dict[str, Any], list[str]]] = {}
371
+ conflicts: list[str] = []
372
+ for source in declared:
373
+ for tag in source["value"]["loading"]["tags"]:
374
+ known = definitions.setdefault(tag["id"], (tag, []))
375
+ known[1].append(source["ref"])
376
+ if known[0] != tag and tag["id"] not in conflicts:
377
+ conflicts.append(tag["id"])
378
+ if conflicts:
379
+ fail(_("标签定义冲突:{0}").format(_(";").join(_("{0}(来源:{1})").format(name, _("、").join(definitions[name][1])) for name in conflicts)))
380
+ always = {identity for source in declared for identity in source["value"]["loading"]["always"]}
381
+ always |= {parse_ref(ref, "rules")[0] for source in templates if "loading" not in source["value"] for ref in source["value"]["rules"]}
382
+ members: dict[str, list[str]] = {}
383
+ for source in declared:
384
+ for identity, names in source["value"]["loading"]["members"].items():
385
+ if identity not in always:
386
+ members[identity] = members.get(identity, []) + [name for name in names if name not in members.get(identity, [])]
387
+ tags = [tag for name, (tag, _refs) in definitions.items() if any(name in names for names in members.values())]
388
+ if not tags:
389
+ return None
390
+ ordered = [identity for source in declared for identity in source["value"]["loading"]["always"]]
391
+ resident = [identity for identity in dict.fromkeys(ordered)] + sorted(always - set(ordered))
392
+ return {"always": resident, "tags": tags, "members": members}
393
+
394
+
395
+ def profile_schema(loading: Any) -> str:
396
+ """没有声明为 2.0;规则束声明为 2.1;标签声明才写 2.2。2.0 与 2.1 的 Profile 字节因此保持不变。"""
397
+ if loading is None:
398
+ return "2.0"
399
+ return "2.2" if isinstance(loading, dict) and "tags" in loading else "2.1"
400
+
401
+
271
402
  def validate_profile(value: Any) -> dict[str, Any]:
272
- tiered = isinstance(value, dict) and value.get("schema_version") == "2.1"
273
- fields(value, PROFILE_FIELDS | PROFILE_OPTIONAL_FIELDS if tiered else PROFILE_FIELDS, "Profile")
274
- if value["schema_version"] not in ("2.0", "2.1"):
275
- fail(_("Profile schema_version 必须为 2.0 或 2.1"))
403
+ schema = value.get("schema_version") if isinstance(value, dict) else None
404
+ fields(value, PROFILE_FIELDS | PROFILE_OPTIONAL_FIELDS if schema in ("2.1", "2.2") else PROFILE_FIELDS, "Profile")
405
+ if schema not in PROFILE_SCHEMAS:
406
+ fail(_("Profile schema_version 必须为 2.0、2.1 或 2.2"))
276
407
  identifier(value["id"])
277
408
  version(value["version"])
278
409
  strings(value["templates"], "templates", empty=True)
@@ -312,8 +443,13 @@ def validate_profile(value: Any) -> dict[str, Any]:
312
443
  fail(_("derived_from 指纹无效"))
313
444
  if not effective_rules(value) and not value["custom"]:
314
445
  fail(_("Profile 至少需要一条有效规则或自定义内容"))
315
- if tiered:
316
- validate_loading(value)
446
+ if "loading" in value:
447
+ if schema == "2.2":
448
+ validate_tag_loading(value)
449
+ elif isinstance(value["loading"], dict) and "tags" in value["loading"]:
450
+ fail(_("loading.tags 声明需要 schema_version 2.2"))
451
+ else:
452
+ validate_loading(value)
317
453
  return value
318
454
 
319
455
 
@@ -336,7 +472,7 @@ def replace_refs(previous: list[str], incoming: list[str], kind: str) -> list[st
336
472
 
337
473
 
338
474
  def behavior(rule: dict[str, Any] | None) -> Any:
339
- return None if rule is None else {key: rule[key] for key in RULE_FIELDS - {"version", "title"}}
475
+ return None if rule is None else {key: rule[key] for key in (RULE_FIELDS - {"version", "title"}) | (RULE_OPTIONAL_FIELDS & set(rule))}
340
476
 
341
477
 
342
478
  def comparison(old: dict[str, Any], new: dict[str, Any]) -> dict[str, Any]:
@@ -391,6 +527,28 @@ def confirm(args: argparse.Namespace, fingerprint: str) -> None:
391
527
  fail(_("请先审阅预览,再使用 --confirm {0} --apply").format(fingerprint))
392
528
 
393
529
 
530
+ def choose_loading(args: argparse.Namespace, old: dict[str, Any] | None, templates: list[str], sources: dict[str, Any]) -> tuple[Any, str, Any]:
531
+ """profile 预览的 loading 来源:(声明, 来源标记, 建议)。只在模板选择变化(或新建)时由模板物化;
532
+ --loading-file、--remove-loading、--no-tags 之外,用户手写的声明不被覆盖,只给出建议。"""
533
+ inherited = None if not old else old.get("loading")
534
+ if args.loading_file:
535
+ if args.no_tags:
536
+ fail(_("--no-tags 与 --loading-file 不能同时使用"))
537
+ return read_object(args.loading_file), "file", None
538
+ if args.remove_loading:
539
+ return None, "removed", None
540
+ if args.no_tags or (old and templates == old["templates"]):
541
+ return inherited, ("inherited" if inherited is not None else "none"), None
542
+ proposed = template_loading(sources)
543
+ try:
544
+ derived = template_loading(old["sources"]) if old else None
545
+ except OpinionVersionError:
546
+ derived = None
547
+ if inherited is None or inherited == derived:
548
+ return proposed, ("template" if proposed is not None else "none"), None
549
+ return inherited, "inherited", (proposed if proposed not in (None, inherited) else None)
550
+
551
+
394
552
  def profile_command(args: argparse.Namespace) -> dict[str, Any]:
395
553
  root = safe_path(args.project)
396
554
  if not root.is_dir():
@@ -424,16 +582,19 @@ def profile_command(args: argparse.Namespace) -> dict[str, Any]:
424
582
  if args.loading_file and args.remove_loading:
425
583
  fail(_("--loading-file 与 --remove-loading 不能同时使用"))
426
584
  # 加载声明整体替换;未提供时沿用原 Profile,保证未变更的声明不会在修订中丢失。
427
- loading = read_object(args.loading_file) if args.loading_file else (None if args.remove_loading or not old else old.get("loading"))
585
+ sources = resolve(catalog, templates, rules)
586
+ loading, loading_source, suggestion = choose_loading(args, old, templates, sources)
428
587
  value = {
429
- "schema_version": "2.0" if loading is None else "2.1", "id": args.id, "version": args.version,
430
- "templates": templates, "rules": rules, "sources": resolve(catalog, templates, rules),
588
+ "schema_version": profile_schema(loading), "id": args.id, "version": args.version,
589
+ "templates": templates, "rules": rules, "sources": sources,
431
590
  "overrides": dict(old["overrides"]) if old else {}, "custom": custom,
432
591
  "derived_from": {"id": old["id"], "version": old["version"], "sha256": digest(old)} if old else None,
433
592
  }
434
593
  if loading is not None:
435
594
  value["loading"] = loading
436
595
  changes = comparison(old, value) if old else {"conflicts": []}
596
+ if not old and loading is not None:
597
+ changes.update({"loading_changed": True, "loading": {"before": None, "after": loading}})
437
598
  resolutions = read_object(args.resolutions_file) if args.resolutions_file else {}
438
599
  conflict_ids = {item["id"] for item in changes["conflicts"]}
439
600
  if set(resolutions) - conflict_ids:
@@ -465,7 +626,11 @@ def profile_command(args: argparse.Namespace) -> dict[str, Any]:
465
626
  changes = updated_changes
466
627
  path = root / ".opinion" / "profiles" / args.id / "versions" / f"{args.version}.json"
467
628
  fingerprint = digest(value)
468
- result = {"ok": True, "status": "preview", "path": str(path), "profile": value, "content": render(value), "effective_rules": list(effective_rules(value).values()), "changes": changes, "unresolved": sorted(unresolved), "confirmation_sha256": fingerprint}
629
+ result = {"ok": True, "status": "preview", "path": str(path), "profile": value, "content": render(value, project_language(root)), "effective_rules": list(effective_rules(value).values()), "changes": changes, "unresolved": sorted(unresolved), "confirmation_sha256": fingerprint,
630
+ "loading_source": loading_source, **untranslated_report(value, project_language(root))}
631
+ if suggestion is not None:
632
+ result["loading_suggestion"] = suggestion
633
+ result.setdefault("warnings", []).append(_("所选模板声明了标签加载,但本 Profile 已有手写的 loading,未自动合并;建议声明见 loading_suggestion,需要时用 --loading-file 整体写入"))
469
634
  if args.apply:
470
635
  if unresolved:
471
636
  fail(_("升级存在未确认的冲突:{0}").format(sorted(unresolved)))
@@ -492,6 +657,8 @@ def publish_command(args: argparse.Namespace) -> dict[str, Any]:
492
657
  if kind == "templates":
493
658
  if latest["scopes"] != value["scopes"]:
494
659
  fail(_("patch 版本不能改变适用范围"))
660
+ if latest.get("loading") != value.get("loading"):
661
+ fail(_("patch 版本不能改变加载声明"))
495
662
  a = resolve(catalog, [release_ref(latest, kind)], [])
496
663
  prospective = {**catalog, "templates": {**catalog["templates"], ref: value}}
497
664
  b = resolve(prospective, [ref], [])
@@ -513,24 +680,84 @@ def publish_command(args: argparse.Namespace) -> dict[str, Any]:
513
680
  return result
514
681
 
515
682
 
516
- def render_rule(profile: dict[str, Any], rule: dict[str, Any]) -> str:
517
- level = "强制规则" if rule["level"] == "required" else "偏好"
518
- origin = f"个人修订:`{profile['id']}@{profile['version']}`" if rule["id"] in profile["overrides"] else f"规则:`{rule['id']}@{rule['version']}`"
519
- return "\n".join((f"## {rule['title']}", "", f"{origin};{level};适用:{'、'.join(rule['scopes'])}。", "", rule["text"]))
683
+ PROJECT_PROFILE = Path(".agents") / "moe.sakanano.agent-pack" / "project.json"
684
+ PROJECT_LANGUAGES = ("zh", "en")
520
685
 
686
+ # 写进项目文件(OPINION.md 与规则行)的语言标签;界面语言只决定命令输出,不决定这里。
687
+ FRAME = {
688
+ "zh": {"title": "# Agent Opinion", "intro": "本文件包含当前环境中用户确认的 Agent 行为、表达、判断与交付要求。",
689
+ "custom": "## 用户自定义规则", "required": "强制规则", "preferred": "偏好", "revision": "个人修订", "rule": "规则",
690
+ "applies": "适用", "sep": "、", "colon": ":", "semi": ";", "stop": "。"},
691
+ "en": {"title": "# Agent Opinion", "intro": "This file holds the agent behavior, expression, judgment and delivery requirements the user confirmed for this environment.",
692
+ "custom": "## User-defined rules", "required": "Required", "preferred": "Preferred", "revision": "Personal revision", "rule": "Rule",
693
+ "applies": "Applies to", "sep": ", ", "colon": ": ", "semi": "; ", "stop": "."},
694
+ }
521
695
 
522
- def render(profile: dict[str, Any]) -> str:
696
+
697
+ def project_language(root: Path) -> str:
698
+ """项目文件语言:Project Profile 的 language;缺省、不是 en 或读不了都按 zh(既有项目保持不变)。"""
699
+ try:
700
+ value = json.loads((root / PROJECT_PROFILE).read_text(encoding="utf-8")).get("language")
701
+ except (OSError, ValueError, AttributeError):
702
+ return "zh"
703
+ return "en" if value == "en" else "zh"
704
+
705
+
706
+ def render_rule(profile: dict[str, Any], rule: dict[str, Any], language: str = "zh") -> str:
707
+ words = FRAME[language]
708
+ level = words["required"] if rule["level"] == "required" else words["preferred"]
709
+ label = words["revision"] if rule["id"] in profile["overrides"] else words["rule"]
710
+ origin = f"{label}{words['colon']}`{profile['id']}@{profile['version']}`" if rule["id"] in profile["overrides"] else f"{label}{words['colon']}`{rule['id']}@{rule['version']}`"
711
+ qualifiers = "".join(f"{words['semi']}{RULE_WORDS[language][name]}{words['colon']}{pick(rule[name], language)[0]}" for name in ("trigger", "purpose", "exclude") if name in rule)
712
+ return "\n".join((f"## {pick(rule['title'], language)[0]}", "", f"{origin}{words['semi']}{level}{words['semi']}{words['applies']}{words['colon']}{words['sep'].join(pick(rule['scopes'], language)[0])}{qualifiers}{words['stop']}", "", pick(rule["text"], language)[0]))
713
+
714
+
715
+ def untranslated(profile: dict[str, Any], language: str) -> list[dict[str, Any]]:
716
+ """项目语言不是 zh 时,列出被选中、却缺少该语言译文的公开规则(及分层加载用到的模板名);不阻断。
717
+ 个人修订(overrides)是用户自己的文字,不算。"""
718
+ if language == "zh":
719
+ return []
720
+ missing = []
721
+ for identity, rule in effective_rules(profile).items():
722
+ if identity in profile["overrides"]:
723
+ continue
724
+ fields_ = [name for name in ("title", "text", "scopes", *sorted(RULE_OPTIONAL_FIELDS)) if name in rule and not pick(rule[name], language)[1]]
725
+ if fields_:
726
+ missing.append({"ref": f"{rule['id']}@{rule['version']}", "kind": "rule", "fields": fields_})
727
+ if "loading" in profile:
728
+ for source in profile["sources"]["templates"]:
729
+ fields_ = [name for name in ("name",) if not pick(source["value"][name], language)[1]]
730
+ if fields_:
731
+ missing.append({"ref": source["ref"], "kind": "template", "fields": fields_})
732
+ if isinstance(profile["loading"], dict):
733
+ for tag in profile["loading"].get("tags", []):
734
+ fields_ = [name for name in ("name", "trigger", "exclude") if not pick(tag[name], language)[1]]
735
+ if fields_:
736
+ missing.append({"ref": tag["id"], "kind": "tag", "fields": fields_})
737
+ return missing
738
+
739
+
740
+ def untranslated_report(profile: dict[str, Any], language: str) -> dict[str, Any]:
741
+ """预览输出里的 untranslated 警告;zh 项目不带这些键,输出与旧版逐字节相同。"""
742
+ missing = untranslated(profile, language)
743
+ if language == "zh":
744
+ return {}
745
+ return {"untranslated": missing, "warnings": [_("项目文件语言为 {0},但这些公开内容没有对应译文,会按原文写入:{1}").format(language, ", ".join(item["ref"] for item in missing))] if missing else []}
746
+
747
+
748
+ def render(profile: dict[str, Any], language: str = "zh") -> str:
749
+ words = FRAME[language]
523
750
  metadata = {"schema_version": "2.0", "profile": f"{profile['id']}@{profile['version']}", "sha256": digest(profile), "templates": profile["templates"], "rules": profile["rules"]}
524
- lines = ["<!-- opinion-manager:metadata", pretty(metadata).rstrip(), "-->", "", "# Agent Opinion", "", "本文件包含当前环境中用户确认的 Agent 行为、表达、判断与交付要求。"]
751
+ lines = ["<!-- opinion-manager:metadata", pretty(metadata).rstrip(), "-->", "", words["title"], "", words["intro"]]
525
752
  for rule in effective_rules(profile).values():
526
- lines.extend(("", render_rule(profile, rule)))
527
- lines.extend(custom_section(profile))
753
+ lines.extend(("", render_rule(profile, rule, language)))
754
+ lines.extend(custom_section(profile, language))
528
755
  return "\n".join(lines).rstrip() + "\n"
529
756
 
530
757
 
531
- def custom_section(profile: dict[str, Any]) -> list[str]:
532
- """OPINION.md 的自定义规则小节(标题属于正文,不随界面语言);切片输出复用同一份。"""
533
- return ["", "## 用户自定义规则", "", profile["custom"]] if profile["custom"] else []
758
+ def custom_section(profile: dict[str, Any], language: str = "zh") -> list[str]:
759
+ """OPINION.md 的自定义规则小节(标题随项目文件语言,不随界面语言);切片输出复用同一份。"""
760
+ return ["", FRAME[language]["custom"], "", profile["custom"]] if profile["custom"] else []
534
761
 
535
762
 
536
763
  def file_state(path: Path) -> str | None:
@@ -538,16 +765,23 @@ def file_state(path: Path) -> str | None:
538
765
  return read_text(path) if path.exists() else None
539
766
 
540
767
 
541
- def lock_value(profile: dict[str, Any], content: str) -> dict[str, Any]:
542
- return {"schema_version": "2.0", "renderer_version": "2.0", "profile": profile, "profile_sha256": digest(profile), "opinion_sha256": text_digest(content)}
768
+ def lock_value(profile: dict[str, Any], content: str, language: str = "zh") -> dict[str, Any]:
769
+ """锁快照。只有项目文件语言不是 zh 时才带 language;zh 项目的锁格式与旧版完全相同(旧运行时读不了带 language 的锁)。"""
770
+ value = {"schema_version": "2.0", "renderer_version": "2.0", "profile": profile, "profile_sha256": digest(profile), "opinion_sha256": text_digest(content)}
771
+ if language != "zh":
772
+ value["language"] = language
773
+ return value
543
774
 
544
775
 
545
776
  def validate_lock(lock: Any) -> dict[str, Any]:
546
- fields(lock, {"schema_version", "renderer_version", "profile", "profile_sha256", "opinion_sha256"}, "lock")
777
+ fields(lock, {"schema_version", "renderer_version", "profile", "profile_sha256", "opinion_sha256"}, "lock", optional={"language"})
547
778
  if lock["schema_version"] != "2.0" or lock["renderer_version"] != "2.0":
548
779
  fail(_("锁定文件版本不受支持"))
780
+ language = lock.get("language", "zh")
781
+ if language not in PROJECT_LANGUAGES or ("language" in lock and language == "zh"):
782
+ fail(_("锁定文件的 language 无效:{0!r}").format(language))
549
783
  profile = validate_profile(lock["profile"])
550
- if lock != lock_value(profile, render(profile)):
784
+ if lock != lock_value(profile, render(profile, language), language):
551
785
  fail(_("锁定文件指纹与内容不一致"))
552
786
  return lock
553
787
 
@@ -575,8 +809,9 @@ def compose_command(args: argparse.Namespace) -> dict[str, Any]:
575
809
  root = safe_path(args.project)
576
810
  if not root.is_dir():
577
811
  fail(_("项目目录不存在:{0}").format(root))
578
- content = render(profile)
579
- lock = lock_value(profile, content)
812
+ language = project_language(root)
813
+ content = render(profile, language)
814
+ lock = lock_value(profile, content, language)
580
815
  destination, lock_path = root / "OPINION.md", root / "opinion.lock.json"
581
816
  current, current_lock = file_state(destination), file_state(lock_path)
582
817
  blocked = None
@@ -596,7 +831,8 @@ def compose_command(args: argparse.Namespace) -> dict[str, Any]:
596
831
  if current not in KNOWN_PLACEHOLDERS:
597
832
  blocked = _("已有 OPINION.md 需要审阅并使用 --replace")
598
833
  fingerprint = digest({"lock": lock, "before": {"opinion": current, "lock": current_lock}, "replace": args.replace, "accept_current": args.accept_current})
599
- result = {"ok": True, "status": "preview", "content": content, "lock": lock, "blocked": blocked, "confirmation_sha256": fingerprint, "path": str(destination)}
834
+ result = {"ok": True, "status": "preview", "content": content, "lock": lock, "blocked": blocked, "confirmation_sha256": fingerprint, "path": str(destination),
835
+ **untranslated_report(profile, language)}
600
836
  if args.apply:
601
837
  if blocked:
602
838
  fail(blocked)
@@ -620,6 +856,14 @@ def verify_project(project: Path) -> dict[str, Any]:
620
856
  return {"ok": True, "status": "verified", "profile": f"{lock['profile']['id']}@{lock['profile']['version']}", "profile_sha256": lock["profile_sha256"], "opinion_sha256": lock["opinion_sha256"]}
621
857
 
622
858
 
859
+ def loading_summary(template: dict[str, Any] | None) -> dict[str, Any] | None:
860
+ """updates 里每个模板版本的标签声明摘要;没有声明为 None(物化后完整读取)。"""
861
+ loading = (template or {}).get("loading")
862
+ if loading is None:
863
+ return None
864
+ return {"always": len(loading["always"]), "tags": [tag["id"] for tag in loading["tags"]], "on_demand_rules": len(loading["members"])}
865
+
866
+
623
867
  def updates_command(args: argparse.Namespace) -> dict[str, Any]:
624
868
  profile = load_profile(args.profile)
625
869
  catalog = load_catalog(args.catalog)
@@ -634,7 +878,10 @@ def updates_command(args: argparse.Namespace) -> dict[str, Any]:
634
878
  identity, current = parse_ref(ref, kind)
635
879
  candidates = [candidate for candidate in catalog[kind] if parse_ref(candidate, kind)[0] == identity and version(parse_ref(candidate, kind)[1]) > version(current)]
636
880
  if candidates:
637
- updates.append({"kind": kind, "current": ref, "available": sorted(candidates, key=lambda candidate: version(parse_ref(candidate, kind)[1]))})
881
+ entry = {"kind": kind, "current": ref, "available": sorted(candidates, key=lambda candidate: version(parse_ref(candidate, kind)[1]))}
882
+ if kind == "templates":
883
+ entry["loading"] = {item: loading_summary(catalog["templates"].get(item)) for item in [ref, *entry["available"]]}
884
+ updates.append(entry)
638
885
  return {"ok": True, "updates": updates, "applied": False}
639
886
 
640
887
 
@@ -667,6 +914,7 @@ def add_commands(subparsers: Any, compose: argparse.ArgumentParser, catalog: arg
667
914
  profile.add_argument("--resolutions-file", type=Path)
668
915
  profile.add_argument("--loading-file", type=Path, help=_("完整的分层加载声明 JSON;整体替换原声明"))
669
916
  profile.add_argument("--remove-loading", action="store_true", help=_("移除分层加载声明,恢复为完整读取"))
917
+ profile.add_argument("--no-tags", action="store_true", help=_("不由所选模板物化标签加载声明,保持完整读取(schema 2.0)"))
670
918
  publish = subparsers.add_parser("publish", help=_("预览或发布规则、模板版本"))
671
919
  options(publish, catalog=True, mutation=True)
672
920
  publish.add_argument("--file", required=True, type=Path)
@@ -49,21 +49,22 @@ description: Generate, compose, review and maintain behavior rules between the u
49
49
 
50
50
  ## 交付物审查与旧格式
51
51
 
52
- 实施前完整读取当前项目 `OPINION.md`,按条件选择适用条款;交付前逐条检查并修正明确问题。Profile 声明了分层加载时,改为先运行 `context core` 读取核心规则与规则束索引,任务命中触发条件或判断不清时用 `context bundle` 读取对应规则束,交付前用 `context check` 核对;命令返回 `fallback` 时完整读取正文。维护规则本身时始终完整读取。冲突改变交付时集中请用户裁决。用户反馈只形成候选,经确认才能发布新版本。项目需要记录候选发生次数、灰度使用与规则覆盖时,使用 `lifecycle` 命令在项目私有目录记账:任务结束后提交 `use` 事件,如实记录适用规则、逐条结果、读取的规则束和漏读;测试与演示标为 `fixture`。工具只记账,不在后台学习,也不自动晋升候选或把灰度版本转为正式,这些裁决来自用户。工作中的低成本暂存使用 `inbox`(见下文),`lifecycle` 保留给带证据的灰度与覆盖记账。
52
+ 实施前完整读取当前项目 `OPINION.md`,按条件选择适用条款;交付前逐条检查并修正明确问题。Profile 声明了分层加载时,改为先运行 `context core` 读取核心规则与规则束索引,命中触发条件或判断不清时,2.1 用 `context bundle`、2.2 用 `context select --tag` 读规则束/标签,交付前用 `context check` 核对;命令返回 `fallback` 时完整读取正文。维护规则本身时始终完整读取。冲突改变交付时集中请用户裁决。用户反馈只形成候选,经确认才能发布新版本。项目需记录候选发生次数、灰度使用与规则覆盖时,用 `lifecycle` 命令在项目私有目录记账:任务结束后提交 `use` 事件,如实记录适用规则、逐条结果、读取的规则束或标签及漏读;测试与演示标为 `fixture`。工具只记账,不后台学习,不自动晋升候选或转正,这些裁决来自用户。工作中的低成本暂存使用 `inbox`(见下文),`lifecycle` 保留给带证据的灰度与覆盖记账。
53
53
 
54
54
  旧格式 `templates/*.json`、`compose --template`、`compose --rule` 与 `compose --custom-file` 保持兼容。有锁项目必须使用版本化 Profile 流程,禁止用旧格式写入绕过核验;新项目优先使用版本化 catalog。
55
55
 
56
56
  ## 候选收件箱与自动采集
57
57
 
58
- 收件箱让用户在工作中顺手沉淀观点:先低成本暂存,再由用户集中裁决。agent-pack 的 hook(`agenthelm nudge`)会在会话开始注入下面的协议并提示未决事项;没有 hook 的客户端按本节手动执行。命令与数据格式见 [候选收件箱](../../references/inbox.md),hook 与阈值见 agent-pack 的 `references/nudge.md`。
58
+ 收件箱让用户在工作中顺手沉淀观点:先低成本暂存,再由用户集中裁决。agent-pack 的 hook(`agenthelm nudge`)会在会话开始注入下面的协议并提示未决事项;无 hook 的客户端按本节手动执行。命令与格式见 [候选收件箱](../../references/inbox.md),hook 与阈值见 agent-pack 的 `references/nudge.md`。
59
59
 
60
- - **暂存**:用户在工作中表达长期偏好、对你行为的纠正或规则(“以后都……”“不要再……”“记住……”)时,立即用 `inbox add` 暂存标题、完整规则、适用范围和用户原话。不打断当前任务,不需要确认。一次性的任务要求、项目事实和命令不是候选。宁可多暂存,裁决环节会过滤。
60
+ - **暂存**:用户在工作中表达长期偏好、对你行为的纠正或规则(“以后都……”“不要再……”“记住……”)时,立即用 `inbox add` 暂存标题、完整规则、适用范围、`--trigger`(何时适用)、`--purpose`(为什么)和用户原话,可选 `--exclude`、`--relation`;缺 trigger / purpose 只警告,按「不完整」展示。不打断当前任务,不需确认。一次性的任务要求、项目事实和命令不是候选。暂存阶段宁可多存,展示与裁决阶段要求条件完整,不得用「所有」等占位词。
61
61
  - **匹配**:实施前读取 OPINION.md;用户已同意试行的候选(`inbox list --status trial`,hook 会随协议注入)同样遵循,交付时说明是否适用。
62
- - **确认**:任务完成或即将完成时,把本次会话新增的候选用编号列表一次性交给用户:正式采纳 / 项目内试行 / 暂缓 / 丢弃。用户明确表态后记录:试行 / 暂缓 / 丢弃用 `inbox decide … --confirmed`;用户说「采纳」时直接用 `inbox adopt`,不先 `decide`。每个会话集中确认一次,不逐条追问。
63
- - **采纳并写入**:用户说「采纳」后,运行 `inbox adopt <编号…>`(不带 `--apply`,零写入)预览:候选正文作为个人规则输入,走与 `profile` / `compose` 相同的完整流程,一次展示 `content`;用户确认后追加 `--apply --confirm <confirmation_sha256>`,一次写入并 `verify` 读回,成功后候选才记为 `formal`。多条候选一次预览、一次确认,全部成功或都不改。
62
+ - **确认**:时机、频率与模式(ask / digest / quiet)以 inbox brief 注入的协议为准,不自行加「任务完成时询问」;无 hook 时运行 `inbox brief` 读取。表态后:试行 / 暂缓 / 丢弃用 `inbox decide … --confirmed`;「采纳」直接 `inbox adopt`,不先 `decide`。
63
+ - **采纳并写入**:`inbox adopt <编号…>`(无 `--apply`,零写入)预览,走与 `profile` / `compose` 相同的流程。`shown_matches` 为真且无 `blocked`、无冲突时可直接 `--apply --confirm <confirmation_sha256>`,否则展示 `content` 与差异、用户确认后再加。`verify` 读回成功才记 `formal`;多条一次预览,全部成功或都不改。细节见 references。
64
64
  - **已批准不等于已生效**:`decide --to formal` 只记录状态,输出 `in_opinion: false` 与 `next_step`,`OPINION.md` 未写入,后续会话不会加载;必须继续 `inbox adopt`。
65
- - **边界**:除 `adopt --apply`(须带预览指纹)外,`inbox` 不写 OPINION.md、Profile 或锁;重复出现不等于确认。试行超过设定天数未转正会回到待确认。
66
- - **隐私**:收件箱 `.opinion/inbox.json` 保存用户原话,可能含敏感信息,建议项目保持私有。`inbox add` 返回 `notice` 时如实转告用户;是否公开仓库、是否排除 `.opinion/` 由用户决定,不要替用户决定,也不要自行修改 `.gitignore`。
65
+ - **补全与修订**:`inbox check` 只读,列出缺条件/目的的候选与 OPINION.md 行,由你给建议值;候选用 `inbox revise` 补全(已展示或非 pending 须 `--confirmed`);`relations` 只是机械提示,语义判断由你做,写入 `--relation`。
66
+ - **边界**:未经用户确认不写入 OPINION.md;除 `adopt --apply`(须带预览指纹)外,`inbox` 不写 OPINION.md、Profile 或锁;重复出现不等于确认。试行超期未转正回到待确认。
67
+ - **隐私**:收件箱 `.opinion/inbox.json` 保存用户原话,可能含敏感信息,建议项目保持私有。`inbox add` 返回 `notice` 时如实转告用户;是否公开仓库、是否排除 `.opinion/` 由用户决定,不要自行修改 `.gitignore`。
67
68
  - **语言**:提示与协议有中文、英文两种,命令带 `--lang zh|en`;向用户转告和确认时使用用户正在使用的语言。候选内容是用户自己的话,不翻译。
68
69
  - **未决汇总**:开新会话时 agent-pack 按阈值提示待确认数量与久未处理的天数;用户可在 Project Profile 的 `opinion.nudge` 或 `~/.config/agenthelm/config.json` 的 `nudge` 调整,或用 `AGENTHELM_NO_NUDGE=1` 关闭。
69
70
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-orchestrator",
3
- "version": "1.11.5",
3
+ "version": "1.12.0",
4
4
  "description": "Portable project lifecycle orchestration for configured workspaces.",
5
5
  "author": {
6
6
  "name": "lc4t"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "project-orchestrator",
4
- "version": "1.11.5",
4
+ "version": "1.12.0",
5
5
  "description": "Portable lifecycle orchestration with Case workspaces, legacy Task/Case compatibility, verified migrations, discovery and scoped Git delivery.",
6
6
  "author": {
7
7
  "name": "lc4t"