@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.
- package/CHANGELOG.md +2935 -2864
- package/README.md +160 -45
- package/dist/agent/controller.d.ts +47 -0
- package/dist/agent/controller.js +153 -2
- package/dist/agent/governance-wiring.js +8 -1
- package/dist/agent/system-prompt.d.ts +26 -0
- package/dist/agent/system-prompt.js +11 -0
- package/dist/app/App.js +101 -3
- package/dist/cli.js +29 -1
- package/dist/commands/builtins.js +4 -0
- package/dist/commands/catalog.js +1 -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 +2 -1
- package/dist/config/env.js +12 -1
- package/dist/config/load.d.ts +10 -0
- package/dist/config/load.js +13 -2
- package/dist/config/store.js +11 -1
- 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 +104 -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 +206 -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 +243 -0
- package/dist/gene/curator/tools-write.d.ts +26 -0
- package/dist/gene/curator/tools-write.js +434 -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 +24 -0
- package/dist/gene/curator/validate/evidence-tokens.js +217 -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 +41 -0
- package/dist/gene/curator/validate/knowledge.js +255 -0
- package/dist/gene/curator/validate/live-check.d.ts +14 -0
- package/dist/gene/curator/validate/live-check.js +150 -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 +165 -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 +116 -0
- package/dist/gene/learn/learn-call.js +165 -0
- package/dist/gene/learn/learn-prompt.d.ts +58 -0
- package/dist/gene/learn/learn-prompt.js +254 -0
- package/dist/gene/learn/learner.d.ts +187 -0
- package/dist/gene/learn/learner.js +448 -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 +207 -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 +84 -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/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/team/runtime.d.ts +5 -0
- package/dist/team/runtime.js +23 -0
- package/dist/team/subagent.d.ts +34 -0
- package/dist/team/subagent.js +39 -2
- package/dist/tools/index.d.ts +36 -2
- package/dist/tools/index.js +48 -7
- package/package.json +3 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input and output shapes of candidate validation (gene-bank spec 10.7).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`. TYPES ONLY.
|
|
5
|
+
*
|
|
6
|
+
* ONE CONTEXT IN, ONE PLAIN-DATA OUTCOME OUT. `CandidateContext` carries everything a validator
|
|
7
|
+
* may look at (the draft, the evidence snapshotted at enqueue, the ports); `CandidateOutcome`
|
|
8
|
+
* carries the per-check results and the routing the curator must follow. Nothing here holds a
|
|
9
|
+
* handle: an outcome can be logged, stored or compared as it is.
|
|
10
|
+
*
|
|
11
|
+
* THE VERDICT IS A ROUTING FACT, NOT A SUMMARY OF `validation.ok`. A candidate that waits for a
|
|
12
|
+
* person (`needs_human`) or that must become a merge / revise instead of a create (`convert`)
|
|
13
|
+
* also has `validation.ok === false`, so a caller that ignores the verdict still cannot publish
|
|
14
|
+
* it; the verdict only tells the curator which door to use instead of the reject door.
|
|
15
|
+
*/
|
|
16
|
+
import type { GeneClass, GeneContent, GeneEvidence, GeneHead, GeneNeedsHuman, GenePermission, GeneProbation, GeneScope, GeneToolRisk, GeneType, GeneValidation } from '@aragon-agent/tui/model/gene/types';
|
|
17
|
+
import type { ConflictDecision } from '../conflicts.js';
|
|
18
|
+
import type { ProbeDeps } from '../probe.js';
|
|
19
|
+
import type { ValidatorPorts } from './ports.js';
|
|
20
|
+
export interface CandidateContext {
|
|
21
|
+
ports: ValidatorPorts;
|
|
22
|
+
type: GeneType;
|
|
23
|
+
scope: GeneScope;
|
|
24
|
+
/** The draft after the curator completed it. Never mutated. */
|
|
25
|
+
content: GeneContent;
|
|
26
|
+
/**
|
|
27
|
+
* The evidence snapshotted when the proposal was enqueued, refs already minted (K2 corpus).
|
|
28
|
+
* The validators never touch the filesystem to find it.
|
|
29
|
+
*/
|
|
30
|
+
evidence: readonly GeneEvidence[];
|
|
31
|
+
/** The existing id for a revise, the minted id for a create; used for self-exclusion. */
|
|
32
|
+
geneId?: string;
|
|
33
|
+
/** The class the draft asked for. Anything but `standard` is demoted for an agent author. */
|
|
34
|
+
requestedClass?: GeneClass;
|
|
35
|
+
/** For a revise: the head being replaced and, when known, its served content. */
|
|
36
|
+
target?: {
|
|
37
|
+
head: GeneHead;
|
|
38
|
+
content?: GeneContent;
|
|
39
|
+
};
|
|
40
|
+
/** Tier-3 text of a `script` tool (the impl evidence), for the risk screen and the probe. */
|
|
41
|
+
scriptText?: string;
|
|
42
|
+
/** S3 task texts: positives come from the source task, negatives from unrelated work. */
|
|
43
|
+
triggerProbe?: {
|
|
44
|
+
positives: readonly string[];
|
|
45
|
+
negatives?: readonly string[];
|
|
46
|
+
};
|
|
47
|
+
/** Test seams for the one module that executes anything. Production passes nothing. */
|
|
48
|
+
probeDeps?: ProbeDeps;
|
|
49
|
+
}
|
|
50
|
+
/** What one type's validator returns; `index.ts` folds it into a `CandidateOutcome`. */
|
|
51
|
+
export interface TypeResult {
|
|
52
|
+
checks: GeneValidation['checks'];
|
|
53
|
+
needsHuman?: GeneNeedsHuman['reason'];
|
|
54
|
+
conflict?: ConflictDecision;
|
|
55
|
+
probation?: GeneProbation;
|
|
56
|
+
forceProbation?: boolean;
|
|
57
|
+
derived?: DerivedTool;
|
|
58
|
+
autoProbed?: boolean;
|
|
59
|
+
usage: {
|
|
60
|
+
in: number;
|
|
61
|
+
out: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Facts the validators RECOMPUTED, so the curator can overwrite what the model claimed. */
|
|
65
|
+
export interface DerivedTool {
|
|
66
|
+
risk: GeneToolRisk;
|
|
67
|
+
permissions: GenePermission[];
|
|
68
|
+
/** `applicability.os` narrowed to the tool's own `env.os` (T5), when that differs. */
|
|
69
|
+
applicabilityOs?: Array<'win32' | 'darwin' | 'linux'>;
|
|
70
|
+
reasons: string[];
|
|
71
|
+
}
|
|
72
|
+
export type CandidateVerdict = 'pass' | 'fail' | 'needs_human' | 'convert';
|
|
73
|
+
export interface CandidateOutcome {
|
|
74
|
+
validation: GeneValidation;
|
|
75
|
+
verdict: CandidateVerdict;
|
|
76
|
+
needsHuman?: GeneNeedsHuman['reason'];
|
|
77
|
+
conflict?: ConflictDecision;
|
|
78
|
+
probation?: GeneProbation;
|
|
79
|
+
/** A model check could not run for lack of positives / a model: the gene must be on probation. */
|
|
80
|
+
forceProbation: boolean;
|
|
81
|
+
/** The class the gene will be stored with (an agent draft of `oversight` is demoted). */
|
|
82
|
+
class: GeneClass;
|
|
83
|
+
derived?: DerivedTool;
|
|
84
|
+
/** True when the tool was executed by the curator itself (read-only whitelist). */
|
|
85
|
+
autoProbed: boolean;
|
|
86
|
+
usage: {
|
|
87
|
+
in: number;
|
|
88
|
+
out: number;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building the validators' ports from what the curator already has (gene-bank spec 10.7).
|
|
3
|
+
*
|
|
4
|
+
* ASCII ONLY - the whole `gene/` tree is in `glyphs.test.ts::inScope`.
|
|
5
|
+
*
|
|
6
|
+
* The validators reach the world only through `ValidatorPorts` (so they stay testable with
|
|
7
|
+
* nothing else in the process). This file is the production binding: library reads for evidence,
|
|
8
|
+
* lookups and neighbours; the model port for the four model checks; and the EFFECTIVE config for
|
|
9
|
+
* the two settings the validators read (`toolsAllowNetwork`, `probeMode`).
|
|
10
|
+
*
|
|
11
|
+
* THE CONFIG IS READ PER CALL, through the switch guard, so a user who turns `probeMode` off in
|
|
12
|
+
* another process stops the next probe, and `toolsAllowNetwork` can only be tightened by the
|
|
13
|
+
* persisted file, never widened (`stricterGeneConfig`).
|
|
14
|
+
*
|
|
15
|
+
* NO MODEL PORT, NO MODEL CHECK. When the port has no `completeJson`, `modelJson` is left out and
|
|
16
|
+
* the validators record K4 / K5 / S3 / S4 as SKIPPED - never as passed (10.7). A skipped model
|
|
17
|
+
* check is how a missing fast model degrades validation instead of blocking it.
|
|
18
|
+
*/
|
|
19
|
+
import type { EnvFingerprint, GeneScope } from '@aragon-agent/tui/model/gene/types';
|
|
20
|
+
import type { CuratorModelPort } from './agent.js';
|
|
21
|
+
import type { CuratorLibrary } from './library.js';
|
|
22
|
+
import type { SwitchGuard } from './switches.js';
|
|
23
|
+
import type { CuratorTaskContext } from './task-context.js';
|
|
24
|
+
import type { ValidatorPorts } from './validate/index.js';
|
|
25
|
+
export interface ValidatorPortsDeps {
|
|
26
|
+
library: CuratorLibrary;
|
|
27
|
+
model: Pick<CuratorModelPort, 'completeJson'>;
|
|
28
|
+
switches: Pick<SwitchGuard, 'effective'>;
|
|
29
|
+
env(): EnvFingerprint;
|
|
30
|
+
now(): number;
|
|
31
|
+
knownSecrets(): readonly string[];
|
|
32
|
+
commandOnPath?(command: string): boolean;
|
|
33
|
+
hostToolNames?(): readonly string[];
|
|
34
|
+
hostToolSchema?(name: string): unknown;
|
|
35
|
+
projectRoot?(scope: GeneScope): string | undefined;
|
|
36
|
+
projectLabels?(): readonly string[];
|
|
37
|
+
}
|
|
38
|
+
export declare function createValidatorPortsFactory(deps: ValidatorPortsDeps): (ctx: CuratorTaskContext) => Promise<ValidatorPorts>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function createValidatorPortsFactory(deps) {
|
|
2
|
+
return async () => {
|
|
3
|
+
const config = await deps.switches.effective();
|
|
4
|
+
const complete = deps.model.completeJson;
|
|
5
|
+
const hostToolNames = deps.hostToolNames?.();
|
|
6
|
+
const ports = {
|
|
7
|
+
now: deps.now,
|
|
8
|
+
readEvidence: (scope, geneId, ref) => deps.library.readEvidence(scope, geneId, ref),
|
|
9
|
+
async lookupGene(id) {
|
|
10
|
+
const found = await deps.library.findHead(id);
|
|
11
|
+
if (found === null || found.read.head.currentVersion === null)
|
|
12
|
+
return null;
|
|
13
|
+
const version = await deps.library.readVersion(found.scope, id, found.read.head.currentVersion);
|
|
14
|
+
return version === null ? null : { head: found.read.head, version };
|
|
15
|
+
},
|
|
16
|
+
neighbours: (scope, type, brief, k) => deps.library.neighbours(scope, type, brief, k),
|
|
17
|
+
config: { toolsAllowNetwork: config.toolsAllowNetwork, probeMode: config.probeMode },
|
|
18
|
+
env: deps.env(),
|
|
19
|
+
knownSecrets: deps.knownSecrets(),
|
|
20
|
+
...(complete === undefined ? {} : { modelJson: (request) => complete.call(deps.model, request) }),
|
|
21
|
+
...(deps.commandOnPath === undefined ? {} : { commandOnPath: deps.commandOnPath }),
|
|
22
|
+
...(hostToolNames === undefined ? {} : { hostToolNames }),
|
|
23
|
+
...(deps.hostToolSchema === undefined ? {} : { hostToolSchema: deps.hostToolSchema }),
|
|
24
|
+
...(deps.projectRoot === undefined ? {} : { projectRoot: deps.projectRoot }),
|
|
25
|
+
...(deps.projectLabels === undefined ? {} : { projectLabels: deps.projectLabels() }),
|
|
26
|
+
};
|
|
27
|
+
return ports;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { GeneConfig } from '@aragon-agent/tui/model/config/schema';
|
|
2
|
+
import type { GeneType } from '@aragon-agent/tui/model/gene/types';
|
|
3
|
+
import type { ManagerCore } from './manager-context.js';
|
|
4
|
+
declare const CONFIG_SOURCES: readonly ["default", "file", "env"];
|
|
5
|
+
declare const POLICY_SOURCES: readonly ["none", "user", "repo", "unreadable"];
|
|
6
|
+
type ConfigSource = (typeof CONFIG_SOURCES)[number];
|
|
7
|
+
type ConfigKey = Exclude<keyof GeneConfig, 'teamPath'>;
|
|
8
|
+
/**
|
|
9
|
+
* Every string a bundle may hold other than a `projectRef` / `holderRef`. The tests assert that a
|
|
10
|
+
* generated bundle uses nothing outside this set, which keeps the vocabulary the single place a
|
|
11
|
+
* new word has to be added.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DIAG_STRING_VOCABULARY: ReadonlySet<string>;
|
|
14
|
+
/** The last eight hex characters of a project key (`<slug>-<8 hex>`), or null. */
|
|
15
|
+
export declare function projectRefOf(key: string): string | null;
|
|
16
|
+
export interface DiagProjectPolicy {
|
|
17
|
+
/** Eight hex characters. A full key or a label is dropped, not shortened. */
|
|
18
|
+
projectRef: string;
|
|
19
|
+
learn: boolean;
|
|
20
|
+
source: (typeof POLICY_SOURCES)[number];
|
|
21
|
+
}
|
|
22
|
+
/** What the collector hands over: loosely typed on purpose, because the serializer validates. */
|
|
23
|
+
export interface DiagFacts {
|
|
24
|
+
now: number;
|
|
25
|
+
versions: {
|
|
26
|
+
cli?: unknown;
|
|
27
|
+
core?: unknown;
|
|
28
|
+
tui?: unknown;
|
|
29
|
+
node?: unknown;
|
|
30
|
+
};
|
|
31
|
+
platform: {
|
|
32
|
+
os?: unknown;
|
|
33
|
+
arch?: unknown;
|
|
34
|
+
};
|
|
35
|
+
config: {
|
|
36
|
+
values?: Partial<Record<ConfigKey, unknown>>;
|
|
37
|
+
sources?: Partial<Record<ConfigKey, unknown>>;
|
|
38
|
+
teamPathSet?: unknown;
|
|
39
|
+
};
|
|
40
|
+
envKillSwitch?: unknown;
|
|
41
|
+
projectPolicy?: Partial<DiagProjectPolicy> | null;
|
|
42
|
+
scopes?: DiagScopeFacts[];
|
|
43
|
+
scopesOmitted?: unknown;
|
|
44
|
+
library?: {
|
|
45
|
+
published?: unknown;
|
|
46
|
+
pinned?: unknown;
|
|
47
|
+
candidates?: unknown;
|
|
48
|
+
archivedBytes?: unknown;
|
|
49
|
+
};
|
|
50
|
+
queue?: {
|
|
51
|
+
pending?: unknown;
|
|
52
|
+
claimed?: unknown;
|
|
53
|
+
dead?: unknown;
|
|
54
|
+
done?: unknown;
|
|
55
|
+
oldestPendingAgeSec?: unknown;
|
|
56
|
+
oldestClaimedAgeSec?: unknown;
|
|
57
|
+
};
|
|
58
|
+
curator?: {
|
|
59
|
+
lease?: unknown;
|
|
60
|
+
holderPid?: unknown;
|
|
61
|
+
kind?: unknown;
|
|
62
|
+
heartbeatAgeSec?: unknown;
|
|
63
|
+
};
|
|
64
|
+
tokens?: {
|
|
65
|
+
today?: unknown;
|
|
66
|
+
budget?: unknown;
|
|
67
|
+
};
|
|
68
|
+
recent?: Array<{
|
|
69
|
+
t?: unknown;
|
|
70
|
+
ev?: unknown;
|
|
71
|
+
type?: unknown;
|
|
72
|
+
}>;
|
|
73
|
+
orphans?: {
|
|
74
|
+
orphanScopes?: unknown;
|
|
75
|
+
unrecordedScopes?: unknown;
|
|
76
|
+
};
|
|
77
|
+
unavailable?: readonly string[];
|
|
78
|
+
}
|
|
79
|
+
export interface DiagScopeFacts {
|
|
80
|
+
kind?: unknown;
|
|
81
|
+
/** Only the project key is ever looked at, and only to cut its last eight characters. */
|
|
82
|
+
projectKey?: unknown;
|
|
83
|
+
/** How many scopes of this kind were merged into the entry (tasks and teams are merged). */
|
|
84
|
+
scopeCount?: unknown;
|
|
85
|
+
current?: unknown;
|
|
86
|
+
published?: unknown;
|
|
87
|
+
pinned?: unknown;
|
|
88
|
+
candidates?: unknown;
|
|
89
|
+
archived?: unknown;
|
|
90
|
+
archivedBytes?: unknown;
|
|
91
|
+
index?: {
|
|
92
|
+
present?: unknown;
|
|
93
|
+
generation?: unknown;
|
|
94
|
+
rows?: unknown;
|
|
95
|
+
journalBytes?: unknown;
|
|
96
|
+
builtAgeSec?: unknown;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface DiagBundle {
|
|
100
|
+
schema: 1;
|
|
101
|
+
generatedAt: number;
|
|
102
|
+
versions: Record<'cli' | 'core' | 'tui' | 'node', [number, number, number] | null>;
|
|
103
|
+
platform: {
|
|
104
|
+
os: string;
|
|
105
|
+
arch: string;
|
|
106
|
+
};
|
|
107
|
+
config: {
|
|
108
|
+
values: Record<string, number | boolean | string>;
|
|
109
|
+
sources: Record<string, ConfigSource>;
|
|
110
|
+
teamPathSet: boolean;
|
|
111
|
+
};
|
|
112
|
+
switches: {
|
|
113
|
+
envKillSwitch: boolean;
|
|
114
|
+
};
|
|
115
|
+
projectPolicy: DiagProjectPolicy | null;
|
|
116
|
+
library: {
|
|
117
|
+
published: Record<GeneType, number>;
|
|
118
|
+
pinned: Record<GeneType, number>;
|
|
119
|
+
candidates: Record<GeneType, number>;
|
|
120
|
+
archivedBytes: number;
|
|
121
|
+
};
|
|
122
|
+
scopes: Array<{
|
|
123
|
+
kind: string;
|
|
124
|
+
projectRef: string | null;
|
|
125
|
+
scopeCount: number;
|
|
126
|
+
current: boolean;
|
|
127
|
+
published: Record<GeneType, number>;
|
|
128
|
+
pinned: Record<GeneType, number>;
|
|
129
|
+
candidates: number;
|
|
130
|
+
archived: number;
|
|
131
|
+
archivedBytes: number;
|
|
132
|
+
index: {
|
|
133
|
+
present: boolean;
|
|
134
|
+
generation: number;
|
|
135
|
+
rows: number;
|
|
136
|
+
journalBytes: number;
|
|
137
|
+
builtAgeSec: number | null;
|
|
138
|
+
};
|
|
139
|
+
}>;
|
|
140
|
+
scopesOmitted: number;
|
|
141
|
+
queue: {
|
|
142
|
+
pending: number;
|
|
143
|
+
claimed: number;
|
|
144
|
+
dead: number;
|
|
145
|
+
done: number;
|
|
146
|
+
oldestPendingAgeSec: number | null;
|
|
147
|
+
oldestClaimedAgeSec: number | null;
|
|
148
|
+
};
|
|
149
|
+
curator: {
|
|
150
|
+
lease: string;
|
|
151
|
+
holderRef: string | null;
|
|
152
|
+
kind: string | null;
|
|
153
|
+
heartbeatAgeSec: number | null;
|
|
154
|
+
};
|
|
155
|
+
tokens: {
|
|
156
|
+
today: number;
|
|
157
|
+
budget: number;
|
|
158
|
+
};
|
|
159
|
+
recent: Array<{
|
|
160
|
+
t: number;
|
|
161
|
+
ev: string;
|
|
162
|
+
type: string | null;
|
|
163
|
+
}>;
|
|
164
|
+
orphans: {
|
|
165
|
+
orphanScopes: number;
|
|
166
|
+
unrecordedScopes: number;
|
|
167
|
+
};
|
|
168
|
+
unavailable: string[];
|
|
169
|
+
notes: string[];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Build the bundle from collected facts. PURE. Every value in the result went through a coercer
|
|
173
|
+
* above; see the file header for what that rules out.
|
|
174
|
+
*/
|
|
175
|
+
export declare function buildDiagBundle(facts: DiagFacts): DiagBundle;
|
|
176
|
+
/** The text that is written to the file: stable key order, two-space indent, trailing newline. */
|
|
177
|
+
export declare function renderDiagBundle(bundle: DiagBundle): string;
|
|
178
|
+
export declare const RECENT_RUNS = 50;
|
|
179
|
+
/** Project scopes listed individually; the rest are only counted. */
|
|
180
|
+
export declare const SCOPES_LISTED_MAX = 50;
|
|
181
|
+
export interface DiagOptions {
|
|
182
|
+
/** This session's project policy (I3-5). Optional: absent = no policy information. */
|
|
183
|
+
projectPolicy?: DiagProjectPolicy | null;
|
|
184
|
+
/** The `gene` object of the persisted config file, to tell file values from defaults. */
|
|
185
|
+
configFile?: () => Record<string, unknown> | null;
|
|
186
|
+
/** Installed versions as `x.y.z` strings. Default: read from the installed packages. */
|
|
187
|
+
versions?: () => DiagFacts['versions'];
|
|
188
|
+
/** Is the `ARAGON_GENE=0` kill switch set? Default: read the environment. */
|
|
189
|
+
envKillSwitch?: () => boolean;
|
|
190
|
+
}
|
|
191
|
+
/** Gather the facts of a bundle from the live library. Never throws, never writes. */
|
|
192
|
+
export declare function collectDiagFacts(core: ManagerCore, options?: DiagOptions): Promise<DiagFacts>;
|
|
193
|
+
/** Collect and serialise in one step. */
|
|
194
|
+
export declare function createDiagBundle(core: ManagerCore, options?: DiagOptions): Promise<DiagBundle>;
|
|
195
|
+
export type DiagWrite = {
|
|
196
|
+
ok: true;
|
|
197
|
+
path: string;
|
|
198
|
+
} | {
|
|
199
|
+
ok: false;
|
|
200
|
+
reason: 'exists' | 'io';
|
|
201
|
+
};
|
|
202
|
+
/** `<genes>/diag/gene-diag.json`: where `/gene diag` writes when no file is named. */
|
|
203
|
+
export declare function defaultDiagFile(root?: string): string;
|
|
204
|
+
/**
|
|
205
|
+
* Write the bundle to `path`. A file somebody else named is never overwritten unless `overwrite`:
|
|
206
|
+
* `--out README.md` must not destroy a README. Never throws.
|
|
207
|
+
*/
|
|
208
|
+
export declare function writeDiagFile(path: string, bundle: DiagBundle, overwrite: boolean): Promise<DiagWrite>;
|
|
209
|
+
export {};
|