chaffjs 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. package/README.md +179 -42
  2. package/dist/adapter-import.d.ts +2 -0
  3. package/dist/adapter-import.d.ts.map +1 -0
  4. package/dist/adapter-import.js +11 -0
  5. package/dist/adapter-import.js.map +1 -0
  6. package/dist/adapter-load.d.ts.map +1 -1
  7. package/dist/adapter-load.js +2 -9
  8. package/dist/adapter-load.js.map +1 -1
  9. package/dist/ai-score/human-shares.d.ts +4 -0
  10. package/dist/ai-score/human-shares.d.ts.map +1 -0
  11. package/dist/ai-score/human-shares.js +205 -0
  12. package/dist/ai-score/human-shares.js.map +1 -0
  13. package/dist/ai-score/lint-line.d.ts +4 -0
  14. package/dist/ai-score/lint-line.d.ts.map +1 -0
  15. package/dist/ai-score/lint-line.js +9 -0
  16. package/dist/ai-score/lint-line.js.map +1 -0
  17. package/dist/ai-score/of-document.d.ts +7 -0
  18. package/dist/ai-score/of-document.d.ts.map +1 -0
  19. package/dist/ai-score/of-document.js +40 -0
  20. package/dist/ai-score/of-document.js.map +1 -0
  21. package/dist/ai-score/render.d.ts +24 -0
  22. package/dist/ai-score/render.d.ts.map +1 -0
  23. package/dist/ai-score/render.js +100 -0
  24. package/dist/ai-score/render.js.map +1 -0
  25. package/dist/ai-score/score.d.ts +77 -0
  26. package/dist/ai-score/score.d.ts.map +1 -0
  27. package/dist/ai-score/score.js +52 -0
  28. package/dist/ai-score/score.js.map +1 -0
  29. package/dist/ai-score/signals.d.ts +19 -0
  30. package/dist/ai-score/signals.d.ts.map +1 -0
  31. package/dist/ai-score/signals.js +30 -0
  32. package/dist/ai-score/signals.js.map +1 -0
  33. package/dist/ai-score/text.d.ts +37 -0
  34. package/dist/ai-score/text.d.ts.map +1 -0
  35. package/dist/ai-score/text.js +59 -0
  36. package/dist/ai-score/text.js.map +1 -0
  37. package/dist/ai-score/view.d.ts +5 -0
  38. package/dist/ai-score/view.d.ts.map +1 -0
  39. package/dist/ai-score/view.js +19 -0
  40. package/dist/ai-score/view.js.map +1 -0
  41. package/dist/backends/anthropic.d.ts +0 -1
  42. package/dist/backends/anthropic.d.ts.map +1 -1
  43. package/dist/backends/anthropic.js +0 -1
  44. package/dist/backends/anthropic.js.map +1 -1
  45. package/dist/backends/default-model.d.ts +3 -0
  46. package/dist/backends/default-model.d.ts.map +1 -0
  47. package/dist/backends/default-model.js +5 -0
  48. package/dist/backends/default-model.js.map +1 -0
  49. package/dist/backends/openai.d.ts +0 -1
  50. package/dist/backends/openai.d.ts.map +1 -1
  51. package/dist/backends/openai.js +0 -1
  52. package/dist/backends/openai.js.map +1 -1
  53. package/dist/browser/adapter-import.d.ts +2 -0
  54. package/dist/browser/adapter-import.d.ts.map +1 -0
  55. package/dist/browser/adapter-import.js +17 -0
  56. package/dist/browser/adapter-import.js.map +1 -0
  57. package/dist/browser/bounded-match.d.ts +3 -0
  58. package/dist/browser/bounded-match.d.ts.map +1 -0
  59. package/dist/browser/bounded-match.js +4 -0
  60. package/dist/browser/bounded-match.js.map +1 -0
  61. package/dist/browser/check-text.d.ts +43 -0
  62. package/dist/browser/check-text.d.ts.map +1 -0
  63. package/dist/browser/check-text.js +50 -0
  64. package/dist/browser/check-text.js.map +1 -0
  65. package/dist/browser/detectors.d.ts +4 -0
  66. package/dist/browser/detectors.d.ts.map +1 -0
  67. package/dist/browser/detectors.js +22 -0
  68. package/dist/browser/detectors.js.map +1 -0
  69. package/dist/browser/package-files.d.ts +5 -0
  70. package/dist/browser/package-files.d.ts.map +1 -0
  71. package/dist/browser/package-files.js +8 -0
  72. package/dist/browser/package-files.js.map +1 -0
  73. package/dist/browser/path.d.ts +9 -0
  74. package/dist/browser/path.d.ts.map +1 -0
  75. package/dist/browser/path.js +70 -0
  76. package/dist/browser/path.js.map +1 -0
  77. package/dist/browser/working-dir.d.ts +2 -0
  78. package/dist/browser/working-dir.d.ts.map +1 -0
  79. package/dist/browser/working-dir.js +3 -0
  80. package/dist/browser/working-dir.js.map +1 -0
  81. package/dist/browser-files.d.ts +21 -0
  82. package/dist/browser-files.d.ts.map +1 -0
  83. package/dist/browser-files.js +65 -0
  84. package/dist/browser-files.js.map +1 -0
  85. package/dist/browser.d.ts +9 -0
  86. package/dist/browser.d.ts.map +1 -0
  87. package/dist/browser.js +13 -0
  88. package/dist/browser.js.map +1 -0
  89. package/dist/cli-text.d.ts.map +1 -1
  90. package/dist/cli-text.js +2 -0
  91. package/dist/cli-text.js.map +1 -1
  92. package/dist/cli.d.ts.map +1 -1
  93. package/dist/cli.js +4 -1
  94. package/dist/cli.js.map +1 -1
  95. package/dist/commands/ai-score.d.ts +8 -0
  96. package/dist/commands/ai-score.d.ts.map +1 -0
  97. package/dist/commands/ai-score.js +59 -0
  98. package/dist/commands/ai-score.js.map +1 -0
  99. package/dist/commands/document-commands.d.ts.map +1 -1
  100. package/dist/commands/document-commands.js +2 -0
  101. package/dist/commands/document-commands.js.map +1 -1
  102. package/dist/config/by-path-problems.d.ts +5 -0
  103. package/dist/config/by-path-problems.d.ts.map +1 -0
  104. package/dist/config/by-path-problems.js +11 -0
  105. package/dist/config/by-path-problems.js.map +1 -0
  106. package/dist/config/load.d.ts +9 -2
  107. package/dist/config/load.d.ts.map +1 -1
  108. package/dist/config/load.js +21 -8
  109. package/dist/config/load.js.map +1 -1
  110. package/dist/config/read.d.ts +2 -0
  111. package/dist/config/read.d.ts.map +1 -1
  112. package/dist/config/read.js +4 -1
  113. package/dist/config/read.js.map +1 -1
  114. package/dist/config/warnings.d.ts +1 -1
  115. package/dist/config/warnings.d.ts.map +1 -1
  116. package/dist/config/warnings.js +3 -1
  117. package/dist/config/warnings.js.map +1 -1
  118. package/dist/config/working-dir.d.ts +2 -0
  119. package/dist/config/working-dir.d.ts.map +1 -0
  120. package/dist/config/working-dir.js +3 -0
  121. package/dist/config/working-dir.js.map +1 -0
  122. package/dist/custom/bounded-match.d.ts +1 -12
  123. package/dist/custom/bounded-match.d.ts.map +1 -1
  124. package/dist/custom/bounded-match.js +1 -11
  125. package/dist/custom/bounded-match.js.map +1 -1
  126. package/dist/custom/pattern-timeout.d.ts +13 -0
  127. package/dist/custom/pattern-timeout.d.ts.map +1 -0
  128. package/dist/custom/pattern-timeout.js +13 -0
  129. package/dist/custom/pattern-timeout.js.map +1 -0
  130. package/dist/detect.d.ts.map +1 -1
  131. package/dist/detect.js +4 -5
  132. package/dist/detect.js.map +1 -1
  133. package/dist/detectors/connective-hierarchy.d.ts +16 -0
  134. package/dist/detectors/connective-hierarchy.d.ts.map +1 -0
  135. package/dist/detectors/connective-hierarchy.js +68 -0
  136. package/dist/detectors/connective-hierarchy.js.map +1 -0
  137. package/dist/detectors/date-year.d.ts +10 -2
  138. package/dist/detectors/date-year.d.ts.map +1 -1
  139. package/dist/detectors/date-year.js +44 -8
  140. package/dist/detectors/date-year.js.map +1 -1
  141. package/dist/detectors/defined-term-form.d.ts +5 -0
  142. package/dist/detectors/defined-term-form.d.ts.map +1 -1
  143. package/dist/detectors/defined-term-form.js +22 -5
  144. package/dist/detectors/defined-term-form.js.map +1 -1
  145. package/dist/detectors/missing-final-period.d.ts +17 -0
  146. package/dist/detectors/missing-final-period.d.ts.map +1 -0
  147. package/dist/detectors/missing-final-period.js +62 -0
  148. package/dist/detectors/missing-final-period.js.map +1 -0
  149. package/dist/detectors/missing-space-after-comma.d.ts +10 -0
  150. package/dist/detectors/missing-space-after-comma.d.ts.map +1 -0
  151. package/dist/detectors/missing-space-after-comma.js +42 -0
  152. package/dist/detectors/missing-space-after-comma.js.map +1 -0
  153. package/dist/detectors/orthographic-variant.d.ts.map +1 -1
  154. package/dist/detectors/orthographic-variant.js +44 -17
  155. package/dist/detectors/orthographic-variant.js.map +1 -1
  156. package/dist/detectors/party-role-name.d.ts +3 -0
  157. package/dist/detectors/party-role-name.d.ts.map +1 -0
  158. package/dist/detectors/party-role-name.js +35 -0
  159. package/dist/detectors/party-role-name.js.map +1 -0
  160. package/dist/detectors/quote-without-source.d.ts +17 -0
  161. package/dist/detectors/quote-without-source.d.ts.map +1 -0
  162. package/dist/detectors/quote-without-source.js +64 -0
  163. package/dist/detectors/quote-without-source.js.map +1 -0
  164. package/dist/detectors/reference-text.js +1 -1
  165. package/dist/detectors/reference-text.js.map +1 -1
  166. package/dist/detectors/registry/connective-hierarchy.d.ts +3 -0
  167. package/dist/detectors/registry/connective-hierarchy.d.ts.map +1 -0
  168. package/dist/detectors/registry/connective-hierarchy.js +3 -0
  169. package/dist/detectors/registry/connective-hierarchy.js.map +1 -0
  170. package/dist/detectors/registry/missing-final-period.d.ts +3 -0
  171. package/dist/detectors/registry/missing-final-period.d.ts.map +1 -0
  172. package/dist/detectors/registry/missing-final-period.js +3 -0
  173. package/dist/detectors/registry/missing-final-period.js.map +1 -0
  174. package/dist/detectors/registry/missing-space-after-comma.d.ts +3 -0
  175. package/dist/detectors/registry/missing-space-after-comma.d.ts.map +1 -0
  176. package/dist/detectors/registry/missing-space-after-comma.js +3 -0
  177. package/dist/detectors/registry/missing-space-after-comma.js.map +1 -0
  178. package/dist/detectors/registry/party-role-name.d.ts +3 -0
  179. package/dist/detectors/registry/party-role-name.d.ts.map +1 -0
  180. package/dist/detectors/registry/party-role-name.js +3 -0
  181. package/dist/detectors/registry/party-role-name.js.map +1 -0
  182. package/dist/detectors/registry/quote-without-source.d.ts +3 -0
  183. package/dist/detectors/registry/quote-without-source.d.ts.map +1 -0
  184. package/dist/detectors/registry/quote-without-source.js +3 -0
  185. package/dist/detectors/registry/quote-without-source.js.map +1 -0
  186. package/dist/detectors/registry/vague-deadline.d.ts +3 -0
  187. package/dist/detectors/registry/vague-deadline.d.ts.map +1 -0
  188. package/dist/detectors/registry/vague-deadline.js +3 -0
  189. package/dist/detectors/registry/vague-deadline.js.map +1 -0
  190. package/dist/detectors/run-in-label.d.ts +7 -0
  191. package/dist/detectors/run-in-label.d.ts.map +1 -0
  192. package/dist/detectors/run-in-label.js +53 -0
  193. package/dist/detectors/run-in-label.js.map +1 -0
  194. package/dist/detectors/sentence-counts.d.ts +3 -1
  195. package/dist/detectors/sentence-counts.d.ts.map +1 -1
  196. package/dist/detectors/sentence-counts.js +11 -4
  197. package/dist/detectors/sentence-counts.js.map +1 -1
  198. package/dist/detectors/sentence-ending.d.ts +1 -1
  199. package/dist/detectors/sentence-ending.d.ts.map +1 -1
  200. package/dist/detectors/sentence-ending.js +2 -1
  201. package/dist/detectors/sentence-ending.js.map +1 -1
  202. package/dist/detectors/structure-tree.d.ts +4 -1
  203. package/dist/detectors/structure-tree.d.ts.map +1 -1
  204. package/dist/detectors/structure-tree.js +21 -2
  205. package/dist/detectors/structure-tree.js.map +1 -1
  206. package/dist/detectors/unbalanced-bracket.d.ts +1 -1
  207. package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
  208. package/dist/detectors/unbalanced-bracket.js +23 -11
  209. package/dist/detectors/unbalanced-bracket.js.map +1 -1
  210. package/dist/detectors/vague-deadline.d.ts +25 -0
  211. package/dist/detectors/vague-deadline.d.ts.map +1 -0
  212. package/dist/detectors/vague-deadline.js +97 -0
  213. package/dist/detectors/vague-deadline.js.map +1 -0
  214. package/dist/furigana.d.ts +7 -0
  215. package/dist/furigana.d.ts.map +1 -0
  216. package/dist/furigana.js +16 -0
  217. package/dist/furigana.js.map +1 -0
  218. package/dist/genre-load.d.ts.map +1 -1
  219. package/dist/genre-load.js +5 -7
  220. package/dist/genre-load.js.map +1 -1
  221. package/dist/grade/ai-score.d.ts +16 -0
  222. package/dist/grade/ai-score.d.ts.map +1 -0
  223. package/dist/grade/ai-score.js +17 -0
  224. package/dist/grade/ai-score.js.map +1 -0
  225. package/dist/grade/finding.d.ts +6 -0
  226. package/dist/grade/finding.d.ts.map +1 -0
  227. package/dist/grade/finding.js +13 -0
  228. package/dist/grade/finding.js.map +1 -0
  229. package/dist/grade/grade-item.d.ts.map +1 -1
  230. package/dist/grade/grade-item.js +4 -11
  231. package/dist/grade/grade-item.js.map +1 -1
  232. package/dist/grade/render-variants.d.ts.map +1 -1
  233. package/dist/grade/render-variants.js +3 -0
  234. package/dist/grade/render-variants.js.map +1 -1
  235. package/dist/grade/render.d.ts.map +1 -1
  236. package/dist/grade/render.js +1 -0
  237. package/dist/grade/render.js.map +1 -1
  238. package/dist/grade/result.d.ts +3 -0
  239. package/dist/grade/result.d.ts.map +1 -1
  240. package/dist/grade/results-read.d.ts.map +1 -1
  241. package/dist/grade/results-read.js +13 -2
  242. package/dist/grade/results-read.js.map +1 -1
  243. package/dist/grade/summary.d.ts +3 -0
  244. package/dist/grade/summary.d.ts.map +1 -1
  245. package/dist/grade/summary.js +6 -0
  246. package/dist/grade/summary.js.map +1 -1
  247. package/dist/grade/text.d.ts +2 -0
  248. package/dist/grade/text.d.ts.map +1 -1
  249. package/dist/grade/text.js +2 -0
  250. package/dist/grade/text.js.map +1 -1
  251. package/dist/grade/variants-text.d.ts +3 -0
  252. package/dist/grade/variants-text.d.ts.map +1 -1
  253. package/dist/grade/variants-text.js +4 -0
  254. package/dist/grade/variants-text.js.map +1 -1
  255. package/dist/grade/variants.d.ts +3 -0
  256. package/dist/grade/variants.d.ts.map +1 -1
  257. package/dist/grade/variants.js +1 -0
  258. package/dist/grade/variants.js.map +1 -1
  259. package/dist/grade-api.d.ts +1 -0
  260. package/dist/grade-api.d.ts.map +1 -1
  261. package/dist/grade-api.js +2 -1
  262. package/dist/grade-api.js.map +1 -1
  263. package/dist/judge.d.ts +0 -1
  264. package/dist/judge.d.ts.map +1 -1
  265. package/dist/judge.js +0 -1
  266. package/dist/judge.js.map +1 -1
  267. package/dist/known-genres.js +2 -2
  268. package/dist/known-genres.js.map +1 -1
  269. package/dist/package-files.d.ts +6 -0
  270. package/dist/package-files.d.ts.map +1 -0
  271. package/dist/package-files.js +11 -0
  272. package/dist/package-files.js.map +1 -0
  273. package/dist/profile/load.d.ts.map +1 -1
  274. package/dist/profile/load.js +5 -6
  275. package/dist/profile/load.js.map +1 -1
  276. package/dist/rule-load.d.ts.map +1 -1
  277. package/dist/rule-load.js +5 -6
  278. package/dist/rule-load.js.map +1 -1
  279. package/dist/rule-offs.js +3 -3
  280. package/dist/rule-offs.js.map +1 -1
  281. package/dist/run.js +1 -1
  282. package/dist/run.js.map +1 -1
  283. package/dist/structure/date-range.d.ts +4 -0
  284. package/dist/structure/date-range.d.ts.map +1 -1
  285. package/dist/structure/date-range.js +23 -3
  286. package/dist/structure/date-range.js.map +1 -1
  287. package/dist/structure/issues.d.ts +17 -1
  288. package/dist/structure/issues.d.ts.map +1 -1
  289. package/dist/structure/issues.js +54 -5
  290. package/dist/structure/issues.js.map +1 -1
  291. package/dist/structure/party-role.d.ts +30 -0
  292. package/dist/structure/party-role.d.ts.map +1 -0
  293. package/dist/structure/party-role.js +58 -0
  294. package/dist/structure/party-role.js.map +1 -0
  295. package/dist/structure/prose-total.d.ts +28 -0
  296. package/dist/structure/prose-total.d.ts.map +1 -0
  297. package/dist/structure/prose-total.js +99 -0
  298. package/dist/structure/prose-total.js.map +1 -0
  299. package/dist/structure/reference-text.d.ts +5 -0
  300. package/dist/structure/reference-text.d.ts.map +1 -1
  301. package/dist/structure/reference-text.js +17 -4
  302. package/dist/structure/reference-text.js.map +1 -1
  303. package/dist/structure/term-prefix.d.ts +18 -0
  304. package/dist/structure/term-prefix.d.ts.map +1 -0
  305. package/dist/structure/term-prefix.js +40 -0
  306. package/dist/structure/term-prefix.js.map +1 -0
  307. package/dist/structure/total.d.ts +2 -0
  308. package/dist/structure/total.d.ts.map +1 -1
  309. package/dist/structure/total.js +2 -0
  310. package/dist/structure/total.js.map +1 -1
  311. package/dist/structure-shape/baseline-load.d.ts.map +1 -1
  312. package/dist/structure-shape/baseline-load.js +4 -5
  313. package/dist/structure-shape/baseline-load.js.map +1 -1
  314. package/dist/style-load.d.ts.map +1 -1
  315. package/dist/style-load.js +5 -6
  316. package/dist/style-load.js.map +1 -1
  317. package/package.json +24 -3
  318. package/rules/cliche.yaml +28 -8
  319. package/rules/connective-hierarchy.yaml +62 -0
  320. package/rules/date-without-year.yaml +28 -3
  321. package/rules/defined-term-form.yaml +9 -6
  322. package/rules/demonstrative-opener-run.yaml +24 -7
  323. package/rules/missing-final-period.yaml +76 -0
  324. package/rules/missing-space-after-comma.yaml +57 -0
  325. package/rules/no-mixed-desumasu.yaml +2 -2
  326. package/rules/orthographic-variant.yaml +2 -2
  327. package/rules/party-role-name.yaml +94 -0
  328. package/rules/quote-without-source.yaml +61 -0
  329. package/rules/total-mismatch.yaml +8 -8
  330. package/rules/vague-deadline.yaml +95 -0
  331. package/rules/weasel-word.yaml +25 -7
  332. package/skills/chaff/SKILL.md +32 -5
  333. package/src/adapter-import.ts +3 -0
  334. package/src/adapter-load.ts +2 -1
  335. package/src/ai-score/human-shares.ts +207 -0
  336. package/src/ai-score/lint-line.ts +10 -0
  337. package/src/ai-score/of-document.ts +46 -0
  338. package/src/ai-score/render.ts +124 -0
  339. package/src/ai-score/score.ts +121 -0
  340. package/src/ai-score/signals.ts +39 -0
  341. package/src/ai-score/text.ts +103 -0
  342. package/src/ai-score/view.ts +21 -0
  343. package/src/backends/anthropic.ts +0 -2
  344. package/src/backends/default-model.ts +9 -0
  345. package/src/backends/openai.ts +0 -2
  346. package/src/browser/adapter-import.ts +19 -0
  347. package/src/browser/bounded-match.ts +9 -0
  348. package/src/browser/check-text.ts +106 -0
  349. package/src/browser/detectors.ts +40 -0
  350. package/src/browser/import-meta-glob.d.ts +5 -0
  351. package/src/browser/package-files.ts +13 -0
  352. package/src/browser/path.ts +73 -0
  353. package/src/browser/working-dir.ts +3 -0
  354. package/src/browser-files.ts +87 -0
  355. package/src/browser.ts +19 -0
  356. package/src/cli-text.ts +2 -0
  357. package/src/cli.ts +4 -1
  358. package/src/commands/ai-score.ts +77 -0
  359. package/src/commands/document-commands.ts +2 -0
  360. package/src/config/by-path-problems.ts +17 -0
  361. package/src/config/load.ts +21 -8
  362. package/src/config/read.ts +5 -1
  363. package/src/config/warnings.ts +3 -1
  364. package/src/config/working-dir.ts +3 -0
  365. package/src/custom/bounded-match.ts +1 -16
  366. package/src/custom/pattern-timeout.ts +17 -0
  367. package/src/detect.ts +4 -5
  368. package/src/detectors/connective-hierarchy.ts +99 -0
  369. package/src/detectors/date-year.ts +51 -12
  370. package/src/detectors/defined-term-form.ts +28 -6
  371. package/src/detectors/missing-final-period.ts +79 -0
  372. package/src/detectors/missing-space-after-comma.ts +54 -0
  373. package/src/detectors/orthographic-variant.ts +59 -18
  374. package/src/detectors/party-role-name.ts +44 -0
  375. package/src/detectors/quote-without-source.ts +90 -0
  376. package/src/detectors/reference-text.ts +1 -1
  377. package/src/detectors/registry/connective-hierarchy.ts +4 -0
  378. package/src/detectors/registry/missing-final-period.ts +4 -0
  379. package/src/detectors/registry/missing-space-after-comma.ts +4 -0
  380. package/src/detectors/registry/party-role-name.ts +4 -0
  381. package/src/detectors/registry/quote-without-source.ts +4 -0
  382. package/src/detectors/registry/vague-deadline.ts +4 -0
  383. package/src/detectors/run-in-label.ts +60 -0
  384. package/src/detectors/sentence-counts.ts +13 -4
  385. package/src/detectors/sentence-ending.ts +3 -2
  386. package/src/detectors/structure-tree.ts +28 -6
  387. package/src/detectors/unbalanced-bracket.ts +25 -10
  388. package/src/detectors/vague-deadline.ts +132 -0
  389. package/src/furigana.ts +20 -0
  390. package/src/genre-load.ts +5 -7
  391. package/src/grade/ai-score.ts +32 -0
  392. package/src/grade/finding.ts +16 -0
  393. package/src/grade/grade-item.ts +4 -13
  394. package/src/grade/render-variants.ts +5 -0
  395. package/src/grade/render.ts +1 -0
  396. package/src/grade/result.ts +3 -0
  397. package/src/grade/results-read.ts +17 -2
  398. package/src/grade/summary.ts +9 -0
  399. package/src/grade/text.ts +6 -0
  400. package/src/grade/variants-text.ts +7 -0
  401. package/src/grade/variants.ts +4 -0
  402. package/src/grade-api.ts +3 -1
  403. package/src/judge.ts +0 -2
  404. package/src/known-genres.ts +2 -2
  405. package/src/package-files.ts +15 -0
  406. package/src/profile/load.ts +5 -6
  407. package/src/rule-load.ts +5 -6
  408. package/src/rule-offs.ts +3 -3
  409. package/src/run.ts +1 -1
  410. package/src/structure/date-range.ts +28 -3
  411. package/src/structure/issues.ts +61 -6
  412. package/src/structure/party-role.ts +94 -0
  413. package/src/structure/prose-total.ts +135 -0
  414. package/src/structure/reference-text.ts +17 -4
  415. package/src/structure/term-prefix.ts +54 -0
  416. package/src/structure/total.ts +4 -0
  417. package/src/structure-shape/baseline-load.ts +4 -5
  418. package/src/style-load.ts +5 -6
@@ -0,0 +1,9 @@
1
+ import { aiScoreOfDocument } from "./of-document.js";
2
+ import { aiScoreSummaryLine } from "./render.js";
3
+ import { scoreViewOf } from "./view.js";
4
+ /** The quick score's one line under a file's lint report, read from the document lint already built. */
5
+ export const aiScoreLineOf = (check) => {
6
+ const score = aiScoreOfDocument(check.doc, check.rules, check.genre.genre);
7
+ return aiScoreSummaryLine(score, check.doc.path, scoreViewOf(check.language, check.doc.lengthUnit, score.group, check.rules));
8
+ };
9
+ //# sourceMappingURL=lint-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint-line.js","sourceRoot":"","sources":["../../src/ai-score/lint-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,wGAAwG;AACxG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAkB,EAAU,EAAE;IAC1D,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3E,OAAO,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAChI,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ProseDocument, RuleDefinition } from "../plugin.ts";
2
+ import { type AiScore } from "./score.ts";
3
+ /** The genre group a genre's human shares are measured under: business for business/report. */
4
+ export declare const genreGroupOf: (genre: string) => string;
5
+ /** The quick score of a document read as lint reads it, against human documents of its genre group. */
6
+ export declare const aiScoreOfDocument: (doc: ProseDocument, rules: readonly RuleDefinition[], genre: string) => AiScore;
7
+ //# sourceMappingURL=of-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"of-document.d.ts","sourceRoot":"","sources":["../../src/ai-score/of-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQlE,OAAO,EAAa,KAAK,OAAO,EAAkB,MAAM,YAAY,CAAC;AAKrE,+FAA+F;AAC/F,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAAsC,CAAC;AAqBpF,uGAAuG;AACvG,eAAO,MAAM,iBAAiB,GAAI,KAAK,aAAa,EAAE,OAAO,SAAS,cAAc,EAAE,EAAE,OAAO,MAAM,KAAG,OASpG,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { presetLevels } from "../genre-load.js";
2
+ import { runRulesWith } from "../run.js";
3
+ import { standingIn } from "../rule-genres.js";
4
+ import { wordsOf } from "../detectors/structure.js";
5
+ import { MIN_DOCUMENT_LENGTH } from "../detectors/signals.js";
6
+ import { structureOf } from "../structure-shape/of-document.js";
7
+ import { HUMAN_SHARES } from "./human-shares.js";
8
+ import { aiScoreOf } from "./score.js";
9
+ import { measuredLevelsOf, scoredSignalIds } from "./signals.js";
10
+ const STRUCTURE_RULE = "ai-structure";
11
+ /** The genre group a genre's human shares are measured under: business for business/report. */
12
+ export const genreGroupOf = (genre) => genre.split("/")[0] ?? genre;
13
+ /** The structure baseline is human articles: it is compared only in the genres ai-structure runs in. */
14
+ const structureApplies = (rules, genre) => {
15
+ const rule = rules.find((entry) => entry.id === STRUCTURE_RULE);
16
+ return rule !== undefined && standingIn(rule, genre, presetLevels(genre)).kind === "on";
17
+ };
18
+ /** The AI-shape rules run on the document at the levels the human shares were measured at, whatever chaff.yaml sets. */
19
+ const signalRuns = (doc, rules, genre) => {
20
+ const ofLanguage = rules.filter((rule) => rule.languages === undefined || rule.languages.includes(doc.language));
21
+ const ids = scoredSignalIds(ofLanguage);
22
+ const signalRules = ofLanguage.filter((rule) => ids.includes(rule.id));
23
+ const result = runRulesWith(doc, signalRules, { settings: measuredLevelsOf(signalRules, presetLevels(genre)), experimental: true, genre });
24
+ return ids.map((rule) => {
25
+ const notRun = result.skipped.find((skip) => skip.rule === rule)?.why;
26
+ const count = result.findings.filter((finding) => finding.rule === rule).length;
27
+ return notRun === undefined ? { rule, count } : { rule, count, notRun };
28
+ });
29
+ };
30
+ /** The quick score of a document read as lint reads it, against human documents of its genre group. */
31
+ export const aiScoreOfDocument = (doc, rules, genre) => aiScoreOf({
32
+ group: genreGroupOf(genre),
33
+ length: wordsOf(doc),
34
+ minimum: MIN_DOCUMENT_LENGTH[doc.lengthUnit],
35
+ unit: doc.lengthUnit,
36
+ signals: signalRuns(doc, rules, genre),
37
+ shares: HUMAN_SHARES,
38
+ structure: structureApplies(rules, genre) ? structureOf(doc) : undefined,
39
+ });
40
+ //# sourceMappingURL=of-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"of-document.js","sourceRoot":"","sources":["../../src/ai-score/of-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,E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,CAAC,CAAC,CAAC,CAAC,SAAS;CACzE,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { LengthUnit, Localized } from "../plugin.ts";
2
+ import type { StructureText } from "../outline/structure-text.ts";
3
+ import { type AiScore } from "./score.ts";
4
+ import type { AiScoreText } from "./text.ts";
5
+ /** What a rendering needs besides the score: the texts, the rules' names, and the genre group's name, in one language. */
6
+ export type ScoreView = {
7
+ readonly text: AiScoreText;
8
+ readonly structure: StructureText;
9
+ readonly language: string;
10
+ readonly unit: LengthUnit;
11
+ readonly groupName: string;
12
+ readonly ruleNames: Readonly<Record<string, Localized>>;
13
+ };
14
+ /** The level line, or why there is none. */
15
+ export declare const aiScoreHeadline: (score: AiScore, view: ScoreView) => string;
16
+ /** The one line the lint report ends a file with. */
17
+ export declare const aiScoreSummaryLine: (score: AiScore, path: string, view: ScoreView) => string;
18
+ /** For a person: the level, the signs, each signal and structure measure that showed, and what was not compared and why. */
19
+ export declare const renderAiScoreFriendly: (path: string, score: AiScore, view: ScoreView) => string[];
20
+ /** For grep: the level (or not-scored) and the signs, on one line. */
21
+ export declare const renderAiScoreCompact: (path: string, score: AiScore) => string;
22
+ /** The score as data, for the JSON report and chaff grade's results. */
23
+ export declare const aiScoreJson: (score: AiScore) => Readonly<Record<string, unknown>>;
24
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/ai-score/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAA0C,KAAK,OAAO,EAAyD,MAAM,YAAY,CAAC;AACzI,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,0HAA0H;AAC1H,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACzD,CAAC;AAYF,4CAA4C;AAC5C,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,EAAE,MAAM,SAAS,KAAG,MAGjE,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,EAAE,MAAM,MAAM,EAAE,MAAM,SAAS,KAAG,MAC4C,CAAC;AA4ChI,4HAA4H;AAC5H,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,OAAO,OAAO,EAAE,MAAM,SAAS,KAAG,MAAM,EAY3F,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,EAAE,OAAO,OAAO,KAAG,MAGnE,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuB3E,CAAC"}
@@ -0,0 +1,100 @@
1
+ import { localized } from "../render/text.js";
2
+ import { HIGH_SIGNS, MEDIUM_SIGNS, shownSignsOf } from "./score.js";
3
+ const nameOf = (rule, view) => {
4
+ const name = view.ruleNames[rule];
5
+ return name === undefined ? rule : localized(name, view.language);
6
+ };
7
+ const notScoredText = (notScored, view) => notScored.reason === "too-short"
8
+ ? view.text.tooShort(notScored.length, notScored.minimum, notScored.unit)
9
+ : view.text.noBaseline(view.groupName, notScored.compared, notScored.needed);
10
+ /** The level line, or why there is none. */
11
+ export const aiScoreHeadline = (score, view) => {
12
+ if (score.level !== undefined)
13
+ return view.text.headline(score.level, view.groupName);
14
+ return view.text.summaryNotScored(score.notScored === undefined ? "" : notScoredText(score.notScored, view));
15
+ };
16
+ /** The one line the lint report ends a file with. */
17
+ export const aiScoreSummaryLine = (score, path, view) => score.level === undefined ? aiScoreHeadline(score, view) : view.text.summary(aiScoreHeadline(score, view), score.signs, path);
18
+ const signalLine = (signal, view) => {
19
+ const { human } = signal;
20
+ if (human === undefined)
21
+ return "";
22
+ const name = nameOf(signal.rule, view);
23
+ return signal.unusual
24
+ ? view.text.fired(name, signal.count, human.fired, human.documents, view.groupName)
25
+ : view.text.common(name, signal.count, human.fired, human.documents);
26
+ };
27
+ const namesLine = (names, line, view) => names.length === 0 ? [] : [` ${line(names.join(view.text.listSeparator))}`];
28
+ const signalLines = (signals, view) => {
29
+ const compared = signals.filter((signal) => signal.human !== undefined);
30
+ const shown = compared.filter((signal) => signal.count > 0);
31
+ const quiet = compared.length - shown.length;
32
+ const unshared = signals.filter((signal) => signal.human === undefined && signal.notRun === undefined).map((signal) => nameOf(signal.rule, view));
33
+ const notRun = signals.flatMap((signal) => (signal.notRun === undefined ? [] : [view.text.aside(nameOf(signal.rule, view), signal.notRun)]));
34
+ return [
35
+ view.text.signalsHeading,
36
+ ...shown.map((signal) => ` ${signalLine(signal, view)}`),
37
+ ...(quiet > 0 ? [` ${view.text.quiet(quiet)}`] : []),
38
+ ...namesLine(unshared, view.text.noHumanShare, view),
39
+ ...namesLine(notRun, view.text.notRun, view),
40
+ ];
41
+ };
42
+ const placeLine = (place, view) => {
43
+ const name = view.structure.features[place.feature.id].name;
44
+ const value = place.feature.value === undefined ? "" : view.structure.features[place.feature.id].value(place.feature.value, place.feature.detail, view.unit);
45
+ const where = view.structure.past(place.pastShare ?? 0, place.direction === "low");
46
+ const line = `✗ ${name}: ${value} ${where}`;
47
+ return place.sameAs === undefined ? line : view.text.aside(line, view.text.sameAs(nameOf(place.sameAs, view)));
48
+ };
49
+ const structureBlock = (score, view) => {
50
+ if (score.structure === undefined)
51
+ return [view.text.structureNotCompared(view.groupName)];
52
+ const beyond = score.structure.filter((place) => place.beyond);
53
+ const usual = score.structure.filter((place) => !place.beyond && place.pastShare !== undefined).length;
54
+ return [view.text.structureHeading, ...beyond.map((place) => ` ${placeLine(place, view)}`), ...(usual > 0 ? [` ${view.text.usual(usual)}`] : [])];
55
+ };
56
+ /** For a person: the level, the signs, each signal and structure measure that showed, and what was not compared and why. */
57
+ export const renderAiScoreFriendly = (path, score, view) => {
58
+ const head = [path, aiScoreHeadline(score, view)];
59
+ if (score.notScored !== undefined)
60
+ return head;
61
+ return [
62
+ ...head,
63
+ ` ${view.text.signs(score.signs, score.compared, MEDIUM_SIGNS, HIGH_SIGNS)}`,
64
+ ` ${view.text.disclaimer}`,
65
+ "",
66
+ ...signalLines(score.signals, view),
67
+ "",
68
+ ...structureBlock(score, view),
69
+ ];
70
+ };
71
+ /** For grep: the level (or not-scored) and the signs, on one line. */
72
+ export const renderAiScoreCompact = (path, score) => {
73
+ const level = score.level ?? `not-scored:${score.notScored?.reason ?? ""}`;
74
+ return [`${path}: ai-score ${level} ${String(score.signs)}/${String(score.compared)}`, ...shownSignsOf(score)].join(" ");
75
+ };
76
+ /** The score as data, for the JSON report and chaff grade's results. */
77
+ export const aiScoreJson = (score) => ({
78
+ level: score.level ?? null,
79
+ notScored: score.notScored ?? null,
80
+ group: score.group,
81
+ signs: score.signs,
82
+ compared: score.compared,
83
+ thresholds: { medium: MEDIUM_SIGNS, high: HIGH_SIGNS },
84
+ signals: score.signals.map((signal) => ({
85
+ rule: signal.rule,
86
+ count: signal.count,
87
+ ...(signal.notRun === undefined ? {} : { notRun: signal.notRun }),
88
+ human: signal.human ?? null,
89
+ unusual: signal.unusual,
90
+ })),
91
+ structure: score.structure?.map((place) => ({
92
+ id: place.feature.id,
93
+ value: place.feature.value ?? null,
94
+ pastShare: place.pastShare ?? null,
95
+ limit: place.limit ?? null,
96
+ beyond: place.beyond,
97
+ sameAs: place.sameAs ?? null,
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,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QACjE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;QAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC;IACH,SAAS,EACP,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC/B,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;QACpB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI;QAClC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI;QAClC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;QAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI;KAC7B,CAAC,CAAC,IAAI,IAAI;CACd,CAAC,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { LengthUnit } from "../plugin.ts";
2
+ import { type Placement, type StructureScore } from "../structure-shape/score.ts";
3
+ /** On how many human documents of one genre group a rule reported (corpus/rules-measure.json). */
4
+ export type GroupShare = {
5
+ readonly documents: number;
6
+ readonly fired: number;
7
+ };
8
+ /** Each AI-shape rule's human shares, by genre group. */
9
+ export type HumanShares = Readonly<Record<string, Readonly<Record<string, GroupShare>>>>;
10
+ /**
11
+ * A sign is unusual when at most this share of human documents shows it: the same line the structure measures draw at
12
+ * the human p90 (BEYOND_STEP), so a phrase signal and a structure measure count by one rule.
13
+ */
14
+ export declare const RARE_SHARE: number;
15
+ /** Below this many human documents a share moves in steps wider than RARE_SHARE: one document alone would be past it. */
16
+ export declare const MIN_BASELINE_DOCUMENTS: number;
17
+ /** In unusual signs: ai-generated-composite's normal and relaxed levels, held to them by test_ai_score.ts. */
18
+ export declare const MEDIUM_SIGNS = 3;
19
+ export declare const HIGH_SIGNS = 5;
20
+ export type AiLevel = "low" | "medium" | "high";
21
+ /** One AI-shape rule's run on the document: how many findings it made, or why it did not run. */
22
+ export type SignalRun = {
23
+ readonly rule: string;
24
+ readonly count: number;
25
+ readonly notRun?: string;
26
+ };
27
+ /** One signal set against human documents of the genre group. */
28
+ export type SignalPlace = SignalRun & {
29
+ /** The human share for the group, or undefined when the group has none, or too few documents to compare with. */
30
+ readonly human: GroupShare | undefined;
31
+ /** It fired, and at most RARE_SHARE of human documents of the group show it: one sign. */
32
+ readonly unusual: boolean;
33
+ };
34
+ /** One structure measure against human articles. sameAs: the rule that reads the same shape, when that rule already counts it. */
35
+ export type StructurePlace = Placement & {
36
+ readonly sameAs: string | undefined;
37
+ };
38
+ export type NotScored = {
39
+ readonly reason: "too-short";
40
+ readonly length: number;
41
+ readonly minimum: number;
42
+ readonly unit: LengthUnit;
43
+ } | {
44
+ readonly reason: "no-baseline";
45
+ readonly compared: number;
46
+ readonly needed: number;
47
+ };
48
+ export type AiScore = {
49
+ readonly group: string;
50
+ /** undefined when the document is not scored: see notScored. */
51
+ readonly level: AiLevel | undefined;
52
+ readonly notScored: NotScored | undefined;
53
+ /** The unusual signs: signals and structure measures past what most human documents of the group show. */
54
+ readonly signs: number;
55
+ /** How many signals and measures could be set against human documents at all. */
56
+ readonly compared: number;
57
+ readonly signals: readonly SignalPlace[];
58
+ /** The structure measures against human articles, or undefined where they are not compared for the genre. */
59
+ readonly structure: readonly StructurePlace[] | undefined;
60
+ };
61
+ /** What the score is computed from. structure: undefined where the structure baseline does not apply to the genre. */
62
+ export type ScoreInput = {
63
+ readonly group: string;
64
+ readonly length: number;
65
+ readonly minimum: number;
66
+ readonly unit: LengthUnit;
67
+ readonly signals: readonly SignalRun[];
68
+ readonly shares: HumanShares;
69
+ readonly structure: StructureScore | undefined;
70
+ };
71
+ export declare const levelOf: (signs: number) => AiLevel;
72
+ export declare const isRare: (share: GroupShare) => boolean;
73
+ /** The quick score of one document: its unusual signs against human documents of its genre group, and the level they reach. */
74
+ export declare const aiScoreOf: (input: ScoreInput) => AiScore;
75
+ /** The signs that counted, for one line: rule ids, and structure measures as structure:<id>. */
76
+ export declare const shownSignsOf: (score: AiScore) => string[];
77
+ //# sourceMappingURL=score.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../src/ai-score/score.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAO/F,kGAAkG;AAClG,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAIzF;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAoC,CAAC;AAE5D,yHAAyH;AACzH,eAAO,MAAM,sBAAsB,QAA4B,CAAC;AAEhE,8GAA8G;AAC9G,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhD,iGAAiG;AACjG,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpG,iEAAiE;AACjE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IACpC,iHAAiH;IACjH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AO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,KAAG,OAGvC,CAAC;AAKF,eAAO,MAAM,MAAM,GAAI,OAAO,UAAU,KAAG,OAAsD,CAAC;AAqBlG,+HAA+H;AAC/H,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,KAAG,OAU7C,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAAM,EAGnD,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { BEYOND_STEP } from "../structure-shape/score.js";
2
+ import { SAME_SHAPE } from "./signals.js";
3
+ const PERCENT = 100;
4
+ /**
5
+ * A sign is unusual when at most this share of human documents shows it: the same line the structure measures draw at
6
+ * the human p90 (BEYOND_STEP), so a phrase signal and a structure measure count by one rule.
7
+ */
8
+ export const RARE_SHARE = (PERCENT - BEYOND_STEP) / PERCENT;
9
+ /** Below this many human documents a share moves in steps wider than RARE_SHARE: one document alone would be past it. */
10
+ export const MIN_BASELINE_DOCUMENTS = Math.ceil(1 / RARE_SHARE);
11
+ /** In unusual signs: ai-generated-composite's normal and relaxed levels, held to them by test_ai_score.ts. */
12
+ export const MEDIUM_SIGNS = 3;
13
+ export const HIGH_SIGNS = 5;
14
+ export const levelOf = (signs) => {
15
+ if (signs >= HIGH_SIGNS)
16
+ return "high";
17
+ return signs >= MEDIUM_SIGNS ? "medium" : "low";
18
+ };
19
+ const comparableShare = (share) => share !== undefined && share.documents >= MIN_BASELINE_DOCUMENTS ? share : undefined;
20
+ export const isRare = (share) => share.fired / share.documents <= RARE_SHARE;
21
+ const placeSignal = (run, shares, group) => {
22
+ const human = run.notRun === undefined ? comparableShare(shares[run.rule]?.[group]) : undefined;
23
+ return { ...run, human, unusual: human !== undefined && run.count > 0 && isRare(human) };
24
+ };
25
+ const notScoredOf = (input, compared) => {
26
+ if (input.length < input.minimum)
27
+ return { reason: "too-short", length: input.length, minimum: input.minimum, unit: input.unit };
28
+ // Fewer comparable signs than the high boundary could never read high: a low there would only mean "not looked at".
29
+ return compared < HIGH_SIGNS ? { reason: "no-baseline", compared, needed: HIGH_SIGNS } : undefined;
30
+ };
31
+ const placeStructure = (placement, signals) => {
32
+ const twin = signals.find((signal) => signal.rule === SAME_SHAPE[placement.feature.id]);
33
+ return { ...placement, sameAs: placement.beyond && twin?.unusual === true ? twin.rule : undefined };
34
+ };
35
+ const comparedTwice = (placement, signals) => placement.pastShare !== undefined && signals.some((signal) => signal.rule === SAME_SHAPE[placement.feature.id] && signal.human !== undefined);
36
+ /** The quick score of one document: its unusual signs against human documents of its genre group, and the level they reach. */
37
+ export const aiScoreOf = (input) => {
38
+ const signals = input.signals.map((run) => placeSignal(run, input.shares, input.group));
39
+ const placements = input.structure?.placements.map((placement) => placeStructure(placement, signals));
40
+ const measures = placements ?? [];
41
+ const signs = signals.filter((signal) => signal.unusual).length + measures.filter((place) => place.beyond && place.sameAs === undefined).length;
42
+ const compared = signals.filter((signal) => signal.human !== undefined).length +
43
+ measures.filter((place) => place.pastShare !== undefined && !comparedTwice(place, signals)).length;
44
+ const notScored = notScoredOf(input, compared);
45
+ return { group: input.group, level: notScored === undefined ? levelOf(signs) : undefined, notScored, signs, compared, signals, structure: placements };
46
+ };
47
+ /** The signs that counted, for one line: rule ids, and structure measures as structure:<id>. */
48
+ export const shownSignsOf = (score) => [
49
+ ...score.signals.filter((signal) => signal.unusual).map((signal) => signal.rule),
50
+ ...(score.structure ?? []).filter((place) => place.beyond && place.sameAs === undefined).map((place) => `structure:${place.feature.id}`),
51
+ ];
52
+ //# sourceMappingURL=score.js.map
@@ -0,0 +1 @@
1
+ {"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AO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AACzJ,CAAC,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAY,EAAE,CAAC;IACxD,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;IAChF,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;CACzI,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Level, LevelTable, RuleDefinition } from "../plugin.ts";
2
+ import type { FeatureId } from "../structure-shape/features.ts";
3
+ /** The rules of group ai-tells, the signals ai-generated-composite reads, and ALSO_AI_SHAPES, in rule-file order. */
4
+ export declare const aiShapeRuleIds: (rules: readonly RuleDefinition[]) => string[];
5
+ /**
6
+ * The AI-shape rules the quick score counts one by one: every one but the two that only add up others (the composite
7
+ * over the signals, ai-structure over the structure measures), which would count the same sign twice.
8
+ */
9
+ export declare const scoredSignalIds: (rules: readonly RuleDefinition[]) => string[];
10
+ /** A structure measure and the rule that reads the same shape: when both count, the shape counts once. */
11
+ export declare const SAME_SHAPE: Readonly<Partial<Record<FeatureId, string>>>;
12
+ /** The composite's levels: the score's level boundaries are held to them (test_ai_score.ts). */
13
+ export declare const compositeLevels: (rules: readonly RuleDefinition[]) => LevelTable;
14
+ /**
15
+ * The level each rule runs at when measured on human documents (`yarn rules:measure`): the genre's level, and normal
16
+ * where the genre turns the rule off, so a share exists for every genre group the rule can run in.
17
+ */
18
+ export declare const measuredLevelsOf: (rules: readonly RuleDefinition[], preset: Readonly<Record<string, Level>>) => Record<string, Level>;
19
+ //# sourceMappingURL=signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/ai-score/signals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAShE,qHAAqH;AACrH,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,cAAc,EAAE,KAAG,MAAM,EAGvE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,cAAc,EAAE,KAAG,MAAM,EAAqF,CAAC;AAE/J,0GAA0G;AAC1G,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAKnE,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,cAAc,EAAE,KAAG,UAAuE,CAAC;AAE3I;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,cAAc,EAAE,EAAE,QAAQ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAC0B,CAAC"}
@@ -0,0 +1,30 @@
1
+ /** Shapes of generated text whose rules sit in another group of the reference (a markup density, a template blank). */
2
+ const ALSO_AI_SHAPES = ["bold-density", "chat-citation-residue", "emoji-density", "unfilled-placeholder"];
3
+ const COMPOSITE = "ai-generated-composite";
4
+ /** Counted through the structure measures it reads, one by one, so it is not counted again as a whole. */
5
+ const STRUCTURE_RULE = "ai-structure";
6
+ /** The rules of group ai-tells, the signals ai-generated-composite reads, and ALSO_AI_SHAPES, in rule-file order. */
7
+ export const aiShapeRuleIds = (rules) => {
8
+ const read = new Set([...ALSO_AI_SHAPES, ...rules.flatMap((rule) => (rule.id === COMPOSITE ? rule.from : []))]);
9
+ return rules.filter((rule) => rule.guide?.group === "ai-tells" || read.has(rule.id)).map((rule) => rule.id);
10
+ };
11
+ /**
12
+ * The AI-shape rules the quick score counts one by one: every one but the two that only add up others (the composite
13
+ * over the signals, ai-structure over the structure measures), which would count the same sign twice.
14
+ */
15
+ export const scoredSignalIds = (rules) => aiShapeRuleIds(rules).filter((id) => id !== COMPOSITE && id !== STRUCTURE_RULE);
16
+ /** A structure measure and the rule that reads the same shape: when both count, the shape counts once. */
17
+ export const SAME_SHAPE = {
18
+ "section-uniformity": "section-length-uniformity",
19
+ "bold-labels": "bold-label-list",
20
+ "emoji-headings": "emoji-heading",
21
+ "three-item-lists": "rule-of-three",
22
+ };
23
+ /** The composite's levels: the score's level boundaries are held to them (test_ai_score.ts). */
24
+ export const compositeLevels = (rules) => rules.find((rule) => rule.id === COMPOSITE)?.levels ?? {};
25
+ /**
26
+ * The level each rule runs at when measured on human documents (`yarn rules:measure`): the genre's level, and normal
27
+ * where the genre turns the rule off, so a share exists for every genre group the rule can run in.
28
+ */
29
+ export const measuredLevelsOf = (rules, preset) => Object.fromEntries(rules.map((rule) => [rule.id, preset[rule.id] === undefined || preset[rule.id] === "off" ? "normal" : (preset[rule.id] ?? "normal")]));
30
+ //# sourceMappingURL=signals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/ai-score/signals.ts"],"names":[],"mappings":"AAGA,uHAAuH;AACvH,MAAM,cAAc,GAAsB,CAAC,cAAc,EAAE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AAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;AAE3I;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAgC,EAAE,MAAuC,EAAyB,EAAE,CACnI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { LengthUnit } from "../plugin.ts";
2
+ import type { Texts } from "../ui.ts";
3
+ import type { AiLevel } from "./score.ts";
4
+ /** What the AI-likeness score says, in both languages. `group` is the genre group's name (ブログ / Blog). */
5
+ export type AiScoreText = {
6
+ readonly level: Readonly<Record<AiLevel, string>>;
7
+ /** The headline: the level and what it compares with. Never a claim about who wrote the text. */
8
+ readonly headline: (level: AiLevel, group: string) => string;
9
+ readonly tooShort: (length: number, minimum: number, unit: LengthUnit) => string;
10
+ readonly noBaseline: (group: string, compared: number, needed: number) => string;
11
+ readonly disclaimer: string;
12
+ /** How many signs, out of how many compared, and where the levels start. */
13
+ readonly signs: (signs: number, compared: number, medium: number, high: number) => string;
14
+ readonly signalsHeading: string;
15
+ readonly structureHeading: string;
16
+ /** A signal that fired, with the share of human documents of the group that show it. */
17
+ readonly fired: (name: string, count: number, fired: number, documents: number, group: string) => string;
18
+ /** A signal that fired but is common in human documents of the group, so it does not count. */
19
+ readonly common: (name: string, count: number, fired: number, documents: number) => string;
20
+ readonly quiet: (count: number) => string;
21
+ /** The structure measures within what human articles show. */
22
+ readonly usual: (count: number) => string;
23
+ readonly noHumanShare: (names: string) => string;
24
+ readonly notRun: (names: string) => string;
25
+ readonly structureNotCompared: (group: string) => string;
26
+ /** A structure measure past the human limit whose shape a signal above already counts. */
27
+ readonly sameAs: (name: string) => string;
28
+ /** The one line in the lint report. */
29
+ readonly summary: (headline: string, signs: number, path: string) => string;
30
+ readonly summaryNotScored: (reason: string) => string;
31
+ readonly usage: string;
32
+ readonly unknownFormat: (format: string) => string;
33
+ readonly listSeparator: string;
34
+ readonly aside: (main: string, inner: string) => string;
35
+ };
36
+ export declare const AI_SCORE_TEXT: Texts<AiScoreText>;
37
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/ai-score/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,0GAA0G;AAC1G,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,iGAAiG;IACjG,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC;IACjF,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACjF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,4EAA4E;IAC5E,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C,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACzD,CAAC;AAWF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,WAAW,CAwD5C,CAAC"}
@@ -0,0 +1,59 @@
1
+ const unitJa = (unit) => (unit === "char" ? "字" : "語");
2
+ const unitEn = (count, unit) => {
3
+ if (unit === "char")
4
+ return "characters";
5
+ return count === 1 ? "word" : "words";
6
+ };
7
+ const HEADLINE_JA = { high: "目印が多い", medium: "目印がやや多い", low: "同じくらい" };
8
+ const HEADLINE_EN = { high: "more signs than", medium: "somewhat more signs than", low: "about as many signs as" };
9
+ export const AI_SCORE_TEXT = {
10
+ ja: {
11
+ level: { low: "低", medium: "中", high: "高" },
12
+ headline: (level, group) => `AI らしさ: ${AI_SCORE_TEXT.ja.level[level]}(人が書いた文書(${group})と比べて${HEADLINE_JA[level]})`,
13
+ tooShort: (length, minimum, unit) => `短すぎます: ${String(length)} ${unitJa(unit)}。${String(minimum)} ${unitJa(unit)}から測ります`,
14
+ noBaseline: (group, compared, needed) => `人が書いた文書(${group})と比べられる目印は ${String(compared)} 項目です。${String(needed)} 項目から測ります`,
15
+ disclaimer: "※ 書いたのが AI かどうかの判定ではありません。生成文に多い目印が、人の文書と比べてどれだけ出ているかです。",
16
+ signs: (signs, compared, medium, high) => `目印 ${String(signs)} 個(比べた ${String(compared)} 項目のうち、人の文書の 9 割には出ないもの)。中は ${String(medium)} 個から、高は ${String(high)} 個から`,
17
+ signalsHeading: "言い回しと形",
18
+ structureHeading: "構成(人の記事と比べて)",
19
+ fired: (name, count, fired, documents, group) => `✗ ${name}: ${String(count)} 件 人が書いた文書(${group})${String(documents)} 本のうち ${String(fired)} 本`,
20
+ common: (name, count, fired, documents) => `· ${name}: ${String(count)} 件 人の文書でも出る(${String(documents)} 本のうち ${String(fired)} 本)ので数えません`,
21
+ quiet: (count) => `· ほかの ${String(count)} 項目は出ていません`,
22
+ usual: (count) => `· ほかの ${String(count)} 項目は人の記事でふつうの値です`,
23
+ noHumanShare: (names) => `比べていない(人の文書の基準が無い): ${names}`,
24
+ notRun: (names) => `動かなかった: ${names}`,
25
+ structureNotCompared: (group) => `構成: 比べていません(基準はブログの記事で、${group}には使いません)`,
26
+ sameAs: (name) => `「${name}」と同じ形なので 1 つに数えます`,
27
+ summary: (headline, signs, path) => `${headline}: 目印 ${String(signs)} 個 ※ 書いたのが AI かどうかの判定ではありません。内訳: chaff ai-score ${path}`,
28
+ summaryNotScored: (reason) => `AI らしさ: 測っていません(${reason})`,
29
+ usage: "使い方: chaff ai-score <file>... [--genre <ジャンル>] [--format text|json] [--compact]",
30
+ unknownFormat: (format) => `--format は text か json です(${format} は知りません)`,
31
+ listSeparator: "、",
32
+ aside: (main, inner) => `${main}(${inner})`,
33
+ },
34
+ en: {
35
+ level: { low: "low", medium: "medium", high: "high" },
36
+ headline: (level, group) => `AI-likeness: ${AI_SCORE_TEXT.en.level[level]} (${HEADLINE_EN[level]} human-written documents (${group}))`,
37
+ tooShort: (length, minimum, unit) => `too short: ${String(length)} ${unitEn(length, unit)}; scored from ${String(minimum)}`,
38
+ noBaseline: (group, compared, needed) => `${String(compared)} of the ${String(needed)} comparable signs needed against human-written documents (${group})`,
39
+ disclaimer: "Not a verdict on whether AI wrote it: how many signs common in generated text show, compared with human documents.",
40
+ signs: (signs, compared, medium, high) => `${String(signs)} ${signs === 1 ? "sign" : "signs"} (of ${String(compared)} compared, ones 90% of human documents do not show); medium from ${String(medium)}, high from ${String(high)}`,
41
+ signalsHeading: "Wording and shape",
42
+ structureHeading: "Structure (against human articles)",
43
+ fired: (name, count, fired, documents, group) => `✗ ${name}: ${String(count)} in ${String(fired)} of ${String(documents)} human-written documents (${group})`,
44
+ common: (name, count, fired, documents) => `· ${name}: ${String(count)} common in human documents too (${String(fired)} of ${String(documents)}), not counted`,
45
+ quiet: (count) => `· the other ${String(count)} did not show`,
46
+ usual: (count) => `· the other ${String(count)} are usual for human articles`,
47
+ noHumanShare: (names) => `not compared (no human baseline): ${names}`,
48
+ notRun: (names) => `did not run: ${names}`,
49
+ structureNotCompared: (group) => `Structure: not compared (the baseline is blog articles, not used for ${group})`,
50
+ sameAs: (name) => `the same shape as "${name}", counted once`,
51
+ summary: (headline, signs, path) => `${headline}: ${String(signs)} ${signs === 1 ? "sign" : "signs"}. Not a verdict on whether AI wrote it. Breakdown: chaff ai-score ${path}`,
52
+ summaryNotScored: (reason) => `AI-likeness: not scored (${reason})`,
53
+ usage: "usage: chaff ai-score <file>... [--genre <genre>] [--format text|json] [--compact]",
54
+ unknownFormat: (format) => `--format is text or json (not ${format})`,
55
+ listSeparator: ", ",
56
+ aside: (main, inner) => `${main} (${inner})`,
57
+ },
58
+ };
59
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/ai-score/text.ts"],"names":[],"mappings":"AAqCA,MAAM,MAAM,GAAG,CAAC,IAAgB,EAAU,EAAE,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC3E,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,IAAgB,EAAU,EAAE;IACzD,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,YAAY,CAAC;IACzC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,WAAW,GAAsC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE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EAAE,CACxC,KAAK,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,oCAAoC,MAAM,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,gBAAgB;QACtH,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,MAAM,CAAC,KAAK,CAAC,eAAe;QAC7D,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,MAAM,CAAC,KAAK,CAAC,+BAA+B;QAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,qCAAqC,KAAK,EAAE;QACrE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,KAAK,EAAE;QAC1C,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,wEAAwE,KAAK,GAAG;QACjH,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,IAAI,iBAAiB;QAC7D,OAAO,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACjC,GAAG,QAAQ,KAAK,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,qEAAqE,IAAI,EAAE;QAC5I,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,4BAA4B,MAAM,GAAG;QACnE,KAAK,EAAE,oFAAoF;QAC3F,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iCAAiC,MAAM,GAAG;QACrE,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,KAAK,GAAG;KAC7C;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { LengthUnit, RuleDefinition } from "../plugin.ts";
2
+ import type { ScoreView } from "./render.ts";
3
+ /** The texts and names a score is shown with, in the document's language. */
4
+ export declare const scoreViewOf: (language: string, unit: LengthUnit, group: string, rules: readonly RuleDefinition[]) => ScoreView;
5
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/ai-score/view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,6EAA6E;AAC7E,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,EAAE,MAAM,UAAU,EAAE,OAAO,MAAM,EAAE,OAAO,SAAS,cAAc,EAAE,KAAG,SAWjH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { loadGenres } from "../genre-load.js";
2
+ import { localized } from "../render/text.js";
3
+ import { STRUCTURE_TEXT } from "../outline/structure-text.js";
4
+ import { uiLanguageOf } from "../ui.js";
5
+ import { AI_SCORE_TEXT } from "./text.js";
6
+ /** The texts and names a score is shown with, in the document's language. */
7
+ export const scoreViewOf = (language, unit, group, rules) => {
8
+ const ui = uiLanguageOf(language);
9
+ const name = loadGenres().groups.find((entry) => entry.id === group)?.name;
10
+ return {
11
+ text: AI_SCORE_TEXT[ui],
12
+ structure: STRUCTURE_TEXT[ui],
13
+ language: ui,
14
+ unit,
15
+ groupName: name === undefined ? group : localized(name, ui),
16
+ ruleNames: Object.fromEntries(rules.map((rule) => [rule.id, rule.name])),
17
+ };
18
+ };
19
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/ai-score/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,IAAgB,EAAE,KAAa,EAAE,KAAgC,EAAa,EAAE;IAC5H,MAAM,EAAE,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,IAAI,CAAC;IAC3E,OAAO;QACL,IAAI,EAAE,aAAa,CAAC,EAAE,CAAC;QACvB,SAAS,EAAE,cAAc,CAAC,EAAE,CAAC;QAC7B,QAAQ,EAAE,EAAE;QACZ,IAAI;QACJ,SAAS,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3D,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACzE,CAAC;AACJ,CAAC,CAAC"}
@@ -13,7 +13,6 @@ export type AnthropicClient = {
13
13
  readonly create: (params: Anthropic.MessageCreateParamsNonStreaming) => Promise<AnthropicResponse>;
14
14
  };
15
15
  };
16
- export declare const DEFAULT_MODEL = "claude-opus-5";
17
16
  export declare const hasCredentials: (profileDir?: string) => boolean;
18
17
  export declare const isAuthFailure: (error: unknown) => boolean;
19
18
  /** API が返した失敗だけを拾う。ネットワーク断やコードの誤りは、握りつぶさずそのまま投げる。 */
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/backends/anthropic.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AA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