@furongjun1999/dsh-memory 0.9.14 → 0.9.16

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 (1281) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/LICENSE +21 -21
  3. package/README.md +31 -2
  4. package/codebuddy/mcp.json +27 -27
  5. package/docs//350/247/204/350/214/203/AI/347/274/226/347/250/213/351/200/232/347/224/250/350/247/204/350/214/203_/347/201/265/346/236/242/351/200/202/351/205/215.md +45 -45
  6. package/dsh/dsh-web-start.bat +17 -17
  7. package/dsh/hive-mcp-probe.mjs +94 -94
  8. package/dsh/update-lingshu.bat +11 -11
  9. package/dsh/update-lingshu.ps1 +337 -337
  10. package/hive/README.md +705 -705
  11. package/hive/id_charset_blocks.txt +147 -147
  12. package/lib/client.js +18 -0
  13. package/lib/hooks.js +29 -12
  14. package/lib/index.js +3 -44
  15. package/lib/lib/console_web.mjs +104 -0
  16. package/lib/lib/hook_audit.d.ts +15 -0
  17. package/lib/lib/hook_audit.js +28 -0
  18. package/lib/tools.d.ts +2 -2
  19. package/md_cg/__init__.py +7 -7
  20. package/md_cg/auditview.py +248 -248
  21. package/md_cg/backfill.py +1328 -1328
  22. package/md_cg/backfill_bigdomain.py +34 -34
  23. package/md_cg/backfill_bucket_zh.py +35 -35
  24. package/md_cg/bench6_arms.py +414 -414
  25. package/md_cg/bench6_common.py +230 -230
  26. package/md_cg/bench6_competitors.py +212 -212
  27. package/md_cg/bench_axis_domain.py +257 -257
  28. package/md_cg/bench_blind_comp.py +308 -308
  29. package/md_cg/bench_e2e_judge.py +534 -534
  30. package/md_cg/bench_e2e_locomo_qa.py +375 -375
  31. package/md_cg/bench_e2e_qa.py +256 -256
  32. package/md_cg/bench_en_atoms_public.py +230 -230
  33. package/md_cg/bench_governance.py +351 -351
  34. package/md_cg/bench_lme_zh.py +410 -410
  35. package/md_cg/bench_locomo.py +121 -121
  36. package/md_cg/bench_locomo_zh.py +460 -460
  37. package/md_cg/bench_locomo_zh_public.py +147 -147
  38. package/md_cg/bench_longmem.py +112 -112
  39. package/md_cg/bench_membench.py +632 -632
  40. package/md_cg/bench_p0.py +149 -149
  41. package/md_cg/bench_progressive.py +287 -287
  42. package/md_cg/bench_role_views.py +238 -238
  43. package/md_cg/bench_task_ab.py +243 -243
  44. package/md_cg/bench_task_ab_llm.py +408 -408
  45. package/md_cg/bench_unified_en.py +204 -204
  46. package/md_cg/bench_zh_mad.py +611 -611
  47. package/md_cg/blindspot_tickets.py +123 -123
  48. package/md_cg/census.py +133 -133
  49. package/md_cg/codeindex.py +531 -531
  50. package/md_cg/comment_gate.py +337 -337
  51. package/md_cg/cond_compose.py +190 -190
  52. package/md_cg/cond_facts.py +154 -154
  53. package/md_cg/cond_template.json +106 -106
  54. package/md_cg/condition_anchor.py +142 -142
  55. package/md_cg/config_registry.py +28 -0
  56. package/md_cg/config_registry_bulk.py +4 -0
  57. package/md_cg/corpus.py +110 -110
  58. package/md_cg/crosscheck.py +1098 -1098
  59. package/md_cg/d_meta.py +310 -310
  60. package/md_cg/docindex.py +496 -488
  61. package/md_cg/evolution.py +493 -493
  62. package/md_cg/freshness.py +21 -1
  63. package/md_cg/generation.py +409 -409
  64. package/md_cg/ghostref.py +130 -130
  65. package/md_cg/hotcache.py +5 -1
  66. package/md_cg/lexicon/RULES.md +32 -32
  67. package/md_cg/lexicon/build_cedict_en_zh.py +329 -329
  68. package/md_cg/lexicon/build_standard_en.py +171 -171
  69. package/md_cg/lexicon/cedict_en_zh.json +28322 -28322
  70. package/md_cg/lexicon/char_atoms_clean.json +43813 -43813
  71. package/md_cg/lexicon/expand_en_zh.py +211 -211
  72. package/md_cg/lexicon/standard_en.json +1262 -1262
  73. package/md_cg/linkref.py +280 -280
  74. package/md_cg/mcp_server.py +9 -2
  75. package/md_cg/md_whitebox.py +345 -345
  76. package/md_cg/mdcg.py +206 -15
  77. package/md_cg/mdcos.py +124 -5
  78. package/md_cg/migrate.py +119 -119
  79. package/md_cg/migrate_aeis.py +221 -221
  80. package/md_cg/migrate_roleplay.py +293 -293
  81. package/md_cg/migrate_wisdom_graph.py +360 -360
  82. package/md_cg/mreview/__init__.py +25 -25
  83. package/md_cg/mreview/__main__.py +110 -110
  84. package/md_cg/mreview/bundle.py +178 -178
  85. package/md_cg/mreview/candidates.py +262 -262
  86. package/md_cg/mreview/govern.py +694 -694
  87. package/md_cg/mreview/locate.py +939 -939
  88. package/md_cg/mreview/pipeline.py +742 -742
  89. package/md_cg/mreview/rules/duplication.json +21 -21
  90. package/md_cg/mreview/rules/field_coverage.json +54 -54
  91. package/md_cg/mreview/rules/source_license.json +21 -21
  92. package/md_cg/mreview/rules/template_flow.json +21 -21
  93. package/md_cg/mreview/ruleset.py +252 -252
  94. package/md_cg/op_table.py +3 -2
  95. package/md_cg/progressive.py +123 -123
  96. package/md_cg/protect.py +29 -6
  97. package/md_cg/protocol/md_cg_gate.proto +33 -33
  98. package/md_cg/qmd_llm.py +334 -334
  99. package/md_cg/roleviews.py +89 -89
  100. package/md_cg/security.py +68 -5
  101. package/md_cg/selfreport.py +161 -161
  102. package/md_cg/semantic/REPRODUCE.md +170 -170
  103. package/md_cg/semantic/SCHEMA.md +33 -33
  104. package/md_cg/semantic/__init__.py +10 -10
  105. package/md_cg/semantic/atoms.json +7348 -7348
  106. package/md_cg/semantic/en_normalizer.py +364 -364
  107. package/md_cg/semantic/search_index.json +6199 -6199
  108. package/md_cg/session5.py +106 -106
  109. package/md_cg/srcindex.py +352 -352
  110. package/md_cg/statushdr.py +179 -179
  111. package/md_cg/tasks.py +26 -0
  112. package/md_cg/test_access_hints.py +147 -147
  113. package/md_cg/test_audit_rotate.py +270 -270
  114. package/md_cg/test_auditview.py +277 -277
  115. package/md_cg/test_autonomy.py +143 -143
  116. package/md_cg/test_autonomy_admission.py +1098 -1098
  117. package/md_cg/test_b1_auto_id_multiproc.py +284 -284
  118. package/md_cg/test_b1_foreign_read.py +244 -244
  119. package/md_cg/test_b1b2_write_face.py +424 -424
  120. package/md_cg/test_b2_sensitivity_landing.py +223 -223
  121. package/md_cg/test_b3_merge_keeps_content.py +583 -583
  122. package/md_cg/test_b4_shard_dir_selfheal.py +880 -843
  123. package/md_cg/test_b4_shard_dir_selfheal_guard.py +249 -238
  124. package/md_cg/test_bench_governance.py +102 -102
  125. package/md_cg/test_blindspot_tickets.py +166 -166
  126. package/md_cg/test_boundary_hit.py +410 -410
  127. package/md_cg/test_branch_discard_tombstone.py +136 -136
  128. package/md_cg/test_ccg_perturb.py +184 -184
  129. package/md_cg/test_ccgc.py +458 -458
  130. package/md_cg/test_census_prune.py +81 -81
  131. package/md_cg/test_chain_read_isolate.py +168 -168
  132. package/md_cg/test_codeindex.py +338 -338
  133. package/md_cg/test_coldverify_drain.py +127 -127
  134. package/md_cg/test_comment_gate.py +187 -187
  135. package/md_cg/test_cond_compose_anchors.py +76 -76
  136. package/md_cg/test_cond_match.py +165 -165
  137. package/md_cg/test_condition_anchor.py +81 -81
  138. package/md_cg/test_config_registry.py +55 -55
  139. package/md_cg/test_config_registry_silent_fallback.py +90 -0
  140. package/md_cg/test_cons200_scan_selection.py +793 -793
  141. package/md_cg/test_corrupt_utf8_read_surfaces.py +451 -451
  142. package/md_cg/test_crypto_rotate.py +256 -256
  143. package/md_cg/test_csre_index_import_guard.py +161 -161
  144. package/md_cg/test_curiosity_budget.py +468 -468
  145. package/md_cg/test_d17_autostart_toolface.py +453 -453
  146. package/md_cg/test_d_meta.py +412 -412
  147. package/md_cg/test_datapath_root.py +199 -199
  148. package/md_cg/test_designer_token_coverage.py +184 -0
  149. package/md_cg/test_emit_negtail_cache.py +156 -156
  150. package/md_cg/test_export_default_collision.py +138 -138
  151. package/md_cg/test_gain_gate.py +223 -223
  152. package/md_cg/test_generation_guard.py +361 -361
  153. package/md_cg/test_ghostref.py +182 -182
  154. package/md_cg/test_goal_gen.py +355 -355
  155. package/md_cg/test_govern_directread.py +434 -434
  156. package/md_cg/test_health_scale.py +173 -173
  157. package/md_cg/test_heartbeat_ledger.py +563 -563
  158. package/md_cg/test_hive_ingest.py +285 -285
  159. package/md_cg/test_hot_cold.py +215 -215
  160. package/md_cg/test_hyperedge.py +245 -245
  161. package/md_cg/test_i50a_half_dup_defer.py +408 -408
  162. package/md_cg/test_i50b_defer_to_review_queue.py +545 -545
  163. package/md_cg/test_i50d_importance_source.py +531 -531
  164. package/md_cg/test_i50e_readside_protection.py +9 -3
  165. package/md_cg/test_identity_contract.py +329 -329
  166. package/md_cg/test_index_crossprocess_reload.py +316 -316
  167. package/md_cg/test_issue39_utf8_stdio.py +572 -572
  168. package/md_cg/test_issue452_ingest_root_sensitivity.py +2 -0
  169. package/md_cg/test_issue52_scan_condition_first.py +677 -677
  170. package/md_cg/test_issue53_cipher_health_hash.py +385 -385
  171. package/md_cg/test_issue659_r26_batch3.py +38 -0
  172. package/md_cg/test_issue66_scrub_semantics.py +107 -107
  173. package/md_cg/test_issue672_optional_assets.py +49 -0
  174. package/md_cg/test_issue676_session_tasks_index_first.py +74 -0
  175. package/md_cg/test_issue677_async_index_flush.py +216 -0
  176. package/md_cg/test_issue677_dedupe_gate.py +67 -0
  177. package/md_cg/test_issue678_narrowed_hint.py +60 -0
  178. package/md_cg/test_issue67_scrub_control_pool.py +233 -233
  179. package/md_cg/test_issue69_audit_boundary.py +129 -129
  180. package/md_cg/test_issue73_doc_chapter_refs.py +326 -326
  181. package/md_cg/test_issue78_export_concurrency.py +334 -334
  182. package/md_cg/test_issue80_residual_flush.py +169 -169
  183. package/md_cg/test_issue84_portability.py +95 -95
  184. package/md_cg/test_issue85_export_overwrite.py +113 -113
  185. package/md_cg/test_issue86_runtime_revoke.py +110 -110
  186. package/md_cg/test_issue87_default_sensitivity_single.py +201 -201
  187. package/md_cg/test_issue88_conclusion_face.py +280 -280
  188. package/md_cg/test_issue89_zero_score.py +169 -169
  189. package/md_cg/test_issue91_verifier_timeout.py +528 -528
  190. package/md_cg/test_issue96_key_fallback.py +102 -102
  191. package/md_cg/test_issue98_tenant_root.py +104 -104
  192. package/md_cg/test_legacy_p3_node_id_type.py +375 -375
  193. package/md_cg/test_lifecycle.py +309 -309
  194. package/md_cg/test_lifecycle_retire_leak.py +498 -498
  195. package/md_cg/test_linkref.py +320 -320
  196. package/md_cg/test_links_concurrent_write.py +188 -188
  197. package/md_cg/test_lock.py +52 -52
  198. package/md_cg/test_m3_h9_bucket_health_protect_mark.py +301 -301
  199. package/md_cg/test_m3_h9_semantic_guard.py +525 -525
  200. package/md_cg/test_md_writepath.py +345 -345
  201. package/md_cg/test_merge_upsert.py +168 -168
  202. package/md_cg/test_mode_parity.py +23 -0
  203. package/md_cg/test_mr_m2.py +615 -599
  204. package/md_cg/test_mr_m3.py +710 -710
  205. package/md_cg/test_mr_m4.py +485 -485
  206. package/md_cg/test_n131_merge_gate.py +205 -205
  207. package/md_cg/test_n139_dek_provision_failclosed.py +185 -185
  208. package/md_cg/test_n176_link_trust.py +221 -221
  209. package/md_cg/test_n178_units_jobid_gate.py +212 -212
  210. package/md_cg/test_n184_keys_concurrent_provision.py +307 -307
  211. package/md_cg/test_n195_writepath_reload.py +283 -283
  212. package/md_cg/test_n196_stale_gate_skip.py +169 -169
  213. package/md_cg/test_n197_n208_write_face_gates.py +471 -471
  214. package/md_cg/test_n198_tokens_corrupt_failclosed.py +225 -225
  215. package/md_cg/test_n199_tokens_concurrent_write.py +378 -378
  216. package/md_cg/test_n201_proposal_visibility.py +382 -382
  217. package/md_cg/test_n202_session_notes_visibility.py +461 -461
  218. package/md_cg/test_n204_n205_n226_n227_n228_n229_exit_gates.py +542 -542
  219. package/md_cg/test_n206_stdio_jsonrpc_type.py +403 -403
  220. package/md_cg/test_n212_n213_n224_generation_gates.py +519 -519
  221. package/md_cg/test_n214_n215_n221_n222_write_face_gates.py +570 -570
  222. package/md_cg/test_n225_nonobject_load.py +1110 -1110
  223. package/md_cg/test_n230_dirty_replay.py +18 -5
  224. package/md_cg/test_n238_body_text_parity.py +156 -156
  225. package/md_cg/test_n276_probe_hoist.py +199 -199
  226. package/md_cg/test_neg_condition_hits.py +333 -333
  227. package/md_cg/test_neg_coverage_budget.py +500 -500
  228. package/md_cg/test_none_id_write_guard.py +166 -166
  229. package/md_cg/test_opt_batch1_md_cg.py +451 -451
  230. package/md_cg/test_p0.py +264 -264
  231. package/md_cg/test_p1.py +316 -316
  232. package/md_cg/test_p10_identity.py +173 -173
  233. package/md_cg/test_p11_consistency.py +382 -382
  234. package/md_cg/test_p12_metacognition.py +212 -212
  235. package/md_cg/test_p13_encryption.py +241 -241
  236. package/md_cg/test_p14_root_fallback.py +373 -373
  237. package/md_cg/test_p14_sustain.py +249 -249
  238. package/md_cg/test_p15_scrub.py +280 -280
  239. package/md_cg/test_p16_self_state.py +301 -301
  240. package/md_cg/test_p17_predict.py +354 -354
  241. package/md_cg/test_p18_whitebox.py +171 -171
  242. package/md_cg/test_p19_migrate_roleplay.py +149 -149
  243. package/md_cg/test_p1x_ref_root.py +197 -197
  244. package/md_cg/test_p2.py +216 -216
  245. package/md_cg/test_p20_evolution.py +315 -315
  246. package/md_cg/test_p22_theory.py +175 -175
  247. package/md_cg/test_p23_links.py +311 -311
  248. package/md_cg/test_p25_weights.py +156 -156
  249. package/md_cg/test_p26_refindex.py +433 -433
  250. package/md_cg/test_p29_session_ingest_export.py +360 -360
  251. package/md_cg/test_p30_maintain.py +361 -361
  252. package/md_cg/test_p31_insight.py +535 -535
  253. package/md_cg/test_p34_crosscheck.py +331 -331
  254. package/md_cg/test_p35_conditioned_claim.py +252 -252
  255. package/md_cg/test_p36_kp_align.py +230 -230
  256. package/md_cg/test_p37_condition_space.py +248 -248
  257. package/md_cg/test_p38_contextualize.py +273 -273
  258. package/md_cg/test_p39_vision_evidence.py +369 -369
  259. package/md_cg/test_p41_evolve_patrol.py +224 -224
  260. package/md_cg/test_p42_provenance.py +269 -269
  261. package/md_cg/test_p44_md_whitebox.py +231 -231
  262. package/md_cg/test_p45_session_identity.py +466 -466
  263. package/md_cg/test_p46_unit_scope.py +272 -272
  264. package/md_cg/test_p4_fuzzy.py +223 -223
  265. package/md_cg/test_p5_semantic.py +226 -226
  266. package/md_cg/test_p6_consolidate.py +822 -822
  267. package/md_cg/test_p7_goals_recent.py +202 -202
  268. package/md_cg/test_p83_jsonrpc_parse_error.py +124 -124
  269. package/md_cg/test_p8_subgraph_chain.py +213 -213
  270. package/md_cg/test_p9_forget_protect.py +238 -238
  271. package/md_cg/test_preflight_failclosed.py +100 -100
  272. package/md_cg/test_progressive.py +146 -146
  273. package/md_cg/test_propose_tail_index.py +157 -157
  274. package/md_cg/test_protect_stats_parity.py +141 -0
  275. package/md_cg/test_protocol.py +272 -272
  276. package/md_cg/test_rank_parity_score_mode.py +522 -522
  277. package/md_cg/test_reach_keys.py +201 -201
  278. package/md_cg/test_read_clip.py +141 -141
  279. package/md_cg/test_read_face_input_gates.py +363 -363
  280. package/md_cg/test_read_face_semantics.py +492 -492
  281. package/md_cg/test_read_scope_b27.py +277 -277
  282. package/md_cg/test_readcache_default_on.py +168 -168
  283. package/md_cg/test_readcache_precise_inval.py +270 -270
  284. package/md_cg/test_recall_metadata.py +422 -422
  285. package/md_cg/test_reconcile_v0.py +294 -294
  286. package/md_cg/test_retr_s1.py +344 -344
  287. package/md_cg/test_retr_s1b.py +276 -276
  288. package/md_cg/test_retr_s3.py +194 -194
  289. package/md_cg/test_retr_s4.py +163 -163
  290. package/md_cg/test_retr_s6.py +157 -157
  291. package/md_cg/test_retr_s7.py +392 -392
  292. package/md_cg/test_retr_s8_time.py +369 -369
  293. package/md_cg/test_retr_s9_edges.py +286 -286
  294. package/md_cg/test_retr_score_once.py +220 -220
  295. package/md_cg/test_review_cli_attribution.py +181 -181
  296. package/md_cg/test_review_cli_visibility.py +235 -235
  297. package/md_cg/test_review_conformance.py +385 -385
  298. package/md_cg/test_review_dual_check.py +97 -0
  299. package/md_cg/test_review_onepass.py +170 -170
  300. package/md_cg/test_review_queue_batch.py +123 -123
  301. package/md_cg/test_review_queue_index.py +130 -130
  302. package/md_cg/test_role_views.py +354 -354
  303. package/md_cg/test_rrf_graph_seed_cache.py +154 -154
  304. package/md_cg/test_security_audit_v21.py +249 -249
  305. package/md_cg/test_sem_noise.py +242 -242
  306. package/md_cg/test_server_version.py +67 -67
  307. package/md_cg/test_session5_identity.py +93 -93
  308. package/md_cg/test_session_attribution_consistency.py +813 -813
  309. package/md_cg/test_session_identity_tristate.py +486 -486
  310. package/md_cg/test_session_isolation.py +168 -168
  311. package/md_cg/test_sleep.py +668 -668
  312. package/md_cg/test_sleep_gitlock.py +134 -134
  313. package/md_cg/test_snapshot_autoclose.py +187 -187
  314. package/md_cg/test_spatial_coords3d.py +292 -292
  315. package/md_cg/test_srcindex.py +171 -171
  316. package/md_cg/test_state_events.py +178 -178
  317. package/md_cg/test_state_slots.py +691 -691
  318. package/md_cg/test_subproc_encoding.py +192 -192
  319. package/md_cg/test_sustain_mutual.py +153 -153
  320. package/md_cg/test_tail_watermark_race.py +208 -208
  321. package/md_cg/test_tasks.py +409 -409
  322. package/md_cg/test_tenant_env_override_warn.py +152 -152
  323. package/md_cg/test_tenant_registry_corrupt_warn.py +151 -151
  324. package/md_cg/test_time_core_lint.py +9 -0
  325. package/md_cg/test_token_lowercase_form.py +315 -315
  326. package/md_cg/test_transfer.py +180 -180
  327. package/md_cg/test_trust.py +361 -361
  328. package/md_cg/test_twophase.py +286 -286
  329. package/md_cg/test_ui_wiring_in_repo.py +113 -0
  330. package/md_cg/test_unify_default_off.py +701 -701
  331. package/md_cg/test_unify_scope.py +182 -182
  332. package/md_cg/test_units_poll.py +71 -71
  333. package/md_cg/test_v21r1_package_version.py +310 -310
  334. package/md_cg/test_validity_filter.py +280 -280
  335. package/md_cg/test_verify_answer.py +138 -138
  336. package/md_cg/test_verify_dirty_reconcile.py +157 -157
  337. package/md_cg/test_w5_path_fingerprint.py +381 -381
  338. package/md_cg/test_wisdom_md_store.py +292 -292
  339. package/md_cg/test_writegate_tiers.py +111 -0
  340. package/md_cg/test_writelimit.py +224 -224
  341. package/md_cg/test_writepipe.py +4 -2
  342. package/md_cg/tokens.py +114 -8
  343. package/md_cg/units.py +869 -869
  344. package/md_cg/version_anchor.py +160 -160
  345. package/md_cg/vision_evidence.py +667 -667
  346. package/md_cg/whitebox_kb/__init__.py +37 -37
  347. package/md_cg/whitebox_kb/aeis_core/__init__.py +42 -42
  348. package/md_cg/whitebox_kb/aeis_core/api.py +1047 -1047
  349. package/md_cg/whitebox_kb/aeis_core/semantic.py +280 -280
  350. package/md_cg/whitebox_kb/aeis_core/textutil.py +13 -13
  351. package/md_cg/whitebox_kb/aeis_core/time_core.py +51 -51
  352. package/md_cg/whitebox_kb/engine.py +310 -310
  353. package/md_cg/whitebox_kb/seed_knowledge/__init__.py +2 -2
  354. package/md_cg/whitebox_kb/seed_knowledge/guardrail-charter.md +164 -164
  355. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/270/255/345/233/275/345/217/244/344/273/243/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  356. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/270/255/345/233/275/347/216/260/344/273/243/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  357. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/272/272/345/267/245/346/231/272/350/203/275/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +121 -121
  358. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/272/272/347/261/273/350/247/202/345/257/237/350/200/205/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +161 -161
  359. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/274/232/350/256/241/345/255/246/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  360. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/277/241/346/201/257/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +90 -90
  361. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/206/345/255/220/347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  362. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/206/346/236/220/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  363. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +241 -241
  364. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/345/216/206/345/217/262/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  365. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/345/234/260/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  366. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +241 -241
  367. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +317 -317
  368. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/347/224/237/347/211/251/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +261 -261
  369. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  370. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/350/257/255/346/226/207/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  371. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/351/201/223/345/276/267/344/270/216/346/263/225/346/262/273/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  372. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/212/250/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  373. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1194 -1194
  374. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/214/226/345/267/245/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  375. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/214/273/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +111 -111
  376. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/216/206/345/217/262/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +278 -278
  377. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/216/237/345/255/220/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  378. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/217/244/344/273/243/346/261/211/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  379. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/223/262/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +111 -111
  380. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/233/272/344/275/223/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +133 -133
  381. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/234/237/346/234/250/345/267/245/347/250/213/345/237/272/347/241/200/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  382. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/234/260/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +154 -154
  383. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/215/345/217/230/345/207/275/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  384. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/226/345/233/275/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +85 -85
  385. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +169 -169
  386. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/346/200/235/346/224/277/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  387. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +201 -201
  388. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +93 -93
  389. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/251/344/275/223/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  390. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/251/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +131 -131
  391. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/256/217/350/247/202/347/273/217/346/265/216/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  392. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/256/236/345/217/230/345/207/275/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  393. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +333 -333
  394. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/347/247/221/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1124 -1124
  395. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  396. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/350/257/255/346/226/207/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  397. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/351/201/223/345/276/267/344/270/216/346/263/225/346/262/273/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  398. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/267/245/347/250/213/345/210/266/345/233/276/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +85 -85
  399. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/267/245/347/250/213/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +362 -362
  400. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/270/202/345/234/272/350/220/245/351/224/200/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +81 -81
  401. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/270/270/345/276/256/345/210/206/346/226/271/347/250/213/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +153 -153
  402. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/276/256/345/210/206/345/207/240/344/275/225/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  403. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/276/256/347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  404. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/276/256/350/247/202/347/273/217/346/265/216/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  405. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/277/203/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +119 -119
  406. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/203/205/346/204/237/346/203/205/347/273/252/344/273/277/347/234/237/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +186 -186
  407. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/212/275/350/261/241/344/273/243/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  408. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/213/223/346/211/221/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  409. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/223/215/344/275/234/347/263/273/347/273/237/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  410. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/224/277/346/262/273/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +234 -234
  411. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/200/274/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +133 -133
  412. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/227/347/224/265/350/267/257/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  413. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1166 -1166
  414. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/246/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +217 -217
  415. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/246/347/211/251/347/220/206/346/226/271/346/263/225/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  416. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/346/215/256/345/272/223/347/263/273/347/273/237/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  417. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/346/215/256/347/273/223/346/236/204/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  418. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/226/207/345/255/246/347/220/206/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  419. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/227/240/346/234/272/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +141 -141
  420. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/227/266/347/251/272/350/256/260/345/277/206/345/233/276/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +214 -214
  421. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/231/272/350/203/275/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +350 -350
  422. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/234/211/346/234/272/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  423. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/235/220/346/226/231/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  424. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/235/241/344/273/266/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +350 -350
  425. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/244/215/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  426. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/246/202/347/216/207/350/256/272/344/270/216/346/225/260/347/220/206/347/273/237/350/256/241/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +149 -149
  427. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/250/241/346/213/237/347/224/265/345/255/220/346/212/200/346/234/257/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  428. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/263/233/345/207/275/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +125 -125
  429. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/203/255/345/212/233/345/255/246/344/270/216/347/273/237/350/256/241/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +125 -125
  430. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/211/251/347/220/206/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  431. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/211/251/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1302 -1302
  432. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/216/260/344/273/243/346/261/211/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  433. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/220/206/350/256/272/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +137 -137
  434. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/346/200/201/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +93 -93
  435. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/347/211/251/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +137 -137
  436. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1018 -1018
  437. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +93 -93
  438. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/265/345/212/250/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +125 -125
  439. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/265/350/267/257/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  440. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/244/276/344/274/232/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +111 -111
  441. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/250/213/345/272/217/350/256/276/350/256/241/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  442. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/256/227/346/263/225/350/256/276/350/256/241/344/270/216/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  443. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/256/241/347/220/206/345/255/246/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  444. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/272/277/346/200/247/344/273/243/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +133 -133
  445. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/206/350/203/236/347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +121 -121
  446. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/217/346/265/216/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +169 -169
  447. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/223/346/236/204/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  448. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/274/345/220/210/302/267/347/273/264/345/237/272/347/273/274/350/277/260.md +184 -184
  449. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/274/226/350/257/221/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  450. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/207/252/346/210/221/346/204/217/350/257/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +270 -270
  451. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/256/241/347/256/227/346/234/272/347/247/221/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +698 -698
  452. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/256/241/347/256/227/346/234/272/347/273/204/346/210/220/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  453. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/256/241/347/256/227/346/234/272/347/275/221/347/273/234/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  454. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/257/255/350/250/200/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +226 -226
  455. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/275/257/344/273/266/345/267/245/347/250/213/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  456. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/201/227/344/274/240/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  457. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/207/217/345/255/220/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +137 -137
  458. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/207/221/350/236/215/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  459. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +341 -341
  460. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/345/216/206/345/217/262/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  461. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/345/234/260/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  462. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/346/200/235/346/203/263/346/224/277/346/262/273/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  463. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +341 -341
  464. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +365 -365
  465. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/347/224/237/347/211/251/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +269 -269
  466. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  467. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/350/257/255/346/226/207/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  468. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/345/210/206/345/255/220/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  469. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/347/255/211/344/273/243/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +157 -157
  470. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/347/255/211/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +237 -237
  471. package/md_cg/whitebox_kb/seed_knowledge//346/231/272/350/203/275/350/256/2723.4.md +5260 -5260
  472. package/md_cg/whitebox_kb/wisdom/__init__.py +6 -6
  473. package/md_cg/whitebox_kb/wisdom/answer_spec_anchor.py +87 -87
  474. package/md_cg/whitebox_kb/wisdom/browser_units.py +2631 -2631
  475. package/md_cg/whitebox_kb/wisdom/card_validator.py +223 -223
  476. package/md_cg/whitebox_kb/wisdom/causal_discover.py +432 -432
  477. package/md_cg/whitebox_kb/wisdom/chat.html +185 -185
  478. package/md_cg/whitebox_kb/wisdom/code_qa.py +119 -119
  479. package/md_cg/whitebox_kb/wisdom/code_route_bridge.py +90 -90
  480. package/md_cg/whitebox_kb/wisdom/code_test_runner.py +217 -217
  481. package/md_cg/whitebox_kb/wisdom/codegraph_white.py +312 -312
  482. package/md_cg/whitebox_kb/wisdom/compiler_compose.py +160 -160
  483. package/md_cg/whitebox_kb/wisdom/condition_algebra.py +112 -112
  484. package/md_cg/whitebox_kb/wisdom/condition_frame.py +315 -315
  485. package/md_cg/whitebox_kb/wisdom/condition_kb.py +108 -108
  486. package/md_cg/whitebox_kb/wisdom/condition_vm.py +264 -264
  487. package/md_cg/whitebox_kb/wisdom/conflict_map.json +4445 -4445
  488. package/md_cg/whitebox_kb/wisdom/core/compiler.py +301 -301
  489. package/md_cg/whitebox_kb/wisdom/core/lexer.py +512 -512
  490. package/md_cg/whitebox_kb/wisdom/core/name_checker.py +1023 -1023
  491. package/md_cg/whitebox_kb/wisdom/cspmn.py +258 -258
  492. package/md_cg/whitebox_kb/wisdom/danmaku_audit.py +252 -252
  493. package/md_cg/whitebox_kb/wisdom/danmaku_bridge.py +141 -141
  494. package/md_cg/whitebox_kb/wisdom/distilled_condition_units.json +6417 -6417
  495. package/md_cg/whitebox_kb/wisdom/docs/WB-EVAL-20260902b.json +1950 -1950
  496. package/md_cg/whitebox_kb/wisdom/docs/WB-EVAL-20260902c.json +1296 -1296
  497. package/md_cg/whitebox_kb/wisdom/docs/codegraph_ref_rating.md +52 -52
  498. package/md_cg/whitebox_kb/wisdom/docs/daoti_absorb_analysis.md +54 -54
  499. package/md_cg/whitebox_kb/wisdom/docs/dsh_memory_v030_stable.md +34 -34
  500. package/md_cg/whitebox_kb/wisdom/docs/github_absorb_analysis.md +71 -71
  501. package/md_cg/whitebox_kb/wisdom/docs/gliding_horse_absorb_analysis.md +47 -47
  502. package/md_cg/whitebox_kb/wisdom/docs/whitebox_capability_graph.md +61 -61
  503. package/md_cg/whitebox_kb/wisdom/docs/whitebox_capability_graph_demo.json +59 -59
  504. package/md_cg/whitebox_kb/wisdom/docs/whitebox_code_rating_202609.md +43 -43
  505. package/md_cg/whitebox_kb/wisdom/docs//344/273/243/347/240/201/346/235/241/344/273/266/350/267/257/347/224/261/345/233/276_CCG/350/256/276/350/256/241.md +150 -150
  506. package/md_cg/whitebox_kb/wisdom/docs//344/273/243/347/240/201/350/257/255/344/271/211/346/235/241/344/273/266/345/215/217/350/256/256.md +650 -650
  507. package/md_cg/whitebox_kb/wisdom/docs//345/261/200/351/203/250/346/234/200/344/274/230/344/270/216/346/203/205/347/273/252/345/201/217/345/245/275_/347/220/206/350/256/272/345/267/245/347/250/213.md +97 -97
  508. package/md_cg/whitebox_kb/wisdom/docs//346/226/271/345/220/221/346/200/247/346/212/211/346/213/251_/350/207/252/344/270/276vs/350/207/252/350/277/255/344/273/243.md +81 -81
  509. package/md_cg/whitebox_kb/wisdom/docs//347/201/265/346/236/242AGI/346/236/266/346/236/204/346/216/242/347/264/242_/346/226/207/346/241/243/350/247/204/345/210/222.md +51 -51
  510. package/md_cg/whitebox_kb/wisdom/docs//347/201/265/346/236/242/346/217/222/344/273/266/345/210/206/347/261/273/345/210/206/346/236/220.md +67 -67
  511. package/md_cg/whitebox_kb/wisdom/docs//347/231/275/347/256/261/346/234/254/345/234/260/346/240/241/351/252/214/345/231/250_ZeroLLM_Verifier.md +276 -276
  512. package/md_cg/whitebox_kb/wisdom/docs//347/231/275/347/256/261/350/207/252/344/270/276/347/254/254/345/205/255/351/230/266/346/256/265_/346/224/266/345/256/230/346/200/273/347/273/223.md +1207 -1207
  513. package/md_cg/whitebox_kb/wisdom/ds_compose.py +177 -177
  514. package/md_cg/whitebox_kb/wisdom/graph_db_units.py +3089 -3089
  515. package/md_cg/whitebox_kb/wisdom/graph_qa.py +123 -123
  516. package/md_cg/whitebox_kb/wisdom/human_observer_knowledge.json +43 -43
  517. package/md_cg/whitebox_kb/wisdom/knowledge_points.py +318 -318
  518. package/md_cg/whitebox_kb/wisdom/md_store.py +276 -276
  519. package/md_cg/whitebox_kb/wisdom/merge_subgraph.py +178 -178
  520. package/md_cg/whitebox_kb/wisdom/neural_retrieve.py +314 -314
  521. package/md_cg/whitebox_kb/wisdom/os_units.py +2735 -2735
  522. package/md_cg/whitebox_kb/wisdom/pattern_separation.py +376 -376
  523. package/md_cg/whitebox_kb/wisdom/prereq_map.json +364 -364
  524. package/md_cg/whitebox_kb/wisdom/python_code_units.py +2766 -2766
  525. package/md_cg/whitebox_kb/wisdom/role_compose.py +268 -268
  526. package/md_cg/whitebox_kb/wisdom/role_solidified.json +7 -7
  527. package/md_cg/whitebox_kb/wisdom/route_memory.py +244 -244
  528. package/md_cg/whitebox_kb/wisdom/scene_reconstruction.py +148 -148
  529. package/md_cg/whitebox_kb/wisdom/se_compose.py +137 -137
  530. package/md_cg/whitebox_kb/wisdom/snr_dashboard.py +219 -219
  531. package/md_cg/whitebox_kb/wisdom/snr_report.json +40 -40
  532. package/md_cg/whitebox_kb/wisdom/spatial_closure.py +96 -96
  533. package/md_cg/whitebox_kb/wisdom/spatial_qa.py +182 -182
  534. package/md_cg/whitebox_kb/wisdom/status_terms.json +21 -21
  535. package/md_cg/whitebox_kb/wisdom/task_discipline.json +43 -43
  536. package/md_cg/whitebox_kb/wisdom/test_code_compose_domains.py +7541 -7541
  537. package/md_cg/whitebox_kb/wisdom/test_compiler_self_bootstrap.py +354 -354
  538. package/md_cg/whitebox_kb/wisdom/test_ecosystem_demos.py +193 -193
  539. package/md_cg/whitebox_kb/wisdom/test_graph_db.py +292 -292
  540. package/md_cg/whitebox_kb/wisdom/test_navigate_self_bootstrap.py +69 -69
  541. package/md_cg/whitebox_kb/wisdom/test_python_self_bootstrap.py +160 -160
  542. package/md_cg/whitebox_kb/wisdom/trigger_words_index.json +4366 -4366
  543. package/md_cg/whitebox_kb/wisdom/verify_answer.py +116 -116
  544. package/md_cg/whitebox_kb/wisdom/wisdom_book.py +2759 -2759
  545. package/md_cg/whitebox_kb/wisdom/wisdom_cloud.py +479 -479
  546. package/md_cg/whitebox_kb/wisdom/wisdom_ui.html +863 -863
  547. package/md_cg/writegate.py +146 -0
  548. package/md_cg/writepipe.py +85 -7
  549. package/package.json +20 -6
  550. package/scripts/workspace_index.py +1 -0
  551. package/skills/README.md +121 -121
  552. package/skills/plugin.json +54 -54
  553. package/skills/skills/designer-perspective/SKILL.md +158 -158
  554. package/skills/skills/designer-perspective/references/01-observation-position.md +66 -66
  555. package/skills/skills/designer-perspective/references/02-structure-recognition.md +62 -62
  556. package/skills/skills/designer-perspective/references/03-direction-judgment.md +55 -55
  557. package/skills/skills/designer-perspective/references/04-qualification-verdict.md +72 -72
  558. package/skills/skills/designer-perspective/references/05-condition-attribution.md +74 -74
  559. package/skills/skills/designer-perspective/scripts/designer.py +545 -545
  560. package/skills/skills/designer-perspective/tests/cases.jsonl +17 -17
  561. package/skills/skills/designer-perspective/tests/selftest.py +61 -61
  562. package/skills/skills/lingshu-browser/SKILL.md +60 -60
  563. package/skills/skills/lingshu-browser/units/browser-02898b15/SKILL.md +45 -45
  564. package/skills/skills/lingshu-browser/units/browser-03b04f98/SKILL.md +45 -45
  565. package/skills/skills/lingshu-browser/units/browser-0754386d/SKILL.md +45 -45
  566. package/skills/skills/lingshu-browser/units/browser-093c03ab/SKILL.md +45 -45
  567. package/skills/skills/lingshu-browser/units/browser-09e60b35/SKILL.md +45 -45
  568. package/skills/skills/lingshu-browser/units/browser-0ab4f2db/SKILL.md +45 -45
  569. package/skills/skills/lingshu-browser/units/browser-0c7f88d6/SKILL.md +45 -45
  570. package/skills/skills/lingshu-browser/units/browser-0f598430/SKILL.md +45 -45
  571. package/skills/skills/lingshu-browser/units/browser-0fd64fa5/SKILL.md +45 -45
  572. package/skills/skills/lingshu-browser/units/browser-17906c62/SKILL.md +45 -45
  573. package/skills/skills/lingshu-browser/units/browser-18f823e2/SKILL.md +45 -45
  574. package/skills/skills/lingshu-browser/units/browser-1bafe81c/SKILL.md +45 -45
  575. package/skills/skills/lingshu-browser/units/browser-1f9ab1f0/SKILL.md +45 -45
  576. package/skills/skills/lingshu-browser/units/browser-1fdb5852/SKILL.md +45 -45
  577. package/skills/skills/lingshu-browser/units/browser-21b0359c/SKILL.md +45 -45
  578. package/skills/skills/lingshu-browser/units/browser-22e8de36/SKILL.md +45 -45
  579. package/skills/skills/lingshu-browser/units/browser-24163519/SKILL.md +45 -45
  580. package/skills/skills/lingshu-browser/units/browser-2471a991/SKILL.md +45 -45
  581. package/skills/skills/lingshu-browser/units/browser-25afee4d/SKILL.md +45 -45
  582. package/skills/skills/lingshu-browser/units/browser-283a91bd/SKILL.md +45 -45
  583. package/skills/skills/lingshu-browser/units/browser-2895ff52/SKILL.md +45 -45
  584. package/skills/skills/lingshu-browser/units/browser-2cc1da58/SKILL.md +45 -45
  585. package/skills/skills/lingshu-browser/units/browser-3189fe6f/SKILL.md +45 -45
  586. package/skills/skills/lingshu-browser/units/browser-31f2b08f/SKILL.md +45 -45
  587. package/skills/skills/lingshu-browser/units/browser-37b8339e/SKILL.md +45 -45
  588. package/skills/skills/lingshu-browser/units/browser-396ec3a6/SKILL.md +45 -45
  589. package/skills/skills/lingshu-browser/units/browser-3df2f904/SKILL.md +45 -45
  590. package/skills/skills/lingshu-browser/units/browser-43154cec/SKILL.md +45 -45
  591. package/skills/skills/lingshu-browser/units/browser-434b74b8/SKILL.md +45 -45
  592. package/skills/skills/lingshu-browser/units/browser-440d4398/SKILL.md +45 -45
  593. package/skills/skills/lingshu-browser/units/browser-44d7f183/SKILL.md +45 -45
  594. package/skills/skills/lingshu-browser/units/browser-4d6c0788/SKILL.md +45 -45
  595. package/skills/skills/lingshu-browser/units/browser-50fecd89/SKILL.md +45 -45
  596. package/skills/skills/lingshu-browser/units/browser-555c0626/SKILL.md +45 -45
  597. package/skills/skills/lingshu-browser/units/browser-57312d24/SKILL.md +45 -45
  598. package/skills/skills/lingshu-browser/units/browser-59a0ada4/SKILL.md +45 -45
  599. package/skills/skills/lingshu-browser/units/browser-5a455aeb/SKILL.md +45 -45
  600. package/skills/skills/lingshu-browser/units/browser-5ae7623a/SKILL.md +45 -45
  601. package/skills/skills/lingshu-browser/units/browser-5dac60b6/SKILL.md +45 -45
  602. package/skills/skills/lingshu-browser/units/browser-5e5f1396/SKILL.md +45 -45
  603. package/skills/skills/lingshu-browser/units/browser-5ebb01dd/SKILL.md +45 -45
  604. package/skills/skills/lingshu-browser/units/browser-5f5453f9/SKILL.md +45 -45
  605. package/skills/skills/lingshu-browser/units/browser-5f90f58c/SKILL.md +45 -45
  606. package/skills/skills/lingshu-browser/units/browser-609362ee/SKILL.md +45 -45
  607. package/skills/skills/lingshu-browser/units/browser-60aefeeb/SKILL.md +45 -45
  608. package/skills/skills/lingshu-browser/units/browser-6636d49c/SKILL.md +45 -45
  609. package/skills/skills/lingshu-browser/units/browser-6cfcb6db/SKILL.md +45 -45
  610. package/skills/skills/lingshu-browser/units/browser-6e1c1158/SKILL.md +45 -45
  611. package/skills/skills/lingshu-browser/units/browser-7008e942/SKILL.md +45 -45
  612. package/skills/skills/lingshu-browser/units/browser-716cd26c/SKILL.md +45 -45
  613. package/skills/skills/lingshu-browser/units/browser-720ce1a1/SKILL.md +45 -45
  614. package/skills/skills/lingshu-browser/units/browser-77a97b43/SKILL.md +45 -45
  615. package/skills/skills/lingshu-browser/units/browser-7bb4871d/SKILL.md +45 -45
  616. package/skills/skills/lingshu-browser/units/browser-7be57bbe/SKILL.md +45 -45
  617. package/skills/skills/lingshu-browser/units/browser-7da433f3/SKILL.md +45 -45
  618. package/skills/skills/lingshu-browser/units/browser-7e96fe1d/SKILL.md +45 -45
  619. package/skills/skills/lingshu-browser/units/browser-7f9cefec/SKILL.md +45 -45
  620. package/skills/skills/lingshu-browser/units/browser-80224e71/SKILL.md +45 -45
  621. package/skills/skills/lingshu-browser/units/browser-81345ecd/SKILL.md +45 -45
  622. package/skills/skills/lingshu-browser/units/browser-822cfa44/SKILL.md +45 -45
  623. package/skills/skills/lingshu-browser/units/browser-853690c0/SKILL.md +45 -45
  624. package/skills/skills/lingshu-browser/units/browser-85553126/SKILL.md +45 -45
  625. package/skills/skills/lingshu-browser/units/browser-87b0ce80/SKILL.md +45 -45
  626. package/skills/skills/lingshu-browser/units/browser-900c4484/SKILL.md +45 -45
  627. package/skills/skills/lingshu-browser/units/browser-910405c4/SKILL.md +45 -45
  628. package/skills/skills/lingshu-browser/units/browser-95fd3c86/SKILL.md +45 -45
  629. package/skills/skills/lingshu-browser/units/browser-97a14ca3/SKILL.md +45 -45
  630. package/skills/skills/lingshu-browser/units/browser-9de10895/SKILL.md +45 -45
  631. package/skills/skills/lingshu-browser/units/browser-9e4914a7/SKILL.md +45 -45
  632. package/skills/skills/lingshu-browser/units/browser-a280ec64/SKILL.md +45 -45
  633. package/skills/skills/lingshu-browser/units/browser-a2d9b0b0/SKILL.md +45 -45
  634. package/skills/skills/lingshu-browser/units/browser-a372edeb/SKILL.md +45 -45
  635. package/skills/skills/lingshu-browser/units/browser-a4c793a4/SKILL.md +45 -45
  636. package/skills/skills/lingshu-browser/units/browser-a681d0c2/SKILL.md +45 -45
  637. package/skills/skills/lingshu-browser/units/browser-a7a2b0c1/SKILL.md +45 -45
  638. package/skills/skills/lingshu-browser/units/browser-a990e68e/SKILL.md +45 -45
  639. package/skills/skills/lingshu-browser/units/browser-aaac4eec/SKILL.md +45 -45
  640. package/skills/skills/lingshu-browser/units/browser-ae6586bb/SKILL.md +45 -45
  641. package/skills/skills/lingshu-browser/units/browser-afa4091f/SKILL.md +45 -45
  642. package/skills/skills/lingshu-browser/units/browser-b4c8cf65/SKILL.md +45 -45
  643. package/skills/skills/lingshu-browser/units/browser-b501767c/SKILL.md +45 -45
  644. package/skills/skills/lingshu-browser/units/browser-bcd4288d/SKILL.md +45 -45
  645. package/skills/skills/lingshu-browser/units/browser-bfad66a5/SKILL.md +45 -45
  646. package/skills/skills/lingshu-browser/units/browser-c45cbfe9/SKILL.md +45 -45
  647. package/skills/skills/lingshu-browser/units/browser-c4dd6078/SKILL.md +45 -45
  648. package/skills/skills/lingshu-browser/units/browser-c879eb0b/SKILL.md +45 -45
  649. package/skills/skills/lingshu-browser/units/browser-c92ac01b/SKILL.md +45 -45
  650. package/skills/skills/lingshu-browser/units/browser-cb179242/SKILL.md +45 -45
  651. package/skills/skills/lingshu-browser/units/browser-cc7d3d6d/SKILL.md +45 -45
  652. package/skills/skills/lingshu-browser/units/browser-cf3c47f0/SKILL.md +45 -45
  653. package/skills/skills/lingshu-browser/units/browser-cf9f812e/SKILL.md +45 -45
  654. package/skills/skills/lingshu-browser/units/browser-d462581c/SKILL.md +45 -45
  655. package/skills/skills/lingshu-browser/units/browser-d5fa0b7f/SKILL.md +45 -45
  656. package/skills/skills/lingshu-browser/units/browser-d72e225b/SKILL.md +45 -45
  657. package/skills/skills/lingshu-browser/units/browser-df1a919e/SKILL.md +45 -45
  658. package/skills/skills/lingshu-browser/units/browser-e84565c1/SKILL.md +45 -45
  659. package/skills/skills/lingshu-browser/units/browser-e947a564/SKILL.md +45 -45
  660. package/skills/skills/lingshu-browser/units/browser-ea9b2b8e/SKILL.md +45 -45
  661. package/skills/skills/lingshu-browser/units/browser-f5ffc6d9/SKILL.md +45 -45
  662. package/skills/skills/lingshu-browser/units/browser-f75a4418/SKILL.md +45 -45
  663. package/skills/skills/lingshu-browser/units/browser-f8f2966e/SKILL.md +45 -45
  664. package/skills/skills/lingshu-browser/units/browser-fa65fa2d/SKILL.md +45 -45
  665. package/skills/skills/lingshu-browser/units/browser-faac8812/SKILL.md +45 -45
  666. package/skills/skills/lingshu-browser/units/browser-ff94a671/SKILL.md +45 -45
  667. package/skills/skills/lingshu-compiler/SKILL.md +56 -56
  668. package/skills/skills/lingshu-compiler/units/analyze-type-infer/SKILL.md +45 -45
  669. package/skills/skills/lingshu-compiler/units/check-name-real/SKILL.md +45 -45
  670. package/skills/skills/lingshu-compiler/units/compile-assign/SKILL.md +45 -45
  671. package/skills/skills/lingshu-compiler/units/compile-expr-tree/SKILL.md +45 -45
  672. package/skills/skills/lingshu-compiler/units/compile-full-pipeline/SKILL.md +45 -45
  673. package/skills/skills/lingshu-compiler/units/compile-func-def/SKILL.md +45 -45
  674. package/skills/skills/lingshu-compiler/units/compile-if-then/SKILL.md +45 -45
  675. package/skills/skills/lingshu-compiler/units/compile-logic-expr/SKILL.md +45 -45
  676. package/skills/skills/lingshu-compiler/units/compile-recursive/SKILL.md +45 -45
  677. package/skills/skills/lingshu-compiler/units/compile-scope/SKILL.md +45 -45
  678. package/skills/skills/lingshu-compiler/units/compile-type-check/SKILL.md +45 -45
  679. package/skills/skills/lingshu-compiler/units/compile-while/SKILL.md +45 -45
  680. package/skills/skills/lingshu-compiler/units/compiler-0010c4bf/SKILL.md +45 -45
  681. package/skills/skills/lingshu-compiler/units/compiler-0355bffb/SKILL.md +45 -45
  682. package/skills/skills/lingshu-compiler/units/compiler-0361708a/SKILL.md +45 -45
  683. package/skills/skills/lingshu-compiler/units/compiler-054a0414/SKILL.md +45 -45
  684. package/skills/skills/lingshu-compiler/units/compiler-05a1691a/SKILL.md +45 -45
  685. package/skills/skills/lingshu-compiler/units/compiler-05eeed1e/SKILL.md +45 -45
  686. package/skills/skills/lingshu-compiler/units/compiler-0622a1f6/SKILL.md +45 -45
  687. package/skills/skills/lingshu-compiler/units/compiler-08b54217/SKILL.md +45 -45
  688. package/skills/skills/lingshu-compiler/units/compiler-0a62b70c/SKILL.md +45 -45
  689. package/skills/skills/lingshu-compiler/units/compiler-0ab24d00/SKILL.md +45 -45
  690. package/skills/skills/lingshu-compiler/units/compiler-0e093688/SKILL.md +45 -45
  691. package/skills/skills/lingshu-compiler/units/compiler-0e82b966/SKILL.md +45 -45
  692. package/skills/skills/lingshu-compiler/units/compiler-0ee9b9b9/SKILL.md +45 -45
  693. package/skills/skills/lingshu-compiler/units/compiler-0f3787e6/SKILL.md +45 -45
  694. package/skills/skills/lingshu-compiler/units/compiler-1028685f/SKILL.md +45 -45
  695. package/skills/skills/lingshu-compiler/units/compiler-11897630/SKILL.md +45 -45
  696. package/skills/skills/lingshu-compiler/units/compiler-16661b9b/SKILL.md +45 -45
  697. package/skills/skills/lingshu-compiler/units/compiler-1f722303/SKILL.md +45 -45
  698. package/skills/skills/lingshu-compiler/units/compiler-25be1262/SKILL.md +45 -45
  699. package/skills/skills/lingshu-compiler/units/compiler-2a76ba07/SKILL.md +45 -45
  700. package/skills/skills/lingshu-compiler/units/compiler-2dbea54a/SKILL.md +45 -45
  701. package/skills/skills/lingshu-compiler/units/compiler-2df52f16/SKILL.md +45 -45
  702. package/skills/skills/lingshu-compiler/units/compiler-2ec2c9d2/SKILL.md +45 -45
  703. package/skills/skills/lingshu-compiler/units/compiler-2f8c8f39/SKILL.md +45 -45
  704. package/skills/skills/lingshu-compiler/units/compiler-38378ac7/SKILL.md +45 -45
  705. package/skills/skills/lingshu-compiler/units/compiler-39457d2e/SKILL.md +45 -45
  706. package/skills/skills/lingshu-compiler/units/compiler-39fb5926/SKILL.md +45 -45
  707. package/skills/skills/lingshu-compiler/units/compiler-47f4fbfa/SKILL.md +45 -45
  708. package/skills/skills/lingshu-compiler/units/compiler-4a8cd1f1/SKILL.md +45 -45
  709. package/skills/skills/lingshu-compiler/units/compiler-4b230b6b/SKILL.md +45 -45
  710. package/skills/skills/lingshu-compiler/units/compiler-4cbbda95/SKILL.md +45 -45
  711. package/skills/skills/lingshu-compiler/units/compiler-4d5a68ff/SKILL.md +45 -45
  712. package/skills/skills/lingshu-compiler/units/compiler-56dc9bdd/SKILL.md +45 -45
  713. package/skills/skills/lingshu-compiler/units/compiler-57e76ebe/SKILL.md +45 -45
  714. package/skills/skills/lingshu-compiler/units/compiler-61ff016b/SKILL.md +45 -45
  715. package/skills/skills/lingshu-compiler/units/compiler-63eae588/SKILL.md +45 -45
  716. package/skills/skills/lingshu-compiler/units/compiler-64c4224b/SKILL.md +45 -45
  717. package/skills/skills/lingshu-compiler/units/compiler-66377955/SKILL.md +45 -45
  718. package/skills/skills/lingshu-compiler/units/compiler-674ab4f6/SKILL.md +45 -45
  719. package/skills/skills/lingshu-compiler/units/compiler-6af76fd6/SKILL.md +45 -45
  720. package/skills/skills/lingshu-compiler/units/compiler-6d979db2/SKILL.md +45 -45
  721. package/skills/skills/lingshu-compiler/units/compiler-6de326c0/SKILL.md +45 -45
  722. package/skills/skills/lingshu-compiler/units/compiler-6f1c0eea/SKILL.md +45 -45
  723. package/skills/skills/lingshu-compiler/units/compiler-724d6c9b/SKILL.md +45 -45
  724. package/skills/skills/lingshu-compiler/units/compiler-7690177f/SKILL.md +45 -45
  725. package/skills/skills/lingshu-compiler/units/compiler-7b229a7d/SKILL.md +45 -45
  726. package/skills/skills/lingshu-compiler/units/compiler-7f471b3a/SKILL.md +45 -45
  727. package/skills/skills/lingshu-compiler/units/compiler-815cad08/SKILL.md +45 -45
  728. package/skills/skills/lingshu-compiler/units/compiler-83c61634/SKILL.md +45 -45
  729. package/skills/skills/lingshu-compiler/units/compiler-8c798c81/SKILL.md +45 -45
  730. package/skills/skills/lingshu-compiler/units/compiler-8dd747ac/SKILL.md +45 -45
  731. package/skills/skills/lingshu-compiler/units/compiler-90324d0a/SKILL.md +45 -45
  732. package/skills/skills/lingshu-compiler/units/compiler-94b8d72d/SKILL.md +45 -45
  733. package/skills/skills/lingshu-compiler/units/compiler-94f12231/SKILL.md +45 -45
  734. package/skills/skills/lingshu-compiler/units/compiler-95937c16/SKILL.md +45 -45
  735. package/skills/skills/lingshu-compiler/units/compiler-98a5625b/SKILL.md +45 -45
  736. package/skills/skills/lingshu-compiler/units/compiler-98b4c42f/SKILL.md +45 -45
  737. package/skills/skills/lingshu-compiler/units/compiler-98e3894a/SKILL.md +45 -45
  738. package/skills/skills/lingshu-compiler/units/compiler-9bdfe4b8/SKILL.md +45 -45
  739. package/skills/skills/lingshu-compiler/units/compiler-9d9b4e83/SKILL.md +45 -45
  740. package/skills/skills/lingshu-compiler/units/compiler-9f7be5ad/SKILL.md +45 -45
  741. package/skills/skills/lingshu-compiler/units/compiler-a6daf076/SKILL.md +45 -45
  742. package/skills/skills/lingshu-compiler/units/compiler-a7995a0c/SKILL.md +45 -45
  743. package/skills/skills/lingshu-compiler/units/compiler-a8399248/SKILL.md +45 -45
  744. package/skills/skills/lingshu-compiler/units/compiler-aabbd099/SKILL.md +45 -45
  745. package/skills/skills/lingshu-compiler/units/compiler-afe169d8/SKILL.md +45 -45
  746. package/skills/skills/lingshu-compiler/units/compiler-b0678bda/SKILL.md +45 -45
  747. package/skills/skills/lingshu-compiler/units/compiler-b09bd196/SKILL.md +45 -45
  748. package/skills/skills/lingshu-compiler/units/compiler-b1396e23/SKILL.md +45 -45
  749. package/skills/skills/lingshu-compiler/units/compiler-b9b31ce0/SKILL.md +45 -45
  750. package/skills/skills/lingshu-compiler/units/compiler-c10264a7/SKILL.md +45 -45
  751. package/skills/skills/lingshu-compiler/units/compiler-cb1e8e4b/SKILL.md +45 -45
  752. package/skills/skills/lingshu-compiler/units/compiler-ccafd438/SKILL.md +45 -45
  753. package/skills/skills/lingshu-compiler/units/compiler-cda9c262/SKILL.md +45 -45
  754. package/skills/skills/lingshu-compiler/units/compiler-ce648068/SKILL.md +45 -45
  755. package/skills/skills/lingshu-compiler/units/compiler-cf5776a4/SKILL.md +45 -45
  756. package/skills/skills/lingshu-compiler/units/compiler-d974e5d3/SKILL.md +45 -45
  757. package/skills/skills/lingshu-compiler/units/compiler-e3979fd3/SKILL.md +45 -45
  758. package/skills/skills/lingshu-compiler/units/compiler-eb1cf2b5/SKILL.md +45 -45
  759. package/skills/skills/lingshu-compiler/units/compiler-ecb30d5b/SKILL.md +45 -45
  760. package/skills/skills/lingshu-compiler/units/compiler-f8c8b24b/SKILL.md +45 -45
  761. package/skills/skills/lingshu-compiler/units/compiler-f99fedbe/SKILL.md +45 -45
  762. package/skills/skills/lingshu-compiler/units/compiler-fa8ff5f7/SKILL.md +45 -45
  763. package/skills/skills/lingshu-compiler/units/compiler-fe1b058d/SKILL.md +45 -45
  764. package/skills/skills/lingshu-compiler/units/lex-chinese-program/SKILL.md +45 -45
  765. package/skills/skills/lingshu-compiler/units/lex-dao-de-jing/SKILL.md +45 -45
  766. package/skills/skills/lingshu-compiler/units/lex-nine-chapters/SKILL.md +45 -45
  767. package/skills/skills/lingshu-compiler/units/vm-arithmetic/SKILL.md +45 -45
  768. package/skills/skills/lingshu-compiler/units/vm-array-ops/SKILL.md +45 -45
  769. package/skills/skills/lingshu-compiler/units/vm-closure-call/SKILL.md +45 -45
  770. package/skills/skills/lingshu-compiler/units/vm-closure-create/SKILL.md +45 -45
  771. package/skills/skills/lingshu-compiler/units/vm-compare/SKILL.md +45 -45
  772. package/skills/skills/lingshu-compiler/units/vm-cond-jump/SKILL.md +45 -45
  773. package/skills/skills/lingshu-compiler/units/vm-cond-space/SKILL.md +45 -45
  774. package/skills/skills/lingshu-compiler/units/vm-exception/SKILL.md +45 -45
  775. package/skills/skills/lingshu-compiler/units/vm-func-call/SKILL.md +45 -45
  776. package/skills/skills/lingshu-compiler/units/vm-loop-run/SKILL.md +45 -45
  777. package/skills/skills/lingshu-compiler/units/vm-profiling/SKILL.md +45 -45
  778. package/skills/skills/lingshu-compiler/units/vm-refcount/SKILL.md +45 -45
  779. package/skills/skills/lingshu-compiler/units/vm-run-loop/SKILL.md +45 -45
  780. package/skills/skills/lingshu-compiler/units/vm-short-circuit/SKILL.md +45 -45
  781. package/skills/skills/lingshu-compiler/units/vm-stack-guard/SKILL.md +45 -45
  782. package/skills/skills/lingshu-compiler/units/vm-stack-ops/SKILL.md +45 -45
  783. package/skills/skills/lingshu-compiler/units/vm-trust-accum/SKILL.md +45 -45
  784. package/skills/skills/lingshu-graph/SKILL.md +63 -63
  785. package/skills/skills/lingshu-graph/units/graph-04cd431b/SKILL.md +45 -45
  786. package/skills/skills/lingshu-graph/units/graph-06e2b1f2/SKILL.md +45 -45
  787. package/skills/skills/lingshu-graph/units/graph-0de12477/SKILL.md +45 -45
  788. package/skills/skills/lingshu-graph/units/graph-0e564e68/SKILL.md +45 -45
  789. package/skills/skills/lingshu-graph/units/graph-10d58a7b/SKILL.md +45 -45
  790. package/skills/skills/lingshu-graph/units/graph-12cd830a/SKILL.md +45 -45
  791. package/skills/skills/lingshu-graph/units/graph-185f2cd2/SKILL.md +45 -45
  792. package/skills/skills/lingshu-graph/units/graph-19a6a301/SKILL.md +45 -45
  793. package/skills/skills/lingshu-graph/units/graph-1b266557/SKILL.md +45 -45
  794. package/skills/skills/lingshu-graph/units/graph-1b707621/SKILL.md +45 -45
  795. package/skills/skills/lingshu-graph/units/graph-1d73b597/SKILL.md +45 -45
  796. package/skills/skills/lingshu-graph/units/graph-2041fa98/SKILL.md +45 -45
  797. package/skills/skills/lingshu-graph/units/graph-2461bc41/SKILL.md +45 -45
  798. package/skills/skills/lingshu-graph/units/graph-2465dff8/SKILL.md +45 -45
  799. package/skills/skills/lingshu-graph/units/graph-2508389f/SKILL.md +45 -45
  800. package/skills/skills/lingshu-graph/units/graph-276d554d/SKILL.md +45 -45
  801. package/skills/skills/lingshu-graph/units/graph-299f4a32/SKILL.md +45 -45
  802. package/skills/skills/lingshu-graph/units/graph-2d455cd8/SKILL.md +45 -45
  803. package/skills/skills/lingshu-graph/units/graph-2fddf701/SKILL.md +45 -45
  804. package/skills/skills/lingshu-graph/units/graph-33385442/SKILL.md +45 -45
  805. package/skills/skills/lingshu-graph/units/graph-34a1dba7/SKILL.md +45 -45
  806. package/skills/skills/lingshu-graph/units/graph-3721be1c/SKILL.md +45 -45
  807. package/skills/skills/lingshu-graph/units/graph-3755dbc9/SKILL.md +45 -45
  808. package/skills/skills/lingshu-graph/units/graph-37a45d4b/SKILL.md +45 -45
  809. package/skills/skills/lingshu-graph/units/graph-3a4a984c/SKILL.md +45 -45
  810. package/skills/skills/lingshu-graph/units/graph-3aa4c941/SKILL.md +45 -45
  811. package/skills/skills/lingshu-graph/units/graph-3b69a528/SKILL.md +45 -45
  812. package/skills/skills/lingshu-graph/units/graph-3bc2eb69/SKILL.md +45 -45
  813. package/skills/skills/lingshu-graph/units/graph-3d255ed4/SKILL.md +45 -45
  814. package/skills/skills/lingshu-graph/units/graph-3d34961d/SKILL.md +45 -45
  815. package/skills/skills/lingshu-graph/units/graph-3e18a380/SKILL.md +45 -45
  816. package/skills/skills/lingshu-graph/units/graph-3f920bf3/SKILL.md +45 -45
  817. package/skills/skills/lingshu-graph/units/graph-40b7bf61/SKILL.md +45 -45
  818. package/skills/skills/lingshu-graph/units/graph-42187d5d/SKILL.md +45 -45
  819. package/skills/skills/lingshu-graph/units/graph-4361c60e/SKILL.md +45 -45
  820. package/skills/skills/lingshu-graph/units/graph-44e56113/SKILL.md +45 -45
  821. package/skills/skills/lingshu-graph/units/graph-4b363727/SKILL.md +45 -45
  822. package/skills/skills/lingshu-graph/units/graph-52e6e216/SKILL.md +45 -45
  823. package/skills/skills/lingshu-graph/units/graph-53fbfef5/SKILL.md +45 -45
  824. package/skills/skills/lingshu-graph/units/graph-54ac2988/SKILL.md +45 -45
  825. package/skills/skills/lingshu-graph/units/graph-580dadcd/SKILL.md +45 -45
  826. package/skills/skills/lingshu-graph/units/graph-5ca34baa/SKILL.md +45 -45
  827. package/skills/skills/lingshu-graph/units/graph-5cb7fbdf/SKILL.md +45 -45
  828. package/skills/skills/lingshu-graph/units/graph-5f894c05/SKILL.md +45 -45
  829. package/skills/skills/lingshu-graph/units/graph-656e7bd4/SKILL.md +45 -45
  830. package/skills/skills/lingshu-graph/units/graph-6dc48231/SKILL.md +45 -45
  831. package/skills/skills/lingshu-graph/units/graph-7186924a/SKILL.md +45 -45
  832. package/skills/skills/lingshu-graph/units/graph-72ce5342/SKILL.md +45 -45
  833. package/skills/skills/lingshu-graph/units/graph-7376a24e/SKILL.md +45 -45
  834. package/skills/skills/lingshu-graph/units/graph-7412a7cb/SKILL.md +45 -45
  835. package/skills/skills/lingshu-graph/units/graph-7becedf0/SKILL.md +45 -45
  836. package/skills/skills/lingshu-graph/units/graph-7c38fbf3/SKILL.md +45 -45
  837. package/skills/skills/lingshu-graph/units/graph-7dc36de7/SKILL.md +45 -45
  838. package/skills/skills/lingshu-graph/units/graph-7fe49de7/SKILL.md +45 -45
  839. package/skills/skills/lingshu-graph/units/graph-80d82194/SKILL.md +45 -45
  840. package/skills/skills/lingshu-graph/units/graph-85bf101e/SKILL.md +45 -45
  841. package/skills/skills/lingshu-graph/units/graph-8650548b/SKILL.md +45 -45
  842. package/skills/skills/lingshu-graph/units/graph-86583b09/SKILL.md +45 -45
  843. package/skills/skills/lingshu-graph/units/graph-8727827c/SKILL.md +45 -45
  844. package/skills/skills/lingshu-graph/units/graph-873fb505/SKILL.md +45 -45
  845. package/skills/skills/lingshu-graph/units/graph-89b11de0/SKILL.md +45 -45
  846. package/skills/skills/lingshu-graph/units/graph-8d7b569b/SKILL.md +45 -45
  847. package/skills/skills/lingshu-graph/units/graph-8e920d5d/SKILL.md +45 -45
  848. package/skills/skills/lingshu-graph/units/graph-8eb38e3d/SKILL.md +45 -45
  849. package/skills/skills/lingshu-graph/units/graph-94582f69/SKILL.md +45 -45
  850. package/skills/skills/lingshu-graph/units/graph-947355f7/SKILL.md +45 -45
  851. package/skills/skills/lingshu-graph/units/graph-9507aff7/SKILL.md +45 -45
  852. package/skills/skills/lingshu-graph/units/graph-95b86a8b/SKILL.md +45 -45
  853. package/skills/skills/lingshu-graph/units/graph-96b85e1f/SKILL.md +45 -45
  854. package/skills/skills/lingshu-graph/units/graph-97b22f09/SKILL.md +45 -45
  855. package/skills/skills/lingshu-graph/units/graph-9833cfda/SKILL.md +45 -45
  856. package/skills/skills/lingshu-graph/units/graph-9aa8a3f4/SKILL.md +45 -45
  857. package/skills/skills/lingshu-graph/units/graph-9f6665c0/SKILL.md +45 -45
  858. package/skills/skills/lingshu-graph/units/graph-a125d282/SKILL.md +45 -45
  859. package/skills/skills/lingshu-graph/units/graph-a49ef4f0/SKILL.md +45 -45
  860. package/skills/skills/lingshu-graph/units/graph-a5cd04ae/SKILL.md +45 -45
  861. package/skills/skills/lingshu-graph/units/graph-add9a63b/SKILL.md +45 -45
  862. package/skills/skills/lingshu-graph/units/graph-b00e3dc7/SKILL.md +45 -45
  863. package/skills/skills/lingshu-graph/units/graph-b33a7662/SKILL.md +45 -45
  864. package/skills/skills/lingshu-graph/units/graph-b76d15ee/SKILL.md +45 -45
  865. package/skills/skills/lingshu-graph/units/graph-b77fa05a/SKILL.md +45 -45
  866. package/skills/skills/lingshu-graph/units/graph-b912fc3b/SKILL.md +45 -45
  867. package/skills/skills/lingshu-graph/units/graph-baf61b7c/SKILL.md +45 -45
  868. package/skills/skills/lingshu-graph/units/graph-c1d5687b/SKILL.md +45 -45
  869. package/skills/skills/lingshu-graph/units/graph-c407bbed/SKILL.md +45 -45
  870. package/skills/skills/lingshu-graph/units/graph-c4676460/SKILL.md +45 -45
  871. package/skills/skills/lingshu-graph/units/graph-c4a59d80/SKILL.md +45 -45
  872. package/skills/skills/lingshu-graph/units/graph-c5815621/SKILL.md +45 -45
  873. package/skills/skills/lingshu-graph/units/graph-ccad55f1/SKILL.md +45 -45
  874. package/skills/skills/lingshu-graph/units/graph-d0677ce1/SKILL.md +45 -45
  875. package/skills/skills/lingshu-graph/units/graph-d1289b39/SKILL.md +45 -45
  876. package/skills/skills/lingshu-graph/units/graph-d15f39b1/SKILL.md +45 -45
  877. package/skills/skills/lingshu-graph/units/graph-d40691ca/SKILL.md +45 -45
  878. package/skills/skills/lingshu-graph/units/graph-d43b387a/SKILL.md +45 -45
  879. package/skills/skills/lingshu-graph/units/graph-d4dd02f4/SKILL.md +45 -45
  880. package/skills/skills/lingshu-graph/units/graph-d724ea18/SKILL.md +45 -45
  881. package/skills/skills/lingshu-graph/units/graph-d74d36fd/SKILL.md +45 -45
  882. package/skills/skills/lingshu-graph/units/graph-d9d3934c/SKILL.md +45 -45
  883. package/skills/skills/lingshu-graph/units/graph-ddf563ff/SKILL.md +45 -45
  884. package/skills/skills/lingshu-graph/units/graph-de00894f/SKILL.md +45 -45
  885. package/skills/skills/lingshu-graph/units/graph-df1ebb63/SKILL.md +45 -45
  886. package/skills/skills/lingshu-graph/units/graph-e2905c20/SKILL.md +45 -45
  887. package/skills/skills/lingshu-graph/units/graph-e4f8cefd/SKILL.md +45 -45
  888. package/skills/skills/lingshu-graph/units/graph-ea3150e7/SKILL.md +45 -45
  889. package/skills/skills/lingshu-graph/units/graph-eb4ac7dd/SKILL.md +45 -45
  890. package/skills/skills/lingshu-graph/units/graph-ee9f6dfa/SKILL.md +45 -45
  891. package/skills/skills/lingshu-graph/units/graph-f055b2ea/SKILL.md +45 -45
  892. package/skills/skills/lingshu-graph/units/graph-f1891287/SKILL.md +45 -45
  893. package/skills/skills/lingshu-graph/units/graph-f1bb5aa1/SKILL.md +45 -45
  894. package/skills/skills/lingshu-graph/units/graph-f56fa220/SKILL.md +45 -45
  895. package/skills/skills/lingshu-graph/units/graph-f729034f/SKILL.md +45 -45
  896. package/skills/skills/lingshu-graph/units/graph-f748a63f/SKILL.md +45 -45
  897. package/skills/skills/lingshu-graph/units/graph-f8c4a59e/SKILL.md +45 -45
  898. package/skills/skills/lingshu-graph/units/graph-fca3d129/SKILL.md +45 -45
  899. package/skills/skills/lingshu-graph/units/graph-fd02d934/SKILL.md +45 -45
  900. package/skills/skills/lingshu-graph/units/graph-fd51ece9/SKILL.md +45 -45
  901. package/skills/skills/lingshu-graph/units/graph-fd6a81ab/SKILL.md +45 -45
  902. package/skills/skills/lingshu-net/SKILL.md +48 -48
  903. package/skills/skills/lingshu-net/units/net-02090d29/SKILL.md +45 -45
  904. package/skills/skills/lingshu-net/units/net-05937712/SKILL.md +45 -45
  905. package/skills/skills/lingshu-net/units/net-059d072f/SKILL.md +45 -45
  906. package/skills/skills/lingshu-net/units/net-080f6012/SKILL.md +45 -45
  907. package/skills/skills/lingshu-net/units/net-08a2fc88/SKILL.md +45 -45
  908. package/skills/skills/lingshu-net/units/net-0935edf1/SKILL.md +45 -45
  909. package/skills/skills/lingshu-net/units/net-0e7f91e4/SKILL.md +45 -45
  910. package/skills/skills/lingshu-net/units/net-0f2850e0/SKILL.md +45 -45
  911. package/skills/skills/lingshu-net/units/net-107ab486/SKILL.md +45 -45
  912. package/skills/skills/lingshu-net/units/net-111e79b0/SKILL.md +45 -45
  913. package/skills/skills/lingshu-net/units/net-126876c1/SKILL.md +45 -45
  914. package/skills/skills/lingshu-net/units/net-13eeb575/SKILL.md +45 -45
  915. package/skills/skills/lingshu-net/units/net-14102d54/SKILL.md +45 -45
  916. package/skills/skills/lingshu-net/units/net-14e9ad0d/SKILL.md +45 -45
  917. package/skills/skills/lingshu-net/units/net-184175d3/SKILL.md +45 -45
  918. package/skills/skills/lingshu-net/units/net-1da1c695/SKILL.md +45 -45
  919. package/skills/skills/lingshu-net/units/net-240a14ec/SKILL.md +45 -45
  920. package/skills/skills/lingshu-net/units/net-2784f98b/SKILL.md +45 -45
  921. package/skills/skills/lingshu-net/units/net-292ef917/SKILL.md +45 -45
  922. package/skills/skills/lingshu-net/units/net-3434e92f/SKILL.md +45 -45
  923. package/skills/skills/lingshu-net/units/net-35019e6b/SKILL.md +45 -45
  924. package/skills/skills/lingshu-net/units/net-3bbc6afb/SKILL.md +45 -45
  925. package/skills/skills/lingshu-net/units/net-3bdf9d9d/SKILL.md +45 -45
  926. package/skills/skills/lingshu-net/units/net-3dcb84d3/SKILL.md +45 -45
  927. package/skills/skills/lingshu-net/units/net-431cccf9/SKILL.md +45 -45
  928. package/skills/skills/lingshu-net/units/net-435a9f7f/SKILL.md +45 -45
  929. package/skills/skills/lingshu-net/units/net-4508101f/SKILL.md +45 -45
  930. package/skills/skills/lingshu-net/units/net-4585c9e7/SKILL.md +45 -45
  931. package/skills/skills/lingshu-net/units/net-479612a0/SKILL.md +45 -45
  932. package/skills/skills/lingshu-net/units/net-47a19838/SKILL.md +45 -45
  933. package/skills/skills/lingshu-net/units/net-4e36e1e3/SKILL.md +45 -45
  934. package/skills/skills/lingshu-net/units/net-509b8001/SKILL.md +45 -45
  935. package/skills/skills/lingshu-net/units/net-51930c5e/SKILL.md +45 -45
  936. package/skills/skills/lingshu-net/units/net-56dbd63f/SKILL.md +45 -45
  937. package/skills/skills/lingshu-net/units/net-57387462/SKILL.md +45 -45
  938. package/skills/skills/lingshu-net/units/net-5c115606/SKILL.md +45 -45
  939. package/skills/skills/lingshu-net/units/net-5d27f392/SKILL.md +45 -45
  940. package/skills/skills/lingshu-net/units/net-5f69c938/SKILL.md +45 -45
  941. package/skills/skills/lingshu-net/units/net-5fa6c13b/SKILL.md +45 -45
  942. package/skills/skills/lingshu-net/units/net-61580202/SKILL.md +45 -45
  943. package/skills/skills/lingshu-net/units/net-61926703/SKILL.md +45 -45
  944. package/skills/skills/lingshu-net/units/net-61f64fbc/SKILL.md +45 -45
  945. package/skills/skills/lingshu-net/units/net-6200f3b2/SKILL.md +45 -45
  946. package/skills/skills/lingshu-net/units/net-63c3eda3/SKILL.md +45 -45
  947. package/skills/skills/lingshu-net/units/net-66e6119b/SKILL.md +45 -45
  948. package/skills/skills/lingshu-net/units/net-68643014/SKILL.md +45 -45
  949. package/skills/skills/lingshu-net/units/net-686632aa/SKILL.md +45 -45
  950. package/skills/skills/lingshu-net/units/net-6967ff14/SKILL.md +45 -45
  951. package/skills/skills/lingshu-net/units/net-6996f499/SKILL.md +45 -45
  952. package/skills/skills/lingshu-net/units/net-6c3b02c2/SKILL.md +45 -45
  953. package/skills/skills/lingshu-net/units/net-6eb37f63/SKILL.md +45 -45
  954. package/skills/skills/lingshu-net/units/net-6f96c190/SKILL.md +45 -45
  955. package/skills/skills/lingshu-net/units/net-6fb27488/SKILL.md +45 -45
  956. package/skills/skills/lingshu-net/units/net-703559d0/SKILL.md +45 -45
  957. package/skills/skills/lingshu-net/units/net-706d2692/SKILL.md +45 -45
  958. package/skills/skills/lingshu-net/units/net-70a20e04/SKILL.md +45 -45
  959. package/skills/skills/lingshu-net/units/net-7376158c/SKILL.md +45 -45
  960. package/skills/skills/lingshu-net/units/net-74d647cb/SKILL.md +45 -45
  961. package/skills/skills/lingshu-net/units/net-74e8a576/SKILL.md +45 -45
  962. package/skills/skills/lingshu-net/units/net-7801c2c0/SKILL.md +45 -45
  963. package/skills/skills/lingshu-net/units/net-78cae54d/SKILL.md +45 -45
  964. package/skills/skills/lingshu-net/units/net-78ec0324/SKILL.md +45 -45
  965. package/skills/skills/lingshu-net/units/net-7998097c/SKILL.md +45 -45
  966. package/skills/skills/lingshu-net/units/net-7d81ae06/SKILL.md +45 -45
  967. package/skills/skills/lingshu-net/units/net-7eabbbc8/SKILL.md +45 -45
  968. package/skills/skills/lingshu-net/units/net-7ed4f2c5/SKILL.md +45 -45
  969. package/skills/skills/lingshu-net/units/net-80b56cd6/SKILL.md +45 -45
  970. package/skills/skills/lingshu-net/units/net-83447546/SKILL.md +45 -45
  971. package/skills/skills/lingshu-net/units/net-8361fe5b/SKILL.md +45 -45
  972. package/skills/skills/lingshu-net/units/net-85e3996c/SKILL.md +45 -45
  973. package/skills/skills/lingshu-net/units/net-8897d5cc/SKILL.md +45 -45
  974. package/skills/skills/lingshu-net/units/net-88ad93a6/SKILL.md +45 -45
  975. package/skills/skills/lingshu-net/units/net-8e6f359e/SKILL.md +45 -45
  976. package/skills/skills/lingshu-net/units/net-8edc4cdb/SKILL.md +45 -45
  977. package/skills/skills/lingshu-net/units/net-8f6169e9/SKILL.md +45 -45
  978. package/skills/skills/lingshu-net/units/net-91e00638/SKILL.md +45 -45
  979. package/skills/skills/lingshu-net/units/net-96c61a3c/SKILL.md +45 -45
  980. package/skills/skills/lingshu-net/units/net-99076a29/SKILL.md +45 -45
  981. package/skills/skills/lingshu-net/units/net-998f3641/SKILL.md +45 -45
  982. package/skills/skills/lingshu-net/units/net-a1d7228a/SKILL.md +45 -45
  983. package/skills/skills/lingshu-net/units/net-a74da501/SKILL.md +45 -45
  984. package/skills/skills/lingshu-net/units/net-ac57deb7/SKILL.md +45 -45
  985. package/skills/skills/lingshu-net/units/net-b22d2f2b/SKILL.md +45 -45
  986. package/skills/skills/lingshu-net/units/net-b2b29d8d/SKILL.md +45 -45
  987. package/skills/skills/lingshu-net/units/net-b2ddce5d/SKILL.md +45 -45
  988. package/skills/skills/lingshu-net/units/net-b4151e9a/SKILL.md +45 -45
  989. package/skills/skills/lingshu-net/units/net-b873d6f7/SKILL.md +45 -45
  990. package/skills/skills/lingshu-net/units/net-bd3d2d55/SKILL.md +45 -45
  991. package/skills/skills/lingshu-net/units/net-c2a3f019/SKILL.md +45 -45
  992. package/skills/skills/lingshu-net/units/net-c685b788/SKILL.md +45 -45
  993. package/skills/skills/lingshu-net/units/net-c6c1fd79/SKILL.md +45 -45
  994. package/skills/skills/lingshu-net/units/net-c74a1b5d/SKILL.md +45 -45
  995. package/skills/skills/lingshu-net/units/net-cdac702d/SKILL.md +45 -45
  996. package/skills/skills/lingshu-net/units/net-d12dff5c/SKILL.md +45 -45
  997. package/skills/skills/lingshu-net/units/net-d3747882/SKILL.md +45 -45
  998. package/skills/skills/lingshu-net/units/net-d5fefa59/SKILL.md +45 -45
  999. package/skills/skills/lingshu-net/units/net-d67ec725/SKILL.md +45 -45
  1000. package/skills/skills/lingshu-net/units/net-d80c1c4c/SKILL.md +45 -45
  1001. package/skills/skills/lingshu-net/units/net-d9cb43b0/SKILL.md +45 -45
  1002. package/skills/skills/lingshu-net/units/net-da559517/SKILL.md +45 -45
  1003. package/skills/skills/lingshu-net/units/net-db4f414e/SKILL.md +45 -45
  1004. package/skills/skills/lingshu-net/units/net-dc09d67c/SKILL.md +45 -45
  1005. package/skills/skills/lingshu-net/units/net-e2d185de/SKILL.md +45 -45
  1006. package/skills/skills/lingshu-net/units/net-e2fc73f8/SKILL.md +45 -45
  1007. package/skills/skills/lingshu-net/units/net-e33ef0c2/SKILL.md +45 -45
  1008. package/skills/skills/lingshu-net/units/net-e346863c/SKILL.md +45 -45
  1009. package/skills/skills/lingshu-net/units/net-e6b3389a/SKILL.md +45 -45
  1010. package/skills/skills/lingshu-net/units/net-e9758fc0/SKILL.md +45 -45
  1011. package/skills/skills/lingshu-net/units/net-e9a9747a/SKILL.md +45 -45
  1012. package/skills/skills/lingshu-net/units/net-ea14aab8/SKILL.md +45 -45
  1013. package/skills/skills/lingshu-net/units/net-eba92ac1/SKILL.md +45 -45
  1014. package/skills/skills/lingshu-net/units/net-f29d91d2/SKILL.md +45 -45
  1015. package/skills/skills/lingshu-net/units/net-f314dd0d/SKILL.md +45 -45
  1016. package/skills/skills/lingshu-net/units/net-f332b629/SKILL.md +45 -45
  1017. package/skills/skills/lingshu-net/units/net-f7df127c/SKILL.md +45 -45
  1018. package/skills/skills/lingshu-net/units/net-fb9d8f5d/SKILL.md +45 -45
  1019. package/skills/skills/lingshu-net/units/net-fdec2c86/SKILL.md +45 -45
  1020. package/skills/skills/lingshu-os/SKILL.md +64 -64
  1021. package/skills/skills/lingshu-os/units/os-0205cf9b/SKILL.md +45 -45
  1022. package/skills/skills/lingshu-os/units/os-027dc9be/SKILL.md +45 -45
  1023. package/skills/skills/lingshu-os/units/os-03c0d7d6/SKILL.md +45 -45
  1024. package/skills/skills/lingshu-os/units/os-040b5505/SKILL.md +45 -45
  1025. package/skills/skills/lingshu-os/units/os-06fa98ed/SKILL.md +45 -45
  1026. package/skills/skills/lingshu-os/units/os-0854291c/SKILL.md +45 -45
  1027. package/skills/skills/lingshu-os/units/os-0c7f14cb/SKILL.md +45 -45
  1028. package/skills/skills/lingshu-os/units/os-0d855af2/SKILL.md +45 -45
  1029. package/skills/skills/lingshu-os/units/os-0e87e997/SKILL.md +45 -45
  1030. package/skills/skills/lingshu-os/units/os-0f8ed882/SKILL.md +45 -45
  1031. package/skills/skills/lingshu-os/units/os-111ce1de/SKILL.md +45 -45
  1032. package/skills/skills/lingshu-os/units/os-1234eb00/SKILL.md +45 -45
  1033. package/skills/skills/lingshu-os/units/os-128f3820/SKILL.md +45 -45
  1034. package/skills/skills/lingshu-os/units/os-15796db5/SKILL.md +45 -45
  1035. package/skills/skills/lingshu-os/units/os-1898928a/SKILL.md +45 -45
  1036. package/skills/skills/lingshu-os/units/os-192b8ca9/SKILL.md +45 -45
  1037. package/skills/skills/lingshu-os/units/os-1d3bcf28/SKILL.md +45 -45
  1038. package/skills/skills/lingshu-os/units/os-1f224514/SKILL.md +45 -45
  1039. package/skills/skills/lingshu-os/units/os-26a4f86a/SKILL.md +45 -45
  1040. package/skills/skills/lingshu-os/units/os-29c96147/SKILL.md +45 -45
  1041. package/skills/skills/lingshu-os/units/os-2ea9a5ff/SKILL.md +45 -45
  1042. package/skills/skills/lingshu-os/units/os-300ef22c/SKILL.md +45 -45
  1043. package/skills/skills/lingshu-os/units/os-310dda5b/SKILL.md +45 -45
  1044. package/skills/skills/lingshu-os/units/os-313ef4ed/SKILL.md +45 -45
  1045. package/skills/skills/lingshu-os/units/os-329a2147/SKILL.md +45 -45
  1046. package/skills/skills/lingshu-os/units/os-34ad4b62/SKILL.md +45 -45
  1047. package/skills/skills/lingshu-os/units/os-350bc623/SKILL.md +45 -45
  1048. package/skills/skills/lingshu-os/units/os-35ee1a30/SKILL.md +45 -45
  1049. package/skills/skills/lingshu-os/units/os-3cd28220/SKILL.md +45 -45
  1050. package/skills/skills/lingshu-os/units/os-3d84e0c9/SKILL.md +45 -45
  1051. package/skills/skills/lingshu-os/units/os-3db42aac/SKILL.md +45 -45
  1052. package/skills/skills/lingshu-os/units/os-3e0aff42/SKILL.md +45 -45
  1053. package/skills/skills/lingshu-os/units/os-3e9405d2/SKILL.md +45 -45
  1054. package/skills/skills/lingshu-os/units/os-41d14544/SKILL.md +45 -45
  1055. package/skills/skills/lingshu-os/units/os-462f3ed4/SKILL.md +45 -45
  1056. package/skills/skills/lingshu-os/units/os-485833fa/SKILL.md +45 -45
  1057. package/skills/skills/lingshu-os/units/os-4a1cf781/SKILL.md +45 -45
  1058. package/skills/skills/lingshu-os/units/os-4bf77933/SKILL.md +45 -45
  1059. package/skills/skills/lingshu-os/units/os-4c14cec2/SKILL.md +45 -45
  1060. package/skills/skills/lingshu-os/units/os-4f05d577/SKILL.md +45 -45
  1061. package/skills/skills/lingshu-os/units/os-4f50ad0b/SKILL.md +45 -45
  1062. package/skills/skills/lingshu-os/units/os-509a4596/SKILL.md +45 -45
  1063. package/skills/skills/lingshu-os/units/os-512b1b6c/SKILL.md +45 -45
  1064. package/skills/skills/lingshu-os/units/os-5192621b/SKILL.md +45 -45
  1065. package/skills/skills/lingshu-os/units/os-55672763/SKILL.md +45 -45
  1066. package/skills/skills/lingshu-os/units/os-5582bce6/SKILL.md +45 -45
  1067. package/skills/skills/lingshu-os/units/os-5a096a1f/SKILL.md +45 -45
  1068. package/skills/skills/lingshu-os/units/os-5ca15108/SKILL.md +45 -45
  1069. package/skills/skills/lingshu-os/units/os-601663e1/SKILL.md +45 -45
  1070. package/skills/skills/lingshu-os/units/os-607f1963/SKILL.md +45 -45
  1071. package/skills/skills/lingshu-os/units/os-6158581b/SKILL.md +45 -45
  1072. package/skills/skills/lingshu-os/units/os-62f9278b/SKILL.md +45 -45
  1073. package/skills/skills/lingshu-os/units/os-63797b86/SKILL.md +45 -45
  1074. package/skills/skills/lingshu-os/units/os-6a1fe224/SKILL.md +45 -45
  1075. package/skills/skills/lingshu-os/units/os-6b0a68bf/SKILL.md +45 -45
  1076. package/skills/skills/lingshu-os/units/os-6e5cee67/SKILL.md +45 -45
  1077. package/skills/skills/lingshu-os/units/os-6fb1ff58/SKILL.md +45 -45
  1078. package/skills/skills/lingshu-os/units/os-71389592/SKILL.md +45 -45
  1079. package/skills/skills/lingshu-os/units/os-72e879a3/SKILL.md +45 -45
  1080. package/skills/skills/lingshu-os/units/os-7598748a/SKILL.md +45 -45
  1081. package/skills/skills/lingshu-os/units/os-80cc3283/SKILL.md +45 -45
  1082. package/skills/skills/lingshu-os/units/os-819f3093/SKILL.md +45 -45
  1083. package/skills/skills/lingshu-os/units/os-83670c2b/SKILL.md +45 -45
  1084. package/skills/skills/lingshu-os/units/os-878c18b3/SKILL.md +45 -45
  1085. package/skills/skills/lingshu-os/units/os-89ed7af1/SKILL.md +45 -45
  1086. package/skills/skills/lingshu-os/units/os-8cb7279d/SKILL.md +45 -45
  1087. package/skills/skills/lingshu-os/units/os-92276145/SKILL.md +45 -45
  1088. package/skills/skills/lingshu-os/units/os-955c4d66/SKILL.md +45 -45
  1089. package/skills/skills/lingshu-os/units/os-97aacf40/SKILL.md +45 -45
  1090. package/skills/skills/lingshu-os/units/os-9b6ed02c/SKILL.md +45 -45
  1091. package/skills/skills/lingshu-os/units/os-9c86a7a2/SKILL.md +45 -45
  1092. package/skills/skills/lingshu-os/units/os-a13ce4aa/SKILL.md +45 -45
  1093. package/skills/skills/lingshu-os/units/os-a568affe/SKILL.md +45 -45
  1094. package/skills/skills/lingshu-os/units/os-abd48f17/SKILL.md +45 -45
  1095. package/skills/skills/lingshu-os/units/os-b0416edc/SKILL.md +45 -45
  1096. package/skills/skills/lingshu-os/units/os-b6509cac/SKILL.md +45 -45
  1097. package/skills/skills/lingshu-os/units/os-b718657b/SKILL.md +45 -45
  1098. package/skills/skills/lingshu-os/units/os-b776ade1/SKILL.md +45 -45
  1099. package/skills/skills/lingshu-os/units/os-ba24fa08/SKILL.md +45 -45
  1100. package/skills/skills/lingshu-os/units/os-bd1fc177/SKILL.md +45 -45
  1101. package/skills/skills/lingshu-os/units/os-bda92711/SKILL.md +45 -45
  1102. package/skills/skills/lingshu-os/units/os-c0fa71bd/SKILL.md +45 -45
  1103. package/skills/skills/lingshu-os/units/os-c3d5cd44/SKILL.md +45 -45
  1104. package/skills/skills/lingshu-os/units/os-c6b6a763/SKILL.md +45 -45
  1105. package/skills/skills/lingshu-os/units/os-c7661eb1/SKILL.md +45 -45
  1106. package/skills/skills/lingshu-os/units/os-c76b5a43/SKILL.md +45 -45
  1107. package/skills/skills/lingshu-os/units/os-c7d35a30/SKILL.md +45 -45
  1108. package/skills/skills/lingshu-os/units/os-c980a25d/SKILL.md +45 -45
  1109. package/skills/skills/lingshu-os/units/os-c9f8df6e/SKILL.md +45 -45
  1110. package/skills/skills/lingshu-os/units/os-cc49ef2f/SKILL.md +45 -45
  1111. package/skills/skills/lingshu-os/units/os-cd9e686a/SKILL.md +45 -45
  1112. package/skills/skills/lingshu-os/units/os-cfa66a1b/SKILL.md +45 -45
  1113. package/skills/skills/lingshu-os/units/os-d237e500/SKILL.md +45 -45
  1114. package/skills/skills/lingshu-os/units/os-d39ef086/SKILL.md +45 -45
  1115. package/skills/skills/lingshu-os/units/os-d4f9e813/SKILL.md +45 -45
  1116. package/skills/skills/lingshu-os/units/os-d97915c0/SKILL.md +45 -45
  1117. package/skills/skills/lingshu-os/units/os-da0aadde/SKILL.md +45 -45
  1118. package/skills/skills/lingshu-os/units/os-da482caf/SKILL.md +45 -45
  1119. package/skills/skills/lingshu-os/units/os-dd4ff45e/SKILL.md +45 -45
  1120. package/skills/skills/lingshu-os/units/os-de0556c5/SKILL.md +45 -45
  1121. package/skills/skills/lingshu-os/units/os-e0ad3364/SKILL.md +45 -45
  1122. package/skills/skills/lingshu-os/units/os-e7612c68/SKILL.md +45 -45
  1123. package/skills/skills/lingshu-os/units/os-ea444e45/SKILL.md +45 -45
  1124. package/skills/skills/lingshu-os/units/os-ea6e7e0b/SKILL.md +45 -45
  1125. package/skills/skills/lingshu-os/units/os-ebc34d83/SKILL.md +45 -45
  1126. package/skills/skills/lingshu-os/units/os-ecbebbe3/SKILL.md +45 -45
  1127. package/skills/skills/lingshu-os/units/os-ecfceae7/SKILL.md +45 -45
  1128. package/skills/skills/lingshu-os/units/os-ed8de3a3/SKILL.md +45 -45
  1129. package/skills/skills/lingshu-os/units/os-f69c0b08/SKILL.md +45 -45
  1130. package/skills/skills/lingshu-os/units/os-f6ae6205/SKILL.md +45 -45
  1131. package/skills/skills/lingshu-os/units/os-f9bf8dd4/SKILL.md +45 -45
  1132. package/skills/skills/lingshu-os/units/os-fcdd828d/SKILL.md +45 -45
  1133. package/skills/skills/lingshu-pylang/SKILL.md +71 -71
  1134. package/skills/skills/lingshu-pylang/units/pylang-01b23f80/SKILL.md +45 -45
  1135. package/skills/skills/lingshu-pylang/units/pylang-074fd698/SKILL.md +45 -45
  1136. package/skills/skills/lingshu-pylang/units/pylang-0b490bb2/SKILL.md +45 -45
  1137. package/skills/skills/lingshu-pylang/units/pylang-0ca7f08b/SKILL.md +45 -45
  1138. package/skills/skills/lingshu-pylang/units/pylang-10ce3e91/SKILL.md +45 -45
  1139. package/skills/skills/lingshu-pylang/units/pylang-15f76c64/SKILL.md +45 -45
  1140. package/skills/skills/lingshu-pylang/units/pylang-1703046f/SKILL.md +45 -45
  1141. package/skills/skills/lingshu-pylang/units/pylang-1aa3e939/SKILL.md +45 -45
  1142. package/skills/skills/lingshu-pylang/units/pylang-1bed54cf/SKILL.md +45 -45
  1143. package/skills/skills/lingshu-pylang/units/pylang-1dd35612/SKILL.md +45 -45
  1144. package/skills/skills/lingshu-pylang/units/pylang-24273d7b/SKILL.md +45 -45
  1145. package/skills/skills/lingshu-pylang/units/pylang-2853f59f/SKILL.md +45 -45
  1146. package/skills/skills/lingshu-pylang/units/pylang-2a6bc16e/SKILL.md +45 -45
  1147. package/skills/skills/lingshu-pylang/units/pylang-2ae78997/SKILL.md +45 -45
  1148. package/skills/skills/lingshu-pylang/units/pylang-2bc88f4c/SKILL.md +45 -45
  1149. package/skills/skills/lingshu-pylang/units/pylang-31f5b8db/SKILL.md +45 -45
  1150. package/skills/skills/lingshu-pylang/units/pylang-36d178bc/SKILL.md +45 -45
  1151. package/skills/skills/lingshu-pylang/units/pylang-38600583/SKILL.md +45 -45
  1152. package/skills/skills/lingshu-pylang/units/pylang-38e8f9ff/SKILL.md +45 -45
  1153. package/skills/skills/lingshu-pylang/units/pylang-395085ca/SKILL.md +45 -45
  1154. package/skills/skills/lingshu-pylang/units/pylang-399b317e/SKILL.md +45 -45
  1155. package/skills/skills/lingshu-pylang/units/pylang-39c72c78/SKILL.md +45 -45
  1156. package/skills/skills/lingshu-pylang/units/pylang-3a659480/SKILL.md +45 -45
  1157. package/skills/skills/lingshu-pylang/units/pylang-482be62b/SKILL.md +45 -45
  1158. package/skills/skills/lingshu-pylang/units/pylang-486a1e94/SKILL.md +45 -45
  1159. package/skills/skills/lingshu-pylang/units/pylang-49026041/SKILL.md +45 -45
  1160. package/skills/skills/lingshu-pylang/units/pylang-4963b28a/SKILL.md +45 -45
  1161. package/skills/skills/lingshu-pylang/units/pylang-4af9140e/SKILL.md +45 -45
  1162. package/skills/skills/lingshu-pylang/units/pylang-4ca283f2/SKILL.md +45 -45
  1163. package/skills/skills/lingshu-pylang/units/pylang-4ddf31f3/SKILL.md +45 -45
  1164. package/skills/skills/lingshu-pylang/units/pylang-50614726/SKILL.md +45 -45
  1165. package/skills/skills/lingshu-pylang/units/pylang-5102c069/SKILL.md +45 -45
  1166. package/skills/skills/lingshu-pylang/units/pylang-521b1bf8/SKILL.md +45 -45
  1167. package/skills/skills/lingshu-pylang/units/pylang-5880b7a1/SKILL.md +45 -45
  1168. package/skills/skills/lingshu-pylang/units/pylang-61a9102d/SKILL.md +45 -45
  1169. package/skills/skills/lingshu-pylang/units/pylang-621123dd/SKILL.md +45 -45
  1170. package/skills/skills/lingshu-pylang/units/pylang-642cd625/SKILL.md +45 -45
  1171. package/skills/skills/lingshu-pylang/units/pylang-65ca79b7/SKILL.md +45 -45
  1172. package/skills/skills/lingshu-pylang/units/pylang-672df225/SKILL.md +45 -45
  1173. package/skills/skills/lingshu-pylang/units/pylang-67d3368e/SKILL.md +45 -45
  1174. package/skills/skills/lingshu-pylang/units/pylang-6be54340/SKILL.md +45 -45
  1175. package/skills/skills/lingshu-pylang/units/pylang-70b2006f/SKILL.md +45 -45
  1176. package/skills/skills/lingshu-pylang/units/pylang-70b215f1/SKILL.md +45 -45
  1177. package/skills/skills/lingshu-pylang/units/pylang-730c3fe4/SKILL.md +45 -45
  1178. package/skills/skills/lingshu-pylang/units/pylang-733c1286/SKILL.md +45 -45
  1179. package/skills/skills/lingshu-pylang/units/pylang-79845f4d/SKILL.md +45 -45
  1180. package/skills/skills/lingshu-pylang/units/pylang-7c4cc6f8/SKILL.md +45 -45
  1181. package/skills/skills/lingshu-pylang/units/pylang-7c7193ad/SKILL.md +45 -45
  1182. package/skills/skills/lingshu-pylang/units/pylang-7d86ab5d/SKILL.md +45 -45
  1183. package/skills/skills/lingshu-pylang/units/pylang-7df8ca78/SKILL.md +45 -45
  1184. package/skills/skills/lingshu-pylang/units/pylang-8182681d/SKILL.md +45 -45
  1185. package/skills/skills/lingshu-pylang/units/pylang-81ad40ee/SKILL.md +45 -45
  1186. package/skills/skills/lingshu-pylang/units/pylang-8283d7c0/SKILL.md +45 -45
  1187. package/skills/skills/lingshu-pylang/units/pylang-82b73f3d/SKILL.md +45 -45
  1188. package/skills/skills/lingshu-pylang/units/pylang-8404bbde/SKILL.md +45 -45
  1189. package/skills/skills/lingshu-pylang/units/pylang-8584040d/SKILL.md +45 -45
  1190. package/skills/skills/lingshu-pylang/units/pylang-85d8617b/SKILL.md +45 -45
  1191. package/skills/skills/lingshu-pylang/units/pylang-886935a3/SKILL.md +45 -45
  1192. package/skills/skills/lingshu-pylang/units/pylang-88ab2f96/SKILL.md +45 -45
  1193. package/skills/skills/lingshu-pylang/units/pylang-8b6f071e/SKILL.md +45 -45
  1194. package/skills/skills/lingshu-pylang/units/pylang-8d6ec58a/SKILL.md +45 -45
  1195. package/skills/skills/lingshu-pylang/units/pylang-8fe98252/SKILL.md +45 -45
  1196. package/skills/skills/lingshu-pylang/units/pylang-9018c39a/SKILL.md +45 -45
  1197. package/skills/skills/lingshu-pylang/units/pylang-91277748/SKILL.md +45 -45
  1198. package/skills/skills/lingshu-pylang/units/pylang-943b9dcb/SKILL.md +45 -45
  1199. package/skills/skills/lingshu-pylang/units/pylang-961e9e43/SKILL.md +45 -45
  1200. package/skills/skills/lingshu-pylang/units/pylang-962954d9/SKILL.md +45 -45
  1201. package/skills/skills/lingshu-pylang/units/pylang-9dbd8e2b/SKILL.md +45 -45
  1202. package/skills/skills/lingshu-pylang/units/pylang-a02eac31/SKILL.md +45 -45
  1203. package/skills/skills/lingshu-pylang/units/pylang-a4d3d7b1/SKILL.md +45 -45
  1204. package/skills/skills/lingshu-pylang/units/pylang-a7c3d0e2/SKILL.md +45 -45
  1205. package/skills/skills/lingshu-pylang/units/pylang-a88db70d/SKILL.md +45 -45
  1206. package/skills/skills/lingshu-pylang/units/pylang-ab7dddc2/SKILL.md +45 -45
  1207. package/skills/skills/lingshu-pylang/units/pylang-ac2a4b38/SKILL.md +45 -45
  1208. package/skills/skills/lingshu-pylang/units/pylang-afaf67c0/SKILL.md +45 -45
  1209. package/skills/skills/lingshu-pylang/units/pylang-b00660e6/SKILL.md +45 -45
  1210. package/skills/skills/lingshu-pylang/units/pylang-b4d7616d/SKILL.md +45 -45
  1211. package/skills/skills/lingshu-pylang/units/pylang-b67b1878/SKILL.md +45 -45
  1212. package/skills/skills/lingshu-pylang/units/pylang-b8040e1c/SKILL.md +45 -45
  1213. package/skills/skills/lingshu-pylang/units/pylang-b880c6c6/SKILL.md +45 -45
  1214. package/skills/skills/lingshu-pylang/units/pylang-b8d45f76/SKILL.md +45 -45
  1215. package/skills/skills/lingshu-pylang/units/pylang-ba956e52/SKILL.md +45 -45
  1216. package/skills/skills/lingshu-pylang/units/pylang-bb18b1f9/SKILL.md +45 -45
  1217. package/skills/skills/lingshu-pylang/units/pylang-bb46f3f2/SKILL.md +45 -45
  1218. package/skills/skills/lingshu-pylang/units/pylang-be55a094/SKILL.md +45 -45
  1219. package/skills/skills/lingshu-pylang/units/pylang-beb47b63/SKILL.md +45 -45
  1220. package/skills/skills/lingshu-pylang/units/pylang-c017681a/SKILL.md +45 -45
  1221. package/skills/skills/lingshu-pylang/units/pylang-c1317cd9/SKILL.md +45 -45
  1222. package/skills/skills/lingshu-pylang/units/pylang-c36fabf7/SKILL.md +45 -45
  1223. package/skills/skills/lingshu-pylang/units/pylang-c42465ec/SKILL.md +45 -45
  1224. package/skills/skills/lingshu-pylang/units/pylang-c5c76a12/SKILL.md +45 -45
  1225. package/skills/skills/lingshu-pylang/units/pylang-c910ad31/SKILL.md +45 -45
  1226. package/skills/skills/lingshu-pylang/units/pylang-ca9332cf/SKILL.md +45 -45
  1227. package/skills/skills/lingshu-pylang/units/pylang-cce90fa0/SKILL.md +45 -45
  1228. package/skills/skills/lingshu-pylang/units/pylang-cd4234a5/SKILL.md +45 -45
  1229. package/skills/skills/lingshu-pylang/units/pylang-cf0fca1c/SKILL.md +45 -45
  1230. package/skills/skills/lingshu-pylang/units/pylang-d2001e1f/SKILL.md +45 -45
  1231. package/skills/skills/lingshu-pylang/units/pylang-d616eb28/SKILL.md +45 -45
  1232. package/skills/skills/lingshu-pylang/units/pylang-d8962e66/SKILL.md +45 -45
  1233. package/skills/skills/lingshu-pylang/units/pylang-db6214cd/SKILL.md +45 -45
  1234. package/skills/skills/lingshu-pylang/units/pylang-dcde3040/SKILL.md +45 -45
  1235. package/skills/skills/lingshu-pylang/units/pylang-dfad3dba/SKILL.md +45 -45
  1236. package/skills/skills/lingshu-pylang/units/pylang-dfd5aac2/SKILL.md +45 -45
  1237. package/skills/skills/lingshu-pylang/units/pylang-e1aa3818/SKILL.md +45 -45
  1238. package/skills/skills/lingshu-pylang/units/pylang-e476915b/SKILL.md +45 -45
  1239. package/skills/skills/lingshu-pylang/units/pylang-e88e31fd/SKILL.md +45 -45
  1240. package/skills/skills/lingshu-pylang/units/pylang-ecd569d2/SKILL.md +45 -45
  1241. package/skills/skills/lingshu-pylang/units/pylang-ecf27e0c/SKILL.md +45 -45
  1242. package/skills/skills/lingshu-pylang/units/pylang-f124f0e6/SKILL.md +45 -45
  1243. package/skills/skills/lingshu-pylang/units/pylang-f127a8d1/SKILL.md +45 -45
  1244. package/skills/skills/lingshu-pylang/units/pylang-f2d6ec27/SKILL.md +45 -45
  1245. package/skills/skills/lingshu-pylang/units/pylang-f2f40090/SKILL.md +45 -45
  1246. package/skills/skills/lingshu-pylang/units/pylang-f4aa9e65/SKILL.md +45 -45
  1247. package/skills/skills/lingshu-pylang/units/pylang-f4f820d4/SKILL.md +45 -45
  1248. package/skills/skills/lingshu-pylang/units/pylang-f5b34833/SKILL.md +45 -45
  1249. package/skills/skills/lingshu-pylang/units/pylang-f6ebb66e/SKILL.md +45 -45
  1250. package/skills/skills/lingshu-pylang/units/pylang-f78bdcd7/SKILL.md +45 -45
  1251. package/skills/skills/lingshu-pylang/units/pylang-f92bc49b/SKILL.md +45 -45
  1252. package/skills/skills/lingshu-pylang/units/pylang-fd7595f0/SKILL.md +45 -45
  1253. package/skills/skills/lingshu-pylang/units/pylang-fda87aa1/SKILL.md +45 -45
  1254. package/src/hooks.ts +26 -12
  1255. package/src/index.ts +3 -0
  1256. package/src/lib/console_web.mjs +104 -0
  1257. package/src/lib/hook_audit.ts +34 -1
  1258. package/src/lib/python_path.ts +71 -71
  1259. package/src/lib/session_state.ts +127 -127
  1260. package/src/lib/whitebox_llm.ts +311 -311
  1261. package/ui/minimal/LICENSE +21 -0
  1262. package/ui/minimal/install.ps1 +168 -0
  1263. package/ui/minimal/integrity.json +41 -0
  1264. package/ui/minimal/payload/build-ui.mjs +16 -0
  1265. package/ui/minimal/payload/lib/client.js +18 -0
  1266. package/ui/minimal/payload/lib/lib/console_web.mjs +104 -0
  1267. package/ui/minimal/payload/src/lib/console_web.mjs +104 -0
  1268. package/ui/minimal/payload/web/app.js +154 -0
  1269. package/ui/minimal/payload/web/client.js +14 -0
  1270. package/ui/minimal/payload/web/entry.js +1 -0
  1271. package/ui/minimal/payload/web/index.html +3 -0
  1272. package/ui/minimal/payload/web/style.css +3 -0
  1273. package/ui/minimal//344/275/277/347/224/250/350/257/264/346/230/216.md +60 -0
  1274. package/ui/minimal//345/215/270/350/275/275UI.cmd +6 -0
  1275. package/ui/minimal//345/256/211/350/243/205UI.cmd +6 -0
  1276. package/utf8_boot.py +237 -237
  1277. package/web/app.js +154 -0
  1278. package/web/client.js +14 -0
  1279. package/web/entry.js +1 -0
  1280. package/web/index.html +3 -0
  1281. package/web/style.css +3 -0
@@ -1,1099 +1,1099 @@
1
- # -*- coding: utf-8 -*-
2
- """批量核对(P34/P35):工单 → 反思候选 → 白箱闸门 → 验证否决 → 来源执照 → 落库。
3
-
4
- 设计约束(与计划一致):
5
-
6
- * **不新增 MCP op**:本模块是「模块 + `_cli`」形态(同 `backfill.py`),子代理经
7
- `python -m md_cg.crosscheck …` 调用;令牌决定权限边界。
8
- * **防自证**:反思单元(`reflect`)与验证单元(`verify`)必须为**不同执行者**;
9
- 验证单元**只能否决、不能新增**候选(越界字段在白箱闸门直接丢弃)。
10
- * **来源执照**:文科(`humanities`)只接受来源一致性档(`textbook`/`public_kb`);
11
- 理科(`science`)只接受可复现档(`compiler`/`test`/`measurement`/`formal_proof`/`data`);
12
- 赛道未定(`undetermined`)或无来源一律不写,保持 DEFER 并登记待补。
13
- * **诚实边界**:占位空壳节点(`骨架锚点`/`内容待填充`)不进接线,转待填充工单;
14
- 拿不出证据的节点绝不写 `verification_basis`。
15
- * **留痕可回滚**:写入前记录 `_crosscheck.jsonl`,`rollback` 仅在「当前值 == 写入值」
16
- 时撤销,否则计入 conflict 跳过。
17
-
18
- `_cli` 之外的所有函数都是纯逻辑(无网络、无第三方依赖),便于离线回归。
19
- """
20
-
21
- from __future__ import annotations
22
-
23
- import argparse
24
- import json
25
- import os
26
- import re
27
- import sys
28
- import time
29
- from collections import OrderedDict
30
-
31
- from . import crypto, nodefile
32
- from .backfill import (BASIS_ENUM_DEFAULT, BASIS_TEXT, INTERNAL_LAYERS,
33
- SKIP_LAYERS, SKIP_TAGS, _as_cg, _as_text, _comment,
34
- _ensure_comment, _entry_id, _readable_guard,
35
- _remove_ccg_line, _sha, derive_fields)
36
- from .consolidate import _has_ccg_line, _upsert_ccg_line
37
- from .fsutil import append_jsonl, read_jsonl
38
- from .mdcos import _ccg_field
39
- from .readcache import direct_read
40
-
41
- # ---- 常量 ----------------------------------------------------------------
42
-
43
- CROSSCHECK_LOG = "_crosscheck.jsonl"
44
- CROSSCHECK_BATCH = "crosscheck"
45
-
46
- REFLECT_UNIT = "reflect"
47
- VERIFY_UNIT = "verify"
48
-
49
- # 可写字段(本管线只动这一处,杜绝越界面)
50
- WRITABLE_FIELDS = ("验证方式",)
51
- FIELD_NORMALIZE = {
52
- "验证方式": "验证方式",
53
- "verification_basis": "验证方式",
54
- "验证": "验证方式",
55
- "verification": "验证方式",
56
- }
57
-
58
- # 赛道 → 来源执照策略
59
- SOURCE_POLICY = {"science": "reproducible", "humanities": "consistency"}
60
-
61
- # 学科关键词(赛道判定;两栖词不入表 → undetermined,宁缺勿猜)
62
- SCIENCE_SUBJECT_HINTS = (
63
- "数学", "物理", "化学", "生物", "科学", "信息技术", "通用技术", "计算机",
64
- )
65
- HUMANITIES_SUBJECT_HINTS = (
66
- "语文", "历史", "政治", "道德与法治", "思想政治", "思想品德", "英语",
67
- "文学", "哲学", "艺术", "音乐", "美术",
68
- )
69
-
70
- # 基底枚举 → 可读标签(条件化表述引用)
71
- BASIS_LABEL = {
72
- "compiler": "编译器/静态检查",
73
- "test": "单元测试",
74
- "measurement": "实测数据",
75
- "formal_proof": "形式化证明",
76
- "data": "数据统计",
77
- "textbook": "人教版教材",
78
- "public_kb": "公开知识库",
79
- "other": "人工评审",
80
- }
81
-
82
- CLAIM_FIELDS = ("功能名", "生效条件", "子功能", "执行")
83
- B_CLAIM = "B_valuation"
84
- A_CLAIM = "A_fact"
85
-
86
- # B 型(评价性断言)标记词:只收「明显是价值判断/修饰」的表达,避免把事实误判。
87
- VALUATION_MARKERS = (
88
- "结晶", "瑰宝", "杰作", "卓越", "杰出", "伟大", "不朽", "巅峰", "典范",
89
- "精华", "珍品", "璀璨", "辉煌", "丰碑", "博大精深", "源远流长",
90
- "不可估量", "无与伦比", "举足轻重", "首屈一指", "独树一帜", "别具一格",
91
- "最优秀", "极富", "令人叹为观止", "不可磨灭", "辉煌成就", "灿烂", "崇高",
92
- "非凡",
93
- )
94
- VALUATION_PATTERNS = (
95
- re.compile(r"被誉为|被称[之为]|堪称|不愧[为是]"),
96
- re.compile(r"是[^,。;\n]{0,24}的(结晶|瑰宝|杰作|典范|精华|骄傲|象征|丰碑)"),
97
- )
98
-
99
- CONDITION_MARK = "〔来源限定〕"
100
-
101
-
102
- # ---- 赛道与来源执照 ------------------------------------------------------
103
-
104
- # 生效条件:给定 fm,若显式 track/discipline_type 命中枚举则返回对应赛道;否则用相关元数据与正文 CCG 字段匹配提示词,返回 humanities/science/undetermined。
105
- def classify_track(fm: dict, content: str = "") -> str:
106
- """判定节点赛道:`humanities` / `science` / `undetermined`。
107
-
108
- 只看**已声明**的元数据(显式字段 > 学科标记),不扫正文散文,避免误判。
109
- """
110
- fm = fm or {}
111
- explicit = str(fm.get("track") or fm.get("discipline_type") or "").strip().lower()
112
- if explicit in ("humanities", "文科", "arts"):
113
- return "humanities"
114
- if explicit in ("science", "理科", "stem"):
115
- return "science"
116
- st = fm.get("state_attributes")
117
- name = _as_text(st.get("name")) if isinstance(st, dict) else ""
118
- parts = [
119
- name,
120
- _as_text(fm.get("title")),
121
- _as_text(fm.get("discipline")),
122
- _as_text(fm.get("subject")),
123
- " ".join(str(t) for t in (fm.get("tags") or [])),
124
- _ccg_field(content, "功能名"),
125
- _ccg_field(content, "执行"),
126
- _ccg_field(content, "子功能"),
127
- ]
128
- text = " ".join(p for p in parts if p)
129
- has_sci = any(k in text for k in SCIENCE_SUBJECT_HINTS)
130
- has_hum = any(k in text for k in HUMANITIES_SUBJECT_HINTS)
131
- if has_sci and not has_hum:
132
- return "science"
133
- if has_hum and not has_sci:
134
- return "humanities"
135
- return "undetermined"
136
-
137
-
138
- # 生效条件:给定 track,返回 SOURCE_POLICY 中映射的策略名;未知 track 返回空串。
139
- def source_policy(track: str) -> str:
140
- """赛道 → 来源策略名(空串表示不可判定,应 DEFER)。"""
141
- return SOURCE_POLICY.get(track or "", "")
142
-
143
-
144
- # 生效条件:给定 track,若为 science 返回 REPRODUCIBLE_BASIS,若为 humanities 返回 CONSISTENCY_BASIS,否则返回 ()。
145
- def allowed_basis(track: str) -> tuple:
146
- if track == "science":
147
- return tuple(nodefile.REPRODUCIBLE_BASIS)
148
- if track == "humanities":
149
- return tuple(nodefile.CONSISTENCY_BASIS)
150
- return ()
151
-
152
-
153
- # 生效条件:给定 track 与 basis,当 basis 非空且其字符串形式属于 allowed_basis(track) 时返回 True,否则 False。
154
- def basis_licensed(track: str, basis) -> bool:
155
- """来源执照:理科要可复现证据,文科要来源一致性;赛道未定一律不发放。"""
156
- return bool(basis) and str(basis) in allowed_basis(track)
157
-
158
-
159
- # 生效条件:给定 field,返回 FIELD_NORMALIZE 映射值;未知字段返回空串。
160
- def normalize_field(field) -> str:
161
- return FIELD_NORMALIZE.get(str(field or "").strip(), "")
162
-
163
-
164
- # 生效条件:给定 v,若为 None 返回 [];否则将单值或列表转为去除空白后非空字符串的列表。
165
- def _as_source(v) -> list:
166
- if v is None:
167
- return []
168
- items = list(v) if isinstance(v, (list, tuple)) else [v]
169
- return [str(x).strip() for x in items if str(x).strip()]
170
-
171
-
172
- # ---- B 型识别与条件化改写 ------------------------------------------------
173
-
174
- # 生效条件:给定 text,若含 VALUATION_MARKERS 或匹配 VALUATION_PATTERNS 则返回 B_CLAIM,否则 A_CLAIM。
175
- def claim_type(text) -> str:
176
- """`A_fact`(事实性)或 `B_valuation`(评价性断言)。"""
177
- s = str(text or "")
178
- if not s.strip():
179
- return A_CLAIM
180
- if any(m in s for m in VALUATION_MARKERS):
181
- return B_CLAIM
182
- if any(p.search(s) for p in VALUATION_PATTERNS):
183
- return B_CLAIM
184
- return A_CLAIM
185
-
186
-
187
- # 生效条件:给定 text,返回其去除首尾空白后是否以 CONDITION_MARK 开头。
188
- def is_conditioned(text) -> bool:
189
- return str(text or "").strip().startswith(CONDITION_MARK)
190
-
191
-
192
- # 生效条件:给定 text、label、source,若 text 非空且 label 非空且 source 解析后非空,则返回带 CONDITION_MARK 的来源限定表述;已条件化原样返回;否则 None。
193
- def conditioned_claim(text, label, source):
194
- """把评价性断言改写为**带来源限定的条件表述**;缺来源/标签则返回 `None`(不写)。
195
-
196
- 形态:`〔来源限定〕据<来源标签>(<来源>)的表述:<原文>`——
197
- 原文完整保留(可追溯),前缀显式声明「这是某来源的表述」而非无条件事实。
198
- 已条件化的文本原样返回(幂等)。
199
- """
200
- body = str(text or "").strip()
201
- if not body or not label:
202
- return None
203
- if is_conditioned(body):
204
- return body
205
- src = ";".join(_as_source(source))
206
- if not src:
207
- return None
208
- return f"{CONDITION_MARK}据{label}({src})的表述:{body}"
209
-
210
-
211
- # 生效条件:给定 fm 与 content,提取 CCG 声明字段、comment 值与正文长句,返回断言列表,每项含 text/type/where/field。
212
- def extract_claims(fm: dict, content: str) -> list:
213
- """提取可核对断言:CCG 声明字段 + comment 值 + 正文长句。
214
-
215
- 每条:`{"text", "type", "where", "field"}`;`where` ∈ ccg/comment/body。
216
- 占位标记不成为断言。
217
- """
218
- out, seen = [], set()
219
-
220
- # 生效条件:仅当 str(text or "").strip() 得到的 s 长度 >= 4、s 不在 seen 中、且 nodefile.is_placeholder_text(s) 为假时,把 {text: s, type: claim_type(s), where, field} 追加进 out 并把 s 加入 seen,否则直接返回(field 默认 "")。
221
- def _push(text, where, field=""):
222
- s = str(text or "").strip()
223
- if len(s) < 4 or s in seen or nodefile.is_placeholder_text(s):
224
- return
225
- seen.add(s)
226
- out.append({"text": s, "type": claim_type(s), "where": where,
227
- "field": field})
228
-
229
- for f in CLAIM_FIELDS:
230
- v = _ccg_field(content, f)
231
- if v:
232
- _push(v, "ccg", f)
233
- c = _comment(fm)
234
- for f in CLAIM_FIELDS:
235
- v = c.get(f)
236
- if isinstance(v, list):
237
- for item in v:
238
- _push(item, "comment", f)
239
- elif v:
240
- _push(v, "comment", f)
241
- for line in (content or "").split("\n"):
242
- raw = line.strip()
243
- if not raw:
244
- continue
245
- body = raw.lstrip("#").strip()
246
- if body.split(":", 1)[0].strip() in nodefile.CCG_MARKS:
247
- continue # 声明行已按 CCG 字段处理,不重复断言
248
- for sent in re.split(r"[。!?]", body):
249
- s = sent.strip()
250
- if len(s) >= 8 and not s.startswith(CONDITION_MARK):
251
- _push(s, "body", "")
252
- return out
253
-
254
-
255
- # 生效条件:给定 fm、content、claim、new_text,按 claim.where 定位并在唯一匹配时替换断言返回 (content, True),否则返回 (content, False)。
256
- def _rewrite_claim(fm: dict, content: str, claim: dict, new_text: str):
257
- """节点内定位并替换一条断言 → `(content, ok)`;定位不唯一则 fail-closed 不动。"""
258
- where, field = claim.get("where"), claim.get("field")
259
- before = str(claim.get("text") or "")
260
- if where == "ccg" and field:
261
- if _ccg_field(content, field).strip() == before.strip():
262
- return _upsert_ccg_line(content, field, new_text), True
263
- return content, False
264
- if where == "comment" and field:
265
- c = _comment(fm)
266
- v = c.get(field)
267
- if isinstance(v, list):
268
- if before in v:
269
- c[field] = [new_text if x == before else x for x in v]
270
- return content, True
271
- return content, False
272
- if str(v or "").strip() == before.strip():
273
- c[field] = new_text
274
- return content, True
275
- return content, False
276
- if where == "body":
277
- if before and content.count(before) == 1:
278
- return content.replace(before, new_text), True
279
- return content, False
280
- return content, False
281
-
282
-
283
- # ---- 工单 ----------------------------------------------------------------
284
-
285
- # 生效条件:给定 fm 与 content,返回缺失项列表:verification_basis 无效则加入该名,正文无 "# 验证方式" 行则加入该名。
286
- def _need(fm: dict, content: str) -> list:
287
- need = []
288
- if not nodefile.verification_basis_valid(fm):
289
- need.append("verification_basis")
290
- if not _has_ccg_line(content, "验证方式"):
291
- need.append("验证方式")
292
- return need
293
-
294
-
295
- # 生效条件:给定 nid、e、fm、content,返回含 id、layer、track、claims、need、source_policy 的工单行字典。
296
- def _worklist_row(nid: str, e: dict, fm: dict, content: str) -> dict:
297
- track = classify_track(fm, content)
298
- return {
299
- "id": nid,
300
- "layer": e.get("layer"),
301
- "track": track,
302
- "claims": extract_claims(fm, content),
303
- "need": _need(fm, content),
304
- "source_policy": source_policy(track),
305
- }
306
-
307
-
308
- # 生效条件:给定 fm 与 content,若正文或 comment 中声明的执行字段为占位文本则返回 True;未声明执行时以正文整体占位判定。
309
- def _is_placeholder_shell(fm: dict, content: str) -> bool:
310
- """空壳判定:核心可执行内容未被填充 → 禁止接线(不得把「待填充」固化成事实)。
311
-
312
- 口径(宁漏判不误判):
313
- 1. 已声明 `执行`(正文 `# 执行:` 行优先,其次 `state_attributes.comment.执行`)
314
- 且值为占位标记 → 空壳;
315
- 2. 未声明 `执行` 时,以正文整体是否为空/占位标记为准——无 comment 但正文写实的
316
- `kp_archaeo_*` 类节点因此不被误判为空壳。
317
- """
318
- decl = _ccg_field(content, "执行") or _as_text(_comment(fm).get("执行"))
319
- if decl:
320
- return nodefile.is_placeholder_text(decl)
321
- return nodefile.is_placeholder_text(content)
322
-
323
-
324
- # 生效条件:给定 cg,逐节点按 layer/ids/prefix 过滤后产出状态为 skip(internal/denied/locked/derived/present/placeholder/unreadable 等)或 row 的扫描结果。
325
- def _scan(cg, layer=None, ids=None, prefix=None):
326
- """逐节点产出扫描结果:`{"status", "reason"?, "id", "row"?}`。
327
-
328
- `prefix`:只纳入 id 以该前缀开头的节点(真实库以 `kp_` 收窄到用户知识节点,
329
- 避免 `node_`/`note_`/`imgpart_` 等派生记忆混入工单);**不计数**,与 `layer` 同理。
330
- """
331
- want = set(ids) if ids else None
332
- for nid, e in list((cg.index.get("nodes") or {}).items()):
333
- if want is not None and nid not in want:
334
- continue
335
- if prefix and not str(nid).startswith(prefix):
336
- continue
337
- if layer and e.get("layer") != layer:
338
- continue
339
- if e.get("layer") in INTERNAL_LAYERS:
340
- yield {"status": "skip", "reason": "internal", "id": nid}
341
- continue
342
- if not _readable_guard(cg, e):
343
- yield {"status": "skip", "reason": "denied", "id": nid}
344
- continue
345
- fm, content = direct_read(cg, e) # 扫描读喂写面:走盘上真值(读缓存口径)
346
- if fm is None:
347
- yield {"status": "skip", "reason": "unreadable", "id": nid}
348
- continue
349
- if crypto.is_encrypted(content):
350
- yield {"status": "skip", "reason": "locked", "id": nid}
351
- continue
352
- if e.get("layer") in SKIP_LAYERS or any(
353
- t in SKIP_TAGS for t in (fm.get("tags") or [])):
354
- yield {"status": "skip", "reason": "derived", "id": nid}
355
- continue
356
- need = _need(fm, content)
357
- if not need: # 已齐备
358
- yield {"status": "skip", "reason": "present", "id": nid}
359
- continue
360
- ph = []
361
- der = derive_fields(fm, content, placeholder_out=ph)
362
- if _is_placeholder_shell(fm, content): # 空壳:转待填充工单
363
- yield {"status": "skip", "reason": "placeholder", "id": nid,
364
- "placeholder_fields": ph}
365
- continue
366
- yield {"status": "row", "id": nid,
367
- "row": _worklist_row(nid, e, fm, content)}
368
-
369
-
370
- _SKIP_KEY = {"locked": "skipped_locked", "derived": "skipped_derived",
371
- "present": "skipped_present", "denied": "skipped_denied",
372
- "unreadable": "skipped_unreadable", "internal": "skipped_internal"}
373
-
374
-
375
- # 生效条件:给定 x(路径或 MdCGOS),只读扫描并生成缺 verification_basis 或 "# 验证方式" 的节点工单,返回统计 rep。
376
- def build_worklist(x, layer=None, limit=None, ids=None, prefix=None) -> dict:
377
- """生成核对工单(只读):缺 `verification_basis`/`验证方式` 的节点入列。
378
-
379
- `prefix`:按 id 前缀收窄范围(真实库用 `kp_`,与计划交付边界一致);
380
- 内部 `anchor`/`self` 层一律出局(计入 `skipped_internal`)。
381
- """
382
- cg = _as_cg(x)
383
- rep = {"root": cg.root, "dry_run": True, "action": "crosscheck_worklist",
384
- "prefix": prefix, "nodes_scanned": 0, "skipped_locked": 0,
385
- "skipped_derived": 0, "skipped_internal": 0, "skipped_present": 0,
386
- "skipped_denied": 0, "skipped_placeholder": 0,
387
- "skipped_unreadable": 0, "placeholder_ids": [], "undetermined": 0,
388
- "targeted": 0, "items": []}
389
- for scan in _scan(cg, layer=layer, ids=ids, prefix=prefix):
390
- rep["nodes_scanned"] += 1
391
- if scan["status"] == "skip":
392
- reason = scan["reason"]
393
- if reason == "placeholder":
394
- rep["skipped_placeholder"] += 1
395
- rep["placeholder_ids"].append(scan["id"])
396
- else:
397
- key = _SKIP_KEY.get(reason)
398
- if key:
399
- rep[key] += 1
400
- continue
401
- row = scan["row"]
402
- if row["track"] == "undetermined":
403
- rep["undetermined"] += 1
404
- rep["targeted"] += 1
405
- if limit is None or len(rep["items"]) < limit:
406
- rep["items"].append(row)
407
- rep["planned_ids"] = [r["id"] for r in rep["items"]]
408
- return rep
409
-
410
-
411
- # ---- 子代理接口(提示词 + 解析) -----------------------------------------
412
-
413
- _REFLECT_TEMPLATE = """你是认知图节点的**反思单元**(reflect)。为节点补齐「验证方式」与其验证基底。
414
- 赛道:{track};来源策略:{policy};待补字段:{need}
415
- 节点标题:{title}
416
- 已声明断言:
417
- {claims}
418
- 正文:
419
- {body}
420
-
421
- 只输出 JSON 数组,元素形如:
422
- {{"field":"验证方式","value":"<一句可核对的验证方式声明>","basis":"<基底枚举>","source":["<教材版本+章节 或 公开知识库条目地址>"],"verdict":"accept|defer","reason":"<理由>"}}
423
- 硬约束:
424
- 1. 文科(humanities)basis 只能是 textbook / public_kb;
425
- 2. 理科(science)basis 只能是 compiler / test / measurement / formal_proof / data;
426
- 3. 来源必须可追溯(教材名称+章节,或公开知识库条目地址);拿不出来就把 verdict 置 defer、source 留空;
427
- 4. 只能补 field=验证方式,禁止新增其它字段。"""
428
-
429
- _VERIFY_TEMPLATE = """你是独立**验证单元**(verify)。对下列候选逐条复核:来源是否真实可追溯、基底是否与赛道相容。
430
- 赛道:{track};来源策略:{policy}
431
- 候选(JSON):
432
- {candidates}
433
-
434
- 只输出 JSON 数组,元素形如:
435
- {{"field":"验证方式","value":"<原样回填候选 value>","verdict":"accept|drop|defer","reason":"<理由>"}}
436
- 硬约束:你只能否决(drop)或存疑(defer),**不得新增候选、不得改写 value**。"""
437
-
438
-
439
- # 生效条件:给定 row、fm、content,用 row 的 track/source_policy/need/claims 与 fm 标题、content 前 1200 字符填充反思模板并返回字符串。
440
- def reflect_prompt(row: dict, fm: dict, content: str) -> str:
441
- claims = "\n".join(f"- [{c['type']}] {c['text']}" for c in (row.get("claims") or []))
442
- return _REFLECT_TEMPLATE.format(
443
- track=row.get("track"), policy=row.get("source_policy") or "(未定)",
444
- need="、".join(row.get("need") or []),
445
- title=_as_text(fm.get("title")) or row.get("id"),
446
- claims=claims or "(无)",
447
- body=(content or "")[:1200])
448
-
449
-
450
- # 生效条件:给定 row 与 rows,把候选字段、值、依据、来源序列化为 JSON 并填充验证模板返回字符串。
451
- def verify_prompt(row: dict, rows: list) -> str:
452
- cands = [{"field": r.get("field"), "value": r.get("value"),
453
- "basis": r.get("basis"), "source": r.get("source")} for r in rows]
454
- return _VERIFY_TEMPLATE.format(
455
- track=row.get("track"), policy=row.get("source_policy") or "(未定)",
456
- candidates=json.dumps(cands, ensure_ascii=False))
457
-
458
-
459
- # 生效条件:raw 经 str(raw or "") 得 s 后,want_list 为真时先试 s 首个 "[" 至末个 "]"、再试首个 "{" 至末个 "}"(want_list 假值时只试花括号),区间可被 json.loads 解析且结果为 list 时原样返回该 list;结果为 dict 时按 rows/items/verdicts/candidates/data 顺序取首个 obj.get(key) 为 list 的 obj[key],都不满足则返回 [obj],非 list/dict 或区间缺失、解析抛 ValueError 时继续下一组括号,全部落空(含 raw 为假值使 s 为空串)返回 []。
460
- def _extract_json(raw, want_list=True):
461
- """从模型输出里抽取 JSON(容忍代码围栏与前后废话)。"""
462
- s = str(raw or "")
463
- pairs = ([("[", "]")] if want_list else []) + [("{", "}")]
464
- for op, cl in pairs:
465
- i, j = s.find(op), s.rfind(cl)
466
- if i < 0 or j <= i:
467
- continue
468
- try:
469
- obj = json.loads(s[i:j + 1])
470
- except ValueError:
471
- continue
472
- if isinstance(obj, list):
473
- return obj
474
- if isinstance(obj, dict):
475
- for key in ("rows", "items", "verdicts", "candidates", "data"):
476
- if isinstance(obj.get(key), list):
477
- return obj[key]
478
- return [obj]
479
- return []
480
-
481
-
482
- # 生效条件:给定 item,若为 dict 则规范化 field/value/basis/source/verdict/reason 后返回字典,否则返回 {}。
483
- def _norm_row(item) -> dict:
484
- if not isinstance(item, dict):
485
- return {}
486
- return {
487
- "field": normalize_field(item.get("field")) or str(item.get("field") or "").strip(),
488
- "value": _as_text(item.get("value")),
489
- "basis": str(item.get("basis") or "").strip(),
490
- "source": _as_source(item.get("source")),
491
- "verdict": str(item.get("verdict") or "").strip().lower(),
492
- "reason": str(item.get("reason") or "").strip(),
493
- }
494
-
495
-
496
- # 生效条件:给定 raw,解析 JSON 行并保留 field 为“验证方式”或“verification_basis”(统一为“验证方式”)的行,返回列表。
497
- def parse_reflect_rows(raw) -> list:
498
- out = []
499
- for item in _extract_json(raw, want_list=True):
500
- r = _norm_row(item)
501
- if not r or r["field"] not in ("验证方式", "verification_basis"):
502
- continue
503
- r["field"] = "验证方式"
504
- out.append(r)
505
- return out
506
-
507
-
508
- # 生效条件:遍历 _extract_json(raw, want_list=False)(只认花括号 JSON)的结果,仅当 item 经 _norm_row 后为真且 r["field"] 非空时产出 {field,value,verdict,reason} 四键行,否则跳过(raw 无可解析花括号对象时 out 为空列表)。
509
- def parse_verify_rows(raw) -> list:
510
- out = []
511
- for item in _extract_json(raw, want_list=False):
512
- r = _norm_row(item)
513
- if not r or not r["field"]:
514
- continue
515
- out.append({k: r[k] for k in ("field", "value", "verdict", "reason")})
516
- return out
517
-
518
-
519
- # ---- 白箱闸门与双单元折叠 ------------------------------------------------
520
-
521
- # 生效条件:逐行处理 rows,仅当 normalize_field(r.get("field")) 落在 WRITABLE_FIELDS、basis_licensed(track, r.get("basis")) 为真、r.get("source") 为真、且 r.get("value") or BASIS_TEXT.get(str(r.get("basis")), "") 非空时进入 kept(附 verdict="accept"),否则该行带对应 reason 进入 gated。
522
- def gate_rows(rows: list, track: str) -> tuple:
523
- """零模型白箱闸门:字段越界 / 来源执照不通过 / 无来源 → 一律降级为 defer。
524
-
525
- 返回 `(kept, gated)`;`kept` 只含「执照齐全」的候选,可进验证单元。
526
- """
527
- kept, gated = [], []
528
- for r in rows:
529
- f = normalize_field(r.get("field"))
530
- row = dict(r, field=f)
531
- if f not in WRITABLE_FIELDS:
532
- gated.append(dict(row, reason=f"越界字段:{r.get('field')}"))
533
- continue
534
- if not basis_licensed(track, r.get("basis")):
535
- gated.append(dict(row, reason=f"{track or '未定赛道'} 不接受基底 {r.get('basis') or '(缺)'}"))
536
- continue
537
- if not r.get("source"):
538
- gated.append(dict(row, reason="无来源,不写"))
539
- continue
540
- value = r.get("value") or BASIS_TEXT.get(str(r.get("basis")), "")
541
- if not value:
542
- gated.append(dict(row, reason="无验证方式声明"))
543
- continue
544
- kept.append(dict(row, value=value, verdict="accept"))
545
- return kept, gated
546
-
547
-
548
- # 生效条件:按 (r.get("id"), normalize_field(r.get("field")) or r.get("field"), r.get("value")) 分组后,组内缺 unit==REFLECT_UNIT 或 unit==VERIFY_UNIT 的行时进 deferred,否则 verify 侧出现 verdict=="drop" 即进 dropped(veto 优先),再否则仅当 reflect 与 verify 各存在 verdict=="accept" 时才进 accepted(附 units),其余进 deferred。
549
- def fold_verdicts(rows: list) -> tuple:
550
- """把两单元裁决折叠为可落库结论 → `(accepted, deferred, dropped)`。
551
-
552
- 接受条件:同 `(id, field, value)` 同时存在 reflect-accept 与 verify-accept;
553
- 任一 verify-drop 即否决(veto 优先)。
554
- """
555
- groups = OrderedDict()
556
- for r in rows:
557
- key = (r.get("id"), normalize_field(r.get("field")) or r.get("field"),
558
- r.get("value"))
559
- groups.setdefault(key, []).append(r)
560
- accepted, deferred, dropped = [], [], []
561
- for (nid, field, value), rs in groups.items():
562
- refl = [r for r in rs if r.get("unit") == REFLECT_UNIT]
563
- ver = [r for r in rs if r.get("unit") == VERIFY_UNIT]
564
- base = {"id": nid, "field": field or "验证方式", "value": value,
565
- "basis": next((r.get("basis") for r in refl if r.get("basis")), ""),
566
- "source": next((r.get("source") for r in refl if r.get("source")), []),
567
- "track": next((r.get("track") for r in refl if r.get("track")), "")}
568
- if not refl or not ver:
569
- base["reason"] = "缺" + ("反思裁决" if not refl else "验证裁决")
570
- deferred.append(base)
571
- continue
572
- if any(r.get("verdict") == "drop" for r in ver):
573
- base["reason"] = next((r.get("reason") for r in ver
574
- if r.get("verdict") == "drop"), "验证单元否决")
575
- dropped.append(base)
576
- continue
577
- ra = any(r.get("verdict") == "accept" for r in refl)
578
- va = any(r.get("verdict") == "accept" for r in ver)
579
- if ra and va:
580
- base["units"] = {
581
- "reflect": sorted({str(r.get("actor") or REFLECT_UNIT) for r in refl}),
582
- "verify": sorted({str(r.get("actor") or VERIFY_UNIT) for r in ver}),
583
- }
584
- accepted.append(base)
585
- else:
586
- base["reason"] = f"单元未确认(reflect={ra}, verify={va})"
587
- deferred.append(base)
588
- return accepted, deferred, dropped
589
-
590
-
591
- # 生效条件:当 rows 中 unit==REFLECT_UNIT 与 unit==VERIFY_UNIT 的执行者经 str(x.get("actor") or "") 后存在相同的非空值(空串被 discard)时返回 True,否则返回 False。
592
- def detect_self_verify(rows: list) -> bool:
593
- """同一执行者同时充当反思与验证 = 自证(禁止)。"""
594
- r = {str(x.get("actor") or "") for x in rows if x.get("unit") == REFLECT_UNIT}
595
- v = {str(x.get("actor") or "") for x in rows if x.get("unit") == VERIFY_UNIT}
596
- r.discard("")
597
- v.discard("")
598
- return bool(r & v)
599
-
600
-
601
- # ---- 落库写入 ------------------------------------------------------------
602
-
603
- # 生效条件:verdicts 为 None 时返回 None;verdicts 为 dict 时对每个键值把 (rs or []) 中的 dict 元素收为 {str(nid): [...]};否则遍历 verdicts or [],仅当元素为 dict 且 str(r.get("id") or "") 非空时按该 id 追加到对应列表。
604
- def _norm_verdicts(verdicts):
605
- """外部裁决(子代理落盘)→ `{id: [rows]}`。"""
606
- if verdicts is None:
607
- return None
608
- out = OrderedDict()
609
- if isinstance(verdicts, dict):
610
- for nid, rs in verdicts.items():
611
- out[str(nid)] = [dict(x) for x in (rs or []) if isinstance(x, dict)]
612
- return out
613
- for r in verdicts or []:
614
- if not isinstance(r, dict):
615
- continue
616
- nid = str(r.get("id") or "")
617
- if nid:
618
- out.setdefault(nid, []).append(dict(r))
619
- return out
620
-
621
-
622
- # 生效条件:accepted 非空(取 accepted[0])时,先以 basis=str(a.get("basis") or BASIS_ENUM_DEFAULT) 与 value=str(a.get("value") or BASIS_TEXT.get(basis, "")).strip() 写「验证方式」行与 comment,之后才在 nodefile.verification_basis_valid(fm) 为真时把 basis 换成 fm.get("verification_basis")、否则把该 basis 写入 fm["verification_basis"];condition_claims 为真时仅对 row.get("claims") 中 type==B_CLAIM 且未被 is_conditioned 的条目做条件化改写,返回含 fm_before、content_hash_before 等留痕的 dict。
623
- def _apply_node(cg, nid, e, fm, content, accepted, row, batch, actor,
624
- condition_claims=True):
625
- """把一个节点的已接受结论写入 md,返回留痕记录(含回滚所需现场)。"""
626
- a = accepted[0]
627
- basis = str(a.get("basis") or BASIS_ENUM_DEFAULT)
628
- source = _as_source(a.get("source"))
629
- content_before = content
630
- value = str(a.get("value") or BASIS_TEXT.get(basis, "")).strip()
631
-
632
- vb_before = {"had": "verification_basis" in fm,
633
- "value": fm.get("verification_basis")}
634
- prov_before = {"had": "verification_evidence" in fm,
635
- "value": fm.get("verification_evidence")}
636
- line_before = {"had": _has_ccg_line(content, "验证方式"),
637
- "value": _ccg_field(content, "验证方式")}
638
- comment0 = _comment(fm)
639
- cv_before = {"had": "验证方式" in comment0, "value": comment0.get("验证方式")}
640
-
641
- # 1) 落「验证方式」规范行 + comment + verification_basis(已有合法基底不覆盖)
642
- content = _upsert_ccg_line(content, "验证方式", value)
643
- _ensure_comment(fm)["验证方式"] = value
644
- if nodefile.verification_basis_valid(fm):
645
- basis = str(fm.get("verification_basis"))
646
- else:
647
- fm["verification_basis"] = basis
648
-
649
- # 2) B 型评价断言 → 条件化表述(A 型保持原样;无来源已由闸门挡掉)
650
- conditioned = []
651
- if condition_claims:
652
- label = BASIS_LABEL.get(basis, basis)
653
- for c in row.get("claims") or []:
654
- if c.get("type") != B_CLAIM or is_conditioned(c.get("text")):
655
- continue
656
- new = conditioned_claim(c.get("text"), label, source)
657
- if not new or new == c.get("text"):
658
- continue
659
- nc, ok = _rewrite_claim(fm, content, c, new)
660
- if not ok:
661
- continue
662
- content = nc
663
- conditioned.append({"where": c.get("where"), "field": c.get("field") or "",
664
- "before": c.get("text"), "after": new})
665
-
666
- wid = _sha(f"{nid}|{batch}|{time.time()}")
667
- fm["verification_evidence"] = {
668
- "at": round(time.time(), 3), "batch": batch, "basis": basis,
669
- "source": source, "track": row.get("track"),
670
- "policy": row.get("source_policy"), "write_id": wid,
671
- "units": a.get("units") or {},
672
- "conditioned": len(conditioned),
673
- }
674
-
675
- cg._write_node(nid, os.path.join(cg.root, e["path"]), fm, content,
676
- durable=True)
677
- return {
678
- "action": "crosscheck", "ts": time.time(), "batch": batch,
679
- "actor": actor, "entry_id": _entry_id(batch, nid), "write_id": wid,
680
- "node": nid, "layer": e.get("layer"), "track": row.get("track"),
681
- "policy": row.get("source_policy"), "basis": basis,
682
- "verification_value": value, "source": source,
683
- "units": a.get("units") or {},
684
- "fm_before": {"verification_basis": vb_before,
685
- "verification_evidence": prov_before,
686
- "comment_verification": cv_before},
687
- "verification_line_before": line_before,
688
- "claims_conditioned": conditioned,
689
- "content_hash_before": _sha(content_before),
690
- "content_hash_after": _sha(content),
691
- }
692
-
693
-
694
- # ---- 主流程 --------------------------------------------------------------
695
-
696
- # 生效条件:reflect_fn(reflect_prompt(scan_row, fm, content)) 经 parse_reflect_rows 得到非空候选时返回 (rrows, vrows),rrows 为空则返回 ([], []);verify_fn 为 None 时 vrows 为空列表,非 None 时由 parse_verify_rows(verify_fn(verify_prompt(scan_row, rrows))) 生成、每行 value 为 c.get("value") or rrows 中同 field 的 value、再回落 ""。
697
- def _rows_for(scan_row, fm, content, reflect_fn, verify_fn, r_actor, v_actor):
698
- """调用两单元子代理,返回合并后的裁决行(reflect + verify)。"""
699
- prompt = reflect_prompt(scan_row, fm, content)
700
- cands = parse_reflect_rows(reflect_fn(prompt))
701
- rrows = [dict(c, id=scan_row["id"], unit=REFLECT_UNIT, actor=r_actor,
702
- track=scan_row["track"]) for c in cands]
703
- if not rrows:
704
- return [], []
705
- vrows = []
706
- if verify_fn is not None:
707
- vp = verify_prompt(scan_row, rrows)
708
- vrows = [dict(c, id=scan_row["id"], unit=VERIFY_UNIT, actor=v_actor,
709
- track=scan_row["track"],
710
- value=c.get("value") or next(
711
- (x.get("value") for x in rrows
712
- if x.get("field") == c.get("field")), ""))
713
- for c in parse_verify_rows(verify_fn(vp))]
714
- return rrows, vrows
715
-
716
-
717
- # 生效条件:对 pre 中每个 r,str(r.get("unit") or REFLECT_UNIT).strip().lower() 等于 VERIFY_UNIT 时进 vrows,否则(含 unit 缺失回落到 REFLECT_UNIT 及任何其他取值)进 rrows,两组行均覆盖 id=nid、unit、track=track。
718
- def _rows_from_verdicts(nid, track, pre):
719
- """从外部裁决中拆出 (reflect, verify) 两组行。"""
720
- rrows, vrows = [], []
721
- for r in pre:
722
- unit = str(r.get("unit") or REFLECT_UNIT).strip().lower()
723
- base = dict(r, id=nid, unit=unit, track=track)
724
- (vrows if unit == VERIFY_UNIT else rrows).append(base)
725
- return rrows, vrows
726
-
727
-
728
- # 生效条件:x 经 _as_cg 解析且 batch = batch or CROSSCHECK_BATCH 后逐节点扫描,裁决来源按 vmap(verdicts 归一化后非 None)→ reflect_fn 非 None → 二者皆无记 no_reflect 三条分支取行;allow_self_verify=False 时同执行者自证记 self_verify_disallowed,再经 gate_rows 闸门与 require_verify 后 fold_verdicts,仅 apply=True 才 _apply_node 写盘并在有写入时 cg.rebuild_index;limit 非 None 且已达标数 >= limit 时用 continue 跳过(非终止)。
729
- def crosscheck(x, layer=None, limit=None, ids=None, reflect_fn=None,
730
- verify_fn=None, verdicts=None, apply=False,
731
- batch=CROSSCHECK_BATCH, actor=None, require_verify=True,
732
- allow_self_verify=False, reflect_actor=None, verify_actor=None,
733
- condition_claims=True, verbose=True, prefix=None) -> dict:
734
- """批量核对主流程:工单 → 反思候选 → 白箱闸门 → 验证否决 → 落库。
735
-
736
- `reflect_fn`/`verify_fn`:可注入的子代理函数(接收提示词、返回 JSON 文本);
737
- `verdicts`:子代理离线产出的裁决行(`[VERDICT_ROW]` 或 `{id: [rows]}`),
738
- 二选一。`apply=True` 才写盘。
739
- """
740
- cg = _as_cg(x)
741
- batch = batch or CROSSCHECK_BATCH
742
- vmap = _norm_verdicts(verdicts)
743
- r_actor = reflect_actor or getattr(reflect_fn, "__name__", "") or REFLECT_UNIT
744
- v_actor = verify_actor or getattr(verify_fn, "__name__", "") or VERIFY_UNIT
745
-
746
- rep = {"root": cg.root, "dry_run": not apply, "action": "crosscheck",
747
- "batch": batch, "actor": actor, "prefix": prefix, "nodes_scanned": 0,
748
- "targeted": 0,
749
- "accepted": 0, "rejected": 0, "deferred": 0, "written": 0,
750
- "claims_conditioned": 0, "skipped_locked": 0, "skipped_derived": 0,
751
- "skipped_internal": 0, "skipped_present": 0, "skipped_denied": 0,
752
- "skipped_unreadable": 0, "skipped_placeholder": 0,
753
- "placeholder_ids": [], "undetermined": 0,
754
- "reasons": {}, "samples": [], "entry_ids": []}
755
-
756
- # 生效条件:无条件执行 rep["reasons"][reason] = rep["reasons"].get(reason, 0) + 1(reason 缺键时按 .get 的第二参数 0 起算),返回 None。
757
- def _bump(reason):
758
- rep["reasons"][reason] = rep["reasons"].get(reason, 0) + 1
759
-
760
- # 生效条件:仅当外层 verbose 为真且 len(rep["samples"]) < 20 时把 {kind, id: nid, detail} 追加进 rep["samples"],否则不追加(已达 20 条即停止采样)。
761
- def _sample(kind, nid, detail=""):
762
- if verbose and len(rep["samples"]) < 20:
763
- rep["samples"].append({"kind": kind, "id": nid, "detail": detail})
764
-
765
- seen_targets = 0
766
- for scan in _scan(cg, layer=layer, ids=ids, prefix=prefix):
767
- rep["nodes_scanned"] += 1
768
- if scan["status"] == "skip":
769
- reason = scan["reason"]
770
- if reason == "placeholder":
771
- rep["skipped_placeholder"] += 1
772
- rep["placeholder_ids"].append(scan["id"])
773
- else:
774
- key = _SKIP_KEY.get(reason)
775
- if key:
776
- rep[key] += 1
777
- continue
778
- row = scan["row"]
779
- if row["track"] == "undetermined":
780
- rep["undetermined"] += 1
781
- if limit is not None and seen_targets >= limit:
782
- continue
783
- seen_targets += 1
784
- rep["targeted"] += 1
785
- nid = row["id"]
786
- e = cg.index["nodes"].get(nid)
787
- fm, content = direct_read(cg, e) if e else (None, None) # 写前重查走盘上真值
788
- if fm is None or crypto.is_encrypted(content):
789
- rep["skipped_locked"] += 1
790
- continue
791
-
792
- # ---- 取两单元裁决 ----
793
- if vmap is not None:
794
- pre = vmap.get(nid)
795
- if not pre:
796
- rep["deferred"] += 1
797
- _bump("no_verdict")
798
- continue
799
- rrows, vrows = _rows_from_verdicts(nid, row["track"], pre)
800
- elif reflect_fn is not None:
801
- try:
802
- rrows, vrows = _rows_for(row, fm, content, reflect_fn,
803
- verify_fn, r_actor, v_actor)
804
- except Exception as exc: # noqa: BLE001
805
- rep["deferred"] += 1
806
- _bump(f"unit_error:{type(exc).__name__}")
807
- continue
808
- else:
809
- rep["deferred"] += 1
810
- _bump("no_reflect")
811
- continue
812
-
813
- # 自证:同一执行者既反思又验证 → 拒收
814
- if not allow_self_verify and detect_self_verify(rrows + vrows):
815
- rep["deferred"] += 1
816
- _bump("self_verify_disallowed")
817
- _sample("self_verify", nid)
818
- continue
819
-
820
- # ---- 白箱闸门(对反思候选;验证行只做字段归位) ----
821
- kept, gated = gate_rows(rrows, row["track"])
822
- for g in gated:
823
- _bump(f"gate:{g.get('reason')[:24]}")
824
- if not kept:
825
- rep["deferred"] += 1
826
- _bump("no_candidate")
827
- _sample("gated", nid, gated[0].get("reason") if gated else "")
828
- continue
829
- if require_verify and not vrows:
830
- rep["deferred"] += 1
831
- _bump("verify_unavailable")
832
- continue
833
-
834
- rows = kept + vrows
835
- accepted, deferred, dropped = fold_verdicts(rows)
836
- if dropped and not accepted:
837
- rep["rejected"] += 1
838
- _bump("verify_veto")
839
- _sample("veto", nid, dropped[0].get("reason", ""))
840
- continue
841
- if not accepted:
842
- rep["deferred"] += 1
843
- _bump("verdict_deferred")
844
- _sample("deferred", nid, deferred[0].get("reason", "") if deferred else "")
845
- continue
846
-
847
- rep["accepted"] += 1
848
- rep["claims_conditioned"] += sum(
849
- 1 for c in (row.get("claims") or []) if c.get("type") == B_CLAIM)
850
- if apply:
851
- rec = _apply_node(cg, nid, e, fm, content, accepted, row, batch,
852
- actor, condition_claims=condition_claims)
853
- append_jsonl(_log_path(cg), rec)
854
- rep["written"] += 1
855
- rep["entry_ids"].append(rec["entry_id"])
856
- _sample("accepted", nid, accepted[0].get("basis", ""))
857
-
858
- if rep["written"]:
859
- cg.rebuild_index()
860
- return rep
861
-
862
-
863
- # ---- 留痕查询 / 回滚 -----------------------------------------------------
864
-
865
- # 生效条件:无条件返回 os.path.join(cg.root, CROSSCHECK_LOG)(以 cg.root 与常量 CROSSCHECK_LOG 拼接,无分支)。
866
- def _log_path(cg) -> str:
867
- return os.path.join(cg.root, CROSSCHECK_LOG)
868
-
869
-
870
- # 生效条件:box 非 dict 时返回 False;box 为 dict 且 key=="comment_verification" 时按 box.get("had") 为真则把 comment 的「验证方式」设为 box.get("value")、否则删除该键并返回 True;其他 key 时 had 为真赋 fm[key]=value、否则 fm.pop(key, None) 并返回 True。
871
- def _reattach(fm: dict, content: str, box: dict, key: str):
872
- """把 `fm_before[key]` 现场还原到 fm,返回是否发生还原。"""
873
- if not isinstance(box, dict):
874
- return False
875
- had, value = box.get("had"), box.get("value")
876
- if key == "comment_verification":
877
- c = _ensure_comment(fm)
878
- if had:
879
- c["验证方式"] = value
880
- else:
881
- c.pop("验证方式", None)
882
- return True
883
- if had:
884
- fm[key] = value
885
- else:
886
- fm.pop(key, None)
887
- return True
888
-
889
-
890
- # 生效条件:仅当 str(c.get("after") or "") 非空,且分别满足 where=="ccg" 且 field 真值且 _ccg_field(content, field).strip()==after.strip()(用 before 覆盖该行)、where=="comment" 且 field 真值且 comment 该 field 为含 after 的 list 或 str(v or "").strip()==after.strip()(改为 before)、where=="body" 且 after 出现在 content 中(替换首个匹配)时返回 (content, True);其余情形(含 where 为其他值、字段缺失、当前值不等于写入值)返回 (content, False)。
891
- def _rewind_claim(fm: dict, content: str, c: dict):
892
- """撤销一条条件化改写(仅当前值 == 写入值时才动)→ `(content, ok)`。"""
893
- where, field = c.get("where"), c.get("field")
894
- before, after = str(c.get("before") or ""), str(c.get("after") or "")
895
- if not after:
896
- return content, False
897
- if where == "ccg" and field:
898
- if _ccg_field(content, field).strip() == after.strip():
899
- return _upsert_ccg_line(content, field, before), True
900
- return content, False
901
- if where == "comment" and field:
902
- cc = _comment(fm)
903
- v = cc.get(field)
904
- if isinstance(v, list):
905
- if after in v:
906
- cc[field] = [before if x == after else x for x in v]
907
- return content, True
908
- return content, False
909
- if str(v or "").strip() == after.strip():
910
- cc[field] = before
911
- return content, True
912
- return content, False
913
- if where == "body":
914
- if after in content:
915
- return content.replace(after, before, 1), True
916
- return content, False
917
- return content, False
918
-
919
-
920
- # 生效条件:x 经 _as_cg 后,对 read_jsonl(_log_path(cg)) 中 action=="crosscheck"、batch 为 None 或等于参数 batch、且 entry_ids 为假值不做 id 过滤(为真值时仅取 entry_id 在集合中的)的记录逐条处理:node 缺失或已处理则跳过,索引无该 node 或 cg._read 得 fm 为 None 或 crypto.is_encrypted(content) 为真时 skipped_drift 加一,write_id 双方非空且不等时 conflict 加一,否则撤销 claims_conditioned、在当前「验证方式」行非空且等于 rec 的 verification_value 时撤销该行、再按 fm_before 还原,reverted 为空则 conflict 加一,非空则写回节点、追加 crosscheck_rollback 日志、reverted 与 entry_ids 加一,最终 reverted 非零时 cg.rebuild_index(),返回 rep;
921
- def rollback(x, batch=None, entry_ids=None, actor=None) -> dict:
922
- """按留痕反向应用:撤销核对写入(当前值 ≠ 写入值时跳过,计入 conflict)。"""
923
- cg = _as_cg(x)
924
- want = set(entry_ids) if entry_ids else None
925
- done = set()
926
- rep = {"root": cg.root, "dry_run": False, "action": "crosscheck_rollback",
927
- "batch": batch, "actor": actor, "planned": 0, "reverted": 0,
928
- "skipped_drift": 0, "conflict": 0, "entry_ids": []}
929
- recs = [r for r in (read_jsonl(_log_path(cg)) or [])
930
- if r.get("action") == "crosscheck"
931
- and (batch is None or r.get("batch") == batch)
932
- and (want is None or r.get("entry_id") in want)]
933
- rep["planned"] = len(recs)
934
- for rec in recs:
935
- nid = rec.get("node")
936
- if not nid or nid in done:
937
- continue
938
- e = cg.index["nodes"].get(nid)
939
- if not e:
940
- rep["skipped_drift"] += 1
941
- continue
942
- fm, content = direct_read(cg, e) # 回滚比对走盘上真值(write_id 防护所验 fm 同源)
943
- if fm is None or crypto.is_encrypted(content):
944
- rep["skipped_drift"] += 1
945
- continue
946
- # 写入现场校验:write_id 一致才回滚(防「写入后又被改过」被误撤)
947
- wid = (fm.get("verification_evidence") or {}).get("write_id")
948
- if wid and rec.get("write_id") and wid != rec.get("write_id"):
949
- rep["conflict"] += 1
950
- continue
951
- # 1) 撤销条件化改写(先于验证方式行,避免行被覆盖影响定位)
952
- reverted = []
953
- for c in rec.get("claims_conditioned") or []:
954
- content, ok = _rewind_claim(fm, content, c)
955
- if ok:
956
- reverted.append(c.get("field") or c.get("where"))
957
- # 2) 撤销「验证方式」行
958
- lb = rec.get("verification_line_before") or {}
959
- cur_line = _ccg_field(content, "验证方式")
960
- if cur_line.strip() and cur_line.strip() == str(
961
- rec.get("verification_value") or "").strip():
962
- content = (_upsert_ccg_line(content, "验证方式", lb.get("value") or "")
963
- if lb.get("had") else _remove_ccg_line(content, "验证方式"))
964
- reverted.append("验证方式")
965
- # 3) 还原 frontmatter 现场
966
- for key, box in (rec.get("fm_before") or {}).items():
967
- _reattach(fm, content, box, key)
968
- if not reverted:
969
- rep["conflict"] += 1
970
- continue
971
- cg._write_node(nid, os.path.join(cg.root, e["path"]), fm, content,
972
- durable=True)
973
- append_jsonl(_log_path(cg), {
974
- "action": "crosscheck_rollback", "ts": time.time(),
975
- "batch": rec.get("batch"), "actor": actor,
976
- "entry_id": rec.get("entry_id"), "node": nid,
977
- "reverted": reverted, "content_hash_after": _sha(content)})
978
- rep["reverted"] += 1
979
- rep["entry_ids"].append(rec.get("entry_id"))
980
- done.add(nid)
981
- if rep["reverted"]:
982
- cg.rebuild_index()
983
- return rep
984
-
985
-
986
- # 生效条件:遍历 _log_path(cg) 的记录时,action 为真值只留 rec.get("action")==action 的行、batch 为真值只留 rec.get("batch")==batch 的行;limit 非 None 且 limit>=0 时按 recs[-limit:] 截取(limit 为 0 时 [-0:] 即整表不被削减),否则保留全部;返回 {'root','total','returned','records'}。
987
- def history(x, limit=100, action=None, batch=None) -> dict:
988
- cg = _as_cg(x)
989
- recs = []
990
- for rec in read_jsonl(_log_path(cg)) or []:
991
- if action and rec.get("action") != action:
992
- continue
993
- if batch and rec.get("batch") != batch:
994
- continue
995
- recs.append(rec)
996
- total = len(recs)
997
- if limit is not None and limit >= 0:
998
- recs = recs[-limit:]
999
- return {"root": cg.root, "total": total, "returned": len(recs),
1000
- "records": recs}
1001
-
1002
-
1003
- # ---- 权限与 CLI ----------------------------------------------------------
1004
-
1005
- # 生效条件:principal 为 None 时返回 False;否则仅当 principal.expired() 为假、principal.can_write 为真、且 principal.allows_layer("knowledge") 为真时返回 True,期间任一步抛 Exception 亦返回 False。
1006
- def can_write_knowledge(principal) -> bool:
1007
- """落 knowledge 层必须持有可写该层的令牌(designer 派生);否则 fail-closed。"""
1008
- if principal is None:
1009
- return False
1010
- try:
1011
- if principal.expired() or not principal.can_write:
1012
- return False
1013
- return bool(principal.allows_layer("knowledge"))
1014
- except Exception: # noqa: BLE001
1015
- return False
1016
-
1017
-
1018
- # 生效条件:path 为假值(空串/None)返回 None;path 不存在则 raise SystemExit;已存在且读取文本 strip 后为空串返回 [],非空时整段 json.loads 成功即返回该值,抛 ValueError 时按行解析(跳过空行与 "//" 开头行)返回行列表。
1019
- def _load_verdicts(path: str):
1020
- if not path:
1021
- return None
1022
- if not os.path.exists(path):
1023
- raise SystemExit(f"裁决文件不存在:{path}")
1024
- with open(path, "r", encoding="utf-8") as fh:
1025
- text = fh.read().strip()
1026
- if not text:
1027
- return []
1028
- try:
1029
- return json.loads(text)
1030
- except ValueError:
1031
- rows = []
1032
- for line in text.splitlines():
1033
- line = line.strip()
1034
- if not line or line.startswith("//"):
1035
- continue
1036
- rows.append(json.loads(line))
1037
- return rows
1038
-
1039
-
1040
- # 生效条件:argv(为 None 时由 argparse 读 sys.argv)解析后按 --action 分派——worklist 调 build_worklist,history 调 history(--limit 默认 None,为 None 时传 100),rollback 在 can_write_knowledge(principal) 为假时抛 SystemExit 否则调 rollback,crosscheck 在 --apply 为真且 can_write_knowledge(principal) 为假时抛 SystemExit 否则调 crosscheck;--token(默认 os.environ.get("MDCG_TOKEN") or "")为真值时先 tokens.verify_token 校验、失败抛 SystemExit;最后打印 rep 并返回 0;
1041
- def _cli(argv=None) -> int:
1042
- ap = argparse.ArgumentParser(
1043
- prog="python -m md_cg.crosscheck",
1044
- description="kp_ 批量核对管线(工单/核对/回滚/留痕)")
1045
- ap.add_argument("--root", default=os.environ.get("MDCG_ROOT") or ".")
1046
- ap.add_argument("--token", default=os.environ.get("MDCG_TOKEN") or "")
1047
- ap.add_argument("--token-file", default=None)
1048
- ap.add_argument("--action", default="worklist",
1049
- choices=("worklist", "crosscheck", "rollback", "history"))
1050
- ap.add_argument("--verdicts", default="", help="子代理裁决 JSON/JSONL 路径")
1051
- ap.add_argument("--apply", action="store_true", help="真正写盘(默认 dry-run)")
1052
- ap.add_argument("--batch", default=CROSSCHECK_BATCH)
1053
- ap.add_argument("--limit", type=int, default=None)
1054
- ap.add_argument("--layer", default=None)
1055
- ap.add_argument("--prefix", default=None, help="按 id 前缀收窄(真实库用 kp_)")
1056
- ap.add_argument("--ids", default="", help="逗号分隔节点 id")
1057
- ap.add_argument("--no-verify", action="store_true", help="允许无验证单元(不建议)")
1058
- ap.add_argument("--allow-self-verify", action="store_true")
1059
- ap.add_argument("--reflect-actor", default=None)
1060
- ap.add_argument("--verify-actor", default=None)
1061
- args = ap.parse_args(argv)
1062
-
1063
- from . import tokens
1064
- principal = None
1065
- if args.token:
1066
- try:
1067
- principal = tokens.verify_token(args.token, path=args.token_file)
1068
- except tokens.TokenError as exc:
1069
- raise SystemExit(f"令牌校验失败:{exc}")
1070
- actor = getattr(principal, "actor", None)
1071
- ids = [s.strip() for s in args.ids.split(",") if s.strip()] or None
1072
-
1073
- if args.action == "worklist":
1074
- rep = build_worklist(args.root, layer=args.layer, limit=args.limit,
1075
- ids=ids, prefix=args.prefix)
1076
- elif args.action == "history":
1077
- rep = history(args.root, limit=args.limit if args.limit is not None else 100,
1078
- batch=args.batch)
1079
- elif args.action == "rollback":
1080
- if not can_write_knowledge(principal):
1081
- raise SystemExit("权限不足:回滚需要可写 knowledge 层的令牌")
1082
- rep = rollback(args.root, batch=args.batch, actor=actor)
1083
- else:
1084
- if args.apply and not can_write_knowledge(principal):
1085
- raise SystemExit("权限不足:落库需要可写 knowledge 层的令牌(designer 派生)")
1086
- rep = crosscheck(args.root, layer=args.layer, limit=args.limit, ids=ids,
1087
- prefix=args.prefix,
1088
- verdicts=_load_verdicts(args.verdicts), apply=args.apply,
1089
- batch=args.batch,
1090
- require_verify=not args.no_verify,
1091
- allow_self_verify=args.allow_self_verify,
1092
- reflect_actor=args.reflect_actor,
1093
- verify_actor=args.verify_actor, actor=actor)
1094
- print(json.dumps(rep, ensure_ascii=False, indent=2))
1095
- return 0
1096
-
1097
-
1098
- if __name__ == "__main__": # pragma: no cover
1
+ # -*- coding: utf-8 -*-
2
+ """批量核对(P34/P35):工单 → 反思候选 → 白箱闸门 → 验证否决 → 来源执照 → 落库。
3
+
4
+ 设计约束(与计划一致):
5
+
6
+ * **不新增 MCP op**:本模块是「模块 + `_cli`」形态(同 `backfill.py`),子代理经
7
+ `python -m md_cg.crosscheck …` 调用;令牌决定权限边界。
8
+ * **防自证**:反思单元(`reflect`)与验证单元(`verify`)必须为**不同执行者**;
9
+ 验证单元**只能否决、不能新增**候选(越界字段在白箱闸门直接丢弃)。
10
+ * **来源执照**:文科(`humanities`)只接受来源一致性档(`textbook`/`public_kb`);
11
+ 理科(`science`)只接受可复现档(`compiler`/`test`/`measurement`/`formal_proof`/`data`);
12
+ 赛道未定(`undetermined`)或无来源一律不写,保持 DEFER 并登记待补。
13
+ * **诚实边界**:占位空壳节点(`骨架锚点`/`内容待填充`)不进接线,转待填充工单;
14
+ 拿不出证据的节点绝不写 `verification_basis`。
15
+ * **留痕可回滚**:写入前记录 `_crosscheck.jsonl`,`rollback` 仅在「当前值 == 写入值」
16
+ 时撤销,否则计入 conflict 跳过。
17
+
18
+ `_cli` 之外的所有函数都是纯逻辑(无网络、无第三方依赖),便于离线回归。
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import argparse
24
+ import json
25
+ import os
26
+ import re
27
+ import sys
28
+ import time
29
+ from collections import OrderedDict
30
+
31
+ from . import crypto, nodefile
32
+ from .backfill import (BASIS_ENUM_DEFAULT, BASIS_TEXT, INTERNAL_LAYERS,
33
+ SKIP_LAYERS, SKIP_TAGS, _as_cg, _as_text, _comment,
34
+ _ensure_comment, _entry_id, _readable_guard,
35
+ _remove_ccg_line, _sha, derive_fields)
36
+ from .consolidate import _has_ccg_line, _upsert_ccg_line
37
+ from .fsutil import append_jsonl, read_jsonl
38
+ from .mdcos import _ccg_field
39
+ from .readcache import direct_read
40
+
41
+ # ---- 常量 ----------------------------------------------------------------
42
+
43
+ CROSSCHECK_LOG = "_crosscheck.jsonl"
44
+ CROSSCHECK_BATCH = "crosscheck"
45
+
46
+ REFLECT_UNIT = "reflect"
47
+ VERIFY_UNIT = "verify"
48
+
49
+ # 可写字段(本管线只动这一处,杜绝越界面)
50
+ WRITABLE_FIELDS = ("验证方式",)
51
+ FIELD_NORMALIZE = {
52
+ "验证方式": "验证方式",
53
+ "verification_basis": "验证方式",
54
+ "验证": "验证方式",
55
+ "verification": "验证方式",
56
+ }
57
+
58
+ # 赛道 → 来源执照策略
59
+ SOURCE_POLICY = {"science": "reproducible", "humanities": "consistency"}
60
+
61
+ # 学科关键词(赛道判定;两栖词不入表 → undetermined,宁缺勿猜)
62
+ SCIENCE_SUBJECT_HINTS = (
63
+ "数学", "物理", "化学", "生物", "科学", "信息技术", "通用技术", "计算机",
64
+ )
65
+ HUMANITIES_SUBJECT_HINTS = (
66
+ "语文", "历史", "政治", "道德与法治", "思想政治", "思想品德", "英语",
67
+ "文学", "哲学", "艺术", "音乐", "美术",
68
+ )
69
+
70
+ # 基底枚举 → 可读标签(条件化表述引用)
71
+ BASIS_LABEL = {
72
+ "compiler": "编译器/静态检查",
73
+ "test": "单元测试",
74
+ "measurement": "实测数据",
75
+ "formal_proof": "形式化证明",
76
+ "data": "数据统计",
77
+ "textbook": "人教版教材",
78
+ "public_kb": "公开知识库",
79
+ "other": "人工评审",
80
+ }
81
+
82
+ CLAIM_FIELDS = ("功能名", "生效条件", "子功能", "执行")
83
+ B_CLAIM = "B_valuation"
84
+ A_CLAIM = "A_fact"
85
+
86
+ # B 型(评价性断言)标记词:只收「明显是价值判断/修饰」的表达,避免把事实误判。
87
+ VALUATION_MARKERS = (
88
+ "结晶", "瑰宝", "杰作", "卓越", "杰出", "伟大", "不朽", "巅峰", "典范",
89
+ "精华", "珍品", "璀璨", "辉煌", "丰碑", "博大精深", "源远流长",
90
+ "不可估量", "无与伦比", "举足轻重", "首屈一指", "独树一帜", "别具一格",
91
+ "最优秀", "极富", "令人叹为观止", "不可磨灭", "辉煌成就", "灿烂", "崇高",
92
+ "非凡",
93
+ )
94
+ VALUATION_PATTERNS = (
95
+ re.compile(r"被誉为|被称[之为]|堪称|不愧[为是]"),
96
+ re.compile(r"是[^,。;\n]{0,24}的(结晶|瑰宝|杰作|典范|精华|骄傲|象征|丰碑)"),
97
+ )
98
+
99
+ CONDITION_MARK = "〔来源限定〕"
100
+
101
+
102
+ # ---- 赛道与来源执照 ------------------------------------------------------
103
+
104
+ # 生效条件:给定 fm,若显式 track/discipline_type 命中枚举则返回对应赛道;否则用相关元数据与正文 CCG 字段匹配提示词,返回 humanities/science/undetermined。
105
+ def classify_track(fm: dict, content: str = "") -> str:
106
+ """判定节点赛道:`humanities` / `science` / `undetermined`。
107
+
108
+ 只看**已声明**的元数据(显式字段 > 学科标记),不扫正文散文,避免误判。
109
+ """
110
+ fm = fm or {}
111
+ explicit = str(fm.get("track") or fm.get("discipline_type") or "").strip().lower()
112
+ if explicit in ("humanities", "文科", "arts"):
113
+ return "humanities"
114
+ if explicit in ("science", "理科", "stem"):
115
+ return "science"
116
+ st = fm.get("state_attributes")
117
+ name = _as_text(st.get("name")) if isinstance(st, dict) else ""
118
+ parts = [
119
+ name,
120
+ _as_text(fm.get("title")),
121
+ _as_text(fm.get("discipline")),
122
+ _as_text(fm.get("subject")),
123
+ " ".join(str(t) for t in (fm.get("tags") or [])),
124
+ _ccg_field(content, "功能名"),
125
+ _ccg_field(content, "执行"),
126
+ _ccg_field(content, "子功能"),
127
+ ]
128
+ text = " ".join(p for p in parts if p)
129
+ has_sci = any(k in text for k in SCIENCE_SUBJECT_HINTS)
130
+ has_hum = any(k in text for k in HUMANITIES_SUBJECT_HINTS)
131
+ if has_sci and not has_hum:
132
+ return "science"
133
+ if has_hum and not has_sci:
134
+ return "humanities"
135
+ return "undetermined"
136
+
137
+
138
+ # 生效条件:给定 track,返回 SOURCE_POLICY 中映射的策略名;未知 track 返回空串。
139
+ def source_policy(track: str) -> str:
140
+ """赛道 → 来源策略名(空串表示不可判定,应 DEFER)。"""
141
+ return SOURCE_POLICY.get(track or "", "")
142
+
143
+
144
+ # 生效条件:给定 track,若为 science 返回 REPRODUCIBLE_BASIS,若为 humanities 返回 CONSISTENCY_BASIS,否则返回 ()。
145
+ def allowed_basis(track: str) -> tuple:
146
+ if track == "science":
147
+ return tuple(nodefile.REPRODUCIBLE_BASIS)
148
+ if track == "humanities":
149
+ return tuple(nodefile.CONSISTENCY_BASIS)
150
+ return ()
151
+
152
+
153
+ # 生效条件:给定 track 与 basis,当 basis 非空且其字符串形式属于 allowed_basis(track) 时返回 True,否则 False。
154
+ def basis_licensed(track: str, basis) -> bool:
155
+ """来源执照:理科要可复现证据,文科要来源一致性;赛道未定一律不发放。"""
156
+ return bool(basis) and str(basis) in allowed_basis(track)
157
+
158
+
159
+ # 生效条件:给定 field,返回 FIELD_NORMALIZE 映射值;未知字段返回空串。
160
+ def normalize_field(field) -> str:
161
+ return FIELD_NORMALIZE.get(str(field or "").strip(), "")
162
+
163
+
164
+ # 生效条件:给定 v,若为 None 返回 [];否则将单值或列表转为去除空白后非空字符串的列表。
165
+ def _as_source(v) -> list:
166
+ if v is None:
167
+ return []
168
+ items = list(v) if isinstance(v, (list, tuple)) else [v]
169
+ return [str(x).strip() for x in items if str(x).strip()]
170
+
171
+
172
+ # ---- B 型识别与条件化改写 ------------------------------------------------
173
+
174
+ # 生效条件:给定 text,若含 VALUATION_MARKERS 或匹配 VALUATION_PATTERNS 则返回 B_CLAIM,否则 A_CLAIM。
175
+ def claim_type(text) -> str:
176
+ """`A_fact`(事实性)或 `B_valuation`(评价性断言)。"""
177
+ s = str(text or "")
178
+ if not s.strip():
179
+ return A_CLAIM
180
+ if any(m in s for m in VALUATION_MARKERS):
181
+ return B_CLAIM
182
+ if any(p.search(s) for p in VALUATION_PATTERNS):
183
+ return B_CLAIM
184
+ return A_CLAIM
185
+
186
+
187
+ # 生效条件:给定 text,返回其去除首尾空白后是否以 CONDITION_MARK 开头。
188
+ def is_conditioned(text) -> bool:
189
+ return str(text or "").strip().startswith(CONDITION_MARK)
190
+
191
+
192
+ # 生效条件:给定 text、label、source,若 text 非空且 label 非空且 source 解析后非空,则返回带 CONDITION_MARK 的来源限定表述;已条件化原样返回;否则 None。
193
+ def conditioned_claim(text, label, source):
194
+ """把评价性断言改写为**带来源限定的条件表述**;缺来源/标签则返回 `None`(不写)。
195
+
196
+ 形态:`〔来源限定〕据<来源标签>(<来源>)的表述:<原文>`——
197
+ 原文完整保留(可追溯),前缀显式声明「这是某来源的表述」而非无条件事实。
198
+ 已条件化的文本原样返回(幂等)。
199
+ """
200
+ body = str(text or "").strip()
201
+ if not body or not label:
202
+ return None
203
+ if is_conditioned(body):
204
+ return body
205
+ src = ";".join(_as_source(source))
206
+ if not src:
207
+ return None
208
+ return f"{CONDITION_MARK}据{label}({src})的表述:{body}"
209
+
210
+
211
+ # 生效条件:给定 fm 与 content,提取 CCG 声明字段、comment 值与正文长句,返回断言列表,每项含 text/type/where/field。
212
+ def extract_claims(fm: dict, content: str) -> list:
213
+ """提取可核对断言:CCG 声明字段 + comment 值 + 正文长句。
214
+
215
+ 每条:`{"text", "type", "where", "field"}`;`where` ∈ ccg/comment/body。
216
+ 占位标记不成为断言。
217
+ """
218
+ out, seen = [], set()
219
+
220
+ # 生效条件:仅当 str(text or "").strip() 得到的 s 长度 >= 4、s 不在 seen 中、且 nodefile.is_placeholder_text(s) 为假时,把 {text: s, type: claim_type(s), where, field} 追加进 out 并把 s 加入 seen,否则直接返回(field 默认 "")。
221
+ def _push(text, where, field=""):
222
+ s = str(text or "").strip()
223
+ if len(s) < 4 or s in seen or nodefile.is_placeholder_text(s):
224
+ return
225
+ seen.add(s)
226
+ out.append({"text": s, "type": claim_type(s), "where": where,
227
+ "field": field})
228
+
229
+ for f in CLAIM_FIELDS:
230
+ v = _ccg_field(content, f)
231
+ if v:
232
+ _push(v, "ccg", f)
233
+ c = _comment(fm)
234
+ for f in CLAIM_FIELDS:
235
+ v = c.get(f)
236
+ if isinstance(v, list):
237
+ for item in v:
238
+ _push(item, "comment", f)
239
+ elif v:
240
+ _push(v, "comment", f)
241
+ for line in (content or "").split("\n"):
242
+ raw = line.strip()
243
+ if not raw:
244
+ continue
245
+ body = raw.lstrip("#").strip()
246
+ if body.split(":", 1)[0].strip() in nodefile.CCG_MARKS:
247
+ continue # 声明行已按 CCG 字段处理,不重复断言
248
+ for sent in re.split(r"[。!?]", body):
249
+ s = sent.strip()
250
+ if len(s) >= 8 and not s.startswith(CONDITION_MARK):
251
+ _push(s, "body", "")
252
+ return out
253
+
254
+
255
+ # 生效条件:给定 fm、content、claim、new_text,按 claim.where 定位并在唯一匹配时替换断言返回 (content, True),否则返回 (content, False)。
256
+ def _rewrite_claim(fm: dict, content: str, claim: dict, new_text: str):
257
+ """节点内定位并替换一条断言 → `(content, ok)`;定位不唯一则 fail-closed 不动。"""
258
+ where, field = claim.get("where"), claim.get("field")
259
+ before = str(claim.get("text") or "")
260
+ if where == "ccg" and field:
261
+ if _ccg_field(content, field).strip() == before.strip():
262
+ return _upsert_ccg_line(content, field, new_text), True
263
+ return content, False
264
+ if where == "comment" and field:
265
+ c = _comment(fm)
266
+ v = c.get(field)
267
+ if isinstance(v, list):
268
+ if before in v:
269
+ c[field] = [new_text if x == before else x for x in v]
270
+ return content, True
271
+ return content, False
272
+ if str(v or "").strip() == before.strip():
273
+ c[field] = new_text
274
+ return content, True
275
+ return content, False
276
+ if where == "body":
277
+ if before and content.count(before) == 1:
278
+ return content.replace(before, new_text), True
279
+ return content, False
280
+ return content, False
281
+
282
+
283
+ # ---- 工单 ----------------------------------------------------------------
284
+
285
+ # 生效条件:给定 fm 与 content,返回缺失项列表:verification_basis 无效则加入该名,正文无 "# 验证方式" 行则加入该名。
286
+ def _need(fm: dict, content: str) -> list:
287
+ need = []
288
+ if not nodefile.verification_basis_valid(fm):
289
+ need.append("verification_basis")
290
+ if not _has_ccg_line(content, "验证方式"):
291
+ need.append("验证方式")
292
+ return need
293
+
294
+
295
+ # 生效条件:给定 nid、e、fm、content,返回含 id、layer、track、claims、need、source_policy 的工单行字典。
296
+ def _worklist_row(nid: str, e: dict, fm: dict, content: str) -> dict:
297
+ track = classify_track(fm, content)
298
+ return {
299
+ "id": nid,
300
+ "layer": e.get("layer"),
301
+ "track": track,
302
+ "claims": extract_claims(fm, content),
303
+ "need": _need(fm, content),
304
+ "source_policy": source_policy(track),
305
+ }
306
+
307
+
308
+ # 生效条件:给定 fm 与 content,若正文或 comment 中声明的执行字段为占位文本则返回 True;未声明执行时以正文整体占位判定。
309
+ def _is_placeholder_shell(fm: dict, content: str) -> bool:
310
+ """空壳判定:核心可执行内容未被填充 → 禁止接线(不得把「待填充」固化成事实)。
311
+
312
+ 口径(宁漏判不误判):
313
+ 1. 已声明 `执行`(正文 `# 执行:` 行优先,其次 `state_attributes.comment.执行`)
314
+ 且值为占位标记 → 空壳;
315
+ 2. 未声明 `执行` 时,以正文整体是否为空/占位标记为准——无 comment 但正文写实的
316
+ `kp_archaeo_*` 类节点因此不被误判为空壳。
317
+ """
318
+ decl = _ccg_field(content, "执行") or _as_text(_comment(fm).get("执行"))
319
+ if decl:
320
+ return nodefile.is_placeholder_text(decl)
321
+ return nodefile.is_placeholder_text(content)
322
+
323
+
324
+ # 生效条件:给定 cg,逐节点按 layer/ids/prefix 过滤后产出状态为 skip(internal/denied/locked/derived/present/placeholder/unreadable 等)或 row 的扫描结果。
325
+ def _scan(cg, layer=None, ids=None, prefix=None):
326
+ """逐节点产出扫描结果:`{"status", "reason"?, "id", "row"?}`。
327
+
328
+ `prefix`:只纳入 id 以该前缀开头的节点(真实库以 `kp_` 收窄到用户知识节点,
329
+ 避免 `node_`/`note_`/`imgpart_` 等派生记忆混入工单);**不计数**,与 `layer` 同理。
330
+ """
331
+ want = set(ids) if ids else None
332
+ for nid, e in list((cg.index.get("nodes") or {}).items()):
333
+ if want is not None and nid not in want:
334
+ continue
335
+ if prefix and not str(nid).startswith(prefix):
336
+ continue
337
+ if layer and e.get("layer") != layer:
338
+ continue
339
+ if e.get("layer") in INTERNAL_LAYERS:
340
+ yield {"status": "skip", "reason": "internal", "id": nid}
341
+ continue
342
+ if not _readable_guard(cg, e):
343
+ yield {"status": "skip", "reason": "denied", "id": nid}
344
+ continue
345
+ fm, content = direct_read(cg, e) # 扫描读喂写面:走盘上真值(读缓存口径)
346
+ if fm is None:
347
+ yield {"status": "skip", "reason": "unreadable", "id": nid}
348
+ continue
349
+ if crypto.is_encrypted(content):
350
+ yield {"status": "skip", "reason": "locked", "id": nid}
351
+ continue
352
+ if e.get("layer") in SKIP_LAYERS or any(
353
+ t in SKIP_TAGS for t in (fm.get("tags") or [])):
354
+ yield {"status": "skip", "reason": "derived", "id": nid}
355
+ continue
356
+ need = _need(fm, content)
357
+ if not need: # 已齐备
358
+ yield {"status": "skip", "reason": "present", "id": nid}
359
+ continue
360
+ ph = []
361
+ der = derive_fields(fm, content, placeholder_out=ph)
362
+ if _is_placeholder_shell(fm, content): # 空壳:转待填充工单
363
+ yield {"status": "skip", "reason": "placeholder", "id": nid,
364
+ "placeholder_fields": ph}
365
+ continue
366
+ yield {"status": "row", "id": nid,
367
+ "row": _worklist_row(nid, e, fm, content)}
368
+
369
+
370
+ _SKIP_KEY = {"locked": "skipped_locked", "derived": "skipped_derived",
371
+ "present": "skipped_present", "denied": "skipped_denied",
372
+ "unreadable": "skipped_unreadable", "internal": "skipped_internal"}
373
+
374
+
375
+ # 生效条件:给定 x(路径或 MdCGOS),只读扫描并生成缺 verification_basis 或 "# 验证方式" 的节点工单,返回统计 rep。
376
+ def build_worklist(x, layer=None, limit=None, ids=None, prefix=None) -> dict:
377
+ """生成核对工单(只读):缺 `verification_basis`/`验证方式` 的节点入列。
378
+
379
+ `prefix`:按 id 前缀收窄范围(真实库用 `kp_`,与计划交付边界一致);
380
+ 内部 `anchor`/`self` 层一律出局(计入 `skipped_internal`)。
381
+ """
382
+ cg = _as_cg(x)
383
+ rep = {"root": cg.root, "dry_run": True, "action": "crosscheck_worklist",
384
+ "prefix": prefix, "nodes_scanned": 0, "skipped_locked": 0,
385
+ "skipped_derived": 0, "skipped_internal": 0, "skipped_present": 0,
386
+ "skipped_denied": 0, "skipped_placeholder": 0,
387
+ "skipped_unreadable": 0, "placeholder_ids": [], "undetermined": 0,
388
+ "targeted": 0, "items": []}
389
+ for scan in _scan(cg, layer=layer, ids=ids, prefix=prefix):
390
+ rep["nodes_scanned"] += 1
391
+ if scan["status"] == "skip":
392
+ reason = scan["reason"]
393
+ if reason == "placeholder":
394
+ rep["skipped_placeholder"] += 1
395
+ rep["placeholder_ids"].append(scan["id"])
396
+ else:
397
+ key = _SKIP_KEY.get(reason)
398
+ if key:
399
+ rep[key] += 1
400
+ continue
401
+ row = scan["row"]
402
+ if row["track"] == "undetermined":
403
+ rep["undetermined"] += 1
404
+ rep["targeted"] += 1
405
+ if limit is None or len(rep["items"]) < limit:
406
+ rep["items"].append(row)
407
+ rep["planned_ids"] = [r["id"] for r in rep["items"]]
408
+ return rep
409
+
410
+
411
+ # ---- 子代理接口(提示词 + 解析) -----------------------------------------
412
+
413
+ _REFLECT_TEMPLATE = """你是认知图节点的**反思单元**(reflect)。为节点补齐「验证方式」与其验证基底。
414
+ 赛道:{track};来源策略:{policy};待补字段:{need}
415
+ 节点标题:{title}
416
+ 已声明断言:
417
+ {claims}
418
+ 正文:
419
+ {body}
420
+
421
+ 只输出 JSON 数组,元素形如:
422
+ {{"field":"验证方式","value":"<一句可核对的验证方式声明>","basis":"<基底枚举>","source":["<教材版本+章节 或 公开知识库条目地址>"],"verdict":"accept|defer","reason":"<理由>"}}
423
+ 硬约束:
424
+ 1. 文科(humanities)basis 只能是 textbook / public_kb;
425
+ 2. 理科(science)basis 只能是 compiler / test / measurement / formal_proof / data;
426
+ 3. 来源必须可追溯(教材名称+章节,或公开知识库条目地址);拿不出来就把 verdict 置 defer、source 留空;
427
+ 4. 只能补 field=验证方式,禁止新增其它字段。"""
428
+
429
+ _VERIFY_TEMPLATE = """你是独立**验证单元**(verify)。对下列候选逐条复核:来源是否真实可追溯、基底是否与赛道相容。
430
+ 赛道:{track};来源策略:{policy}
431
+ 候选(JSON):
432
+ {candidates}
433
+
434
+ 只输出 JSON 数组,元素形如:
435
+ {{"field":"验证方式","value":"<原样回填候选 value>","verdict":"accept|drop|defer","reason":"<理由>"}}
436
+ 硬约束:你只能否决(drop)或存疑(defer),**不得新增候选、不得改写 value**。"""
437
+
438
+
439
+ # 生效条件:给定 row、fm、content,用 row 的 track/source_policy/need/claims 与 fm 标题、content 前 1200 字符填充反思模板并返回字符串。
440
+ def reflect_prompt(row: dict, fm: dict, content: str) -> str:
441
+ claims = "\n".join(f"- [{c['type']}] {c['text']}" for c in (row.get("claims") or []))
442
+ return _REFLECT_TEMPLATE.format(
443
+ track=row.get("track"), policy=row.get("source_policy") or "(未定)",
444
+ need="、".join(row.get("need") or []),
445
+ title=_as_text(fm.get("title")) or row.get("id"),
446
+ claims=claims or "(无)",
447
+ body=(content or "")[:1200])
448
+
449
+
450
+ # 生效条件:给定 row 与 rows,把候选字段、值、依据、来源序列化为 JSON 并填充验证模板返回字符串。
451
+ def verify_prompt(row: dict, rows: list) -> str:
452
+ cands = [{"field": r.get("field"), "value": r.get("value"),
453
+ "basis": r.get("basis"), "source": r.get("source")} for r in rows]
454
+ return _VERIFY_TEMPLATE.format(
455
+ track=row.get("track"), policy=row.get("source_policy") or "(未定)",
456
+ candidates=json.dumps(cands, ensure_ascii=False))
457
+
458
+
459
+ # 生效条件:raw 经 str(raw or "") 得 s 后,want_list 为真时先试 s 首个 "[" 至末个 "]"、再试首个 "{" 至末个 "}"(want_list 假值时只试花括号),区间可被 json.loads 解析且结果为 list 时原样返回该 list;结果为 dict 时按 rows/items/verdicts/candidates/data 顺序取首个 obj.get(key) 为 list 的 obj[key],都不满足则返回 [obj],非 list/dict 或区间缺失、解析抛 ValueError 时继续下一组括号,全部落空(含 raw 为假值使 s 为空串)返回 []。
460
+ def _extract_json(raw, want_list=True):
461
+ """从模型输出里抽取 JSON(容忍代码围栏与前后废话)。"""
462
+ s = str(raw or "")
463
+ pairs = ([("[", "]")] if want_list else []) + [("{", "}")]
464
+ for op, cl in pairs:
465
+ i, j = s.find(op), s.rfind(cl)
466
+ if i < 0 or j <= i:
467
+ continue
468
+ try:
469
+ obj = json.loads(s[i:j + 1])
470
+ except ValueError:
471
+ continue
472
+ if isinstance(obj, list):
473
+ return obj
474
+ if isinstance(obj, dict):
475
+ for key in ("rows", "items", "verdicts", "candidates", "data"):
476
+ if isinstance(obj.get(key), list):
477
+ return obj[key]
478
+ return [obj]
479
+ return []
480
+
481
+
482
+ # 生效条件:给定 item,若为 dict 则规范化 field/value/basis/source/verdict/reason 后返回字典,否则返回 {}。
483
+ def _norm_row(item) -> dict:
484
+ if not isinstance(item, dict):
485
+ return {}
486
+ return {
487
+ "field": normalize_field(item.get("field")) or str(item.get("field") or "").strip(),
488
+ "value": _as_text(item.get("value")),
489
+ "basis": str(item.get("basis") or "").strip(),
490
+ "source": _as_source(item.get("source")),
491
+ "verdict": str(item.get("verdict") or "").strip().lower(),
492
+ "reason": str(item.get("reason") or "").strip(),
493
+ }
494
+
495
+
496
+ # 生效条件:给定 raw,解析 JSON 行并保留 field 为“验证方式”或“verification_basis”(统一为“验证方式”)的行,返回列表。
497
+ def parse_reflect_rows(raw) -> list:
498
+ out = []
499
+ for item in _extract_json(raw, want_list=True):
500
+ r = _norm_row(item)
501
+ if not r or r["field"] not in ("验证方式", "verification_basis"):
502
+ continue
503
+ r["field"] = "验证方式"
504
+ out.append(r)
505
+ return out
506
+
507
+
508
+ # 生效条件:遍历 _extract_json(raw, want_list=False)(只认花括号 JSON)的结果,仅当 item 经 _norm_row 后为真且 r["field"] 非空时产出 {field,value,verdict,reason} 四键行,否则跳过(raw 无可解析花括号对象时 out 为空列表)。
509
+ def parse_verify_rows(raw) -> list:
510
+ out = []
511
+ for item in _extract_json(raw, want_list=False):
512
+ r = _norm_row(item)
513
+ if not r or not r["field"]:
514
+ continue
515
+ out.append({k: r[k] for k in ("field", "value", "verdict", "reason")})
516
+ return out
517
+
518
+
519
+ # ---- 白箱闸门与双单元折叠 ------------------------------------------------
520
+
521
+ # 生效条件:逐行处理 rows,仅当 normalize_field(r.get("field")) 落在 WRITABLE_FIELDS、basis_licensed(track, r.get("basis")) 为真、r.get("source") 为真、且 r.get("value") or BASIS_TEXT.get(str(r.get("basis")), "") 非空时进入 kept(附 verdict="accept"),否则该行带对应 reason 进入 gated。
522
+ def gate_rows(rows: list, track: str) -> tuple:
523
+ """零模型白箱闸门:字段越界 / 来源执照不通过 / 无来源 → 一律降级为 defer。
524
+
525
+ 返回 `(kept, gated)`;`kept` 只含「执照齐全」的候选,可进验证单元。
526
+ """
527
+ kept, gated = [], []
528
+ for r in rows:
529
+ f = normalize_field(r.get("field"))
530
+ row = dict(r, field=f)
531
+ if f not in WRITABLE_FIELDS:
532
+ gated.append(dict(row, reason=f"越界字段:{r.get('field')}"))
533
+ continue
534
+ if not basis_licensed(track, r.get("basis")):
535
+ gated.append(dict(row, reason=f"{track or '未定赛道'} 不接受基底 {r.get('basis') or '(缺)'}"))
536
+ continue
537
+ if not r.get("source"):
538
+ gated.append(dict(row, reason="无来源,不写"))
539
+ continue
540
+ value = r.get("value") or BASIS_TEXT.get(str(r.get("basis")), "")
541
+ if not value:
542
+ gated.append(dict(row, reason="无验证方式声明"))
543
+ continue
544
+ kept.append(dict(row, value=value, verdict="accept"))
545
+ return kept, gated
546
+
547
+
548
+ # 生效条件:按 (r.get("id"), normalize_field(r.get("field")) or r.get("field"), r.get("value")) 分组后,组内缺 unit==REFLECT_UNIT 或 unit==VERIFY_UNIT 的行时进 deferred,否则 verify 侧出现 verdict=="drop" 即进 dropped(veto 优先),再否则仅当 reflect 与 verify 各存在 verdict=="accept" 时才进 accepted(附 units),其余进 deferred。
549
+ def fold_verdicts(rows: list) -> tuple:
550
+ """把两单元裁决折叠为可落库结论 → `(accepted, deferred, dropped)`。
551
+
552
+ 接受条件:同 `(id, field, value)` 同时存在 reflect-accept 与 verify-accept;
553
+ 任一 verify-drop 即否决(veto 优先)。
554
+ """
555
+ groups = OrderedDict()
556
+ for r in rows:
557
+ key = (r.get("id"), normalize_field(r.get("field")) or r.get("field"),
558
+ r.get("value"))
559
+ groups.setdefault(key, []).append(r)
560
+ accepted, deferred, dropped = [], [], []
561
+ for (nid, field, value), rs in groups.items():
562
+ refl = [r for r in rs if r.get("unit") == REFLECT_UNIT]
563
+ ver = [r for r in rs if r.get("unit") == VERIFY_UNIT]
564
+ base = {"id": nid, "field": field or "验证方式", "value": value,
565
+ "basis": next((r.get("basis") for r in refl if r.get("basis")), ""),
566
+ "source": next((r.get("source") for r in refl if r.get("source")), []),
567
+ "track": next((r.get("track") for r in refl if r.get("track")), "")}
568
+ if not refl or not ver:
569
+ base["reason"] = "缺" + ("反思裁决" if not refl else "验证裁决")
570
+ deferred.append(base)
571
+ continue
572
+ if any(r.get("verdict") == "drop" for r in ver):
573
+ base["reason"] = next((r.get("reason") for r in ver
574
+ if r.get("verdict") == "drop"), "验证单元否决")
575
+ dropped.append(base)
576
+ continue
577
+ ra = any(r.get("verdict") == "accept" for r in refl)
578
+ va = any(r.get("verdict") == "accept" for r in ver)
579
+ if ra and va:
580
+ base["units"] = {
581
+ "reflect": sorted({str(r.get("actor") or REFLECT_UNIT) for r in refl}),
582
+ "verify": sorted({str(r.get("actor") or VERIFY_UNIT) for r in ver}),
583
+ }
584
+ accepted.append(base)
585
+ else:
586
+ base["reason"] = f"单元未确认(reflect={ra}, verify={va})"
587
+ deferred.append(base)
588
+ return accepted, deferred, dropped
589
+
590
+
591
+ # 生效条件:当 rows 中 unit==REFLECT_UNIT 与 unit==VERIFY_UNIT 的执行者经 str(x.get("actor") or "") 后存在相同的非空值(空串被 discard)时返回 True,否则返回 False。
592
+ def detect_self_verify(rows: list) -> bool:
593
+ """同一执行者同时充当反思与验证 = 自证(禁止)。"""
594
+ r = {str(x.get("actor") or "") for x in rows if x.get("unit") == REFLECT_UNIT}
595
+ v = {str(x.get("actor") or "") for x in rows if x.get("unit") == VERIFY_UNIT}
596
+ r.discard("")
597
+ v.discard("")
598
+ return bool(r & v)
599
+
600
+
601
+ # ---- 落库写入 ------------------------------------------------------------
602
+
603
+ # 生效条件:verdicts 为 None 时返回 None;verdicts 为 dict 时对每个键值把 (rs or []) 中的 dict 元素收为 {str(nid): [...]};否则遍历 verdicts or [],仅当元素为 dict 且 str(r.get("id") or "") 非空时按该 id 追加到对应列表。
604
+ def _norm_verdicts(verdicts):
605
+ """外部裁决(子代理落盘)→ `{id: [rows]}`。"""
606
+ if verdicts is None:
607
+ return None
608
+ out = OrderedDict()
609
+ if isinstance(verdicts, dict):
610
+ for nid, rs in verdicts.items():
611
+ out[str(nid)] = [dict(x) for x in (rs or []) if isinstance(x, dict)]
612
+ return out
613
+ for r in verdicts or []:
614
+ if not isinstance(r, dict):
615
+ continue
616
+ nid = str(r.get("id") or "")
617
+ if nid:
618
+ out.setdefault(nid, []).append(dict(r))
619
+ return out
620
+
621
+
622
+ # 生效条件:accepted 非空(取 accepted[0])时,先以 basis=str(a.get("basis") or BASIS_ENUM_DEFAULT) 与 value=str(a.get("value") or BASIS_TEXT.get(basis, "")).strip() 写「验证方式」行与 comment,之后才在 nodefile.verification_basis_valid(fm) 为真时把 basis 换成 fm.get("verification_basis")、否则把该 basis 写入 fm["verification_basis"];condition_claims 为真时仅对 row.get("claims") 中 type==B_CLAIM 且未被 is_conditioned 的条目做条件化改写,返回含 fm_before、content_hash_before 等留痕的 dict。
623
+ def _apply_node(cg, nid, e, fm, content, accepted, row, batch, actor,
624
+ condition_claims=True):
625
+ """把一个节点的已接受结论写入 md,返回留痕记录(含回滚所需现场)。"""
626
+ a = accepted[0]
627
+ basis = str(a.get("basis") or BASIS_ENUM_DEFAULT)
628
+ source = _as_source(a.get("source"))
629
+ content_before = content
630
+ value = str(a.get("value") or BASIS_TEXT.get(basis, "")).strip()
631
+
632
+ vb_before = {"had": "verification_basis" in fm,
633
+ "value": fm.get("verification_basis")}
634
+ prov_before = {"had": "verification_evidence" in fm,
635
+ "value": fm.get("verification_evidence")}
636
+ line_before = {"had": _has_ccg_line(content, "验证方式"),
637
+ "value": _ccg_field(content, "验证方式")}
638
+ comment0 = _comment(fm)
639
+ cv_before = {"had": "验证方式" in comment0, "value": comment0.get("验证方式")}
640
+
641
+ # 1) 落「验证方式」规范行 + comment + verification_basis(已有合法基底不覆盖)
642
+ content = _upsert_ccg_line(content, "验证方式", value)
643
+ _ensure_comment(fm)["验证方式"] = value
644
+ if nodefile.verification_basis_valid(fm):
645
+ basis = str(fm.get("verification_basis"))
646
+ else:
647
+ fm["verification_basis"] = basis
648
+
649
+ # 2) B 型评价断言 → 条件化表述(A 型保持原样;无来源已由闸门挡掉)
650
+ conditioned = []
651
+ if condition_claims:
652
+ label = BASIS_LABEL.get(basis, basis)
653
+ for c in row.get("claims") or []:
654
+ if c.get("type") != B_CLAIM or is_conditioned(c.get("text")):
655
+ continue
656
+ new = conditioned_claim(c.get("text"), label, source)
657
+ if not new or new == c.get("text"):
658
+ continue
659
+ nc, ok = _rewrite_claim(fm, content, c, new)
660
+ if not ok:
661
+ continue
662
+ content = nc
663
+ conditioned.append({"where": c.get("where"), "field": c.get("field") or "",
664
+ "before": c.get("text"), "after": new})
665
+
666
+ wid = _sha(f"{nid}|{batch}|{time.time()}")
667
+ fm["verification_evidence"] = {
668
+ "at": round(time.time(), 3), "batch": batch, "basis": basis,
669
+ "source": source, "track": row.get("track"),
670
+ "policy": row.get("source_policy"), "write_id": wid,
671
+ "units": a.get("units") or {},
672
+ "conditioned": len(conditioned),
673
+ }
674
+
675
+ cg._write_node(nid, os.path.join(cg.root, e["path"]), fm, content,
676
+ durable=True)
677
+ return {
678
+ "action": "crosscheck", "ts": time.time(), "batch": batch,
679
+ "actor": actor, "entry_id": _entry_id(batch, nid), "write_id": wid,
680
+ "node": nid, "layer": e.get("layer"), "track": row.get("track"),
681
+ "policy": row.get("source_policy"), "basis": basis,
682
+ "verification_value": value, "source": source,
683
+ "units": a.get("units") or {},
684
+ "fm_before": {"verification_basis": vb_before,
685
+ "verification_evidence": prov_before,
686
+ "comment_verification": cv_before},
687
+ "verification_line_before": line_before,
688
+ "claims_conditioned": conditioned,
689
+ "content_hash_before": _sha(content_before),
690
+ "content_hash_after": _sha(content),
691
+ }
692
+
693
+
694
+ # ---- 主流程 --------------------------------------------------------------
695
+
696
+ # 生效条件:reflect_fn(reflect_prompt(scan_row, fm, content)) 经 parse_reflect_rows 得到非空候选时返回 (rrows, vrows),rrows 为空则返回 ([], []);verify_fn 为 None 时 vrows 为空列表,非 None 时由 parse_verify_rows(verify_fn(verify_prompt(scan_row, rrows))) 生成、每行 value 为 c.get("value") or rrows 中同 field 的 value、再回落 ""。
697
+ def _rows_for(scan_row, fm, content, reflect_fn, verify_fn, r_actor, v_actor):
698
+ """调用两单元子代理,返回合并后的裁决行(reflect + verify)。"""
699
+ prompt = reflect_prompt(scan_row, fm, content)
700
+ cands = parse_reflect_rows(reflect_fn(prompt))
701
+ rrows = [dict(c, id=scan_row["id"], unit=REFLECT_UNIT, actor=r_actor,
702
+ track=scan_row["track"]) for c in cands]
703
+ if not rrows:
704
+ return [], []
705
+ vrows = []
706
+ if verify_fn is not None:
707
+ vp = verify_prompt(scan_row, rrows)
708
+ vrows = [dict(c, id=scan_row["id"], unit=VERIFY_UNIT, actor=v_actor,
709
+ track=scan_row["track"],
710
+ value=c.get("value") or next(
711
+ (x.get("value") for x in rrows
712
+ if x.get("field") == c.get("field")), ""))
713
+ for c in parse_verify_rows(verify_fn(vp))]
714
+ return rrows, vrows
715
+
716
+
717
+ # 生效条件:对 pre 中每个 r,str(r.get("unit") or REFLECT_UNIT).strip().lower() 等于 VERIFY_UNIT 时进 vrows,否则(含 unit 缺失回落到 REFLECT_UNIT 及任何其他取值)进 rrows,两组行均覆盖 id=nid、unit、track=track。
718
+ def _rows_from_verdicts(nid, track, pre):
719
+ """从外部裁决中拆出 (reflect, verify) 两组行。"""
720
+ rrows, vrows = [], []
721
+ for r in pre:
722
+ unit = str(r.get("unit") or REFLECT_UNIT).strip().lower()
723
+ base = dict(r, id=nid, unit=unit, track=track)
724
+ (vrows if unit == VERIFY_UNIT else rrows).append(base)
725
+ return rrows, vrows
726
+
727
+
728
+ # 生效条件:x 经 _as_cg 解析且 batch = batch or CROSSCHECK_BATCH 后逐节点扫描,裁决来源按 vmap(verdicts 归一化后非 None)→ reflect_fn 非 None → 二者皆无记 no_reflect 三条分支取行;allow_self_verify=False 时同执行者自证记 self_verify_disallowed,再经 gate_rows 闸门与 require_verify 后 fold_verdicts,仅 apply=True 才 _apply_node 写盘并在有写入时 cg.rebuild_index;limit 非 None 且已达标数 >= limit 时用 continue 跳过(非终止)。
729
+ def crosscheck(x, layer=None, limit=None, ids=None, reflect_fn=None,
730
+ verify_fn=None, verdicts=None, apply=False,
731
+ batch=CROSSCHECK_BATCH, actor=None, require_verify=True,
732
+ allow_self_verify=False, reflect_actor=None, verify_actor=None,
733
+ condition_claims=True, verbose=True, prefix=None) -> dict:
734
+ """批量核对主流程:工单 → 反思候选 → 白箱闸门 → 验证否决 → 落库。
735
+
736
+ `reflect_fn`/`verify_fn`:可注入的子代理函数(接收提示词、返回 JSON 文本);
737
+ `verdicts`:子代理离线产出的裁决行(`[VERDICT_ROW]` 或 `{id: [rows]}`),
738
+ 二选一。`apply=True` 才写盘。
739
+ """
740
+ cg = _as_cg(x)
741
+ batch = batch or CROSSCHECK_BATCH
742
+ vmap = _norm_verdicts(verdicts)
743
+ r_actor = reflect_actor or getattr(reflect_fn, "__name__", "") or REFLECT_UNIT
744
+ v_actor = verify_actor or getattr(verify_fn, "__name__", "") or VERIFY_UNIT
745
+
746
+ rep = {"root": cg.root, "dry_run": not apply, "action": "crosscheck",
747
+ "batch": batch, "actor": actor, "prefix": prefix, "nodes_scanned": 0,
748
+ "targeted": 0,
749
+ "accepted": 0, "rejected": 0, "deferred": 0, "written": 0,
750
+ "claims_conditioned": 0, "skipped_locked": 0, "skipped_derived": 0,
751
+ "skipped_internal": 0, "skipped_present": 0, "skipped_denied": 0,
752
+ "skipped_unreadable": 0, "skipped_placeholder": 0,
753
+ "placeholder_ids": [], "undetermined": 0,
754
+ "reasons": {}, "samples": [], "entry_ids": []}
755
+
756
+ # 生效条件:无条件执行 rep["reasons"][reason] = rep["reasons"].get(reason, 0) + 1(reason 缺键时按 .get 的第二参数 0 起算),返回 None。
757
+ def _bump(reason):
758
+ rep["reasons"][reason] = rep["reasons"].get(reason, 0) + 1
759
+
760
+ # 生效条件:仅当外层 verbose 为真且 len(rep["samples"]) < 20 时把 {kind, id: nid, detail} 追加进 rep["samples"],否则不追加(已达 20 条即停止采样)。
761
+ def _sample(kind, nid, detail=""):
762
+ if verbose and len(rep["samples"]) < 20:
763
+ rep["samples"].append({"kind": kind, "id": nid, "detail": detail})
764
+
765
+ seen_targets = 0
766
+ for scan in _scan(cg, layer=layer, ids=ids, prefix=prefix):
767
+ rep["nodes_scanned"] += 1
768
+ if scan["status"] == "skip":
769
+ reason = scan["reason"]
770
+ if reason == "placeholder":
771
+ rep["skipped_placeholder"] += 1
772
+ rep["placeholder_ids"].append(scan["id"])
773
+ else:
774
+ key = _SKIP_KEY.get(reason)
775
+ if key:
776
+ rep[key] += 1
777
+ continue
778
+ row = scan["row"]
779
+ if row["track"] == "undetermined":
780
+ rep["undetermined"] += 1
781
+ if limit is not None and seen_targets >= limit:
782
+ continue
783
+ seen_targets += 1
784
+ rep["targeted"] += 1
785
+ nid = row["id"]
786
+ e = cg.index["nodes"].get(nid)
787
+ fm, content = direct_read(cg, e) if e else (None, None) # 写前重查走盘上真值
788
+ if fm is None or crypto.is_encrypted(content):
789
+ rep["skipped_locked"] += 1
790
+ continue
791
+
792
+ # ---- 取两单元裁决 ----
793
+ if vmap is not None:
794
+ pre = vmap.get(nid)
795
+ if not pre:
796
+ rep["deferred"] += 1
797
+ _bump("no_verdict")
798
+ continue
799
+ rrows, vrows = _rows_from_verdicts(nid, row["track"], pre)
800
+ elif reflect_fn is not None:
801
+ try:
802
+ rrows, vrows = _rows_for(row, fm, content, reflect_fn,
803
+ verify_fn, r_actor, v_actor)
804
+ except Exception as exc: # noqa: BLE001
805
+ rep["deferred"] += 1
806
+ _bump(f"unit_error:{type(exc).__name__}")
807
+ continue
808
+ else:
809
+ rep["deferred"] += 1
810
+ _bump("no_reflect")
811
+ continue
812
+
813
+ # 自证:同一执行者既反思又验证 → 拒收
814
+ if not allow_self_verify and detect_self_verify(rrows + vrows):
815
+ rep["deferred"] += 1
816
+ _bump("self_verify_disallowed")
817
+ _sample("self_verify", nid)
818
+ continue
819
+
820
+ # ---- 白箱闸门(对反思候选;验证行只做字段归位) ----
821
+ kept, gated = gate_rows(rrows, row["track"])
822
+ for g in gated:
823
+ _bump(f"gate:{g.get('reason')[:24]}")
824
+ if not kept:
825
+ rep["deferred"] += 1
826
+ _bump("no_candidate")
827
+ _sample("gated", nid, gated[0].get("reason") if gated else "")
828
+ continue
829
+ if require_verify and not vrows:
830
+ rep["deferred"] += 1
831
+ _bump("verify_unavailable")
832
+ continue
833
+
834
+ rows = kept + vrows
835
+ accepted, deferred, dropped = fold_verdicts(rows)
836
+ if dropped and not accepted:
837
+ rep["rejected"] += 1
838
+ _bump("verify_veto")
839
+ _sample("veto", nid, dropped[0].get("reason", ""))
840
+ continue
841
+ if not accepted:
842
+ rep["deferred"] += 1
843
+ _bump("verdict_deferred")
844
+ _sample("deferred", nid, deferred[0].get("reason", "") if deferred else "")
845
+ continue
846
+
847
+ rep["accepted"] += 1
848
+ rep["claims_conditioned"] += sum(
849
+ 1 for c in (row.get("claims") or []) if c.get("type") == B_CLAIM)
850
+ if apply:
851
+ rec = _apply_node(cg, nid, e, fm, content, accepted, row, batch,
852
+ actor, condition_claims=condition_claims)
853
+ append_jsonl(_log_path(cg), rec)
854
+ rep["written"] += 1
855
+ rep["entry_ids"].append(rec["entry_id"])
856
+ _sample("accepted", nid, accepted[0].get("basis", ""))
857
+
858
+ if rep["written"]:
859
+ cg.rebuild_index()
860
+ return rep
861
+
862
+
863
+ # ---- 留痕查询 / 回滚 -----------------------------------------------------
864
+
865
+ # 生效条件:无条件返回 os.path.join(cg.root, CROSSCHECK_LOG)(以 cg.root 与常量 CROSSCHECK_LOG 拼接,无分支)。
866
+ def _log_path(cg) -> str:
867
+ return os.path.join(cg.root, CROSSCHECK_LOG)
868
+
869
+
870
+ # 生效条件:box 非 dict 时返回 False;box 为 dict 且 key=="comment_verification" 时按 box.get("had") 为真则把 comment 的「验证方式」设为 box.get("value")、否则删除该键并返回 True;其他 key 时 had 为真赋 fm[key]=value、否则 fm.pop(key, None) 并返回 True。
871
+ def _reattach(fm: dict, content: str, box: dict, key: str):
872
+ """把 `fm_before[key]` 现场还原到 fm,返回是否发生还原。"""
873
+ if not isinstance(box, dict):
874
+ return False
875
+ had, value = box.get("had"), box.get("value")
876
+ if key == "comment_verification":
877
+ c = _ensure_comment(fm)
878
+ if had:
879
+ c["验证方式"] = value
880
+ else:
881
+ c.pop("验证方式", None)
882
+ return True
883
+ if had:
884
+ fm[key] = value
885
+ else:
886
+ fm.pop(key, None)
887
+ return True
888
+
889
+
890
+ # 生效条件:仅当 str(c.get("after") or "") 非空,且分别满足 where=="ccg" 且 field 真值且 _ccg_field(content, field).strip()==after.strip()(用 before 覆盖该行)、where=="comment" 且 field 真值且 comment 该 field 为含 after 的 list 或 str(v or "").strip()==after.strip()(改为 before)、where=="body" 且 after 出现在 content 中(替换首个匹配)时返回 (content, True);其余情形(含 where 为其他值、字段缺失、当前值不等于写入值)返回 (content, False)。
891
+ def _rewind_claim(fm: dict, content: str, c: dict):
892
+ """撤销一条条件化改写(仅当前值 == 写入值时才动)→ `(content, ok)`。"""
893
+ where, field = c.get("where"), c.get("field")
894
+ before, after = str(c.get("before") or ""), str(c.get("after") or "")
895
+ if not after:
896
+ return content, False
897
+ if where == "ccg" and field:
898
+ if _ccg_field(content, field).strip() == after.strip():
899
+ return _upsert_ccg_line(content, field, before), True
900
+ return content, False
901
+ if where == "comment" and field:
902
+ cc = _comment(fm)
903
+ v = cc.get(field)
904
+ if isinstance(v, list):
905
+ if after in v:
906
+ cc[field] = [before if x == after else x for x in v]
907
+ return content, True
908
+ return content, False
909
+ if str(v or "").strip() == after.strip():
910
+ cc[field] = before
911
+ return content, True
912
+ return content, False
913
+ if where == "body":
914
+ if after in content:
915
+ return content.replace(after, before, 1), True
916
+ return content, False
917
+ return content, False
918
+
919
+
920
+ # 生效条件:x 经 _as_cg 后,对 read_jsonl(_log_path(cg)) 中 action=="crosscheck"、batch 为 None 或等于参数 batch、且 entry_ids 为假值不做 id 过滤(为真值时仅取 entry_id 在集合中的)的记录逐条处理:node 缺失或已处理则跳过,索引无该 node 或 cg._read 得 fm 为 None 或 crypto.is_encrypted(content) 为真时 skipped_drift 加一,write_id 双方非空且不等时 conflict 加一,否则撤销 claims_conditioned、在当前「验证方式」行非空且等于 rec 的 verification_value 时撤销该行、再按 fm_before 还原,reverted 为空则 conflict 加一,非空则写回节点、追加 crosscheck_rollback 日志、reverted 与 entry_ids 加一,最终 reverted 非零时 cg.rebuild_index(),返回 rep;
921
+ def rollback(x, batch=None, entry_ids=None, actor=None) -> dict:
922
+ """按留痕反向应用:撤销核对写入(当前值 ≠ 写入值时跳过,计入 conflict)。"""
923
+ cg = _as_cg(x)
924
+ want = set(entry_ids) if entry_ids else None
925
+ done = set()
926
+ rep = {"root": cg.root, "dry_run": False, "action": "crosscheck_rollback",
927
+ "batch": batch, "actor": actor, "planned": 0, "reverted": 0,
928
+ "skipped_drift": 0, "conflict": 0, "entry_ids": []}
929
+ recs = [r for r in (read_jsonl(_log_path(cg)) or [])
930
+ if r.get("action") == "crosscheck"
931
+ and (batch is None or r.get("batch") == batch)
932
+ and (want is None or r.get("entry_id") in want)]
933
+ rep["planned"] = len(recs)
934
+ for rec in recs:
935
+ nid = rec.get("node")
936
+ if not nid or nid in done:
937
+ continue
938
+ e = cg.index["nodes"].get(nid)
939
+ if not e:
940
+ rep["skipped_drift"] += 1
941
+ continue
942
+ fm, content = direct_read(cg, e) # 回滚比对走盘上真值(write_id 防护所验 fm 同源)
943
+ if fm is None or crypto.is_encrypted(content):
944
+ rep["skipped_drift"] += 1
945
+ continue
946
+ # 写入现场校验:write_id 一致才回滚(防「写入后又被改过」被误撤)
947
+ wid = (fm.get("verification_evidence") or {}).get("write_id")
948
+ if wid and rec.get("write_id") and wid != rec.get("write_id"):
949
+ rep["conflict"] += 1
950
+ continue
951
+ # 1) 撤销条件化改写(先于验证方式行,避免行被覆盖影响定位)
952
+ reverted = []
953
+ for c in rec.get("claims_conditioned") or []:
954
+ content, ok = _rewind_claim(fm, content, c)
955
+ if ok:
956
+ reverted.append(c.get("field") or c.get("where"))
957
+ # 2) 撤销「验证方式」行
958
+ lb = rec.get("verification_line_before") or {}
959
+ cur_line = _ccg_field(content, "验证方式")
960
+ if cur_line.strip() and cur_line.strip() == str(
961
+ rec.get("verification_value") or "").strip():
962
+ content = (_upsert_ccg_line(content, "验证方式", lb.get("value") or "")
963
+ if lb.get("had") else _remove_ccg_line(content, "验证方式"))
964
+ reverted.append("验证方式")
965
+ # 3) 还原 frontmatter 现场
966
+ for key, box in (rec.get("fm_before") or {}).items():
967
+ _reattach(fm, content, box, key)
968
+ if not reverted:
969
+ rep["conflict"] += 1
970
+ continue
971
+ cg._write_node(nid, os.path.join(cg.root, e["path"]), fm, content,
972
+ durable=True)
973
+ append_jsonl(_log_path(cg), {
974
+ "action": "crosscheck_rollback", "ts": time.time(),
975
+ "batch": rec.get("batch"), "actor": actor,
976
+ "entry_id": rec.get("entry_id"), "node": nid,
977
+ "reverted": reverted, "content_hash_after": _sha(content)})
978
+ rep["reverted"] += 1
979
+ rep["entry_ids"].append(rec.get("entry_id"))
980
+ done.add(nid)
981
+ if rep["reverted"]:
982
+ cg.rebuild_index()
983
+ return rep
984
+
985
+
986
+ # 生效条件:遍历 _log_path(cg) 的记录时,action 为真值只留 rec.get("action")==action 的行、batch 为真值只留 rec.get("batch")==batch 的行;limit 非 None 且 limit>=0 时按 recs[-limit:] 截取(limit 为 0 时 [-0:] 即整表不被削减),否则保留全部;返回 {'root','total','returned','records'}。
987
+ def history(x, limit=100, action=None, batch=None) -> dict:
988
+ cg = _as_cg(x)
989
+ recs = []
990
+ for rec in read_jsonl(_log_path(cg)) or []:
991
+ if action and rec.get("action") != action:
992
+ continue
993
+ if batch and rec.get("batch") != batch:
994
+ continue
995
+ recs.append(rec)
996
+ total = len(recs)
997
+ if limit is not None and limit >= 0:
998
+ recs = recs[-limit:]
999
+ return {"root": cg.root, "total": total, "returned": len(recs),
1000
+ "records": recs}
1001
+
1002
+
1003
+ # ---- 权限与 CLI ----------------------------------------------------------
1004
+
1005
+ # 生效条件:principal 为 None 时返回 False;否则仅当 principal.expired() 为假、principal.can_write 为真、且 principal.allows_layer("knowledge") 为真时返回 True,期间任一步抛 Exception 亦返回 False。
1006
+ def can_write_knowledge(principal) -> bool:
1007
+ """落 knowledge 层必须持有可写该层的令牌(designer 派生);否则 fail-closed。"""
1008
+ if principal is None:
1009
+ return False
1010
+ try:
1011
+ if principal.expired() or not principal.can_write:
1012
+ return False
1013
+ return bool(principal.allows_layer("knowledge"))
1014
+ except Exception: # noqa: BLE001
1015
+ return False
1016
+
1017
+
1018
+ # 生效条件:path 为假值(空串/None)返回 None;path 不存在则 raise SystemExit;已存在且读取文本 strip 后为空串返回 [],非空时整段 json.loads 成功即返回该值,抛 ValueError 时按行解析(跳过空行与 "//" 开头行)返回行列表。
1019
+ def _load_verdicts(path: str):
1020
+ if not path:
1021
+ return None
1022
+ if not os.path.exists(path):
1023
+ raise SystemExit(f"裁决文件不存在:{path}")
1024
+ with open(path, "r", encoding="utf-8") as fh:
1025
+ text = fh.read().strip()
1026
+ if not text:
1027
+ return []
1028
+ try:
1029
+ return json.loads(text)
1030
+ except ValueError:
1031
+ rows = []
1032
+ for line in text.splitlines():
1033
+ line = line.strip()
1034
+ if not line or line.startswith("//"):
1035
+ continue
1036
+ rows.append(json.loads(line))
1037
+ return rows
1038
+
1039
+
1040
+ # 生效条件:argv(为 None 时由 argparse 读 sys.argv)解析后按 --action 分派——worklist 调 build_worklist,history 调 history(--limit 默认 None,为 None 时传 100),rollback 在 can_write_knowledge(principal) 为假时抛 SystemExit 否则调 rollback,crosscheck 在 --apply 为真且 can_write_knowledge(principal) 为假时抛 SystemExit 否则调 crosscheck;--token(默认 os.environ.get("MDCG_TOKEN") or "")为真值时先 tokens.verify_token 校验、失败抛 SystemExit;最后打印 rep 并返回 0;
1041
+ def _cli(argv=None) -> int:
1042
+ ap = argparse.ArgumentParser(
1043
+ prog="python -m md_cg.crosscheck",
1044
+ description="kp_ 批量核对管线(工单/核对/回滚/留痕)")
1045
+ ap.add_argument("--root", default=os.environ.get("MDCG_ROOT") or ".")
1046
+ ap.add_argument("--token", default=os.environ.get("MDCG_TOKEN") or "")
1047
+ ap.add_argument("--token-file", default=None)
1048
+ ap.add_argument("--action", default="worklist",
1049
+ choices=("worklist", "crosscheck", "rollback", "history"))
1050
+ ap.add_argument("--verdicts", default="", help="子代理裁决 JSON/JSONL 路径")
1051
+ ap.add_argument("--apply", action="store_true", help="真正写盘(默认 dry-run)")
1052
+ ap.add_argument("--batch", default=CROSSCHECK_BATCH)
1053
+ ap.add_argument("--limit", type=int, default=None)
1054
+ ap.add_argument("--layer", default=None)
1055
+ ap.add_argument("--prefix", default=None, help="按 id 前缀收窄(真实库用 kp_)")
1056
+ ap.add_argument("--ids", default="", help="逗号分隔节点 id")
1057
+ ap.add_argument("--no-verify", action="store_true", help="允许无验证单元(不建议)")
1058
+ ap.add_argument("--allow-self-verify", action="store_true")
1059
+ ap.add_argument("--reflect-actor", default=None)
1060
+ ap.add_argument("--verify-actor", default=None)
1061
+ args = ap.parse_args(argv)
1062
+
1063
+ from . import tokens
1064
+ principal = None
1065
+ if args.token:
1066
+ try:
1067
+ principal = tokens.verify_token(args.token, path=args.token_file)
1068
+ except tokens.TokenError as exc:
1069
+ raise SystemExit(f"令牌校验失败:{exc}")
1070
+ actor = getattr(principal, "actor", None)
1071
+ ids = [s.strip() for s in args.ids.split(",") if s.strip()] or None
1072
+
1073
+ if args.action == "worklist":
1074
+ rep = build_worklist(args.root, layer=args.layer, limit=args.limit,
1075
+ ids=ids, prefix=args.prefix)
1076
+ elif args.action == "history":
1077
+ rep = history(args.root, limit=args.limit if args.limit is not None else 100,
1078
+ batch=args.batch)
1079
+ elif args.action == "rollback":
1080
+ if not can_write_knowledge(principal):
1081
+ raise SystemExit("权限不足:回滚需要可写 knowledge 层的令牌")
1082
+ rep = rollback(args.root, batch=args.batch, actor=actor)
1083
+ else:
1084
+ if args.apply and not can_write_knowledge(principal):
1085
+ raise SystemExit("权限不足:落库需要可写 knowledge 层的令牌(designer 派生)")
1086
+ rep = crosscheck(args.root, layer=args.layer, limit=args.limit, ids=ids,
1087
+ prefix=args.prefix,
1088
+ verdicts=_load_verdicts(args.verdicts), apply=args.apply,
1089
+ batch=args.batch,
1090
+ require_verify=not args.no_verify,
1091
+ allow_self_verify=args.allow_self_verify,
1092
+ reflect_actor=args.reflect_actor,
1093
+ verify_actor=args.verify_actor, actor=actor)
1094
+ print(json.dumps(rep, ensure_ascii=False, indent=2))
1095
+ return 0
1096
+
1097
+
1098
+ if __name__ == "__main__": # pragma: no cover
1099
1099
  sys.exit(_cli())