@fieldwangai/agentflow 0.1.41 → 0.1.42

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.
@@ -136,11 +136,35 @@ const BUILTIN_SKILL_COLLECTIONS = [
136
136
  "agentflow-workspace-markdown",
137
137
  "agentflow-workspace-mermaid",
138
138
  "agentflow-workspace-ascii",
139
+ "agentflow-workspace-chart",
140
+ "agentflow-workspace-table",
141
+ "agentflow-workspace-html",
142
+ "agentflow-workspace-image",
139
143
  "agentflow-node-reference",
140
144
  "agentflow-placeholder-reference",
141
145
  "agentflow-runtime-reference",
142
146
  ],
143
147
  legacyDefaultKeys: [
148
+ [
149
+ "agentflow-workspace-graph",
150
+ "agentflow-workspace-markdown",
151
+ "agentflow-workspace-mermaid",
152
+ "agentflow-workspace-ascii",
153
+ "agentflow-workspace-chart",
154
+ "agentflow-workspace-table",
155
+ "agentflow-node-reference",
156
+ "agentflow-placeholder-reference",
157
+ "agentflow-runtime-reference",
158
+ ],
159
+ [
160
+ "agentflow-workspace-graph",
161
+ "agentflow-workspace-markdown",
162
+ "agentflow-workspace-mermaid",
163
+ "agentflow-workspace-ascii",
164
+ "agentflow-node-reference",
165
+ "agentflow-placeholder-reference",
166
+ "agentflow-runtime-reference",
167
+ ],
144
168
  [
145
169
  "agentflow-flow-add-instances",
146
170
  "agentflow-flow-edit-node-fields",
@@ -1420,20 +1444,123 @@ function workspaceUnescapeLooseJsonString(value) {
1420
1444
  .trim();
1421
1445
  }
1422
1446
 
1447
+ function workspaceFindMatchingDelimiter(text, openIndex, openChar = "{", closeChar = "}") {
1448
+ const raw = String(text || "");
1449
+ if (raw[openIndex] !== openChar) return -1;
1450
+ let depth = 0;
1451
+ let quote = "";
1452
+ let escaped = false;
1453
+ for (let i = openIndex; i < raw.length; i += 1) {
1454
+ const ch = raw[i];
1455
+ if (quote) {
1456
+ if (escaped) {
1457
+ escaped = false;
1458
+ } else if (ch === "\\") {
1459
+ escaped = true;
1460
+ } else if (ch === quote) {
1461
+ quote = "";
1462
+ }
1463
+ continue;
1464
+ }
1465
+ if (ch === '"' || ch === "'") {
1466
+ quote = ch;
1467
+ continue;
1468
+ }
1469
+ if (ch === openChar) depth += 1;
1470
+ if (ch === closeChar) {
1471
+ depth -= 1;
1472
+ if (depth === 0) return i;
1473
+ }
1474
+ }
1475
+ return -1;
1476
+ }
1477
+
1478
+ function workspaceParseLooseJsonValue(text, startIndex, limitIndex = String(text || "").length) {
1479
+ const raw = String(text || "");
1480
+ let i = startIndex;
1481
+ while (i < limitIndex && /\s/.test(raw[i])) i += 1;
1482
+ if (i >= limitIndex) return { value: "", end: i };
1483
+ const ch = raw[i];
1484
+ if (ch === "{" || ch === "[") {
1485
+ const close = workspaceFindMatchingDelimiter(raw, i, ch, ch === "{" ? "}" : "]");
1486
+ const end = close >= 0 ? close + 1 : limitIndex;
1487
+ const slice = raw.slice(i, end).trim();
1488
+ try {
1489
+ return { value: workspaceStringifyOutputValue(JSON.parse(slice)), end };
1490
+ } catch {
1491
+ return { value: slice, end };
1492
+ }
1493
+ }
1494
+ if (ch === '"' || ch === "'") {
1495
+ const quote = ch;
1496
+ let escaped = false;
1497
+ let end = i + 1;
1498
+ for (; end < limitIndex; end += 1) {
1499
+ const c = raw[end];
1500
+ if (escaped) {
1501
+ escaped = false;
1502
+ } else if (c === "\\") {
1503
+ escaped = true;
1504
+ } else if (c === quote) {
1505
+ break;
1506
+ }
1507
+ }
1508
+ const body = raw.slice(i + 1, end < limitIndex ? end : limitIndex);
1509
+ return { value: workspaceUnescapeLooseJsonString(body), end: Math.min(end + 1, limitIndex) };
1510
+ }
1511
+ let end = i;
1512
+ while (end < limitIndex && raw[end] !== "," && raw[end] !== "\n" && raw[end] !== "\r" && raw[end] !== "}") end += 1;
1513
+ const slice = raw.slice(i, end).trim().replace(/^["'`]|["'`]$/g, "");
1514
+ return { value: workspaceUnescapeLooseJsonString(slice), end };
1515
+ }
1516
+
1423
1517
  function workspaceExtractLooseOutParams(raw) {
1424
1518
  const text = String(raw || "");
1425
1519
  const out = {};
1426
1520
  const startMatch = /["']outParams["']\s*:\s*\{/i.exec(text);
1427
1521
  if (!startMatch) return out;
1428
- const start = startMatch.index + startMatch[0].length;
1429
- const end = text.indexOf("}", start);
1430
- const block = end >= start ? text.slice(start, end) : text.slice(start);
1431
- const pairRe = /["']?([A-Za-z_][A-Za-z0-9_-]*)["']?\s*:\s*(?:"([^"]*)"|'([^']*)'|([^,\n\r}]+))/g;
1432
- let match;
1433
- while ((match = pairRe.exec(block))) {
1434
- const key = String(match[1] || "").trim();
1435
- const value = match[2] ?? match[3] ?? match[4] ?? "";
1436
- if (key) out[key] = workspaceUnescapeLooseJsonString(value).replace(/^["'`]|["'`]$/g, "").trim();
1522
+ const openIndex = text.indexOf("{", startMatch.index);
1523
+ const closeIndex = workspaceFindMatchingDelimiter(text, openIndex);
1524
+ const endLimit = closeIndex >= 0 ? closeIndex : text.length;
1525
+ const block = text.slice(openIndex, closeIndex >= 0 ? closeIndex + 1 : text.length);
1526
+ try {
1527
+ const parsed = JSON.parse(block);
1528
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
1529
+ for (const [key, value] of Object.entries(parsed)) {
1530
+ const name = String(key || "").trim();
1531
+ if (name) out[name] = workspaceStringifyOutputValue(value);
1532
+ }
1533
+ return out;
1534
+ }
1535
+ } catch {
1536
+ /* fall through to loose top-level scanning */
1537
+ }
1538
+ let i = openIndex + 1;
1539
+ while (i < endLimit) {
1540
+ while (i < endLimit && /[\s,]/.test(text[i])) i += 1;
1541
+ if (i >= endLimit) break;
1542
+ let key = "";
1543
+ if (text[i] === '"' || text[i] === "'") {
1544
+ const quote = text[i];
1545
+ const keyStart = i + 1;
1546
+ i = keyStart;
1547
+ while (i < endLimit && text[i] !== quote) i += 1;
1548
+ key = text.slice(keyStart, i).trim();
1549
+ i += 1;
1550
+ } else {
1551
+ const keyStart = i;
1552
+ while (i < endLimit && /[A-Za-z0-9_-]/.test(text[i])) i += 1;
1553
+ key = text.slice(keyStart, i).trim();
1554
+ }
1555
+ while (i < endLimit && /\s/.test(text[i])) i += 1;
1556
+ if (text[i] !== ":") {
1557
+ i += 1;
1558
+ continue;
1559
+ }
1560
+ i += 1;
1561
+ const parsedValue = workspaceParseLooseJsonValue(text, i, endLimit);
1562
+ if (key) out[key] = String(parsedValue.value ?? "").trim();
1563
+ i = parsedValue.end;
1437
1564
  }
1438
1565
  return out;
1439
1566
  }