fraim-framework 2.0.87 → 2.0.88

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.
@@ -56,6 +56,10 @@ class WorkflowParser {
56
56
  // Extract Phases (id -> content)
57
57
  const phases = new Map();
58
58
  const phaseSections = restOfContent.split(/^##\s+Phase:\s+/m);
59
+ // Ensure metadata has a phases object
60
+ if (!metadata.phases) {
61
+ metadata.phases = {};
62
+ }
59
63
  // Skip the first part (empty or overview overlap)
60
64
  for (let i = 1; i < phaseSections.length; i++) {
61
65
  const section = phaseSections[i];
@@ -70,7 +74,8 @@ class WorkflowParser {
70
74
  metadata,
71
75
  overview,
72
76
  phases,
73
- isSimple: false
77
+ isSimple: false,
78
+ path: filePath
74
79
  };
75
80
  }
76
81
  /**
@@ -88,9 +93,34 @@ class WorkflowParser {
88
93
  metadata,
89
94
  overview: content.trim(),
90
95
  phases: new Map(),
91
- isSimple: true
96
+ isSimple: true,
97
+ path: filePath
92
98
  };
93
99
  }
100
+ /**
101
+ * Parse workflow content from a string
102
+ */
103
+ static parseContent(content, name, path) {
104
+ // Strip optional UTF-8 BOM
105
+ if (content.charCodeAt(0) === 0xfeff) {
106
+ content = content.slice(1);
107
+ }
108
+ // Try to extract JSON Metadata (frontmatter)
109
+ const metadataMatch = content.match(/^---\r?\n([\s\S]+?)\r?\n---/);
110
+ if (metadataMatch) {
111
+ return this.parsePhaseBasedWorkflow(path || `content:${name}`, content, metadataMatch);
112
+ }
113
+ else {
114
+ return this.parseSimpleWorkflow(path || `content:${name}`, content);
115
+ }
116
+ }
117
+ /**
118
+ * Get just the overview from content
119
+ */
120
+ static getOverviewFromContent(content, name) {
121
+ const wf = this.parseContent(content, name);
122
+ return wf ? wf.overview : null;
123
+ }
94
124
  /**
95
125
  * Get just the overview for an agent starting a workflow
96
126
  */