@aragon-agent/cli 0.6.55 → 0.6.57

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 (319) hide show
  1. package/CHANGELOG.md +2935 -2864
  2. package/README.md +160 -45
  3. package/dist/agent/controller.d.ts +47 -0
  4. package/dist/agent/controller.js +153 -2
  5. package/dist/agent/governance-wiring.js +8 -1
  6. package/dist/agent/system-prompt.d.ts +26 -0
  7. package/dist/agent/system-prompt.js +11 -0
  8. package/dist/app/App.js +101 -3
  9. package/dist/cli.js +29 -1
  10. package/dist/commands/builtins.js +4 -0
  11. package/dist/commands/catalog.js +1 -0
  12. package/dist/commands/registry.d.ts +8 -0
  13. package/dist/config/app-paths.d.ts +10 -0
  14. package/dist/config/app-paths.js +12 -0
  15. package/dist/config/cli-commands.d.ts +29 -0
  16. package/dist/config/cli-commands.js +76 -1
  17. package/dist/config/env.d.ts +2 -1
  18. package/dist/config/env.js +12 -1
  19. package/dist/config/load.d.ts +10 -0
  20. package/dist/config/load.js +13 -2
  21. package/dist/config/store.js +11 -1
  22. package/dist/exec/bridge/server.d.ts +7 -0
  23. package/dist/exec/bridge/server.js +6 -2
  24. package/dist/exec/cli-commands.js +4 -0
  25. package/dist/exec/index.js +2 -0
  26. package/dist/exec/options.d.ts +11 -0
  27. package/dist/exec/options.js +21 -1
  28. package/dist/gene/block.d.ts +33 -0
  29. package/dist/gene/block.js +51 -0
  30. package/dist/gene/capacity.d.ts +74 -0
  31. package/dist/gene/capacity.js +169 -0
  32. package/dist/gene/catalog-reconcile.d.ts +13 -0
  33. package/dist/gene/catalog-reconcile.js +105 -0
  34. package/dist/gene/catalog-stats.d.ts +27 -0
  35. package/dist/gene/catalog-stats.js +89 -0
  36. package/dist/gene/catalog-sync.d.ts +82 -0
  37. package/dist/gene/catalog-sync.js +324 -0
  38. package/dist/gene/catalog.d.ts +160 -0
  39. package/dist/gene/catalog.js +433 -0
  40. package/dist/gene/cli-commands.d.ts +50 -0
  41. package/dist/gene/cli-commands.js +500 -0
  42. package/dist/gene/command-report.d.ts +40 -0
  43. package/dist/gene/command-report.js +246 -0
  44. package/dist/gene/command.d.ts +29 -0
  45. package/dist/gene/command.js +561 -0
  46. package/dist/gene/commit-apply-types.d.ts +13 -0
  47. package/dist/gene/commit-apply-types.js +1 -0
  48. package/dist/gene/commit-compound.d.ts +34 -0
  49. package/dist/gene/commit-compound.js +212 -0
  50. package/dist/gene/commit-counts.d.ts +41 -0
  51. package/dist/gene/commit-counts.js +70 -0
  52. package/dist/gene/commit-exec.d.ts +42 -0
  53. package/dist/gene/commit-exec.js +134 -0
  54. package/dist/gene/commit-head.d.ts +52 -0
  55. package/dist/gene/commit-head.js +97 -0
  56. package/dist/gene/commit-plan.d.ts +95 -0
  57. package/dist/gene/commit-plan.js +68 -0
  58. package/dist/gene/commit-prepare.d.ts +63 -0
  59. package/dist/gene/commit-prepare.js +159 -0
  60. package/dist/gene/commit-types.d.ts +234 -0
  61. package/dist/gene/commit-types.js +3 -0
  62. package/dist/gene/curator/agent.d.ts +137 -0
  63. package/dist/gene/curator/agent.js +203 -0
  64. package/dist/gene/curator/budget.d.ts +69 -0
  65. package/dist/gene/curator/budget.js +131 -0
  66. package/dist/gene/curator/conflicts.d.ts +54 -0
  67. package/dist/gene/curator/conflicts.js +143 -0
  68. package/dist/gene/curator/curator.d.ts +170 -0
  69. package/dist/gene/curator/curator.js +617 -0
  70. package/dist/gene/curator/deps.d.ts +34 -0
  71. package/dist/gene/curator/deps.js +48 -0
  72. package/dist/gene/curator/deterministic.d.ts +62 -0
  73. package/dist/gene/curator/deterministic.js +287 -0
  74. package/dist/gene/curator/executors.d.ts +36 -0
  75. package/dist/gene/curator/executors.js +379 -0
  76. package/dist/gene/curator/lanes.d.ts +52 -0
  77. package/dist/gene/curator/lanes.js +99 -0
  78. package/dist/gene/curator/lease.d.ts +76 -0
  79. package/dist/gene/curator/lease.js +171 -0
  80. package/dist/gene/curator/library.d.ts +36 -0
  81. package/dist/gene/curator/library.js +169 -0
  82. package/dist/gene/curator/lifecycle.d.ts +52 -0
  83. package/dist/gene/curator/lifecycle.js +109 -0
  84. package/dist/gene/curator/maintenance.d.ts +71 -0
  85. package/dist/gene/curator/maintenance.js +213 -0
  86. package/dist/gene/curator/probation.d.ts +51 -0
  87. package/dist/gene/curator/probation.js +71 -0
  88. package/dist/gene/curator/probe.d.ts +131 -0
  89. package/dist/gene/curator/probe.js +534 -0
  90. package/dist/gene/curator/prompt.d.ts +18 -0
  91. package/dist/gene/curator/prompt.js +128 -0
  92. package/dist/gene/curator/publish.d.ts +64 -0
  93. package/dist/gene/curator/publish.js +113 -0
  94. package/dist/gene/curator/recheck.d.ts +55 -0
  95. package/dist/gene/curator/recheck.js +104 -0
  96. package/dist/gene/curator/run-events.d.ts +63 -0
  97. package/dist/gene/curator/run-events.js +55 -0
  98. package/dist/gene/curator/similarity.d.ts +13 -0
  99. package/dist/gene/curator/similarity.js +46 -0
  100. package/dist/gene/curator/switches.d.ts +78 -0
  101. package/dist/gene/curator/switches.js +146 -0
  102. package/dist/gene/curator/task-context.d.ts +93 -0
  103. package/dist/gene/curator/task-context.js +63 -0
  104. package/dist/gene/curator/task-runner.d.ts +56 -0
  105. package/dist/gene/curator/task-runner.js +257 -0
  106. package/dist/gene/curator/tool-support.d.ts +112 -0
  107. package/dist/gene/curator/tool-support.js +206 -0
  108. package/dist/gene/curator/toolkit.d.ts +49 -0
  109. package/dist/gene/curator/toolkit.js +104 -0
  110. package/dist/gene/curator/tools-read.d.ts +4 -0
  111. package/dist/gene/curator/tools-read.js +177 -0
  112. package/dist/gene/curator/tools-release.d.ts +73 -0
  113. package/dist/gene/curator/tools-release.js +287 -0
  114. package/dist/gene/curator/tools-verify.d.ts +47 -0
  115. package/dist/gene/curator/tools-verify.js +243 -0
  116. package/dist/gene/curator/tools-write.d.ts +26 -0
  117. package/dist/gene/curator/tools-write.js +434 -0
  118. package/dist/gene/curator/tools.d.ts +23 -0
  119. package/dist/gene/curator/tools.js +21 -0
  120. package/dist/gene/curator/validate/common.d.ts +87 -0
  121. package/dist/gene/curator/validate/common.js +132 -0
  122. package/dist/gene/curator/validate/evidence-tokens.d.ts +24 -0
  123. package/dist/gene/curator/validate/evidence-tokens.js +217 -0
  124. package/dist/gene/curator/validate/index.d.ts +23 -0
  125. package/dist/gene/curator/validate/index.js +62 -0
  126. package/dist/gene/curator/validate/knowledge.d.ts +41 -0
  127. package/dist/gene/curator/validate/knowledge.js +255 -0
  128. package/dist/gene/curator/validate/live-check.d.ts +14 -0
  129. package/dist/gene/curator/validate/live-check.js +150 -0
  130. package/dist/gene/curator/validate/ports.d.ts +67 -0
  131. package/dist/gene/curator/validate/ports.js +1 -0
  132. package/dist/gene/curator/validate/prompts.d.ts +41 -0
  133. package/dist/gene/curator/validate/prompts.js +165 -0
  134. package/dist/gene/curator/validate/skill.d.ts +15 -0
  135. package/dist/gene/curator/validate/skill.js +251 -0
  136. package/dist/gene/curator/validate/tool.d.ts +6 -0
  137. package/dist/gene/curator/validate/tool.js +217 -0
  138. package/dist/gene/curator/validate/types.d.ts +90 -0
  139. package/dist/gene/curator/validate/types.js +1 -0
  140. package/dist/gene/curator/validator-ports.d.ts +38 -0
  141. package/dist/gene/curator/validator-ports.js +29 -0
  142. package/dist/gene/diag.d.ts +209 -0
  143. package/dist/gene/diag.js +549 -0
  144. package/dist/gene/env.d.ts +10 -0
  145. package/dist/gene/env.js +214 -0
  146. package/dist/gene/eval-recorder.d.ts +84 -0
  147. package/dist/gene/eval-recorder.js +222 -0
  148. package/dist/gene/explain-transport.d.ts +3 -0
  149. package/dist/gene/explain-transport.js +39 -0
  150. package/dist/gene/explain.d.ts +96 -0
  151. package/dist/gene/explain.js +293 -0
  152. package/dist/gene/fs.d.ts +39 -0
  153. package/dist/gene/fs.js +139 -0
  154. package/dist/gene/fsck.d.ts +68 -0
  155. package/dist/gene/fsck.js +134 -0
  156. package/dist/gene/gc-library-sweeps.d.ts +9 -0
  157. package/dist/gene/gc-library-sweeps.js +220 -0
  158. package/dist/gene/gc-rejected-set.d.ts +15 -0
  159. package/dist/gene/gc-rejected-set.js +63 -0
  160. package/dist/gene/gc-safe.d.ts +12 -0
  161. package/dist/gene/gc-safe.js +74 -0
  162. package/dist/gene/gc-scope-sweeps.d.ts +18 -0
  163. package/dist/gene/gc-scope-sweeps.js +297 -0
  164. package/dist/gene/gc-types.d.ts +55 -0
  165. package/dist/gene/gc-types.js +26 -0
  166. package/dist/gene/gc.d.ts +42 -0
  167. package/dist/gene/gc.js +129 -0
  168. package/dist/gene/gene-errors.d.ts +23 -0
  169. package/dist/gene/gene-errors.js +29 -0
  170. package/dist/gene/hints.d.ts +91 -0
  171. package/dist/gene/hints.js +394 -0
  172. package/dist/gene/hub.d.ts +149 -0
  173. package/dist/gene/hub.js +371 -0
  174. package/dist/gene/import-plan.d.ts +80 -0
  175. package/dist/gene/import-plan.js +294 -0
  176. package/dist/gene/import-proposal.d.ts +23 -0
  177. package/dist/gene/import-proposal.js +101 -0
  178. package/dist/gene/import-skill-port.d.ts +6 -0
  179. package/dist/gene/import-skill-port.js +53 -0
  180. package/dist/gene/import-sources.d.ts +48 -0
  181. package/dist/gene/import-sources.js +140 -0
  182. package/dist/gene/index-writer.d.ts +36 -0
  183. package/dist/gene/index-writer.js +101 -0
  184. package/dist/gene/learn/learn-call.d.ts +116 -0
  185. package/dist/gene/learn/learn-call.js +165 -0
  186. package/dist/gene/learn/learn-prompt.d.ts +58 -0
  187. package/dist/gene/learn/learn-prompt.js +254 -0
  188. package/dist/gene/learn/learner.d.ts +187 -0
  189. package/dist/gene/learn/learner.js +448 -0
  190. package/dist/gene/learn/ledger.d.ts +220 -0
  191. package/dist/gene/learn/ledger.js +394 -0
  192. package/dist/gene/learn/proposal-build.d.ts +83 -0
  193. package/dist/gene/learn/proposal-build.js +207 -0
  194. package/dist/gene/learn/proposal-guard.d.ts +43 -0
  195. package/dist/gene/learn/proposal-guard.js +37 -0
  196. package/dist/gene/learn/signals-port.d.ts +47 -0
  197. package/dist/gene/learn/signals-port.js +86 -0
  198. package/dist/gene/maintenance-paths.d.ts +7 -0
  199. package/dist/gene/maintenance-paths.js +20 -0
  200. package/dist/gene/maintenance-probation.d.ts +33 -0
  201. package/dist/gene/maintenance-probation.js +127 -0
  202. package/dist/gene/maintenance-proposals.d.ts +24 -0
  203. package/dist/gene/maintenance-proposals.js +68 -0
  204. package/dist/gene/maintenance-runner.d.ts +92 -0
  205. package/dist/gene/maintenance-runner.js +262 -0
  206. package/dist/gene/maintenance-tasks.d.ts +37 -0
  207. package/dist/gene/maintenance-tasks.js +95 -0
  208. package/dist/gene/manager-actions.d.ts +12 -0
  209. package/dist/gene/manager-actions.js +279 -0
  210. package/dist/gene/manager-approve.d.ts +29 -0
  211. package/dist/gene/manager-approve.js +84 -0
  212. package/dist/gene/manager-context.d.ts +90 -0
  213. package/dist/gene/manager-context.js +201 -0
  214. package/dist/gene/manager-detail.d.ts +17 -0
  215. package/dist/gene/manager-detail.js +313 -0
  216. package/dist/gene/manager-gc.d.ts +13 -0
  217. package/dist/gene/manager-gc.js +81 -0
  218. package/dist/gene/manager-library.d.ts +39 -0
  219. package/dist/gene/manager-library.js +90 -0
  220. package/dist/gene/manager-list.d.ts +27 -0
  221. package/dist/gene/manager-list.js +170 -0
  222. package/dist/gene/manager-queue.d.ts +16 -0
  223. package/dist/gene/manager-queue.js +124 -0
  224. package/dist/gene/manager-stats.d.ts +28 -0
  225. package/dist/gene/manager-stats.js +53 -0
  226. package/dist/gene/manager-view.d.ts +27 -0
  227. package/dist/gene/manager-view.js +124 -0
  228. package/dist/gene/manager.d.ts +56 -0
  229. package/dist/gene/manager.js +179 -0
  230. package/dist/gene/orphan-scopes.d.ts +37 -0
  231. package/dist/gene/orphan-scopes.js +150 -0
  232. package/dist/gene/paths.d.ts +73 -0
  233. package/dist/gene/paths.js +239 -0
  234. package/dist/gene/plan-content.d.ts +73 -0
  235. package/dist/gene/plan-content.js +522 -0
  236. package/dist/gene/plan-lifecycle.d.ts +29 -0
  237. package/dist/gene/plan-lifecycle.js +310 -0
  238. package/dist/gene/policy.d.ts +71 -0
  239. package/dist/gene/policy.js +313 -0
  240. package/dist/gene/project-learning.d.ts +25 -0
  241. package/dist/gene/project-learning.js +54 -0
  242. package/dist/gene/propagation.d.ts +48 -0
  243. package/dist/gene/propagation.js +45 -0
  244. package/dist/gene/queue-lock.d.ts +22 -0
  245. package/dist/gene/queue-lock.js +99 -0
  246. package/dist/gene/queue-record.d.ts +57 -0
  247. package/dist/gene/queue-record.js +145 -0
  248. package/dist/gene/queue.d.ts +235 -0
  249. package/dist/gene/queue.js +764 -0
  250. package/dist/gene/read.d.ts +61 -0
  251. package/dist/gene/read.js +252 -0
  252. package/dist/gene/runlog.d.ts +101 -0
  253. package/dist/gene/runlog.js +404 -0
  254. package/dist/gene/schema-lite.d.ts +24 -0
  255. package/dist/gene/schema-lite.js +159 -0
  256. package/dist/gene/scope-guard.d.ts +23 -0
  257. package/dist/gene/scope-guard.js +9 -0
  258. package/dist/gene/scope-lock.d.ts +48 -0
  259. package/dist/gene/scope-lock.js +222 -0
  260. package/dist/gene/scope-verify.d.ts +63 -0
  261. package/dist/gene/scope-verify.js +123 -0
  262. package/dist/gene/secrets.d.ts +43 -0
  263. package/dist/gene/secrets.js +161 -0
  264. package/dist/gene/service-context.d.ts +43 -0
  265. package/dist/gene/service-context.js +79 -0
  266. package/dist/gene/service-prepare.d.ts +25 -0
  267. package/dist/gene/service-prepare.js +219 -0
  268. package/dist/gene/service-types.d.ts +196 -0
  269. package/dist/gene/service-types.js +1 -0
  270. package/dist/gene/service-view.d.ts +41 -0
  271. package/dist/gene/service-view.js +69 -0
  272. package/dist/gene/service.d.ts +114 -0
  273. package/dist/gene/service.js +761 -0
  274. package/dist/gene/session-start.d.ts +36 -0
  275. package/dist/gene/session-start.js +212 -0
  276. package/dist/gene/store-port.d.ts +88 -0
  277. package/dist/gene/store-port.js +10 -0
  278. package/dist/gene/store-rows.d.ts +36 -0
  279. package/dist/gene/store-rows.js +72 -0
  280. package/dist/gene/store.d.ts +125 -0
  281. package/dist/gene/store.js +622 -0
  282. package/dist/gene/tombstones.d.ts +47 -0
  283. package/dist/gene/tombstones.js +61 -0
  284. package/dist/gene/tool-runner.d.ts +47 -0
  285. package/dist/gene/tool-runner.js +154 -0
  286. package/dist/gene/tool-screen.d.ts +41 -0
  287. package/dist/gene/tool-screen.js +227 -0
  288. package/dist/gene/tools.d.ts +112 -0
  289. package/dist/gene/tools.js +539 -0
  290. package/dist/gene/transfer.d.ts +85 -0
  291. package/dist/gene/transfer.js +433 -0
  292. package/dist/gene/ui-hints.d.ts +15 -0
  293. package/dist/gene/ui-hints.js +67 -0
  294. package/dist/gene/usage-fold-cursor.d.ts +24 -0
  295. package/dist/gene/usage-fold-cursor.js +115 -0
  296. package/dist/gene/usage-fold.d.ts +49 -0
  297. package/dist/gene/usage-fold.js +397 -0
  298. package/dist/gene/usage.d.ts +67 -0
  299. package/dist/gene/usage.js +231 -0
  300. package/dist/gene/version-service.d.ts +118 -0
  301. package/dist/gene/version-service.js +453 -0
  302. package/dist/gene/wiring-events.d.ts +43 -0
  303. package/dist/gene/wiring-events.js +113 -0
  304. package/dist/gene/wiring-models.d.ts +46 -0
  305. package/dist/gene/wiring-models.js +84 -0
  306. package/dist/gene/wiring.d.ts +200 -0
  307. package/dist/gene/wiring.js +764 -0
  308. package/dist/governance/prompts/orchestrator-block.js +3 -2
  309. package/dist/host/gene.d.ts +26 -0
  310. package/dist/host/gene.js +24 -0
  311. package/dist/host/index.d.ts +1 -0
  312. package/dist/host/index.js +1 -0
  313. package/dist/team/runtime.d.ts +5 -0
  314. package/dist/team/runtime.js +23 -0
  315. package/dist/team/subagent.d.ts +34 -0
  316. package/dist/team/subagent.js +39 -2
  317. package/dist/tools/index.d.ts +36 -2
  318. package/dist/tools/index.js +48 -7
  319. package/package.json +3 -3
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The author and maintain groups: `gene_create_candidate`, `gene_revise`, `gene_merge`,
3
+ * `gene_archive`, `gene_restore`, `gene_set_health` (gene-bank spec 9.5, 10.7, 16.2).
4
+ *
5
+ * ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`.
6
+ *
7
+ * AUTHORING NEVER PUBLISHES. `gene_create_candidate` and `gene_revise` call the version service
8
+ * as the curator actor, which writes a CANDIDATE: invisible to the foreground (I-6), served
9
+ * alongside the published version for a revise, and only promoted by `gene_publish` after the
10
+ * gate. The model supplies prose and payload; provenance, the evidence list and the skill
11
+ * dependency list are ours (`buildContent`), and an `oversight` class is dropped with a warning
12
+ * (11.3).
13
+ *
14
+ * A MERGE PUBLISHES AT ONCE (the service's merge writes the survivor as current), so it validates
15
+ * INLINE and asks the publish gate before it commits: the same rule as the candidate path, in one
16
+ * call. The members of the merge are excluded from the neighbour set, otherwise K5 would call the
17
+ * merged text a duplicate of the genes it replaces and refuse it.
18
+ *
19
+ * EVERY WRITE CARRIES A BASIS (I-10). A revise passes the version the model says it read,
20
+ * checked against the head BEFORE the commit; the service checks it again under the lock. The
21
+ * first moved basis is a "re-read once"; the second ends the task as `stale_basis`.
22
+ */
23
+ import type { AgentTool } from '@aragon-agent/core';
24
+ import { type ToolEnv } from './tool-support.js';
25
+ export declare function authorTools(env: ToolEnv): AgentTool[];
26
+ export declare function maintainTools(env: ToolEnv): AgentTool[];
@@ -0,0 +1,434 @@
1
+ import { GENE_TYPES } from '@aragon-agent/tui/model/gene/types';
2
+ import { contentHashOf } from '@aragon-agent/tui/model/gene/validate';
3
+ import { evaluatePublishGate } from './publish.js';
4
+ import { validationKey } from './task-context.js';
5
+ import { flagNeedsHuman, runCandidateValidation, summariseChecks } from './tools-verify.js';
6
+ import { CURATOR_ACTOR, TYPE_NAMES, applyFailureEffects, asObject, asString, asStringList, buildContent, defineCuratorTool, evidenceFor, failureResult, noteStale, reasonOf, receipt, refuse, switchGate, } from './tool-support.js';
7
+ /**
8
+ * The `applicability` block, WITH its keys declared (RC-2). It used to be an undescribed object,
9
+ * so the model wrote whatever it remembered (`platform`, `projects`, `surfaces`) and K3 - which
10
+ * reads `os` - saw "no environment at all" and refused the gene. Declaring the six keys here stops
11
+ * the bad shape at the model side; `normalizeApplicability` catches the rest at the write boundary.
12
+ */
13
+ const APPLICABILITY_PARAM = {
14
+ type: 'object',
15
+ description: 'Environment filters, and nothing else. os plus optional requiresTools, fileGlobs, projectKinds, ' +
16
+ 'envStamp, minWindowTokens. The scope already carries the project; do not repeat it here.',
17
+ properties: {
18
+ os: {
19
+ type: 'array',
20
+ description: 'win32, darwin or linux.',
21
+ items: { type: 'string', enum: ['win32', 'darwin', 'linux'] },
22
+ },
23
+ requiresTools: { type: 'array', description: 'Tool names that must exist.', items: { type: 'string' } },
24
+ fileGlobs: { type: 'array', description: 'Files the statement is about.', items: { type: 'string' } },
25
+ projectKinds: { type: 'array', description: 'Kinds of project.', items: { type: 'string' } },
26
+ envStamp: { type: 'object', description: 'Environment values that must match.' },
27
+ minWindowTokens: { type: 'number', description: 'Smallest context window it needs.' },
28
+ },
29
+ };
30
+ const CONTENT_PARAM = {
31
+ type: 'object',
32
+ description: 'name, purpose, trigger, body, tags, localeHints, applicability, roles, payload. English prose.',
33
+ properties: {
34
+ name: { type: 'string', description: 'kebab-case, 3-60 chars of a-z, 0-9 and "-".' },
35
+ purpose: { type: 'string', description: 'One English sentence: what it is for.' },
36
+ trigger: { type: 'string', description: 'One English sentence: when to load it.' },
37
+ body: { type: 'string', description: 'The English text of the gene.' },
38
+ tags: { type: 'array', items: { type: 'string' } },
39
+ // Declared because `buildContent` reads it: a field the boundary accepts but the schema
40
+ // hides is one the model has to guess at.
41
+ localeHints: {
42
+ type: 'array',
43
+ description: 'Chinese phrases a search may arrive in, when the body is English.',
44
+ items: { type: 'string' },
45
+ },
46
+ applicability: APPLICABILITY_PARAM,
47
+ roles: { type: 'array', items: { type: 'string', enum: ['main', 'subagent', 'reviewer'] } },
48
+ payload: { type: 'object', description: 'kind, claims, exec, requires or preference.' },
49
+ },
50
+ };
51
+ function candidateNote(outcome, warnings) {
52
+ const extra = warnings.length > 0 ? ` Warning: ${warnings.join('; ')}.` : '';
53
+ return `Candidate ${outcome.id} v${outcome.version ?? '?'} written.${extra}`
54
+ + ' Next: load verify, gene_validate.';
55
+ }
56
+ function noteCandidate(env, ref, built) {
57
+ const { ctx } = env;
58
+ ctx.wrote = true;
59
+ ctx.evidenceAttached.add(ref.id);
60
+ ctx.candidates.set(ref.id, {
61
+ id: ref.id,
62
+ scope: ctx.scope,
63
+ type: ref.type,
64
+ version: ref.version,
65
+ ...(built.requestedClass === undefined ? {} : { requestedClass: built.requestedClass }),
66
+ });
67
+ }
68
+ // ---------------------------------------------------------------------------
69
+ // create
70
+ // ---------------------------------------------------------------------------
71
+ async function createCandidate(env, params) {
72
+ const tool = 'gene_create_candidate';
73
+ const blocked = await switchGate(env, tool);
74
+ if (blocked !== null)
75
+ return blocked;
76
+ const type = asString(params.type);
77
+ const raw = asObject(params.content);
78
+ if (!GENE_TYPES.includes(type) || raw === undefined) {
79
+ return refuse(tool, 'GENE_ARGS_INVALID', 'type and content are required.');
80
+ }
81
+ const reason = reasonOf(env, tool, params.reason);
82
+ if (!reason.ok)
83
+ return reason.result;
84
+ const geneType = type;
85
+ const built = buildContent(env, geneType, raw);
86
+ const done = await env.deps.service.commit({
87
+ op: 'create',
88
+ type: geneType,
89
+ scope: env.ctx.scope,
90
+ content: built.content,
91
+ reason: reason.value,
92
+ class: 'standard',
93
+ proposalId: env.ctx.proposal.id,
94
+ evidence: evidenceFor(env.ctx, null),
95
+ }, CURATOR_ACTOR);
96
+ if (!done.ok) {
97
+ applyFailureEffects(env.ctx, done);
98
+ return failureResult(tool, done);
99
+ }
100
+ noteCandidate(env, { id: done.value.id, type: geneType, version: done.value.version ?? 1 }, built);
101
+ return receipt(candidateNote(done.value, built.warnings));
102
+ }
103
+ function createTool(env) {
104
+ return defineCuratorTool(env, {
105
+ name: 'gene_create_candidate',
106
+ label: 'Create candidate',
107
+ description: 'Write a NEW gene as a candidate. Nothing is published and agents cannot see it yet.\n' +
108
+ 'type is knowledge, tool or skill; content carries the English draft; reason says why ' +
109
+ 'it is worth keeping. It lands in the proposal scope.',
110
+ parameters: {
111
+ type: 'object',
112
+ properties: {
113
+ type: { type: 'string', enum: [...TYPE_NAMES] },
114
+ content: CONTENT_PARAM,
115
+ reason: { type: 'string' },
116
+ scope: { type: 'object', description: 'Ignored unless it equals the proposal scope.' },
117
+ },
118
+ required: ['type', 'content', 'reason'],
119
+ },
120
+ run: (params) => createCandidate(env, params),
121
+ });
122
+ }
123
+ // ---------------------------------------------------------------------------
124
+ // revise
125
+ // ---------------------------------------------------------------------------
126
+ async function servedContentOf(env, head) {
127
+ const n = head.currentVersion ?? head.candidateVersion;
128
+ return n === null ? null : env.deps.library.readVersion(head.scope, head.id, n);
129
+ }
130
+ async function reviseCandidate(env, params) {
131
+ const tool = 'gene_revise';
132
+ const blocked = await switchGate(env, tool);
133
+ if (blocked !== null)
134
+ return blocked;
135
+ const id = asString(params.id)?.trim() ?? '';
136
+ const raw = asObject(params.content);
137
+ const read = await env.deps.library.readHead(env.ctx.scope, id);
138
+ if (read === null || raw === undefined) {
139
+ return refuse(tool, 'GENE_NOT_FOUND', 'No such gene in this scope, or content is missing.');
140
+ }
141
+ const { head } = read;
142
+ if (params.expectedVersion !== head.latestVersion) {
143
+ noteStale(env.ctx);
144
+ return refuse(tool, 'GENE_STALE_BASIS', `The gene is at v${head.latestVersion}; re-read it once.`);
145
+ }
146
+ const reason = reasonOf(env, tool, params.reason);
147
+ if (!reason.ok)
148
+ return reason.result;
149
+ const built = buildContent(env, head.type, raw, (await servedContentOf(env, head))?.content);
150
+ const done = await env.deps.service.commit({
151
+ op: 'revise',
152
+ scope: env.ctx.scope,
153
+ id,
154
+ content: built.content,
155
+ reason: reason.value,
156
+ proposalId: env.ctx.proposal.id,
157
+ evidence: evidenceFor(env.ctx, id),
158
+ }, CURATOR_ACTOR, { version: head.latestVersion });
159
+ if (!done.ok) {
160
+ applyFailureEffects(env.ctx, done);
161
+ return failureResult(tool, done);
162
+ }
163
+ const version = done.value.version ?? head.latestVersion + 1;
164
+ noteCandidate(env, { id, type: head.type, version }, built);
165
+ return receipt(candidateNote(done.value, built.warnings));
166
+ }
167
+ function reviseTool(env) {
168
+ return defineCuratorTool(env, {
169
+ name: 'gene_revise',
170
+ label: 'Revise gene',
171
+ description: 'Write a revision of a gene as a CANDIDATE version; the published one keeps serving.\n' +
172
+ 'expectedVersion is the latest version you read. A moved version is refused: re-read ' +
173
+ 'once. content may omit fields that stay the same.',
174
+ parameters: {
175
+ type: 'object',
176
+ properties: {
177
+ id: { type: 'string' },
178
+ expectedVersion: { type: 'number' },
179
+ content: CONTENT_PARAM,
180
+ reason: { type: 'string' },
181
+ },
182
+ required: ['id', 'expectedVersion', 'content', 'reason'],
183
+ },
184
+ run: (params) => reviseCandidate(env, params),
185
+ });
186
+ }
187
+ // ---------------------------------------------------------------------------
188
+ // merge
189
+ // ---------------------------------------------------------------------------
190
+ async function loadMembers(env, ids) {
191
+ const heads = new Map();
192
+ for (const id of ids) {
193
+ const read = await env.deps.library.readHead(env.ctx.scope, id);
194
+ if (read === null)
195
+ return id;
196
+ heads.set(id, read.head);
197
+ }
198
+ return heads;
199
+ }
200
+ function protectedMember(heads, from) {
201
+ return from.some((id) => heads.get(id)?.pinned === true || heads.get(id)?.class === 'oversight');
202
+ }
203
+ function mergeRefusal(env, gate) {
204
+ if (gate.abandon !== undefined)
205
+ env.ctx.abandoned = gate.abandon;
206
+ if (gate.stale === true)
207
+ noteStale(env.ctx);
208
+ if (gate.needsHuman !== undefined)
209
+ env.ctx.needsHuman = gate.needsHuman;
210
+ return refuse('gene_merge', gate.code, gate.message);
211
+ }
212
+ async function commitMerge(env, merge) {
213
+ const { ctx, deps } = env;
214
+ const basisOf = (id) => ctx.basis.get(id) ?? merge.members.get(id).latestVersion;
215
+ const fromBasis = {};
216
+ for (const id of merge.from)
217
+ fromBasis[id] = basisOf(id);
218
+ const done = await deps.service.commit({
219
+ op: 'merge',
220
+ scope: ctx.scope,
221
+ into: merge.into,
222
+ from: merge.from,
223
+ content: merge.content,
224
+ reason: merge.reason,
225
+ proposalId: ctx.proposal.id,
226
+ fromBasis,
227
+ evidence: evidenceFor(ctx, merge.into),
228
+ }, CURATOR_ACTOR, { version: basisOf(merge.into) });
229
+ if (!done.ok) {
230
+ applyFailureEffects(ctx, done);
231
+ return failureResult('gene_merge', done);
232
+ }
233
+ ctx.wrote = true;
234
+ ctx.evidenceAttached.add(merge.into);
235
+ if (done.value.needsHuman === true) {
236
+ ctx.needsHuman = 'conflict_with_human';
237
+ return refuse('gene_merge', 'GENE_CONFLICT_WITH_HUMAN', 'A person owns the target. Finish needs_human.');
238
+ }
239
+ ctx.merged.push(merge.into);
240
+ return receipt(`Merged ${merge.from.length} gene(s) into ${merge.into}. Next: gene_finish merged.`);
241
+ }
242
+ /** Validate the merged text inline; null when it passes, otherwise the refusal to return. */
243
+ async function validateMerge(env, plan, hash) {
244
+ const intoHead = plan.members.get(plan.into);
245
+ const previous = await servedContentOf(env, intoHead);
246
+ const stored = await runCandidateValidation(env, {
247
+ type: intoHead.type,
248
+ scope: env.ctx.scope,
249
+ geneId: plan.into,
250
+ version: intoHead.latestVersion,
251
+ contentHash: hash,
252
+ content: plan.content,
253
+ head: intoHead,
254
+ ...(previous === null ? {} : { headContent: previous.content }),
255
+ excludeNeighbours: new Set(plan.from),
256
+ });
257
+ const { outcome } = stored;
258
+ if (outcome.verdict === 'pass')
259
+ return null;
260
+ if (outcome.verdict === 'needs_human' && outcome.needsHuman !== undefined) {
261
+ await flagNeedsHuman(env, intoHead, outcome.needsHuman);
262
+ }
263
+ return refuse('gene_merge', `GENE_VALIDATION_${outcome.verdict.toUpperCase()}`, summariseChecks(outcome));
264
+ }
265
+ async function mergeGenes(env, params) {
266
+ const { ctx, deps } = env;
267
+ const into = asString(params.into)?.trim() ?? '';
268
+ const from = asStringList(params.from).filter((id) => id !== into);
269
+ const raw = asObject(params.content);
270
+ if (into.length === 0 || from.length === 0 || raw === undefined) {
271
+ return refuse('gene_merge', 'GENE_ARGS_INVALID', 'into, from[] and content are required.');
272
+ }
273
+ const reason = reasonOf(env, 'gene_merge', params.reason);
274
+ if (!reason.ok)
275
+ return reason.result;
276
+ const members = await loadMembers(env, [into, ...from]);
277
+ if (typeof members === 'string') {
278
+ return refuse('gene_merge', 'GENE_NOT_FOUND', `${members} is not a live gene in this scope.`);
279
+ }
280
+ if (protectedMember(members, from)) {
281
+ ctx.needsHuman = 'conflict_with_human';
282
+ return refuse('gene_merge', 'GENE_PINNED', 'A pinned or oversight gene cannot be folded away. Finish needs_human.');
283
+ }
284
+ const intoHead = members.get(into);
285
+ const previous = await servedContentOf(env, intoHead);
286
+ const built = buildContent(env, intoHead.type, raw, previous?.content);
287
+ const plan = { into, from, members, content: built.content, reason: reason.value };
288
+ const hash = contentHashOf(built.content);
289
+ const invalid = await validateMerge(env, plan, hash);
290
+ if (invalid !== null)
291
+ return invalid;
292
+ const gate = await evaluatePublishGate({ switches: deps.switches, isForgotten: deps.isForgotten }, {
293
+ head: intoHead,
294
+ version: { n: intoHead.latestVersion, contentHash: hash, content: built.content },
295
+ stored: ctx.validations.get(validationKey(into, intoHead.latestVersion)),
296
+ expectedVersion: intoHead.latestVersion,
297
+ mode: 'direct',
298
+ proposalCreatedAt: ctx.proposal.createdAt,
299
+ originProjectKey: ctx.proposal.origin.projectKey ?? null,
300
+ originSource: ctx.proposal.origin.source,
301
+ });
302
+ return gate.ok ? commitMerge(env, plan) : mergeRefusal(env, gate);
303
+ }
304
+ function mergeTool(env) {
305
+ return defineCuratorTool(env, {
306
+ name: 'gene_merge',
307
+ label: 'Merge genes',
308
+ description: 'Fold duplicate genes into one survivor; the others are archived.\n' +
309
+ 'The survivor keeps its id and gets the merged content. The content is validated and the ' +
310
+ 'publish gate runs in this one call. Pinned genes cannot be folded away.',
311
+ parameters: {
312
+ type: 'object',
313
+ properties: {
314
+ into: { type: 'string' },
315
+ from: { type: 'array', items: { type: 'string' } },
316
+ content: CONTENT_PARAM,
317
+ reason: { type: 'string' },
318
+ },
319
+ required: ['into', 'from', 'content', 'reason'],
320
+ },
321
+ async run(params) {
322
+ const blocked = await switchGate(env, 'gene_merge');
323
+ return blocked ?? mergeGenes(env, params);
324
+ },
325
+ });
326
+ }
327
+ // ---------------------------------------------------------------------------
328
+ // archive / restore / health
329
+ // ---------------------------------------------------------------------------
330
+ function archiveTool(env) {
331
+ return defineCuratorTool(env, {
332
+ name: 'gene_archive',
333
+ label: 'Archive gene',
334
+ description: 'Move a gene out of use into the archive; it can be restored.\n' +
335
+ 'A pinned gene is refused (GENE_PINNED). reason is required, at most 200 characters.',
336
+ parameters: {
337
+ type: 'object',
338
+ properties: { id: { type: 'string' }, reason: { type: 'string' } },
339
+ required: ['id', 'reason'],
340
+ },
341
+ async run(params) {
342
+ const blocked = await switchGate(env, 'gene_archive');
343
+ if (blocked !== null)
344
+ return blocked;
345
+ const reason = reasonOf(env, 'gene_archive', params.reason);
346
+ if (!reason.ok)
347
+ return reason.result;
348
+ const id = asString(params.id)?.trim() ?? '';
349
+ const read = await env.deps.library.readHead(env.ctx.scope, id);
350
+ if (read === null)
351
+ return refuse('gene_archive', 'GENE_NOT_FOUND', 'No live gene with that id.');
352
+ const done = await env.deps.service.commit({ op: 'archive', scope: env.ctx.scope, id, reason: reason.value, proposalId: env.ctx.proposal.id }, CURATOR_ACTOR, { version: env.ctx.basis.get(id) ?? read.head.latestVersion });
353
+ if (!done.ok) {
354
+ applyFailureEffects(env.ctx, done);
355
+ return failureResult('gene_archive', done);
356
+ }
357
+ env.ctx.wrote = true;
358
+ return receipt(`Archived ${id}.`);
359
+ },
360
+ });
361
+ }
362
+ function restoreTool(env) {
363
+ return defineCuratorTool(env, {
364
+ name: 'gene_restore',
365
+ label: 'Restore gene',
366
+ description: 'Bring an archived gene back into use.\nIt re-enters the library under the normal size limit.',
367
+ parameters: {
368
+ type: 'object',
369
+ properties: { id: { type: 'string' }, reason: { type: 'string' } },
370
+ required: ['id', 'reason'],
371
+ },
372
+ async run(params) {
373
+ const blocked = await switchGate(env, 'gene_restore');
374
+ if (blocked !== null)
375
+ return blocked;
376
+ const id = asString(params.id)?.trim() ?? '';
377
+ const archived = await env.deps.library.readArchivedHead(env.ctx.scope, id);
378
+ if (archived === null)
379
+ return refuse('gene_restore', 'GENE_NOT_FOUND', 'No archived gene with that id.');
380
+ const done = await env.deps.service.commit({ op: 'restore', scope: env.ctx.scope, id }, CURATOR_ACTOR, { version: archived.head.latestVersion });
381
+ if (!done.ok) {
382
+ applyFailureEffects(env.ctx, done);
383
+ return failureResult('gene_restore', done);
384
+ }
385
+ env.ctx.wrote = true;
386
+ return receipt(`Restored ${id}.`);
387
+ },
388
+ });
389
+ }
390
+ const HEALTH_VALUES = ['ok', 'recheck', 'broken'];
391
+ function healthTool(env) {
392
+ return defineCuratorTool(env, {
393
+ name: 'gene_set_health',
394
+ label: 'Set gene health',
395
+ description: 'Mark a gene ok, recheck or broken. Only the mark changes; no content is touched.\n' +
396
+ 'A broken tool gene is refused by gene_run; other genes still show with a warning.',
397
+ parameters: {
398
+ type: 'object',
399
+ properties: {
400
+ id: { type: 'string' },
401
+ health: { type: 'string', enum: [...HEALTH_VALUES] },
402
+ reason: { type: 'string' },
403
+ },
404
+ required: ['id', 'health', 'reason'],
405
+ },
406
+ async run(params) {
407
+ const health = asString(params.health);
408
+ if (!HEALTH_VALUES.includes(health ?? '')) {
409
+ return refuse('gene_set_health', 'GENE_ARGS_INVALID', 'health must be ok, recheck or broken.');
410
+ }
411
+ const reason = reasonOf(env, 'gene_set_health', params.reason);
412
+ if (!reason.ok)
413
+ return reason.result;
414
+ const id = asString(params.id)?.trim() ?? '';
415
+ const done = await env.deps.service.commit({
416
+ op: 'setHealth',
417
+ scope: env.ctx.scope,
418
+ id,
419
+ health: health,
420
+ healthReason: reason.value.slice(0, 100),
421
+ }, CURATOR_ACTOR);
422
+ if (!done.ok)
423
+ return failureResult('gene_set_health', done);
424
+ env.ctx.wrote = true;
425
+ return receipt(`Marked ${id} ${health}.`);
426
+ },
427
+ });
428
+ }
429
+ export function authorTools(env) {
430
+ return [createTool(env), reviseTool(env)];
431
+ }
432
+ export function maintainTools(env) {
433
+ return [mergeTool(env), archiveTool(env), restoreTool(env), healthTool(env)];
434
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The curator's tool box (gene-bank spec 9.5, 16.2).
3
+ *
4
+ * ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`.
5
+ *
6
+ * `createCuratorToolkit` builds every curator tool around ONE task context and hands them to a
7
+ * `CuratorToolkit`, which decides which of them the model can see. The tools live in four files by
8
+ * what they do (`tools-read`, `tools-write`, `tools-verify`, `tools-release`); this file is only
9
+ * the assembly, so there is a single answer to "which tools exist" - the registry below - and the
10
+ * toolkit's group table is checked against it.
11
+ *
12
+ * ALL OF THEM CALL `assertCuratorContext` FIRST (via `defineCuratorTool`), and none of them holds
13
+ * any write code: the only writer is `GeneVersionService`. The foreground never receives this
14
+ * array; the tools exist only inside a curator agent's tool list.
15
+ */
16
+ import type { AgentTool } from '@aragon-agent/core';
17
+ import { CuratorToolkit } from './toolkit.js';
18
+ import type { ToolEnv } from './tool-support.js';
19
+ export { CURATOR_ACTOR } from './tool-support.js';
20
+ export type { CuratorToolDeps, ToolEnv } from './tool-support.js';
21
+ /** Every curator tool by name. */
22
+ export declare function createCuratorRegistry(env: ToolEnv): Map<string, AgentTool>;
23
+ export declare function createCuratorToolkit(env: ToolEnv): CuratorToolkit;
@@ -0,0 +1,21 @@
1
+ import { CuratorToolkit } from './toolkit.js';
2
+ import { readTool, searchTool } from './tools-read.js';
3
+ import { releaseTools } from './tools-release.js';
4
+ import { verifyTools } from './tools-verify.js';
5
+ import { authorTools, maintainTools } from './tools-write.js';
6
+ export { CURATOR_ACTOR } from './tool-support.js';
7
+ /** Every curator tool by name. */
8
+ export function createCuratorRegistry(env) {
9
+ const all = [
10
+ searchTool(env),
11
+ readTool(env),
12
+ ...authorTools(env),
13
+ ...maintainTools(env),
14
+ ...verifyTools(env),
15
+ ...releaseTools(env),
16
+ ];
17
+ return new Map(all.map((tool) => [tool.name, tool]));
18
+ }
19
+ export function createCuratorToolkit(env) {
20
+ return new CuratorToolkit(env, createCuratorRegistry(env));
21
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Checks shared by every gene type (gene-bank spec 10.7, 11.3, 11.5; I-12, I-16, TH-1, TH-5).
3
+ *
4
+ * ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`.
5
+ *
6
+ * WHAT LIVES HERE: the check builders (one vocabulary for pass / fail / skipped), the static
7
+ * content check (`validateGeneContent` with the secret screen wired in), the oversight demotion,
8
+ * the source-trust gate and the verdict fold. Per-type rules live in `knowledge.ts`, `tool.ts`
9
+ * and `skill.ts`.
10
+ *
11
+ * CHECK CODES. A FAILING check carries the stable code the UI localises (`KNOWLEDGE_*`,
12
+ * `TOOL_*`, `SKILL_*`, or a `GENE_*` error code for static failures). A PASSING check carries its
13
+ * short id (`K1`, `T4`, ...). A check that was NOT RUN carries `SKIPPED_<id>` with `ok: true` and
14
+ * the reason in `detail` - it is recorded, it is not a pass, and `isSkippedCheck` tells them apart.
15
+ *
16
+ * NO DETAIL TEXT MAY CARRY GENE BODY TEXT OR A SECRET (I-19): details name paths of FIELDS, ids of
17
+ * checks and counts, never what the field said.
18
+ */
19
+ import type { GeneClass, GeneContent, GeneEvidence, GeneNeedsHuman, GeneScope, GeneType, GeneValidation, GeneValidationCheck } from '@aragon-agent/tui/model/gene/types';
20
+ import type { GeneIssue } from '@aragon-agent/tui/model/gene/validate';
21
+ import type { CandidateVerdict } from './types.js';
22
+ export declare const SKIPPED_PREFIX = "SKIPPED_";
23
+ /** Failing codes that mean "a person must decide", not "this candidate is wrong". */
24
+ export declare const NEEDS_HUMAN_CODES: ReadonlySet<string>;
25
+ /** Failing codes that mean "do not create this; route it as a merge or a revise". */
26
+ export declare const CONVERT_CODES: ReadonlySet<string>;
27
+ export interface CheckExtras {
28
+ by?: GeneValidationCheck['by'];
29
+ model?: string;
30
+ durationMs?: number;
31
+ }
32
+ export declare function okCheck(id: string, at: number, detail?: string, extras?: CheckExtras): GeneValidationCheck;
33
+ export declare function failCheck(code: string, at: number, detail: string, extras?: CheckExtras): GeneValidationCheck;
34
+ /** A check that was not run. `ok: true` so it blocks nothing, but never mistaken for a pass. */
35
+ export declare function skippedCheck(id: string, at: number, reason: string): GeneValidationCheck;
36
+ export declare function isSkippedCheck(check: GeneValidationCheck): boolean;
37
+ /** Dotted field paths only - never the offending text (I-19). */
38
+ export declare function describeIssues(issues: readonly GeneIssue[]): string;
39
+ export interface StaticInput {
40
+ type: GeneType;
41
+ content: GeneContent;
42
+ scope: GeneScope;
43
+ /** The class the head has today; `oversight` here means an agent is editing a human-only gene. */
44
+ targetClass?: GeneClass;
45
+ requestedClass?: GeneClass;
46
+ knownSecrets?: readonly string[];
47
+ }
48
+ export interface StaticReport {
49
+ issues: GeneIssue[];
50
+ /** The class the gene will be stored with. */
51
+ storedClass: GeneClass;
52
+ /** The draft asked for `oversight`; it was demoted to `standard` (11.3, a warning not silence). */
53
+ demoted: boolean;
54
+ }
55
+ /**
56
+ * Run `validateGeneContent` as the AGENT actor. The one place that decides what an agent may do
57
+ * with `class: 'oversight'`: editing an existing oversight gene is refused (I-12), asking for a
58
+ * NEW one is demoted to `standard` with a warning.
59
+ */
60
+ export declare function runStaticChecks(input: StaticInput): StaticReport;
61
+ export declare function splitIssues(issues: readonly GeneIssue[], pick: (issue: GeneIssue) => boolean): {
62
+ picked: GeneIssue[];
63
+ rest: GeneIssue[];
64
+ };
65
+ /** The K1 check: every static issue not owned by a type-specific check. */
66
+ export declare function staticCheck(rest: readonly GeneIssue[], at: number): GeneValidationCheck;
67
+ /** Warning check recorded when an agent draft asked for the human-only `oversight` class. */
68
+ export declare function oversightChecks(report: StaticReport, targetClass: GeneClass | undefined, at: number): GeneValidationCheck[];
69
+ /**
70
+ * All evidence `untrusted` and nothing from the user or from a local measurement: the library
71
+ * is not allowed to learn from a web page alone (TH-1). No evidence at all is K2's problem.
72
+ */
73
+ export declare function untrustedOnly(evidence: readonly GeneEvidence[]): boolean;
74
+ export declare function trustCheck(evidence: readonly GeneEvidence[], at: number): {
75
+ check: GeneValidationCheck;
76
+ needsHuman?: GeneNeedsHuman['reason'];
77
+ };
78
+ export declare function validationOf(checks: readonly GeneValidationCheck[], at: number): GeneValidation;
79
+ /** fail > needs_human > convert > pass. */
80
+ export declare function verdictOf(checks: readonly GeneValidationCheck[]): CandidateVerdict;
81
+ export declare function addUsage(into: {
82
+ in: number;
83
+ out: number;
84
+ }, usage: {
85
+ in: number;
86
+ out: number;
87
+ } | undefined): void;