chiltepin-render 0.33.3 → 0.34.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/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5708,6 +5708,13 @@ function autoGrid(ids, edges, rankdir) {
|
|
|
5708
5708
|
}
|
|
5709
5709
|
|
|
5710
5710
|
// src/blocks/flow.ts
|
|
5711
|
+
var AI_CHIP = {
|
|
5712
|
+
agent: "AGENT",
|
|
5713
|
+
llm: "LLM",
|
|
5714
|
+
tool: "TOOL",
|
|
5715
|
+
human: "HUMAN",
|
|
5716
|
+
memory: "MEMORY"
|
|
5717
|
+
};
|
|
5711
5718
|
function flowRevealOrder(nodes, edges) {
|
|
5712
5719
|
const ids = new Set(nodes.map((n) => n.id));
|
|
5713
5720
|
const indeg = /* @__PURE__ */ new Map();
|
|
@@ -5836,16 +5843,22 @@ function renderFlowSvg(data) {
|
|
|
5836
5843
|
const cx = r5.x + r5.w / 2;
|
|
5837
5844
|
const cy = r5.y + r5.h / 2;
|
|
5838
5845
|
const accent = accentIds.has(n.id);
|
|
5839
|
-
const
|
|
5840
|
-
const
|
|
5841
|
-
const
|
|
5846
|
+
const chip3 = AI_CHIP[kind];
|
|
5847
|
+
const secondary2 = kind === "start" || kind === "memory";
|
|
5848
|
+
const stroke = accent ? "var(--accent)" : secondary2 ? "var(--rule-solid)" : "var(--ink)";
|
|
5849
|
+
const sw = accent ? 1.5 : secondary2 ? 1 : 1.5;
|
|
5850
|
+
const fill = accent ? "var(--accent-tint)" : secondary2 ? "var(--paper-2)" : "var(--paper)";
|
|
5851
|
+
const dash = kind === "human" ? ' stroke-dasharray="4 3"' : "";
|
|
5842
5852
|
let shape;
|
|
5843
5853
|
if (kind === "decision") {
|
|
5844
5854
|
shape = `<polygon points="${cx},${r5.y} ${r5.x + r5.w},${cy} ${cx},${r5.y + r5.h} ${r5.x},${cy}" fill="${fill}" stroke="${stroke}" stroke-width="${sw}" stroke-linejoin="round"/>`;
|
|
5845
5855
|
} else if (kind === "start" || kind === "end") {
|
|
5846
5856
|
shape = `<rect x="${r5.x}" y="${r5.y}" width="${r5.w}" height="${r5.h}" rx="${r5.h / 2}" fill="${fill}" stroke="${stroke}" stroke-width="${sw}"/>`;
|
|
5847
5857
|
} else {
|
|
5848
|
-
shape = `<rect x="${r5.x}" y="${r5.y}" width="${r5.w}" height="${r5.h}" rx="4" fill="${fill}" stroke="${stroke}" stroke-width="${sw}"/>`;
|
|
5858
|
+
shape = `<rect x="${r5.x}" y="${r5.y}" width="${r5.w}" height="${r5.h}" rx="4" fill="${fill}" stroke="${stroke}" stroke-width="${sw}"${dash}/>`;
|
|
5859
|
+
}
|
|
5860
|
+
if (chip3 !== void 0) {
|
|
5861
|
+
shape += `<text x="${r5.x + 8}" y="${r5.y + 11}" class="blk-chip t-sub">${chip3}</text>`;
|
|
5849
5862
|
}
|
|
5850
5863
|
const nl = n.label.indexOf("\n");
|
|
5851
5864
|
const name = nl >= 0 ? n.label.slice(0, nl) : n.label;
|
|
@@ -5853,12 +5866,13 @@ function renderFlowSvg(data) {
|
|
|
5853
5866
|
const maxChars = kind === "decision" ? 18 : 20;
|
|
5854
5867
|
const lines = sub.length > 0 ? wrapText(name, maxChars, 1) : wrapText(name, maxChars, 2);
|
|
5855
5868
|
const tone = accent ? " c-accent" : "";
|
|
5869
|
+
const dy = chip3 !== void 0 ? 4 : 0;
|
|
5856
5870
|
let texts = "";
|
|
5857
5871
|
if (sub.length > 0) {
|
|
5858
|
-
texts = `<text x="${cx}" y="${cy - 1}" class="fc-label t-name${tone}">${escapeHtml(lines[0] ?? name)}</text><text x="${cx}" y="${cy + 12}" class="fc-sub t-sub" text-anchor="middle">${escapeHtml(sub)}</text>`;
|
|
5872
|
+
texts = `<text x="${cx}" y="${cy - 1 + dy}" class="fc-label t-name${tone}">${escapeHtml(lines[0] ?? name)}</text><text x="${cx}" y="${cy + 12 + dy}" class="fc-sub t-sub" text-anchor="middle">${escapeHtml(sub)}</text>`;
|
|
5859
5873
|
} else {
|
|
5860
5874
|
texts = lines.map(
|
|
5861
|
-
(ln2, j2) => `<text x="${cx}" y="${cy + 4.5 - (lines.length - 1) * 7.5 + j2 * 15}" class="fc-label t-name${tone}">${escapeHtml(ln2)}</text>`
|
|
5875
|
+
(ln2, j2) => `<text x="${cx}" y="${cy + 4.5 + dy - (lines.length - 1) * 7.5 + j2 * 15}" class="fc-label t-name${tone}">${escapeHtml(ln2)}</text>`
|
|
5862
5876
|
).join("");
|
|
5863
5877
|
}
|
|
5864
5878
|
s += `<g${bp(`nodes.${ni}`)}${nodeCellAttrs(n.col, n.row, n.w ?? 1)}${revealAttr(stepOf(n.id))}>${shape}${texts}</g>`;
|
|
@@ -5871,6 +5885,11 @@ function renderFlowSvg(data) {
|
|
|
5871
5885
|
if (kindsUsed.has("start")) items.push({ swatch: "node-fill2", label: "start" });
|
|
5872
5886
|
if (kindsUsed.has("process")) items.push({ swatch: "node", label: "step" });
|
|
5873
5887
|
if (kindsUsed.has("decision")) items.push({ swatch: "node", label: "decision (diamond)" });
|
|
5888
|
+
if (kindsUsed.has("agent")) items.push({ swatch: "node", label: "AGENT \xB7 autonomous step" });
|
|
5889
|
+
if (kindsUsed.has("llm")) items.push({ swatch: "node", label: "LLM \xB7 model call" });
|
|
5890
|
+
if (kindsUsed.has("tool")) items.push({ swatch: "node", label: "TOOL \xB7 retrieval / API / code" });
|
|
5891
|
+
if (kindsUsed.has("human")) items.push({ swatch: "node-dashed", label: "HUMAN \xB7 review gate" });
|
|
5892
|
+
if (kindsUsed.has("memory")) items.push({ swatch: "node-fill2", label: "MEMORY \xB7 store" });
|
|
5874
5893
|
if (kindsUsed.has("end") && [...accentIds].length < nodes.filter((n) => n.kind === "end").length) {
|
|
5875
5894
|
items.push({ swatch: "node", label: "exit" });
|
|
5876
5895
|
}
|