@puckeditor/plugin-ai 0.6.1-canary.433ca837 → 0.6.1-canary.45a1a2e4
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/dist/index.css +50 -160
- package/dist/index.js +41 -136
- package/dist/index.mjs +47 -143
- package/package.json +2 -3
package/dist/index.css
CHANGED
|
@@ -1469,7 +1469,7 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
|
|
1471
1471
|
/* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-ai/src/components/ChatBody/styles.module.css/#css-module-data */
|
|
1472
|
-
.
|
|
1472
|
+
._Chat_1njo2_1 {
|
|
1473
1473
|
--fade-size: 32px;
|
|
1474
1474
|
--chat-background-color: white;
|
|
1475
1475
|
display: flex;
|
|
@@ -1479,46 +1479,46 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1479
1479
|
overflow: hidden;
|
|
1480
1480
|
}
|
|
1481
1481
|
@media (min-width: 638px) {
|
|
1482
|
-
.
|
|
1482
|
+
._Chat_1njo2_1 {
|
|
1483
1483
|
max-height: none;
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
|
-
._Chat-
|
|
1486
|
+
._Chat-inner_1njo2_17 {
|
|
1487
1487
|
background-color: var(--chat-background-color);
|
|
1488
1488
|
display: flex;
|
|
1489
1489
|
flex-direction: column;
|
|
1490
1490
|
max-height: 100%;
|
|
1491
1491
|
position: relative;
|
|
1492
1492
|
}
|
|
1493
|
-
._Chat--
|
|
1493
|
+
._Chat--hasMessages_1njo2_25 ._Chat-inner_1njo2_17 {
|
|
1494
1494
|
padding-top: 0;
|
|
1495
1495
|
}
|
|
1496
|
-
.
|
|
1496
|
+
._Chat_1njo2_1:not(._Chat--hasChildren_1njo2_29) ._Chat-inner_1njo2_17 {
|
|
1497
1497
|
height: 100%;
|
|
1498
1498
|
padding-top: 0;
|
|
1499
1499
|
}
|
|
1500
|
-
._Chat--
|
|
1500
|
+
._Chat--hasMessages_1njo2_25 ._Chat-messages_1njo2_34 {
|
|
1501
1501
|
display: flex;
|
|
1502
1502
|
flex-direction: column-reverse;
|
|
1503
1503
|
padding: 16px;
|
|
1504
1504
|
overflow: auto;
|
|
1505
1505
|
}
|
|
1506
|
-
._Chat-
|
|
1506
|
+
._Chat-form_1njo2_41 {
|
|
1507
1507
|
background-color: white;
|
|
1508
1508
|
padding: 16px;
|
|
1509
1509
|
}
|
|
1510
|
-
._Chat--
|
|
1510
|
+
._Chat--hideInput_1njo2_46 ._Chat-form_1njo2_41 {
|
|
1511
1511
|
display: none;
|
|
1512
1512
|
}
|
|
1513
|
-
._Chat--
|
|
1513
|
+
._Chat--hasMessages_1njo2_25 ._Chat-form_1njo2_41 {
|
|
1514
1514
|
border-top: 1px solid var(--puck-color-grey-09);
|
|
1515
1515
|
}
|
|
1516
1516
|
@media (min-width: 638px) {
|
|
1517
|
-
._Chat-
|
|
1517
|
+
._Chat-form_1njo2_41 {
|
|
1518
1518
|
border-top: 1px solid var(--puck-color-grey-09);
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
|
-
._Chat-
|
|
1521
|
+
._Chat-formHelper_1njo2_60 {
|
|
1522
1522
|
align-items: center;
|
|
1523
1523
|
display: flex;
|
|
1524
1524
|
color: var(--puck-color-grey-04);
|
|
@@ -1527,11 +1527,11 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1527
1527
|
gap: 8px;
|
|
1528
1528
|
padding-bottom: 12px;
|
|
1529
1529
|
}
|
|
1530
|
-
._Chat--
|
|
1530
|
+
._Chat--hasMessages_1njo2_25 ._Chat-formHelper_1njo2_60 {
|
|
1531
1531
|
opacity: 0;
|
|
1532
1532
|
transition: opacity 250ms ease-in;
|
|
1533
1533
|
}
|
|
1534
|
-
._Chat-
|
|
1534
|
+
._Chat-examplePrompts_1njo2_75 {
|
|
1535
1535
|
align-items: center;
|
|
1536
1536
|
display: flex;
|
|
1537
1537
|
flex-wrap: nowrap;
|
|
@@ -1540,7 +1540,7 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1540
1540
|
width: 100%;
|
|
1541
1541
|
overflow-x: auto;
|
|
1542
1542
|
}
|
|
1543
|
-
._Chat-
|
|
1543
|
+
._Chat-examplePrompt_1njo2_75 {
|
|
1544
1544
|
align-items: center;
|
|
1545
1545
|
background: white;
|
|
1546
1546
|
border: 1px solid var(--puck-color-grey-09);
|
|
@@ -1553,35 +1553,35 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1553
1553
|
padding: 6px 12px;
|
|
1554
1554
|
text-wrap: nowrap;
|
|
1555
1555
|
}
|
|
1556
|
-
._Chat-
|
|
1556
|
+
._Chat-examplePrompt_1njo2_75:hover {
|
|
1557
1557
|
background: var(--puck-color-azure-11);
|
|
1558
1558
|
border-color: var(--puck-color-azure-08);
|
|
1559
1559
|
color: var(--puck-color-azure-04);
|
|
1560
1560
|
}
|
|
1561
|
-
._Chat-
|
|
1561
|
+
._Chat-examplePromptArrow_1njo2_105 {
|
|
1562
1562
|
display: flex;
|
|
1563
1563
|
margin-left: auto;
|
|
1564
1564
|
}
|
|
1565
|
-
._Chat-
|
|
1565
|
+
._Chat-default_1njo2_110 {
|
|
1566
1566
|
overflow-y: auto;
|
|
1567
1567
|
flex-grow: 1;
|
|
1568
1568
|
}
|
|
1569
|
-
._Chat--
|
|
1569
|
+
._Chat--hasMessages_1njo2_25 ._Chat-default_1njo2_110 {
|
|
1570
1570
|
opacity: 0;
|
|
1571
1571
|
padding: 0;
|
|
1572
1572
|
pointer-events: none;
|
|
1573
1573
|
transition: opacity 250ms ease-in;
|
|
1574
1574
|
}
|
|
1575
|
-
._Chat--
|
|
1575
|
+
._Chat--hasMessages_1njo2_25 {
|
|
1576
1576
|
background-color: white;
|
|
1577
1577
|
transition: background-color 250ms ease-in;
|
|
1578
1578
|
}
|
|
1579
|
-
.
|
|
1579
|
+
._ChatMessage_1njo2_127 {
|
|
1580
1580
|
font-size: var(--puck-font-size-xs);
|
|
1581
1581
|
line-height: var(--line-height-s);
|
|
1582
1582
|
overflow-wrap: break-word;
|
|
1583
1583
|
}
|
|
1584
|
-
._ChatMessage--
|
|
1584
|
+
._ChatMessage--userRole_1njo2_133 ._ChatMessage-text_1njo2_133 {
|
|
1585
1585
|
background: var(--puck-color-azure-10);
|
|
1586
1586
|
border-radius: 16px;
|
|
1587
1587
|
color: var(--puck-color-grey-03);
|
|
@@ -1590,70 +1590,70 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1590
1590
|
margin-top: 8px;
|
|
1591
1591
|
padding: 12px 16px;
|
|
1592
1592
|
}
|
|
1593
|
-
.
|
|
1594
|
-
.
|
|
1593
|
+
._ChatMessage_1njo2_127 ul,
|
|
1594
|
+
._ChatMessage_1njo2_127 ol {
|
|
1595
1595
|
list-style: decimal;
|
|
1596
1596
|
margin: 0;
|
|
1597
1597
|
margin-bottom: 12px;
|
|
1598
1598
|
margin-top: 12px;
|
|
1599
1599
|
padding-left: 32px;
|
|
1600
1600
|
}
|
|
1601
|
-
.
|
|
1601
|
+
._ChatMessage_1njo2_127 li {
|
|
1602
1602
|
margin-bottom: 8px;
|
|
1603
1603
|
margin-top: 8px;
|
|
1604
1604
|
padding-left: 8px;
|
|
1605
1605
|
}
|
|
1606
|
-
.
|
|
1607
|
-
.
|
|
1608
|
-
.
|
|
1609
|
-
.
|
|
1610
|
-
.
|
|
1611
|
-
.
|
|
1606
|
+
._ChatMessage_1njo2_127 h1,
|
|
1607
|
+
._ChatMessage_1njo2_127 h2,
|
|
1608
|
+
._ChatMessage_1njo2_127 h3,
|
|
1609
|
+
._ChatMessage_1njo2_127 h4,
|
|
1610
|
+
._ChatMessage_1njo2_127 h5,
|
|
1611
|
+
._ChatMessage_1njo2_127 h6 {
|
|
1612
1612
|
font-weight: 600;
|
|
1613
1613
|
}
|
|
1614
|
-
.
|
|
1614
|
+
._ChatMessage_1njo2_127 h1 {
|
|
1615
1615
|
font-size: var(--puck-font-l);
|
|
1616
1616
|
}
|
|
1617
|
-
.
|
|
1617
|
+
._ChatMessage_1njo2_127 h2 {
|
|
1618
1618
|
font-size: var(--puck-font-m);
|
|
1619
1619
|
}
|
|
1620
|
-
.
|
|
1620
|
+
._ChatMessage_1njo2_127 h3 {
|
|
1621
1621
|
font-size: var(--puck-font-m);
|
|
1622
1622
|
}
|
|
1623
|
-
.
|
|
1623
|
+
._ChatMessage_1njo2_127 h4 {
|
|
1624
1624
|
font-size: var(--puck-font-s);
|
|
1625
1625
|
}
|
|
1626
|
-
.
|
|
1626
|
+
._ChatMessage_1njo2_127 h5 {
|
|
1627
1627
|
font-size: var(--puck-font-xs);
|
|
1628
1628
|
}
|
|
1629
|
-
.
|
|
1629
|
+
._ChatMessage_1njo2_127 h6 {
|
|
1630
1630
|
font-size: var(--puck-font-xm);
|
|
1631
1631
|
}
|
|
1632
|
-
.
|
|
1632
|
+
._ChatMessage_1njo2_127 p {
|
|
1633
1633
|
margin-bottom: 8px;
|
|
1634
1634
|
margin-top: 8px;
|
|
1635
1635
|
}
|
|
1636
|
-
._ChatMessage--
|
|
1636
|
+
._ChatMessage--userRole_1njo2_133 ._ChatMessage-text_1njo2_133 > *:first-of-type {
|
|
1637
1637
|
margin-top: 0px;
|
|
1638
1638
|
}
|
|
1639
|
-
._ChatMessage--
|
|
1639
|
+
._ChatMessage--userRole_1njo2_133 ._ChatMessage-text_1njo2_133 > *:last-of-type {
|
|
1640
1640
|
margin-bottom: 0px;
|
|
1641
1641
|
}
|
|
1642
|
-
.
|
|
1642
|
+
._ChatMessage_1njo2_127 a {
|
|
1643
1643
|
color: var(--puck-color-azure-04);
|
|
1644
1644
|
font-weight: 600;
|
|
1645
1645
|
text-decoration: none;
|
|
1646
1646
|
}
|
|
1647
|
-
.
|
|
1647
|
+
._ChatMessage_1njo2_127 a:hover {
|
|
1648
1648
|
color: var(--puck-color-azure-05);
|
|
1649
1649
|
}
|
|
1650
|
-
.
|
|
1650
|
+
._ChatMessage_1njo2_127 hr {
|
|
1651
1651
|
border-top: none;
|
|
1652
1652
|
border-bottom-color: var(--puck-color-grey-09);
|
|
1653
1653
|
margin-bottom: 16px;
|
|
1654
1654
|
margin-top: 16px;
|
|
1655
1655
|
}
|
|
1656
|
-
.
|
|
1656
|
+
._ChatMessage_1njo2_127 blockquote {
|
|
1657
1657
|
margin-bottom: 8px;
|
|
1658
1658
|
margin-top: 8px;
|
|
1659
1659
|
margin-left: 0;
|
|
@@ -1662,7 +1662,7 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1662
1662
|
padding-bottom: 2px;
|
|
1663
1663
|
padding-top: 2px;
|
|
1664
1664
|
}
|
|
1665
|
-
._ChatMessage-
|
|
1665
|
+
._ChatMessage-data_1njo2_231 {
|
|
1666
1666
|
background: var(--puck-color-grey-12);
|
|
1667
1667
|
border: 1px solid var(--puck-color-grey-08);
|
|
1668
1668
|
border-radius: 16px;
|
|
@@ -1672,19 +1672,19 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1672
1672
|
margin-top: 12px;
|
|
1673
1673
|
padding: 12px 16px;
|
|
1674
1674
|
}
|
|
1675
|
-
._ChatMessage-
|
|
1675
|
+
._ChatMessage-dataInner_1njo2_242 {
|
|
1676
1676
|
align-items: center;
|
|
1677
1677
|
display: flex;
|
|
1678
1678
|
gap: 8px;
|
|
1679
1679
|
}
|
|
1680
|
-
._ChatMessage-
|
|
1680
|
+
._ChatMessage-dataIcon_1njo2_248 {
|
|
1681
1681
|
display: flex;
|
|
1682
1682
|
}
|
|
1683
|
-
._Chat-
|
|
1683
|
+
._Chat-loader_1njo2_252 {
|
|
1684
1684
|
padding: 16px;
|
|
1685
1685
|
padding-top: 0;
|
|
1686
1686
|
}
|
|
1687
|
-
._Chat-
|
|
1687
|
+
._Chat-error_1njo2_257 {
|
|
1688
1688
|
align-items: center;
|
|
1689
1689
|
display: flex;
|
|
1690
1690
|
gap: 8px;
|
|
@@ -1692,122 +1692,12 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1692
1692
|
margin: 16px;
|
|
1693
1693
|
margin-top: 0;
|
|
1694
1694
|
}
|
|
1695
|
-
._Chat-
|
|
1695
|
+
._Chat-errorLabel_1njo2_266 {
|
|
1696
1696
|
color: var(--puck-color-red-04);
|
|
1697
1697
|
}
|
|
1698
|
-
._Chat-
|
|
1698
|
+
._Chat-errorAction_1njo2_270 {
|
|
1699
1699
|
margin-left: auto;
|
|
1700
1700
|
}
|
|
1701
|
-
._Chat-planGroup_8hszl_274 {
|
|
1702
|
-
background: var(--puck-color-grey-12);
|
|
1703
|
-
border: 1px solid var(--puck-color-grey-09);
|
|
1704
|
-
border-radius: 16px;
|
|
1705
|
-
margin-block: 8px;
|
|
1706
|
-
margin-bottom: 12px;
|
|
1707
|
-
overflow: hidden;
|
|
1708
|
-
}
|
|
1709
|
-
._Chat-planGroupHeader_8hszl_283 {
|
|
1710
|
-
color: var(--puck-color-grey-02);
|
|
1711
|
-
background: var(--puck-color-grey-11);
|
|
1712
|
-
padding: 8px 12px;
|
|
1713
|
-
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
1714
|
-
font-weight: 600;
|
|
1715
|
-
font-size: var(--puck-font-size-xxs);
|
|
1716
|
-
}
|
|
1717
|
-
._Chat-planGroupFooter_8hszl_292 {
|
|
1718
|
-
color: var(--puck-color-grey-02);
|
|
1719
|
-
background: var(--puck-color-grey-11);
|
|
1720
|
-
display: flex;
|
|
1721
|
-
flex-direction: row-reverse;
|
|
1722
|
-
padding: 8px 12px;
|
|
1723
|
-
border-top: 1px solid var(--puck-color-grey-09);
|
|
1724
|
-
font-weight: 600;
|
|
1725
|
-
font-size: var(--puck-font-size-xxs);
|
|
1726
|
-
}
|
|
1727
|
-
._Chat-planSummary_8hszl_303 {
|
|
1728
|
-
color: var(--puck-color-grey-02);
|
|
1729
|
-
display: flex;
|
|
1730
|
-
justify-content: space-between;
|
|
1731
|
-
gap: 8px;
|
|
1732
|
-
align-items: flex-end;
|
|
1733
|
-
}
|
|
1734
|
-
._Chat-planSummaryIcon_8hszl_311 {
|
|
1735
|
-
transition: ease-out 150ms;
|
|
1736
|
-
}
|
|
1737
|
-
._Chat-plan_8hszl_274[open] ._Chat-planSummaryIcon_8hszl_311 {
|
|
1738
|
-
transform: rotate(180deg);
|
|
1739
|
-
}
|
|
1740
|
-
._Chat-planSummary_8hszl_303:hover {
|
|
1741
|
-
color: var(--puck-color-azure-04);
|
|
1742
|
-
cursor: pointer;
|
|
1743
|
-
}
|
|
1744
|
-
._Chat-planPath_8hszl_324 {
|
|
1745
|
-
font-weight: 600;
|
|
1746
|
-
font-size: var(--puck-font-size-xxxs);
|
|
1747
|
-
opacity: 0.8;
|
|
1748
|
-
}
|
|
1749
|
-
._Chat-planHeader_8hszl_330 {
|
|
1750
|
-
display: flex;
|
|
1751
|
-
justify-content: space-between;
|
|
1752
|
-
gap: 8px;
|
|
1753
|
-
}
|
|
1754
|
-
._Chat-planTitle_8hszl_336 {
|
|
1755
|
-
font-weight: 600;
|
|
1756
|
-
font-size: var(--puck-font-size-xs);
|
|
1757
|
-
}
|
|
1758
|
-
._Chat-planPrompt_8hszl_341 {
|
|
1759
|
-
color: var(--puck-color-grey-03);
|
|
1760
|
-
font-size: var(--puck-font-size-xxs);
|
|
1761
|
-
margin-top: 4px;
|
|
1762
|
-
}
|
|
1763
|
-
._Chat-planStatus_8hszl_347 {
|
|
1764
|
-
margin-left: auto;
|
|
1765
|
-
}
|
|
1766
|
-
._Chat-plan_8hszl_274 {
|
|
1767
|
-
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
1768
|
-
padding: 8px 12px;
|
|
1769
|
-
}
|
|
1770
|
-
._Chat-plan_8hszl_274:last-of-type {
|
|
1771
|
-
border-bottom: 0;
|
|
1772
|
-
}
|
|
1773
|
-
._Chat-planSummary_8hszl_303 {
|
|
1774
|
-
list-style: none;
|
|
1775
|
-
}
|
|
1776
|
-
._Chat-planSummary_8hszl_303::-webkit-details-marker {
|
|
1777
|
-
display: none;
|
|
1778
|
-
}
|
|
1779
|
-
._Chat-textStatus_8hszl_368 {
|
|
1780
|
-
background-color: var(--puck-color-grey-04);
|
|
1781
|
-
background-image:
|
|
1782
|
-
linear-gradient(
|
|
1783
|
-
110deg,
|
|
1784
|
-
var(--puck-color-grey-04) 0%,
|
|
1785
|
-
var(--puck-color-grey-08) 50%,
|
|
1786
|
-
var(--puck-color-grey-04) 100%);
|
|
1787
|
-
background-size: 40% 100%;
|
|
1788
|
-
background-position: 100% 0;
|
|
1789
|
-
background-repeat: no-repeat;
|
|
1790
|
-
-webkit-background-clip: text;
|
|
1791
|
-
background-clip: text;
|
|
1792
|
-
color: transparent;
|
|
1793
|
-
-webkit-text-fill-color: transparent;
|
|
1794
|
-
animation: _Chat-textStatusShimmer_8hszl_1 1.4s linear infinite;
|
|
1795
|
-
font-weight: 500;
|
|
1796
|
-
margin-top: 4px;
|
|
1797
|
-
}
|
|
1798
|
-
@keyframes _Chat-textStatusShimmer_8hszl_1 {
|
|
1799
|
-
from {
|
|
1800
|
-
background-position: -100% 100%;
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
@media (prefers-reduced-motion: reduce) {
|
|
1804
|
-
._Chat-textStatus_8hszl_368 {
|
|
1805
|
-
animation: none;
|
|
1806
|
-
background-image: none;
|
|
1807
|
-
color: var(--puck-color-grey-03);
|
|
1808
|
-
-webkit-text-fill-color: currentColor;
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
1701
|
|
|
1812
1702
|
/* css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-ai/src/components/PromptForm/styles.module.css/#css-module-data */
|
|
1813
1703
|
._PromptForm_1r4kq_1 {
|
package/dist/index.js
CHANGED
|
@@ -250,12 +250,6 @@ var Bot = createLucideIcon("Bot", [
|
|
|
250
250
|
init_react_import();
|
|
251
251
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
252
252
|
|
|
253
|
-
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
254
|
-
init_react_import();
|
|
255
|
-
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
256
|
-
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
257
|
-
]);
|
|
258
|
-
|
|
259
253
|
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
|
|
260
254
|
init_react_import();
|
|
261
255
|
var RotateCcw = createLucideIcon("RotateCcw", [
|
|
@@ -531,7 +525,7 @@ function useChat({
|
|
|
531
525
|
}
|
|
532
526
|
|
|
533
527
|
// src/components/Chat/index.tsx
|
|
534
|
-
var
|
|
528
|
+
var import_core2 = require("@puckeditor/core");
|
|
535
529
|
var import_ai4 = require("ai");
|
|
536
530
|
var import_react25 = require("react");
|
|
537
531
|
var import_ulid = require("ulid");
|
|
@@ -6186,7 +6180,7 @@ var ctx = (0, import_react20.createContext)({});
|
|
|
6186
6180
|
|
|
6187
6181
|
// css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
6188
6182
|
init_react_import();
|
|
6189
|
-
var styles_module_default8 = { "Chat": "
|
|
6183
|
+
var styles_module_default8 = { "Chat": "_Chat_1njo2_1", "Chat-inner": "_Chat-inner_1njo2_17", "Chat--hasMessages": "_Chat--hasMessages_1njo2_25", "Chat--hasChildren": "_Chat--hasChildren_1njo2_29", "Chat-messages": "_Chat-messages_1njo2_34", "Chat-form": "_Chat-form_1njo2_41", "Chat--hideInput": "_Chat--hideInput_1njo2_46", "Chat-formHelper": "_Chat-formHelper_1njo2_60", "Chat-examplePrompts": "_Chat-examplePrompts_1njo2_75", "Chat-examplePrompt": "_Chat-examplePrompt_1njo2_75", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_1njo2_105", "Chat-default": "_Chat-default_1njo2_110", "ChatMessage": "_ChatMessage_1njo2_127", "ChatMessage--userRole": "_ChatMessage--userRole_1njo2_133", "ChatMessage-text": "_ChatMessage-text_1njo2_133", "ChatMessage-data": "_ChatMessage-data_1njo2_231", "ChatMessage-dataInner": "_ChatMessage-dataInner_1njo2_242", "ChatMessage-dataIcon": "_ChatMessage-dataIcon_1njo2_248", "Chat-loader": "_Chat-loader_1njo2_252", "Chat-error": "_Chat-error_1njo2_257", "Chat-errorLabel": "_Chat-errorLabel_1njo2_266", "Chat-errorAction": "_Chat-errorAction_1njo2_270" };
|
|
6190
6184
|
|
|
6191
6185
|
// src/components/PromptForm/index.tsx
|
|
6192
6186
|
init_react_import();
|
|
@@ -6338,31 +6332,7 @@ var toolStatusContext = (0, import_react22.createContext)({});
|
|
|
6338
6332
|
var ToolStatusProvider = toolStatusContext.Provider;
|
|
6339
6333
|
|
|
6340
6334
|
// src/components/ChatBody/index.tsx
|
|
6341
|
-
var import_core2 = require("@puckeditor/core");
|
|
6342
|
-
var import_plugin_pages = require("@puckeditor/plugin-pages");
|
|
6343
6335
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6344
|
-
async function* iterateSSE(body) {
|
|
6345
|
-
const reader = body.getReader();
|
|
6346
|
-
const dec = new TextDecoder();
|
|
6347
|
-
let buf = "";
|
|
6348
|
-
while (true) {
|
|
6349
|
-
const { done, value } = await reader.read();
|
|
6350
|
-
if (done) break;
|
|
6351
|
-
buf += dec.decode(value, { stream: true });
|
|
6352
|
-
let idx;
|
|
6353
|
-
while ((idx = buf.indexOf("\n\n")) >= 0) {
|
|
6354
|
-
const chunk = buf.slice(0, idx).trim();
|
|
6355
|
-
buf = buf.slice(idx + 2);
|
|
6356
|
-
if (!chunk) continue;
|
|
6357
|
-
const line = chunk.startsWith("data: ") ? chunk.slice(6) : chunk;
|
|
6358
|
-
try {
|
|
6359
|
-
yield JSON.parse(line);
|
|
6360
|
-
} catch {
|
|
6361
|
-
}
|
|
6362
|
-
}
|
|
6363
|
-
}
|
|
6364
|
-
}
|
|
6365
|
-
var usePuck = (0, import_core2.createUsePuck)();
|
|
6366
6336
|
var cx8 = getClassNameFactory2("Chat", styles_module_default8);
|
|
6367
6337
|
var cxMessage = getClassNameFactory2("ChatMessage", styles_module_default8);
|
|
6368
6338
|
function ChatBody({
|
|
@@ -6437,86 +6407,11 @@ function ChatMessagePart({
|
|
|
6437
6407
|
if (part.type === "text") {
|
|
6438
6408
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cxMessage("text"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChatMessageWrapper, { role, children: part.text }) });
|
|
6439
6409
|
}
|
|
6440
|
-
if (part.type === "tool-plan") {
|
|
6441
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PlanTool, { ...part });
|
|
6442
|
-
}
|
|
6443
6410
|
if (part.type.startsWith("tool-")) {
|
|
6444
6411
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PuckTool, { ...part });
|
|
6445
6412
|
}
|
|
6446
6413
|
return null;
|
|
6447
6414
|
}
|
|
6448
|
-
function PlanTool({ output }) {
|
|
6449
|
-
const planOutput = output?.plan;
|
|
6450
|
-
const config = usePuck((s2) => s2.config);
|
|
6451
|
-
const history = usePuck((s2) => s2.history);
|
|
6452
|
-
const dispatch = usePuck((s2) => s2.dispatch);
|
|
6453
|
-
const getPuck = (0, import_core2.useGetPuck)();
|
|
6454
|
-
const [loading, setLoading] = (0, import_react23.useState)({});
|
|
6455
|
-
const { setPageVersions, createPage } = (0, import_plugin_pages.usePagesStore)();
|
|
6456
|
-
if (!planOutput) {
|
|
6457
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("textStatus"), children: "Planning" });
|
|
6458
|
-
}
|
|
6459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cx8("planGroup"), children: [
|
|
6460
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("planGroupHeader"), children: "Plan" }),
|
|
6461
|
-
planOutput?.pages?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("details", { className: cx8("plan"), children: [
|
|
6462
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("summary", { className: cx8("planSummary"), children: [
|
|
6463
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cx8("planSummaryText"), children: [
|
|
6464
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cx8("planHeader"), children: [
|
|
6465
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("planTitle"), children: item.shortTitle }),
|
|
6466
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("planStatus"), children: loading[item.path] && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Loader, { size: 18 }) })
|
|
6467
|
-
] }),
|
|
6468
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("planPath"), children: item.path })
|
|
6469
|
-
] }),
|
|
6470
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("planSummaryIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, {}) })
|
|
6471
|
-
] }),
|
|
6472
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("planPrompt"), children: item.pagePrompt })
|
|
6473
|
-
] }, item.path)),
|
|
6474
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cx8("planGroupFooter"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6475
|
-
Button,
|
|
6476
|
-
{
|
|
6477
|
-
onClick: async () => {
|
|
6478
|
-
const res = await fetch(`/api/puck/plan`, {
|
|
6479
|
-
method: "POST",
|
|
6480
|
-
body: JSON.stringify({ plan: planOutput, config })
|
|
6481
|
-
});
|
|
6482
|
-
if (res.body) {
|
|
6483
|
-
for await (const chunk of iterateSSE(res.body)) {
|
|
6484
|
-
if (chunk.type === "data-plan-progress") {
|
|
6485
|
-
if (chunk.data.data) {
|
|
6486
|
-
const tempId = Math.random().toString();
|
|
6487
|
-
setPageVersions(
|
|
6488
|
-
chunk.data.path,
|
|
6489
|
-
[
|
|
6490
|
-
{
|
|
6491
|
-
id: tempId,
|
|
6492
|
-
data: chunk.data.data,
|
|
6493
|
-
versionNumber: 1,
|
|
6494
|
-
isNew: true
|
|
6495
|
-
}
|
|
6496
|
-
],
|
|
6497
|
-
chunk.data.path
|
|
6498
|
-
);
|
|
6499
|
-
setLoading((s2) => ({ ...s2, [chunk.data.path]: false }));
|
|
6500
|
-
if (import_plugin_pages.usePagesStore.getState().activePage === chunk.data.path) {
|
|
6501
|
-
history.setHistories([]);
|
|
6502
|
-
dispatch({
|
|
6503
|
-
type: "set",
|
|
6504
|
-
state: { ...getPuck().appState, data: chunk.data.data }
|
|
6505
|
-
});
|
|
6506
|
-
}
|
|
6507
|
-
} else if (chunk.data.path && chunk.data.status === "processing") {
|
|
6508
|
-
createPage(chunk.data.path);
|
|
6509
|
-
setLoading((s2) => ({ ...s2, [chunk.data.path]: true }));
|
|
6510
|
-
}
|
|
6511
|
-
}
|
|
6512
|
-
}
|
|
6513
|
-
}
|
|
6514
|
-
},
|
|
6515
|
-
children: "Execute plan"
|
|
6516
|
-
}
|
|
6517
|
-
) })
|
|
6518
|
-
] });
|
|
6519
|
-
}
|
|
6520
6415
|
function PuckTool({
|
|
6521
6416
|
toolCallId,
|
|
6522
6417
|
output,
|
|
@@ -6744,7 +6639,7 @@ var q2 = (0, import_qler.default)();
|
|
|
6744
6639
|
var BENCHMARK = false;
|
|
6745
6640
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
|
|
6746
6641
|
var getClassName18 = getClassNameFactory("Chat", styles_module_default);
|
|
6747
|
-
var
|
|
6642
|
+
var usePuck = (0, import_core2.createUsePuck)();
|
|
6748
6643
|
function Chat2({
|
|
6749
6644
|
chat,
|
|
6750
6645
|
host = "/api/puck/chat",
|
|
@@ -6752,8 +6647,8 @@ function Chat2({
|
|
|
6752
6647
|
scrollTrackingId
|
|
6753
6648
|
}) {
|
|
6754
6649
|
const { examplePrompts } = chat ?? {};
|
|
6755
|
-
const puckDispatch =
|
|
6756
|
-
const getPuck = (0,
|
|
6650
|
+
const puckDispatch = usePuck((s2) => s2.dispatch);
|
|
6651
|
+
const getPuck = (0, import_core2.useGetPuck)();
|
|
6757
6652
|
const localChatId = (0, import_react25.useRef)("");
|
|
6758
6653
|
const inputRef = (0, import_react25.useRef)(null);
|
|
6759
6654
|
const pluginRef = (0, import_react25.useRef)(null);
|
|
@@ -6761,29 +6656,39 @@ function Chat2({
|
|
|
6761
6656
|
const [toolStatus, setToolStatus] = (0, import_react25.useState)({});
|
|
6762
6657
|
const uploadScreenshot = (0, import_react25.useCallback)(
|
|
6763
6658
|
async (width, bucketUrl) => {
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6659
|
+
try {
|
|
6660
|
+
const iframeDocument = document?.getElementById("preview-frame")?.contentDocument?.documentElement ?? null;
|
|
6661
|
+
if (!iframeDocument) {
|
|
6662
|
+
throw new Error("Preview frame not found");
|
|
6663
|
+
}
|
|
6664
|
+
const canvas = await (0, import_html2canvas_pro.default)(iframeDocument, {
|
|
6665
|
+
scale: 2,
|
|
6666
|
+
backgroundColor: "#ffffff",
|
|
6667
|
+
width,
|
|
6668
|
+
windowWidth: width,
|
|
6669
|
+
foreignObjectRendering: false,
|
|
6670
|
+
imageTimeout: 3e4,
|
|
6671
|
+
logging: false,
|
|
6672
|
+
allowTaint: false,
|
|
6673
|
+
useCORS: true,
|
|
6674
|
+
scrollY: 0,
|
|
6675
|
+
ignoreElements: (el) => Array.from(el.classList).some(
|
|
6676
|
+
(c2) => c2.startsWith("_DraggableComponent--hover") || c2.startsWith("_ActionBar")
|
|
6677
|
+
)
|
|
6678
|
+
});
|
|
6679
|
+
const image = canvas.toDataURL("image/webp", 0.8);
|
|
6680
|
+
const imageResponse = await fetch(image);
|
|
6681
|
+
const blob = await imageResponse.blob();
|
|
6682
|
+
const uploadResponse = await fetch(bucketUrl, {
|
|
6683
|
+
method: "PUT",
|
|
6684
|
+
body: blob
|
|
6685
|
+
});
|
|
6686
|
+
if (!uploadResponse.ok) {
|
|
6687
|
+
throw new Error(`Upload failed with status ${uploadResponse.status}`);
|
|
6688
|
+
}
|
|
6689
|
+
} catch (e2) {
|
|
6690
|
+
console.error("Failed to upload screenshot", e2);
|
|
6691
|
+
}
|
|
6787
6692
|
},
|
|
6788
6693
|
[]
|
|
6789
6694
|
);
|
|
@@ -6828,9 +6733,10 @@ function Chat2({
|
|
|
6828
6733
|
return;
|
|
6829
6734
|
}
|
|
6830
6735
|
case "data-send-screenshot": {
|
|
6831
|
-
dataPart.data.urls.
|
|
6736
|
+
dataPart.data.urls.forEach((obj) => {
|
|
6832
6737
|
const [[key, value]] = Object.entries(obj);
|
|
6833
6738
|
const breakpoint = Number(key);
|
|
6739
|
+
uploadScreenshot(breakpoint, value);
|
|
6834
6740
|
});
|
|
6835
6741
|
return;
|
|
6836
6742
|
}
|
|
@@ -6839,7 +6745,7 @@ function Chat2({
|
|
|
6839
6745
|
return;
|
|
6840
6746
|
}
|
|
6841
6747
|
},
|
|
6842
|
-
[getPuck]
|
|
6748
|
+
[getPuck, puckDispatch, uploadScreenshot]
|
|
6843
6749
|
);
|
|
6844
6750
|
const { messages, status, sendMessage, regenerate, setMessages } = useChat({
|
|
6845
6751
|
generateId: () => prefixedUlid("msg"),
|
|
@@ -7194,7 +7100,6 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
7194
7100
|
lucide-react/dist/esm/icons/arrow-up.js:
|
|
7195
7101
|
lucide-react/dist/esm/icons/bot.js:
|
|
7196
7102
|
lucide-react/dist/esm/icons/check.js:
|
|
7197
|
-
lucide-react/dist/esm/icons/chevron-down.js:
|
|
7198
7103
|
lucide-react/dist/esm/icons/rotate-ccw.js:
|
|
7199
7104
|
lucide-react/dist/esm/icons/triangle-alert.js:
|
|
7200
7105
|
lucide-react/dist/esm/lucide-react.js:
|
package/dist/index.mjs
CHANGED
|
@@ -238,12 +238,6 @@ var Bot = createLucideIcon("Bot", [
|
|
|
238
238
|
init_react_import();
|
|
239
239
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
240
240
|
|
|
241
|
-
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
242
|
-
init_react_import();
|
|
243
|
-
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
244
|
-
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
245
|
-
]);
|
|
246
|
-
|
|
247
241
|
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
|
|
248
242
|
init_react_import();
|
|
249
243
|
var RotateCcw = createLucideIcon("RotateCcw", [
|
|
@@ -522,13 +516,13 @@ function useChat({
|
|
|
522
516
|
|
|
523
517
|
// src/components/Chat/index.tsx
|
|
524
518
|
import {
|
|
525
|
-
createUsePuck
|
|
526
|
-
useGetPuck
|
|
519
|
+
createUsePuck,
|
|
520
|
+
useGetPuck
|
|
527
521
|
} from "@puckeditor/core";
|
|
528
522
|
import {
|
|
529
523
|
DefaultChatTransport
|
|
530
524
|
} from "ai";
|
|
531
|
-
import { useCallback as useCallback4, useEffect as useEffect10, useMemo as useMemo4, useRef as useRef9, useState as
|
|
525
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useMemo as useMemo4, useRef as useRef9, useState as useState14 } from "react";
|
|
532
526
|
import { ulid } from "ulid";
|
|
533
527
|
|
|
534
528
|
// ../utils/lib/get-class-name-factory.ts
|
|
@@ -572,8 +566,7 @@ var styles_module_default = { "Chat": "_Chat_3s08c_1", "Chat-header": "_Chat-hea
|
|
|
572
566
|
// src/components/ChatBody/index.tsx
|
|
573
567
|
init_react_import();
|
|
574
568
|
import {
|
|
575
|
-
useContext as useContext3
|
|
576
|
-
useState as useState14
|
|
569
|
+
useContext as useContext3
|
|
577
570
|
} from "react";
|
|
578
571
|
import { useStickToBottom } from "use-stick-to-bottom";
|
|
579
572
|
import Markdown from "react-markdown";
|
|
@@ -6184,7 +6177,7 @@ var ctx = createContext2({});
|
|
|
6184
6177
|
|
|
6185
6178
|
// css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
6186
6179
|
init_react_import();
|
|
6187
|
-
var styles_module_default8 = { "Chat": "
|
|
6180
|
+
var styles_module_default8 = { "Chat": "_Chat_1njo2_1", "Chat-inner": "_Chat-inner_1njo2_17", "Chat--hasMessages": "_Chat--hasMessages_1njo2_25", "Chat--hasChildren": "_Chat--hasChildren_1njo2_29", "Chat-messages": "_Chat-messages_1njo2_34", "Chat-form": "_Chat-form_1njo2_41", "Chat--hideInput": "_Chat--hideInput_1njo2_46", "Chat-formHelper": "_Chat-formHelper_1njo2_60", "Chat-examplePrompts": "_Chat-examplePrompts_1njo2_75", "Chat-examplePrompt": "_Chat-examplePrompt_1njo2_75", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_1njo2_105", "Chat-default": "_Chat-default_1njo2_110", "ChatMessage": "_ChatMessage_1njo2_127", "ChatMessage--userRole": "_ChatMessage--userRole_1njo2_133", "ChatMessage-text": "_ChatMessage-text_1njo2_133", "ChatMessage-data": "_ChatMessage-data_1njo2_231", "ChatMessage-dataInner": "_ChatMessage-dataInner_1njo2_242", "ChatMessage-dataIcon": "_ChatMessage-dataIcon_1njo2_248", "Chat-loader": "_Chat-loader_1njo2_252", "Chat-error": "_Chat-error_1njo2_257", "Chat-errorLabel": "_Chat-errorLabel_1njo2_266", "Chat-errorAction": "_Chat-errorAction_1njo2_270" };
|
|
6188
6181
|
|
|
6189
6182
|
// src/components/PromptForm/index.tsx
|
|
6190
6183
|
init_react_import();
|
|
@@ -6340,31 +6333,7 @@ var toolStatusContext = createContext3({});
|
|
|
6340
6333
|
var ToolStatusProvider = toolStatusContext.Provider;
|
|
6341
6334
|
|
|
6342
6335
|
// src/components/ChatBody/index.tsx
|
|
6343
|
-
import { createUsePuck, useGetPuck } from "@puckeditor/core";
|
|
6344
|
-
import { usePagesStore } from "@puckeditor/plugin-pages";
|
|
6345
6336
|
import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6346
|
-
async function* iterateSSE(body) {
|
|
6347
|
-
const reader = body.getReader();
|
|
6348
|
-
const dec = new TextDecoder();
|
|
6349
|
-
let buf = "";
|
|
6350
|
-
while (true) {
|
|
6351
|
-
const { done, value } = await reader.read();
|
|
6352
|
-
if (done) break;
|
|
6353
|
-
buf += dec.decode(value, { stream: true });
|
|
6354
|
-
let idx;
|
|
6355
|
-
while ((idx = buf.indexOf("\n\n")) >= 0) {
|
|
6356
|
-
const chunk = buf.slice(0, idx).trim();
|
|
6357
|
-
buf = buf.slice(idx + 2);
|
|
6358
|
-
if (!chunk) continue;
|
|
6359
|
-
const line = chunk.startsWith("data: ") ? chunk.slice(6) : chunk;
|
|
6360
|
-
try {
|
|
6361
|
-
yield JSON.parse(line);
|
|
6362
|
-
} catch {
|
|
6363
|
-
}
|
|
6364
|
-
}
|
|
6365
|
-
}
|
|
6366
|
-
}
|
|
6367
|
-
var usePuck = createUsePuck();
|
|
6368
6337
|
var cx8 = getClassNameFactory2("Chat", styles_module_default8);
|
|
6369
6338
|
var cxMessage = getClassNameFactory2("ChatMessage", styles_module_default8);
|
|
6370
6339
|
function ChatBody({
|
|
@@ -6439,86 +6408,11 @@ function ChatMessagePart({
|
|
|
6439
6408
|
if (part.type === "text") {
|
|
6440
6409
|
return /* @__PURE__ */ jsx30("div", { className: cxMessage("text"), children: /* @__PURE__ */ jsx30(ChatMessageWrapper, { role, children: part.text }) });
|
|
6441
6410
|
}
|
|
6442
|
-
if (part.type === "tool-plan") {
|
|
6443
|
-
return /* @__PURE__ */ jsx30(PlanTool, { ...part });
|
|
6444
|
-
}
|
|
6445
6411
|
if (part.type.startsWith("tool-")) {
|
|
6446
6412
|
return /* @__PURE__ */ jsx30(PuckTool, { ...part });
|
|
6447
6413
|
}
|
|
6448
6414
|
return null;
|
|
6449
6415
|
}
|
|
6450
|
-
function PlanTool({ output }) {
|
|
6451
|
-
const planOutput = output?.plan;
|
|
6452
|
-
const config = usePuck((s2) => s2.config);
|
|
6453
|
-
const history = usePuck((s2) => s2.history);
|
|
6454
|
-
const dispatch = usePuck((s2) => s2.dispatch);
|
|
6455
|
-
const getPuck = useGetPuck();
|
|
6456
|
-
const [loading, setLoading] = useState14({});
|
|
6457
|
-
const { setPageVersions, createPage } = usePagesStore();
|
|
6458
|
-
if (!planOutput) {
|
|
6459
|
-
return /* @__PURE__ */ jsx30("div", { className: cx8("textStatus"), children: "Planning" });
|
|
6460
|
-
}
|
|
6461
|
-
return /* @__PURE__ */ jsxs17("div", { className: cx8("planGroup"), children: [
|
|
6462
|
-
/* @__PURE__ */ jsx30("div", { className: cx8("planGroupHeader"), children: "Plan" }),
|
|
6463
|
-
planOutput?.pages?.map((item) => /* @__PURE__ */ jsxs17("details", { className: cx8("plan"), children: [
|
|
6464
|
-
/* @__PURE__ */ jsxs17("summary", { className: cx8("planSummary"), children: [
|
|
6465
|
-
/* @__PURE__ */ jsxs17("div", { className: cx8("planSummaryText"), children: [
|
|
6466
|
-
/* @__PURE__ */ jsxs17("div", { className: cx8("planHeader"), children: [
|
|
6467
|
-
/* @__PURE__ */ jsx30("div", { className: cx8("planTitle"), children: item.shortTitle }),
|
|
6468
|
-
/* @__PURE__ */ jsx30("div", { className: cx8("planStatus"), children: loading[item.path] && /* @__PURE__ */ jsx30(Loader, { size: 18 }) })
|
|
6469
|
-
] }),
|
|
6470
|
-
/* @__PURE__ */ jsx30("div", { className: cx8("planPath"), children: item.path })
|
|
6471
|
-
] }),
|
|
6472
|
-
/* @__PURE__ */ jsx30("div", { className: cx8("planSummaryIcon"), children: /* @__PURE__ */ jsx30(ChevronDown, {}) })
|
|
6473
|
-
] }),
|
|
6474
|
-
/* @__PURE__ */ jsx30("div", { className: cx8("planPrompt"), children: item.pagePrompt })
|
|
6475
|
-
] }, item.path)),
|
|
6476
|
-
/* @__PURE__ */ jsx30("div", { className: cx8("planGroupFooter"), children: /* @__PURE__ */ jsx30(
|
|
6477
|
-
Button,
|
|
6478
|
-
{
|
|
6479
|
-
onClick: async () => {
|
|
6480
|
-
const res = await fetch(`/api/puck/plan`, {
|
|
6481
|
-
method: "POST",
|
|
6482
|
-
body: JSON.stringify({ plan: planOutput, config })
|
|
6483
|
-
});
|
|
6484
|
-
if (res.body) {
|
|
6485
|
-
for await (const chunk of iterateSSE(res.body)) {
|
|
6486
|
-
if (chunk.type === "data-plan-progress") {
|
|
6487
|
-
if (chunk.data.data) {
|
|
6488
|
-
const tempId = Math.random().toString();
|
|
6489
|
-
setPageVersions(
|
|
6490
|
-
chunk.data.path,
|
|
6491
|
-
[
|
|
6492
|
-
{
|
|
6493
|
-
id: tempId,
|
|
6494
|
-
data: chunk.data.data,
|
|
6495
|
-
versionNumber: 1,
|
|
6496
|
-
isNew: true
|
|
6497
|
-
}
|
|
6498
|
-
],
|
|
6499
|
-
chunk.data.path
|
|
6500
|
-
);
|
|
6501
|
-
setLoading((s2) => ({ ...s2, [chunk.data.path]: false }));
|
|
6502
|
-
if (usePagesStore.getState().activePage === chunk.data.path) {
|
|
6503
|
-
history.setHistories([]);
|
|
6504
|
-
dispatch({
|
|
6505
|
-
type: "set",
|
|
6506
|
-
state: { ...getPuck().appState, data: chunk.data.data }
|
|
6507
|
-
});
|
|
6508
|
-
}
|
|
6509
|
-
} else if (chunk.data.path && chunk.data.status === "processing") {
|
|
6510
|
-
createPage(chunk.data.path);
|
|
6511
|
-
setLoading((s2) => ({ ...s2, [chunk.data.path]: true }));
|
|
6512
|
-
}
|
|
6513
|
-
}
|
|
6514
|
-
}
|
|
6515
|
-
}
|
|
6516
|
-
},
|
|
6517
|
-
children: "Execute plan"
|
|
6518
|
-
}
|
|
6519
|
-
) })
|
|
6520
|
-
] });
|
|
6521
|
-
}
|
|
6522
6416
|
function PuckTool({
|
|
6523
6417
|
toolCallId,
|
|
6524
6418
|
output,
|
|
@@ -6746,7 +6640,7 @@ var q2 = qler();
|
|
|
6746
6640
|
var BENCHMARK = false;
|
|
6747
6641
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
|
|
6748
6642
|
var getClassName18 = getClassNameFactory("Chat", styles_module_default);
|
|
6749
|
-
var
|
|
6643
|
+
var usePuck = createUsePuck();
|
|
6750
6644
|
function Chat2({
|
|
6751
6645
|
chat,
|
|
6752
6646
|
host = "/api/puck/chat",
|
|
@@ -6754,38 +6648,48 @@ function Chat2({
|
|
|
6754
6648
|
scrollTrackingId
|
|
6755
6649
|
}) {
|
|
6756
6650
|
const { examplePrompts } = chat ?? {};
|
|
6757
|
-
const puckDispatch =
|
|
6758
|
-
const getPuck =
|
|
6651
|
+
const puckDispatch = usePuck((s2) => s2.dispatch);
|
|
6652
|
+
const getPuck = useGetPuck();
|
|
6759
6653
|
const localChatId = useRef9("");
|
|
6760
6654
|
const inputRef = useRef9(null);
|
|
6761
6655
|
const pluginRef = useRef9(null);
|
|
6762
|
-
const [error, setError] =
|
|
6763
|
-
const [toolStatus, setToolStatus] =
|
|
6656
|
+
const [error, setError] = useState14();
|
|
6657
|
+
const [toolStatus, setToolStatus] = useState14({});
|
|
6764
6658
|
const uploadScreenshot = useCallback4(
|
|
6765
6659
|
async (width, bucketUrl) => {
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6660
|
+
try {
|
|
6661
|
+
const iframeDocument = document?.getElementById("preview-frame")?.contentDocument?.documentElement ?? null;
|
|
6662
|
+
if (!iframeDocument) {
|
|
6663
|
+
throw new Error("Preview frame not found");
|
|
6664
|
+
}
|
|
6665
|
+
const canvas = await html2canvas(iframeDocument, {
|
|
6666
|
+
scale: 2,
|
|
6667
|
+
backgroundColor: "#ffffff",
|
|
6668
|
+
width,
|
|
6669
|
+
windowWidth: width,
|
|
6670
|
+
foreignObjectRendering: false,
|
|
6671
|
+
imageTimeout: 3e4,
|
|
6672
|
+
logging: false,
|
|
6673
|
+
allowTaint: false,
|
|
6674
|
+
useCORS: true,
|
|
6675
|
+
scrollY: 0,
|
|
6676
|
+
ignoreElements: (el) => Array.from(el.classList).some(
|
|
6677
|
+
(c2) => c2.startsWith("_DraggableComponent--hover") || c2.startsWith("_ActionBar")
|
|
6678
|
+
)
|
|
6679
|
+
});
|
|
6680
|
+
const image = canvas.toDataURL("image/webp", 0.8);
|
|
6681
|
+
const imageResponse = await fetch(image);
|
|
6682
|
+
const blob = await imageResponse.blob();
|
|
6683
|
+
const uploadResponse = await fetch(bucketUrl, {
|
|
6684
|
+
method: "PUT",
|
|
6685
|
+
body: blob
|
|
6686
|
+
});
|
|
6687
|
+
if (!uploadResponse.ok) {
|
|
6688
|
+
throw new Error(`Upload failed with status ${uploadResponse.status}`);
|
|
6689
|
+
}
|
|
6690
|
+
} catch (e2) {
|
|
6691
|
+
console.error("Failed to upload screenshot", e2);
|
|
6692
|
+
}
|
|
6789
6693
|
},
|
|
6790
6694
|
[]
|
|
6791
6695
|
);
|
|
@@ -6830,9 +6734,10 @@ function Chat2({
|
|
|
6830
6734
|
return;
|
|
6831
6735
|
}
|
|
6832
6736
|
case "data-send-screenshot": {
|
|
6833
|
-
dataPart.data.urls.
|
|
6737
|
+
dataPart.data.urls.forEach((obj) => {
|
|
6834
6738
|
const [[key, value]] = Object.entries(obj);
|
|
6835
6739
|
const breakpoint = Number(key);
|
|
6740
|
+
uploadScreenshot(breakpoint, value);
|
|
6836
6741
|
});
|
|
6837
6742
|
return;
|
|
6838
6743
|
}
|
|
@@ -6841,7 +6746,7 @@ function Chat2({
|
|
|
6841
6746
|
return;
|
|
6842
6747
|
}
|
|
6843
6748
|
},
|
|
6844
|
-
[getPuck]
|
|
6749
|
+
[getPuck, puckDispatch, uploadScreenshot]
|
|
6845
6750
|
);
|
|
6846
6751
|
const { messages, status, sendMessage, regenerate, setMessages } = useChat({
|
|
6847
6752
|
generateId: () => prefixedUlid("msg"),
|
|
@@ -6913,7 +6818,7 @@ function Chat2({
|
|
|
6913
6818
|
}
|
|
6914
6819
|
}
|
|
6915
6820
|
});
|
|
6916
|
-
const [forcedStatus, setForcedStatus] =
|
|
6821
|
+
const [forcedStatus, setForcedStatus] = useState14();
|
|
6917
6822
|
const resolvedStatus = useMemo4(
|
|
6918
6823
|
() => forcedStatus ?? status,
|
|
6919
6824
|
[status, forcedStatus]
|
|
@@ -7195,7 +7100,6 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
7195
7100
|
lucide-react/dist/esm/icons/arrow-up.js:
|
|
7196
7101
|
lucide-react/dist/esm/icons/bot.js:
|
|
7197
7102
|
lucide-react/dist/esm/icons/check.js:
|
|
7198
|
-
lucide-react/dist/esm/icons/chevron-down.js:
|
|
7199
7103
|
lucide-react/dist/esm/icons/rotate-ccw.js:
|
|
7200
7104
|
lucide-react/dist/esm/icons/triangle-alert.js:
|
|
7201
7105
|
lucide-react/dist/esm/lucide-react.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-ai",
|
|
3
|
-
"version": "0.6.1-canary.
|
|
3
|
+
"version": "0.6.1-canary.45a1a2e4",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": "puckeditor/puck",
|
|
6
6
|
"bugs": "https://github.com/puckeditor/puck/issues",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"lint": "eslint \"**/*.ts*\"",
|
|
23
23
|
"build": "rm -rf dist && tsup index.ts",
|
|
24
|
-
"dev": "tsup index.ts --watch
|
|
24
|
+
"dev": "tsup index.ts --watch"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@puckeditor/ai-types": "workspace:*",
|
|
41
41
|
"@puckeditor/core": "0.21.1",
|
|
42
42
|
"@puckeditor/platform-types": "workspace:*",
|
|
43
|
-
"@puckeditor/plugin-pages": "workspace:*",
|
|
44
43
|
"@types/jest": "^30.0.0",
|
|
45
44
|
"@types/node": "^24.3.0",
|
|
46
45
|
"@types/react": "^19.1.8",
|