@cccarv82/freya 2.13.2 → 2.13.4

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/cli/web-ui.css CHANGED
@@ -134,6 +134,7 @@ body {
134
134
  .shell {
135
135
  display: grid;
136
136
  grid-template-columns: 72px minmax(520px, 1fr);
137
+ grid-template-rows: 1fr;
137
138
  height: 100vh;
138
139
  min-height: 0;
139
140
  }
@@ -360,6 +361,7 @@ body {
360
361
  display: flex;
361
362
  flex-direction: column;
362
363
  min-height: 0;
364
+ overflow: hidden;
363
365
  padding: 8px 0 18px;
364
366
  }
365
367
 
@@ -369,6 +371,7 @@ body {
369
371
  align-items: center;
370
372
  padding: 16px 20px 10px;
371
373
  background: transparent;
374
+ flex-shrink: 0;
372
375
  }
373
376
 
374
377
  .brandLine {
@@ -590,6 +593,9 @@ body {
590
593
  gap: 18px;
591
594
  flex: 1;
592
595
  }
596
+ .centerBody > * {
597
+ flex-shrink: 0;
598
+ }
593
599
 
594
600
  .promptShell {
595
601
  display: flex;
package/cli/web-ui.js CHANGED
@@ -139,9 +139,10 @@
139
139
  }
140
140
 
141
141
  const li = line.match(/^[ \t]*[-*][ \t]+(.*)$/);
142
- if (li) {
142
+ const oli = !li ? line.match(/^[ \t]*\d+\.[ \t]+(.*)$/) : null;
143
+ if (li || oli) {
143
144
  if (!inList) { html += '<ul class="md-ul">'; inList = true; }
144
- const content = inlineFormat(li[1]);
145
+ const content = inlineFormat((li || oli)[1]);
145
146
  html += '<li>' + content + '</li>';
146
147
  continue;
147
148
  }
@@ -163,67 +164,107 @@
163
164
  }
164
165
 
165
166
  function formatPlanForDisplay(rawPlan) {
167
+ var text = String(rawPlan || '');
168
+ if (!text) return null;
169
+
170
+ // --- Strategy 1: try full JSON parse (works when copilot output is complete) ---
166
171
  try {
167
- const text = String(rawPlan || '');
168
- const start = text.indexOf('{');
169
- if (start === -1) return null;
170
- let depth = 0, inStr = false, esc = false, jsonStr = null;
171
- for (let i = start; i < text.length; i++) {
172
- const ch = text[i];
173
- if (esc) { esc = false; continue; }
174
- if (ch === '\\') { esc = true; continue; }
175
- if (ch === '"') { inStr = !inStr; continue; }
176
- if (inStr) continue;
177
- if (ch === '{') depth++;
178
- if (ch === '}') { depth--; if (depth === 0) { jsonStr = text.slice(start, i + 1); break; } }
172
+ var start = text.indexOf('{');
173
+ if (start !== -1) {
174
+ var depth = 0, inStr = false, esc = false, jsonStr = null;
175
+ for (var i = start; i < text.length; i++) {
176
+ var ch = text[i];
177
+ if (esc) { esc = false; continue; }
178
+ if (ch === '\\') { esc = true; continue; }
179
+ if (ch === '"') { inStr = !inStr; continue; }
180
+ if (inStr) continue;
181
+ if (ch === '{') depth++;
182
+ if (ch === '}') { depth--; if (depth === 0) { jsonStr = text.slice(start, i + 1); break; } }
183
+ }
184
+ if (jsonStr) {
185
+ var plan = JSON.parse(jsonStr);
186
+ var actions = Array.isArray(plan.actions) ? plan.actions : [];
187
+ if (actions.length > 0) {
188
+ return formatActions(actions);
189
+ }
190
+ }
179
191
  }
180
- if (!jsonStr) return null;
181
- const plan = JSON.parse(jsonStr);
182
- const actions = Array.isArray(plan.actions) ? plan.actions : [];
183
- if (actions.length === 0) return null;
184
-
185
- const icons = {
186
- append_daily_log: '\u{1F4DD}', appenddailylog: '\u{1F4DD}',
187
- create_task: '\u2705', createtask: '\u2705',
188
- create_blocker: '\u{1F6A7}', createblocker: '\u{1F6A7}',
189
- suggest_report: '\u{1F4CA}', suggestreport: '\u{1F4CA}',
190
- oracle_query: '\u{1F50D}', oraclequery: '\u{1F50D}'
191
- };
192
+ } catch (e) { /* fall through to regex strategy */ }
192
193
 
193
- const lines = actions.map(function(a, i) {
194
- var type = String(a.type || '').trim().toLowerCase().replace(/_/g, '');
195
- var icon = icons[type] || icons[String(a.type || '').trim()] || '\u2022';
196
- var num = i + 1;
197
- var typeNorm = type.replace(/_/g, '');
194
+ // --- Strategy 2: regex fallback for truncated/malformed JSON ---
195
+ var lines = [];
198
196
 
199
- if (typeNorm === 'appenddailylog') {
200
- var t = String(a.text || '').slice(0, 140);
201
- return num + '. ' + icon + ' **Registrar no log:** ' + t + (String(a.text || '').length > 140 ? '...' : '');
202
- }
203
- if (typeNorm === 'createtask') {
204
- var desc = String(a.description || '').slice(0, 120);
205
- var pri = a.priority ? ' (prioridade: **' + String(a.priority).toUpperCase() + '**)' : '';
206
- var cat = a.category ? ' [' + a.category + ']' : '';
207
- return num + '. ' + icon + ' **Criar tarefa:** ' + desc + pri + cat;
208
- }
209
- if (typeNorm === 'createblocker') {
210
- var title = String(a.title || a.description || '').slice(0, 120);
211
- var sev = a.severity ? ' (severidade: **' + String(a.severity).toUpperCase() + '**)' : '';
212
- return num + '. ' + icon + ' **Registrar blocker:** ' + title + sev;
213
- }
214
- if (typeNorm === 'suggestreport') {
215
- return num + '. ' + icon + ' **Sugerir relatorio:** ' + String(a.name || a.reportType || '');
216
- }
217
- if (typeNorm === 'oraclequery') {
218
- return num + '. ' + icon + ' **Consultar oracle:** ' + String(a.query || '').slice(0, 120);
219
- }
220
- return num + '. \u2022 **' + String(a.type || 'acao') + ':** ' + JSON.stringify(a).slice(0, 100);
221
- });
197
+ // Match append_daily_log / appenddailylog actions
198
+ var logRe = /"type"\s*:\s*"append_?daily_?log"\s*,\s*"text"\s*:\s*"([^"]{1,300})/gi;
199
+ var m;
200
+ while ((m = logRe.exec(text)) !== null) {
201
+ var t = m[1].slice(0, 140);
202
+ lines.push('- \u{1F4DD} **Registrar no log:** ' + t + (m[1].length > 140 ? '...' : ''));
203
+ }
222
204
 
223
- return lines.join('\n');
224
- } catch (e) {
225
- return null;
205
+ // Match create_task actions
206
+ var taskRe = /"type"\s*:\s*"create_?task"\s*,\s*"description"\s*:\s*"([^"]{1,200})/gi;
207
+ while ((m = taskRe.exec(text)) !== null) {
208
+ var desc = m[1].slice(0, 120);
209
+ var priMatch = text.slice(m.index, m.index + 400).match(/"priority"\s*:\s*"(\w+)"/i);
210
+ var pri = priMatch ? ' (prioridade: **' + priMatch[1].toUpperCase() + '**)' : '';
211
+ lines.push('- \u2705 **Criar tarefa:** ' + desc + pri);
212
+ }
213
+
214
+ // Match create_blocker actions
215
+ var blockerRe = /"type"\s*:\s*"create_?blocker"\s*,\s*"title"\s*:\s*"([^"]{1,200})/gi;
216
+ while ((m = blockerRe.exec(text)) !== null) {
217
+ var title = m[1].slice(0, 120);
218
+ var sevMatch = text.slice(m.index, m.index + 400).match(/"severity"\s*:\s*"(\w+)"/i);
219
+ var sev = sevMatch ? ' (severidade: **' + sevMatch[1].toUpperCase() + '**)' : '';
220
+ lines.push('- \u{1F6A7} **Registrar blocker:** ' + title + sev);
226
221
  }
222
+
223
+ // Match suggest_report actions
224
+ var repRe = /"type"\s*:\s*"suggest_?report"\s*,\s*"name"\s*:\s*"([^"]+)"/gi;
225
+ while ((m = repRe.exec(text)) !== null) {
226
+ lines.push('- \u{1F4CA} **Sugerir relatorio:** ' + m[1]);
227
+ }
228
+
229
+ return lines.length > 0 ? lines.join('\n') : null;
230
+ }
231
+
232
+ function formatActions(actions) {
233
+ var icons = {
234
+ appenddailylog: '\u{1F4DD}', createtask: '\u2705',
235
+ createblocker: '\u{1F6A7}', suggestreport: '\u{1F4CA}',
236
+ oraclequery: '\u{1F50D}'
237
+ };
238
+
239
+ var lines = actions.map(function(a) {
240
+ var type = String(a.type || '').trim().toLowerCase().replace(/_/g, '');
241
+ var icon = icons[type] || '\u2022';
242
+
243
+ if (type === 'appenddailylog') {
244
+ var t = String(a.text || '').slice(0, 140);
245
+ return '- ' + icon + ' **Registrar no log:** ' + t + (String(a.text || '').length > 140 ? '...' : '');
246
+ }
247
+ if (type === 'createtask') {
248
+ var desc = String(a.description || '').slice(0, 120);
249
+ var pri = a.priority ? ' (prioridade: **' + String(a.priority).toUpperCase() + '**)' : '';
250
+ var cat = a.category ? ' [' + a.category + ']' : '';
251
+ return '- ' + icon + ' **Criar tarefa:** ' + desc + pri + cat;
252
+ }
253
+ if (type === 'createblocker') {
254
+ var title = String(a.title || a.description || '').slice(0, 120);
255
+ var sev = a.severity ? ' (severidade: **' + String(a.severity).toUpperCase() + '**)' : '';
256
+ return '- ' + icon + ' **Registrar blocker:** ' + title + sev;
257
+ }
258
+ if (type === 'suggestreport') {
259
+ return '- ' + icon + ' **Sugerir relatorio:** ' + String(a.name || a.reportType || '');
260
+ }
261
+ if (type === 'oraclequery') {
262
+ return '- ' + icon + ' **Consultar oracle:** ' + String(a.query || '').slice(0, 120);
263
+ }
264
+ return '- \u2022 **' + String(a.type || 'acao') + '**';
265
+ });
266
+
267
+ return lines.join('\n');
227
268
  }
228
269
 
229
270
  function ensureChatSession() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "2.13.2",
3
+ "version": "2.13.4",
4
4
  "description": "Personal AI Assistant with local-first persistence",
5
5
  "scripts": {
6
6
  "health": "node scripts/validate-data.js && node scripts/validate-structure.js",