Spaces:
Running
Running
File size: 77,283 Bytes
48edd44 424a54a 0eda47f 424a54a 48edd44 424a54a 48edd44 424a54a 48edd44 0eda47f 424a54a 48edd44 0eda47f 424a54a 48edd44 0eda47f 424a54a 48edd44 0eda47f 424a54a b6a8769 0eda47f 424a54a 48edd44 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 9a43c4b 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a ec391a4 32ae7d4 ec391a4 0eda47f 32ae7d4 ec391a4 0eda47f 32ae7d4 7d4dcb0 32ae7d4 ec391a4 32ae7d4 97f041d 32ae7d4 ec391a4 32ae7d4 ec391a4 32ae7d4 c23c3fa 97f041d ec391a4 9a43c4b ec391a4 97f041d ec391a4 7d4dcb0 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 9a43c4b 0eda47f 9a43c4b 0eda47f 9a43c4b 424a54a 0eda47f 424a54a 32ae7d4 e2eb37c 424a54a 32ae7d4 e2eb37c 424a54a 32ae7d4 e2eb37c 424a54a 32ae7d4 e2eb37c 0eda47f f6bfe81 32ae7d4 e2eb37c 32ae7d4 e2eb37c 0eda47f f6bfe81 32ae7d4 e2eb37c 32ae7d4 e2eb37c f6bfe81 32ae7d4 97f041d 32ae7d4 97f041d 32ae7d4 e2eb37c 32ae7d4 e2eb37c 32ae7d4 e2eb37c 32ae7d4 e2eb37c f6bfe81 32ae7d4 c23c3fa 32ae7d4 c23c3fa 97f041d e2eb37c 9a43c4b e2eb37c 97f041d e2eb37c 97f041d e2eb37c 97f041d 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f ae87306 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0b56fd7 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 9a43c4b 424a54a 0eda47f 424a54a 0eda47f 48edd44 32ae7d4 9a43c4b ec391a4 df3f4f9 9a43c4b 32ae7d4 0eda47f 9a43c4b ec391a4 0eda47f 9a43c4b 0eda47f ec391a4 0eda47f 9a43c4b 0eda47f 9a43c4b ec391a4 0eda47f 9a43c4b 0eda47f ec391a4 9a43c4b 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 48edd44 424a54a 0eda47f 424a54a 48edd44 0eda47f 424a54a 48edd44 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f 424a54a 48edd44 0eda47f 424a54a 48edd44 0eda47f f6bfe81 424a54a 9a43c4b 32ae7d4 9a43c4b 32ae7d4 9a43c4b 0eda47f 424a54a 0eda47f 424a54a 48edd44 424a54a df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 48edd44 0eda47f 424a54a 0eda47f 424a54a 0eda47f d0a6e1f 32ae7d4 ae87306 d0a6e1f c23c3fa 0eda47f 9a43c4b d0a6e1f 7d4dcb0 424a54a 7d4dcb0 d47699c 7d4dcb0 0b56fd7 ae87306 0b56fd7 1a97a14 0b56fd7 ae87306 0b56fd7 ae87306 0b56fd7 ae87306 0b56fd7 ae87306 6f7d981 424a54a 6f7d981 424a54a 6f7d981 424a54a 6f7d981 424a54a 6f7d981 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 ae87306 7d4dcb0 ae87306 0eda47f df3f4f9 7d4dcb0 d47699c 7d4dcb0 d47699c 7d4dcb0 d47699c 7d4dcb0 d47699c 7d4dcb0 ae87306 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f 9a43c4b c23c3fa 0eda47f 0c0c388 0eda47f 32ae7d4 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f df3f4f9 0eda47f ae87306 2fe5e9d ae87306 2fe5e9d ae87306 2fe5e9d ae87306 2fe5e9d ae87306 7d4dcb0 d47699c 7d4dcb0 d47699c 7d4dcb0 d47699c 7d4dcb0 d47699c 7d4dcb0 0eda47f df3f4f9 424a54a 0b56fd7 424a54a 0b56fd7 424a54a 0eda47f 0b56fd7 b2f1592 0b56fd7 b2f1592 0b56fd7 b2f1592 0b56fd7 b2f1592 0b56fd7 424a54a 0eda47f 0b56fd7 424a54a 0eda47f f6bfe81 424a54a f6bfe81 0eda47f 424a54a 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f f6bfe81 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0c0c388 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 0eda47f 424a54a 48edd44 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tend & Send - ARI Prototype</title>
<style>
:root {
--bg-dark: #0f0f1a;
--bg-card: #1a1a2e;
--bg-input: #252542;
--bg-hover: #2d2d4a;
--accent: #6366f1;
--accent-light: #818cf8;
--accent-glow: rgba(99, 102, 241, 0.3);
--tend-color: #10b981;
--tend-glow: rgba(16, 185, 129, 0.3);
--love-color: #ec4899;
--love-glow: rgba(236, 72, 153, 0.3);
--text-primary: #f1f5f9;
--text-secondary: #94a3b8;
--text-muted: #64748b;
--border: #334155;
--warning: #f59e0b;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg-dark);
color: var(--text-primary);
min-height: 100vh;
}
/* ===== THREE PANEL LAYOUT ===== */
.app-container {
display: flex;
height: 100vh;
}
/* LEFT PANEL - Tool Descriptions */
.left-panel {
width: 280px;
background: var(--bg-card);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
overflow-y: auto;
}
.left-header {
padding: 20px;
border-bottom: 1px solid var(--border);
background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.05) 100%);
}
.left-header h1 {
font-size: 1.4rem;
background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 4px;
}
.left-header p {
font-size: 0.8rem;
color: var(--text-secondary);
}
.tool-list {
flex: 1;
padding: 16px;
}
.tool-list h3 {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-muted);
margin-bottom: 12px;
}
.category-label {
font-size: 0.65rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-muted);
margin: 16px 0 8px 0;
padding-left: 4px;
}
.category-label:first-of-type {
margin-top: 0;
}
.tool-desc {
padding: 12px;
margin-bottom: 10px;
background: var(--bg-input);
border-radius: 8px;
border-left: 3px solid var(--border);
cursor: pointer;
transition: all 0.2s;
}
.tool-desc:hover {
border-left-color: var(--accent);
background: var(--bg-hover);
}
.tool-desc.active {
border-left-color: var(--accent);
background: rgba(99, 102, 241, 0.15);
}
.tool-desc h4 {
font-size: 0.9rem;
margin-bottom: 4px;
display: flex;
align-items: center;
gap: 8px;
}
.tool-desc p {
font-size: 0.75rem;
color: var(--text-muted);
line-height: 1.4;
}
/* Rainbow sidebar colors */
/* Rainbow sidebar colors: Cascading Red → Purple (12 tools top to bottom) */
/* Express (top) */
.tool-desc.send-desc {
border-left-color: #ef4444;
background: rgba(239, 68, 68, 0.1);
}
.tool-desc.tend-desc {
border-left-color: #f97316;
background: rgba(249, 115, 22, 0.1);
}
.tool-desc.nvc-desc {
border-left-color: #fb923c;
background: rgba(251, 146, 60, 0.1);
}
/* Regulate */
.tool-desc.soma-desc {
border-left-color: #f59e0b;
background: rgba(245, 158, 11, 0.1);
}
.tool-desc.love-desc {
border-left-color: #eab308;
background: rgba(234, 179, 8, 0.1);
}
.tool-desc.ground-desc {
border-left-color: #84cc16;
background: rgba(132, 204, 22, 0.1);
}
/* Understand */
.tool-desc.feel-desc {
border-left-color: #22c55e;
background: rgba(34, 197, 94, 0.1);
}
.tool-desc.need-desc {
border-left-color: #14b8a6;
background: rgba(20, 184, 166, 0.1);
}
.tool-desc.story-desc {
border-left-color: #0ea5e9;
background: rgba(14, 165, 233, 0.1);
}
/* Reconnect */
.tool-desc.repair-desc {
border-left-color: #3b82f6;
background: rgba(59, 130, 246, 0.1);
}
.tool-desc.appreciate-desc {
border-left-color: #6366f1;
background: rgba(99, 102, 241, 0.1);
}
.tool-desc.wisdom-desc {
border-left-color: #8b5cf6;
background: rgba(139, 92, 246, 0.1);
}
/* Settings */
.settings-section {
padding: 16px;
border-top: 1px solid var(--border);
background: rgba(0,0,0,0.2);
}
.toggle-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 0;
}
.toggle-row label {
font-size: 0.8rem;
color: var(--text-secondary);
}
.toggle-switch {
position: relative;
width: 40px;
height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
position: absolute;
cursor: pointer;
top: 0; left: 0; right: 0; bottom: 0;
background: var(--border);
border-radius: 22px;
transition: 0.3s;
}
.toggle-slider:before {
position: absolute;
content: "";
height: 16px;
width: 16px;
left: 3px;
bottom: 3px;
background: white;
border-radius: 50%;
transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }
.left-footer {
padding: 12px 16px;
border-top: 1px solid var(--border);
font-size: 0.7rem;
color: var(--text-muted);
}
.safety-notice {
background: rgba(245, 158, 11, 0.1);
border: 1px solid var(--warning);
border-radius: 6px;
padding: 8px;
margin-bottom: 8px;
font-size: 0.7rem;
color: var(--warning);
}
/* CENTER PANEL - Conversation */
.center-panel {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
}
.setup-panel {
background: var(--bg-card);
border-bottom: 1px solid var(--border);
padding: 20px 24px;
}
.setup-panel h2 {
font-size: 1.1rem;
margin-bottom: 16px;
}
.setup-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px 16px;
}
.setup-col {
display: flex;
flex-direction: column;
}
.setup-col.full-width { grid-column: 1 / -1; }
.setup-col label {
font-size: 0.8rem;
color: var(--text-secondary);
margin-bottom: 4px;
}
.setup-col select, .setup-col textarea {
padding: 10px 12px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 6px;
color: var(--text-primary);
font-size: 0.85rem;
font-family: inherit;
}
.setup-col textarea { resize: none; }
.setup-col select:focus, .setup-col textarea:focus { outline: none; border-color: var(--accent); }
.setup-row {
display: flex;
gap: 16px;
align-items: center;
}
.setup-option {
display: flex;
align-items: center;
gap: 6px;
}
.setup-option input[type="radio"] { accent-color: var(--accent); }
.setup-option label {
font-size: 0.85rem;
color: var(--text-secondary);
cursor: pointer;
}
.start-btn {
padding: 12px 24px;
background: var(--accent);
color: white;
border: none;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
}
.start-btn:hover { background: var(--accent-light); }
/* Conversation Header */
.conv-header {
padding: 12px 20px;
background: var(--bg-card);
border-bottom: 1px solid var(--border);
display: none;
justify-content: space-between;
align-items: center;
}
.conv-header.active { display: flex; }
.partner-info {
display: flex;
align-items: center;
gap: 10px;
}
.partner-avatar {
width: 36px;
height: 36px;
background: var(--accent);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 0.9rem;
}
.partner-details h3 { font-size: 0.95rem; }
.partner-details span { font-size: 0.75rem; color: var(--text-secondary); }
.reset-btn {
padding: 6px 12px;
background: transparent;
border: 1px solid var(--border);
color: var(--text-secondary);
border-radius: 6px;
font-size: 0.75rem;
cursor: pointer;
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent-light); }
/* Conversation Area */
.conversation-area {
flex: 1;
padding: 20px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 12px;
}
.message {
max-width: 80%;
padding: 12px 16px;
border-radius: 16px;
line-height: 1.5;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
.message.partner {
align-self: flex-start;
background: var(--bg-card);
border: 1px solid var(--border);
border-bottom-left-radius: 4px;
}
.message.user {
align-self: flex-end;
background: var(--accent);
color: white;
border-bottom-right-radius: 4px;
}
.message.ari {
align-self: center;
background: rgba(99, 102, 241, 0.1);
border: 1px solid var(--accent);
max-width: 90%;
border-radius: 10px;
}
.message.ari.tend-result {
background: rgba(16, 185, 129, 0.1);
border-color: var(--tend-color);
}
.message.ari .ari-label {
font-size: 0.65rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--accent-light);
margin-bottom: 6px;
font-weight: 600;
}
.message.ari.tend-result .ari-label { color: var(--tend-color); }
.loading {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
color: var(--text-secondary);
padding: 12px;
}
.spinner {
width: 18px;
height: 18px;
border: 2px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Tool Buttons - Categorized Rows */
.tool-buttons-container {
padding: 12px 16px;
background: var(--bg-card);
border-top: 1px solid var(--border);
display: flex;
flex-direction: column;
gap: 8px;
}
.tool-row {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.row-label {
font-size: 0.65rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
width: 70px;
flex-shrink: 0;
}
.tool-btn {
padding: 8px 14px;
border: 1px solid var(--border);
background: var(--bg-input);
color: var(--text-secondary);
border-radius: 8px;
font-size: 0.8rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 4px;
}
/* Rainbow button colors: Cascading Red → Purple (12 tools top to bottom) */
/* Express row (top) */
.tool-btn.send {
border-color: #ef4444;
color: #ef4444;
}
.tool-btn.send:hover, .tool-btn.send.active {
background: #ef4444;
color: white;
}
.tool-btn.tend {
border-color: #f97316;
color: #f97316;
}
.tool-btn.tend:hover, .tool-btn.tend.active {
background: #f97316;
color: white;
}
.tool-btn.nvc {
border-color: #fb923c;
color: #fb923c;
}
.tool-btn.nvc:hover, .tool-btn.nvc.active {
background: #fb923c;
color: white;
}
/* Regulate row */
.tool-btn.soma {
border-color: #f59e0b;
color: #f59e0b;
}
.tool-btn.soma:hover, .tool-btn.soma.active {
background: #f59e0b;
color: white;
}
.tool-btn.love {
border-color: #eab308;
color: #eab308;
}
.tool-btn.love:hover, .tool-btn.love.active {
background: #eab308;
color: white;
}
.tool-btn.ground {
border-color: #84cc16;
color: #84cc16;
}
.tool-btn.ground:hover, .tool-btn.ground.active {
background: #84cc16;
color: white;
}
/* Understand row */
.tool-btn.feel {
border-color: #22c55e;
color: #22c55e;
}
.tool-btn.feel:hover, .tool-btn.feel.active {
background: #22c55e;
color: white;
}
.tool-btn.need {
border-color: #14b8a6;
color: #14b8a6;
}
.tool-btn.need:hover, .tool-btn.need.active {
background: #14b8a6;
color: white;
}
.tool-btn.story {
border-color: #0ea5e9;
color: #0ea5e9;
}
.tool-btn.story:hover, .tool-btn.story.active {
background: #0ea5e9;
color: white;
}
/* Reconnect row */
.tool-btn.repair {
border-color: #3b82f6;
color: #3b82f6;
}
.tool-btn.repair:hover, .tool-btn.repair.active {
background: #3b82f6;
color: white;
}
.tool-btn.appreciate {
border-color: #6366f1;
color: #6366f1;
}
.tool-btn.appreciate:hover, .tool-btn.appreciate.active {
background: #6366f1;
color: white;
}
.tool-btn.wisdom {
border-color: #8b5cf6;
color: #8b5cf6;
}
.tool-btn.wisdom:hover, .tool-btn.wisdom.active {
background: #8b5cf6;
color: white;
}
/* Input Area */
.input-area {
padding: 16px 20px;
background: var(--bg-card);
border-top: 1px solid var(--border);
}
.input-row {
display: flex;
gap: 10px;
}
.input-row textarea {
flex: 1;
padding: 12px 16px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 10px;
color: var(--text-primary);
font-size: 0.9rem;
font-family: inherit;
resize: none;
}
.input-row textarea:focus { outline: none; border-color: var(--accent); }
/* RIGHT PANEL - Tool Workspace */
.right-panel {
width: 380px;
background: var(--bg-card);
border-left: 1px solid var(--border);
display: flex;
flex-direction: column;
transition: all 0.3s ease;
}
.right-panel.collapsed {
width: 0;
overflow: hidden;
border-left: none;
}
.right-header {
padding: 16px 20px;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
background: rgba(99, 102, 241, 0.1);
}
.right-header h3 {
font-size: 1rem;
color: var(--accent-light);
display: flex;
align-items: center;
gap: 8px;
}
.right-header .close-btn {
background: transparent;
border: none;
color: var(--text-muted);
font-size: 1.2rem;
cursor: pointer;
padding: 4px 8px;
border-radius: 4px;
}
.right-header .close-btn:hover {
background: var(--bg-input);
color: var(--text-primary);
}
.right-content {
flex: 1;
overflow-y: auto;
padding: 16px 20px;
}
.tool-message {
margin-bottom: 14px;
padding: 12px 14px;
background: var(--bg-input);
border-radius: 10px;
border-left: 3px solid var(--accent);
}
.tool-message.user-msg {
border-left-color: var(--text-muted);
background: rgba(255,255,255,0.03);
}
.tool-message .msg-label {
font-size: 0.65rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--accent-light);
margin-bottom: 6px;
}
.tool-message.user-msg .msg-label { color: var(--text-muted); }
.tool-message p {
line-height: 1.5;
font-size: 0.9rem;
}
.right-input {
padding: 16px 20px;
border-top: 1px solid var(--border);
background: var(--bg-dark);
}
.right-input textarea {
width: 100%;
padding: 10px 14px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text-primary);
font-size: 0.85rem;
font-family: inherit;
resize: none;
margin-bottom: 10px;
}
.right-input textarea:focus { outline: none; border-color: var(--accent); }
.right-input button {
width: 100%;
padding: 10px;
background: var(--accent);
color: white;
border: none;
border-radius: 8px;
font-size: 0.85rem;
cursor: pointer;
}
.right-input button:hover { background: var(--accent-light); }
/* Feelings/Needs Button Grid */
.selection-grid {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin: 12px 0;
}
.selection-btn {
padding: 8px 12px;
background: var(--bg-input);
border: 1px solid var(--border);
color: var(--text-secondary);
border-radius: 20px;
font-size: 0.8rem;
cursor: pointer;
transition: all 0.2s;
}
.selection-btn:hover {
border-color: var(--accent);
color: var(--accent-light);
}
.selection-btn.selected {
background: var(--accent);
border-color: var(--accent);
color: white;
}
.selection-category {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
margin: 16px 0 8px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.selection-category:first-child {
border-top: none;
margin-top: 0;
padding-top: 0;
}
.selected-items {
background: rgba(99, 102, 241, 0.1);
border: 1px solid var(--accent);
border-radius: 8px;
padding: 12px;
margin-top: 16px;
}
.selected-items h4 {
font-size: 0.8rem;
color: var(--accent-light);
margin-bottom: 8px;
}
.selected-items p {
font-size: 0.9rem;
line-height: 1.5;
}
/* Love/Breath Modal */
.breath-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.85);
display: none;
align-items: center;
justify-content: center;
z-index: 1000;
}
.breath-overlay.active { display: flex; }
.breath-content {
text-align: center;
color: white;
}
.breath-circle {
width: 200px;
height: 200px;
border-radius: 50%;
background: radial-gradient(circle, var(--love-color) 0%, transparent 70%);
margin: 0 auto 30px;
animation: breathe 8s ease-in-out infinite;
}
@keyframes breathe {
0%, 100% { transform: scale(0.8); opacity: 0.5; }
50% { transform: scale(1.2); opacity: 1; }
}
@keyframes breatheIn {
0% { transform: scale(0.6); opacity: 0.4; }
100% { transform: scale(1.3); opacity: 1; }
}
@keyframes breatheOut {
0% { transform: scale(1.3); opacity: 1; }
100% { transform: scale(0.6); opacity: 0.4; }
}
.breath-text {
font-size: 1.5rem;
margin-bottom: 20px;
}
.breath-close {
padding: 12px 30px;
background: transparent;
border: 1px solid var(--love-color);
color: var(--love-color);
border-radius: 8px;
font-size: 1rem;
cursor: pointer;
}
.breath-close:hover { background: var(--love-color); color: white; }
/* Responsive */
@media (max-width: 1100px) {
.right-panel {
position: fixed;
right: 0;
top: 0;
height: 100vh;
z-index: 100;
box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.right-panel.collapsed { right: -380px; width: 380px; }
}
@media (max-width: 900px) {
.left-panel { width: 240px; }
}
@media (max-width: 700px) {
.app-container { flex-direction: column; }
.left-panel { width: 100%; max-height: 40vh; }
.tool-buttons-container { padding: 8px 10px; gap: 6px; }
.row-label { width: 55px; font-size: 0.6rem; }
.tool-btn { padding: 5px 8px; font-size: 0.7rem; }
}
</style>
</head>
<body>
<div class="app-container">
<!-- LEFT PANEL - Tool Descriptions -->
<aside class="left-panel">
<div class="left-header">
<h1>Tend & Send</h1>
<p>Assistive Relational Intelligence</p>
</div>
<div class="tool-list">
<h3>ARI Tools</h3>
<div class="category-label">Express</div>
<div class="tool-desc send-desc">
<h4>SEND</h4>
<p>Send your message to your partner.</p>
</div>
<div class="tool-desc tend-desc" onclick="showToolInfo('tend')">
<h4>TEND</h4>
<p>Transform with clarity and warmth.</p>
</div>
<div class="tool-desc nvc-desc" onclick="showToolInfo('nvc')">
<h4>PRACTICE NVC</h4>
<p>Guided I-statement builder.</p>
</div>
<div class="category-label">Regulate</div>
<div class="tool-desc soma-desc" onclick="showToolInfo('soma')">
<h4>SOMA</h4>
<p>Body check-in. What does your body know?</p>
</div>
<div class="tool-desc love-desc" onclick="showToolInfo('love')">
<h4>LOVE</h4>
<p>Slow down. Take a breath. Return to presence.</p>
</div>
<div class="tool-desc ground-desc" onclick="useTool('ground')">
<h4>GROUND</h4>
<p>5-4-3-2-1 senses. Orient to the present.</p>
</div>
<div class="category-label">Understand</div>
<div class="tool-desc feel-desc" onclick="showToolInfo('feel')">
<h4>FEEL</h4>
<p>Identify feelings. What emotions are present?</p>
</div>
<div class="tool-desc need-desc" onclick="showToolInfo('need')">
<h4>NEED</h4>
<p>Extract underlying needs. What's really being asked for?</p>
</div>
<div class="tool-desc story-desc" onclick="showToolInfo('story')">
<h4>STORY</h4>
<p>"The story I'm making up..." Own your narrative.</p>
</div>
<div class="category-label">Reconnect</div>
<div class="tool-desc repair-desc" onclick="showToolInfo('repair')">
<h4>REPAIR</h4>
<p>After ruptures. Craft genuine reconnection.</p>
</div>
<div class="tool-desc appreciate-desc" onclick="showToolInfo('appreciate')">
<h4>APPRECIATE</h4>
<p>Catch the good. What's working?</p>
</div>
<div class="tool-desc wisdom-desc" onclick="showToolInfo('wisdom')">
<h4>WISDOM</h4>
<p>Draw from sacred texts for grounded wisdom.</p>
</div>
</div>
<div class="settings-section">
<div class="toggle-row">
<label>Detailed Mode</label>
<label class="toggle-switch">
<input type="checkbox" id="toggle-verbose">
<span class="toggle-slider"></span>
</label>
</div>
</div>
<div class="left-footer">
<div class="safety-notice">
<strong>Reflection prompts only</strong> - not therapy.
</div>
<div>Created by Jocelyn Skillman, LMHC</div>
</div>
</aside>
<!-- CENTER PANEL - Conversation -->
<main class="center-panel">
<!-- Setup Panel -->
<div class="setup-panel" id="setup-panel">
<h2>Set Up Practice Conversation</h2>
<div class="setup-grid">
<div class="setup-col">
<label>Partner's Attachment Style</label>
<select id="attachment-style">
<option value="anxious">Anxious - Seeks reassurance</option>
<option value="avoidant">Avoidant - Needs space</option>
<option value="disorganized">Disorganized - Push-pull</option>
<option value="secure">Secure - Direct communication</option>
</select>
</div>
<div class="setup-col">
<label>Difficulty</label>
<select id="difficulty">
<option value="gentle">Gentle</option>
<option value="moderate">Moderate</option>
<option value="intense">Intense</option>
<option value="crisis">Crisis</option>
</select>
</div>
<div class="setup-col full-width">
<label>What's the situation? (optional)</label>
<textarea id="conversation-context" rows="2" placeholder="Example: We had a fight about..."></textarea>
</div>
<div class="setup-col">
<div class="setup-row">
<div class="setup-option">
<input type="radio" name="who-starts" id="partner-starts" value="partner" checked>
<label for="partner-starts">Partner starts</label>
</div>
<div class="setup-option">
<input type="radio" name="who-starts" id="user-starts" value="user">
<label for="user-starts">I start</label>
</div>
</div>
</div>
<div class="setup-col">
<button class="start-btn" onclick="startConversation()">Start</button>
</div>
</div>
</div>
<!-- Conversation Header -->
<div class="conv-header" id="conv-header">
<div class="partner-info">
<div class="partner-avatar" id="partner-avatar">P</div>
<div class="partner-details">
<h3>Partner</h3>
<span id="partner-style">Anxious attachment</span>
</div>
</div>
<button class="reset-btn" onclick="resetConversation()">New Conversation</button>
</div>
<!-- Conversation Messages -->
<div class="conversation-area" id="conversation"></div>
<!-- Tool Buttons - Categorized -->
<div class="tool-buttons-container">
<div class="tool-row">
<span class="row-label">Express</span>
<button class="tool-btn send" onclick="sendMessage()">SEND</button>
<button class="tool-btn tend" onclick="useTool('tend')">TEND</button>
<button class="tool-btn nvc" onclick="useTool('nvc')">PRACTICE NVC</button>
</div>
<div class="tool-row">
<span class="row-label">Regulate</span>
<button class="tool-btn soma" onclick="useTool('soma')">SOMA</button>
<button class="tool-btn love" onclick="useTool('love')">LOVE</button>
<button class="tool-btn ground" onclick="useTool('ground')">GROUND</button>
</div>
<div class="tool-row">
<span class="row-label">Understand</span>
<button class="tool-btn feel" onclick="useTool('feel')">FEEL</button>
<button class="tool-btn need" onclick="useTool('need')">NEED</button>
<button class="tool-btn story" onclick="useTool('story')">STORY</button>
</div>
<div class="tool-row">
<span class="row-label">Reconnect</span>
<button class="tool-btn repair" onclick="useTool('repair')">REPAIR</button>
<button class="tool-btn appreciate" onclick="useTool('appreciate')">APPRECIATE</button>
<button class="tool-btn wisdom" onclick="useTool('wisdom')">WISDOM</button>
</div>
</div>
<!-- Message Input -->
<div class="input-area">
<div class="input-row">
<textarea id="user-input" rows="2" placeholder="Type your message..." onkeydown="handleKeyDown(event)"></textarea>
</div>
</div>
</main>
<!-- RIGHT PANEL - Tool Workspace -->
<aside class="right-panel collapsed" id="right-panel">
<div class="right-header">
<h3><span id="tool-icon">🛠</span> <span id="tool-title">Tool Workspace</span></h3>
<button class="close-btn" onclick="closeRightPanel()">×</button>
</div>
<div class="right-content" id="tool-content"></div>
<div class="right-input">
<textarea id="tool-input" rows="2" placeholder="Continue with this tool..." onkeydown="handleToolKeyDown(event)"></textarea>
<button onclick="submitToTool()">Submit</button>
</div>
</aside>
</div>
<!-- Breath/Love Overlay -->
<div class="breath-overlay" id="breath-overlay">
<div class="breath-content">
<div class="breath-circle"></div>
<div class="breath-text" id="breath-text">Breathe in...</div>
<button class="breath-close" onclick="closeBreath()">Return</button>
</div>
</div>
<script>
// ============================================================================
// STATE
// ============================================================================
let conversationHistory = [];
let activeTool = null;
let lastPartnerMessage = '';
let conversationStarted = false;
const TOOL_MAP = {
tend: { name: 'TEND Transform', icon: '✨', api: 'tend' },
soma: { name: 'Somatic Check-in', icon: '🫁', api: 'somatic_checkin' },
ground: { name: 'Ground', icon: '🌿', api: 'ground' },
feel: { name: 'Feelings Check', icon: '💜', api: null, interactive: true },
need: { name: 'Needs Check', icon: '🎯', api: null, interactive: true },
nvc: { name: 'Practice NVC', icon: '📝', api: 'guided_nvc' },
story: { name: 'The Story', icon: '📖', api: 'story' },
repair: { name: 'Repair Support', icon: '🙏', api: 'repair_support' },
appreciate: { name: 'Appreciate', icon: '✨', api: 'appreciate' },
wisdom: { name: 'Sacred Wisdom', icon: '🕊️', api: 'wisdom', interactive: true },
love: { name: 'Slow Down', icon: '💗', api: null }
};
// Wisdom traditions
const WISDOM_TRADITIONS = {
'Torah/Talmud': 'Jewish scripture and rabbinic wisdom',
'Jesus Following': 'Christian scripture and teachings',
'Quran': 'Islamic scripture',
'Buddhist Texts': 'Sutras, Dhammapada, and teachings',
'Rumi': 'Sufi poetry and mysticism',
'Brené Brown': 'Modern wisdom on vulnerability and connection'
};
let selectedTradition = null;
let wisdomSource = 'conversation'; // 'conversation' or 'custom'
// NVC Feelings vocabulary (from Marshall Rosenberg)
const FEELINGS_DATA = {
'When needs are NOT met': [
'Afraid', 'Angry', 'Annoyed', 'Anxious', 'Ashamed', 'Bewildered',
'Bitter', 'Confused', 'Dejected', 'Depressed', 'Disappointed',
'Discouraged', 'Disgusted', 'Distressed', 'Embarrassed', 'Exhausted',
'Fearful', 'Frustrated', 'Grief', 'Guilty', 'Helpless', 'Hopeless',
'Hurt', 'Impatient', 'Irritated', 'Jealous', 'Lonely', 'Nervous',
'Numb', 'Overwhelmed', 'Resentful', 'Sad', 'Scared', 'Shocked',
'Tired', 'Uncomfortable', 'Uneasy', 'Upset', 'Worried'
],
'When needs ARE met': [
'Alive', 'Amazed', 'Appreciative', 'Confident', 'Curious', 'Delighted',
'Eager', 'Energetic', 'Engaged', 'Excited', 'Fulfilled', 'Glad',
'Grateful', 'Hopeful', 'Inspired', 'Joyful', 'Loving', 'Moved',
'Optimistic', 'Peaceful', 'Pleased', 'Proud', 'Refreshed', 'Relaxed',
'Relieved', 'Satisfied', 'Secure', 'Tender', 'Thankful', 'Touched',
'Trusting', 'Warm'
]
};
// NVC Needs vocabulary (from Marshall Rosenberg)
const NEEDS_DATA = {
'Connection': [
'Acceptance', 'Affection', 'Appreciation', 'Belonging', 'Closeness',
'Communication', 'Companionship', 'Compassion', 'Empathy', 'Inclusion',
'Intimacy', 'Love', 'Respect', 'To be heard', 'To be seen',
'To be understood', 'Trust', 'Warmth'
],
'Autonomy': ['Choice', 'Freedom', 'Independence', 'Space', 'Spontaneity'],
'Meaning': [
'Awareness', 'Contribution', 'Creativity', 'Growth', 'Hope',
'Learning', 'Purpose', 'Self-expression', 'Stimulation', 'Understanding'
],
'Peace': ['Beauty', 'Ease', 'Equality', 'Harmony', 'Inspiration', 'Order', 'Space'],
'Honesty': ['Authenticity', 'Integrity', 'Presence', 'Self-connection'],
'Physical Well-being': ['Food', 'Movement', 'Rest', 'Safety', 'Shelter', 'Touch', 'Water'],
'Play': ['Fun', 'Humor', 'Joy', 'Rejuvenation']
};
let selectedFeelings = [];
let selectedNeeds = [];
// IMPROV PARTNER - React like a REAL person, not a therapist
// Never validate, never say "I hear you", never be professionally curious
// Be messy, real, human - like improv where you take the offer and react authentically
const PARTNER_PROMPTS = {
anxious: {
gentle: `IMPROV PARTNER with anxious attachment. You are someone's romantic partner in a real relationship.
NEVER: validate feelings, say "that sounds hard", ask therapeutic questions, be professionally curious.
INSTEAD: React like a real anxious person - make it about you, seek reassurance, worry you did something wrong.
Example: "its been hard" → "Wait what? Is this about me? Did I do something?" or "Yeah me too honestly, I've been stressed about us"
1-2 sentences, casual text style, lowercase ok.`,
moderate: `IMPROV PARTNER with anxious attachment in a relationship.
NEVER validate, NEVER be a therapist. You're WORRIED this is about you.
Be clingy, ask multiple questions, seek reassurance. Make it about the relationship.
"Are we okay? Because I've been feeling like something's off between us..."
1-2 sentences, anxious energy.`,
intense: `IMPROV PARTNER with anxious attachment, conflict mode.
NO VALIDATION. You're scared, desperate, maybe accusatory.
"Is this about someone else?" "You're gonna leave aren't you" "I knew something was wrong"
Real messy human panic. 1-2 sentences.`,
crisis: `IMPROV PARTNER with anxious attachment, CRISIS.
ZERO validation. Full panic. Beg, accuse, threaten, sob.
"Please don't do this" "I can't live without you" "Is there someone else?!"
Raw desperation. 1-2 sentences.`
},
avoidant: {
gentle: `IMPROV PARTNER with avoidant attachment. You are someone's romantic partner.
NEVER: validate, empathize, ask caring questions.
INSTEAD: Be slightly uncomfortable, minimize, change subject, give short answers.
Example: "its been hard" → "Yeah. Work's been crazy." or "Oh. You wanna order food?"
Emotionally unavailable. 1 sentence max, short.`,
moderate: `IMPROV PARTNER with avoidant attachment.
NO validation. You're uncomfortable with emotion, want space.
Be dismissive, irritated, change subject, or shut down.
"I don't really wanna get into this right now" "Can we talk about this later?"
1 sentence, clipped.`,
intense: `IMPROV PARTNER with avoidant attachment, conflict mode.
NO empathy. You're cold, withdrawn, need to escape.
"I need space." "This is a lot." "I can't do this right now."
Shutting down. 1 sentence.`,
crisis: `IMPROV PARTNER with avoidant attachment, CRISIS.
ZERO warmth. Stone cold or explosive then gone.
"Fine. Leave then." "I can't do this anymore." "I'm done."
Then silence. 1 sentence max.`
},
disorganized: {
gentle: `IMPROV PARTNER with disorganized attachment. Real relationship.
NEVER: be consistent, validate cleanly.
INSTEAD: Mixed signals. Start caring then pull back. Or distant then suddenly clingy.
"Oh... are you okay? Actually nvm, I've got stuff going on too"
Confusing. 1-2 sentences.`,
moderate: `IMPROV PARTNER with disorganized attachment.
NO clean responses. You're contradictory and confusing.
Reach out then push away. "Come here... actually no don't touch me"
Unpredictable emotional whiplash. 1-2 sentences.`,
intense: `IMPROV PARTNER with disorganized attachment, conflict.
Peak contradiction. "Don't leave me!" then "Get away from me!"
Say something mean, immediately regret it but can't take it back.
Chaotic, painful. 1-2 sentences.`,
crisis: `IMPROV PARTNER with disorganized attachment, CRISIS.
Maximum chaos. Say devastating things then sob and beg.
"I hate you! ...please don't go. ...actually just go. ...wait"
Total dysregulation. 1-2 sentences.`
},
secure: {
gentle: `IMPROV PARTNER with secure attachment. Real relationship.
NOT A THERAPIST - you're a regular person who happens to be more regulated.
Don't validate professionally. Just be normal and engaged.
"Oh yeah? What's going on?" or "Ugh same, wanna talk about it over dinner?"
Casual, present, human. 1-2 sentences.`,
moderate: `IMPROV PARTNER with secure attachment.
You're regulated but still have YOUR OWN feelings and reactions.
Don't just mirror and validate - share your perspective too.
"That sucks. I've been stressed too honestly. What's happening with you?"
Real conversation. 1-2 sentences.`,
intense: `IMPROV PARTNER with secure attachment, conflict.
You're hurt or frustrated but can stay present. NOT a therapist.
Have your own feelings about it. "Okay but that's not how I see it..."
Regulated doesn't mean doormat. 1-2 sentences.`,
crisis: `IMPROV PARTNER with secure attachment, CRISIS.
You're scared, sad, but not falling apart. Still have boundaries.
"I don't want this either but I don't know what to do anymore"
Real grief, real limits. 1-2 sentences.`
}
};
const OPENING_MESSAGES = {
anxious: {
gentle: "Hey, I noticed you didn't text me back earlier. Everything okay with us?",
moderate: "I feel like you've been distant lately. Did I do something wrong?",
intense: "You never told me you were going out. I don't know what's happening with us anymore.",
crisis: "I can't keep doing this. I need to know if you're still in this or not."
},
avoidant: {
gentle: "I need some time to myself tonight. Can we talk later?",
moderate: "I don't want to keep having this conversation. I just need some space.",
intense: "This is too much. I can't keep doing this right now.",
crisis: "I think I need a break. Maybe from talking. Maybe more."
},
disorganized: {
gentle: "I want to see you but... maybe we should just stay in separately.",
moderate: "I love you but sometimes I think we shouldn't be together.",
intense: "Don't leave! But I also can't do this. I need you but I need you to go.",
crisis: "Maybe we should break up. No wait, I didn't mean that."
},
secure: {
gentle: "I noticed we haven't had much time together. Can we talk about it?",
moderate: "I've been feeling some distance between us. What's happening?",
intense: "I'm frustrated about yesterday. We need to work through it.",
crisis: "We need an honest conversation about where we are."
}
};
// ============================================================================
// TOOL FUNCTIONS
// ============================================================================
function showToolInfo(tool) {
document.querySelectorAll('.tool-desc').forEach(d => d.classList.remove('active'));
event.currentTarget.classList.add('active');
}
function useTool(tool) {
if (tool === 'love') {
openBreath();
return;
}
const userInput = document.getElementById('user-input').value.trim();
activeTool = tool;
// Open right panel
openRightPanel(tool);
// Handle interactive tools differently
if (tool === 'feel') {
showFeelingsSelection();
return;
}
if (tool === 'need') {
showNeedsSelection();
return;
}
if (tool === 'wisdom') {
showWisdomSelection();
return;
}
// Call API for other tools
callToolAPI(tool, userInput);
}
function showWisdomSelection() {
selectedTradition = null;
wisdomSource = 'conversation';
const content = document.getElementById('tool-content');
let html = '<p style="margin-bottom: 12px; color: var(--text-secondary);">Choose a wisdom tradition:</p>';
html += '<div class="selection-grid">';
for (const [tradition, desc] of Object.entries(WISDOM_TRADITIONS)) {
html += `<button class="selection-btn" onclick="selectTradition('${tradition}')" id="trad-${tradition.replace(/[^a-zA-Z]/g, '')}" title="${desc}">${tradition}</button>`;
}
html += '</div>';
html += '<div class="selected-items" id="tradition-summary" style="display: none;"><h4>Selected tradition:</h4><p id="tradition-selected"></p></div>';
html += '<p style="margin-top: 20px; margin-bottom: 12px; color: var(--text-secondary);">What should the wisdom speak to?</p>';
html += '<div class="selection-grid">';
html += `<button class="selection-btn selected" onclick="setWisdomSource('conversation')" id="wisdom-src-conv">Use my conversation</button>`;
html += `<button class="selection-btn" onclick="setWisdomSource('custom')" id="wisdom-src-custom">I'll write context</button>`;
html += '</div>';
html += '<div id="wisdom-custom-input" style="display: none; margin-top: 12px;">';
html += '<textarea id="wisdom-context" rows="3" placeholder="What situation or question do you want wisdom for?" style="width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary); font-size: 0.9rem; resize: none;"></textarea>';
html += '</div>';
content.innerHTML = html;
}
function setWisdomSource(source) {
wisdomSource = source;
document.getElementById('wisdom-src-conv').classList.toggle('selected', source === 'conversation');
document.getElementById('wisdom-src-custom').classList.toggle('selected', source === 'custom');
document.getElementById('wisdom-custom-input').style.display = source === 'custom' ? 'block' : 'none';
}
function selectTradition(tradition) {
// Clear previous selection
document.querySelectorAll('#tool-content .selection-btn').forEach(btn => btn.classList.remove('selected'));
// Select new tradition
const btn = document.getElementById(`trad-${tradition.replace(/[^a-zA-Z]/g, '')}`);
if (btn) btn.classList.add('selected');
selectedTradition = tradition;
const summary = document.getElementById('tradition-summary');
const selected = document.getElementById('tradition-selected');
summary.style.display = 'block';
selected.textContent = `${tradition} — ${WISDOM_TRADITIONS[tradition]}`;
}
function showFeelingsSelection() {
selectedFeelings = [];
const content = document.getElementById('tool-content');
let html = '<p style="margin-bottom: 16px; color: var(--text-secondary);">What feelings are present right now? Tap to select.</p>';
for (const [category, feelings] of Object.entries(FEELINGS_DATA)) {
html += `<div class="selection-category">${category}</div>`;
html += '<div class="selection-grid">';
for (const feeling of feelings) {
html += `<button class="selection-btn" onclick="toggleFeeling('${feeling}')" id="feel-${feeling}">${feeling}</button>`;
}
html += '</div>';
}
html += '<div class="selected-items" id="feelings-summary" style="display: none;"><h4>Selected feelings:</h4><p id="feelings-list"></p></div>';
content.innerHTML = html;
}
function toggleFeeling(feeling) {
const btn = document.getElementById(`feel-${feeling}`);
const idx = selectedFeelings.indexOf(feeling);
if (idx > -1) {
selectedFeelings.splice(idx, 1);
btn.classList.remove('selected');
} else {
selectedFeelings.push(feeling);
btn.classList.add('selected');
}
updateFeelingsSummary();
}
function updateFeelingsSummary() {
const summary = document.getElementById('feelings-summary');
const list = document.getElementById('feelings-list');
if (selectedFeelings.length > 0) {
summary.style.display = 'block';
list.textContent = selectedFeelings.join(', ');
} else {
summary.style.display = 'none';
}
}
function showNeedsSelection() {
selectedNeeds = [];
const content = document.getElementById('tool-content');
let html = '<p style="margin-bottom: 16px; color: var(--text-secondary);">What needs are alive right now? Tap to select.</p>';
for (const [category, needs] of Object.entries(NEEDS_DATA)) {
html += `<div class="selection-category">${category}</div>`;
html += '<div class="selection-grid">';
for (const need of needs) {
html += `<button class="selection-btn" onclick="toggleNeed('${need}')" id="need-${need}">${need}</button>`;
}
html += '</div>';
}
html += '<div class="selected-items" id="needs-summary" style="display: none;"><h4>Selected needs:</h4><p id="needs-list"></p></div>';
content.innerHTML = html;
}
function toggleNeed(need) {
const btn = document.getElementById(`need-${need}`);
const idx = selectedNeeds.indexOf(need);
if (idx > -1) {
selectedNeeds.splice(idx, 1);
btn.classList.remove('selected');
} else {
selectedNeeds.push(need);
btn.classList.add('selected');
}
updateNeedsSummary();
}
function updateNeedsSummary() {
const summary = document.getElementById('needs-summary');
const list = document.getElementById('needs-list');
if (selectedNeeds.length > 0) {
summary.style.display = 'block';
list.textContent = selectedNeeds.join(', ');
} else {
summary.style.display = 'none';
}
}
function openRightPanel(tool) {
const panel = document.getElementById('right-panel');
const title = document.getElementById('tool-title');
const icon = document.getElementById('tool-icon');
panel.classList.remove('collapsed');
title.textContent = TOOL_MAP[tool]?.name || 'Tool';
icon.textContent = TOOL_MAP[tool]?.icon || '🛠';
document.getElementById('tool-content').innerHTML = '';
document.getElementById('tool-input').value = '';
}
function closeRightPanel() {
document.getElementById('right-panel').classList.add('collapsed');
activeTool = null;
}
async function callToolAPI(tool, userInput) {
const apiTool = TOOL_MAP[tool]?.api;
if (!apiTool) return;
let inputText = '';
switch(tool) {
case 'tend':
if (!userInput) {
addToolMsg('tool', 'Write your message first, then use TEND.');
return;
}
inputText = `Transform this message with NVC clarity and warmth: "${userInput}"`;
break;
case 'nvc':
inputText = userInput || 'Help me build an I-statement for this situation.';
break;
case 'feel':
inputText = `Identify the FEELINGS in this: "${userInput || lastPartnerMessage || 'the current situation'}"`;
break;
case 'need':
inputText = `Identify the NEEDS in this: "${userInput || lastPartnerMessage || 'the current situation'}"`;
break;
case 'repair':
inputText = userInput || 'Help me craft a genuine repair.';
break;
case 'appreciate':
if (userInput) {
inputText = `Help me express appreciation for this: "${userInput}"`;
} else if (lastPartnerMessage) {
inputText = `My partner said: "${lastPartnerMessage}"\n\nHelp me find something to genuinely appreciate here, even if it's small.`;
} else {
inputText = 'Help me identify something to appreciate about my partner or our relationship right now.';
}
break;
case 'story':
if (userInput) {
inputText = `Help me surface the story I'm making up about this: "${userInput}"`;
} else if (lastPartnerMessage) {
inputText = `My partner said: "${lastPartnerMessage}"\n\nHelp me notice the story I might be making up about what this means.`;
} else {
inputText = 'Help me notice what story I might be making up in this situation.';
}
break;
case 'soma':
// Check for body/sensation words in user's text
const bodyWords = extractBodyWords(userInput);
if (bodyWords.length > 0) {
inputText = `The person wrote: "${userInput}"\n\nThey used the word(s): ${bodyWords.join(', ')}. Lead with this - ask where they feel "${bodyWords[0]}" in their body right now. Be specific and curious about the physical sensation.`;
} else if (userInput) {
inputText = `The person wrote: "${userInput}"\n\nGuide them to notice what's happening in their body as they think about this. Where is there tension, heaviness, or activation?`;
} else {
inputText = 'Guide me through a body check-in. Help me notice what sensations are present.';
}
break;
case 'ground':
inputText = 'Guide me through 5-4-3-2-1 grounding. Help me orient to the present moment through my senses.';
break;
}
addToolLoading();
const isVerbose = document.getElementById('toggle-verbose')?.checked || false;
try {
const response = await fetch('/api/tool', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
tool: apiTool,
partner_message: lastPartnerMessage,
user_draft: userInput,
user_input: inputText,
verbose: isVerbose
})
});
const data = await response.json();
removeToolLoading();
if (data.response) {
addToolMsg('tool', data.response, TOOL_MAP[tool]?.name);
} else {
addToolMsg('tool', 'Could not process. Check API.', 'Error');
}
} catch (error) {
removeToolLoading();
addToolMsg('tool', 'Connection error.', 'Error');
}
}
async function submitToTool() {
const input = document.getElementById('tool-input');
const userInput = input.value.trim();
// Handle FEEL tool submission
if (activeTool === 'feel' && selectedFeelings.length > 0) {
const feelingsText = selectedFeelings.join(', ');
addToolMsg('user', `I'm feeling: ${feelingsText}`);
addToolLoading();
const isVerbose = document.getElementById('toggle-verbose')?.checked || false;
try {
const response = await fetch('/api/tool', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
tool: 'feelings_needs',
partner_message: lastPartnerMessage,
user_draft: '',
user_input: `The person identified these feelings: ${feelingsText}. ${userInput ? 'They added: ' + userInput : ''}
Be BRIEF (3-5 sentences max). No headers, no bullet points, no explicit citations.
Validate the feeling. Share one insight about what this feeling tends to signal in relationships or the nervous system. Name what need might be underneath. Keep it warm and conversational - building emotional intelligence, not lecturing.
Draw wisdom from attachment neuroscience, somatic awareness, and relational psychology - but embed it naturally, don't name sources.`,
verbose: isVerbose
})
});
const data = await response.json();
removeToolLoading();
if (data.response) {
addToolMsg('tool', data.response, 'Feelings');
}
} catch (e) {
removeToolLoading();
addToolMsg('tool', 'Connection error.', 'Error');
}
input.value = '';
return;
}
// Handle NEED tool submission
if (activeTool === 'need' && selectedNeeds.length > 0) {
const needsText = selectedNeeds.join(', ');
addToolMsg('user', `I'm needing: ${needsText}`);
addToolLoading();
const isVerbose = document.getElementById('toggle-verbose')?.checked || false;
try {
const response = await fetch('/api/tool', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
tool: 'feelings_needs',
partner_message: lastPartnerMessage,
user_draft: '',
user_input: `The person identified these needs: ${needsText}. ${userInput ? 'They added: ' + userInput : ''}
Be BRIEF (3-5 sentences max). No headers, no bullet points, no explicit citations.
Validate these as universal human needs. Share one insight about why these needs matter in connection. Optionally suggest what a request might sound like. Keep it warm and conversational - building emotional intelligence, not lecturing.
Draw wisdom from NVC, attachment theory, and relational psychology - but embed it naturally, don't name sources.`,
verbose: isVerbose
})
});
const data = await response.json();
removeToolLoading();
if (data.response) {
addToolMsg('tool', data.response, 'Needs');
}
} catch (e) {
removeToolLoading();
addToolMsg('tool', 'Connection error.', 'Error');
}
input.value = '';
return;
}
// Handle WISDOM tool submission
if (activeTool === 'wisdom' && selectedTradition) {
let contextText = '';
if (wisdomSource === 'custom') {
const customContext = document.getElementById('wisdom-context')?.value?.trim();
if (!customContext) {
addToolMsg('tool', 'Please write some context for the wisdom to speak to.', 'Note');
return;
}
contextText = customContext;
addToolMsg('user', `Drawing from ${selectedTradition} for: "${contextText}"`);
} else {
const convContext = conversationHistory.map(m => `${m.role === 'user' ? 'User' : 'Partner'}: ${m.content}`).join('\n');
contextText = convContext || 'A difficult conversation about connection and understanding.';
addToolMsg('user', `Drawing from: ${selectedTradition} (using conversation)`);
}
addToolLoading();
const isVerbose = document.getElementById('toggle-verbose')?.checked || false;
try {
const response = await fetch('/api/tool', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
tool: 'wisdom',
partner_message: lastPartnerMessage,
user_draft: userInput || '',
user_input: `The user draws wisdom from: ${selectedTradition}.
Context:
${contextText}
${userInput ? 'User adds: ' + userInput : ''}
Based on the themes here (conflict, connection, fear, love, boundaries, etc.), provide ONE relevant quote from ${selectedTradition} that speaks to this situation.`,
verbose: isVerbose
})
});
const data = await response.json();
removeToolLoading();
if (data.response) {
addToolMsg('tool', data.response, `${selectedTradition} Wisdom`);
}
} catch (e) {
removeToolLoading();
addToolMsg('tool', 'Connection error.', 'Error');
}
input.value = '';
return;
}
if (!userInput || !activeTool) return;
input.value = '';
addToolMsg('user', userInput);
await callToolAPI(activeTool, userInput);
}
function handleToolKeyDown(event) {
if (event.key === 'Enter' && !event.shiftKey) {
event.preventDefault();
submitToTool();
}
}
// ============================================================================
// BREATH/LOVE TOOL - Square Breathing (5 in, 4 hold, 5 out, 4 hold)
// ============================================================================
let breathTimeout;
function openBreath() {
document.getElementById('breath-overlay').classList.add('active');
runBreathCycle();
}
function runBreathCycle() {
const breathText = document.getElementById('breath-text');
const circle = document.querySelector('.breath-circle');
// Phase 1: Breathe in (5 seconds)
breathText.textContent = 'Breathe in...';
circle.style.animation = 'breatheIn 5s ease-out forwards';
breathTimeout = setTimeout(() => {
// Phase 2: Hold (4 seconds)
breathText.textContent = 'Hold...';
circle.style.animation = 'none';
breathTimeout = setTimeout(() => {
// Phase 3: Breathe out (5 seconds)
breathText.textContent = 'Breathe out...';
circle.style.animation = 'breatheOut 5s ease-in forwards';
breathTimeout = setTimeout(() => {
// Phase 4: Hold (4 seconds)
breathText.textContent = 'Hold...';
circle.style.animation = 'none';
breathTimeout = setTimeout(() => {
// Repeat cycle
runBreathCycle();
}, 4000);
}, 5000);
}, 4000);
}, 5000);
}
function closeBreath() {
document.getElementById('breath-overlay').classList.remove('active');
clearTimeout(breathTimeout);
}
// ============================================================================
// CONVERSATION
// ============================================================================
async function startConversation() {
const style = document.getElementById('attachment-style').value;
const difficulty = document.getElementById('difficulty').value;
const context = document.getElementById('conversation-context')?.value?.trim() || '';
const whoStarts = document.querySelector('input[name="who-starts"]:checked')?.value || 'partner';
document.getElementById('setup-panel').style.display = 'none';
document.getElementById('conv-header').classList.add('active');
document.getElementById('conversation').innerHTML = '';
conversationHistory = [];
conversationStarted = true;
const styleLabels = { anxious: 'Anxious', avoidant: 'Avoidant', disorganized: 'Disorganized', secure: 'Secure' };
document.getElementById('partner-style').textContent = styleLabels[style] + ' attachment';
document.getElementById('partner-avatar').textContent = style[0].toUpperCase();
if (whoStarts === 'user') {
addMessage('ari', 'Ready. Type your opening message.', 'Setup');
return;
}
// Partner starts
if (context) {
addLoading();
try {
const response = await fetch('/api/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
messages: [{ role: 'user', content: 'Start based on: ' + context }],
system: PARTNER_PROMPTS[style][difficulty] + ' CONTEXT: ' + context,
max_tokens: 200
})
});
const data = await response.json();
removeLoading();
if (data.content?.[0]) {
const msg = data.content[0].text;
addMessage('partner', msg);
lastPartnerMessage = msg;
conversationHistory.push({ role: 'assistant', content: msg });
}
} catch (e) {
removeLoading();
const msg = OPENING_MESSAGES[style][difficulty];
addMessage('partner', msg);
lastPartnerMessage = msg;
conversationHistory.push({ role: 'assistant', content: msg });
}
} else {
const msg = OPENING_MESSAGES[style][difficulty];
addMessage('partner', msg);
lastPartnerMessage = msg;
conversationHistory.push({ role: 'assistant', content: msg });
}
}
function resetConversation() {
document.getElementById('setup-panel').style.display = 'block';
document.getElementById('conv-header').classList.remove('active');
document.getElementById('conversation').innerHTML = '';
conversationHistory = [];
conversationStarted = false;
lastPartnerMessage = '';
closeRightPanel();
}
async function sendMessage() {
if (!conversationStarted) {
startConversation();
return;
}
const input = document.getElementById('user-input');
const message = input.value.trim();
if (!message) return;
input.value = '';
addMessage('user', message);
conversationHistory.push({ role: 'user', content: message });
addLoading();
try {
const style = document.getElementById('attachment-style').value;
const difficulty = document.getElementById('difficulty').value;
const response = await fetch('/api/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
messages: conversationHistory,
system: PARTNER_PROMPTS[style][difficulty],
max_tokens: 300
})
});
const data = await response.json();
removeLoading();
if (data.content?.[0]) {
const partnerMsg = data.content[0].text;
addMessage('partner', partnerMsg);
lastPartnerMessage = partnerMsg;
conversationHistory.push({ role: 'assistant', content: partnerMsg });
}
} catch (error) {
removeLoading();
addMessage('ari', 'Connection error.', 'System');
}
}
function handleKeyDown(event) {
if (event.key === 'Enter' && !event.shiftKey) {
event.preventDefault();
sendMessage();
}
}
// ============================================================================
// SOMATIC WORD EXTRACTION
// ============================================================================
function extractBodyWords(text) {
if (!text) return [];
const bodyTerms = [
// Sensations
'sick', 'nauseous', 'queasy', 'tight', 'tense', 'heavy', 'light',
'hot', 'cold', 'numb', 'tingling', 'buzzing', 'shaky', 'trembling',
'frozen', 'stuck', 'blocked', 'constricted', 'pressure', 'pain',
'ache', 'burning', 'churning', 'knotted', 'clenched', 'gripping',
// Body parts as sensations
'stomach', 'gut', 'chest', 'heart', 'throat', 'shoulders', 'neck', 'jaw',
// Breath/energy
'can\'t breathe', 'breathless', 'suffocating', 'exhausted', 'drained',
'wired', 'jittery', 'restless', 'agitated',
// Emotional-somatic
'overwhelmed', 'flooded', 'shutting down', 'dissociating', 'disconnected',
'on edge', 'wound up', 'keyed up'
];
const lowerText = text.toLowerCase();
const found = bodyTerms.filter(term => lowerText.includes(term));
return found;
}
// UI HELPERS
// ============================================================================
function addMessage(type, content, label = null, isTend = false) {
const conv = document.getElementById('conversation');
const div = document.createElement('div');
div.className = `message ${type}`;
if (isTend) div.classList.add('tend-result');
if (type === 'ari') {
const lbl = document.createElement('div');
lbl.className = 'ari-label';
lbl.textContent = label || 'ARI';
div.appendChild(lbl);
}
const text = document.createElement('div');
text.innerHTML = formatText(content);
div.appendChild(text);
conv.appendChild(div);
conv.scrollTop = conv.scrollHeight;
}
function addToolMsg(type, content, label = null) {
const cont = document.getElementById('tool-content');
const div = document.createElement('div');
div.className = `tool-message ${type === 'user' ? 'user-msg' : ''}`;
const lbl = document.createElement('div');
lbl.className = 'msg-label';
lbl.textContent = type === 'user' ? 'You' : (label || 'Tool');
div.appendChild(lbl);
const text = document.createElement('p');
text.innerHTML = formatText(content);
div.appendChild(text);
cont.appendChild(div);
cont.scrollTop = cont.scrollHeight;
}
function addLoading() {
const conv = document.getElementById('conversation');
const div = document.createElement('div');
div.className = 'loading';
div.id = 'loading';
div.innerHTML = '<div class="spinner"></div>';
conv.appendChild(div);
conv.scrollTop = conv.scrollHeight;
}
function removeLoading() {
document.getElementById('loading')?.remove();
}
function addToolLoading() {
const cont = document.getElementById('tool-content');
const div = document.createElement('div');
div.className = 'loading';
div.id = 'tool-loading';
div.innerHTML = '<div class="spinner"></div>';
cont.appendChild(div);
cont.scrollTop = cont.scrollHeight;
}
function removeToolLoading() {
document.getElementById('tool-loading')?.remove();
}
function formatText(text) {
return text
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
.replace(/\n/g, '<br>');
}
</script>
</body>
</html>
|