@x12i/memorix-metadata 3.0.2 → 3.1.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 +10 -6
- package/dist/abstracts.d.ts +9 -3
- package/dist/abstracts.d.ts.map +1 -1
- package/dist/abstracts.js +70 -66
- package/dist/abstracts.js.map +1 -1
- package/dist/fold-bindings.d.ts +19 -0
- package/dist/fold-bindings.d.ts.map +1 -0
- package/dist/fold-bindings.js +103 -0
- package/dist/fold-bindings.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/kind-fields.d.ts.map +1 -1
- package/dist/kind-fields.js +0 -1
- package/dist/kind-fields.js.map +1 -1
- package/dist/kinds.d.ts +1 -1
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +6 -11
- package/dist/kinds.js.map +1 -1
- package/dist/multi-agent-rule.d.ts +3 -3
- package/dist/multi-agent-rule.d.ts.map +1 -1
- package/dist/multi-agent-rule.js +7 -7
- package/dist/multi-agent-rule.js.map +1 -1
- package/dist/normalize.d.ts +3 -2
- package/dist/normalize.d.ts.map +1 -1
- package/dist/normalize.js +18 -5
- package/dist/normalize.js.map +1 -1
- package/dist/resolve.d.ts +14 -2
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +229 -133
- package/dist/resolve.js.map +1 -1
- package/dist/streams.d.ts +17 -0
- package/dist/streams.d.ts.map +1 -0
- package/dist/streams.js +76 -0
- package/dist/streams.js.map +1 -0
- package/dist/topology.d.ts +52 -0
- package/dist/topology.d.ts.map +1 -0
- package/dist/topology.js +348 -0
- package/dist/topology.js.map +1 -0
- package/dist/types.d.ts +133 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +22 -2
- package/dist/types.js.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +188 -64
- package/dist/validate.js.map +1 -1
- package/examples/custom-kinds/acme-ui-tabs.pack.json +2 -2
- package/examples/invalid/agent-classification.json +69 -69
- package/examples/invalid/broken-binding.json +69 -69
- package/examples/invalid/completion-mapping-with-exec-policy.json +65 -65
- package/examples/invalid/missing-parent.json +69 -69
- package/examples/invalid/operational-kind-root.json +73 -73
- package/examples/invalid/pipeline-unknown-service.json +62 -62
- package/examples/invalid/relationship-missing-rules.json +65 -65
- package/examples/invalid/relationship-with-storage.json +65 -65
- package/examples/invalid/service-with-secrets.json +66 -66
- package/examples/knowx/normalized/pack.json +1538 -0
- package/examples/{ops → opx}/normalized/pack.json +340 -322
- package/examples/opx/raw/abstract-types.json +244 -0
- package/examples/{ops → opx}/raw/agents.json +8 -8
- package/examples/opx/raw/object-types.json +101 -0
- package/examples/{ops → opx}/raw/pipelines-and-sources.json +79 -31
- package/examples/{ops → opx}/raw/relationship-definitions.json +17 -47
- package/examples/{ops → opx}/raw/view-definitions.json +7 -21
- package/examples/opx/raw/write-and-source-mappings.json +223 -0
- package/examples/{project-ops → project-opx}/normalized/pack.json +391 -299
- package/package.json +1 -1
- package/examples/ops/raw/abstract-bindings.json +0 -38
- package/examples/ops/raw/abstract-types.json +0 -28
- package/examples/ops/raw/object-types.json +0 -170
- package/examples/ops/raw/write-and-source-mappings.json +0 -108
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effective metadata topology — pure projection of concrete connections.
|
|
3
|
+
*
|
|
4
|
+
* Author relationships on abstracts; consume OT↔OT edges from this projection.
|
|
5
|
+
* Sources/streams feed object types. Agent services declare abstract ports
|
|
6
|
+
* (authored service→abstract edges). Services also appear on OT neighborhoods
|
|
7
|
+
* when a pipeline invokes them and a mapping on the same pipeline lands on an OT.
|
|
8
|
+
*/
|
|
9
|
+
import type { EffectiveDefinition, EffectiveMetadataResult } from "./resolve.js";
|
|
10
|
+
import type { MetadataPack } from "./types.js";
|
|
11
|
+
export type TopologyNodeKind = "agents" | "object-types" | "abstract-types" | "relationship-definitions" | "sources" | "streams" | "connectors" | "services" | "pipelines" | "mappings" | "views" | "writes" | "schedules" | "kind-declarations";
|
|
12
|
+
export type TopologyEdgeKind = "abstract" | "member" | "from" | "to" | "related" | "feeds" | "uses" | "stream" | "transforms" | "runs" | string;
|
|
13
|
+
export type TopologyEdgeVia = {
|
|
14
|
+
relationshipDefinitionId?: string;
|
|
15
|
+
direction?: "from-to" | "to-from";
|
|
16
|
+
pipelineId?: string;
|
|
17
|
+
mappingId?: string;
|
|
18
|
+
streamId?: string;
|
|
19
|
+
stepId?: string;
|
|
20
|
+
/** Authored service→abstract port binding. */
|
|
21
|
+
serviceId?: string;
|
|
22
|
+
};
|
|
23
|
+
export type TopologyNode = {
|
|
24
|
+
id: string;
|
|
25
|
+
kind: TopologyNodeKind | string;
|
|
26
|
+
entityId: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
};
|
|
29
|
+
export type TopologyEdge = {
|
|
30
|
+
id: string;
|
|
31
|
+
from: string;
|
|
32
|
+
to: string;
|
|
33
|
+
kind: TopologyEdgeKind;
|
|
34
|
+
via?: TopologyEdgeVia;
|
|
35
|
+
};
|
|
36
|
+
export type EffectiveMetadataTopology = {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
nodes: TopologyNode[];
|
|
39
|
+
edges: TopologyEdge[];
|
|
40
|
+
issues: Array<{
|
|
41
|
+
code: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
/** Rebuild a pack from a flat effective definition array (for entry-only callers). */
|
|
46
|
+
export declare function packFromEffectiveDefinitions(entries: EffectiveDefinition[], agentId?: string): MetadataPack;
|
|
47
|
+
/**
|
|
48
|
+
* Build a resolved graph of effective connections over metadata.
|
|
49
|
+
* No new authoring kinds — pure projection from pack / effective result.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildEffectiveMetadataTopology(input: EffectiveMetadataResult | MetadataPack | EffectiveDefinition[]): EffectiveMetadataTopology;
|
|
52
|
+
//# sourceMappingURL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AAM,CAAC;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD,CAAC;AAkFF,sFAAsF;AACtF,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mBAAmB,EAAE,EAC9B,OAAO,SAAc,GACpB,YAAY,CA0Cd;AAuED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,uBAAuB,GAAG,YAAY,GAAG,mBAAmB,EAAE,GACpE,yBAAyB,CA+P3B"}
|
package/dist/topology.js
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effective metadata topology — pure projection of concrete connections.
|
|
3
|
+
*
|
|
4
|
+
* Author relationships on abstracts; consume OT↔OT edges from this projection.
|
|
5
|
+
* Sources/streams feed object types. Agent services declare abstract ports
|
|
6
|
+
* (authored service→abstract edges). Services also appear on OT neighborhoods
|
|
7
|
+
* when a pipeline invokes them and a mapping on the same pipeline lands on an OT.
|
|
8
|
+
*/
|
|
9
|
+
import { resolveAbstractBindings, resolveAbstractBindingsFromPack, } from "./abstracts.js";
|
|
10
|
+
import { foldLegacyAbstractBindings } from "./fold-bindings.js";
|
|
11
|
+
import { resolveSourceStreams } from "./streams.js";
|
|
12
|
+
function nodeId(kind, entityId) {
|
|
13
|
+
return `${kind}:${entityId}`;
|
|
14
|
+
}
|
|
15
|
+
function displayName(def, fallback) {
|
|
16
|
+
if (typeof def.name === "string" && def.name.trim())
|
|
17
|
+
return def.name.trim();
|
|
18
|
+
if (typeof def.title === "string" && def.title.trim())
|
|
19
|
+
return def.title.trim();
|
|
20
|
+
return fallback;
|
|
21
|
+
}
|
|
22
|
+
function pushNode(nodes, kind, entityId, name) {
|
|
23
|
+
const id = nodeId(kind, entityId);
|
|
24
|
+
if (!nodes.has(id)) {
|
|
25
|
+
nodes.set(id, { id, kind, entityId, name: name ?? entityId });
|
|
26
|
+
}
|
|
27
|
+
return id;
|
|
28
|
+
}
|
|
29
|
+
function pushEdge(edges, seen, from, to, kind, via) {
|
|
30
|
+
const viaKey = via
|
|
31
|
+
? `:${via.relationshipDefinitionId ?? ""}:${via.pipelineId ?? ""}:${via.mappingId ?? ""}:${via.streamId ?? ""}:${via.direction ?? ""}`
|
|
32
|
+
: "";
|
|
33
|
+
const id = `${from}->${to}:${kind}${viaKey}`;
|
|
34
|
+
if (seen.has(id))
|
|
35
|
+
return;
|
|
36
|
+
seen.add(id);
|
|
37
|
+
edges.push(via ? { id, from, to, kind, via } : { id, from, to, kind });
|
|
38
|
+
}
|
|
39
|
+
function isMetadataPack(input) {
|
|
40
|
+
return (!!input &&
|
|
41
|
+
typeof input === "object" &&
|
|
42
|
+
input.format === "memorix-metadata/1" &&
|
|
43
|
+
Array.isArray(input.agents));
|
|
44
|
+
}
|
|
45
|
+
function isEffectiveResult(input) {
|
|
46
|
+
return (!!input &&
|
|
47
|
+
typeof input === "object" &&
|
|
48
|
+
"effective" in input &&
|
|
49
|
+
"ok" in input &&
|
|
50
|
+
Array.isArray(input.effective));
|
|
51
|
+
}
|
|
52
|
+
function emptyPack(agentId) {
|
|
53
|
+
return {
|
|
54
|
+
format: "memorix-metadata/1",
|
|
55
|
+
agentId,
|
|
56
|
+
agents: [],
|
|
57
|
+
objectTypes: [],
|
|
58
|
+
abstractTypes: [],
|
|
59
|
+
abstractBindings: [],
|
|
60
|
+
relationshipDefinitions: [],
|
|
61
|
+
mappings: [],
|
|
62
|
+
views: [],
|
|
63
|
+
writes: [],
|
|
64
|
+
sources: [],
|
|
65
|
+
services: [],
|
|
66
|
+
pipelines: [],
|
|
67
|
+
schedules: [],
|
|
68
|
+
kindDeclarations: [],
|
|
69
|
+
extensions: {},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Rebuild a pack from a flat effective definition array (for entry-only callers). */
|
|
73
|
+
export function packFromEffectiveDefinitions(entries, agentId = "effective") {
|
|
74
|
+
const pack = emptyPack(agentId);
|
|
75
|
+
const bucket = (kind) => {
|
|
76
|
+
switch (kind) {
|
|
77
|
+
case "agents":
|
|
78
|
+
return pack.agents;
|
|
79
|
+
case "object-types":
|
|
80
|
+
return pack.objectTypes;
|
|
81
|
+
case "abstract-types":
|
|
82
|
+
return pack.abstractTypes;
|
|
83
|
+
case "relationship-definitions":
|
|
84
|
+
return pack.relationshipDefinitions;
|
|
85
|
+
case "mappings":
|
|
86
|
+
return pack.mappings;
|
|
87
|
+
case "views":
|
|
88
|
+
return pack.views;
|
|
89
|
+
case "writes":
|
|
90
|
+
return pack.writes;
|
|
91
|
+
case "sources":
|
|
92
|
+
return pack.sources;
|
|
93
|
+
case "services":
|
|
94
|
+
return pack.services;
|
|
95
|
+
case "pipelines":
|
|
96
|
+
return pack.pipelines;
|
|
97
|
+
case "schedules":
|
|
98
|
+
return pack.schedules;
|
|
99
|
+
case "kind-declarations":
|
|
100
|
+
return pack.kindDeclarations;
|
|
101
|
+
default:
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
for (const e of entries) {
|
|
106
|
+
const def = { ...(e.definition ?? {}), id: e.id };
|
|
107
|
+
const list = bucket(e.kind);
|
|
108
|
+
if (list)
|
|
109
|
+
list.push(def);
|
|
110
|
+
}
|
|
111
|
+
if (!pack.agents.some((a) => a.id === agentId)) {
|
|
112
|
+
pack.agents.push({ id: agentId, name: agentId, parentId: null });
|
|
113
|
+
}
|
|
114
|
+
return pack;
|
|
115
|
+
}
|
|
116
|
+
function resolvePackAndAbstracts(input) {
|
|
117
|
+
if (isMetadataPack(input)) {
|
|
118
|
+
const abstracts = resolveAbstractBindingsFromPack(input);
|
|
119
|
+
return { pack: input, abstracts, ok: abstracts.ok, issues: abstracts.issues };
|
|
120
|
+
}
|
|
121
|
+
if (isEffectiveResult(input)) {
|
|
122
|
+
if (input.effectivePack) {
|
|
123
|
+
const abstracts = resolveAbstractBindings(input);
|
|
124
|
+
return {
|
|
125
|
+
pack: input.effectivePack,
|
|
126
|
+
abstracts,
|
|
127
|
+
ok: input.ok && abstracts.ok,
|
|
128
|
+
issues: [
|
|
129
|
+
...input.issues.map((i) => ({ code: i.code, message: i.message })),
|
|
130
|
+
...abstracts.issues,
|
|
131
|
+
],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (input.effective.length > 0) {
|
|
135
|
+
const pack = packFromEffectiveDefinitions(input.effective, input.selectedAgentIds[0] ?? "effective");
|
|
136
|
+
const abstracts = resolveAbstractBindingsFromPack(pack);
|
|
137
|
+
return {
|
|
138
|
+
pack,
|
|
139
|
+
abstracts,
|
|
140
|
+
ok: input.ok && abstracts.ok,
|
|
141
|
+
issues: [
|
|
142
|
+
...input.issues.map((i) => ({ code: i.code, message: i.message })),
|
|
143
|
+
...abstracts.issues,
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
pack: null,
|
|
149
|
+
abstracts: {
|
|
150
|
+
ok: false,
|
|
151
|
+
issues: [],
|
|
152
|
+
plans: [],
|
|
153
|
+
relationshipExpansions: [],
|
|
154
|
+
identityModel: {
|
|
155
|
+
abstractsMaterializeRecords: false,
|
|
156
|
+
abstractsHaveCollections: false,
|
|
157
|
+
concreteRecordIdRetained: true,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
ok: false,
|
|
161
|
+
issues: [{ code: "TOPO-EMPTY", message: "No effective metadata to project" }],
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
// EffectiveDefinition[]
|
|
165
|
+
const entries = input;
|
|
166
|
+
const pack = packFromEffectiveDefinitions(entries);
|
|
167
|
+
const abstracts = resolveAbstractBindingsFromPack(pack);
|
|
168
|
+
return { pack, abstracts, ok: abstracts.ok, issues: abstracts.issues };
|
|
169
|
+
}
|
|
170
|
+
function memberObjectTypes(abs) {
|
|
171
|
+
return [...new Set((abs.members ?? []).map((m) => m.objectType).filter(Boolean))];
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Build a resolved graph of effective connections over metadata.
|
|
175
|
+
* No new authoring kinds — pure projection from pack / effective result.
|
|
176
|
+
*/
|
|
177
|
+
export function buildEffectiveMetadataTopology(input) {
|
|
178
|
+
const { pack, abstracts, ok, issues } = resolvePackAndAbstracts(input);
|
|
179
|
+
if (!pack) {
|
|
180
|
+
return { ok: false, nodes: [], edges: [], issues };
|
|
181
|
+
}
|
|
182
|
+
foldLegacyAbstractBindings(pack);
|
|
183
|
+
const nodes = new Map();
|
|
184
|
+
const edges = [];
|
|
185
|
+
const seen = new Set();
|
|
186
|
+
// --- Agents ---
|
|
187
|
+
for (const a of pack.agents) {
|
|
188
|
+
pushNode(nodes, "agents", a.id, a.name ?? a.id);
|
|
189
|
+
}
|
|
190
|
+
// --- Object types ---
|
|
191
|
+
for (const ot of pack.objectTypes) {
|
|
192
|
+
pushNode(nodes, "object-types", ot.id, ot.name ?? ot.id);
|
|
193
|
+
}
|
|
194
|
+
// --- Abstracts + member edges (sole membership source of truth) ---
|
|
195
|
+
for (const abs of pack.abstractTypes) {
|
|
196
|
+
pushNode(nodes, "abstract-types", abs.id, abs.name ?? abs.id);
|
|
197
|
+
for (const m of memberObjectTypes(abs)) {
|
|
198
|
+
pushNode(nodes, "object-types", m);
|
|
199
|
+
pushEdge(edges, seen, nodeId("abstract-types", abs.id), nodeId("object-types", m), "member");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// --- Relationship defs (abstract endpoints) + projected OT↔OT ---
|
|
203
|
+
for (const rel of pack.relationshipDefinitions) {
|
|
204
|
+
pushNode(nodes, "relationship-definitions", rel.id, rel.name ?? rel.id);
|
|
205
|
+
const fromAbs = rel.from?.abstractType?.trim();
|
|
206
|
+
const toAbs = rel.to?.abstractType?.trim();
|
|
207
|
+
if (fromAbs) {
|
|
208
|
+
pushNode(nodes, "abstract-types", fromAbs);
|
|
209
|
+
pushEdge(edges, seen, nodeId("relationship-definitions", rel.id), nodeId("abstract-types", fromAbs), "from");
|
|
210
|
+
}
|
|
211
|
+
if (toAbs) {
|
|
212
|
+
pushNode(nodes, "abstract-types", toAbs);
|
|
213
|
+
pushEdge(edges, seen, nodeId("relationship-definitions", rel.id), nodeId("abstract-types", toAbs), "to");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
for (const exp of abstracts.relationshipExpansions) {
|
|
217
|
+
for (const combo of exp.candidateCombinations) {
|
|
218
|
+
pushNode(nodes, "object-types", combo.fromObjectType);
|
|
219
|
+
pushNode(nodes, "object-types", combo.toObjectType);
|
|
220
|
+
pushEdge(edges, seen, nodeId("object-types", combo.fromObjectType), nodeId("object-types", combo.toObjectType), "related", {
|
|
221
|
+
relationshipDefinitionId: exp.relationshipId,
|
|
222
|
+
direction: "from-to",
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// --- Mappings ---
|
|
227
|
+
const mappingById = new Map();
|
|
228
|
+
for (const m of pack.mappings) {
|
|
229
|
+
mappingById.set(m.id, m);
|
|
230
|
+
pushNode(nodes, "mappings", m.id, m.id);
|
|
231
|
+
if (m.objectType?.trim()) {
|
|
232
|
+
pushNode(nodes, "object-types", m.objectType.trim());
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// --- Connector instances (metadata kind `sources`) + streams ---
|
|
236
|
+
// The connector *package* id lives on the instance (`connectorRef`); it is not
|
|
237
|
+
// a peer topology node. Operators manage one concept: installed connectors.
|
|
238
|
+
for (const source of pack.sources) {
|
|
239
|
+
const sourceNode = pushNode(nodes, "sources", source.id, source.name ?? source.id);
|
|
240
|
+
const streams = resolveSourceStreams(source);
|
|
241
|
+
const streamFed = new Set();
|
|
242
|
+
for (const stream of streams) {
|
|
243
|
+
const streamEntityId = `${source.id}/${stream.streamId}`;
|
|
244
|
+
const streamNode = pushNode(nodes, "streams", streamEntityId, stream.name ?? stream.endpoint ?? stream.streamId);
|
|
245
|
+
pushEdge(edges, seen, sourceNode, streamNode, "stream");
|
|
246
|
+
const ot = stream.objectType?.trim();
|
|
247
|
+
if (ot) {
|
|
248
|
+
streamFed.add(ot);
|
|
249
|
+
pushNode(nodes, "object-types", ot);
|
|
250
|
+
pushEdge(edges, seen, streamNode, nodeId("object-types", ot), "feeds", {
|
|
251
|
+
streamId: stream.streamId,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Aggregate source→OT feeds only when no stream already covers that OT.
|
|
256
|
+
const routeOts = new Set();
|
|
257
|
+
for (const r of source.routes ?? []) {
|
|
258
|
+
if (r.objectType?.trim())
|
|
259
|
+
routeOts.add(r.objectType.trim());
|
|
260
|
+
}
|
|
261
|
+
for (const s of source.streams ?? []) {
|
|
262
|
+
if (s.objectType?.trim())
|
|
263
|
+
routeOts.add(s.objectType.trim());
|
|
264
|
+
}
|
|
265
|
+
for (const ot of routeOts) {
|
|
266
|
+
if (streamFed.has(ot))
|
|
267
|
+
continue;
|
|
268
|
+
pushNode(nodes, "object-types", ot);
|
|
269
|
+
pushEdge(edges, seen, sourceNode, nodeId("object-types", ot), "feeds");
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// --- Services (authored abstract ports + pipeline-derived OT transforms) ---
|
|
273
|
+
for (const svc of pack.services) {
|
|
274
|
+
pushNode(nodes, "services", svc.id, svc.name ?? svc.id);
|
|
275
|
+
const ports = [...(svc.inputs ?? []), ...(svc.outputs ?? [])];
|
|
276
|
+
const seenAbs = new Set();
|
|
277
|
+
for (const port of ports) {
|
|
278
|
+
const abs = port.abstractType?.trim();
|
|
279
|
+
if (!abs || seenAbs.has(abs))
|
|
280
|
+
continue;
|
|
281
|
+
seenAbs.add(abs);
|
|
282
|
+
pushNode(nodes, "abstract-types", abs);
|
|
283
|
+
pushEdge(edges, seen, nodeId("services", svc.id), nodeId("abstract-types", abs), "transforms", { serviceId: svc.id });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// --- Pipelines: step edges + derived service→OT transforms ---
|
|
287
|
+
for (const pipeline of pack.pipelines) {
|
|
288
|
+
pushNode(nodes, "pipelines", pipeline.id, pipeline.name ?? pipeline.id);
|
|
289
|
+
const serviceIds = new Set();
|
|
290
|
+
const mappingIds = new Set();
|
|
291
|
+
for (const step of pipeline.steps ?? []) {
|
|
292
|
+
const stepKind = step.kind?.trim() || "step";
|
|
293
|
+
if (step.sourceId?.trim()) {
|
|
294
|
+
pushNode(nodes, "sources", step.sourceId.trim());
|
|
295
|
+
pushEdge(edges, seen, nodeId("pipelines", pipeline.id), nodeId("sources", step.sourceId.trim()), stepKind, { pipelineId: pipeline.id, stepId: step.id });
|
|
296
|
+
}
|
|
297
|
+
if (step.serviceId?.trim()) {
|
|
298
|
+
serviceIds.add(step.serviceId.trim());
|
|
299
|
+
pushNode(nodes, "services", step.serviceId.trim());
|
|
300
|
+
pushEdge(edges, seen, nodeId("pipelines", pipeline.id), nodeId("services", step.serviceId.trim()), stepKind, { pipelineId: pipeline.id, stepId: step.id });
|
|
301
|
+
}
|
|
302
|
+
if (step.mappingId?.trim()) {
|
|
303
|
+
mappingIds.add(step.mappingId.trim());
|
|
304
|
+
pushNode(nodes, "mappings", step.mappingId.trim());
|
|
305
|
+
pushEdge(edges, seen, nodeId("pipelines", pipeline.id), nodeId("mappings", step.mappingId.trim()), stepKind, { pipelineId: pipeline.id, stepId: step.id });
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// Derived transforms: service on pipeline + mapping on same pipeline → OT
|
|
309
|
+
for (const serviceId of serviceIds) {
|
|
310
|
+
for (const mappingId of mappingIds) {
|
|
311
|
+
const mapping = mappingById.get(mappingId);
|
|
312
|
+
const ot = mapping?.objectType?.trim();
|
|
313
|
+
if (!ot)
|
|
314
|
+
continue;
|
|
315
|
+
pushNode(nodes, "object-types", ot);
|
|
316
|
+
pushEdge(edges, seen, nodeId("services", serviceId), nodeId("object-types", ot), "transforms", { pipelineId: pipeline.id, mappingId });
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
// --- Views / writes / schedules / kind-declarations ---
|
|
321
|
+
for (const v of pack.views) {
|
|
322
|
+
pushNode(nodes, "views", v.id, displayName(v, v.id));
|
|
323
|
+
}
|
|
324
|
+
for (const w of pack.writes) {
|
|
325
|
+
pushNode(nodes, "writes", w.id, w.id);
|
|
326
|
+
}
|
|
327
|
+
for (const s of pack.schedules) {
|
|
328
|
+
pushNode(nodes, "schedules", s.id, s.id);
|
|
329
|
+
if (s.pipelineId?.trim()) {
|
|
330
|
+
pushNode(nodes, "pipelines", s.pipelineId.trim());
|
|
331
|
+
pushEdge(edges, seen, nodeId("schedules", s.id), nodeId("pipelines", s.pipelineId.trim()), "runs", { pipelineId: s.pipelineId.trim() });
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
for (const k of pack.kindDeclarations ?? []) {
|
|
335
|
+
pushNode(nodes, "kind-declarations", k.id, k.name ?? k.id);
|
|
336
|
+
}
|
|
337
|
+
// Drop edges whose endpoints vanished (should not happen after pushNode)
|
|
338
|
+
const pruned = edges.filter((e) => nodes.has(e.from) && nodes.has(e.to));
|
|
339
|
+
const sortedNodes = [...nodes.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
340
|
+
const sortedEdges = pruned.sort((a, b) => a.id.localeCompare(b.id));
|
|
341
|
+
return {
|
|
342
|
+
ok,
|
|
343
|
+
nodes: sortedNodes,
|
|
344
|
+
edges: sortedEdges,
|
|
345
|
+
issues,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=topology.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topology.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;KACP,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Canonical metadata document shapes (Phase 3A).
|
|
3
|
-
* Agents are one kind;
|
|
3
|
+
* Agents are one kind; parentIds optional; no base/concrete classification.
|
|
4
4
|
*/
|
|
5
5
|
export type JsonObject = Record<string, unknown>;
|
|
6
6
|
export type AgentDefinition = {
|
|
7
7
|
id: string;
|
|
8
8
|
name: string;
|
|
9
9
|
description?: string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Direct parent agent ids. Empty / omitted = root.
|
|
12
|
+
* Prefer this over parentId; values are unique and sorted when normalized.
|
|
13
|
+
*/
|
|
14
|
+
parentIds?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Legacy single parent. Prefer parentIds.
|
|
17
|
+
* When both are present, parentIds wins after normalize.
|
|
18
|
+
*/
|
|
11
19
|
parentId?: string | null;
|
|
12
20
|
};
|
|
21
|
+
/** Resolve direct parent ids from an agent record (supports legacy parentId). */
|
|
22
|
+
export declare function parentIdsOf(agent: AgentDefinition | null | undefined): string[];
|
|
13
23
|
export type ContentTypeSpec = {
|
|
14
24
|
id: string;
|
|
25
|
+
/** When true, subjects of this object type should have this content type. */
|
|
15
26
|
required?: boolean;
|
|
27
|
+
/** Why this content type is required; set when `required` is true. */
|
|
28
|
+
requiredReason?: string;
|
|
16
29
|
notes?: string;
|
|
17
30
|
retention?: string;
|
|
18
31
|
discriminator?: {
|
|
@@ -28,6 +41,13 @@ export type ObjectTypeFieldSpec = {
|
|
|
28
41
|
valueType: string;
|
|
29
42
|
/** Defaults to applying across all content types when omitted. */
|
|
30
43
|
contentType?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Target object type when this field holds a record id (or array of ids).
|
|
46
|
+
* Required for entity-valued fields (`recordId` / array of recordIds).
|
|
47
|
+
*/
|
|
48
|
+
refersTo?: {
|
|
49
|
+
objectType: string;
|
|
50
|
+
};
|
|
31
51
|
};
|
|
32
52
|
export type ObjectTypeDefinition = {
|
|
33
53
|
id: string;
|
|
@@ -47,16 +67,6 @@ export type AbstractPropertyDefinition = {
|
|
|
47
67
|
required?: boolean;
|
|
48
68
|
description?: string;
|
|
49
69
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Metadata-only abstract type. Never materializes a collection or abstract recordId.
|
|
52
|
-
*/
|
|
53
|
-
export type AbstractTypeDefinition = {
|
|
54
|
-
id: string;
|
|
55
|
-
name: string;
|
|
56
|
-
meaning: string;
|
|
57
|
-
category: string;
|
|
58
|
-
properties?: AbstractPropertyDefinition[];
|
|
59
|
-
};
|
|
60
70
|
/**
|
|
61
71
|
* How one abstract property is satisfied for one concrete union member.
|
|
62
72
|
* Direct: propertyPath (+ compatible concreteValueType).
|
|
@@ -87,9 +97,24 @@ export type AbstractMemberBinding = {
|
|
|
87
97
|
properties?: AbstractPropertyBinding[];
|
|
88
98
|
};
|
|
89
99
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
|
|
100
|
+
* Metadata-only abstract type. Never materializes a collection or abstract recordId.
|
|
101
|
+
* Owns membership and property projection (`members`) — no separate binding kind.
|
|
102
|
+
*/
|
|
103
|
+
export type AbstractTypeDefinition = {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
meaning: string;
|
|
107
|
+
category: string;
|
|
108
|
+
properties?: AbstractPropertyDefinition[];
|
|
109
|
+
/** Concrete object types that participate + how each fills abstract properties. */
|
|
110
|
+
members?: AbstractMemberBinding[];
|
|
111
|
+
/** True when more than one concrete object type participates. */
|
|
112
|
+
union?: boolean;
|
|
113
|
+
notes?: string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* @deprecated Legacy separate binding documents. Folded into
|
|
117
|
+
* `AbstractTypeDefinition.members` by `foldLegacyAbstractBindings`.
|
|
93
118
|
*/
|
|
94
119
|
export type AbstractBindingDefinition = {
|
|
95
120
|
id: string;
|
|
@@ -169,6 +194,13 @@ export type WriteDefinition = {
|
|
|
169
194
|
issuer?: string;
|
|
170
195
|
};
|
|
171
196
|
};
|
|
197
|
+
/** How Memory resumes the next pull for this route. */
|
|
198
|
+
export type SourceCheckpointMethod = "cursor" | "watermark" | "fullScanHash";
|
|
199
|
+
export type SourceRouteCheckpoint = {
|
|
200
|
+
method: SourceCheckpointMethod;
|
|
201
|
+
/** watermark only — path/field in provider payload or header name */
|
|
202
|
+
watermarkField?: string;
|
|
203
|
+
};
|
|
172
204
|
export type SourceRouteDefinition = {
|
|
173
205
|
endpoint: string;
|
|
174
206
|
objectType: string;
|
|
@@ -177,6 +209,45 @@ export type SourceRouteDefinition = {
|
|
|
177
209
|
primaryKind?: string;
|
|
178
210
|
modes?: Array<"context" | "knowledge">;
|
|
179
211
|
pageSize?: number;
|
|
212
|
+
/** Declared checkpoint method for this route (runtime state is per-org). */
|
|
213
|
+
checkpoint?: SourceRouteCheckpoint;
|
|
214
|
+
/**
|
|
215
|
+
* Optional stable stream id. When omitted, runtime derives a compatibility
|
|
216
|
+
* identity from endpoint + objectType (FR-007 / FR-043).
|
|
217
|
+
*/
|
|
218
|
+
streamId?: string;
|
|
219
|
+
};
|
|
220
|
+
/** Stable data-producing unit that owns independent checkpoint state (FR-007). */
|
|
221
|
+
export type SourceStreamDefinition = {
|
|
222
|
+
streamId: string;
|
|
223
|
+
/** User-readable name. */
|
|
224
|
+
name?: string;
|
|
225
|
+
/** Provider operation or endpoint path. */
|
|
226
|
+
endpoint: string;
|
|
227
|
+
objectType: string;
|
|
228
|
+
dataCategory: "entity" | "event" | "knowledge" | "operational" | string;
|
|
229
|
+
identityPath?: string;
|
|
230
|
+
primaryKind?: string;
|
|
231
|
+
modes?: Array<"context" | "knowledge">;
|
|
232
|
+
pageSize?: number;
|
|
233
|
+
checkpoint?: SourceRouteCheckpoint;
|
|
234
|
+
/** True when streamId was derived from a legacy route (not authored). */
|
|
235
|
+
derivedFromRoute?: boolean;
|
|
236
|
+
};
|
|
237
|
+
export type SourceWorkflowStepKind = "command" | "poll" | "collect" | "control";
|
|
238
|
+
/** Declarative workflow step metadata (runtime handlers live in the connector). */
|
|
239
|
+
export type SourceWorkflowStepDefinition = {
|
|
240
|
+
id: string;
|
|
241
|
+
name?: string;
|
|
242
|
+
kind: SourceWorkflowStepKind;
|
|
243
|
+
dependsOn?: string[];
|
|
244
|
+
/** Provider operation label for Studio. */
|
|
245
|
+
providerOperation?: string;
|
|
246
|
+
/** Stream ids produced by this step (collect steps). */
|
|
247
|
+
streamIds?: string[];
|
|
248
|
+
};
|
|
249
|
+
export type SourceWorkflowDefinition = {
|
|
250
|
+
steps: SourceWorkflowStepDefinition[];
|
|
180
251
|
};
|
|
181
252
|
export type SourceRetentionPolicy = {
|
|
182
253
|
context?: {
|
|
@@ -193,7 +264,12 @@ export type SourceDefinition = {
|
|
|
193
264
|
/** Logical credential reference id — not a secret value. */
|
|
194
265
|
credentialRef?: string;
|
|
195
266
|
endpoints?: string[];
|
|
267
|
+
/** Legacy flat routes — still supported via compatibility adapter. */
|
|
196
268
|
routes?: SourceRouteDefinition[];
|
|
269
|
+
/** Preferred stable streams (FR-007). When absent, derived from routes. */
|
|
270
|
+
streams?: SourceStreamDefinition[];
|
|
271
|
+
/** Ordered / dependency-based retrieval workflow (FR-006). */
|
|
272
|
+
workflow?: SourceWorkflowDefinition;
|
|
197
273
|
retention?: SourceRetentionPolicy;
|
|
198
274
|
pagination?: {
|
|
199
275
|
style?: "cursor" | "page";
|
|
@@ -201,9 +277,30 @@ export type SourceDefinition = {
|
|
|
201
277
|
};
|
|
202
278
|
connectorRef?: string;
|
|
203
279
|
};
|
|
280
|
+
/**
|
|
281
|
+
* `agent` (default): subject I/O speaks only abstracts.
|
|
282
|
+
* `connector`: connector-adjacent pull/promote workers — exempt from the
|
|
283
|
+
* abstract-port law; may use concrete Memory surfaces (`raw`).
|
|
284
|
+
*/
|
|
285
|
+
export type ServiceRole = "agent" | "connector";
|
|
204
286
|
export type ServiceIoPort = {
|
|
205
287
|
id: string;
|
|
206
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* Abstract type this port speaks. Required on subject-data ports for
|
|
290
|
+
* `role: "agent"` services (default). Runtime may resolve to concrete members.
|
|
291
|
+
*/
|
|
292
|
+
abstractType?: string;
|
|
293
|
+
/** Optional property / view path on the abstract. */
|
|
294
|
+
path?: string;
|
|
295
|
+
/**
|
|
296
|
+
* Non-subject control port (triggerReason, sourceId, cursors, …).
|
|
297
|
+
* Exempt from abstractType requirement on agent services.
|
|
298
|
+
*/
|
|
299
|
+
control?: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Logical schema / view reference — not a runtime payload.
|
|
302
|
+
* Must not be `memorix-record/{contentType}` on agent services; prefer abstractType.
|
|
303
|
+
*/
|
|
207
304
|
schemaRef?: string;
|
|
208
305
|
description?: string;
|
|
209
306
|
};
|
|
@@ -214,15 +311,30 @@ export type ServiceInvocation = {
|
|
|
214
311
|
/**
|
|
215
312
|
* Declarative service contract: capabilities + logical I/O + invocation shape.
|
|
216
313
|
* Forbidden: secret values, deployment/runtime state.
|
|
314
|
+
* Agent services speak only abstracts (hard rule); connector-role workers may
|
|
315
|
+
* land concrete raw via sources/connectors.
|
|
217
316
|
*/
|
|
317
|
+
/** Opt-in Memorix surfaces a called service may use mid-invocation. */
|
|
318
|
+
export type MemorixServiceAccess = "explore" | "checkpoints" | "raw";
|
|
218
319
|
export type ServiceDefinition = {
|
|
219
320
|
id: string;
|
|
220
321
|
name: string;
|
|
221
322
|
description?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Default `agent`. Use `connector` for pull/promote workers that speak
|
|
325
|
+
* concrete Memory / source ids — not agent vocabulary.
|
|
326
|
+
*/
|
|
327
|
+
role?: ServiceRole;
|
|
222
328
|
capabilities: string[];
|
|
223
329
|
inputs?: ServiceIoPort[];
|
|
224
330
|
outputs?: ServiceIoPort[];
|
|
225
331
|
invocation?: ServiceInvocation;
|
|
332
|
+
/**
|
|
333
|
+
* When set, pipeline invoke injects a `memorix` callback context so the
|
|
334
|
+
* worker can call Explore and/or Source checkpoints mid-work.
|
|
335
|
+
* `raw` is allowed only when `role: "connector"`.
|
|
336
|
+
*/
|
|
337
|
+
memorixAccess?: MemorixServiceAccess[];
|
|
226
338
|
};
|
|
227
339
|
export type PipelineStep = {
|
|
228
340
|
id: string;
|
|
@@ -267,7 +379,11 @@ export type MetadataPack = {
|
|
|
267
379
|
agents: AgentDefinition[];
|
|
268
380
|
objectTypes: ObjectTypeDefinition[];
|
|
269
381
|
abstractTypes: AbstractTypeDefinition[];
|
|
270
|
-
|
|
382
|
+
/**
|
|
383
|
+
* @deprecated Always empty after normalize/fold. Kept optional for load compat.
|
|
384
|
+
* Membership lives on `abstractTypes[].members`.
|
|
385
|
+
*/
|
|
386
|
+
abstractBindings?: AbstractBindingDefinition[];
|
|
271
387
|
relationshipDefinitions: RelationshipDefinition[];
|
|
272
388
|
mappings: MappingDefinition[];
|
|
273
389
|
views: ViewDefinition[];
|