schematex 0.2.0 → 0.2.3
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 +1 -1
- package/dist/ai/ai-sdk.cjs +85 -0
- package/dist/ai/ai-sdk.cjs.map +1 -0
- package/dist/ai/ai-sdk.d.cts +30 -0
- package/dist/ai/ai-sdk.d.ts +30 -0
- package/dist/ai/ai-sdk.js +83 -0
- package/dist/ai/ai-sdk.js.map +1 -0
- package/dist/ai/index.cjs +60 -0
- package/dist/ai/index.cjs.map +1 -0
- package/dist/ai/index.d.cts +155 -0
- package/dist/ai/index.d.ts +155 -0
- package/dist/ai/index.js +23 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/browser.cjs +22 -21
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +20 -19
- package/dist/browser.js.map +1 -1
- package/dist/{chunk-HLYA4QBB.js → chunk-2BM3HJSK.js} +545 -101
- package/dist/chunk-2BM3HJSK.js.map +1 -0
- package/dist/{chunk-ZO77FHBF.cjs → chunk-2JDVJRR3.cjs} +14 -6
- package/dist/chunk-2JDVJRR3.cjs.map +1 -0
- package/dist/{chunk-TIGP2OEJ.js → chunk-2VNMKOUO.js} +20 -5
- package/dist/chunk-2VNMKOUO.js.map +1 -0
- package/dist/{chunk-ULERCTGS.cjs → chunk-3YZ6FPQW.cjs} +36 -30
- package/dist/chunk-3YZ6FPQW.cjs.map +1 -0
- package/dist/{chunk-GEPBET4L.js → chunk-45KP67RR.js} +14 -6
- package/dist/chunk-45KP67RR.js.map +1 -0
- package/dist/chunk-4QP37LD3.js +1112 -0
- package/dist/chunk-4QP37LD3.js.map +1 -0
- package/dist/{chunk-HKRYKEOV.cjs → chunk-4S2WILLW.cjs} +4 -4
- package/dist/{chunk-HKRYKEOV.cjs.map → chunk-4S2WILLW.cjs.map} +1 -1
- package/dist/{chunk-IMHR3S5H.cjs → chunk-5AEN2PLB.cjs} +17 -9
- package/dist/chunk-5AEN2PLB.cjs.map +1 -0
- package/dist/{chunk-SPIW4VWP.js → chunk-5YYAYW67.js} +3 -3
- package/dist/{chunk-SPIW4VWP.js.map → chunk-5YYAYW67.js.map} +1 -1
- package/dist/{chunk-CEV3GZA3.cjs → chunk-6LZJTAA3.cjs} +552 -108
- package/dist/chunk-6LZJTAA3.cjs.map +1 -0
- package/dist/{chunk-IY52OWPG.cjs → chunk-A5D2IMOX.cjs} +18 -10
- package/dist/chunk-A5D2IMOX.cjs.map +1 -0
- package/dist/{chunk-AMP2FFES.cjs → chunk-B37IKTI7.cjs} +229 -52
- package/dist/chunk-B37IKTI7.cjs.map +1 -0
- package/dist/{chunk-LKHWBDWZ.cjs → chunk-B6INLQBU.cjs} +17 -11
- package/dist/chunk-B6INLQBU.cjs.map +1 -0
- package/dist/{chunk-DTMCQXXC.cjs → chunk-COLTVQWR.cjs} +184 -16
- package/dist/chunk-COLTVQWR.cjs.map +1 -0
- package/dist/{chunk-S6VPECM3.cjs → chunk-D7EHZFK4.cjs} +20 -5
- package/dist/chunk-D7EHZFK4.cjs.map +1 -0
- package/dist/chunk-DNZFOCV7.js +796 -0
- package/dist/chunk-DNZFOCV7.js.map +1 -0
- package/dist/{chunk-ZGKEFVJQ.cjs → chunk-E65ITQXV.cjs} +188 -32
- package/dist/chunk-E65ITQXV.cjs.map +1 -0
- package/dist/{chunk-7WXAAVR3.js → chunk-FCGHV6ZK.js} +17 -9
- package/dist/chunk-FCGHV6ZK.js.map +1 -0
- package/dist/{chunk-A74ZCP5I.js → chunk-FE6GAUNW.js} +36 -30
- package/dist/chunk-FE6GAUNW.js.map +1 -0
- package/dist/{chunk-MXJ6FHSY.js → chunk-JDTB7IKL.js} +3 -3
- package/dist/{chunk-MXJ6FHSY.js.map → chunk-JDTB7IKL.js.map} +1 -1
- package/dist/{chunk-RQX53J6M.js → chunk-LR4X4ZRG.js} +180 -24
- package/dist/chunk-LR4X4ZRG.js.map +1 -0
- package/dist/{chunk-MRGS54WN.js → chunk-M5B2UUNW.js} +3 -3
- package/dist/{chunk-MRGS54WN.js.map → chunk-M5B2UUNW.js.map} +1 -1
- package/dist/{chunk-LXNFVHDT.cjs → chunk-MCFQAUQV.cjs} +21 -13
- package/dist/chunk-MCFQAUQV.cjs.map +1 -0
- package/dist/chunk-MOU5QRZY.cjs +1121 -0
- package/dist/chunk-MOU5QRZY.cjs.map +1 -0
- package/dist/{chunk-TPA36ULU.js → chunk-OC22GGQN.js} +223 -46
- package/dist/chunk-OC22GGQN.js.map +1 -0
- package/dist/{chunk-2OIW3MAE.js → chunk-PGALHQFF.js} +3 -3
- package/dist/{chunk-2OIW3MAE.js.map → chunk-PGALHQFF.js.map} +1 -1
- package/dist/{chunk-3M7QWADF.cjs → chunk-QSQX77S2.cjs} +4 -4
- package/dist/{chunk-3M7QWADF.cjs.map → chunk-QSQX77S2.cjs.map} +1 -1
- package/dist/{chunk-VP54YPOX.cjs → chunk-QXIGHMH2.cjs} +498 -177
- package/dist/chunk-QXIGHMH2.cjs.map +1 -0
- package/dist/{chunk-YO4GU6JX.js → chunk-RP5UATRA.js} +175 -7
- package/dist/chunk-RP5UATRA.js.map +1 -0
- package/dist/{chunk-M6AMNXQ7.js → chunk-S3RBKJM5.js} +478 -157
- package/dist/chunk-S3RBKJM5.js.map +1 -0
- package/dist/{chunk-JZGFSRVT.js → chunk-SN7NTZI6.js} +9 -7
- package/dist/chunk-SN7NTZI6.js.map +1 -0
- package/dist/{chunk-L6IHSTPP.js → chunk-U6L3FAML.js} +16 -10
- package/dist/chunk-U6L3FAML.js.map +1 -0
- package/dist/{chunk-5SH5NUDW.js → chunk-UGCUNADI.js} +21 -13
- package/dist/chunk-UGCUNADI.js.map +1 -0
- package/dist/chunk-ULYRO2KY.cjs +800 -0
- package/dist/chunk-ULYRO2KY.cjs.map +1 -0
- package/dist/{chunk-4HPT4BOI.cjs → chunk-WYFXOXVK.cjs} +4 -4
- package/dist/{chunk-4HPT4BOI.cjs.map → chunk-WYFXOXVK.cjs.map} +1 -1
- package/dist/{chunk-YKO7DY2F.cjs → chunk-X7RPFTTR.cjs} +13 -13
- package/dist/{chunk-YKO7DY2F.cjs.map → chunk-X7RPFTTR.cjs.map} +1 -1
- package/dist/{chunk-4TS5NB7L.js → chunk-YQANC7HQ.js} +3 -3
- package/dist/{chunk-4TS5NB7L.js.map → chunk-YQANC7HQ.js.map} +1 -1
- package/dist/{chunk-HAIBAF6J.cjs → chunk-Z3DE6S64.cjs} +10 -8
- package/dist/chunk-Z3DE6S64.cjs.map +1 -0
- package/dist/{chunk-IQIJ6WW6.js → chunk-ZNDIGQJD.js} +15 -7
- package/dist/chunk-ZNDIGQJD.js.map +1 -0
- package/dist/{chunk-PIQG2Z5N.cjs → chunk-ZNOD4VZT.cjs} +4 -4
- package/dist/{chunk-PIQG2Z5N.cjs.map → chunk-ZNOD4VZT.cjs.map} +1 -1
- package/dist/diagrams/blockdiagram/index.cjs +5 -5
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/blockdiagram/index.js +1 -1
- package/dist/diagrams/circuit/index.cjs +8 -8
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.js +2 -2
- package/dist/diagrams/ecomap/index.cjs +8 -7
- package/dist/diagrams/ecomap/index.d.cts +2 -2
- package/dist/diagrams/ecomap/index.d.ts +2 -2
- package/dist/diagrams/ecomap/index.js +3 -2
- package/dist/diagrams/entity/index.cjs +6 -6
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/entity/index.js +2 -2
- package/dist/diagrams/fishbone/index.cjs +8 -8
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.js +2 -2
- package/dist/diagrams/flowchart/index.cjs +8 -8
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/flowchart/index.js +2 -2
- package/dist/diagrams/genogram/index.cjs +10 -9
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/genogram/index.js +3 -2
- package/dist/diagrams/ladder/index.cjs +6 -6
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.js +2 -2
- package/dist/diagrams/logic/index.cjs +6 -6
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/logic/index.js +2 -2
- package/dist/diagrams/orgchart/index.cjs +7 -7
- package/dist/diagrams/orgchart/index.d.cts +5 -2
- package/dist/diagrams/orgchart/index.d.ts +5 -2
- package/dist/diagrams/orgchart/index.js +2 -2
- package/dist/diagrams/pedigree/index.cjs +8 -7
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.js +3 -2
- package/dist/diagrams/phylo/index.cjs +7 -7
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.js +2 -2
- package/dist/diagrams/sld/index.cjs +6 -6
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +2 -2
- package/dist/diagrams/sociogram/index.cjs +7 -6
- package/dist/diagrams/sociogram/index.d.cts +2 -1
- package/dist/diagrams/sociogram/index.d.ts +2 -1
- package/dist/diagrams/sociogram/index.js +3 -2
- package/dist/diagrams/timing/index.cjs +4 -4
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/timing/index.js +1 -1
- package/dist/diagrams/venn/index.cjs +9 -9
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/diagrams/venn/index.js +2 -2
- package/dist/{index-ga04CTBI.d.ts → index-C97K-kuw.d.ts} +1 -1
- package/dist/{index-SSGpCggE.d.cts → index-lsSaw3E0.d.cts} +1 -1
- package/dist/index.cjs +50 -49
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -18
- package/dist/react.cjs +20 -19
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +19 -18
- package/dist/react.js.map +1 -1
- package/dist/{types-BcPhMdHd.d.cts → types-C4LnMEcB.d.cts} +58 -4
- package/dist/{types-BcPhMdHd.d.ts → types-C4LnMEcB.d.ts} +58 -4
- package/package.json +30 -7
- package/dist/chunk-5SH5NUDW.js.map +0 -1
- package/dist/chunk-7WXAAVR3.js.map +0 -1
- package/dist/chunk-A74ZCP5I.js.map +0 -1
- package/dist/chunk-AMP2FFES.cjs.map +0 -1
- package/dist/chunk-CEV3GZA3.cjs.map +0 -1
- package/dist/chunk-DTMCQXXC.cjs.map +0 -1
- package/dist/chunk-GEPBET4L.js.map +0 -1
- package/dist/chunk-HAIBAF6J.cjs.map +0 -1
- package/dist/chunk-HLYA4QBB.js.map +0 -1
- package/dist/chunk-IMHR3S5H.cjs.map +0 -1
- package/dist/chunk-IQIJ6WW6.js.map +0 -1
- package/dist/chunk-IY52OWPG.cjs.map +0 -1
- package/dist/chunk-JZGFSRVT.js.map +0 -1
- package/dist/chunk-L6IHSTPP.js.map +0 -1
- package/dist/chunk-LKHWBDWZ.cjs.map +0 -1
- package/dist/chunk-LXNFVHDT.cjs.map +0 -1
- package/dist/chunk-M6AMNXQ7.js.map +0 -1
- package/dist/chunk-RQX53J6M.js.map +0 -1
- package/dist/chunk-S6VPECM3.cjs.map +0 -1
- package/dist/chunk-TIGP2OEJ.js.map +0 -1
- package/dist/chunk-TPA36ULU.js.map +0 -1
- package/dist/chunk-ULERCTGS.cjs.map +0 -1
- package/dist/chunk-VP54YPOX.cjs.map +0 -1
- package/dist/chunk-YO4GU6JX.js.map +0 -1
- package/dist/chunk-ZGKEFVJQ.cjs.map +0 -1
- package/dist/chunk-ZO77FHBF.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
26
|
<p align="center">
|
|
27
|
-
<img src="
|
|
27
|
+
<img src="./website/public/hero-demo.gif" alt="Schematex demo — genogram, pedigree, ladder logic, phylo, entity structure, fishbone, circuit, ecomap, timing" width="720">
|
|
28
28
|
</p>
|
|
29
29
|
|
|
30
30
|
---
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMOU5QRZY_cjs = require('../chunk-MOU5QRZY.cjs');
|
|
4
|
+
require('../chunk-QXIGHMH2.cjs');
|
|
5
|
+
require('../chunk-A5D2IMOX.cjs');
|
|
6
|
+
require('../chunk-4S2WILLW.cjs');
|
|
7
|
+
require('../chunk-MCFQAUQV.cjs');
|
|
8
|
+
require('../chunk-B6INLQBU.cjs');
|
|
9
|
+
require('../chunk-3YZ6FPQW.cjs');
|
|
10
|
+
require('../chunk-ZNOD4VZT.cjs');
|
|
11
|
+
require('../chunk-5AEN2PLB.cjs');
|
|
12
|
+
require('../chunk-QSQX77S2.cjs');
|
|
13
|
+
require('../chunk-Z3DE6S64.cjs');
|
|
14
|
+
require('../chunk-6LZJTAA3.cjs');
|
|
15
|
+
require('../chunk-E65ITQXV.cjs');
|
|
16
|
+
require('../chunk-B37IKTI7.cjs');
|
|
17
|
+
require('../chunk-X7RPFTTR.cjs');
|
|
18
|
+
require('../chunk-COLTVQWR.cjs');
|
|
19
|
+
require('../chunk-ULYRO2KY.cjs');
|
|
20
|
+
require('../chunk-2JDVJRR3.cjs');
|
|
21
|
+
require('../chunk-WYFXOXVK.cjs');
|
|
22
|
+
require('../chunk-D7EHZFK4.cjs');
|
|
23
|
+
require('../chunk-HDKDQAEQ.cjs');
|
|
24
|
+
var ai = require('ai');
|
|
25
|
+
var zod = require('zod');
|
|
26
|
+
|
|
27
|
+
var schematexTools = {
|
|
28
|
+
listDiagrams: ai.tool({
|
|
29
|
+
description: "List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.",
|
|
30
|
+
inputSchema: zod.z.object({}),
|
|
31
|
+
execute: async () => chunkMOU5QRZY_cjs.listDiagrams()
|
|
32
|
+
}),
|
|
33
|
+
getSyntax: ai.tool({
|
|
34
|
+
description: "Return a compact syntax reference for one diagram type \u2014 rules, grammar (EBNF), and inline examples. Trimmed for LLM consumption (~2,000\u20134,000 tokens). Call after listDiagrams once you've chosen a type.",
|
|
35
|
+
inputSchema: zod.z.object({
|
|
36
|
+
type: zod.z.string().describe(
|
|
37
|
+
"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone')."
|
|
38
|
+
)
|
|
39
|
+
}),
|
|
40
|
+
execute: async ({ type }) => chunkMOU5QRZY_cjs.getSyntax(type)
|
|
41
|
+
}),
|
|
42
|
+
getExamples: ai.tool({
|
|
43
|
+
description: "Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.",
|
|
44
|
+
inputSchema: zod.z.object({
|
|
45
|
+
type: zod.z.string().describe("Diagram type id."),
|
|
46
|
+
limit: zod.z.number().int().min(1).max(10).optional().describe("Max examples to return (default 5)."),
|
|
47
|
+
preferFeatured: zod.z.boolean().optional().describe("Rank featured examples first."),
|
|
48
|
+
maxComplexity: zod.z.number().int().min(1).max(5).optional().describe("Only return examples with complexity <= this value (1=simplest).")
|
|
49
|
+
}),
|
|
50
|
+
execute: async (args) => chunkMOU5QRZY_cjs.getExamples(args.type, {
|
|
51
|
+
limit: args.limit,
|
|
52
|
+
preferFeatured: args.preferFeatured,
|
|
53
|
+
maxComplexity: args.maxComplexity
|
|
54
|
+
})
|
|
55
|
+
}),
|
|
56
|
+
validateDsl: ai.tool({
|
|
57
|
+
description: "Validate Schematex DSL. Returns { ok: true } or { ok: false, errors: [{line, column, message, source}] }. Call before returning DSL to the user and self-correct on errors.",
|
|
58
|
+
inputSchema: zod.z.object({
|
|
59
|
+
type: zod.z.string().optional().describe(
|
|
60
|
+
"Diagram type. Optional \u2014 Schematex auto-detects from the first line if omitted."
|
|
61
|
+
),
|
|
62
|
+
dsl: zod.z.string().describe("The DSL source text to validate.")
|
|
63
|
+
}),
|
|
64
|
+
execute: async ({ type, dsl }) => chunkMOU5QRZY_cjs.validateDsl(type, dsl)
|
|
65
|
+
}),
|
|
66
|
+
renderDsl: ai.tool({
|
|
67
|
+
description: "Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.",
|
|
68
|
+
inputSchema: zod.z.object({
|
|
69
|
+
type: zod.z.string().optional().describe("Diagram type (auto-detected if omitted)."),
|
|
70
|
+
dsl: zod.z.string().describe("The DSL source text to render."),
|
|
71
|
+
theme: zod.z.string().optional().describe("Theme name, e.g. 'default' or 'dark'."),
|
|
72
|
+
padding: zod.z.number().optional().describe("Outer padding in pixels.")
|
|
73
|
+
}),
|
|
74
|
+
execute: async ({
|
|
75
|
+
type,
|
|
76
|
+
dsl,
|
|
77
|
+
theme,
|
|
78
|
+
padding
|
|
79
|
+
}) => chunkMOU5QRZY_cjs.renderDsl(type, dsl, { theme, padding })
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.schematexTools = schematexTools;
|
|
84
|
+
//# sourceMappingURL=ai-sdk.cjs.map
|
|
85
|
+
//# sourceMappingURL=ai-sdk.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ai/ai-sdk.ts"],"names":["tool","z","listDiagrams","getSyntax","getExamples","validateDsl","renderDsl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,IAAM,cAAA,GAAiB;AAAA,EAC5B,cAAcA,OAAA,CAAK;AAAA,IACjB,WAAA,EACE,8JAAA;AAAA,IACF,WAAA,EAAaC,KAAA,CAAE,MAAA,CAAO,EAAE,CAAA;AAAA,IACxB,OAAA,EAAS,YAAYC,8BAAA;AAAiB,GACvC,CAAA;AAAA,EAED,WAAWF,OAAA,CAAK;AAAA,IACd,WAAA,EACE,sNAAA;AAAA,IACF,WAAA,EAAaC,MAAE,MAAA,CAAO;AAAA,MACpB,IAAA,EAAMA,KAAA,CACH,MAAA,EAAO,CACP,QAAA;AAAA,QACC;AAAA;AACF,KACH,CAAA;AAAA,IACD,SAAS,OAAO,EAAE,IAAA,EAAK,KAAwBE,4BAAc,IAAI;AAAA,GAClE,CAAA;AAAA,EAED,aAAaH,OAAA,CAAK;AAAA,IAChB,WAAA,EACE,8IAAA;AAAA,IACF,WAAA,EAAaC,MAAE,MAAA,CAAO;AAAA,MACpB,IAAA,EAAMA,KAAA,CAAE,MAAA,EAAO,CAAE,SAAS,kBAAkB,CAAA;AAAA,MAC5C,KAAA,EAAOA,KAAA,CACJ,MAAA,EAAO,CACP,KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,IAAI,EAAE,CAAA,CACN,QAAA,EAAS,CACT,SAAS,qCAAqC,CAAA;AAAA,MACjD,gBAAgBA,KAAA,CACb,OAAA,GACA,QAAA,EAAS,CACT,SAAS,+BAA+B,CAAA;AAAA,MAC3C,aAAA,EAAeA,KAAA,CACZ,MAAA,EAAO,CACP,KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,IAAI,CAAC,CAAA,CACL,QAAA,EAAS,CACT,SAAS,kEAAkE;AAAA,KAC/E,CAAA;AAAA,IACD,OAAA,EAAS,OAAO,IAAA,KAMdG,6BAAA,CAAgB,KAAK,IAAA,EAAM;AAAA,MACzB,OAAO,IAAA,CAAK,KAAA;AAAA,MACZ,gBAAgB,IAAA,CAAK,cAAA;AAAA,MACrB,eAAe,IAAA,CAAK;AAAA,KACrB;AAAA,GACJ,CAAA;AAAA,EAED,aAAaJ,OAAA,CAAK;AAAA,IAChB,WAAA,EACE,6KAAA;AAAA,IACF,WAAA,EAAaC,MAAE,MAAA,CAAO;AAAA,MACpB,IAAA,EAAMA,KAAA,CACH,MAAA,EAAO,CACP,UAAS,CACT,QAAA;AAAA,QACC;AAAA,OACF;AAAA,MACF,GAAA,EAAKA,KAAA,CAAE,MAAA,EAAO,CAAE,SAAS,kCAAkC;AAAA,KAC5D,CAAA;AAAA,IACD,OAAA,EAAS,OAAO,EAAE,IAAA,EAAM,KAAI,KAC1BI,6BAAA,CAAgB,MAAM,GAAG;AAAA,GAC5B,CAAA;AAAA,EAED,WAAWL,OAAA,CAAK;AAAA,IACd,WAAA,EACE,sKAAA;AAAA,IACF,WAAA,EAAaC,MAAE,MAAA,CAAO;AAAA,MACpB,MAAMA,KAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,0CAA0C,CAAA;AAAA,MAC/E,GAAA,EAAKA,KAAA,CAAE,MAAA,EAAO,CAAE,SAAS,gCAAgC,CAAA;AAAA,MACzD,OAAOA,KAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,uCAAuC,CAAA;AAAA,MAC7E,SAASA,KAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,0BAA0B;AAAA,KACnE,CAAA;AAAA,IACD,SAAS,OAAO;AAAA,MACd,IAAA;AAAA,MACA,GAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,UAMIK,2BAAA,CAAc,IAAA,EAAM,KAAK,EAAE,KAAA,EAAO,SAAS;AAAA,GAClD;AACH","file":"ai-sdk.cjs","sourcesContent":["/**\n * Vercel AI SDK adapter — ready-to-use `tools` object for `generateText` /\n * `streamText`.\n *\n * @example\n * ```ts\n * import { streamText } from 'ai';\n * import { schematexTools } from 'schematex/ai/sdk';\n *\n * const result = streamText({\n * model: 'anthropic/claude-opus-4-7',\n * tools: schematexTools,\n * maxSteps: 5,\n * system: `You write Schematex DSL. Discover types with listDiagrams,\n * then fetch getSyntax + getExamples before writing. Call validateDsl\n * before returning DSL to the user.`,\n * prompt: userMessage,\n * });\n * ```\n *\n * Peer-deps `ai` and `zod` are optional — this module only loads if both\n * are installed.\n */\nimport { tool } from \"ai\";\nimport { z } from \"zod\";\n\nimport {\n listDiagrams as listDiagramsImpl,\n getSyntax as getSyntaxImpl,\n getExamples as getExamplesImpl,\n validateDsl as validateDslImpl,\n renderDsl as renderDslImpl,\n} from \"./tools\";\n\nexport const schematexTools = {\n listDiagrams: tool({\n description:\n \"List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.\",\n inputSchema: z.object({}),\n execute: async () => listDiagramsImpl(),\n }),\n\n getSyntax: tool({\n description:\n \"Return a compact syntax reference for one diagram type — rules, grammar (EBNF), and inline examples. Trimmed for LLM consumption (~2,000–4,000 tokens). Call after listDiagrams once you've chosen a type.\",\n inputSchema: z.object({\n type: z\n .string()\n .describe(\n \"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone').\"\n ),\n }),\n execute: async ({ type }: { type: string }) => getSyntaxImpl(type),\n }),\n\n getExamples: tool({\n description:\n \"Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.\",\n inputSchema: z.object({\n type: z.string().describe(\"Diagram type id.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe(\"Max examples to return (default 5).\"),\n preferFeatured: z\n .boolean()\n .optional()\n .describe(\"Rank featured examples first.\"),\n maxComplexity: z\n .number()\n .int()\n .min(1)\n .max(5)\n .optional()\n .describe(\"Only return examples with complexity <= this value (1=simplest).\"),\n }),\n execute: async (args: {\n type: string;\n limit?: number;\n preferFeatured?: boolean;\n maxComplexity?: number;\n }) =>\n getExamplesImpl(args.type, {\n limit: args.limit,\n preferFeatured: args.preferFeatured,\n maxComplexity: args.maxComplexity,\n }),\n }),\n\n validateDsl: tool({\n description:\n \"Validate Schematex DSL. Returns { ok: true } or { ok: false, errors: [{line, column, message, source}] }. Call before returning DSL to the user and self-correct on errors.\",\n inputSchema: z.object({\n type: z\n .string()\n .optional()\n .describe(\n \"Diagram type. Optional — Schematex auto-detects from the first line if omitted.\"\n ),\n dsl: z.string().describe(\"The DSL source text to validate.\"),\n }),\n execute: async ({ type, dsl }: { type?: string; dsl: string }) =>\n validateDslImpl(type, dsl),\n }),\n\n renderDsl: tool({\n description:\n \"Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.\",\n inputSchema: z.object({\n type: z.string().optional().describe(\"Diagram type (auto-detected if omitted).\"),\n dsl: z.string().describe(\"The DSL source text to render.\"),\n theme: z.string().optional().describe(\"Theme name, e.g. 'default' or 'dark'.\"),\n padding: z.number().optional().describe(\"Outer padding in pixels.\"),\n }),\n execute: async ({\n type,\n dsl,\n theme,\n padding,\n }: {\n type?: string;\n dsl: string;\n theme?: string;\n padding?: number;\n }) => renderDslImpl(type, dsl, { theme, padding }),\n }),\n} as const;\n\nexport type SchematexTools = typeof schematexTools;\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { DiagramListItem, GetSyntaxResult, GetExamplesResult, ValidateDslResult, RenderDslResult } from './index.cjs';
|
|
3
|
+
import '../api-bQZ98gkJ.cjs';
|
|
4
|
+
import '../types-C4LnMEcB.cjs';
|
|
5
|
+
|
|
6
|
+
declare const schematexTools: {
|
|
7
|
+
readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
|
|
8
|
+
readonly getSyntax: ai.Tool<{
|
|
9
|
+
type: string;
|
|
10
|
+
}, GetSyntaxResult>;
|
|
11
|
+
readonly getExamples: ai.Tool<{
|
|
12
|
+
type: string;
|
|
13
|
+
limit?: number | undefined;
|
|
14
|
+
preferFeatured?: boolean | undefined;
|
|
15
|
+
maxComplexity?: number | undefined;
|
|
16
|
+
}, GetExamplesResult>;
|
|
17
|
+
readonly validateDsl: ai.Tool<{
|
|
18
|
+
dsl: string;
|
|
19
|
+
type?: string | undefined;
|
|
20
|
+
}, ValidateDslResult>;
|
|
21
|
+
readonly renderDsl: ai.Tool<{
|
|
22
|
+
dsl: string;
|
|
23
|
+
type?: string | undefined;
|
|
24
|
+
theme?: string | undefined;
|
|
25
|
+
padding?: number | undefined;
|
|
26
|
+
}, RenderDslResult>;
|
|
27
|
+
};
|
|
28
|
+
type SchematexTools = typeof schematexTools;
|
|
29
|
+
|
|
30
|
+
export { type SchematexTools, schematexTools };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { DiagramListItem, GetSyntaxResult, GetExamplesResult, ValidateDslResult, RenderDslResult } from './index.js';
|
|
3
|
+
import '../api-bQZ98gkJ.js';
|
|
4
|
+
import '../types-C4LnMEcB.js';
|
|
5
|
+
|
|
6
|
+
declare const schematexTools: {
|
|
7
|
+
readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
|
|
8
|
+
readonly getSyntax: ai.Tool<{
|
|
9
|
+
type: string;
|
|
10
|
+
}, GetSyntaxResult>;
|
|
11
|
+
readonly getExamples: ai.Tool<{
|
|
12
|
+
type: string;
|
|
13
|
+
limit?: number | undefined;
|
|
14
|
+
preferFeatured?: boolean | undefined;
|
|
15
|
+
maxComplexity?: number | undefined;
|
|
16
|
+
}, GetExamplesResult>;
|
|
17
|
+
readonly validateDsl: ai.Tool<{
|
|
18
|
+
dsl: string;
|
|
19
|
+
type?: string | undefined;
|
|
20
|
+
}, ValidateDslResult>;
|
|
21
|
+
readonly renderDsl: ai.Tool<{
|
|
22
|
+
dsl: string;
|
|
23
|
+
type?: string | undefined;
|
|
24
|
+
theme?: string | undefined;
|
|
25
|
+
padding?: number | undefined;
|
|
26
|
+
}, RenderDslResult>;
|
|
27
|
+
};
|
|
28
|
+
type SchematexTools = typeof schematexTools;
|
|
29
|
+
|
|
30
|
+
export { type SchematexTools, schematexTools };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { renderDsl, validateDsl, getExamples, getSyntax, listDiagrams } from '../chunk-4QP37LD3.js';
|
|
2
|
+
import '../chunk-S3RBKJM5.js';
|
|
3
|
+
import '../chunk-FCGHV6ZK.js';
|
|
4
|
+
import '../chunk-PGALHQFF.js';
|
|
5
|
+
import '../chunk-UGCUNADI.js';
|
|
6
|
+
import '../chunk-U6L3FAML.js';
|
|
7
|
+
import '../chunk-FE6GAUNW.js';
|
|
8
|
+
import '../chunk-M5B2UUNW.js';
|
|
9
|
+
import '../chunk-ZNDIGQJD.js';
|
|
10
|
+
import '../chunk-JDTB7IKL.js';
|
|
11
|
+
import '../chunk-SN7NTZI6.js';
|
|
12
|
+
import '../chunk-2BM3HJSK.js';
|
|
13
|
+
import '../chunk-LR4X4ZRG.js';
|
|
14
|
+
import '../chunk-OC22GGQN.js';
|
|
15
|
+
import '../chunk-YQANC7HQ.js';
|
|
16
|
+
import '../chunk-RP5UATRA.js';
|
|
17
|
+
import '../chunk-DNZFOCV7.js';
|
|
18
|
+
import '../chunk-45KP67RR.js';
|
|
19
|
+
import '../chunk-5YYAYW67.js';
|
|
20
|
+
import '../chunk-2VNMKOUO.js';
|
|
21
|
+
import '../chunk-KLJEK547.js';
|
|
22
|
+
import { tool } from 'ai';
|
|
23
|
+
import { z } from 'zod';
|
|
24
|
+
|
|
25
|
+
var schematexTools = {
|
|
26
|
+
listDiagrams: tool({
|
|
27
|
+
description: "List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.",
|
|
28
|
+
inputSchema: z.object({}),
|
|
29
|
+
execute: async () => listDiagrams()
|
|
30
|
+
}),
|
|
31
|
+
getSyntax: tool({
|
|
32
|
+
description: "Return a compact syntax reference for one diagram type \u2014 rules, grammar (EBNF), and inline examples. Trimmed for LLM consumption (~2,000\u20134,000 tokens). Call after listDiagrams once you've chosen a type.",
|
|
33
|
+
inputSchema: z.object({
|
|
34
|
+
type: z.string().describe(
|
|
35
|
+
"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone')."
|
|
36
|
+
)
|
|
37
|
+
}),
|
|
38
|
+
execute: async ({ type }) => getSyntax(type)
|
|
39
|
+
}),
|
|
40
|
+
getExamples: tool({
|
|
41
|
+
description: "Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.",
|
|
42
|
+
inputSchema: z.object({
|
|
43
|
+
type: z.string().describe("Diagram type id."),
|
|
44
|
+
limit: z.number().int().min(1).max(10).optional().describe("Max examples to return (default 5)."),
|
|
45
|
+
preferFeatured: z.boolean().optional().describe("Rank featured examples first."),
|
|
46
|
+
maxComplexity: z.number().int().min(1).max(5).optional().describe("Only return examples with complexity <= this value (1=simplest).")
|
|
47
|
+
}),
|
|
48
|
+
execute: async (args) => getExamples(args.type, {
|
|
49
|
+
limit: args.limit,
|
|
50
|
+
preferFeatured: args.preferFeatured,
|
|
51
|
+
maxComplexity: args.maxComplexity
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
validateDsl: tool({
|
|
55
|
+
description: "Validate Schematex DSL. Returns { ok: true } or { ok: false, errors: [{line, column, message, source}] }. Call before returning DSL to the user and self-correct on errors.",
|
|
56
|
+
inputSchema: z.object({
|
|
57
|
+
type: z.string().optional().describe(
|
|
58
|
+
"Diagram type. Optional \u2014 Schematex auto-detects from the first line if omitted."
|
|
59
|
+
),
|
|
60
|
+
dsl: z.string().describe("The DSL source text to validate.")
|
|
61
|
+
}),
|
|
62
|
+
execute: async ({ type, dsl }) => validateDsl(type, dsl)
|
|
63
|
+
}),
|
|
64
|
+
renderDsl: tool({
|
|
65
|
+
description: "Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.",
|
|
66
|
+
inputSchema: z.object({
|
|
67
|
+
type: z.string().optional().describe("Diagram type (auto-detected if omitted)."),
|
|
68
|
+
dsl: z.string().describe("The DSL source text to render."),
|
|
69
|
+
theme: z.string().optional().describe("Theme name, e.g. 'default' or 'dark'."),
|
|
70
|
+
padding: z.number().optional().describe("Outer padding in pixels.")
|
|
71
|
+
}),
|
|
72
|
+
execute: async ({
|
|
73
|
+
type,
|
|
74
|
+
dsl,
|
|
75
|
+
theme,
|
|
76
|
+
padding
|
|
77
|
+
}) => renderDsl(type, dsl, { theme, padding })
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { schematexTools };
|
|
82
|
+
//# sourceMappingURL=ai-sdk.js.map
|
|
83
|
+
//# sourceMappingURL=ai-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ai/ai-sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkCO,IAAM,cAAA,GAAiB;AAAA,EAC5B,cAAc,IAAA,CAAK;AAAA,IACjB,WAAA,EACE,8JAAA;AAAA,IACF,WAAA,EAAa,CAAA,CAAE,MAAA,CAAO,EAAE,CAAA;AAAA,IACxB,OAAA,EAAS,YAAY,YAAA;AAAiB,GACvC,CAAA;AAAA,EAED,WAAW,IAAA,CAAK;AAAA,IACd,WAAA,EACE,sNAAA;AAAA,IACF,WAAA,EAAa,EAAE,MAAA,CAAO;AAAA,MACpB,IAAA,EAAM,CAAA,CACH,MAAA,EAAO,CACP,QAAA;AAAA,QACC;AAAA;AACF,KACH,CAAA;AAAA,IACD,SAAS,OAAO,EAAE,IAAA,EAAK,KAAwB,UAAc,IAAI;AAAA,GAClE,CAAA;AAAA,EAED,aAAa,IAAA,CAAK;AAAA,IAChB,WAAA,EACE,8IAAA;AAAA,IACF,WAAA,EAAa,EAAE,MAAA,CAAO;AAAA,MACpB,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,kBAAkB,CAAA;AAAA,MAC5C,KAAA,EAAO,CAAA,CACJ,MAAA,EAAO,CACP,KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,IAAI,EAAE,CAAA,CACN,QAAA,EAAS,CACT,SAAS,qCAAqC,CAAA;AAAA,MACjD,gBAAgB,CAAA,CACb,OAAA,GACA,QAAA,EAAS,CACT,SAAS,+BAA+B,CAAA;AAAA,MAC3C,aAAA,EAAe,CAAA,CACZ,MAAA,EAAO,CACP,KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,IAAI,CAAC,CAAA,CACL,QAAA,EAAS,CACT,SAAS,kEAAkE;AAAA,KAC/E,CAAA;AAAA,IACD,OAAA,EAAS,OAAO,IAAA,KAMd,WAAA,CAAgB,KAAK,IAAA,EAAM;AAAA,MACzB,OAAO,IAAA,CAAK,KAAA;AAAA,MACZ,gBAAgB,IAAA,CAAK,cAAA;AAAA,MACrB,eAAe,IAAA,CAAK;AAAA,KACrB;AAAA,GACJ,CAAA;AAAA,EAED,aAAa,IAAA,CAAK;AAAA,IAChB,WAAA,EACE,6KAAA;AAAA,IACF,WAAA,EAAa,EAAE,MAAA,CAAO;AAAA,MACpB,IAAA,EAAM,CAAA,CACH,MAAA,EAAO,CACP,UAAS,CACT,QAAA;AAAA,QACC;AAAA,OACF;AAAA,MACF,GAAA,EAAK,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,kCAAkC;AAAA,KAC5D,CAAA;AAAA,IACD,OAAA,EAAS,OAAO,EAAE,IAAA,EAAM,KAAI,KAC1B,WAAA,CAAgB,MAAM,GAAG;AAAA,GAC5B,CAAA;AAAA,EAED,WAAW,IAAA,CAAK;AAAA,IACd,WAAA,EACE,sKAAA;AAAA,IACF,WAAA,EAAa,EAAE,MAAA,CAAO;AAAA,MACpB,MAAM,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,0CAA0C,CAAA;AAAA,MAC/E,GAAA,EAAK,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,gCAAgC,CAAA;AAAA,MACzD,OAAO,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,uCAAuC,CAAA;AAAA,MAC7E,SAAS,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,0BAA0B;AAAA,KACnE,CAAA;AAAA,IACD,SAAS,OAAO;AAAA,MACd,IAAA;AAAA,MACA,GAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,UAMI,SAAA,CAAc,IAAA,EAAM,KAAK,EAAE,KAAA,EAAO,SAAS;AAAA,GAClD;AACH","file":"ai-sdk.js","sourcesContent":["/**\n * Vercel AI SDK adapter — ready-to-use `tools` object for `generateText` /\n * `streamText`.\n *\n * @example\n * ```ts\n * import { streamText } from 'ai';\n * import { schematexTools } from 'schematex/ai/sdk';\n *\n * const result = streamText({\n * model: 'anthropic/claude-opus-4-7',\n * tools: schematexTools,\n * maxSteps: 5,\n * system: `You write Schematex DSL. Discover types with listDiagrams,\n * then fetch getSyntax + getExamples before writing. Call validateDsl\n * before returning DSL to the user.`,\n * prompt: userMessage,\n * });\n * ```\n *\n * Peer-deps `ai` and `zod` are optional — this module only loads if both\n * are installed.\n */\nimport { tool } from \"ai\";\nimport { z } from \"zod\";\n\nimport {\n listDiagrams as listDiagramsImpl,\n getSyntax as getSyntaxImpl,\n getExamples as getExamplesImpl,\n validateDsl as validateDslImpl,\n renderDsl as renderDslImpl,\n} from \"./tools\";\n\nexport const schematexTools = {\n listDiagrams: tool({\n description:\n \"List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.\",\n inputSchema: z.object({}),\n execute: async () => listDiagramsImpl(),\n }),\n\n getSyntax: tool({\n description:\n \"Return a compact syntax reference for one diagram type — rules, grammar (EBNF), and inline examples. Trimmed for LLM consumption (~2,000–4,000 tokens). Call after listDiagrams once you've chosen a type.\",\n inputSchema: z.object({\n type: z\n .string()\n .describe(\n \"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone').\"\n ),\n }),\n execute: async ({ type }: { type: string }) => getSyntaxImpl(type),\n }),\n\n getExamples: tool({\n description:\n \"Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.\",\n inputSchema: z.object({\n type: z.string().describe(\"Diagram type id.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe(\"Max examples to return (default 5).\"),\n preferFeatured: z\n .boolean()\n .optional()\n .describe(\"Rank featured examples first.\"),\n maxComplexity: z\n .number()\n .int()\n .min(1)\n .max(5)\n .optional()\n .describe(\"Only return examples with complexity <= this value (1=simplest).\"),\n }),\n execute: async (args: {\n type: string;\n limit?: number;\n preferFeatured?: boolean;\n maxComplexity?: number;\n }) =>\n getExamplesImpl(args.type, {\n limit: args.limit,\n preferFeatured: args.preferFeatured,\n maxComplexity: args.maxComplexity,\n }),\n }),\n\n validateDsl: tool({\n description:\n \"Validate Schematex DSL. Returns { ok: true } or { ok: false, errors: [{line, column, message, source}] }. Call before returning DSL to the user and self-correct on errors.\",\n inputSchema: z.object({\n type: z\n .string()\n .optional()\n .describe(\n \"Diagram type. Optional — Schematex auto-detects from the first line if omitted.\"\n ),\n dsl: z.string().describe(\"The DSL source text to validate.\"),\n }),\n execute: async ({ type, dsl }: { type?: string; dsl: string }) =>\n validateDslImpl(type, dsl),\n }),\n\n renderDsl: tool({\n description:\n \"Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.\",\n inputSchema: z.object({\n type: z.string().optional().describe(\"Diagram type (auto-detected if omitted).\"),\n dsl: z.string().describe(\"The DSL source text to render.\"),\n theme: z.string().optional().describe(\"Theme name, e.g. 'default' or 'dark'.\"),\n padding: z.number().optional().describe(\"Outer padding in pixels.\"),\n }),\n execute: async ({\n type,\n dsl,\n theme,\n padding,\n }: {\n type?: string;\n dsl: string;\n theme?: string;\n padding?: number;\n }) => renderDslImpl(type, dsl, { theme, padding }),\n }),\n} as const;\n\nexport type SchematexTools = typeof schematexTools;\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMOU5QRZY_cjs = require('../chunk-MOU5QRZY.cjs');
|
|
4
|
+
require('../chunk-QXIGHMH2.cjs');
|
|
5
|
+
require('../chunk-A5D2IMOX.cjs');
|
|
6
|
+
require('../chunk-4S2WILLW.cjs');
|
|
7
|
+
require('../chunk-MCFQAUQV.cjs');
|
|
8
|
+
require('../chunk-B6INLQBU.cjs');
|
|
9
|
+
require('../chunk-3YZ6FPQW.cjs');
|
|
10
|
+
require('../chunk-ZNOD4VZT.cjs');
|
|
11
|
+
require('../chunk-5AEN2PLB.cjs');
|
|
12
|
+
require('../chunk-QSQX77S2.cjs');
|
|
13
|
+
require('../chunk-Z3DE6S64.cjs');
|
|
14
|
+
require('../chunk-6LZJTAA3.cjs');
|
|
15
|
+
require('../chunk-E65ITQXV.cjs');
|
|
16
|
+
require('../chunk-B37IKTI7.cjs');
|
|
17
|
+
require('../chunk-X7RPFTTR.cjs');
|
|
18
|
+
require('../chunk-COLTVQWR.cjs');
|
|
19
|
+
require('../chunk-ULYRO2KY.cjs');
|
|
20
|
+
require('../chunk-2JDVJRR3.cjs');
|
|
21
|
+
require('../chunk-WYFXOXVK.cjs');
|
|
22
|
+
require('../chunk-D7EHZFK4.cjs');
|
|
23
|
+
require('../chunk-HDKDQAEQ.cjs');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Object.defineProperty(exports, "DIAGRAM_REGISTRY", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkMOU5QRZY_cjs.DIAGRAM_REGISTRY; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "getAllDiagramTypes", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkMOU5QRZY_cjs.getAllDiagramTypes; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "getDiagramMeta", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkMOU5QRZY_cjs.getDiagramMeta; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "getExamples", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkMOU5QRZY_cjs.getExamples; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "getSyntax", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkMOU5QRZY_cjs.getSyntax; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "listDiagrams", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkMOU5QRZY_cjs.listDiagrams; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "renderDsl", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunkMOU5QRZY_cjs.renderDsl; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "validateDsl", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunkMOU5QRZY_cjs.validateDsl; }
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.cjs.map
|
|
60
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { S as SchematexConfig } from '../api-bQZ98gkJ.cjs';
|
|
2
|
+
import { q as DiagramType } from '../types-C4LnMEcB.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Diagram registry — metadata for every diagram type Schematex supports.
|
|
6
|
+
*
|
|
7
|
+
* This is the index an LLM sees when calling `listDiagrams()`. Descriptions
|
|
8
|
+
* are tuned to help the model pick the right type for a user request.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type DiagramCluster = "relationships" | "electrical-industrial" | "corporate-legal" | "causality-analysis" | "generic" | "strategy" | "knowledge";
|
|
12
|
+
interface DiagramMeta {
|
|
13
|
+
/** Canonical type id — matches `DiagramType` and plugin keys. */
|
|
14
|
+
type: DiagramType;
|
|
15
|
+
/** Human-readable name. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** One-sentence tagline. */
|
|
18
|
+
tagline: string;
|
|
19
|
+
/** When should an LLM pick this diagram? Written in "use X when …" form. */
|
|
20
|
+
useWhen: string;
|
|
21
|
+
/** Domain cluster for grouping. */
|
|
22
|
+
cluster: DiagramCluster;
|
|
23
|
+
/** Published standard the parser and layout follow. */
|
|
24
|
+
standard: string;
|
|
25
|
+
/** Path to the syntax doc key in the generated content bundle. */
|
|
26
|
+
syntaxKey: string;
|
|
27
|
+
}
|
|
28
|
+
declare const DIAGRAM_REGISTRY: readonly DiagramMeta[];
|
|
29
|
+
declare function getDiagramMeta(type: string): DiagramMeta | undefined;
|
|
30
|
+
declare function getAllDiagramTypes(): DiagramType[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Structured error type returned by the AI tool layer.
|
|
34
|
+
*
|
|
35
|
+
* The underlying per-diagram parsers each throw their own error class
|
|
36
|
+
* (genogram.ParseError, SLDParseError, PedigreeParseError, ...). Some
|
|
37
|
+
* carry line/column, some don't. {@link extractError} normalises any
|
|
38
|
+
* thrown value into this shape via structural extraction — no parser
|
|
39
|
+
* refactor required.
|
|
40
|
+
*/
|
|
41
|
+
interface SchematexValidationError {
|
|
42
|
+
/** 1-based line number where the error occurred, if the parser reported it. */
|
|
43
|
+
line?: number;
|
|
44
|
+
/** 1-based column, if reported. */
|
|
45
|
+
column?: number;
|
|
46
|
+
/** Source snippet from the offending line, if the parser captured it. */
|
|
47
|
+
source?: string;
|
|
48
|
+
/** Human-readable error message. */
|
|
49
|
+
message: string;
|
|
50
|
+
/** Optional remediation hint. */
|
|
51
|
+
hint?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* AUTO-GENERATED by scripts/build-ai-content.mjs — do not edit by hand.
|
|
56
|
+
* Regenerate with: npm run build:ai
|
|
57
|
+
*
|
|
58
|
+
* Compiled content bundle for the AI tool layer. Keeps MDX content
|
|
59
|
+
* available to the published npm package without runtime fs access.
|
|
60
|
+
*/
|
|
61
|
+
interface GeneratedExample {
|
|
62
|
+
slug: string;
|
|
63
|
+
diagram: string;
|
|
64
|
+
title: string;
|
|
65
|
+
description: string;
|
|
66
|
+
standard: string;
|
|
67
|
+
tags: readonly string[];
|
|
68
|
+
complexity: number;
|
|
69
|
+
featured: boolean;
|
|
70
|
+
dsl: string;
|
|
71
|
+
notes: string;
|
|
72
|
+
}
|
|
73
|
+
interface GeneratedSyntax {
|
|
74
|
+
title: string;
|
|
75
|
+
content: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Example library — runtime lookup over the bundled MDX examples.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
type Example = GeneratedExample;
|
|
83
|
+
interface GetExamplesOptions {
|
|
84
|
+
/** Maximum number of examples to return. Default 5. */
|
|
85
|
+
limit?: number;
|
|
86
|
+
/** Prefer examples marked `featured: true` when set. */
|
|
87
|
+
preferFeatured?: boolean;
|
|
88
|
+
/** Maximum complexity (1–5). */
|
|
89
|
+
maxComplexity?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Syntax lookup — LLM-facing per-diagram grammar reference.
|
|
94
|
+
*
|
|
95
|
+
* v1: returns the stripped-MDX content from `website/content/docs/*.mdx`
|
|
96
|
+
* (JSX components replaced with fenced DSL code blocks).
|
|
97
|
+
*
|
|
98
|
+
* Later: may be replaced with curated compact summaries per diagram if
|
|
99
|
+
* the stripped docs prove too long for good LLM performance.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
type SyntaxDoc = GeneratedSyntax & {
|
|
103
|
+
key: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* AI-facing tool functions — the five tools an LLM uses to work with Schematex.
|
|
108
|
+
*
|
|
109
|
+
* Pure TypeScript, zero framework deps. Both the Vercel AI SDK adapter
|
|
110
|
+
* (ai-sdk.ts) and the MCP server wrap these functions.
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
interface DiagramListItem {
|
|
114
|
+
type: string;
|
|
115
|
+
name: string;
|
|
116
|
+
tagline: string;
|
|
117
|
+
useWhen: string;
|
|
118
|
+
cluster: DiagramMeta["cluster"];
|
|
119
|
+
standard: string;
|
|
120
|
+
}
|
|
121
|
+
declare function listDiagrams(): DiagramListItem[];
|
|
122
|
+
interface GetSyntaxResult {
|
|
123
|
+
type: string;
|
|
124
|
+
name: string;
|
|
125
|
+
standard: string;
|
|
126
|
+
syntax: SyntaxDoc;
|
|
127
|
+
}
|
|
128
|
+
declare function getSyntax(type: string): GetSyntaxResult;
|
|
129
|
+
interface GetExamplesResult {
|
|
130
|
+
type: string;
|
|
131
|
+
count: number;
|
|
132
|
+
examples: Example[];
|
|
133
|
+
}
|
|
134
|
+
declare function getExamples(type: string, opts?: GetExamplesOptions): GetExamplesResult;
|
|
135
|
+
type ValidateDslResult = {
|
|
136
|
+
ok: true;
|
|
137
|
+
type: string | null;
|
|
138
|
+
} | {
|
|
139
|
+
ok: false;
|
|
140
|
+
type: string | null;
|
|
141
|
+
errors: SchematexValidationError[];
|
|
142
|
+
};
|
|
143
|
+
declare function validateDsl(type: string | undefined, dsl: string): ValidateDslResult;
|
|
144
|
+
type RenderDslResult = {
|
|
145
|
+
ok: true;
|
|
146
|
+
type: string | null;
|
|
147
|
+
svg: string;
|
|
148
|
+
} | {
|
|
149
|
+
ok: false;
|
|
150
|
+
type: string | null;
|
|
151
|
+
errors: SchematexValidationError[];
|
|
152
|
+
};
|
|
153
|
+
declare function renderDsl(type: string | undefined, dsl: string, options?: Omit<SchematexConfig, "type">): RenderDslResult;
|
|
154
|
+
|
|
155
|
+
export { DIAGRAM_REGISTRY, type DiagramCluster, type DiagramListItem, type DiagramMeta, type Example, type GetExamplesOptions, type GetExamplesResult, type GetSyntaxResult, type RenderDslResult, type SchematexValidationError, type SyntaxDoc, type ValidateDslResult, getAllDiagramTypes, getDiagramMeta, getExamples, getSyntax, listDiagrams, renderDsl, validateDsl };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { S as SchematexConfig } from '../api-bQZ98gkJ.js';
|
|
2
|
+
import { q as DiagramType } from '../types-C4LnMEcB.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Diagram registry — metadata for every diagram type Schematex supports.
|
|
6
|
+
*
|
|
7
|
+
* This is the index an LLM sees when calling `listDiagrams()`. Descriptions
|
|
8
|
+
* are tuned to help the model pick the right type for a user request.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type DiagramCluster = "relationships" | "electrical-industrial" | "corporate-legal" | "causality-analysis" | "generic" | "strategy" | "knowledge";
|
|
12
|
+
interface DiagramMeta {
|
|
13
|
+
/** Canonical type id — matches `DiagramType` and plugin keys. */
|
|
14
|
+
type: DiagramType;
|
|
15
|
+
/** Human-readable name. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** One-sentence tagline. */
|
|
18
|
+
tagline: string;
|
|
19
|
+
/** When should an LLM pick this diagram? Written in "use X when …" form. */
|
|
20
|
+
useWhen: string;
|
|
21
|
+
/** Domain cluster for grouping. */
|
|
22
|
+
cluster: DiagramCluster;
|
|
23
|
+
/** Published standard the parser and layout follow. */
|
|
24
|
+
standard: string;
|
|
25
|
+
/** Path to the syntax doc key in the generated content bundle. */
|
|
26
|
+
syntaxKey: string;
|
|
27
|
+
}
|
|
28
|
+
declare const DIAGRAM_REGISTRY: readonly DiagramMeta[];
|
|
29
|
+
declare function getDiagramMeta(type: string): DiagramMeta | undefined;
|
|
30
|
+
declare function getAllDiagramTypes(): DiagramType[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Structured error type returned by the AI tool layer.
|
|
34
|
+
*
|
|
35
|
+
* The underlying per-diagram parsers each throw their own error class
|
|
36
|
+
* (genogram.ParseError, SLDParseError, PedigreeParseError, ...). Some
|
|
37
|
+
* carry line/column, some don't. {@link extractError} normalises any
|
|
38
|
+
* thrown value into this shape via structural extraction — no parser
|
|
39
|
+
* refactor required.
|
|
40
|
+
*/
|
|
41
|
+
interface SchematexValidationError {
|
|
42
|
+
/** 1-based line number where the error occurred, if the parser reported it. */
|
|
43
|
+
line?: number;
|
|
44
|
+
/** 1-based column, if reported. */
|
|
45
|
+
column?: number;
|
|
46
|
+
/** Source snippet from the offending line, if the parser captured it. */
|
|
47
|
+
source?: string;
|
|
48
|
+
/** Human-readable error message. */
|
|
49
|
+
message: string;
|
|
50
|
+
/** Optional remediation hint. */
|
|
51
|
+
hint?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* AUTO-GENERATED by scripts/build-ai-content.mjs — do not edit by hand.
|
|
56
|
+
* Regenerate with: npm run build:ai
|
|
57
|
+
*
|
|
58
|
+
* Compiled content bundle for the AI tool layer. Keeps MDX content
|
|
59
|
+
* available to the published npm package without runtime fs access.
|
|
60
|
+
*/
|
|
61
|
+
interface GeneratedExample {
|
|
62
|
+
slug: string;
|
|
63
|
+
diagram: string;
|
|
64
|
+
title: string;
|
|
65
|
+
description: string;
|
|
66
|
+
standard: string;
|
|
67
|
+
tags: readonly string[];
|
|
68
|
+
complexity: number;
|
|
69
|
+
featured: boolean;
|
|
70
|
+
dsl: string;
|
|
71
|
+
notes: string;
|
|
72
|
+
}
|
|
73
|
+
interface GeneratedSyntax {
|
|
74
|
+
title: string;
|
|
75
|
+
content: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Example library — runtime lookup over the bundled MDX examples.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
type Example = GeneratedExample;
|
|
83
|
+
interface GetExamplesOptions {
|
|
84
|
+
/** Maximum number of examples to return. Default 5. */
|
|
85
|
+
limit?: number;
|
|
86
|
+
/** Prefer examples marked `featured: true` when set. */
|
|
87
|
+
preferFeatured?: boolean;
|
|
88
|
+
/** Maximum complexity (1–5). */
|
|
89
|
+
maxComplexity?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Syntax lookup — LLM-facing per-diagram grammar reference.
|
|
94
|
+
*
|
|
95
|
+
* v1: returns the stripped-MDX content from `website/content/docs/*.mdx`
|
|
96
|
+
* (JSX components replaced with fenced DSL code blocks).
|
|
97
|
+
*
|
|
98
|
+
* Later: may be replaced with curated compact summaries per diagram if
|
|
99
|
+
* the stripped docs prove too long for good LLM performance.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
type SyntaxDoc = GeneratedSyntax & {
|
|
103
|
+
key: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* AI-facing tool functions — the five tools an LLM uses to work with Schematex.
|
|
108
|
+
*
|
|
109
|
+
* Pure TypeScript, zero framework deps. Both the Vercel AI SDK adapter
|
|
110
|
+
* (ai-sdk.ts) and the MCP server wrap these functions.
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
interface DiagramListItem {
|
|
114
|
+
type: string;
|
|
115
|
+
name: string;
|
|
116
|
+
tagline: string;
|
|
117
|
+
useWhen: string;
|
|
118
|
+
cluster: DiagramMeta["cluster"];
|
|
119
|
+
standard: string;
|
|
120
|
+
}
|
|
121
|
+
declare function listDiagrams(): DiagramListItem[];
|
|
122
|
+
interface GetSyntaxResult {
|
|
123
|
+
type: string;
|
|
124
|
+
name: string;
|
|
125
|
+
standard: string;
|
|
126
|
+
syntax: SyntaxDoc;
|
|
127
|
+
}
|
|
128
|
+
declare function getSyntax(type: string): GetSyntaxResult;
|
|
129
|
+
interface GetExamplesResult {
|
|
130
|
+
type: string;
|
|
131
|
+
count: number;
|
|
132
|
+
examples: Example[];
|
|
133
|
+
}
|
|
134
|
+
declare function getExamples(type: string, opts?: GetExamplesOptions): GetExamplesResult;
|
|
135
|
+
type ValidateDslResult = {
|
|
136
|
+
ok: true;
|
|
137
|
+
type: string | null;
|
|
138
|
+
} | {
|
|
139
|
+
ok: false;
|
|
140
|
+
type: string | null;
|
|
141
|
+
errors: SchematexValidationError[];
|
|
142
|
+
};
|
|
143
|
+
declare function validateDsl(type: string | undefined, dsl: string): ValidateDslResult;
|
|
144
|
+
type RenderDslResult = {
|
|
145
|
+
ok: true;
|
|
146
|
+
type: string | null;
|
|
147
|
+
svg: string;
|
|
148
|
+
} | {
|
|
149
|
+
ok: false;
|
|
150
|
+
type: string | null;
|
|
151
|
+
errors: SchematexValidationError[];
|
|
152
|
+
};
|
|
153
|
+
declare function renderDsl(type: string | undefined, dsl: string, options?: Omit<SchematexConfig, "type">): RenderDslResult;
|
|
154
|
+
|
|
155
|
+
export { DIAGRAM_REGISTRY, type DiagramCluster, type DiagramListItem, type DiagramMeta, type Example, type GetExamplesOptions, type GetExamplesResult, type GetSyntaxResult, type RenderDslResult, type SchematexValidationError, type SyntaxDoc, type ValidateDslResult, getAllDiagramTypes, getDiagramMeta, getExamples, getSyntax, listDiagrams, renderDsl, validateDsl };
|
package/dist/ai/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { DIAGRAM_REGISTRY, getAllDiagramTypes, getDiagramMeta, getExamples, getSyntax, listDiagrams, renderDsl, validateDsl } from '../chunk-4QP37LD3.js';
|
|
2
|
+
import '../chunk-S3RBKJM5.js';
|
|
3
|
+
import '../chunk-FCGHV6ZK.js';
|
|
4
|
+
import '../chunk-PGALHQFF.js';
|
|
5
|
+
import '../chunk-UGCUNADI.js';
|
|
6
|
+
import '../chunk-U6L3FAML.js';
|
|
7
|
+
import '../chunk-FE6GAUNW.js';
|
|
8
|
+
import '../chunk-M5B2UUNW.js';
|
|
9
|
+
import '../chunk-ZNDIGQJD.js';
|
|
10
|
+
import '../chunk-JDTB7IKL.js';
|
|
11
|
+
import '../chunk-SN7NTZI6.js';
|
|
12
|
+
import '../chunk-2BM3HJSK.js';
|
|
13
|
+
import '../chunk-LR4X4ZRG.js';
|
|
14
|
+
import '../chunk-OC22GGQN.js';
|
|
15
|
+
import '../chunk-YQANC7HQ.js';
|
|
16
|
+
import '../chunk-RP5UATRA.js';
|
|
17
|
+
import '../chunk-DNZFOCV7.js';
|
|
18
|
+
import '../chunk-45KP67RR.js';
|
|
19
|
+
import '../chunk-5YYAYW67.js';
|
|
20
|
+
import '../chunk-2VNMKOUO.js';
|
|
21
|
+
import '../chunk-KLJEK547.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|