ma-agents 3.15.4 → 3.16.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/lib/bmad-extension-plugin/.claude-plugin/marketplace.json +1 -1
- package/lib/knowledge-atlas/dist/atlas.cjs +138 -55
- package/lib/knowledge-atlas/src/render/document.ts +109 -12
- package/lib/knowledge-atlas/src/render/site.ts +20 -2
- package/lib/knowledge-atlas/src/render/vendor.ts +43 -0
- package/lib/knowledge-atlas/vendor/drawio-viewer.min.js +7563 -0
- package/lib/knowledge-atlas/vendor/mermaid.min.js +2314 -0
- package/package.json +70 -70
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/knowledge-atlas/src/render/vendor.ts
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* Locate and read vendored browser runtimes that are too large to embed as
|
|
5
|
+
* inline strings in the bundle (mermaid, the drawio viewer). They ship as real
|
|
6
|
+
* files under `lib/knowledge-atlas/vendor/` and are copied verbatim into a
|
|
7
|
+
* generated site's `assets/` directory, referenced by a local relative
|
|
8
|
+
* `<script src="…">`. Nothing here is fetched over the network — the files are
|
|
9
|
+
* part of the committed, offline ma-agents distribution.
|
|
10
|
+
*
|
|
11
|
+
* The engine runs as the bundled `lib/knowledge-atlas/dist/atlas.cjs`, so the
|
|
12
|
+
* vendor directory is a sibling of `dist/` (`../vendor`).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import * as fs from 'fs';
|
|
16
|
+
import * as path from 'path';
|
|
17
|
+
|
|
18
|
+
/** Absolute path to the vendored-runtime directory, relative to the bundle. */
|
|
19
|
+
export function vendorDir(): string {
|
|
20
|
+
return path.join(__dirname, '..', 'vendor');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Read a vendored asset (e.g. "mermaid.min.js"); returns null if absent. */
|
|
24
|
+
export function readVendorAsset(name: string): string | null {
|
|
25
|
+
const p = path.join(vendorDir(), name);
|
|
26
|
+
try {
|
|
27
|
+
return fs.readFileSync(p, 'utf-8');
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Copy a vendored asset into `outDir/assets/<name>`. Returns the relative path
|
|
34
|
+
* written (e.g. "assets/mermaid.min.js"), or null if the asset is unavailable. */
|
|
35
|
+
export function writeVendorAsset(outDir: string, name: string): string | null {
|
|
36
|
+
const content = readVendorAsset(name);
|
|
37
|
+
if (content == null) return null;
|
|
38
|
+
const assetsDir = path.join(outDir, 'assets');
|
|
39
|
+
fs.mkdirSync(assetsDir, { recursive: true });
|
|
40
|
+
// LF-normalize for determinism (NFR62), consistent with writeHtml.
|
|
41
|
+
fs.writeFileSync(path.join(assetsDir, name), content.replace(/\r\n/g, '\n'), { encoding: 'utf-8' });
|
|
42
|
+
return `assets/${name}`;
|
|
43
|
+
}
|