fusion-artifacts-engine 0.7.18__py3-none-any.whl
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.
- fusion_artifacts_engine/__init__.py +0 -0
- fusion_artifacts_engine/__main__.py +263 -0
- fusion_artifacts_engine/ai_client.py +54 -0
- fusion_artifacts_engine/auto_identifier.py +148 -0
- fusion_artifacts_engine/compactor.py +164 -0
- fusion_artifacts_engine/config.py +462 -0
- fusion_artifacts_engine/default_config.yaml +144 -0
- fusion_artifacts_engine/dsl_parser.py +231 -0
- fusion_artifacts_engine/engine.py +1372 -0
- fusion_artifacts_engine/gateway_client.py +396 -0
- fusion_artifacts_engine/ipc_consumer.py +321 -0
- fusion_artifacts_engine/long_context.py +392 -0
- fusion_artifacts_engine/metrics.py +144 -0
- fusion_artifacts_engine/models.py +168 -0
- fusion_artifacts_engine/office_ingest.py +365 -0
- fusion_artifacts_engine/rate_limiter.py +82 -0
- fusion_artifacts_engine/ref_parser.py +77 -0
- fusion_artifacts_engine/render.py +184 -0
- fusion_artifacts_engine/rpc/__init__.py +0 -0
- fusion_artifacts_engine/rpc/errors.py +61 -0
- fusion_artifacts_engine/rpc/event_bus.py +95 -0
- fusion_artifacts_engine/rpc/methods.py +1365 -0
- fusion_artifacts_engine/rpc/server.py +1279 -0
- fusion_artifacts_engine/section_index.py +189 -0
- fusion_artifacts_engine/share.py +326 -0
- fusion_artifacts_engine/storage/__init__.py +0 -0
- fusion_artifacts_engine/storage/base.py +270 -0
- fusion_artifacts_engine/storage/sqlite_storage.py +2813 -0
- fusion_artifacts_engine/token_budget.py +119 -0
- fusion_artifacts_engine/token_counter.py +80 -0
- fusion_artifacts_engine/tracing.py +132 -0
- fusion_artifacts_engine/utils.py +170 -0
- fusion_artifacts_engine/visual_dispatcher.py +135 -0
- fusion_artifacts_engine/visual_error_boundary.py +52 -0
- fusion_artifacts_engine/visual_primitives/__init__.py +34 -0
- fusion_artifacts_engine/visual_primitives/array_grid.py +66 -0
- fusion_artifacts_engine/visual_primitives/base.py +79 -0
- fusion_artifacts_engine/visual_primitives/bucket_divider.py +66 -0
- fusion_artifacts_engine/visual_primitives/data_chart.py +65 -0
- fusion_artifacts_engine/visual_primitives/flow_card.py +101 -0
- fusion_artifacts_engine/visual_primitives/geometry_2d.py +80 -0
- fusion_artifacts_engine/visual_primitives/isometric_3d.py +82 -0
- fusion_artifacts_engine/visual_primitives/tape_diagram.py +58 -0
- fusion_artifacts_engine/visual_primitives/track_timeline.py +58 -0
- fusion_artifacts_engine/webui_dist/assets/abnfDiagram-WEYOIA3C-2ebtMp5N.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/architectureDiagram-ZHVYKT53-COvSzFYy.js +36 -0
- fusion_artifacts_engine/webui_dist/assets/blockDiagram-RJAE7QA3-CsO2Iy8b.js +140 -0
- fusion_artifacts_engine/webui_dist/assets/c4Diagram-XDPPPE54-dFggQosH.js +38 -0
- fusion_artifacts_engine/webui_dist/assets/channel-BXYZthxM.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-2E7WHVMD-B93QdjG6.js +88 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-2Q5K7J3B-DHEJLJup.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-4EMNKR2T-OGUUH-PY.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-55XCU76K-CKbux1-g.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-5VM5RSS4-CPHhHyIF.js +15 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-JWPE2WC7-CJSxuarC.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-VQ5W62QI-LHItmtfv.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-XXDRQBXY-BRYBW56M.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-ZCHMQSOR-cGbkforM.js +2 -0
- fusion_artifacts_engine/webui_dist/assets/classDiagram-v2-4MYWR3UA-RVdXT7ne.js +217 -0
- fusion_artifacts_engine/webui_dist/assets/cose-bilkent-JH36ORCC-C1hy4K0b.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/cynefin-EF2NZ3EQ-D8ytFvIy.js +141 -0
- fusion_artifacts_engine/webui_dist/assets/cynefinDiagram-WF24UDRP-9iOV04Va.js +62 -0
- fusion_artifacts_engine/webui_dist/assets/cytoscape.esm-BLAcgzS2.js +331 -0
- fusion_artifacts_engine/webui_dist/assets/dagre-NK4GIZVX-zE4dzUJh.js +4 -0
- fusion_artifacts_engine/webui_dist/assets/defaultLocale-5voVPcsN.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-CBK3MWTC-BrXmQtKM.js +24 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-I5XIIV2D-Bctxj8zx.js +24 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-ODIL2UCW-DfDzzeod.js +30 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-PFBEJUXE-BGZKfFXu.js +3 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-RJA3I4VV-CXB6A2jx.js +41 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-TYUNFSNR-gfqyjmIj.js +200 -0
- fusion_artifacts_engine/webui_dist/assets/ebnfDiagram-V4P3TTPT-CZ1BZkcl.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/elk-QONTBCTQ-C5YzS41r.js +27 -0
- fusion_artifacts_engine/webui_dist/assets/erDiagram-KYQIGQAA-B-DYTd4O.js +99 -0
- fusion_artifacts_engine/webui_dist/assets/flowDiagram-IUGLLWBU-IRAKfxcJ.js +213 -0
- fusion_artifacts_engine/webui_dist/assets/ganttDiagram-R7GPNTJY-DRdmsg6i.js +292 -0
- fusion_artifacts_engine/webui_dist/assets/gitGraphDiagram-PDYL7XHY-B0QL_KrV.js +106 -0
- fusion_artifacts_engine/webui_dist/assets/graph-Bn3Yngep.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/index-CCsQ6nhB.js +374 -0
- fusion_artifacts_engine/webui_dist/assets/index-Cw23dyL1.css +1 -0
- fusion_artifacts_engine/webui_dist/assets/infoDiagram-MVDRKAX5-DMlVkZRb.js +2 -0
- fusion_artifacts_engine/webui_dist/assets/init-DDsq4BXF.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/ishikawaDiagram-HPEHV2GE-yZW7Bvw7.js +70 -0
- fusion_artifacts_engine/webui_dist/assets/journeyDiagram-BOSHW7O7-C0UaOGz2.js +139 -0
- fusion_artifacts_engine/webui_dist/assets/kanban-definition-FNSA4HC5-D2VjWSCv.js +89 -0
- fusion_artifacts_engine/webui_dist/assets/katex-Be3d8Y4U.js +257 -0
- fusion_artifacts_engine/webui_dist/assets/linear-B0L4ZWGd.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/mermaid.core-C0Fw4Tzk.js +314 -0
- fusion_artifacts_engine/webui_dist/assets/mindmap-definition-6OY57UG3-Dy3WTB5p.js +98 -0
- fusion_artifacts_engine/webui_dist/assets/ordinal-_ShbN0yz.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/pegDiagram-ECIUJNBX-Cdm0XnAV.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/pieDiagram-GNMPY74T-TrdpBRYl.js +39 -0
- fusion_artifacts_engine/webui_dist/assets/quadrantDiagram-D57K4MC3-N1OmHTjQ.js +7 -0
- fusion_artifacts_engine/webui_dist/assets/railroadDiagram-Y72NRBL7-DhZcDSX6.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/requirementDiagram-EQYSW5RA-CGmfo0LK.js +84 -0
- fusion_artifacts_engine/webui_dist/assets/sankeyDiagram-SY24JHO5-CnAXR6RI.js +40 -0
- fusion_artifacts_engine/webui_dist/assets/sequenceDiagram-BLEHNHQU-Divp82Qv.js +169 -0
- fusion_artifacts_engine/webui_dist/assets/sizeCapture-INFHLROL-BxUSO2gs.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/stateDiagram-v2-A6IESKWZ-Ch2o3gee.js +291 -0
- fusion_artifacts_engine/webui_dist/assets/swimlanes-B3ENRKFQ-CBnYOtut.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/swimlanesDiagram-AYQRV4AK-Bdp49byx.js +8 -0
- fusion_artifacts_engine/webui_dist/assets/timeline-definition-JXYKGLGB-Cp8DPlck.js +120 -0
- fusion_artifacts_engine/webui_dist/assets/usecaseDiagram-WPOLBNNX-CcF_Y4cE.js +370 -0
- fusion_artifacts_engine/webui_dist/assets/vennDiagram-Q3Y3IDCW-Dplzp3gZ.js +34 -0
- fusion_artifacts_engine/webui_dist/assets/wardleyDiagram-IVAIDKWA-fKoKxoZw.js +78 -0
- fusion_artifacts_engine/webui_dist/assets/xychartDiagram-4URNHDU4-DRVZF7Gc.js +7 -0
- fusion_artifacts_engine/webui_dist/favicon.svg +1 -0
- fusion_artifacts_engine/webui_dist/index.html +14 -0
- fusion_artifacts_engine-0.7.18.dist-info/METADATA +1115 -0
- fusion_artifacts_engine-0.7.18.dist-info/RECORD +114 -0
- fusion_artifacts_engine-0.7.18.dist-info/WHEEL +5 -0
- fusion_artifacts_engine-0.7.18.dist-info/entry_points.txt +2 -0
- fusion_artifacts_engine-0.7.18.dist-info/licenses/LICENSE +201 -0
- fusion_artifacts_engine-0.7.18.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import logging
|
|
3
|
+
import re
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
logger = logging.getLogger(__name__)
|
|
7
|
+
|
|
8
|
+
_THINKING_RE = re.compile(r"<thinking>\n?(.*?)\n?</thinking>", re.DOTALL)
|
|
9
|
+
_DSL_RE = re.compile(r"<dsl>\n?(.*?)\n?</dsl>", re.DOTALL)
|
|
10
|
+
|
|
11
|
+
_FALLBACK_VISUAL_TYPE = "flow_card"
|
|
12
|
+
|
|
13
|
+
# Issue #64/#63 CI: fusion_core.dsl_schema is a monorepo sibling package and
|
|
14
|
+
# may be absent in isolated environments (CI installs only this repo). Schema
|
|
15
|
+
# validation must never silently degrade to "everything is valid" — a
|
|
16
|
+
# malformed DSL would then be marked valid and rendered downstream. This
|
|
17
|
+
# fallback validator mirrors the required/enum checks of
|
|
18
|
+
# fusion_core.dsl_schema.SOCRATIC_DSL_V3_SCHEMA (kept in sync manually).
|
|
19
|
+
_FALLBACK_VISUAL_TYPES = (
|
|
20
|
+
"array_grid",
|
|
21
|
+
"tape_diagram",
|
|
22
|
+
"geometry_2d",
|
|
23
|
+
"isometric_3d",
|
|
24
|
+
"track_timeline",
|
|
25
|
+
"bucket_divider",
|
|
26
|
+
"data_chart",
|
|
27
|
+
"flow_card",
|
|
28
|
+
)
|
|
29
|
+
_FALLBACK_FALLBACK_TYPES = ("tape_diagram", "flow_card")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _fallback_validate_dsl(dsl_dict: dict) -> list[str]:
|
|
33
|
+
errors: list[str] = []
|
|
34
|
+
for key in ("meta", "parameters", "entities", "pipeline"):
|
|
35
|
+
if key not in dsl_dict:
|
|
36
|
+
errors.append(f"missing required property: {key}")
|
|
37
|
+
extra = set(dsl_dict) - {"meta", "parameters", "entities", "pipeline"}
|
|
38
|
+
if extra:
|
|
39
|
+
errors.append(f"additional properties not allowed: {sorted(extra)}")
|
|
40
|
+
meta = dsl_dict.get("meta")
|
|
41
|
+
if not isinstance(meta, dict):
|
|
42
|
+
if meta is not None or "meta" not in dsl_dict:
|
|
43
|
+
errors.append("meta must be an object")
|
|
44
|
+
else:
|
|
45
|
+
for key in ("id", "grade", "topic", "visual_type", "fallback_type"):
|
|
46
|
+
if key not in meta:
|
|
47
|
+
errors.append(f"meta: missing required property: {key}")
|
|
48
|
+
meta_extra = set(meta) - {"id", "grade", "topic", "visual_type", "fallback_type"}
|
|
49
|
+
if meta_extra:
|
|
50
|
+
errors.append(f"meta: additional properties not allowed: {sorted(meta_extra)}")
|
|
51
|
+
if meta.get("visual_type") not in _FALLBACK_VISUAL_TYPES:
|
|
52
|
+
errors.append(f"meta.visual_type: {meta.get('visual_type')!r} is not one of {_FALLBACK_VISUAL_TYPES}")
|
|
53
|
+
if meta.get("fallback_type") not in _FALLBACK_FALLBACK_TYPES:
|
|
54
|
+
errors.append(f"meta.fallback_type: {meta.get('fallback_type')!r} is not one of {_FALLBACK_FALLBACK_TYPES}")
|
|
55
|
+
params = dsl_dict.get("parameters")
|
|
56
|
+
if params is not None and not isinstance(params, dict):
|
|
57
|
+
errors.append("parameters must be an object")
|
|
58
|
+
elif isinstance(params, dict):
|
|
59
|
+
for key, val in params.items():
|
|
60
|
+
if not isinstance(val, dict):
|
|
61
|
+
errors.append(f"parameters.{key}: must be an object")
|
|
62
|
+
continue
|
|
63
|
+
for sub in ("label", "value", "unit"):
|
|
64
|
+
if sub not in val:
|
|
65
|
+
errors.append(f"parameters.{key}: missing required property: {sub}")
|
|
66
|
+
entities = dsl_dict.get("entities")
|
|
67
|
+
if entities is not None and not isinstance(entities, list):
|
|
68
|
+
errors.append("entities must be an array")
|
|
69
|
+
elif isinstance(entities, list):
|
|
70
|
+
for i, ent in enumerate(entities):
|
|
71
|
+
if not isinstance(ent, dict):
|
|
72
|
+
errors.append(f"entities[{i}]: must be an object")
|
|
73
|
+
continue
|
|
74
|
+
for sub in ("id", "type", "label", "properties"):
|
|
75
|
+
if sub not in ent:
|
|
76
|
+
errors.append(f"entities[{i}]: missing required property: {sub}")
|
|
77
|
+
pipeline = dsl_dict.get("pipeline")
|
|
78
|
+
if pipeline is not None and not isinstance(pipeline, list):
|
|
79
|
+
errors.append("pipeline must be an array")
|
|
80
|
+
elif isinstance(pipeline, list):
|
|
81
|
+
for i, step in enumerate(pipeline):
|
|
82
|
+
if not isinstance(step, dict):
|
|
83
|
+
errors.append(f"pipeline[{i}]: must be an object")
|
|
84
|
+
continue
|
|
85
|
+
for sub in ("step", "title", "formula", "eval", "result_unit", "visual_state"):
|
|
86
|
+
if sub not in step:
|
|
87
|
+
errors.append(f"pipeline[{i}]: missing required property: {sub}")
|
|
88
|
+
vs = step.get("visual_state")
|
|
89
|
+
if vs is not None and isinstance(vs, dict):
|
|
90
|
+
for sub in ("progress_range", "active_entities", "action"):
|
|
91
|
+
if sub not in vs:
|
|
92
|
+
errors.append(f"pipeline[{i}].visual_state: missing required property: {sub}")
|
|
93
|
+
pr = vs.get("progress_range")
|
|
94
|
+
if pr is not None and (not isinstance(pr, list) or len(pr) != 2):
|
|
95
|
+
errors.append(f"pipeline[{i}].visual_state.progress_range: must be a 2-item array")
|
|
96
|
+
return errors
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@dataclass
|
|
100
|
+
class ParsedDSL:
|
|
101
|
+
thinking: str | None = None
|
|
102
|
+
dsl: dict | None = None
|
|
103
|
+
valid: bool = False
|
|
104
|
+
errors: list[str] = field(default_factory=list)
|
|
105
|
+
visual_type: str = _FALLBACK_VISUAL_TYPE
|
|
106
|
+
fallback_type: str = "flow_card"
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def parse_dsl_json(dsl_str: str) -> tuple[dict | None, list[str]]:
|
|
110
|
+
if not dsl_str or not dsl_str.strip():
|
|
111
|
+
return None, ["empty dsl string"]
|
|
112
|
+
try:
|
|
113
|
+
parsed = json.loads(dsl_str)
|
|
114
|
+
except json.JSONDecodeError as exc:
|
|
115
|
+
logger.debug("dsl json parse fail: %s", exc)
|
|
116
|
+
return None, [f"json parse error: {exc}"]
|
|
117
|
+
if not isinstance(parsed, dict):
|
|
118
|
+
return None, [f"expected dict, got {type(parsed).__name__}"]
|
|
119
|
+
try:
|
|
120
|
+
from fusion_core.dsl_schema import validate_dsl_str
|
|
121
|
+
|
|
122
|
+
ok, err = validate_dsl_str(dsl_str)
|
|
123
|
+
if not ok:
|
|
124
|
+
return None, [f"schema violation: {err}"]
|
|
125
|
+
except ImportError:
|
|
126
|
+
# #63 CI: fusion_core is a monorepo sibling, not on PyPI — validate
|
|
127
|
+
# with the in-repo fallback instead of silently accepting anything.
|
|
128
|
+
errors = _fallback_validate_dsl(parsed)
|
|
129
|
+
if errors:
|
|
130
|
+
return None, [f"schema violation: {'; '.join(errors)}"]
|
|
131
|
+
logger.debug("validated with in-repo fallback validator (fusion_core absent)")
|
|
132
|
+
except Exception as exc:
|
|
133
|
+
logger.warning("dsl schema validation error: %s", exc)
|
|
134
|
+
return None, [f"schema validation error: {exc}"]
|
|
135
|
+
return parsed, []
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def validate_dsl_object(dsl_dict: dict) -> list[str]:
|
|
139
|
+
# Issue #124: schema-validate a caller-supplied DSL dict (the render.visual
|
|
140
|
+
# dsl-object path). Mirrors parse_dsl_json: fusion_core first, in-repo
|
|
141
|
+
# fallback validator when the sibling package is absent. Returns error
|
|
142
|
+
# strings; empty list = valid.
|
|
143
|
+
if not isinstance(dsl_dict, dict):
|
|
144
|
+
return ["invalid dsl dict"]
|
|
145
|
+
try:
|
|
146
|
+
from fusion_core.dsl_schema import validate_dsl_str
|
|
147
|
+
|
|
148
|
+
ok, err = validate_dsl_str(json.dumps(dsl_dict))
|
|
149
|
+
if not ok:
|
|
150
|
+
return [f"schema violation: {err}"]
|
|
151
|
+
return []
|
|
152
|
+
except ImportError:
|
|
153
|
+
# #63 CI: fusion_core is a monorepo sibling, not on PyPI — validate
|
|
154
|
+
# with the in-repo fallback instead of silently accepting anything.
|
|
155
|
+
return _fallback_validate_dsl(dsl_dict)
|
|
156
|
+
except Exception as exc:
|
|
157
|
+
logger.warning("dsl schema validation error: %s", exc)
|
|
158
|
+
return [f"schema validation error: {exc}"]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def extract_visual_type(dsl_dict: dict | None) -> str:
|
|
162
|
+
if not isinstance(dsl_dict, dict):
|
|
163
|
+
return _FALLBACK_VISUAL_TYPE
|
|
164
|
+
meta = dsl_dict.get("meta") or {}
|
|
165
|
+
if not isinstance(meta, dict):
|
|
166
|
+
return _FALLBACK_VISUAL_TYPE
|
|
167
|
+
vt = meta.get("visual_type")
|
|
168
|
+
if isinstance(vt, str) and vt:
|
|
169
|
+
return vt
|
|
170
|
+
ft = meta.get("fallback_type")
|
|
171
|
+
if isinstance(ft, str) and ft:
|
|
172
|
+
return ft
|
|
173
|
+
return _FALLBACK_VISUAL_TYPE
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def get_pipeline_progress(dsl_dict: dict | None) -> list[tuple[float, float]]:
|
|
177
|
+
if not isinstance(dsl_dict, dict):
|
|
178
|
+
return []
|
|
179
|
+
pipeline = dsl_dict.get("pipeline") or []
|
|
180
|
+
if not isinstance(pipeline, list):
|
|
181
|
+
return []
|
|
182
|
+
ranges: list[tuple[float, float]] = []
|
|
183
|
+
for step in pipeline:
|
|
184
|
+
if not isinstance(step, dict):
|
|
185
|
+
continue
|
|
186
|
+
vs = step.get("visual_state") or {}
|
|
187
|
+
if not isinstance(vs, dict):
|
|
188
|
+
continue
|
|
189
|
+
pr = vs.get("progress_range")
|
|
190
|
+
if isinstance(pr, list) and len(pr) == 2:
|
|
191
|
+
try:
|
|
192
|
+
ranges.append((float(pr[0]), float(pr[1])))
|
|
193
|
+
except (TypeError, ValueError):
|
|
194
|
+
ranges.append((0.0, 1.0))
|
|
195
|
+
else:
|
|
196
|
+
ranges.append((0.0, 1.0))
|
|
197
|
+
return ranges
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def parse_model_output(raw_text: str) -> ParsedDSL:
|
|
201
|
+
if not raw_text or not raw_text.strip():
|
|
202
|
+
return ParsedDSL(errors=["empty input"])
|
|
203
|
+
thinking_match = _THINKING_RE.search(raw_text)
|
|
204
|
+
thinking = thinking_match.group(1).strip() if thinking_match else None
|
|
205
|
+
if thinking is None:
|
|
206
|
+
logger.debug("no <thinking> tag found in model output")
|
|
207
|
+
dsl_match = _DSL_RE.search(raw_text)
|
|
208
|
+
if dsl_match is None:
|
|
209
|
+
return ParsedDSL(thinking=thinking, errors=["missing dsl tag"])
|
|
210
|
+
dsl_str = dsl_match.group(1).strip()
|
|
211
|
+
dsl_dict, errors = parse_dsl_json(dsl_str)
|
|
212
|
+
if dsl_dict is None:
|
|
213
|
+
return ParsedDSL(thinking=thinking, errors=errors)
|
|
214
|
+
visual_type = extract_visual_type(dsl_dict)
|
|
215
|
+
meta = dsl_dict.get("meta") or {}
|
|
216
|
+
fallback_type = meta.get("fallback_type") or "flow_card"
|
|
217
|
+
parsed = ParsedDSL(
|
|
218
|
+
thinking=thinking,
|
|
219
|
+
dsl=dsl_dict,
|
|
220
|
+
valid=True,
|
|
221
|
+
errors=[],
|
|
222
|
+
visual_type=visual_type,
|
|
223
|
+
fallback_type=fallback_type,
|
|
224
|
+
)
|
|
225
|
+
logger.info(
|
|
226
|
+
"parsed DSL: valid=%s visual_type=%s fallback_type=%s",
|
|
227
|
+
parsed.valid,
|
|
228
|
+
visual_type,
|
|
229
|
+
fallback_type,
|
|
230
|
+
)
|
|
231
|
+
return parsed
|