@datatechsolutions/ui 2.11.79 → 2.11.81
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/astrlabe/contracts.d.mts +19 -1
- package/dist/astrlabe/contracts.d.ts +19 -1
- package/dist/astrlabe/index.d.mts +31 -3
- package/dist/astrlabe/index.d.ts +31 -3
- package/dist/astrlabe/index.js +436 -0
- package/dist/astrlabe/index.js.map +1 -1
- package/dist/astrlabe/index.mjs +435 -2
- package/dist/astrlabe/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/astrlabe/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ export { GraphNodeBadge, GraphNodeHeader, GraphNodeIconBubble, GraphNodeMeta } f
|
|
|
11
11
|
import { getAgentTier, createDefaultLogicNodeConfig } from '../chunk-WNCPAWLC.mjs';
|
|
12
12
|
export { applyDagreLayout, createDefaultLogicNodeConfig, getAgentTier } from '../chunk-WNCPAWLC.mjs';
|
|
13
13
|
import { memo, useCallback, useState, useEffect, useMemo, useRef, Children } from 'react';
|
|
14
|
-
import { UserCircleIcon, Cog6ToothIcon, SparklesIcon, CommandLineIcon, KeyIcon, PlayCircleIcon, CpuChipIcon, ArrowPathRoundedSquareIcon, ArrowsPointingOutIcon, ArrowsPointingInIcon, BoltIcon, ClockIcon, CheckIcon, AdjustmentsHorizontalIcon, CircleStackIcon, TrashIcon, PlusIcon, XMarkIcon, EyeIcon,
|
|
14
|
+
import { UserCircleIcon, Cog6ToothIcon, SparklesIcon, CommandLineIcon, KeyIcon, PlayCircleIcon, CpuChipIcon, ArrowPathRoundedSquareIcon, ArrowsPointingOutIcon, ArrowsPointingInIcon, BoltIcon, ClockIcon, CheckIcon, ArrowPathIcon, AdjustmentsHorizontalIcon, CircleStackIcon, TrashIcon, PlusIcon, XMarkIcon, EyeIcon, PlayIcon, StopIcon, XCircleIcon, CheckCircleIcon, VariableIcon, ChevronDownIcon, ChevronRightIcon, ExclamationCircleIcon, ClipboardDocumentIcon, ArrowDownTrayIcon, ArrowUpTrayIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline';
|
|
15
15
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
16
16
|
import { create } from 'zustand';
|
|
17
17
|
|
|
@@ -1553,6 +1553,439 @@ function PipelineSettingsModal({ onSave }) {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
);
|
|
1555
1555
|
}
|
|
1556
|
+
function RunReplayModal({
|
|
1557
|
+
open,
|
|
1558
|
+
onClose,
|
|
1559
|
+
runId,
|
|
1560
|
+
workflowId,
|
|
1561
|
+
originalInputs,
|
|
1562
|
+
onReplay
|
|
1563
|
+
}) {
|
|
1564
|
+
const t = useTranslations("agents.workflow");
|
|
1565
|
+
const [rows, setRows] = useState([]);
|
|
1566
|
+
const [submitting, setSubmitting] = useState(false);
|
|
1567
|
+
const [error, setError] = useState(null);
|
|
1568
|
+
useEffect(() => {
|
|
1569
|
+
if (!open) return;
|
|
1570
|
+
setRows(Object.entries(originalInputs).map(([key, value]) => toRow(key, value)));
|
|
1571
|
+
setError(null);
|
|
1572
|
+
}, [open, originalInputs]);
|
|
1573
|
+
const overrides = useMemo(() => {
|
|
1574
|
+
const out = {};
|
|
1575
|
+
for (const row of rows) {
|
|
1576
|
+
if (!row.touched) continue;
|
|
1577
|
+
try {
|
|
1578
|
+
out[row.key] = parseRow(row);
|
|
1579
|
+
} catch (e) {
|
|
1580
|
+
out[`__error__${row.key}`] = e.message;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
return out;
|
|
1584
|
+
}, [rows]);
|
|
1585
|
+
const hasParseError = Object.keys(overrides).some((k) => k.startsWith("__error__"));
|
|
1586
|
+
const updateRow = (index, patch) => {
|
|
1587
|
+
setRows((current) => current.map((r, i) => i === index ? { ...r, ...patch, touched: true } : r));
|
|
1588
|
+
};
|
|
1589
|
+
const resetRow = (index) => {
|
|
1590
|
+
setRows((current) => current.map((r, i) => {
|
|
1591
|
+
if (i !== index) return r;
|
|
1592
|
+
return toRow(r.key, r.original);
|
|
1593
|
+
}));
|
|
1594
|
+
};
|
|
1595
|
+
const handleSubmit = async () => {
|
|
1596
|
+
setError(null);
|
|
1597
|
+
if (hasParseError) {
|
|
1598
|
+
setError(t("replayParseError", { _: "One or more values do not match their declared type." }));
|
|
1599
|
+
return;
|
|
1600
|
+
}
|
|
1601
|
+
setSubmitting(true);
|
|
1602
|
+
try {
|
|
1603
|
+
const cleaned = {};
|
|
1604
|
+
for (const row of rows) {
|
|
1605
|
+
if (!row.touched) continue;
|
|
1606
|
+
cleaned[row.key] = parseRow(row);
|
|
1607
|
+
}
|
|
1608
|
+
await onReplay(cleaned);
|
|
1609
|
+
onClose();
|
|
1610
|
+
} catch (e) {
|
|
1611
|
+
setError(e.message);
|
|
1612
|
+
} finally {
|
|
1613
|
+
setSubmitting(false);
|
|
1614
|
+
}
|
|
1615
|
+
};
|
|
1616
|
+
const footer = /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1617
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-gray-400", children: [
|
|
1618
|
+
"run ",
|
|
1619
|
+
/* @__PURE__ */ jsx("code", { children: runId.slice(0, 8) }),
|
|
1620
|
+
" \xB7 wf ",
|
|
1621
|
+
/* @__PURE__ */ jsx("code", { children: workflowId.slice(0, 8) })
|
|
1622
|
+
] }),
|
|
1623
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1624
|
+
/* @__PURE__ */ jsx(
|
|
1625
|
+
"button",
|
|
1626
|
+
{
|
|
1627
|
+
type: "button",
|
|
1628
|
+
onClick: onClose,
|
|
1629
|
+
className: "rounded-lg border border-gray-200/50 px-4 py-2 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100/50 dark:border-white/10 dark:text-gray-300 dark:hover:bg-white/5",
|
|
1630
|
+
children: t("cancel")
|
|
1631
|
+
}
|
|
1632
|
+
),
|
|
1633
|
+
/* @__PURE__ */ jsxs(
|
|
1634
|
+
Button,
|
|
1635
|
+
{
|
|
1636
|
+
type: "submit",
|
|
1637
|
+
form: "run-replay-form",
|
|
1638
|
+
color: "ios-glass-blue",
|
|
1639
|
+
loading: submitting,
|
|
1640
|
+
children: [
|
|
1641
|
+
/* @__PURE__ */ jsx(ArrowPathIcon, { className: "h-4 w-4" }),
|
|
1642
|
+
t("replay", { _: "Replay" })
|
|
1643
|
+
]
|
|
1644
|
+
}
|
|
1645
|
+
)
|
|
1646
|
+
] })
|
|
1647
|
+
] });
|
|
1648
|
+
return /* @__PURE__ */ jsx(
|
|
1649
|
+
GlassModal,
|
|
1650
|
+
{
|
|
1651
|
+
open,
|
|
1652
|
+
onClose,
|
|
1653
|
+
title: t("replayTitle", { _: "Replay run" }),
|
|
1654
|
+
subtitle: t("replaySubtitle", { _: "Tweak any input below and re-execute. Untouched keys keep their original value." }),
|
|
1655
|
+
icon: /* @__PURE__ */ jsx(ArrowPathIcon, { className: "h-5 w-5 text-white" }),
|
|
1656
|
+
gradient: "from-sky-500 to-indigo-600",
|
|
1657
|
+
maxWidth: "lg",
|
|
1658
|
+
footer,
|
|
1659
|
+
onSubmit: (event) => {
|
|
1660
|
+
event.preventDefault();
|
|
1661
|
+
void handleSubmit();
|
|
1662
|
+
},
|
|
1663
|
+
children: /* @__PURE__ */ jsxs(
|
|
1664
|
+
"form",
|
|
1665
|
+
{
|
|
1666
|
+
id: "run-replay-form",
|
|
1667
|
+
onSubmit: (event) => {
|
|
1668
|
+
event.preventDefault();
|
|
1669
|
+
void handleSubmit();
|
|
1670
|
+
},
|
|
1671
|
+
className: "space-y-3",
|
|
1672
|
+
children: [
|
|
1673
|
+
rows.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("replayNoInputs", { _: "This run had no input variables \u2014 replaying will execute the workflow as-is." }) }) : rows.map((row, index) => /* @__PURE__ */ jsx(
|
|
1674
|
+
RowEditor,
|
|
1675
|
+
{
|
|
1676
|
+
row,
|
|
1677
|
+
onChange: (patch) => updateRow(index, patch),
|
|
1678
|
+
onReset: () => resetRow(index)
|
|
1679
|
+
},
|
|
1680
|
+
row.key
|
|
1681
|
+
)),
|
|
1682
|
+
error && /* @__PURE__ */ jsx("p", { className: "rounded-lg border border-red-400/40 bg-red-500/10 p-2 text-xs text-red-600 dark:text-red-300", children: error })
|
|
1683
|
+
]
|
|
1684
|
+
}
|
|
1685
|
+
)
|
|
1686
|
+
}
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
function RowEditor({
|
|
1690
|
+
row,
|
|
1691
|
+
onChange,
|
|
1692
|
+
onReset
|
|
1693
|
+
}) {
|
|
1694
|
+
const isJson = row.kind === "json";
|
|
1695
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-gray-200/60 bg-gray-50/60 p-3 dark:border-white/10 dark:bg-white/5", children: [
|
|
1696
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
1697
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-gray-700 dark:text-gray-200", children: row.key }),
|
|
1698
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1699
|
+
/* @__PURE__ */ jsx("span", { className: "rounded-full bg-gray-200/60 px-2 py-0.5 text-[10px] uppercase tracking-wider text-gray-600 dark:bg-white/10 dark:text-gray-300", children: row.kind }),
|
|
1700
|
+
row.touched && /* @__PURE__ */ jsx(
|
|
1701
|
+
"button",
|
|
1702
|
+
{
|
|
1703
|
+
type: "button",
|
|
1704
|
+
onClick: onReset,
|
|
1705
|
+
className: "text-[11px] text-indigo-600 hover:text-indigo-500 dark:text-indigo-400",
|
|
1706
|
+
children: "reset"
|
|
1707
|
+
}
|
|
1708
|
+
)
|
|
1709
|
+
] })
|
|
1710
|
+
] }),
|
|
1711
|
+
row.kind === "boolean" ? /* @__PURE__ */ jsxs(
|
|
1712
|
+
"select",
|
|
1713
|
+
{
|
|
1714
|
+
value: row.value,
|
|
1715
|
+
onChange: (event) => onChange({ value: event.target.value }),
|
|
1716
|
+
className: "w-full rounded-lg border border-gray-200/50 bg-white/70 px-3 py-2 text-sm text-gray-900 dark:border-white/10 dark:bg-gray-800/70 dark:text-gray-100",
|
|
1717
|
+
children: [
|
|
1718
|
+
/* @__PURE__ */ jsx("option", { value: "true", children: "true" }),
|
|
1719
|
+
/* @__PURE__ */ jsx("option", { value: "false", children: "false" })
|
|
1720
|
+
]
|
|
1721
|
+
}
|
|
1722
|
+
) : isJson ? /* @__PURE__ */ jsx(
|
|
1723
|
+
FormTextarea,
|
|
1724
|
+
{
|
|
1725
|
+
value: row.value,
|
|
1726
|
+
onValueChange: (v) => onChange({ value: v }),
|
|
1727
|
+
rows: 4,
|
|
1728
|
+
className: "font-mono"
|
|
1729
|
+
}
|
|
1730
|
+
) : /* @__PURE__ */ jsx(
|
|
1731
|
+
FormInput,
|
|
1732
|
+
{
|
|
1733
|
+
type: row.kind === "number" ? "number" : "text",
|
|
1734
|
+
value: row.value,
|
|
1735
|
+
onValueChange: (v) => onChange({ value: v })
|
|
1736
|
+
}
|
|
1737
|
+
)
|
|
1738
|
+
] });
|
|
1739
|
+
}
|
|
1740
|
+
function toRow(key, value) {
|
|
1741
|
+
if (value === null || value === void 0) {
|
|
1742
|
+
return { key, value: "", kind: "string", touched: false, original: value };
|
|
1743
|
+
}
|
|
1744
|
+
if (typeof value === "boolean") {
|
|
1745
|
+
return { key, value: value ? "true" : "false", kind: "boolean", touched: false, original: value };
|
|
1746
|
+
}
|
|
1747
|
+
if (typeof value === "number") {
|
|
1748
|
+
return { key, value: String(value), kind: "number", touched: false, original: value };
|
|
1749
|
+
}
|
|
1750
|
+
if (typeof value === "string") {
|
|
1751
|
+
return { key, value, kind: "string", touched: false, original: value };
|
|
1752
|
+
}
|
|
1753
|
+
return {
|
|
1754
|
+
key,
|
|
1755
|
+
value: JSON.stringify(value, null, 2),
|
|
1756
|
+
kind: "json",
|
|
1757
|
+
touched: false,
|
|
1758
|
+
original: value
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
function parseRow(row) {
|
|
1762
|
+
switch (row.kind) {
|
|
1763
|
+
case "string":
|
|
1764
|
+
return row.value;
|
|
1765
|
+
case "number": {
|
|
1766
|
+
const n = Number(row.value);
|
|
1767
|
+
if (!Number.isFinite(n)) {
|
|
1768
|
+
throw new Error(`'${row.key}' must be a number, got '${row.value}'`);
|
|
1769
|
+
}
|
|
1770
|
+
return n;
|
|
1771
|
+
}
|
|
1772
|
+
case "boolean":
|
|
1773
|
+
return row.value === "true";
|
|
1774
|
+
case "json": {
|
|
1775
|
+
if (row.value.trim().length === 0) return null;
|
|
1776
|
+
try {
|
|
1777
|
+
return JSON.parse(row.value);
|
|
1778
|
+
} catch (e) {
|
|
1779
|
+
throw new Error(`'${row.key}' is not valid JSON: ${e.message}`);
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
var PRIMITIVE_TYPES = [
|
|
1785
|
+
{ value: "string", label: "string" },
|
|
1786
|
+
{ value: "number", label: "number" },
|
|
1787
|
+
{ value: "integer", label: "integer" },
|
|
1788
|
+
{ value: "boolean", label: "boolean" }
|
|
1789
|
+
];
|
|
1790
|
+
var COMPLEX_TYPES = [
|
|
1791
|
+
{ value: "object", label: "object (nested)" },
|
|
1792
|
+
{ value: "array", label: "array of objects" }
|
|
1793
|
+
];
|
|
1794
|
+
var ALL_TYPES = [...PRIMITIVE_TYPES, ...COMPLEX_TYPES];
|
|
1795
|
+
function OutputSchemaBuilder({ value, onChange, depth = 0 }) {
|
|
1796
|
+
const fields = useMemo(() => {
|
|
1797
|
+
if (!value || value.type !== "object") return [];
|
|
1798
|
+
return buildFieldRows(value);
|
|
1799
|
+
}, [value]);
|
|
1800
|
+
if (!value) {
|
|
1801
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-dashed border-slate-300 bg-slate-50/40 p-4 text-center dark:border-slate-700 dark:bg-slate-900/30", children: [
|
|
1802
|
+
/* @__PURE__ */ jsx("p", { className: "mb-3 text-xs text-slate-500 dark:text-slate-400", children: "No schema yet \u2014 agent text is exposed as a raw string. Add a schema to enforce structured output." }),
|
|
1803
|
+
/* @__PURE__ */ jsx(
|
|
1804
|
+
Button,
|
|
1805
|
+
{
|
|
1806
|
+
type: "button",
|
|
1807
|
+
outline: true,
|
|
1808
|
+
onClick: () => onChange({ type: "object", properties: {}, required: [] }),
|
|
1809
|
+
children: "+ Add output schema"
|
|
1810
|
+
}
|
|
1811
|
+
)
|
|
1812
|
+
] });
|
|
1813
|
+
}
|
|
1814
|
+
if (value.type !== "object") {
|
|
1815
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-amber-300 bg-amber-50/40 p-3 text-xs text-amber-700 dark:border-amber-700 dark:bg-amber-900/20 dark:text-amber-300", children: [
|
|
1816
|
+
"The visual builder only supports `type: object` at the top level. Convert manually or",
|
|
1817
|
+
/* @__PURE__ */ jsx(
|
|
1818
|
+
"button",
|
|
1819
|
+
{
|
|
1820
|
+
type: "button",
|
|
1821
|
+
className: "ml-1 underline",
|
|
1822
|
+
onClick: () => onChange({ type: "object", properties: {}, required: [] }),
|
|
1823
|
+
children: "reset to object"
|
|
1824
|
+
}
|
|
1825
|
+
),
|
|
1826
|
+
"."
|
|
1827
|
+
] });
|
|
1828
|
+
}
|
|
1829
|
+
const updateFields = (next) => {
|
|
1830
|
+
onChange(rowsToSchema(next));
|
|
1831
|
+
};
|
|
1832
|
+
const addField = () => {
|
|
1833
|
+
updateFields([
|
|
1834
|
+
...fields,
|
|
1835
|
+
{ name: "", type: "string", description: "", required: false, child: void 0 }
|
|
1836
|
+
]);
|
|
1837
|
+
};
|
|
1838
|
+
const removeField = (index) => {
|
|
1839
|
+
updateFields(fields.filter((_, i) => i !== index));
|
|
1840
|
+
};
|
|
1841
|
+
const patchField = (index, patch) => {
|
|
1842
|
+
updateFields(fields.map((f, i) => i === index ? { ...f, ...patch } : f));
|
|
1843
|
+
};
|
|
1844
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1845
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1846
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700 dark:text-slate-200", children: "Top-level fields" }),
|
|
1847
|
+
/* @__PURE__ */ jsx(
|
|
1848
|
+
"button",
|
|
1849
|
+
{
|
|
1850
|
+
type: "button",
|
|
1851
|
+
className: "text-xs text-rose-600 hover:text-rose-500",
|
|
1852
|
+
onClick: () => onChange(void 0),
|
|
1853
|
+
children: "Remove schema"
|
|
1854
|
+
}
|
|
1855
|
+
)
|
|
1856
|
+
] }),
|
|
1857
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1858
|
+
fields.map((field, index) => /* @__PURE__ */ jsx(
|
|
1859
|
+
FieldEditor,
|
|
1860
|
+
{
|
|
1861
|
+
field,
|
|
1862
|
+
onChange: (patch) => patchField(index, patch),
|
|
1863
|
+
onRemove: () => removeField(index),
|
|
1864
|
+
depth
|
|
1865
|
+
},
|
|
1866
|
+
index
|
|
1867
|
+
)),
|
|
1868
|
+
/* @__PURE__ */ jsx(Button, { type: "button", outline: true, onClick: addField, children: "+ Add field" })
|
|
1869
|
+
] })
|
|
1870
|
+
] });
|
|
1871
|
+
}
|
|
1872
|
+
function FieldEditor({
|
|
1873
|
+
field,
|
|
1874
|
+
onChange,
|
|
1875
|
+
onRemove,
|
|
1876
|
+
depth
|
|
1877
|
+
}) {
|
|
1878
|
+
const handleTypeChange = (next) => {
|
|
1879
|
+
if (next === "object") {
|
|
1880
|
+
onChange({ type: next, child: { type: "object", properties: {}, required: [] } });
|
|
1881
|
+
} else if (next === "array") {
|
|
1882
|
+
onChange({ type: next, child: { type: "object", properties: {}, required: [] } });
|
|
1883
|
+
} else {
|
|
1884
|
+
onChange({ type: next, child: void 0 });
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1887
|
+
const isComplex = field.type === "object" || field.type === "array";
|
|
1888
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 bg-slate-50/60 p-3 dark:border-slate-700 dark:bg-slate-900/40", children: [
|
|
1889
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_140px_auto_auto] items-end gap-2", children: [
|
|
1890
|
+
/* @__PURE__ */ jsx(
|
|
1891
|
+
FormInput,
|
|
1892
|
+
{
|
|
1893
|
+
label: "Name",
|
|
1894
|
+
value: field.name,
|
|
1895
|
+
onValueChange: (name) => onChange({ name }),
|
|
1896
|
+
placeholder: "recommendedPrice"
|
|
1897
|
+
}
|
|
1898
|
+
),
|
|
1899
|
+
/* @__PURE__ */ jsx(
|
|
1900
|
+
FormSelect,
|
|
1901
|
+
{
|
|
1902
|
+
label: "Type",
|
|
1903
|
+
value: field.type,
|
|
1904
|
+
options: ALL_TYPES.map((t) => ({ value: t.value, label: t.label })),
|
|
1905
|
+
onValueChange: (t) => handleTypeChange(t)
|
|
1906
|
+
}
|
|
1907
|
+
),
|
|
1908
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 pb-2 text-xs text-slate-700 dark:text-slate-200", children: [
|
|
1909
|
+
/* @__PURE__ */ jsx(
|
|
1910
|
+
"input",
|
|
1911
|
+
{
|
|
1912
|
+
type: "checkbox",
|
|
1913
|
+
checked: field.required,
|
|
1914
|
+
onChange: (event) => onChange({ required: event.target.checked }),
|
|
1915
|
+
className: "h-4 w-4 rounded border-slate-300"
|
|
1916
|
+
}
|
|
1917
|
+
),
|
|
1918
|
+
"Required"
|
|
1919
|
+
] }),
|
|
1920
|
+
/* @__PURE__ */ jsx(Button, { type: "button", plain: true, onClick: onRemove, children: "Remove" })
|
|
1921
|
+
] }),
|
|
1922
|
+
/* @__PURE__ */ jsx(
|
|
1923
|
+
FormInput,
|
|
1924
|
+
{
|
|
1925
|
+
label: "Description (optional)",
|
|
1926
|
+
value: field.description,
|
|
1927
|
+
onValueChange: (description) => onChange({ description }),
|
|
1928
|
+
placeholder: "What the model should put here"
|
|
1929
|
+
}
|
|
1930
|
+
),
|
|
1931
|
+
isComplex && depth < 1 && /* @__PURE__ */ jsxs("div", { className: "mt-3 rounded-lg border border-dashed border-slate-300 p-2 dark:border-slate-700", children: [
|
|
1932
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-[11px] uppercase tracking-wider text-slate-400", children: field.type === "array" ? "Item shape" : "Nested fields" }),
|
|
1933
|
+
/* @__PURE__ */ jsx(
|
|
1934
|
+
OutputSchemaBuilder,
|
|
1935
|
+
{
|
|
1936
|
+
value: field.child,
|
|
1937
|
+
onChange: (child) => onChange({ child }),
|
|
1938
|
+
depth: depth + 1
|
|
1939
|
+
}
|
|
1940
|
+
)
|
|
1941
|
+
] }),
|
|
1942
|
+
isComplex && depth >= 1 && /* @__PURE__ */ jsx("p", { className: "mt-2 text-[11px] italic text-slate-500", children: "Deeper nesting is supported by the engine but not by this builder \u2014 edit the JSON directly if you need a third level." })
|
|
1943
|
+
] });
|
|
1944
|
+
}
|
|
1945
|
+
function buildFieldRows(schema) {
|
|
1946
|
+
const properties = schema.properties ?? {};
|
|
1947
|
+
const required = new Set(schema.required ?? []);
|
|
1948
|
+
return Object.entries(properties).map(([name, subschema]) => {
|
|
1949
|
+
const t = subschema.type ?? "string";
|
|
1950
|
+
const isObject = t === "object";
|
|
1951
|
+
const isArray = t === "array";
|
|
1952
|
+
return {
|
|
1953
|
+
name,
|
|
1954
|
+
type: isObject ? "object" : isArray ? "array" : t,
|
|
1955
|
+
description: subschema.description ?? "",
|
|
1956
|
+
required: required.has(name),
|
|
1957
|
+
child: isObject ? subschema : isArray ? subschema.items : void 0
|
|
1958
|
+
};
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
function rowsToSchema(rows) {
|
|
1962
|
+
const properties = {};
|
|
1963
|
+
const required = [];
|
|
1964
|
+
for (const row of rows) {
|
|
1965
|
+
const name = row.name.trim();
|
|
1966
|
+
if (!name) continue;
|
|
1967
|
+
let entry;
|
|
1968
|
+
if (row.type === "object") {
|
|
1969
|
+
entry = row.child && row.child.type === "object" ? row.child : { type: "object", properties: {}, required: [] };
|
|
1970
|
+
} else if (row.type === "array") {
|
|
1971
|
+
entry = {
|
|
1972
|
+
type: "array",
|
|
1973
|
+
items: row.child ?? { type: "object", properties: {}, required: [] }
|
|
1974
|
+
};
|
|
1975
|
+
} else {
|
|
1976
|
+
entry = { type: row.type };
|
|
1977
|
+
}
|
|
1978
|
+
if (row.description) entry.description = row.description;
|
|
1979
|
+
properties[name] = entry;
|
|
1980
|
+
if (row.required) required.push(name);
|
|
1981
|
+
}
|
|
1982
|
+
const out = { type: "object", properties };
|
|
1983
|
+
if (required.length > 0) out.required = required;
|
|
1984
|
+
return out;
|
|
1985
|
+
}
|
|
1986
|
+
function defaultAgentOutputSchema() {
|
|
1987
|
+
return { type: "object", properties: {}, required: [] };
|
|
1988
|
+
}
|
|
1556
1989
|
|
|
1557
1990
|
// src/astrlabe/components/rules/types.ts
|
|
1558
1991
|
var RULE_STATUS_OPTIONS = ["draft", "active", "archived"];
|
|
@@ -4312,6 +4745,6 @@ function useHelpLines() {
|
|
|
4312
4745
|
};
|
|
4313
4746
|
}
|
|
4314
4747
|
|
|
4315
|
-
export { AgentModal, AmazonNovaIcon, AnthropicModelIcon, AutoSaveWorkspace, DslExportModal, DslImportModal, DynamicIslandConfirm2 as DynamicIslandConfirm, MetaLlamaIcon, NodePalette, PipelineSettingsModal, PreviewPanel, RULE_STATUS_OPTIONS, RuleActionBuilder, RuleConditionBuilder, RuleForm, RunInputDialog, RunPanel, SaveStatusBadge, SubworkflowModal, TIMEZONE_OPTIONS, VariableInspector, VersionHistoryPanel, WorkflowListBar, defaultRuleAction, defaultRuleCondition, defaultRuleForm, getModelIcon, useCanRedo, useCanUndo, useCanvasShortcuts, useClipboard, useContextMenu, useEditingNodeId, useHasCopied, useHelpLines, useIsRunning, useNodeResults, useSelectedNodeCount, useSubworkflowStore, useUndoRedo };
|
|
4748
|
+
export { AgentModal, AmazonNovaIcon, AnthropicModelIcon, AutoSaveWorkspace, DslExportModal, DslImportModal, DynamicIslandConfirm2 as DynamicIslandConfirm, MetaLlamaIcon, NodePalette, OutputSchemaBuilder, PipelineSettingsModal, PreviewPanel, RULE_STATUS_OPTIONS, RuleActionBuilder, RuleConditionBuilder, RuleForm, RunInputDialog, RunPanel, RunReplayModal, SaveStatusBadge, SubworkflowModal, TIMEZONE_OPTIONS, VariableInspector, VersionHistoryPanel, WorkflowListBar, defaultAgentOutputSchema, defaultRuleAction, defaultRuleCondition, defaultRuleForm, getModelIcon, useCanRedo, useCanUndo, useCanvasShortcuts, useClipboard, useContextMenu, useEditingNodeId, useHasCopied, useHelpLines, useIsRunning, useNodeResults, useSelectedNodeCount, useSubworkflowStore, useUndoRedo };
|
|
4316
4749
|
//# sourceMappingURL=index.mjs.map
|
|
4317
4750
|
//# sourceMappingURL=index.mjs.map
|