@gadicc/loom 0.0.0-oidc-bootstrap.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 (342) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +6 -0
  3. package/README.md +448 -0
  4. package/THIRD_PARTY_NOTICES.md +25 -0
  5. package/db/drizzle-config.d.ts +20 -0
  6. package/db/drizzle-config.js +34 -0
  7. package/db/fixtures.d.ts +31 -0
  8. package/db/fixtures.js +52 -0
  9. package/db/neon.d.ts +3 -0
  10. package/db/neon.js +20 -0
  11. package/db/neonFull.d.ts +12 -0
  12. package/db/neonFull.js +33 -0
  13. package/db/package.json +3 -0
  14. package/db/testing.d.ts +26 -0
  15. package/db/testing.js +76 -0
  16. package/db/testing.test.ts +28 -0
  17. package/db/valibot.d.ts +23 -0
  18. package/db/valibot.js +8 -0
  19. package/esm/_dnt.polyfills.d.ts +149 -0
  20. package/esm/_dnt.polyfills.d.ts.map +1 -0
  21. package/esm/_dnt.polyfills.js +163 -0
  22. package/esm/_dnt.shims.d.ts +2 -0
  23. package/esm/_dnt.shims.d.ts.map +1 -0
  24. package/esm/_dnt.shims.js +57 -0
  25. package/esm/bin/loom.d.ts +2 -0
  26. package/esm/bin/loom.d.ts.map +1 -0
  27. package/esm/bin/loom.js +11 -0
  28. package/esm/mod.d.ts +9 -0
  29. package/esm/mod.d.ts.map +1 -0
  30. package/esm/mod.js +8 -0
  31. package/esm/package.json +3 -0
  32. package/esm/src/apiKeys/authorize.d.ts +4 -0
  33. package/esm/src/apiKeys/authorize.d.ts.map +1 -0
  34. package/esm/src/apiKeys/authorize.js +184 -0
  35. package/esm/src/apiKeys/country.d.ts +3 -0
  36. package/esm/src/apiKeys/country.d.ts.map +1 -0
  37. package/esm/src/apiKeys/country.js +7 -0
  38. package/esm/src/apiKeys/credentials.d.ts +4 -0
  39. package/esm/src/apiKeys/credentials.d.ts.map +1 -0
  40. package/esm/src/apiKeys/credentials.js +55 -0
  41. package/esm/src/apiKeys/fingerprint.d.ts +3 -0
  42. package/esm/src/apiKeys/fingerprint.d.ts.map +1 -0
  43. package/esm/src/apiKeys/fingerprint.js +5 -0
  44. package/esm/src/apiKeys/mod.d.ts +9 -0
  45. package/esm/src/apiKeys/mod.d.ts.map +1 -0
  46. package/esm/src/apiKeys/mod.js +8 -0
  47. package/esm/src/apiKeys/policy.d.ts +59 -0
  48. package/esm/src/apiKeys/policy.d.ts.map +1 -0
  49. package/esm/src/apiKeys/policy.js +88 -0
  50. package/esm/src/apiKeys/retention.d.ts +55 -0
  51. package/esm/src/apiKeys/retention.d.ts.map +1 -0
  52. package/esm/src/apiKeys/retention.js +65 -0
  53. package/esm/src/apiKeys/types.d.ts +175 -0
  54. package/esm/src/apiKeys/types.d.ts.map +1 -0
  55. package/esm/src/apiKeys/types.js +1 -0
  56. package/esm/src/cli/externalSkills.d.ts +39 -0
  57. package/esm/src/cli/externalSkills.d.ts.map +1 -0
  58. package/esm/src/cli/externalSkills.js +177 -0
  59. package/esm/src/cli/mod.d.ts +337 -0
  60. package/esm/src/cli/mod.d.ts.map +1 -0
  61. package/esm/src/cli/mod.js +9268 -0
  62. package/esm/src/cli/projectSkills.d.ts +102 -0
  63. package/esm/src/cli/projectSkills.d.ts.map +1 -0
  64. package/esm/src/cli/projectSkills.js +592 -0
  65. package/esm/src/files/client.d.ts +29 -0
  66. package/esm/src/files/client.d.ts.map +1 -0
  67. package/esm/src/files/client.js +41 -0
  68. package/esm/src/files/errors.d.ts +37 -0
  69. package/esm/src/files/errors.d.ts.map +1 -0
  70. package/esm/src/files/errors.js +66 -0
  71. package/esm/src/files/hash.d.ts +15 -0
  72. package/esm/src/files/hash.d.ts.map +1 -0
  73. package/esm/src/files/hash.js +82 -0
  74. package/esm/src/files/memory.d.ts +29 -0
  75. package/esm/src/files/memory.d.ts.map +1 -0
  76. package/esm/src/files/memory.js +109 -0
  77. package/esm/src/files/metadata.d.ts +10 -0
  78. package/esm/src/files/metadata.d.ts.map +1 -0
  79. package/esm/src/files/metadata.js +186 -0
  80. package/esm/src/files/mod.d.ts +10 -0
  81. package/esm/src/files/mod.d.ts.map +1 -0
  82. package/esm/src/files/mod.js +9 -0
  83. package/esm/src/files/s3.d.ts +29 -0
  84. package/esm/src/files/s3.d.ts.map +1 -0
  85. package/esm/src/files/s3.js +107 -0
  86. package/esm/src/files/service.d.ts +27 -0
  87. package/esm/src/files/service.d.ts.map +1 -0
  88. package/esm/src/files/service.js +136 -0
  89. package/esm/src/files/types.d.ts +134 -0
  90. package/esm/src/files/types.d.ts.map +1 -0
  91. package/esm/src/files/types.js +1 -0
  92. package/esm/src/jobs/catalog.d.ts +32 -0
  93. package/esm/src/jobs/catalog.d.ts.map +1 -0
  94. package/esm/src/jobs/catalog.js +208 -0
  95. package/esm/src/jobs/controller.d.ts +28 -0
  96. package/esm/src/jobs/controller.d.ts.map +1 -0
  97. package/esm/src/jobs/controller.js +95 -0
  98. package/esm/src/jobs/direct.d.ts +36 -0
  99. package/esm/src/jobs/direct.d.ts.map +1 -0
  100. package/esm/src/jobs/direct.js +122 -0
  101. package/esm/src/jobs/events.d.ts +15 -0
  102. package/esm/src/jobs/events.d.ts.map +1 -0
  103. package/esm/src/jobs/events.js +30 -0
  104. package/esm/src/jobs/format.d.ts +16 -0
  105. package/esm/src/jobs/format.d.ts.map +1 -0
  106. package/esm/src/jobs/format.js +183 -0
  107. package/esm/src/jobs/http.d.ts +22 -0
  108. package/esm/src/jobs/http.d.ts.map +1 -0
  109. package/esm/src/jobs/http.js +44 -0
  110. package/esm/src/jobs/log.d.ts +2 -0
  111. package/esm/src/jobs/log.d.ts.map +1 -0
  112. package/esm/src/jobs/log.js +10 -0
  113. package/esm/src/jobs/mod.d.ts +10 -0
  114. package/esm/src/jobs/mod.d.ts.map +1 -0
  115. package/esm/src/jobs/mod.js +9 -0
  116. package/esm/src/jobs/run.d.ts +20 -0
  117. package/esm/src/jobs/run.d.ts.map +1 -0
  118. package/esm/src/jobs/run.js +57 -0
  119. package/esm/src/jobs/types.d.ts +31 -0
  120. package/esm/src/jobs/types.d.ts.map +1 -0
  121. package/esm/src/jobs/types.js +1 -0
  122. package/esm/src/mui/apiKeys.d.ts +65 -0
  123. package/esm/src/mui/apiKeys.d.ts.map +1 -0
  124. package/esm/src/mui/apiKeys.js +301 -0
  125. package/esm/src/mui/apiKeysView.d.ts +48 -0
  126. package/esm/src/mui/apiKeysView.d.ts.map +1 -0
  127. package/esm/src/mui/apiKeysView.js +34 -0
  128. package/esm/src/mui/confirm.d.ts +12 -0
  129. package/esm/src/mui/confirm.d.ts.map +1 -0
  130. package/esm/src/mui/confirm.js +78 -0
  131. package/esm/src/mui/mod.d.ts +4 -0
  132. package/esm/src/mui/mod.d.ts.map +1 -0
  133. package/esm/src/mui/mod.js +2 -0
  134. package/esm/src/next/apiKeys/mod.d.ts +64 -0
  135. package/esm/src/next/apiKeys/mod.d.ts.map +1 -0
  136. package/esm/src/next/apiKeys/mod.js +217 -0
  137. package/esm/src/next/auth/config.d.ts +34 -0
  138. package/esm/src/next/auth/config.d.ts.map +1 -0
  139. package/esm/src/next/auth/config.js +103 -0
  140. package/esm/src/next/auth/mod.d.ts +3 -0
  141. package/esm/src/next/auth/mod.d.ts.map +1 -0
  142. package/esm/src/next/auth/mod.js +2 -0
  143. package/esm/src/next/auth/server.d.ts +28 -0
  144. package/esm/src/next/auth/server.d.ts.map +1 -0
  145. package/esm/src/next/auth/server.js +24 -0
  146. package/esm/src/next/files/mod.d.ts +3 -0
  147. package/esm/src/next/files/mod.d.ts.map +1 -0
  148. package/esm/src/next/files/mod.js +2 -0
  149. package/esm/src/next/files/route.d.ts +99 -0
  150. package/esm/src/next/files/route.d.ts.map +1 -0
  151. package/esm/src/next/files/route.js +349 -0
  152. package/esm/src/next/jobs/list.d.ts +25 -0
  153. package/esm/src/next/jobs/list.d.ts.map +1 -0
  154. package/esm/src/next/jobs/list.js +39 -0
  155. package/esm/src/next/jobs/mod.d.ts +6 -0
  156. package/esm/src/next/jobs/mod.d.ts.map +1 -0
  157. package/esm/src/next/jobs/mod.js +5 -0
  158. package/esm/src/next/jobs/paths.d.ts +14 -0
  159. package/esm/src/next/jobs/paths.d.ts.map +1 -0
  160. package/esm/src/next/jobs/paths.js +40 -0
  161. package/esm/src/next/jobs/route.d.ts +48 -0
  162. package/esm/src/next/jobs/route.d.ts.map +1 -0
  163. package/esm/src/next/jobs/route.js +101 -0
  164. package/esm/src/next/jobs/run.d.ts +51 -0
  165. package/esm/src/next/jobs/run.d.ts.map +1 -0
  166. package/esm/src/next/jobs/run.js +563 -0
  167. package/esm/src/next/jobs/stream.d.ts +3 -0
  168. package/esm/src/next/jobs/stream.d.ts.map +1 -0
  169. package/esm/src/next/jobs/stream.js +25 -0
  170. package/esm/src/next/pwa/mod.d.ts +104 -0
  171. package/esm/src/next/pwa/mod.d.ts.map +1 -0
  172. package/esm/src/next/pwa/mod.js +169 -0
  173. package/esm/src/next/pwa/worker.d.ts +27 -0
  174. package/esm/src/next/pwa/worker.d.ts.map +1 -0
  175. package/esm/src/next/pwa/worker.js +27 -0
  176. package/package.json +293 -0
  177. package/script/_dnt.polyfills.d.ts +149 -0
  178. package/script/_dnt.polyfills.d.ts.map +1 -0
  179. package/script/_dnt.polyfills.js +166 -0
  180. package/script/_dnt.shims.d.ts +2 -0
  181. package/script/_dnt.shims.d.ts.map +1 -0
  182. package/script/_dnt.shims.js +60 -0
  183. package/script/bin/loom.d.ts +2 -0
  184. package/script/bin/loom.d.ts.map +1 -0
  185. package/script/bin/loom.js +17 -0
  186. package/script/mod.d.ts +9 -0
  187. package/script/mod.d.ts.map +1 -0
  188. package/script/mod.js +24 -0
  189. package/script/package.json +3 -0
  190. package/script/src/apiKeys/authorize.d.ts +4 -0
  191. package/script/src/apiKeys/authorize.d.ts.map +1 -0
  192. package/script/src/apiKeys/authorize.js +187 -0
  193. package/script/src/apiKeys/country.d.ts +3 -0
  194. package/script/src/apiKeys/country.d.ts.map +1 -0
  195. package/script/src/apiKeys/country.js +10 -0
  196. package/script/src/apiKeys/credentials.d.ts +4 -0
  197. package/script/src/apiKeys/credentials.d.ts.map +1 -0
  198. package/script/src/apiKeys/credentials.js +58 -0
  199. package/script/src/apiKeys/fingerprint.d.ts +3 -0
  200. package/script/src/apiKeys/fingerprint.d.ts.map +1 -0
  201. package/script/src/apiKeys/fingerprint.js +8 -0
  202. package/script/src/apiKeys/mod.d.ts +9 -0
  203. package/script/src/apiKeys/mod.d.ts.map +1 -0
  204. package/script/src/apiKeys/mod.js +24 -0
  205. package/script/src/apiKeys/policy.d.ts +59 -0
  206. package/script/src/apiKeys/policy.d.ts.map +1 -0
  207. package/script/src/apiKeys/policy.js +92 -0
  208. package/script/src/apiKeys/retention.d.ts +55 -0
  209. package/script/src/apiKeys/retention.d.ts.map +1 -0
  210. package/script/src/apiKeys/retention.js +70 -0
  211. package/script/src/apiKeys/types.d.ts +175 -0
  212. package/script/src/apiKeys/types.d.ts.map +1 -0
  213. package/script/src/apiKeys/types.js +2 -0
  214. package/script/src/cli/externalSkills.d.ts +39 -0
  215. package/script/src/cli/externalSkills.d.ts.map +1 -0
  216. package/script/src/cli/externalSkills.js +181 -0
  217. package/script/src/cli/mod.d.ts +337 -0
  218. package/script/src/cli/mod.d.ts.map +1 -0
  219. package/script/src/cli/mod.js +9337 -0
  220. package/script/src/cli/projectSkills.d.ts +102 -0
  221. package/script/src/cli/projectSkills.d.ts.map +1 -0
  222. package/script/src/cli/projectSkills.js +606 -0
  223. package/script/src/files/client.d.ts +29 -0
  224. package/script/src/files/client.d.ts.map +1 -0
  225. package/script/src/files/client.js +45 -0
  226. package/script/src/files/errors.d.ts +37 -0
  227. package/script/src/files/errors.d.ts.map +1 -0
  228. package/script/src/files/errors.js +76 -0
  229. package/script/src/files/hash.d.ts +15 -0
  230. package/script/src/files/hash.d.ts.map +1 -0
  231. package/script/src/files/hash.js +89 -0
  232. package/script/src/files/memory.d.ts +29 -0
  233. package/script/src/files/memory.d.ts.map +1 -0
  234. package/script/src/files/memory.js +113 -0
  235. package/script/src/files/metadata.d.ts +10 -0
  236. package/script/src/files/metadata.d.ts.map +1 -0
  237. package/script/src/files/metadata.js +189 -0
  238. package/script/src/files/mod.d.ts +10 -0
  239. package/script/src/files/mod.d.ts.map +1 -0
  240. package/script/src/files/mod.js +25 -0
  241. package/script/src/files/s3.d.ts +29 -0
  242. package/script/src/files/s3.d.ts.map +1 -0
  243. package/script/src/files/s3.js +110 -0
  244. package/script/src/files/service.d.ts +27 -0
  245. package/script/src/files/service.d.ts.map +1 -0
  246. package/script/src/files/service.js +139 -0
  247. package/script/src/files/types.d.ts +134 -0
  248. package/script/src/files/types.d.ts.map +1 -0
  249. package/script/src/files/types.js +2 -0
  250. package/script/src/jobs/catalog.d.ts +32 -0
  251. package/script/src/jobs/catalog.d.ts.map +1 -0
  252. package/script/src/jobs/catalog.js +223 -0
  253. package/script/src/jobs/controller.d.ts +28 -0
  254. package/script/src/jobs/controller.d.ts.map +1 -0
  255. package/script/src/jobs/controller.js +100 -0
  256. package/script/src/jobs/direct.d.ts +36 -0
  257. package/script/src/jobs/direct.d.ts.map +1 -0
  258. package/script/src/jobs/direct.js +128 -0
  259. package/script/src/jobs/events.d.ts +15 -0
  260. package/script/src/jobs/events.d.ts.map +1 -0
  261. package/script/src/jobs/events.js +37 -0
  262. package/script/src/jobs/format.d.ts +16 -0
  263. package/script/src/jobs/format.d.ts.map +1 -0
  264. package/script/src/jobs/format.js +193 -0
  265. package/script/src/jobs/http.d.ts +22 -0
  266. package/script/src/jobs/http.d.ts.map +1 -0
  267. package/script/src/jobs/http.js +50 -0
  268. package/script/src/jobs/log.d.ts +2 -0
  269. package/script/src/jobs/log.d.ts.map +1 -0
  270. package/script/src/jobs/log.js +13 -0
  271. package/script/src/jobs/mod.d.ts +10 -0
  272. package/script/src/jobs/mod.d.ts.map +1 -0
  273. package/script/src/jobs/mod.js +25 -0
  274. package/script/src/jobs/run.d.ts +20 -0
  275. package/script/src/jobs/run.d.ts.map +1 -0
  276. package/script/src/jobs/run.js +61 -0
  277. package/script/src/jobs/types.d.ts +31 -0
  278. package/script/src/jobs/types.d.ts.map +1 -0
  279. package/script/src/jobs/types.js +2 -0
  280. package/script/src/mui/apiKeys.d.ts +65 -0
  281. package/script/src/mui/apiKeys.d.ts.map +1 -0
  282. package/script/src/mui/apiKeys.js +327 -0
  283. package/script/src/mui/apiKeysView.d.ts +48 -0
  284. package/script/src/mui/apiKeysView.d.ts.map +1 -0
  285. package/script/src/mui/apiKeysView.js +40 -0
  286. package/script/src/mui/confirm.d.ts +12 -0
  287. package/script/src/mui/confirm.d.ts.map +1 -0
  288. package/script/src/mui/confirm.js +85 -0
  289. package/script/src/mui/mod.d.ts +4 -0
  290. package/script/src/mui/mod.d.ts.map +1 -0
  291. package/script/src/mui/mod.js +19 -0
  292. package/script/src/next/apiKeys/mod.d.ts +64 -0
  293. package/script/src/next/apiKeys/mod.d.ts.map +1 -0
  294. package/script/src/next/apiKeys/mod.js +224 -0
  295. package/script/src/next/auth/config.d.ts +34 -0
  296. package/script/src/next/auth/config.d.ts.map +1 -0
  297. package/script/src/next/auth/config.js +142 -0
  298. package/script/src/next/auth/mod.d.ts +3 -0
  299. package/script/src/next/auth/mod.d.ts.map +1 -0
  300. package/script/src/next/auth/mod.js +18 -0
  301. package/script/src/next/auth/server.d.ts +28 -0
  302. package/script/src/next/auth/server.d.ts.map +1 -0
  303. package/script/src/next/auth/server.js +27 -0
  304. package/script/src/next/files/mod.d.ts +3 -0
  305. package/script/src/next/files/mod.d.ts.map +1 -0
  306. package/script/src/next/files/mod.js +18 -0
  307. package/script/src/next/files/route.d.ts +99 -0
  308. package/script/src/next/files/route.d.ts.map +1 -0
  309. package/script/src/next/files/route.js +353 -0
  310. package/script/src/next/jobs/list.d.ts +25 -0
  311. package/script/src/next/jobs/list.d.ts.map +1 -0
  312. package/script/src/next/jobs/list.js +48 -0
  313. package/script/src/next/jobs/mod.d.ts +6 -0
  314. package/script/src/next/jobs/mod.d.ts.map +1 -0
  315. package/script/src/next/jobs/mod.js +21 -0
  316. package/script/src/next/jobs/paths.d.ts +14 -0
  317. package/script/src/next/jobs/paths.d.ts.map +1 -0
  318. package/script/src/next/jobs/paths.js +47 -0
  319. package/script/src/next/jobs/route.d.ts +48 -0
  320. package/script/src/next/jobs/route.d.ts.map +1 -0
  321. package/script/src/next/jobs/route.js +105 -0
  322. package/script/src/next/jobs/run.d.ts +51 -0
  323. package/script/src/next/jobs/run.d.ts.map +1 -0
  324. package/script/src/next/jobs/run.js +570 -0
  325. package/script/src/next/jobs/stream.d.ts +3 -0
  326. package/script/src/next/jobs/stream.d.ts.map +1 -0
  327. package/script/src/next/jobs/stream.js +28 -0
  328. package/script/src/next/pwa/mod.d.ts +104 -0
  329. package/script/src/next/pwa/mod.d.ts.map +1 -0
  330. package/script/src/next/pwa/mod.js +192 -0
  331. package/script/src/next/pwa/worker.d.ts +27 -0
  332. package/script/src/next/pwa/worker.d.ts.map +1 -0
  333. package/script/src/next/pwa/worker.js +33 -0
  334. package/skills/loom/SKILL.md +200 -0
  335. package/skills/loom-api-keys/SKILL.md +123 -0
  336. package/skills/loom-auth/SKILL.md +70 -0
  337. package/skills/loom-db/SKILL.md +94 -0
  338. package/skills/loom-db/references/db-stack.md +39 -0
  339. package/skills/loom-files/SKILL.md +97 -0
  340. package/skills/loom-jobs/SKILL.md +148 -0
  341. package/skills/upgrade-deps/SKILL.md +165 -0
  342. package/skills/upgrade-deps/agents/openai.yaml +4 -0
@@ -0,0 +1,104 @@
1
+ import "../../../_dnt.polyfills.js";
2
+ export * from "./worker.js";
3
+ import type { LoomPwaUpdateMode } from "./worker.js";
4
+ export declare const DEFAULT_LOOM_PWA_UPDATE_PROMPT = "A newer version of this web app is available. Reload to update?";
5
+ /** Event payload shape emitted by the Serwist browser lifecycle helper. */
6
+ export interface LoomSerwistLifecycleEvent {
7
+ /** Whether Serwist identified the event as an update to an existing worker. */
8
+ isUpdate?: boolean;
9
+ /** The Serwist lifecycle event name. */
10
+ type: string;
11
+ /** Whether a waiting service worker existed before registration completed. */
12
+ wasWaitingBeforeRegister?: boolean;
13
+ }
14
+ /** Serwist lifecycle event names handled by the Loom PWA lifecycle adapter. */
15
+ export type LoomSerwistEventName = "activated" | "controlling" | "installed" | "message" | "redundant" | "waiting";
16
+ /**
17
+ * Minimal shape of the Serwist browser helper exposed on `window.serwist`.
18
+ *
19
+ * Loom keeps this structural instead of importing Serwist directly so the client
20
+ * lifecycle helper stays usable with different Serwist integration modes.
21
+ */
22
+ export interface LoomWindowSerwist {
23
+ addEventListener: (type: LoomSerwistEventName, listener: (event: LoomSerwistLifecycleEvent) => void) => void;
24
+ messageSkipWaiting: () => Promise<void>;
25
+ register: () => Promise<ServiceWorkerRegistration | undefined>;
26
+ removeEventListener: (type: LoomSerwistEventName, listener: (event: LoomSerwistLifecycleEvent) => void) => void;
27
+ }
28
+ /** Context passed to app hooks during the PWA update lifecycle. */
29
+ export interface LoomPwaUpdateContext {
30
+ /** Raw Serwist lifecycle event that triggered the callback. */
31
+ event: LoomSerwistLifecycleEvent;
32
+ /** Whether the lifecycle event represents an update rather than first install. */
33
+ isUpdate: boolean;
34
+ /** Which lifecycle stage caused the callback. */
35
+ reason: "controlling" | "waiting";
36
+ /** Serwist browser helper used by Loom to register and activate workers. */
37
+ serwist: LoomWindowSerwist;
38
+ /** Whether Serwist reported a waiting worker before registration completed. */
39
+ wasWaitingBeforeRegister?: boolean;
40
+ }
41
+ /** Options for `setupLoomPwaLifecycle` and the `LoomPwaLifecycle` component. */
42
+ export interface LoomPwaLifecycleOptions {
43
+ /**
44
+ * Lets the app delay update activation while user work is in progress.
45
+ *
46
+ * Return `false` to defer prompting or reloading for the current update event.
47
+ */
48
+ canReloadNow?: (context: LoomPwaUpdateContext) => boolean | Promise<boolean>;
49
+ /**
50
+ * Prompt shown when an update is waiting in `prompt` mode.
51
+ *
52
+ * Omit this to use the browser `confirm()` fallback, or pass the shared MUI
53
+ * `asyncConfirm` adapter from `@gadicc/loom/mui/confirm`.
54
+ */
55
+ confirmUpdate?: (context: LoomPwaUpdateContext) => boolean | Promise<boolean>;
56
+ /** Logger for lifecycle diagnostics, or `false` to silence Loom logging. */
57
+ logger?: Pick<Console, "debug" | "error" | "info" | "warn"> | false;
58
+ /** Error sink for registration, update-check, and lifecycle callback failures. */
59
+ onError?: (error: unknown) => void;
60
+ /** Called after the user/app accepts an update and before `skipWaiting`. */
61
+ onUpdateAccepted?: (context: LoomPwaUpdateContext) => void;
62
+ /** Called immediately before Loom reloads after the new worker takes control. */
63
+ onUpdateActivated?: (context: LoomPwaUpdateContext) => void;
64
+ /** Called when Serwist reports a waiting update. */
65
+ onUpdateAvailable?: (context: LoomPwaUpdateContext) => void;
66
+ /** Called when an update is found but not applied during the current event. */
67
+ onUpdateDeferred?: (context: LoomPwaUpdateContext) => void;
68
+ /** Whether Loom should call `serwist.register()` on mount. Defaults to true. */
69
+ register?: boolean;
70
+ /** Reload implementation used after an accepted update takes control. */
71
+ reload?: () => void;
72
+ /** Optional interval for calling `ServiceWorkerRegistration.update()`. */
73
+ updateCheckIntervalMs?: number;
74
+ /**
75
+ * Update activation policy.
76
+ *
77
+ * `prompt` asks before activating, `manual` only reports availability, and
78
+ * `auto` activates/reloads without asking when the app allows reloading.
79
+ */
80
+ updateMode?: LoomPwaUpdateMode;
81
+ }
82
+ declare global {
83
+ interface Window {
84
+ serwist?: LoomWindowSerwist;
85
+ }
86
+ }
87
+ /**
88
+ * Registers Loom's Serwist lifecycle listeners and optional update polling.
89
+ *
90
+ * The returned cleanup function removes listeners and clears the polling timer.
91
+ * In `prompt` mode, a waiting worker is activated only after `canReloadNow` and
92
+ * `confirmUpdate` both allow it; in `manual` mode Loom reports availability but
93
+ * never activates the worker for the app.
94
+ */
95
+ export declare function setupLoomPwaLifecycle(options?: LoomPwaLifecycleOptions): () => void;
96
+ /**
97
+ * React component wrapper around `setupLoomPwaLifecycle`.
98
+ *
99
+ * Render this inside `SerwistProvider` with `register={false}` so Loom owns
100
+ * registration, update prompts, and reload timing while Serwist still provides
101
+ * the browser helper on `window.serwist`.
102
+ */
103
+ export declare function LoomPwaLifecycle({ canReloadNow, confirmUpdate, logger, onError, onUpdateAccepted, onUpdateActivated, onUpdateAvailable, onUpdateDeferred, register, reload, updateCheckIntervalMs, updateMode, }: LoomPwaLifecycleOptions): null;
104
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/next/pwa/mod.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.DEFAULT_LOOM_PWA_UPDATE_PROMPT = void 0;
21
+ exports.setupLoomPwaLifecycle = setupLoomPwaLifecycle;
22
+ exports.LoomPwaLifecycle = LoomPwaLifecycle;
23
+ require("../../../_dnt.polyfills.js");
24
+ "use client";
25
+ const react_1 = __importDefault(require("react"));
26
+ __exportStar(require("./worker.js"), exports);
27
+ exports.DEFAULT_LOOM_PWA_UPDATE_PROMPT = "A newer version of this web app is available. Reload to update?";
28
+ function defaultReload() {
29
+ globalThis.location.reload();
30
+ }
31
+ function defaultConfirmUpdate() {
32
+ if (typeof globalThis.confirm !== "function") {
33
+ return false;
34
+ }
35
+ return globalThis.confirm(exports.DEFAULT_LOOM_PWA_UPDATE_PROMPT);
36
+ }
37
+ function getSerwist() {
38
+ if (typeof globalThis.navigator === "undefined" ||
39
+ !("serviceWorker" in globalThis.navigator) ||
40
+ globalThis.serwist === undefined) {
41
+ return null;
42
+ }
43
+ return globalThis.serwist;
44
+ }
45
+ function reportError(error, onError, logger) {
46
+ if (onError) {
47
+ onError(error);
48
+ return;
49
+ }
50
+ if (logger !== false) {
51
+ (logger ?? console).error("[PWA] Service worker lifecycle error", error);
52
+ }
53
+ }
54
+ async function canApplyUpdate(context, options) {
55
+ return await (options.canReloadNow?.(context) ?? true);
56
+ }
57
+ /**
58
+ * Registers Loom's Serwist lifecycle listeners and optional update polling.
59
+ *
60
+ * The returned cleanup function removes listeners and clears the polling timer.
61
+ * In `prompt` mode, a waiting worker is activated only after `canReloadNow` and
62
+ * `confirmUpdate` both allow it; in `manual` mode Loom reports availability but
63
+ * never activates the worker for the app.
64
+ */
65
+ function setupLoomPwaLifecycle(options = {}) {
66
+ const serwist = getSerwist();
67
+ if (!serwist) {
68
+ return () => { };
69
+ }
70
+ const updateMode = options.updateMode ?? "prompt";
71
+ const logger = options.logger === false ? false : options.logger ?? console;
72
+ const reload = options.reload ?? defaultReload;
73
+ let disposed = false;
74
+ let reloadOnNextControl = false;
75
+ let updateInterval;
76
+ const makeContext = (reason, event) => ({
77
+ event,
78
+ isUpdate: event.isUpdate ?? reason === "waiting",
79
+ reason,
80
+ serwist,
81
+ wasWaitingBeforeRegister: event.wasWaitingBeforeRegister,
82
+ });
83
+ const deferUpdate = (context) => {
84
+ options.onUpdateDeferred?.(context);
85
+ logger && logger.info("[PWA] Update deferred.");
86
+ };
87
+ const handleWaiting = async (event) => {
88
+ const context = makeContext("waiting", event);
89
+ options.onUpdateAvailable?.(context);
90
+ if (updateMode === "manual") {
91
+ deferUpdate(context);
92
+ return;
93
+ }
94
+ if (!(await canApplyUpdate(context, options))) {
95
+ deferUpdate(context);
96
+ return;
97
+ }
98
+ const accepted = updateMode === "auto"
99
+ ? true
100
+ : await (options.confirmUpdate?.(context) ?? defaultConfirmUpdate());
101
+ if (!accepted) {
102
+ deferUpdate(context);
103
+ return;
104
+ }
105
+ reloadOnNextControl = true;
106
+ options.onUpdateAccepted?.(context);
107
+ await serwist.messageSkipWaiting();
108
+ };
109
+ const handleControlling = async (event) => {
110
+ const context = makeContext("controlling", event);
111
+ if (!context.isUpdate || (!reloadOnNextControl && updateMode !== "auto")) {
112
+ return;
113
+ }
114
+ if (!(await canApplyUpdate(context, options))) {
115
+ deferUpdate(context);
116
+ return;
117
+ }
118
+ options.onUpdateActivated?.(context);
119
+ reload();
120
+ };
121
+ const waitingListener = (event) => {
122
+ handleWaiting(event).catch((error) => reportError(error, options.onError, options.logger));
123
+ };
124
+ const controllingListener = (event) => {
125
+ handleControlling(event).catch((error) => reportError(error, options.onError, options.logger));
126
+ };
127
+ serwist.addEventListener("waiting", waitingListener);
128
+ serwist.addEventListener("controlling", controllingListener);
129
+ if (options.register ?? true) {
130
+ serwist.register().catch((error) => reportError(error, options.onError, options.logger));
131
+ }
132
+ if (options.updateCheckIntervalMs !== undefined &&
133
+ options.updateCheckIntervalMs > 0) {
134
+ navigator.serviceWorker.ready
135
+ .then((registration) => {
136
+ if (disposed) {
137
+ return;
138
+ }
139
+ logger &&
140
+ logger.info(`[PWA] Will check for updates every ${options.updateCheckIntervalMs / 1000} seconds.`);
141
+ updateInterval = setInterval(() => {
142
+ registration.update().catch((error) => reportError(error, options.onError, options.logger));
143
+ }, options.updateCheckIntervalMs);
144
+ })
145
+ .catch((error) => reportError(error, options.onError, options.logger));
146
+ }
147
+ return () => {
148
+ disposed = true;
149
+ serwist.removeEventListener("waiting", waitingListener);
150
+ serwist.removeEventListener("controlling", controllingListener);
151
+ if (updateInterval !== undefined) {
152
+ clearInterval(updateInterval);
153
+ }
154
+ };
155
+ }
156
+ /**
157
+ * React component wrapper around `setupLoomPwaLifecycle`.
158
+ *
159
+ * Render this inside `SerwistProvider` with `register={false}` so Loom owns
160
+ * registration, update prompts, and reload timing while Serwist still provides
161
+ * the browser helper on `window.serwist`.
162
+ */
163
+ function LoomPwaLifecycle({ canReloadNow, confirmUpdate, logger, onError, onUpdateAccepted, onUpdateActivated, onUpdateAvailable, onUpdateDeferred, register, reload, updateCheckIntervalMs, updateMode, }) {
164
+ react_1.default.useEffect(() => setupLoomPwaLifecycle({
165
+ canReloadNow,
166
+ confirmUpdate,
167
+ logger,
168
+ onError,
169
+ onUpdateAccepted,
170
+ onUpdateActivated,
171
+ onUpdateAvailable,
172
+ onUpdateDeferred,
173
+ register,
174
+ reload,
175
+ updateCheckIntervalMs,
176
+ updateMode,
177
+ }), [
178
+ canReloadNow,
179
+ confirmUpdate,
180
+ logger,
181
+ onError,
182
+ onUpdateAccepted,
183
+ onUpdateActivated,
184
+ onUpdateAvailable,
185
+ onUpdateDeferred,
186
+ register,
187
+ reload,
188
+ updateCheckIntervalMs,
189
+ updateMode,
190
+ ]);
191
+ return null;
192
+ }
@@ -0,0 +1,27 @@
1
+ import "../../../_dnt.polyfills.js";
2
+ export type LoomPwaUpdateMode = "auto" | "manual" | "prompt";
3
+ export interface CreateLoomPwaSerwistOptionsInput<TPrecacheEntry, TRuntimeCaching> {
4
+ precacheEntries: readonly TPrecacheEntry[] | undefined;
5
+ runtimeCaching: TRuntimeCaching;
6
+ updateMode?: LoomPwaUpdateMode;
7
+ navigationPreload?: boolean;
8
+ }
9
+ export declare function getLoomPwaWorkerFlags(updateMode?: LoomPwaUpdateMode): {
10
+ clientsClaim: boolean;
11
+ skipWaiting: boolean;
12
+ };
13
+ export declare function createLoomPwaSerwistOptions<TPrecacheEntry, TRuntimeCaching>(options: CreateLoomPwaSerwistOptionsInput<TPrecacheEntry, TRuntimeCaching>): {
14
+ navigationPreload: boolean;
15
+ runtimeCaching: TRuntimeCaching;
16
+ clientsClaim: boolean;
17
+ skipWaiting: boolean;
18
+ precacheEntries: TPrecacheEntry[] | undefined;
19
+ };
20
+ type SkipWaitingScope = {
21
+ addEventListener: (type: "message", listener: (event: MessageEvent) => void) => void;
22
+ removeEventListener?: (type: "message", listener: (event: MessageEvent) => void) => void;
23
+ skipWaiting: () => Promise<void>;
24
+ };
25
+ export declare function addLoomPwaSkipWaitingListener(scope: SkipWaitingScope): () => void;
26
+ export {};
27
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../../src/src/next/pwa/worker.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,gCAAgC,CAC/C,cAAc,EACd,eAAe;IAEf,eAAe,EAAE,SAAS,cAAc,EAAE,GAAG,SAAS,CAAC;IACvD,cAAc,EAAE,eAAe,CAAC;IAChC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,qBAAqB,CACnC,UAAU,GAAE,iBAA4B;;;EAMzC;AAED,wBAAgB,2BAA2B,CACzC,cAAc,EACd,eAAe,EAEf,OAAO,EAAE,gCAAgC,CAAC,cAAc,EAAE,eAAe,CAAC;;;;;;EAU3E;AAED,KAAK,gBAAgB,GAAG;IACtB,gBAAgB,EAAE,CAChB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,KACpC,IAAI,CAAC;IACV,mBAAmB,CAAC,EAAE,CACpB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,KACpC,IAAI,CAAC;IACV,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,gBAAgB,cAYpE"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLoomPwaWorkerFlags = getLoomPwaWorkerFlags;
4
+ exports.createLoomPwaSerwistOptions = createLoomPwaSerwistOptions;
5
+ exports.addLoomPwaSkipWaitingListener = addLoomPwaSkipWaitingListener;
6
+ require("../../../_dnt.polyfills.js");
7
+ function getLoomPwaWorkerFlags(updateMode = "prompt") {
8
+ return {
9
+ clientsClaim: true,
10
+ skipWaiting: updateMode === "auto",
11
+ };
12
+ }
13
+ function createLoomPwaSerwistOptions(options) {
14
+ return {
15
+ precacheEntries: options.precacheEntries
16
+ ? [...options.precacheEntries]
17
+ : undefined,
18
+ ...getLoomPwaWorkerFlags(options.updateMode),
19
+ navigationPreload: options.navigationPreload ?? true,
20
+ runtimeCaching: options.runtimeCaching,
21
+ };
22
+ }
23
+ function addLoomPwaSkipWaitingListener(scope) {
24
+ const listener = (event) => {
25
+ if (event.data?.type === "SKIP_WAITING") {
26
+ void scope.skipWaiting();
27
+ }
28
+ };
29
+ scope.addEventListener("message", listener);
30
+ return () => {
31
+ scope.removeEventListener?.("message", listener);
32
+ };
33
+ }
@@ -0,0 +1,200 @@
1
+ ---
2
+ name: loom
3
+ description: Use when working in an app that consumes @gadicc/loom or when the task mentions loom.json, loom init/check/add, shared loom feature adoption, thin wrapper files, or deciding whether behavior belongs in the shared loom package versus the local app.
4
+ ---
5
+
6
+ # Loom
7
+
8
+ Use this skill in consuming application repositories that have adopted
9
+ `@gadicc/loom`.
10
+
11
+ Consumer repos should keep `AGENTS.md` small and route work here through the
12
+ managed Loom bootstrap block instead of copying the shared policy into every
13
+ project.
14
+
15
+ ## Start here
16
+
17
+ 1. Read `loom.json` first.
18
+ 2. Identify which loom features are active and which paths are configured there.
19
+ 3. Treat the active loom features as the contract between the app and the shared
20
+ package.
21
+ 4. Run `loom status` when you need a quick summary of active features, local
22
+ Loom dev state, or managed/recommended skill links.
23
+
24
+ ## Cross-repository Loom work
25
+
26
+ When work starts in a consumer app but requires inspecting or changing a Loom
27
+ source checkout, do not assume the source repository's instructions were loaded
28
+ from the consumer's working directory.
29
+
30
+ - Locate and read the Loom checkout's root `AGENTS.md` before running
31
+ repository-specific commands or editing files there.
32
+ - Also read any more deeply nested `AGENTS.md` that applies to the target file.
33
+ - Treat the source checkout's instructions as authoritative for Loom changes;
34
+ the consumer app's instructions still apply to changes made in that app.
35
+ - Check the git status of both repositories before editing, and keep their
36
+ verification and commits separate unless the user explicitly requests a
37
+ different workflow.
38
+
39
+ ## Working rules
40
+
41
+ - Prefer the shared `@gadicc/loom` package for stable cross-app behavior.
42
+ - Preserve app-specific behavior through thin wrappers, configuration, and
43
+ app-local modules instead of forcing every app into the same structure.
44
+ - If a fix would benefit multiple loom consumers, make it in the shared package
45
+ instead of duplicating it in one app.
46
+ - Do not assume one file layout. Respect `app/...` vs `src/app/...` and any
47
+ configured loom paths.
48
+ - If a loom-managed file exists only as a thin wrapper, keep it thin unless the
49
+ app intentionally needs custom behavior there.
50
+
51
+ ## Environment loading
52
+
53
+ - Next commands such as `next dev`, `next build`, and server runtime code load
54
+ `.env*` files themselves. Do not add extra env loading around those paths.
55
+ - Non-Next commands that need app env should run through a project package
56
+ script that centralizes env loading, or directly through
57
+ `pnpm exec loom env -- <command>`.
58
+ - `loom env -- <command> [...args]` loads env files from the consumer project
59
+ root with Next-compatible `@next/env` semantics, preserves existing shell env
60
+ precedence, then runs the command from the project root.
61
+ - Implementation files, generated wrappers, Drizzle configs, and direct job
62
+ runners should not import `dotenv` or `@next/env` by hand.
63
+ - After `vercel pull` in external CI, treat `.vercel/.env.<target>.local` as a
64
+ plaintext secret file. Sensitive values are available to that build path but
65
+ not to `vercel env run`; mask them before build output and load the pulled
66
+ file explicitly for migrations.
67
+
68
+ ## Re-establishing work context
69
+
70
+ When a user resumes prior work, references earlier implementation state, or asks
71
+ for follow-up on an existing feature, reconstruct the current project state
72
+ before making substantial changes.
73
+
74
+ Use a scoped pass:
75
+
76
+ - Read `loom.json` and identify active Loom features relevant to the task.
77
+ - Check `git status --short` so existing local changes are understood.
78
+ - Review recent commits relevant to the touched feature, preferably path-scoped
79
+ with `git log -- <paths>`.
80
+ - Look for nearby `README.md`, design notes, roadmaps, lessons-learned docs, and
81
+ other `.md` files in the relevant code paths.
82
+ - Inspect the current implementation and tests before assuming the last known
83
+ state from memory.
84
+ - Summarize the current state, intended next step, and notable risks before
85
+ making substantial changes.
86
+
87
+ Keep this proportional: avoid broad repo-wide archaeology for small isolated
88
+ requests, but do the context pass when the user signals continuity, uncertainty,
89
+ or work spanning multiple prior commits.
90
+
91
+ ## Runtime evidence before theory
92
+
93
+ When a live or manual test fails, inspect durable runtime state before
94
+ diagnosing from the top-level error message alone. Prefer concrete evidence such
95
+ as database rows, job/run artifacts, checkpoints, logs, saved metadata, and the
96
+ exact command or UI path used. Treat the provider or system's recorded response
97
+ as more authoritative than a generic mapped error when deciding what failed.
98
+
99
+ ## Documentation and comments
100
+
101
+ - Add JSDoc for new exported functions or methods when intent, key behavior, or
102
+ constraints would not otherwise be obvious.
103
+ - Add JSDoc for new interfaces or types that cross module boundaries.
104
+ - Add property-level descriptions when a type shape is shared and the property
105
+ names alone are not enough.
106
+ - Add concise comments on non-obvious code paths, especially to explain "why" or
107
+ a tradeoff.
108
+ - Do not add comments for obvious assignments or control flow.
109
+
110
+ ## Verification
111
+
112
+ - Run `loom check` when validating a consuming app.
113
+ - Run `loom add` to list CLI-activatable shared features and `loom status` to
114
+ inspect which features and project skills are currently wired in.
115
+ - Use `loom skills check` to validate locked external skills and package skill
116
+ activations, and `loom skills update` to adopt reviewed catalog revisions.
117
+ - Third-party skills must remain consumer-installed; never copy their content
118
+ into the Loom package. Missing upstream licenses require explicit consumer
119
+ acknowledgement.
120
+ - In the Loom package source checkout, treat `"use client"` and `"use server"`
121
+ as emitted-package contracts. Run `deno task build` after changes that may
122
+ affect `dnt`: syntax anywhere in an entrypoint graph can cause a polyfill
123
+ import to be emitted before a framework directive. Prefer a portable
124
+ equivalent or adjust the build; never edit generated `npm/` output by hand.
125
+ The package build rejects generated ESM with code before either directive.
126
+ - After loom-related changes, also run the repo's normal verification commands
127
+ before handoff.
128
+ - If the task touches Next.js routes, confirm the wrapper paths still point at
129
+ real files and that App Router conventions are still respected.
130
+ - If Loom-managed Next.js routes or wrappers were changed and runtime tooling is
131
+ available, prefer runtime verification in addition to static checks.
132
+ - If the task affects an active feature, prefer feature-specific loom skills
133
+ such as `loom-jobs` or `loom-api-keys`.
134
+
135
+ ## Local development
136
+
137
+ - For local unpublished Loom package development in pnpm apps, prefer
138
+ `loom dev local <path>` over `pnpm link`.
139
+ - The managed local-dev flow keeps the committed dependency on the published
140
+ Loom version, writes a managed `file:` marker in `pnpm-workspace.yaml`, and
141
+ then requires the explicit `pnpm update --no-save` command that
142
+ `loom dev local` prints for the direct dependency.
143
+ - This still avoids the peer-resolution problems we observed with `pnpm link`
144
+ when Loom is consumed by React apps.
145
+ - Treat this as a workaround for current pnpm behavior, not a permanent
146
+ preference. If pnpm's local-link behavior changes enough to preserve peer
147
+ resolution cleanly for Loom, this workaround can be revisited or removed.
148
+ - Before committing app changes or preparing a published build, switch back with
149
+ `loom dev published`, then run the published `pnpm update --no-save` command
150
+ it prints, and then `pnpm install`.
151
+ - `loom dev sync` records the Loom source commit in the managed
152
+ `pnpm-workspace.yaml` block and gitignored `.loom/dev-state.json` when the
153
+ local package path points at a Loom git checkout.
154
+ - `loom dev published` uses that recorded commit as a release gate when present:
155
+ the commit must be cleanly synced, reachable from `origin/main`, and either
156
+ included in a semver release tag or package-equivalent to the latest semver
157
+ release because only non-package files changed after that tag. The app then
158
+ switches to the exact published Loom version that covers the sync.
159
+ - `loom dev published` also notices stale `pnpm-lock.yaml` resolutions that
160
+ still point at local Loom after the workspace override has been removed.
161
+ - `loom check` should warn during normal development if `pnpm-lock.yaml` still
162
+ resolves Loom locally, if the synced Loom commit is unpublished, or if it is
163
+ covered by a newer exact version than the app currently pins.
164
+ - If an older local-dev block has no recorded commit, switch back carefully and
165
+ run `loom dev sync` first whenever the app may depend on unpublished Loom
166
+ changes.
167
+ - Before app release or CD builds, run `loom check --production` so local Loom
168
+ overrides, local lockfile resolutions, and unresolved synced Loom commits fail
169
+ the build instead of remaining advisory warnings.
170
+ - Publishing Loom makes a version available, but it should not move unrelated
171
+ consumer apps; each app upgrades only through its own package and lockfile
172
+ changes.
173
+
174
+ ## Semver and compatibility
175
+
176
+ - Loom changes that are visible to consumer apps must honor semver.
177
+ - Prefer additive APIs, adapters, compatibility flags, and deprecation notices
178
+ over breaking existing consumers.
179
+ - Keep old code paths available when practical until active reference apps have
180
+ migrated.
181
+ - Use release-producing Conventional Commits for consumer-needed Loom changes:
182
+ `fix(scope): ...` for patches, `feat(scope): ...` for additive behavior, and
183
+ breaking-change metadata only when consumers must update before upgrading.
184
+ - If one app needs new behavior that would break another app pinned to an older
185
+ Loom version, preserve the older behavior and add an explicit new path for the
186
+ changed behavior.
187
+
188
+ ## Commits
189
+
190
+ - Use conventional commits with scopes for title.
191
+ - In the body, include the motivation, summary of changes, and anything else of
192
+ note.
193
+ - At bottom: "Co-authored with <Assistant> (<model>, reasoning <level>)"
194
+ - If and only if YOU are the Codex tool, use the top-level `model` and
195
+ `model_reasoning_effort` values from `~/.codex/config.toml` for `<model>` and
196
+ `<level>` when present (not relevant for Antigravity or other non-Codex
197
+ assistants).
198
+ - If the exact assistant name, model and reasoning level are unknown and cannot
199
+ be inferred, ask the user before committing and then reuse that answer for the
200
+ rest of the session.