@aragon-agent/cli 0.6.54 → 0.6.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2912 -2838
- package/README.md +4226 -4042
- package/dist/agent/controller.d.ts +119 -0
- package/dist/agent/controller.js +365 -2
- package/dist/agent/governance-wiring.js +8 -1
- package/dist/agent/redteam-prompt.d.ts +47 -0
- package/dist/agent/redteam-prompt.js +161 -0
- package/dist/agent/redteam-wiring.d.ts +159 -0
- package/dist/agent/redteam-wiring.js +349 -0
- package/dist/agent/system-prompt.d.ts +39 -0
- package/dist/agent/system-prompt.js +18 -0
- package/dist/app/App.d.ts +10 -1
- package/dist/app/App.js +233 -24
- package/dist/app/use-redteam-mode.d.ts +56 -0
- package/dist/app/use-redteam-mode.js +121 -0
- package/dist/cli.js +82 -4
- package/dist/commands/builtins.js +43 -1
- package/dist/commands/catalog.js +5 -0
- package/dist/commands/index-build.js +2 -1
- package/dist/commands/redteam-command.d.ts +22 -0
- package/dist/commands/redteam-command.js +141 -0
- package/dist/commands/registry.d.ts +8 -0
- package/dist/config/app-paths.d.ts +10 -0
- package/dist/config/app-paths.js +12 -0
- package/dist/config/cli-commands.d.ts +29 -0
- package/dist/config/cli-commands.js +76 -1
- package/dist/config/env.d.ts +3 -1
- package/dist/config/env.js +23 -1
- package/dist/config/load.d.ts +22 -0
- package/dist/config/load.js +22 -2
- package/dist/config/redteam-launch.d.ts +77 -0
- package/dist/config/redteam-launch.js +58 -0
- package/dist/config/store.js +21 -1
- package/dist/config/ui-state.d.ts +44 -0
- package/dist/config/ui-state.js +38 -0
- package/dist/exec/bridge/server.d.ts +7 -0
- package/dist/exec/bridge/server.js +6 -2
- package/dist/exec/cli-commands.js +4 -0
- package/dist/exec/index.js +2 -0
- package/dist/exec/options.d.ts +11 -0
- package/dist/exec/options.js +21 -1
- package/dist/gene/block.d.ts +33 -0
- package/dist/gene/block.js +51 -0
- package/dist/gene/capacity.d.ts +74 -0
- package/dist/gene/capacity.js +169 -0
- package/dist/gene/catalog-reconcile.d.ts +13 -0
- package/dist/gene/catalog-reconcile.js +105 -0
- package/dist/gene/catalog-stats.d.ts +27 -0
- package/dist/gene/catalog-stats.js +89 -0
- package/dist/gene/catalog-sync.d.ts +82 -0
- package/dist/gene/catalog-sync.js +324 -0
- package/dist/gene/catalog.d.ts +160 -0
- package/dist/gene/catalog.js +433 -0
- package/dist/gene/cli-commands.d.ts +50 -0
- package/dist/gene/cli-commands.js +500 -0
- package/dist/gene/command-report.d.ts +40 -0
- package/dist/gene/command-report.js +246 -0
- package/dist/gene/command.d.ts +29 -0
- package/dist/gene/command.js +561 -0
- package/dist/gene/commit-apply-types.d.ts +13 -0
- package/dist/gene/commit-apply-types.js +1 -0
- package/dist/gene/commit-compound.d.ts +34 -0
- package/dist/gene/commit-compound.js +212 -0
- package/dist/gene/commit-counts.d.ts +41 -0
- package/dist/gene/commit-counts.js +70 -0
- package/dist/gene/commit-exec.d.ts +42 -0
- package/dist/gene/commit-exec.js +134 -0
- package/dist/gene/commit-head.d.ts +52 -0
- package/dist/gene/commit-head.js +97 -0
- package/dist/gene/commit-plan.d.ts +95 -0
- package/dist/gene/commit-plan.js +68 -0
- package/dist/gene/commit-prepare.d.ts +63 -0
- package/dist/gene/commit-prepare.js +159 -0
- package/dist/gene/commit-types.d.ts +234 -0
- package/dist/gene/commit-types.js +3 -0
- package/dist/gene/curator/agent.d.ts +137 -0
- package/dist/gene/curator/agent.js +203 -0
- package/dist/gene/curator/budget.d.ts +69 -0
- package/dist/gene/curator/budget.js +131 -0
- package/dist/gene/curator/conflicts.d.ts +54 -0
- package/dist/gene/curator/conflicts.js +143 -0
- package/dist/gene/curator/curator.d.ts +170 -0
- package/dist/gene/curator/curator.js +617 -0
- package/dist/gene/curator/deps.d.ts +34 -0
- package/dist/gene/curator/deps.js +48 -0
- package/dist/gene/curator/deterministic.d.ts +62 -0
- package/dist/gene/curator/deterministic.js +287 -0
- package/dist/gene/curator/executors.d.ts +36 -0
- package/dist/gene/curator/executors.js +379 -0
- package/dist/gene/curator/lanes.d.ts +52 -0
- package/dist/gene/curator/lanes.js +99 -0
- package/dist/gene/curator/lease.d.ts +76 -0
- package/dist/gene/curator/lease.js +171 -0
- package/dist/gene/curator/library.d.ts +36 -0
- package/dist/gene/curator/library.js +169 -0
- package/dist/gene/curator/lifecycle.d.ts +52 -0
- package/dist/gene/curator/lifecycle.js +109 -0
- package/dist/gene/curator/maintenance.d.ts +71 -0
- package/dist/gene/curator/maintenance.js +213 -0
- package/dist/gene/curator/probation.d.ts +51 -0
- package/dist/gene/curator/probation.js +71 -0
- package/dist/gene/curator/probe.d.ts +131 -0
- package/dist/gene/curator/probe.js +534 -0
- package/dist/gene/curator/prompt.d.ts +18 -0
- package/dist/gene/curator/prompt.js +128 -0
- package/dist/gene/curator/publish.d.ts +64 -0
- package/dist/gene/curator/publish.js +113 -0
- package/dist/gene/curator/recheck.d.ts +55 -0
- package/dist/gene/curator/recheck.js +103 -0
- package/dist/gene/curator/run-events.d.ts +63 -0
- package/dist/gene/curator/run-events.js +55 -0
- package/dist/gene/curator/similarity.d.ts +13 -0
- package/dist/gene/curator/similarity.js +46 -0
- package/dist/gene/curator/switches.d.ts +78 -0
- package/dist/gene/curator/switches.js +146 -0
- package/dist/gene/curator/task-context.d.ts +93 -0
- package/dist/gene/curator/task-context.js +63 -0
- package/dist/gene/curator/task-runner.d.ts +56 -0
- package/dist/gene/curator/task-runner.js +257 -0
- package/dist/gene/curator/tool-support.d.ts +112 -0
- package/dist/gene/curator/tool-support.js +197 -0
- package/dist/gene/curator/toolkit.d.ts +49 -0
- package/dist/gene/curator/toolkit.js +104 -0
- package/dist/gene/curator/tools-read.d.ts +4 -0
- package/dist/gene/curator/tools-read.js +177 -0
- package/dist/gene/curator/tools-release.d.ts +73 -0
- package/dist/gene/curator/tools-release.js +287 -0
- package/dist/gene/curator/tools-verify.d.ts +47 -0
- package/dist/gene/curator/tools-verify.js +202 -0
- package/dist/gene/curator/tools-write.d.ts +26 -0
- package/dist/gene/curator/tools-write.js +394 -0
- package/dist/gene/curator/tools.d.ts +23 -0
- package/dist/gene/curator/tools.js +21 -0
- package/dist/gene/curator/validate/common.d.ts +87 -0
- package/dist/gene/curator/validate/common.js +132 -0
- package/dist/gene/curator/validate/evidence-tokens.d.ts +36 -0
- package/dist/gene/curator/validate/evidence-tokens.js +139 -0
- package/dist/gene/curator/validate/index.d.ts +23 -0
- package/dist/gene/curator/validate/index.js +62 -0
- package/dist/gene/curator/validate/knowledge.d.ts +25 -0
- package/dist/gene/curator/validate/knowledge.js +216 -0
- package/dist/gene/curator/validate/live-check.d.ts +14 -0
- package/dist/gene/curator/validate/live-check.js +144 -0
- package/dist/gene/curator/validate/ports.d.ts +67 -0
- package/dist/gene/curator/validate/ports.js +1 -0
- package/dist/gene/curator/validate/prompts.d.ts +41 -0
- package/dist/gene/curator/validate/prompts.js +161 -0
- package/dist/gene/curator/validate/skill.d.ts +15 -0
- package/dist/gene/curator/validate/skill.js +251 -0
- package/dist/gene/curator/validate/tool.d.ts +6 -0
- package/dist/gene/curator/validate/tool.js +217 -0
- package/dist/gene/curator/validate/types.d.ts +90 -0
- package/dist/gene/curator/validate/types.js +1 -0
- package/dist/gene/curator/validator-ports.d.ts +38 -0
- package/dist/gene/curator/validator-ports.js +29 -0
- package/dist/gene/diag.d.ts +209 -0
- package/dist/gene/diag.js +549 -0
- package/dist/gene/env.d.ts +10 -0
- package/dist/gene/env.js +214 -0
- package/dist/gene/eval-recorder.d.ts +84 -0
- package/dist/gene/eval-recorder.js +222 -0
- package/dist/gene/explain-transport.d.ts +3 -0
- package/dist/gene/explain-transport.js +39 -0
- package/dist/gene/explain.d.ts +96 -0
- package/dist/gene/explain.js +293 -0
- package/dist/gene/fs.d.ts +39 -0
- package/dist/gene/fs.js +139 -0
- package/dist/gene/fsck.d.ts +68 -0
- package/dist/gene/fsck.js +134 -0
- package/dist/gene/gc-library-sweeps.d.ts +9 -0
- package/dist/gene/gc-library-sweeps.js +220 -0
- package/dist/gene/gc-rejected-set.d.ts +15 -0
- package/dist/gene/gc-rejected-set.js +63 -0
- package/dist/gene/gc-safe.d.ts +12 -0
- package/dist/gene/gc-safe.js +74 -0
- package/dist/gene/gc-scope-sweeps.d.ts +18 -0
- package/dist/gene/gc-scope-sweeps.js +297 -0
- package/dist/gene/gc-types.d.ts +55 -0
- package/dist/gene/gc-types.js +26 -0
- package/dist/gene/gc.d.ts +42 -0
- package/dist/gene/gc.js +129 -0
- package/dist/gene/gene-errors.d.ts +23 -0
- package/dist/gene/gene-errors.js +29 -0
- package/dist/gene/hints.d.ts +91 -0
- package/dist/gene/hints.js +394 -0
- package/dist/gene/hub.d.ts +149 -0
- package/dist/gene/hub.js +371 -0
- package/dist/gene/import-plan.d.ts +80 -0
- package/dist/gene/import-plan.js +294 -0
- package/dist/gene/import-proposal.d.ts +23 -0
- package/dist/gene/import-proposal.js +101 -0
- package/dist/gene/import-skill-port.d.ts +6 -0
- package/dist/gene/import-skill-port.js +53 -0
- package/dist/gene/import-sources.d.ts +48 -0
- package/dist/gene/import-sources.js +140 -0
- package/dist/gene/index-writer.d.ts +36 -0
- package/dist/gene/index-writer.js +101 -0
- package/dist/gene/learn/learn-call.d.ts +63 -0
- package/dist/gene/learn/learn-call.js +157 -0
- package/dist/gene/learn/learn-prompt.d.ts +51 -0
- package/dist/gene/learn/learn-prompt.js +245 -0
- package/dist/gene/learn/learner.d.ts +181 -0
- package/dist/gene/learn/learner.js +426 -0
- package/dist/gene/learn/ledger.d.ts +220 -0
- package/dist/gene/learn/ledger.js +394 -0
- package/dist/gene/learn/proposal-build.d.ts +83 -0
- package/dist/gene/learn/proposal-build.js +211 -0
- package/dist/gene/learn/proposal-guard.d.ts +43 -0
- package/dist/gene/learn/proposal-guard.js +37 -0
- package/dist/gene/learn/signals-port.d.ts +47 -0
- package/dist/gene/learn/signals-port.js +86 -0
- package/dist/gene/maintenance-paths.d.ts +7 -0
- package/dist/gene/maintenance-paths.js +20 -0
- package/dist/gene/maintenance-probation.d.ts +33 -0
- package/dist/gene/maintenance-probation.js +127 -0
- package/dist/gene/maintenance-proposals.d.ts +24 -0
- package/dist/gene/maintenance-proposals.js +68 -0
- package/dist/gene/maintenance-runner.d.ts +92 -0
- package/dist/gene/maintenance-runner.js +262 -0
- package/dist/gene/maintenance-tasks.d.ts +37 -0
- package/dist/gene/maintenance-tasks.js +95 -0
- package/dist/gene/manager-actions.d.ts +12 -0
- package/dist/gene/manager-actions.js +279 -0
- package/dist/gene/manager-approve.d.ts +29 -0
- package/dist/gene/manager-approve.js +84 -0
- package/dist/gene/manager-context.d.ts +90 -0
- package/dist/gene/manager-context.js +201 -0
- package/dist/gene/manager-detail.d.ts +17 -0
- package/dist/gene/manager-detail.js +313 -0
- package/dist/gene/manager-gc.d.ts +13 -0
- package/dist/gene/manager-gc.js +81 -0
- package/dist/gene/manager-library.d.ts +39 -0
- package/dist/gene/manager-library.js +90 -0
- package/dist/gene/manager-list.d.ts +27 -0
- package/dist/gene/manager-list.js +170 -0
- package/dist/gene/manager-queue.d.ts +16 -0
- package/dist/gene/manager-queue.js +124 -0
- package/dist/gene/manager-stats.d.ts +28 -0
- package/dist/gene/manager-stats.js +53 -0
- package/dist/gene/manager-view.d.ts +27 -0
- package/dist/gene/manager-view.js +124 -0
- package/dist/gene/manager.d.ts +56 -0
- package/dist/gene/manager.js +179 -0
- package/dist/gene/orphan-scopes.d.ts +37 -0
- package/dist/gene/orphan-scopes.js +150 -0
- package/dist/gene/paths.d.ts +73 -0
- package/dist/gene/paths.js +239 -0
- package/dist/gene/plan-content.d.ts +73 -0
- package/dist/gene/plan-content.js +522 -0
- package/dist/gene/plan-lifecycle.d.ts +29 -0
- package/dist/gene/plan-lifecycle.js +310 -0
- package/dist/gene/policy.d.ts +71 -0
- package/dist/gene/policy.js +313 -0
- package/dist/gene/project-learning.d.ts +25 -0
- package/dist/gene/project-learning.js +54 -0
- package/dist/gene/propagation.d.ts +48 -0
- package/dist/gene/propagation.js +45 -0
- package/dist/gene/queue-lock.d.ts +22 -0
- package/dist/gene/queue-lock.js +99 -0
- package/dist/gene/queue-record.d.ts +57 -0
- package/dist/gene/queue-record.js +145 -0
- package/dist/gene/queue.d.ts +235 -0
- package/dist/gene/queue.js +764 -0
- package/dist/gene/read.d.ts +61 -0
- package/dist/gene/read.js +252 -0
- package/dist/gene/runlog.d.ts +101 -0
- package/dist/gene/runlog.js +404 -0
- package/dist/gene/schema-lite.d.ts +24 -0
- package/dist/gene/schema-lite.js +159 -0
- package/dist/gene/scope-guard.d.ts +23 -0
- package/dist/gene/scope-guard.js +9 -0
- package/dist/gene/scope-lock.d.ts +48 -0
- package/dist/gene/scope-lock.js +222 -0
- package/dist/gene/scope-verify.d.ts +63 -0
- package/dist/gene/scope-verify.js +123 -0
- package/dist/gene/secrets.d.ts +43 -0
- package/dist/gene/secrets.js +161 -0
- package/dist/gene/service-context.d.ts +43 -0
- package/dist/gene/service-context.js +79 -0
- package/dist/gene/service-prepare.d.ts +25 -0
- package/dist/gene/service-prepare.js +219 -0
- package/dist/gene/service-types.d.ts +196 -0
- package/dist/gene/service-types.js +1 -0
- package/dist/gene/service-view.d.ts +41 -0
- package/dist/gene/service-view.js +69 -0
- package/dist/gene/service.d.ts +114 -0
- package/dist/gene/service.js +761 -0
- package/dist/gene/session-start.d.ts +36 -0
- package/dist/gene/session-start.js +212 -0
- package/dist/gene/store-port.d.ts +88 -0
- package/dist/gene/store-port.js +10 -0
- package/dist/gene/store-rows.d.ts +36 -0
- package/dist/gene/store-rows.js +72 -0
- package/dist/gene/store.d.ts +125 -0
- package/dist/gene/store.js +622 -0
- package/dist/gene/tombstones.d.ts +47 -0
- package/dist/gene/tombstones.js +61 -0
- package/dist/gene/tool-runner.d.ts +47 -0
- package/dist/gene/tool-runner.js +154 -0
- package/dist/gene/tool-screen.d.ts +41 -0
- package/dist/gene/tool-screen.js +227 -0
- package/dist/gene/tools.d.ts +112 -0
- package/dist/gene/tools.js +539 -0
- package/dist/gene/transfer.d.ts +85 -0
- package/dist/gene/transfer.js +433 -0
- package/dist/gene/ui-hints.d.ts +15 -0
- package/dist/gene/ui-hints.js +67 -0
- package/dist/gene/usage-fold-cursor.d.ts +24 -0
- package/dist/gene/usage-fold-cursor.js +115 -0
- package/dist/gene/usage-fold.d.ts +49 -0
- package/dist/gene/usage-fold.js +397 -0
- package/dist/gene/usage.d.ts +67 -0
- package/dist/gene/usage.js +231 -0
- package/dist/gene/version-service.d.ts +118 -0
- package/dist/gene/version-service.js +453 -0
- package/dist/gene/wiring-events.d.ts +43 -0
- package/dist/gene/wiring-events.js +113 -0
- package/dist/gene/wiring-models.d.ts +46 -0
- package/dist/gene/wiring-models.js +81 -0
- package/dist/gene/wiring.d.ts +200 -0
- package/dist/gene/wiring.js +764 -0
- package/dist/governance/prompts/orchestrator-block.js +3 -2
- package/dist/host/controller-factory.d.ts +8 -0
- package/dist/host/controller-factory.js +7 -0
- package/dist/host/gene.d.ts +26 -0
- package/dist/host/gene.js +24 -0
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +1 -0
- package/dist/session/checkpoint.d.ts +15 -0
- package/dist/session/checkpoint.js +18 -0
- package/dist/session/persist.d.ts +21 -0
- package/dist/session/persist.js +10 -0
- package/dist/session/startup-session.d.ts +11 -2
- package/dist/session/startup-session.js +12 -2
- package/dist/session/validate-session.js +31 -0
- package/dist/team/runtime.d.ts +16 -0
- package/dist/team/runtime.js +29 -0
- package/dist/team/subagent.d.ts +55 -0
- package/dist/team/subagent.js +46 -2
- package/dist/tools/index.d.ts +60 -2
- package/dist/tools/index.js +68 -10
- package/package.json +3 -3
- package/skills/project-indexer/SKILL.md +275 -147
- package/skills/project-indexer/templates/artifact-hygiene-template.md +14 -0
- package/skills/project-indexer/templates/config-template.md +12 -0
- package/skills/project-indexer/templates/index-template.md +4 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The maintenance plan (gene-bank spec 10.10, 7.2, 7.3; I-5, I-7, G-07).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`. PURE: rows, statistics and
|
|
5
|
+
* the clock arrive as arguments, the plan leaves as data. Turning a suggestion into a proposal,
|
|
6
|
+
* and a proposal into a commit, is the queue's and the publish path's business.
|
|
7
|
+
*
|
|
8
|
+
* WHAT A PLAN CONTAINS
|
|
9
|
+
* merges duplicate detection: published genes of the same type AND scope whose vectors have
|
|
10
|
+
* cosine >= 0.92. Each cluster names a survivor and the genes folded into it. Pinned
|
|
11
|
+
* and person-owned genes are never the ones folded away, and `oversight` genes are
|
|
12
|
+
* never touched.
|
|
13
|
+
* archives low-value archive SUGGESTIONS: idle for 180 days, retention value `R` low, not
|
|
14
|
+
* pinned, standard class, and no published dependents. A suggestion, not an action.
|
|
15
|
+
* promotions project-scope genes adopted effectively in >= 3 distinct sessions; a person
|
|
16
|
+
* decides (I-11), the curator only suggests.
|
|
17
|
+
* capacity per type, whether the library crossed 90% of its cap (7.2).
|
|
18
|
+
*
|
|
19
|
+
* BOUNDED WORK. Duplicate detection is pairwise; it stops at `maxComparisons` and says so
|
|
20
|
+
* (`truncated`) instead of running for as long as a large library needs. A gene without a vector
|
|
21
|
+
* is never reported as a duplicate: "unknown" is not "identical".
|
|
22
|
+
*
|
|
23
|
+
* `expiredTaskScopes` and `findOrphans` are the two sweep lists of 10.10 (5): they only NAME what
|
|
24
|
+
* may be removed; the garbage collector decides and deletes, inside `genes/`.
|
|
25
|
+
*/
|
|
26
|
+
import { buildReverseIndex } from '@aragon-agent/tui/model/gene/deps';
|
|
27
|
+
import { GENE_CURATION, GENE_LIMITS, GENE_SCORE } from '@aragon-agent/tui/model/gene/limits';
|
|
28
|
+
import { effectiveness } from '@aragon-agent/tui/model/gene/score';
|
|
29
|
+
import { GENE_TYPES } from '@aragon-agent/tui/model/gene/types';
|
|
30
|
+
import { isArchivable, rankArchiveCandidates } from './lifecycle.js';
|
|
31
|
+
import { cosinePrepared, peersOf, prepareVectors } from './similarity.js';
|
|
32
|
+
const DAY_MS = 86_400_000;
|
|
33
|
+
const DEFAULT_MAX_COMPARISONS = 1_500_000;
|
|
34
|
+
/** `R` at or below which an idle gene is worth suggesting for archive (unique genes score higher). */
|
|
35
|
+
export const ARCHIVE_R_MAX = 0.3;
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Duplicates
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
class UnionFind {
|
|
40
|
+
parent = new Map();
|
|
41
|
+
find(id) {
|
|
42
|
+
let root = id;
|
|
43
|
+
while ((this.parent.get(root) ?? root) !== root)
|
|
44
|
+
root = this.parent.get(root);
|
|
45
|
+
this.parent.set(id, root);
|
|
46
|
+
return root;
|
|
47
|
+
}
|
|
48
|
+
union(a, b) {
|
|
49
|
+
const ra = this.find(a);
|
|
50
|
+
const rb = this.find(b);
|
|
51
|
+
if (ra !== rb)
|
|
52
|
+
this.parent.set(ra, rb);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const TRUST_RANK = {
|
|
56
|
+
human: 3,
|
|
57
|
+
agent_validated: 2,
|
|
58
|
+
untrusted_origin: 1,
|
|
59
|
+
agent_unvalidated: 0,
|
|
60
|
+
};
|
|
61
|
+
/** Who survives a merge: pinned, then person-owned, then the better track record, then the id. */
|
|
62
|
+
function survivorOrder(stats) {
|
|
63
|
+
const score = (row) => {
|
|
64
|
+
const s = stats.get(row.id);
|
|
65
|
+
return [row.pinned ? 1 : 0, TRUST_RANK[row.trust], s ? effectiveness(s) : 0.5, s?.helped ?? 0];
|
|
66
|
+
};
|
|
67
|
+
return (a, b) => {
|
|
68
|
+
const sa = score(a);
|
|
69
|
+
const sb = score(b);
|
|
70
|
+
for (let i = 0; i < sa.length; i += 1)
|
|
71
|
+
if (sa[i] !== sb[i])
|
|
72
|
+
return sb[i] - sa[i];
|
|
73
|
+
return a.id.localeCompare(b.id);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** May this gene be folded away by the curator? Never pinned, never person-owned, never oversight. */
|
|
77
|
+
function isFoldable(row) {
|
|
78
|
+
return !row.pinned && row.trust !== 'human' && row.class === 'standard';
|
|
79
|
+
}
|
|
80
|
+
function scanGroup(group, budget) {
|
|
81
|
+
const uf = new UnionFind();
|
|
82
|
+
let comparisons = 0;
|
|
83
|
+
let exhausted = false;
|
|
84
|
+
for (let i = 0; i < group.length && !exhausted; i += 1) {
|
|
85
|
+
for (let j = i + 1; j < group.length; j += 1) {
|
|
86
|
+
if (comparisons >= budget) {
|
|
87
|
+
exhausted = true;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
comparisons += 1;
|
|
91
|
+
if (cosinePrepared(group[i], group[j]) >= GENE_SCORE.duplicateCosine)
|
|
92
|
+
uf.union(group[i].row.id, group[j].row.id);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const byRoot = new Map();
|
|
96
|
+
for (const member of group) {
|
|
97
|
+
const root = uf.find(member.row.id);
|
|
98
|
+
byRoot.set(root, [...(byRoot.get(root) ?? []), member]);
|
|
99
|
+
}
|
|
100
|
+
return { clusters: [...byRoot.values()].filter((c) => c.length > 1), comparisons, exhausted };
|
|
101
|
+
}
|
|
102
|
+
function suggestionFrom(cluster, stats) {
|
|
103
|
+
const ordered = [...cluster].sort((a, b) => survivorOrder(stats)(a.row, b.row));
|
|
104
|
+
const survivor = ordered[0];
|
|
105
|
+
const folded = ordered
|
|
106
|
+
.slice(1)
|
|
107
|
+
.filter((m) => isFoldable(m.row) && cosinePrepared(survivor, m) >= GENE_SCORE.duplicateCosine);
|
|
108
|
+
if (folded.length === 0 || survivor.row.class !== 'standard')
|
|
109
|
+
return null;
|
|
110
|
+
return {
|
|
111
|
+
type: survivor.row.type,
|
|
112
|
+
scope: survivor.row.scope,
|
|
113
|
+
survivor: survivor.row.id,
|
|
114
|
+
from: folded.map((m) => m.row.id),
|
|
115
|
+
cosine: Math.min(...folded.map((m) => cosinePrepared(survivor, m))),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export function findDuplicates(rows, stats, maxComparisons = DEFAULT_MAX_COMPARISONS) {
|
|
119
|
+
const published = rows.filter((r) => r.status === 'published' && r.class === 'standard');
|
|
120
|
+
const seen = new Set();
|
|
121
|
+
const merges = [];
|
|
122
|
+
let left = maxComparisons;
|
|
123
|
+
let truncated = false;
|
|
124
|
+
for (const row of published) {
|
|
125
|
+
const key = `${row.type}|${row.scope.kind}|${row.scope.key ?? ''}`;
|
|
126
|
+
if (seen.has(key))
|
|
127
|
+
continue;
|
|
128
|
+
seen.add(key);
|
|
129
|
+
const scan = scanGroup(prepareVectors(peersOf(published, row)), left);
|
|
130
|
+
left -= scan.comparisons;
|
|
131
|
+
truncated ||= scan.exhausted;
|
|
132
|
+
for (const cluster of scan.clusters) {
|
|
133
|
+
const suggestion = suggestionFrom(cluster, stats);
|
|
134
|
+
if (suggestion !== null)
|
|
135
|
+
merges.push(suggestion);
|
|
136
|
+
}
|
|
137
|
+
if (left <= 0) {
|
|
138
|
+
truncated = true;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { merges, truncated };
|
|
143
|
+
}
|
|
144
|
+
// ---------------------------------------------------------------------------
|
|
145
|
+
// Archive, promotion, capacity
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
function dependentCounts(published) {
|
|
148
|
+
const reverse = buildReverseIndex(published);
|
|
149
|
+
return new Map([...reverse.entries()].map(([id, list]) => [id, list.length]));
|
|
150
|
+
}
|
|
151
|
+
function idleDaysOf(row, stats, now) {
|
|
152
|
+
const anchor = stats.get(row.id)?.lastAdoptedAt ?? row.updatedAt;
|
|
153
|
+
return Math.max(0, now - anchor) / DAY_MS;
|
|
154
|
+
}
|
|
155
|
+
export function suggestArchives(rows, stats, now) {
|
|
156
|
+
const published = rows.filter((r) => r.status === 'published');
|
|
157
|
+
const dependents = dependentCounts(published);
|
|
158
|
+
const idle = published.filter((r) => isArchivable(r, dependents) && idleDaysOf(r, stats, now) >= GENE_CURATION.archiveIdleDays);
|
|
159
|
+
const ranked = rankArchiveCandidates({
|
|
160
|
+
rows: idle,
|
|
161
|
+
peers: published,
|
|
162
|
+
stats,
|
|
163
|
+
dependents,
|
|
164
|
+
now,
|
|
165
|
+
count: idle.length,
|
|
166
|
+
});
|
|
167
|
+
return ranked
|
|
168
|
+
.filter((c) => c.r <= ARCHIVE_R_MAX)
|
|
169
|
+
.map((c) => ({ id: c.id, r: c.r, idleDays: Math.floor(idleDaysOf(idle.find((r) => r.id === c.id), stats, now)) }));
|
|
170
|
+
}
|
|
171
|
+
export function suggestPromotions(rows, sessions) {
|
|
172
|
+
if (sessions === undefined)
|
|
173
|
+
return [];
|
|
174
|
+
return rows
|
|
175
|
+
.filter((r) => r.status === 'published' && r.scope.kind === 'project' && r.class === 'standard')
|
|
176
|
+
.map((r) => ({ id: r.id, sessions: sessions.get(r.id) ?? 0, from: r.scope, to: 'user' }))
|
|
177
|
+
.filter((p) => p.sessions >= GENE_CURATION.promoteSessionsMin);
|
|
178
|
+
}
|
|
179
|
+
export function capacityWarnings(rows, capPerType) {
|
|
180
|
+
const out = [];
|
|
181
|
+
for (const type of GENE_TYPES) {
|
|
182
|
+
const count = rows.filter((r) => r.status === 'published' && r.type === type).length;
|
|
183
|
+
const share = capPerType > 0 ? count / capPerType : 0;
|
|
184
|
+
if (share >= GENE_CURATION.capWarnShare)
|
|
185
|
+
out.push({ type, count, cap: capPerType, share, over: Math.max(0, count - capPerType) });
|
|
186
|
+
}
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
export function planMaintenance(input) {
|
|
190
|
+
const duplicates = findDuplicates(input.rows, input.stats, input.maxComparisons);
|
|
191
|
+
return {
|
|
192
|
+
merges: duplicates.merges,
|
|
193
|
+
archives: suggestArchives(input.rows, input.stats, input.now),
|
|
194
|
+
promotions: suggestPromotions(input.rows, input.effectiveSessions),
|
|
195
|
+
capacity: capacityWarnings(input.rows, input.capPerType),
|
|
196
|
+
truncated: duplicates.truncated,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
// ---------------------------------------------------------------------------
|
|
200
|
+
// Sweep lists (10.10 item 5)
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
/** Task scopes whose last write is older than the retention window. */
|
|
203
|
+
export function expiredTaskScopes(scopes, now) {
|
|
204
|
+
const ttl = GENE_LIMITS.taskScopeTtlDays * DAY_MS;
|
|
205
|
+
return scopes.filter((s) => s.scope.kind === 'task' && now - s.lastWriteAt > ttl).map((s) => s.scope);
|
|
206
|
+
}
|
|
207
|
+
/** Version and evidence directories whose gene no longer has a head: safe for the GC to remove. */
|
|
208
|
+
export function findOrphans(listing) {
|
|
209
|
+
return {
|
|
210
|
+
versions: listing.versionDirs.filter((id) => !listing.headIds.has(id)),
|
|
211
|
+
evidence: listing.evidenceDirs.filter((id) => !listing.headIds.has(id)),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Probation: the field test of a freshly published gene (gene-bank spec 10.7.3 S6, 7.4; I-7, I-9).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`.
|
|
5
|
+
*
|
|
6
|
+
* A gene the curator publishes starts on probation (the version service stamps it). While it lasts,
|
|
7
|
+
* outcomes weigh double; if the gene hurts twice and has never helped (`harmed >= 2 && helped == 0`)
|
|
8
|
+
* the curator takes it back WITHOUT ASKING A MODEL: roll back to the previous published version, or
|
|
9
|
+
* revoke it when there is none. That is the only automatic reversal of a published gene, and it is
|
|
10
|
+
* data-driven: the counters come from real attributed outcomes (`unknown` is never counted, I-9).
|
|
11
|
+
*
|
|
12
|
+
* `sweepProbation` is the lease holder's periodic pass over every published gene still carrying a
|
|
13
|
+
* probation record. `decideProbation` is the same rule applied to one gene (the `invalidate` path
|
|
14
|
+
* uses it so a harm report acts at once instead of waiting for the next sweep). Graduation is not
|
|
15
|
+
* a write: `isOnProbation` is computed from the record's time and adoption count, so a gene that
|
|
16
|
+
* has served its probation simply stops being weighted double.
|
|
17
|
+
*
|
|
18
|
+
* A PINNED GENE IS NEVER ROLLED BACK OR REVOKED BY THIS (I-7): the version service refuses
|
|
19
|
+
* (`GENE_PINNED`) and the sweep reports it as `skippedPinned`; a person decides.
|
|
20
|
+
*/
|
|
21
|
+
import { type ProbationDecision } from './lifecycle.js';
|
|
22
|
+
import type { CommitOutcome } from '../commit-types.js';
|
|
23
|
+
import type { GeneHead, GeneIndexRow, GeneResult, GeneScope } from '@aragon-agent/tui/model/gene/types';
|
|
24
|
+
import { type ReleaseEnv } from './tools-release.js';
|
|
25
|
+
export type RollbackDecision = Extract<ProbationDecision, {
|
|
26
|
+
action: 'rollback';
|
|
27
|
+
}>;
|
|
28
|
+
/** The rule for one gene, or `continue` when it has no probation record. */
|
|
29
|
+
export declare function decideProbation(env: Pick<ReleaseEnv, 'library'>, head: GeneHead, now: number): Promise<ProbationDecision>;
|
|
30
|
+
/** Carry out a rollback decision: back to the previous version, or revoke when there is none. */
|
|
31
|
+
export declare function applyRollback(env: ReleaseEnv, head: GeneHead, decision: RollbackDecision): Promise<GeneResult<CommitOutcome>>;
|
|
32
|
+
export interface SweepReport {
|
|
33
|
+
checked: number;
|
|
34
|
+
rolledBack: string[];
|
|
35
|
+
revoked: string[];
|
|
36
|
+
graduated: number;
|
|
37
|
+
skippedPinned: string[];
|
|
38
|
+
/** A person owns the gene, so the service parked the rollback for them. */
|
|
39
|
+
needsHuman: string[];
|
|
40
|
+
failed: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface SweepDeps {
|
|
43
|
+
service: ReleaseEnv['service'];
|
|
44
|
+
library: ReleaseEnv['library'] & {
|
|
45
|
+
scopes(): Promise<GeneScope[]>;
|
|
46
|
+
rowsOf(scope: GeneScope): Promise<GeneIndexRow[]>;
|
|
47
|
+
};
|
|
48
|
+
now(): number;
|
|
49
|
+
}
|
|
50
|
+
/** Check every published gene on probation. Never throws; each gene is independent. */
|
|
51
|
+
export declare function sweepProbation(deps: SweepDeps): Promise<SweepReport>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Probation: the field test of a freshly published gene (gene-bank spec 10.7.3 S6, 7.4; I-7, I-9).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`.
|
|
5
|
+
*
|
|
6
|
+
* A gene the curator publishes starts on probation (the version service stamps it). While it lasts,
|
|
7
|
+
* outcomes weigh double; if the gene hurts twice and has never helped (`harmed >= 2 && helped == 0`)
|
|
8
|
+
* the curator takes it back WITHOUT ASKING A MODEL: roll back to the previous published version, or
|
|
9
|
+
* revoke it when there is none. That is the only automatic reversal of a published gene, and it is
|
|
10
|
+
* data-driven: the counters come from real attributed outcomes (`unknown` is never counted, I-9).
|
|
11
|
+
*
|
|
12
|
+
* `sweepProbation` is the lease holder's periodic pass over every published gene still carrying a
|
|
13
|
+
* probation record. `decideProbation` is the same rule applied to one gene (the `invalidate` path
|
|
14
|
+
* uses it so a harm report acts at once instead of waiting for the next sweep). Graduation is not
|
|
15
|
+
* a write: `isOnProbation` is computed from the record's time and adoption count, so a gene that
|
|
16
|
+
* has served its probation simply stops being weighted double.
|
|
17
|
+
*
|
|
18
|
+
* A PINNED GENE IS NEVER ROLLED BACK OR REVOKED BY THIS (I-7): the version service refuses
|
|
19
|
+
* (`GENE_PINNED`) and the sweep reports it as `skippedPinned`; a person decides.
|
|
20
|
+
*/
|
|
21
|
+
import { evaluateProbation } from './lifecycle.js';
|
|
22
|
+
import { previousPublishedVersion, revokeGene, rollbackGene, } from './tools-release.js';
|
|
23
|
+
/** The rule for one gene, or `continue` when it has no probation record. */
|
|
24
|
+
export async function decideProbation(env, head, now) {
|
|
25
|
+
if (head.probation === undefined || head.status !== 'published')
|
|
26
|
+
return { action: 'continue' };
|
|
27
|
+
const previous = await previousPublishedVersion(env.library, head);
|
|
28
|
+
return evaluateProbation(head.probation, { now, hasPreviousPublished: previous !== null });
|
|
29
|
+
}
|
|
30
|
+
/** Carry out a rollback decision: back to the previous version, or revoke when there is none. */
|
|
31
|
+
export async function applyRollback(env, head, decision) {
|
|
32
|
+
if (decision.to === 'previous')
|
|
33
|
+
return rollbackGene(env, { id: head.id });
|
|
34
|
+
return revokeGene(env, {
|
|
35
|
+
id: head.id,
|
|
36
|
+
reason: 'Revoked: it harmed twice during probation and never helped.',
|
|
37
|
+
harmful: true,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** Check every published gene on probation. Never throws; each gene is independent. */
|
|
41
|
+
export async function sweepProbation(deps) {
|
|
42
|
+
const report = { checked: 0, rolledBack: [], revoked: [], graduated: 0, skippedPinned: [], needsHuman: [], failed: [] };
|
|
43
|
+
for (const scope of await deps.library.scopes().catch(() => [])) {
|
|
44
|
+
const rows = (await deps.library.rowsOf(scope).catch(() => [])).filter((r) => r.status === 'published' && r.probation === true);
|
|
45
|
+
for (const row of rows)
|
|
46
|
+
await sweepOne(deps, scope, row.id, report);
|
|
47
|
+
}
|
|
48
|
+
return report;
|
|
49
|
+
}
|
|
50
|
+
async function sweepOne(deps, scope, id, report) {
|
|
51
|
+
const read = await deps.library.readHead(scope, id).catch(() => null);
|
|
52
|
+
if (read === null)
|
|
53
|
+
return;
|
|
54
|
+
report.checked += 1;
|
|
55
|
+
const decision = await decideProbation(deps, read.head, deps.now());
|
|
56
|
+
if (decision.action === 'graduate')
|
|
57
|
+
report.graduated += 1;
|
|
58
|
+
if (decision.action !== 'rollback')
|
|
59
|
+
return;
|
|
60
|
+
if (read.head.pinned) {
|
|
61
|
+
report.skippedPinned.push(id);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const done = await applyRollback({ service: deps.service, library: deps.library, scope }, read.head, decision);
|
|
65
|
+
if (!done.ok)
|
|
66
|
+
report.failed.push(id);
|
|
67
|
+
else if (done.value.needsHuman === true)
|
|
68
|
+
report.needsHuman.push(id);
|
|
69
|
+
else
|
|
70
|
+
(decision.to === 'previous' ? report.rolledBack : report.revoked).push(id);
|
|
71
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { GeneConfig } from '@aragon-agent/tui/model/config/schema';
|
|
2
|
+
import type { GeneContent, GeneHead, GeneNeedsHuman, GeneToolRisk, GeneValidation, GeneValidationCheck, GeneVersion, ToolExec } from '@aragon-agent/tui/model/gene/types';
|
|
3
|
+
import type { ToolScreen } from '../tool-screen.js';
|
|
4
|
+
export declare const PROBE_LIMITS: {
|
|
5
|
+
readonly outputBytes: number;
|
|
6
|
+
readonly timeoutCapMs: 20000;
|
|
7
|
+
readonly totalMs: 90000;
|
|
8
|
+
readonly fixtureFiles: 8;
|
|
9
|
+
readonly fixtureBytes: number;
|
|
10
|
+
};
|
|
11
|
+
/** The only environment names a probe sees. HOME-like values point into the sandbox. */
|
|
12
|
+
export declare const PROBE_ENV_ALLOW: readonly string[];
|
|
13
|
+
interface StreamLike {
|
|
14
|
+
on(event: 'data', listener: (chunk: Buffer | string) => void): unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface ChildLike {
|
|
17
|
+
stdout: StreamLike | null;
|
|
18
|
+
stderr: StreamLike | null;
|
|
19
|
+
on(event: 'close', listener: (code: number | null, signal: string | null) => void): unknown;
|
|
20
|
+
on(event: 'error', listener: (error: Error) => void): unknown;
|
|
21
|
+
kill(signal?: NodeJS.Signals): boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface SpawnLikeOptions {
|
|
24
|
+
shell: false;
|
|
25
|
+
cwd: string;
|
|
26
|
+
env: Record<string, string>;
|
|
27
|
+
timeout: number;
|
|
28
|
+
windowsHide: true;
|
|
29
|
+
stdio: ['ignore', 'pipe', 'pipe'];
|
|
30
|
+
killSignal: 'SIGKILL';
|
|
31
|
+
}
|
|
32
|
+
export type SpawnLike = (command: string, args: readonly string[], options: SpawnLikeOptions) => ChildLike;
|
|
33
|
+
export type ScreenFn = (exec: ToolExec, scriptText?: string) => ToolScreen;
|
|
34
|
+
export interface ProbeDeps {
|
|
35
|
+
/** Test seam. Production never passes it. */
|
|
36
|
+
spawn?: SpawnLike;
|
|
37
|
+
/** Test seam: the eligibility gate. Production never passes it. */
|
|
38
|
+
screen?: ScreenFn;
|
|
39
|
+
tmpRoot?: string;
|
|
40
|
+
sourceEnv?: NodeJS.ProcessEnv;
|
|
41
|
+
platform?: NodeJS.Platform;
|
|
42
|
+
now?: () => number;
|
|
43
|
+
}
|
|
44
|
+
export interface ExampleOutcome {
|
|
45
|
+
name: string;
|
|
46
|
+
ok: boolean;
|
|
47
|
+
exitCode: number | null;
|
|
48
|
+
durationMs: number;
|
|
49
|
+
/** Failure kinds only: exit_code, stdout_missing, json_unparsable, json_mismatch, timeout, ... */
|
|
50
|
+
failures: string[];
|
|
51
|
+
/** T6: output-contract failures, tracked apart from the example's own expectations. */
|
|
52
|
+
contractFailures: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface ProbeRun {
|
|
55
|
+
examples: ExampleOutcome[];
|
|
56
|
+
allPassed: boolean;
|
|
57
|
+
contractHolds: boolean;
|
|
58
|
+
/** T4 and T6. */
|
|
59
|
+
checks: GeneValidationCheck[];
|
|
60
|
+
durationMs: number;
|
|
61
|
+
}
|
|
62
|
+
export interface AutoProbeDecision {
|
|
63
|
+
eligible: boolean;
|
|
64
|
+
needsHuman?: GeneNeedsHuman['reason'];
|
|
65
|
+
risk: GeneToolRisk;
|
|
66
|
+
reasons: string[];
|
|
67
|
+
}
|
|
68
|
+
export type AutoProbeOutcome = {
|
|
69
|
+
ok: true;
|
|
70
|
+
run: ProbeRun;
|
|
71
|
+
} | {
|
|
72
|
+
ok: false;
|
|
73
|
+
code: 'GENE_PROBE_NEEDS_APPROVAL';
|
|
74
|
+
message: string;
|
|
75
|
+
needsHuman: 'probe_approval' | 'high_risk_tool';
|
|
76
|
+
reasons: string[];
|
|
77
|
+
};
|
|
78
|
+
export type ProbeApproval = NonNullable<GeneValidation['probeApproval']>;
|
|
79
|
+
export interface ProbeSubject {
|
|
80
|
+
geneId: string;
|
|
81
|
+
content: GeneContent;
|
|
82
|
+
/** Tier-3 text of a `script` tool (the impl evidence). */
|
|
83
|
+
scriptText?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* May the curator run this tool on its own? Pure. The structural locks come BEFORE the screen and
|
|
87
|
+
* are not delegated to it.
|
|
88
|
+
*/
|
|
89
|
+
export declare function decideAutoProbe(content: GeneContent, config: Pick<GeneConfig, 'probeMode'>, deps?: Pick<ProbeDeps, 'screen'> & {
|
|
90
|
+
scriptText?: string;
|
|
91
|
+
}): AutoProbeDecision;
|
|
92
|
+
/** Allow-list only. Nothing else from the caller's environment reaches a probe. */
|
|
93
|
+
export declare function buildProbeEnv(source: NodeJS.ProcessEnv, platform: NodeJS.Platform, sandboxDir: string): Record<string, string>;
|
|
94
|
+
/**
|
|
95
|
+
* The curator's own probe. Returns `GENE_PROBE_NEEDS_APPROVAL` - with ZERO calls to `spawn` -
|
|
96
|
+
* unless `decideAutoProbe` says the tool is a read-only whitelisted command.
|
|
97
|
+
*/
|
|
98
|
+
export declare function autoProbe(subject: ProbeSubject, config: Pick<GeneConfig, 'probeMode'>, deps?: ProbeDeps): Promise<AutoProbeOutcome>;
|
|
99
|
+
export interface ApprovedProbeOptions extends ProbeDeps {
|
|
100
|
+
/** The person confirmed they understand a `high` risk tool will run. Required for risk high. */
|
|
101
|
+
confirmHighRisk?: boolean;
|
|
102
|
+
scriptText?: string;
|
|
103
|
+
}
|
|
104
|
+
export type ApprovedProbeRefusal = 'not_user' | 'approval_stale' | 'content_hash_mismatch' | 'high_risk_unconfirmed' | 'script_unreadable' | 'not_a_tool';
|
|
105
|
+
export type ApprovedProbeOutcome = {
|
|
106
|
+
ok: false;
|
|
107
|
+
code: 'GENE_PROBE_NEEDS_APPROVAL' | 'GENE_TOOL_HIGH_RISK';
|
|
108
|
+
reason: ApprovedProbeRefusal;
|
|
109
|
+
message: string;
|
|
110
|
+
} | {
|
|
111
|
+
ok: true;
|
|
112
|
+
executed: boolean;
|
|
113
|
+
run: ProbeRun | null;
|
|
114
|
+
validation: GeneValidation;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* The person's path. The approval is bound to the EXACT content: it must carry the hash of the
|
|
118
|
+
* content being probed, so an edit after the approval invalidates it. A composite is approved but
|
|
119
|
+
* never executed here - the curator has none of the tools its steps call.
|
|
120
|
+
*/
|
|
121
|
+
export declare function runApprovedProbe(head: Pick<GeneHead, 'id'>, version: GeneVersion, approval: ProbeApproval, options?: ApprovedProbeOptions): Promise<ApprovedProbeOutcome>;
|
|
122
|
+
/**
|
|
123
|
+
* May this tool be PUBLISHED? A tool the curator did not probe itself needs a person's probe
|
|
124
|
+
* approval recorded in its validation; a tool it did probe must be read-only and have validated.
|
|
125
|
+
*/
|
|
126
|
+
export declare function canPublishTool(validation: GeneValidation, risk: GeneToolRisk, autoProbed: boolean, contentHash?: string): boolean;
|
|
127
|
+
/** Fold a person-approved probe into the validation the candidate already carries. */
|
|
128
|
+
export declare function mergeApprovedProbe(base: GeneValidation, approved: Extract<ApprovedProbeOutcome, {
|
|
129
|
+
ok: true;
|
|
130
|
+
}>): GeneValidation;
|
|
131
|
+
export {};
|