@chrryai/chrry 1.5.64 → 1.5.66

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/Chat.module.scss CHANGED
@@ -8,7 +8,7 @@
8
8
  z-index: 1000;
9
9
  bottom: toRem.toRem(3);
10
10
  padding: 0 toRem.toRem(10);
11
- max-width: toRem.toRem(600);
11
+ max-width: toRem.toRem(620);
12
12
 
13
13
  width: 100%;
14
14
  // transform: translateX(-50%);
package/dist/index.js CHANGED
@@ -2093,7 +2093,7 @@ var init_utils = __esm({
2093
2093
  };
2094
2094
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
2095
2095
  config = getSiteConfig(getClientHostname());
2096
- VERSION = config.version || "1.5.64";
2096
+ VERSION = config.version || "1.5.66";
2097
2097
  getSlugFromPathname = (path) => {
2098
2098
  return getAppAndStoreSlugs(path, {
2099
2099
  defaultAppSlug: config.slug,
@@ -4208,9 +4208,9 @@ function SortableItem({
4208
4208
  transform: import_utilities.CSS.Transform.toString(transform2),
4209
4209
  transition,
4210
4210
  zIndex: isDragging ? 999 : "auto",
4211
- position: "relative",
4212
- touchAction: "none"
4213
- // Important for mobile drag
4211
+ position: "relative"
4212
+ // Don't block touch events on the entire item - let scrolling work
4213
+ // touchAction is set to "none" only on the drag handle itself
4214
4214
  };
4215
4215
  const drag = listeners?.onPointerDown;
4216
4216
  return /* @__PURE__ */ import_react7.default.createElement("div", { ref: setNodeRef, style: style2, ...attributes }, renderItem({
@@ -4233,12 +4233,27 @@ function DraggableList({
4233
4233
  testID
4234
4234
  }) {
4235
4235
  const sensors = (0, import_core.useSensors)(
4236
- (0, import_core.useSensor)(import_core.PointerSensor),
4236
+ (0, import_core.useSensor)(import_core.PointerSensor, {
4237
+ activationConstraint: {
4238
+ distance: 5
4239
+ // Require 5px movement before drag starts
4240
+ }
4241
+ }),
4237
4242
  (0, import_core.useSensor)(import_core.KeyboardSensor, {
4238
4243
  coordinateGetter: import_sortable.sortableKeyboardCoordinates
4239
4244
  }),
4240
- (0, import_core.useSensor)(import_core.TouchSensor),
4241
- (0, import_core.useSensor)(import_core.MouseSensor)
4245
+ (0, import_core.useSensor)(import_core.TouchSensor, {
4246
+ activationConstraint: {
4247
+ distance: 5
4248
+ // Require 5px movement before drag starts
4249
+ }
4250
+ }),
4251
+ (0, import_core.useSensor)(import_core.MouseSensor, {
4252
+ activationConstraint: {
4253
+ distance: 5
4254
+ // Require 5px movement before drag starts
4255
+ }
4256
+ })
4242
4257
  );
4243
4258
  const items = (0, import_react7.useMemo)(
4244
4259
  () => data.map((item, index) => keyExtractor(item, index)),
@@ -24400,7 +24415,7 @@ function DataProvider({ children, ...rest }) {
24400
24415
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24401
24416
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24402
24417
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24403
- const VERSION4 = "1.5.64";
24418
+ const VERSION4 = "1.5.66";
24404
24419
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24405
24420
  const {
24406
24421
  API_URL: API_URL2,
@@ -36576,7 +36591,7 @@ var init_Chat_styles = __esm({
36576
36591
  zIndex: 1e3,
36577
36592
  bottom: 3,
36578
36593
  padding: "0 10px",
36579
- maxWidth: 600,
36594
+ maxWidth: 620,
36580
36595
  width: "100%",
36581
36596
  flexDirection: "column",
36582
36597
  flex: 1,
@@ -38680,7 +38695,11 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
38680
38695
  const threadId2 = threadIdRef.current;
38681
38696
  if (!token) return;
38682
38697
  const clientId = data?.clientId;
38683
- if (type === "stream_update" && data.chunk && clientId) {
38698
+ const chunk2 = data?.chunk;
38699
+ if (type === "stream_update" && chunk2 && clientId && data.message && (isOwner_default(data.message.message, {
38700
+ userId: user?.id,
38701
+ guestId: guest?.id
38702
+ }) ? data.deviceId === deviceId : true)) {
38684
38703
  if (isSpeechActive && os !== "ios") {
38685
38704
  return;
38686
38705
  }
@@ -38695,10 +38714,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
38695
38714
  if (shouldStopRef.current) return;
38696
38715
  if (!shouldStopRef.current) {
38697
38716
  streamContentRef.current += data.chunk;
38698
- const cleanContent = stripActionText(
38699
- streamContentRef.current,
38700
- data.chunk
38701
- );
38717
+ const cleanContent = stripActionText(streamContentRef.current, chunk2);
38702
38718
  onStreamingUpdate?.({
38703
38719
  content: cleanContent,
38704
38720
  clientId,
@@ -39639,7 +39655,8 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
39639
39655
  style: {
39640
39656
  ...styles4.chat.style,
39641
39657
  ...isStandalone2 ? styles4.standalone : {},
39642
- ...isChatFloating ? styles4.chatFloating.style : {}
39658
+ ...isChatFloating ? styles4.chatFloating.style : {},
39659
+ "--glow-color": COLORS[app?.themeColor]
39643
39660
  }
39644
39661
  },
39645
39662
  selectedAgent?.capabilities.imageGeneration && /* @__PURE__ */ React.createElement(
@@ -45062,8 +45079,6 @@ function Store({
45062
45079
  if (app) {
45063
45080
  setSelectedApp(app);
45064
45081
  }
45065
- } else if (store?.appId && !hasStoreApps(storeAppsContext.find((app) => app.id === app.id))) {
45066
- setLoadingAppId(store?.appId);
45067
45082
  }
45068
45083
  }, [slugParam, storeAppsContext]);
45069
45084
  const [loadingAppInternal, setLoadingAppInternal] = (0, import_react73.useState)(loadingApp);
@@ -45184,50 +45199,56 @@ function Store({
45184
45199
  /* @__PURE__ */ import_react73.default.createElement(icons_exports.Sparkles, { size: 16, color: "var(--accent-1)" }),
45185
45200
  t5("Create Your Agent")
45186
45201
  )),
45187
- /* @__PURE__ */ import_react73.default.createElement(Div, { style: styles4.content.style }, /* @__PURE__ */ import_react73.default.createElement(Div, { style: styles4.apps.style }, storeApps?.map((app, index) => /* @__PURE__ */ import_react73.default.createElement(
45188
- Div,
45189
- {
45190
- key: app.id,
45191
- className: "pointer",
45192
- style: {
45193
- ...styles4.app.style,
45194
- ...index === storeApps?.length - 1 && styles4.appLast.style,
45195
- ...!isMobileDevice ? styles4.appLarge.style : {},
45196
- ...selectedApp?.id === app.id && styles4.appSelected.style
45197
- },
45198
- onClick: () => setSelectedApp(app)
45199
- },
45200
- /* @__PURE__ */ import_react73.default.createElement(
45201
- Span,
45202
- {
45203
- style: {
45204
- ...styles4.badge.style,
45205
- display: isMobileDevice ? "none" : "flex"
45206
- }
45207
- },
45208
- t5(app.status === "active" ? "live" : "testing")
45209
- ),
45210
- /* @__PURE__ */ import_react73.default.createElement(
45211
- ImageComponent,
45212
- {
45213
- style: { ...styles4.appImage.style },
45214
- app,
45215
- alt: app.name,
45216
- size: isMobileDevice ? 40 : 80
45217
- }
45218
- ),
45219
- /* @__PURE__ */ import_react73.default.createElement(
45202
+ /* @__PURE__ */ import_react73.default.createElement(Div, { style: styles4.content.style }, /* @__PURE__ */ import_react73.default.createElement(Div, { style: styles4.apps.style }, storeApps?.map((app, index) => {
45203
+ return /* @__PURE__ */ import_react73.default.createElement(
45220
45204
  Div,
45221
45205
  {
45206
+ key: app.id,
45207
+ "data-color": COLORS[app.themeColor],
45208
+ className: `pointer ${loadingApp?.id === app.id ? "placeholderGlow" : ""}`,
45222
45209
  style: {
45223
- ...styles4.appInfo.style,
45224
- display: isMobileDevice ? "none" : "flex"
45225
- }
45210
+ ...styles4.app.style,
45211
+ ...index === storeApps?.length - 1 && styles4.appLast.style,
45212
+ ...!isMobileDevice ? styles4.appLarge.style : {},
45213
+ ...selectedApp?.id === app.id && styles4.appSelected.style,
45214
+ boxShadow: COLORS[app.themeColor],
45215
+ borderColor: COLORS[app.themeColor],
45216
+ "--glow-color": COLORS[app.themeColor]
45217
+ },
45218
+ onClick: () => setSelectedApp(app)
45226
45219
  },
45227
- /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appName.style } }, loadingAppId === app.id ? /* @__PURE__ */ import_react73.default.createElement(Loading, { size: 16 }) : app.icon, " ", app.name),
45228
- /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appSubtitle.style } }, t5(app.subtitle || ""))
45229
- )
45230
- ))), /* @__PURE__ */ import_react73.default.createElement(Div, { key: selectedApp?.id, style: styles4.footer.style }, selectedApp && /* @__PURE__ */ import_react73.default.createElement(Div, { style: styles4.appDetails.style }, /* @__PURE__ */ import_react73.default.createElement(H3, { style: styles4.appTitle.style }, selectedApp.icon, " ", selectedApp.name, /* @__PURE__ */ import_react73.default.createElement(
45220
+ /* @__PURE__ */ import_react73.default.createElement(
45221
+ Span,
45222
+ {
45223
+ style: {
45224
+ ...styles4.badge.style,
45225
+ display: isMobileDevice ? "none" : "flex"
45226
+ }
45227
+ },
45228
+ t5(app.status === "active" ? "live" : "testing")
45229
+ ),
45230
+ /* @__PURE__ */ import_react73.default.createElement(
45231
+ ImageComponent,
45232
+ {
45233
+ style: { ...styles4.appImage.style },
45234
+ app,
45235
+ alt: app.name,
45236
+ size: isMobileDevice ? 40 : 80
45237
+ }
45238
+ ),
45239
+ /* @__PURE__ */ import_react73.default.createElement(
45240
+ Div,
45241
+ {
45242
+ style: {
45243
+ ...styles4.appInfo.style,
45244
+ display: isMobileDevice ? "none" : "flex"
45245
+ }
45246
+ },
45247
+ /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appName.style } }, loadingAppId === app.id ? /* @__PURE__ */ import_react73.default.createElement(Loading, { size: 16 }) : app.icon, " ", app.name),
45248
+ /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appSubtitle.style } }, t5(app.subtitle || ""))
45249
+ )
45250
+ );
45251
+ })), /* @__PURE__ */ import_react73.default.createElement(Div, { key: selectedApp?.id, style: styles4.footer.style }, selectedApp && /* @__PURE__ */ import_react73.default.createElement(Div, { style: styles4.appDetails.style }, /* @__PURE__ */ import_react73.default.createElement(H3, { style: styles4.appTitle.style }, selectedApp.icon, " ", selectedApp.name, /* @__PURE__ */ import_react73.default.createElement(
45231
45252
  Anchor,
45232
45253
  {
45233
45254
  href: getAppSlug(selectedApp),
@@ -50166,12 +50187,20 @@ function FocusButton2({
50166
50187
  onPointerDown: (e) => {
50167
50188
  if (e.pointerType === "mouse" && e.button !== 0)
50168
50189
  return;
50190
+ e.preventDefault();
50191
+ e.stopPropagation();
50169
50192
  drag(e);
50170
50193
  },
50194
+ onPointerUp: (e) => {
50195
+ e.stopPropagation();
50196
+ },
50171
50197
  style: {
50172
50198
  ...styles4.dragHandle.style,
50173
50199
  touchAction: "none",
50174
- cursor: "grab"
50200
+ cursor: "grab",
50201
+ // Increase touch target size for better mobile UX
50202
+ padding: "8px",
50203
+ margin: "-8px"
50175
50204
  }
50176
50205
  },
50177
50206
  /* @__PURE__ */ import_react87.default.createElement(icons_exports.GripVertical, { width: 22, height: 22 })
@@ -81908,6 +81937,198 @@ var init_Hey = __esm({
81908
81937
  }
81909
81938
  });
81910
81939
 
81940
+ // lib/swrCacheProvider.ts
81941
+ async function withRetry(operation, config2, operationName) {
81942
+ let lastError;
81943
+ for (let attempt = 0; attempt < config2.maxRetries; attempt++) {
81944
+ try {
81945
+ return await operation();
81946
+ } catch (error) {
81947
+ lastError = error;
81948
+ if (isQuotaExceeded(error)) {
81949
+ console.warn(`[SWR Cache] Quota exceeded during ${operationName}`);
81950
+ throw error;
81951
+ }
81952
+ const delay = config2.retryBaseDelay * Math.pow(2, attempt);
81953
+ await new Promise((resolve) => setTimeout(resolve, delay));
81954
+ }
81955
+ }
81956
+ console.error(
81957
+ `[SWR Cache] ${operationName} failed after ${config2.maxRetries} retries:`,
81958
+ lastError
81959
+ );
81960
+ return void 0;
81961
+ }
81962
+ function isQuotaExceeded(error) {
81963
+ if (error instanceof Error) {
81964
+ return error.name === "QuotaExceededError" || error.message.includes("quota") || error.message.includes("storage");
81965
+ }
81966
+ return false;
81967
+ }
81968
+ function createDexieProvider(config2 = DEFAULT_CONFIG) {
81969
+ const db = new SWRDexieDB();
81970
+ const memCache = /* @__PURE__ */ new Map();
81971
+ let degradedMode = false;
81972
+ let gcTimer = null;
81973
+ async function runGarbageCollection() {
81974
+ if (degradedMode) return;
81975
+ try {
81976
+ const now2 = Date.now();
81977
+ const expiredKeys = await db.cache.where("ts").below(now2 - config2.ttl).primaryKeys();
81978
+ if (expiredKeys.length > 0) {
81979
+ await db.cache.bulkDelete(expiredKeys);
81980
+ expiredKeys.forEach((key) => memCache.delete(key));
81981
+ console.debug(
81982
+ `[SWR Cache] GC: Removed ${expiredKeys.length} expired entries`
81983
+ );
81984
+ }
81985
+ const totalCount = await db.cache.count();
81986
+ if (totalCount > config2.maxEntries) {
81987
+ const toEvict = totalCount - config2.maxEntries + config2.evictionBatchSize;
81988
+ const lruEntries = await db.cache.orderBy("lastAccess").limit(toEvict).primaryKeys();
81989
+ if (lruEntries.length > 0) {
81990
+ await db.cache.bulkDelete(lruEntries);
81991
+ lruEntries.forEach((key) => memCache.delete(key));
81992
+ console.debug(
81993
+ `[SWR Cache] GC: Evicted ${lruEntries.length} LRU entries`
81994
+ );
81995
+ }
81996
+ }
81997
+ } catch (error) {
81998
+ console.warn("[SWR Cache] GC failed:", error);
81999
+ }
82000
+ }
82001
+ async function initialize() {
82002
+ try {
82003
+ const now2 = Date.now();
82004
+ const items = await db.cache.toArray();
82005
+ let expiredCount = 0;
82006
+ let loadedCount = 0;
82007
+ let migratedCount = 0;
82008
+ for (const item of items) {
82009
+ if (item.version !== SCHEMA_VERSION) {
82010
+ await db.cache.update(item.key, {
82011
+ version: SCHEMA_VERSION,
82012
+ lastAccess: item.lastAccess || item.ts
82013
+ });
82014
+ migratedCount++;
82015
+ }
82016
+ if (now2 - item.ts <= config2.ttl) {
82017
+ memCache.set(item.key, item.value);
82018
+ loadedCount++;
82019
+ } else {
82020
+ db.cache.delete(item.key).catch(() => {
82021
+ });
82022
+ expiredCount++;
82023
+ }
82024
+ }
82025
+ console.debug(
82026
+ `[SWR Cache] Initialized: ${loadedCount} loaded, ${expiredCount} expired, ${migratedCount} migrated`
82027
+ );
82028
+ gcTimer = setInterval(runGarbageCollection, config2.gcInterval);
82029
+ setTimeout(runGarbageCollection, 1e3);
82030
+ } catch (error) {
82031
+ console.warn("[SWR Cache] Failed to initialize from IndexedDB:", error);
82032
+ degradedMode = true;
82033
+ }
82034
+ }
82035
+ initialize();
82036
+ return {
82037
+ get: (key) => {
82038
+ const value = memCache.get(key);
82039
+ if (value !== void 0 && !degradedMode) {
82040
+ db.cache.update(key, { lastAccess: Date.now() }).catch(() => {
82041
+ });
82042
+ }
82043
+ return value;
82044
+ },
82045
+ set: (key, value) => {
82046
+ memCache.set(key, value);
82047
+ if (degradedMode) return;
82048
+ const entry = {
82049
+ key,
82050
+ value,
82051
+ ts: Date.now(),
82052
+ lastAccess: Date.now(),
82053
+ version: SCHEMA_VERSION
82054
+ };
82055
+ withRetry(() => db.cache.put(entry), config2, `set(${key})`).catch(
82056
+ (error) => {
82057
+ if (isQuotaExceeded(error)) {
82058
+ runGarbageCollection().then(() => {
82059
+ db.cache.put(entry).catch(() => {
82060
+ console.warn("[SWR Cache] Switching to degraded mode");
82061
+ degradedMode = true;
82062
+ });
82063
+ });
82064
+ }
82065
+ }
82066
+ );
82067
+ },
82068
+ delete: (key) => {
82069
+ memCache.delete(key);
82070
+ if (degradedMode) return;
82071
+ db.cache.delete(key).catch((error) => {
82072
+ console.error("[SWR Cache] Failed to delete from IndexedDB:", error);
82073
+ });
82074
+ },
82075
+ keys: () => {
82076
+ return memCache.keys();
82077
+ }
82078
+ };
82079
+ }
82080
+ function createMemoryProvider() {
82081
+ const cache = /* @__PURE__ */ new Map();
82082
+ return cache;
82083
+ }
82084
+ function getCacheProvider(_parentCache) {
82085
+ if (typeof indexedDB !== "undefined") {
82086
+ try {
82087
+ return createDexieProvider(DEFAULT_CONFIG);
82088
+ } catch (error) {
82089
+ console.warn("[SWR Cache] Dexie failed, using memory:", error);
82090
+ return createMemoryProvider();
82091
+ }
82092
+ }
82093
+ return createMemoryProvider();
82094
+ }
82095
+ var import_dexie, DEFAULT_CONFIG, SCHEMA_VERSION, SWRDexieDB, swrCacheProvider_default;
82096
+ var init_swrCacheProvider = __esm({
82097
+ "lib/swrCacheProvider.ts"() {
82098
+ "use strict";
82099
+ import_dexie = __toESM(require("dexie"));
82100
+ DEFAULT_CONFIG = {
82101
+ ttl: 60 * 60 * 1e3,
82102
+ // 1 hour
82103
+ maxEntries: 1e3,
82104
+ gcInterval: 5 * 60 * 1e3,
82105
+ // 5 minutes
82106
+ evictionBatchSize: 100,
82107
+ maxRetries: 3,
82108
+ retryBaseDelay: 100
82109
+ };
82110
+ SCHEMA_VERSION = 2;
82111
+ SWRDexieDB = class extends import_dexie.default {
82112
+ cache;
82113
+ constructor() {
82114
+ super("swr-dexie-cache");
82115
+ this.version(1).stores({
82116
+ cache: "key, ts"
82117
+ });
82118
+ this.version(2).stores({
82119
+ cache: "key, ts, lastAccess, version"
82120
+ }).upgrade((tx) => {
82121
+ return tx.table("cache").toCollection().modify((entry) => {
82122
+ entry.lastAccess = entry.ts;
82123
+ entry.version = 1;
82124
+ });
82125
+ });
82126
+ }
82127
+ };
82128
+ swrCacheProvider_default = getCacheProvider;
82129
+ }
82130
+ });
82131
+
81911
82132
  // context/providers/index.tsx
81912
82133
  function AppProviders({
81913
82134
  children,
@@ -81927,7 +82148,7 @@ function AppProviders({
81927
82148
  const [error, setError] = (0, import_react117.useState)("");
81928
82149
  const swrConfig = {
81929
82150
  // Use persistent cache provider (IndexedDB on web, MMKV on native)
81930
- // ...(cacheProvider ? { provider: cacheProvider } : {}),
82151
+ provider: swrCacheProvider_default,
81931
82152
  // Pre-populate cache with SSR data
81932
82153
  // fallback: {
81933
82154
  // ...(session ? { session: { data: session } } : {}),
@@ -82002,6 +82223,7 @@ var init_providers = __esm({
82002
82223
  import_swr10 = require("swr");
82003
82224
  init_TimerContext();
82004
82225
  init_Hey();
82226
+ init_swrCacheProvider();
82005
82227
  }
82006
82228
  });
82007
82229