@rotifer/playground 0.25.1 → 0.26.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/README.zh.md +1 -1
  4. package/dist/commands/arena-submit.d.ts.map +1 -1
  5. package/dist/commands/arena-submit.js +2 -57
  6. package/dist/commands/arena-submit.js.map +1 -1
  7. package/dist/commands/compile.d.ts.map +1 -1
  8. package/dist/commands/compile.js +22 -0
  9. package/dist/commands/compile.js.map +1 -1
  10. package/dist/commands/install.d.ts.map +1 -1
  11. package/dist/commands/install.js +18 -0
  12. package/dist/commands/install.js.map +1 -1
  13. package/dist/commands/publish.d.ts.map +1 -1
  14. package/dist/commands/publish.js +49 -0
  15. package/dist/commands/publish.js.map +1 -1
  16. package/dist/commands/test.d.ts.map +1 -1
  17. package/dist/commands/test.js +164 -0
  18. package/dist/commands/test.js.map +1 -1
  19. package/dist/scanner/rules.d.ts.map +1 -1
  20. package/dist/scanner/rules.js +14 -4
  21. package/dist/scanner/rules.js.map +1 -1
  22. package/dist/testsuite/gate.d.ts +82 -0
  23. package/dist/testsuite/gate.d.ts.map +1 -0
  24. package/dist/testsuite/gate.js +179 -0
  25. package/dist/testsuite/gate.js.map +1 -0
  26. package/dist/testsuite/generate.d.ts +12 -0
  27. package/dist/testsuite/generate.d.ts.map +1 -0
  28. package/dist/testsuite/generate.js +70 -0
  29. package/dist/testsuite/generate.js.map +1 -0
  30. package/dist/testsuite/load.d.ts +23 -0
  31. package/dist/testsuite/load.d.ts.map +1 -0
  32. package/dist/testsuite/load.js +121 -0
  33. package/dist/testsuite/load.js.map +1 -0
  34. package/dist/testsuite/run.d.ts +109 -0
  35. package/dist/testsuite/run.d.ts.map +1 -0
  36. package/dist/testsuite/run.js +298 -0
  37. package/dist/testsuite/run.js.map +1 -0
  38. package/dist/testsuite/scaffold.d.ts +20 -0
  39. package/dist/testsuite/scaffold.d.ts.map +1 -0
  40. package/dist/testsuite/scaffold.js +146 -0
  41. package/dist/testsuite/scaffold.js.map +1 -0
  42. package/dist/testsuite/types.d.ts +67 -0
  43. package/dist/testsuite/types.d.ts.map +1 -0
  44. package/dist/testsuite/types.js +19 -0
  45. package/dist/testsuite/types.js.map +1 -0
  46. package/dist/utils/artifact-consistency.d.ts +37 -0
  47. package/dist/utils/artifact-consistency.d.ts.map +1 -0
  48. package/dist/utils/artifact-consistency.js +43 -0
  49. package/dist/utils/artifact-consistency.js.map +1 -0
  50. package/genes/genesis-code-format/.cloud-manifest.json +4 -4
  51. package/genes/genesis-code-format/index.ts +24 -6
  52. package/genes/genesis-code-format/phenotype.json +36 -7
  53. package/genes/genesis-code-format/testsuite.json +25 -0
  54. package/genes/genesis-file-read/.cloud-manifest.json +4 -4
  55. package/genes/genesis-file-read/index.ts +21 -2
  56. package/genes/genesis-file-read/phenotype.json +32 -8
  57. package/genes/genesis-file-read/testsuite.json +41 -0
  58. package/genes/genesis-web-search/.cloud-manifest.json +4 -4
  59. package/genes/genesis-web-search/index.ts +23 -4
  60. package/genes/genesis-web-search/phenotype.json +36 -9
  61. package/genes/genesis-web-search/testsuite.json +82 -0
  62. package/genes/genesis-web-search-lite/.cloud-manifest.json +4 -4
  63. package/genes/genesis-web-search-lite/index.ts +14 -2
  64. package/genes/genesis-web-search-lite/phenotype.json +21 -5
  65. package/genes/genesis-web-search-lite/testsuite.json +24 -0
  66. package/package.json +12 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/testsuite/run.ts"],"names":[],"mappings":";;;;;;AAgDA,4BA8BC;AAqDD,kCAgDC;AA+BD,kCAuDC;AAYD,kCAuCC;AAeD,sBAkEC;AAGD,oCAEC;AAlZD,8CAAsB;AAEtB,6CAAyC;AAOzC,+CAAkD;AAElD,2EAA2E;AAC9D,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAuB1C;;;;;;;;;;;;GAYG;AACH,SAA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AW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IACjF,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEvB,MAAM,kBAAkB,GAAG,UAAU,CAAC,IAAI,CACxC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CACrD,CAAC;IACF,MAAM,kBAAkB,GAAG,UAAU,CAAC,IAAI,CACxC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CACrD,CAAC;IAEF,MAAM,YAAY,GAAG;QACnB,QAAQ,EAAE,kBAAkB;QAC5B,QAAQ,EAAE,kBAAkB;QAC5B,QAAQ,EAAE,QAAQ,CAAC,MAAM;KAC1B,CAAC;IAEF,sEAAsE;IACtE,4EAA4E;IAC5E,8EAA8E;IAC9E,8EAA8E;IAC9E,yDAAyD;IACzD,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAEtD,OAAO;QACL,OAAO;QACP,UAAU;QACV,YAAY;QACZ,UAAU,EACR,YAAY,CAAC,QAAQ;YACrB,YAAY,CAAC,QAAQ;YACrB,YAAY,CAAC,QAAQ;YACrB,CAAC,cAAc;KAClB,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,SAAgB,YAAY;IAC1B,OAAO,IAAA,wBAAU,GAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { TestSuite } from "./types.js";
2
+ interface ScaffoldNote {
3
+ /** Which §47.5 requirement this case is there to satisfy. */
4
+ requirement: "positive" | "negative";
5
+ /** Why this input is legal or illegal, for the comment block. */
6
+ rationale: string;
7
+ }
8
+ export interface ScaffoldResult {
9
+ suite: TestSuite;
10
+ notes: ScaffoldNote[];
11
+ /** Cases the generator meant to be illegal but could not make illegal —
12
+ * see makeIllegalInputs. Empty is the normal case. */
13
+ warnings: string[];
14
+ }
15
+ export declare function scaffoldTestSuite(phenotype: {
16
+ inputSchema?: unknown;
17
+ outputSchema?: unknown;
18
+ }): ScaffoldResult;
19
+ export {};
20
+ //# sourceMappingURL=scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/testsuite/scaffold.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,YAAY,CAAC;AAmBtD,UAAU,YAAY;IACpB,6DAA6D;IAC7D,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IACrC,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB;0DACsD;IACtD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAiED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,cAAc,CA4EjB"}
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.scaffoldTestSuite = scaffoldTestSuite;
7
+ const ajv_1 = __importDefault(require("ajv"));
8
+ const generate_js_1 = require("./generate.js");
9
+ const run_js_1 = require("./run.js");
10
+ /**
11
+ * §47.3 Phenotype-driven scaffolding, aimed at §47.5's shape.
12
+ *
13
+ * This exists because 2.1 turns §47.5 into a publishing gate, and a gate with
14
+ * no exit teaches people to route around it. Being told "you need a negative
15
+ * case" is only actionable if something can write the first one for you.
16
+ *
17
+ * What it cannot do is make a Gene correct. A scaffolded suite is a starting
18
+ * point whose assertions the author still has to mean — the generated negative
19
+ * cases in particular encode a guess about what rejection should look like, and
20
+ * that guess is left blank on purpose (see below).
21
+ */
22
+ const SCAFFOLD_SEED = 1;
23
+ /**
24
+ * Build inputs that the Gene's own inputSchema rejects.
25
+ *
26
+ * Each strategy targets a different way a caller gets it wrong, because a
27
+ * negative case that only ever tests one of them proves little:
28
+ *
29
+ * - a required field missing entirely
30
+ * - a field present with the wrong type
31
+ * - an empty object, the degenerate call
32
+ *
33
+ * Every candidate is then run through the validator before being kept. A
34
+ * "negative" case whose input the schema happens to accept is silently a
35
+ * positive case — classify() would file it as one, the suite would look like it
36
+ * covers §47.5 while covering half of it, and nothing would say so.
37
+ */
38
+ function makeIllegalInputs(inputSchema, isIllegal) {
39
+ const inputs = [];
40
+ const warnings = [];
41
+ const candidates = [];
42
+ const properties = (inputSchema?.properties ?? {});
43
+ const required = (inputSchema?.required ?? []);
44
+ const legal = (0, generate_js_1.generateTestInput)(inputSchema, SCAFFOLD_SEED);
45
+ if (required.length > 0) {
46
+ const dropped = { ...legal };
47
+ delete dropped[required[0]];
48
+ candidates.push({
49
+ value: dropped,
50
+ rationale: `required field "${required[0]}" is missing`,
51
+ });
52
+ }
53
+ const firstTyped = Object.entries(properties).find(([, p]) => typeof p.type === "string");
54
+ if (firstTyped) {
55
+ const [key, prop] = firstTyped;
56
+ // A value of a type the field cannot hold. Numbers are wrong for
57
+ // everything except number/integer, where a string is wrong instead.
58
+ const wrong = prop.type === "number" || prop.type === "integer" ? "not-a-number" : 42;
59
+ candidates.push({
60
+ value: { ...legal, [key]: wrong },
61
+ rationale: `"${key}" is declared ${String(prop.type)} but given ${JSON.stringify(wrong)}`,
62
+ });
63
+ }
64
+ candidates.push({ value: {}, rationale: "empty object — the degenerate call" });
65
+ for (const c of candidates) {
66
+ if (isIllegal(c.value)) {
67
+ inputs.push(c);
68
+ }
69
+ else {
70
+ warnings.push(`dropped a would-be negative case (${c.rationale}): the Gene's inputSchema accepts it, ` +
71
+ `so it would have been classified as a positive case`);
72
+ }
73
+ }
74
+ return { inputs, warnings };
75
+ }
76
+ function scaffoldTestSuite(phenotype) {
77
+ const inputSchema = phenotype.inputSchema ?? null;
78
+ const outputSchema = phenotype.outputSchema ?? null;
79
+ const ajv = new ajv_1.default({ allErrors: true, strict: false });
80
+ let isIllegal = () => false;
81
+ if (inputSchema) {
82
+ try {
83
+ const validate = ajv.compile(inputSchema);
84
+ isIllegal = (v) => !validate(v);
85
+ }
86
+ catch {
87
+ isIllegal = () => false;
88
+ }
89
+ }
90
+ const testCases = [];
91
+ const notes = [];
92
+ const warnings = [];
93
+ // Positive case. It asserts against outputSchema rather than a literal
94
+ // expectedOutput: a generated literal would be whatever the Gene happens to
95
+ // return today, which is an assertion that the Gene never changes, not that
96
+ // it is right.
97
+ const legal = (0, generate_js_1.generateTestInput)(inputSchema, SCAFFOLD_SEED);
98
+ testCases.push({
99
+ input: legal,
100
+ ...(outputSchema ? { expectedSchema: outputSchema } : {}),
101
+ });
102
+ // The generator is best-effort: for nested or object-typed required fields it
103
+ // can emit something the schema rejects. Left unchecked that case is filed as
104
+ // a *negative* by classify(), and the suite ships with no positive case at
105
+ // all — measured on json-validator, whose `data` and `schema` fields the
106
+ // generator could not satisfy.
107
+ //
108
+ // Negative candidates were already verified illegal; not verifying the
109
+ // positive one was an asymmetry, and it failed in the direction that is
110
+ // harder to notice: the suite looks complete and the gate reports "positive
111
+ // NOT met" without saying the scaffold is why.
112
+ const isPositiveLegal = !isIllegal(legal);
113
+ if (!isPositiveLegal) {
114
+ warnings.push(`the generated positive input does not satisfy this Gene's inputSchema, so it will be ` +
115
+ `classified as a negative case and the suite will have no positive case — ` +
116
+ `replace testCases[0].input with one your Gene actually accepts`);
117
+ }
118
+ notes.push({
119
+ requirement: "positive",
120
+ rationale: !isPositiveLegal
121
+ ? "GENERATED INPUT IS NOT ACCEPTED BY inputSchema — replace it, see the warning below"
122
+ : outputSchema
123
+ ? "generated from inputSchema; asserts the output conforms to outputSchema"
124
+ : "generated from inputSchema; the Gene declares no outputSchema, so replace this with an expectedOutput you mean",
125
+ });
126
+ const { inputs: illegal, warnings: negativeWarnings } = makeIllegalInputs(inputSchema, isIllegal);
127
+ warnings.push(...negativeWarnings);
128
+ for (const c of illegal) {
129
+ // No expectedOutput / expectedSchema on purpose. If the Gene answers
130
+ // illegal input rather than refusing it — json-validator returning
131
+ // { valid: false } is the honest version of this — the author has to say
132
+ // what that answer should be. Guessing here would hand out a case that
133
+ // passes on whatever the Gene already does, which is not a test.
134
+ testCases.push({ input: c.value });
135
+ notes.push({ requirement: "negative", rationale: c.rationale });
136
+ }
137
+ return {
138
+ suite: {
139
+ testCases,
140
+ config: { fuzzIterations: run_js_1.DEFAULT_FUZZ_ITERATIONS, seed: SCAFFOLD_SEED },
141
+ },
142
+ notes,
143
+ warnings,
144
+ };
145
+ }
146
+ //# sourceMappingURL=scaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/testsuite/scaffold.ts"],"names":[],"mappings":";;;;;AAkGA,8CA+EC;AAjLD,8CAAsB;AAEtB,+CAAkD;AAClD,qCAAmD;AAEnD;;;;;;;;;;;GAWG;AAEH,MAAM,aAAa,GAAG,CAAC,CAAC;AAiBxB;;;;;;;;;;;;;;GAcG;AACH,SAAS,iBAAiB,CACxB,WAA2C,EAC3C,SAAkC;IAElC,MAAM,MAAM,GAA4C,EAAE,CAAC;IAC3D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,UAAU,GAA4C,EAAE,CAAC;IAE/D,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,UAAU,IAAI,EAAE,CAA4C,CAAC;IAC9F,MAAM,QAAQ,GAAG,CAAC,WAAW,EAAE,QAAQ,IAAI,EAAE,CAAa,CAAC;IAC3D,M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E,gCAAuB,EAAE,IAAI,EAAE,aAAa,EAAE;SACzE;QACD,KAAK;QACL,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * TestSuite types, spec §4.2.
3
+ *
4
+ * The field set here is the spec's struct verbatim — no additions. That is
5
+ * deliberate: §47.5 requires a publishing gate to count "at least 1 positive
6
+ * case" and "at least 1 negative case", and the obvious way to support it
7
+ * would be a `kind: "positive" | "negative"` discriminator. The spec has no
8
+ * such field, and inventing one would put a concept in the file format that
9
+ * the protocol does not define.
10
+ *
11
+ * It is not needed. §47.5 words the negative case as "gene can correctly
12
+ * handle illegal input", and legality is already decided by the gene's own
13
+ * `inputSchema`. So the classification is *derived* rather than declared —
14
+ * see classify() in ./run.ts. A gene author writes test cases; whether each
15
+ * one is positive or negative follows from the input.
16
+ */
17
+ /** spec §4.2 TestConfig */
18
+ export interface TestConfig {
19
+ /** Fuzz testing iteration count. §47.5 fixes the publishing gate at 10. */
20
+ fuzzIterations?: number;
21
+ /** Random seed, so a property run can be reproduced exactly. */
22
+ seed?: number;
23
+ }
24
+ /** spec §4.2 TestCase */
25
+ export interface TestCase {
26
+ /** Test input. MUST conform to inputSchema for a positive case. */
27
+ input: unknown;
28
+ /** Expected output, for exact matching. */
29
+ expectedOutput?: unknown;
30
+ /** Expected output Schema, for structural validation. */
31
+ expectedSchema?: Record<string, unknown>;
32
+ /** Per-case timeout, milliseconds. */
33
+ timeout?: number;
34
+ }
35
+ /** spec §4.2 TestSuite */
36
+ export interface TestSuite {
37
+ testCases: TestCase[];
38
+ config?: TestConfig;
39
+ }
40
+ /** spec §47.1 test level */
41
+ export type TestLevel = "T1" | "T2" | "T3" | "T4";
42
+ /** spec §4.2 / §47.2 TestResult */
43
+ export interface TestResult {
44
+ testId: string;
45
+ level: TestLevel;
46
+ passed: boolean;
47
+ /** Milliseconds. */
48
+ duration: number;
49
+ details?: string;
50
+ failureReason?: string;
51
+ coverageHint?: number;
52
+ }
53
+ /**
54
+ * How a case was classified, and why. Not part of the file format — this is
55
+ * produced by the runner, and exists so `rotifer test` can report which of
56
+ * §47.5's three T1 requirements a given case satisfied.
57
+ */
58
+ export type CaseKind = "positive" | "negative";
59
+ export interface ClassifiedCase {
60
+ index: number;
61
+ kind: CaseKind;
62
+ testCase: TestCase;
63
+ /** Why it landed in that bucket — shown on failure so the author can tell
64
+ * an intentionally-illegal input from an accidentally-illegal one. */
65
+ reason: string;
66
+ }
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/testsuite/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,2BAA2B;AAC3B,MAAM,WAAW,UAAU;IACzB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,yBAAyB;AACzB,MAAM,WAAW,QAAQ;IACvB,mEAAmE;IACnE,KAAK,EAAE,OAAO,CAAC;IACf,2CAA2C;IAC3C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0BAA0B;AAC1B,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,4BAA4B;AAC5B,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,mCAAmC;AACnC,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB;0EACsE;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * TestSuite types, spec §4.2.
4
+ *
5
+ * The field set here is the spec's struct verbatim — no additions. That is
6
+ * deliberate: §47.5 requires a publishing gate to count "at least 1 positive
7
+ * case" and "at least 1 negative case", and the obvious way to support it
8
+ * would be a `kind: "positive" | "negative"` discriminator. The spec has no
9
+ * such field, and inventing one would put a concept in the file format that
10
+ * the protocol does not define.
11
+ *
12
+ * It is not needed. §47.5 words the negative case as "gene can correctly
13
+ * handle illegal input", and legality is already decided by the gene's own
14
+ * `inputSchema`. So the classification is *derived* rather than declared —
15
+ * see classify() in ./run.ts. A gene author writes test cases; whether each
16
+ * one is positive or negative follows from the input.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/testsuite/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Does a Gene's declared fidelity match what is actually on disk / in the
3
+ * registry record?
4
+ *
5
+ * spec §4.2 defines NATIVE as "core logic compiled to Rotifer IR". A record
6
+ * declaring Native with no artifact is therefore self-contradicting, and until
7
+ * 2026-09-07 both commands that meet one said nothing about it:
8
+ *
9
+ * install downloaded nothing (no else branch on `if (gene.wasm_url)`) and
10
+ * then reported "Gene installed! Fidelity: Native" — for a Gene that
11
+ * answers `rotifer run` with "No runnable source found".
12
+ * compile wrote `.compile-result.json` with `fidelity: "Wrapped"` while
13
+ * leaving phenotype.json saying Native, and reported *success*:
14
+ * "validated (Wrapped fidelity)". Two files in one directory
15
+ * disagreeing, and a green tick over a Gene that cannot run.
16
+ *
17
+ * The judgement lives here, apart from the commands, so it can be tested
18
+ * without a network or a compiler.
19
+ */
20
+ export type ArtifactVerdict = {
21
+ status: "consistent";
22
+ }
23
+ /** Declared Native, nothing to run. The Gene cannot do what it claims. */
24
+ | {
25
+ status: "native-without-artifact";
26
+ message: string;
27
+ hint: string[];
28
+ };
29
+ export declare function checkNativeArtifact(input: {
30
+ geneName: string;
31
+ fidelity: string | undefined;
32
+ /** A compiled artifact is present (installed .wasm, or a registry wasm_url). */
33
+ hasArtifact: boolean;
34
+ /** Source is present, so the Gene can still be compiled locally. */
35
+ hasSource: boolean;
36
+ }): ArtifactVerdict;
37
+ //# sourceMappingURL=artifact-consistency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-consistency.d.ts","sourceRoot":"","sources":["../../src/utils/artifact-consistency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE;AAC1B,0EAA0E;GACxE;IAAE,MAAM,EAAE,yBAAyB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB,oEAAoE;IACpE,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,eAAe,CAmBlB"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * Does a Gene's declared fidelity match what is actually on disk / in the
4
+ * registry record?
5
+ *
6
+ * spec §4.2 defines NATIVE as "core logic compiled to Rotifer IR". A record
7
+ * declaring Native with no artifact is therefore self-contradicting, and until
8
+ * 2026-09-07 both commands that meet one said nothing about it:
9
+ *
10
+ * install downloaded nothing (no else branch on `if (gene.wasm_url)`) and
11
+ * then reported "Gene installed! Fidelity: Native" — for a Gene that
12
+ * answers `rotifer run` with "No runnable source found".
13
+ * compile wrote `.compile-result.json` with `fidelity: "Wrapped"` while
14
+ * leaving phenotype.json saying Native, and reported *success*:
15
+ * "validated (Wrapped fidelity)". Two files in one directory
16
+ * disagreeing, and a green tick over a Gene that cannot run.
17
+ *
18
+ * The judgement lives here, apart from the commands, so it can be tested
19
+ * without a network or a compiler.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.checkNativeArtifact = checkNativeArtifact;
23
+ function checkNativeArtifact(input) {
24
+ if (input.fidelity !== "Native")
25
+ return { status: "consistent" };
26
+ if (input.hasArtifact)
27
+ return { status: "consistent" };
28
+ // Source but no artifact is a normal working state — it compiles into one.
29
+ // Only the case with neither is a Gene that claims Native and cannot be.
30
+ if (input.hasSource)
31
+ return { status: "consistent" };
32
+ return {
33
+ status: "native-without-artifact",
34
+ message: `'${input.geneName}' declares fidelity Native but ships no compiled artifact. ` +
35
+ `spec §4.2 defines Native as core logic compiled to Rotifer IR, so this Gene ` +
36
+ `cannot run: 'rotifer run ${input.geneName}' will report "No runnable source found".`,
37
+ hint: [
38
+ `This is the Gene's own defect, not your setup — nothing you can configure fixes it.`,
39
+ `Ask its author to republish with the artifact, or pick another Gene.`,
40
+ ],
41
+ };
42
+ }
43
+ //# sourceMappingURL=artifact-consistency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-consistency.js","sourceRoot":"","sources":["../../src/utils/artifact-consistency.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;AAOH,kDA0BC;AA1BD,SAAgB,mBAAmB,CAAC,KAOnC;IACC,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IACjE,IAAI,KAAK,CAAC,WAAW;QAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvD,2EAA2E;IAC3E,yEAAyE;IACzE,IAAI,KAAK,CAAC,SAAS;QAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IAErD,OAAO;QACL,MAAM,EAAE,yBAAyB;QACjC,OAAO,EACL,IAAI,KAAK,CAAC,QAAQ,6DAA6D;YAC/E,8EAA8E;YAC9E,4BAA4B,KAAK,CAAC,QAAQ,2CAA2C;QACvF,IAAI,EAAE;YACJ,qFAAqF;YACrF,sEAAsE;SACvE;KACF,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
- "cloud_id": "68bf602d-1495-4a13-9165-0f6edaf16352",
3
- "owner": "Rotifer Protocol",
4
- "version": "0.1.0",
5
- "published_at": "2026-03-17T14:12:49.078Z"
2
+ "cloud_id": "27903d83-b263-4eb4-acb4-67a2695b51dd",
3
+ "owner": "xiaoba-dev",
4
+ "version": "0.2.0",
5
+ "published_at": "2026-09-08T15:40:25.013Z"
6
6
  }
@@ -15,19 +15,37 @@ interface CodeFormatOutput {
15
15
  * Formats source code. MVP uses simple heuristic formatting.
16
16
  * Production binding would delegate to prettier/rustfmt/etc.
17
17
  */
18
+ const LANGUAGES = ["typescript", "javascript", "json", "markdown", "rust"] as const;
19
+
18
20
  export function express(input: CodeFormatInput): CodeFormatOutput {
21
+ // `input.code` went straight into .replace(), so anything that was not a
22
+ // string threw — all three illegal shapes crashed this Gene rather than
23
+ // producing an answer. The schema declares the type, so a value of another
24
+ // type is treated as a missing one.
25
+ const rawCode: unknown = input.code;
26
+ const code = typeof rawCode === "string" ? rawCode : "";
27
+
28
+ // `language` was echoed into the output unchecked, so a value outside the
29
+ // declared enum came back out as if the Gene had recognised it. It did not:
30
+ // an unrecognised language falls through to the generic whitespace pass, and
31
+ // the output should say so rather than repeat what it was handed.
32
+ const rawLanguage: unknown = input.language;
33
+ const language = (LANGUAGES as readonly unknown[]).includes(rawLanguage)
34
+ ? (rawLanguage as string)
35
+ : "unknown";
36
+
19
37
  let formatted: string;
20
38
 
21
- switch (input.language) {
39
+ switch (language) {
22
40
  case "json":
23
41
  try {
24
- formatted = JSON.stringify(JSON.parse(input.code), null, 2);
42
+ formatted = JSON.stringify(JSON.parse(code), null, 2);
25
43
  } catch {
26
- formatted = input.code;
44
+ formatted = code;
27
45
  }
28
46
  break;
29
47
  default:
30
- formatted = input.code
48
+ formatted = code
31
49
  .replace(/\t/g, " ")
32
50
  .replace(/[ \t]+$/gm, "")
33
51
  .replace(/\n{3,}/g, "\n\n");
@@ -36,7 +54,7 @@ export function express(input: CodeFormatInput): CodeFormatOutput {
36
54
 
37
55
  return {
38
56
  formatted,
39
- changed: formatted !== input.code,
40
- language: input.language,
57
+ changed: formatted !== code,
58
+ language,
41
59
  };
42
60
  }
@@ -4,17 +4,39 @@
4
4
  "inputSchema": {
5
5
  "type": "object",
6
6
  "properties": {
7
- "code": { "type": "string", "description": "Source code to format" },
8
- "language": { "type": "string", "description": "Programming language", "enum": ["typescript", "javascript", "json", "markdown", "rust"] }
7
+ "code": {
8
+ "type": "string",
9
+ "description": "Source code to format"
10
+ },
11
+ "language": {
12
+ "type": "string",
13
+ "description": "Programming language",
14
+ "enum": [
15
+ "typescript",
16
+ "javascript",
17
+ "json",
18
+ "markdown",
19
+ "rust"
20
+ ]
21
+ }
9
22
  },
10
- "required": ["code", "language"]
23
+ "required": [
24
+ "code",
25
+ "language"
26
+ ]
11
27
  },
12
28
  "outputSchema": {
13
29
  "type": "object",
14
30
  "properties": {
15
- "formatted": { "type": "string" },
16
- "changed": { "type": "boolean" },
17
- "language": { "type": "string" }
31
+ "formatted": {
32
+ "type": "string"
33
+ },
34
+ "changed": {
35
+ "type": "boolean"
36
+ },
37
+ "language": {
38
+ "type": "string"
39
+ }
18
40
  }
19
41
  },
20
42
  "dependencies": [],
@@ -27,5 +49,12 @@
27
49
  "concurrencyModel": "Stateless",
28
50
  "failureSemantics": "FAIL_FAST"
29
51
  },
30
- "tags": ["formatter", "prettier", "typescript", "rust", "genesis"]
52
+ "tags": [
53
+ "formatter",
54
+ "prettier",
55
+ "typescript",
56
+ "rust",
57
+ "genesis"
58
+ ],
59
+ "irHash": "1250405b99303f13211fde6df73f75b19ea933b3b800b76711008eafa8933a9b"
31
60
  }
@@ -0,0 +1,25 @@
1
+ {
2
+ "testCases": [
3
+ {
4
+ "input": { "code": "{\"b\":2,\"a\":1}", "language": "json" },
5
+ "expectedOutput": {
6
+ "formatted": "{\n \"b\": 2,\n \"a\": 1\n}",
7
+ "changed": true,
8
+ "language": "json"
9
+ }
10
+ },
11
+ {
12
+ "input": { "code": 42, "language": "json" },
13
+ "expectedOutput": { "formatted": "", "changed": false, "language": "json" }
14
+ },
15
+ {
16
+ "input": { "language": "json" },
17
+ "expectedOutput": { "formatted": "", "changed": false, "language": "json" }
18
+ },
19
+ {
20
+ "input": {},
21
+ "expectedOutput": { "formatted": "", "changed": false, "language": "unknown" }
22
+ }
23
+ ],
24
+ "config": { "fuzzIterations": 10, "seed": 1 }
25
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
- "cloud_id": "59edda66-9df0-4b62-83f5-c2db1975a541",
3
- "owner": "Rotifer Protocol",
4
- "version": "0.1.0",
5
- "published_at": "2026-03-17T14:12:50.917Z"
2
+ "cloud_id": "948ba7e7-3f7b-42c0-9b25-ec1abf6cefae",
3
+ "owner": "xiaoba-dev",
4
+ "version": "0.2.0",
5
+ "published_at": "2026-09-08T15:37:52.362Z"
6
6
  }
@@ -18,11 +18,30 @@ interface FileReadOutput {
18
18
  * Restricted by L0 sandbox constraints (path allowlist).
19
19
  */
20
20
  export function express(input: FileReadInput): FileReadOutput {
21
- const encoding = input.encoding ?? "utf-8";
21
+ // The schema declares encoding as an enum, so a value outside it is not a
22
+ // third choice — fall back to the documented default rather than passing it
23
+ // to Buffer.toString(), which would throw on an unknown encoding.
24
+ const rawEncoding: unknown = input.encoding;
25
+ const encoding = rawEncoding === "base64" ? "base64" : "utf-8";
26
+
27
+ // readFileSync accepts a number as a *file descriptor*, so `{"path": 42}`
28
+ // did not fail as a bad path — it attempted to read whatever fd 42 happened
29
+ // to be, and reported EBADF only because that one was closed. A caller
30
+ // choosing the number gets to choose the descriptor, which is not a path
31
+ // read at all. The type check has to happen before the call, not inside the
32
+ // catch: by then the read has already been attempted.
33
+ const rawPath: unknown = input.path;
34
+ if (typeof rawPath !== "string" || rawPath === "") {
35
+ return {
36
+ content: "[error] INVALID_PATH: path must be a non-empty string",
37
+ size: 0,
38
+ encoding,
39
+ };
40
+ }
22
41
 
23
42
  let buffer: Buffer;
24
43
  try {
25
- buffer = readFileSync(input.path);
44
+ buffer = readFileSync(rawPath);
26
45
  } catch (err: any) {
27
46
  return {
28
47
  content: `[error] ${err.code ?? "UNKNOWN"}: ${err.message}`,
@@ -4,28 +4,52 @@
4
4
  "inputSchema": {
5
5
  "type": "object",
6
6
  "properties": {
7
- "path": { "type": "string", "description": "File path to read" },
8
- "encoding": { "type": "string", "default": "utf-8", "enum": ["utf-8", "base64"] }
7
+ "path": {
8
+ "type": "string",
9
+ "description": "File path to read"
10
+ },
11
+ "encoding": {
12
+ "type": "string",
13
+ "default": "utf-8",
14
+ "enum": [
15
+ "utf-8",
16
+ "base64"
17
+ ]
18
+ }
9
19
  },
10
- "required": ["path"]
20
+ "required": [
21
+ "path"
22
+ ]
11
23
  },
12
24
  "outputSchema": {
13
25
  "type": "object",
14
26
  "properties": {
15
- "content": { "type": "string" },
16
- "size": { "type": "integer" },
17
- "encoding": { "type": "string" }
27
+ "content": {
28
+ "type": "string"
29
+ },
30
+ "size": {
31
+ "type": "integer"
32
+ },
33
+ "encoding": {
34
+ "type": "string"
35
+ }
18
36
  }
19
37
  },
20
38
  "dependencies": [],
21
39
  "version": "0.2.0",
22
40
  "author": "rotifer-genesis",
23
- "fidelity": "Native",
41
+ "fidelity": "Wrapped",
24
42
  "transparency": "Open",
25
43
  "semanticRequirements": {
26
44
  "timeModel": "Sync",
27
45
  "concurrencyModel": "Stateless",
28
46
  "failureSemantics": "FAIL_FAST"
29
47
  },
30
- "tags": ["file-io", "encoding", "base64", "local-files", "genesis"]
48
+ "tags": [
49
+ "file-io",
50
+ "encoding",
51
+ "base64",
52
+ "local-files",
53
+ "genesis"
54
+ ]
31
55
  }