@rotifer/playground 0.8.6 → 0.9.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 (102) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +16 -18
  3. package/README.zh.md +15 -17
  4. package/dist/cloud/auth.d.ts +14 -4
  5. package/dist/cloud/auth.d.ts.map +1 -1
  6. package/dist/cloud/auth.js +19 -7
  7. package/dist/cloud/auth.js.map +1 -1
  8. package/dist/cloud/badge.d.ts +42 -0
  9. package/dist/cloud/badge.d.ts.map +1 -0
  10. package/dist/cloud/badge.js +67 -0
  11. package/dist/cloud/badge.js.map +1 -0
  12. package/dist/cloud/client.d.ts +14 -0
  13. package/dist/cloud/client.d.ts.map +1 -1
  14. package/dist/cloud/client.js +54 -13
  15. package/dist/cloud/client.js.map +1 -1
  16. package/dist/cloud/gene-ref.d.ts +41 -0
  17. package/dist/cloud/gene-ref.d.ts.map +1 -0
  18. package/dist/cloud/gene-ref.js +45 -0
  19. package/dist/cloud/gene-ref.js.map +1 -0
  20. package/dist/cloud/index.d.ts +1 -0
  21. package/dist/cloud/index.d.ts.map +1 -1
  22. package/dist/cloud/index.js +1 -0
  23. package/dist/cloud/index.js.map +1 -1
  24. package/dist/cloud/types.d.ts +2 -0
  25. package/dist/cloud/types.d.ts.map +1 -1
  26. package/dist/cloud/types.js +2 -1
  27. package/dist/cloud/types.js.map +1 -1
  28. package/dist/commands/agent-list.d.ts.map +1 -1
  29. package/dist/commands/agent-list.js +8 -1
  30. package/dist/commands/agent-list.js.map +1 -1
  31. package/dist/commands/compile.d.ts.map +1 -1
  32. package/dist/commands/compile.js +21 -5
  33. package/dist/commands/compile.js.map +1 -1
  34. package/dist/commands/doctor.d.ts +3 -0
  35. package/dist/commands/doctor.d.ts.map +1 -0
  36. package/dist/commands/doctor.js +58 -0
  37. package/dist/commands/doctor.js.map +1 -0
  38. package/dist/commands/hello.d.ts.map +1 -1
  39. package/dist/commands/hello.js +45 -6
  40. package/dist/commands/hello.js.map +1 -1
  41. package/dist/commands/init.d.ts.map +1 -1
  42. package/dist/commands/init.js +11 -9
  43. package/dist/commands/init.js.map +1 -1
  44. package/dist/commands/list.js +3 -3
  45. package/dist/commands/list.js.map +1 -1
  46. package/dist/commands/network.d.ts.map +1 -1
  47. package/dist/commands/network.js +172 -64
  48. package/dist/commands/network.js.map +1 -1
  49. package/dist/commands/publish.d.ts.map +1 -1
  50. package/dist/commands/publish.js +47 -0
  51. package/dist/commands/publish.js.map +1 -1
  52. package/dist/commands/reputation.d.ts.map +1 -1
  53. package/dist/commands/reputation.js +51 -10
  54. package/dist/commands/reputation.js.map +1 -1
  55. package/dist/commands/run.d.ts.map +1 -1
  56. package/dist/commands/run.js +7 -1
  57. package/dist/commands/run.js.map +1 -1
  58. package/dist/commands/user-config.js +2 -2
  59. package/dist/commands/user-config.js.map +1 -1
  60. package/dist/commands/versions.d.ts.map +1 -1
  61. package/dist/commands/versions.js +34 -3
  62. package/dist/commands/versions.js.map +1 -1
  63. package/dist/commands/vg.d.ts.map +1 -1
  64. package/dist/commands/vg.js +7 -25
  65. package/dist/commands/vg.js.map +1 -1
  66. package/dist/commands/whoami.d.ts.map +1 -1
  67. package/dist/commands/whoami.js +7 -1
  68. package/dist/commands/whoami.js.map +1 -1
  69. package/dist/commands/wrap.d.ts.map +1 -1
  70. package/dist/commands/wrap.js +25 -2
  71. package/dist/commands/wrap.js.map +1 -1
  72. package/dist/index.js +2 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/types/phenotype.d.ts +181 -0
  75. package/dist/types/phenotype.d.ts.map +1 -0
  76. package/dist/types/phenotype.js +87 -0
  77. package/dist/types/phenotype.js.map +1 -0
  78. package/dist/utils/binding.d.ts +28 -4
  79. package/dist/utils/binding.d.ts.map +1 -1
  80. package/dist/utils/binding.js +34 -12
  81. package/dist/utils/binding.js.map +1 -1
  82. package/dist/utils/config.js +1 -1
  83. package/dist/utils/config.js.map +1 -1
  84. package/dist/utils/javy-compiler.d.ts +32 -1
  85. package/dist/utils/javy-compiler.d.ts.map +1 -1
  86. package/dist/utils/javy-compiler.js +136 -12
  87. package/dist/utils/javy-compiler.js.map +1 -1
  88. package/dist/utils/p2p-daemon.d.ts +30 -0
  89. package/dist/utils/p2p-daemon.d.ts.map +1 -0
  90. package/dist/utils/p2p-daemon.js +199 -0
  91. package/dist/utils/p2p-daemon.js.map +1 -0
  92. package/dist/utils/phenotype-validator.d.ts.map +1 -1
  93. package/dist/utils/phenotype-validator.js +197 -2
  94. package/dist/utils/phenotype-validator.js.map +1 -1
  95. package/dist/utils/project-root.js +1 -1
  96. package/dist/utils/project-root.js.map +1 -1
  97. package/dist/utils/user-config.d.ts +2 -0
  98. package/dist/utils/user-config.d.ts.map +1 -1
  99. package/dist/utils/user-config.js +12 -2
  100. package/dist/utils/user-config.js.map +1 -1
  101. package/package.json +13 -10
  102. package/scripts/postinstall.js +1 -1
@@ -0,0 +1,181 @@
1
+ /**
2
+ * Phenotype type definitions — v0.9.1 §3.3 (ADR-253 D4.4 + ADR-277 D7 L3).
3
+ *
4
+ * Single source of truth for Phenotype field schemas in TypeScript. The
5
+ * runtime validator (`utils/phenotype-validator.ts`) imports the const
6
+ * arrays from here so the enum surface stays in sync between type-check
7
+ * time and runtime validation.
8
+ *
9
+ * Spec alignment: §4.2 RotiferGeneSpec. The `executionModel` field is
10
+ * pending L2 Spec Patch (Tier 2) — track via Plan §3.3.
11
+ */
12
+ /**
13
+ * Declares how a Gene is consumed at runtime.
14
+ *
15
+ * - `CHAT`: Conversational Agent (chat URL surface applies — rotifer.ai
16
+ * `/agents/[creator]/[name]` renders a chat interface).
17
+ * - `BATCH`: Synchronous function-call style invocation. Default for legacy
18
+ * v0.8.x Genes that pre-date this enum.
19
+ * - `EVENT_DRIVEN`: Triggered by external events (cron, webhook, message).
20
+ *
21
+ * Absent field is treated as `BATCH` at runtime for backward compatibility
22
+ * with pre-§3.3 published Genes.
23
+ */
24
+ export type ExecutionModel = "CHAT" | "BATCH" | "EVENT_DRIVEN";
25
+ export declare const EXECUTION_MODELS: readonly ExecutionModel[];
26
+ export type SynthesisMethod = "MANUAL" | "LLM_ASSISTED" | "LLM_AUTO" | "MUTATION" | "DE_NOVO";
27
+ export declare const SYNTHESIS_METHODS: readonly SynthesisMethod[];
28
+ export type Fidelity = "Wrapped" | "Hybrid" | "Native" | "Unknown";
29
+ /**
30
+ * Gene source-code transparency (spec §4.2 `GeneTransparency`, §10.4). Mirrors
31
+ * the Rust IR `GeneTransparency`. Spec serialises UPPERCASE; legacy PascalCase
32
+ * literals are accepted with a deprecation warning until v0.9.2 (see
33
+ * `LEGACY_GENE_TRANSPARENCIES`).
34
+ */
35
+ export type GeneTransparency = "OPEN" | "OPAQUE";
36
+ export declare const GENE_TRANSPARENCIES: readonly GeneTransparency[];
37
+ /** Pre-§3.3 PascalCase transparency literals → spec UPPERCASE. Removed v0.9.2. */
38
+ export declare const LEGACY_GENE_TRANSPARENCIES: Readonly<Record<string, GeneTransparency>>;
39
+ /**
40
+ * FIDELITY_DISCOUNT — protocol parameter (spec §5.1 v2.11).
41
+ *
42
+ * Multiplied into F(g) so that Native, Hybrid, and Wrapped genes can compete
43
+ * on a single Arena ranking without privileging external-API-shaped genes.
44
+ *
45
+ * F(g) = base_fitness × FIDELITY_DISCOUNT[gene.fidelity]
46
+ *
47
+ * Keys are the lowercase canonical form (Q2=c 2026-05-28 — case
48
+ * normalization between spec enum (UPPER) and runtime keys (lower) is
49
+ * deferred to Phase 5 / v0.9.1; current binding implementations should
50
+ * normalize via lowercasing before lookup).
51
+ *
52
+ * PAP minor adjustment: Δ ≤ 0.05 per discount tier per cycle (spec §14.6).
53
+ */
54
+ export declare const FIDELITY_DISCOUNT: Readonly<Record<string, number>>;
55
+ /**
56
+ * Semantic-layer external API dependency declaration.
57
+ *
58
+ * Complements the protocol-layer NetworkConfig — `network` declares the
59
+ * sandbox's domain whitelist + timeouts, while `externalDependencies`
60
+ * declares the *semantic* contract (what kind of service, expected SLA,
61
+ * and degradation behavior).
62
+ *
63
+ * Spec §4.2 v2.11; v0.9 plan §3.11 (A2=b decision); ADR-220 §"D-04".
64
+ */
65
+ export interface ExternalDependency {
66
+ /** Protocol family — "rest" | "graphql" | "grpc" | "websocket". */
67
+ apiType: string;
68
+ /** Semantic identifier (e.g. "cve-database", "llm-judge", "git-cli"). */
69
+ semanticTag: string;
70
+ /** Optional expected SLA. */
71
+ sla?: {
72
+ expectedLatency?: number;
73
+ expectedAvailability?: number;
74
+ };
75
+ /**
76
+ * How the gene behaves when this dependency is unreachable — the
77
+ * external-dependency axis (spec §4.2 `DegradationBehavior`), one of three
78
+ * orthogonal degradation axes (ADR-220 E2, ADR-297): external-dependency
79
+ * behavior ⊥ degradation mode (`DegradationSpec.mode`) ⊥ eventual failure
80
+ * semantics. Mirrors the Rust IR `ExternalDependencyBehavior`. The legacy
81
+ * PascalCase literals still validate with a deprecation warning through the
82
+ * v0.9.1 grace window (see `LEGACY_DEGRADATION_BEHAVIORS`; removed v0.9.2).
83
+ */
84
+ degradationBehavior: ExternalDependencyBehavior;
85
+ }
86
+ /** Spec §4.2 `DegradationBehavior` — external-dependency unreachable behavior. */
87
+ export type ExternalDependencyBehavior = "FAIL" | "FALLBACK" | "CACHE" | "SKIP";
88
+ export declare const DEGRADATION_BEHAVIORS: readonly ExternalDependencyBehavior[];
89
+ /**
90
+ * Legacy `degradationBehavior` literals (the pre-§3.3 collapsed 5-variant set)
91
+ * mapped to their spec replacement. Accepted with a deprecation warning through
92
+ * the v0.9.1 grace window; removed in v0.9.2 (ADR-297 D3 phase 4). The two
93
+ * transaction-axis values (PartialRetry / AtomicRollback) were mis-merged into
94
+ * this dependency axis and map to the closest dependency behavior.
95
+ */
96
+ export declare const LEGACY_DEGRADATION_BEHAVIORS: Readonly<Record<string, ExternalDependencyBehavior>>;
97
+ /**
98
+ * Spec §45 `FailureSemantics` — the transaction (eventual-failure) axis,
99
+ * orthogonal to `degradationBehavior`. Mirrors the Rust IR
100
+ * `EventualFailureSemantics`; enforced on the IR side (no TS phenotype field
101
+ * consumes it yet) and declared here for cross-language parity.
102
+ */
103
+ export type EventualFailureSemantics = "ATOMIC_ROLLBACK" | "PARTIAL_RETRY" | "SILENT_DEGRADE" | "FAIL_FAST";
104
+ /**
105
+ * Dry-run protocol declaration (ADR-220 T1, "Tesla mind simulation" pattern).
106
+ *
107
+ * Spec §4.2 v2.11; v0.9 plan §3.11.
108
+ */
109
+ export interface SimulationSpec {
110
+ supportsDryRun: boolean;
111
+ /** Inline expression that generates representative test input. */
112
+ syntheticInputGenerator?: string;
113
+ /** Inline expression that validates dry-run output. */
114
+ expectedOutputValidator?: string;
115
+ resourceEstimate: {
116
+ estimatedLatencyMs: number;
117
+ /** SHOULD for LLM-Native genes. */
118
+ estimatedTokens?: number;
119
+ };
120
+ }
121
+ /**
122
+ * Graceful degradation declaration (ADR-220 E2, "Euler post-blindness").
123
+ *
124
+ * Spec §4.2 v2.11; v0.9 plan §3.11.
125
+ */
126
+ export interface DegradationSpec {
127
+ mode: "FAIL_FAST" | "PARTIAL_OUTPUT" | "FALLBACK_LOGIC";
128
+ /** SHOULD for PARTIAL_OUTPUT mode — schema of degraded output. */
129
+ fallbackOutputSchema?: unknown;
130
+ /** Set of `externalDependencies[].semanticTag` values whose absence is tolerable. */
131
+ minimumDependencies: string[];
132
+ }
133
+ export declare const DEGRADATION_MODES: readonly DegradationSpec["mode"][];
134
+ export type TemplateFormat = "mustache" | "handlebars" | "jinja2" | "fstring" | "raw";
135
+ export declare const TEMPLATE_FORMATS: readonly TemplateFormat[];
136
+ export type GuardPosition = "input" | "output" | "both";
137
+ export declare const GUARD_POSITIONS: readonly GuardPosition[];
138
+ export interface LlmRequirements {
139
+ templateFormat?: TemplateFormat;
140
+ templateVariables?: string[];
141
+ }
142
+ export interface GuardConfig {
143
+ position?: GuardPosition;
144
+ categories?: string[];
145
+ riskThreshold?: number;
146
+ }
147
+ /**
148
+ * Phenotype is the metadata + behavioral declaration block of a Gene.
149
+ *
150
+ * v0.9.1 §3.3 adds `executionModel` (and forward-compat optional `systemPrompt`
151
+ * for CHAT mode) per ADR-253 D4.4 + ADR-256 D4.
152
+ *
153
+ * All fields are optional at the type level — runtime validation enforces
154
+ * which combinations are required (see `phenotype-validator.ts`).
155
+ */
156
+ export interface Phenotype {
157
+ name?: string;
158
+ domain?: string;
159
+ version?: string;
160
+ fidelity?: Fidelity;
161
+ /** Source-code transparency (spec §4.2). Optional; legacy genes lack it. */
162
+ transparency?: GeneTransparency;
163
+ description?: string;
164
+ synthesisMethod?: SynthesisMethod;
165
+ inputSchema?: unknown;
166
+ outputSchema?: unknown;
167
+ executionModel?: ExecutionModel;
168
+ /**
169
+ * Optional system prompt for CHAT mode. Consumed by the rotifer.ai chat
170
+ * surface as the Agent's initial system message. Ignored for non-CHAT
171
+ * executionModel (validator emits W0101 if set).
172
+ */
173
+ systemPrompt?: string;
174
+ llmRequirements?: LlmRequirements;
175
+ guardConfig?: GuardConfig;
176
+ externalDependencies?: ExternalDependency[];
177
+ simulationSpec?: SimulationSpec;
178
+ degradationSpec?: DegradationSpec;
179
+ [key: string]: unknown;
180
+ }
181
+ //# sourceMappingURL=phenotype.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phenotype.d.ts","sourceRoot":"","sources":["../../src/types/phenotype.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAI5C,CAAC;AAIX,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,cAAc,GACd,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAM9C,CAAC;AAIX,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAA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,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAGlC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAO1B,oBAAoB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,eAAe,CAAC,EAAE,eAAe,CAAC;IAIlC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /**
3
+ * Phenotype type definitions — v0.9.1 §3.3 (ADR-253 D4.4 + ADR-277 D7 L3).
4
+ *
5
+ * Single source of truth for Phenotype field schemas in TypeScript. The
6
+ * runtime validator (`utils/phenotype-validator.ts`) imports the const
7
+ * arrays from here so the enum surface stays in sync between type-check
8
+ * time and runtime validation.
9
+ *
10
+ * Spec alignment: §4.2 RotiferGeneSpec. The `executionModel` field is
11
+ * pending L2 Spec Patch (Tier 2) — track via Plan §3.3.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.GUARD_POSITIONS = exports.TEMPLATE_FORMATS = exports.DEGRADATION_MODES = exports.LEGACY_DEGRADATION_BEHAVIORS = exports.DEGRADATION_BEHAVIORS = exports.FIDELITY_DISCOUNT = exports.LEGACY_GENE_TRANSPARENCIES = exports.GENE_TRANSPARENCIES = exports.SYNTHESIS_METHODS = exports.EXECUTION_MODELS = void 0;
15
+ exports.EXECUTION_MODELS = [
16
+ "CHAT",
17
+ "BATCH",
18
+ "EVENT_DRIVEN",
19
+ ];
20
+ exports.SYNTHESIS_METHODS = [
21
+ "MANUAL",
22
+ "LLM_ASSISTED",
23
+ "LLM_AUTO",
24
+ "MUTATION",
25
+ "DE_NOVO",
26
+ ];
27
+ exports.GENE_TRANSPARENCIES = ["OPEN", "OPAQUE"];
28
+ /** Pre-§3.3 PascalCase transparency literals → spec UPPERCASE. Removed v0.9.2. */
29
+ exports.LEGACY_GENE_TRANSPARENCIES = Object.freeze({
30
+ Open: "OPEN",
31
+ Opaque: "OPAQUE",
32
+ });
33
+ // ─── Hybrid Fidelity (Spec §4.2 v2.11 + §3.11 v0.9 plan + ADR-220) ───────────
34
+ /**
35
+ * FIDELITY_DISCOUNT — protocol parameter (spec §5.1 v2.11).
36
+ *
37
+ * Multiplied into F(g) so that Native, Hybrid, and Wrapped genes can compete
38
+ * on a single Arena ranking without privileging external-API-shaped genes.
39
+ *
40
+ * F(g) = base_fitness × FIDELITY_DISCOUNT[gene.fidelity]
41
+ *
42
+ * Keys are the lowercase canonical form (Q2=c 2026-05-28 — case
43
+ * normalization between spec enum (UPPER) and runtime keys (lower) is
44
+ * deferred to Phase 5 / v0.9.1; current binding implementations should
45
+ * normalize via lowercasing before lookup).
46
+ *
47
+ * PAP minor adjustment: Δ ≤ 0.05 per discount tier per cycle (spec §14.6).
48
+ */
49
+ exports.FIDELITY_DISCOUNT = Object.freeze({
50
+ native: 1.0,
51
+ hybrid: 0.85,
52
+ wrapped: 0.7,
53
+ });
54
+ exports.DEGRADATION_BEHAVIORS = [
55
+ "FAIL",
56
+ "FALLBACK",
57
+ "CACHE",
58
+ "SKIP",
59
+ ];
60
+ /**
61
+ * Legacy `degradationBehavior` literals (the pre-§3.3 collapsed 5-variant set)
62
+ * mapped to their spec replacement. Accepted with a deprecation warning through
63
+ * the v0.9.1 grace window; removed in v0.9.2 (ADR-297 D3 phase 4). The two
64
+ * transaction-axis values (PartialRetry / AtomicRollback) were mis-merged into
65
+ * this dependency axis and map to the closest dependency behavior.
66
+ */
67
+ exports.LEGACY_DEGRADATION_BEHAVIORS = Object.freeze({
68
+ FailFast: "FAIL",
69
+ SilentDegrade: "FALLBACK",
70
+ Retry: "CACHE",
71
+ PartialRetry: "CACHE",
72
+ AtomicRollback: "FAIL",
73
+ });
74
+ exports.DEGRADATION_MODES = [
75
+ "FAIL_FAST",
76
+ "PARTIAL_OUTPUT",
77
+ "FALLBACK_LOGIC",
78
+ ];
79
+ exports.TEMPLATE_FORMATS = [
80
+ "mustache",
81
+ "handlebars",
82
+ "jinja2",
83
+ "fstring",
84
+ "raw",
85
+ ];
86
+ exports.GUARD_POSITIONS = ["input", "output", "both"];
87
+ //# sourceMappingURL=phenotype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phenotype.js","sourceRoot":"","sources":["../../src/types/phenotype.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAkBU,QAAA,gBAAgB,GAA8B;IACzD,MAAM;IACN,OAAO;IACP,cAAc;CACN,CAAC;AAWE,QAAA,iBAAiB,GAA+B;IAC3D,QAAQ;IACR,cAAc;IACd,UAAU;IACV,UAAU;IACV,SAAS;CACD,CAAC;AAcE,QAAA,mBAAmB,GAAgC,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC;AAE5F,kFAAkF;AACrE,QAAA,0BAA0B,GAA+C,MAAM,CAAC,MAAM,CAAC;IAClG,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAEH,gFAAgF;AAEhF;;;;;;;;;;;;;;GAcG;AACU,QAAA,iBAAiB,GAAqC,MAAM,CAAC,MAAM,CAAC;IAC/E,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,GAAG;CACb,CAAC,CAAC;AAqCU,QAAA,qBAAqB,GAA0C;IAC1E,MAAM;IACN,UAAU;IACV,OAAO;IACP,MAAM;CACE,CAAC;AAEX;;;;;;GAMG;AACU,QAAA,4BAA4B,GACvC,MAAM,CAAC,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,UAAU;IACzB,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,OAAO;IACrB,cAAc,EAAE,MAAM;CACvB,CAAC,CAAC;AA6CQ,QAAA,iBAAiB,GAAuC;IACnE,WAAW;IACX,gBAAgB;IAChB,gBAAgB;CACR,CAAC;AAME,QAAA,gBAAgB,GAA8B;IACzD,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,SAAS;IACT,KAAK;CACG,CAAC;AAIE,QAAA,eAAe,GAA6B,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC"}
@@ -37,11 +37,35 @@ export interface NativeBinding {
37
37
  l0Check(phenotypeJson: string, permissionsJson?: string, constraintsJson?: string): L0CheckResultView;
38
38
  executeAlgebra(algebraJson: string, geneEntriesJson: string, inputJson: string): AlgebraResultView;
39
39
  }
40
+ export declare function tryLoadBinding(): NativeBinding | null;
41
+ /** A gene announcement received from a peer (mirrors the Rust napi struct). */
42
+ export interface ReceivedAnnouncement {
43
+ geneId: string;
44
+ name: string;
45
+ domain: string;
46
+ version: string;
47
+ fidelity: string;
48
+ publisher: string;
49
+ source?: string;
50
+ }
40
51
  /**
41
- * Try to load the napi native addon.
42
- * Strategy: platform npm package first, then local .node file fallback.
43
- * Returns null if the addon is not available (fallback to pure-TS path).
52
+ * Subset of the native `P2pNode` class surfaced to the CLI. Method names are
53
+ * camelCase (napi converts the Rust snake_case automatically).
44
54
  */
45
- export declare function tryLoadBinding(): NativeBinding | null;
55
+ export interface P2pNodeHandle {
56
+ start(): void;
57
+ peerId(): string;
58
+ listenAddrs(): string[];
59
+ discoveredPeers(): string[];
60
+ receivedAnnouncements(): ReceivedAnnouncement[];
61
+ announceGene(geneId: string, name: string, domain: string, version: string, fidelity: string): void;
62
+ stop(): void;
63
+ }
64
+ /**
65
+ * Construct a native libp2p P2P node. Returns null when the native addon is
66
+ * unavailable (e.g. a pure-TS environment without the compiled `.node`), so
67
+ * callers can degrade gracefully.
68
+ */
69
+ export declare function loadP2pNode(listenHost: string, listenPort: number, bootstrapPeers: string[]): P2pNodeHandle | null;
46
70
  export declare function isNativeAvailable(): boolean;
47
71
  //# sourceMappingURL=binding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../src/utils/binding.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CACf,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,iBAAiB,CAAC;IACrB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1C,iBAAiB,IAAI,MAAM,CAAC;IAC5B,mBAAmB,IAAI,MAAM,CAAC;IAC9B,sBAAsB,IAAI,MAAM,CAAC;IACjC,sBAAsB,IAAI,MAAM,CAAC;IACjC,WAAW,C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qB,IAAI,oBAAoB,EAAE,CAAC;IAChD,YAAY,CACV,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,IAAI,CAAC;IACR,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EAAE,GACvB,aAAa,GAAG,IAAI,CAStB;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C"}
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tryLoadBinding = tryLoadBinding;
4
+ exports.loadP2pNode = loadP2pNode;
4
5
  exports.isNativeAvailable = isNativeAvailable;
5
6
  const node_path_1 = require("node:path");
6
7
  const node_fs_1 = require("node:fs");
7
8
  const private_fs_js_1 = require("./private-fs.js");
8
9
  let _binding = null;
9
10
  let _hasLoadAttempted = false;
11
+ let _rawModule = null;
12
+ let _hasModuleLoadAttempted = false;
10
13
  const PLATFORM_PACKAGE_MAP = {
11
14
  "darwin-arm64": "@rotifer/playground-darwin-arm64",
12
15
  "darwin-x64": "@rotifer/playground-darwin-x64",
@@ -25,18 +28,16 @@ function initBinding(mod) {
25
28
  * Strategy: platform npm package first, then local .node file fallback.
26
29
  * Returns null if the addon is not available (fallback to pure-TS path).
27
30
  */
28
- function tryLoadBinding() {
29
- if (_hasLoadAttempted)
30
- return _binding;
31
- _hasLoadAttempted = true;
31
+ function loadRawModule() {
32
+ if (_hasModuleLoadAttempted)
33
+ return _rawModule;
34
+ _hasModuleLoadAttempted = true;
32
35
  const platformKey = `${process.platform}-${process.arch}`;
33
36
  const pkgName = PLATFORM_PACKAGE_MAP[platformKey];
34
37
  if (pkgName) {
35
38
  try {
36
- const mod = require(pkgName);
37
- _binding = initBinding(mod);
38
- if (_binding)
39
- return _binding;
39
+ _rawModule = require(pkgName);
40
+ return _rawModule;
40
41
  }
41
42
  catch {
42
43
  // platform package not installed — fall through to local search
@@ -50,10 +51,8 @@ function tryLoadBinding() {
50
51
  for (const candidate of localCandidates) {
51
52
  if ((0, node_fs_1.existsSync)(candidate)) {
52
53
  try {
53
- const mod = require(candidate);
54
- _binding = initBinding(mod);
55
- if (_binding)
56
- return _binding;
54
+ _rawModule = require(candidate);
55
+ return _rawModule;
57
56
  }
58
57
  catch {
59
58
  // addon exists but failed to load — continue
@@ -62,6 +61,29 @@ function tryLoadBinding() {
62
61
  }
63
62
  return null;
64
63
  }
64
+ function tryLoadBinding() {
65
+ if (_hasLoadAttempted)
66
+ return _binding;
67
+ _hasLoadAttempted = true;
68
+ const mod = loadRawModule();
69
+ if (mod)
70
+ _binding = initBinding(mod);
71
+ return _binding;
72
+ }
73
+ /**
74
+ * Construct a native libp2p P2P node. Returns null when the native addon is
75
+ * unavailable (e.g. a pure-TS environment without the compiled `.node`), so
76
+ * callers can degrade gracefully.
77
+ */
78
+ function loadP2pNode(listenHost, listenPort, bootstrapPeers) {
79
+ const mod = loadRawModule();
80
+ // napi renders the Rust `P2pNode` as `P2PNode` (it uppercases the "p2p"
81
+ // acronym); accept either spelling so both the raw addon and any JS wrapper work.
82
+ const Ctor = (mod?.P2PNode ?? mod?.P2pNode);
83
+ if (typeof Ctor !== "function")
84
+ return null;
85
+ return new Ctor(listenHost, listenPort, bootstrapPeers);
86
+ }
65
87
  function isNativeAvailable() {
66
88
  return tryLoadBinding() !== null;
67
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/utils/binding.ts"],"names":[],"mappings":";;AA2FA,wCAmCC;AAED,8CAEC;AAlID,yCAAiC;AACjC,qCAAqC;AACrC,mDAAmD;AA+DnD,IAAI,QAAQ,GAAyB,IAAI,CAAC;AAC1C,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAE9B,MAAM,oB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ACpB,CAAC;YAAC,MAAM,CAAC;gBACP,6CAA6C;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,cAAc;IAC5B,IAAI,iBAAiB;QAAE,OAAO,QAAQ,CAAC;IACvC,iBAAiB,GAAG,IAAI,CAAC;IACzB,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,IAAI,GAAG;QAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAiCD;;;;GAIG;AACH,SAAgB,WAAW,CACzB,UAAkB,EAClB,UAAkB,EAClB,cAAwB;IAExB,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,wEAAwE;IACxE,kFAAkF;IAClF,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,OAAO,CAE7B,CAAC;IACd,IAAI,OAAO,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,IAAI,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,cAAc,EAAE,KAAK,IAAI,CAAC;AACnC,CAAC"}
@@ -33,7 +33,7 @@ function saveConfig(config, projectDir) {
33
33
  function getProjectRoot() {
34
34
  const root = findProjectRoot();
35
35
  if (!root) {
36
- throw new Error(`No ${CONFIG_FILE} found. Run 'rotifer init' to create a new project.`);
36
+ throw new Error(`No ${CONFIG_FILE} found. Run 'rotifer init' to create a new Agent workspace.`);
37
37
  }
38
38
  return root;
39
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":";;AAaA,0CASC;AAED,gCAWC;AAED,gCAGC;AAED,wCAQC;AAlDD,qCAAkE;AAClE,yCAAiC;AAUjC,MAAM,WAAW,GAAG,c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CAAC;AACpE,CAAC;AAED,SAAgB,cAAc;IAC5B,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,MAAM,WAAW,6DAA6D,CAC/E,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,3 +1,33 @@
1
+ /** Gene source declares an async/Promise-returning express() — incompatible with Javy/QuickJS (#57). */
2
+ export declare class AsyncExpressError extends Error {
3
+ name: string;
4
+ }
5
+ /** TS→WASM toolchain (esbuild / javy) unavailable; message carries the full diagnosis (#58). */
6
+ export declare class ToolchainError extends Error {
7
+ name: string;
8
+ }
9
+ /**
10
+ * Detect an async/Promise-returning express() in gene source.
11
+ * Returns a human-readable description of the offending shape, or null if clean.
12
+ */
13
+ export declare function detectAsyncExpress(source: string): string | null;
14
+ type Command = string[];
15
+ export interface ToolchainStatus {
16
+ esbuild: Command | null;
17
+ javy: Command | null;
18
+ }
19
+ /** Resolve the TS→WASM toolchain without ever hitting the network. */
20
+ export declare function preflightToolchain(): ToolchainStatus;
21
+ /** Full diagnosis for a failed preflight: per-tool status, environment, exact fixes. */
22
+ /** Resolve the active `npx` path (impure: PATH lookup). Returns "not found" if absent. */
23
+ export declare function resolveActiveNpxPath(): string;
24
+ /** True when both tools resolved. */
25
+ export declare function toolchainOk(status: ToolchainStatus): boolean;
26
+ /** Per-tool status + environment, as report lines. Pure (no I/O — pass npxPath in). */
27
+ export declare function formatToolchainReport(status: ToolchainStatus, npxPath: string): string[];
28
+ export declare function buildToolchainErrorMessage(status: ToolchainStatus): string;
29
+ /** True when the gene source has been edited after the WASM was last compiled (#58). */
30
+ export declare function isWasmStale(wasmPath: string, sourcePath: string): boolean;
1
31
  export interface JavyCompileResult {
2
32
  wasmPath: string;
3
33
  bundleSize: number;
@@ -11,7 +41,7 @@ export interface JavyCompileResult {
11
41
  */
12
42
  export declare function compileTypeScriptToWasm(geneSrcPath: string, outputWasmPath: string): JavyCompileResult;
13
43
  /**
14
- * Check whether the Javy CLI is available.
44
+ * Check whether the Javy CLI is available (offline check; never hits the registry).
15
45
  */
16
46
  export declare function isJavyAvailable(): boolean;
17
47
  /**
@@ -19,4 +49,5 @@ export declare function isJavyAvailable(): boolean;
19
49
  * Returns the path to `index.ts` or `index.js` if found.
20
50
  */
21
51
  export declare function findGeneSource(geneDir: string): string | null;
52
+ export {};
22
53
  //# sourceMappingURL=javy-compiler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"javy-compiler.d.ts","sourceRoot":"","sources":["../../src/utils/javy-compiler.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,iBAAiB,CA0CnB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAOzC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM7D"}
1
+ {"version":3,"file":"javy-compiler.d.ts","sourceRoot":"","sources":["../../src/utils/javy-compiler.ts"],"names":[],"mappings":"AAKA,wGAAwG;AACxG,qBAAa,iBAAkB,SAAQ,KAAK;IACjC,IAAI,SAAuB;CACrC;AAED,gGAAgG;AAChG,qBAAa,cAAe,SAAQ,KAAK;IAC9B,IAAI,SAAoB;CAClC;AAUD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhE;AAED,KAAK,OAAO,GAAG,MAAM,EAAE,CAAC;AA8BxB,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,GAAG,IAAI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