@neuroverseos/governance 0.5.1 → 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 +55 -0
- package/dist/adapters/autoresearch.js +2 -2
- package/dist/adapters/deep-agents.js +2 -2
- package/dist/adapters/express.js +2 -2
- package/dist/adapters/github.js +2 -2
- package/dist/adapters/index.js +8 -8
- package/dist/adapters/langchain.js +2 -2
- package/dist/adapters/mentraos.js +2 -2
- package/dist/adapters/openai.js +2 -2
- package/dist/adapters/openclaw.js +2 -2
- package/dist/{add-JP7TC2K3.js → add-XSANI3FK.js} +1 -1
- package/dist/{build-THUEYMVT.js → build-UTVDGHB3.js} +4 -4
- package/dist/{chunk-TZBERHFM.js → chunk-7FL3U7Z5.js} +1 -1
- package/dist/{chunk-FGOSKQDE.js → chunk-A2UZTLRV.js} +1 -1
- package/dist/{chunk-R23T5SZG.js → chunk-B3IIPTY3.js} +1 -1
- package/dist/chunk-EQR7BGFN.js +337 -0
- package/dist/{chunk-LAKUB76X.js → chunk-FDPPZLSQ.js} +1 -1
- package/dist/{chunk-UZBW44KD.js → chunk-FKQCPRKI.js} +1 -1
- package/dist/{chunk-XPMZB46F.js → chunk-FS2UUJJO.js} +3 -3
- package/dist/{chunk-6UPEUMJ2.js → chunk-HDNDL6D5.js} +1 -1
- package/dist/{chunk-7UU7V3AD.js → chunk-IOVXB6QN.js} +1 -1
- package/dist/{chunk-EK77AJAH.js → chunk-OTZU76DH.js} +1 -1
- package/dist/{chunk-5RAQ5DZW.js → chunk-T6GMRZWC.js} +1 -1
- package/dist/{chunk-RF2L5SYG.js → chunk-TIXVEPS2.js} +1 -1
- package/dist/{chunk-TL4DLMMW.js → chunk-TJ5L2UTE.js} +1 -1
- package/dist/chunk-UGTNKTHS.js +542 -0
- package/dist/cli/neuroverse.cjs +1987 -303
- package/dist/cli/neuroverse.js +27 -19
- package/dist/cli/plan.js +1 -1
- package/dist/cli/run.js +2 -2
- 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-N5K4VXJW.js → demo-6W3YXLAX.js} +2 -2
- package/dist/{derive-5LOMN7GO.js → derive-42IJW7JI.js} +3 -3
- 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-PYCJ3Q4U.js → equity-penalties-CCO3GVHS.js} +1 -1
- package/dist/{explain-42TVC3QD.js → explain-HDFN4ION.js} +1 -1
- package/dist/{guard-TPYDFG6V.js → guard-IHJEKHL2.js} +1 -1
- package/dist/{improve-HLZGJ54Z.js → improve-LRORRYEX.js} +1 -1
- package/dist/index.js +48 -48
- package/dist/{lens-NFGZHD76.js → lens-TLDZQXBI.js} +61 -2
- package/dist/{mcp-server-5XXNG6VC.js → mcp-server-CKYBHXWK.js} +2 -2
- package/dist/{playground-2EU5CFIH.js → playground-3TTBN7XD.js} +1 -1
- package/dist/{redteam-VK6OVHAE.js → redteam-W644UMWN.js} +1 -1
- package/dist/{session-NGA4DUPL.js → session-FMAROEIE.js} +2 -2
- package/dist/{simulate-4YNOBMES.js → simulate-VT437EEL.js} +1 -1
- package/dist/{test-HDBPMQTG.js → test-XDB2DH3L.js} +1 -1
- package/dist/{validate-6MFQZ2EG.js → validate-M52DX22Y.js} +1 -1
- package/dist/{world-H5WVURKU.js → world-O4HTQPDP.js} +1 -1
- package/dist/{world-loader-J47PCPDZ.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 +2 -2
- package/dist/{bootstrap-IP5QMC3Q.js → bootstrap-2OW5ZLBL.js} +3 -3
- package/dist/{chunk-QZ666FCV.js → chunk-735Z3HA4.js} +3 -3
- /package/dist/{chunk-EQUAWNXW.js → chunk-I4RTIMLX.js} +0 -0
- /package/dist/{doctor-Q5APJOTS.js → doctor-XEMLO6UA.js} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
handleListPresets,
|
|
7
7
|
handleReasonRequest,
|
|
8
8
|
writeTempWorld
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7FL3U7Z5.js";
|
|
10
10
|
import {
|
|
11
11
|
adaptationFromVerdict,
|
|
12
12
|
detectBehavioralPatterns,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
DEFAULT_BUNDLED_WORLD,
|
|
20
20
|
loadBundledWorld,
|
|
21
21
|
loadWorld
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-I4RTIMLX.js";
|
|
23
23
|
import "./chunk-ZAF6JH23.js";
|
|
24
24
|
import "./chunk-QLPTHTVB.js";
|
|
25
25
|
import {
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
DeriveInputError,
|
|
3
3
|
DeriveProviderError,
|
|
4
4
|
deriveWorld
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-735Z3HA4.js";
|
|
6
6
|
import {
|
|
7
7
|
DERIVE_EXIT_CODES
|
|
8
8
|
} from "./chunk-FMSTRBBS.js";
|
|
9
9
|
import "./chunk-OT6PXH54.js";
|
|
10
10
|
import "./chunk-INWQHLPS.js";
|
|
11
11
|
import "./chunk-7P3S7MAY.js";
|
|
12
|
-
import "./chunk-3NZMMSOW.js";
|
|
13
12
|
import "./chunk-YPCVY4GS.js";
|
|
13
|
+
import "./chunk-3NZMMSOW.js";
|
|
14
14
|
import "./chunk-QWGCMQQD.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/derive.ts
|
|
@@ -121,7 +121,7 @@ Normalization: ${n.fixCount} fix(es) applied
|
|
|
121
121
|
process.stderr.write(`
|
|
122
122
|
Bootstrapping to ${args.bootstrapDir}...
|
|
123
123
|
`);
|
|
124
|
-
const { main: bootstrapMain } = await import("./bootstrap-
|
|
124
|
+
const { main: bootstrapMain } = await import("./bootstrap-2OW5ZLBL.js");
|
|
125
125
|
await bootstrapMain([
|
|
126
126
|
"--input",
|
|
127
127
|
result.outputPath,
|
|
@@ -0,0 +1,366 @@
|
|
|
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/engine/worldmodel-compiler.ts
|
|
21
|
+
var worldmodel_compiler_exports = {};
|
|
22
|
+
__export(worldmodel_compiler_exports, {
|
|
23
|
+
compileWorldModel: () => compileWorldModel,
|
|
24
|
+
emitContextsConfig: () => emitContextsConfig,
|
|
25
|
+
emitLensSuggestions: () => emitLensSuggestions,
|
|
26
|
+
emitOverlapMap: () => emitOverlapMap,
|
|
27
|
+
emitSignalSchema: () => emitSignalSchema,
|
|
28
|
+
emitWorldMarkdown: () => emitWorldMarkdown
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(worldmodel_compiler_exports);
|
|
31
|
+
function toSnakeCase(text) {
|
|
32
|
+
return text.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
|
|
33
|
+
}
|
|
34
|
+
function toKebabCase(text) {
|
|
35
|
+
return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
36
|
+
}
|
|
37
|
+
function titleCase(text) {
|
|
38
|
+
return text.split(/[\s_-]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ");
|
|
39
|
+
}
|
|
40
|
+
function matchSignal(behaviorText, signals) {
|
|
41
|
+
const lowerText = behaviorText.toLowerCase();
|
|
42
|
+
for (const signal of signals) {
|
|
43
|
+
const signalWords = signal.toLowerCase().split("_");
|
|
44
|
+
if (signalWords.some((w) => w.length > 3 && lowerText.includes(w))) {
|
|
45
|
+
return signal;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return "alignment_score";
|
|
49
|
+
}
|
|
50
|
+
function emitWorldMarkdown(model) {
|
|
51
|
+
const lines = [];
|
|
52
|
+
const worldId = model.frontmatter.model_id;
|
|
53
|
+
const worldName = model.frontmatter.name;
|
|
54
|
+
const version = model.frontmatter.version;
|
|
55
|
+
lines.push("---");
|
|
56
|
+
lines.push(`world_id: ${worldId}`);
|
|
57
|
+
lines.push(`name: ${worldName}`);
|
|
58
|
+
lines.push(`version: ${version}`);
|
|
59
|
+
lines.push("runtime_mode: COMPLIANCE");
|
|
60
|
+
lines.push("default_profile: aligned");
|
|
61
|
+
lines.push("alternative_profile: drifting");
|
|
62
|
+
lines.push("---");
|
|
63
|
+
lines.push("");
|
|
64
|
+
lines.push("# Thesis");
|
|
65
|
+
lines.push("");
|
|
66
|
+
lines.push(model.geometry.mission);
|
|
67
|
+
if (model.geometry.centerIdentity) {
|
|
68
|
+
lines.push(
|
|
69
|
+
`When all domains are aligned, the system operates as: ${model.geometry.centerIdentity}.`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
lines.push("");
|
|
73
|
+
lines.push("# Invariants");
|
|
74
|
+
lines.push("");
|
|
75
|
+
let invariantIdx = 0;
|
|
76
|
+
for (const domain of model.geometry.domains) {
|
|
77
|
+
for (const value of domain.values) {
|
|
78
|
+
invariantIdx++;
|
|
79
|
+
const invId = `${toSnakeCase(domain.name)}_value_${String(invariantIdx).padStart(2, "0")}`;
|
|
80
|
+
lines.push(
|
|
81
|
+
`- \`${invId}\` \u2014 ${value} [${domain.name}] (structural, immutable)`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
lines.push("");
|
|
86
|
+
lines.push("# State");
|
|
87
|
+
lines.push("");
|
|
88
|
+
lines.push("## alignment_score");
|
|
89
|
+
lines.push("- type: number");
|
|
90
|
+
lines.push("- min: 0");
|
|
91
|
+
lines.push("- max: 100");
|
|
92
|
+
lines.push("- step: 5");
|
|
93
|
+
lines.push("- default: 70");
|
|
94
|
+
lines.push("- label: Alignment Score");
|
|
95
|
+
lines.push(
|
|
96
|
+
"- description: Composite behavioral alignment metric derived from all signals"
|
|
97
|
+
);
|
|
98
|
+
lines.push("");
|
|
99
|
+
for (const signal of model.evolution.signals) {
|
|
100
|
+
const signalId = toSnakeCase(signal);
|
|
101
|
+
const signalLabel = titleCase(signal);
|
|
102
|
+
lines.push(`## ${signalId}`);
|
|
103
|
+
lines.push("- type: number");
|
|
104
|
+
lines.push("- min: 0");
|
|
105
|
+
lines.push("- max: 100");
|
|
106
|
+
lines.push("- step: 5");
|
|
107
|
+
lines.push("- default: 70");
|
|
108
|
+
lines.push(`- label: ${signalLabel}`);
|
|
109
|
+
lines.push(`- description: Behavioral signal measuring ${signal.replace(/_/g, " ")}`);
|
|
110
|
+
lines.push("");
|
|
111
|
+
}
|
|
112
|
+
lines.push("# Assumptions");
|
|
113
|
+
lines.push("");
|
|
114
|
+
lines.push("## aligned");
|
|
115
|
+
lines.push("- name: Aligned");
|
|
116
|
+
lines.push("- description: All behavioral signals at healthy levels");
|
|
117
|
+
lines.push("- pressure_level: low");
|
|
118
|
+
lines.push("");
|
|
119
|
+
lines.push("## drifting");
|
|
120
|
+
lines.push("- name: Drifting");
|
|
121
|
+
lines.push("- description: Behavioral signals under pressure with drift risk");
|
|
122
|
+
lines.push("- pressure_level: high");
|
|
123
|
+
lines.push("");
|
|
124
|
+
lines.push("# Rules");
|
|
125
|
+
lines.push("");
|
|
126
|
+
let ruleIdx = 0;
|
|
127
|
+
for (const drift of model.evolution.driftBehaviors) {
|
|
128
|
+
ruleIdx++;
|
|
129
|
+
const ruleId = `rule-${String(ruleIdx).padStart(3, "0")}`;
|
|
130
|
+
const matchedSignal = matchSignal(drift, model.evolution.signals);
|
|
131
|
+
const signalId = toSnakeCase(matchedSignal);
|
|
132
|
+
lines.push(`## ${ruleId}: ${drift} (degradation)`);
|
|
133
|
+
lines.push(`Drift behavior detected: ${drift}`);
|
|
134
|
+
lines.push("");
|
|
135
|
+
lines.push(`When ${signalId} < 50 [state]`);
|
|
136
|
+
lines.push("Then alignment_score *= 0.80");
|
|
137
|
+
lines.push("");
|
|
138
|
+
lines.push(`> trigger: ${signalId} drops below threshold`);
|
|
139
|
+
lines.push(`> rule: Drift behavior weakens alignment`);
|
|
140
|
+
lines.push(`> shift: Behavioral alignment decreases`);
|
|
141
|
+
lines.push(`> effect: Alignment score reduced by 20%`);
|
|
142
|
+
lines.push("");
|
|
143
|
+
}
|
|
144
|
+
for (const aligned of model.evolution.alignedBehaviors) {
|
|
145
|
+
ruleIdx++;
|
|
146
|
+
const ruleId = `rule-${String(ruleIdx).padStart(3, "0")}`;
|
|
147
|
+
const matchedSignal = matchSignal(aligned, model.evolution.signals);
|
|
148
|
+
const signalId = toSnakeCase(matchedSignal);
|
|
149
|
+
lines.push(`## ${ruleId}: ${aligned} (advantage)`);
|
|
150
|
+
lines.push(`Aligned behavior reinforced: ${aligned}`);
|
|
151
|
+
lines.push("");
|
|
152
|
+
lines.push(`When ${signalId} >= 70 [state]`);
|
|
153
|
+
lines.push("Then alignment_score *= 1.10");
|
|
154
|
+
lines.push("");
|
|
155
|
+
lines.push(`> trigger: ${signalId} above healthy threshold`);
|
|
156
|
+
lines.push(`> rule: Aligned behavior strengthens system`);
|
|
157
|
+
lines.push(`> shift: Behavioral alignment increases`);
|
|
158
|
+
lines.push(`> effect: Alignment score boosted by 10%`);
|
|
159
|
+
lines.push("");
|
|
160
|
+
}
|
|
161
|
+
for (let i = 0; i < model.evolution.decisionPriorities.length; i++) {
|
|
162
|
+
ruleIdx++;
|
|
163
|
+
const priority = model.evolution.decisionPriorities[i];
|
|
164
|
+
const ruleId = `rule-${String(ruleIdx).padStart(3, "0")}`;
|
|
165
|
+
lines.push(
|
|
166
|
+
`## ${ruleId}: ${priority.preferred} over ${priority.over} (structural)`
|
|
167
|
+
);
|
|
168
|
+
lines.push(
|
|
169
|
+
`Priority: ${priority.preferred} takes precedence over ${priority.over} in tradeoff situations.`
|
|
170
|
+
);
|
|
171
|
+
lines.push("");
|
|
172
|
+
lines.push("When alignment_score < 40 [state]");
|
|
173
|
+
lines.push("Then alignment_score *= 0.70");
|
|
174
|
+
lines.push("Collapse: alignment_score < 10");
|
|
175
|
+
lines.push("");
|
|
176
|
+
lines.push(`> trigger: Alignment score critically low`);
|
|
177
|
+
lines.push(
|
|
178
|
+
`> rule: Priority violation \u2014 ${priority.preferred} must outweigh ${priority.over}`
|
|
179
|
+
);
|
|
180
|
+
lines.push(`> shift: System enters structural enforcement`);
|
|
181
|
+
lines.push(`> effect: Alignment sharply reduced; collapse if critical`);
|
|
182
|
+
lines.push("");
|
|
183
|
+
}
|
|
184
|
+
lines.push("# Gates");
|
|
185
|
+
lines.push("");
|
|
186
|
+
lines.push("- STRONG: alignment_score >= 85");
|
|
187
|
+
lines.push("- STABLE: alignment_score >= 65");
|
|
188
|
+
lines.push("- WATCHING: alignment_score >= 45");
|
|
189
|
+
lines.push("- FRAGILE: alignment_score > 30");
|
|
190
|
+
lines.push("- MISALIGNED: alignment_score <= 30");
|
|
191
|
+
lines.push("");
|
|
192
|
+
lines.push("# Outcomes");
|
|
193
|
+
lines.push("");
|
|
194
|
+
lines.push("## alignment_score");
|
|
195
|
+
lines.push("- type: number");
|
|
196
|
+
lines.push("- range: 0-100");
|
|
197
|
+
lines.push("- display: percentage");
|
|
198
|
+
lines.push("- label: Alignment Score");
|
|
199
|
+
lines.push("- primary: true");
|
|
200
|
+
lines.push("");
|
|
201
|
+
for (const signal of model.evolution.signals) {
|
|
202
|
+
const signalId = toSnakeCase(signal);
|
|
203
|
+
const signalLabel = titleCase(signal);
|
|
204
|
+
lines.push(`## ${signalId}`);
|
|
205
|
+
lines.push("- type: number");
|
|
206
|
+
lines.push("- range: 0-100");
|
|
207
|
+
lines.push("- display: percentage");
|
|
208
|
+
lines.push(`- label: ${signalLabel}`);
|
|
209
|
+
lines.push("");
|
|
210
|
+
}
|
|
211
|
+
const lensSuggestions = buildLensSuggestions(model);
|
|
212
|
+
if (lensSuggestions.length > 0) {
|
|
213
|
+
lines.push("# Lenses");
|
|
214
|
+
lines.push("- policy: role_default");
|
|
215
|
+
lines.push("");
|
|
216
|
+
for (const lens of lensSuggestions) {
|
|
217
|
+
lines.push(`## ${lens.id}`);
|
|
218
|
+
lines.push(`- tagline: ${lens.tagline}`);
|
|
219
|
+
lines.push(
|
|
220
|
+
`- description: Lens derived from ${lens.derived_from.domainA} and ${lens.derived_from.domainB} interaction, producing ${lens.derived_from.effect}.`
|
|
221
|
+
);
|
|
222
|
+
lines.push(`- formality: ${lens.tone.formality}`);
|
|
223
|
+
lines.push(`- verbosity: ${lens.tone.verbosity}`);
|
|
224
|
+
lines.push(`- emotion: ${lens.tone.emotion}`);
|
|
225
|
+
lines.push(`- confidence: ${lens.tone.confidence}`);
|
|
226
|
+
lines.push("- tags: behavioral, worldmodel, overlap");
|
|
227
|
+
lines.push("- default_for_roles: all");
|
|
228
|
+
lines.push("- priority: 50");
|
|
229
|
+
lines.push("- stackable: true");
|
|
230
|
+
lines.push("");
|
|
231
|
+
for (const directive of lens.directives) {
|
|
232
|
+
lines.push(`> ${directive.scope}: ${directive.instruction}`);
|
|
233
|
+
}
|
|
234
|
+
lines.push("");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return lines.join("\n");
|
|
238
|
+
}
|
|
239
|
+
function emitSignalSchema(model) {
|
|
240
|
+
const signals = model.evolution.signals.map((signal) => ({
|
|
241
|
+
id: toSnakeCase(signal),
|
|
242
|
+
name: titleCase(signal),
|
|
243
|
+
type: "number",
|
|
244
|
+
default: 70
|
|
245
|
+
}));
|
|
246
|
+
return {
|
|
247
|
+
model_id: model.frontmatter.model_id,
|
|
248
|
+
signals
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function emitOverlapMap(model) {
|
|
252
|
+
const pairings = model.geometry.overlapEffects.map((o) => ({
|
|
253
|
+
domainA: o.domainA,
|
|
254
|
+
domainB: o.domainB,
|
|
255
|
+
effect: o.effect
|
|
256
|
+
}));
|
|
257
|
+
const matrix = {};
|
|
258
|
+
for (const overlap of model.geometry.overlapEffects) {
|
|
259
|
+
const keyA = toKebabCase(overlap.domainA);
|
|
260
|
+
const keyB = toKebabCase(overlap.domainB);
|
|
261
|
+
if (!matrix[keyA]) matrix[keyA] = {};
|
|
262
|
+
matrix[keyA][keyB] = overlap.effect;
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
model_id: model.frontmatter.model_id,
|
|
266
|
+
pairings,
|
|
267
|
+
matrix
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function emitContextsConfig(model) {
|
|
271
|
+
return {
|
|
272
|
+
model_id: model.frontmatter.model_id,
|
|
273
|
+
authority_layers: model.modifiers.authorityLayers,
|
|
274
|
+
spatial_contexts: model.modifiers.spatialContexts,
|
|
275
|
+
interpretation_rules: model.modifiers.interpretationRules
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function deriveTone(domainA, domainB) {
|
|
279
|
+
const combined = `${domainA} ${domainB}`.toLowerCase();
|
|
280
|
+
let formality = "neutral";
|
|
281
|
+
if (/strateg|technic|analytic|research|engineer/.test(combined)) {
|
|
282
|
+
formality = "professional";
|
|
283
|
+
} else if (/narrat|story|communi|creative/.test(combined)) {
|
|
284
|
+
formality = "casual";
|
|
285
|
+
}
|
|
286
|
+
let verbosity = "balanced";
|
|
287
|
+
if (/foresight|scenario|plan|design/.test(combined)) {
|
|
288
|
+
verbosity = "detailed";
|
|
289
|
+
} else if (/prosper|negotiat|stakeholder/.test(combined)) {
|
|
290
|
+
verbosity = "concise";
|
|
291
|
+
}
|
|
292
|
+
let emotion = "neutral";
|
|
293
|
+
if (/empath|emoti|care|safe|trust/.test(combined)) {
|
|
294
|
+
emotion = "warm";
|
|
295
|
+
} else if (/analytic|system|data/.test(combined)) {
|
|
296
|
+
emotion = "clinical";
|
|
297
|
+
}
|
|
298
|
+
let confidence = "balanced";
|
|
299
|
+
if (/lead|command|decis|strateg/.test(combined)) {
|
|
300
|
+
confidence = "authoritative";
|
|
301
|
+
} else if (/explor|experiment|creat/.test(combined)) {
|
|
302
|
+
confidence = "exploratory";
|
|
303
|
+
}
|
|
304
|
+
return { formality, verbosity, emotion, confidence };
|
|
305
|
+
}
|
|
306
|
+
function buildLensSuggestions(model) {
|
|
307
|
+
const lenses = [];
|
|
308
|
+
const domainMap = new Map(model.geometry.domains.map((d) => [d.name.toLowerCase(), d]));
|
|
309
|
+
for (const overlap of model.geometry.overlapEffects) {
|
|
310
|
+
const lensId = toKebabCase(overlap.effect);
|
|
311
|
+
const tone = deriveTone(overlap.domainA, overlap.domainB);
|
|
312
|
+
const domainAData = domainMap.get(overlap.domainA.toLowerCase());
|
|
313
|
+
const domainBData = domainMap.get(overlap.domainB.toLowerCase());
|
|
314
|
+
const directives = [];
|
|
315
|
+
if (domainAData && domainAData.skills.length > 0) {
|
|
316
|
+
directives.push({
|
|
317
|
+
scope: "response_framing",
|
|
318
|
+
instruction: `Approach through the lens of ${domainAData.skills.join(", ").toLowerCase()}.`
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
if (domainBData && domainBData.values.length > 0) {
|
|
322
|
+
directives.push({
|
|
323
|
+
scope: "behavior_shaping",
|
|
324
|
+
instruction: `Maintain ${domainBData.values.join(", ").toLowerCase()} in all responses.`
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
directives.push({
|
|
328
|
+
scope: "value_emphasis",
|
|
329
|
+
instruction: `Emphasize ${overlap.effect.toLowerCase()} as the emergent state of aligned behavior.`
|
|
330
|
+
});
|
|
331
|
+
lenses.push({
|
|
332
|
+
id: lensId,
|
|
333
|
+
name: titleCase(overlap.effect),
|
|
334
|
+
tagline: `${overlap.effect} through ${overlap.domainA} and ${overlap.domainB}.`,
|
|
335
|
+
derived_from: {
|
|
336
|
+
domainA: overlap.domainA,
|
|
337
|
+
domainB: overlap.domainB,
|
|
338
|
+
effect: overlap.effect
|
|
339
|
+
},
|
|
340
|
+
tone,
|
|
341
|
+
directives
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
return lenses;
|
|
345
|
+
}
|
|
346
|
+
function emitLensSuggestions(model) {
|
|
347
|
+
return buildLensSuggestions(model);
|
|
348
|
+
}
|
|
349
|
+
function compileWorldModel(model) {
|
|
350
|
+
return {
|
|
351
|
+
worldMarkdown: emitWorldMarkdown(model),
|
|
352
|
+
signalSchema: emitSignalSchema(model),
|
|
353
|
+
overlapMap: emitOverlapMap(model),
|
|
354
|
+
contextsConfig: emitContextsConfig(model),
|
|
355
|
+
lensSuggestions: emitLensSuggestions(model)
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
359
|
+
0 && (module.exports = {
|
|
360
|
+
compileWorldModel,
|
|
361
|
+
emitContextsConfig,
|
|
362
|
+
emitLensSuggestions,
|
|
363
|
+
emitOverlapMap,
|
|
364
|
+
emitSignalSchema,
|
|
365
|
+
emitWorldMarkdown
|
|
366
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { P as ParsedWorldModel, W as WorldModelOutput, C as ContextsConfig, L as LensSuggestion, O as OverlapMap, S as SignalSchema } from '../worldmodel-contract-BPGhiuW5.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WorldModel Compiler — ParsedWorldModel → .nv-world.md + Artifacts
|
|
5
|
+
*
|
|
6
|
+
* Deterministic compiler that transforms a three-layer behavioral model
|
|
7
|
+
* into executable NeuroVerse governance artifacts.
|
|
8
|
+
*
|
|
9
|
+
* Layer Mapping:
|
|
10
|
+
* Core Model Geometry → thesis, invariants, lenses, overlaps.json
|
|
11
|
+
* Contextual Modifiers → contexts.json
|
|
12
|
+
* Evolution Layer → state, rules, gates, outcomes, signals.json
|
|
13
|
+
*
|
|
14
|
+
* The generated .nv-world.md is valid for bootstrap-parser.ts (round-trip safe).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Compile ParsedWorldModel into a valid .nv-world.md string.
|
|
19
|
+
*
|
|
20
|
+
* The output is designed to parse cleanly through bootstrap-parser.ts.
|
|
21
|
+
*/
|
|
22
|
+
declare function emitWorldMarkdown(model: ParsedWorldModel): string;
|
|
23
|
+
/**
|
|
24
|
+
* Emit the signal schema as a structured JSON-serializable object.
|
|
25
|
+
*/
|
|
26
|
+
declare function emitSignalSchema(model: ParsedWorldModel): SignalSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Emit the overlap map as a structured JSON-serializable object.
|
|
29
|
+
*/
|
|
30
|
+
declare function emitOverlapMap(model: ParsedWorldModel): OverlapMap;
|
|
31
|
+
/**
|
|
32
|
+
* Emit the contextual modifiers as a structured JSON-serializable object.
|
|
33
|
+
*/
|
|
34
|
+
declare function emitContextsConfig(model: ParsedWorldModel): ContextsConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Emit lens suggestions as a structured JSON-serializable array.
|
|
37
|
+
*/
|
|
38
|
+
declare function emitLensSuggestions(model: ParsedWorldModel): LensSuggestion[];
|
|
39
|
+
/**
|
|
40
|
+
* Compile a ParsedWorldModel into all output artifacts.
|
|
41
|
+
*
|
|
42
|
+
* Deterministic. Same input → same output. No LLM calls.
|
|
43
|
+
*/
|
|
44
|
+
declare function compileWorldModel(model: ParsedWorldModel): WorldModelOutput;
|
|
45
|
+
|
|
46
|
+
export { compileWorldModel, emitContextsConfig, emitLensSuggestions, emitOverlapMap, emitSignalSchema, emitWorldMarkdown };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { P as ParsedWorldModel, W as WorldModelOutput, C as ContextsConfig, L as LensSuggestion, O as OverlapMap, S as SignalSchema } from '../worldmodel-contract-BPGhiuW5.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WorldModel Compiler — ParsedWorldModel → .nv-world.md + Artifacts
|
|
5
|
+
*
|
|
6
|
+
* Deterministic compiler that transforms a three-layer behavioral model
|
|
7
|
+
* into executable NeuroVerse governance artifacts.
|
|
8
|
+
*
|
|
9
|
+
* Layer Mapping:
|
|
10
|
+
* Core Model Geometry → thesis, invariants, lenses, overlaps.json
|
|
11
|
+
* Contextual Modifiers → contexts.json
|
|
12
|
+
* Evolution Layer → state, rules, gates, outcomes, signals.json
|
|
13
|
+
*
|
|
14
|
+
* The generated .nv-world.md is valid for bootstrap-parser.ts (round-trip safe).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Compile ParsedWorldModel into a valid .nv-world.md string.
|
|
19
|
+
*
|
|
20
|
+
* The output is designed to parse cleanly through bootstrap-parser.ts.
|
|
21
|
+
*/
|
|
22
|
+
declare function emitWorldMarkdown(model: ParsedWorldModel): string;
|
|
23
|
+
/**
|
|
24
|
+
* Emit the signal schema as a structured JSON-serializable object.
|
|
25
|
+
*/
|
|
26
|
+
declare function emitSignalSchema(model: ParsedWorldModel): SignalSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Emit the overlap map as a structured JSON-serializable object.
|
|
29
|
+
*/
|
|
30
|
+
declare function emitOverlapMap(model: ParsedWorldModel): OverlapMap;
|
|
31
|
+
/**
|
|
32
|
+
* Emit the contextual modifiers as a structured JSON-serializable object.
|
|
33
|
+
*/
|
|
34
|
+
declare function emitContextsConfig(model: ParsedWorldModel): ContextsConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Emit lens suggestions as a structured JSON-serializable array.
|
|
37
|
+
*/
|
|
38
|
+
declare function emitLensSuggestions(model: ParsedWorldModel): LensSuggestion[];
|
|
39
|
+
/**
|
|
40
|
+
* Compile a ParsedWorldModel into all output artifacts.
|
|
41
|
+
*
|
|
42
|
+
* Deterministic. Same input → same output. No LLM calls.
|
|
43
|
+
*/
|
|
44
|
+
declare function compileWorldModel(model: ParsedWorldModel): WorldModelOutput;
|
|
45
|
+
|
|
46
|
+
export { compileWorldModel, emitContextsConfig, emitLensSuggestions, emitOverlapMap, emitSignalSchema, emitWorldMarkdown };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compileWorldModel,
|
|
3
|
+
emitContextsConfig,
|
|
4
|
+
emitLensSuggestions,
|
|
5
|
+
emitOverlapMap,
|
|
6
|
+
emitSignalSchema,
|
|
7
|
+
emitWorldMarkdown
|
|
8
|
+
} from "../chunk-EQR7BGFN.js";
|
|
9
|
+
import "../chunk-QWGCMQQD.js";
|
|
10
|
+
export {
|
|
11
|
+
compileWorldModel,
|
|
12
|
+
emitContextsConfig,
|
|
13
|
+
emitLensSuggestions,
|
|
14
|
+
emitOverlapMap,
|
|
15
|
+
emitSignalSchema,
|
|
16
|
+
emitWorldMarkdown
|
|
17
|
+
};
|