@nodaro/shared 3.31.0 → 3.33.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 (378) hide show
  1. package/README.md +17 -0
  2. package/dist/chunk-23FJQTEA.js +1604 -0
  3. package/dist/chunk-23FJQTEA.js.map +1 -0
  4. package/dist/chunk-2NIQO2J3.cjs +54 -0
  5. package/dist/chunk-2NIQO2J3.cjs.map +1 -0
  6. package/dist/chunk-2NQLSLSN.cjs +19 -0
  7. package/dist/chunk-2NQLSLSN.cjs.map +1 -0
  8. package/dist/chunk-2OJIVO7R.cjs +32 -0
  9. package/dist/chunk-2OJIVO7R.cjs.map +1 -0
  10. package/dist/chunk-2RF4Z7KG.cjs +803 -0
  11. package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
  12. package/dist/chunk-3RYKIUAE.js +86 -0
  13. package/dist/chunk-3RYKIUAE.js.map +1 -0
  14. package/dist/chunk-44I73CQS.cjs +194 -0
  15. package/dist/chunk-44I73CQS.cjs.map +1 -0
  16. package/dist/chunk-5PC6JBGJ.cjs +1419 -0
  17. package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
  18. package/dist/chunk-5RU2HCW2.js +30 -0
  19. package/dist/chunk-5RU2HCW2.js.map +1 -0
  20. package/dist/chunk-5RYLK3MQ.js +267 -0
  21. package/dist/chunk-5RYLK3MQ.js.map +1 -0
  22. package/dist/chunk-5THUHJ3E.js +46 -0
  23. package/dist/chunk-5THUHJ3E.js.map +1 -0
  24. package/dist/chunk-6DAWSVX2.cjs +103 -0
  25. package/dist/chunk-6DAWSVX2.cjs.map +1 -0
  26. package/dist/chunk-6WZ2VN7V.js +920 -0
  27. package/dist/chunk-6WZ2VN7V.js.map +1 -0
  28. package/dist/chunk-7G7G42KS.js +86 -0
  29. package/dist/chunk-7G7G42KS.js.map +1 -0
  30. package/dist/chunk-7Z5LUTGU.js +1567 -0
  31. package/dist/chunk-7Z5LUTGU.js.map +1 -0
  32. package/dist/chunk-AINCI23X.js +2171 -0
  33. package/dist/chunk-AINCI23X.js.map +1 -0
  34. package/dist/chunk-BG5D5CZ6.js +1922 -0
  35. package/dist/chunk-BG5D5CZ6.js.map +1 -0
  36. package/dist/chunk-CK3GK34R.js +1381 -0
  37. package/dist/chunk-CK3GK34R.js.map +1 -0
  38. package/dist/chunk-CUH22J4D.js +17 -0
  39. package/dist/chunk-CUH22J4D.js.map +1 -0
  40. package/dist/chunk-D26ENTN2.cjs +1770 -0
  41. package/dist/chunk-D26ENTN2.cjs.map +1 -0
  42. package/dist/chunk-D6GNRSCV.cjs +2017 -0
  43. package/dist/chunk-D6GNRSCV.cjs.map +1 -0
  44. package/dist/chunk-FBV5DF6D.js +95 -0
  45. package/dist/chunk-FBV5DF6D.js.map +1 -0
  46. package/dist/chunk-FG4E7MTG.cjs +4 -0
  47. package/dist/chunk-FG4E7MTG.cjs.map +1 -0
  48. package/dist/chunk-FT5CF6IA.js +42 -0
  49. package/dist/chunk-FT5CF6IA.js.map +1 -0
  50. package/dist/chunk-G6IIVKMO.js +26 -0
  51. package/dist/chunk-G6IIVKMO.js.map +1 -0
  52. package/dist/chunk-HC7VKIV5.cjs +430 -0
  53. package/dist/chunk-HC7VKIV5.cjs.map +1 -0
  54. package/dist/chunk-HGC5JNVA.cjs +1503 -0
  55. package/dist/chunk-HGC5JNVA.cjs.map +1 -0
  56. package/dist/chunk-HKFMXNVQ.cjs +1273 -0
  57. package/dist/chunk-HKFMXNVQ.cjs.map +1 -0
  58. package/dist/chunk-HRXEZ3SX.cjs +526 -0
  59. package/dist/chunk-HRXEZ3SX.cjs.map +1 -0
  60. package/dist/chunk-HSHCCBIV.js +255 -0
  61. package/dist/chunk-HSHCCBIV.js.map +1 -0
  62. package/dist/chunk-HUR6ZJ7S.cjs +159 -0
  63. package/dist/chunk-HUR6ZJ7S.cjs.map +1 -0
  64. package/dist/chunk-J7BMO73N.cjs +114 -0
  65. package/dist/chunk-J7BMO73N.cjs.map +1 -0
  66. package/dist/chunk-JFS3NWZ5.cjs +1714 -0
  67. package/dist/chunk-JFS3NWZ5.cjs.map +1 -0
  68. package/dist/chunk-JL4C5VJ7.cjs +488 -0
  69. package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
  70. package/dist/chunk-JSGIEF6Z.cjs +1087 -0
  71. package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
  72. package/dist/chunk-JWA5SGCS.js +203 -0
  73. package/dist/chunk-JWA5SGCS.js.map +1 -0
  74. package/dist/chunk-K3LLGRK7.cjs +3545 -0
  75. package/dist/chunk-K3LLGRK7.cjs.map +1 -0
  76. package/dist/chunk-KU6S7IYV.cjs +210 -0
  77. package/dist/chunk-KU6S7IYV.cjs.map +1 -0
  78. package/dist/chunk-M36G6SRP.js +447 -0
  79. package/dist/chunk-M36G6SRP.js.map +1 -0
  80. package/dist/chunk-M7GQBRZU.cjs +1963 -0
  81. package/dist/chunk-M7GQBRZU.cjs.map +1 -0
  82. package/dist/chunk-MRXGWL42.cjs +4 -0
  83. package/dist/chunk-MRXGWL42.cjs.map +1 -0
  84. package/dist/chunk-NEJ2PV4C.cjs +211 -0
  85. package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
  86. package/dist/chunk-OTATNBMD.js +141 -0
  87. package/dist/chunk-OTATNBMD.js.map +1 -0
  88. package/dist/chunk-OZSACQ2V.js +471 -0
  89. package/dist/chunk-OZSACQ2V.js.map +1 -0
  90. package/dist/chunk-PHZ23DP3.js +1782 -0
  91. package/dist/chunk-PHZ23DP3.js.map +1 -0
  92. package/dist/chunk-PQHS255G.js +1369 -0
  93. package/dist/chunk-PQHS255G.js.map +1 -0
  94. package/dist/chunk-PRYE7AZQ.cjs +1227 -0
  95. package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
  96. package/dist/chunk-PVJBAPYJ.js +404 -0
  97. package/dist/chunk-PVJBAPYJ.js.map +1 -0
  98. package/dist/chunk-PXFQVLBX.js +776 -0
  99. package/dist/chunk-PXFQVLBX.js.map +1 -0
  100. package/dist/chunk-QA3MVQ32.js +21 -0
  101. package/dist/chunk-QA3MVQ32.js.map +1 -0
  102. package/dist/chunk-QJRP44ZO.js +769 -0
  103. package/dist/chunk-QJRP44ZO.js.map +1 -0
  104. package/dist/chunk-SAW5OK36.cjs +54 -0
  105. package/dist/chunk-SAW5OK36.cjs.map +1 -0
  106. package/dist/chunk-SES6GDBQ.cjs +624 -0
  107. package/dist/chunk-SES6GDBQ.cjs.map +1 -0
  108. package/dist/chunk-SFW3UB2P.js +31 -0
  109. package/dist/chunk-SFW3UB2P.js.map +1 -0
  110. package/dist/chunk-TNPDV7I4.cjs +2346 -0
  111. package/dist/chunk-TNPDV7I4.cjs.map +1 -0
  112. package/dist/chunk-TU33KYKW.cjs +25 -0
  113. package/dist/chunk-TU33KYKW.cjs.map +1 -0
  114. package/dist/chunk-TZBIY5C3.js +187 -0
  115. package/dist/chunk-TZBIY5C3.js.map +1 -0
  116. package/dist/chunk-TZE673G6.js +3 -0
  117. package/dist/chunk-TZE673G6.js.map +1 -0
  118. package/dist/chunk-UCFWI6D4.js +29 -0
  119. package/dist/chunk-UCFWI6D4.js.map +1 -0
  120. package/dist/chunk-UTQSSKSG.js +1164 -0
  121. package/dist/chunk-UTQSSKSG.js.map +1 -0
  122. package/dist/chunk-VA42637J.cjs +287 -0
  123. package/dist/chunk-VA42637J.cjs.map +1 -0
  124. package/dist/chunk-VNQRI2RO.cjs +1047 -0
  125. package/dist/chunk-VNQRI2RO.cjs.map +1 -0
  126. package/dist/chunk-VXPLKQWY.cjs +821 -0
  127. package/dist/chunk-VXPLKQWY.cjs.map +1 -0
  128. package/dist/chunk-WD6HJRBG.cjs +197 -0
  129. package/dist/chunk-WD6HJRBG.cjs.map +1 -0
  130. package/dist/chunk-WDIBOWAA.js +1054 -0
  131. package/dist/chunk-WDIBOWAA.js.map +1 -0
  132. package/dist/chunk-WKOIGLQX.cjs +38 -0
  133. package/dist/chunk-WKOIGLQX.cjs.map +1 -0
  134. package/dist/chunk-WNVQ3SMB.cjs +96 -0
  135. package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
  136. package/dist/chunk-WRSWH7US.cjs +285 -0
  137. package/dist/chunk-WRSWH7US.cjs.map +1 -0
  138. package/dist/chunk-XGFTL5XY.js +181 -0
  139. package/dist/chunk-XGFTL5XY.js.map +1 -0
  140. package/dist/chunk-XNISPHTZ.js +1039 -0
  141. package/dist/chunk-XNISPHTZ.js.map +1 -0
  142. package/dist/chunk-Y2PM3FFL.js +3 -0
  143. package/dist/chunk-Y2PM3FFL.js.map +1 -0
  144. package/dist/chunk-YBPBK5KI.js +1030 -0
  145. package/dist/chunk-YBPBK5KI.js.map +1 -0
  146. package/dist/chunk-YWNYGYI7.cjs +31 -0
  147. package/dist/chunk-YWNYGYI7.cjs.map +1 -0
  148. package/dist/chunk-YYV35XOS.js +122 -0
  149. package/dist/chunk-YYV35XOS.js.map +1 -0
  150. package/dist/chunk-Z2OL5AJD.cjs +133 -0
  151. package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
  152. package/dist/chunk-ZDFHA2EC.js +572 -0
  153. package/dist/chunk-ZDFHA2EC.js.map +1 -0
  154. package/dist/chunk-ZL7UM6PU.cjs +34 -0
  155. package/dist/chunk-ZL7UM6PU.cjs.map +1 -0
  156. package/dist/chunk-ZNZDQAXN.js +175 -0
  157. package/dist/chunk-ZNZDQAXN.js.map +1 -0
  158. package/dist/chunk-ZO5PBBFX.js +3497 -0
  159. package/dist/chunk-ZO5PBBFX.js.map +1 -0
  160. package/dist/chunk-ZRL2UFTH.cjs +1073 -0
  161. package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
  162. package/dist/entries/apps.cjs +155 -0
  163. package/dist/entries/apps.cjs.map +1 -0
  164. package/dist/entries/apps.d.cts +292 -0
  165. package/dist/entries/apps.d.ts +292 -0
  166. package/dist/entries/apps.js +10 -0
  167. package/dist/entries/apps.js.map +1 -0
  168. package/dist/entries/captions.cjs +124 -0
  169. package/dist/entries/captions.cjs.map +1 -0
  170. package/dist/entries/captions.d.cts +354 -0
  171. package/dist/entries/captions.d.ts +354 -0
  172. package/dist/entries/captions.js +3 -0
  173. package/dist/entries/captions.js.map +1 -0
  174. package/dist/entries/catalogs.cjs +165 -0
  175. package/dist/entries/catalogs.cjs.map +1 -0
  176. package/dist/entries/catalogs.d.cts +385 -0
  177. package/dist/entries/catalogs.d.ts +385 -0
  178. package/dist/entries/catalogs.js +4 -0
  179. package/dist/entries/catalogs.js.map +1 -0
  180. package/dist/entries/credits.cjs +596 -0
  181. package/dist/entries/credits.cjs.map +1 -0
  182. package/dist/entries/credits.d.cts +1460 -0
  183. package/dist/entries/credits.d.ts +1460 -0
  184. package/dist/entries/credits.js +11 -0
  185. package/dist/entries/credits.js.map +1 -0
  186. package/dist/entries/edl.cjs +409 -0
  187. package/dist/entries/edl.cjs.map +1 -0
  188. package/dist/entries/edl.d.cts +1199 -0
  189. package/dist/entries/edl.d.ts +1199 -0
  190. package/dist/entries/edl.js +4 -0
  191. package/dist/entries/edl.js.map +1 -0
  192. package/dist/entries/entities.cjs +530 -0
  193. package/dist/entries/entities.cjs.map +1 -0
  194. package/dist/entries/entities.d.cts +1371 -0
  195. package/dist/entries/entities.d.ts +1371 -0
  196. package/dist/entries/entities.js +5 -0
  197. package/dist/entries/entities.js.map +1 -0
  198. package/dist/entries/i18n.cjs +48 -0
  199. package/dist/entries/i18n.cjs.map +1 -0
  200. package/dist/entries/i18n.d.cts +69 -0
  201. package/dist/entries/i18n.d.ts +69 -0
  202. package/dist/entries/i18n.js +3 -0
  203. package/dist/entries/i18n.js.map +1 -0
  204. package/dist/entries/llm-models.cjs +177 -0
  205. package/dist/entries/llm-models.cjs.map +1 -0
  206. package/dist/entries/llm-models.d.cts +435 -0
  207. package/dist/entries/llm-models.d.ts +435 -0
  208. package/dist/entries/llm-models.js +4 -0
  209. package/dist/entries/llm-models.js.map +1 -0
  210. package/dist/entries/media.cjs +335 -0
  211. package/dist/entries/media.cjs.map +1 -0
  212. package/dist/entries/media.d.cts +518 -0
  213. package/dist/entries/media.d.ts +518 -0
  214. package/dist/entries/media.js +6 -0
  215. package/dist/entries/media.js.map +1 -0
  216. package/dist/entries/model-catalog.cjs +259 -0
  217. package/dist/entries/model-catalog.cjs.map +1 -0
  218. package/dist/entries/model-catalog.d.cts +202 -0
  219. package/dist/entries/model-catalog.d.ts +202 -0
  220. package/dist/entries/model-catalog.js +6 -0
  221. package/dist/entries/model-catalog.js.map +1 -0
  222. package/dist/entries/models.cjs +833 -0
  223. package/dist/entries/models.cjs.map +1 -0
  224. package/dist/entries/models.d.cts +287 -0
  225. package/dist/entries/models.d.ts +287 -0
  226. package/dist/entries/models.js +8 -0
  227. package/dist/entries/models.js.map +1 -0
  228. package/dist/entries/nodes.cjs +789 -0
  229. package/dist/entries/nodes.cjs.map +1 -0
  230. package/dist/entries/nodes.d.cts +1600 -0
  231. package/dist/entries/nodes.d.ts +1600 -0
  232. package/dist/entries/nodes.js +16 -0
  233. package/dist/entries/nodes.js.map +1 -0
  234. package/dist/entries/organizations.cjs +80 -0
  235. package/dist/entries/organizations.cjs.map +1 -0
  236. package/dist/entries/organizations.d.cts +466 -0
  237. package/dist/entries/organizations.d.ts +466 -0
  238. package/dist/entries/organizations.js +3 -0
  239. package/dist/entries/organizations.js.map +1 -0
  240. package/dist/entries/pipeline.cjs +594 -0
  241. package/dist/entries/pipeline.cjs.map +1 -0
  242. package/dist/entries/pipeline.d.cts +2617 -0
  243. package/dist/entries/pipeline.d.ts +2617 -0
  244. package/dist/entries/pipeline.js +5 -0
  245. package/dist/entries/pipeline.js.map +1 -0
  246. package/dist/entries/scene3d.cjs +704 -0
  247. package/dist/entries/scene3d.cjs.map +1 -0
  248. package/dist/entries/scene3d.d.cts +4284 -0
  249. package/dist/entries/scene3d.d.ts +4284 -0
  250. package/dist/entries/scene3d.js +3 -0
  251. package/dist/entries/scene3d.js.map +1 -0
  252. package/dist/entries/social.cjs +714 -0
  253. package/dist/entries/social.cjs.map +1 -0
  254. package/dist/entries/social.d.cts +1366 -0
  255. package/dist/entries/social.d.ts +1366 -0
  256. package/dist/entries/social.js +5 -0
  257. package/dist/entries/social.js.map +1 -0
  258. package/dist/entries/types.cjs +13 -0
  259. package/dist/entries/types.cjs.map +1 -0
  260. package/dist/entries/types.d.cts +162 -0
  261. package/dist/entries/types.d.ts +162 -0
  262. package/dist/entries/types.js +4 -0
  263. package/dist/entries/types.js.map +1 -0
  264. package/dist/entries/ugc.cjs +279 -0
  265. package/dist/entries/ugc.cjs.map +1 -0
  266. package/dist/entries/ugc.d.cts +575 -0
  267. package/dist/entries/ugc.d.ts +575 -0
  268. package/dist/entries/ugc.js +6 -0
  269. package/dist/entries/ugc.js.map +1 -0
  270. package/dist/entries/video.cjs +549 -0
  271. package/dist/entries/video.cjs.map +1 -0
  272. package/dist/entries/video.d.cts +1791 -0
  273. package/dist/entries/video.d.ts +1791 -0
  274. package/dist/entries/video.js +8 -0
  275. package/dist/entries/video.js.map +1 -0
  276. package/dist/entries/workflow.cjs +574 -0
  277. package/dist/entries/workflow.cjs.map +1 -0
  278. package/dist/entries/workflow.d.cts +1743 -0
  279. package/dist/entries/workflow.d.ts +1743 -0
  280. package/dist/entries/workflow.js +5 -0
  281. package/dist/entries/workflow.js.map +1 -0
  282. package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
  283. package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
  284. package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
  285. package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
  286. package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
  287. package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
  288. package/dist/index.cjs +7747 -27084
  289. package/dist/index.cjs.map +1 -1
  290. package/dist/index.d.cts +32 -24198
  291. package/dist/index.d.ts +32 -24198
  292. package/dist/index.js +40 -25220
  293. package/dist/index.js.map +1 -1
  294. package/dist/model-catalog-V-ZNzRSd.d.cts +651 -0
  295. package/dist/model-catalog-V-ZNzRSd.d.ts +651 -0
  296. package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
  297. package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
  298. package/dist/presentation-utils-D0kxsWf9.d.cts +92 -0
  299. package/dist/presentation-utils-pZwlEAzo.d.ts +92 -0
  300. package/dist/scene-node-types-C3kl_zyK.d.cts +1949 -0
  301. package/dist/scene-node-types-C3kl_zyK.d.ts +1949 -0
  302. package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
  303. package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
  304. package/dist/types-BRlFPEru.d.cts +511 -0
  305. package/dist/types-BRlFPEru.d.ts +511 -0
  306. package/dist/types-DffyGSy5.d.cts +67 -0
  307. package/dist/types-DffyGSy5.d.ts +67 -0
  308. package/package.json +102 -1
  309. package/src/__tests__/add-captions-plan.test.ts +6 -2
  310. package/src/__tests__/caption-edge-dash.test.ts +23 -0
  311. package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
  312. package/src/__tests__/input-field-extra-keys.test.ts +1 -0
  313. package/src/__tests__/model-makers.test.ts +76 -0
  314. package/src/__tests__/no-internal-imports.test.ts +1 -1
  315. package/src/__tests__/node-aspect-ratio.test.ts +25 -0
  316. package/src/__tests__/node-runtime-keys.test.ts +9 -0
  317. package/src/__tests__/package-entries.test.ts +50 -0
  318. package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
  319. package/src/__tests__/presentation-utils.test.ts +15 -0
  320. package/src/__tests__/preview-gate-use-case.test.ts +151 -0
  321. package/src/__tests__/private-host.test.ts +53 -0
  322. package/src/__tests__/run-continuation.test.ts +7 -1
  323. package/src/__tests__/site-capture-node.test.ts +58 -0
  324. package/src/__tests__/ugc-lane-wires.test.ts +228 -0
  325. package/src/__tests__/ugc-node-wires.test.ts +9 -3
  326. package/src/__tests__/ugc-run-state.test.ts +5 -4
  327. package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
  328. package/src/__tests__/video-analysis-pricing.test.ts +6 -6
  329. package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
  330. package/src/add-captions-plan.ts +9 -3
  331. package/src/caption-edge-dash.ts +33 -0
  332. package/src/component-types.ts +9 -0
  333. package/src/credit-estimators/index.ts +22 -1
  334. package/src/credit-estimators/pitch-tempo.ts +15 -1
  335. package/src/credit-estimators/speech.ts +72 -4
  336. package/src/credit-estimators/unit-quote.ts +52 -0
  337. package/src/credit-estimators/video-sfx.ts +15 -0
  338. package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
  339. package/src/credit-identifiers.ts +62 -17
  340. package/src/entity-image-handle.ts +2 -0
  341. package/src/entries/apps.ts +63 -0
  342. package/src/entries/captions.ts +34 -0
  343. package/src/entries/catalogs.ts +65 -0
  344. package/src/entries/credits.ts +105 -0
  345. package/src/entries/edl.ts +42 -0
  346. package/src/entries/entities.ts +144 -0
  347. package/src/entries/i18n.ts +31 -0
  348. package/src/entries/llm-models.ts +63 -0
  349. package/src/entries/media.ts +36 -0
  350. package/src/entries/model-catalog.ts +95 -0
  351. package/src/entries/models.ts +266 -0
  352. package/src/entries/nodes.ts +245 -0
  353. package/src/entries/organizations.ts +9 -0
  354. package/src/entries/pipeline.ts +43 -0
  355. package/src/entries/scene3d.ts +27 -0
  356. package/src/entries/social.ts +297 -0
  357. package/src/entries/types.ts +26 -0
  358. package/src/entries/ugc.ts +14 -0
  359. package/src/entries/video.ts +59 -0
  360. package/src/entries/workflow.ts +172 -0
  361. package/src/fan-out-rows.ts +2 -0
  362. package/src/index.ts +25 -1845
  363. package/src/json-kinds.ts +4 -0
  364. package/src/model-catalog.ts +243 -34
  365. package/src/node-mappable-fields.ts +1 -0
  366. package/src/node-run-routes.ts +2 -0
  367. package/src/node-runtime-keys.ts +8 -0
  368. package/src/normalize-node-params.ts +30 -0
  369. package/src/presentation-utils.ts +12 -0
  370. package/src/preview-gate.ts +92 -14
  371. package/src/private-host.ts +89 -59
  372. package/src/producer-types.ts +16 -2
  373. package/src/run-continuation.ts +21 -0
  374. package/src/site-capture-node.ts +82 -0
  375. package/src/ugc-lane-wires.ts +246 -0
  376. package/src/ugc-node-wires.ts +37 -7
  377. package/src/ugc-run-state.ts +5 -3
  378. package/src/video-analysis-pricing.ts +31 -29
@@ -0,0 +1,1366 @@
1
+ /**
2
+ * Auto-upgrade Pinterest CDN URLs to their highest-resolution variant.
3
+ *
4
+ * `i.pinimg.com` serves the same image at multiple sizes via a path-prefix
5
+ * segment: `/236x/`, `/474x/`, `/564x/`, `/736x/`, `/1200x/`, `/originals/`.
6
+ * The `originals` segment returns the source resolution — much better input
7
+ * for `describe-image`, `image-to-image`, `face-swap`, etc.
8
+ *
9
+ * Returns the input unchanged when:
10
+ * - the URL doesn't parse as a URL
11
+ * - the host isn't `i.pinimg.com`
12
+ * - the path doesn't start with a recognized size segment
13
+ *
14
+ * Used by the upload-image node when a user pastes a Pinterest URL, and by
15
+ * any backend describe-image-style fetch that wants the highest-res input.
16
+ */
17
+ declare function normalizePinterestUrl(url: string): string;
18
+
19
+ declare const SCRAPER_ACTOR_IDS: readonly ["content-crawler", "google-search", "instagram", "tiktok", "rss"];
20
+ type ScraperActorId = (typeof SCRAPER_ACTOR_IDS)[number];
21
+ declare const SCRAPER_ACTOR_LABELS: Record<ScraperActorId, string>;
22
+ /** Credit costs per composite SKU — must stay in sync with STATIC_CREDIT_COSTS in backend.
23
+ *
24
+ * "Must stay in sync" was doing no work: these were left at the pre-2026-07-30
25
+ * credit base while the backend moved, so every SKU here read a tenth of the
26
+ * real price. Values below are copied from `model_pricing`, which is what the
27
+ * user is actually charged. */
28
+ declare const SCRAPER_CREDIT_COSTS: Record<string, number>;
29
+ declare function isScraperActor(value: unknown): value is ScraperActorId;
30
+ interface ScraperCreditInput {
31
+ actor: ScraperActorId;
32
+ mode?: "page" | "site";
33
+ }
34
+ declare function buildScraperCreditId(input: ScraperCreditInput): string;
35
+ /**
36
+ * Resolve the credit identifier from an unvalidated request body.
37
+ * Falls back to a fixed default SKU (google-search) on missing/invalid actor
38
+ * so misrouted requests reserve a known mid-tier price, not the max-cost tier.
39
+ */
40
+ declare function resolveScraperCreditId(body: unknown): string;
41
+
42
+ /**
43
+ * Scalar fields exposed in the Extract Field dropdown when the direct
44
+ * upstream is a web-scrape node. Nested / non-scalar fields (authorMeta,
45
+ * musicMeta) are intentionally omitted — users access them via the
46
+ * "Custom path..." option.
47
+ *
48
+ * content-crawler paths are pre-dotted (`pages.url`, `pages.markdown`)
49
+ * because its root shape is `{ pages: [...] }`, not a top-level array.
50
+ */
51
+ declare const SCRAPER_OUTPUT_FIELDS: Record<ScraperActorId, readonly string[]>;
52
+
53
+ /**
54
+ * Shared constants for social post nodes.
55
+ *
56
+ * Used by both the frontend DAG executor and backend orchestrator so input
57
+ * routing + API validation agree on which node types are social posts and
58
+ * on Instagram's carousel item limits.
59
+ */
60
+ /** Node types that publish to a social platform via POST /v1/social/publish.
61
+ * The 7 per-platform nodes hardcode their platform via `node.type`;
62
+ * `publish-social` is the UNIFIED node whose platform is derived from the
63
+ * chosen connection (`data.platform`) instead. All shared-set-driven routing
64
+ * (carousel accumulation, caption, refMap gate) covers it automatically. */
65
+ declare const SOCIAL_POST_NODE_TYPES: Set<string>;
66
+ /** The platform each per-platform social post node publishes to. The unified
67
+ * `publish-social` node is absent on purpose: its platform comes from the
68
+ * chosen connection (`data.platform`). */
69
+ declare const SOCIAL_POST_NODE_PLATFORM: Readonly<Record<string, string>>;
70
+ /** Instagram carousel limits per Meta Graph API.
71
+ * Meta's documented limit is 10 items; sending >10 fails at container
72
+ * creation with "(#100) too little or too many attachments". */
73
+ declare const INSTAGRAM_CAROUSEL_MIN_ITEMS = 2;
74
+ declare const INSTAGRAM_CAROUSEL_MAX_ITEMS = 10;
75
+
76
+ /**
77
+ * The Telegram Account Trigger's named outputs — the wire contract between the
78
+ * Cloud connector that starts a run (it writes these keys into the run's
79
+ * trigger data) and everything that reads them: both workflow engines, the
80
+ * canvas card and the public node registry. A handle id IS the trigger-data
81
+ * key, so the two can never disagree.
82
+ *
83
+ * Structural vocabulary only: the keys and what each one carries. How the
84
+ * connector decides which key a post fills is not part of the contract.
85
+ */
86
+ /** The message itself — the card's original output. */
87
+ declare const TELEGRAM_ACCOUNT_TRIGGER_MESSAGE_HANDLE = "out";
88
+ /**
89
+ * Named outputs, in the order the card shows them. Exactly one of `videoLink`
90
+ * and `postText` carries a value in a run that is about a shared post; both
91
+ * are empty otherwise. Never undefined — an engine reading an empty one gets
92
+ * "", never the message text in its place.
93
+ */
94
+ declare const TELEGRAM_ACCOUNT_TRIGGER_POST_FIELDS: readonly ["videoLink", "postText", "postLink"];
95
+ type TelegramAccountTriggerPostField = (typeof TELEGRAM_ACCOUNT_TRIGGER_POST_FIELDS)[number];
96
+ /** Message facts carried alongside — read through trigger tokens and JSON-authored wires. */
97
+ declare const TELEGRAM_ACCOUNT_TRIGGER_MESSAGE_FIELDS: readonly ["chatId", "chatType", "messageId", "senderId"];
98
+ /** Every handle the card renders, `out` first. */
99
+ declare const TELEGRAM_ACCOUNT_TRIGGER_OUTPUT_HANDLES: readonly string[];
100
+ /**
101
+ * A handle naming one value of the run (a post field or a message fact) —
102
+ * every handle but the message itself. A wire from one carries that value,
103
+ * "" when the run has none, never the message in its place.
104
+ */
105
+ declare function isTelegramAccountTriggerNamedHandle(handle: unknown): handle is string;
106
+ /**
107
+ * What an account trigger listens to, and whether it listens: the settings
108
+ * only its owner may set. One canonical string, so the editor that changed a
109
+ * trigger and the server that arms it compare the same thing — the server
110
+ * arms a trigger the owner's editor named only while the stored node still
111
+ * says exactly what that editor set.
112
+ *
113
+ * It states what the trigger hears, not how the node spells it: in inbox mode
114
+ * the owner's own messages are always heard, so `includeOutgoing` reads as on
115
+ * there — a setting the panel does not show in that mode never decides a match.
116
+ * The account id is the one exception: it is read exactly as written, because
117
+ * the server never listens on one that is not written exactly (padded), and
118
+ * the editor shows such an id as no account of the owner's.
119
+ */
120
+ declare function telegramAccountListeningSignature(data: unknown): string;
121
+ /**
122
+ * The named outputs of one run, from its trigger data: every post field
123
+ * present (possibly ""), each message field only when it has a value.
124
+ */
125
+ declare function telegramAccountTriggerOutputs(triggerData: Record<string, unknown> | null | undefined): Record<string, string>;
126
+
127
+ /**
128
+ * Telegram Reply (`telegram-account-send`) — who writes the message and
129
+ * where it goes, as node data spells it. Structural vocabulary only: every
130
+ * destination is the run's OWNER — the chat of the post they shared, their
131
+ * Saved Messages, or their private chat with their own bot. How the Cloud
132
+ * connector sends is not part of the contract.
133
+ */
134
+ declare const TELEGRAM_ACCOUNT_SEND_NODE_TYPE = "telegram-account-send";
135
+ /** `account`: the owner's connected account writes. `bot`: the owner's own bot writes to them privately. */
136
+ declare const TELEGRAM_SEND_AS: readonly ["account", "bot"];
137
+ type TelegramSendAs = (typeof TELEGRAM_SEND_AS)[number];
138
+ /**
139
+ * Where an account-written message goes. `reply`: under the post that started
140
+ * the run, in its chat (a run started by the Telegram Account Trigger only).
141
+ * `saved`: the owner's Saved Messages. A bot always writes to the owner's
142
+ * private chat with it, so it has no destination to choose.
143
+ */
144
+ declare const TELEGRAM_SEND_DESTINATIONS: readonly ["reply", "saved"];
145
+ type TelegramSendDestination = (typeof TELEGRAM_SEND_DESTINATIONS)[number];
146
+ /** The node's `sendAs`, as every reader reads it: anything else is the account. */
147
+ declare function telegramSendAsOf(value: unknown): TelegramSendAs;
148
+ /** The node's `destination`, as every reader reads it: anything else is a reply. */
149
+ declare function telegramSendDestinationOf(value: unknown): TelegramSendDestination;
150
+
151
+ declare const META_ADS_SCRAPE_NODE_TYPE: "meta-ads-scrape";
152
+ /** The WIRE modes — what `POST /v1/meta-ads-scrape` accepts. */
153
+ declare const META_ADS_SCRAPE_MODES: readonly ["search", "pages"];
154
+ type MetaAdsScrapeMode = (typeof META_ADS_SCRAPE_MODES)[number];
155
+ /** The NODE modes — the wire modes plus the editor-only advertiser picker (runs as pages). */
156
+ declare const META_ADS_NODE_MODES: readonly ["search", "pages", "advertiser"];
157
+ type MetaAdsNodeMode = (typeof META_ADS_NODE_MODES)[number];
158
+ /** Coerce stored node data to a node mode; anything unknown is the default keyword search. */
159
+ declare function metaAdsNodeMode(value: unknown): MetaAdsNodeMode;
160
+ /** An advertiser the user picked by name — stored on the node, run as its Page url. */
161
+ interface MetaAdsAdvertiser {
162
+ readonly pageId: string;
163
+ readonly name: string;
164
+ /** The Facebook Page url. The actor resolves it to the Ad Library advertiser itself — the Page id and the advertiser id are NOT the same number. */
165
+ readonly url: string;
166
+ readonly imageUrl?: string;
167
+ readonly verified?: boolean;
168
+ }
169
+ /** How many matches an advertiser lookup returns — more than the pick cap, so a same-name brand can be told apart by its badge / avatar. */
170
+ declare const META_ADS_ADVERTISER_MAX_RESULTS = 8;
171
+ /** http(s) url on facebook.com (any subdomain) — the ONE predicate for a Page address, on the route's Zod and on stored picks alike. */
172
+ declare function isFacebookPageUrl(value: unknown): value is string;
173
+ /** A Page avatar lives on Meta's CDN; anything else is not stored (it would be fetched by every viewer's browser and our image proxy). */
174
+ declare function isMetaCdnImageUrl(value: unknown): value is string;
175
+ /** Stored / relayed advertisers, sanitized: a page id, a name, a facebook.com url, a Meta-CDN avatar; deduped by page id; at most `limit` (the pick cap by default). */
176
+ declare function metaAdsAdvertisersFrom(raw: unknown, limit?: number): MetaAdsAdvertiser[];
177
+ declare const META_ADS_SCRAPE_PERIODS: readonly ["24h", "7d", "30d", "all"];
178
+ type MetaAdsScrapePeriod = (typeof META_ADS_SCRAPE_PERIODS)[number];
179
+ declare const META_ADS_SCRAPE_STATUSES: readonly ["active", "inactive", "all"];
180
+ type MetaAdsScrapeStatus = (typeof META_ADS_SCRAPE_STATUSES)[number];
181
+ /** Meta's `publisher_platform` vocabulary — the values an ad's `platforms` carries and the filter the node accepts. */
182
+ declare const META_ADS_PLATFORMS: readonly ["FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK", "MESSENGER", "WHATSAPP", "THREADS"];
183
+ type MetaAdsPlatform = (typeof META_ADS_PLATFORMS)[number];
184
+ declare function isMetaAdsPlatform(value: unknown): value is MetaAdsPlatform;
185
+ /**
186
+ * Creative format, classified from the creative's measured pixels — the
187
+ * user's "phone vs web" question. `vertical` = Stories / Reels / mobile feed
188
+ * (9:16, 4:5), `square` = 1:1 (±5 %), `horizontal` = feed / web / banners
189
+ * (16:9, 1.91:1). One classifier for the route (node setting), the Results
190
+ * chips and the card, so they can never disagree.
191
+ */
192
+ declare const META_ADS_FORMATS: readonly ["vertical", "square", "horizontal"];
193
+ type MetaAdsFormat = (typeof META_ADS_FORMATS)[number];
194
+ type MetaAdsCreativeFormat = MetaAdsFormat | "unknown";
195
+ declare function isMetaAdsFormat(value: unknown): value is MetaAdsFormat;
196
+ /** The featured ad index, clamped so a rerun that returned fewer ads never indexes past the end. */
197
+ declare function clampMetaAdsFeaturedIndex(stored: unknown, count: number): number;
198
+ interface FeaturedMetaAdOutputs {
199
+ readonly text?: string;
200
+ readonly imageUrl?: string;
201
+ readonly videoUrl?: string;
202
+ }
203
+ /**
204
+ * What the node's typed `text` / `image` / `video` handles carry: the
205
+ * FEATURED ad's copy (headline + body), first image (else the video poster)
206
+ * and first video. ONE derivation for the route's output_data, the backend
207
+ * saved-output hydration and the editor's extractNodeOutput, so a thumb pick
208
+ * re-hydrates the handles identically everywhere.
209
+ */
210
+ declare function featuredMetaAdOutputs(json: unknown, featuredIndex: unknown): FeaturedMetaAdOutputs;
211
+ declare function classifyCreativeFormat(width: unknown, height: unknown): MetaAdsCreativeFormat;
212
+ /** Presets the config panel offers; the route accepts any integer 1..MAX_COUNT. */
213
+ declare const META_ADS_SCRAPE_COUNT_OPTIONS: readonly [10, 20, 50, 100];
214
+ declare const META_ADS_SCRAPE_DEFAULT_COUNT = 20;
215
+ declare const META_ADS_SCRAPE_MAX_COUNT = 100;
216
+ declare const META_ADS_SCRAPE_MAX_SOURCES = 5;
217
+ /** Meta caps Ad Library search terms at 100 characters. */
218
+ declare const META_ADS_SCRAPE_MAX_QUERY_LENGTH = 100;
219
+ declare const META_ADS_SCRAPE_DEFAULT_COUNTRY = "ALL";
220
+ /** Requested-total buckets. Sorted ascending; the last one is `MAX_COUNT × MAX_SOURCES`. */
221
+ declare const META_ADS_SCRAPE_TIERS: readonly [10, 20, 50, 100, 200, 500];
222
+ type MetaAdsScrapeTier = (typeof META_ADS_SCRAPE_TIERS)[number];
223
+ /**
224
+ * Optional per-ad AI analysis — the "expert competitor ad analyst" pass.
225
+ * Priced per REQUESTED ad like the scrape, by the analysing model's tier,
226
+ * and folded into the SAME tiered identifier so every quote (guard,
227
+ * reservation, card badge, run total, backend estimator) stays one SKU:
228
+ *
229
+ * meta-ads-scrape:<tier> tier
230
+ * meta-ads-scrape:<tier>:analysis tier × (1 + 3) standard models
231
+ * meta-ads-scrape:<tier>:analysis:economy tier × (1 + 1)
232
+ * meta-ads-scrape:<tier>:analysis:premium tier × (1 + 4)
233
+ *
234
+ * The per-ad SKUs (`meta-ads-analysis[:economy|:premium]`) price the
235
+ * SETTLEMENT: a run commits tier + per-ad × ads actually analysed and
236
+ * refunds the rest (an ad the model failed on, or one the deadline skipped).
237
+ */
238
+ declare const META_ADS_ANALYSIS_TIERS: readonly ["economy", "standard", "premium"];
239
+ type MetaAdsAnalysisTier = (typeof META_ADS_ANALYSIS_TIERS)[number];
240
+ declare const META_ADS_ANALYSIS_CREDITS_PER_AD: Record<MetaAdsAnalysisTier, number>;
241
+ declare const META_ADS_ANALYSIS_CREDIT_ID: "meta-ads-analysis";
242
+ /** The user's optional analyst focus, appended to the fixed prompt. */
243
+ declare const META_ADS_ANALYSIS_FOCUS_MAX = 500;
244
+ /** The per-ad settlement SKU for a tier (the bare id is the standard tier). */
245
+ declare function metaAdsAnalysisCreditId(tier: MetaAdsAnalysisTier): string;
246
+ /** The analysing model's tier; an absent model is the feature default. */
247
+ declare function metaAdsAnalysisTier(modelId?: unknown): MetaAdsAnalysisTier;
248
+ /** What one analysed ad carries (`ad.analysis`); fixed fields + string lists only — never a map (Gemini via KIE drops map fields). */
249
+ interface AdCreativeAnalysis {
250
+ readonly assetType: "static" | "motion" | "carousel" | "unknown";
251
+ readonly format: string;
252
+ readonly visualHooks: readonly string[];
253
+ readonly audiences: readonly string[];
254
+ readonly graphicIdentity: string;
255
+ readonly copywritingHooks: readonly string[];
256
+ readonly usps: readonly string[];
257
+ readonly cta: string;
258
+ readonly summary: string;
259
+ }
260
+ /** Read a stored analysis back defensively (a node's saved JSON is untrusted shape); null when there is none. */
261
+ declare function adCreativeAnalysisFrom(raw: unknown): AdCreativeAnalysis | null;
262
+ /**
263
+ * Credit cost per SKU — mirror of the backend `STATIC_CREDIT_COSTS` rows and
264
+ * migrations 428 / 429, for the frontend badge / estimator. 1 credit per
265
+ * requested ad at every tier, plus the analysis multiples above; the bare
266
+ * identifier is the pre-Zod fallback (mid tier, never the max).
267
+ */
268
+ declare const META_ADS_SCRAPE_CREDIT_COSTS: Record<string, number>;
269
+ declare const META_ADS_SCRAPE_FALLBACK_CREDIT_ID = "meta-ads-scrape:20";
270
+ /**
271
+ * Page urls are typed one per line in the config panel (a FieldMapping
272
+ * injects the same text); the route wants an array. Tolerates commas and
273
+ * whitespace as separators (a url never contains either) and an array that
274
+ * already went through this once.
275
+ */
276
+ declare function splitMetaAdsPageUrls(value: unknown): string[];
277
+ declare function isMetaAdsScrapeMode(value: unknown): value is MetaAdsScrapeMode;
278
+ /**
279
+ * Advertiser NAMES to resolve at run time (advertiser mode driven by the `in`
280
+ * input) — one per line or comma-separated. Unlike page urls, a name contains
281
+ * spaces, so this never splits on whitespace. Trimmed, de-duped, each 2..100
282
+ * chars, capped at `MAX_SOURCES`.
283
+ */
284
+ declare function splitMetaAdsAdvertiserNames(value: unknown): string[];
285
+ /** The node-data fields that decide what a run scrapes (and therefore what it costs). Index-signature so any node-data bag is accepted as-is. */
286
+ interface MetaAdsNodeSourceFields {
287
+ readonly [key: string]: unknown;
288
+ readonly mode?: unknown;
289
+ readonly query?: unknown;
290
+ readonly pageUrls?: unknown;
291
+ readonly advertisers?: unknown;
292
+ }
293
+ /**
294
+ * How many sources a run bills — the number the card badge, the run total,
295
+ * the pre-run estimator and the backend quote must all read, so an advertiser
296
+ * pick can never be quoted as one source while the server reserves five. An
297
+ * empty page list / no picks counts as one (the run then fails validation
298
+ * before anything is reserved).
299
+ */
300
+ declare function metaAdsScrapeSources(data: MetaAdsNodeSourceFields): number;
301
+ type MetaAdsWireSources = {
302
+ readonly mode: "search";
303
+ readonly query: string | undefined;
304
+ } | {
305
+ readonly mode: "pages";
306
+ readonly pageUrls: string[];
307
+ readonly advertiserNames?: string[];
308
+ };
309
+ /**
310
+ * The wire half of a request from node data — ONE mapping for the editor's
311
+ * executor and the orchestrator's payload builder. The keyword / page list
312
+ * falls back to the upstream text so a Prompt or List node can drive the
313
+ * scrape; advertiser picks are explicit (no upstream fallback) and run as
314
+ * their Page urls, which is why the route never sees "advertiser".
315
+ */
316
+ declare function metaAdsScrapeWireSources(data: MetaAdsNodeSourceFields, upstream?: unknown): MetaAdsWireSources;
317
+ declare function isMetaAdsScrapeCount(value: unknown): value is number;
318
+ /** Smallest tier that fits the requested total; clamps to the top tier. */
319
+ declare function metaAdsScrapeTier(requestedTotal: number): MetaAdsScrapeTier;
320
+ interface MetaAdsScrapeCreditInput {
321
+ count: number;
322
+ /** Number of input URLs in pages mode; 1 for a keyword search. */
323
+ sources: number;
324
+ /** The analysing model's tier when per-ad analysis is on; absent / null = scrape only. */
325
+ analysis?: MetaAdsAnalysisTier | null;
326
+ }
327
+ declare function buildMetaAdsScrapeCreditId(input: MetaAdsScrapeCreditInput): string;
328
+ /** The analysis tier a request / node asks for, or null when analysis is off. */
329
+ declare function metaAdsAnalysisTierFrom(data: {
330
+ readonly analyze?: unknown;
331
+ readonly analysisModel?: unknown;
332
+ }): MetaAdsAnalysisTier | null;
333
+ /**
334
+ * Resolve the credit identifier from an UNVALIDATED request body (the
335
+ * creditGuard preHandler runs before Zod). It must land on the SAME tier the
336
+ * post-Zod reservation computes, so an OMITTED count is the route's default
337
+ * (Zod fills it in the same way); only a present-but-invalid body reserves
338
+ * the fixed mid tier, and the route then rejects it with a 400 and refunds.
339
+ */
340
+ declare function resolveMetaAdsScrapeCreditId(body: unknown): string;
341
+ /** The node-data fields a quote reads: what a run scrapes, how many, and whether it analyses. */
342
+ interface MetaAdsNodeQuoteFields extends MetaAdsNodeSourceFields {
343
+ readonly count?: unknown;
344
+ readonly analyze?: unknown;
345
+ readonly analysisModel?: unknown;
346
+ }
347
+ /**
348
+ * The ONE credit identifier for a node's current settings — the card badge,
349
+ * the run total, the pre-run estimator and the backend quote all read this,
350
+ * and it is the same builder the route's guard + reservation use on the wire
351
+ * body, so no surface can quote a different SKU than the one reserved.
352
+ */
353
+ declare function metaAdsScrapeCreditIdFromNode(data: MetaAdsNodeQuoteFields): string;
354
+
355
+ /**
356
+ * Instagram scraper node — shared vocabulary + credit identifiers.
357
+ *
358
+ * Pulls PUBLIC Instagram posts (feed images, carousels, reels) by profile, by
359
+ * hashtag or by post link and emits a normalized JSON array. Same shape of contract as the
360
+ * Meta Ads node: everything the backend guard/reservation, the frontend credit
361
+ * badge and the docs formula must agree on lives here.
362
+ *
363
+ * Pricing: 1 credit per REQUESTED post, rounded UP to a fixed tier of
364
+ * `count × sources` (a profile / hashtag / post link is one source, up to 5;
365
+ * a post link is always ONE post — see `instagramRequestedCount`). Optional
366
+ * per-post AI analysis folds into the same identifier, priced by the model's
367
+ * tier — reusing the Meta analysis per-item values so the two nodes stay in
368
+ * lockstep.
369
+ */
370
+
371
+ declare const INSTAGRAM_SCRAPE_NODE_TYPE: "instagram-scrape";
372
+ /**
373
+ * `profile` = recent posts of an account, `hashtag` = recent posts under a tag,
374
+ * `post` = exactly the posts whose links are given (one post per link — the
375
+ * "remake this post" entry point, where a full run must land on THAT post).
376
+ */
377
+ declare const INSTAGRAM_SCRAPE_MODES: readonly ["profile", "hashtag", "post"];
378
+ type InstagramScrapeMode = (typeof INSTAGRAM_SCRAPE_MODES)[number];
379
+ declare function isInstagramScrapeMode(value: unknown): value is InstagramScrapeMode;
380
+ declare function instagramScrapeMode(value: unknown): InstagramScrapeMode;
381
+ /** Same window vocabulary as Meta Ads; the Instagram actor honours it server-side (`onlyPostsNewerThan`). */
382
+ declare const INSTAGRAM_SCRAPE_PERIODS: readonly ["24h", "7d", "30d", "all"];
383
+ type InstagramScrapePeriod = (typeof INSTAGRAM_SCRAPE_PERIODS)[number];
384
+ declare const INSTAGRAM_SCRAPE_DEFAULT_COUNT = 20;
385
+ declare const INSTAGRAM_SCRAPE_MAX_COUNT = 100;
386
+ declare const INSTAGRAM_SCRAPE_MAX_SOURCES = 5;
387
+ /** Instagram usernames / hashtags are short; cap a single target well under a URL. */
388
+ declare const INSTAGRAM_SCRAPE_MAX_TARGET_LENGTH = 200;
389
+ /** Requested-total buckets — identical shape to Meta (the pricing model is the same). */
390
+ declare const INSTAGRAM_SCRAPE_TIERS: readonly [10, 20, 50, 100, 200, 500];
391
+ type InstagramScrapeTier = (typeof INSTAGRAM_SCRAPE_TIERS)[number];
392
+ declare function instagramScrapeTier(requestedTotal: number): InstagramScrapeTier;
393
+ /** The analysis tier a request / node asks for, or null when analysis is off. */
394
+ declare function instagramAnalysisTierFrom(data: {
395
+ readonly analyze?: unknown;
396
+ readonly analysisModel?: unknown;
397
+ }): MetaAdsAnalysisTier | null;
398
+ /** Per-post settlement SKU for a tier (the bare id is the standard tier). */
399
+ declare const INSTAGRAM_ANALYSIS_CREDIT_ID: "instagram-analysis";
400
+ declare function instagramAnalysisCreditId(tier: MetaAdsAnalysisTier): string;
401
+ interface InstagramScrapeCreditInput {
402
+ count: number;
403
+ sources: number;
404
+ analysis?: MetaAdsAnalysisTier | null;
405
+ }
406
+ declare function buildInstagramScrapeCreditId(input: InstagramScrapeCreditInput): string;
407
+ /**
408
+ * Cost per SKU — mirror of the backend `STATIC_CREDIT_COSTS` rows / migration,
409
+ * for the frontend badge / estimator. 1 credit per requested post at every
410
+ * tier, plus the analysis multiples.
411
+ */
412
+ declare const INSTAGRAM_SCRAPE_CREDIT_COSTS: Record<string, number>;
413
+ declare const INSTAGRAM_SCRAPE_FALLBACK_CREDIT_ID = "instagram-scrape:20";
414
+ declare function isInstagramScrapeCount(value: unknown): value is number;
415
+ /** The canonical link of the post a value points at, or null when it is not an Instagram post link. */
416
+ declare function instagramPostLink(value: string): string | null;
417
+ /**
418
+ * Targets are typed one per line; the route wants an array.
419
+ *
420
+ * - `profile` / `hashtag` (the default — the signature predates post mode):
421
+ * a target can be a bare username / `#tag`, so split on lines / commas only
422
+ * (never whitespace), strip a leading `@` or `#`, dedupe, cap at MAX_SOURCES.
423
+ * - `post`: only Instagram post links count; each is canonicalised (see
424
+ * `instagramPostLink`) and anything else is dropped, so the guard, the
425
+ * reservation and the scrape all see the same set of posts.
426
+ */
427
+ declare function splitInstagramTargets(value: unknown, mode?: InstagramScrapeMode): string[];
428
+ /** The featured post index, clamped. */
429
+ declare function clampInstagramFeaturedIndex(stored: unknown, count: number): number;
430
+ interface FeaturedInstagramOutputs {
431
+ readonly text?: string;
432
+ readonly imageUrl?: string;
433
+ readonly videoUrl?: string;
434
+ }
435
+ /** The featured post's caption (`text`), first image / cover (`image`), and first video (`video`). */
436
+ declare function featuredInstagramOutputs(json: unknown, featuredIndex: unknown): FeaturedInstagramOutputs;
437
+ /** The node-data fields a quote reads. */
438
+ interface InstagramNodeQuoteFields {
439
+ readonly [key: string]: unknown;
440
+ readonly mode?: unknown;
441
+ readonly targets?: unknown;
442
+ readonly count?: unknown;
443
+ readonly analyze?: unknown;
444
+ readonly analysisModel?: unknown;
445
+ }
446
+ /**
447
+ * Posts requested PER SOURCE: the `count` setting, except in post mode, where
448
+ * every source is one link and so one post (the count setting does not apply).
449
+ * Every price computation goes through this, so the guard, the reservation,
450
+ * the settlement and the node's badge cannot disagree on a post-mode run.
451
+ */
452
+ declare function instagramRequestedCount(mode: InstagramScrapeMode, count: number): number;
453
+ /** Billable source count: number of targets (min 1). */
454
+ declare function instagramScrapeSources(data: InstagramNodeQuoteFields): number;
455
+ /** The ONE credit identifier for a node's current settings. */
456
+ declare function instagramScrapeCreditIdFromNode(data: InstagramNodeQuoteFields): string;
457
+ /**
458
+ * Resolve the credit identifier from an UNVALIDATED request body (the guard
459
+ * runs before Zod). Lands on the SAME tier the reservation computes.
460
+ */
461
+ declare function resolveInstagramScrapeCreditId(body: unknown): string;
462
+
463
+ type InstagramFormat = MetaAdsFormat;
464
+
465
+ /**
466
+ * Social Search node — shared vocabulary, the post shape, credit identifiers,
467
+ * and the rule for which posts a run passes on.
468
+ *
469
+ * One node searches one platform (TikTok, Instagram, YouTube, X, Reddit,
470
+ * LinkedIn, Meta's Ad Library) by keyword or by account and returns up to 60
471
+ * posts in one shape. In the editor a person picks the posts to keep; a
472
+ * workflow run without picks passes on the first few. Everything the route
473
+ * reservation, the orchestrator, the editor, the SDK and the docs must agree
474
+ * on lives here.
475
+ *
476
+ * Why public: `SocialPost` is the node's output and the SDK's return type,
477
+ * and `SocialSearchParams` is the `/v1/social-search` request body. The search
478
+ * itself runs in a private plugin (Cloud only).
479
+ */
480
+ declare const SOCIAL_SEARCH_NODE_TYPE: "social-search";
481
+ declare const SOCIAL_PLATFORMS: readonly ["tiktok", "instagram", "youtube", "x", "reddit", "linkedin", "meta_ads"];
482
+ type SocialPlatform = (typeof SOCIAL_PLATFORMS)[number];
483
+ /** `account` is a creator, a LinkedIn company page or person's profile, or
484
+ * a Meta advertiser; `community` is a subreddit. */
485
+ declare const SOCIAL_SEARCH_MODES: readonly ["keyword", "account", "community"];
486
+ type SocialSearchMode = (typeof SOCIAL_SEARCH_MODES)[number];
487
+ declare const SOCIAL_SEARCH_PLATFORM_MODES: Readonly<Record<SocialPlatform, readonly SocialSearchMode[]>>;
488
+ declare const SOCIAL_SEARCH_PERIODS: readonly ["day", "week", "month", "year", "all"];
489
+ type SocialSearchPeriod = (typeof SOCIAL_SEARCH_PERIODS)[number];
490
+ declare const SOCIAL_SEARCH_SORTS: readonly ["relevance", "popular", "newest"];
491
+ type SocialSearchSort = (typeof SOCIAL_SEARCH_SORTS)[number];
492
+ /** Results per search: one page of the platform per 20 posts. */
493
+ declare const SOCIAL_SEARCH_COUNTS: readonly [20, 40, 60];
494
+ type SocialSearchCount = (typeof SOCIAL_SEARCH_COUNTS)[number];
495
+ /**
496
+ * The searches that can fetch more than one page. Every other one (an
497
+ * account's latest posts on TikTok, Instagram, YouTube or LinkedIn, a YouTube
498
+ * keyword search, a Reddit keyword search) returns one page however many
499
+ * results are asked for, so it is capped at 20 — and billed for one page. The
500
+ * plugin applies the same table to what it fetches and reserves.
501
+ */
502
+ declare const SOCIAL_SEARCH_PAGED_MODES: Readonly<Record<SocialPlatform, readonly SocialSearchMode[]>>;
503
+ /** The most results this platform and mode can return in one search. */
504
+ declare function socialSearchMaxCount(platform: SocialPlatform, mode: SocialSearchMode): SocialSearchCount;
505
+ declare const SOCIAL_SEARCH_VIDEO_KINDS: readonly ["all", "videos", "shorts"];
506
+ type SocialSearchVideoKind = (typeof SOCIAL_SEARCH_VIDEO_KINDS)[number];
507
+ /** How many posts a run passes on when nobody picked: the first five. */
508
+ declare const SOCIAL_SEARCH_DEFAULT_PICK_TOP = 5;
509
+ declare const SOCIAL_SEARCH_MAX_QUERY_LENGTH = 300;
510
+ interface SocialPostAuthor {
511
+ readonly handle: string;
512
+ readonly name: string;
513
+ readonly avatarUrl?: string;
514
+ readonly followers?: number;
515
+ readonly verified?: boolean;
516
+ readonly url?: string;
517
+ }
518
+ /** Absent means the platform did not report it, never zero. */
519
+ interface SocialPostMetrics {
520
+ readonly views?: number;
521
+ readonly likes?: number;
522
+ readonly comments?: number;
523
+ readonly shares?: number;
524
+ readonly saves?: number;
525
+ /** Reddit's vote score. */
526
+ readonly score?: number;
527
+ }
528
+ interface SocialPostMedia {
529
+ readonly kind: "video" | "image" | "text";
530
+ /** The platform's own still. Signed links expire within days. */
531
+ readonly thumbnailUrl?: string;
532
+ /** A direct video file when the platform hands one out. Also short-lived. */
533
+ readonly videoUrl?: string;
534
+ readonly durationSec?: number;
535
+ readonly aspect?: "9:16" | "16:9" | "1:1";
536
+ }
537
+ interface SocialPost {
538
+ /** `<platform>:<the platform's own id>`, stable across searches. */
539
+ readonly id: string;
540
+ readonly platform: SocialPlatform;
541
+ /** The post's page. */
542
+ readonly url: string;
543
+ readonly title?: string;
544
+ readonly text: string;
545
+ readonly author: SocialPostAuthor;
546
+ /** Where it was posted: `r/<subreddit>`, a channel, a company page, an advertiser. */
547
+ readonly container?: string;
548
+ /** ISO 8601, UTC. */
549
+ readonly publishedAt?: string;
550
+ readonly metrics: SocialPostMetrics;
551
+ readonly media: SocialPostMedia;
552
+ readonly hashtags: readonly string[];
553
+ /** Platform-specific facts: a TikTok `sound`, an ad's `active` / `endedAt` /
554
+ * `variants` / `cta`, a Reddit `subreddit`, an X `reply` flag. */
555
+ readonly extra: Readonly<Record<string, unknown>>;
556
+ }
557
+ /** Every field the card, the digest and the picker read, with its type. A
558
+ * saved post that fails this is skipped, never rendered half-broken. */
559
+ declare function isSocialPost(value: unknown): value is SocialPost;
560
+ /** The posts in an unknown value (a job's output, a node's saved data). */
561
+ declare function socialPostsFrom(value: unknown): SocialPost[];
562
+ /** The body of `POST /v1/social-search` (and `nodes.run("social-search", …)`).
563
+ * A type alias, not an interface, so it is assignable to a plain record (the
564
+ * SDK's generic `run` body). */
565
+ type SocialSearchParams = {
566
+ readonly platform: SocialPlatform;
567
+ /** Default `keyword`. */
568
+ readonly mode?: SocialSearchMode;
569
+ /** A keyword, or an account: a handle, a profile link, a subreddit, a
570
+ * LinkedIn company page or profile, a Meta advertiser's name or page id. */
571
+ readonly query: string;
572
+ /** 20, 40 or 60 results. Default 20. */
573
+ readonly count?: SocialSearchCount;
574
+ /** Default `month`. */
575
+ readonly period?: SocialSearchPeriod;
576
+ /** Default `relevance` (the platform's own order). */
577
+ readonly sort?: SocialSearchSort;
578
+ /** TikTok keyword search: a two-letter region. */
579
+ readonly region?: string;
580
+ /** Meta ads: a two-letter country, or `ALL`. */
581
+ readonly country?: string;
582
+ /** Meta ads: only ads that are running now. Default true. */
583
+ readonly activeOnly?: boolean;
584
+ /** Reddit keyword search inside one subreddit. */
585
+ readonly subreddit?: string;
586
+ /** YouTube: long videos, Shorts, or both. Default `all`. */
587
+ readonly videoKind?: SocialSearchVideoKind;
588
+ };
589
+ declare function socialSearchPlatform(value: unknown): SocialPlatform;
590
+ /** The mode, or the platform's first one when the stored mode does not apply
591
+ * (a node switched from Reddit "community" to TikTok). */
592
+ declare function socialSearchMode(platform: SocialPlatform, value: unknown): SocialSearchMode;
593
+ declare function socialSearchCount(value: unknown): SocialSearchCount;
594
+ declare function socialSearchPages(count: SocialSearchCount): 1 | 2 | 3;
595
+ /** The count a search really runs at: the asked count, capped for a search
596
+ * that returns one page (`socialSearchMaxCount`). */
597
+ declare function socialSearchEffectiveCount(platform: SocialPlatform, mode: SocialSearchMode, value: unknown): SocialSearchCount;
598
+ /** A two-letter region (TikTok), upper-cased, or undefined. */
599
+ declare function socialSearchRegion(value: unknown): string | undefined;
600
+ /** A two-letter country or ALL (Meta ads), upper-cased; anything else is ALL. */
601
+ declare function socialSearchCountry(value: unknown): string;
602
+ /**
603
+ * The request a Social Search node sends — the ONE builder the editor's run
604
+ * and the workflow orchestrator share. `query` is the wired text when there is
605
+ * one (a Text node, a List item), else the node's own field.
606
+ */
607
+ declare function socialSearchRequestFromNode(data: Readonly<Record<string, unknown>>, wiredQuery?: string): SocialSearchParams;
608
+ /**
609
+ * The page link of a Social Search post, read from the node's `json` output
610
+ * as a wire hands it on: one post (a wire in Each mode) or the list of posts
611
+ * (any other wire: the first). Undefined when the output holds no post with
612
+ * an http(s) link.
613
+ */
614
+ declare function socialSearchPostLink(output: string): string | undefined;
615
+ /**
616
+ * A signed link counts as expired this long before its stated end, so it
617
+ * still answers when the run reads it: the length check, then the download.
618
+ */
619
+ declare const SOCIAL_POST_VIDEO_LINK_MARGIN_MS: number;
620
+ /**
621
+ * When a platform's signed media link stops working, in epoch milliseconds,
622
+ * if the link says: `oe` (hex seconds: Instagram, Facebook and ad videos),
623
+ * `x-expires` (TikTok), `Expires` (S3, CloudFront), `e` (LinkedIn). Undefined
624
+ * for a link that names no end (an X video's link does not expire).
625
+ */
626
+ declare function signedLinkExpiresAt(link: string): number | undefined;
627
+ /** What a Social Search post hands Video Analysis. */
628
+ type SocialSearchPostVideo =
629
+ /** The post's own video file, while the platform's signed link is valid. */
630
+ {
631
+ readonly kind: "file";
632
+ readonly url: string;
633
+ }
634
+ /** No file came with the post (TikTok, YouTube): its page, which the analysis fetches. */
635
+ | {
636
+ readonly kind: "page";
637
+ readonly url: string;
638
+ }
639
+ /** The file's signed link has expired: the search has to run again. */
640
+ | {
641
+ readonly kind: "expired";
642
+ }
643
+ /** The post is an image or a text post: there is no video to analyze. */
644
+ | {
645
+ readonly kind: "none";
646
+ };
647
+ /**
648
+ * The video Video Analysis reads from a Social Search node's `json` output,
649
+ * as a wire hands it on: one post (a wire in Each mode) or the list (any
650
+ * other wire: the first post). A post that came with its own video file is
651
+ * analyzed from that file, so the platform's page is never read: Instagram's
652
+ * page does not say how long the video is, and a video without a length
653
+ * cannot be priced. A file whose signed link has expired is reported as such
654
+ * rather than swapped for the page. Undefined when the output holds no post.
655
+ * Both engines read it (input-resolver / node-input-resolver).
656
+ */
657
+ declare function socialSearchPostVideo(output: string, now?: number): SocialSearchPostVideo | undefined;
658
+ /**
659
+ * The longest video among the posts, in seconds: what Video Analysis quotes
660
+ * for each post a Social Search wire hands it (each post is charged by its
661
+ * own length when it runs, so the quote is never lower than the charge).
662
+ * Posts without a video are left out: Video Analysis refuses them without a
663
+ * charge. Undefined when no post has a video, or one of them does not say
664
+ * how long it is (the ceiling quotes it).
665
+ */
666
+ declare function socialPostsLongestVideoSec(posts: readonly SocialPost[]): number | undefined;
667
+ /**
668
+ * Credits for one page of results (up to 20 posts), set by the owner: 20 /
669
+ * 40 / 60 results cost 20 / 40 / 60 credits on every platform. The
670
+ * `model_pricing` rows seed the same values. A run is charged by the results
671
+ * it asks for (pages), never by the platform.
672
+ */
673
+ declare const SOCIAL_SEARCH_CREDITS_PER_PAGE = 20;
674
+ declare function socialSearchCreditId(count: SocialSearchCount): string;
675
+ declare function socialSearchCreditIdFromNode(data: Readonly<Record<string, unknown>>): string;
676
+ /** Every id a search can reserve, plus the bare id (the node's headline price). */
677
+ declare const SOCIAL_SEARCH_CREDIT_COSTS: Readonly<Record<string, number>>;
678
+ declare function socialSearchPickTop(value: unknown): number;
679
+ /**
680
+ * The posts passed on: the ones a person picked, in the order they picked
681
+ * them, when any of them is among the results; otherwise the first `pickTop`.
682
+ * Picks belong to the search a person picked from: a NEW search (the editor's
683
+ * run, a workflow run) starts with none, so it passes on the first `pickTop`
684
+ * — the same in both engines. Keeping picks means not searching again
685
+ * (`isSocialSearchPickFrozen`).
686
+ */
687
+ declare function pickSocialPosts(results: readonly SocialPost[], pickedIds: readonly string[] | undefined, pickTop: unknown): SocialPost[];
688
+ /**
689
+ * "Keep my picks": a node whose author picked posts and chose to keep them
690
+ * does not search again on a workflow run — it passes its picks on, like a
691
+ * frozen (skipped) node. Both engines treat it as skipped.
692
+ */
693
+ declare function isSocialSearchPickFrozen(type: string | undefined, data: Readonly<Record<string, unknown>>): boolean;
694
+ /** One post as a few plain lines: who, when, reach; the words; the link. */
695
+ declare function socialPostDigestLine(post: SocialPost, index: number): string;
696
+ /** The posts as text, for nodes that read text (a prompt, a writer). */
697
+ declare function socialPostsDigest(posts: readonly SocialPost[]): string;
698
+
699
+ /**
700
+ * Saved posts — the inspiration wall's wire contract.
701
+ *
702
+ * A person saves a post they found (a Social Search result) with a note and
703
+ * tags, to come back to it or feed it into a workflow. The row keeps a
704
+ * snapshot of the post, because platform links and numbers change, and the
705
+ * post's still is copied into the person's storage so the wall outlives the
706
+ * platform's signed image links.
707
+ *
708
+ * Why public: `SavedPost` is what `GET /v1/saved-posts` returns and the SDK's
709
+ * `savedPosts` resource types.
710
+ */
711
+
712
+ /** Where a save came from. */
713
+ declare const SAVED_POST_SOURCES: readonly ["picker", "competitors", "manual", "api"];
714
+ type SavedPostSource = (typeof SAVED_POST_SOURCES)[number];
715
+ declare const SAVED_POST_NOTE_MAX = 2000;
716
+ declare const SAVED_POST_MAX_TAGS = 10;
717
+ declare const SAVED_POST_TAG_MAX = 40;
718
+ declare const SAVED_POSTS_PAGE_MAX = 100;
719
+ /** How many post ids one lookup may ask about. */
720
+ declare const SAVED_POSTS_LOOKUP_MAX = 200;
721
+ interface SavedPost {
722
+ readonly id: string;
723
+ /** The post's own id (`SocialPost.id`); one save per post per person. */
724
+ readonly postId: string;
725
+ readonly platform: SocialPlatform;
726
+ readonly url: string;
727
+ /** The post as it was when saved. */
728
+ readonly post: SocialPost;
729
+ /** The still, copied into the person's storage; null when the copy failed
730
+ * (the post's own `media.thumbnailUrl` is then the only, expiring, link). */
731
+ readonly thumbnailUrl: string | null;
732
+ readonly note: string;
733
+ readonly tags: readonly string[];
734
+ readonly source: SavedPostSource;
735
+ readonly createdAt: string;
736
+ readonly updatedAt: string;
737
+ }
738
+ /** The body of `POST /v1/saved-posts`. Saving a post already saved updates
739
+ * its note and tags (when given) and returns the existing save. */
740
+ type SavePostInput = {
741
+ readonly post: SocialPost;
742
+ readonly note?: string;
743
+ readonly tags?: readonly string[];
744
+ readonly source?: SavedPostSource;
745
+ };
746
+ /** The body of `PATCH /v1/saved-posts/:id`. */
747
+ type UpdateSavedPostInput = {
748
+ readonly note?: string;
749
+ readonly tags?: readonly string[];
750
+ };
751
+ /** Query of `GET /v1/saved-posts`. */
752
+ type ListSavedPostsParams = {
753
+ readonly platform?: SocialPlatform;
754
+ /** Only saves carrying this tag. */
755
+ readonly tag?: string;
756
+ /** Words to find in the note or the post's text. */
757
+ readonly q?: string;
758
+ /** The `nextCursor` of the previous page. */
759
+ readonly cursor?: string;
760
+ /** 1–100, default 40. */
761
+ readonly limit?: number;
762
+ };
763
+ interface ListSavedPostsResult {
764
+ readonly data: readonly SavedPost[];
765
+ readonly nextCursor: string | null;
766
+ }
767
+ /** The answer of `POST /v1/saved-posts/lookup`: which of the asked posts are saved. */
768
+ interface SavedPostsLookupResult {
769
+ readonly saved: ReadonlyArray<{
770
+ readonly postId: string;
771
+ readonly id: string;
772
+ }>;
773
+ }
774
+ /**
775
+ * Tags as stored: split on commas (`,` `,` `、`, so "hooks, openers" is two
776
+ * tags in any script), trimmed, inner whitespace collapsed, lower-cased, a
777
+ * leading `#` dropped, braces, quotes and backslashes removed (they would
778
+ * change a tag filter's meaning), each at most 40 characters, no repeats, at
779
+ * most 10.
780
+ */
781
+ declare function normalizeSavedPostTags(tags: unknown): string[];
782
+
783
+ /**
784
+ * Read Inspiration and Read Competitor — the nodes that read posts the person
785
+ * already has (the Inspiration library; a tracked brand's scans) and emit them
786
+ * the way Social Search does: `json` the posts (`SocialPost[]`), `text` their
787
+ * digest (`socialPostsDigest`), one list item per post. Both engines' output
788
+ * branches read this ONE list, so a new reader is routed like the rest.
789
+ *
790
+ * The routes behind them (`/v1/inspiration-read`, `/v1/competitor-read`) are
791
+ * free: they read what the account already holds.
792
+ */
793
+ declare const INSPIRATION_READ_NODE_TYPE: "inspiration-read";
794
+ declare const COMPETITOR_READ_NODE_TYPE: "competitor-read";
795
+ declare const SOCIAL_POST_READER_NODE_TYPES: ReadonlySet<string>;
796
+ declare function isSocialPostReaderNodeType(type: unknown): boolean;
797
+ /** The most posts one run reads. */
798
+ declare const SOCIAL_READ_LIMIT_MAX = 100;
799
+ declare const SOCIAL_READ_DEFAULT_LIMIT = 20;
800
+ /** A window in hours reaches back at most 30 days; in days, at most a year (Competitors keep at most twelve months of scans). */
801
+ declare const SOCIAL_READ_WINDOW_HOURS_MAX = 720;
802
+ declare const SOCIAL_READ_WINDOW_DAYS_MAX = 365;
803
+ /** `window`: the last N hours or days. `day`: one calendar day in the node's timezone. */
804
+ declare const SOCIAL_READ_PERIODS: readonly ["window", "day"];
805
+ type SocialReadPeriod = (typeof SOCIAL_READ_PERIODS)[number];
806
+ /** Which of a brand's posts Read Competitor reads: its own, posts about it, or both. */
807
+ declare const COMPETITOR_READ_ROLES: readonly ["own", "about", "all"];
808
+ type CompetitorReadRole = (typeof COMPETITOR_READ_ROLES)[number];
809
+ /** A calendar day as the node stores it. */
810
+ declare const SOCIAL_READ_DAY_PATTERN: RegExp;
811
+
812
+ /**
813
+ * Competitors — the wire contract of the competitor tracking area.
814
+ *
815
+ * A person tracks brands (competitors, or their own brand): their accounts,
816
+ * where to look for posts that name them, and a schedule. Each scan reads the
817
+ * accounts and searches the name, one Social Search page per search, and
818
+ * produces action cards: what happened, why it matters, what to do, with the
819
+ * posts it rests on.
820
+ *
821
+ * Why public: these are the shapes `/v1/competitors*` answers and the SDK's
822
+ * `competitors` resource types; the card `kind` vocabulary is what a client
823
+ * phrases a card by. How a card is decided is not part of the contract.
824
+ */
825
+
826
+ /** The accounts a scan reads straight from. */
827
+ declare const COMPETITOR_ACCOUNT_KEYS: readonly ["tiktok", "instagram", "youtube", "x", "linkedin", "meta_ads"];
828
+ type CompetitorAccountKey = (typeof COMPETITOR_ACCOUNT_KEYS)[number];
829
+ /** Where a scan looks for posts that name the brand. */
830
+ declare const COMPETITOR_ABOUT_PLATFORMS: readonly ["tiktok", "instagram", "youtube", "x", "reddit", "linkedin"];
831
+ type CompetitorAboutPlatform = (typeof COMPETITOR_ABOUT_PLATFORMS)[number];
832
+ declare const COMPETITOR_DEFAULT_ABOUT_PLATFORMS: readonly CompetitorAboutPlatform[];
833
+ declare const COMPETITOR_SCHEDULES: readonly ["off", "weekly", "daily"];
834
+ type CompetitorSchedule = (typeof COMPETITOR_SCHEDULES)[number];
835
+ /** One search per account and per about-platform. */
836
+ declare const COMPETITOR_SCAN_MAX_SEARCHES: number;
837
+ declare const COMPETITOR_SCAN_NODE_TYPE = "competitor-scan";
838
+ /** How many brands one person can track. */
839
+ declare const COMPETITORS_MAX = 50;
840
+ type CompetitorAccounts = Partial<Record<CompetitorAccountKey, string>>;
841
+ /** A search of a brand: its account ("own") or its name ("about"). */
842
+ type CompetitorSearchKind = "own" | "about";
843
+ /** One search a scan runs. */
844
+ interface CompetitorSearch {
845
+ readonly kind: CompetitorSearchKind;
846
+ readonly platform: SocialPlatform;
847
+ }
848
+ interface TrackedCompetitor {
849
+ readonly id: string;
850
+ readonly brand: string;
851
+ readonly website: string;
852
+ readonly accounts: CompetitorAccounts;
853
+ readonly aboutPlatforms: readonly CompetitorAboutPlatform[];
854
+ /** The person's own brand: cards speak to them. */
855
+ readonly isOwn: boolean;
856
+ readonly schedule: CompetitorSchedule;
857
+ readonly nextScanAt: string | null;
858
+ readonly lastScanAt: string | null;
859
+ readonly lastScanId: string | null;
860
+ /** Why the last scan (or scheduled start) fell short; null when it did not. */
861
+ readonly lastScanError: string | null;
862
+ /** A scan is running now. */
863
+ readonly scanning: boolean;
864
+ /** Searches one scan runs; a scan costs this many Social Search pages. */
865
+ readonly searches: number;
866
+ /** What the next scan searches. Absent from a server older than this field. */
867
+ readonly searchPlan?: readonly CompetitorSearch[];
868
+ readonly createdAt: string;
869
+ readonly updatedAt: string;
870
+ }
871
+ /** What a brand's latest scan found on one platform, and what works for it there. */
872
+ interface CompetitorPlatformTally {
873
+ readonly platform: SocialPlatform;
874
+ /** The brand's own posts the scan kept there. */
875
+ readonly own: number;
876
+ /** Posts about the brand the scan kept there. */
877
+ readonly about: number;
878
+ /** The searches the scan ran there. */
879
+ readonly searched: readonly CompetitorSearchKind[];
880
+ /** Of those, the ones that failed; null when the scan cannot say which (a scan stored before this was kept, that had failures). */
881
+ readonly failed: readonly CompetitorSearchKind[] | null;
882
+ /** Its typical reach there, in `unit`; null while too few of its posts, or until its next scan. */
883
+ readonly usual: number | null;
884
+ readonly unit: "views" | "points" | "likes" | null;
885
+ /** What its best posts there share most strongly; null when nothing stands out, or until its next scan. */
886
+ readonly top: BrandLesson | null;
887
+ /** The account's followers at this scan; null when the platform gives none (YouTube, Reddit) or no post of its own was read. Absent from an older server. */
888
+ readonly followers?: number | null;
889
+ }
890
+ /** A brand's latest scan, platform by platform. */
891
+ interface CompetitorBrandTally {
892
+ readonly scanId: string;
893
+ readonly at: string;
894
+ readonly platforms: readonly CompetitorPlatformTally[];
895
+ }
896
+ declare const ACTION_CARD_KINDS: readonly ["outlier", "launch", "complaints", "spreading", "sound", "mentions_up", "pace", "market_sound", "top_in_sources"];
897
+ type ActionCardKind = (typeof ACTION_CARD_KINDS)[number];
898
+ /** 1 = act now · 2 = an opening worth taking · 3 = good to know. */
899
+ type ActionCardPriority = 1 | 2 | 3;
900
+ interface ActionCard {
901
+ /** Stable across scans for the same finding. */
902
+ readonly id: string;
903
+ readonly kind: ActionCardKind;
904
+ readonly priority: ActionCardPriority;
905
+ /** How strong the finding is within its kind, 0 to 1. The API returns
906
+ * cards already in order (priority, then kind, then strength). */
907
+ readonly strength?: number;
908
+ /** The tracked brand it is about; null for a market card. */
909
+ readonly subjectId: string | null;
910
+ /**
911
+ * The numbers and words to phrase the card with. Common: `brand`, `own`.
912
+ * Per kind: outlier `platform, ratio, over100, reach, usual, unit` ·
913
+ * launch `firstLine, posts` · complaints `count, example` · spreading and
914
+ * top_in_sources `platform, reach, perDay, unit, firstLine` · sound
915
+ * `soundTitle, posts, views` · market_sound `soundTitle, brands, views` ·
916
+ * mentions_up `now, before` · pace `platform, recent, before`.
917
+ */
918
+ readonly params: Readonly<Record<string, string | number | boolean | readonly string[]>>;
919
+ /** Ids of the posts it rests on (at most four). */
920
+ readonly evidence: readonly string[];
921
+ /** English text, for surfaces that do not phrase cards themselves. */
922
+ readonly title: string;
923
+ readonly why: string;
924
+ readonly action: string;
925
+ }
926
+ /** A post a scan found, with whose it is. */
927
+ type CompetitorPost = SocialPost & {
928
+ readonly role: "own" | "about" | "market";
929
+ };
930
+ interface CompetitorScanCounts {
931
+ readonly own: number;
932
+ readonly about: number;
933
+ readonly searches: number;
934
+ readonly failedSearches: number;
935
+ /** The searches that returned, as `<own|about>:<platform>`. */
936
+ readonly okSearches?: readonly string[];
937
+ }
938
+ interface CompetitorScanSummary {
939
+ readonly id: string;
940
+ readonly at: string;
941
+ readonly counts: CompetitorScanCounts;
942
+ readonly cards: number;
943
+ }
944
+ interface CompetitorScan {
945
+ readonly id: string;
946
+ readonly at: string;
947
+ readonly counts: CompetitorScanCounts;
948
+ readonly posts: readonly CompetitorPost[];
949
+ readonly cards: readonly ActionCard[];
950
+ }
951
+ /** `GET /v1/competitors`. */
952
+ interface CompetitorListResult {
953
+ readonly data: readonly TrackedCompetitor[];
954
+ /** How many months of scans your plan keeps (older scans are deleted at a brand's next scan). Absent from an older server. */
955
+ readonly historyMonths?: number;
956
+ }
957
+ /** One platform as one scan found and read it. Numbers a scan stored before they were kept answer null. */
958
+ interface CompetitorHistoryPlatform {
959
+ readonly platform: SocialPlatform;
960
+ readonly own: number | null;
961
+ readonly about: number | null;
962
+ /** The account's followers at that scan; null when the platform gives none. */
963
+ readonly followers: number | null;
964
+ /** The brand's usual reach there as learned at that scan, in `unit`. */
965
+ readonly usual: number | null;
966
+ readonly unit: "views" | "points" | "likes" | null;
967
+ }
968
+ interface CompetitorHistoryPoint {
969
+ readonly id: string;
970
+ readonly at: string;
971
+ readonly platforms: readonly CompetitorHistoryPlatform[];
972
+ }
973
+ /** `GET /v1/competitors/:id/history`: the brand's scans, oldest first. */
974
+ interface CompetitorHistory {
975
+ readonly scans: readonly CompetitorHistoryPoint[];
976
+ }
977
+ /** The followers a scan read, and when. */
978
+ interface CompetitorPeriodFollowers {
979
+ readonly value: number;
980
+ readonly at: string;
981
+ }
982
+ /** A brand on one platform over a period. */
983
+ interface CompetitorPeriodPlatform {
984
+ readonly platform: SocialPlatform;
985
+ /** The brand's own posts published in the period, and the posts about it. */
986
+ readonly own: number;
987
+ readonly about: number;
988
+ /** The median reach of its own posts in the period; null below three posts. */
989
+ readonly usual: number | null;
990
+ readonly unit: "views" | "points" | "likes" | null;
991
+ /** From the newest scan inside the period; null when no scan read them. */
992
+ readonly followers: CompetitorPeriodFollowers | null;
993
+ /** Followers gained (or lost) since the newest scan before the period; null when either side is unknown. */
994
+ readonly change: number | null;
995
+ /** What worked there in the period (the lessons need eight posts). */
996
+ readonly lessons: readonly BrandLesson[];
997
+ /** Its best posts of the period there, best first, at most four. */
998
+ readonly best: readonly string[];
999
+ }
1000
+ interface CompetitorPeriod {
1001
+ readonly from: string;
1002
+ readonly to: string;
1003
+ readonly platforms: readonly CompetitorPeriodPlatform[];
1004
+ }
1005
+ /** `GET /v1/competitors/:id/compare`: ISO datetimes; a period is at most a year; `vsFrom` and `vsTo` go together. */
1006
+ interface CompetitorCompareInput {
1007
+ readonly from: string;
1008
+ readonly to: string;
1009
+ readonly vsFrom?: string;
1010
+ readonly vsTo?: string;
1011
+ }
1012
+ /** One or two periods, and the posts they name. */
1013
+ interface CompetitorCompareResult {
1014
+ readonly periods: readonly CompetitorPeriod[];
1015
+ readonly posts: Readonly<Record<string, CompetitorPost>>;
1016
+ }
1017
+ /** `GET /v1/competitors/:id`. */
1018
+ interface CompetitorDetail extends TrackedCompetitor {
1019
+ readonly latestScan: CompetitorScan | null;
1020
+ /** Its latest scan, platform by platform; null before its first scan. Absent from an older server. */
1021
+ readonly platforms?: readonly CompetitorPlatformTally[] | null;
1022
+ /** Newest first, at most twelve. */
1023
+ readonly scans: readonly CompetitorScanSummary[];
1024
+ }
1025
+ /** `GET /v1/competitors/cards`: every card, most urgent first, and the posts they rest on. */
1026
+ interface CompetitorCardsResult {
1027
+ readonly cards: readonly ActionCard[];
1028
+ readonly posts: Readonly<Record<string, CompetitorPost>>;
1029
+ /**
1030
+ * How the advice the person acted on went, per family. Within a priority,
1031
+ * cards of a family marked `proven` come first and `weak` ones last; the
1032
+ * order of priorities never changes. Empty until there are verdicts.
1033
+ */
1034
+ readonly record?: readonly AdviceRecord[];
1035
+ /** Each tracked brand with a scan (by id): its latest scan, platform by platform. Absent from an older server. */
1036
+ readonly brands?: Readonly<Record<string, CompetitorBrandTally>>;
1037
+ }
1038
+ /**
1039
+ * Advice is summed up by family: a competitor's sound and a sound around the
1040
+ * market are both "sound"; "outlier" is making a post like a competitor's
1041
+ * best one.
1042
+ */
1043
+ declare const ADVICE_FAMILIES: readonly ["sound", "outlier", "launch", "complaints"];
1044
+ type AdviceFamily = (typeof ADVICE_FAMILIES)[number];
1045
+ /** The family a card's advice belongs to; null for a card whose advice is not a post. */
1046
+ declare function adviceFamilyOf(kind: string): AdviceFamily | null;
1047
+ /**
1048
+ * Whether "I did this" applies: the card's advice ends in a post of the
1049
+ * person's own. Complaints about their own brand end in replies, so not those.
1050
+ * The server is the judge; this only decides whether to offer the button.
1051
+ */
1052
+ declare function isMeasurableCard(card: Pick<ActionCard, "kind" | "params">): boolean;
1053
+ /** What a card said when it was acted on (cards change with every scan). */
1054
+ interface CardSnapshot {
1055
+ readonly title: string;
1056
+ readonly why: string;
1057
+ readonly action: string;
1058
+ readonly priority?: ActionCardPriority;
1059
+ /** The card's numbers and words, to phrase it as the wall did. */
1060
+ readonly params?: ActionCard["params"];
1061
+ readonly brand?: string;
1062
+ readonly platform?: string;
1063
+ readonly evidence: readonly string[];
1064
+ /** A sound card's sound. */
1065
+ readonly soundId?: string;
1066
+ /** When the card first showed. */
1067
+ readonly cardAt?: string;
1068
+ }
1069
+ declare const CARD_OUTCOME_STATES: readonly ["worked", "flat", "missed", "waiting", "not_found", "older_than_advice", "no_baseline", "posts_since", "no_posts_yet", "no_brand"];
1070
+ /**
1071
+ * worked / flat (about the usual) / missed (below it): the verdict on the one
1072
+ * post tied to the card. waiting: that post is too new, or not scanned yet.
1073
+ * not_found: the linked post never showed up in the brand's scans.
1074
+ * older_than_advice: the linked post went up before the advice.
1075
+ * no_baseline: too few of the brand's posts on that platform to compare with.
1076
+ * posts_since: nothing tied to the card; the brand's posts since, no verdict.
1077
+ * no_posts_yet: nothing tied and no post since. no_brand: no own brand scanned.
1078
+ */
1079
+ type CardOutcomeState = (typeof CARD_OUTCOME_STATES)[number];
1080
+ interface CardOutcome {
1081
+ readonly state: CardOutcomeState;
1082
+ /** The post's reach over the brand's usual. */
1083
+ readonly ratio?: number;
1084
+ readonly liftLabel?: string;
1085
+ readonly reach?: number;
1086
+ readonly usual?: number;
1087
+ readonly unit?: "views" | "points" | "likes";
1088
+ readonly platform?: string;
1089
+ /** The judged post first; with no tie, the best posts since. */
1090
+ readonly postIds?: readonly string[];
1091
+ readonly ageDays?: number;
1092
+ /** How the judged post was tied: the person's link, or a sound card's sound. */
1093
+ readonly matchedBy?: "link" | "sound";
1094
+ /** The brand's posts since the advice, newest first, to pick the one that came of it. */
1095
+ readonly candidates?: readonly string[];
1096
+ }
1097
+ /** The first verdict, kept as it was reached. */
1098
+ interface CardVerdict {
1099
+ readonly state: "worked" | "flat" | "missed";
1100
+ readonly ratio: number;
1101
+ readonly reach: number;
1102
+ readonly usual: number;
1103
+ readonly unit: "views" | "points" | "likes";
1104
+ readonly platform: string;
1105
+ readonly postId: string;
1106
+ readonly matchedBy: "link" | "sound";
1107
+ readonly at: string;
1108
+ }
1109
+ /** A card the person acted on, and how it went. */
1110
+ interface CardAction {
1111
+ readonly id: string;
1112
+ /** The card on the wall it was made on. */
1113
+ readonly cardId: string;
1114
+ readonly cardKind: ActionCardKind;
1115
+ readonly card: CardSnapshot;
1116
+ /** The tracked brand it was about; null for a market card (or a removed brand). */
1117
+ readonly subjectId: string | null;
1118
+ readonly postUrl: string | null;
1119
+ /** When the post was linked. */
1120
+ readonly linkedAt: string | null;
1121
+ readonly actedAt: string;
1122
+ readonly verdict: CardVerdict | null;
1123
+ /** When the person first saw the verdict. */
1124
+ readonly seenAt: string | null;
1125
+ /**
1126
+ * The card is still on the wall. Once it leaves, the mark stays (in Tried
1127
+ * and the record), and the card can be marked anew if it comes back.
1128
+ */
1129
+ readonly onWall: boolean;
1130
+ readonly outcome: CardOutcome;
1131
+ }
1132
+ /** How one family of advice went for the person, one verdict per post. */
1133
+ interface AdviceRecord {
1134
+ readonly family: AdviceFamily;
1135
+ readonly tried: number;
1136
+ readonly worked: number;
1137
+ readonly flat: number;
1138
+ readonly missed: number;
1139
+ /** The mean of those posts' reach over the usual. */
1140
+ readonly avgRatio: number;
1141
+ /** Enough verdicts to show this record. */
1142
+ readonly shown: boolean;
1143
+ /** Whether it moves this family's cards (up when proven, down when weak). */
1144
+ readonly tier: "proven" | "weak" | "neutral";
1145
+ }
1146
+ /** `GET /v1/competitors/actions`: the cards the person acted on, newest first. */
1147
+ interface CompetitorActionsResult {
1148
+ readonly actions: readonly CardAction[];
1149
+ readonly record: readonly AdviceRecord[];
1150
+ /** The posts the outcomes name, by id. */
1151
+ readonly posts: Readonly<Record<string, CompetitorPost>>;
1152
+ }
1153
+ /** `POST /v1/competitors/actions`: mark a card on the wall as done. */
1154
+ interface MarkCardInput {
1155
+ readonly cardId: string;
1156
+ /** The person's own post that came of it (http(s), up to 1,000 characters). */
1157
+ readonly postUrl?: string | null;
1158
+ }
1159
+ /** `POST` and `PATCH /v1/competitors/actions*`: the mark, and the posts its outcome names. */
1160
+ interface CardActionResult {
1161
+ readonly action: CardAction;
1162
+ readonly posts: Readonly<Record<string, CompetitorPost>>;
1163
+ /** POST only: false when the card was already marked (the mark is returned as it was). */
1164
+ readonly created?: boolean;
1165
+ }
1166
+ /** `PATCH /v1/competitors/actions/:id`: link (or unlink with null) the post, or mark the verdict seen. */
1167
+ interface UpdateCardActionInput {
1168
+ readonly postUrl?: string | null;
1169
+ readonly seen?: true;
1170
+ }
1171
+ /** The traits a brand's best posts can share. */
1172
+ declare const BRAND_LESSON_KINDS: readonly ["short_videos", "long_videos", "format", "question_hook", "number_hook", "short_caption", "long_caption", "hashtag", "sound", "weekday"];
1173
+ type BrandLessonKind = (typeof BRAND_LESSON_KINDS)[number];
1174
+ /**
1175
+ * One thing a brand's best posts share, measured on its own posts: the posts
1176
+ * with the trait reached `lift` times what the rest did.
1177
+ */
1178
+ interface BrandLesson {
1179
+ /** `<platform>:<kind>:<key>`, stable across reads. */
1180
+ readonly id: string;
1181
+ readonly kind: BrandLessonKind;
1182
+ readonly platform: string;
1183
+ /**
1184
+ * Always `lift` (number), `liftLabel` ("2.4x"), `posts` (with the trait),
1185
+ * `winners` (of the best among them) and `unit` ("views" | "likes" |
1186
+ * "points"). Per kind: short_videos `maxSec` · long_videos `minSec` ·
1187
+ * format `format` · short_caption and long_caption `chars` · hashtag `tag` ·
1188
+ * sound `sound` · weekday `day` (0 = Sunday, UTC).
1189
+ */
1190
+ readonly params: Readonly<Record<string, string | number | boolean | readonly string[]>>;
1191
+ /** Ids of the posts it rests on, best first (at most four). */
1192
+ readonly evidence: readonly string[];
1193
+ readonly strength: number;
1194
+ /** English, for surfaces that do not phrase lessons themselves. */
1195
+ readonly text: string;
1196
+ }
1197
+ /** What works for a brand on one platform. */
1198
+ interface BrandPlatformLessons {
1199
+ readonly platform: string;
1200
+ /** The brand's own posts counted there. */
1201
+ readonly posts: number;
1202
+ /** Their typical reach; null while there are fewer than `minPosts`. */
1203
+ readonly usual: number | null;
1204
+ readonly unit: "views" | "points" | "likes";
1205
+ /** Its best posts, best first. */
1206
+ readonly winners: readonly string[];
1207
+ /** Its weakest posts, weakest first. */
1208
+ readonly misses: readonly string[];
1209
+ readonly lessons: readonly BrandLesson[];
1210
+ }
1211
+ interface BrandLessons {
1212
+ readonly subjectId: string;
1213
+ /** The user's own brand ("what works for you"), not a competitor. */
1214
+ readonly isOwn: boolean;
1215
+ readonly platforms: readonly BrandPlatformLessons[];
1216
+ /** Posts a platform needs before it gets lessons. */
1217
+ readonly minPosts: number;
1218
+ }
1219
+ /** `GET /v1/competitors/:id/lessons`: what works for a tracked brand, and the posts it names. */
1220
+ interface CompetitorLessonsResult {
1221
+ readonly lessons: BrandLessons;
1222
+ readonly posts: Readonly<Record<string, CompetitorPost>>;
1223
+ }
1224
+ /** `POST /v1/competitor-discover`: a brand's accounts found from its website. */
1225
+ interface CompetitorDiscovery {
1226
+ readonly brand: string;
1227
+ readonly website: string;
1228
+ readonly accounts: Partial<Record<CompetitorAccountKey, {
1229
+ readonly value: string;
1230
+ readonly from: "site" | "guess";
1231
+ }>>;
1232
+ }
1233
+ type CreateCompetitorInput = {
1234
+ readonly brand: string;
1235
+ readonly website?: string;
1236
+ readonly accounts?: CompetitorAccounts;
1237
+ readonly aboutPlatforms?: readonly CompetitorAboutPlatform[];
1238
+ readonly isOwn?: boolean;
1239
+ /** Default weekly. */
1240
+ readonly schedule?: CompetitorSchedule;
1241
+ };
1242
+ type UpdateCompetitorInput = Partial<CreateCompetitorInput>;
1243
+ /** Searches a scan of this configuration runs. */
1244
+ declare function competitorScanSearches(c: {
1245
+ readonly accounts?: CompetitorAccounts;
1246
+ readonly aboutPlatforms?: readonly string[];
1247
+ }): number;
1248
+ /** The credit id of a scan of `n` searches. */
1249
+ declare function competitorScanCreditId(n: number): string;
1250
+ /** A scan costs one Social Search page per search: every id it can reserve. */
1251
+ declare const COMPETITOR_SCAN_CREDIT_COSTS: Readonly<Record<string, number>>;
1252
+ /** The credits a scan of this many searches costs. */
1253
+ declare function competitorScanCredits(searches: number): number;
1254
+ /** Whether a platform is one the about-search covers (used by pickers). */
1255
+ declare function isCompetitorAboutPlatform(value: string): value is CompetitorAboutPlatform & SocialPlatform;
1256
+
1257
+ type SocialMediaPlatform = "instagram" | "tiktok" | "x" | "youtube" | "facebook" | "linkedin" | "telegram";
1258
+ type SocialMediaContentType = "feed-square" | "feed-portrait" | "feed-landscape" | "story-reel" | "video" | "image-landscape" | "image-square" | "x-video" | "short" | "fb-feed-portrait" | "reel" | "li-image-landscape" | "li-image-square" | "li-video";
1259
+ interface SocialMediaSpec {
1260
+ readonly platform: SocialMediaPlatform;
1261
+ readonly contentType: SocialMediaContentType;
1262
+ readonly label: string;
1263
+ readonly width: number;
1264
+ readonly height: number;
1265
+ readonly maxDurationSeconds: number | null;
1266
+ readonly textLimit: number;
1267
+ readonly isVideo: boolean;
1268
+ }
1269
+ declare const PLATFORM_SPECS: Record<string, SocialMediaSpec>;
1270
+ declare const CONTENT_TYPES_BY_PLATFORM: Record<SocialMediaPlatform, ReadonlyArray<{
1271
+ key: string;
1272
+ label: string;
1273
+ }>>;
1274
+ declare const PLATFORM_LABELS: Record<SocialMediaPlatform, string>;
1275
+
1276
+ /**
1277
+ * Telegram Channel Feed — the post shape the node emits on its `json` handle,
1278
+ * the digest its `text` handle carries, and the ONE cursor rule (where the
1279
+ * feed's position goes after a run). Structural vocabulary and a pure rule;
1280
+ * the fetching lives in the backend (`services/social/telegram-channel.ts`).
1281
+ *
1282
+ * Media links (`cdn*.telesco.pe/...`) carry a `?token=` and expire within days:
1283
+ * a consumer that needs the picture later copies it (an upload node, a
1284
+ * collection), never stores the link alone.
1285
+ */
1286
+ interface TelegramChannelPostMedia {
1287
+ readonly type: "photo" | "video";
1288
+ /** The file — a photo's, or a video's when the preview page embeds the file ("Watch in Telegram" players have none). */
1289
+ readonly url?: string;
1290
+ /** A video's poster frame. */
1291
+ readonly posterUrl?: string;
1292
+ }
1293
+ interface TelegramChannelPost {
1294
+ /** Sequential per-channel message id. */
1295
+ readonly id: number;
1296
+ /** The channel's bare id (no `@`). */
1297
+ readonly channel: string;
1298
+ /** Canonical link to the post. */
1299
+ readonly postUrl: string;
1300
+ /** Plain text (HTML stripped, entities decoded); a reply's quoted text is not part of it. */
1301
+ readonly text: string;
1302
+ /** ISO timestamp of the post. */
1303
+ readonly date?: string;
1304
+ /** The channel or person the post was forwarded from. */
1305
+ readonly forwardedFrom?: {
1306
+ readonly name: string;
1307
+ readonly url?: string;
1308
+ };
1309
+ /** Every photo and video of the post, in page order (an album is several). */
1310
+ readonly media: readonly TelegramChannelPostMedia[];
1311
+ /** The first picture — the first photo, else the first video's poster — for a consumer that takes one image. */
1312
+ readonly imageUrl?: string;
1313
+ /** The view counter as the page shows it ("1.52M"). */
1314
+ readonly views?: string;
1315
+ }
1316
+ /** The most posts a poll emits per run — two preview pages at most. */
1317
+ declare const TELEGRAM_FEED_LIMIT_MAX = 30;
1318
+ /** The most posts a peek ("re-fetch the last N") can show — one preview page. */
1319
+ declare const TELEGRAM_FEED_PEEK_MAX = 20;
1320
+ /** What one preview page (`t.me/s/<channel>[?after=<id>]`) renders. */
1321
+ declare const TELEGRAM_FEED_PAGE_SIZE = 20;
1322
+ /** The default posts per run. */
1323
+ declare const TELEGRAM_FEED_DEFAULT_LIMIT = 5;
1324
+ declare const TELEGRAM_FEED_DIGEST_SEPARATOR = "\n\n---\n\n";
1325
+ /** The `text` handle: the posts' text, oldest first, joined by a rule. Posts with no text (a bare picture) add nothing. */
1326
+ declare function telegramFeedDigest(posts: ReadonlyArray<Pick<TelegramChannelPost, "text">>): string;
1327
+ /**
1328
+ * The posts held in a saved `generatedJson` / a run's `output.json`, normalized:
1329
+ * anything that is not a post with a numeric id and a text is left out, and a
1330
+ * post saved before a field existed reads with that field at its default.
1331
+ */
1332
+ declare function telegramPostsFrom(value: unknown): TelegramChannelPost[];
1333
+ interface FeedEmissionPlan<P extends {
1334
+ readonly id: number;
1335
+ }> {
1336
+ /** The posts this run emits, oldest first. */
1337
+ readonly emitted: P[];
1338
+ /** The feed's position after this run (the cursor to store), or undefined when there is nothing to stand on. */
1339
+ readonly latestId: number | undefined;
1340
+ }
1341
+ /**
1342
+ * Where the feed stands after a run — the ONE rule both the route and the
1343
+ * tests read (decided 2026-10-05):
1344
+ *
1345
+ * - no position yet (first run, after Reset): the NEWEST `limit` posts, and
1346
+ * the position jumps to the newest post — the person asked for what is new
1347
+ * from now on; older posts are never revisited;
1348
+ * - a stored position: the OLDEST `limit` posts above it, and the position
1349
+ * becomes the highest post EMITTED — a backlog drains `limit` per run and
1350
+ * nothing is lost (the old rule jumped to the newest post even when `limit`
1351
+ * cut the fetch short, and the posts in between were gone for good).
1352
+ *
1353
+ * `posts` may come in any order and repeat (a pinned post renders twice).
1354
+ */
1355
+ declare function planFeedEmission<P extends {
1356
+ readonly id: number;
1357
+ }>(posts: ReadonlyArray<P>, since: number | undefined, limit: number,
1358
+ /**
1359
+ * The highest message id the fetched page(s) rendered above `since`, posts
1360
+ * with nothing to read included. When nothing readable lies above the
1361
+ * position but the page went further, the position moves past the unreadable
1362
+ * posts — else the feed reads the same page every tick for ever.
1363
+ */
1364
+ pageMaxId?: number): FeedEmissionPlan<P>;
1365
+
1366
+ export { ACTION_CARD_KINDS, ADVICE_FAMILIES, type ActionCard, type ActionCardKind, type ActionCardPriority, type AdCreativeAnalysis, type AdviceFamily, type AdviceRecord, BRAND_LESSON_KINDS, type BrandLesson, type BrandLessonKind, type BrandLessons, type BrandPlatformLessons, CARD_OUTCOME_STATES, COMPETITORS_MAX, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_ACCOUNT_KEYS, COMPETITOR_DEFAULT_ABOUT_PLATFORMS, COMPETITOR_READ_NODE_TYPE, COMPETITOR_READ_ROLES, COMPETITOR_SCAN_CREDIT_COSTS, COMPETITOR_SCAN_MAX_SEARCHES, COMPETITOR_SCAN_NODE_TYPE, COMPETITOR_SCHEDULES, CONTENT_TYPES_BY_PLATFORM, type CardAction, type CardActionResult, type CardOutcome, type CardOutcomeState, type CardSnapshot, type CardVerdict, type CompetitorAboutPlatform, type CompetitorAccountKey, type CompetitorAccounts, type CompetitorActionsResult, type CompetitorBrandTally, type CompetitorCardsResult, type CompetitorCompareInput, type CompetitorCompareResult, type CompetitorDetail, type CompetitorDiscovery, type CompetitorHistory, type CompetitorHistoryPlatform, type CompetitorHistoryPoint, type CompetitorLessonsResult, type CompetitorListResult, type CompetitorPeriod, type CompetitorPeriodFollowers, type CompetitorPeriodPlatform, type CompetitorPlatformTally, type CompetitorPost, type CompetitorReadRole, type CompetitorScan, type CompetitorScanCounts, type CompetitorScanSummary, type CompetitorSchedule, type CompetitorSearch, type CompetitorSearchKind, type CreateCompetitorInput, type FeaturedInstagramOutputs, type FeaturedMetaAdOutputs, type FeedEmissionPlan, INSPIRATION_READ_NODE_TYPE, INSTAGRAM_ANALYSIS_CREDIT_ID, INSTAGRAM_CAROUSEL_MAX_ITEMS, INSTAGRAM_CAROUSEL_MIN_ITEMS, INSTAGRAM_SCRAPE_CREDIT_COSTS, INSTAGRAM_SCRAPE_DEFAULT_COUNT, INSTAGRAM_SCRAPE_FALLBACK_CREDIT_ID, INSTAGRAM_SCRAPE_MAX_COUNT, INSTAGRAM_SCRAPE_MAX_SOURCES, INSTAGRAM_SCRAPE_MAX_TARGET_LENGTH, INSTAGRAM_SCRAPE_MODES, INSTAGRAM_SCRAPE_NODE_TYPE, INSTAGRAM_SCRAPE_PERIODS, INSTAGRAM_SCRAPE_TIERS, type InstagramFormat, type InstagramNodeQuoteFields, type InstagramScrapeMode, type InstagramScrapePeriod, type InstagramScrapeTier, type ListSavedPostsParams, type ListSavedPostsResult, META_ADS_ADVERTISER_MAX_RESULTS, META_ADS_ANALYSIS_CREDITS_PER_AD, META_ADS_ANALYSIS_CREDIT_ID, META_ADS_ANALYSIS_FOCUS_MAX, META_ADS_ANALYSIS_TIERS, META_ADS_FORMATS, META_ADS_NODE_MODES, META_ADS_PLATFORMS, META_ADS_SCRAPE_COUNT_OPTIONS, META_ADS_SCRAPE_CREDIT_COSTS, META_ADS_SCRAPE_DEFAULT_COUNT, META_ADS_SCRAPE_DEFAULT_COUNTRY, META_ADS_SCRAPE_FALLBACK_CREDIT_ID, META_ADS_SCRAPE_MAX_COUNT, META_ADS_SCRAPE_MAX_QUERY_LENGTH, META_ADS_SCRAPE_MAX_SOURCES, META_ADS_SCRAPE_MODES, META_ADS_SCRAPE_NODE_TYPE, META_ADS_SCRAPE_PERIODS, META_ADS_SCRAPE_STATUSES, META_ADS_SCRAPE_TIERS, type MarkCardInput, type MetaAdsAdvertiser, type MetaAdsAnalysisTier, type MetaAdsCreativeFormat, type MetaAdsFormat, type MetaAdsNodeMode, type MetaAdsNodeQuoteFields, type MetaAdsNodeSourceFields, type MetaAdsPlatform, type MetaAdsScrapeMode, type MetaAdsScrapePeriod, type MetaAdsScrapeStatus, type MetaAdsScrapeTier, type MetaAdsWireSources, PLATFORM_LABELS, PLATFORM_SPECS, SAVED_POSTS_LOOKUP_MAX, SAVED_POSTS_PAGE_MAX, SAVED_POST_MAX_TAGS, SAVED_POST_NOTE_MAX, SAVED_POST_SOURCES, SAVED_POST_TAG_MAX, SCRAPER_ACTOR_LABELS, SCRAPER_CREDIT_COSTS, SCRAPER_OUTPUT_FIELDS, SOCIAL_PLATFORMS, SOCIAL_POST_NODE_PLATFORM, SOCIAL_POST_NODE_TYPES, SOCIAL_POST_READER_NODE_TYPES, SOCIAL_POST_VIDEO_LINK_MARGIN_MS, SOCIAL_READ_DAY_PATTERN, SOCIAL_READ_DEFAULT_LIMIT, SOCIAL_READ_LIMIT_MAX, SOCIAL_READ_PERIODS, SOCIAL_READ_WINDOW_DAYS_MAX, SOCIAL_READ_WINDOW_HOURS_MAX, SOCIAL_SEARCH_COUNTS, SOCIAL_SEARCH_CREDITS_PER_PAGE, SOCIAL_SEARCH_CREDIT_COSTS, SOCIAL_SEARCH_DEFAULT_PICK_TOP, SOCIAL_SEARCH_MAX_QUERY_LENGTH, SOCIAL_SEARCH_MODES, SOCIAL_SEARCH_NODE_TYPE, SOCIAL_SEARCH_PAGED_MODES, SOCIAL_SEARCH_PERIODS, SOCIAL_SEARCH_PLATFORM_MODES, SOCIAL_SEARCH_SORTS, SOCIAL_SEARCH_VIDEO_KINDS, type SavePostInput, type SavedPost, type SavedPostSource, type SavedPostsLookupResult, type ScraperActorId, type SocialMediaContentType, type SocialMediaPlatform, type SocialMediaSpec, type SocialPlatform, type SocialPost, type SocialPostAuthor, type SocialPostMedia, type SocialPostMetrics, type SocialReadPeriod, type SocialSearchCount, type SocialSearchMode, type SocialSearchParams, type SocialSearchPeriod, type SocialSearchPostVideo, type SocialSearchSort, type SocialSearchVideoKind, TELEGRAM_ACCOUNT_SEND_NODE_TYPE, TELEGRAM_ACCOUNT_TRIGGER_MESSAGE_FIELDS, TELEGRAM_ACCOUNT_TRIGGER_MESSAGE_HANDLE, TELEGRAM_ACCOUNT_TRIGGER_OUTPUT_HANDLES, TELEGRAM_ACCOUNT_TRIGGER_POST_FIELDS, TELEGRAM_FEED_DEFAULT_LIMIT, TELEGRAM_FEED_DIGEST_SEPARATOR, TELEGRAM_FEED_LIMIT_MAX, TELEGRAM_FEED_PAGE_SIZE, TELEGRAM_FEED_PEEK_MAX, TELEGRAM_SEND_AS, TELEGRAM_SEND_DESTINATIONS, type TelegramAccountTriggerPostField, type TelegramChannelPost, type TelegramChannelPostMedia, type TelegramSendAs, type TelegramSendDestination, type TrackedCompetitor, type UpdateCardActionInput, type UpdateCompetitorInput, type UpdateSavedPostInput, adCreativeAnalysisFrom, adviceFamilyOf, buildInstagramScrapeCreditId, buildMetaAdsScrapeCreditId, buildScraperCreditId, clampInstagramFeaturedIndex, clampMetaAdsFeaturedIndex, classifyCreativeFormat, competitorScanCreditId, competitorScanCredits, competitorScanSearches, featuredInstagramOutputs, featuredMetaAdOutputs, instagramAnalysisCreditId, instagramAnalysisTierFrom, instagramPostLink, instagramRequestedCount, instagramScrapeCreditIdFromNode, instagramScrapeMode, instagramScrapeSources, instagramScrapeTier, isCompetitorAboutPlatform, isFacebookPageUrl, isInstagramScrapeCount, isInstagramScrapeMode, isMeasurableCard, isMetaAdsFormat, isMetaAdsPlatform, isMetaAdsScrapeCount, isMetaAdsScrapeMode, isMetaCdnImageUrl, isScraperActor, isSocialPost, isSocialPostReaderNodeType, isSocialSearchPickFrozen, isTelegramAccountTriggerNamedHandle, metaAdsAdvertisersFrom, metaAdsAnalysisCreditId, metaAdsAnalysisTier, metaAdsAnalysisTierFrom, metaAdsNodeMode, metaAdsScrapeCreditIdFromNode, metaAdsScrapeSources, metaAdsScrapeTier, metaAdsScrapeWireSources, normalizePinterestUrl, normalizeSavedPostTags, pickSocialPosts, planFeedEmission, resolveInstagramScrapeCreditId, resolveMetaAdsScrapeCreditId, resolveScraperCreditId, signedLinkExpiresAt, socialPostDigestLine, socialPostsDigest, socialPostsFrom, socialPostsLongestVideoSec, socialSearchCount, socialSearchCountry, socialSearchCreditId, socialSearchCreditIdFromNode, socialSearchEffectiveCount, socialSearchMaxCount, socialSearchMode, socialSearchPages, socialSearchPickTop, socialSearchPlatform, socialSearchPostLink, socialSearchPostVideo, socialSearchRegion, socialSearchRequestFromNode, splitInstagramTargets, splitMetaAdsAdvertiserNames, splitMetaAdsPageUrls, telegramAccountListeningSignature, telegramAccountTriggerOutputs, telegramFeedDigest, telegramPostsFrom, telegramSendAsOf, telegramSendDestinationOf };