birdclaw 0.8.3 → 0.8.4

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.
Files changed (284) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +10 -8
  3. package/bin/birdclaw.mjs +4 -66
  4. package/dist/cli/birdclaw.js +28165 -0
  5. package/dist/client/assets/AvatarChip-DLoqM5xD.js +1 -0
  6. package/dist/client/assets/ProfilePreview-BejAuYsJ.js +1 -0
  7. package/dist/client/assets/SavedTimelineView-BIS7HKpp.js +1 -0
  8. package/dist/client/assets/SmartTimestamp-BR0-9se2.js +1 -0
  9. package/dist/client/assets/TimelineRouteFrame-CyGPj0eM.js +1 -0
  10. package/dist/client/assets/blocks-7UDKQp8H.js +1 -0
  11. package/dist/client/assets/bookmarks-CbBkMvXk.js +1 -0
  12. package/dist/client/assets/chunk-C0phanGV.js +1 -0
  13. package/dist/client/assets/circle-check-C_Vq3ElD.js +1 -0
  14. package/dist/client/assets/client-stream-contracts-ys3XhWG4.js +5 -0
  15. package/dist/client/assets/createLucideIcon-JV8isFFR.js +1 -0
  16. package/dist/client/assets/data-sources-Cm2bpNvg.js +1 -0
  17. package/dist/client/assets/discuss-DTjaOugw.js +1 -0
  18. package/dist/client/assets/dms-CGd6Eogq.js +1 -0
  19. package/dist/client/assets/inbox-BHlGuOy2.js +1 -0
  20. package/dist/client/assets/index-CEIG7S6s.js +31 -0
  21. package/dist/client/assets/index-bpFrQ5yG.css +1 -0
  22. package/dist/client/assets/likes-cLrcAQem.js +1 -0
  23. package/dist/client/assets/links-CM9QO1LC.js +1 -0
  24. package/dist/client/assets/mapbox-BxTlqXt9.js +2 -0
  25. package/dist/client/assets/mapbox-gl-dgf_hX3a.js +3215 -0
  26. package/dist/client/assets/mentions-CxKCgzIf.js +1 -0
  27. package/dist/client/assets/network-map-B5a3whqj.js +2 -0
  28. package/dist/client/assets/profile-analyze-CRtNEwlb.js +1 -0
  29. package/dist/client/assets/profile-hydration-client-YEtJsNTv.js +1 -0
  30. package/dist/client/assets/profiles._handle-C82_HoKX.js +1 -0
  31. package/dist/client/assets/query-client-fYu2rzRC.js +17 -0
  32. package/dist/client/assets/rate-limits-ScaEwdVK.js +1 -0
  33. package/dist/client/assets/react-dom-DHl6Ug7F.js +1 -0
  34. package/dist/client/assets/react-nBylq1U5.js +1 -0
  35. package/dist/client/assets/repeat-2-xCwHM9hD.js +1 -0
  36. package/dist/client/assets/routes-q7ZaW4En.js +1 -0
  37. package/dist/client/assets/schemas-I9r6F6ya.js +64 -0
  38. package/dist/client/assets/search-Dq5kYsxA.js +1 -0
  39. package/dist/client/assets/sparkles-CQVlvHsZ.js +1 -0
  40. package/dist/client/assets/styles-B8s3tt3r.css +2 -0
  41. package/dist/client/assets/today-CeG1O7Py.js +1 -0
  42. package/dist/client/assets/triangle-alert-CBL7s2pf.js +1 -0
  43. package/dist/client/assets/useTimelineRouteData-1HsqgvUi.js +1 -0
  44. package/dist/client/assets/users-CHbKlqUr.js +1 -0
  45. package/dist/server/assets/AvatarChip-zUDAEmjL.js +105 -0
  46. package/dist/server/assets/FeedState-ntW0Q2GB.js +214 -0
  47. package/dist/server/assets/ProfileAnalysisStream-BFvhVdhn.js +198 -0
  48. package/dist/server/assets/ProfilePreview-C6gAor_j.js +752 -0
  49. package/dist/server/assets/SavedTimelineView-BG1jnBp1.js +64 -0
  50. package/dist/server/assets/SmartTimestamp-DfwE1NGf.js +45 -0
  51. package/dist/server/assets/SyncNowButton-BOn_IBXS.js +76 -0
  52. package/dist/server/assets/TimelineRouteFrame-CU7ilM7U.js +85 -0
  53. package/dist/server/assets/TweetRichText-DhCVv1-6.js +74 -0
  54. package/dist/server/assets/_tanstack-start-manifest_v-C-ZRnG_n.js +148 -0
  55. package/dist/server/assets/account-selection-CTdFGWRk.js +44 -0
  56. package/dist/server/assets/blocks-C1mgGTB3.js +299 -0
  57. package/dist/server/assets/blocks-DSgQghqP.js +17 -0
  58. package/dist/server/assets/bookmarks-BJN8tykY.js +14 -0
  59. package/dist/server/assets/client-stream-contracts-C2xbWVjm.js +769 -0
  60. package/dist/server/assets/data-sources-BnA1Q94p.js +180 -0
  61. package/dist/server/assets/discuss-CJ1dau1j.js +15 -0
  62. package/dist/server/assets/discuss-QTo08NCN.js +338 -0
  63. package/dist/server/assets/dms-BuLj4bp8.js +368 -0
  64. package/dist/server/assets/dms-DAyQrVM2.js +240 -0
  65. package/dist/server/assets/empty-plugin-adapters-DzrEkdBF.js +5 -0
  66. package/dist/server/assets/inbox-CkGOaW1q.js +214 -0
  67. package/dist/server/assets/inbox-DpWd1EzC.js +146 -0
  68. package/dist/server/assets/likes-DBOAtsJU.js +14 -0
  69. package/dist/server/assets/links-DAhSjynu.js +240 -0
  70. package/dist/server/assets/links-DmH5lxHO.js +468 -0
  71. package/dist/server/assets/mentions-BH2MzKtB.js +26 -0
  72. package/dist/server/assets/network-map-D3CzRcC4.js +224 -0
  73. package/dist/server/assets/network-map-D5DoLOwR.js +582 -0
  74. package/dist/server/assets/profile-analyze-BP65PED0.js +90 -0
  75. package/dist/server/assets/profile-analyze-C1NoM0tV.js +9 -0
  76. package/dist/server/assets/profile-hydration-client-GJ4kwJS8.js +133 -0
  77. package/dist/server/assets/profiles._handle-DjwlN_ac.js +184 -0
  78. package/dist/server/assets/profiles._handle-DsLNj2Ca.js +12 -0
  79. package/dist/server/assets/query-client-BdauHBgd.js +923 -0
  80. package/dist/server/assets/rate-limits-VAr2qzYD.js +262 -0
  81. package/dist/server/assets/route-search-BUlQ5lGM.js +117 -0
  82. package/dist/server/assets/router-DqkwSPiM.js +17026 -0
  83. package/dist/server/assets/routes-A9c9ZhwN.js +26 -0
  84. package/dist/server/assets/start-FaDOTmto.js +4 -0
  85. package/dist/server/assets/today-B5hVM57Z.js +17 -0
  86. package/dist/server/assets/today-fvGiZ7ud.js +303 -0
  87. package/dist/server/assets/ui-qbmcMSSX.js +137 -0
  88. package/{src/components/useDebouncedValue.ts → dist/server/assets/useDebouncedValue-DOnA6Xcy.js} +4 -4
  89. package/dist/server/assets/useTimelineRouteData-27cxynxa.js +1101 -0
  90. package/dist/server/server.js +5520 -0
  91. package/package.json +26 -34
  92. package/playwright.config.ts +0 -35
  93. package/scripts/browser-perf.mjs +0 -427
  94. package/scripts/build-docs-site.mjs +0 -967
  95. package/scripts/docs-site-assets.mjs +0 -311
  96. package/scripts/run-vitest.mjs +0 -21
  97. package/scripts/sanitize-node-options.mjs +0 -23
  98. package/scripts/start-test-server.mjs +0 -42
  99. package/src/cli/command-context.ts +0 -17
  100. package/src/cli/register-analysis.ts +0 -500
  101. package/src/cli/register-compose.ts +0 -40
  102. package/src/cli/register-graph.ts +0 -132
  103. package/src/cli/register-inbox.ts +0 -41
  104. package/src/cli/register-storage.ts +0 -106
  105. package/src/cli-moderation.ts +0 -210
  106. package/src/cli.ts +0 -1616
  107. package/src/components/AccountSwitcher.tsx +0 -178
  108. package/src/components/AppNav.tsx +0 -118
  109. package/src/components/AvatarChip.tsx +0 -58
  110. package/src/components/AvatarPreload.ts +0 -149
  111. package/src/components/BrandMark.tsx +0 -67
  112. package/src/components/ConversationThread.tsx +0 -131
  113. package/src/components/DmWorkspace.tsx +0 -286
  114. package/src/components/EmbeddedTweetCard.tsx +0 -55
  115. package/src/components/FeedState.tsx +0 -147
  116. package/src/components/FloatingPreview.tsx +0 -382
  117. package/src/components/InboxCard.tsx +0 -152
  118. package/src/components/LinkPreviewCard.tsx +0 -292
  119. package/src/components/MarkdownCitations.tsx +0 -680
  120. package/src/components/MarkdownViewer.tsx +0 -111
  121. package/src/components/ProfileAnalysisClient.ts +0 -191
  122. package/src/components/ProfileAnalysisStream.tsx +0 -259
  123. package/src/components/ProfilePreview.tsx +0 -131
  124. package/src/components/SavedTimelineView.tsx +0 -155
  125. package/src/components/SmartTimestamp.tsx +0 -72
  126. package/src/components/SyncNowButton.tsx +0 -140
  127. package/src/components/ThemeSlider.tsx +0 -80
  128. package/src/components/TimelineCard.tsx +0 -533
  129. package/src/components/TimelineRouteFrame.tsx +0 -186
  130. package/src/components/TweetArticleCard.tsx +0 -66
  131. package/src/components/TweetMediaGrid.tsx +0 -185
  132. package/src/components/TweetRichText.tsx +0 -159
  133. package/src/components/account-selection.ts +0 -64
  134. package/src/components/links-controller.ts +0 -162
  135. package/src/components/links-model.ts +0 -198
  136. package/src/components/network-map-controller.ts +0 -84
  137. package/src/components/network-map-model.ts +0 -255
  138. package/src/components/useTimelineRouteData.ts +0 -193
  139. package/src/lib/account-sync-job.ts +0 -666
  140. package/src/lib/actions-transport.ts +0 -300
  141. package/src/lib/analysis-runtime.ts +0 -238
  142. package/src/lib/api-client.ts +0 -220
  143. package/src/lib/api-contracts.ts +0 -328
  144. package/src/lib/archive-finder.ts +0 -185
  145. package/src/lib/archive-import-plan.ts +0 -102
  146. package/src/lib/archive-import.ts +0 -2695
  147. package/src/lib/authored-live.ts +0 -1027
  148. package/src/lib/avatar-cache.ts +0 -349
  149. package/src/lib/backup.ts +0 -2652
  150. package/src/lib/bird-actions.ts +0 -294
  151. package/src/lib/bird-command.ts +0 -130
  152. package/src/lib/bird.ts +0 -1140
  153. package/src/lib/blocklist.ts +0 -136
  154. package/src/lib/blocks-write.ts +0 -171
  155. package/src/lib/blocks.ts +0 -387
  156. package/src/lib/bookmark-sync-job.ts +0 -536
  157. package/src/lib/config.ts +0 -224
  158. package/src/lib/conversation-surface.ts +0 -205
  159. package/src/lib/data-sources.ts +0 -219
  160. package/src/lib/database-metrics.ts +0 -88
  161. package/src/lib/database-migrations.ts +0 -34
  162. package/src/lib/database-schema.ts +0 -312
  163. package/src/lib/database-writer.ts +0 -69
  164. package/src/lib/db.ts +0 -889
  165. package/src/lib/dm-read-model.ts +0 -533
  166. package/src/lib/dms-live.ts +0 -870
  167. package/src/lib/effect-runtime.ts +0 -45
  168. package/src/lib/follow-graph.ts +0 -1087
  169. package/src/lib/geocoding.ts +0 -296
  170. package/src/lib/http-effect.ts +0 -222
  171. package/src/lib/identity-search-index.ts +0 -369
  172. package/src/lib/import-repository.ts +0 -138
  173. package/src/lib/inbox.ts +0 -242
  174. package/src/lib/link-index.ts +0 -641
  175. package/src/lib/link-insights.ts +0 -860
  176. package/src/lib/link-preview-metadata.ts +0 -754
  177. package/src/lib/live-sync-engine.ts +0 -209
  178. package/src/lib/live-transport-gateway.ts +0 -128
  179. package/src/lib/location.ts +0 -137
  180. package/src/lib/media-fetch.ts +0 -860
  181. package/src/lib/media-includes.ts +0 -165
  182. package/src/lib/mention-threads-live.ts +0 -830
  183. package/src/lib/mentions-export.ts +0 -147
  184. package/src/lib/mentions-live.ts +0 -1114
  185. package/src/lib/moderation-target.ts +0 -227
  186. package/src/lib/moderation-write.ts +0 -131
  187. package/src/lib/mutes-write.ts +0 -171
  188. package/src/lib/mutes.ts +0 -84
  189. package/src/lib/ndjson-stream.ts +0 -106
  190. package/src/lib/network-map.ts +0 -382
  191. package/src/lib/openai-response-runtime.ts +0 -251
  192. package/src/lib/openai.ts +0 -117
  193. package/src/lib/paginated-sync.ts +0 -93
  194. package/src/lib/period-digest.ts +0 -1364
  195. package/src/lib/present.ts +0 -118
  196. package/src/lib/profile-affiliation-hydration.ts +0 -228
  197. package/src/lib/profile-affiliations.ts +0 -262
  198. package/src/lib/profile-analysis.ts +0 -1198
  199. package/src/lib/profile-bio-entities.ts +0 -318
  200. package/src/lib/profile-history.ts +0 -164
  201. package/src/lib/profile-hydration.ts +0 -180
  202. package/src/lib/profile-replies.ts +0 -77
  203. package/src/lib/profile-resolver.ts +0 -650
  204. package/src/lib/queries.ts +0 -6
  205. package/src/lib/query-actions.ts +0 -437
  206. package/src/lib/query-client.tsx +0 -47
  207. package/src/lib/query-read-model-shared.ts +0 -52
  208. package/src/lib/query-read-models.ts +0 -5
  209. package/src/lib/query-resource.ts +0 -41
  210. package/src/lib/query-status.ts +0 -164
  211. package/src/lib/research.ts +0 -652
  212. package/src/lib/runtime-services.ts +0 -20
  213. package/src/lib/search-discussion.ts +0 -812
  214. package/src/lib/seed.ts +0 -613
  215. package/src/lib/server-runtime-services.ts +0 -30
  216. package/src/lib/sqlite.ts +0 -183
  217. package/src/lib/streaming-ingestion.ts +0 -240
  218. package/src/lib/sync-cache.ts +0 -70
  219. package/src/lib/sync-plan.ts +0 -175
  220. package/src/lib/theme-transition.ts +0 -113
  221. package/src/lib/theme.tsx +0 -165
  222. package/src/lib/timeline-collections-live.ts +0 -407
  223. package/src/lib/timeline-live.ts +0 -302
  224. package/src/lib/timeline-read-model.ts +0 -1191
  225. package/src/lib/tweet-account-edges.ts +0 -48
  226. package/src/lib/tweet-lookup.ts +0 -46
  227. package/src/lib/tweet-render.ts +0 -430
  228. package/src/lib/tweet-repository.ts +0 -156
  229. package/src/lib/tweet-search-live.ts +0 -462
  230. package/src/lib/types.ts +0 -723
  231. package/src/lib/ui.ts +0 -529
  232. package/src/lib/url-expansion-store.ts +0 -110
  233. package/src/lib/url-expansion.ts +0 -343
  234. package/src/lib/url-safety.ts +0 -220
  235. package/src/lib/web-sync.ts +0 -533
  236. package/src/lib/whois.ts +0 -1080
  237. package/src/lib/x-profile.ts +0 -365
  238. package/src/lib/x-web.ts +0 -199
  239. package/src/lib/xurl-rate-limits.ts +0 -267
  240. package/src/lib/xurl.ts +0 -1677
  241. package/src/routeTree.gen.ts +0 -723
  242. package/src/router.tsx +0 -20
  243. package/src/routes/__root.tsx +0 -82
  244. package/src/routes/api/action.tsx +0 -147
  245. package/src/routes/api/avatar.tsx +0 -50
  246. package/src/routes/api/blocks.tsx +0 -35
  247. package/src/routes/api/conversation.tsx +0 -45
  248. package/src/routes/api/data-sources.tsx +0 -24
  249. package/src/routes/api/inbox.tsx +0 -43
  250. package/src/routes/api/link-insights.tsx +0 -85
  251. package/src/routes/api/link-preview.tsx +0 -47
  252. package/src/routes/api/network-map.tsx +0 -55
  253. package/src/routes/api/period-digest.tsx +0 -101
  254. package/src/routes/api/profile-analysis.tsx +0 -97
  255. package/src/routes/api/profile-hydrate.tsx +0 -54
  256. package/src/routes/api/query.tsx +0 -121
  257. package/src/routes/api/search-discussion.tsx +0 -113
  258. package/src/routes/api/status.tsx +0 -30
  259. package/src/routes/api/sync.tsx +0 -108
  260. package/src/routes/api/xurl-rate-limits.tsx +0 -24
  261. package/src/routes/blocks.tsx +0 -343
  262. package/src/routes/bookmarks.tsx +0 -18
  263. package/src/routes/data-sources.tsx +0 -249
  264. package/src/routes/discuss.tsx +0 -419
  265. package/src/routes/dms.tsx +0 -415
  266. package/src/routes/inbox.tsx +0 -232
  267. package/src/routes/index.tsx +0 -32
  268. package/src/routes/likes.tsx +0 -18
  269. package/src/routes/links.tsx +0 -631
  270. package/src/routes/mentions.tsx +0 -32
  271. package/src/routes/network-map.tsx +0 -732
  272. package/src/routes/profile-analyze.tsx +0 -112
  273. package/src/routes/profiles.$handle.tsx +0 -228
  274. package/src/routes/rate-limits.tsx +0 -305
  275. package/src/routes/today.tsx +0 -511
  276. package/src/styles.css +0 -257
  277. package/tsconfig.json +0 -29
  278. package/vite.config.ts +0 -29
  279. /package/{public → dist/client}/birdclaw-mark.png +0 -0
  280. /package/{public → dist/client}/favicon.ico +0 -0
  281. /package/{public → dist/client}/logo192.png +0 -0
  282. /package/{public → dist/client}/logo512.png +0 -0
  283. /package/{public → dist/client}/manifest.json +0 -0
  284. /package/{public → dist/client}/robots.txt +0 -0
@@ -0,0 +1,214 @@
1
+ import { Dt as pageSubtitleClass, Et as pageHeaderRowClass, K as emptyStateClass, Mt as primaryButtonClass, Ot as pageTitleClass, Tt as pageHeaderClass, Wt as secondaryButtonClass, Z as feedClass, cn as tabButtonClass, dn as textFieldClass, fn as textFieldShortClass, ln as tabButtonIndicatorClass, m as cx, pn as timestampClass, un as tabStripClass } from "./ui-qbmcMSSX.js";
2
+ import { a as fetchQueryEnvelope, n as queryKeys, r as fetchJson, s as postAction, y as inboxResponseSchema } from "./query-client-BdauHBgd.js";
3
+ import { r as useSelectedAccountId } from "./account-selection-CTdFGWRk.js";
4
+ import { i as validateInboxSearch } from "./route-search-BUlQ5lGM.js";
5
+ import { n as InboxCard, t as Route$1 } from "./inbox-DpWd1EzC.js";
6
+ import { useMemo, useState } from "react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Sparkles } from "lucide-react";
9
+ import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
10
+ //#region src/routes/inbox.tsx?tsr-split=component
11
+ var TABS = [
12
+ {
13
+ value: "mixed",
14
+ label: "Mixed"
15
+ },
16
+ {
17
+ value: "mentions",
18
+ label: "Mentions"
19
+ },
20
+ {
21
+ value: "dms",
22
+ label: "DMs"
23
+ }
24
+ ];
25
+ function InboxRoute() {
26
+ const search = Route$1.useSearch();
27
+ const navigate = Route$1.useNavigate();
28
+ return /* @__PURE__ */ jsx(InboxRouteView, {
29
+ searchState: search,
30
+ onSearchChange: (next, options) => void navigate({
31
+ search: next,
32
+ replace: options?.replace
33
+ })
34
+ });
35
+ }
36
+ function InboxRouteView({ searchState: controlledSearch, onSearchChange } = {}) {
37
+ const queryClient = useQueryClient();
38
+ const [localSearch, setLocalSearch] = useState(() => validateInboxSearch({}));
39
+ const searchState = controlledSearch ?? localSearch;
40
+ const updateSearch = (next, options) => onSearchChange ? onSearchChange(next, options) : setLocalSearch(next);
41
+ const { kind, minScore, hideLowSignal } = searchState;
42
+ const [activeReplyId, setActiveReplyId] = useState(null);
43
+ const [replyDraft, setReplyDraft] = useState("");
44
+ const [isSendingReply, setIsSendingReply] = useState(false);
45
+ const [replyError, setReplyError] = useState(null);
46
+ const meta = useQuery({
47
+ queryKey: queryKeys.status,
48
+ queryFn: ({ signal }) => fetchQueryEnvelope({ signal })
49
+ }).data ?? null;
50
+ const selectedAccountId = useSelectedAccountId(meta?.accounts);
51
+ const inboxQuery = useQuery({
52
+ queryKey: [...queryKeys.inbox, {
53
+ hideLowSignal,
54
+ kind,
55
+ minScore,
56
+ selectedAccountId: selectedAccountId ?? null
57
+ }],
58
+ queryFn: async ({ signal }) => {
59
+ const url = new URL("/api/inbox", window.location.origin);
60
+ url.searchParams.set("kind", kind);
61
+ url.searchParams.set("minScore", minScore);
62
+ if (selectedAccountId) url.searchParams.set("account", selectedAccountId);
63
+ if (hideLowSignal) url.searchParams.set("hideLowSignal", "1");
64
+ return fetchJson(url, { signal }, inboxResponseSchema, "Inbox request failed");
65
+ },
66
+ placeholderData: keepPreviousData,
67
+ staleTime: 5 * 6e4
68
+ });
69
+ const items = inboxQuery.data?.items ?? [];
70
+ const stats = inboxQuery.data?.stats ?? null;
71
+ const scoreMutation = useMutation({
72
+ mutationFn: () => postAction({
73
+ kind: "scoreInbox",
74
+ scoreKind: kind,
75
+ account: selectedAccountId,
76
+ limit: 8
77
+ }),
78
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: queryKeys.inbox })
79
+ });
80
+ const subtitle = useMemo(() => {
81
+ if (!meta || !stats) return "Ranking unreplied mentions and DMs...";
82
+ return `${String(stats.total)} in queue · ${String(stats.openai)} OpenAI scored · ${meta.transport.statusText}`;
83
+ }, [meta, stats]);
84
+ async function scoreNow() {
85
+ await scoreMutation.mutateAsync();
86
+ }
87
+ async function sendReply(item) {
88
+ if (!replyDraft.trim()) return;
89
+ setIsSendingReply(true);
90
+ setReplyError(null);
91
+ try {
92
+ await postAction(item.entityKind === "dm" ? {
93
+ kind: "replyDm",
94
+ conversationId: item.entityId,
95
+ text: replyDraft
96
+ } : {
97
+ kind: "replyTweet",
98
+ accountId: item.accountId,
99
+ tweetId: item.entityId,
100
+ text: replyDraft
101
+ });
102
+ setReplyDraft("");
103
+ setActiveReplyId(null);
104
+ await queryClient.invalidateQueries({ queryKey: queryKeys.inbox });
105
+ } catch (error) {
106
+ setReplyError(error instanceof Error ? error.message : "Reply failed");
107
+ } finally {
108
+ setIsSendingReply(false);
109
+ }
110
+ }
111
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
112
+ /* @__PURE__ */ jsxs("header", {
113
+ className: pageHeaderClass,
114
+ children: [
115
+ /* @__PURE__ */ jsxs("div", {
116
+ className: pageHeaderRowClass,
117
+ children: [/* @__PURE__ */ jsxs("div", {
118
+ className: "flex min-w-0 flex-col",
119
+ children: [/* @__PURE__ */ jsx("h1", {
120
+ className: pageTitleClass,
121
+ children: "Inbox"
122
+ }), /* @__PURE__ */ jsx("p", {
123
+ className: pageSubtitleClass,
124
+ children: subtitle
125
+ })]
126
+ }), /* @__PURE__ */ jsxs("button", {
127
+ className: primaryButtonClass,
128
+ disabled: scoreMutation.isPending,
129
+ onClick: () => void scoreNow(),
130
+ type: "button",
131
+ children: [/* @__PURE__ */ jsx(Sparkles, {
132
+ className: "size-4",
133
+ strokeWidth: 2.2
134
+ }), scoreMutation.isPending ? "Scoring..." : "Score with OpenAI"]
135
+ })]
136
+ }),
137
+ /* @__PURE__ */ jsxs("div", {
138
+ className: "flex flex-wrap items-center gap-2 px-4 pb-3",
139
+ children: [/* @__PURE__ */ jsx("input", {
140
+ className: cx(textFieldClass, textFieldShortClass),
141
+ inputMode: "numeric",
142
+ onChange: (event) => updateSearch({
143
+ ...searchState,
144
+ minScore: event.target.value
145
+ }, { replace: true }),
146
+ placeholder: "Min AI score",
147
+ value: minScore
148
+ }), /* @__PURE__ */ jsx("button", {
149
+ className: secondaryButtonClass,
150
+ onClick: () => updateSearch({
151
+ ...searchState,
152
+ hideLowSignal: !hideLowSignal
153
+ }),
154
+ type: "button",
155
+ "aria-pressed": hideLowSignal,
156
+ children: hideLowSignal ? "Hide low-signal" : "Show all"
157
+ })]
158
+ }),
159
+ /* @__PURE__ */ jsx("div", {
160
+ className: tabStripClass,
161
+ children: TABS.map((tab) => {
162
+ const active = kind === tab.value;
163
+ return /* @__PURE__ */ jsx("button", {
164
+ type: "button",
165
+ "aria-pressed": active,
166
+ className: cx(tabButtonClass, active && "text-[var(--ink)] font-bold"),
167
+ onClick: () => updateSearch({
168
+ ...searchState,
169
+ kind: tab.value
170
+ }),
171
+ children: /* @__PURE__ */ jsxs("span", {
172
+ className: "relative inline-flex flex-col items-center justify-center py-1",
173
+ children: [tab.value, active ? /* @__PURE__ */ jsx("span", { className: tabButtonIndicatorClass }) : null]
174
+ })
175
+ }, tab.value);
176
+ })
177
+ })
178
+ ]
179
+ }),
180
+ replyError ? /* @__PURE__ */ jsx("p", {
181
+ className: cx(timestampClass, "px-4 py-2 text-red-500"),
182
+ children: replyError
183
+ }) : null,
184
+ /* @__PURE__ */ jsxs("section", {
185
+ className: feedClass,
186
+ children: [items.length === 0 ? /* @__PURE__ */ jsx("div", {
187
+ className: emptyStateClass,
188
+ children: "Inbox clear."
189
+ }) : null, items.map((item) => /* @__PURE__ */ jsx(InboxCard, {
190
+ isReplying: activeReplyId === item.id,
191
+ item,
192
+ onReplyChange: setReplyDraft,
193
+ onReplySend: () => void sendReply(item),
194
+ onReplyToggle: () => {
195
+ setReplyError(null);
196
+ if (activeReplyId === item.id) {
197
+ setActiveReplyId(null);
198
+ setReplyDraft("");
199
+ return;
200
+ }
201
+ setActiveReplyId(item.id);
202
+ setReplyDraft("");
203
+ },
204
+ replyDraft: activeReplyId === item.id ? replyDraft : ""
205
+ }, item.id))]
206
+ }),
207
+ isSendingReply ? /* @__PURE__ */ jsx("p", {
208
+ className: cx(timestampClass, "px-4 py-2"),
209
+ children: "Sending reply..."
210
+ }) : null
211
+ ] });
212
+ }
213
+ //#endregion
214
+ export { InboxRouteView, InboxRoute as component };
@@ -0,0 +1,146 @@
1
+ import { $ as feedRowBodyClass, At as pillClass, Mt as primaryButtonClass, Wt as secondaryButtonClass, _t as mutedDotClass, c as composerBarClass, ct as feedRowTextClass, et as feedRowClass, it as feedRowNameClass, jt as pillSoftClass, kt as pillAlertClass, l as composerInputClass, lt as feedRowTimestampClass, m as cx, nt as feedRowHandleClass, pn as timestampClass, rt as feedRowHeaderClass, tt as feedRowDotClass, u as composerShellClass, ut as inboxAnalysisClass } from "./ui-qbmcMSSX.js";
2
+ import "./query-client-BdauHBgd.js";
3
+ import { r as formatCompactNumber, t as AvatarChip } from "./AvatarChip-zUDAEmjL.js";
4
+ import "./account-selection-CTdFGWRk.js";
5
+ import { t as SmartTimestamp } from "./SmartTimestamp-DfwE1NGf.js";
6
+ import { i as validateInboxSearch } from "./route-search-BUlQ5lGM.js";
7
+ import "react";
8
+ import { Link, createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { CheckCircle2, Circle, ExternalLink, MessageCircle } from "lucide-react";
11
+ import "@tanstack/react-query";
12
+ //#region src/components/InboxCard.tsx
13
+ function InboxCard({ item, isReplying, replyDraft, onReplyChange, onReplyToggle, onReplySend }) {
14
+ return /* @__PURE__ */ jsxs("article", {
15
+ className: cx(feedRowClass, "items-start"),
16
+ children: [/* @__PURE__ */ jsx(AvatarChip, {
17
+ avatarUrl: item.participant.avatarUrl,
18
+ hue: item.participant.avatarHue,
19
+ name: item.participant.displayName,
20
+ profileId: item.participant.id
21
+ }), /* @__PURE__ */ jsxs("div", {
22
+ className: feedRowBodyClass,
23
+ children: [
24
+ /* @__PURE__ */ jsxs("header", {
25
+ className: feedRowHeaderClass,
26
+ children: [
27
+ /* @__PURE__ */ jsxs("span", {
28
+ className: "flex min-w-0 items-center gap-1.5",
29
+ children: [/* @__PURE__ */ jsx("span", {
30
+ className: feedRowNameClass,
31
+ children: item.participant.displayName
32
+ }), /* @__PURE__ */ jsxs("span", {
33
+ className: feedRowHandleClass,
34
+ children: ["@", item.participant.handle]
35
+ })]
36
+ }),
37
+ /* @__PURE__ */ jsx("span", {
38
+ className: feedRowDotClass,
39
+ children: "·"
40
+ }),
41
+ /* @__PURE__ */ jsx(SmartTimestamp, {
42
+ className: feedRowTimestampClass,
43
+ value: item.createdAt
44
+ }),
45
+ /* @__PURE__ */ jsxs("span", {
46
+ className: "ml-auto flex items-center gap-1.5",
47
+ children: [/* @__PURE__ */ jsx("span", {
48
+ className: cx(pillClass, pillSoftClass),
49
+ children: item.entityKind
50
+ }), /* @__PURE__ */ jsxs("span", {
51
+ className: cx(pillClass, pillAlertClass),
52
+ children: ["score ", item.score]
53
+ })]
54
+ })
55
+ ]
56
+ }),
57
+ /* @__PURE__ */ jsx("h3", {
58
+ className: "text-[15px] font-bold text-[var(--ink)]",
59
+ children: item.title
60
+ }),
61
+ /* @__PURE__ */ jsx("p", {
62
+ className: feedRowTextClass,
63
+ children: item.text
64
+ }),
65
+ /* @__PURE__ */ jsxs("div", {
66
+ className: inboxAnalysisClass,
67
+ children: [/* @__PURE__ */ jsx("strong", {
68
+ className: "text-[var(--ink)]",
69
+ children: item.summary
70
+ }), /* @__PURE__ */ jsx("p", { children: item.reasoning })]
71
+ }),
72
+ /* @__PURE__ */ jsxs("div", {
73
+ className: "mt-2 flex items-center justify-between gap-3 text-[13px] text-[var(--ink-soft)]",
74
+ children: [/* @__PURE__ */ jsxs("div", {
75
+ className: "flex flex-wrap items-center gap-2",
76
+ children: [
77
+ /* @__PURE__ */ jsx("span", { children: item.source }),
78
+ /* @__PURE__ */ jsx("span", { className: mutedDotClass }),
79
+ /* @__PURE__ */ jsxs("span", { children: ["influence ", formatCompactNumber(item.influenceScore)] }),
80
+ /* @__PURE__ */ jsx("span", { className: mutedDotClass }),
81
+ /* @__PURE__ */ jsxs("span", {
82
+ className: "inline-flex items-center gap-1",
83
+ children: [item.needsReply ? /* @__PURE__ */ jsx(Circle, {
84
+ className: "size-3",
85
+ strokeWidth: 2.2
86
+ }) : /* @__PURE__ */ jsx(CheckCircle2, {
87
+ className: "size-3.5",
88
+ strokeWidth: 2
89
+ }), item.needsReply ? "open" : "replied"]
90
+ })
91
+ ]
92
+ }), /* @__PURE__ */ jsxs("div", {
93
+ className: "flex items-center gap-2",
94
+ children: [/* @__PURE__ */ jsxs("button", {
95
+ className: secondaryButtonClass,
96
+ onClick: onReplyToggle,
97
+ type: "button",
98
+ children: [/* @__PURE__ */ jsx(MessageCircle, {
99
+ className: "size-4",
100
+ strokeWidth: 2
101
+ }), isReplying ? "Close reply" : "Reply"]
102
+ }), /* @__PURE__ */ jsxs(Link, {
103
+ className: cx(secondaryButtonClass, "gap-1.5"),
104
+ to: item.entityKind === "dm" ? "/dms" : "/mentions",
105
+ children: [/* @__PURE__ */ jsx(ExternalLink, {
106
+ className: "size-4",
107
+ strokeWidth: 2
108
+ }), "Open"]
109
+ })]
110
+ })]
111
+ }),
112
+ isReplying ? /* @__PURE__ */ jsxs("div", {
113
+ className: composerShellClass,
114
+ children: [/* @__PURE__ */ jsx("textarea", {
115
+ className: composerInputClass,
116
+ onChange: (event) => onReplyChange(event.target.value),
117
+ placeholder: item.entityKind === "dm" ? `Reply to @${item.participant.handle}` : `Reply to mention from @${item.participant.handle}`,
118
+ rows: 4,
119
+ value: replyDraft
120
+ }), /* @__PURE__ */ jsxs("div", {
121
+ className: composerBarClass,
122
+ children: [/* @__PURE__ */ jsx("span", {
123
+ className: timestampClass,
124
+ children: "Send from inbox"
125
+ }), /* @__PURE__ */ jsx("button", {
126
+ className: primaryButtonClass,
127
+ disabled: !replyDraft.trim(),
128
+ onClick: onReplySend,
129
+ type: "button",
130
+ children: "Send"
131
+ })]
132
+ })]
133
+ }) : null
134
+ ]
135
+ })]
136
+ });
137
+ }
138
+ //#endregion
139
+ //#region src/routes/inbox.tsx
140
+ var $$splitComponentImporter = () => import("./inbox-CkGOaW1q.js");
141
+ var Route$1 = createFileRoute("/inbox")({
142
+ component: lazyRouteComponent($$splitComponentImporter, "component"),
143
+ validateSearch: validateInboxSearch
144
+ });
145
+ //#endregion
146
+ export { InboxCard as n, Route$1 as t };
@@ -0,0 +1,14 @@
1
+ import { t as SavedTimelineView } from "./SavedTimelineView-BG1jnBp1.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/routes/likes.tsx?tsr-split=component
4
+ function LikesRoute() {
5
+ return /* @__PURE__ */ jsx(SavedTimelineView, {
6
+ eyebrow: "liked posts",
7
+ filter: "liked",
8
+ loadingLabel: "Loading liked posts...",
9
+ searchPlaceholder: "Search likes",
10
+ title: "Things worth keeping in the orbit."
11
+ });
12
+ }
13
+ //#endregion
14
+ export { LikesRoute as component };
@@ -0,0 +1,240 @@
1
+ import "./ui-qbmcMSSX.js";
2
+ import { b as linkInsightResponseSchema, n as queryKeys, r as fetchJson } from "./query-client-BdauHBgd.js";
3
+ import { r as formatCompactNumber } from "./AvatarChip-zUDAEmjL.js";
4
+ import "./FeedState-ntW0Q2GB.js";
5
+ import "./ProfilePreview-C6gAor_j.js";
6
+ import "./SmartTimestamp-DfwE1NGf.js";
7
+ import { t as hydrateProfileHandles } from "./profile-hydration-client-GJ4kwJS8.js";
8
+ import { a as validateLinksSearch } from "./route-search-BUlQ5lGM.js";
9
+ import { useEffect, useMemo } from "react";
10
+ import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
11
+ import "react/jsx-runtime";
12
+ import "lucide-react";
13
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
14
+ var PROFILE_HYDRATION_DELAY_MS = 1200;
15
+ var LINK_INSIGHTS_CACHE_MAX_AGE_MS = 5 * 6e4;
16
+ var ranges = [
17
+ {
18
+ value: "today",
19
+ label: "Today"
20
+ },
21
+ {
22
+ value: "week",
23
+ label: "Week"
24
+ },
25
+ {
26
+ value: "month",
27
+ label: "Month"
28
+ },
29
+ {
30
+ value: "year",
31
+ label: "Year"
32
+ },
33
+ {
34
+ value: "all",
35
+ label: "All"
36
+ }
37
+ ];
38
+ function itemTitle(item) {
39
+ return item.title?.trim() || item.displayUrl;
40
+ }
41
+ function itemSubtitle(item) {
42
+ const description = item.description?.trim();
43
+ if (description) return description;
44
+ return item.displayUrl.split("?")[0] || item.displayUrl;
45
+ }
46
+ function linkInsightQueryKey(kind, range, sort, source) {
47
+ return [...queryKeys.linkInsights, {
48
+ kind,
49
+ range,
50
+ sort,
51
+ source
52
+ }];
53
+ }
54
+ function linkInsightsUrl(kind, range, sort, source) {
55
+ const url = new URL("/api/link-insights", window.location.origin);
56
+ url.searchParams.set("kind", kind);
57
+ url.searchParams.set("range", range);
58
+ url.searchParams.set("sort", sort);
59
+ url.searchParams.set("source", source);
60
+ url.searchParams.set("limit", String(30));
61
+ url.searchParams.set("commentsLimit", String(30));
62
+ return url;
63
+ }
64
+ async function fetchLinkInsights(kind, range, sort, source, signal) {
65
+ return fetchJson(linkInsightsUrl(kind, range, sort, source), { signal }, linkInsightResponseSchema, "Link insights unavailable");
66
+ }
67
+ function mentionHref(mention, item) {
68
+ return mention.sourceUrl || mention.contentTweetUrl || item.url;
69
+ }
70
+ function mentionCopy(mention) {
71
+ return mention.commentText || mention.sharedContentText || mention.rawText || "Shared without comment";
72
+ }
73
+ function isSameProfile(left, right) {
74
+ return Boolean(left && right && left.id === right.id);
75
+ }
76
+ function mediaImage(media) {
77
+ return media.find((item) => item.thumbnailUrl || item.url) ?? null;
78
+ }
79
+ function youtubeVideoId(rawUrl) {
80
+ try {
81
+ const url = new URL(rawUrl);
82
+ const host = url.hostname.toLowerCase().replace(/^www\./, "");
83
+ if (host === "youtu.be") return url.pathname.split("/").filter(Boolean)[0] ?? null;
84
+ if (!host.endsWith("youtube.com")) return null;
85
+ if (url.pathname === "/watch") return url.searchParams.get("v");
86
+ const parts = url.pathname.split("/").filter(Boolean);
87
+ if (parts[0] === "embed" || parts[0] === "shorts" || parts[0] === "live") return parts[1] ?? null;
88
+ return null;
89
+ } catch {
90
+ return null;
91
+ }
92
+ }
93
+ function youtubeThumbnailUrl(rawUrl) {
94
+ const id = youtubeVideoId(rawUrl);
95
+ if (!id || !/^[\w-]{6,}$/.test(id)) return null;
96
+ return `https://i.ytimg.com/vi/${encodeURIComponent(id)}/hqdefault.jpg`;
97
+ }
98
+ function commentCount(item) {
99
+ return item.commentCount ?? item.mentions.filter((mention) => mention.hasComment).length;
100
+ }
101
+ function pureShareCount(item) {
102
+ return item.pureShareCount ?? item.mentions.filter((mention) => mention.isPureShare || !mention.hasComment).length;
103
+ }
104
+ function isArchivePlaceholderProfile(profile) {
105
+ return /^id\d+$/i.test(profile.handle) && profile.displayName === profile.handle && profile.id === `profile_user_${profile.handle.slice(2)}`;
106
+ }
107
+ function profileNeedsHydration(profile) {
108
+ if (!profile?.handle || isArchivePlaceholderProfile(profile)) return false;
109
+ return !profile.avatarUrl || profile.followersCount === 0;
110
+ }
111
+ function collectProfilesForHydration(data) {
112
+ const handles = /* @__PURE__ */ new Set();
113
+ for (const item of data?.items ?? []) for (const profile of [
114
+ item.topSharer,
115
+ ...item.sharers,
116
+ ...item.mentions.flatMap((mention) => [
117
+ mention.sharedBy,
118
+ mention.contentAuthor,
119
+ mention.participant
120
+ ])
121
+ ]) {
122
+ if (!profile || !profileNeedsHydration(profile)) continue;
123
+ handles.add(profile.handle.replace(/^@/, ""));
124
+ if (handles.size >= 30) return [...handles];
125
+ }
126
+ return [...handles];
127
+ }
128
+ //#endregion
129
+ //#region src/components/links-controller.ts
130
+ function useLinksController(filters, onFiltersChange) {
131
+ const queryClient = useQueryClient();
132
+ const { kind, range, source, sort, q: search } = filters;
133
+ const insightsQuery = useQuery({
134
+ queryKey: linkInsightQueryKey(kind, range, sort, source),
135
+ queryFn: ({ signal }) => fetchLinkInsights(kind, range, sort, source, signal),
136
+ staleTime: LINK_INSIGHTS_CACHE_MAX_AGE_MS
137
+ });
138
+ const data = insightsQuery.data ?? null;
139
+ useEffect(() => {
140
+ if (!data) return;
141
+ const prefetchKind = kind === "links" ? "videos" : "links";
142
+ const timer = window.setTimeout(() => {
143
+ queryClient.prefetchQuery({
144
+ queryKey: linkInsightQueryKey(prefetchKind, range, sort, source),
145
+ queryFn: ({ signal }) => fetchLinkInsights(prefetchKind, range, sort, source, signal),
146
+ staleTime: LINK_INSIGHTS_CACHE_MAX_AGE_MS
147
+ });
148
+ }, 250);
149
+ return () => window.clearTimeout(timer);
150
+ }, [
151
+ data,
152
+ kind,
153
+ queryClient,
154
+ range,
155
+ sort,
156
+ source
157
+ ]);
158
+ useEffect(() => {
159
+ const handles = collectProfilesForHydration(data);
160
+ if (handles.length === 0) return;
161
+ let active = true;
162
+ let idleId = null;
163
+ const runHydration = () => {
164
+ hydrateProfileHandles(queryClient, handles, { limit: 30 }).then((response) => {
165
+ if (!active) return;
166
+ if (response.fetchedResults.some((result) => result.status === "hit")) queryClient.invalidateQueries({ queryKey: queryKeys.linkInsights });
167
+ }).catch((error) => {
168
+ if (!active) return;
169
+ console.warn("Profile hydration failed", error);
170
+ });
171
+ };
172
+ const timer = window.setTimeout(() => {
173
+ if ("requestIdleCallback" in window) idleId = window.requestIdleCallback(runHydration, { timeout: 2500 });
174
+ else runHydration();
175
+ }, PROFILE_HYDRATION_DELAY_MS);
176
+ return () => {
177
+ active = false;
178
+ window.clearTimeout(timer);
179
+ if (idleId !== null && "cancelIdleCallback" in window) window.cancelIdleCallback(idleId);
180
+ };
181
+ }, [data, queryClient]);
182
+ return {
183
+ kind,
184
+ setKind: (value) => onFiltersChange({
185
+ ...filters,
186
+ kind: value
187
+ }),
188
+ range,
189
+ setRange: (value) => onFiltersChange({
190
+ ...filters,
191
+ range: value
192
+ }),
193
+ source,
194
+ setSource: (value) => onFiltersChange({
195
+ ...filters,
196
+ source: value
197
+ }),
198
+ sort,
199
+ setSort: (value) => onFiltersChange({
200
+ ...filters,
201
+ sort: value
202
+ }),
203
+ search,
204
+ setSearch: (value) => onFiltersChange({
205
+ ...filters,
206
+ q: value
207
+ }, { replace: true }),
208
+ items: useMemo(() => {
209
+ const query = search.trim().toLowerCase();
210
+ return (data?.items ?? []).filter((item) => {
211
+ if (!query) return true;
212
+ return [
213
+ item.title,
214
+ item.description,
215
+ item.displayUrl,
216
+ item.host,
217
+ item.topSharer?.handle,
218
+ ...item.mentions.map((mention) => mention.commentText)
219
+ ].filter(Boolean).some((value) => String(value).toLowerCase().includes(query));
220
+ });
221
+ }, [data?.items, search]),
222
+ subtitle: useMemo(() => {
223
+ if (!data) return "Loading link memory...";
224
+ const label = kind === "videos" ? "video URLs" : "URLs";
225
+ return `${formatCompactNumber(data.stats.occurrences)} ${label} across ${formatCompactNumber(data.stats.groups)} groups`;
226
+ }, [data, kind]),
227
+ loading: insightsQuery.isPending,
228
+ error: insightsQuery.error ? insightsQuery.error instanceof Error ? insightsQuery.error.message : "Link insights unavailable" : null,
229
+ retry: insightsQuery.refetch
230
+ };
231
+ }
232
+ //#endregion
233
+ //#region src/routes/links.tsx
234
+ var $$splitComponentImporter = () => import("./links-DmH5lxHO.js");
235
+ var Route$1 = createFileRoute("/links")({
236
+ component: lazyRouteComponent($$splitComponentImporter, "component"),
237
+ validateSearch: validateLinksSearch
238
+ });
239
+ //#endregion
240
+ export { itemSubtitle as a, mentionCopy as c, ranges as d, youtubeThumbnailUrl as f, isSameProfile as i, mentionHref as l, useLinksController as n, itemTitle as o, commentCount as r, mediaImage as s, Route$1 as t, pureShareCount as u };