@pinepaper.studio/mcp-server 1.5.5 → 1.6.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.de.md +71 -0
- package/README.es.md +71 -0
- package/README.fr.md +71 -0
- package/README.hi.md +71 -0
- package/README.ja.md +71 -0
- package/README.ko.md +71 -0
- package/README.md +513 -272
- package/README.pt-BR.md +71 -0
- package/README.zh-CN.md +71 -0
- package/assets/easing-splashes.svg +152 -0
- package/assets/equation-path.svg +77 -0
- package/assets/hero.svg +126 -0
- package/assets/live-badge.svg +62 -0
- package/assets/poster-sunburst.svg +106 -0
- package/dist/__tests__/fixtures/mock-relations.d.ts +48 -0
- package/dist/__tests__/fixtures/mock-relations.d.ts.map +1 -1
- package/dist/__tests__/fixtures/mock-relations.js +31 -0
- package/dist/__tests__/fixtures/mock-relations.js.map +1 -1
- package/dist/agent/types.d.ts +6 -6
- package/dist/browser/bridge.d.ts +48 -4
- package/dist/browser/bridge.d.ts.map +1 -1
- package/dist/browser/bridge.js +79 -18
- package/dist/browser/bridge.js.map +1 -1
- package/dist/browser/puppeteer-controller.d.ts +34 -0
- package/dist/browser/puppeteer-controller.d.ts.map +1 -1
- package/dist/browser/puppeteer-controller.js +116 -5
- package/dist/browser/puppeteer-controller.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/dist/ontology/index.d.ts +2 -0
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +2 -0
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/ontology-compiler.d.ts +78 -0
- package/dist/ontology/ontology-compiler.d.ts.map +1 -0
- package/dist/ontology/ontology-compiler.js +235 -0
- package/dist/ontology/ontology-compiler.js.map +1 -0
- package/dist/ontology/ontology-validator.d.ts +103 -0
- package/dist/ontology/ontology-validator.d.ts.map +1 -0
- package/dist/ontology/ontology-validator.js +573 -0
- package/dist/ontology/ontology-validator.js.map +1 -0
- package/dist/ontology/types.d.ts +1 -0
- package/dist/ontology/types.d.ts.map +1 -1
- package/dist/ontology/validator.d.ts +6 -0
- package/dist/ontology/validator.d.ts.map +1 -1
- package/dist/ontology/validator.js +34 -5
- package/dist/ontology/validator.js.map +1 -1
- package/dist/ontology/vocabulary.d.ts.map +1 -1
- package/dist/ontology/vocabulary.js +91 -3
- package/dist/ontology/vocabulary.js.map +1 -1
- package/dist/tools/definitions.d.ts +1 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +978 -27
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/handlers/maps.d.ts.map +1 -1
- package/dist/tools/handlers/maps.js +54 -1
- package/dist/tools/handlers/maps.js.map +1 -1
- package/dist/tools/handlers/ontology.d.ts.map +1 -1
- package/dist/tools/handlers/ontology.js +15 -3
- package/dist/tools/handlers/ontology.js.map +1 -1
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/handlers.js +137 -6
- package/dist/tools/handlers.js.map +1 -1
- package/dist/tools/minimal-descriptions.d.ts.map +1 -1
- package/dist/tools/minimal-descriptions.js +20 -1
- package/dist/tools/minimal-descriptions.js.map +1 -1
- package/dist/tools/toolkits.d.ts.map +1 -1
- package/dist/tools/toolkits.js +25 -2
- package/dist/tools/toolkits.js.map +1 -1
- package/dist/types/code-generator.d.ts +190 -2
- package/dist/types/code-generator.d.ts.map +1 -1
- package/dist/types/code-generator.js +1068 -30
- package/dist/types/code-generator.js.map +1 -1
- package/dist/types/schemas.d.ts +2726 -116
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +594 -4
- package/dist/types/schemas.js.map +1 -1
- package/manifest.json +299 -71
- package/package.json +14 -3
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OntologyCompiler (S12-E3) — the reverse of DesignGraph.
|
|
3
|
+
*
|
|
4
|
+
* Ported from FxTool/js/ontology/OntologyCompiler.js to typed TypeScript. Compiles
|
|
5
|
+
* a pp:-namespaced JSON-LD document (typed nodes + structural edges like pp:onTopOf)
|
|
6
|
+
* into a scene document `{ items, relations }` plus an op list the MCP can emit as
|
|
7
|
+
* app.create / app.addRelation calls — so "author an ontology, get a design" holds
|
|
8
|
+
* without a FxTool round-trip. Only ROOT nodes get absolute coordinates; every other
|
|
9
|
+
* node's position is DERIVED at runtime from its structural relations.
|
|
10
|
+
*
|
|
11
|
+
* const { scene, ops, diagnostics } = new OntologyCompiler().compile(doc);
|
|
12
|
+
*
|
|
13
|
+
* Kept bit-faithful to FxTool's compiler (same root placement, same diagnostics)
|
|
14
|
+
* so extract(compile(O)) round-trips O's typed structural edges.
|
|
15
|
+
*/
|
|
16
|
+
import { ITEM_TYPE_MAP, RELATION_TYPE_MAP } from './vocabulary.js';
|
|
17
|
+
const STRUCTURAL_RELATIONS = new Set(['on_top_of', 'below', 'beside', 'inside', 'centered_on', 'aligned_with']);
|
|
18
|
+
// Type → default geometry. Overridable via new OntologyCompiler({ defaultGeometry }).
|
|
19
|
+
const DEFAULT_GEOMETRY = {
|
|
20
|
+
rectangle: { width: 100, height: 100 },
|
|
21
|
+
circle: { width: 100, height: 100 },
|
|
22
|
+
ellipse: { width: 100, height: 100 },
|
|
23
|
+
triangle: { width: 100, height: 100 },
|
|
24
|
+
star: { width: 100, height: 100 },
|
|
25
|
+
polygon: { width: 100, height: 100 },
|
|
26
|
+
line: { width: 100, height: 2 },
|
|
27
|
+
text: { width: 200, height: 40 },
|
|
28
|
+
image: { width: 200, height: 200 },
|
|
29
|
+
group: { width: 100, height: 100 },
|
|
30
|
+
};
|
|
31
|
+
const FALLBACK_GEOMETRY = { width: 100, height: 100 };
|
|
32
|
+
// Inverse maps (pp:IRI → runtime). ITEM_TYPE_MAP is not injective; the FIRST runtime
|
|
33
|
+
// key for each IRI wins as the canonical inverse (matches FxTool).
|
|
34
|
+
const INV_ITEM_TYPE = {};
|
|
35
|
+
for (const [rt, pp] of Object.entries(ITEM_TYPE_MAP))
|
|
36
|
+
if (!(pp in INV_ITEM_TYPE))
|
|
37
|
+
INV_ITEM_TYPE[pp] = rt;
|
|
38
|
+
const INV_RELATION_TYPE = {};
|
|
39
|
+
for (const [rt, pp] of Object.entries(RELATION_TYPE_MAP))
|
|
40
|
+
INV_RELATION_TYPE[pp] = rt;
|
|
41
|
+
const stripNodePrefix = (iri) => (typeof iri === 'string' ? iri.replace(/^pp:node\//, '') : iri);
|
|
42
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : undefined);
|
|
43
|
+
export class OntologyCompiler {
|
|
44
|
+
canvas;
|
|
45
|
+
defaultGeometry;
|
|
46
|
+
constructor(opts = {}) {
|
|
47
|
+
this.canvas = opts.canvas || { width: 1080, height: 1080 };
|
|
48
|
+
this.defaultGeometry = { ...DEFAULT_GEOMETRY, ...(opts.defaultGeometry || {}) };
|
|
49
|
+
}
|
|
50
|
+
compile(doc) {
|
|
51
|
+
const diagnostics = [];
|
|
52
|
+
const diag = (severity, code, message, extra) => diagnostics.push({ severity, code, message, ...(extra || {}) });
|
|
53
|
+
doc = doc || {};
|
|
54
|
+
const nodes = this._readNodes(doc, diag);
|
|
55
|
+
const edges = this._readEdges(doc, nodes, diag);
|
|
56
|
+
const positions = this._placeRoots(nodes, edges, diag);
|
|
57
|
+
const items = [];
|
|
58
|
+
for (const [id, n] of nodes) {
|
|
59
|
+
const g = this.defaultGeometry[n.runtimeType] || FALLBACK_GEOMETRY;
|
|
60
|
+
const item = {
|
|
61
|
+
id,
|
|
62
|
+
type: n.runtimeType,
|
|
63
|
+
width: n.geom.width != null ? n.geom.width : g.width,
|
|
64
|
+
height: n.geom.height != null ? n.geom.height : g.height,
|
|
65
|
+
};
|
|
66
|
+
const pos = (n.geom.x != null && n.geom.y != null) ? { x: n.geom.x, y: n.geom.y } : positions.get(id);
|
|
67
|
+
if (pos) {
|
|
68
|
+
item.x = pos.x;
|
|
69
|
+
item.y = pos.y;
|
|
70
|
+
}
|
|
71
|
+
items.push(item);
|
|
72
|
+
}
|
|
73
|
+
const relations = edges.map((e) => ({ from: e.from, to: e.to, type: e.type, params: e.params }));
|
|
74
|
+
const ops = [];
|
|
75
|
+
for (const it of items)
|
|
76
|
+
ops.push({ op: 'create', ...it });
|
|
77
|
+
for (const r of relations)
|
|
78
|
+
ops.push({ op: 'addRelation', from: r.from, to: r.to, relation: r.type, params: r.params });
|
|
79
|
+
return { scene: { items, relations }, ops, diagnostics };
|
|
80
|
+
}
|
|
81
|
+
_readNodes(doc, diag) {
|
|
82
|
+
const raw = doc['pp:nodes'] || doc.nodes || (Array.isArray(doc['@graph']) ? doc['@graph'] : []);
|
|
83
|
+
const nodes = new Map();
|
|
84
|
+
for (const n of (raw || [])) {
|
|
85
|
+
const id = stripNodePrefix(n['@id'] != null ? n['@id'] : n.id);
|
|
86
|
+
if (id == null) {
|
|
87
|
+
diag('warning', 'NODE_NO_ID', 'node without @id/id skipped');
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const ppType = n['@type'] || n.type;
|
|
91
|
+
let runtimeType = INV_ITEM_TYPE[ppType];
|
|
92
|
+
let detected = false;
|
|
93
|
+
if (!runtimeType) {
|
|
94
|
+
if (typeof ppType === 'string' && ppType.startsWith('pp:Detected')) {
|
|
95
|
+
runtimeType = 'rectangle';
|
|
96
|
+
detected = true;
|
|
97
|
+
diag('info', 'DETECTED_PLACEHOLDER', `detected class "${ppType}" → rectangle placeholder`, { node: id });
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
runtimeType = 'rectangle';
|
|
101
|
+
diag('warning', 'UNKNOWN_TYPE', `unknown @type "${ppType}" for node "${id}" → rectangle`, { node: id });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const geom = {};
|
|
105
|
+
const w = num(n['pp:width'] != null ? n['pp:width'] : n.width);
|
|
106
|
+
const h = num(n['pp:height'] != null ? n['pp:height'] : n.height);
|
|
107
|
+
const x = num(n['pp:x'] != null ? n['pp:x'] : n.x);
|
|
108
|
+
const y = num(n['pp:y'] != null ? n['pp:y'] : n.y);
|
|
109
|
+
if (w != null)
|
|
110
|
+
geom.width = w;
|
|
111
|
+
if (h != null)
|
|
112
|
+
geom.height = h;
|
|
113
|
+
if (x != null)
|
|
114
|
+
geom.x = x;
|
|
115
|
+
if (y != null)
|
|
116
|
+
geom.y = y;
|
|
117
|
+
nodes.set(id, { id, ppType, runtimeType, detected, geom });
|
|
118
|
+
}
|
|
119
|
+
return nodes;
|
|
120
|
+
}
|
|
121
|
+
_readEdges(doc, nodes, diag) {
|
|
122
|
+
const edges = [];
|
|
123
|
+
const seen = new Set();
|
|
124
|
+
const add = (from, to, type, params) => {
|
|
125
|
+
const k = `${from} ${to} ${type}`;
|
|
126
|
+
if (seen.has(k))
|
|
127
|
+
return;
|
|
128
|
+
seen.add(k);
|
|
129
|
+
edges.push({ from, to, type, params: params || {} });
|
|
130
|
+
};
|
|
131
|
+
for (const e of (doc['pp:edges'] || doc.edges || [])) {
|
|
132
|
+
const ppType = e['@type'] || e.type;
|
|
133
|
+
let rel = INV_RELATION_TYPE[ppType];
|
|
134
|
+
if (!rel && RELATION_TYPE_MAP[ppType])
|
|
135
|
+
rel = ppType; // tolerate a runtime name given directly
|
|
136
|
+
if (!rel) {
|
|
137
|
+
diag('warning', 'UNKNOWN_EDGE', `unknown edge type "${ppType}" skipped`);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const from = stripNodePrefix(e['pp:source'] || e.source || e.from);
|
|
141
|
+
const to = stripNodePrefix(e['pp:target'] != null ? e['pp:target'] : (e.target != null ? e.target : e.to));
|
|
142
|
+
if (!nodes.has(from)) {
|
|
143
|
+
diag('warning', 'EDGE_BAD_SOURCE', `edge "${ppType}" source "${from}" is not a node; skipped`);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (to != null && !nodes.has(to)) {
|
|
147
|
+
diag('warning', 'EDGE_BAD_TARGET', `edge "${ppType}" target "${to}" is not a node; skipped`);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
add(from, to, rel, e['pp:params'] || e.params || {});
|
|
151
|
+
}
|
|
152
|
+
// Inline: a node property whose key is a pp: relation IRI.
|
|
153
|
+
for (const n of (doc['pp:nodes'] || doc.nodes || [])) {
|
|
154
|
+
const from = stripNodePrefix(n['@id'] != null ? n['@id'] : n.id);
|
|
155
|
+
if (!nodes.has(from))
|
|
156
|
+
continue;
|
|
157
|
+
for (const key of Object.keys(n)) {
|
|
158
|
+
const rel = INV_RELATION_TYPE[key];
|
|
159
|
+
if (!rel)
|
|
160
|
+
continue;
|
|
161
|
+
const vals = Array.isArray(n[key]) ? n[key] : [n[key]];
|
|
162
|
+
for (const v of vals) {
|
|
163
|
+
const to = stripNodePrefix(typeof v === 'string' ? v : (v && (v['@id'] || v.id || v.target)));
|
|
164
|
+
let params = {};
|
|
165
|
+
if (v && typeof v === 'object') {
|
|
166
|
+
params = v.params || v['pp:params'] ||
|
|
167
|
+
Object.fromEntries(Object.entries(v).filter(([k]) => !k.startsWith('@') && k !== 'id' && k !== 'target'));
|
|
168
|
+
}
|
|
169
|
+
if (to != null && nodes.has(to))
|
|
170
|
+
add(from, to, rel, params);
|
|
171
|
+
else
|
|
172
|
+
diag('warning', 'EDGE_BAD_REF', `inline "${key}" ${from}→${to} skipped (target not a node)`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return edges;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Root placement: connected components over structural edges; a ROOT is a node
|
|
180
|
+
* never the SOURCE of a structural relation. Components tile the canvas row-major;
|
|
181
|
+
* each component's roots get its cell center. Non-roots get NO position (derived).
|
|
182
|
+
*/
|
|
183
|
+
_placeRoots(nodes, edges, diag) {
|
|
184
|
+
const placedSources = new Set(edges.filter((e) => STRUCTURAL_RELATIONS.has(e.type)).map((e) => e.from));
|
|
185
|
+
const adj = new Map();
|
|
186
|
+
for (const id of nodes.keys())
|
|
187
|
+
adj.set(id, new Set());
|
|
188
|
+
for (const e of edges) {
|
|
189
|
+
if (!STRUCTURAL_RELATIONS.has(e.type) || e.to == null)
|
|
190
|
+
continue;
|
|
191
|
+
adj.get(e.from).add(e.to);
|
|
192
|
+
adj.get(e.to).add(e.from);
|
|
193
|
+
}
|
|
194
|
+
const components = [];
|
|
195
|
+
const seen = new Set();
|
|
196
|
+
for (const id of nodes.keys()) {
|
|
197
|
+
if (seen.has(id))
|
|
198
|
+
continue;
|
|
199
|
+
const members = [];
|
|
200
|
+
const stack = [id];
|
|
201
|
+
while (stack.length) {
|
|
202
|
+
const nId = stack.pop();
|
|
203
|
+
if (seen.has(nId))
|
|
204
|
+
continue;
|
|
205
|
+
seen.add(nId);
|
|
206
|
+
members.push(nId);
|
|
207
|
+
for (const m of adj.get(nId))
|
|
208
|
+
if (!seen.has(m))
|
|
209
|
+
stack.push(m);
|
|
210
|
+
}
|
|
211
|
+
components.push(members);
|
|
212
|
+
}
|
|
213
|
+
const cols = Math.max(1, Math.ceil(Math.sqrt(components.length)));
|
|
214
|
+
const rows = Math.max(1, Math.ceil(components.length / cols));
|
|
215
|
+
const cellW = this.canvas.width / cols;
|
|
216
|
+
const cellH = this.canvas.height / rows;
|
|
217
|
+
const positions = new Map();
|
|
218
|
+
components.forEach((members, k) => {
|
|
219
|
+
const col = k % cols;
|
|
220
|
+
const row = Math.floor(k / cols);
|
|
221
|
+
const cx = cellW * (col + 0.5);
|
|
222
|
+
const cy = cellH * (row + 0.5);
|
|
223
|
+
let roots = members.filter((m) => !placedSources.has(m));
|
|
224
|
+
if (roots.length === 0) {
|
|
225
|
+
roots = [members[0]]; // cyclic component — no natural root
|
|
226
|
+
diag('warning', 'NO_ROOT', `component [${members.join(', ')}] has no root (cycle); "${members[0]}" pinned`);
|
|
227
|
+
}
|
|
228
|
+
roots.forEach((r, i) => {
|
|
229
|
+
positions.set(r, { x: Math.round(cx + (i - (roots.length - 1) / 2) * 40), y: Math.round(cy) });
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
return positions;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=ontology-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ontology-compiler.js","sourceRoot":"","sources":["../../src/ontology/ontology-compiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;AAEhH,sFAAsF;AACtF,MAAM,gBAAgB,GAAsD;IAC1E,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IACtC,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IACnC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IACpC,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IACrC,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IACjC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IACpC,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;IAC/B,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IAChC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAClC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;CACnC,CAAC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AM,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YAC/B,IAAI,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACzD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,qCAAqC;gBAC3D,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC9G,CAAC;YACD,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;gBACrB,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACjG,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OntologyValidator — active semantic validator producing STRUCTURED diagnostics
|
|
3
|
+
* ({code, severity, message, target, context, fix}) over scene state or a proposed op.
|
|
4
|
+
*
|
|
5
|
+
* Ported from FxTool/js/core/OntologyValidator.js to typed TypeScript (the S3.4
|
|
6
|
+
* "one validator, two surfaces" shared library — the same checks FxTool and the Cloud
|
|
7
|
+
* pre-render gate run). READ-ONLY: never mutates; `fix.apply` is a *proposed* op.
|
|
8
|
+
*
|
|
9
|
+
* The validator is ontology-agnostic: it takes a narrow read-only ctx (getters only).
|
|
10
|
+
* buildDefinitionValidatorContext() wires it to a template definition so the server's
|
|
11
|
+
* pinepaper_validate_design can run it Node-side without a browser round-trip.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SEVERITY: {
|
|
14
|
+
readonly ERROR: "error";
|
|
15
|
+
readonly WARNING: "warning";
|
|
16
|
+
readonly HINT: "hint";
|
|
17
|
+
};
|
|
18
|
+
export interface ValidatorItemEntry {
|
|
19
|
+
itemId: string;
|
|
20
|
+
item: {
|
|
21
|
+
data?: Record<string, any> | null;
|
|
22
|
+
};
|
|
23
|
+
type?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ValidatorRule {
|
|
26
|
+
params?: Record<string, {
|
|
27
|
+
type?: string;
|
|
28
|
+
options?: unknown[];
|
|
29
|
+
min?: number;
|
|
30
|
+
max?: number;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
export interface ValidatorContext {
|
|
35
|
+
getItem(id: string): unknown;
|
|
36
|
+
getAllItems(): ValidatorItemEntry[];
|
|
37
|
+
hasItemType(type: string): boolean;
|
|
38
|
+
getRule(name: string): ValidatorRule | null;
|
|
39
|
+
}
|
|
40
|
+
export interface Diagnostic {
|
|
41
|
+
code: string;
|
|
42
|
+
severity: string;
|
|
43
|
+
message: string;
|
|
44
|
+
target?: Record<string, unknown>;
|
|
45
|
+
context?: Record<string, unknown>;
|
|
46
|
+
fix?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
export interface ValidatorResult {
|
|
49
|
+
ok: boolean;
|
|
50
|
+
diagnostics: Diagnostic[];
|
|
51
|
+
validatorVersion: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class OntologyValidator {
|
|
54
|
+
private ctx;
|
|
55
|
+
private _batchPending;
|
|
56
|
+
constructor(ctx?: Partial<ValidatorContext>);
|
|
57
|
+
/** Audit the whole current scene. */
|
|
58
|
+
validateScene(): ValidatorResult;
|
|
59
|
+
/** Validate a PROPOSED mutation before it is applied. */
|
|
60
|
+
validateOp(op: any): ValidatorResult;
|
|
61
|
+
/** Validate a BATCH of proposed ops against a hypothetical scene (ids created earlier count as existing). */
|
|
62
|
+
validateOps(ops: any[]): ValidatorResult;
|
|
63
|
+
private _checkItemType;
|
|
64
|
+
private _checkAssociations;
|
|
65
|
+
private _checkParams;
|
|
66
|
+
/** First reference cycle among relation edges (A→B→A), or none. */
|
|
67
|
+
private _checkCycles;
|
|
68
|
+
private _checkAddRelation;
|
|
69
|
+
/**
|
|
70
|
+
* Which position axes a structural placement relation writes: ['x','y'] for a
|
|
71
|
+
* full write, one axis for aligned_with, [] for aligned_with with no valid axis,
|
|
72
|
+
* or null if `relation` is not a structural placement relation.
|
|
73
|
+
*/
|
|
74
|
+
private _structuralAxes;
|
|
75
|
+
/** Map<relation, Set<axis>> of structural placement relations already on a source. */
|
|
76
|
+
private _structuralAxesOnSource;
|
|
77
|
+
private _associationGraph;
|
|
78
|
+
private _reachPath;
|
|
79
|
+
private _checkCreate;
|
|
80
|
+
private _checkModify;
|
|
81
|
+
private _checkDelete;
|
|
82
|
+
private _checkKeyframes;
|
|
83
|
+
private _isVirtual;
|
|
84
|
+
private _refOk;
|
|
85
|
+
private _refMissing;
|
|
86
|
+
private _typeMatches;
|
|
87
|
+
private _nearest;
|
|
88
|
+
private _lev;
|
|
89
|
+
private _findCycle;
|
|
90
|
+
private _diag;
|
|
91
|
+
private _result;
|
|
92
|
+
private _safe;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Adapt a template DEFINITION ({ data: { items, relations } }) to a ValidatorContext,
|
|
96
|
+
* so OntologyValidator.validateScene() runs Node-side over a static design — no browser.
|
|
97
|
+
* Relations are folded into each source item's `data.associations`, mirroring how the
|
|
98
|
+
* live engine stores them, so dangling-target / cycle / duplicate checks all apply.
|
|
99
|
+
*/
|
|
100
|
+
export declare function buildDefinitionValidatorContext(definition: any): ValidatorContext;
|
|
101
|
+
/** Convenience: run the semantic validator over a template definition. */
|
|
102
|
+
export declare function validateDefinitionSemantics(definition: any): ValidatorResult;
|
|
103
|
+
//# sourceMappingURL=ontology-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ontology-validator.d.ts","sourceRoot":"","sources":["../../src/ontology/ontology-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,eAAO,MAAM,QAAQ;;;;CAAgE,CAAC;AAoCtF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACjH;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,WAAW,IAAI,kBAAkB,EAAE,CAAC;IACpC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;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