@akropolys/kiku 1.7.4 → 1.7.6
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.js +83 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -86
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +154 -60
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1130,6 +1130,11 @@ var ArrowUpIcon2 = () => /* @__PURE__ */ jsxs6("svg", { width: "18", height: "18
|
|
|
1130
1130
|
/* @__PURE__ */ jsx7("path", { d: "M12 19V5" })
|
|
1131
1131
|
] });
|
|
1132
1132
|
var StopIcon = () => /* @__PURE__ */ jsx7("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx7("rect", { x: "5", y: "5", width: "14", height: "14", rx: "2" }) });
|
|
1133
|
+
var ExternalIcon = () => /* @__PURE__ */ jsxs6("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1134
|
+
/* @__PURE__ */ jsx7("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1135
|
+
/* @__PURE__ */ jsx7("polyline", { points: "15 3 21 3 21 9" }),
|
|
1136
|
+
/* @__PURE__ */ jsx7("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1137
|
+
] });
|
|
1133
1138
|
var ContinueIcon = () => /* @__PURE__ */ jsx7("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx7("path", { d: "M8 5v14l11-7z" }) });
|
|
1134
1139
|
var CloseIcon = () => /* @__PURE__ */ jsxs6("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1135
1140
|
/* @__PURE__ */ jsx7("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
@@ -1572,67 +1577,36 @@ function parseThinking(text) {
|
|
|
1572
1577
|
isComplete: true
|
|
1573
1578
|
};
|
|
1574
1579
|
}
|
|
1575
|
-
function ThinkingBlock({ text, isComplete }) {
|
|
1576
|
-
const
|
|
1580
|
+
function ThinkingBlock({ text, isComplete, seconds: fixedSeconds }) {
|
|
1581
|
+
const startRef = useRef5(Date.now());
|
|
1582
|
+
const [seconds, setSeconds] = useState5(() => isComplete ? null : 0);
|
|
1583
|
+
const [isOpen, setIsOpen] = useState5(!isComplete);
|
|
1577
1584
|
useEffect3(() => {
|
|
1578
|
-
if (
|
|
1579
|
-
|
|
1585
|
+
if (isComplete) {
|
|
1586
|
+
if (seconds !== null) {
|
|
1587
|
+
setSeconds(Math.max(1, Math.round((Date.now() - startRef.current) / 1e3)));
|
|
1588
|
+
setIsOpen(false);
|
|
1589
|
+
}
|
|
1590
|
+
return;
|
|
1580
1591
|
}
|
|
1592
|
+
setIsOpen(true);
|
|
1593
|
+
const t = setInterval(() => {
|
|
1594
|
+
setSeconds(Math.round((Date.now() - startRef.current) / 1e3));
|
|
1595
|
+
}, 1e3);
|
|
1596
|
+
return () => clearInterval(t);
|
|
1581
1597
|
}, [isComplete]);
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
onClick: () => setIsOpen(!isOpen),
|
|
1595
|
-
style: {
|
|
1596
|
-
display: "flex",
|
|
1597
|
-
alignItems: "center",
|
|
1598
|
-
gap: "6px",
|
|
1599
|
-
color: "#71717a",
|
|
1600
|
-
cursor: "pointer",
|
|
1601
|
-
fontWeight: 500,
|
|
1602
|
-
userSelect: "none"
|
|
1603
|
-
},
|
|
1604
|
-
children: [
|
|
1605
|
-
/* @__PURE__ */ jsxs6("span", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1606
|
-
/* @__PURE__ */ jsxs6("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { animation: !isComplete ? "spin 3s linear infinite" : "none" }, children: [
|
|
1607
|
-
/* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1608
|
-
/* @__PURE__ */ jsx7("path", { d: "M12 6v6l4 2" })
|
|
1609
|
-
] }),
|
|
1610
|
-
"Thinking Process"
|
|
1611
|
-
] }),
|
|
1612
|
-
!isComplete && /* @__PURE__ */ jsx7("span", { style: {
|
|
1613
|
-
width: "6px",
|
|
1614
|
-
height: "6px",
|
|
1615
|
-
borderRadius: "50%",
|
|
1616
|
-
backgroundColor: "#3b82f6",
|
|
1617
|
-
display: "inline-block",
|
|
1618
|
-
animation: "hsk-pulse 1.2s infinite ease-in-out"
|
|
1619
|
-
} }),
|
|
1620
|
-
/* @__PURE__ */ jsx7("span", { style: {
|
|
1621
|
-
fontSize: "0.7rem",
|
|
1622
|
-
marginLeft: "auto",
|
|
1623
|
-
transform: isOpen ? "rotate(90deg)" : "none",
|
|
1624
|
-
transition: "transform 0.1s"
|
|
1625
|
-
}, children: "\u25B6" })
|
|
1626
|
-
]
|
|
1627
|
-
}
|
|
1628
|
-
),
|
|
1629
|
-
isOpen && /* @__PURE__ */ jsx7("div", { style: {
|
|
1630
|
-
marginTop: "6px",
|
|
1631
|
-
color: "#52525b",
|
|
1632
|
-
whiteSpace: "pre-wrap",
|
|
1633
|
-
lineHeight: "1.4",
|
|
1634
|
-
fontStyle: "italic"
|
|
1635
|
-
}, children: text })
|
|
1598
|
+
const finalSeconds = fixedSeconds ?? seconds;
|
|
1599
|
+
const label = isComplete ? finalSeconds !== null && finalSeconds !== void 0 ? `Thought for ${finalSeconds}s` : "Thought process" : `Thinking${seconds ? ` \xB7 ${seconds}s` : "\u2026"}`;
|
|
1600
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn("hsk-cb-think", !isComplete && "hsk-cb-think--live"), children: [
|
|
1601
|
+
/* @__PURE__ */ jsxs6("button", { type: "button", className: "hsk-cb-think-head", onClick: () => setIsOpen((o) => !o), "aria-expanded": isOpen, children: [
|
|
1602
|
+
/* @__PURE__ */ jsxs6("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: !isComplete ? "hsk-cb-think-spin" : void 0, children: [
|
|
1603
|
+
/* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1604
|
+
/* @__PURE__ */ jsx7("path", { d: "M12 6v6l4 2" })
|
|
1605
|
+
] }),
|
|
1606
|
+
/* @__PURE__ */ jsx7("span", { children: label }),
|
|
1607
|
+
/* @__PURE__ */ jsx7("span", { className: cn("hsk-cb-think-chevron", isOpen && "hsk-cb-think-chevron--open"), children: "\u25B6" })
|
|
1608
|
+
] }),
|
|
1609
|
+
isOpen && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-think-body", children: text })
|
|
1636
1610
|
] });
|
|
1637
1611
|
}
|
|
1638
1612
|
function ChatModal({
|
|
@@ -1652,7 +1626,7 @@ function ChatModal({
|
|
|
1652
1626
|
visionCategoryHint
|
|
1653
1627
|
}) {
|
|
1654
1628
|
const client = useAkropolysContext3();
|
|
1655
|
-
const { messages, sources, loading, streaming, error, lastAction, lastIntent, send, stop, stopped, continueGenerating, reset, referencedIds } = useKiku2();
|
|
1629
|
+
const { messages, sources, loading, streaming, error, lastAction, lastIntent, send, stop, stopped, interrupted, continueGenerating, reset, referencedIds } = useKiku2();
|
|
1656
1630
|
const [input, setInput] = useState5("");
|
|
1657
1631
|
const [shopperName, setShopperNameState] = useState5(() => {
|
|
1658
1632
|
try {
|
|
@@ -1742,6 +1716,15 @@ function ChatModal({
|
|
|
1742
1716
|
const [keyPhase, setKeyPhase] = useState5("idle");
|
|
1743
1717
|
const [mintedKey, setMintedKey] = useState5(null);
|
|
1744
1718
|
const [mintedPub, setMintedPub] = useState5(null);
|
|
1719
|
+
const [copied, setCopied] = useState5(null);
|
|
1720
|
+
const copyValue = (value, which) => {
|
|
1721
|
+
try {
|
|
1722
|
+
navigator.clipboard?.writeText(value);
|
|
1723
|
+
} catch {
|
|
1724
|
+
}
|
|
1725
|
+
setCopied(which);
|
|
1726
|
+
setTimeout(() => setCopied((c) => c === which ? null : c), 1600);
|
|
1727
|
+
};
|
|
1745
1728
|
const [keyCountdown, setKeyCountdown] = useState5(KIKU_KEY_REVEAL_SECONDS);
|
|
1746
1729
|
const [minting, setMinting] = useState5(false);
|
|
1747
1730
|
const [showKikuPicker, setShowKikuPicker] = useState5(false);
|
|
@@ -2014,21 +1997,29 @@ function ChatModal({
|
|
|
2014
1997
|
] }),
|
|
2015
1998
|
/* @__PURE__ */ jsxs6("div", { className: "hsk-cb-msgs", ref: msgsContainerRef, children: [
|
|
2016
1999
|
displayMessages.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-empty", children: [
|
|
2017
|
-
/* @__PURE__ */ jsx7("div", { className: "hsk-cb-empty-logo", "aria-hidden": "true", children: /* @__PURE__ */ jsx7("svg", { viewBox: "0 0 100 100", className: "hsk-brand-mark", children: /* @__PURE__ */ jsx7("path", { d: "M39.4 10.4 Q44 0 48.6 10.4 L86.1 95.8 Q88 100 83.4 100 L4.6 100 Q0 100 1.9 95.8 Z M24 100 L24 65 Q24 60 27.4 56.3 Q44 38 60.6 56.3 Q64 60 64 65 L64 100 Z", transform: "translate(22.7 19) scale(0.62)", fillRule: "evenodd" }) }) }),
|
|
2018
2000
|
awaitingName ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2001
|
+
/* @__PURE__ */ jsxs6("h2", { className: "hsk-cb-hello", children: [
|
|
2002
|
+
"Hi, I'm ",
|
|
2003
|
+
/* @__PURE__ */ jsx7("b", { children: "kiku" }),
|
|
2004
|
+
"."
|
|
2005
|
+
] }),
|
|
2006
|
+
/* @__PURE__ */ jsx7("p", { className: "hsk-cb-hello-lead", children: "I can search, visualize, or capture anything for you \u2014 on this site or any other." }),
|
|
2007
|
+
/* @__PURE__ */ jsx7("p", { className: "hsk-cb-hello-ask", children: "What should I call you?" }),
|
|
2008
|
+
/* @__PURE__ */ jsx7("button", { className: "hsk-cb-hello-skip", onClick: () => setNameSkipped(true), children: "Skip for now" })
|
|
2023
2009
|
] }) : shopperName ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2024
|
-
/* @__PURE__ */ jsxs6("
|
|
2025
|
-
"
|
|
2026
|
-
shopperName
|
|
2010
|
+
/* @__PURE__ */ jsxs6("h2", { className: "hsk-cb-hello", children: [
|
|
2011
|
+
"Hi, ",
|
|
2012
|
+
shopperName,
|
|
2013
|
+
"."
|
|
2027
2014
|
] }),
|
|
2028
|
-
/* @__PURE__ */ jsx7("
|
|
2015
|
+
/* @__PURE__ */ jsx7("p", { className: "hsk-cb-hello-lead", children: "What can I find for you today?" })
|
|
2029
2016
|
] }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2030
|
-
/* @__PURE__ */
|
|
2031
|
-
|
|
2017
|
+
/* @__PURE__ */ jsxs6("h2", { className: "hsk-cb-hello", children: [
|
|
2018
|
+
"Hi, I'm ",
|
|
2019
|
+
/* @__PURE__ */ jsx7("b", { children: "kiku" }),
|
|
2020
|
+
"."
|
|
2021
|
+
] }),
|
|
2022
|
+
/* @__PURE__ */ jsx7("p", { className: "hsk-cb-hello-lead", children: "Ask me to search, visualize, or capture anything \u2014 I look across the whole site in real time." })
|
|
2032
2023
|
] }),
|
|
2033
2024
|
!awaitingName && activeChips.length > 0 && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-chips", children: activeChips.map((chip) => /* @__PURE__ */ jsx7(
|
|
2034
2025
|
"button",
|
|
@@ -2057,9 +2048,12 @@ function ChatModal({
|
|
|
2057
2048
|
/* @__PURE__ */ jsx7("div", { className: "hsk-cb-ai-icon", style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx7(SparkleIcon2, {}) }),
|
|
2058
2049
|
/* @__PURE__ */ jsxs6("div", { className: "hsk-cb-ai-body", children: [
|
|
2059
2050
|
(() => {
|
|
2060
|
-
const
|
|
2051
|
+
const parsed = parseThinking(displayContent);
|
|
2052
|
+
const thinking = msg.thinking || parsed.thinking;
|
|
2053
|
+
const content = parsed.content;
|
|
2054
|
+
const isComplete = msg.thinking ? content.length > 0 || !(isLast && streaming) : parsed.isComplete;
|
|
2061
2055
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2062
|
-
thinking && /* @__PURE__ */ jsx7(ThinkingBlock, { text: thinking, isComplete }),
|
|
2056
|
+
thinking && /* @__PURE__ */ jsx7(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
|
|
2063
2057
|
content && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-ai-text", children: [
|
|
2064
2058
|
renderMarkdown(content, isLast && streaming),
|
|
2065
2059
|
isLast && streaming && /* @__PURE__ */ jsx7("span", { style: { display: "inline-block", width: "0.5em", height: "1.05em", marginLeft: "2px", verticalAlign: "text-bottom", background: "currentColor", opacity: 0.55, borderRadius: "1px" } })
|
|
@@ -2152,8 +2146,21 @@ function ChatModal({
|
|
|
2152
2146
|
] }),
|
|
2153
2147
|
/* @__PURE__ */ jsx7("span", { className: "hsk-cb-thinking-text", children: "Thinking\u2026" })
|
|
2154
2148
|
] }),
|
|
2155
|
-
|
|
2156
|
-
|
|
2149
|
+
lastAction?.type === "open_memory" && lastAction.url && !loading && !streaming && /* @__PURE__ */ jsxs6(
|
|
2150
|
+
"a",
|
|
2151
|
+
{
|
|
2152
|
+
className: "hsk-cb-memory-pill",
|
|
2153
|
+
href: String(lastAction.url),
|
|
2154
|
+
target: "_blank",
|
|
2155
|
+
rel: "noopener noreferrer",
|
|
2156
|
+
children: [
|
|
2157
|
+
"Open my memory on mimi",
|
|
2158
|
+
/* @__PURE__ */ jsx7(ExternalIcon, {})
|
|
2159
|
+
]
|
|
2160
|
+
}
|
|
2161
|
+
),
|
|
2162
|
+
(stopped || interrupted) && !loading && !streaming && messages[messages.length - 1]?.role === "assistant" && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-stopped", children: [
|
|
2163
|
+
/* @__PURE__ */ jsx7("span", { className: "hsk-cb-stopped-label", children: stopped ? "You stopped this response." : "This response was interrupted." }),
|
|
2157
2164
|
/* @__PURE__ */ jsxs6("button", { className: "hsk-cb-continue", onClick: continueGenerating, children: [
|
|
2158
2165
|
/* @__PURE__ */ jsx7(ContinueIcon, {}),
|
|
2159
2166
|
"Continue generating"
|
|
@@ -2189,12 +2196,7 @@ function ChatModal({
|
|
|
2189
2196
|
/* @__PURE__ */ jsx7("div", { style: { fontSize: 12, fontWeight: 600, marginBottom: 4 }, children: "Your secret \u2014 shown only once" }),
|
|
2190
2197
|
/* @__PURE__ */ jsx7("code", { style: { display: "block", fontSize: 14, fontWeight: 700, marginBottom: 6, wordBreak: "break-all" }, children: mintedKey }),
|
|
2191
2198
|
/* @__PURE__ */ jsxs6("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
2192
|
-
/* @__PURE__ */ jsx7("button", { className: "hsk-cb-phone-submit", style: { padding: "4px 10px" }, onClick: () =>
|
|
2193
|
-
try {
|
|
2194
|
-
navigator.clipboard?.writeText(mintedKey);
|
|
2195
|
-
} catch {
|
|
2196
|
-
}
|
|
2197
|
-
}, children: "Copy secret" }),
|
|
2199
|
+
/* @__PURE__ */ jsx7("button", { className: "hsk-cb-phone-submit", style: { padding: "4px 10px" }, onClick: () => copyValue(mintedKey, "secret"), children: copied === "secret" ? "Copied" : "Copy secret" }),
|
|
2198
2200
|
/* @__PURE__ */ jsx7("span", { style: { fontSize: 11, opacity: 0.7 }, children: "Keep it private \u2014 use it to unlock your memory at mimi.akropolys.cloud. If lost, the memory is lost with it." })
|
|
2199
2201
|
] })
|
|
2200
2202
|
] }),
|
|
@@ -2202,12 +2204,7 @@ function ChatModal({
|
|
|
2202
2204
|
/* @__PURE__ */ jsx7("div", { style: { fontSize: 12, fontWeight: 600, marginBottom: 4 }, children: "Your public id" }),
|
|
2203
2205
|
/* @__PURE__ */ jsx7("code", { style: { display: "block", fontSize: 13, fontWeight: 600, marginBottom: 6, wordBreak: "break-all", opacity: 0.85 }, children: mintedPub }),
|
|
2204
2206
|
/* @__PURE__ */ jsxs6("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
2205
|
-
/* @__PURE__ */ jsx7("button", { className: "hsk-cb-phone-submit", style: { padding: "4px 10px" }, onClick: () =>
|
|
2206
|
-
try {
|
|
2207
|
-
navigator.clipboard?.writeText(mintedPub);
|
|
2208
|
-
} catch {
|
|
2209
|
-
}
|
|
2210
|
-
}, children: "Copy id" }),
|
|
2207
|
+
/* @__PURE__ */ jsx7("button", { className: "hsk-cb-phone-submit", style: { padding: "4px 10px" }, onClick: () => copyValue(mintedPub, "pub"), children: copied === "pub" ? "Copied" : "Copy id" }),
|
|
2211
2208
|
/* @__PURE__ */ jsx7("span", { style: { fontSize: 11, opacity: 0.7 }, children: "Paste this on any site to keep saving to the same memory." })
|
|
2212
2209
|
] })
|
|
2213
2210
|
] }),
|