@rotifer/playground 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +3 -1
- package/README.zh.md +3 -1
- package/dist/cloud/capability-candidates.d.ts +89 -0
- package/dist/cloud/capability-candidates.d.ts.map +1 -0
- package/dist/cloud/capability-candidates.js +296 -0
- package/dist/cloud/capability-candidates.js.map +1 -0
- package/dist/commands/agent-create.d.ts +8 -0
- package/dist/commands/agent-create.d.ts.map +1 -1
- package/dist/commands/agent-create.js +5 -2
- package/dist/commands/agent-create.js.map +1 -1
- package/dist/commands/agent-run.d.ts.map +1 -1
- package/dist/commands/agent-run.js +30 -13
- package/dist/commands/agent-run.js.map +1 -1
- package/dist/commands/genome-format.d.ts +180 -0
- package/dist/commands/genome-format.d.ts.map +1 -0
- package/dist/commands/genome-format.js +774 -0
- package/dist/commands/genome-format.js.map +1 -0
- package/dist/commands/genome-import.d.ts +100 -0
- package/dist/commands/genome-import.d.ts.map +1 -0
- package/dist/commands/genome-import.js +425 -0
- package/dist/commands/genome-import.js.map +1 -0
- package/dist/commands/genome.d.ts +82 -0
- package/dist/commands/genome.d.ts.map +1 -0
- package/dist/commands/genome.js +392 -0
- package/dist/commands/genome.js.map +1 -0
- package/dist/commands/install.d.ts +54 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +148 -75
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/publish.js +2 -2
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/vg.js +2 -2
- package/dist/commands/vg.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/publish/pre-publish-check.d.ts +15 -0
- package/dist/publish/pre-publish-check.d.ts.map +1 -1
- package/dist/publish/pre-publish-check.js +17 -2
- package/dist/publish/pre-publish-check.js.map +1 -1
- package/dist/scanner/index.d.ts +1 -1
- package/dist/scanner/index.d.ts.map +1 -1
- package/dist/scanner/index.js +3 -1
- package/dist/scanner/index.js.map +1 -1
- package/dist/scanner/literals.d.ts +2 -0
- package/dist/scanner/literals.d.ts.map +1 -0
- package/dist/scanner/literals.js +293 -0
- package/dist/scanner/literals.js.map +1 -0
- package/dist/scanner/rules.d.ts +14 -0
- package/dist/scanner/rules.d.ts.map +1 -1
- package/dist/scanner/rules.js +30 -1
- package/dist/scanner/rules.js.map +1 -1
- package/dist/scanner/scanner.d.ts.map +1 -1
- package/dist/scanner/scanner.js +8 -1
- package/dist/scanner/scanner.js.map +1 -1
- package/dist/scanner/types.d.ts +7 -0
- package/dist/scanner/types.d.ts.map +1 -1
- package/dist/utils/binding.d.ts +1 -1
- package/dist/utils/binding.d.ts.map +1 -1
- package/dist/utils/binding.js.map +1 -1
- package/dist/utils/rust-phenotype.d.ts +24 -0
- package/dist/utils/rust-phenotype.d.ts.map +1 -0
- package/dist/utils/rust-phenotype.js +59 -0
- package/dist/utils/rust-phenotype.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { AgentRecord } from "./agent-create.js";
|
|
3
|
+
import { type AlgebraExpr, type CredentialFinding, type CredentialLayer, type GeneReference, type GenomeBlueprint } from "./genome-format.js";
|
|
4
|
+
export * from "./genome-format.js";
|
|
5
|
+
export interface RoleSummary {
|
|
6
|
+
role: string;
|
|
7
|
+
geneId: string;
|
|
8
|
+
fidelity: string;
|
|
9
|
+
hasHints: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class GenomeExportError extends Error {
|
|
12
|
+
readonly hint?: string | undefined;
|
|
13
|
+
readonly findings?: CredentialFinding[] | undefined;
|
|
14
|
+
constructor(message: string, hint?: string | undefined, findings?: CredentialFinding[] | undefined);
|
|
15
|
+
}
|
|
16
|
+
/** Find a local agent by id, or by name when the name is unique. */
|
|
17
|
+
export declare function findAgent(root: string, ref: string): AgentRecord;
|
|
18
|
+
/** Composition type exactly as `agent run` derives it. */
|
|
19
|
+
export declare function compositionTypeOf(agent: AgentRecord): string;
|
|
20
|
+
/**
|
|
21
|
+
* Map the agent's composition onto §15.2, limited to what `agent run` executes:
|
|
22
|
+
* branches are single genes, Par/Cond/Try take the genome in order. Anything
|
|
23
|
+
* else fails rather than being approximated.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildComposition(agent: AgentRecord, refs: GeneReference[]): {
|
|
26
|
+
composition: AlgebraExpr;
|
|
27
|
+
parMerge?: string;
|
|
28
|
+
};
|
|
29
|
+
export interface BuildBlueprintInput {
|
|
30
|
+
root: string;
|
|
31
|
+
genesDir: string;
|
|
32
|
+
agent: AgentRecord;
|
|
33
|
+
lock?: boolean;
|
|
34
|
+
minFitness?: number;
|
|
35
|
+
minVg?: number;
|
|
36
|
+
description?: string;
|
|
37
|
+
author?: string;
|
|
38
|
+
now?: Date;
|
|
39
|
+
}
|
|
40
|
+
export interface BuildBlueprintResult {
|
|
41
|
+
blueprint: GenomeBlueprint;
|
|
42
|
+
roles: RoleSummary[];
|
|
43
|
+
notices: string[];
|
|
44
|
+
}
|
|
45
|
+
export declare function buildBlueprint(input: BuildBlueprintInput): BuildBlueprintResult;
|
|
46
|
+
export interface ExportGenomeInput extends BuildBlueprintInput {
|
|
47
|
+
output: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ExportGenomeResult {
|
|
50
|
+
file: string;
|
|
51
|
+
agent: string;
|
|
52
|
+
composition: string;
|
|
53
|
+
geneCount: number;
|
|
54
|
+
mode: "capability" | "lock";
|
|
55
|
+
roles: RoleSummary[];
|
|
56
|
+
notices: string[];
|
|
57
|
+
credentialScan: {
|
|
58
|
+
passed: true;
|
|
59
|
+
layers: CredentialLayer[];
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build, scan, and write a Blueprint. Nothing is written when the scan finds
|
|
64
|
+
* anything, or when this CLI's own import would refuse the file: the reader's
|
|
65
|
+
* rules (Cond forms, numbers, strings, required fields) run on the exact text.
|
|
66
|
+
*/
|
|
67
|
+
export declare function exportGenome(input: ExportGenomeInput): ExportGenomeResult;
|
|
68
|
+
export interface GenomeExportOptions {
|
|
69
|
+
output?: string;
|
|
70
|
+
lock?: boolean;
|
|
71
|
+
minFitness?: string;
|
|
72
|
+
minVg?: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
}
|
|
75
|
+
/** Run `genome export`; returns the process exit code. */
|
|
76
|
+
export declare function runGenomeExport(agentRef: string, options: GenomeExportOptions, ctx: {
|
|
77
|
+
root: string;
|
|
78
|
+
genesDir: string;
|
|
79
|
+
author?: string;
|
|
80
|
+
}): number;
|
|
81
|
+
export declare const genomeCommand: Command;
|
|
82
|
+
//# sourceMappingURL=genome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genome.d.ts","sourceRoot":"","sources":["../../src/commands/genome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAWL,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EAErB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,oBAAoB,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAGxC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,EAAE;gBAFvC,OAAO,EAAE,MAAM,EACN,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,QAAQ,CAAC,EAAE,iBAAiB,EAAE,YAAA;CAK1C;A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AE,CAAC;IAClB,cAAc,EAAE;QAAE,MAAM,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;CAC7D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CA+BzE;AAID,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAsBD,0DAA0D;AAC1D,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,mBAAmB,EAC5B,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACvD,MAAM,CAoCR;AAiBD,eAAO,MAAM,aAAa,SAEQ,CAAC"}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.genomeCommand = exports.GenomeExportError = void 0;
|
|
40
|
+
exports.findAgent = findAgent;
|
|
41
|
+
exports.compositionTypeOf = compositionTypeOf;
|
|
42
|
+
exports.buildComposition = buildComposition;
|
|
43
|
+
exports.buildBlueprint = buildBlueprint;
|
|
44
|
+
exports.exportGenome = exportGenome;
|
|
45
|
+
exports.runGenomeExport = runGenomeExport;
|
|
46
|
+
const commander_1 = require("commander");
|
|
47
|
+
const node_fs_1 = require("node:fs");
|
|
48
|
+
const node_path_1 = require("node:path");
|
|
49
|
+
const display = __importStar(require("../utils/display.js"));
|
|
50
|
+
const config_js_1 = require("../utils/config.js");
|
|
51
|
+
const project_root_js_1 = require("../utils/project-root.js");
|
|
52
|
+
const binding_js_1 = require("../utils/binding.js");
|
|
53
|
+
const validate_gene_name_js_1 = require("../utils/validate-gene-name.js");
|
|
54
|
+
const auth_js_1 = require("../cloud/auth.js");
|
|
55
|
+
const genome_format_js_1 = require("./genome-format.js");
|
|
56
|
+
__exportStar(require("./genome-format.js"), exports);
|
|
57
|
+
class GenomeExportError extends Error {
|
|
58
|
+
hint;
|
|
59
|
+
findings;
|
|
60
|
+
constructor(message, hint, findings) {
|
|
61
|
+
super(message);
|
|
62
|
+
this.hint = hint;
|
|
63
|
+
this.findings = findings;
|
|
64
|
+
this.name = "GenomeExportError";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.GenomeExportError = GenomeExportError;
|
|
68
|
+
// ── Agent lookup ─────────────────────────────────────────────
|
|
69
|
+
/** Find a local agent by id, or by name when the name is unique. */
|
|
70
|
+
function findAgent(root, ref) {
|
|
71
|
+
const agentsDir = (0, node_path_1.join)(root, ".rotifer", "agents");
|
|
72
|
+
const records = (0, node_fs_1.existsSync)(agentsDir)
|
|
73
|
+
? (0, node_fs_1.readdirSync)(agentsDir)
|
|
74
|
+
.filter((f) => f.endsWith(".json"))
|
|
75
|
+
.map((f) => JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(agentsDir, f), "utf-8")))
|
|
76
|
+
: [];
|
|
77
|
+
const byId = records.find((a) => a.id === ref);
|
|
78
|
+
if (byId)
|
|
79
|
+
return byId;
|
|
80
|
+
const byName = records.filter((a) => a.name === ref);
|
|
81
|
+
if (byName.length === 1)
|
|
82
|
+
return byName[0];
|
|
83
|
+
if (byName.length > 1) {
|
|
84
|
+
throw new GenomeExportError(`${byName.length} agents are named '${ref}'`, `Pass one of their ids instead: ${byName.map((a) => a.id).join(", ")}`);
|
|
85
|
+
}
|
|
86
|
+
throw new GenomeExportError(`Agent '${ref}' not found`, "List local agents: rotifer agent list");
|
|
87
|
+
}
|
|
88
|
+
/** Composition type exactly as `agent run` derives it. */
|
|
89
|
+
function compositionTypeOf(agent) {
|
|
90
|
+
const comp = agent.composition;
|
|
91
|
+
const declared = typeof comp === "object" && comp !== null ? comp.type : comp;
|
|
92
|
+
return (typeof declared === "string" && declared) || (agent.genome.length >= 2 ? "Seq" : "Single");
|
|
93
|
+
}
|
|
94
|
+
function outsideSubset(type, why) {
|
|
95
|
+
return new GenomeExportError(`Composition '${type}' cannot be exported: ${why}`, "v0.9.2 exports only what 'rotifer agent run' executes faithfully: " +
|
|
96
|
+
"Single (1 gene), Seq, Par (2+ genes), Cond and Try (exactly 2 genes).");
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Map the agent's composition onto §15.2, limited to what `agent run` executes:
|
|
100
|
+
* branches are single genes, Par/Cond/Try take the genome in order. Anything
|
|
101
|
+
* else fails rather than being approximated.
|
|
102
|
+
*/
|
|
103
|
+
function buildComposition(agent, refs) {
|
|
104
|
+
const type = compositionTypeOf(agent);
|
|
105
|
+
const comp = (typeof agent.composition === "object" ? agent.composition : {});
|
|
106
|
+
const leaf = (i) => ({ Gene: { geneRef: refs[i] } });
|
|
107
|
+
const n = refs.length;
|
|
108
|
+
switch (type) {
|
|
109
|
+
case "Single":
|
|
110
|
+
if (n !== 1)
|
|
111
|
+
throw outsideSubset(type, `needs exactly 1 gene, the genome has ${n}`);
|
|
112
|
+
return { composition: leaf(0) };
|
|
113
|
+
case "Seq":
|
|
114
|
+
if (n < 1)
|
|
115
|
+
throw outsideSubset(type, "the genome is empty");
|
|
116
|
+
return { composition: { Seq: { steps: refs.map((_, i) => leaf(i)) } } };
|
|
117
|
+
case "Par": {
|
|
118
|
+
if (n < 2)
|
|
119
|
+
throw outsideSubset(type, `needs at least 2 genes, the genome has ${n}`);
|
|
120
|
+
// Right-associative: [a, b, c] → Par(a, Par(b, c)). No deadline — `agent run` has none.
|
|
121
|
+
let expr = leaf(n - 1);
|
|
122
|
+
for (let i = n - 2; i >= 0; i--)
|
|
123
|
+
expr = { Par: { left: leaf(i), right: expr } };
|
|
124
|
+
return { composition: expr, parMerge: comp.merge || "first" };
|
|
125
|
+
}
|
|
126
|
+
case "Cond": {
|
|
127
|
+
if (n !== 2)
|
|
128
|
+
throw outsideSubset(type, `needs exactly 2 genes, the genome has ${n}`);
|
|
129
|
+
// Same defaults `agent run` applies to a missing predicate.
|
|
130
|
+
const pred = comp.predicate ?? {};
|
|
131
|
+
const op = pred.op || "Eq";
|
|
132
|
+
const operator = Object.hasOwn(genome_format_js_1.COMPARE_OPS, op) ? genome_format_js_1.COMPARE_OPS[op] : undefined;
|
|
133
|
+
if (!operator) {
|
|
134
|
+
throw outsideSubset(type, `unknown predicate operator '${op}' (expected one of ${Object.keys(genome_format_js_1.COMPARE_OPS).join(", ")})`);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
composition: {
|
|
138
|
+
Cond: {
|
|
139
|
+
predicate: { field: pred.field || "type", operator, value: pred.value ?? pred.equals ?? "primary" },
|
|
140
|
+
ifTrue: leaf(0),
|
|
141
|
+
ifFalse: leaf(1),
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
case "Try":
|
|
147
|
+
if (n !== 2)
|
|
148
|
+
throw outsideSubset(type, `needs exactly 2 genes, the genome has ${n}`);
|
|
149
|
+
return { composition: { TryCatch: { body: leaf(0), handler: leaf(1) } } };
|
|
150
|
+
default:
|
|
151
|
+
throw outsideSubset(type, "§15.2 has no such operator, or it is outside the v0.9.2 executable subset");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function readJson(path) {
|
|
155
|
+
if (!(0, node_fs_1.existsSync)(path))
|
|
156
|
+
return null;
|
|
157
|
+
try {
|
|
158
|
+
return JSON.parse((0, node_fs_1.readFileSync)(path, "utf-8"));
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function hintForUncomputableId(gene, reason) {
|
|
165
|
+
if (/ir\.wasm|rotifer\.version|rotifer\.constraints/.test(reason)) {
|
|
166
|
+
return `Compile it first: rotifer compile ${gene}`;
|
|
167
|
+
}
|
|
168
|
+
if (/fidelity/.test(reason))
|
|
169
|
+
return `Re-wrap it so phenotype.json declares a fidelity: rotifer wrap ${gene}`;
|
|
170
|
+
return "See docs/gene-id-v2.md §5 for what makes a gene ID computable.";
|
|
171
|
+
}
|
|
172
|
+
function checkUnitInterval(name, value) {
|
|
173
|
+
if (value === undefined)
|
|
174
|
+
return;
|
|
175
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
176
|
+
throw new GenomeExportError(`${name} must be a number between 0 and 1`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function buildBlueprint(input) {
|
|
180
|
+
const { root, genesDir, agent } = input;
|
|
181
|
+
const genesRoot = (0, node_path_1.join)(root, genesDir);
|
|
182
|
+
const notices = [];
|
|
183
|
+
checkUnitInterval("--min-fitness", input.minFitness);
|
|
184
|
+
if (input.minVg !== undefined) {
|
|
185
|
+
if (!Number.isFinite(input.minVg) || input.minVg < genome_format_js_1.MIN_VG_FLOOR || input.minVg >= 1) {
|
|
186
|
+
throw new GenomeExportError(`--min-vg must be in [${genome_format_js_1.MIN_VG_FLOOR}, 1.0)`, "§5.1 does not allow a V(g) threshold below 0.5.");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (!Array.isArray(agent.genome) || agent.genome.length === 0) {
|
|
190
|
+
throw new GenomeExportError(`Agent '${agent.name}' has an empty genome`);
|
|
191
|
+
}
|
|
192
|
+
const seen = new Set();
|
|
193
|
+
for (const gene of agent.genome) {
|
|
194
|
+
if (seen.has(gene)) {
|
|
195
|
+
throw new GenomeExportError(`Gene '${gene}' appears more than once in the genome`, "A Blueprint keys each role by gene name, so every gene can appear only once.");
|
|
196
|
+
}
|
|
197
|
+
seen.add(gene);
|
|
198
|
+
}
|
|
199
|
+
const refs = [];
|
|
200
|
+
const roles = [];
|
|
201
|
+
const capabilities = {};
|
|
202
|
+
const hints = {};
|
|
203
|
+
for (const gene of agent.genome) {
|
|
204
|
+
try {
|
|
205
|
+
(0, validate_gene_name_js_1.validateGeneName)(gene);
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
throw new GenomeExportError(err.message);
|
|
209
|
+
}
|
|
210
|
+
const geneDir = (0, node_path_1.join)(genesRoot, gene);
|
|
211
|
+
const phenotype = readJson((0, node_path_1.join)(geneDir, "phenotype.json"));
|
|
212
|
+
if (!phenotype) {
|
|
213
|
+
throw new GenomeExportError(`Gene '${gene}' has no readable phenotype.json under ${genesDir}/`, `Install or wrap it first: rotifer install ${gene} or rotifer wrap ${gene}`);
|
|
214
|
+
}
|
|
215
|
+
const idResult = (0, binding_js_1.geneIdV2)(genesRoot, gene);
|
|
216
|
+
if (!("id" in idResult)) {
|
|
217
|
+
throw new GenomeExportError(`Gene '${gene}' has no v2 gene ID: ${idResult.reason}`, hintForUncomputableId(gene, idResult.reason));
|
|
218
|
+
}
|
|
219
|
+
if (!genome_format_js_1.GENE_ID_V2.test(idResult.id)) {
|
|
220
|
+
throw new GenomeExportError(`Gene '${gene}' got a malformed v2 gene ID from the native module`);
|
|
221
|
+
}
|
|
222
|
+
refs.push({ geneId: idResult.id, role: gene, optional: false });
|
|
223
|
+
const fidelity = typeof phenotype.fidelity === "string" ? phenotype.fidelity : "";
|
|
224
|
+
const isWrapped = fidelity.toLowerCase() === "wrapped";
|
|
225
|
+
if (!input.lock) {
|
|
226
|
+
if (typeof phenotype.domain === "string" && phenotype.domain) {
|
|
227
|
+
capabilities[gene] = {
|
|
228
|
+
domain: phenotype.domain,
|
|
229
|
+
inputSchemaCompat: phenotype.inputSchema ?? {},
|
|
230
|
+
outputSchemaCompat: phenotype.outputSchema ?? {},
|
|
231
|
+
minFitness: input.minFitness ?? genome_format_js_1.DEFAULT_MIN_FITNESS,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
notices.push(`Gene '${gene}' declares no domain — the receiver can only import it by gene ID.`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const manifest = readJson((0, node_path_1.join)(geneDir, ".cloud-manifest.json"));
|
|
239
|
+
const owner = manifest?.owner;
|
|
240
|
+
const version = manifest?.version;
|
|
241
|
+
let hasHints = false;
|
|
242
|
+
if (typeof owner === "string" && owner && typeof version === "string" && version && fidelity) {
|
|
243
|
+
hints[gene] = {
|
|
244
|
+
owner,
|
|
245
|
+
name: gene,
|
|
246
|
+
version,
|
|
247
|
+
...(typeof manifest?.cloud_id === "string" && manifest.cloud_id ? { cloudId: manifest.cloud_id } : {}),
|
|
248
|
+
fidelity,
|
|
249
|
+
};
|
|
250
|
+
hasHints = true;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
notices.push(input.lock
|
|
254
|
+
? `Gene '${gene}' was never published or installed from the Registry — the receiver has no way to fetch it.`
|
|
255
|
+
: `Gene '${gene}' was never published or installed from the Registry — the receiver can only find a substitute by capability.`);
|
|
256
|
+
}
|
|
257
|
+
if (isWrapped) {
|
|
258
|
+
notices.push(`Gene '${gene}' is Wrapped: in v0.9.2 the receiver cannot install Wrapped genes from the Registry ` +
|
|
259
|
+
"(their source is not distributed there), only find a Native/Hybrid substitute by capability.");
|
|
260
|
+
}
|
|
261
|
+
roles.push({ role: gene, geneId: idResult.id, fidelity, hasHints });
|
|
262
|
+
}
|
|
263
|
+
const { composition, parMerge } = buildComposition(agent, refs);
|
|
264
|
+
const extension = {};
|
|
265
|
+
if (parMerge !== undefined)
|
|
266
|
+
extension.parMerge = parMerge;
|
|
267
|
+
if (input.minVg !== undefined)
|
|
268
|
+
extension.minVg = input.minVg;
|
|
269
|
+
const now = (input.now ?? new Date()).toISOString();
|
|
270
|
+
const blueprint = {
|
|
271
|
+
blueprintFormat: genome_format_js_1.BLUEPRINT_FORMAT,
|
|
272
|
+
protocolVersion: { ...genome_format_js_1.BLUEPRINT_PROTOCOL_VERSION, supportedFeatures: ["GENE_COMPOSITION_ALGEBRA"] },
|
|
273
|
+
snapshot: { genes: refs, composition, snapshotAt: now },
|
|
274
|
+
metadata: {
|
|
275
|
+
name: agent.name,
|
|
276
|
+
...(input.description ? { description: input.description } : {}),
|
|
277
|
+
...(input.author ? { author: input.author } : {}),
|
|
278
|
+
createdAt: now,
|
|
279
|
+
},
|
|
280
|
+
...(Object.keys(capabilities).length > 0 ? { capabilities } : {}),
|
|
281
|
+
...(Object.keys(hints).length > 0 ? { resolutionHints: hints } : {}),
|
|
282
|
+
...(Object.keys(extension).length > 0 ? { bindingExtensions: { [genome_format_js_1.BINDING_NAME]: extension } } : {}),
|
|
283
|
+
};
|
|
284
|
+
return { blueprint, roles, notices };
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Build, scan, and write a Blueprint. Nothing is written when the scan finds
|
|
288
|
+
* anything, or when this CLI's own import would refuse the file: the reader's
|
|
289
|
+
* rules (Cond forms, numbers, strings, required fields) run on the exact text.
|
|
290
|
+
*/
|
|
291
|
+
function exportGenome(input) {
|
|
292
|
+
const { blueprint, roles, notices } = buildBlueprint(input);
|
|
293
|
+
const findings = (0, genome_format_js_1.scanBlueprint)(blueprint);
|
|
294
|
+
if (findings.length > 0) {
|
|
295
|
+
throw new GenomeExportError(`Credential scan blocked the export: ${findings.length} finding(s); nothing was written`, "Remove the flagged values (shown by position only) and export again.", findings);
|
|
296
|
+
}
|
|
297
|
+
const text = JSON.stringify(blueprint, null, 2) + "\n";
|
|
298
|
+
try {
|
|
299
|
+
(0, genome_format_js_1.parseBlueprint)(text);
|
|
300
|
+
}
|
|
301
|
+
catch (err) {
|
|
302
|
+
if (!(err instanceof genome_format_js_1.GenomeImportError))
|
|
303
|
+
throw err;
|
|
304
|
+
throw new GenomeExportError(`The Blueprint would not import, so nothing was written: ${err.message}`, err.hint);
|
|
305
|
+
}
|
|
306
|
+
(0, node_fs_1.writeFileSync)(input.output, text);
|
|
307
|
+
return {
|
|
308
|
+
file: input.output,
|
|
309
|
+
agent: input.agent.name,
|
|
310
|
+
composition: compositionTypeOf(input.agent),
|
|
311
|
+
geneCount: blueprint.snapshot.genes.length,
|
|
312
|
+
mode: blueprint.capabilities ? "capability" : "lock",
|
|
313
|
+
roles,
|
|
314
|
+
notices,
|
|
315
|
+
credentialScan: { passed: true, layers: ["key-name", "value-pattern", "entropy"] },
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function parseNumberOption(flag, raw) {
|
|
319
|
+
if (raw === undefined)
|
|
320
|
+
return undefined;
|
|
321
|
+
const n = Number(raw);
|
|
322
|
+
if (raw.trim() === "" || !Number.isFinite(n))
|
|
323
|
+
throw new GenomeExportError(`${flag} must be a number, got '${raw}'`);
|
|
324
|
+
return n;
|
|
325
|
+
}
|
|
326
|
+
function reportFailure(err) {
|
|
327
|
+
if (display.isJsonMode()) {
|
|
328
|
+
process.stdout.write(JSON.stringify({ ok: false, error: err.message, hint: err.hint, findings: err.findings }, null, 2) + "\n");
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
display.error(err.message, err.hint);
|
|
332
|
+
for (const f of err.findings ?? []) {
|
|
333
|
+
console.error(` ${f.pointer || "/"} [${f.layer}] ${f.rule}`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/** Run `genome export`; returns the process exit code. */
|
|
337
|
+
function runGenomeExport(agentRef, options, ctx) {
|
|
338
|
+
try {
|
|
339
|
+
const agent = findAgent(ctx.root, agentRef);
|
|
340
|
+
const output = (0, node_path_1.resolve)(options.output ?? `${agent.name}.rgenome`);
|
|
341
|
+
const result = exportGenome({
|
|
342
|
+
root: ctx.root,
|
|
343
|
+
genesDir: ctx.genesDir,
|
|
344
|
+
agent,
|
|
345
|
+
lock: options.lock,
|
|
346
|
+
minFitness: parseNumberOption("--min-fitness", options.minFitness),
|
|
347
|
+
minVg: parseNumberOption("--min-vg", options.minVg),
|
|
348
|
+
description: options.description,
|
|
349
|
+
author: ctx.author,
|
|
350
|
+
output,
|
|
351
|
+
});
|
|
352
|
+
display.renderResult({ ok: true, ...result }, (r) => {
|
|
353
|
+
display.header("Genome Export");
|
|
354
|
+
display.keyValue("Agent", r.agent);
|
|
355
|
+
display.keyValue("Composition", r.composition);
|
|
356
|
+
display.keyValue("Mode", r.mode === "lock" ? "lock (gene IDs only)" : "capability + gene IDs");
|
|
357
|
+
for (const role of r.roles) {
|
|
358
|
+
display.keyValue(` ${role.role}`, `${role.geneId} ${role.fidelity}${role.hasHints ? "" : " (no Registry hints)"}`);
|
|
359
|
+
}
|
|
360
|
+
for (const n of r.notices)
|
|
361
|
+
display.warn(n);
|
|
362
|
+
display.success("Credential scan passed (key names, value patterns, entropy)");
|
|
363
|
+
display.success(`Wrote ${r.file}`);
|
|
364
|
+
});
|
|
365
|
+
return 0;
|
|
366
|
+
}
|
|
367
|
+
catch (err) {
|
|
368
|
+
if (err instanceof GenomeExportError) {
|
|
369
|
+
reportFailure(err);
|
|
370
|
+
return 1;
|
|
371
|
+
}
|
|
372
|
+
throw err;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const genomeExportCommand = new commander_1.Command("export")
|
|
376
|
+
.description("Export an agent's genome as a shareable Blueprint (.rgenome)")
|
|
377
|
+
.argument("<agent>", "agent name or id")
|
|
378
|
+
.option("-o, --output <file>", "output file (default: <agent>.rgenome)")
|
|
379
|
+
.option("--lock", "reference genes by ID only; write no capability queries")
|
|
380
|
+
.option("--min-fitness <n>", `minimum fitness in each capability query (default: ${genome_format_js_1.DEFAULT_MIN_FITNESS})`)
|
|
381
|
+
.option("--min-vg <n>", `suggested minimum V(g) for importers, in [${genome_format_js_1.MIN_VG_FLOOR}, 1.0)`)
|
|
382
|
+
.option("-d, --description <text>", "description stored in the Blueprint metadata")
|
|
383
|
+
.action((agentRef, options) => {
|
|
384
|
+
const root = (0, project_root_js_1.requireProjectRoot)();
|
|
385
|
+
const config = (0, config_js_1.loadConfig)(root);
|
|
386
|
+
const author = (0, auth_js_1.loadCredentials)()?.user?.username;
|
|
387
|
+
process.exitCode = runGenomeExport(agentRef, options, { root, genesDir: config.genes_dir, author });
|
|
388
|
+
});
|
|
389
|
+
exports.genomeCommand = new commander_1.Command("genome")
|
|
390
|
+
.description("Genome Blueprint commands: export an agent's genome, import one")
|
|
391
|
+
.addCommand(genomeExportCommand);
|
|
392
|
+
//# sourceMappingURL=genome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genome.js","sourceRoot":"","sources":["../../src/commands/genome.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,8BAoBC;AAWD,8CAIC;AAeD,4CAgDC;AA8CD,wCAoIC;AAwBD,oCA+BC;AAiCD,0CAwCC;AAzcD,yCAAoC;AACpC,qCAA+E;AAC/E,yCAA0C;AAC1C,6DAA+C;AAC/C,kDAAgD;AAChD,8DAA8D;AAC9D,oDAA+C;AAC/C,0EAAkE;AAClE,8CAAmD;AAEnD,yDAkB4B;AAE5B,qDAAmC;AASnC,MAAa,iBAAkB,SAAQ,KAAK;IAG/B;IACA;IAHX,YACE,OAAe,EACN,IAAa,EACb,QAA8B;QAEvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,SAAI,GAAJ,IAAI,CAAS;QACb,aAAQ,GAAR,QAAQ,CAAsB;QAGvC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AATD,8CASC;AAED,gEAAgE;AAEhE,oEAAoE;AACpE,SAAgB,SAAS,CAAC,IAAY,EAAE,GAAW;IACjD,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,OAAO,GAAkB,IAAA,oBAAU,EAAC,SAAS,CAAC;QAClD,CAAC,CAAC,IAAA,qBAAW,EAAC,SAAS,CAAC;aACnB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClC,GAAG,CAAC,CAAC,CAAC,EAAE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C,QAAQ,CAAC;KAC/C,WAAW,CAAC,iEAAiE,CAAC;KAC9E,UAAU,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,3 +1,57 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import type { CloudGene } from "../cloud/types.js";
|
|
3
|
+
/** The gene is already installed and `force` was not set. */
|
|
4
|
+
export declare class GeneExistsError extends Error {
|
|
5
|
+
readonly geneName: string;
|
|
6
|
+
readonly geneDir: string;
|
|
7
|
+
constructor(geneName: string, geneDir: string);
|
|
8
|
+
}
|
|
9
|
+
/** The downloaded WASM does not match the size or hash the Registry recorded. */
|
|
10
|
+
export declare class WasmIntegrityError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether a Registry row's phenotype and its recorded content_hash (the v1,
|
|
15
|
+
* client-defined hash) agree. Both come from the same row in the same
|
|
16
|
+
* response, so agreement says nothing about whether the content can be relied
|
|
17
|
+
* on — anyone able to change one can change the other, and some edits (a
|
|
18
|
+
* `__proto__` key) do not move the hash at all. Disagreement does say
|
|
19
|
+
* something: storage damage, a hash edited after publication, or one of the
|
|
20
|
+
* early-2026 rows known to differ.
|
|
21
|
+
*/
|
|
22
|
+
export type ContentHashCheck = {
|
|
23
|
+
status: "match";
|
|
24
|
+
} | {
|
|
25
|
+
status: "mismatch";
|
|
26
|
+
recorded: string;
|
|
27
|
+
recomputed: string;
|
|
28
|
+
} | {
|
|
29
|
+
status: "absent";
|
|
30
|
+
};
|
|
31
|
+
export declare function checkContentHash(gene: Pick<CloudGene, "phenotype" | "content_hash">): ContentHashCheck;
|
|
32
|
+
/** The one-line notice for a mismatch. Deliberately makes no claim about trust. */
|
|
33
|
+
export declare function contentHashWarning(geneName: string, check: ContentHashCheck): string | null;
|
|
34
|
+
export interface InstallFromCloudOptions {
|
|
35
|
+
/** Absolute path of the workspace's genes directory. */
|
|
36
|
+
genesDir: string;
|
|
37
|
+
force?: boolean;
|
|
38
|
+
/** Print progress the way `rotifer install` does. */
|
|
39
|
+
isVerbose?: boolean;
|
|
40
|
+
/** Called once the gene's metadata has been fetched. */
|
|
41
|
+
onFetched?: (gene: CloudGene) => void;
|
|
42
|
+
}
|
|
43
|
+
export interface InstalledGene {
|
|
44
|
+
gene: CloudGene;
|
|
45
|
+
geneDir: string;
|
|
46
|
+
didSnapshot: boolean;
|
|
47
|
+
contentHashCheck: ContentHashCheck;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Install one gene from the Registry: phenotype.json, the WASM (size and
|
|
51
|
+
* SHA-256 checked against the Registry row), and `.cloud-manifest.json`.
|
|
52
|
+
* Counts the download, as every install does. Throws on any failure; nothing
|
|
53
|
+
* is printed unless `isVerbose`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function installGeneFromCloud(geneRef: string, options: InstallFromCloudOptions): Promise<InstalledGene>;
|
|
2
56
|
export declare const installCommand: Command;
|
|
3
57
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD,6DAA6D;AAC7D,qBAAa,eAAgB,SAAQ,KAAK;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM;gBAA1C,QAAQ,EAAE,MAAM,EAAW,OAAO,EAAE,MAAM;CAIhE;AAED,iFAAiF;AACjF,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;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