@walkeros/explorer 2.1.0 → 2.1.2

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.
Files changed (96) hide show
  1. package/AGENT.md +19 -0
  2. package/STYLE.md +6 -0
  3. package/dist/chunk-3TPAJIVM.mjs +580 -0
  4. package/dist/chunk-3TPAJIVM.mjs.map +1 -0
  5. package/dist/components/atoms/button-link.stories.d.ts +1 -3
  6. package/dist/components/atoms/button-link.stories.d.ts.map +1 -1
  7. package/dist/components/atoms/button-link.stories.js +1 -15
  8. package/dist/components/atoms/button-link.stories.js.map +1 -1
  9. package/dist/components/atoms/code.d.ts +29 -1
  10. package/dist/components/atoms/code.d.ts.map +1 -1
  11. package/dist/components/atoms/code.js +76 -8
  12. package/dist/components/atoms/code.js.map +1 -1
  13. package/dist/components/atoms/code.stories.d.ts +0 -7
  14. package/dist/components/atoms/code.stories.d.ts.map +1 -1
  15. package/dist/components/atoms/code.stories.js +0 -34
  16. package/dist/components/atoms/code.stories.js.map +1 -1
  17. package/dist/components/molecules/code-box.d.ts +6 -1
  18. package/dist/components/molecules/code-box.d.ts.map +1 -1
  19. package/dist/components/molecules/code-box.js +53 -3
  20. package/dist/components/molecules/code-box.js.map +1 -1
  21. package/dist/components/molecules/code-box.stories.d.ts +45 -9
  22. package/dist/components/molecules/code-box.stories.d.ts.map +1 -1
  23. package/dist/components/molecules/code-box.stories.js +106 -45
  24. package/dist/components/molecules/code-box.stories.js.map +1 -1
  25. package/dist/components/molecules/code-snippet.stories.d.ts +0 -8
  26. package/dist/components/molecules/code-snippet.stories.d.ts.map +1 -1
  27. package/dist/components/molecules/code-snippet.stories.js +0 -19
  28. package/dist/components/molecules/code-snippet.stories.js.map +1 -1
  29. package/dist/components/molecules/flow-map/FlowMap.stories.d.ts +0 -32
  30. package/dist/components/molecules/flow-map/FlowMap.stories.d.ts.map +1 -1
  31. package/dist/components/molecules/flow-map/FlowMap.stories.js +0 -330
  32. package/dist/components/molecules/flow-map/FlowMap.stories.js.map +1 -1
  33. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.d.ts +0 -16
  34. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.d.ts.map +1 -1
  35. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.js +0 -78
  36. package/dist/components/molecules/flow-map/FlowMap.transformers.stories.js.map +1 -1
  37. package/dist/components/molecules/preview.d.ts.map +1 -1
  38. package/dist/components/molecules/preview.js +32 -22
  39. package/dist/components/molecules/preview.js.map +1 -1
  40. package/dist/index.d.cts +191 -3
  41. package/dist/index.d.ts +9 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +11 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +1059 -43
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/{monaco-types-OLSF6MIE.mjs → monaco-types-7HYTHECU.mjs} +2 -2
  48. package/dist/styles.css +31 -0
  49. package/dist/types/intellisense.d.ts +31 -0
  50. package/dist/types/intellisense.d.ts.map +1 -0
  51. package/dist/types/intellisense.js +2 -0
  52. package/dist/types/intellisense.js.map +1 -0
  53. package/dist/utils/monaco-intellisense-flow-extractor.d.ts +13 -0
  54. package/dist/utils/monaco-intellisense-flow-extractor.d.ts.map +1 -0
  55. package/dist/utils/monaco-intellisense-flow-extractor.js +161 -0
  56. package/dist/utils/monaco-intellisense-flow-extractor.js.map +1 -0
  57. package/dist/utils/monaco-json-schema.d.ts +11 -0
  58. package/dist/utils/monaco-json-schema.d.ts.map +1 -1
  59. package/dist/utils/monaco-json-schema.js +13 -3
  60. package/dist/utils/monaco-json-schema.js.map +1 -1
  61. package/dist/utils/monaco-schema-contract.d.ts +8 -0
  62. package/dist/utils/monaco-schema-contract.d.ts.map +1 -0
  63. package/dist/utils/monaco-schema-contract.js +73 -0
  64. package/dist/utils/monaco-schema-contract.js.map +1 -0
  65. package/dist/utils/monaco-schema-enrichment.d.ts +26 -0
  66. package/dist/utils/monaco-schema-enrichment.d.ts.map +1 -0
  67. package/dist/utils/monaco-schema-enrichment.js +31 -0
  68. package/dist/utils/monaco-schema-enrichment.js.map +1 -0
  69. package/dist/utils/monaco-schema-flow-setup.d.ts +10 -0
  70. package/dist/utils/monaco-schema-flow-setup.d.ts.map +1 -0
  71. package/dist/utils/monaco-schema-flow-setup.js +201 -0
  72. package/dist/utils/monaco-schema-flow-setup.js.map +1 -0
  73. package/dist/utils/monaco-schema-variables.d.ts +4 -0
  74. package/dist/utils/monaco-schema-variables.d.ts.map +1 -0
  75. package/dist/utils/monaco-schema-variables.js +26 -0
  76. package/dist/utils/monaco-schema-variables.js.map +1 -0
  77. package/dist/utils/monaco-walkeros-completions.d.ts +15 -0
  78. package/dist/utils/monaco-walkeros-completions.d.ts.map +1 -0
  79. package/dist/utils/monaco-walkeros-completions.js +65 -0
  80. package/dist/utils/monaco-walkeros-completions.js.map +1 -0
  81. package/dist/utils/monaco-walkeros-decorations.d.ts +29 -0
  82. package/dist/utils/monaco-walkeros-decorations.d.ts.map +1 -0
  83. package/dist/utils/monaco-walkeros-decorations.js +87 -0
  84. package/dist/utils/monaco-walkeros-decorations.js.map +1 -0
  85. package/dist/utils/monaco-walkeros-markers.d.ts +13 -0
  86. package/dist/utils/monaco-walkeros-markers.d.ts.map +1 -0
  87. package/dist/utils/monaco-walkeros-markers.js +69 -0
  88. package/dist/utils/monaco-walkeros-markers.js.map +1 -0
  89. package/dist/utils/monaco-walkeros-providers.d.ts +19 -0
  90. package/dist/utils/monaco-walkeros-providers.d.ts.map +1 -0
  91. package/dist/utils/monaco-walkeros-providers.js +229 -0
  92. package/dist/utils/monaco-walkeros-providers.js.map +1 -0
  93. package/package.json +1 -1
  94. package/dist/chunk-YKT4D7MG.mjs +0 -3087
  95. package/dist/chunk-YKT4D7MG.mjs.map +0 -1
  96. /package/dist/{monaco-types-OLSF6MIE.mjs.map → monaco-types-7HYTHECU.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  "use client"
2
2
  import {
3
+ __require,
3
4
  addFunctionContextTypes,
4
5
  initializeMonacoTypes,
5
6
  loadPackageTypes,
6
7
  loadTypeLibraryFromURL,
7
8
  registerWalkerOSTypes
8
- } from "./chunk-YKT4D7MG.mjs";
9
+ } from "./chunk-3TPAJIVM.mjs";
9
10
 
10
11
  // src/components/demos/MappingDemo.tsx
11
12
  import { useState as useState6, useCallback as useCallback5, useEffect as useEffect5 } from "react";
@@ -646,6 +647,348 @@ function registerDataElbStyles() {
646
647
  document.head.appendChild(style);
647
648
  }
648
649
 
650
+ // src/utils/monaco-walkeros-decorations.ts
651
+ var REFERENCE_PATTERNS = [
652
+ { type: "variable", regex: /\$var\.(\w*)/g, className: "elb-ref-variable" },
653
+ {
654
+ type: "definition",
655
+ regex: /\$def\.(\w*)/g,
656
+ className: "elb-ref-definition"
657
+ },
658
+ { type: "secret", regex: /\$secret\.(\w*)/g, className: "elb-ref-secret" },
659
+ { type: "env", regex: /\$env\.(\w*)/g, className: "elb-ref-env" },
660
+ { type: "code", regex: /\$code:/g, className: "elb-ref-code" }
661
+ ];
662
+ function findWalkerOSReferences(text) {
663
+ const references = [];
664
+ for (const pattern of REFERENCE_PATTERNS) {
665
+ const regex2 = new RegExp(pattern.regex.source, pattern.regex.flags);
666
+ let match;
667
+ while ((match = regex2.exec(text)) !== null) {
668
+ references.push({
669
+ type: pattern.type,
670
+ name: pattern.type === "code" ? "" : match[1] || "",
671
+ startIndex: match.index,
672
+ endIndex: match.index + match[0].length
673
+ });
674
+ }
675
+ }
676
+ return references;
677
+ }
678
+ function applyWalkerOSDecorations(editorInstance) {
679
+ let decorationIds = [];
680
+ function update() {
681
+ const model = editorInstance.getModel();
682
+ if (!model) return;
683
+ const text = model.getValue();
684
+ const references = findWalkerOSReferences(text);
685
+ const decorations = references.map(
686
+ (ref) => {
687
+ const startPos = model.getPositionAt(ref.startIndex);
688
+ const endPos = model.getPositionAt(ref.endIndex);
689
+ const pattern = REFERENCE_PATTERNS.find((p) => p.type === ref.type);
690
+ return {
691
+ range: {
692
+ startLineNumber: startPos.lineNumber,
693
+ startColumn: startPos.column,
694
+ endLineNumber: endPos.lineNumber,
695
+ endColumn: endPos.column
696
+ },
697
+ options: { inlineClassName: pattern.className }
698
+ };
699
+ }
700
+ );
701
+ decorationIds = editorInstance.deltaDecorations(decorationIds, decorations);
702
+ }
703
+ update();
704
+ const disposable = editorInstance.onDidChangeModelContent(() => update());
705
+ return () => {
706
+ disposable.dispose();
707
+ editorInstance.deltaDecorations(decorationIds, []);
708
+ };
709
+ }
710
+ function registerWalkerOSDecorationStyles() {
711
+ if (typeof document === "undefined") return;
712
+ if (document.getElementById("walkeros-ref-styles")) return;
713
+ const style = document.createElement("style");
714
+ style.id = "walkeros-ref-styles";
715
+ style.textContent = `
716
+ .monaco-editor .elb-ref-variable { color: #89ddff !important; font-style: italic; }
717
+ .monaco-editor .elb-ref-definition { color: #c3e88d !important; font-style: italic; }
718
+ .monaco-editor .elb-ref-secret { color: #ffcb6b !important; font-style: italic; }
719
+ .monaco-editor .elb-ref-env { color: #ffcb6b !important; font-style: italic; }
720
+ .monaco-editor .elb-ref-code { color: #c084fc !important; }
721
+ `;
722
+ document.head.appendChild(style);
723
+ }
724
+
725
+ // src/utils/monaco-walkeros-completions.ts
726
+ function getVariableCompletions(variables) {
727
+ if (!variables || Object.keys(variables).length === 0) return [];
728
+ return Object.entries(variables).map(([name, value]) => ({
729
+ label: `$var.${name}`,
730
+ insertText: `$var.${name}`,
731
+ detail: `= ${JSON.stringify(value)}`,
732
+ documentation: `Variable reference. Resolves to \`${JSON.stringify(value)}\` at runtime.`,
733
+ kind: "variable",
734
+ sortText: "0_var_" + name
735
+ }));
736
+ }
737
+ function getDefinitionCompletions(definitions) {
738
+ if (!definitions || Object.keys(definitions).length === 0) return [];
739
+ return Object.keys(definitions).map((name) => ({
740
+ label: `$def.${name}`,
741
+ insertText: `$def.${name}`,
742
+ detail: "(definition)",
743
+ documentation: `Definition reference. Injects the reusable config fragment "${name}" at runtime.`,
744
+ kind: "reference",
745
+ sortText: "0_def_" + name
746
+ }));
747
+ }
748
+ function getSecretCompletions(secrets) {
749
+ if (!secrets || secrets.length === 0) return [];
750
+ return secrets.map((name) => ({
751
+ label: `$secret.${name}`,
752
+ insertText: `$secret.${name}`,
753
+ detail: "(secret)",
754
+ documentation: "Secret reference. Value is securely injected at runtime. Never stored in config.",
755
+ kind: "secret",
756
+ sortText: "0_secret_" + name
757
+ }));
758
+ }
759
+ function getPackageCompletions(packages, platform) {
760
+ if (!packages || packages.length === 0) return [];
761
+ const filtered = platform ? packages.filter((p) => p.platform === platform) : packages;
762
+ return filtered.map((pkg) => ({
763
+ label: pkg.package,
764
+ insertText: pkg.package,
765
+ detail: `${pkg.type} (${pkg.platform})`,
766
+ documentation: `walkerOS ${pkg.type}: ${pkg.shortName}`,
767
+ kind: "module",
768
+ sortText: "1_pkg_" + pkg.shortName
769
+ }));
770
+ }
771
+ function getStepNameCompletions(stepNames, context) {
772
+ if (!stepNames) return [];
773
+ const names = stepNames.transformers || [];
774
+ return names.map((name) => ({
775
+ label: name,
776
+ insertText: name,
777
+ detail: `transformer (${context} chain)`,
778
+ documentation: `Reference to transformer step "${name}" in this flow config.`,
779
+ kind: "reference",
780
+ sortText: "0_step_" + name
781
+ }));
782
+ }
783
+
784
+ // src/utils/monaco-walkeros-providers.ts
785
+ var contextRegistry = /* @__PURE__ */ new Map();
786
+ var disposables = [];
787
+ var registered = false;
788
+ function setIntelliSenseContext(modelPath, context) {
789
+ contextRegistry.set(modelPath, context);
790
+ }
791
+ function removeIntelliSenseContext(modelPath) {
792
+ contextRegistry.delete(modelPath);
793
+ }
794
+ function registerWalkerOSProviders(monaco) {
795
+ if (registered) return;
796
+ registered = true;
797
+ disposables.push(
798
+ monaco.languages.registerCompletionItemProvider("json", {
799
+ triggerCharacters: ['"', ".", "$"],
800
+ provideCompletionItems(model, position) {
801
+ const modelPath = model.uri.toString();
802
+ const context = contextRegistry.get(modelPath);
803
+ if (!context) return { suggestions: [] };
804
+ const lineContent = model.getLineContent(position.lineNumber);
805
+ const textBeforeCursor = lineContent.substring(0, position.column - 1);
806
+ const entries = [];
807
+ if (textBeforeCursor.includes("$var.") || textBeforeCursor.endsWith('"$var')) {
808
+ entries.push(...getVariableCompletions(context.variables));
809
+ } else if (textBeforeCursor.includes("$def.") || textBeforeCursor.endsWith('"$def')) {
810
+ entries.push(...getDefinitionCompletions(context.definitions));
811
+ } else if (textBeforeCursor.includes("$secret.") || textBeforeCursor.endsWith('"$secret')) {
812
+ entries.push(...getSecretCompletions(context.secrets));
813
+ } else if (isInsideKey(model, position, "package")) {
814
+ entries.push(
815
+ ...getPackageCompletions(context.packages, context.platform)
816
+ );
817
+ } else if (isInsideKey(model, position, "next") || isInsideKey(model, position, "before")) {
818
+ const key = isInsideKey(model, position, "next") ? "next" : "before";
819
+ entries.push(...getStepNameCompletions(context.stepNames, key));
820
+ } else if (textBeforeCursor.endsWith('"$') || textBeforeCursor.endsWith('"')) {
821
+ entries.push(...getVariableCompletions(context.variables));
822
+ entries.push(...getDefinitionCompletions(context.definitions));
823
+ entries.push(...getSecretCompletions(context.secrets));
824
+ }
825
+ const refStartMatch = textBeforeCursor.match(
826
+ /\$(?:var|def|secret|env|code)[.:]?\w*$/
827
+ );
828
+ const word = model.getWordUntilPosition(position);
829
+ const startCol = refStartMatch ? position.column - refStartMatch[0].length : word.startColumn;
830
+ const range = {
831
+ startLineNumber: position.lineNumber,
832
+ endLineNumber: position.lineNumber,
833
+ startColumn: startCol,
834
+ endColumn: position.column
835
+ };
836
+ return {
837
+ suggestions: entries.map((entry) => ({
838
+ label: entry.label,
839
+ insertText: entry.insertText,
840
+ detail: entry.detail,
841
+ documentation: entry.documentation,
842
+ kind: mapCompletionKind(monaco, entry.kind),
843
+ sortText: entry.sortText,
844
+ range
845
+ }))
846
+ };
847
+ }
848
+ })
849
+ );
850
+ disposables.push(
851
+ monaco.languages.registerHoverProvider("json", {
852
+ provideHover(model, position) {
853
+ const modelPath = model.uri.toString();
854
+ const context = contextRegistry.get(modelPath);
855
+ if (!context) return null;
856
+ const lineContent = model.getLineContent(position.lineNumber);
857
+ const col = position.column - 1;
858
+ function matchAtCursor(pattern) {
859
+ const regex2 = new RegExp(pattern.source, "g");
860
+ let m;
861
+ while ((m = regex2.exec(lineContent)) !== null) {
862
+ if (col >= m.index && col <= m.index + m[0].length) return m;
863
+ }
864
+ return null;
865
+ }
866
+ const varMatch = matchAtCursor(/\$var\.(\w+)/);
867
+ if (varMatch && context.variables) {
868
+ const name = varMatch[1];
869
+ if (name in context.variables) {
870
+ const value = context.variables[name];
871
+ return {
872
+ range: {
873
+ startLineNumber: position.lineNumber,
874
+ startColumn: varMatch.index + 1,
875
+ endLineNumber: position.lineNumber,
876
+ endColumn: varMatch.index + varMatch[0].length + 1
877
+ },
878
+ contents: [
879
+ {
880
+ value: `**Variable:** \`$var.${name}\`
881
+
882
+ **Value:** \`${JSON.stringify(value)}\`
883
+
884
+ *Resolved at runtime via variable interpolation*`
885
+ }
886
+ ]
887
+ };
888
+ }
889
+ return {
890
+ contents: [
891
+ {
892
+ value: `**Unknown variable** \`$var.${name}\`
893
+
894
+ Defined variables: ${Object.keys(context.variables).join(", ") || "none"}`
895
+ }
896
+ ]
897
+ };
898
+ }
899
+ const defMatch = matchAtCursor(/\$def\.(\w+)/);
900
+ if (defMatch && context.definitions) {
901
+ const name = defMatch[1];
902
+ if (name in context.definitions) {
903
+ return {
904
+ range: {
905
+ startLineNumber: position.lineNumber,
906
+ startColumn: defMatch.index + 1,
907
+ endLineNumber: position.lineNumber,
908
+ endColumn: defMatch.index + defMatch[0].length + 1
909
+ },
910
+ contents: [
911
+ {
912
+ value: `**Definition:** \`$def.${name}\`
913
+
914
+ *Injects reusable config fragment at runtime*`
915
+ }
916
+ ]
917
+ };
918
+ }
919
+ return {
920
+ contents: [
921
+ {
922
+ value: `**Unknown definition** \`$def.${name}\`
923
+
924
+ Defined: ${Object.keys(context.definitions).join(", ") || "none"}`
925
+ }
926
+ ]
927
+ };
928
+ }
929
+ const secretMatch = matchAtCursor(/\$secret\.(\w+)/);
930
+ if (secretMatch) {
931
+ const name = secretMatch[1];
932
+ if (context.secrets?.includes(name)) {
933
+ return {
934
+ range: {
935
+ startLineNumber: position.lineNumber,
936
+ startColumn: secretMatch.index + 1,
937
+ endLineNumber: position.lineNumber,
938
+ endColumn: secretMatch.index + secretMatch[0].length + 1
939
+ },
940
+ contents: [
941
+ {
942
+ value: `**Secret:** \`$secret.${name}\`
943
+
944
+ *Securely injected at runtime. Value not stored in config.*`
945
+ }
946
+ ]
947
+ };
948
+ }
949
+ return {
950
+ contents: [
951
+ {
952
+ value: `**Unknown secret** \`$secret.${name}\`
953
+
954
+ Available secrets: ${context.secrets?.join(", ") || "none"}`
955
+ }
956
+ ]
957
+ };
958
+ }
959
+ return null;
960
+ }
961
+ })
962
+ );
963
+ }
964
+ function disposeWalkerOSProviders() {
965
+ for (const d of disposables) d.dispose();
966
+ disposables.length = 0;
967
+ registered = false;
968
+ contextRegistry.clear();
969
+ }
970
+ function mapCompletionKind(monaco, kind) {
971
+ switch (kind) {
972
+ case "variable":
973
+ return monaco.languages.CompletionItemKind.Variable;
974
+ case "reference":
975
+ return monaco.languages.CompletionItemKind.Reference;
976
+ case "secret":
977
+ return monaco.languages.CompletionItemKind.Constant;
978
+ case "module":
979
+ return monaco.languages.CompletionItemKind.Module;
980
+ case "property":
981
+ return monaco.languages.CompletionItemKind.Property;
982
+ default:
983
+ return monaco.languages.CompletionItemKind.Text;
984
+ }
985
+ }
986
+ function isInsideKey(model, position, key) {
987
+ const lineContent = model.getLineContent(position.lineNumber);
988
+ const pattern = new RegExp(`"${key}"\\s*:\\s*"`);
989
+ return pattern.test(lineContent);
990
+ }
991
+
649
992
  // src/utils/monaco-formatters.ts
650
993
  import * as prettier from "prettier/standalone";
651
994
  import prettierBabel from "prettier/plugins/babel";
@@ -771,9 +1114,15 @@ function registerFormatters(monacoInstance) {
771
1114
  }
772
1115
 
773
1116
  // src/utils/monaco-json-schema.ts
774
- import { json } from "monaco-editor";
775
1117
  var schemaRegistry = /* @__PURE__ */ new Map();
776
1118
  var idCounter = 0;
1119
+ var _json;
1120
+ function getJson() {
1121
+ if (!_json) {
1122
+ _json = __require("monaco-editor").json;
1123
+ }
1124
+ return _json;
1125
+ }
777
1126
  function generateModelPath() {
778
1127
  return `inmemory://walkeros/json-${++idCounter}.json`;
779
1128
  }
@@ -790,7 +1139,7 @@ function unregisterJsonSchema(modelPath) {
790
1139
  applySchemas();
791
1140
  }
792
1141
  function applySchemas() {
793
- json.jsonDefaults.setDiagnosticsOptions({
1142
+ getJson().jsonDefaults.setDiagnosticsOptions({
794
1143
  validate: true,
795
1144
  schemaValidation: "error",
796
1145
  schemaRequest: "ignore",
@@ -886,11 +1235,14 @@ function Code({
886
1235
  packages,
887
1236
  sticky = true,
888
1237
  ide = false,
889
- jsonSchema
1238
+ jsonSchema,
1239
+ intellisenseContext,
1240
+ validate,
1241
+ onMarkerCounts
890
1242
  }) {
891
1243
  const [isMounted, setIsMounted] = useState3(false);
892
1244
  const [monacoTheme, setMonacoTheme] = useState3("vs-light");
893
- const decorationsCleanupRef = useRef3(null);
1245
+ const decorationsCleanupRef = useRef3([]);
894
1246
  const monacoRef = useRef3(null);
895
1247
  const editorRef = useRef3(null);
896
1248
  const containerRef = useRef3(null);
@@ -979,7 +1331,13 @@ function Code({
979
1331
  };
980
1332
  }, []);
981
1333
  const modelPathRef = useRef3(null);
982
- if (jsonSchema && !modelPathRef.current) {
1334
+ const intellisenseContextRef = useRef3(intellisenseContext);
1335
+ intellisenseContextRef.current = intellisenseContext;
1336
+ const validateRef = useRef3(validate);
1337
+ validateRef.current = validate;
1338
+ const onMarkerCountsRef = useRef3(onMarkerCounts);
1339
+ onMarkerCountsRef.current = onMarkerCounts;
1340
+ if ((jsonSchema || intellisenseContext) && !modelPathRef.current) {
983
1341
  modelPathRef.current = generateModelPath();
984
1342
  }
985
1343
  useEffect2(() => {
@@ -991,6 +1349,16 @@ function Code({
991
1349
  }
992
1350
  };
993
1351
  }, [jsonSchema]);
1352
+ useEffect2(() => {
1353
+ if (intellisenseContext && modelPathRef.current) {
1354
+ setIntelliSenseContext(modelPathRef.current, intellisenseContext);
1355
+ return () => {
1356
+ if (modelPathRef.current) {
1357
+ removeIntelliSenseContext(modelPathRef.current);
1358
+ }
1359
+ };
1360
+ }
1361
+ }, [intellisenseContext]);
994
1362
  const handleChange = (value) => {
995
1363
  if (onChange && value !== void 0) {
996
1364
  onChange(value);
@@ -1002,7 +1370,7 @@ function Code({
1002
1370
  registerFormatters(monaco);
1003
1371
  if (packages && packages.length > 0) {
1004
1372
  registerWalkerOSTypes(monaco);
1005
- const { loadPackageTypes: loadPackageTypes2 } = await import("./monaco-types-OLSF6MIE.mjs");
1373
+ const { loadPackageTypes: loadPackageTypes2 } = await import("./monaco-types-7HYTHECU.mjs");
1006
1374
  for (const pkg of packages) {
1007
1375
  if (pkg !== "@walkeros/core") {
1008
1376
  await loadPackageTypes2(monaco, { package: pkg }).catch(() => {
@@ -1014,6 +1382,9 @@ function Code({
1014
1382
  const isDark = dataTheme === "dark" || dataTheme === null && window.matchMedia("(prefers-color-scheme: dark)").matches;
1015
1383
  const themeName = isDark ? "elbTheme-dark" : "elbTheme-light";
1016
1384
  monaco.editor.setTheme(themeName);
1385
+ if (language === "json") {
1386
+ registerWalkerOSProviders(monaco);
1387
+ }
1017
1388
  if (beforeMount) {
1018
1389
  beforeMount(monaco);
1019
1390
  }
@@ -1025,11 +1396,54 @@ function Code({
1025
1396
  registerEditor(monacoEditor);
1026
1397
  }
1027
1398
  if (language === "html" && monacoRef.current) {
1028
- decorationsCleanupRef.current = applyDataElbDecorations(
1029
- monacoEditor,
1030
- monacoRef.current
1399
+ decorationsCleanupRef.current.push(
1400
+ applyDataElbDecorations(monacoEditor, monacoRef.current)
1031
1401
  );
1032
1402
  }
1403
+ if (language === "json") {
1404
+ registerWalkerOSDecorationStyles();
1405
+ decorationsCleanupRef.current.push(
1406
+ applyWalkerOSDecorations(monacoEditor)
1407
+ );
1408
+ }
1409
+ if (validateRef.current && monacoRef.current) {
1410
+ const monacoInstance = monacoRef.current;
1411
+ let validateTimer;
1412
+ const runValidation = () => {
1413
+ const model = monacoEditor.getModel();
1414
+ if (!model) return;
1415
+ const text = model.getValue();
1416
+ const fn = validateRef.current;
1417
+ if (!fn) return;
1418
+ const result = fn(text);
1419
+ const allIssues = [...result.errors, ...result.warnings];
1420
+ monacoInstance.editor.setModelMarkers(
1421
+ model,
1422
+ "validate",
1423
+ allIssues.map((issue) => ({
1424
+ severity: issue.severity === "error" ? 8 : 4,
1425
+ message: issue.message,
1426
+ startLineNumber: issue.line,
1427
+ startColumn: issue.column,
1428
+ endLineNumber: issue.endLine ?? issue.line,
1429
+ endColumn: issue.endColumn ?? issue.column + 1
1430
+ }))
1431
+ );
1432
+ onMarkerCountsRef.current?.({
1433
+ errors: result.errors.length,
1434
+ warnings: result.warnings.length
1435
+ });
1436
+ };
1437
+ runValidation();
1438
+ const validateDisposable = monacoEditor.onDidChangeModelContent(() => {
1439
+ clearTimeout(validateTimer);
1440
+ validateTimer = setTimeout(runValidation, 300);
1441
+ });
1442
+ decorationsCleanupRef.current.push(() => {
1443
+ clearTimeout(validateTimer);
1444
+ validateDisposable.dispose();
1445
+ });
1446
+ }
1033
1447
  requestAnimationFrame(() => {
1034
1448
  monacoEditor.layout();
1035
1449
  });
@@ -1039,9 +1453,10 @@ function Code({
1039
1453
  };
1040
1454
  useEffect2(() => {
1041
1455
  return () => {
1042
- if (decorationsCleanupRef.current) {
1043
- decorationsCleanupRef.current();
1456
+ for (const cleanup of decorationsCleanupRef.current) {
1457
+ cleanup();
1044
1458
  }
1459
+ decorationsCleanupRef.current = [];
1045
1460
  };
1046
1461
  }, []);
1047
1462
  const monacoHeight = autoHeight || gridContext?.enabled ? `${calculatedHeight}px` : "100%";
@@ -1081,7 +1496,7 @@ function Code({
1081
1496
  overviewRulerLanes: 0,
1082
1497
  renderLineHighlight: "none",
1083
1498
  renderValidationDecorations: ide || jsonSchema ? "editable" : "off",
1084
- hover: { enabled: ide || !!jsonSchema },
1499
+ hover: { enabled: ide || !!jsonSchema || !!intellisenseContext },
1085
1500
  "semanticHighlighting.enabled": ide,
1086
1501
  showDeprecated: ide,
1087
1502
  showUnused: ide,
@@ -1115,7 +1530,7 @@ function Code({
1115
1530
  // Don't select line when clicking line numbers
1116
1531
  wordBasedSuggestions: "off",
1117
1532
  // Reduce auto-completion interference
1118
- quickSuggestions: jsonSchema ? { strings: true, other: true, comments: false } : false,
1533
+ quickSuggestions: jsonSchema || intellisenseContext ? { strings: true, other: true, comments: false } : false,
1119
1534
  stickyScroll: { enabled: sticky }
1120
1535
  }
1121
1536
  }
@@ -1124,6 +1539,13 @@ function Code({
1124
1539
 
1125
1540
  // src/components/molecules/code-box.tsx
1126
1541
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1542
+ var _monacoNs;
1543
+ function getMonaco() {
1544
+ if (!_monacoNs) {
1545
+ _monacoNs = __require("monaco-editor");
1546
+ }
1547
+ return _monacoNs;
1548
+ }
1127
1549
  function CodeBox({
1128
1550
  // Code props (single code mode)
1129
1551
  code,
@@ -1146,6 +1568,8 @@ function CodeBox({
1146
1568
  showCopy = true,
1147
1569
  showFormat = false,
1148
1570
  showSettings = false,
1571
+ // Validation
1572
+ onValidationIssues,
1149
1573
  // Layout
1150
1574
  footer,
1151
1575
  height,
@@ -1153,6 +1577,7 @@ function CodeBox({
1153
1577
  className,
1154
1578
  ...codeProps
1155
1579
  }) {
1580
+ const { onMount: userOnMount, ...restCodeProps } = codeProps;
1156
1581
  const [copied, setCopied] = useState4(false);
1157
1582
  const [showSettingsPanel, setShowSettingsPanel] = useState4(false);
1158
1583
  const [settings, setSettings] = useState4({
@@ -1162,6 +1587,9 @@ function CodeBox({
1162
1587
  sticky: true
1163
1588
  });
1164
1589
  const settingsRef = useRef4(null);
1590
+ const [markerCounts, setMarkerCounts] = useState4({ errors: 0, warnings: 0 });
1591
+ const editorInstanceRef = useRef4(null);
1592
+ const lastJumpIndexRef = useRef4({ errors: -1, warnings: -1 });
1165
1593
  useEffect3(() => {
1166
1594
  if (!showSettingsPanel) return;
1167
1595
  const handleClickOutside = (e) => {
@@ -1204,6 +1632,42 @@ function CodeBox({
1204
1632
  } catch (e) {
1205
1633
  }
1206
1634
  };
1635
+ const handleEditorMount = useCallback3(
1636
+ (monacoEditor) => {
1637
+ editorInstanceRef.current = monacoEditor;
1638
+ userOnMount?.(monacoEditor);
1639
+ },
1640
+ [userOnMount]
1641
+ );
1642
+ const handleMarkerCounts = useCallback3(
1643
+ (counts) => {
1644
+ setMarkerCounts(counts);
1645
+ lastJumpIndexRef.current = { errors: -1, warnings: -1 };
1646
+ onValidationIssues?.(counts);
1647
+ },
1648
+ [onValidationIssues]
1649
+ );
1650
+ const jumpToMarker = useCallback3((severity) => {
1651
+ const ed = editorInstanceRef.current;
1652
+ if (!ed) return;
1653
+ const model = ed.getModel();
1654
+ if (!model) return;
1655
+ const severityValue = severity === "error" ? 8 : 4;
1656
+ const markers = getMonaco().editor.getModelMarkers({ resource: model.uri }).filter((m) => m.severity === severityValue).sort(
1657
+ (a, b) => a.startLineNumber - b.startLineNumber || a.startColumn - b.startColumn
1658
+ );
1659
+ if (markers.length === 0) return;
1660
+ const key = severity === "error" ? "errors" : "warnings";
1661
+ const nextIndex = (lastJumpIndexRef.current[key] + 1) % markers.length;
1662
+ lastJumpIndexRef.current[key] = nextIndex;
1663
+ const marker = markers[nextIndex];
1664
+ ed.revealLineInCenter(marker.startLineNumber);
1665
+ ed.setPosition({
1666
+ lineNumber: marker.startLineNumber,
1667
+ column: marker.startColumn
1668
+ });
1669
+ ed.focus();
1670
+ }, []);
1207
1671
  const settingsProps = {
1208
1672
  lineNumbers: settings.lineNumbers,
1209
1673
  minimap: settings.minimap,
@@ -1211,6 +1675,60 @@ function CodeBox({
1211
1675
  sticky: settings.sticky
1212
1676
  };
1213
1677
  const actions = /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "4px", alignItems: "center" }, children: [
1678
+ markerCounts.errors > 0 && /* @__PURE__ */ jsxs3(
1679
+ "button",
1680
+ {
1681
+ className: "elb-codebox-marker-badge elb-codebox-marker-badge--error",
1682
+ onClick: () => jumpToMarker("error"),
1683
+ title: `${markerCounts.errors} error${markerCounts.errors !== 1 ? "s" : ""} \u2014 click to jump`,
1684
+ children: [
1685
+ /* @__PURE__ */ jsxs3(
1686
+ "svg",
1687
+ {
1688
+ width: "14",
1689
+ height: "14",
1690
+ viewBox: "0 0 24 24",
1691
+ fill: "none",
1692
+ stroke: "currentColor",
1693
+ strokeWidth: "2",
1694
+ children: [
1695
+ /* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "10" }),
1696
+ /* @__PURE__ */ jsx4("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
1697
+ /* @__PURE__ */ jsx4("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
1698
+ ]
1699
+ }
1700
+ ),
1701
+ /* @__PURE__ */ jsx4("span", { children: markerCounts.errors })
1702
+ ]
1703
+ }
1704
+ ),
1705
+ markerCounts.warnings > 0 && /* @__PURE__ */ jsxs3(
1706
+ "button",
1707
+ {
1708
+ className: "elb-codebox-marker-badge elb-codebox-marker-badge--warning",
1709
+ onClick: () => jumpToMarker("warning"),
1710
+ title: `${markerCounts.warnings} warning${markerCounts.warnings !== 1 ? "s" : ""} \u2014 click to jump`,
1711
+ children: [
1712
+ /* @__PURE__ */ jsxs3(
1713
+ "svg",
1714
+ {
1715
+ width: "14",
1716
+ height: "14",
1717
+ viewBox: "0 0 24 24",
1718
+ fill: "none",
1719
+ stroke: "currentColor",
1720
+ strokeWidth: "2",
1721
+ children: [
1722
+ /* @__PURE__ */ jsx4("path", { d: "M12 3L2 21h20L12 3z" }),
1723
+ /* @__PURE__ */ jsx4("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
1724
+ /* @__PURE__ */ jsx4("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
1725
+ ]
1726
+ }
1727
+ ),
1728
+ /* @__PURE__ */ jsx4("span", { children: markerCounts.warnings })
1729
+ ]
1730
+ }
1731
+ ),
1214
1732
  showFormat && !disabled && currentLanguage === "json" && /* @__PURE__ */ jsx4(
1215
1733
  "button",
1216
1734
  {
@@ -1363,7 +1881,9 @@ function CodeBox({
1363
1881
  onChange,
1364
1882
  disabled,
1365
1883
  autoHeight,
1366
- ...codeProps,
1884
+ onMount: handleEditorMount,
1885
+ onMarkerCounts: handleMarkerCounts,
1886
+ ...restCodeProps,
1367
1887
  ...settingsProps
1368
1888
  }
1369
1889
  )
@@ -1391,7 +1911,9 @@ function CodeBox({
1391
1911
  onChange,
1392
1912
  disabled,
1393
1913
  autoHeight,
1394
- ...codeProps,
1914
+ onMount: handleEditorMount,
1915
+ onMarkerCounts: handleMarkerCounts,
1916
+ ...restCodeProps,
1395
1917
  ...settingsProps
1396
1918
  }
1397
1919
  )
@@ -2058,7 +2580,9 @@ function Preview({
2058
2580
  setTimeout(async () => {
2059
2581
  if (sourceRef.current) {
2060
2582
  try {
2061
- await sourceRef.current.destroy?.();
2583
+ await sourceRef.current.instance.destroy?.(
2584
+ sourceRef.current.destroyContext
2585
+ );
2062
2586
  } catch {
2063
2587
  }
2064
2588
  }
@@ -2083,34 +2607,44 @@ function Preview({
2083
2607
  ok: true,
2084
2608
  destination: {}
2085
2609
  });
2086
- const source = await sourceBrowser({
2610
+ const config = {
2611
+ settings: {
2612
+ pageview: false,
2613
+ prefix: "data-elb",
2614
+ elb: "elb",
2615
+ elbLayer: "elbLayer",
2616
+ // Use body as scope - trigger.ts compares `scope !== document` against
2617
+ // main page's document, so iframe.contentDocument fails the Element cast
2618
+ scope: iframe.contentDocument.body
2619
+ }
2620
+ };
2621
+ const env = {
2622
+ elb: elbRef.current,
2623
+ push: noopPush,
2624
+ command: async () => ({ ok: true, destination: {} }),
2625
+ logger: noopLogger,
2626
+ window: iframe.contentWindow,
2627
+ document: iframe.contentDocument
2628
+ };
2629
+ const instance = await sourceBrowser({
2087
2630
  id: "preview",
2088
2631
  collector: {},
2089
2632
  // Not used when elb is provided directly
2090
2633
  logger: noopLogger,
2091
2634
  setIngest: async () => {
2092
2635
  },
2093
- config: {
2094
- settings: {
2095
- pageview: false,
2096
- prefix: "data-elb",
2097
- elb: "elb",
2098
- elbLayer: "elbLayer",
2099
- // Use body as scope - trigger.ts compares `scope !== document` against
2100
- // main page's document, so iframe.contentDocument fails the Element cast
2101
- scope: iframe.contentDocument.body
2102
- }
2103
- },
2104
- env: {
2105
- elb: elbRef.current,
2106
- push: noopPush,
2107
- command: async () => ({ ok: true, destination: {} }),
2108
- logger: noopLogger,
2109
- window: iframe.contentWindow,
2110
- document: iframe.contentDocument
2111
- }
2636
+ config,
2637
+ env
2112
2638
  });
2113
- sourceRef.current = source;
2639
+ sourceRef.current = {
2640
+ instance,
2641
+ destroyContext: {
2642
+ id: "preview",
2643
+ config,
2644
+ env,
2645
+ logger: noopLogger
2646
+ }
2647
+ };
2114
2648
  } catch {
2115
2649
  }
2116
2650
  }, 50);
@@ -2121,7 +2655,7 @@ function Preview({
2121
2655
  clearTimeout(updateTimeoutRef.current);
2122
2656
  }
2123
2657
  if (sourceRef.current) {
2124
- sourceRef.current.destroy?.();
2658
+ sourceRef.current.instance.destroy?.(sourceRef.current.destroyContext);
2125
2659
  }
2126
2660
  };
2127
2661
  }, [html, css, highlights, autoMarkProperties, elb]);
@@ -3392,14 +3926,14 @@ function detectNodeType(value, path, structure, schemas) {
3392
3926
  const schema = propertyDef && schemas ? resolveSchema(path.slice(propertyDefIndex), propertyDef, schemas) : void 0;
3393
3927
  if (schema) {
3394
3928
  const primitiveType = typeof value;
3395
- const isPrimitive = primitiveType === "string" || primitiveType === "number" || primitiveType === "boolean" || value === void 0 || value === null;
3929
+ const isPrimitive2 = primitiveType === "string" || primitiveType === "number" || primitiveType === "boolean" || value === void 0 || value === null;
3396
3930
  if (schema.type === "boolean" && (primitiveType === "boolean" || value === void 0 || value === null)) {
3397
3931
  return "boolean";
3398
3932
  }
3399
- if (schema.enum && Array.isArray(schema.enum) && schema.enum.length > 0 && isPrimitive) {
3933
+ if (schema.enum && Array.isArray(schema.enum) && schema.enum.length > 0 && isPrimitive2) {
3400
3934
  return "enum";
3401
3935
  }
3402
- if ((schema.type === "string" || schema.type === "number") && isPrimitive) {
3936
+ if ((schema.type === "string" || schema.type === "number") && isPrimitive2) {
3403
3937
  return "primitive";
3404
3938
  }
3405
3939
  if (schema.type === "array") {
@@ -17498,6 +18032,474 @@ function useDropdown() {
17498
18032
  containerRef
17499
18033
  };
17500
18034
  }
18035
+
18036
+ // src/utils/monaco-schema-enrichment.ts
18037
+ function enrichSchema(baseSchema, enrichments) {
18038
+ const schema = JSON.parse(JSON.stringify(baseSchema));
18039
+ for (const [path, extensions] of Object.entries(enrichments)) {
18040
+ const target = path === "" ? schema : getNestedObject(schema, path);
18041
+ if (target && typeof target === "object") {
18042
+ Object.assign(target, extensions);
18043
+ }
18044
+ }
18045
+ return schema;
18046
+ }
18047
+ function getNestedObject(obj, path) {
18048
+ const keys = path.split(".");
18049
+ let current = obj;
18050
+ for (const key of keys) {
18051
+ if (current && typeof current === "object" && key in current) {
18052
+ current = current[key];
18053
+ } else {
18054
+ return void 0;
18055
+ }
18056
+ }
18057
+ return current;
18058
+ }
18059
+
18060
+ // src/utils/monaco-schema-flow-setup.ts
18061
+ function enrichFlowSetupSchema(baseSchema) {
18062
+ const schema = JSON.parse(JSON.stringify(baseSchema));
18063
+ if (!schema.anyOf?.[0]?.properties) return schema;
18064
+ const root = schema.anyOf[0];
18065
+ const props = root.properties;
18066
+ const flowConfig = props.flows?.additionalProperties?.properties;
18067
+ if (props.version) {
18068
+ props.version.markdownDescription = 'Schema version number. Must be `1` for the current format.\n\n```json\n"version": 1\n```';
18069
+ }
18070
+ if (props.$schema) {
18071
+ props.$schema.markdownDescription = 'JSON Schema URI for IDE validation.\n\n```json\n"$schema": "https://walkeros.io/schema/flow/v1.json"\n```';
18072
+ }
18073
+ if (props.include) {
18074
+ props.include.markdownDescription = 'Folders to include in the bundle output.\n\n```json\n"include": ["./src", "./lib"]\n```';
18075
+ }
18076
+ if (props.variables) {
18077
+ props.variables.markdownDescription = 'Shared variables for `$var.name` interpolation across all flows.\n\n```json\n"variables": {\n "measurementId": "G-XXXXXXXXXX",\n "debug": false\n}\n```\n\nReference in any config value: `"$var.measurementId"`';
18078
+ props.variables.defaultSnippets = [
18079
+ {
18080
+ label: "Add variable",
18081
+ description: "New key-value variable",
18082
+ body: { "${1:name}": "${2:value}" }
18083
+ }
18084
+ ];
18085
+ }
18086
+ if (props.definitions) {
18087
+ props.definitions.markdownDescription = 'Reusable configuration fragments for `$def.name` references.\n\n```json\n"definitions": {\n "gaConfig": {\n "measurementId": "$var.trackingId"\n }\n}\n```\n\nReference in any config: `"$def.gaConfig"`';
18088
+ props.definitions.defaultSnippets = [
18089
+ {
18090
+ label: "Add definition",
18091
+ description: "New reusable config fragment",
18092
+ body: { "${1:name}": { "${2:key}": "${3:value}" } }
18093
+ }
18094
+ ];
18095
+ }
18096
+ if (props.flows) {
18097
+ props.flows.markdownDescription = 'Flow configurations keyed by name. Each flow defines a complete event pipeline.\n\n```json\n"flows": {\n "myFlow": {\n "web": {},\n "sources": { ... },\n "destinations": { ... }\n }\n}\n```';
18098
+ props.flows.defaultSnippets = [
18099
+ {
18100
+ label: "Web flow (basic)",
18101
+ description: "Minimal web flow with browser source",
18102
+ body: {
18103
+ "${1:myFlow}": {
18104
+ web: {},
18105
+ sources: {
18106
+ browser: { package: "@walkeros/web-source-browser" }
18107
+ },
18108
+ destinations: {}
18109
+ }
18110
+ }
18111
+ },
18112
+ {
18113
+ label: "Server flow (basic)",
18114
+ description: "Minimal server flow with Express source",
18115
+ body: {
18116
+ "${1:myFlow}": {
18117
+ server: {},
18118
+ sources: {
18119
+ express: { package: "@walkeros/server-source-express" }
18120
+ },
18121
+ destinations: {}
18122
+ }
18123
+ }
18124
+ },
18125
+ {
18126
+ label: "Web + GA4 flow",
18127
+ description: "Web flow with browser source and GA4 destination",
18128
+ body: {
18129
+ "${1:myFlow}": {
18130
+ web: {},
18131
+ sources: {
18132
+ browser: { package: "@walkeros/web-source-browser" }
18133
+ },
18134
+ destinations: {
18135
+ ga4: {
18136
+ package: "@walkeros/web-destination-ga4",
18137
+ config: {
18138
+ measurementId: "$var.${2:measurementId}"
18139
+ }
18140
+ }
18141
+ }
18142
+ }
18143
+ }
18144
+ }
18145
+ ];
18146
+ }
18147
+ if (flowConfig) {
18148
+ if (flowConfig.sources) {
18149
+ flowConfig.sources.markdownDescription = 'Source configurations for data capture, keyed by step name.\n\n```json\n"sources": {\n "browser": { "package": "@walkeros/web-source-browser" }\n}\n```';
18150
+ flowConfig.sources.defaultSnippets = [
18151
+ {
18152
+ label: "Add web source",
18153
+ description: "Browser source for web tracking",
18154
+ body: {
18155
+ "${1:browser}": {
18156
+ package: "@walkeros/web-source-browser"
18157
+ }
18158
+ }
18159
+ },
18160
+ {
18161
+ label: "Add server source",
18162
+ description: "Express source for server tracking",
18163
+ body: {
18164
+ "${1:express}": {
18165
+ package: "@walkeros/server-source-express"
18166
+ }
18167
+ }
18168
+ }
18169
+ ];
18170
+ }
18171
+ if (flowConfig.destinations) {
18172
+ flowConfig.destinations.markdownDescription = 'Destination configurations for data output, keyed by step name.\n\n```json\n"destinations": {\n "ga4": {\n "package": "@walkeros/web-destination-ga4",\n "config": { "measurementId": "$var.trackingId" }\n }\n}\n```';
18173
+ flowConfig.destinations.defaultSnippets = [
18174
+ {
18175
+ label: "Add GA4 destination",
18176
+ description: "Google Analytics 4 destination",
18177
+ body: {
18178
+ "${1:ga4}": {
18179
+ package: "@walkeros/web-destination-ga4",
18180
+ config: {
18181
+ measurementId: "$var.${2:measurementId}"
18182
+ }
18183
+ }
18184
+ }
18185
+ },
18186
+ {
18187
+ label: "Add custom destination",
18188
+ description: "Custom destination with inline code",
18189
+ body: {
18190
+ "${1:custom}": {
18191
+ code: {
18192
+ push: "$code:(event) => { ${2:// handle event} }"
18193
+ }
18194
+ }
18195
+ }
18196
+ }
18197
+ ];
18198
+ }
18199
+ if (flowConfig.transformers) {
18200
+ flowConfig.transformers.markdownDescription = 'Transformer configurations for event transformation, keyed by step name.\n\n```json\n"transformers": {\n "validator": {\n "code": { "push": "$code:(event) => event" }\n }\n}\n```';
18201
+ flowConfig.transformers.defaultSnippets = [
18202
+ {
18203
+ label: "Add transformer",
18204
+ description: "Inline transformer with code",
18205
+ body: {
18206
+ "${1:transformer}": {
18207
+ code: {
18208
+ push: "$code:(event) => { ${2:return event;} }"
18209
+ }
18210
+ }
18211
+ }
18212
+ }
18213
+ ];
18214
+ }
18215
+ if (flowConfig.web) {
18216
+ flowConfig.web.markdownDescription = 'Web platform configuration (browser-based). Mutually exclusive with `server`.\n\n```json\n"web": {\n "windowCollector": "collector",\n "windowElb": "elb"\n}\n```';
18217
+ }
18218
+ if (flowConfig.server) {
18219
+ flowConfig.server.markdownDescription = 'Server platform configuration (Node.js). Mutually exclusive with `web`.\n\n```json\n"server": {}\n```';
18220
+ }
18221
+ }
18222
+ return schema;
18223
+ }
18224
+
18225
+ // src/utils/monaco-schema-contract.ts
18226
+ function getEnrichedContractSchema() {
18227
+ return {
18228
+ type: "object",
18229
+ markdownDescription: 'walkerOS Data Contract. Defines entity\u2192action schemas for event validation.\n\n```json\n{\n "$tagging": 1,\n "page": {\n "view": {\n "type": "object",\n "properties": {\n "title": { "type": "string" }\n }\n }\n }\n}\n```',
18230
+ properties: {
18231
+ $tagging: {
18232
+ type: "number",
18233
+ markdownDescription: 'Contract version number. Increment when making breaking changes.\n\n```json\n"$tagging": 1\n```'
18234
+ }
18235
+ },
18236
+ additionalProperties: {
18237
+ type: "object",
18238
+ markdownDescription: "Entity name. Contains action\u2192schema mappings.",
18239
+ additionalProperties: {
18240
+ type: "object",
18241
+ markdownDescription: 'Action schema (JSON Schema). Defines valid event data for this entity+action.\n\n```json\n{\n "type": "object",\n "properties": {\n "name": { "type": "string" },\n "price": { "type": "number" }\n },\n "required": ["name"]\n}\n```',
18242
+ defaultSnippets: [
18243
+ {
18244
+ label: "Object schema",
18245
+ description: "Schema with typed properties",
18246
+ body: {
18247
+ type: "object",
18248
+ properties: {
18249
+ "${1:name}": { type: "${2:string}" }
18250
+ }
18251
+ }
18252
+ }
18253
+ ]
18254
+ },
18255
+ defaultSnippets: [
18256
+ {
18257
+ label: "Add action",
18258
+ description: "Action with event data schema",
18259
+ body: {
18260
+ "${1:action}": {
18261
+ type: "object",
18262
+ properties: {
18263
+ "${2:property}": { type: "${3:string}" }
18264
+ }
18265
+ }
18266
+ }
18267
+ }
18268
+ ]
18269
+ },
18270
+ defaultSnippets: [
18271
+ {
18272
+ label: "Entity with action",
18273
+ description: "New entity with one action and properties",
18274
+ body: {
18275
+ "${1:entity}": {
18276
+ "${2:action}": {
18277
+ type: "object",
18278
+ properties: {
18279
+ "${3:property}": { type: "${4:string}" }
18280
+ }
18281
+ }
18282
+ }
18283
+ }
18284
+ }
18285
+ ]
18286
+ };
18287
+ }
18288
+
18289
+ // src/utils/monaco-schema-variables.ts
18290
+ function getVariablesSchema() {
18291
+ return {
18292
+ type: "object",
18293
+ markdownDescription: 'Flow variables for `$var.name` interpolation. Values must be string, number, or boolean.\n\n```json\n{\n "measurementId": "G-XXXXXXXXXX",\n "debug": false,\n "batchSize": 10\n}\n```\n\nReference in any config value: `"$var.measurementId"`',
18294
+ additionalProperties: {
18295
+ oneOf: [{ type: "string" }, { type: "number" }, { type: "boolean" }]
18296
+ },
18297
+ defaultSnippets: [
18298
+ {
18299
+ label: "Add string variable",
18300
+ body: { "${1:name}": "${2:value}" }
18301
+ },
18302
+ {
18303
+ label: "Add boolean variable",
18304
+ body: { "${1:name}": "${2|true,false|}" }
18305
+ },
18306
+ {
18307
+ label: "Add number variable",
18308
+ body: { "${1:name}": 0 }
18309
+ }
18310
+ ]
18311
+ };
18312
+ }
18313
+
18314
+ // src/utils/monaco-walkeros-markers.ts
18315
+ function validateWalkerOSReferences(text, context) {
18316
+ const issues = [];
18317
+ if (context.variables) {
18318
+ const varRegex = /\$var\.(\w+)/g;
18319
+ let match;
18320
+ while ((match = varRegex.exec(text)) !== null) {
18321
+ if (!(match[1] in context.variables)) {
18322
+ issues.push({
18323
+ message: `Unknown variable "$var.${match[1]}". Defined variables: ${Object.keys(context.variables).join(", ") || "none"}`,
18324
+ severity: "warning",
18325
+ startIndex: match.index,
18326
+ endIndex: match.index + match[0].length
18327
+ });
18328
+ }
18329
+ }
18330
+ }
18331
+ if (context.definitions) {
18332
+ const defRegex = /\$def\.(\w+)/g;
18333
+ let match;
18334
+ while ((match = defRegex.exec(text)) !== null) {
18335
+ if (!(match[1] in context.definitions)) {
18336
+ issues.push({
18337
+ message: `Unknown definition "$def.${match[1]}". Defined: ${Object.keys(context.definitions).join(", ") || "none"}`,
18338
+ severity: "warning",
18339
+ startIndex: match.index,
18340
+ endIndex: match.index + match[0].length
18341
+ });
18342
+ }
18343
+ }
18344
+ }
18345
+ if (context.secrets) {
18346
+ const secretRegex = /\$secret\.(\w+)/g;
18347
+ let match;
18348
+ while ((match = secretRegex.exec(text)) !== null) {
18349
+ if (!context.secrets.includes(match[1])) {
18350
+ issues.push({
18351
+ message: `Unknown secret "$secret.${match[1]}". Available: ${context.secrets.join(", ") || "none"}`,
18352
+ severity: "warning",
18353
+ startIndex: match.index,
18354
+ endIndex: match.index + match[0].length
18355
+ });
18356
+ }
18357
+ }
18358
+ }
18359
+ if (context.stepNames?.transformers) {
18360
+ const nextRegex = /"(?:next|before)"\s*:\s*"(\w+)"/g;
18361
+ let match;
18362
+ while ((match = nextRegex.exec(text)) !== null) {
18363
+ if (!context.stepNames.transformers.includes(match[1])) {
18364
+ issues.push({
18365
+ message: `Unknown transformer "${match[1]}". Available: ${context.stepNames.transformers.join(", ") || "none"}`,
18366
+ severity: "warning",
18367
+ startIndex: match.index,
18368
+ endIndex: match.index + match[0].length
18369
+ });
18370
+ }
18371
+ }
18372
+ }
18373
+ return issues;
18374
+ }
18375
+
18376
+ // src/utils/monaco-intellisense-flow-extractor.ts
18377
+ function extractFlowIntelliSenseContext(json) {
18378
+ let parsed;
18379
+ try {
18380
+ parsed = JSON.parse(json);
18381
+ } catch {
18382
+ return {};
18383
+ }
18384
+ if (!isFlowSetup(parsed)) return {};
18385
+ const variables = {};
18386
+ const definitions = {};
18387
+ const sources = [];
18388
+ const destinations = [];
18389
+ const transformers = [];
18390
+ const packages = [];
18391
+ const contractEntities = [];
18392
+ let platform;
18393
+ mergeVars(variables, parsed.variables);
18394
+ mergeDefs(definitions, parsed.definitions);
18395
+ extractContract(contractEntities, parsed.contract);
18396
+ for (const config of Object.values(parsed.flows)) {
18397
+ if (!isObject(config)) continue;
18398
+ if (!platform) {
18399
+ if ("web" in config) platform = "web";
18400
+ else if ("server" in config) platform = "server";
18401
+ }
18402
+ mergeVars(variables, config.variables);
18403
+ mergeDefs(definitions, config.definitions);
18404
+ extractContract(contractEntities, config.contract);
18405
+ if (isObject(config.sources)) {
18406
+ for (const [name, ref] of Object.entries(config.sources)) {
18407
+ sources.push(name);
18408
+ if (isObject(ref)) {
18409
+ mergeVars(variables, ref.variables);
18410
+ mergeDefs(definitions, ref.definitions);
18411
+ if (typeof ref.package === "string") {
18412
+ packages.push({
18413
+ package: ref.package,
18414
+ shortName: name,
18415
+ type: "source",
18416
+ platform: platform || "web"
18417
+ });
18418
+ }
18419
+ }
18420
+ }
18421
+ }
18422
+ if (isObject(config.destinations)) {
18423
+ for (const [name, ref] of Object.entries(config.destinations)) {
18424
+ destinations.push(name);
18425
+ if (isObject(ref)) {
18426
+ mergeVars(variables, ref.variables);
18427
+ mergeDefs(definitions, ref.definitions);
18428
+ if (typeof ref.package === "string") {
18429
+ packages.push({
18430
+ package: ref.package,
18431
+ shortName: name,
18432
+ type: "destination",
18433
+ platform: platform || "web"
18434
+ });
18435
+ }
18436
+ }
18437
+ }
18438
+ }
18439
+ if (isObject(config.transformers)) {
18440
+ for (const [name, ref] of Object.entries(config.transformers)) {
18441
+ transformers.push(name);
18442
+ if (isObject(ref)) {
18443
+ mergeVars(variables, ref.variables);
18444
+ mergeDefs(definitions, ref.definitions);
18445
+ if (typeof ref.package === "string") {
18446
+ packages.push({
18447
+ package: ref.package,
18448
+ shortName: name,
18449
+ type: "transformer",
18450
+ platform: platform || "web"
18451
+ });
18452
+ }
18453
+ }
18454
+ }
18455
+ }
18456
+ }
18457
+ const result = {
18458
+ variables,
18459
+ definitions,
18460
+ stepNames: { sources, destinations, transformers }
18461
+ };
18462
+ if (platform) result.platform = platform;
18463
+ if (packages.length > 0) result.packages = packages;
18464
+ if (contractEntities.length > 0) result.contract = contractEntities;
18465
+ return result;
18466
+ }
18467
+ function isObject(v) {
18468
+ return typeof v === "object" && v !== null && !Array.isArray(v);
18469
+ }
18470
+ function isFlowSetup(v) {
18471
+ return isObject(v) && "version" in v && "flows" in v && isObject(v.flows);
18472
+ }
18473
+ function isPrimitive(v) {
18474
+ return typeof v === "string" || typeof v === "number" || typeof v === "boolean";
18475
+ }
18476
+ function mergeVars(target, source) {
18477
+ if (!isObject(source)) return;
18478
+ for (const [k, v] of Object.entries(source)) {
18479
+ if (isPrimitive(v)) target[k] = v;
18480
+ }
18481
+ }
18482
+ function mergeDefs(target, source) {
18483
+ if (!isObject(source)) return;
18484
+ for (const [k, v] of Object.entries(source)) {
18485
+ target[k] = v;
18486
+ }
18487
+ }
18488
+ function extractContract(target, contract) {
18489
+ if (!isObject(contract)) return;
18490
+ for (const [key, value] of Object.entries(contract)) {
18491
+ if (key.startsWith("$") || !isObject(value)) continue;
18492
+ const existing = target.find((e) => e.entity === key);
18493
+ const actions = Object.keys(value);
18494
+ if (existing) {
18495
+ for (const a of actions) {
18496
+ if (!existing.actions.includes(a)) existing.actions.push(a);
18497
+ }
18498
+ } else {
18499
+ target.push({ entity: key, actions });
18500
+ }
18501
+ }
18502
+ }
17501
18503
  export {
17502
18504
  Alert,
17503
18505
  ArchitectureFlow,
@@ -17542,9 +18544,11 @@ export {
17542
18544
  Preview,
17543
18545
  PromotionPlayground,
17544
18546
  PropertyTable,
18547
+ REFERENCE_PATTERNS,
17545
18548
  Spinner,
17546
18549
  SplitButton,
17547
18550
  SubmitButton,
18551
+ applyWalkerOSDecorations,
17548
18552
  captureDestinationPush,
17549
18553
  cn,
17550
18554
  createCaptureFn,
@@ -17552,8 +18556,15 @@ export {
17552
18556
  createGtagDestination,
17553
18557
  createPlausibleDestination,
17554
18558
  createRawCapture,
18559
+ disposeWalkerOSProviders,
18560
+ enrichFlowSetupSchema,
18561
+ enrichSchema,
18562
+ extractFlowIntelliSenseContext,
18563
+ findWalkerOSReferences,
17555
18564
  formatCapturedCalls,
17556
18565
  generateModelPath,
18566
+ getEnrichedContractSchema,
18567
+ getVariablesSchema,
17557
18568
  initializeMonacoTypes,
17558
18569
  lighthouseTheme,
17559
18570
  loadPackageTypes,
@@ -17563,8 +18574,13 @@ export {
17563
18574
  registerJsonSchema,
17564
18575
  registerLighthouseTheme,
17565
18576
  registerPalenightTheme,
18577
+ registerWalkerOSDecorationStyles,
18578
+ registerWalkerOSProviders,
17566
18579
  registerWalkerOSTypes,
18580
+ removeIntelliSenseContext,
18581
+ setIntelliSenseContext,
17567
18582
  unregisterJsonSchema,
17568
- useDropdown
18583
+ useDropdown,
18584
+ validateWalkerOSReferences
17569
18585
  };
17570
18586
  //# sourceMappingURL=index.mjs.map