@neuroverseos/governance 0.3.4 → 0.4.1
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 +280 -405
- package/dist/adapters/autoresearch.cjs +63 -9
- package/dist/adapters/autoresearch.d.cts +2 -1
- package/dist/adapters/autoresearch.d.ts +2 -1
- package/dist/adapters/autoresearch.js +3 -3
- package/dist/adapters/deep-agents.cjs +63 -9
- package/dist/adapters/deep-agents.d.cts +3 -2
- package/dist/adapters/deep-agents.d.ts +3 -2
- package/dist/adapters/deep-agents.js +3 -3
- package/dist/adapters/express.cjs +63 -9
- package/dist/adapters/express.d.cts +2 -1
- package/dist/adapters/express.d.ts +2 -1
- package/dist/adapters/express.js +3 -3
- package/dist/adapters/index.cjs +961 -9
- package/dist/adapters/index.d.cts +4 -2
- package/dist/adapters/index.d.ts +4 -2
- package/dist/adapters/index.js +54 -17
- package/dist/adapters/langchain.cjs +63 -9
- package/dist/adapters/langchain.d.cts +3 -2
- package/dist/adapters/langchain.d.ts +3 -2
- package/dist/adapters/langchain.js +3 -3
- 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/adapters/mentraos.js +48 -0
- package/dist/adapters/openai.cjs +63 -9
- package/dist/adapters/openai.d.cts +3 -2
- package/dist/adapters/openai.d.ts +3 -2
- package/dist/adapters/openai.js +3 -3
- package/dist/adapters/openclaw.cjs +63 -9
- package/dist/adapters/openclaw.d.cts +3 -2
- package/dist/adapters/openclaw.d.ts +3 -2
- package/dist/adapters/openclaw.js +3 -3
- package/dist/{add-ROOZLU62.js → add-XSANI3FK.js} +1 -1
- package/dist/{behavioral-MJO34S6Q.js → behavioral-SLW7ALEK.js} +4 -4
- package/dist/{bootstrap-CQRZVOXK.js → bootstrap-2OW5ZLBL.js} +4 -4
- package/dist/bootstrap-contract-DcV6t-8M.d.cts +216 -0
- package/dist/bootstrap-contract-DcV6t-8M.d.ts +216 -0
- package/dist/browser.global.js +149 -5
- package/dist/{build-ZHPMX5AZ.js → build-EGBGZFIJ.js} +6 -6
- package/dist/{chunk-A7GKPPU7.js → chunk-2VAWP6FI.js} +1 -1
- package/dist/{chunk-3WQLXYTP.js → chunk-3AYKQHYI.js} +2 -2
- package/dist/{chunk-EMQDLDAF.js → chunk-3NZMMSOW.js} +80 -2
- package/dist/chunk-3S5AD4AB.js +421 -0
- package/dist/{chunk-VXHSMA3I.js → chunk-6CV4XG3J.js} +1 -1
- package/dist/{chunk-BNKJPUPQ.js → chunk-A7SHG75T.js} +2 -2
- package/dist/{chunk-U6U7EJZL.js → chunk-AV7XJJWK.js} +2 -2
- package/dist/{chunk-ZWI3NIXK.js → chunk-CYDMUJVZ.js} +54 -3
- package/dist/{chunk-F66BVUYB.js → chunk-DA5MHFRR.js} +3 -3
- package/dist/{chunk-YEKMVDWK.js → chunk-FHXXD2TI.js} +7 -7
- package/dist/{chunk-5TPFNWRU.js → chunk-FS2UUJJO.js} +3 -3
- package/dist/{chunk-4FLICVVA.js → chunk-FVOGUCB6.js} +2 -2
- package/dist/chunk-GTPV2XGO.js +893 -0
- package/dist/{chunk-CTZHONLA.js → chunk-I4RTIMLX.js} +2 -2
- package/dist/{chunk-B6OXJLJ5.js → chunk-J2IZBHXJ.js} +4 -4
- package/dist/{chunk-TG6SEF24.js → chunk-OQU65525.js} +1 -1
- package/dist/{chunk-QXBFT7NI.js → chunk-QMVQ6KPL.js} +2 -2
- package/dist/{chunk-G7DJ6VOD.js → chunk-RDA7ISWC.js} +2 -2
- package/dist/{chunk-O5ABKEA7.js → chunk-YJ34R5NB.js} +2 -2
- package/dist/{chunk-PVTQQS3Y.js → chunk-YPCVY4GS.js} +31 -0
- package/dist/{chunk-W7LLXRGY.js → chunk-ZAF6JH23.js} +65 -10
- package/dist/{chunk-IS4WUH6Y.js → chunk-ZEIT2QLM.js} +4 -4
- package/dist/cli/neuroverse.cjs +4436 -1035
- package/dist/cli/neuroverse.js +40 -24
- package/dist/cli/plan.cjs +176 -12
- package/dist/cli/plan.js +2 -2
- package/dist/cli/run.cjs +63 -9
- package/dist/cli/run.js +2 -2
- package/dist/configure-world-XU2COHOZ.js +705 -0
- package/dist/{decision-flow-M63D47LO.js → decision-flow-3K4D72G4.js} +2 -2
- package/dist/{demo-G43RLCPK.js → demo-6OQYWRR6.js} +4 -4
- package/dist/{derive-LMDUTXDD.js → derive-7Y7YWVLU.js} +5 -5
- package/dist/{doctor-6BC6X2VO.js → doctor-NHXI7OQW.js} +3 -1
- 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-Q7UIJZ2O.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-EEF36XDU.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/engine/guard-engine.js +12 -0
- 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/{equity-penalties-SG5IZQ7I.js → equity-penalties-NVBAB5WL.js} +4 -4
- package/dist/{explain-RHBU2GBR.js → explain-HDFN4ION.js} +1 -1
- package/dist/github-TIKTWOGU.js +27 -0
- package/dist/{guard-AEEJNWLD.js → guard-6KSCWT2W.js} +4 -4
- package/dist/{guard-contract-B7lplwm9.d.cts → guard-contract-C991HDZp.d.cts} +32 -309
- package/dist/{guard-contract-B7lplwm9.d.ts → guard-contract-hHjTTjtR.d.ts} +32 -309
- package/dist/{impact-3XVDSCBU.js → impact-WIAM66IH.js} +3 -3
- package/dist/{improve-TQP4ECSY.js → improve-2PWGGO5B.js} +3 -3
- package/dist/index.cjs +682 -14
- package/dist/index.d.cts +231 -423
- package/dist/index.d.ts +231 -423
- package/dist/index.js +81 -58
- package/dist/{init-FYPV4SST.js → init-TKIJDR7I.js} +5 -1
- package/dist/lens-MHMUDCMQ.js +1084 -0
- package/dist/{mcp-server-5Y3ZM7TV.js → mcp-server-TNIWZ7B5.js} +3 -3
- package/dist/{playground-VZBNPPBO.js → playground-3FLDGBET.js} +3 -3
- package/dist/{redteam-MZPZD3EF.js → redteam-HV6LMKEH.js} +3 -3
- package/dist/{session-JYOARW54.js → session-XZP2754M.js} +3 -3
- package/dist/{shared-C_zpdvBm.d.cts → shared-DGnn1jiS.d.cts} +1 -1
- package/dist/{shared-Cf7yxx4-.d.ts → shared-U405h52W.d.ts} +1 -1
- package/dist/{simulate-LJXYBC6M.js → simulate-VT437EEL.js} +17 -4
- package/dist/spatial/index.cjs +682 -0
- package/dist/spatial/index.d.cts +517 -0
- package/dist/spatial/index.d.ts +517 -0
- package/dist/spatial/index.js +633 -0
- package/dist/{test-BOOR4A5F.js → test-4WTX6RKQ.js} +3 -3
- package/dist/{trace-PKV4KX56.js → trace-2YDNAXMK.js} +2 -2
- 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-RALX7CZS.js → validate-M52DX22Y.js} +1 -1
- package/dist/{world-BIP4GZBZ.js → world-O4HTQPDP.js} +1 -1
- package/dist/{world-loader-Y6HMQH2D.js → world-loader-YTYFOP7D.js} +1 -1
- package/dist/worlds/mentraos-smartglasses.nv-world.md +423 -0
- package/dist/worlds/mentraos-spatial.nv-world.md +68 -0
- package/dist/worlds/user-rules.nv-world.md +328 -0
- package/package.json +46 -3
- package/dist/guard-engine-PNR6MHCM.js +0 -10
- package/dist/{configure-ai-5MP5DWTT.js → configure-ai-LL3VAPQW.js} +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readAuditLog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2VAWP6FI.js";
|
|
4
4
|
import {
|
|
5
5
|
generateDecisionFlow,
|
|
6
6
|
renderDecisionFlow
|
|
7
7
|
} from "./chunk-D2UCV5AK.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ZAF6JH23.js";
|
|
9
9
|
import "./chunk-QLPTHTVB.js";
|
|
10
10
|
import "./chunk-QWGCMQQD.js";
|
|
11
11
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
handleListPresets,
|
|
7
7
|
handleReasonRequest,
|
|
8
8
|
writeTempWorld
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AV7XJJWK.js";
|
|
10
10
|
import {
|
|
11
11
|
adaptationFromVerdict,
|
|
12
12
|
detectBehavioralPatterns,
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
resolveWorldPath
|
|
17
17
|
} from "./chunk-AKW5YVCE.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-QLPTHTVB.js";
|
|
18
|
+
import "./chunk-ZAF6JH23.js";
|
|
20
19
|
import {
|
|
21
20
|
DEFAULT_BUNDLED_WORLD,
|
|
22
21
|
loadBundledWorld,
|
|
23
22
|
loadWorld
|
|
24
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-I4RTIMLX.js";
|
|
24
|
+
import "./chunk-QLPTHTVB.js";
|
|
25
25
|
import {
|
|
26
26
|
__require
|
|
27
27
|
} from "./chunk-QWGCMQQD.js";
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
DeriveInputError,
|
|
3
3
|
DeriveProviderError,
|
|
4
4
|
deriveWorld
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FHXXD2TI.js";
|
|
6
6
|
import {
|
|
7
7
|
DERIVE_EXIT_CODES
|
|
8
8
|
} from "./chunk-FMSTRBBS.js";
|
|
9
|
-
import "./chunk-OT6PXH54.js";
|
|
10
9
|
import "./chunk-INWQHLPS.js";
|
|
10
|
+
import "./chunk-OT6PXH54.js";
|
|
11
11
|
import "./chunk-7P3S7MAY.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
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,
|
|
@@ -10,8 +10,10 @@ var globImport_adapters = __glob({
|
|
|
10
10
|
"../adapters/autoresearch.ts": () => import("./adapters/autoresearch.js"),
|
|
11
11
|
"../adapters/deep-agents.ts": () => import("./adapters/deep-agents.js"),
|
|
12
12
|
"../adapters/express.ts": () => import("./adapters/express.js"),
|
|
13
|
+
"../adapters/github.ts": () => import("./github-TIKTWOGU.js"),
|
|
13
14
|
"../adapters/index.ts": () => import("./adapters/index.js"),
|
|
14
15
|
"../adapters/langchain.ts": () => import("./adapters/langchain.js"),
|
|
16
|
+
"../adapters/mentraos.ts": () => import("./adapters/mentraos.js"),
|
|
15
17
|
"../adapters/openai.ts": () => import("./adapters/openai.js"),
|
|
16
18
|
"../adapters/openclaw.ts": () => import("./adapters/openclaw.js"),
|
|
17
19
|
"../adapters/shared.ts": () => import("./shared-7RLUHNMU.js")
|
|
@@ -103,7 +105,7 @@ async function main(argv) {
|
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
try {
|
|
106
|
-
const { evaluateGuard } = await import("./guard-engine
|
|
108
|
+
const { evaluateGuard } = await import("./engine/guard-engine.js");
|
|
107
109
|
checks.push({
|
|
108
110
|
label: "Guard engine",
|
|
109
111
|
status: typeof evaluateGuard === "function" ? "pass" : "fail",
|
|
@@ -0,0 +1,241 @@
|
|
|
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/bootstrap-emitter.ts
|
|
21
|
+
var bootstrap_emitter_exports = {};
|
|
22
|
+
__export(bootstrap_emitter_exports, {
|
|
23
|
+
emitWorldDefinition: () => emitWorldDefinition
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(bootstrap_emitter_exports);
|
|
26
|
+
var GATE_DEFAULTS = {
|
|
27
|
+
THRIVING: { color: "#0f6b3a", icon: "\u2726" },
|
|
28
|
+
STABLE: { color: "#1856b8", icon: "\u25CF" },
|
|
29
|
+
COMPRESSED: { color: "#a16207", icon: "\u25B2" },
|
|
30
|
+
CRITICAL: { color: "#b91c1c", icon: "\u26A0" },
|
|
31
|
+
MODEL_COLLAPSES: { color: "#7f1d1d", icon: "\u2715" }
|
|
32
|
+
};
|
|
33
|
+
function emitWorldDefinition(parsed) {
|
|
34
|
+
const issues = [];
|
|
35
|
+
const fm = parsed.frontmatter;
|
|
36
|
+
const defaultProfile = fm.default_profile ?? parsed.assumptions[0]?.id ?? "baseline";
|
|
37
|
+
const altProfile = fm.alternative_profile ?? parsed.assumptions[1]?.id ?? "alternative";
|
|
38
|
+
const world = {
|
|
39
|
+
world_id: fm.world_id,
|
|
40
|
+
name: fm.name,
|
|
41
|
+
thesis: parsed.thesis,
|
|
42
|
+
version: fm.version ?? "1.0.0",
|
|
43
|
+
runtime_mode: fm.runtime_mode ?? "SIMULATION",
|
|
44
|
+
default_assumption_profile: defaultProfile,
|
|
45
|
+
default_alternative_profile: altProfile,
|
|
46
|
+
modules: parsed.rules.map((r) => r.id),
|
|
47
|
+
players: {
|
|
48
|
+
thinking_space: true,
|
|
49
|
+
experience_space: true,
|
|
50
|
+
action_space: true
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const invariants = parsed.invariants.map((inv) => ({
|
|
54
|
+
id: inv.id,
|
|
55
|
+
label: inv.label,
|
|
56
|
+
enforcement: inv.enforcement === "prompt" ? "prompt" : "structural",
|
|
57
|
+
mutable: false
|
|
58
|
+
}));
|
|
59
|
+
const profiles = {};
|
|
60
|
+
const parameterDefinitions = {};
|
|
61
|
+
for (let i = 0; i < parsed.assumptions.length; i++) {
|
|
62
|
+
const profile = parsed.assumptions[i];
|
|
63
|
+
const params = {};
|
|
64
|
+
for (const [key, val] of Object.entries(profile.parameters)) {
|
|
65
|
+
params[key] = String(val);
|
|
66
|
+
if (!parameterDefinitions[key]) {
|
|
67
|
+
parameterDefinitions[key] = {
|
|
68
|
+
type: typeof val === "boolean" ? "boolean" : typeof val === "number" ? "number" : "enum",
|
|
69
|
+
label: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()),
|
|
70
|
+
description: `Parameter: ${key}`
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
profiles[profile.id] = {
|
|
75
|
+
name: profile.name,
|
|
76
|
+
description: profile.description,
|
|
77
|
+
is_default_baseline: i === 0 || profile.id === defaultProfile,
|
|
78
|
+
is_default_alternative: i === 1 || profile.id === altProfile,
|
|
79
|
+
parameters: params
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const assumptions = { profiles, parameter_definitions: parameterDefinitions };
|
|
83
|
+
const variables = {};
|
|
84
|
+
for (const v of parsed.stateVariables) {
|
|
85
|
+
const stateVar = {
|
|
86
|
+
type: v.type,
|
|
87
|
+
default: v.default,
|
|
88
|
+
mutable: true,
|
|
89
|
+
label: v.label,
|
|
90
|
+
description: v.description
|
|
91
|
+
};
|
|
92
|
+
if (v.type === "number") {
|
|
93
|
+
if (v.min !== void 0) stateVar.min = v.min;
|
|
94
|
+
if (v.max !== void 0) stateVar.max = v.max;
|
|
95
|
+
if (v.step !== void 0) stateVar.step = v.step;
|
|
96
|
+
}
|
|
97
|
+
if (v.type === "enum" && v.options) {
|
|
98
|
+
stateVar.options = v.options;
|
|
99
|
+
}
|
|
100
|
+
variables[v.id] = stateVar;
|
|
101
|
+
}
|
|
102
|
+
const stateSchema = { variables, presets: {} };
|
|
103
|
+
const rules = parsed.rules.map((r) => {
|
|
104
|
+
const triggers = r.triggers.map((t) => ({
|
|
105
|
+
field: t.field,
|
|
106
|
+
operator: t.operator,
|
|
107
|
+
value: t.value,
|
|
108
|
+
source: t.source
|
|
109
|
+
}));
|
|
110
|
+
const effects = r.effects.map((e) => ({
|
|
111
|
+
target: e.target,
|
|
112
|
+
operation: e.operation,
|
|
113
|
+
value: e.value
|
|
114
|
+
}));
|
|
115
|
+
let collapse_check;
|
|
116
|
+
if (r.collapse_check) {
|
|
117
|
+
collapse_check = {
|
|
118
|
+
field: r.collapse_check.field,
|
|
119
|
+
operator: r.collapse_check.operator,
|
|
120
|
+
value: r.collapse_check.value,
|
|
121
|
+
result: "MODEL_COLLAPSES"
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const causal_translation = r.causal_translation ?? {
|
|
125
|
+
trigger_text: "",
|
|
126
|
+
rule_text: "",
|
|
127
|
+
shift_text: "",
|
|
128
|
+
effect_text: ""
|
|
129
|
+
};
|
|
130
|
+
const rule = {
|
|
131
|
+
id: r.id,
|
|
132
|
+
severity: r.severity,
|
|
133
|
+
label: r.label,
|
|
134
|
+
description: r.description ?? r.label,
|
|
135
|
+
order: r.order,
|
|
136
|
+
triggers,
|
|
137
|
+
effects: effects.length > 0 ? effects : void 0,
|
|
138
|
+
collapse_check,
|
|
139
|
+
causal_translation
|
|
140
|
+
};
|
|
141
|
+
return rule;
|
|
142
|
+
});
|
|
143
|
+
const viabilityClassification = parsed.gates.map((g) => {
|
|
144
|
+
const defaults = GATE_DEFAULTS[g.status] ?? { color: "#5c5a52", icon: "\u25CF" };
|
|
145
|
+
return {
|
|
146
|
+
status: g.status,
|
|
147
|
+
field: g.field,
|
|
148
|
+
operator: g.operator,
|
|
149
|
+
value: g.value,
|
|
150
|
+
color: defaults.color,
|
|
151
|
+
icon: defaults.icon
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
const gates = {
|
|
155
|
+
viability_classification: viabilityClassification,
|
|
156
|
+
structural_override: {
|
|
157
|
+
description: "Rules with severity=structural and triggered collapse_check force MODEL_COLLAPSES regardless of final margin.",
|
|
158
|
+
enforcement: "mandatory"
|
|
159
|
+
},
|
|
160
|
+
sustainability_threshold: 0.1,
|
|
161
|
+
collapse_visual: {
|
|
162
|
+
background: "#1c1917",
|
|
163
|
+
text: "#fef2f2",
|
|
164
|
+
border: "#b91c1c",
|
|
165
|
+
label: "Structural Failure"
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const computedOutcomes = parsed.outcomes.map((o) => {
|
|
169
|
+
const outcome = {
|
|
170
|
+
id: o.id,
|
|
171
|
+
type: o.type,
|
|
172
|
+
label: o.label,
|
|
173
|
+
show_in_comparison: true
|
|
174
|
+
};
|
|
175
|
+
if (o.range) outcome.range = o.range;
|
|
176
|
+
if (o.display) outcome.display_as = o.display;
|
|
177
|
+
if (o.primary) outcome.primary = o.primary;
|
|
178
|
+
if (o.assignment) outcome.assignment = o.assignment;
|
|
179
|
+
return outcome;
|
|
180
|
+
});
|
|
181
|
+
const outcomes = {
|
|
182
|
+
computed_outcomes: computedOutcomes,
|
|
183
|
+
comparison_layout: {
|
|
184
|
+
primary_card: computedOutcomes.find((o) => o.primary)?.id ?? computedOutcomes[0]?.id ?? "",
|
|
185
|
+
status_badge: "viability_status",
|
|
186
|
+
structural_indicators: rules.filter((r) => r.severity === "structural").map((r) => r.id)
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const validScopes = /* @__PURE__ */ new Set(["response_framing", "language_style", "content_filtering", "value_emphasis", "behavior_shaping"]);
|
|
190
|
+
const lensConfigs = parsed.lenses.map((pl) => {
|
|
191
|
+
const directives = pl.directives.map((d) => ({
|
|
192
|
+
id: d.id,
|
|
193
|
+
scope: validScopes.has(d.scope) ? d.scope : "behavior_shaping",
|
|
194
|
+
instruction: d.instruction
|
|
195
|
+
}));
|
|
196
|
+
return {
|
|
197
|
+
id: pl.id,
|
|
198
|
+
name: pl.name,
|
|
199
|
+
tagline: pl.tagline,
|
|
200
|
+
description: pl.description,
|
|
201
|
+
tags: pl.tags,
|
|
202
|
+
tone: {
|
|
203
|
+
formality: pl.formality || "neutral",
|
|
204
|
+
verbosity: pl.verbosity || "balanced",
|
|
205
|
+
emotion: pl.emotion || "neutral",
|
|
206
|
+
confidence: pl.confidence || "balanced"
|
|
207
|
+
},
|
|
208
|
+
directives,
|
|
209
|
+
defaultForRoles: pl.defaultForRoles,
|
|
210
|
+
priority: pl.priority,
|
|
211
|
+
stackable: pl.stackable
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
const lensesConfig = lensConfigs.length > 0 ? {
|
|
215
|
+
lenses: lensConfigs,
|
|
216
|
+
...parsed.lensPolicy ? { policy: parsed.lensPolicy } : {},
|
|
217
|
+
...parsed.lensLockPin ? { lockPin: parsed.lensLockPin } : {}
|
|
218
|
+
} : void 0;
|
|
219
|
+
const metadata = {
|
|
220
|
+
format_version: "1.0.0",
|
|
221
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
222
|
+
last_modified: (/* @__PURE__ */ new Date()).toISOString(),
|
|
223
|
+
authoring_method: "manual-authoring"
|
|
224
|
+
};
|
|
225
|
+
const worldDefinition = {
|
|
226
|
+
world,
|
|
227
|
+
invariants,
|
|
228
|
+
assumptions,
|
|
229
|
+
stateSchema,
|
|
230
|
+
rules,
|
|
231
|
+
gates,
|
|
232
|
+
outcomes,
|
|
233
|
+
...lensesConfig ? { lenses: lensesConfig } : {},
|
|
234
|
+
metadata
|
|
235
|
+
};
|
|
236
|
+
return { world: worldDefinition, issues };
|
|
237
|
+
}
|
|
238
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
239
|
+
0 && (module.exports = {
|
|
240
|
+
emitWorldDefinition
|
|
241
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { P as ParsedWorld, a as ParseIssue } from '../bootstrap-contract-DcV6t-8M.cjs';
|
|
2
|
+
import { WorldDefinition } from '../types.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Bootstrap Emitter — ParsedWorld → WorldDefinition
|
|
6
|
+
*
|
|
7
|
+
* Converts the intermediate representation from the parser
|
|
8
|
+
* into a proper WorldDefinition that the guard engine, validate engine,
|
|
9
|
+
* and compileWorldToZip() all consume.
|
|
10
|
+
*
|
|
11
|
+
* Fills in sensible defaults for optional fields.
|
|
12
|
+
* Reports issues when the parsed data can't cleanly map to the target type.
|
|
13
|
+
*
|
|
14
|
+
* Deterministic. Same parsed input → same WorldDefinition output.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Convert a ParsedWorld into a WorldDefinition.
|
|
19
|
+
*
|
|
20
|
+
* Returns the world definition and any issues encountered during emission.
|
|
21
|
+
*/
|
|
22
|
+
declare function emitWorldDefinition(parsed: ParsedWorld): {
|
|
23
|
+
world: WorldDefinition;
|
|
24
|
+
issues: ParseIssue[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { emitWorldDefinition };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { P as ParsedWorld, a as ParseIssue } from '../bootstrap-contract-DcV6t-8M.js';
|
|
2
|
+
import { WorldDefinition } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Bootstrap Emitter — ParsedWorld → WorldDefinition
|
|
6
|
+
*
|
|
7
|
+
* Converts the intermediate representation from the parser
|
|
8
|
+
* into a proper WorldDefinition that the guard engine, validate engine,
|
|
9
|
+
* and compileWorldToZip() all consume.
|
|
10
|
+
*
|
|
11
|
+
* Fills in sensible defaults for optional fields.
|
|
12
|
+
* Reports issues when the parsed data can't cleanly map to the target type.
|
|
13
|
+
*
|
|
14
|
+
* Deterministic. Same parsed input → same WorldDefinition output.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Convert a ParsedWorld into a WorldDefinition.
|
|
19
|
+
*
|
|
20
|
+
* Returns the world definition and any issues encountered during emission.
|
|
21
|
+
*/
|
|
22
|
+
declare function emitWorldDefinition(parsed: ParsedWorld): {
|
|
23
|
+
world: WorldDefinition;
|
|
24
|
+
issues: ParseIssue[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { emitWorldDefinition };
|