@dxos/plugin-magazine 0.9.1-staging.ee54ba693a → 0.11.0

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 (242) hide show
  1. package/dist/lib/MagazinePlugin.mjs +36 -0
  2. package/dist/lib/MagazinePlugin.mjs.map +1 -0
  3. package/dist/lib/MagazinePlugin.workerd.mjs +26 -0
  4. package/dist/lib/MagazinePlugin.workerd.mjs.map +1 -0
  5. package/dist/lib/atoms.mjs +175 -0
  6. package/dist/lib/atoms.mjs.map +1 -0
  7. package/dist/lib/capabilities.mjs +12 -0
  8. package/dist/lib/capabilities.mjs.map +1 -0
  9. package/dist/lib/chunk-FeedArticle.mjs +70 -0
  10. package/dist/lib/chunk-FeedArticle.mjs.map +1 -0
  11. package/dist/lib/chunk-FeedProperties.mjs +78 -0
  12. package/dist/lib/chunk-FeedProperties.mjs.map +1 -0
  13. package/dist/lib/chunk-MagazineArticle.mjs +267 -0
  14. package/dist/lib/chunk-MagazineArticle.mjs.map +1 -0
  15. package/dist/lib/chunk-PostArticle.mjs +174 -0
  16. package/dist/lib/chunk-PostArticle.mjs.map +1 -0
  17. package/dist/lib/chunk-PostCard.mjs +62 -0
  18. package/dist/lib/chunk-PostCard.mjs.map +1 -0
  19. package/dist/lib/chunk-app-graph-builder.mjs +91 -0
  20. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
  21. package/dist/lib/chunk-clear-magazine.mjs +37 -0
  22. package/dist/lib/chunk-clear-magazine.mjs.map +1 -0
  23. package/dist/lib/chunk-create-object.mjs +59 -0
  24. package/dist/lib/chunk-create-object.mjs.map +1 -0
  25. package/dist/lib/chunk-curate-magazine.mjs +164 -0
  26. package/dist/lib/chunk-curate-magazine.mjs.map +1 -0
  27. package/dist/lib/chunk-date.mjs +25 -0
  28. package/dist/lib/chunk-date.mjs.map +1 -0
  29. package/dist/lib/chunk-fetch-article-content.mjs +26 -0
  30. package/dist/lib/chunk-fetch-article-content.mjs.map +1 -0
  31. package/dist/lib/chunk-load-post-content.mjs +57 -0
  32. package/dist/lib/chunk-load-post-content.mjs.map +1 -0
  33. package/dist/lib/{neutral/chunk-JFPR6OV4.mjs → chunk-meta.mjs} +19 -26
  34. package/dist/lib/chunk-meta.mjs.map +1 -0
  35. package/dist/lib/chunk-operation-handler.mjs +13 -0
  36. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  37. package/dist/lib/chunk-paths.mjs +8 -0
  38. package/dist/lib/chunk-paths.mjs.map +1 -0
  39. package/dist/lib/chunk-post-content.mjs +14 -0
  40. package/dist/lib/chunk-post-content.mjs.map +1 -0
  41. package/dist/lib/chunk-react-surface.mjs +60 -0
  42. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  43. package/dist/lib/chunk-routine-templates.mjs +52 -0
  44. package/dist/lib/chunk-routine-templates.mjs.map +1 -0
  45. package/dist/lib/chunk-skill-definition.mjs +12 -0
  46. package/dist/lib/chunk-skill-definition.mjs.map +1 -0
  47. package/dist/lib/chunk-sources.mjs +576 -0
  48. package/dist/lib/chunk-sources.mjs.map +1 -0
  49. package/dist/lib/chunk-sync-feed.mjs +86 -0
  50. package/dist/lib/chunk-sync-feed.mjs.map +1 -0
  51. package/dist/lib/chunk-text.mjs +52 -0
  52. package/dist/lib/chunk-text.mjs.map +1 -0
  53. package/dist/lib/chunk-types.mjs +607 -0
  54. package/dist/lib/chunk-types.mjs.map +1 -0
  55. package/dist/lib/components.mjs +323 -0
  56. package/dist/lib/components.mjs.map +1 -0
  57. package/dist/lib/containers.mjs +11 -0
  58. package/dist/lib/containers.mjs.map +1 -0
  59. package/dist/lib/index.mjs +3 -0
  60. package/dist/lib/meta.mjs +2 -0
  61. package/dist/lib/operations.mjs +7 -0
  62. package/dist/lib/operations.mjs.map +1 -0
  63. package/dist/lib/plugin.mjs +9 -0
  64. package/dist/lib/plugin.mjs.map +1 -0
  65. package/dist/lib/plugin.workerd.mjs +3 -0
  66. package/dist/lib/{neutral/skills/index.mjs → skills.mjs} +15 -28
  67. package/dist/lib/skills.mjs.map +1 -0
  68. package/dist/lib/testing.mjs +71 -0
  69. package/dist/lib/testing.mjs.map +1 -0
  70. package/dist/lib/translations.mjs +74 -0
  71. package/dist/lib/translations.mjs.map +1 -0
  72. package/dist/lib/types.mjs +2 -0
  73. package/dist/types/src/MagazinePlugin.d.ts.map +1 -1
  74. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  75. package/dist/types/src/capabilities/create-object.d.ts +1 -1
  76. package/dist/types/src/capabilities/index.d.ts +0 -1
  77. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  78. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  79. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  80. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  81. package/dist/types/src/capabilities/routine-templates.d.ts +1 -1
  82. package/dist/types/src/components/PostContent/PostContent.d.ts +1 -13
  83. package/dist/types/src/components/PostContent/PostContent.d.ts.map +1 -1
  84. package/dist/types/src/components/PostContent/dedupe-images.d.ts +13 -0
  85. package/dist/types/src/components/PostContent/dedupe-images.d.ts.map +1 -0
  86. package/dist/types/src/components/PostContent/index.d.ts +1 -0
  87. package/dist/types/src/components/PostContent/index.d.ts.map +1 -1
  88. package/dist/types/src/components/PostStack/PostStack.d.ts +1 -1
  89. package/dist/types/src/components/PostStack/PostStack.d.ts.map +1 -1
  90. package/dist/types/src/components/SubscriptionStack/SubscriptionStack.d.ts +1 -1
  91. package/dist/types/src/components/SubscriptionStack/SubscriptionStack.d.ts.map +1 -1
  92. package/dist/types/src/containers/FeedArticle/FeedArticle.d.ts +4 -1
  93. package/dist/types/src/containers/FeedArticle/FeedArticle.d.ts.map +1 -1
  94. package/dist/types/src/containers/FeedProperties/FeedProperties.d.ts +4 -1
  95. package/dist/types/src/containers/FeedProperties/FeedProperties.d.ts.map +1 -1
  96. package/dist/types/src/containers/MagazineArticle/MagazineArticle.d.ts +4 -1
  97. package/dist/types/src/containers/MagazineArticle/MagazineArticle.d.ts.map +1 -1
  98. package/dist/types/src/containers/MagazineArticle/MagazineArticle.stories.d.ts.map +1 -1
  99. package/dist/types/src/containers/MagazineArticle/MagazineTile.d.ts +4 -1
  100. package/dist/types/src/containers/MagazineArticle/MagazineTile.d.ts.map +1 -1
  101. package/dist/types/src/containers/MagazineArticle/useToolbar.d.ts +4 -8
  102. package/dist/types/src/containers/MagazineArticle/useToolbar.d.ts.map +1 -1
  103. package/dist/types/src/containers/PostArticle/PostArticle.d.ts +4 -1
  104. package/dist/types/src/containers/PostArticle/PostArticle.d.ts.map +1 -1
  105. package/dist/types/src/containers/PostArticle/PostArticle.stories.d.ts.map +1 -1
  106. package/dist/types/src/containers/PostArticle/PostToolbar.d.ts +1 -1
  107. package/dist/types/src/containers/PostArticle/PostToolbar.d.ts.map +1 -1
  108. package/dist/types/src/containers/PostCard/PostCard.d.ts +4 -6
  109. package/dist/types/src/containers/PostCard/PostCard.d.ts.map +1 -1
  110. package/dist/types/src/containers/SubscriptionsArticle/SubscriptionsArticle.d.ts +4 -1
  111. package/dist/types/src/containers/SubscriptionsArticle/SubscriptionsArticle.d.ts.map +1 -1
  112. package/dist/types/src/containers/SubscriptionsArticle/SubscriptionsArticle.stories.d.ts.map +1 -1
  113. package/dist/types/src/stories/ArticleExtractor.stories.d.ts +1 -0
  114. package/dist/types/src/stories/ArticleExtractor.stories.d.ts.map +1 -1
  115. package/dist/types/src/stories/MagazineCurate.stories.d.ts.map +1 -1
  116. package/dist/types/src/templates/magazine-curation.d.ts.map +1 -1
  117. package/dist/types/src/translations.d.ts +1 -0
  118. package/dist/types/src/translations.d.ts.map +1 -1
  119. package/dist/types/tsconfig.tsbuildinfo +1 -1
  120. package/dx.config.ts +1 -1
  121. package/package.json +57 -60
  122. package/src/MagazinePlugin.tsx +0 -3
  123. package/src/atoms/atoms.test.ts +5 -4
  124. package/src/capabilities/app-graph-builder.ts +8 -6
  125. package/src/capabilities/index.ts +0 -1
  126. package/src/capabilities/{react-surface.tsx → react-surface.ts} +10 -12
  127. package/src/components/PostContent/PostContent.test.ts +1 -1
  128. package/src/components/PostContent/PostContent.tsx +1 -41
  129. package/src/components/PostContent/dedupe-images.ts +48 -0
  130. package/src/components/PostContent/index.ts +1 -0
  131. package/src/containers/FeedArticle/FeedArticle.stories.tsx +2 -2
  132. package/src/containers/FeedArticle/FeedArticle.tsx +4 -2
  133. package/src/containers/FeedProperties/FeedProperties.tsx +6 -4
  134. package/src/containers/MagazineArticle/MagazineArticle.stories.tsx +2 -1
  135. package/src/containers/MagazineArticle/MagazineArticle.tsx +8 -6
  136. package/src/containers/MagazineArticle/MagazineTile.tsx +2 -0
  137. package/src/containers/MagazineArticle/useToolbar.tsx +2 -0
  138. package/src/containers/PostArticle/PostArticle.stories.tsx +2 -1
  139. package/src/containers/PostArticle/PostArticle.tsx +6 -3
  140. package/src/containers/PostArticle/PostToolbar.tsx +1 -1
  141. package/src/containers/PostCard/PostCard.tsx +3 -1
  142. package/src/containers/SubscriptionsArticle/SubscriptionsArticle.stories.tsx +2 -1
  143. package/src/containers/SubscriptionsArticle/SubscriptionsArticle.tsx +5 -3
  144. package/src/operations/curate-magazine.test.ts +108 -4
  145. package/src/operations/sync-feed.test.ts +1 -1
  146. package/src/operations/sync-feed.ts +1 -1
  147. package/src/paths.ts +3 -3
  148. package/src/stories/ArticleExtractor.stories.tsx +1 -1
  149. package/src/stories/MagazineCurate.stories.tsx +3 -2
  150. package/src/templates/magazine-curation.ts +3 -2
  151. package/src/types/Magazine.test.ts +1 -1
  152. package/src/types/Subscription.ts +1 -1
  153. package/dist/lib/neutral/FeedArticle-PEWCFFSP.mjs +0 -90
  154. package/dist/lib/neutral/FeedArticle-PEWCFFSP.mjs.map +0 -7
  155. package/dist/lib/neutral/FeedProperties-EIO7IZOA.mjs +0 -97
  156. package/dist/lib/neutral/FeedProperties-EIO7IZOA.mjs.map +0 -7
  157. package/dist/lib/neutral/MagazineArticle-5T7RTIPS.mjs +0 -325
  158. package/dist/lib/neutral/MagazineArticle-5T7RTIPS.mjs.map +0 -7
  159. package/dist/lib/neutral/MagazinePlugin.mjs +0 -62
  160. package/dist/lib/neutral/MagazinePlugin.mjs.map +0 -7
  161. package/dist/lib/neutral/MagazinePlugin.workerd.mjs +0 -12
  162. package/dist/lib/neutral/MagazinePlugin.workerd.mjs.map +0 -7
  163. package/dist/lib/neutral/PostArticle-BGIPU7XA.mjs +0 -230
  164. package/dist/lib/neutral/PostArticle-BGIPU7XA.mjs.map +0 -7
  165. package/dist/lib/neutral/PostCard-VDGN7BBA.mjs +0 -60
  166. package/dist/lib/neutral/PostCard-VDGN7BBA.mjs.map +0 -7
  167. package/dist/lib/neutral/app-graph-builder-JDPRBVHL.mjs +0 -121
  168. package/dist/lib/neutral/app-graph-builder-JDPRBVHL.mjs.map +0 -7
  169. package/dist/lib/neutral/capabilities/index.mjs +0 -21
  170. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  171. package/dist/lib/neutral/chunk-3K4AQKBZ.mjs +0 -12
  172. package/dist/lib/neutral/chunk-3K4AQKBZ.mjs.map +0 -7
  173. package/dist/lib/neutral/chunk-AFPBWBTK.mjs +0 -591
  174. package/dist/lib/neutral/chunk-AFPBWBTK.mjs.map +0 -7
  175. package/dist/lib/neutral/chunk-APQRTYT3.mjs +0 -57
  176. package/dist/lib/neutral/chunk-APQRTYT3.mjs.map +0 -7
  177. package/dist/lib/neutral/chunk-GU725ZF4.mjs +0 -11
  178. package/dist/lib/neutral/chunk-GU725ZF4.mjs.map +0 -7
  179. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  180. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  181. package/dist/lib/neutral/chunk-JFPR6OV4.mjs.map +0 -7
  182. package/dist/lib/neutral/chunk-KTYLUOUG.mjs +0 -36
  183. package/dist/lib/neutral/chunk-KTYLUOUG.mjs.map +0 -7
  184. package/dist/lib/neutral/chunk-LFSQMLPK.mjs +0 -8
  185. package/dist/lib/neutral/chunk-LFSQMLPK.mjs.map +0 -7
  186. package/dist/lib/neutral/chunk-MBPX7RPI.mjs +0 -14
  187. package/dist/lib/neutral/chunk-MBPX7RPI.mjs.map +0 -7
  188. package/dist/lib/neutral/chunk-OYCDRSWB.mjs +0 -624
  189. package/dist/lib/neutral/chunk-OYCDRSWB.mjs.map +0 -7
  190. package/dist/lib/neutral/chunk-SAWKLGJU.mjs +0 -28
  191. package/dist/lib/neutral/chunk-SAWKLGJU.mjs.map +0 -7
  192. package/dist/lib/neutral/chunk-XCNCK47N.mjs +0 -15
  193. package/dist/lib/neutral/chunk-XCNCK47N.mjs.map +0 -7
  194. package/dist/lib/neutral/clear-magazine-KNY4OWY4.mjs +0 -59
  195. package/dist/lib/neutral/clear-magazine-KNY4OWY4.mjs.map +0 -7
  196. package/dist/lib/neutral/components/index.mjs +0 -338
  197. package/dist/lib/neutral/components/index.mjs.map +0 -7
  198. package/dist/lib/neutral/containers/index.mjs +0 -17
  199. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  200. package/dist/lib/neutral/create-object-SYZMRR4H.mjs +0 -98
  201. package/dist/lib/neutral/create-object-SYZMRR4H.mjs.map +0 -7
  202. package/dist/lib/neutral/curate-magazine-7RMKSJC5.mjs +0 -184
  203. package/dist/lib/neutral/curate-magazine-7RMKSJC5.mjs.map +0 -7
  204. package/dist/lib/neutral/fetch-article-content-CXPKXIMR.mjs +0 -31
  205. package/dist/lib/neutral/fetch-article-content-CXPKXIMR.mjs.map +0 -7
  206. package/dist/lib/neutral/index.mjs +0 -18
  207. package/dist/lib/neutral/index.mjs.map +0 -7
  208. package/dist/lib/neutral/load-post-content-H3S4TKVM.mjs +0 -65
  209. package/dist/lib/neutral/load-post-content-H3S4TKVM.mjs.map +0 -7
  210. package/dist/lib/neutral/meta.json +0 -1
  211. package/dist/lib/neutral/meta.mjs +0 -8
  212. package/dist/lib/neutral/meta.mjs.map +0 -7
  213. package/dist/lib/neutral/navigation-resolver-IN4OMCDR.mjs +0 -18
  214. package/dist/lib/neutral/navigation-resolver-IN4OMCDR.mjs.map +0 -7
  215. package/dist/lib/neutral/operation-handler-JE3743BU.mjs +0 -8
  216. package/dist/lib/neutral/operation-handler-JE3743BU.mjs.map +0 -7
  217. package/dist/lib/neutral/operations/index.mjs +0 -8
  218. package/dist/lib/neutral/operations/index.mjs.map +0 -7
  219. package/dist/lib/neutral/plugin.mjs +0 -16
  220. package/dist/lib/neutral/plugin.mjs.map +0 -7
  221. package/dist/lib/neutral/plugin.workerd.mjs +0 -16
  222. package/dist/lib/neutral/plugin.workerd.mjs.map +0 -7
  223. package/dist/lib/neutral/react-surface-TZESAMG2.mjs +0 -60
  224. package/dist/lib/neutral/react-surface-TZESAMG2.mjs.map +0 -7
  225. package/dist/lib/neutral/routine-templates-D5A2L4KL.mjs +0 -52
  226. package/dist/lib/neutral/routine-templates-D5A2L4KL.mjs.map +0 -7
  227. package/dist/lib/neutral/skill-definition-3KLMUEC5.mjs +0 -8
  228. package/dist/lib/neutral/skill-definition-3KLMUEC5.mjs.map +0 -7
  229. package/dist/lib/neutral/skills/index.mjs.map +0 -7
  230. package/dist/lib/neutral/sync-feed-SDXYF7HU.mjs +0 -99
  231. package/dist/lib/neutral/sync-feed-SDXYF7HU.mjs.map +0 -7
  232. package/dist/lib/neutral/translations.mjs +0 -81
  233. package/dist/lib/neutral/translations.mjs.map +0 -7
  234. package/dist/lib/neutral/types/index.mjs +0 -14
  235. package/dist/lib/neutral/types/index.mjs.map +0 -7
  236. package/dist/types/src/capabilities/navigation-resolver.d.ts +0 -5
  237. package/dist/types/src/capabilities/navigation-resolver.d.ts.map +0 -1
  238. package/dist/types/src/operations/curate-magazine.skill.test.d.ts +0 -2
  239. package/dist/types/src/operations/curate-magazine.skill.test.d.ts.map +0 -1
  240. package/src/capabilities/navigation-resolver.ts +0 -21
  241. package/src/operations/curate-magazine.skill.conversations.json +0 -1
  242. package/src/operations/curate-magazine.skill.test.ts +0 -167
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/CreateSubscription.ts", "../../../src/types/Subscription.ts", "../../../src/types/FeedOperation.ts", "../../../src/types/Magazine.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Format } from '@dxos/echo';\n\nimport * as Subscription from './Subscription';\n\n// Structural gates (regex / URL format), used as form-field validation and to short-circuit the network\n// effects on obviously-malformed input. Handle existence is verified implicitly by the publication lookup\n// (an unresolvable handle yields no publications, and a publication is required to submit).\nexport const HandleSchema = Schema.String.pipe(\n Schema.pattern(/^@?([\\da-z-]+\\.)+[a-z]{2,}$|^did:[a-z]+:[a-zA-Z0-9._%:-]+$/i),\n);\n\nexport const isHandle = Schema.is(HandleSchema);\nexport const isUrl = Schema.is(Format.URL);\n\n//\n// Base structs (no dynamic annotations). The capability layer (create-object.ts) applies annotation\n// closures on top — those closures reference operations/sources and so cannot live in this module.\n//\n\nexport const StandardSiteCreateBase = Schema.Struct({\n type: Schema.Literal('standard-site'),\n handle: HandleSchema.annotations({ title: 'Handle', description: 'atproto handle, e.g. dxos.org.' }),\n // No `name`: the feed name is taken from the selected publication (resolved by `fetchStandardSite`).\n publication: Schema.String.annotations({ title: 'Publication', description: 'Choose a publication.' }),\n});\n\nexport type StandardSiteValues = Schema.Schema.Type<typeof StandardSiteCreateBase>;\n\nexport const RssCreateBase = Schema.Struct({\n type: Schema.Literal('rss'),\n url: Format.URL.annotations({ title: 'URL', description: 'RSS feed URL.' }),\n name: Schema.optional(Schema.String.annotations({ title: 'Name' })),\n});\n\nexport type RssValues = Schema.Schema.Type<typeof RssCreateBase>;\n\n// Input type covers both annotated union members; the union itself is built in create-object.ts after\n// annotations are applied. The switch narrows on `type` which is common to both shapes.\nexport type CreateSubscriptionInput =\n | { type: 'standard-site'; handle: string; publication: string }\n | { type: 'rss'; url: string; name?: string };\n\n/** Normalizes a create-form union member into the stored {@link Subscription.Subscription} fields. */\nexport const makeSubscriptionFromCreate = (input: CreateSubscriptionInput): Subscription.Subscription => {\n switch (input.type) {\n case 'standard-site':\n // `url` stores the publication site reference (at:// or https://); sync derives the author DID\n // from it directly — no handle stored, name resolved from the publication at sync time.\n return Subscription.makeSubscription({ type: 'standard-site', url: input.publication });\n case 'rss':\n return Subscription.makeSubscription({ type: 'rss', url: input.url, name: input.name });\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { type Space } from '@dxos/client/echo';\nimport { Annotation, Database, DXN, Feed, Filter, Obj, Query, Ref, Scope, Tag, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';\nimport { EffectEx } from '@dxos/effect';\nimport { type EntityId } from '@dxos/keys';\nimport { FactoryAnnotation, type FactoryFn, FeedAnnotation, StateMap, TagIndex } from '@dxos/schema';\n\n// TODO: FeedType is currently a closed literal — plugins like plugin-bluesky must add their type here.\n// Consider making it extensible (e.g. a string schema with a well-known-values registry) so plugins can\n// register feed types without modifying core.\n/** Subscription protocol type. */\nexport const FeedType = Schema.Literal('standard-site', 'rss', 'bluesky');\nexport type FeedType = Schema.Schema.Type<typeof FeedType>;\n\n/**\n * System per-Post flags (starred/archived) modelled as space-wide {@link Tag} objects (resolved via\n * `Tag.findOrCreate` on first use). Each entry is a single source of truth carrying its foreign\n * `key` plus display `label`/`hue`.\n */\nexport const SYSTEM_TAGS = {\n starred: { key: { source: 'org.dxos.plugin.magazine', id: 'starred' }, label: 'Starred', hue: 'amber' },\n archived: { key: { source: 'org.dxos.plugin.magazine', id: 'archived' }, label: 'Archived', hue: 'neutral' },\n} as const;\n\n/** A system per-Post flag modelled as a tag. */\nexport type SystemTag = keyof typeof SYSTEM_TAGS;\n\n/** Per-Post mutable state stored on the Subscription (shared across magazines), keyed by Post id. */\nexport const PostState = Schema.Struct({\n /** ISO 8601 timestamp when first opened. */\n readAt: Schema.optional(Schema.String),\n});\nexport type PostState = Schema.Schema.Type<typeof PostState>;\n\n/**\n * Default upper bound on the number of (non-starred) Posts retained when\n * syncing a {@link Subscription} or curating a Magazine. Applied when the object\n * has no explicit `keep` value.\n */\nexport const DEFAULT_KEEP = 10;\n\n/**\n * Subscription feed schema: an RSS/Atom/AT Protocol subscription.\n */\nexport class Subscription extends Type.makeObject<Subscription>(DXN.make('org.dxos.type.subscription.feed', '0.1.0'))(\n Schema.Struct({\n /** User-facing title of the feed. */\n name: Schema.String.pipe(Schema.optional),\n /** The URL of the RSS/Atom feed or AT Protocol handle/DID. */\n url: Schema.String.pipe(Schema.optional),\n /** Protocol type — determines which fetcher is used for sync. */\n type: FeedType.pipe(Schema.optional),\n /** Description of the feed. */\n description: Schema.String.pipe(Schema.optional),\n /** URL of the feed's associated website. */\n link: Schema.String.pipe(Schema.optional),\n /** URL of the feed's icon/image. */\n iconUrl: Schema.String.pipe(Schema.optional),\n /**\n * Maximum number of (non-starred) Posts retained in the feed's queue when syncing.\n * Older posts beyond this bound are dropped; starred posts are preserved regardless.\n * Defaults to {@link DEFAULT_KEEP} when unset.\n */\n keep: Schema.Number.pipe(\n Schema.annotations({\n title: 'Keep',\n description: 'Number of synced items.',\n }),\n Schema.optional,\n ),\n /** Opaque sync cursor — protocol-specific. */\n cursor: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),\n /** Backing ECHO feed (queue) for Posts: immutable feed entries appended by sync. */\n feed: Ref.Ref(Feed.Feed).pipe(FormInputAnnotation.set(false)),\n /**\n * Backing ECHO feed (queue) for fetched article bodies — one\n * {@link PostContent} entry per Post whose content has been loaded.\n *\n * Feeds (not the {@link postState} side map) are the right home for big\n * immutable payloads: they're append-only, lazily replicated, and don't\n * inflate the Subscription document. The side map keeps only the small\n * per-Post user state (read/archived/star/imageUrl).\n *\n * Optional for backwards compatibility with older Subscription documents\n * that pre-date this feed; new subscriptions always have one via\n * {@link makeSubscription}.\n */\n contentFeed: Ref.Ref(Feed.Feed).pipe(FormInputAnnotation.set(false), Schema.optional),\n /**\n * Per-Post mutable state keyed by Post id, shared across every Magazine that references the Post.\n * Posts live immutably in the `feed` queue; their `readAt` marker lives here. (`snippet`/`imageUrl`\n * are derived from the Post, or refined onto `contentFeed` entries — not stored here; star/archive\n * are tags — see `tags`.)\n */\n postState: Ref.Ref(StateMap.StateMap).pipe(FormInputAnnotation.set(false)),\n /**\n * Per-Post tags keyed by tag uri → Post ids. Boolean flags (starred, archived — see\n * {@link SYSTEM_TAGS}) are modelled as {@link Tag} objects so they\n * participate in the space-wide tag system. Stored as a child {@link TagIndex} object.\n */\n tags: Ref.Ref(TagIndex.TagIndex).pipe(FormInputAnnotation.set(false)),\n }).pipe(\n LabelAnnotation.set(['name', 'url']),\n Annotation.IconAnnotation.set({ icon: 'ph--rss--regular', hue: 'indigo' }),\n FeedAnnotation.set(true),\n FactoryAnnotation.set(((values) => makeSubscription(values)) as FactoryFn),\n ),\n) {}\n\n/** Checks if a value is a Subscription.Subscription object. */\nexport const instanceOf = (value: unknown): value is Subscription => Obj.instanceOf(Subscription, value);\n\n/** Creates a Subscription.Subscription with backing ECHO feeds for posts and fetched content. */\nexport const makeSubscription = (\n props: Omit<Obj.MakeProps<typeof Subscription>, 'feed' | 'contentFeed' | 'postState' | 'tags'> = {},\n): Subscription => {\n const postFeed = Feed.make();\n const contentFeed = Feed.make();\n const postState = StateMap.make();\n const tags = TagIndex.make();\n const subscription = Obj.make(Subscription, {\n feed: Ref.make(postFeed),\n contentFeed: Ref.make(contentFeed),\n postState: Ref.make(postState),\n tags: Ref.make(tags),\n ...props,\n });\n Obj.setParent(postFeed, subscription);\n Obj.setParent(contentFeed, subscription);\n // Per-Post state and tag index are children: cascade-deleted with the subscription.\n Obj.setParent(postState, subscription);\n Obj.setParent(tags, subscription);\n return subscription;\n};\n\n/**\n * A single post/entry within a subscription feed.\n *\n * Immutable feed-entry: every field below is set at sync time by the protocol\n * fetcher and never written to again. Mutable state (read, archived, starred,\n * fetched content, hero image) lives on\n * {@link Subscription.Subscription.postState} keyed by Post id; curation\n * outputs (snippet, rank) live on `Magazine.postState`.\n */\nexport class Post extends Type.makeObject<Post>(DXN.make('org.dxos.type.subscription.post', '0.1.0'))(\n Schema.Struct({\n /** Source subscription feed; populated by `SyncSubscription` so curated posts can show provenance. */\n source: Ref.Ref(Subscription).pipe(FormInputAnnotation.set(false), Schema.optional),\n /** Post title. */\n title: Schema.String.pipe(Schema.optional),\n /** URL link to the original article. */\n link: Schema.String.pipe(Schema.optional),\n /** Plain-text or summary. */\n description: Schema.String.pipe(Schema.optional),\n /** Plain-text or HTML content. */\n content: Schema.String.pipe(Schema.optional),\n /** Author name. */\n author: Schema.String.pipe(Schema.optional),\n /** ISO 8601 publication date. */\n published: Schema.String.pipe(Schema.optional),\n /** Unique identifier (guid) from the feed. */\n guid: Schema.String.pipe(Schema.optional),\n }).pipe(\n LabelAnnotation.set(['title']),\n Annotation.IconAnnotation.set({ icon: 'ph--article--regular', hue: 'orange' }),\n ),\n) {}\n\n/** Creates a Subscription.Post object. */\nexport const makePost = (props: Obj.MakeProps<typeof Post> = {}): Post => Obj.make(Post, props);\n\n/**\n * An entry in a Subscription's {@link Subscription.contentFeed} queue: the\n * fetched body of a Post, linked back to the queue Post in the parallel `feed`\n * queue via {@link post}.\n *\n * Lives in a queue (not on `Subscription.postState`) because fetched bodies\n * can be many KB; storing them inline would inflate the Subscription document\n * unboundedly and force every reader to download every body. The queue is\n * lazily replicated and append-only — a natural fit for immutable content.\n */\nexport class PostContent extends Type.makeObject<PostContent>(\n DXN.make('org.dxos.type.subscription.postContent', '0.1.0'),\n)(\n Schema.Struct({\n /** Source Post (in the Subscription's `feed` queue). */\n post: Ref.Ref(Post).pipe(FormInputAnnotation.set(false)),\n /** Extracted article body, in Markdown. */\n text: Schema.String,\n /** Refined snippet derived from the full article (preferred over the description-derived one). */\n snippet: Schema.optional(Schema.String),\n /** Refined hero image derived from the full article (preferred over the description-derived one). */\n imageUrl: Schema.optional(Schema.String),\n /** ISO 8601 timestamp when the content was fetched. */\n fetchedAt: Schema.String,\n }).pipe(Annotation.HiddenAnnotation.set(true)),\n) {}\n\n//\n// Per-Post state, keyed by Post entity id (Posts are immutable queue items). Read marker lives in\n// `postState`; star/archive are system Tags indexed in `tags`. Shared across magazines.\n//\n\n/** ISO timestamp the Post was first opened, or undefined. */\nexport const getReadAt = (\n subscription: Subscription | Obj.Snapshot<Subscription> | undefined,\n postId: EntityId,\n): string | undefined => {\n const stateMap = subscription?.postState.target;\n return stateMap ? StateMap.bind<PostState>(stateMap).get(postId).readAt : undefined;\n};\n\n/** Sets/clears the Post's read marker. */\nexport const setReadAt = (subscription: Subscription, postId: EntityId, value: string | undefined): void => {\n const stateMap = subscription.postState.target;\n if (stateMap) {\n StateMap.bind<PostState>(stateMap).patch(postId, { readAt: value });\n }\n};\n\n/** Resolves the uri of an existing system Tag without creating one; `undefined` when absent. Async. */\nexport const findSystemTagUri = async (\n db: Pick<Database.Database, 'query'>,\n which: SystemTag,\n): Promise<string | undefined> => {\n // Prefer the current key; fall back to the legacy 'org.dxos.plugin.feed' source so\n // starred/archived tags created before the plugin-feed → plugin-magazine rename still resolve.\n // Two separate queries ensure deterministic priority when both tags co-exist.\n const [currentTag] = await db.query(Filter.foreignKeys(Tag.Tag, [SYSTEM_TAGS[which].key])).run();\n if (currentTag) {\n return Obj.getURI(currentTag).toString();\n }\n const legacyKey = { source: 'org.dxos.plugin.feed', id: SYSTEM_TAGS[which].key.id };\n const [legacyTag] = await db.query(Filter.foreignKeys(Tag.Tag, [legacyKey])).run();\n return legacyTag ? Obj.getURI(legacyTag).toString() : undefined;\n};\n\n/** Whether a Post carries the given (resolved) tag uri on its Subscription. Pure. */\nexport const hasTag = (\n subscription: Subscription | Obj.Snapshot<Subscription> | undefined,\n postId: EntityId,\n tagUri: string | undefined,\n): boolean => {\n const tagIndex = subscription?.tags.target;\n return !!(tagIndex && tagUri) && TagIndex.bind(tagIndex).objects(tagUri).includes(postId);\n};\n\n/** Sets/clears a system tag (`starred`/`archived`) on a Post (find-or-creates the Tag object). Async. */\nexport const setTag = async (\n subscription: Subscription,\n postId: EntityId,\n db: Pick<Database.Database, 'query' | 'add'>,\n which: SystemTag,\n value: boolean,\n): Promise<void> => {\n const tag = await Tag.findOrCreate(db, SYSTEM_TAGS[which]);\n const uri = Obj.getURI(tag).toString();\n const tagIndex = subscription.tags.target;\n if (!tagIndex) {\n return;\n }\n const tags = TagIndex.bind(tagIndex);\n if (value) {\n tags.setTag(uri, postId);\n } else {\n tags.unsetTag(uri, postId);\n }\n};\n\n//\n// Content feed (fetched article bodies; carries refined snippet/imageUrl).\n//\n\n/** Resolves a Post's source Subscription synchronously if its `source` ref is loaded, else undefined. */\nexport const getPostSubscription = (post: Post): Subscription | undefined => post.source?.target;\n\n/**\n * Query for {@link PostContent} entries referencing a Post via the reverse-ref index.\n * Scoped to the Subscription's post and content feeds.\n */\nexport const queryPostContentForPost = (\n subscription: Subscription | Obj.Snapshot<Subscription>,\n post: Post | Obj.Snapshot<Post>,\n): Query.Any | undefined => {\n const postFeed = subscription.feed?.target;\n const contentFeed = subscription.contentFeed?.target;\n if (!postFeed || !contentFeed) {\n return undefined;\n }\n const postFeedUri = Obj.getURI(postFeed);\n const contentFeedUri = Obj.getURI(contentFeed);\n return Query.select(Filter.id(post.id))\n .referencedBy(PostContent, 'post')\n .from(Scope.feed(postFeedUri), Scope.feed(contentFeedUri));\n};\n\n/** Pick the newest PostContent when multiple entries reference the same Post. */\nexport const pickLatestPostContent = (entries: readonly PostContent[]): PostContent | undefined => {\n if (entries.length === 0) {\n return undefined;\n }\n return [...entries].sort((entryA, entryB) => entryB.fetchedAt.localeCompare(entryA.fetchedAt))[0];\n};\n\n/** Looks up PostContent for a Post (newest wins); undefined if absent. */\nexport const findPostContent = async (\n subscription: Subscription | Obj.Snapshot<Subscription>,\n post: Post | Obj.Snapshot<Post>,\n): Promise<PostContent | undefined> => {\n const db = Obj.getDatabase(subscription);\n const query = queryPostContentForPost(subscription, post);\n if (!db || !query) {\n return undefined;\n }\n return pickLatestPostContent(await db.query(query).run());\n};\n\n/** Returns the Subscription's `contentFeed`, lazily creating and attaching one when missing. */\nconst ensureContentFeed = (subscription: Subscription): Feed.Feed => {\n const existing = subscription.contentFeed?.target;\n if (existing) {\n return existing;\n }\n const created = Feed.make();\n Obj.update(subscription, (subscription) => {\n const mutable = subscription as Obj.Mutable<typeof subscription>;\n mutable.contentFeed = Ref.make(created);\n });\n Obj.setParent(created, subscription);\n return created;\n};\n\n/**\n * Appends a {@link PostContent} entry (body + refined snippet/imageUrl) to a Subscription's\n * `contentFeed`, lazily creating the feed on first use.\n */\nexport const appendPostContent = async (\n space: Pick<Space, 'db'>,\n subscription: Subscription,\n entry: {\n post: Post | Obj.Snapshot<Post>;\n text: string;\n snippet?: string;\n imageUrl?: string;\n fetchedAt?: string;\n },\n): Promise<void> => {\n const echoFeed = ensureContentFeed(subscription);\n const content = Obj.make(PostContent, {\n post: Ref.fromURI(Obj.getURI(entry.post)),\n text: entry.text,\n ...(entry.snippet ? { snippet: entry.snippet } : {}),\n ...(entry.imageUrl ? { imageUrl: entry.imageUrl } : {}),\n fetchedAt: entry.fetchedAt ?? new Date().toISOString(),\n });\n await Feed.append(echoFeed, [content]).pipe(Effect.provide(Database.layer(space.db)), EffectEx.runAndForwardErrors);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, DXN, Ref, Registry } from '@dxos/echo';\n\nimport { meta } from '#meta';\n\nimport * as Magazine from './Magazine';\nimport * as Subscription from './Subscription';\n\nconst makeKey = (name: string) => DXN.make(`${meta.profile.key}.operation.${name}`);\n\n/** Fetches an RSS/Atom feed and appends new posts to the backing ECHO feed. */\nexport const SyncFeed = Operation.make({\n meta: {\n key: makeKey('syncFeed'),\n name: 'Sync Feed',\n description: 'Fetches RSS/Atom feed and writes posts to the ECHO feed.',\n icon: 'ph--arrows-clockwise--regular',\n },\n services: [Database.Service],\n input: Schema.Struct({\n feed: Ref.Ref(Subscription.Subscription),\n }),\n output: Schema.Void,\n}).pipe(Operation.visible);\n\n/**\n * Fetches a Post's article page over HTTP and returns extracted plain text plus\n * any image URLs found. Read-only; does not mutate the Post. Agent-facing tool\n * (the surviving curation tool: the agent may call it to read a candidate's full\n * text when title + description are insufficient to judge relevance).\n */\nexport const FetchArticleContent = Operation.make({\n meta: {\n key: makeKey('fetchArticleContent'),\n name: 'Fetch Article Content',\n description: \"Fetches and extracts text + image URLs from a Post's article page.\",\n icon: 'ph--article--regular',\n },\n input: Schema.Struct({\n post: Ref.Ref(Subscription.Post).annotations({\n description: 'The Post to fetch content for. The Post must have a link.',\n }),\n }),\n output: Schema.Struct({\n text: Schema.String.annotations({ description: 'Extracted plain text from the article page.' }),\n imageUrls: Schema.Array(Schema.String).annotations({\n description: 'Image URLs found on the page (og:image first, then <img> src values).',\n }),\n }),\n services: [Database.Service],\n});\n\n/**\n * Fetches a Post's article page over HTTP and writes the extracted plain text\n * and hero image URL to the source Subscription's content feed. Per-Post read/star/archive\n * state on the Subscription is keyed by Post entity id.\n * (the Post itself is an immutable queue item). Idempotent — skips if\n * `content` is already set or the Post has no link. Used by the reader view\n * to populate the full article on first open.\n */\nexport const LoadPostContent = Operation.make({\n meta: {\n key: makeKey('loadPostContent'),\n name: 'Load Post Content',\n description: 'Fetches and stores the full article content on a Post.',\n icon: 'ph--download--regular',\n },\n input: Schema.Struct({\n post: Ref.Ref(Subscription.Post).annotations({\n description: 'The Post to load content for.',\n }),\n force: Schema.optional(\n Schema.Boolean.annotations({\n description: 'Re-fetch and append fresh content even if an entry already exists (refresh).',\n }),\n ),\n }),\n output: Schema.Void,\n});\n\n/**\n * End-to-end magazine curation: syncs all referenced feeds (in parallel), then runs an in-memory\n * routine (the magazine's topic instructions + the registry-resolved Magazine skill) through the\n * agent to select matching posts, adds the selected posts mechanically, and finally enforces each\n * feed's `keep` bound. Drives the MagazineArticle Curate button; schedulable via triggers.\n */\nexport const CurateMagazine = Operation.make({\n meta: {\n key: makeKey('curateMagazine'),\n name: 'Curate Magazine',\n description: 'Syncs feeds, selects matching posts via the magazine skill, and applies per-feed keep limits.',\n icon: 'ph--sparkle--regular',\n },\n input: Schema.Struct({\n magazine: Ref.Ref(Magazine.Magazine).annotations({\n description: 'The Magazine to curate.',\n }),\n }),\n output: Schema.Struct({\n synced: Schema.Number.annotations({ description: 'Number of feeds successfully synced.' }),\n curated: Schema.Number.annotations({ description: 'Number of posts added to the magazine.' }),\n }),\n // Database.Service for candidate collection, Registry.Service to resolve the methodology skill;\n // sub-operations (SyncFeed, RunInstructions) resolve through the ambient Operation.Service invoker.\n services: [Database.Service, Registry.Service],\n}).pipe(Operation.visible);\n\n/**\n * Clears a Magazine's curated posts, preserving any that are starred. Drives the MagazineArticle\n * Clear button.\n */\nexport const ClearMagazine = Operation.make({\n meta: {\n key: makeKey('clearMagazine'),\n name: 'Clear Magazine',\n description: \"Removes a Magazine's posts, keeping any that are starred.\",\n icon: 'ph--trash--regular',\n },\n input: Schema.Struct({\n magazine: Ref.Ref(Magazine.Magazine).annotations({\n description: 'The Magazine to clear.',\n }),\n }),\n output: Schema.Void,\n services: [Database.Service],\n}).pipe(Operation.visible);\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { AppAnnotation } from '@dxos/app-toolkit';\nimport { Instructions, Skill } from '@dxos/compute';\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInlineAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';\nimport { type EntityId } from '@dxos/keys';\nimport { StateMap } from '@dxos/schema';\nimport { trim } from '@dxos/util';\n\nimport * as Subscription from './Subscription';\n\nexport const SKILL_KEY = 'org.dxos.skill.magazine';\n\n/**\n * Default editorial methodology seeded into a Magazine's curation Routine. Describes WHAT to curate\n * (selection, dedup, snippet, hero image). The HOW (candidate input shape, tool usage, output\n * contract) lives in the Magazine skill, not here.\n */\nexport const DEFAULT_INSTRUCTIONS = trim`\n You curate articles for a Magazine around the Topic described below.\n\n Select only candidates that clearly match the Topic — quality over quantity.\n\n Never select duplicate articles. Two candidates are duplicates if they share a link or guid, or if\n their titles and content describe the same story (e.g. the same article syndicated by different\n feeds). Keep only one of each — prefer the most complete or authoritative source — and skip the rest.\n\n For each candidate you select, also produce:\n - A concise 1-2 sentence snippet (plain text, no markdown) capturing why the article is relevant to\n the Topic. If you read the full article, use it to write a richer snippet.\n - The best hero image URL for the article, when one is available.\n`;\n\n/** Per-Post magazine-scoped curation state, keyed by Post id. */\nexport const PostState = Schema.Struct({\n /** Agent-assigned relevance within this magazine (lower = more relevant). */\n rank: Schema.optional(Schema.Number),\n /** Agent-written concise snippet summarising the article in the context of this magazine's topic. */\n snippet: Schema.optional(Schema.String),\n /** Agent-selected hero image URL for this post in this magazine. */\n imageUrl: Schema.optional(Schema.String),\n});\nexport type PostState = Schema.Schema.Type<typeof PostState>;\n\n/**\n * Structured output contract of the curation Routine: the Posts the agent selected, each with\n * agent-generated display values. Declared as the Routine's `output` ({@link make}) so the agent's\n * `completeJob` carries this payload (a Void/Unknown default would silently drop it); {@link\n * CurateMagazine} decodes the Routine result against the same schema.\n */\nexport const CurationOutput = Schema.Struct({\n posts: Schema.Array(\n Schema.Struct({\n id: Obj.ID,\n /** Concise 1-2 sentence snippet summarising why this article is relevant to the magazine topic. */\n snippet: Schema.optional(Schema.String),\n /** Best image URL found for this article (from the post or fetched content). */\n imageUrl: Schema.optional(Schema.String),\n }),\n ),\n});\n\n/**\n * An agent-curated collection of articles drawn from one or more Feeds.\n * Curation is driven by a {@link Routine.Routine} created with the magazine ({@link make}): its\n * instructions hold the editorial brief and it references the Magazine skill (the tool/output\n * contract). {@link CurateMagazine} runs the Routine to select matching Posts.\n */\nexport class Magazine extends Type.makeObject<Magazine>(DXN.make('org.dxos.type.magazine', '0.2.0'))(\n Schema.Struct({\n /** User-facing title of the magazine. */\n name: Schema.String.pipe(Schema.optional),\n /** Feeds to pull content from. */\n feeds: Schema.Array(Ref.Ref(Subscription.Subscription)),\n /** Curated Post refs (insertion order; UI displays newest-last reversed). */\n posts: Schema.Array(Ref.Ref(Subscription.Post)).pipe(FormInputAnnotation.set(false)),\n /**\n * Curation Instructions, created with the magazine ({@link make}). Holds the editorial brief and\n * references the Magazine skill. Rendered inline by the properties form (the Instructions'\n * own fields), so the brief is edited there without a custom surface.\n * Optional for backward compatibility; {@link CurateMagazine} and the toolbar require it.\n */\n instructions: Ref.Ref(Instructions.Instructions).pipe(FormInlineAnnotation.set(true), Schema.optional),\n /**\n * Per-Post magazine-scoped curation state, keyed by Post id. Shared per-Post state (readAt,\n * star/archive tags) lives on `Subscription`; snippet/imageUrl here are agent-written at\n * curation time and take precedence over the RSS-derived defaults in display.\n */\n postState: Ref.Ref(StateMap.StateMap).pipe(FormInputAnnotation.set(false)),\n /**\n * Maximum number of (non-starred) curated Posts retained on the magazine after curation.\n * Older posts beyond this bound are dropped; starred posts are preserved regardless.\n * Defaults to {@link Subscription.DEFAULT_KEEP} when unset.\n */\n keep: Schema.Number.pipe(\n Schema.annotations({\n title: 'Keep',\n description: 'Number of items to keep.',\n }),\n Schema.optional,\n ),\n }).pipe(\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--book-open-text--regular', hue: 'indigo' }),\n AppAnnotation.SkillsAnnotation.set([SKILL_KEY]),\n ),\n) {}\n\n/** Checks if a value is a Magazine object. */\nexport const instanceOf = (value: unknown): value is Magazine => Obj.instanceOf(Magazine, value);\n\nexport type MakeProps = Omit<Obj.MakeProps<typeof Magazine>, 'feeds' | 'posts' | 'instructions' | 'postState'> & {\n feeds?: Ref.Ref<Subscription.Subscription>[];\n posts?: Ref.Ref<Subscription.Post>[];\n /** Editorial brief seeded into the curation Routine's instructions (composed with the default methodology). */\n instructions?: string;\n};\n\n/**\n * Creates a Magazine plus its curation Routine and per-Post state map as hidden children (all\n * cascade-deleted with the magazine). The Routine holds the editorial brief (its instructions,\n * seeded from {@link composeInstructions}) and references the Magazine skill by its registry DXN;\n * {@link CurateMagazine} runs it and the agent resolves the skill at run time.\n */\nexport const make = (props: MakeProps = {}): Magazine => {\n const postState = StateMap.make();\n const magazine = Obj.make(Magazine, {\n name: props.name,\n feeds: props.feeds ?? [],\n posts: props.posts ?? [],\n keep: props.keep,\n postState: Ref.make(postState),\n });\n\n const instructions = Instructions.make({\n name: props.name ? `${props.name} curation` : 'Magazine curation',\n text: composeInstructions(props.instructions),\n skills: [Ref.fromURI(Skill.registryURI(SKILL_KEY))],\n // Bind the magazine as session context so the agent sees it, not only the candidate JSON input.\n objects: [Ref.make(magazine)],\n // Declare the selection contract so the agent's completeJob carries the chosen Posts.\n output: CurationOutput,\n });\n Obj.update(magazine, (magazine) => {\n magazine.instructions = Ref.make(instructions);\n });\n\n // Cascade-delete the Instructions object (and its Text) and the per-Post state with the magazine.\n Obj.setParent(instructions, magazine);\n if (instructions.text.target) {\n Obj.setParent(instructions.text.target, instructions);\n }\n Obj.setParent(postState, magazine);\n return magazine;\n};\n\n/** Composes Routine instructions from the default editorial methodology and an optional topic focus. */\nexport const composeInstructions = (topic?: string): string => {\n const trimmed = topic?.trim();\n return trimmed ? `${DEFAULT_INSTRUCTIONS}\\n\\n## Topic\\n\\n${trimmed}` : DEFAULT_INSTRUCTIONS;\n};\n\n/** Schema for the create-magazine dialog form. */\nexport const CreateMagazineSchema = Schema.Struct({\n name: Schema.optional(\n Schema.String.annotations({\n title: 'Name',\n }),\n ),\n feeds: Schema.Array(Ref.Ref(Subscription.Subscription)).annotations({\n title: 'Feeds',\n }),\n instructions: Schema.optional(\n Schema.String.annotations({\n title: 'Topic',\n description: 'Describe what content to curate.',\n }),\n ),\n});\n\n//\n// Per-Post magazine-scoped curation state, keyed by Post id.\n//\n\n/** Agent-assigned relevance of a Post within a Magazine, or undefined. */\nexport const getRank = (magazine: Magazine | undefined, postId: EntityId): number | undefined => {\n const stateMap = magazine?.postState.target;\n return stateMap ? StateMap.bind<PostState>(stateMap).get(postId).rank : undefined;\n};\n\n/** Returns the full magazine-scoped {@link PostState} for a Post, or an empty record. */\nexport const getPostState = (magazine: Magazine | undefined, postId: EntityId): Partial<PostState> => {\n const stateMap = magazine?.postState.target;\n return stateMap ? StateMap.bind<PostState>(stateMap).get(postId) : {};\n};\n\n/** Merges partial state into a Post's magazine-scoped {@link PostState}. */\nexport const patchPostState = (magazine: Magazine, postId: EntityId, state: Partial<PostState>): void => {\n const stateMap = magazine.postState.target;\n if (stateMap) {\n StateMap.bind<PostState>(stateMap).patch(postId, state);\n }\n};\n\n/** Sets the magazine-scoped rank for a Post. */\nexport const setRank = (magazine: Magazine, postId: EntityId, rank: number): void =>\n patchPostState(magazine, postId, { rank });\n"],
5
- "mappings": ";;;;;AAAA;;;;;;;;;AAMA,YAAYA,aAAY;AAExB,SAASC,cAAc;;;ACRvB;;;;;;;;;;;;;;;;;;;;;;;AAMA,YAAYC,YAAY;AACxB,YAAYC,YAAY;AAGxB,SAASC,YAAYC,UAAUC,KAAKC,MAAMC,QAAQC,KAAKC,OAAOC,KAAKC,OAAOC,KAAKC,YAAY;AAC3F,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,gBAAgB;AAEzB,SAASC,mBAAmCC,gBAAgBC,UAAUC,gBAAgB;AAM/E,IAAMC,WAAkBC,eAAQ,iBAAiB,OAAO,SAAA;AAQxD,IAAMC,cAAc;EACzBC,SAAS;IAAEC,KAAK;MAAEC,QAAQ;MAA4BC,IAAI;IAAU;IAAGC,OAAO;IAAWC,KAAK;EAAQ;EACtGC,UAAU;IAAEL,KAAK;MAAEC,QAAQ;MAA4BC,IAAI;IAAW;IAAGC,OAAO;IAAYC,KAAK;EAAU;AAC7G;AAMO,IAAME,YAAmBC,cAAO;;EAErCC,QAAeC,gBAAgBC,aAAM;AACv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,UAAU;IAACC,UAASC;IAAS4B,SAAS5B;;AACxC,CAAA,EAAGQ,KAAKb,UAAUc,OAAO;AAMlB,IAAMoB,gBAAgBlC,UAAUL,KAAK;EAC1CC,MAAM;IACJE,KAAKN,QAAQ,eAAA;IACbC,MAAM;IACNQ,aAAa;IACbC,MAAM;EACR;EACAI,OAAcC,eAAO;IACnBqB,UAAUnB,KAAIA,IAAaoB,QAAQ,EAAEX,YAAY;MAC/CjB,aAAa;IACf,CAAA;EACF,CAAA;EACAU,QAAeC;EACfT,UAAU;IAACC,UAASC;;AACtB,CAAA,EAAGQ,KAAKb,UAAUc,OAAO;",
6
- "names": ["Schema", "Format", "Effect", "Schema", "Annotation", "Database", "DXN", "Feed", "Filter", "Obj", "Query", "Ref", "Scope", "Tag", "Type", "FormInputAnnotation", "LabelAnnotation", "EffectEx", "FactoryAnnotation", "FeedAnnotation", "StateMap", "TagIndex", "FeedType", "Literal", "SYSTEM_TAGS", "starred", "key", "source", "id", "label", "hue", "archived", "PostState", "Struct", "readAt", "optional", "String", "DEFAULT_KEEP", "Subscription", "makeObject", "make", "name", "pipe", "url", "type", "description", "link", "iconUrl", "keep", "Number", "annotations", "title", "cursor", "set", "feed", "contentFeed", "postState", "tags", "IconAnnotation", "icon", "values", "makeSubscription", "instanceOf", "value", "props", "postFeed", "subscription", "setParent", "Post", "content", "author", "published", "guid", "makePost", "PostContent", "post", "text", "snippet", "imageUrl", "fetchedAt", "HiddenAnnotation", "getReadAt", "postId", "stateMap", "target", "bind", "get", "undefined", "setReadAt", "patch", "findSystemTagUri", "db", "which", "currentTag", "query", "foreignKeys", "run", "getURI", "toString", "legacyKey", "legacyTag", "hasTag", "tagUri", "tagIndex", "objects", "includes", "setTag", "tag", "findOrCreate", "uri", "unsetTag", "getPostSubscription", "queryPostContentForPost", "postFeedUri", "contentFeedUri", "select", "referencedBy", "from", "pickLatestPostContent", "entries", "length", "sort", "entryA", "entryB", "localeCompare", "findPostContent", "getDatabase", "ensureContentFeed", "existing", "created", "update", "mutable", "appendPostContent", "space", "entry", "echoFeed", "fromURI", "Date", "toISOString", "append", "provide", "layer", "runAndForwardErrors", "HandleSchema", "String", "pipe", "pattern", "isHandle", "is", "isUrl", "Format", "URL", "StandardSiteCreateBase", "Struct", "type", "Literal", "handle", "annotations", "title", "description", "publication", "RssCreateBase", "url", "name", "optional", "makeSubscriptionFromCreate", "input", "makeSubscription", "Schema", "Operation", "Database", "DXN", "Ref", "Registry", "meta", "PostState", "instanceOf", "Schema", "AppAnnotation", "Instructions", "Skill", "Annotation", "DXN", "Obj", "Ref", "Type", "FormInlineAnnotation", "FormInputAnnotation", "LabelAnnotation", "StateMap", "trim", "SKILL_KEY", "DEFAULT_INSTRUCTIONS", "trim", "PostState", "Struct", "rank", "optional", "Number", "snippet", "String", "imageUrl", "CurationOutput", "posts", "Array", "id", "Obj", "ID", "Magazine", "Type", "makeObject", "DXN", "make", "name", "pipe", "feeds", "Ref", "Subscription", "Post", "FormInputAnnotation", "set", "instructions", "Instructions", "FormInlineAnnotation", "postState", "StateMap", "keep", "annotations", "title", "description", "LabelAnnotation", "Annotation", "IconAnnotation", "icon", "hue", "AppAnnotation", "SkillsAnnotation", "instanceOf", "value", "props", "magazine", "text", "composeInstructions", "skills", "fromURI", "Skill", "registryURI", "objects", "output", "update", "setParent", "target", "topic", "trimmed", "CreateMagazineSchema", "getRank", "postId", "stateMap", "bind", "get", "undefined", "getPostState", "patchPostState", "state", "patch", "setRank", "makeKey", "name", "DXN", "make", "meta", "profile", "key", "SyncFeed", "Operation", "description", "icon", "services", "Database", "Service", "input", "Struct", "feed", "Ref", "Subscription", "output", "Void", "pipe", "visible", "FetchArticleContent", "post", "Post", "annotations", "text", "String", "imageUrls", "Array", "LoadPostContent", "force", "optional", "Boolean", "CurateMagazine", "magazine", "Magazine", "synced", "Number", "curated", "Registry", "ClearMagazine"]
7
- }
@@ -1,28 +0,0 @@
1
- // src/util/date.ts
2
- var formatDate = (iso) => {
3
- if (!iso) {
4
- return void 0;
5
- }
6
- const date = new Date(iso);
7
- if (Number.isNaN(date.getTime())) {
8
- return void 0;
9
- }
10
- return date.toLocaleDateString(void 0, {
11
- year: "numeric",
12
- month: "short",
13
- day: "numeric"
14
- });
15
- };
16
- var publishedTimestamp = (published) => {
17
- if (!published) {
18
- return Number.NEGATIVE_INFINITY;
19
- }
20
- const ms = Date.parse(published);
21
- return Number.isNaN(ms) ? Number.NEGATIVE_INFINITY : ms;
22
- };
23
-
24
- export {
25
- formatDate,
26
- publishedTimestamp
27
- };
28
- //# sourceMappingURL=chunk-SAWKLGJU.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/util/date.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\n/** Format an ISO 8601 date string for tile/reader display. Returns undefined for missing/invalid input. */\nexport const formatDate = (iso: string | undefined): string | undefined => {\n if (!iso) {\n return undefined;\n }\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) {\n return undefined;\n }\n return date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' });\n};\n\n/**\n * Sortable timestamp from an ISO date string (e.g. a Post's `published`); missing/unparseable\n * values sort last (newest-first sorts treat them as `-Infinity`).\n */\nexport const publishedTimestamp = (published: string | undefined): number => {\n if (!published) {\n return Number.NEGATIVE_INFINITY;\n }\n const ms = Date.parse(published);\n return Number.isNaN(ms) ? Number.NEGATIVE_INFINITY : ms;\n};\n"],
5
- "mappings": ";AAKO,IAAMA,aAAa,CAACC,QAAAA;AACzB,MAAI,CAACA,KAAK;AACR,WAAOC;EACT;AACA,QAAMC,OAAO,IAAIC,KAAKH,GAAAA;AACtB,MAAII,OAAOC,MAAMH,KAAKI,QAAO,CAAA,GAAK;AAChC,WAAOL;EACT;AACA,SAAOC,KAAKK,mBAAmBN,QAAW;IAAEO,MAAM;IAAWC,OAAO;IAASC,KAAK;EAAU,CAAA;AAC9F;AAMO,IAAMC,qBAAqB,CAACC,cAAAA;AACjC,MAAI,CAACA,WAAW;AACd,WAAOR,OAAOS;EAChB;AACA,QAAMC,KAAKX,KAAKY,MAAMH,SAAAA;AACtB,SAAOR,OAAOC,MAAMS,EAAAA,IAAMV,OAAOS,oBAAoBC;AACvD;",
6
- "names": ["formatDate", "iso", "undefined", "date", "Date", "Number", "isNaN", "getTime", "toLocaleDateString", "year", "month", "day", "publishedTimestamp", "published", "NEGATIVE_INFINITY", "ms", "parse"]
7
- }
@@ -1,15 +0,0 @@
1
- import {
2
- extractImageUrls,
3
- makeSnippet,
4
- stripHtml
5
- } from "./chunk-APQRTYT3.mjs";
6
-
7
- // src/util/post-content.ts
8
- var getSnippet = (post, content) => content?.snippet ?? makeSnippet(stripHtml(post.description ?? ""));
9
- var getImageUrl = (post, content) => content?.imageUrl ?? extractImageUrls(post.description ?? "")[0];
10
-
11
- export {
12
- getSnippet,
13
- getImageUrl
14
- };
15
- //# sourceMappingURL=chunk-XCNCK47N.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/util/post-content.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Subscription } from '../types';\nimport { extractImageUrls, makeSnippet, stripHtml } from './text';\n\n/**\n * Pure derivations of a Post's display snippet/hero-image, preferring the refined values on a\n * fetched {@link Subscription.PostContent} entry when present, else derived from `post.description`.\n */\n\n/** Plain-text snippet: the refined contentFeed value if loaded, else derived from `post.description`. */\nexport const getSnippet = (post: { description?: string }, content?: Subscription.PostContent): string =>\n content?.snippet ?? makeSnippet(stripHtml(post.description ?? ''));\n\n/** Hero image url: the refined contentFeed value if loaded, else derived from `post.description`. */\nexport const getImageUrl = (post: { description?: string }, content?: Subscription.PostContent): string | undefined =>\n content?.imageUrl ?? extractImageUrls(post.description ?? '')[0];\n"],
5
- "mappings": ";;;;;;;AAaO,IAAMA,aAAa,CAACC,MAAgCC,YACzDA,SAASC,WAAWC,YAAYC,UAAUJ,KAAKK,eAAe,EAAA,CAAA;AAGzD,IAAMC,cAAc,CAACN,MAAgCC,YAC1DA,SAASM,YAAYC,iBAAiBR,KAAKK,eAAe,EAAA,EAAI,CAAA;",
6
- "names": ["getSnippet", "post", "content", "snippet", "makeSnippet", "stripHtml", "description", "getImageUrl", "imageUrl", "extractImageUrls"]
7
- }
@@ -1,59 +0,0 @@
1
- import {
2
- FeedOperation_exports,
3
- Subscription_exports
4
- } from "./chunk-OYCDRSWB.mjs";
5
- import "./chunk-J5LGTIGS.mjs";
6
-
7
- // src/operations/clear-magazine.ts
8
- import * as Effect from "effect/Effect";
9
- import * as Option from "effect/Option";
10
- import { Operation } from "@dxos/compute";
11
- import { Database, Obj, Ref } from "@dxos/echo";
12
- import { EID } from "@dxos/keys";
13
- var handler = FeedOperation_exports.ClearMagazine.pipe(Operation.withHandler(Effect.fn(function* ({ magazine: magazineRef }) {
14
- const magazine = yield* Database.load(magazineRef);
15
- const db = Obj.getDatabase(magazine);
16
- if (!db || magazine.posts.length === 0) {
17
- return;
18
- }
19
- const starredUri = yield* Effect.promise(() => Subscription_exports.findSystemTagUri(db, "starred"));
20
- const next = yield* Option.fromNullable(starredUri).pipe(Option.match({
21
- onNone: () => Effect.succeed([]),
22
- onSome: (uri) => Effect.gen(function* () {
23
- const loaded = yield* Effect.all(magazine.posts.map((ref) => Database.load(ref)), {
24
- concurrency: "unbounded"
25
- });
26
- const sourceById = /* @__PURE__ */ new Map();
27
- for (const post of loaded) {
28
- if (post.source) {
29
- sourceById.set(EID.getEntityId(EID.parse(post.source.uri)) ?? post.source.uri, post.source);
30
- }
31
- }
32
- const subscriptionEntries = yield* Effect.all([
33
- ...sourceById
34
- ].map(([entityId, source]) => Database.load(source).pipe(
35
- // Resolve the child tag index so `hasTag` can read it synchronously below.
36
- Effect.tap((subscription) => Database.load(subscription.tags)),
37
- Effect.map((subscription) => [
38
- entityId,
39
- subscription
40
- ])
41
- )), {
42
- concurrency: "unbounded"
43
- });
44
- const subscriptionById = new Map(subscriptionEntries);
45
- return loaded.filter((post) => Subscription_exports.hasTag(post.source ? subscriptionById.get(EID.getEntityId(EID.parse(post.source.uri)) ?? post.source.uri) : void 0, post.id, uri)).map((post) => Ref.make(post));
46
- })
47
- }));
48
- if (next.length === magazine.posts.length) {
49
- return;
50
- }
51
- Obj.update(magazine, (magazine2) => {
52
- magazine2.posts = next;
53
- });
54
- })));
55
- var clear_magazine_default = handler;
56
- export {
57
- clear_magazine_default as default
58
- };
59
- //# sourceMappingURL=clear-magazine-KNY4OWY4.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/operations/clear-magazine.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, Obj, Ref } from '@dxos/echo';\nimport { EID } from '@dxos/keys';\n\nimport { FeedOperation, Subscription } from '../types';\n\n/**\n * Clears a Magazine's curated posts, preserving any that are starred. With no `starred` tag in the\n * space nothing can be starred, so the whole list is emptied without resolving any posts; otherwise\n * each post (and its distinct source Subscription) is resolved and the starred ones are kept.\n */\nconst handler: Operation.WithHandler<typeof FeedOperation.ClearMagazine> = FeedOperation.ClearMagazine.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ magazine: magazineRef }) {\n const magazine = yield* Database.load(magazineRef);\n const db = Obj.getDatabase(magazine);\n if (!db || magazine.posts.length === 0) {\n return;\n }\n const starredUri = yield* Effect.promise(() => Subscription.findSystemTagUri(db, 'starred'));\n\n const next = yield* Option.fromNullable(starredUri).pipe(\n Option.match({\n onNone: () => Effect.succeed<Ref.Ref<Subscription.Post>[]>([]),\n onSome: (uri) =>\n Effect.gen(function* () {\n // Resolve posts concurrently — `Effect.all` defaults to sequential.\n const loaded = yield* Effect.all(\n magazine.posts.map((ref) => Database.load(ref)),\n { concurrency: 'unbounded' },\n );\n // A post's starred flag lives on its Subscription's TagIndex; many posts share one\n // Subscription (a feed has many posts), so resolve each distinct source once.\n const sourceById = new Map<string, Ref.Ref<Subscription.Subscription>>();\n for (const post of loaded) {\n if (post.source) {\n sourceById.set(EID.getEntityId(EID.parse(post.source.uri)) ?? post.source.uri, post.source);\n }\n }\n const subscriptionEntries = yield* Effect.all(\n [...sourceById].map(([entityId, source]) =>\n Database.load(source).pipe(\n // Resolve the child tag index so `hasTag` can read it synchronously below.\n Effect.tap((subscription) => Database.load(subscription.tags)),\n Effect.map((subscription) => [entityId, subscription] as const),\n ),\n ),\n { concurrency: 'unbounded' },\n );\n const subscriptionById = new Map(subscriptionEntries);\n return loaded\n .filter((post) =>\n Subscription.hasTag(\n post.source\n ? subscriptionById.get(EID.getEntityId(EID.parse(post.source.uri)) ?? post.source.uri)\n : undefined,\n post.id,\n uri,\n ),\n )\n .map((post) => Ref.make(post));\n }),\n }),\n );\n\n if (next.length === magazine.posts.length) {\n return;\n }\n Obj.update(magazine, (magazine) => {\n magazine.posts = next;\n });\n }),\n ),\n);\n\nexport default handler;\n"],
5
- "mappings": ";;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,KAAKC,WAAW;AACnC,SAASC,WAAW;AASpB,IAAMC,UAAqEC,sBAAcC,cAAcC,KACrGC,UAAUC,YACDC,UAAG,WAAW,EAAEC,UAAUC,YAAW,GAAE;AAC5C,QAAMD,WAAW,OAAOE,SAASC,KAAKF,WAAAA;AACtC,QAAMG,KAAKC,IAAIC,YAAYN,QAAAA;AAC3B,MAAI,CAACI,MAAMJ,SAASO,MAAMC,WAAW,GAAG;AACtC;EACF;AACA,QAAMC,aAAa,OAAcC,eAAQ,MAAMC,qBAAaC,iBAAiBR,IAAI,SAAA,CAAA;AAEjF,QAAMS,OAAO,OAAcC,oBAAaL,UAAAA,EAAYb,KAC3CmB,aAAM;IACXC,QAAQ,MAAaC,eAAsC,CAAA,CAAE;IAC7DC,QAAQ,CAACC,QACAC,W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FeedOperation", "ClearMagazine", "pipe", "Operation", "withHandler", "fn", "magazine", "magazineRef", "Database", "load", "db", "Obj", "getDatabase", "posts", "length", "starredUri", "promise", "Subscription", "findSystemTagUri", "next", "fromNullable", "match", "onNone", "succeed", "onSome", "uri", "gen", "loaded", "all", "map", "ref", "concurrency", "sourceById", "Map", "post", "source", "set", "EID", "getEntityId", "parse", "subscriptionEntries", "entityId", "tap", "subscription", "tags", "subscriptionById", "filter", "hasTag", "get", "undefined", "id", "Ref", "make", "update"]
7
- }
@@ -1,338 +0,0 @@
1
- import {
2
- getImageUrl
3
- } from "../chunk-XCNCK47N.mjs";
4
- import "../chunk-APQRTYT3.mjs";
5
- import {
6
- formatDate
7
- } from "../chunk-SAWKLGJU.mjs";
8
- import "../chunk-J5LGTIGS.mjs";
9
-
10
- // src/components/PostContent/PostContent.tsx
11
- import React, { useMemo } from "react";
12
- import { ScrollArea } from "@dxos/react-ui";
13
- import { composable } from "@dxos/react-ui";
14
- import { MarkdownView } from "@dxos/react-ui-markdown";
15
- import { usePostContentAtom } from "#atoms";
16
- var dedupeImagesInMarkdown = (markdown, excluded) => {
17
- const seen = /* @__PURE__ */ new Set();
18
- for (const url of excluded) {
19
- if (url) {
20
- seen.add(url);
21
- }
22
- }
23
- const markdownImg = /!\[[^\]]*\]\(\s*([^)\s]+)(?:\s+"[^"]*")?\s*\)/g;
24
- const htmlImg = /<img\b[^>]*\bsrc=["']([^"']+)["'][^>]*>/gi;
25
- const dedupe = (input, regex) => input.replace(regex, (match, url) => {
26
- if (typeof url !== "string") {
27
- return match;
28
- }
29
- if (seen.has(url)) {
30
- return "";
31
- }
32
- seen.add(url);
33
- return match;
34
- });
35
- return dedupe(dedupe(markdown, markdownImg), htmlImg);
36
- };
37
- var contentHasImage = (markdown) => /!\[[^\]]*\]\(\s*[^)\s]+/.test(markdown) || /<img\b[^>]*\bsrc=["'][^"']+["']/i.test(markdown);
38
- var PostContent = composable(({ post, metadata = [], ...props }, forwardedRef) => {
39
- const meta = [
40
- post.author,
41
- ...metadata,
42
- formatDate(post.published)
43
- ].filter(Boolean).join(" \xB7 ");
44
- const title = post.title;
45
- const postContent = usePostContentAtom(post);
46
- const imageUrl = getImageUrl(post, postContent);
47
- const fetchedText = postContent?.text;
48
- const content = useMemo(() => {
49
- const source = fetchedText || post.description || "";
50
- if (!source) {
51
- return "";
52
- }
53
- return dedupeImagesInMarkdown(source, [
54
- imageUrl
55
- ]);
56
- }, [
57
- fetchedText,
58
- post.description,
59
- imageUrl
60
- ]);
61
- const showHero = useMemo(() => Boolean(imageUrl?.startsWith("http")) && !contentHasImage(content), [
62
- imageUrl,
63
- content
64
- ]);
65
- return /* @__PURE__ */ React.createElement(ScrollArea.Root, {
66
- ...props,
67
- orientation: "vertical",
68
- thin: true,
69
- ref: forwardedRef
70
- }, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, {
71
- classNames: "flex flex-col gap-3 p-4"
72
- }, title && /* @__PURE__ */ React.createElement("h1", {
73
- className: "text-xl font-semibold"
74
- }, title), showHero && /* @__PURE__ */ React.createElement("img", {
75
- src: imageUrl,
76
- alt: "",
77
- className: "rounded w-full object-cover max-h-72",
78
- loading: "lazy"
79
- }), content && /* @__PURE__ */ React.createElement(MarkdownView, {
80
- content
81
- }), meta && /* @__PURE__ */ React.createElement("div", {
82
- className: "text-xs text-subdued"
83
- }, meta)));
84
- });
85
- PostContent.displayName = "PostContent";
86
-
87
- // src/components/PostStack/PostStack.tsx
88
- import React2, { forwardRef, useCallback, useMemo as useMemo2, useState } from "react";
89
- import { Type } from "@dxos/echo";
90
- import { Card, Icon, ScrollArea as ScrollArea2, useTranslation } from "@dxos/react-ui";
91
- import { composable as composable2, composableProps } from "@dxos/react-ui";
92
- import { MarkdownView as MarkdownView2 } from "@dxos/react-ui-markdown";
93
- import { Focus, Mosaic, useMosaicContainer } from "@dxos/react-ui-mosaic";
94
- import { Subscription } from "#types";
95
- var PostStack = composable2(({ posts = [], currentId, onAction, ...props }, forwardedRef) => {
96
- const [viewport, setViewport] = useState(null);
97
- const items = useMemo2(() => posts.map((post) => ({
98
- post,
99
- onAction
100
- })), [
101
- posts,
102
- onAction
103
- ]);
104
- const handleCurrentChange = useCallback((id) => {
105
- if (id) {
106
- onAction?.({
107
- type: "current",
108
- postId: id
109
- });
110
- }
111
- }, [
112
- onAction
113
- ]);
114
- const handleKeyDown = useCallback((event) => {
115
- if (event.key === "Enter") {
116
- event.preventDefault();
117
- document.activeElement?.click();
118
- }
119
- }, []);
120
- return /* @__PURE__ */ React2.createElement(Focus.Group, {
121
- asChild: true,
122
- ...composableProps(props),
123
- onKeyDown: handleKeyDown,
124
- ref: forwardedRef
125
- }, /* @__PURE__ */ React2.createElement(Mosaic.Container, {
126
- asChild: true,
127
- withFocus: true,
128
- autoScroll: viewport,
129
- currentId,
130
- onCurrentChange: handleCurrentChange
131
- }, /* @__PURE__ */ React2.createElement(ScrollArea2.Root, {
132
- orientation: "vertical",
133
- padding: true,
134
- centered: true
135
- }, /* @__PURE__ */ React2.createElement(ScrollArea2.Viewport, {
136
- ref: setViewport
137
- }, /* @__PURE__ */ React2.createElement(Mosaic.VirtualStack, {
138
- Tile: PostTile,
139
- classNames: "my-2",
140
- gap: 8,
141
- items,
142
- draggable: false,
143
- getId: (item) => item.post.id,
144
- getScrollElement: () => viewport,
145
- estimateSize: () => 120
146
- })))));
147
- });
148
- PostStack.displayName = "PostStack";
149
- var PostTile = /* @__PURE__ */ forwardRef(({ data, location, current }, forwardedRef) => {
150
- const post = data?.post;
151
- const { setCurrentId } = useMosaicContainer("PostTile");
152
- const { t } = useTranslation(Type.getTypename(Subscription.Post));
153
- const handleCurrentChange = useCallback(() => {
154
- if (post) {
155
- setCurrentId(post.id);
156
- }
157
- }, [
158
- post,
159
- setCurrentId
160
- ]);
161
- if (!post) {
162
- return null;
163
- }
164
- const published = post.published ? new Date(post.published).toLocaleDateString() : void 0;
165
- return /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
166
- asChild: true,
167
- classNames: "dx-hover dx-current",
168
- id: post.id,
169
- data,
170
- location
171
- }, /* @__PURE__ */ React2.createElement(Focus.Item, {
172
- asChild: true,
173
- current,
174
- onCurrentChange: handleCurrentChange
175
- }, /* @__PURE__ */ React2.createElement(Card.Root, {
176
- ref: forwardedRef,
177
- fullWidth: true
178
- }, /* @__PURE__ */ React2.createElement(Card.Header, null, /* @__PURE__ */ React2.createElement(Card.Block, null, /* @__PURE__ */ React2.createElement(Icon, {
179
- icon: "ph--dot-outline--regular"
180
- })), /* @__PURE__ */ React2.createElement(Card.Text, {
181
- classNames: "truncate"
182
- }, post.title ?? t("post-title.placeholder")), post.link && /* @__PURE__ */ React2.createElement(Card.Block, {
183
- end: true
184
- }, /* @__PURE__ */ React2.createElement("a", {
185
- href: post.link,
186
- target: "_blank",
187
- rel: "noreferrer",
188
- className: "shrink-0"
189
- }, /* @__PURE__ */ React2.createElement(Icon, {
190
- icon: "ph--arrow-square-out--regular",
191
- size: 4
192
- })))), /* @__PURE__ */ React2.createElement(Card.Body, null, post.author && /* @__PURE__ */ React2.createElement(Card.Row, null, /* @__PURE__ */ React2.createElement(Card.Block, null, /* @__PURE__ */ React2.createElement(Icon, {
193
- icon: "ph--user--regular"
194
- })), /* @__PURE__ */ React2.createElement(Card.Text, {
195
- variant: "description"
196
- }, post.author)), (post.description || post.content) && /* @__PURE__ */ React2.createElement(Card.Row, null, /* @__PURE__ */ React2.createElement(MarkdownView2, {
197
- content: post.description ?? post.content,
198
- classNames: "line-clamp-5 text-sm text-description"
199
- })), published && /* @__PURE__ */ React2.createElement(Card.Row, null, /* @__PURE__ */ React2.createElement(Card.Block, null, /* @__PURE__ */ React2.createElement(Icon, {
200
- icon: "ph--calendar--regular"
201
- })), /* @__PURE__ */ React2.createElement(Card.Text, {
202
- variant: "description"
203
- }, published))))));
204
- });
205
- PostTile.displayName = "PostTile";
206
-
207
- // src/components/SubscriptionStack/SubscriptionStack.tsx
208
- import React3, { forwardRef as forwardRef2, useCallback as useCallback2, useMemo as useMemo3, useState as useState2 } from "react";
209
- import { Card as Card2, Icon as Icon2, ScrollArea as ScrollArea3 } from "@dxos/react-ui";
210
- import { composable as composable3, composableProps as composableProps2 } from "@dxos/react-ui";
211
- import { Focus as Focus2, Mosaic as Mosaic2, useMosaicContainer as useMosaicContainer2 } from "@dxos/react-ui-mosaic";
212
- var SubscriptionStack = composable3(({ feeds = [], currentId, onAction, ...props }, forwardedRef) => {
213
- const [viewport, setViewport] = useState2(null);
214
- const items = useMemo3(() => feeds.map((feed) => ({
215
- feed,
216
- onAction
217
- })), [
218
- feeds,
219
- onAction
220
- ]);
221
- const handleCurrentChange = useCallback2((id) => {
222
- if (id) {
223
- onAction?.({
224
- type: "current",
225
- feedId: id
226
- });
227
- }
228
- }, [
229
- onAction
230
- ]);
231
- const handleKeyDown = useCallback2((event) => {
232
- if (event.key === "Enter") {
233
- event.preventDefault();
234
- document.activeElement?.click();
235
- }
236
- }, []);
237
- return /* @__PURE__ */ React3.createElement(Focus2.Group, {
238
- asChild: true,
239
- ...composableProps2(props),
240
- onKeyDown: handleKeyDown,
241
- ref: forwardedRef
242
- }, /* @__PURE__ */ React3.createElement(Mosaic2.Container, {
243
- asChild: true,
244
- withFocus: true,
245
- autoScroll: viewport,
246
- currentId,
247
- onCurrentChange: handleCurrentChange
248
- }, /* @__PURE__ */ React3.createElement(ScrollArea3.Root, {
249
- orientation: "vertical",
250
- padding: true,
251
- centered: true
252
- }, /* @__PURE__ */ React3.createElement(ScrollArea3.Viewport, {
253
- ref: setViewport
254
- }, /* @__PURE__ */ React3.createElement(Mosaic2.VirtualStack, {
255
- Tile: SubscriptionTile,
256
- classNames: "my-2",
257
- gap: 8,
258
- items,
259
- draggable: false,
260
- getId: (item) => item.feed.id,
261
- getScrollElement: () => viewport,
262
- estimateSize: () => 100
263
- })))));
264
- });
265
- SubscriptionStack.displayName = "SubscriptionStack";
266
- var icons = {
267
- "standard-site": {
268
- icon: "ph--article--regular",
269
- className: "text-sky-500"
270
- },
271
- "rss": {
272
- icon: "ph--rss--regular",
273
- className: "text-green-500"
274
- },
275
- "bluesky": {
276
- icon: "ph--butterfly--regular",
277
- className: "text-blue-500"
278
- }
279
- };
280
- var SubscriptionTile = /* @__PURE__ */ forwardRef2(({ data, location, current }, forwardedRef) => {
281
- const { feed, onAction } = data;
282
- const { setCurrentId } = useMosaicContainer2("SubscriptionTile");
283
- const { icon, className: iconClassName } = icons[feed.type ?? "rss"] || icons.rss;
284
- const handleCurrentChange = useCallback2(() => {
285
- setCurrentId(feed.id);
286
- }, [
287
- feed.id,
288
- setCurrentId
289
- ]);
290
- const menuItems = useMemo3(() => [
291
- {
292
- label: "Sync",
293
- onClick: () => onAction?.({
294
- type: "sync",
295
- feedId: feed.id
296
- })
297
- },
298
- {
299
- label: "Delete",
300
- onClick: () => onAction?.({
301
- type: "delete",
302
- feedId: feed.id
303
- })
304
- }
305
- ], [
306
- feed.id,
307
- onAction
308
- ]);
309
- return /* @__PURE__ */ React3.createElement(Mosaic2.Tile, {
310
- asChild: true,
311
- classNames: "dx-hover dx-current",
312
- id: feed.id,
313
- data,
314
- location
315
- }, /* @__PURE__ */ React3.createElement(Focus2.Item, {
316
- asChild: true,
317
- current,
318
- onCurrentChange: handleCurrentChange
319
- }, /* @__PURE__ */ React3.createElement(Card2.Root, {
320
- ref: forwardedRef
321
- }, /* @__PURE__ */ React3.createElement(Card2.Header, null, /* @__PURE__ */ React3.createElement(Card2.Block, null, /* @__PURE__ */ React3.createElement(Icon2, {
322
- icon,
323
- classNames: iconClassName
324
- })), /* @__PURE__ */ React3.createElement(Card2.Title, null, feed.name ?? "Untitled feed"), /* @__PURE__ */ React3.createElement(Card2.Menu, {
325
- items: menuItems
326
- })), /* @__PURE__ */ React3.createElement(Card2.Body, null, feed.description && /* @__PURE__ */ React3.createElement(Card2.Row, null, /* @__PURE__ */ React3.createElement(Card2.Text, {
327
- variant: "description"
328
- }, feed.description))))));
329
- });
330
- SubscriptionTile.displayName = "SubscriptionTile";
331
- export {
332
- PostContent,
333
- PostStack,
334
- SubscriptionStack,
335
- contentHasImage,
336
- dedupeImagesInMarkdown
337
- };
338
- //# sourceMappingURL=index.mjs.map