@rotifer/playground 0.27.0 → 0.28.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 +22 -0
- package/README.md +3 -1
- package/README.zh.md +3 -1
- package/dist/cloud/capability-candidates.d.ts +87 -0
- package/dist/cloud/capability-candidates.d.ts.map +1 -0
- package/dist/cloud/capability-candidates.js +244 -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 +23 -13
- package/dist/commands/agent-run.js.map +1 -1
- package/dist/commands/genome-import.d.ts +122 -0
- package/dist/commands/genome-import.d.ts.map +1 -0
- package/dist/commands/genome-import.js +632 -0
- package/dist/commands/genome-import.js.map +1 -0
- package/dist/commands/genome.d.ts +213 -0
- package/dist/commands/genome.d.ts.map +1 -0
- package/dist/commands/genome.js +606 -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,606 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.genomeCommand = exports.BARE_HEX_RULE = exports.CREDENTIAL_KEY_NAMES = exports.COMPARE_OPS = exports.GenomeExportError = exports.GENE_ID_V2 = exports.BINDING_NAME = exports.MIN_VG_FLOOR = exports.DEFAULT_MIN_FITNESS = exports.BLUEPRINT_PROTOCOL_VERSION = exports.BLUEPRINT_FORMAT = void 0;
|
|
37
|
+
exports.findAgent = findAgent;
|
|
38
|
+
exports.compositionTypeOf = compositionTypeOf;
|
|
39
|
+
exports.buildComposition = buildComposition;
|
|
40
|
+
exports.buildBlueprint = buildBlueprint;
|
|
41
|
+
exports.shannonEntropy = shannonEntropy;
|
|
42
|
+
exports.scanForCredentials = scanForCredentials;
|
|
43
|
+
exports.scanBlueprint = scanBlueprint;
|
|
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 pre_publish_check_js_1 = require("../publish/pre-publish-check.js");
|
|
56
|
+
// ── Genome Blueprint format (.rgenome) ───────────────────────
|
|
57
|
+
//
|
|
58
|
+
// A Blueprint describes an agent's genome so someone else can rebuild it: the
|
|
59
|
+
// spec's GenomeSnapshot (§25.1) plus how to find each gene again. It carries
|
|
60
|
+
// references and public fields only — never gene code or WASM (§10.4.1).
|
|
61
|
+
/** Blueprint format number; an importer refuses a larger one. */
|
|
62
|
+
exports.BLUEPRINT_FORMAT = 1;
|
|
63
|
+
/** Protocol version whose Blueprint layout this command writes. */
|
|
64
|
+
exports.BLUEPRINT_PROTOCOL_VERSION = { major: 0, minor: 9, patch: 2 };
|
|
65
|
+
/** Default `minFitness` for a CapabilityQuery: the recommended τ of §5.1. */
|
|
66
|
+
exports.DEFAULT_MIN_FITNESS = 0.3;
|
|
67
|
+
/** §5.1: V_min MUST lie in [0.5, 1.0). */
|
|
68
|
+
exports.MIN_VG_FLOOR = 0.5;
|
|
69
|
+
/** Key under `bindingExtensions` for semantics only this binding defines. */
|
|
70
|
+
exports.BINDING_NAME = "rotifer-playground";
|
|
71
|
+
exports.GENE_ID_V2 = /^v2:[0-9a-f]{64}$/;
|
|
72
|
+
class GenomeExportError extends Error {
|
|
73
|
+
hint;
|
|
74
|
+
findings;
|
|
75
|
+
constructor(message, hint, findings) {
|
|
76
|
+
super(message);
|
|
77
|
+
this.hint = hint;
|
|
78
|
+
this.findings = findings;
|
|
79
|
+
this.name = "GenomeExportError";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.GenomeExportError = GenomeExportError;
|
|
83
|
+
// ── Agent lookup ─────────────────────────────────────────────
|
|
84
|
+
/** Find a local agent by id, or by name when the name is unique. */
|
|
85
|
+
function findAgent(root, ref) {
|
|
86
|
+
const agentsDir = (0, node_path_1.join)(root, ".rotifer", "agents");
|
|
87
|
+
const records = (0, node_fs_1.existsSync)(agentsDir)
|
|
88
|
+
? (0, node_fs_1.readdirSync)(agentsDir)
|
|
89
|
+
.filter((f) => f.endsWith(".json"))
|
|
90
|
+
.map((f) => JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(agentsDir, f), "utf-8")))
|
|
91
|
+
: [];
|
|
92
|
+
const byId = records.find((a) => a.id === ref);
|
|
93
|
+
if (byId)
|
|
94
|
+
return byId;
|
|
95
|
+
const byName = records.filter((a) => a.name === ref);
|
|
96
|
+
if (byName.length === 1)
|
|
97
|
+
return byName[0];
|
|
98
|
+
if (byName.length > 1) {
|
|
99
|
+
throw new GenomeExportError(`${byName.length} agents are named '${ref}'`, `Pass one of their ids instead: ${byName.map((a) => a.id).join(", ")}`);
|
|
100
|
+
}
|
|
101
|
+
throw new GenomeExportError(`Agent '${ref}' not found`, "List local agents: rotifer agent list");
|
|
102
|
+
}
|
|
103
|
+
// ── Composition ──────────────────────────────────────────────
|
|
104
|
+
/** Rust executor CompareOp (what `agent run` accepts) → §15.2 CompareOp. */
|
|
105
|
+
exports.COMPARE_OPS = {
|
|
106
|
+
Eq: "EQ",
|
|
107
|
+
Neq: "NEQ",
|
|
108
|
+
Gt: "GT",
|
|
109
|
+
Gte: "GTE",
|
|
110
|
+
Lt: "LT",
|
|
111
|
+
Lte: "LTE",
|
|
112
|
+
Contains: "CONTAINS",
|
|
113
|
+
Matches: "MATCHES",
|
|
114
|
+
};
|
|
115
|
+
/** Composition type exactly as `agent run` derives it. */
|
|
116
|
+
function compositionTypeOf(agent) {
|
|
117
|
+
const comp = agent.composition;
|
|
118
|
+
const declared = typeof comp === "object" && comp !== null ? comp.type : comp;
|
|
119
|
+
return (typeof declared === "string" && declared) || (agent.genome.length >= 2 ? "Seq" : "Single");
|
|
120
|
+
}
|
|
121
|
+
function outsideSubset(type, why) {
|
|
122
|
+
return new GenomeExportError(`Composition '${type}' cannot be exported: ${why}`, "v0.9.2 exports only what 'rotifer agent run' executes faithfully: " +
|
|
123
|
+
"Single (1 gene), Seq, Par (2+ genes), Cond and Try (exactly 2 genes).");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Map the agent's composition onto §15.2, limited to what `agent run` executes:
|
|
127
|
+
* branches are single genes, Par/Cond/Try take the genome in order. Anything
|
|
128
|
+
* else fails rather than being approximated.
|
|
129
|
+
*/
|
|
130
|
+
function buildComposition(agent, refs) {
|
|
131
|
+
const type = compositionTypeOf(agent);
|
|
132
|
+
const comp = (typeof agent.composition === "object" ? agent.composition : {});
|
|
133
|
+
const leaf = (i) => ({ Gene: { geneRef: refs[i] } });
|
|
134
|
+
const n = refs.length;
|
|
135
|
+
switch (type) {
|
|
136
|
+
case "Single":
|
|
137
|
+
if (n !== 1)
|
|
138
|
+
throw outsideSubset(type, `needs exactly 1 gene, the genome has ${n}`);
|
|
139
|
+
return { composition: leaf(0) };
|
|
140
|
+
case "Seq":
|
|
141
|
+
if (n < 1)
|
|
142
|
+
throw outsideSubset(type, "the genome is empty");
|
|
143
|
+
return { composition: { Seq: { steps: refs.map((_, i) => leaf(i)) } } };
|
|
144
|
+
case "Par": {
|
|
145
|
+
if (n < 2)
|
|
146
|
+
throw outsideSubset(type, `needs at least 2 genes, the genome has ${n}`);
|
|
147
|
+
// Right-associative: [a, b, c] → Par(a, Par(b, c)). No deadline — `agent run` has none.
|
|
148
|
+
let expr = leaf(n - 1);
|
|
149
|
+
for (let i = n - 2; i >= 0; i--)
|
|
150
|
+
expr = { Par: { left: leaf(i), right: expr } };
|
|
151
|
+
return { composition: expr, parMerge: comp.merge || "first" };
|
|
152
|
+
}
|
|
153
|
+
case "Cond": {
|
|
154
|
+
if (n !== 2)
|
|
155
|
+
throw outsideSubset(type, `needs exactly 2 genes, the genome has ${n}`);
|
|
156
|
+
// Same defaults `agent run` applies to a missing predicate.
|
|
157
|
+
const pred = comp.predicate ?? {};
|
|
158
|
+
const op = pred.op || "Eq";
|
|
159
|
+
const operator = exports.COMPARE_OPS[op];
|
|
160
|
+
if (!operator) {
|
|
161
|
+
throw outsideSubset(type, `unknown predicate operator '${op}' (expected one of ${Object.keys(exports.COMPARE_OPS).join(", ")})`);
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
composition: {
|
|
165
|
+
Cond: {
|
|
166
|
+
predicate: { field: pred.field || "type", operator, value: pred.value ?? pred.equals ?? "primary" },
|
|
167
|
+
ifTrue: leaf(0),
|
|
168
|
+
ifFalse: leaf(1),
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
case "Try":
|
|
174
|
+
if (n !== 2)
|
|
175
|
+
throw outsideSubset(type, `needs exactly 2 genes, the genome has ${n}`);
|
|
176
|
+
return { composition: { TryCatch: { body: leaf(0), handler: leaf(1) } } };
|
|
177
|
+
default:
|
|
178
|
+
throw outsideSubset(type, "§15.2 has no such operator, or it is outside the v0.9.2 executable subset");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function readJson(path) {
|
|
182
|
+
if (!(0, node_fs_1.existsSync)(path))
|
|
183
|
+
return null;
|
|
184
|
+
try {
|
|
185
|
+
return JSON.parse((0, node_fs_1.readFileSync)(path, "utf-8"));
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function hintForUncomputableId(gene, reason) {
|
|
192
|
+
if (/ir\.wasm|rotifer\.version|rotifer\.constraints/.test(reason)) {
|
|
193
|
+
return `Compile it first: rotifer compile ${gene}`;
|
|
194
|
+
}
|
|
195
|
+
if (/fidelity/.test(reason))
|
|
196
|
+
return `Re-wrap it so phenotype.json declares a fidelity: rotifer wrap ${gene}`;
|
|
197
|
+
return "See docs/gene-id-v2.md §5 for what makes a gene ID computable.";
|
|
198
|
+
}
|
|
199
|
+
function checkUnitInterval(name, value) {
|
|
200
|
+
if (value === undefined)
|
|
201
|
+
return;
|
|
202
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
203
|
+
throw new GenomeExportError(`${name} must be a number between 0 and 1`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function buildBlueprint(input) {
|
|
207
|
+
const { root, genesDir, agent } = input;
|
|
208
|
+
const genesRoot = (0, node_path_1.join)(root, genesDir);
|
|
209
|
+
const notices = [];
|
|
210
|
+
checkUnitInterval("--min-fitness", input.minFitness);
|
|
211
|
+
if (input.minVg !== undefined) {
|
|
212
|
+
if (!Number.isFinite(input.minVg) || input.minVg < exports.MIN_VG_FLOOR || input.minVg >= 1) {
|
|
213
|
+
throw new GenomeExportError(`--min-vg must be in [${exports.MIN_VG_FLOOR}, 1.0)`, "§5.1 does not allow a V(g) threshold below 0.5.");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (!Array.isArray(agent.genome) || agent.genome.length === 0) {
|
|
217
|
+
throw new GenomeExportError(`Agent '${agent.name}' has an empty genome`);
|
|
218
|
+
}
|
|
219
|
+
const seen = new Set();
|
|
220
|
+
for (const gene of agent.genome) {
|
|
221
|
+
if (seen.has(gene)) {
|
|
222
|
+
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.");
|
|
223
|
+
}
|
|
224
|
+
seen.add(gene);
|
|
225
|
+
}
|
|
226
|
+
const refs = [];
|
|
227
|
+
const roles = [];
|
|
228
|
+
const capabilities = {};
|
|
229
|
+
const hints = {};
|
|
230
|
+
for (const gene of agent.genome) {
|
|
231
|
+
try {
|
|
232
|
+
(0, validate_gene_name_js_1.validateGeneName)(gene);
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
throw new GenomeExportError(err.message);
|
|
236
|
+
}
|
|
237
|
+
const geneDir = (0, node_path_1.join)(genesRoot, gene);
|
|
238
|
+
const phenotype = readJson((0, node_path_1.join)(geneDir, "phenotype.json"));
|
|
239
|
+
if (!phenotype) {
|
|
240
|
+
throw new GenomeExportError(`Gene '${gene}' has no readable phenotype.json under ${genesDir}/`, `Install or wrap it first: rotifer install ${gene} or rotifer wrap ${gene}`);
|
|
241
|
+
}
|
|
242
|
+
const idResult = (0, binding_js_1.geneIdV2)(genesRoot, gene);
|
|
243
|
+
if (!("id" in idResult)) {
|
|
244
|
+
throw new GenomeExportError(`Gene '${gene}' has no v2 gene ID: ${idResult.reason}`, hintForUncomputableId(gene, idResult.reason));
|
|
245
|
+
}
|
|
246
|
+
if (!exports.GENE_ID_V2.test(idResult.id)) {
|
|
247
|
+
throw new GenomeExportError(`Gene '${gene}' got a malformed v2 gene ID from the native module`);
|
|
248
|
+
}
|
|
249
|
+
refs.push({ geneId: idResult.id, role: gene, optional: false });
|
|
250
|
+
const fidelity = typeof phenotype.fidelity === "string" ? phenotype.fidelity : "";
|
|
251
|
+
const isWrapped = fidelity.toLowerCase() === "wrapped";
|
|
252
|
+
if (!input.lock) {
|
|
253
|
+
if (typeof phenotype.domain === "string" && phenotype.domain) {
|
|
254
|
+
capabilities[gene] = {
|
|
255
|
+
domain: phenotype.domain,
|
|
256
|
+
inputSchemaCompat: phenotype.inputSchema ?? {},
|
|
257
|
+
outputSchemaCompat: phenotype.outputSchema ?? {},
|
|
258
|
+
minFitness: input.minFitness ?? exports.DEFAULT_MIN_FITNESS,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
notices.push(`Gene '${gene}' declares no domain — the receiver can only import it by gene ID.`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const manifest = readJson((0, node_path_1.join)(geneDir, ".cloud-manifest.json"));
|
|
266
|
+
const owner = manifest?.owner;
|
|
267
|
+
const version = manifest?.version;
|
|
268
|
+
let hasHints = false;
|
|
269
|
+
if (typeof owner === "string" && owner && typeof version === "string" && version && fidelity) {
|
|
270
|
+
hints[gene] = {
|
|
271
|
+
owner,
|
|
272
|
+
name: gene,
|
|
273
|
+
version,
|
|
274
|
+
...(typeof manifest?.cloud_id === "string" && manifest.cloud_id ? { cloudId: manifest.cloud_id } : {}),
|
|
275
|
+
fidelity,
|
|
276
|
+
};
|
|
277
|
+
hasHints = true;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
notices.push(input.lock
|
|
281
|
+
? `Gene '${gene}' was never published or installed from the Registry — the receiver has no way to fetch it.`
|
|
282
|
+
: `Gene '${gene}' was never published or installed from the Registry — the receiver can only find a substitute by capability.`);
|
|
283
|
+
}
|
|
284
|
+
if (isWrapped) {
|
|
285
|
+
notices.push(`Gene '${gene}' is Wrapped: in v0.9.2 the receiver cannot install Wrapped genes from the Registry ` +
|
|
286
|
+
"(their source is not distributed there), only find a Native/Hybrid substitute by capability.");
|
|
287
|
+
}
|
|
288
|
+
roles.push({ role: gene, geneId: idResult.id, fidelity, hasHints });
|
|
289
|
+
}
|
|
290
|
+
const { composition, parMerge } = buildComposition(agent, refs);
|
|
291
|
+
const extension = {};
|
|
292
|
+
if (parMerge !== undefined)
|
|
293
|
+
extension.parMerge = parMerge;
|
|
294
|
+
if (input.minVg !== undefined)
|
|
295
|
+
extension.minVg = input.minVg;
|
|
296
|
+
const now = (input.now ?? new Date()).toISOString();
|
|
297
|
+
const blueprint = {
|
|
298
|
+
blueprintFormat: exports.BLUEPRINT_FORMAT,
|
|
299
|
+
protocolVersion: { ...exports.BLUEPRINT_PROTOCOL_VERSION, supportedFeatures: ["GENE_COMPOSITION_ALGEBRA"] },
|
|
300
|
+
snapshot: { genes: refs, composition, snapshotAt: now },
|
|
301
|
+
metadata: {
|
|
302
|
+
name: agent.name,
|
|
303
|
+
...(input.description ? { description: input.description } : {}),
|
|
304
|
+
...(input.author ? { author: input.author } : {}),
|
|
305
|
+
createdAt: now,
|
|
306
|
+
},
|
|
307
|
+
...(Object.keys(capabilities).length > 0 ? { capabilities } : {}),
|
|
308
|
+
...(Object.keys(hints).length > 0 ? { resolutionHints: hints } : {}),
|
|
309
|
+
...(Object.keys(extension).length > 0 ? { bindingExtensions: { [exports.BINDING_NAME]: extension } } : {}),
|
|
310
|
+
};
|
|
311
|
+
return { blueprint, roles, notices };
|
|
312
|
+
}
|
|
313
|
+
/** Field names that hold a credential. Matched after lower-casing and dropping `_`/`-`, as the whole name or its suffix. */
|
|
314
|
+
exports.CREDENTIAL_KEY_NAMES = [
|
|
315
|
+
"apiKey",
|
|
316
|
+
"password",
|
|
317
|
+
"privateKey",
|
|
318
|
+
"secret",
|
|
319
|
+
"token",
|
|
320
|
+
"bearer",
|
|
321
|
+
"accessToken",
|
|
322
|
+
"clientSecret",
|
|
323
|
+
"refreshToken",
|
|
324
|
+
"oauth_token",
|
|
325
|
+
"aws_secret_access_key",
|
|
326
|
+
"stripe_secret_key",
|
|
327
|
+
];
|
|
328
|
+
const NORMALIZED_KEY_NAMES = exports.CREDENTIAL_KEY_NAMES.map(normalizeKey);
|
|
329
|
+
function normalizeKey(key) {
|
|
330
|
+
return key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
331
|
+
}
|
|
332
|
+
function isCredentialKeyName(key) {
|
|
333
|
+
const k = normalizeKey(key);
|
|
334
|
+
return NORMALIZED_KEY_NAMES.some((name) => k === name || k.endsWith(name));
|
|
335
|
+
}
|
|
336
|
+
/** A bare 32-byte key in hex: exactly 64 hex characters, optionally `0x`-prefixed. */
|
|
337
|
+
const BARE_HEX_KEY = /(?<![0-9A-Fa-f])(?:0x)?[0-9A-Fa-f]{64}(?![0-9A-Fa-f])/;
|
|
338
|
+
/** A `/`-separated run of plain words ("docs/protocol/genome") — prose, not key material. */
|
|
339
|
+
const PATH_WORD = /^[A-Za-z][a-z]*[0-9]*$/;
|
|
340
|
+
function isPathLike(run) {
|
|
341
|
+
const segments = run.split("/");
|
|
342
|
+
return segments.length >= 2 && segments.every((s) => s.length >= 2 && PATH_WORD.test(s));
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* A bare 32- or 64-byte key in Base64 outside a PEM block: a Base64 run of
|
|
346
|
+
* 43–44 or 86–88 characters that also looks random. Letters and `/` are in the
|
|
347
|
+
* Base64 alphabet, so length and charset alone also catch path text; random
|
|
348
|
+
* key material is told apart by its entropy (over 200,000 random keys the
|
|
349
|
+
* lowest seen was 4.24 bits/char at 32 bytes and 4.88 at 64; one million of
|
|
350
|
+
* each all still matched this rule) and by not splitting into plain words on `/`.
|
|
351
|
+
*/
|
|
352
|
+
function hasBareBase64Key(value) {
|
|
353
|
+
for (const run of value.match(/[A-Za-z0-9+/=]+/g) ?? []) {
|
|
354
|
+
const body = run.replace(/={1,2}$/, "");
|
|
355
|
+
if (body.includes("="))
|
|
356
|
+
continue;
|
|
357
|
+
const len = run.length;
|
|
358
|
+
const isKey32 = len >= 43 && len <= 44;
|
|
359
|
+
const isKey64 = len >= 86 && len <= 88;
|
|
360
|
+
if (!isKey32 && !isKey64)
|
|
361
|
+
continue;
|
|
362
|
+
if (shannonEntropy(body) < (isKey32 ? 4.0 : 4.5))
|
|
363
|
+
continue;
|
|
364
|
+
if (isPathLike(body))
|
|
365
|
+
continue;
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
exports.BARE_HEX_RULE = "Bare 32-byte hex key";
|
|
371
|
+
const BARE_BASE64_RULE = "Bare Base64 key (32/64 bytes)";
|
|
372
|
+
/** Shannon entropy in bits per character. */
|
|
373
|
+
function shannonEntropy(s) {
|
|
374
|
+
if (s.length === 0)
|
|
375
|
+
return 0;
|
|
376
|
+
const counts = new Map();
|
|
377
|
+
for (const ch of s)
|
|
378
|
+
counts.set(ch, (counts.get(ch) ?? 0) + 1);
|
|
379
|
+
let bits = 0;
|
|
380
|
+
for (const n of counts.values()) {
|
|
381
|
+
const p = n / s.length;
|
|
382
|
+
bits -= p * Math.log2(p);
|
|
383
|
+
}
|
|
384
|
+
return bits;
|
|
385
|
+
}
|
|
386
|
+
const ENTROPY_THRESHOLD = 4.5;
|
|
387
|
+
const ENTROPY_MIN_LENGTH = 20;
|
|
388
|
+
/** RFC 6901 escaping of one reference token. */
|
|
389
|
+
function pointerToken(key) {
|
|
390
|
+
return key.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Scan one string. `isHexExempt` lifts only the bare-hex rule — for fields that
|
|
394
|
+
* legitimately hold a hash; every other rule still applies.
|
|
395
|
+
*/
|
|
396
|
+
function scanString(value, pointer, isHexExempt, out) {
|
|
397
|
+
for (const { label, pattern } of pre_publish_check_js_1.SENSITIVE_PATTERNS) {
|
|
398
|
+
if (pattern.test(value))
|
|
399
|
+
out.push({ pointer, layer: "value-pattern", rule: label });
|
|
400
|
+
}
|
|
401
|
+
if (!isHexExempt && BARE_HEX_KEY.test(value)) {
|
|
402
|
+
out.push({ pointer, layer: "value-pattern", rule: exports.BARE_HEX_RULE });
|
|
403
|
+
}
|
|
404
|
+
if (hasBareBase64Key(value))
|
|
405
|
+
out.push({ pointer, layer: "value-pattern", rule: BARE_BASE64_RULE });
|
|
406
|
+
// Per run of printable ASCII: credentials are printable ASCII, so whitespace
|
|
407
|
+
// and any other character end a token. Prose does not add up to a hit, and
|
|
408
|
+
// text without spaces — Chinese, or ASCII words joined by symbols like "≥" —
|
|
409
|
+
// is not one long high-entropy token; a key glued to such text is still
|
|
410
|
+
// judged on its own. Hex tops out at 4.0 bits/char and never trips this —
|
|
411
|
+
// the hex rule above covers it.
|
|
412
|
+
for (const token of value.match(/[\x21-\x7e]+/g) ?? []) {
|
|
413
|
+
if (token.length > ENTROPY_MIN_LENGTH && shannonEntropy(token) > ENTROPY_THRESHOLD) {
|
|
414
|
+
out.push({ pointer, layer: "entropy", rule: `High-entropy string (> ${ENTROPY_THRESHOLD} bits/char)` });
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/** A number array of key length (32 or 64 entries, each a byte) — key material stored as bytes. */
|
|
420
|
+
function isKeyLengthByteArray(node) {
|
|
421
|
+
return (node.length === 32 || node.length === 64) && node.every((n) => Number.isInteger(n) && n >= 0 && n <= 255);
|
|
422
|
+
}
|
|
423
|
+
const BYTE_ARRAY_RULE = "Byte array of key length (32/64)";
|
|
424
|
+
/** A value a credential-named field could hold: a non-empty string, a number, or a list of those. */
|
|
425
|
+
function holdsCredentialValue(value) {
|
|
426
|
+
if (typeof value === "string")
|
|
427
|
+
return value.trim() !== "";
|
|
428
|
+
if (typeof value === "number")
|
|
429
|
+
return Number.isFinite(value);
|
|
430
|
+
return Array.isArray(value) && value.length > 0 && value.every((v) => typeof v === "number" || typeof v === "string");
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Code a Blueprint must not carry (it holds references and public fields only).
|
|
434
|
+
* Checked only where free-form binding data lives, so prose like "calls the
|
|
435
|
+
* function" in a description is not mistaken for code.
|
|
436
|
+
*/
|
|
437
|
+
const CODE_SHAPE = /\breturn\b[^;\n]*;|=>|\bfunction\b\s*[\w$]*\s*\(|\b(?:eval|require|Function|setTimeout|setInterval|fetch)\s*\(|<script\b|^\s*import\s|\bmodule\.exports\b/;
|
|
438
|
+
const CODE_RULE = "Code in extension field";
|
|
439
|
+
/**
|
|
440
|
+
* Scan any JSON value.
|
|
441
|
+
*
|
|
442
|
+
* Pointers are built for humans to find the problem, so they must not become
|
|
443
|
+
* the leak: an object key that itself looks like a credential is replaced by
|
|
444
|
+
* `<redacted key #i>` (i = its position among that object's keys) in its own
|
|
445
|
+
* pointer and in every pointer below it.
|
|
446
|
+
*/
|
|
447
|
+
function scanForCredentials(doc, options = {}) {
|
|
448
|
+
const isHexExempt = options.isHexExempt ?? (() => false);
|
|
449
|
+
const isCodeForbidden = options.isCodeForbidden ?? (() => false);
|
|
450
|
+
const out = [];
|
|
451
|
+
const walk = (node, pointer) => {
|
|
452
|
+
if (typeof node === "string") {
|
|
453
|
+
scanString(node, pointer, isHexExempt(pointer, node), out);
|
|
454
|
+
if (isCodeForbidden(pointer) && CODE_SHAPE.test(node))
|
|
455
|
+
out.push({ pointer, layer: "value-pattern", rule: CODE_RULE });
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (Array.isArray(node)) {
|
|
459
|
+
if (isKeyLengthByteArray(node))
|
|
460
|
+
out.push({ pointer, layer: "value-pattern", rule: BYTE_ARRAY_RULE });
|
|
461
|
+
node.forEach((item, i) => walk(item, `${pointer}/${i}`));
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if (node === null || typeof node !== "object")
|
|
465
|
+
return;
|
|
466
|
+
Object.entries(node).forEach(([key, value], index) => {
|
|
467
|
+
// Map keys (roles, schema properties, extension names) are content too.
|
|
468
|
+
const keyFindings = [];
|
|
469
|
+
scanString(key, "", false, keyFindings);
|
|
470
|
+
const isSecretKey = keyFindings.length > 0;
|
|
471
|
+
const token = isSecretKey ? `<redacted key #${index}>` : pointerToken(key);
|
|
472
|
+
const child = `${pointer}/${token}`;
|
|
473
|
+
for (const f of keyFindings)
|
|
474
|
+
out.push({ ...f, pointer: child });
|
|
475
|
+
// A key that names a credential only counts when it holds one: a schema
|
|
476
|
+
// declaring an `apiKey` parameter (an object) is not a leak.
|
|
477
|
+
if (isCredentialKeyName(key) && holdsCredentialValue(value)) {
|
|
478
|
+
out.push({ pointer: child, layer: "key-name", rule: `Credential field name ${isSecretKey ? token : `'${key}'`}` });
|
|
479
|
+
}
|
|
480
|
+
walk(value, child);
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
walk(doc, "");
|
|
484
|
+
const seen = new Set();
|
|
485
|
+
return out.filter((f) => {
|
|
486
|
+
const id = `${f.pointer}\u0000${f.layer}\u0000${f.rule}`;
|
|
487
|
+
if (seen.has(id))
|
|
488
|
+
return false;
|
|
489
|
+
seen.add(id);
|
|
490
|
+
return true;
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
const GENES_GENE_ID = /^\/snapshot\/genes\/\d+\/geneId$/;
|
|
494
|
+
const EXCLUDED_GENE_ID = /^\/capabilities\/[^/]+\/excludeGeneIds\/\d+$/;
|
|
495
|
+
const COMPOSITION_GENE_ID = /^\/snapshot\/composition(?:\/[^/]+)*\/geneRef\/geneId$/;
|
|
496
|
+
function scanBlueprint(blueprint, options = {}) {
|
|
497
|
+
// Also called on unvalidated import input, so nothing about its shape is assumed.
|
|
498
|
+
const genes = blueprint?.snapshot?.genes;
|
|
499
|
+
const listed = new Set((Array.isArray(genes) ? genes : [])
|
|
500
|
+
.map((g) => (typeof g === "object" && g !== null ? g.geneId : undefined))
|
|
501
|
+
.filter((id) => typeof id === "string" && exports.GENE_ID_V2.test(id)));
|
|
502
|
+
return scanForCredentials(blueprint, {
|
|
503
|
+
isHexExempt: (pointer, value) => {
|
|
504
|
+
if (!exports.GENE_ID_V2.test(value))
|
|
505
|
+
return false;
|
|
506
|
+
if (GENES_GENE_ID.test(pointer) || EXCLUDED_GENE_ID.test(pointer))
|
|
507
|
+
return true;
|
|
508
|
+
return COMPOSITION_GENE_ID.test(pointer) && (options.isLeafIdCheckedStructurally || listed.has(value));
|
|
509
|
+
},
|
|
510
|
+
isCodeForbidden: (pointer) => pointer.startsWith("/bindingExtensions/"),
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
/** Build, scan, and write a Blueprint. Nothing is written when the scan finds anything. */
|
|
514
|
+
function exportGenome(input) {
|
|
515
|
+
const { blueprint, roles, notices } = buildBlueprint(input);
|
|
516
|
+
const findings = scanBlueprint(blueprint);
|
|
517
|
+
if (findings.length > 0) {
|
|
518
|
+
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);
|
|
519
|
+
}
|
|
520
|
+
(0, node_fs_1.writeFileSync)(input.output, JSON.stringify(blueprint, null, 2) + "\n");
|
|
521
|
+
return {
|
|
522
|
+
file: input.output,
|
|
523
|
+
agent: input.agent.name,
|
|
524
|
+
composition: compositionTypeOf(input.agent),
|
|
525
|
+
geneCount: blueprint.snapshot.genes.length,
|
|
526
|
+
mode: blueprint.capabilities ? "capability" : "lock",
|
|
527
|
+
roles,
|
|
528
|
+
notices,
|
|
529
|
+
credentialScan: { passed: true, layers: ["key-name", "value-pattern", "entropy"] },
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
function parseNumberOption(flag, raw) {
|
|
533
|
+
if (raw === undefined)
|
|
534
|
+
return undefined;
|
|
535
|
+
const n = Number(raw);
|
|
536
|
+
if (raw.trim() === "" || !Number.isFinite(n))
|
|
537
|
+
throw new GenomeExportError(`${flag} must be a number, got '${raw}'`);
|
|
538
|
+
return n;
|
|
539
|
+
}
|
|
540
|
+
function reportFailure(err) {
|
|
541
|
+
if (display.isJsonMode()) {
|
|
542
|
+
process.stdout.write(JSON.stringify({ ok: false, error: err.message, hint: err.hint, findings: err.findings }, null, 2) + "\n");
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
display.error(err.message, err.hint);
|
|
546
|
+
for (const f of err.findings ?? []) {
|
|
547
|
+
console.error(` ${f.pointer || "/"} [${f.layer}] ${f.rule}`);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
/** Run `genome export`; returns the process exit code. */
|
|
551
|
+
function runGenomeExport(agentRef, options, ctx) {
|
|
552
|
+
try {
|
|
553
|
+
const agent = findAgent(ctx.root, agentRef);
|
|
554
|
+
const output = (0, node_path_1.resolve)(options.output ?? `${agent.name}.rgenome`);
|
|
555
|
+
const result = exportGenome({
|
|
556
|
+
root: ctx.root,
|
|
557
|
+
genesDir: ctx.genesDir,
|
|
558
|
+
agent,
|
|
559
|
+
lock: options.lock,
|
|
560
|
+
minFitness: parseNumberOption("--min-fitness", options.minFitness),
|
|
561
|
+
minVg: parseNumberOption("--min-vg", options.minVg),
|
|
562
|
+
description: options.description,
|
|
563
|
+
author: ctx.author,
|
|
564
|
+
output,
|
|
565
|
+
});
|
|
566
|
+
display.renderResult({ ok: true, ...result }, (r) => {
|
|
567
|
+
display.header("Genome Export");
|
|
568
|
+
display.keyValue("Agent", r.agent);
|
|
569
|
+
display.keyValue("Composition", r.composition);
|
|
570
|
+
display.keyValue("Mode", r.mode === "lock" ? "lock (gene IDs only)" : "capability + gene IDs");
|
|
571
|
+
for (const role of r.roles) {
|
|
572
|
+
display.keyValue(` ${role.role}`, `${role.geneId} ${role.fidelity}${role.hasHints ? "" : " (no Registry hints)"}`);
|
|
573
|
+
}
|
|
574
|
+
for (const n of r.notices)
|
|
575
|
+
display.warn(n);
|
|
576
|
+
display.success("Credential scan passed (key names, value patterns, entropy)");
|
|
577
|
+
display.success(`Wrote ${r.file}`);
|
|
578
|
+
});
|
|
579
|
+
return 0;
|
|
580
|
+
}
|
|
581
|
+
catch (err) {
|
|
582
|
+
if (err instanceof GenomeExportError) {
|
|
583
|
+
reportFailure(err);
|
|
584
|
+
return 1;
|
|
585
|
+
}
|
|
586
|
+
throw err;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
const genomeExportCommand = new commander_1.Command("export")
|
|
590
|
+
.description("Export an agent's genome as a shareable Blueprint (.rgenome)")
|
|
591
|
+
.argument("<agent>", "agent name or id")
|
|
592
|
+
.option("-o, --output <file>", "output file (default: <agent>.rgenome)")
|
|
593
|
+
.option("--lock", "reference genes by ID only; write no capability queries")
|
|
594
|
+
.option("--min-fitness <n>", `minimum fitness in each capability query (default: ${exports.DEFAULT_MIN_FITNESS})`)
|
|
595
|
+
.option("--min-vg <n>", `suggested minimum V(g) for importers, in [${exports.MIN_VG_FLOOR}, 1.0)`)
|
|
596
|
+
.option("-d, --description <text>", "description stored in the Blueprint metadata")
|
|
597
|
+
.action((agentRef, options) => {
|
|
598
|
+
const root = (0, project_root_js_1.requireProjectRoot)();
|
|
599
|
+
const config = (0, config_js_1.loadConfig)(root);
|
|
600
|
+
const author = (0, auth_js_1.loadCredentials)()?.user?.username;
|
|
601
|
+
process.exitCode = runGenomeExport(agentRef, options, { root, genesDir: config.genes_dir, author });
|
|
602
|
+
});
|
|
603
|
+
exports.genomeCommand = new commander_1.Command("genome")
|
|
604
|
+
.description("Genome Blueprint commands: export an agent's genome, import one")
|
|
605
|
+
.addCommand(genomeExportCommand);
|
|
606
|
+
//# sourceMappingURL=genome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genome.js","sourceRoot":"","sources":["../../src/commands/genome.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwHA,8BAoBC;AAuBD,8CAIC;AAeD,4CAgDC;AA8CD,wCAoIC;AAiFD,wCAUC;AA0ED,gDA6CC;AAyBD,sCAgBC;AAoBD,oCAwBC;AAiCD,0CAwCC;AAxwBD,yCAAoC;AACpC,qCAA+E;AAC/E,yCAA0C;AAC1C,6DAA+C;AAC/C,kDAAgD;AAChD,8DAA8D;AAC9D,oDAA+C;AAC/C,0EAAkE;AAClE,8CAAmD;AACnD,0EAAqE;AAGrE,gEAAgE;AAChE,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,yEAAyE;AAEzE,iEAAiE;AACpD,QAAA,gBAAgB,GAAG,CAAC,CAAC;AAElC,mEAAmE;AACtD,QAAA,0BAA0B,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC;AAEpF,6EAA6E;AAChE,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAEvC,0CAA0C;AAC7B,QAAA,YAAY,GAAG,GAAG,CAAC;AAEhC,6EAA6E;AAChE,QAAA,YAAY,GAAG,oBAAoB,CAAC;AAEpC,QAAA,UAAU,GAAG,mBAAmB,CAAC;AAyE9C,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,gEA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