@neuroverseos/governance 0.5.0 → 0.6.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/README.md +244 -0
- package/dist/adapters/autoresearch.d.cts +2 -1
- package/dist/adapters/autoresearch.d.ts +2 -1
- package/dist/adapters/autoresearch.js +2 -2
- package/dist/adapters/deep-agents.d.cts +3 -2
- package/dist/adapters/deep-agents.d.ts +3 -2
- package/dist/adapters/deep-agents.js +2 -2
- package/dist/adapters/express.d.cts +2 -1
- package/dist/adapters/express.d.ts +2 -1
- package/dist/adapters/express.js +2 -2
- package/dist/adapters/github.cjs +1697 -0
- package/dist/adapters/github.d.cts +225 -0
- package/dist/adapters/github.d.ts +225 -0
- package/dist/adapters/github.js +27 -0
- package/dist/adapters/index.d.cts +4 -316
- package/dist/adapters/index.d.ts +4 -316
- package/dist/adapters/index.js +23 -21
- package/dist/adapters/langchain.d.cts +3 -2
- package/dist/adapters/langchain.d.ts +3 -2
- package/dist/adapters/langchain.js +2 -2
- package/dist/adapters/mentraos.cjs +2181 -0
- package/dist/adapters/mentraos.d.cts +319 -0
- package/dist/adapters/mentraos.d.ts +319 -0
- package/dist/{mentraos-LLH7KEV4.js → adapters/mentraos.js} +12 -10
- package/dist/adapters/openai.d.cts +3 -2
- package/dist/adapters/openai.d.ts +3 -2
- package/dist/adapters/openai.js +2 -2
- package/dist/adapters/openclaw.d.cts +3 -2
- package/dist/adapters/openclaw.d.ts +3 -2
- package/dist/adapters/openclaw.js +2 -2
- package/dist/{add-LYHDZ5RL.js → add-XSANI3FK.js} +1 -1
- package/dist/admin/index.cjs +2214 -0
- package/dist/admin/index.d.cts +362 -0
- package/dist/admin/index.d.ts +362 -0
- package/dist/admin/index.js +703 -0
- package/dist/bootstrap-contract-DcV6t-8M.d.cts +216 -0
- package/dist/bootstrap-contract-DcV6t-8M.d.ts +216 -0
- package/dist/{build-SCAWPA7E.js → build-UTVDGHB3.js} +5 -5
- package/dist/{chunk-JKGPSFGH.js → chunk-7FL3U7Z5.js} +3 -3
- package/dist/chunk-A2UZTLRV.js +421 -0
- package/dist/{chunk-TD5GKIHP.js → chunk-B3IIPTY3.js} +3 -3
- package/dist/chunk-EQR7BGFN.js +337 -0
- package/dist/{chunk-5JUZ4HL7.js → chunk-FDPPZLSQ.js} +3 -3
- package/dist/{chunk-MFKHTE5R.js → chunk-FKQCPRKI.js} +3 -3
- package/dist/{chunk-7D7PZLB7.js → chunk-FS2UUJJO.js} +3 -3
- package/dist/{chunk-U6FRAEQJ.js → chunk-GJ6LM4JZ.js} +1 -441
- package/dist/chunk-H3REGQRI.js +107 -0
- package/dist/{chunk-25XHSTPT.js → chunk-HDNDL6D5.js} +3 -3
- package/dist/{chunk-BXLTEUS4.js → chunk-I4RTIMLX.js} +2 -2
- package/dist/chunk-IOVXB6QN.js +447 -0
- package/dist/{chunk-Y6WXAPKY.js → chunk-NTHXZAW4.js} +3 -3
- package/dist/{chunk-UTH7OXTM.js → chunk-OTZU76DH.js} +22 -4
- package/dist/{chunk-DWHUZUEY.js → chunk-T6GMRZWC.js} +3 -3
- package/dist/{chunk-V4FZHJQX.js → chunk-TIXVEPS2.js} +3 -3
- package/dist/{chunk-YNYCQECH.js → chunk-TJ5L2UTE.js} +3 -3
- package/dist/chunk-UGTNKTHS.js +542 -0
- package/dist/cli/neuroverse.cjs +3372 -523
- package/dist/cli/neuroverse.js +53 -21
- package/dist/cli/plan.js +2 -2
- package/dist/cli/run.cjs +242 -139
- package/dist/cli/run.js +23 -3
- package/dist/cli/worldmodel.cjs +1624 -0
- package/dist/cli/worldmodel.d.cts +24 -0
- package/dist/cli/worldmodel.d.ts +24 -0
- package/dist/cli/worldmodel.js +742 -0
- package/dist/{demo-66MMJTEH.js → demo-6W3YXLAX.js} +4 -4
- package/dist/{derive-AUQE3L3P.js → derive-42IJW7JI.js} +4 -4
- package/dist/{doctor-EY7LKSYY.js → doctor-XEMLO6UA.js} +3 -2
- package/dist/engine/bootstrap-emitter.cjs +241 -0
- package/dist/engine/bootstrap-emitter.d.cts +27 -0
- package/dist/engine/bootstrap-emitter.d.ts +27 -0
- package/dist/{bootstrap-emitter-GIMOJFOC.js → engine/bootstrap-emitter.js} +2 -2
- package/dist/engine/bootstrap-parser.cjs +560 -0
- package/dist/engine/bootstrap-parser.d.cts +96 -0
- package/dist/engine/bootstrap-parser.d.ts +96 -0
- package/dist/{bootstrap-parser-LBLGVEMU.js → engine/bootstrap-parser.js} +2 -2
- package/dist/engine/guard-engine.cjs +1116 -0
- package/dist/engine/guard-engine.d.cts +60 -0
- package/dist/engine/guard-engine.d.ts +60 -0
- package/dist/{guard-engine-N7TUIUU7.js → engine/guard-engine.js} +3 -3
- package/dist/engine/simulate-engine.cjs +390 -0
- package/dist/engine/simulate-engine.d.cts +105 -0
- package/dist/engine/simulate-engine.d.ts +105 -0
- package/dist/engine/simulate-engine.js +9 -0
- package/dist/engine/worldmodel-compiler.cjs +366 -0
- package/dist/engine/worldmodel-compiler.d.cts +46 -0
- package/dist/engine/worldmodel-compiler.d.ts +46 -0
- package/dist/engine/worldmodel-compiler.js +17 -0
- package/dist/engine/worldmodel-parser.cjs +566 -0
- package/dist/engine/worldmodel-parser.d.cts +22 -0
- package/dist/engine/worldmodel-parser.d.ts +22 -0
- package/dist/engine/worldmodel-parser.js +7 -0
- package/dist/{equity-penalties-WWC7UDQD.js → equity-penalties-CCO3GVHS.js} +6 -6
- package/dist/{explain-MUSGDT67.js → explain-HDFN4ION.js} +1 -1
- package/dist/{guard-W3BMQPBJ.js → guard-IHJEKHL2.js} +16 -4
- package/dist/{guard-contract-CLBbTGK_.d.ts → guard-contract-ddiIPlOg.d.cts} +2 -369
- package/dist/{guard-contract-CLBbTGK_.d.cts → guard-contract-q6HJAq3Q.d.ts} +2 -369
- package/dist/{improve-PJDAWW4Q.js → improve-LRORRYEX.js} +3 -3
- package/dist/index.cjs +471 -1
- package/dist/index.d.cts +14 -492
- package/dist/index.d.ts +14 -492
- package/dist/index.js +63 -42
- package/dist/keygen-BSZH3NM2.js +77 -0
- package/dist/{lens-IP6GIZ2Q.js → lens-TLDZQXBI.js} +152 -26
- package/dist/{mcp-server-OG3PPVD2.js → mcp-server-CKYBHXWK.js} +2 -2
- package/dist/migrate-NH5PVMX4.js +221 -0
- package/dist/{playground-4BK2XQ47.js → playground-3TTBN7XD.js} +5 -5
- package/dist/{redteam-BRZALBPP.js → redteam-W644UMWN.js} +3 -3
- package/dist/{session-SGRUT2UH.js → session-FMAROEIE.js} +2 -2
- package/dist/{shared-CwGpPheR.d.ts → shared-DAzdfWtU.d.ts} +1 -1
- package/dist/{shared-BGzmYP5g.d.cts → shared-PpalGKxc.d.cts} +1 -1
- package/dist/sign-RRELHKWM.js +11 -0
- package/dist/{simulate-FGXKIH7V.js → simulate-VT437EEL.js} +2 -2
- package/dist/{test-PT44BSYG.js → test-XDB2DH3L.js} +3 -3
- package/dist/types.cjs +18 -0
- package/dist/types.d.cts +370 -0
- package/dist/types.d.ts +370 -0
- package/dist/types.js +0 -0
- package/dist/{validate-Q5O5TGLT.js → validate-M52DX22Y.js} +1 -1
- package/dist/verify-6AVTWX75.js +151 -0
- package/dist/{world-V52ZMH26.js → world-O4HTQPDP.js} +1 -1
- package/dist/{world-loader-C4D3VPP3.js → world-loader-YTYFOP7D.js} +1 -1
- package/dist/worldmodel-contract-BPGhiuW5.d.cts +221 -0
- package/dist/worldmodel-contract-BPGhiuW5.d.ts +221 -0
- package/dist/worlds/auki-vanguard.worldmodel.md +116 -0
- package/dist/worlds/behavioral-demo.nv-world.md +130 -0
- package/dist/worlds/neuroverse-governance.worldmodel.md +115 -0
- package/package.json +44 -3
- package/dist/{bootstrap-IP5QMC3Q.js → bootstrap-2OW5ZLBL.js} +3 -3
- package/dist/{chunk-4G6WHPLI.js → chunk-735Z3HA4.js} +6 -6
- package/dist/{chunk-7QIAF377.js → chunk-CYDMUJVZ.js} +0 -0
- package/dist/{configure-ai-LL3VAPQW.js → configure-ai-5MP5DWTT.js} +3 -3
- package/dist/{decision-flow-3K4D72G4.js → decision-flow-IJPNMVQK.js} +3 -3
|
@@ -0,0 +1,1624 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/cli/worldmodel.ts
|
|
21
|
+
var worldmodel_exports = {};
|
|
22
|
+
__export(worldmodel_exports, {
|
|
23
|
+
main: () => main
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(worldmodel_exports);
|
|
26
|
+
var import_promises = require("fs/promises");
|
|
27
|
+
var import_fs = require("fs");
|
|
28
|
+
var import_path = require("path");
|
|
29
|
+
|
|
30
|
+
// src/engine/worldmodel-parser.ts
|
|
31
|
+
function splitSections(markdown) {
|
|
32
|
+
const lines = markdown.split("\n");
|
|
33
|
+
let frontmatter = "";
|
|
34
|
+
let bodyStart = 0;
|
|
35
|
+
if (lines[0]?.trim() === "---") {
|
|
36
|
+
const endIdx = lines.indexOf("---", 1);
|
|
37
|
+
if (endIdx > 0) {
|
|
38
|
+
frontmatter = lines.slice(1, endIdx).join("\n");
|
|
39
|
+
bodyStart = endIdx + 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const sections = [];
|
|
43
|
+
let currentSection = null;
|
|
44
|
+
const contentLines = [];
|
|
45
|
+
for (let i = bodyStart; i < lines.length; i++) {
|
|
46
|
+
const line = lines[i];
|
|
47
|
+
if (line.startsWith("# ")) {
|
|
48
|
+
if (currentSection) {
|
|
49
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
50
|
+
sections.push(currentSection);
|
|
51
|
+
contentLines.length = 0;
|
|
52
|
+
}
|
|
53
|
+
currentSection = {
|
|
54
|
+
name: line.replace(/^#\s+/, "").trim(),
|
|
55
|
+
content: "",
|
|
56
|
+
startLine: i + 1
|
|
57
|
+
// 1-based
|
|
58
|
+
};
|
|
59
|
+
} else if (currentSection) {
|
|
60
|
+
contentLines.push(line);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (currentSection) {
|
|
64
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
65
|
+
sections.push(currentSection);
|
|
66
|
+
}
|
|
67
|
+
return { frontmatter, sections };
|
|
68
|
+
}
|
|
69
|
+
function splitH2Sections(content, baseLine) {
|
|
70
|
+
const lines = content.split("\n");
|
|
71
|
+
const sections = [];
|
|
72
|
+
let currentSection = null;
|
|
73
|
+
const contentLines = [];
|
|
74
|
+
for (let i = 0; i < lines.length; i++) {
|
|
75
|
+
const line = lines[i];
|
|
76
|
+
if (line.startsWith("## ")) {
|
|
77
|
+
if (currentSection) {
|
|
78
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
79
|
+
sections.push(currentSection);
|
|
80
|
+
contentLines.length = 0;
|
|
81
|
+
}
|
|
82
|
+
currentSection = {
|
|
83
|
+
name: line.replace(/^##\s+/, "").trim(),
|
|
84
|
+
content: "",
|
|
85
|
+
startLine: baseLine + i
|
|
86
|
+
};
|
|
87
|
+
} else if (currentSection) {
|
|
88
|
+
contentLines.push(line);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (currentSection) {
|
|
92
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
93
|
+
sections.push(currentSection);
|
|
94
|
+
}
|
|
95
|
+
return sections;
|
|
96
|
+
}
|
|
97
|
+
function splitH3Sections(content, baseLine) {
|
|
98
|
+
const lines = content.split("\n");
|
|
99
|
+
const sections = [];
|
|
100
|
+
let currentSection = null;
|
|
101
|
+
const contentLines = [];
|
|
102
|
+
for (let i = 0; i < lines.length; i++) {
|
|
103
|
+
const line = lines[i];
|
|
104
|
+
if (line.startsWith("### ")) {
|
|
105
|
+
if (currentSection) {
|
|
106
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
107
|
+
sections.push(currentSection);
|
|
108
|
+
contentLines.length = 0;
|
|
109
|
+
}
|
|
110
|
+
currentSection = {
|
|
111
|
+
name: line.replace(/^###\s+/, "").trim(),
|
|
112
|
+
content: "",
|
|
113
|
+
startLine: baseLine + i
|
|
114
|
+
};
|
|
115
|
+
} else if (currentSection) {
|
|
116
|
+
contentLines.push(line);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (currentSection) {
|
|
120
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
121
|
+
sections.push(currentSection);
|
|
122
|
+
}
|
|
123
|
+
return sections;
|
|
124
|
+
}
|
|
125
|
+
function splitH4Sections(content, baseLine) {
|
|
126
|
+
const lines = content.split("\n");
|
|
127
|
+
const sections = [];
|
|
128
|
+
let currentSection = null;
|
|
129
|
+
const contentLines = [];
|
|
130
|
+
for (let i = 0; i < lines.length; i++) {
|
|
131
|
+
const line = lines[i];
|
|
132
|
+
if (line.startsWith("#### ")) {
|
|
133
|
+
if (currentSection) {
|
|
134
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
135
|
+
sections.push(currentSection);
|
|
136
|
+
contentLines.length = 0;
|
|
137
|
+
}
|
|
138
|
+
currentSection = {
|
|
139
|
+
name: line.replace(/^####\s+/, "").trim(),
|
|
140
|
+
content: "",
|
|
141
|
+
startLine: baseLine + i
|
|
142
|
+
};
|
|
143
|
+
} else if (currentSection) {
|
|
144
|
+
contentLines.push(line);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (currentSection) {
|
|
148
|
+
currentSection.content = contentLines.join("\n").trim();
|
|
149
|
+
sections.push(currentSection);
|
|
150
|
+
}
|
|
151
|
+
return sections;
|
|
152
|
+
}
|
|
153
|
+
function parseBulletList(content) {
|
|
154
|
+
const items = [];
|
|
155
|
+
let inComment = false;
|
|
156
|
+
for (const line of content.split("\n")) {
|
|
157
|
+
const trimmed = line.trim();
|
|
158
|
+
if (trimmed.startsWith("<!--")) {
|
|
159
|
+
inComment = true;
|
|
160
|
+
}
|
|
161
|
+
if (inComment) {
|
|
162
|
+
if (trimmed.includes("-->")) {
|
|
163
|
+
inComment = false;
|
|
164
|
+
}
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (trimmed.startsWith("- ")) {
|
|
168
|
+
items.push(trimmed.slice(2).trim());
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return items;
|
|
172
|
+
}
|
|
173
|
+
function extractTextContent(content) {
|
|
174
|
+
const lines = content.split("\n");
|
|
175
|
+
const textLines = [];
|
|
176
|
+
let inComment = false;
|
|
177
|
+
for (const line of lines) {
|
|
178
|
+
const trimmed = line.trim();
|
|
179
|
+
if (trimmed.startsWith("<!--")) {
|
|
180
|
+
inComment = true;
|
|
181
|
+
}
|
|
182
|
+
if (inComment) {
|
|
183
|
+
if (trimmed.includes("-->")) {
|
|
184
|
+
inComment = false;
|
|
185
|
+
}
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (trimmed && !trimmed.startsWith("#")) {
|
|
189
|
+
textLines.push(trimmed);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return textLines.join("\n").trim();
|
|
193
|
+
}
|
|
194
|
+
function toKebabCase(name) {
|
|
195
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
196
|
+
}
|
|
197
|
+
function parseFrontmatter(yaml, issues) {
|
|
198
|
+
const result = {};
|
|
199
|
+
for (const line of yaml.split("\n")) {
|
|
200
|
+
const trimmed = line.trim();
|
|
201
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
202
|
+
const colonIdx = trimmed.indexOf(":");
|
|
203
|
+
if (colonIdx === -1) continue;
|
|
204
|
+
const key = trimmed.slice(0, colonIdx).trim();
|
|
205
|
+
const value = trimmed.slice(colonIdx + 1).trim();
|
|
206
|
+
result[key] = value;
|
|
207
|
+
}
|
|
208
|
+
const name = result.name || "";
|
|
209
|
+
if (!name) {
|
|
210
|
+
issues.push({
|
|
211
|
+
line: 1,
|
|
212
|
+
section: "frontmatter",
|
|
213
|
+
message: "Missing name in frontmatter. Provide a human-readable model name.",
|
|
214
|
+
severity: "error"
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const model_id = result.model_id || toKebabCase(name);
|
|
218
|
+
return {
|
|
219
|
+
model_id,
|
|
220
|
+
name,
|
|
221
|
+
version: result.version || "1.0.0"
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function parseGeometry(section, issues) {
|
|
225
|
+
const geometry = {
|
|
226
|
+
mission: "",
|
|
227
|
+
domains: [],
|
|
228
|
+
overlapEffects: [],
|
|
229
|
+
centerIdentity: ""
|
|
230
|
+
};
|
|
231
|
+
if (!section) {
|
|
232
|
+
issues.push({
|
|
233
|
+
line: 0,
|
|
234
|
+
section: "Core Model Geometry",
|
|
235
|
+
message: "Missing # Core Model Geometry section. Define the structural model: mission, domains with embedded skills and values, overlaps, and center identity.",
|
|
236
|
+
severity: "error"
|
|
237
|
+
});
|
|
238
|
+
return geometry;
|
|
239
|
+
}
|
|
240
|
+
const h2Sections = splitH2Sections(section.content, section.startLine);
|
|
241
|
+
const missionSection = h2Sections.find((s) => s.name.toLowerCase() === "mission");
|
|
242
|
+
if (missionSection) {
|
|
243
|
+
geometry.mission = extractTextContent(missionSection.content);
|
|
244
|
+
}
|
|
245
|
+
if (!geometry.mission) {
|
|
246
|
+
issues.push({
|
|
247
|
+
line: missionSection?.startLine ?? section.startLine,
|
|
248
|
+
section: "Mission",
|
|
249
|
+
message: "Missing ## Mission. Define what this system is trying to achieve \u2014 the core aim, not a slogan.",
|
|
250
|
+
severity: "error"
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
const domainsSection = h2Sections.find((s) => s.name.toLowerCase() === "domains");
|
|
254
|
+
if (domainsSection) {
|
|
255
|
+
const domainSections = splitH3Sections(domainsSection.content, domainsSection.startLine);
|
|
256
|
+
for (const ds of domainSections) {
|
|
257
|
+
const domain = {
|
|
258
|
+
id: toKebabCase(ds.name),
|
|
259
|
+
name: ds.name,
|
|
260
|
+
skills: [],
|
|
261
|
+
values: [],
|
|
262
|
+
line: ds.startLine
|
|
263
|
+
};
|
|
264
|
+
const h4Sections = splitH4Sections(ds.content, ds.startLine);
|
|
265
|
+
const skillsH4 = h4Sections.find((s) => s.name.toLowerCase() === "skills");
|
|
266
|
+
if (skillsH4) {
|
|
267
|
+
domain.skills = parseBulletList(skillsH4.content);
|
|
268
|
+
}
|
|
269
|
+
const valuesH4 = h4Sections.find((s) => s.name.toLowerCase() === "values");
|
|
270
|
+
if (valuesH4) {
|
|
271
|
+
domain.values = parseBulletList(valuesH4.content);
|
|
272
|
+
}
|
|
273
|
+
if (domain.skills.length === 0) {
|
|
274
|
+
issues.push({
|
|
275
|
+
line: ds.startLine,
|
|
276
|
+
section: "Domains",
|
|
277
|
+
message: `Domain '${ds.name}' has no skills defined. Skills are the capabilities within this domain.`,
|
|
278
|
+
severity: "warning"
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if (domain.values.length === 0) {
|
|
282
|
+
issues.push({
|
|
283
|
+
line: ds.startLine,
|
|
284
|
+
section: "Domains",
|
|
285
|
+
message: `Domain '${ds.name}' has no values defined. Behavior has no constraints without values.`,
|
|
286
|
+
severity: "warning"
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
geometry.domains.push(domain);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (geometry.domains.length < 2) {
|
|
293
|
+
issues.push({
|
|
294
|
+
line: domainsSection?.startLine ?? section.startLine,
|
|
295
|
+
section: "Domains",
|
|
296
|
+
message: "At least 2 domains required. Domains are the major operating modes of the system, each carrying skills and values.",
|
|
297
|
+
severity: "error"
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const overlapsSection = h2Sections.find(
|
|
301
|
+
(s) => s.name.toLowerCase() === "overlap effects"
|
|
302
|
+
);
|
|
303
|
+
if (overlapsSection) {
|
|
304
|
+
const bullets = parseBulletList(overlapsSection.content);
|
|
305
|
+
const domainNames = new Set(geometry.domains.map((d) => d.name.toLowerCase()));
|
|
306
|
+
for (let i = 0; i < bullets.length; i++) {
|
|
307
|
+
const bullet = bullets[i];
|
|
308
|
+
const match = bullet.match(/^(.+?)\s*\+\s*(.+?)\s*=\s*(.+)$/);
|
|
309
|
+
if (match) {
|
|
310
|
+
const domainA = match[1].trim();
|
|
311
|
+
const domainB = match[2].trim();
|
|
312
|
+
const effect = match[3].trim();
|
|
313
|
+
if (!domainNames.has(domainA.toLowerCase())) {
|
|
314
|
+
issues.push({
|
|
315
|
+
line: overlapsSection.startLine + i,
|
|
316
|
+
section: "Overlap Effects",
|
|
317
|
+
message: `Overlap references unknown domain '${domainA}'. Must reference a declared domain.`,
|
|
318
|
+
severity: "warning"
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
if (!domainNames.has(domainB.toLowerCase())) {
|
|
322
|
+
issues.push({
|
|
323
|
+
line: overlapsSection.startLine + i,
|
|
324
|
+
section: "Overlap Effects",
|
|
325
|
+
message: `Overlap references unknown domain '${domainB}'. Must reference a declared domain.`,
|
|
326
|
+
severity: "warning"
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
geometry.overlapEffects.push({
|
|
330
|
+
domainA,
|
|
331
|
+
domainB,
|
|
332
|
+
effect,
|
|
333
|
+
line: overlapsSection.startLine + i
|
|
334
|
+
});
|
|
335
|
+
} else {
|
|
336
|
+
issues.push({
|
|
337
|
+
line: overlapsSection.startLine + i,
|
|
338
|
+
section: "Overlap Effects",
|
|
339
|
+
message: `Cannot parse overlap: '${bullet}'. Expected format: 'Domain A + Domain B = Emergent State'.`,
|
|
340
|
+
severity: "warning"
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (geometry.overlapEffects.length === 0) {
|
|
346
|
+
issues.push({
|
|
347
|
+
line: overlapsSection?.startLine ?? section.startLine,
|
|
348
|
+
section: "Overlap Effects",
|
|
349
|
+
message: 'No overlap effects defined. Define what emerges when two domains interact well (e.g., "Domain A + Domain B = Inspiration").',
|
|
350
|
+
severity: "warning"
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
const identitySection = h2Sections.find(
|
|
354
|
+
(s) => s.name.toLowerCase() === "center identity"
|
|
355
|
+
);
|
|
356
|
+
if (identitySection) {
|
|
357
|
+
geometry.centerIdentity = extractTextContent(identitySection.content);
|
|
358
|
+
}
|
|
359
|
+
if (!geometry.centerIdentity) {
|
|
360
|
+
issues.push({
|
|
361
|
+
line: identitySection?.startLine ?? section.startLine,
|
|
362
|
+
section: "Center Identity",
|
|
363
|
+
message: "No center identity defined. Define what the system becomes when all domains are aligned \u2014 the core identity.",
|
|
364
|
+
severity: "warning"
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
return geometry;
|
|
368
|
+
}
|
|
369
|
+
function parseModifiers(section, issues) {
|
|
370
|
+
const modifiers = {
|
|
371
|
+
authorityLayers: [],
|
|
372
|
+
spatialContexts: [],
|
|
373
|
+
interpretationRules: []
|
|
374
|
+
};
|
|
375
|
+
if (!section) {
|
|
376
|
+
issues.push({
|
|
377
|
+
line: 0,
|
|
378
|
+
section: "Contextual Modifiers",
|
|
379
|
+
message: "Missing # Contextual Modifiers section. Define how authority, role, and spatial context change how behavior is interpreted.",
|
|
380
|
+
severity: "warning"
|
|
381
|
+
});
|
|
382
|
+
return modifiers;
|
|
383
|
+
}
|
|
384
|
+
const h2Sections = splitH2Sections(section.content, section.startLine);
|
|
385
|
+
const authoritySection = h2Sections.find(
|
|
386
|
+
(s) => s.name.toLowerCase() === "authority layers"
|
|
387
|
+
);
|
|
388
|
+
if (authoritySection) {
|
|
389
|
+
modifiers.authorityLayers = parseBulletList(authoritySection.content);
|
|
390
|
+
}
|
|
391
|
+
const spatialSection = h2Sections.find(
|
|
392
|
+
(s) => s.name.toLowerCase() === "spatial contexts"
|
|
393
|
+
);
|
|
394
|
+
if (spatialSection) {
|
|
395
|
+
modifiers.spatialContexts = parseBulletList(spatialSection.content);
|
|
396
|
+
}
|
|
397
|
+
const rulesSection = h2Sections.find(
|
|
398
|
+
(s) => s.name.toLowerCase() === "interpretation rules"
|
|
399
|
+
);
|
|
400
|
+
if (rulesSection) {
|
|
401
|
+
modifiers.interpretationRules = parseBulletList(rulesSection.content);
|
|
402
|
+
}
|
|
403
|
+
return modifiers;
|
|
404
|
+
}
|
|
405
|
+
function parseEvolution(section, issues) {
|
|
406
|
+
const evolution = {
|
|
407
|
+
alignedBehaviors: [],
|
|
408
|
+
driftBehaviors: [],
|
|
409
|
+
signals: [],
|
|
410
|
+
decisionPriorities: [],
|
|
411
|
+
evolutionConditions: []
|
|
412
|
+
};
|
|
413
|
+
if (!section) {
|
|
414
|
+
issues.push({
|
|
415
|
+
line: 0,
|
|
416
|
+
section: "Evolution Layer",
|
|
417
|
+
message: "Missing # Evolution Layer section. Define observable behaviors, signals, decision priorities, and adaptation conditions.",
|
|
418
|
+
severity: "error"
|
|
419
|
+
});
|
|
420
|
+
return evolution;
|
|
421
|
+
}
|
|
422
|
+
const h2Sections = splitH2Sections(section.content, section.startLine);
|
|
423
|
+
const alignedSection = h2Sections.find(
|
|
424
|
+
(s) => s.name.toLowerCase() === "aligned behaviors"
|
|
425
|
+
);
|
|
426
|
+
if (alignedSection) {
|
|
427
|
+
evolution.alignedBehaviors = parseBulletList(alignedSection.content);
|
|
428
|
+
}
|
|
429
|
+
if (evolution.alignedBehaviors.length === 0) {
|
|
430
|
+
issues.push({
|
|
431
|
+
line: alignedSection?.startLine ?? section.startLine,
|
|
432
|
+
section: "Aligned Behaviors",
|
|
433
|
+
message: "No aligned behaviors defined. Define what success looks like in action.",
|
|
434
|
+
severity: "warning"
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
const driftSection = h2Sections.find(
|
|
438
|
+
(s) => s.name.toLowerCase() === "drift behaviors"
|
|
439
|
+
);
|
|
440
|
+
if (driftSection) {
|
|
441
|
+
evolution.driftBehaviors = parseBulletList(driftSection.content);
|
|
442
|
+
}
|
|
443
|
+
if (evolution.driftBehaviors.length === 0) {
|
|
444
|
+
issues.push({
|
|
445
|
+
line: driftSection?.startLine ?? section.startLine,
|
|
446
|
+
section: "Drift Behaviors",
|
|
447
|
+
message: "No drift behaviors defined. Define what misalignment looks like so the system can detect behavioral drift over time.",
|
|
448
|
+
severity: "warning"
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
const signalsSection = h2Sections.find(
|
|
452
|
+
(s) => s.name.toLowerCase() === "signals"
|
|
453
|
+
);
|
|
454
|
+
if (signalsSection) {
|
|
455
|
+
evolution.signals = parseBulletList(signalsSection.content);
|
|
456
|
+
}
|
|
457
|
+
if (evolution.signals.length < 2) {
|
|
458
|
+
issues.push({
|
|
459
|
+
line: signalsSection?.startLine ?? section.startLine,
|
|
460
|
+
section: "Signals",
|
|
461
|
+
message: "At least 2 signals required. Signals are the observable metrics for detecting alignment or drift.",
|
|
462
|
+
severity: "error"
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
const prioritiesSection = h2Sections.find(
|
|
466
|
+
(s) => s.name.toLowerCase() === "decision priorities"
|
|
467
|
+
);
|
|
468
|
+
if (prioritiesSection) {
|
|
469
|
+
const bullets = parseBulletList(prioritiesSection.content);
|
|
470
|
+
for (let i = 0; i < bullets.length; i++) {
|
|
471
|
+
const bullet = bullets[i];
|
|
472
|
+
const match = bullet.match(/^(.+?)\s*>\s*(.+)$/);
|
|
473
|
+
if (match) {
|
|
474
|
+
evolution.decisionPriorities.push({
|
|
475
|
+
preferred: match[1].trim(),
|
|
476
|
+
over: match[2].trim(),
|
|
477
|
+
line: prioritiesSection.startLine + i
|
|
478
|
+
});
|
|
479
|
+
} else {
|
|
480
|
+
issues.push({
|
|
481
|
+
line: prioritiesSection.startLine + i,
|
|
482
|
+
section: "Decision Priorities",
|
|
483
|
+
message: `Cannot parse priority: '${bullet}'. Expected format: 'preferred > over'.`,
|
|
484
|
+
severity: "warning"
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (evolution.decisionPriorities.length === 0) {
|
|
490
|
+
issues.push({
|
|
491
|
+
line: prioritiesSection?.startLine ?? section.startLine,
|
|
492
|
+
section: "Decision Priorities",
|
|
493
|
+
message: "No decision priorities defined. Define what wins when tradeoffs appear.",
|
|
494
|
+
severity: "warning"
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
const evoSection = h2Sections.find(
|
|
498
|
+
(s) => s.name.toLowerCase() === "evolution conditions"
|
|
499
|
+
);
|
|
500
|
+
if (evoSection) {
|
|
501
|
+
evolution.evolutionConditions = parseBulletList(evoSection.content);
|
|
502
|
+
}
|
|
503
|
+
if (evolution.signals.length > 0 && evolution.driftBehaviors.length === 0) {
|
|
504
|
+
issues.push({
|
|
505
|
+
line: signalsSection?.startLine ?? section.startLine,
|
|
506
|
+
section: "Evolution Layer",
|
|
507
|
+
message: "Signals defined but no drift behaviors. System cannot detect failure without drift definitions.",
|
|
508
|
+
severity: "warning"
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
return evolution;
|
|
512
|
+
}
|
|
513
|
+
function parseWorldModel(markdown) {
|
|
514
|
+
const issues = [];
|
|
515
|
+
if (!markdown || !markdown.trim()) {
|
|
516
|
+
issues.push({
|
|
517
|
+
line: 0,
|
|
518
|
+
section: "file",
|
|
519
|
+
message: "Empty input. Provide a .worldmodel.md file with three layers: Core Model Geometry, Contextual Modifiers, Evolution Layer.",
|
|
520
|
+
severity: "error"
|
|
521
|
+
});
|
|
522
|
+
return { model: null, issues };
|
|
523
|
+
}
|
|
524
|
+
const { frontmatter: fmRaw, sections } = splitSections(markdown);
|
|
525
|
+
const frontmatter = parseFrontmatter(fmRaw, issues);
|
|
526
|
+
const geometrySection = sections.find(
|
|
527
|
+
(s) => s.name.toLowerCase() === "core model geometry"
|
|
528
|
+
);
|
|
529
|
+
const modifiersSection = sections.find(
|
|
530
|
+
(s) => s.name.toLowerCase() === "contextual modifiers"
|
|
531
|
+
);
|
|
532
|
+
const evolutionSection = sections.find(
|
|
533
|
+
(s) => s.name.toLowerCase() === "evolution layer"
|
|
534
|
+
);
|
|
535
|
+
const geometry = parseGeometry(geometrySection, issues);
|
|
536
|
+
const modifiers = parseModifiers(modifiersSection, issues);
|
|
537
|
+
const evolution = parseEvolution(evolutionSection, issues);
|
|
538
|
+
if (geometry.overlapEffects.length > 0 && !geometry.centerIdentity) {
|
|
539
|
+
issues.push({
|
|
540
|
+
line: 0,
|
|
541
|
+
section: "Core Model Geometry",
|
|
542
|
+
message: "Overlaps defined but no center identity. System lacks coherence without an aligned identity.",
|
|
543
|
+
severity: "warning"
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
const hasErrors = issues.some((i) => i.severity === "error");
|
|
547
|
+
if (hasErrors) {
|
|
548
|
+
return {
|
|
549
|
+
model: {
|
|
550
|
+
frontmatter,
|
|
551
|
+
geometry,
|
|
552
|
+
modifiers,
|
|
553
|
+
evolution
|
|
554
|
+
},
|
|
555
|
+
issues
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
return {
|
|
559
|
+
model: {
|
|
560
|
+
frontmatter,
|
|
561
|
+
geometry,
|
|
562
|
+
modifiers,
|
|
563
|
+
evolution
|
|
564
|
+
},
|
|
565
|
+
issues
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// src/engine/worldmodel-compiler.ts
|
|
570
|
+
function toSnakeCase(text) {
|
|
571
|
+
return text.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
|
|
572
|
+
}
|
|
573
|
+
function toKebabCase2(text) {
|
|
574
|
+
return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
575
|
+
}
|
|
576
|
+
function titleCase(text) {
|
|
577
|
+
return text.split(/[\s_-]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ");
|
|
578
|
+
}
|
|
579
|
+
function matchSignal(behaviorText, signals) {
|
|
580
|
+
const lowerText = behaviorText.toLowerCase();
|
|
581
|
+
for (const signal of signals) {
|
|
582
|
+
const signalWords = signal.toLowerCase().split("_");
|
|
583
|
+
if (signalWords.some((w) => w.length > 3 && lowerText.includes(w))) {
|
|
584
|
+
return signal;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return "alignment_score";
|
|
588
|
+
}
|
|
589
|
+
function emitWorldMarkdown(model) {
|
|
590
|
+
const lines = [];
|
|
591
|
+
const worldId = model.frontmatter.model_id;
|
|
592
|
+
const worldName = model.frontmatter.name;
|
|
593
|
+
const version = model.frontmatter.version;
|
|
594
|
+
lines.push("---");
|
|
595
|
+
lines.push(`world_id: ${worldId}`);
|
|
596
|
+
lines.push(`name: ${worldName}`);
|
|
597
|
+
lines.push(`version: ${version}`);
|
|
598
|
+
lines.push("runtime_mode: COMPLIANCE");
|
|
599
|
+
lines.push("default_profile: aligned");
|
|
600
|
+
lines.push("alternative_profile: drifting");
|
|
601
|
+
lines.push("---");
|
|
602
|
+
lines.push("");
|
|
603
|
+
lines.push("# Thesis");
|
|
604
|
+
lines.push("");
|
|
605
|
+
lines.push(model.geometry.mission);
|
|
606
|
+
if (model.geometry.centerIdentity) {
|
|
607
|
+
lines.push(
|
|
608
|
+
`When all domains are aligned, the system operates as: ${model.geometry.centerIdentity}.`
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
lines.push("");
|
|
612
|
+
lines.push("# Invariants");
|
|
613
|
+
lines.push("");
|
|
614
|
+
let invariantIdx = 0;
|
|
615
|
+
for (const domain of model.geometry.domains) {
|
|
616
|
+
for (const value of domain.values) {
|
|
617
|
+
invariantIdx++;
|
|
618
|
+
const invId = `${toSnakeCase(domain.name)}_value_${String(invariantIdx).padStart(2, "0")}`;
|
|
619
|
+
lines.push(
|
|
620
|
+
`- \`${invId}\` \u2014 ${value} [${domain.name}] (structural, immutable)`
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
lines.push("");
|
|
625
|
+
lines.push("# State");
|
|
626
|
+
lines.push("");
|
|
627
|
+
lines.push("## alignment_score");
|
|
628
|
+
lines.push("- type: number");
|
|
629
|
+
lines.push("- min: 0");
|
|
630
|
+
lines.push("- max: 100");
|
|
631
|
+
lines.push("- step: 5");
|
|
632
|
+
lines.push("- default: 70");
|
|
633
|
+
lines.push("- label: Alignment Score");
|
|
634
|
+
lines.push(
|
|
635
|
+
"- description: Composite behavioral alignment metric derived from all signals"
|
|
636
|
+
);
|
|
637
|
+
lines.push("");
|
|
638
|
+
for (const signal of model.evolution.signals) {
|
|
639
|
+
const signalId = toSnakeCase(signal);
|
|
640
|
+
const signalLabel = titleCase(signal);
|
|
641
|
+
lines.push(`## ${signalId}`);
|
|
642
|
+
lines.push("- type: number");
|
|
643
|
+
lines.push("- min: 0");
|
|
644
|
+
lines.push("- max: 100");
|
|
645
|
+
lines.push("- step: 5");
|
|
646
|
+
lines.push("- default: 70");
|
|
647
|
+
lines.push(`- label: ${signalLabel}`);
|
|
648
|
+
lines.push(`- description: Behavioral signal measuring ${signal.replace(/_/g, " ")}`);
|
|
649
|
+
lines.push("");
|
|
650
|
+
}
|
|
651
|
+
lines.push("# Assumptions");
|
|
652
|
+
lines.push("");
|
|
653
|
+
lines.push("## aligned");
|
|
654
|
+
lines.push("- name: Aligned");
|
|
655
|
+
lines.push("- description: All behavioral signals at healthy levels");
|
|
656
|
+
lines.push("- pressure_level: low");
|
|
657
|
+
lines.push("");
|
|
658
|
+
lines.push("## drifting");
|
|
659
|
+
lines.push("- name: Drifting");
|
|
660
|
+
lines.push("- description: Behavioral signals under pressure with drift risk");
|
|
661
|
+
lines.push("- pressure_level: high");
|
|
662
|
+
lines.push("");
|
|
663
|
+
lines.push("# Rules");
|
|
664
|
+
lines.push("");
|
|
665
|
+
let ruleIdx = 0;
|
|
666
|
+
for (const drift of model.evolution.driftBehaviors) {
|
|
667
|
+
ruleIdx++;
|
|
668
|
+
const ruleId = `rule-${String(ruleIdx).padStart(3, "0")}`;
|
|
669
|
+
const matchedSignal = matchSignal(drift, model.evolution.signals);
|
|
670
|
+
const signalId = toSnakeCase(matchedSignal);
|
|
671
|
+
lines.push(`## ${ruleId}: ${drift} (degradation)`);
|
|
672
|
+
lines.push(`Drift behavior detected: ${drift}`);
|
|
673
|
+
lines.push("");
|
|
674
|
+
lines.push(`When ${signalId} < 50 [state]`);
|
|
675
|
+
lines.push("Then alignment_score *= 0.80");
|
|
676
|
+
lines.push("");
|
|
677
|
+
lines.push(`> trigger: ${signalId} drops below threshold`);
|
|
678
|
+
lines.push(`> rule: Drift behavior weakens alignment`);
|
|
679
|
+
lines.push(`> shift: Behavioral alignment decreases`);
|
|
680
|
+
lines.push(`> effect: Alignment score reduced by 20%`);
|
|
681
|
+
lines.push("");
|
|
682
|
+
}
|
|
683
|
+
for (const aligned of model.evolution.alignedBehaviors) {
|
|
684
|
+
ruleIdx++;
|
|
685
|
+
const ruleId = `rule-${String(ruleIdx).padStart(3, "0")}`;
|
|
686
|
+
const matchedSignal = matchSignal(aligned, model.evolution.signals);
|
|
687
|
+
const signalId = toSnakeCase(matchedSignal);
|
|
688
|
+
lines.push(`## ${ruleId}: ${aligned} (advantage)`);
|
|
689
|
+
lines.push(`Aligned behavior reinforced: ${aligned}`);
|
|
690
|
+
lines.push("");
|
|
691
|
+
lines.push(`When ${signalId} >= 70 [state]`);
|
|
692
|
+
lines.push("Then alignment_score *= 1.10");
|
|
693
|
+
lines.push("");
|
|
694
|
+
lines.push(`> trigger: ${signalId} above healthy threshold`);
|
|
695
|
+
lines.push(`> rule: Aligned behavior strengthens system`);
|
|
696
|
+
lines.push(`> shift: Behavioral alignment increases`);
|
|
697
|
+
lines.push(`> effect: Alignment score boosted by 10%`);
|
|
698
|
+
lines.push("");
|
|
699
|
+
}
|
|
700
|
+
for (let i = 0; i < model.evolution.decisionPriorities.length; i++) {
|
|
701
|
+
ruleIdx++;
|
|
702
|
+
const priority = model.evolution.decisionPriorities[i];
|
|
703
|
+
const ruleId = `rule-${String(ruleIdx).padStart(3, "0")}`;
|
|
704
|
+
lines.push(
|
|
705
|
+
`## ${ruleId}: ${priority.preferred} over ${priority.over} (structural)`
|
|
706
|
+
);
|
|
707
|
+
lines.push(
|
|
708
|
+
`Priority: ${priority.preferred} takes precedence over ${priority.over} in tradeoff situations.`
|
|
709
|
+
);
|
|
710
|
+
lines.push("");
|
|
711
|
+
lines.push("When alignment_score < 40 [state]");
|
|
712
|
+
lines.push("Then alignment_score *= 0.70");
|
|
713
|
+
lines.push("Collapse: alignment_score < 10");
|
|
714
|
+
lines.push("");
|
|
715
|
+
lines.push(`> trigger: Alignment score critically low`);
|
|
716
|
+
lines.push(
|
|
717
|
+
`> rule: Priority violation \u2014 ${priority.preferred} must outweigh ${priority.over}`
|
|
718
|
+
);
|
|
719
|
+
lines.push(`> shift: System enters structural enforcement`);
|
|
720
|
+
lines.push(`> effect: Alignment sharply reduced; collapse if critical`);
|
|
721
|
+
lines.push("");
|
|
722
|
+
}
|
|
723
|
+
lines.push("# Gates");
|
|
724
|
+
lines.push("");
|
|
725
|
+
lines.push("- STRONG: alignment_score >= 85");
|
|
726
|
+
lines.push("- STABLE: alignment_score >= 65");
|
|
727
|
+
lines.push("- WATCHING: alignment_score >= 45");
|
|
728
|
+
lines.push("- FRAGILE: alignment_score > 30");
|
|
729
|
+
lines.push("- MISALIGNED: alignment_score <= 30");
|
|
730
|
+
lines.push("");
|
|
731
|
+
lines.push("# Outcomes");
|
|
732
|
+
lines.push("");
|
|
733
|
+
lines.push("## alignment_score");
|
|
734
|
+
lines.push("- type: number");
|
|
735
|
+
lines.push("- range: 0-100");
|
|
736
|
+
lines.push("- display: percentage");
|
|
737
|
+
lines.push("- label: Alignment Score");
|
|
738
|
+
lines.push("- primary: true");
|
|
739
|
+
lines.push("");
|
|
740
|
+
for (const signal of model.evolution.signals) {
|
|
741
|
+
const signalId = toSnakeCase(signal);
|
|
742
|
+
const signalLabel = titleCase(signal);
|
|
743
|
+
lines.push(`## ${signalId}`);
|
|
744
|
+
lines.push("- type: number");
|
|
745
|
+
lines.push("- range: 0-100");
|
|
746
|
+
lines.push("- display: percentage");
|
|
747
|
+
lines.push(`- label: ${signalLabel}`);
|
|
748
|
+
lines.push("");
|
|
749
|
+
}
|
|
750
|
+
const lensSuggestions = buildLensSuggestions(model);
|
|
751
|
+
if (lensSuggestions.length > 0) {
|
|
752
|
+
lines.push("# Lenses");
|
|
753
|
+
lines.push("- policy: role_default");
|
|
754
|
+
lines.push("");
|
|
755
|
+
for (const lens of lensSuggestions) {
|
|
756
|
+
lines.push(`## ${lens.id}`);
|
|
757
|
+
lines.push(`- tagline: ${lens.tagline}`);
|
|
758
|
+
lines.push(
|
|
759
|
+
`- description: Lens derived from ${lens.derived_from.domainA} and ${lens.derived_from.domainB} interaction, producing ${lens.derived_from.effect}.`
|
|
760
|
+
);
|
|
761
|
+
lines.push(`- formality: ${lens.tone.formality}`);
|
|
762
|
+
lines.push(`- verbosity: ${lens.tone.verbosity}`);
|
|
763
|
+
lines.push(`- emotion: ${lens.tone.emotion}`);
|
|
764
|
+
lines.push(`- confidence: ${lens.tone.confidence}`);
|
|
765
|
+
lines.push("- tags: behavioral, worldmodel, overlap");
|
|
766
|
+
lines.push("- default_for_roles: all");
|
|
767
|
+
lines.push("- priority: 50");
|
|
768
|
+
lines.push("- stackable: true");
|
|
769
|
+
lines.push("");
|
|
770
|
+
for (const directive of lens.directives) {
|
|
771
|
+
lines.push(`> ${directive.scope}: ${directive.instruction}`);
|
|
772
|
+
}
|
|
773
|
+
lines.push("");
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
return lines.join("\n");
|
|
777
|
+
}
|
|
778
|
+
function emitSignalSchema(model) {
|
|
779
|
+
const signals = model.evolution.signals.map((signal) => ({
|
|
780
|
+
id: toSnakeCase(signal),
|
|
781
|
+
name: titleCase(signal),
|
|
782
|
+
type: "number",
|
|
783
|
+
default: 70
|
|
784
|
+
}));
|
|
785
|
+
return {
|
|
786
|
+
model_id: model.frontmatter.model_id,
|
|
787
|
+
signals
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
function emitOverlapMap(model) {
|
|
791
|
+
const pairings = model.geometry.overlapEffects.map((o) => ({
|
|
792
|
+
domainA: o.domainA,
|
|
793
|
+
domainB: o.domainB,
|
|
794
|
+
effect: o.effect
|
|
795
|
+
}));
|
|
796
|
+
const matrix = {};
|
|
797
|
+
for (const overlap of model.geometry.overlapEffects) {
|
|
798
|
+
const keyA = toKebabCase2(overlap.domainA);
|
|
799
|
+
const keyB = toKebabCase2(overlap.domainB);
|
|
800
|
+
if (!matrix[keyA]) matrix[keyA] = {};
|
|
801
|
+
matrix[keyA][keyB] = overlap.effect;
|
|
802
|
+
}
|
|
803
|
+
return {
|
|
804
|
+
model_id: model.frontmatter.model_id,
|
|
805
|
+
pairings,
|
|
806
|
+
matrix
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
function emitContextsConfig(model) {
|
|
810
|
+
return {
|
|
811
|
+
model_id: model.frontmatter.model_id,
|
|
812
|
+
authority_layers: model.modifiers.authorityLayers,
|
|
813
|
+
spatial_contexts: model.modifiers.spatialContexts,
|
|
814
|
+
interpretation_rules: model.modifiers.interpretationRules
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
function deriveTone(domainA, domainB) {
|
|
818
|
+
const combined = `${domainA} ${domainB}`.toLowerCase();
|
|
819
|
+
let formality = "neutral";
|
|
820
|
+
if (/strateg|technic|analytic|research|engineer/.test(combined)) {
|
|
821
|
+
formality = "professional";
|
|
822
|
+
} else if (/narrat|story|communi|creative/.test(combined)) {
|
|
823
|
+
formality = "casual";
|
|
824
|
+
}
|
|
825
|
+
let verbosity = "balanced";
|
|
826
|
+
if (/foresight|scenario|plan|design/.test(combined)) {
|
|
827
|
+
verbosity = "detailed";
|
|
828
|
+
} else if (/prosper|negotiat|stakeholder/.test(combined)) {
|
|
829
|
+
verbosity = "concise";
|
|
830
|
+
}
|
|
831
|
+
let emotion = "neutral";
|
|
832
|
+
if (/empath|emoti|care|safe|trust/.test(combined)) {
|
|
833
|
+
emotion = "warm";
|
|
834
|
+
} else if (/analytic|system|data/.test(combined)) {
|
|
835
|
+
emotion = "clinical";
|
|
836
|
+
}
|
|
837
|
+
let confidence = "balanced";
|
|
838
|
+
if (/lead|command|decis|strateg/.test(combined)) {
|
|
839
|
+
confidence = "authoritative";
|
|
840
|
+
} else if (/explor|experiment|creat/.test(combined)) {
|
|
841
|
+
confidence = "exploratory";
|
|
842
|
+
}
|
|
843
|
+
return { formality, verbosity, emotion, confidence };
|
|
844
|
+
}
|
|
845
|
+
function buildLensSuggestions(model) {
|
|
846
|
+
const lenses = [];
|
|
847
|
+
const domainMap = new Map(model.geometry.domains.map((d) => [d.name.toLowerCase(), d]));
|
|
848
|
+
for (const overlap of model.geometry.overlapEffects) {
|
|
849
|
+
const lensId = toKebabCase2(overlap.effect);
|
|
850
|
+
const tone = deriveTone(overlap.domainA, overlap.domainB);
|
|
851
|
+
const domainAData = domainMap.get(overlap.domainA.toLowerCase());
|
|
852
|
+
const domainBData = domainMap.get(overlap.domainB.toLowerCase());
|
|
853
|
+
const directives = [];
|
|
854
|
+
if (domainAData && domainAData.skills.length > 0) {
|
|
855
|
+
directives.push({
|
|
856
|
+
scope: "response_framing",
|
|
857
|
+
instruction: `Approach through the lens of ${domainAData.skills.join(", ").toLowerCase()}.`
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
if (domainBData && domainBData.values.length > 0) {
|
|
861
|
+
directives.push({
|
|
862
|
+
scope: "behavior_shaping",
|
|
863
|
+
instruction: `Maintain ${domainBData.values.join(", ").toLowerCase()} in all responses.`
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
directives.push({
|
|
867
|
+
scope: "value_emphasis",
|
|
868
|
+
instruction: `Emphasize ${overlap.effect.toLowerCase()} as the emergent state of aligned behavior.`
|
|
869
|
+
});
|
|
870
|
+
lenses.push({
|
|
871
|
+
id: lensId,
|
|
872
|
+
name: titleCase(overlap.effect),
|
|
873
|
+
tagline: `${overlap.effect} through ${overlap.domainA} and ${overlap.domainB}.`,
|
|
874
|
+
derived_from: {
|
|
875
|
+
domainA: overlap.domainA,
|
|
876
|
+
domainB: overlap.domainB,
|
|
877
|
+
effect: overlap.effect
|
|
878
|
+
},
|
|
879
|
+
tone,
|
|
880
|
+
directives
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
return lenses;
|
|
884
|
+
}
|
|
885
|
+
function emitLensSuggestions(model) {
|
|
886
|
+
return buildLensSuggestions(model);
|
|
887
|
+
}
|
|
888
|
+
function compileWorldModel(model) {
|
|
889
|
+
return {
|
|
890
|
+
worldMarkdown: emitWorldMarkdown(model),
|
|
891
|
+
signalSchema: emitSignalSchema(model),
|
|
892
|
+
overlapMap: emitOverlapMap(model),
|
|
893
|
+
contextsConfig: emitContextsConfig(model),
|
|
894
|
+
lensSuggestions: emitLensSuggestions(model)
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// src/cli/worldmodel.ts
|
|
899
|
+
var BOLD = "\x1B[1m";
|
|
900
|
+
var DIM = "\x1B[2m";
|
|
901
|
+
var CYAN = "\x1B[36m";
|
|
902
|
+
var GREEN = "\x1B[32m";
|
|
903
|
+
var YELLOW = "\x1B[33m";
|
|
904
|
+
var RED = "\x1B[31m";
|
|
905
|
+
var MAGENTA = "\x1B[35m";
|
|
906
|
+
var RESET = "\x1B[0m";
|
|
907
|
+
var USAGE = `
|
|
908
|
+
neuroverse worldmodel \u2014 Behavioral world model toolkit
|
|
909
|
+
|
|
910
|
+
${BOLD}This file defines how a system behaves, how that behavior
|
|
911
|
+
is interpreted, and how it evolves over time.${RESET}
|
|
912
|
+
|
|
913
|
+
Commands:
|
|
914
|
+
init Scaffold a new .worldmodel.md template
|
|
915
|
+
validate Check structure and completeness
|
|
916
|
+
explain Human-readable model summary
|
|
917
|
+
build Compile to .nv-world.md + signals + overlaps + contexts + lenses
|
|
918
|
+
emit-world Emit compiled .nv-world.md to stdout
|
|
919
|
+
emit-signals Emit signal schema JSON to stdout
|
|
920
|
+
emit-lenses Emit lens suggestions JSON to stdout
|
|
921
|
+
emit-contexts Emit contextual modifiers JSON to stdout
|
|
922
|
+
emit-overlaps Emit overlap map JSON to stdout
|
|
923
|
+
|
|
924
|
+
Usage:
|
|
925
|
+
neuroverse worldmodel init [--name "Name"] [--output path]
|
|
926
|
+
neuroverse worldmodel validate <source.worldmodel.md> [--json]
|
|
927
|
+
neuroverse worldmodel explain <source.worldmodel.md> [--json]
|
|
928
|
+
neuroverse worldmodel build <source.worldmodel.md> [--output <dir>]
|
|
929
|
+
neuroverse worldmodel emit-world <source.worldmodel.md>
|
|
930
|
+
neuroverse worldmodel emit-signals <source.worldmodel.md> [--json]
|
|
931
|
+
neuroverse worldmodel emit-lenses <source.worldmodel.md> [--json]
|
|
932
|
+
neuroverse worldmodel emit-contexts <source.worldmodel.md> [--json]
|
|
933
|
+
neuroverse worldmodel emit-overlaps <source.worldmodel.md> [--json]
|
|
934
|
+
|
|
935
|
+
Examples:
|
|
936
|
+
neuroverse worldmodel init --name "Auki Vanguard"
|
|
937
|
+
neuroverse worldmodel build ./auki-vanguard.worldmodel.md --output ./world/
|
|
938
|
+
neuroverse worldmodel explain ./auki-vanguard.worldmodel.md
|
|
939
|
+
`.trim();
|
|
940
|
+
function parseArgs(argv) {
|
|
941
|
+
const args = {
|
|
942
|
+
inputPath: "",
|
|
943
|
+
output: "",
|
|
944
|
+
name: "",
|
|
945
|
+
json: false,
|
|
946
|
+
help: false
|
|
947
|
+
};
|
|
948
|
+
for (let i = 0; i < argv.length; i++) {
|
|
949
|
+
const arg = argv[i];
|
|
950
|
+
if (arg === "--json") {
|
|
951
|
+
args.json = true;
|
|
952
|
+
} else if (arg === "--help" || arg === "-h") {
|
|
953
|
+
args.help = true;
|
|
954
|
+
} else if (arg === "--output" && i + 1 < argv.length) {
|
|
955
|
+
args.output = argv[++i];
|
|
956
|
+
} else if (arg === "--name" && i + 1 < argv.length) {
|
|
957
|
+
args.name = argv[++i];
|
|
958
|
+
} else if (!arg.startsWith("--") && !args.inputPath) {
|
|
959
|
+
args.inputPath = arg;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
return args;
|
|
963
|
+
}
|
|
964
|
+
function formatIssue(issue) {
|
|
965
|
+
const color = issue.severity === "error" ? RED : issue.severity === "warning" ? YELLOW : DIM;
|
|
966
|
+
const icon = issue.severity === "error" ? "x" : issue.severity === "warning" ? "!" : "i";
|
|
967
|
+
const lineRef = issue.line > 0 ? `:${issue.line}` : "";
|
|
968
|
+
return ` ${color}${icon}${RESET} [${issue.section}${lineRef}] ${issue.message}`;
|
|
969
|
+
}
|
|
970
|
+
async function readSourceFile(inputPath) {
|
|
971
|
+
const fullPath = (0, import_path.resolve)(inputPath);
|
|
972
|
+
if (!(0, import_fs.existsSync)(fullPath)) {
|
|
973
|
+
process.stderr.write(`File not found: ${fullPath}
|
|
974
|
+
`);
|
|
975
|
+
process.exit(3);
|
|
976
|
+
}
|
|
977
|
+
return (0, import_promises.readFile)(fullPath, "utf-8");
|
|
978
|
+
}
|
|
979
|
+
async function loadAndParse(inputPath) {
|
|
980
|
+
const content = await readSourceFile(inputPath);
|
|
981
|
+
const result = parseWorldModel(content);
|
|
982
|
+
if (!result.model) {
|
|
983
|
+
process.stderr.write(`${RED}Failed to parse ${inputPath}${RESET}
|
|
984
|
+
`);
|
|
985
|
+
for (const issue of result.issues) {
|
|
986
|
+
process.stderr.write(formatIssue(issue) + "\n");
|
|
987
|
+
}
|
|
988
|
+
process.exit(1);
|
|
989
|
+
}
|
|
990
|
+
return { model: result.model, issues: result.issues };
|
|
991
|
+
}
|
|
992
|
+
async function cmdInit(argv) {
|
|
993
|
+
const args = parseArgs(argv);
|
|
994
|
+
if (args.help) {
|
|
995
|
+
process.stdout.write(
|
|
996
|
+
'neuroverse worldmodel init \u2014 Scaffold a new .worldmodel.md template\n\nOptions:\n --name <name> Model name (default: "My Behavioral Model")\n --output <path> Output path (default: ./model.worldmodel.md)\n'
|
|
997
|
+
);
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
const modelName = args.name || "My Behavioral Model";
|
|
1001
|
+
const outputPath = (0, import_path.resolve)(
|
|
1002
|
+
args.output || `./${toFileName(modelName)}.worldmodel.md`
|
|
1003
|
+
);
|
|
1004
|
+
if ((0, import_fs.existsSync)(outputPath)) {
|
|
1005
|
+
process.stderr.write(`File already exists: ${outputPath}
|
|
1006
|
+
`);
|
|
1007
|
+
process.stderr.write("Use --output to specify a different path.\n");
|
|
1008
|
+
process.exit(1);
|
|
1009
|
+
}
|
|
1010
|
+
const template = generateScaffold(modelName);
|
|
1011
|
+
const dir = (0, import_path.dirname)(outputPath);
|
|
1012
|
+
if (!(0, import_fs.existsSync)(dir)) {
|
|
1013
|
+
await (0, import_promises.mkdir)(dir, { recursive: true });
|
|
1014
|
+
}
|
|
1015
|
+
await (0, import_promises.writeFile)(outputPath, template, "utf-8");
|
|
1016
|
+
process.stderr.write(`${GREEN}Created${RESET} ${outputPath}
|
|
1017
|
+
`);
|
|
1018
|
+
process.stderr.write(
|
|
1019
|
+
`${DIM}Edit the template, then run: neuroverse worldmodel validate ${(0, import_path.basename)(outputPath)}${RESET}
|
|
1020
|
+
`
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
function toFileName(name) {
|
|
1024
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
1025
|
+
}
|
|
1026
|
+
function generateScaffold(modelName) {
|
|
1027
|
+
return `---
|
|
1028
|
+
name: ${modelName}
|
|
1029
|
+
version: 1.0.0
|
|
1030
|
+
---
|
|
1031
|
+
|
|
1032
|
+
# Core Model Geometry
|
|
1033
|
+
<!--
|
|
1034
|
+
This section defines the STRUCTURE of your behavioral system.
|
|
1035
|
+
|
|
1036
|
+
You are defining:
|
|
1037
|
+
- what the system is trying to achieve (mission)
|
|
1038
|
+
- the major domains it operates within (2-4 recommended)
|
|
1039
|
+
- the skills inside each domain
|
|
1040
|
+
- the values that govern those skills
|
|
1041
|
+
- what emerges when domains interact
|
|
1042
|
+
- what identity forms when everything is aligned
|
|
1043
|
+
|
|
1044
|
+
Think of this as the "physics" of your system.
|
|
1045
|
+
-->
|
|
1046
|
+
|
|
1047
|
+
## Mission
|
|
1048
|
+
<!-- What is this system trying to achieve? This is not a slogan \u2014 it is the core aim. -->
|
|
1049
|
+
|
|
1050
|
+
Replace with your mission statement.
|
|
1051
|
+
|
|
1052
|
+
## Domains
|
|
1053
|
+
<!--
|
|
1054
|
+
Define 2-4 domains. Each domain is a mode of operating.
|
|
1055
|
+
Each domain MUST include:
|
|
1056
|
+
- Skills (what it can do)
|
|
1057
|
+
- Values (how it must behave while doing it)
|
|
1058
|
+
|
|
1059
|
+
Domains are NOT personality traits \u2014 they are capability environments.
|
|
1060
|
+
-->
|
|
1061
|
+
|
|
1062
|
+
### Domain One
|
|
1063
|
+
|
|
1064
|
+
#### Skills
|
|
1065
|
+
- Replace with a capability
|
|
1066
|
+
- Replace with another capability
|
|
1067
|
+
|
|
1068
|
+
#### Values
|
|
1069
|
+
- Replace with a constraint
|
|
1070
|
+
- Replace with another constraint
|
|
1071
|
+
|
|
1072
|
+
### Domain Two
|
|
1073
|
+
|
|
1074
|
+
#### Skills
|
|
1075
|
+
- Replace with a capability
|
|
1076
|
+
- Replace with another capability
|
|
1077
|
+
|
|
1078
|
+
#### Values
|
|
1079
|
+
- Replace with a constraint
|
|
1080
|
+
- Replace with another constraint
|
|
1081
|
+
|
|
1082
|
+
## Overlap Effects
|
|
1083
|
+
<!--
|
|
1084
|
+
Define what emerges when TWO domains interact well.
|
|
1085
|
+
|
|
1086
|
+
Format:
|
|
1087
|
+
- Domain A + Domain B = Emergent State
|
|
1088
|
+
|
|
1089
|
+
These are NOT enforced rules.
|
|
1090
|
+
These are INTERPRETIVE STATES used downstream.
|
|
1091
|
+
|
|
1092
|
+
They answer:
|
|
1093
|
+
"What does it feel like / look like when these are working together?"
|
|
1094
|
+
-->
|
|
1095
|
+
|
|
1096
|
+
- Domain One + Domain Two = Replace With Emergent State
|
|
1097
|
+
|
|
1098
|
+
## Center Identity
|
|
1099
|
+
<!--
|
|
1100
|
+
What does the system become when all domains are aligned?
|
|
1101
|
+
This is the CORE IDENTITY of the system.
|
|
1102
|
+
-->
|
|
1103
|
+
|
|
1104
|
+
Replace with center identity name
|
|
1105
|
+
|
|
1106
|
+
# Contextual Modifiers
|
|
1107
|
+
<!--
|
|
1108
|
+
This section defines how BEHAVIOR IS INTERPRETED differently depending on context.
|
|
1109
|
+
|
|
1110
|
+
These do NOT define truth.
|
|
1111
|
+
They define how meaning changes depending on:
|
|
1112
|
+
- who is acting
|
|
1113
|
+
- where behavior occurs
|
|
1114
|
+
- what phase the system is in
|
|
1115
|
+
|
|
1116
|
+
This is what makes the model multidimensional.
|
|
1117
|
+
-->
|
|
1118
|
+
|
|
1119
|
+
## Authority Layers
|
|
1120
|
+
<!-- Who is acting? -->
|
|
1121
|
+
- founder
|
|
1122
|
+
- maintainer
|
|
1123
|
+
- contributor
|
|
1124
|
+
- agent
|
|
1125
|
+
|
|
1126
|
+
## Spatial Contexts
|
|
1127
|
+
<!-- Where is behavior happening? -->
|
|
1128
|
+
- planning
|
|
1129
|
+
- execution
|
|
1130
|
+
- deployment
|
|
1131
|
+
- governance
|
|
1132
|
+
|
|
1133
|
+
## Interpretation Rules
|
|
1134
|
+
<!--
|
|
1135
|
+
How does context change meaning?
|
|
1136
|
+
|
|
1137
|
+
Examples:
|
|
1138
|
+
- ambiguity from a founder carries more risk than ambiguity from a contributor
|
|
1139
|
+
- weak ownership in deployment is more serious than in planning
|
|
1140
|
+
-->
|
|
1141
|
+
|
|
1142
|
+
- Replace with an interpretation rule
|
|
1143
|
+
|
|
1144
|
+
# Evolution Layer
|
|
1145
|
+
<!--
|
|
1146
|
+
This section defines:
|
|
1147
|
+
- what GOOD behavior looks like
|
|
1148
|
+
- what DRIFT looks like
|
|
1149
|
+
- what can be OBSERVED
|
|
1150
|
+
- how decisions should be made
|
|
1151
|
+
- how the model EVOLVES
|
|
1152
|
+
|
|
1153
|
+
This is the EXECUTABLE layer.
|
|
1154
|
+
-->
|
|
1155
|
+
|
|
1156
|
+
## Aligned Behaviors
|
|
1157
|
+
<!-- What does success look like in action? -->
|
|
1158
|
+
- Replace with an aligned behavior
|
|
1159
|
+
|
|
1160
|
+
## Drift Behaviors
|
|
1161
|
+
<!-- What does misalignment look like? -->
|
|
1162
|
+
- Replace with a drift behavior
|
|
1163
|
+
|
|
1164
|
+
## Signals
|
|
1165
|
+
<!--
|
|
1166
|
+
What can be measured or observed?
|
|
1167
|
+
|
|
1168
|
+
Use simple snake_case identifiers:
|
|
1169
|
+
- clarity
|
|
1170
|
+
- ownership
|
|
1171
|
+
- follow_through
|
|
1172
|
+
-->
|
|
1173
|
+
|
|
1174
|
+
- clarity
|
|
1175
|
+
- ownership
|
|
1176
|
+
|
|
1177
|
+
## Decision Priorities
|
|
1178
|
+
<!--
|
|
1179
|
+
What wins when tradeoffs appear?
|
|
1180
|
+
|
|
1181
|
+
Format:
|
|
1182
|
+
- preferred > secondary
|
|
1183
|
+
-->
|
|
1184
|
+
|
|
1185
|
+
- quality > speed
|
|
1186
|
+
|
|
1187
|
+
## Evolution Conditions
|
|
1188
|
+
<!--
|
|
1189
|
+
When should the model adapt?
|
|
1190
|
+
|
|
1191
|
+
Examples:
|
|
1192
|
+
- repeated successful behavior outside assumptions should trigger review
|
|
1193
|
+
- persistent drift across scopes should trigger evolution proposal
|
|
1194
|
+
-->
|
|
1195
|
+
|
|
1196
|
+
- Replace with an evolution condition
|
|
1197
|
+
`;
|
|
1198
|
+
}
|
|
1199
|
+
async function cmdValidate(argv) {
|
|
1200
|
+
const args = parseArgs(argv);
|
|
1201
|
+
if (args.help || !args.inputPath) {
|
|
1202
|
+
process.stdout.write(
|
|
1203
|
+
"neuroverse worldmodel validate <source.worldmodel.md> [--json]\n"
|
|
1204
|
+
);
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
const content = await readSourceFile(args.inputPath);
|
|
1208
|
+
const result = parseWorldModel(content);
|
|
1209
|
+
const errors = result.issues.filter((i) => i.severity === "error");
|
|
1210
|
+
const warnings = result.issues.filter((i) => i.severity === "warning");
|
|
1211
|
+
const infos = result.issues.filter((i) => i.severity === "info");
|
|
1212
|
+
if (args.json) {
|
|
1213
|
+
const summary = result.model ? {
|
|
1214
|
+
valid: errors.length === 0,
|
|
1215
|
+
domains: result.model.geometry.domains.length,
|
|
1216
|
+
overlaps: result.model.geometry.overlapEffects.length,
|
|
1217
|
+
signals: result.model.evolution.signals.length,
|
|
1218
|
+
aligned_behaviors: result.model.evolution.alignedBehaviors.length,
|
|
1219
|
+
drift_behaviors: result.model.evolution.driftBehaviors.length,
|
|
1220
|
+
priorities: result.model.evolution.decisionPriorities.length,
|
|
1221
|
+
errors: errors.length,
|
|
1222
|
+
warnings: warnings.length
|
|
1223
|
+
} : { valid: false, errors: errors.length, warnings: warnings.length };
|
|
1224
|
+
process.stdout.write(
|
|
1225
|
+
JSON.stringify({ summary, issues: result.issues }, null, 2) + "\n"
|
|
1226
|
+
);
|
|
1227
|
+
process.exit(errors.length > 0 ? 1 : 0);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
if (errors.length === 0) {
|
|
1231
|
+
process.stderr.write(
|
|
1232
|
+
`${GREEN}Valid${RESET} ${args.inputPath}
|
|
1233
|
+
`
|
|
1234
|
+
);
|
|
1235
|
+
} else {
|
|
1236
|
+
process.stderr.write(
|
|
1237
|
+
`${RED}Invalid${RESET} ${args.inputPath}
|
|
1238
|
+
`
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1241
|
+
if (result.model) {
|
|
1242
|
+
const m = result.model;
|
|
1243
|
+
process.stderr.write(
|
|
1244
|
+
`${DIM} Domains: ${m.geometry.domains.length} Overlaps: ${m.geometry.overlapEffects.length} Signals: ${m.evolution.signals.length}${RESET}
|
|
1245
|
+
`
|
|
1246
|
+
);
|
|
1247
|
+
}
|
|
1248
|
+
if (result.issues.length > 0) {
|
|
1249
|
+
process.stderr.write("\n");
|
|
1250
|
+
for (const issue of result.issues) {
|
|
1251
|
+
process.stderr.write(formatIssue(issue) + "\n");
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
process.exit(errors.length > 0 ? 1 : 0);
|
|
1255
|
+
}
|
|
1256
|
+
async function cmdExplain(argv) {
|
|
1257
|
+
const args = parseArgs(argv);
|
|
1258
|
+
if (args.help || !args.inputPath) {
|
|
1259
|
+
process.stdout.write(
|
|
1260
|
+
"neuroverse worldmodel explain <source.worldmodel.md> [--json]\n"
|
|
1261
|
+
);
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
const { model } = await loadAndParse(args.inputPath);
|
|
1265
|
+
if (args.json) {
|
|
1266
|
+
const output = buildExplainData(model);
|
|
1267
|
+
process.stdout.write(JSON.stringify(output, null, 2) + "\n");
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
const out = process.stdout;
|
|
1271
|
+
out.write(`
|
|
1272
|
+
${BOLD}MODEL:${RESET} ${model.frontmatter.name} (v${model.frontmatter.version})
|
|
1273
|
+
|
|
1274
|
+
`);
|
|
1275
|
+
out.write(`${CYAN}${BOLD}CORE MODEL GEOMETRY${RESET}
|
|
1276
|
+
`);
|
|
1277
|
+
out.write(` ${BOLD}Mission:${RESET} ${model.geometry.mission}
|
|
1278
|
+
`);
|
|
1279
|
+
const domainNames = model.geometry.domains.map((d) => d.name).join(", ");
|
|
1280
|
+
out.write(
|
|
1281
|
+
` ${BOLD}Domains (${model.geometry.domains.length}):${RESET} ${domainNames}
|
|
1282
|
+
`
|
|
1283
|
+
);
|
|
1284
|
+
for (const domain of model.geometry.domains) {
|
|
1285
|
+
out.write(`
|
|
1286
|
+
${MAGENTA}${domain.name}${RESET}
|
|
1287
|
+
`);
|
|
1288
|
+
if (domain.skills.length > 0) {
|
|
1289
|
+
out.write(` ${DIM}Skills:${RESET} ${domain.skills.join(", ")}
|
|
1290
|
+
`);
|
|
1291
|
+
}
|
|
1292
|
+
if (domain.values.length > 0) {
|
|
1293
|
+
out.write(` ${DIM}Values:${RESET} ${domain.values.join(", ")}
|
|
1294
|
+
`);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
if (model.geometry.overlapEffects.length > 0) {
|
|
1298
|
+
out.write(`
|
|
1299
|
+
${BOLD}Overlaps (${model.geometry.overlapEffects.length}):${RESET}
|
|
1300
|
+
`);
|
|
1301
|
+
for (const o of model.geometry.overlapEffects) {
|
|
1302
|
+
out.write(` ${o.domainA} + ${o.domainB} = ${GREEN}${o.effect}${RESET}
|
|
1303
|
+
`);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
if (model.geometry.centerIdentity) {
|
|
1307
|
+
out.write(
|
|
1308
|
+
`
|
|
1309
|
+
${BOLD}Center Identity:${RESET} ${GREEN}${model.geometry.centerIdentity}${RESET}
|
|
1310
|
+
`
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
out.write(`
|
|
1314
|
+
${CYAN}${BOLD}CONTEXTUAL MODIFIERS${RESET}
|
|
1315
|
+
`);
|
|
1316
|
+
if (model.modifiers.authorityLayers.length > 0) {
|
|
1317
|
+
out.write(
|
|
1318
|
+
` ${BOLD}Authority:${RESET} ${model.modifiers.authorityLayers.join(", ")}
|
|
1319
|
+
`
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
if (model.modifiers.spatialContexts.length > 0) {
|
|
1323
|
+
out.write(
|
|
1324
|
+
` ${BOLD}Spatial:${RESET} ${model.modifiers.spatialContexts.join(", ")}
|
|
1325
|
+
`
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
if (model.modifiers.interpretationRules.length > 0) {
|
|
1329
|
+
out.write(
|
|
1330
|
+
` ${BOLD}Interpretation Rules:${RESET} ${model.modifiers.interpretationRules.length} defined
|
|
1331
|
+
`
|
|
1332
|
+
);
|
|
1333
|
+
for (const rule of model.modifiers.interpretationRules) {
|
|
1334
|
+
out.write(` ${DIM}- ${rule}${RESET}
|
|
1335
|
+
`);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
out.write(`
|
|
1339
|
+
${CYAN}${BOLD}EVOLUTION LAYER${RESET}
|
|
1340
|
+
`);
|
|
1341
|
+
out.write(
|
|
1342
|
+
` Aligned behaviors: ${model.evolution.alignedBehaviors.length} defined
|
|
1343
|
+
`
|
|
1344
|
+
);
|
|
1345
|
+
out.write(
|
|
1346
|
+
` Drift behaviors: ${model.evolution.driftBehaviors.length} defined
|
|
1347
|
+
`
|
|
1348
|
+
);
|
|
1349
|
+
out.write(
|
|
1350
|
+
` Signals: ${model.evolution.signals.length} tracked
|
|
1351
|
+
`
|
|
1352
|
+
);
|
|
1353
|
+
out.write(
|
|
1354
|
+
` Decision priorities: ${model.evolution.decisionPriorities.length} defined
|
|
1355
|
+
`
|
|
1356
|
+
);
|
|
1357
|
+
out.write(
|
|
1358
|
+
` Evolution conditions: ${model.evolution.evolutionConditions.length} defined
|
|
1359
|
+
`
|
|
1360
|
+
);
|
|
1361
|
+
out.write(`
|
|
1362
|
+
${DIM}---${RESET}
|
|
1363
|
+
`);
|
|
1364
|
+
const overlapEffects = model.geometry.overlapEffects.map((o) => o.effect).join(", ");
|
|
1365
|
+
out.write(
|
|
1366
|
+
`
|
|
1367
|
+
This model operates across ${model.geometry.domains.length} domains governed by embedded values.
|
|
1368
|
+
`
|
|
1369
|
+
);
|
|
1370
|
+
if (overlapEffects) {
|
|
1371
|
+
out.write(
|
|
1372
|
+
`It produces ${GREEN}${overlapEffects}${RESET} when domains interact well.
|
|
1373
|
+
`
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
if (model.evolution.driftBehaviors.length > 0) {
|
|
1377
|
+
const driftSample = model.evolution.driftBehaviors.slice(0, 3).join("; ");
|
|
1378
|
+
out.write(`Drift shows as: ${YELLOW}${driftSample}${RESET}.
|
|
1379
|
+
`);
|
|
1380
|
+
}
|
|
1381
|
+
if (model.geometry.centerIdentity) {
|
|
1382
|
+
out.write(
|
|
1383
|
+
`When aligned, the system becomes: ${GREEN}${BOLD}${model.geometry.centerIdentity}${RESET}.
|
|
1384
|
+
`
|
|
1385
|
+
);
|
|
1386
|
+
}
|
|
1387
|
+
out.write("\n");
|
|
1388
|
+
}
|
|
1389
|
+
function buildExplainData(model) {
|
|
1390
|
+
return {
|
|
1391
|
+
name: model.frontmatter.name,
|
|
1392
|
+
version: model.frontmatter.version,
|
|
1393
|
+
model_id: model.frontmatter.model_id,
|
|
1394
|
+
geometry: {
|
|
1395
|
+
mission: model.geometry.mission,
|
|
1396
|
+
domains: model.geometry.domains.map((d) => ({
|
|
1397
|
+
name: d.name,
|
|
1398
|
+
skills: d.skills,
|
|
1399
|
+
values: d.values
|
|
1400
|
+
})),
|
|
1401
|
+
overlaps: model.geometry.overlapEffects.map((o) => ({
|
|
1402
|
+
domainA: o.domainA,
|
|
1403
|
+
domainB: o.domainB,
|
|
1404
|
+
effect: o.effect
|
|
1405
|
+
})),
|
|
1406
|
+
centerIdentity: model.geometry.centerIdentity
|
|
1407
|
+
},
|
|
1408
|
+
modifiers: {
|
|
1409
|
+
authority: model.modifiers.authorityLayers,
|
|
1410
|
+
spatial: model.modifiers.spatialContexts,
|
|
1411
|
+
interpretationRules: model.modifiers.interpretationRules.length
|
|
1412
|
+
},
|
|
1413
|
+
evolution: {
|
|
1414
|
+
alignedBehaviors: model.evolution.alignedBehaviors.length,
|
|
1415
|
+
driftBehaviors: model.evolution.driftBehaviors.length,
|
|
1416
|
+
signals: model.evolution.signals,
|
|
1417
|
+
priorities: model.evolution.decisionPriorities.length,
|
|
1418
|
+
evolutionConditions: model.evolution.evolutionConditions.length
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
async function cmdBuild(argv) {
|
|
1423
|
+
const args = parseArgs(argv);
|
|
1424
|
+
if (args.help || !args.inputPath) {
|
|
1425
|
+
process.stdout.write(
|
|
1426
|
+
"neuroverse worldmodel build <source.worldmodel.md> [--output <dir>] [--json]\n"
|
|
1427
|
+
);
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
const { model, issues } = await loadAndParse(args.inputPath);
|
|
1431
|
+
const errors = issues.filter((i) => i.severity === "error");
|
|
1432
|
+
if (errors.length > 0) {
|
|
1433
|
+
process.stderr.write(`${RED}Cannot build \u2014 validation errors:${RESET}
|
|
1434
|
+
`);
|
|
1435
|
+
for (const issue of errors) {
|
|
1436
|
+
process.stderr.write(formatIssue(issue) + "\n");
|
|
1437
|
+
}
|
|
1438
|
+
process.exit(1);
|
|
1439
|
+
}
|
|
1440
|
+
const warnings = issues.filter((i) => i.severity === "warning");
|
|
1441
|
+
if (warnings.length > 0) {
|
|
1442
|
+
process.stderr.write(`${YELLOW}Warnings:${RESET}
|
|
1443
|
+
`);
|
|
1444
|
+
for (const issue of warnings) {
|
|
1445
|
+
process.stderr.write(formatIssue(issue) + "\n");
|
|
1446
|
+
}
|
|
1447
|
+
process.stderr.write("\n");
|
|
1448
|
+
}
|
|
1449
|
+
const output = compileWorldModel(model);
|
|
1450
|
+
const outputDir = (0, import_path.resolve)(
|
|
1451
|
+
args.output || `.neuroverse/worldmodels/${model.frontmatter.model_id}/`
|
|
1452
|
+
);
|
|
1453
|
+
if (!(0, import_fs.existsSync)(outputDir)) {
|
|
1454
|
+
await (0, import_promises.mkdir)(outputDir, { recursive: true });
|
|
1455
|
+
}
|
|
1456
|
+
const worldPath = (0, import_path.join)(outputDir, `${model.frontmatter.model_id}.nv-world.md`);
|
|
1457
|
+
const signalsPath = (0, import_path.join)(outputDir, "signals.json");
|
|
1458
|
+
const overlapsPath = (0, import_path.join)(outputDir, "overlaps.json");
|
|
1459
|
+
const contextsPath = (0, import_path.join)(outputDir, "contexts.json");
|
|
1460
|
+
const lensesPath = (0, import_path.join)(outputDir, "lenses.json");
|
|
1461
|
+
await Promise.all([
|
|
1462
|
+
(0, import_promises.writeFile)(worldPath, output.worldMarkdown, "utf-8"),
|
|
1463
|
+
(0, import_promises.writeFile)(signalsPath, JSON.stringify(output.signalSchema, null, 2) + "\n", "utf-8"),
|
|
1464
|
+
(0, import_promises.writeFile)(overlapsPath, JSON.stringify(output.overlapMap, null, 2) + "\n", "utf-8"),
|
|
1465
|
+
(0, import_promises.writeFile)(contextsPath, JSON.stringify(output.contextsConfig, null, 2) + "\n", "utf-8"),
|
|
1466
|
+
(0, import_promises.writeFile)(lensesPath, JSON.stringify(output.lensSuggestions, null, 2) + "\n", "utf-8")
|
|
1467
|
+
]);
|
|
1468
|
+
if (args.json) {
|
|
1469
|
+
process.stdout.write(
|
|
1470
|
+
JSON.stringify(
|
|
1471
|
+
{
|
|
1472
|
+
success: true,
|
|
1473
|
+
outputDir,
|
|
1474
|
+
files: {
|
|
1475
|
+
world: worldPath,
|
|
1476
|
+
signals: signalsPath,
|
|
1477
|
+
overlaps: overlapsPath,
|
|
1478
|
+
contexts: contextsPath,
|
|
1479
|
+
lenses: lensesPath
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
null,
|
|
1483
|
+
2
|
|
1484
|
+
) + "\n"
|
|
1485
|
+
);
|
|
1486
|
+
} else {
|
|
1487
|
+
process.stderr.write(`${GREEN}Built${RESET} ${model.frontmatter.name}
|
|
1488
|
+
|
|
1489
|
+
`);
|
|
1490
|
+
process.stderr.write(` ${BOLD}Output:${RESET} ${outputDir}/
|
|
1491
|
+
`);
|
|
1492
|
+
process.stderr.write(` ${(0, import_path.basename)(worldPath)}${DIM} \u2014 executable world${RESET}
|
|
1493
|
+
`);
|
|
1494
|
+
process.stderr.write(` signals.json${DIM} \u2014 signal schema${RESET}
|
|
1495
|
+
`);
|
|
1496
|
+
process.stderr.write(` overlaps.json${DIM} \u2014 overlap map${RESET}
|
|
1497
|
+
`);
|
|
1498
|
+
process.stderr.write(` contexts.json${DIM} \u2014 contextual modifiers${RESET}
|
|
1499
|
+
`);
|
|
1500
|
+
process.stderr.write(` lenses.json${DIM} \u2014 lens suggestions${RESET}
|
|
1501
|
+
|
|
1502
|
+
`);
|
|
1503
|
+
const ruleCount = model.evolution.driftBehaviors.length + model.evolution.alignedBehaviors.length + model.evolution.decisionPriorities.length;
|
|
1504
|
+
const invariantCount = model.geometry.domains.reduce(
|
|
1505
|
+
(sum, d) => sum + d.values.length,
|
|
1506
|
+
0
|
|
1507
|
+
);
|
|
1508
|
+
process.stderr.write(
|
|
1509
|
+
` ${DIM}${invariantCount} invariants, ${model.evolution.signals.length + 1} state vars, ${ruleCount} rules, 5 gates, ${model.geometry.overlapEffects.length} lenses${RESET}
|
|
1510
|
+
`
|
|
1511
|
+
);
|
|
1512
|
+
process.stderr.write(
|
|
1513
|
+
`
|
|
1514
|
+
${DIM}Next: neuroverse bootstrap --input ${worldPath} --output ${outputDir}${RESET}
|
|
1515
|
+
`
|
|
1516
|
+
);
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
async function cmdEmitWorld(argv) {
|
|
1520
|
+
const args = parseArgs(argv);
|
|
1521
|
+
if (args.help || !args.inputPath) {
|
|
1522
|
+
process.stdout.write("neuroverse worldmodel emit-world <source.worldmodel.md>\n");
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
const { model } = await loadAndParse(args.inputPath);
|
|
1526
|
+
const markdown = emitWorldMarkdown(model);
|
|
1527
|
+
if (args.output) {
|
|
1528
|
+
const dir = (0, import_path.dirname)((0, import_path.resolve)(args.output));
|
|
1529
|
+
if (!(0, import_fs.existsSync)(dir)) await (0, import_promises.mkdir)(dir, { recursive: true });
|
|
1530
|
+
await (0, import_promises.writeFile)((0, import_path.resolve)(args.output), markdown, "utf-8");
|
|
1531
|
+
process.stderr.write(`${GREEN}Written${RESET} ${args.output}
|
|
1532
|
+
`);
|
|
1533
|
+
} else {
|
|
1534
|
+
process.stdout.write(markdown);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
async function cmdEmitSignals(argv) {
|
|
1538
|
+
const args = parseArgs(argv);
|
|
1539
|
+
if (args.help || !args.inputPath) {
|
|
1540
|
+
process.stdout.write(
|
|
1541
|
+
"neuroverse worldmodel emit-signals <source.worldmodel.md> [--json]\n"
|
|
1542
|
+
);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
const { model } = await loadAndParse(args.inputPath);
|
|
1546
|
+
const schema = emitSignalSchema(model);
|
|
1547
|
+
process.stdout.write(JSON.stringify(schema, null, 2) + "\n");
|
|
1548
|
+
}
|
|
1549
|
+
async function cmdEmitLenses(argv) {
|
|
1550
|
+
const args = parseArgs(argv);
|
|
1551
|
+
if (args.help || !args.inputPath) {
|
|
1552
|
+
process.stdout.write(
|
|
1553
|
+
"neuroverse worldmodel emit-lenses <source.worldmodel.md> [--json]\n"
|
|
1554
|
+
);
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
const { model } = await loadAndParse(args.inputPath);
|
|
1558
|
+
const lenses = emitLensSuggestions(model);
|
|
1559
|
+
process.stdout.write(JSON.stringify(lenses, null, 2) + "\n");
|
|
1560
|
+
}
|
|
1561
|
+
async function cmdEmitContexts(argv) {
|
|
1562
|
+
const args = parseArgs(argv);
|
|
1563
|
+
if (args.help || !args.inputPath) {
|
|
1564
|
+
process.stdout.write(
|
|
1565
|
+
"neuroverse worldmodel emit-contexts <source.worldmodel.md> [--json]\n"
|
|
1566
|
+
);
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
const { model } = await loadAndParse(args.inputPath);
|
|
1570
|
+
const contexts = emitContextsConfig(model);
|
|
1571
|
+
process.stdout.write(JSON.stringify(contexts, null, 2) + "\n");
|
|
1572
|
+
}
|
|
1573
|
+
async function cmdEmitOverlaps(argv) {
|
|
1574
|
+
const args = parseArgs(argv);
|
|
1575
|
+
if (args.help || !args.inputPath) {
|
|
1576
|
+
process.stdout.write(
|
|
1577
|
+
"neuroverse worldmodel emit-overlaps <source.worldmodel.md> [--json]\n"
|
|
1578
|
+
);
|
|
1579
|
+
return;
|
|
1580
|
+
}
|
|
1581
|
+
const { model } = await loadAndParse(args.inputPath);
|
|
1582
|
+
const overlaps = emitOverlapMap(model);
|
|
1583
|
+
process.stdout.write(JSON.stringify(overlaps, null, 2) + "\n");
|
|
1584
|
+
}
|
|
1585
|
+
async function main(argv = process.argv.slice(2)) {
|
|
1586
|
+
const subcommand = argv[0] ?? "";
|
|
1587
|
+
const subArgs = argv.slice(1);
|
|
1588
|
+
switch (subcommand) {
|
|
1589
|
+
case "init":
|
|
1590
|
+
return cmdInit(subArgs);
|
|
1591
|
+
case "validate":
|
|
1592
|
+
return cmdValidate(subArgs);
|
|
1593
|
+
case "explain":
|
|
1594
|
+
return cmdExplain(subArgs);
|
|
1595
|
+
case "build":
|
|
1596
|
+
return cmdBuild(subArgs);
|
|
1597
|
+
case "emit-world":
|
|
1598
|
+
return cmdEmitWorld(subArgs);
|
|
1599
|
+
case "emit-signals":
|
|
1600
|
+
return cmdEmitSignals(subArgs);
|
|
1601
|
+
case "emit-lenses":
|
|
1602
|
+
return cmdEmitLenses(subArgs);
|
|
1603
|
+
case "emit-contexts":
|
|
1604
|
+
return cmdEmitContexts(subArgs);
|
|
1605
|
+
case "emit-overlaps":
|
|
1606
|
+
return cmdEmitOverlaps(subArgs);
|
|
1607
|
+
case "--help":
|
|
1608
|
+
case "-h":
|
|
1609
|
+
case "help":
|
|
1610
|
+
case "":
|
|
1611
|
+
process.stdout.write(USAGE + "\n");
|
|
1612
|
+
break;
|
|
1613
|
+
default:
|
|
1614
|
+
process.stderr.write(`Unknown worldmodel command: "${subcommand}"
|
|
1615
|
+
|
|
1616
|
+
`);
|
|
1617
|
+
process.stdout.write(USAGE + "\n");
|
|
1618
|
+
process.exit(1);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1622
|
+
0 && (module.exports = {
|
|
1623
|
+
main
|
|
1624
|
+
});
|