gemi 0.131.0 → 0.133.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 (230) hide show
  1. package/dist/ai/AgentController.d.ts +73 -0
  2. package/dist/ai/AgentController.d.ts.map +1 -1
  3. package/dist/ai/AgentProvider.d.ts +25 -0
  4. package/dist/ai/AgentProvider.d.ts.map +1 -1
  5. package/dist/ai/VoiceBridge.d.ts +365 -0
  6. package/dist/ai/VoiceBridge.d.ts.map +1 -0
  7. package/dist/ai/index.d.ts +13 -0
  8. package/dist/ai/index.d.ts.map +1 -1
  9. package/dist/ai/index.js +18 -18
  10. package/dist/ai/index.js.map +11 -6
  11. package/dist/ai/providers/endpoints.d.ts +19 -0
  12. package/dist/ai/providers/endpoints.d.ts.map +1 -1
  13. package/dist/ai/providers/realtime.d.ts +272 -0
  14. package/dist/ai/providers/realtime.d.ts.map +1 -0
  15. package/dist/ai/providers/sideband.d.ts +254 -0
  16. package/dist/ai/providers/sideband.d.ts.map +1 -0
  17. package/dist/ai/runtime.d.ts.map +1 -1
  18. package/dist/ai/types.d.ts +15 -0
  19. package/dist/ai/types.d.ts.map +1 -1
  20. package/dist/ai/voice/index.d.ts +23 -0
  21. package/dist/ai/voice/index.d.ts.map +1 -0
  22. package/dist/ai/voice/index.js +433 -0
  23. package/dist/ai/voice/index.js.map +1 -0
  24. package/dist/ai/voice/state.d.ts +34 -0
  25. package/dist/ai/voice/state.d.ts.map +1 -0
  26. package/dist/ai/voice/useVoiceSession.d.ts +82 -0
  27. package/dist/ai/voice/useVoiceSession.d.ts.map +1 -0
  28. package/dist/ai/voice/voiceCall.d.ts +57 -0
  29. package/dist/ai/voice/voiceCall.d.ts.map +1 -0
  30. package/dist/ai/voice/wire.d.ts +66 -0
  31. package/dist/ai/voice/wire.d.ts.map +1 -0
  32. package/dist/ai/voiceConfig.d.ts +70 -0
  33. package/dist/ai/voiceConfig.d.ts.map +1 -0
  34. package/dist/ai/voiceMcp.d.ts +89 -0
  35. package/dist/ai/voiceMcp.d.ts.map +1 -0
  36. package/dist/ai/voiceStore.d.ts +52 -0
  37. package/dist/ai/voiceStore.d.ts.map +1 -0
  38. package/dist/app/index.js +1 -1
  39. package/dist/bun/plugin.js +1 -1
  40. package/dist/bun/preload.js +1 -1
  41. package/dist/{chunk-4gmhx2ba.js → chunk-0eamc2tr.js} +2 -2
  42. package/dist/{chunk-4gmhx2ba.js.map → chunk-0eamc2tr.js.map} +1 -1
  43. package/dist/{chunk-2x0n3ze1.js → chunk-0gg4e94v.js} +2 -2
  44. package/dist/{chunk-2x0n3ze1.js.map → chunk-0gg4e94v.js.map} +1 -1
  45. package/dist/{chunk-p642ja42.js → chunk-0rhf4g12.js} +3 -3
  46. package/dist/{chunk-p642ja42.js.map → chunk-0rhf4g12.js.map} +1 -1
  47. package/dist/{chunk-dxm5gxqk.js → chunk-1awxdnb6.js} +1 -1
  48. package/dist/{chunk-2senwsdq.js → chunk-2cnawkke.js} +12 -12
  49. package/dist/{chunk-2senwsdq.js.map → chunk-2cnawkke.js.map} +3 -3
  50. package/dist/{chunk-fxm8fqh9.js → chunk-33hdxe7v.js} +1 -1
  51. package/dist/{chunk-63xekerg.js → chunk-3g5q0cj5.js} +2 -2
  52. package/dist/{chunk-63xekerg.js.map → chunk-3g5q0cj5.js.map} +1 -1
  53. package/dist/{chunk-xjs72pb0.js → chunk-3h37f124.js} +2 -2
  54. package/dist/{chunk-xjs72pb0.js.map → chunk-3h37f124.js.map} +1 -1
  55. package/dist/{chunk-65fq5a9d.js → chunk-4278e429.js} +2 -2
  56. package/dist/{chunk-65fq5a9d.js.map → chunk-4278e429.js.map} +1 -1
  57. package/dist/chunk-47e7fbsp.js +5 -0
  58. package/dist/{chunk-mvka90rq.js.map → chunk-47e7fbsp.js.map} +1 -1
  59. package/dist/{chunk-p6b0cyf8.js → chunk-4pvv8qs0.js} +2 -2
  60. package/dist/{chunk-p6b0cyf8.js.map → chunk-4pvv8qs0.js.map} +1 -1
  61. package/dist/{chunk-rjyw1thg.js → chunk-4t41m5f1.js} +2 -2
  62. package/dist/{chunk-rjyw1thg.js.map → chunk-4t41m5f1.js.map} +1 -1
  63. package/dist/{chunk-f21v4n2v.js → chunk-53rr32zm.js} +1 -1
  64. package/dist/{chunk-xhvknqvn.js → chunk-5pdgh9a1.js} +2 -2
  65. package/dist/{chunk-xhvknqvn.js.map → chunk-5pdgh9a1.js.map} +1 -1
  66. package/dist/{chunk-e4ay1vg9.js → chunk-65j32dtn.js} +2 -2
  67. package/dist/{chunk-e4ay1vg9.js.map → chunk-65j32dtn.js.map} +1 -1
  68. package/dist/{chunk-jxvec7jc.js → chunk-6fr6j338.js} +2 -2
  69. package/dist/{chunk-jxvec7jc.js.map → chunk-6fr6j338.js.map} +1 -1
  70. package/dist/{chunk-jd1afbrs.js → chunk-6hz63ts4.js} +4 -4
  71. package/dist/{chunk-jd1afbrs.js.map → chunk-6hz63ts4.js.map} +1 -1
  72. package/dist/{chunk-4z0rt6ws.js → chunk-6qty7at2.js} +2 -2
  73. package/dist/{chunk-4z0rt6ws.js.map → chunk-6qty7at2.js.map} +1 -1
  74. package/dist/{chunk-pzb3agv9.js → chunk-7nxnyw7x.js} +2 -2
  75. package/dist/{chunk-pzb3agv9.js.map → chunk-7nxnyw7x.js.map} +1 -1
  76. package/dist/{chunk-7n0zn5h4.js → chunk-8ryrjtn0.js} +2 -2
  77. package/dist/{chunk-7n0zn5h4.js.map → chunk-8ryrjtn0.js.map} +1 -1
  78. package/dist/{chunk-c1gq2ttb.js → chunk-8sde8337.js} +2 -2
  79. package/dist/{chunk-c1gq2ttb.js.map → chunk-8sde8337.js.map} +1 -1
  80. package/dist/{chunk-cggywjzz.js → chunk-99a4e6zf.js} +2 -2
  81. package/dist/{chunk-cggywjzz.js.map → chunk-99a4e6zf.js.map} +1 -1
  82. package/dist/chunk-b6yb3svm.js +6 -0
  83. package/dist/{chunk-539w9yt3.js.map → chunk-b6yb3svm.js.map} +2 -2
  84. package/dist/{chunk-822p54vc.js → chunk-beb265c9.js} +2 -2
  85. package/dist/{chunk-822p54vc.js.map → chunk-beb265c9.js.map} +1 -1
  86. package/dist/{chunk-hdgbh8hn.js → chunk-cxsvzqd4.js} +2 -2
  87. package/dist/{chunk-hdgbh8hn.js.map → chunk-cxsvzqd4.js.map} +1 -1
  88. package/dist/{chunk-pahr13xg.js → chunk-dt95z6et.js} +2 -2
  89. package/dist/{chunk-pahr13xg.js.map → chunk-dt95z6et.js.map} +1 -1
  90. package/dist/{chunk-hr8annr1.js → chunk-feajsgns.js} +2 -2
  91. package/dist/{chunk-hr8annr1.js.map → chunk-feajsgns.js.map} +1 -1
  92. package/dist/{chunk-2tda49mv.js → chunk-ff60bzvf.js} +2 -2
  93. package/dist/{chunk-2tda49mv.js.map → chunk-ff60bzvf.js.map} +1 -1
  94. package/dist/{chunk-b00z33zg.js → chunk-gng5e7pd.js} +1 -1
  95. package/dist/{chunk-mz73066c.js → chunk-gqgpwb88.js} +2 -2
  96. package/dist/{chunk-mz73066c.js.map → chunk-gqgpwb88.js.map} +1 -1
  97. package/dist/{chunk-h0xye69a.js → chunk-ha15x5ns.js} +2 -2
  98. package/dist/{chunk-h0xye69a.js.map → chunk-ha15x5ns.js.map} +1 -1
  99. package/dist/{chunk-d5g1caxb.js → chunk-hb9hm8za.js} +3 -3
  100. package/dist/{chunk-d5g1caxb.js.map → chunk-hb9hm8za.js.map} +1 -1
  101. package/dist/{chunk-8fvt7kys.js → chunk-hf492gg2.js} +1 -1
  102. package/dist/{chunk-fgtr9cds.js → chunk-hj88dcss.js} +3 -3
  103. package/dist/{chunk-fgtr9cds.js.map → chunk-hj88dcss.js.map} +1 -1
  104. package/dist/{chunk-hnf11jhc.js → chunk-j5g7qc5f.js} +2 -2
  105. package/dist/{chunk-hnf11jhc.js.map → chunk-j5g7qc5f.js.map} +1 -1
  106. package/dist/{chunk-e1fhy2h5.js → chunk-jgx8ggbz.js} +2 -2
  107. package/dist/{chunk-e1fhy2h5.js.map → chunk-jgx8ggbz.js.map} +1 -1
  108. package/dist/{chunk-35zw2s61.js → chunk-jx2mgvvt.js} +3 -3
  109. package/dist/{chunk-35zw2s61.js.map → chunk-jx2mgvvt.js.map} +1 -1
  110. package/dist/{chunk-w26cw41m.js → chunk-jx5zx48j.js} +2 -2
  111. package/dist/{chunk-w26cw41m.js.map → chunk-jx5zx48j.js.map} +1 -1
  112. package/dist/{chunk-z1gjgr1c.js → chunk-jy9dkgt0.js} +2 -2
  113. package/dist/{chunk-z1gjgr1c.js.map → chunk-jy9dkgt0.js.map} +1 -1
  114. package/dist/{chunk-7j48ymk1.js → chunk-k2xeskp6.js} +2 -2
  115. package/dist/{chunk-7j48ymk1.js.map → chunk-k2xeskp6.js.map} +1 -1
  116. package/dist/{chunk-jxmc33m9.js → chunk-ka991yx4.js} +2 -2
  117. package/dist/{chunk-jxmc33m9.js.map → chunk-ka991yx4.js.map} +1 -1
  118. package/dist/{chunk-65s63bdh.js → chunk-krk880my.js} +2 -2
  119. package/dist/{chunk-65s63bdh.js.map → chunk-krk880my.js.map} +1 -1
  120. package/dist/{chunk-x4yq0c9v.js → chunk-m9vwg9j1.js} +3 -3
  121. package/dist/{chunk-x4yq0c9v.js.map → chunk-m9vwg9j1.js.map} +1 -1
  122. package/dist/{chunk-x07rp3fc.js → chunk-mpqvmge4.js} +1 -1
  123. package/dist/{chunk-n7sbwpce.js → chunk-mw7ft5bs.js} +2 -2
  124. package/dist/{chunk-n7sbwpce.js.map → chunk-mw7ft5bs.js.map} +1 -1
  125. package/dist/{chunk-v5esvs66.js → chunk-njpnstck.js} +2 -2
  126. package/dist/{chunk-v5esvs66.js.map → chunk-njpnstck.js.map} +1 -1
  127. package/dist/{chunk-p320fd3g.js → chunk-p82868xx.js} +2 -2
  128. package/dist/{chunk-p320fd3g.js.map → chunk-p82868xx.js.map} +1 -1
  129. package/dist/{chunk-jbd723h1.js → chunk-pm8wjatv.js} +3 -3
  130. package/dist/{chunk-jbd723h1.js.map → chunk-pm8wjatv.js.map} +1 -1
  131. package/dist/{chunk-t227jn4b.js → chunk-q15f5g86.js} +2 -2
  132. package/dist/{chunk-t227jn4b.js.map → chunk-q15f5g86.js.map} +1 -1
  133. package/dist/{chunk-838cdh6v.js → chunk-qfra7gah.js} +2 -2
  134. package/dist/{chunk-838cdh6v.js.map → chunk-qfra7gah.js.map} +1 -1
  135. package/dist/{chunk-aprjvzrz.js → chunk-rnp5k8m3.js} +2 -2
  136. package/dist/{chunk-aprjvzrz.js.map → chunk-rnp5k8m3.js.map} +1 -1
  137. package/dist/{chunk-qz89m7ss.js → chunk-rzqft8q8.js} +2 -2
  138. package/dist/{chunk-qz89m7ss.js.map → chunk-rzqft8q8.js.map} +1 -1
  139. package/dist/{chunk-zc5962gh.js → chunk-s025aycr.js} +2 -2
  140. package/dist/{chunk-zc5962gh.js.map → chunk-s025aycr.js.map} +1 -1
  141. package/dist/{chunk-y14weak4.js → chunk-s21kn0x8.js} +2 -2
  142. package/dist/{chunk-y14weak4.js.map → chunk-s21kn0x8.js.map} +1 -1
  143. package/dist/{chunk-3wnczt5w.js → chunk-s55t7rxw.js} +2 -2
  144. package/dist/{chunk-3wnczt5w.js.map → chunk-s55t7rxw.js.map} +1 -1
  145. package/dist/{chunk-fzs7g6mc.js → chunk-s782bzeq.js} +2 -2
  146. package/dist/{chunk-fzs7g6mc.js.map → chunk-s782bzeq.js.map} +1 -1
  147. package/dist/{chunk-77ymcf7q.js → chunk-sa6cxt3g.js} +2 -2
  148. package/dist/{chunk-77ymcf7q.js.map → chunk-sa6cxt3g.js.map} +1 -1
  149. package/dist/{chunk-dz76qhx8.js → chunk-swwkdm75.js} +2 -2
  150. package/dist/{chunk-dz76qhx8.js.map → chunk-swwkdm75.js.map} +1 -1
  151. package/dist/{chunk-58mg4rpd.js → chunk-t33yh84d.js} +2 -2
  152. package/dist/{chunk-58mg4rpd.js.map → chunk-t33yh84d.js.map} +1 -1
  153. package/dist/{chunk-mym7egdq.js → chunk-vnw91fe1.js} +2 -2
  154. package/dist/{chunk-mym7egdq.js.map → chunk-vnw91fe1.js.map} +1 -1
  155. package/dist/{chunk-4wda9teq.js → chunk-w1cksc5z.js} +3 -3
  156. package/dist/{chunk-4wda9teq.js.map → chunk-w1cksc5z.js.map} +1 -1
  157. package/dist/chunk-wevj4981.js +122 -0
  158. package/dist/{chunk-fx7r6pdf.js.map → chunk-wevj4981.js.map} +3 -3
  159. package/dist/{chunk-ayjfs5mm.js → chunk-wrsf2abe.js} +2 -2
  160. package/dist/{chunk-ayjfs5mm.js.map → chunk-wrsf2abe.js.map} +1 -1
  161. package/dist/{chunk-j1wc4afr.js → chunk-x16ckgq1.js} +2 -2
  162. package/dist/{chunk-j1wc4afr.js.map → chunk-x16ckgq1.js.map} +1 -1
  163. package/dist/{chunk-gnaxedwh.js → chunk-x51tegk3.js} +2 -2
  164. package/dist/{chunk-gnaxedwh.js.map → chunk-x51tegk3.js.map} +1 -1
  165. package/dist/{chunk-qspam5cf.js → chunk-x5hj0mqp.js} +2 -2
  166. package/dist/{chunk-qspam5cf.js.map → chunk-x5hj0mqp.js.map} +1 -1
  167. package/dist/{chunk-dp2yz8bj.js → chunk-x9bk5s21.js} +2 -2
  168. package/dist/{chunk-dp2yz8bj.js.map → chunk-x9bk5s21.js.map} +1 -1
  169. package/dist/{chunk-p462p2xe.js → chunk-xvvsc58s.js} +2 -2
  170. package/dist/{chunk-p462p2xe.js.map → chunk-xvvsc58s.js.map} +1 -1
  171. package/dist/{chunk-0g5f8ymy.js → chunk-xymr3asa.js} +2 -2
  172. package/dist/{chunk-0g5f8ymy.js.map → chunk-xymr3asa.js.map} +1 -1
  173. package/dist/{chunk-j4y0sjdc.js → chunk-ysc7ykss.js} +2 -2
  174. package/dist/{chunk-j4y0sjdc.js.map → chunk-ysc7ykss.js.map} +1 -1
  175. package/dist/{chunk-3xy41vc0.js → chunk-z61dj480.js} +3 -3
  176. package/dist/{chunk-3xy41vc0.js.map → chunk-z61dj480.js.map} +1 -1
  177. package/dist/{chunk-0q68t71d.js → chunk-z9xxthp1.js} +3 -3
  178. package/dist/{chunk-0q68t71d.js.map → chunk-z9xxthp1.js.map} +1 -1
  179. package/dist/{chunk-47eav3ex.js → chunk-zv5qyrqg.js} +2 -2
  180. package/dist/{chunk-47eav3ex.js.map → chunk-zv5qyrqg.js.map} +1 -1
  181. package/dist/{chunk-asmszzkp.js → chunk-zyhmn3hy.js} +3 -3
  182. package/dist/{chunk-asmszzkp.js.map → chunk-zyhmn3hy.js.map} +1 -1
  183. package/dist/{chunk-zzgt759n.js → chunk-zypmy8yq.js} +2 -2
  184. package/dist/{chunk-zzgt759n.js.map → chunk-zypmy8yq.js.map} +1 -1
  185. package/dist/config/index.js +1 -1
  186. package/dist/console/run.js +2 -2
  187. package/dist/console/run.js.map +1 -1
  188. package/dist/container/index.js +2 -2
  189. package/dist/container/index.js.map +1 -1
  190. package/dist/database/index.js +2 -2
  191. package/dist/database/index.js.map +1 -1
  192. package/dist/email/index.js +2 -2
  193. package/dist/email/index.js.map +1 -1
  194. package/dist/facades/index.js +2 -2
  195. package/dist/facades/index.js.map +1 -1
  196. package/dist/foundation/index.js +2 -2
  197. package/dist/foundation/index.js.map +1 -1
  198. package/dist/http/ApiRouter.d.ts +27 -5
  199. package/dist/http/ApiRouter.d.ts.map +1 -1
  200. package/dist/http/index.js +2 -2
  201. package/dist/http/index.js.map +1 -1
  202. package/dist/i18n/dictionaryRuntime.js +2 -2
  203. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  204. package/dist/i18n/index.js +2 -2
  205. package/dist/i18n/index.js.map +1 -1
  206. package/dist/kernel/index.js +2 -2
  207. package/dist/kernel/index.js.map +1 -1
  208. package/dist/orm/defaults.d.ts.map +1 -1
  209. package/dist/orm/index.js +3 -3
  210. package/dist/orm/index.js.map +3 -3
  211. package/dist/server/index.js +2 -2
  212. package/dist/server/index.js.map +1 -1
  213. package/dist/services/index.js +2 -2
  214. package/dist/services/index.js.map +1 -1
  215. package/dist/services/queue/work.js +2 -2
  216. package/dist/services/queue/work.js.map +1 -1
  217. package/dist/stats/route-table.js +1 -1
  218. package/dist/support/index.js +2 -2
  219. package/dist/support/index.js.map +1 -1
  220. package/dist/vitest/index.js +1 -1
  221. package/package.json +2 -1
  222. package/dist/chunk-539w9yt3.js +0 -6
  223. package/dist/chunk-fx7r6pdf.js +0 -122
  224. package/dist/chunk-mvka90rq.js +0 -5
  225. /package/dist/{chunk-dxm5gxqk.js.map → chunk-1awxdnb6.js.map} +0 -0
  226. /package/dist/{chunk-fxm8fqh9.js.map → chunk-33hdxe7v.js.map} +0 -0
  227. /package/dist/{chunk-f21v4n2v.js.map → chunk-53rr32zm.js.map} +0 -0
  228. /package/dist/{chunk-b00z33zg.js.map → chunk-gng5e7pd.js.map} +0 -0
  229. /package/dist/{chunk-8fvt7kys.js.map → chunk-hf492gg2.js.map} +0 -0
  230. /package/dist/{chunk-x07rp3fc.js.map → chunk-mpqvmge4.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ua as B,va as C,xa as E}from"./chunk-epvpmakp.js";import{gk as x,ik as z,jk as A}from"./chunk-822p54vc.js";function M(b,f={}){let j=B(b,f.sourceLocale);return G(E(b),j,(q)=>C(b,q,j))}function N(b,f){let j=Object.keys(f);return G(b,j,(q)=>{let v=f[q]??f[j[0]];if(!v)return{};return v().then((k)=>k.default)})}function G(b,f,j){let q={id:b,locales:f,load:j};x(q);let v=()=>x(q);return{id:b,locales:f,load:(k)=>{return v(),z(b,k)},loadForRender:(k)=>{return v(),A(b,k)},get:(k)=>{v();let w=z(b,k);if(w instanceof Promise){w.catch(()=>{});return}return w}}}
2
+ import{ua as B,va as C,xa as E}from"./chunk-epvpmakp.js";import{hk as x,jk as z,kk as A}from"./chunk-beb265c9.js";function M(b,f={}){let j=B(b,f.sourceLocale);return G(E(b),j,(q)=>C(b,q,j))}function N(b,f){let j=Object.keys(f);return G(b,j,(q)=>{let v=f[q]??f[j[0]];if(!v)return{};return v().then((k)=>k.default)})}function G(b,f,j){let q={id:b,locales:f,load:j};x(q);let v=()=>x(q);return{id:b,locales:f,load:(k)=>{return v(),z(b,k)},loadForRender:(k)=>{return v(),A(b,k)},get:(k)=>{v();let w=z(b,k);if(w instanceof Promise){w.catch(()=>{});return}return w}}}
3
3
  export{M as ca,N as da};
4
4
 
5
- //# debugId=454E4DA2F7161A0864756E2164756E21
5
+ //# debugId=3D876DB8AB684CFF64756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "import {\n dictionaryId,\n dictionaryLocales,\n localeStrings,\n type DictionaryTranslations,\n type LocaleStrings,\n} from \"./dictionaryShape\";\nimport {\n loadDictionary,\n loadDictionaryForRender,\n registerDictionary,\n type RenderThenable,\n} from \"./dictionaryRegistry\";\n\ndeclare const brand: unique symbol;\n\nexport interface DictionaryHandle<\n T extends DictionaryTranslations = DictionaryTranslations,\n> {\n readonly id: string;\n /** Locales this dictionary declares, source language first. */\n readonly locales: readonly string[];\n /**\n * Strings for `locale`. Synchronous when they are already in memory —\n * always, for an unbundled dictionary; after a preload or the SSR seed, for a\n * bundled one.\n */\n load(locale: string): LocaleStrings | Promise<LocaleStrings>;\n /**\n * `load`, but as the exact thing React's `use()` wants: never rejecting, so\n * a failed locale chunk degrades the component to rendering keys instead of\n * unmounting it into an error boundary; and always a thenable, even when the\n * strings are already in memory. The caller skips `use()` only for a\n * thenable built from strings already in hand, which carries them as\n * `inHand`; every thenable a render could have suspended on still goes\n * through it. `loadDictionaryForRender` has the whole reasoning.\n */\n loadForRender(locale: string): RenderThenable;\n get(locale: string): LocaleStrings | undefined;\n /** Type-only: carries the literal's shape through to `useDictionary`. */\n readonly [brand]?: T;\n}\n\n/**\n * Declare the strings a component needs, next to the component.\n *\n * ```ts\n * export const homeDict = defineDictionary({\n * title: { \"en-US\": \"Welcome {{name}}\", \"tr-TR\": \"Hoş geldin {{name}}\" },\n * });\n * ```\n *\n * As written this holds every locale. Under gemi's Vite plugin the call is\n * rewritten so each locale becomes its own chunk and a page downloads only the\n * one it renders in — but the plugin is strictly an optimization, and the\n * behaviour is identical without it (in `bun test`, and in server code that\n * does not go through the bundler).\n *\n * The first locale in the literal is the source language: a key missing from\n * another locale falls back to it rather than rendering as its own key.\n */\nexport interface DefineDictionaryOptions {\n /**\n * The locale this dictionary is authored in. Keys missing from another locale\n * fall back to it, and it is what renders when the app has no locale\n * configured.\n *\n * Optional, but worth setting on any dictionary that is not uniformly\n * translated: without it the source language is whichever locale appears\n * first in the literal, so adding a key at the top can re-point every\n * fallback in the dictionary.\n */\n sourceLocale?: string;\n}\n\nexport function defineDictionary<const T extends DictionaryTranslations>(\n translations: T,\n options: DefineDictionaryOptions = {},\n): DictionaryHandle<T> {\n const locales = dictionaryLocales(translations, options.sourceLocale);\n return createHandle(dictionaryId(translations), locales, (locale) =>\n localeStrings(translations, locale, locales),\n );\n}\n\n/**\n * The rewritten form of a `defineDictionary` call — emitted by\n * `packages/gemi/vite/dictionaryPlugin.ts`, never written by hand. `loaders`\n * holds one dynamic import per locale so the bundler emits one chunk per\n * locale and the untaken ones never reach the browser.\n */\nexport function __gemi_dict__<\n const T extends DictionaryTranslations = DictionaryTranslations,\n>(\n id: string,\n loaders: Record<string, () => Promise<{ default: LocaleStrings }>>,\n): DictionaryHandle<T> {\n const locales = Object.keys(loaders);\n return createHandle(id, locales, (locale) => {\n // An unknown locale falls back to the source language, matching what\n // `localeStrings` does per key on the unbundled path.\n const load = loaders[locale] ?? loaders[locales[0]];\n if (!load) {\n return {};\n }\n return load().then((mod) => mod.default);\n });\n}\n\nfunction createHandle<T extends DictionaryTranslations>(\n id: string,\n locales: string[],\n load: (locale: string) => LocaleStrings | Promise<LocaleStrings>,\n): DictionaryHandle<T> {\n const entry = { id, locales, load };\n registerDictionary(entry);\n\n // Re-asserted on every read rather than only at construction. A handle is\n // created once, at module scope, but the registry it delegates to can be\n // emptied under it — a test's `afterEach` reset, an HMR boundary — and the\n // handle would then be permanently orphaned, throwing \"Unknown dictionary\"\n // for a dictionary the caller is holding. `registerDictionary` is a no-op\n // when the id is already there, so this costs one Map lookup.\n const ensure = () => registerDictionary(entry);\n\n return {\n id,\n locales,\n // Routed through the registry rather than calling `load` directly so\n // concurrent readers share one in-flight import and results are cached.\n load: (locale: string) => {\n ensure();\n return loadDictionary(id, locale);\n },\n loadForRender: (locale: string) => {\n ensure();\n return loadDictionaryForRender(id, locale);\n },\n get: (locale: string) => {\n ensure();\n const strings = loadDictionary(id, locale);\n if (strings instanceof Promise) {\n // Nothing downstream awaits this one — `get` is the synchronous peek,\n // and the caller is about to discard it. An unattached rejection (a\n // locale chunk that 404s mid-deploy) would surface as an\n // `unhandledRejection`, which under Node's default handler takes the\n // process down over one missing translation file. The load itself is\n // still cached and still retried through `loadDictionary`.\n strings.catch(() => {});\n return undefined;\n }\n return strings;\n },\n };\n}\n\n"
6
6
  ],
7
7
  "mappings": ";wHA2EO,GAAS,CAAwD,CACtE,EACA,EAAmC,CAAC,EACf,CACrB,IAAM,EAAU,EAAkB,EAAc,EAAQ,YAAY,EACpE,OAAO,EAAa,EAAa,CAAY,EAAG,EAAS,CAAC,IACxD,EAAc,EAAc,EAAQ,CAAO,CAC7C,EASK,SAAS,CAEf,CACC,EACA,EACqB,CACrB,IAAM,EAAU,OAAO,KAAK,CAAO,EACnC,OAAO,EAAa,EAAI,EAAS,CAAC,IAAW,CAG3C,IAAM,EAAO,EAAQ,IAAW,EAAQ,EAAQ,IAChD,GAAI,CAAC,EACH,MAAO,CAAC,EAEV,OAAO,EAAK,EAAE,KAAK,CAAC,IAAQ,EAAI,OAAO,EACxC,EAGH,SAAS,CAA8C,CACrD,EACA,EACA,EACqB,CACrB,IAAM,EAAQ,CAAE,KAAI,UAAS,MAAK,EAClC,EAAmB,CAAK,EAQxB,IAAM,EAAS,IAAM,EAAmB,CAAK,EAE7C,MAAO,CACL,KACA,UAGA,KAAM,CAAC,IAAmB,CAExB,OADA,EAAO,EACA,EAAe,EAAI,CAAM,GAElC,cAAe,CAAC,IAAmB,CAEjC,OADA,EAAO,EACA,EAAwB,EAAI,CAAM,GAE3C,IAAK,CAAC,IAAmB,CACvB,EAAO,EACP,IAAM,EAAU,EAAe,EAAI,CAAM,EACzC,GAAI,aAAmB,QAAS,CAO9B,EAAQ,MAAM,IAAM,EAAE,EACtB,OAEF,OAAO,EAEX",
8
- "debugId": "454E4DA2F7161A0864756E2164756E21",
8
+ "debugId": "3D876DB8AB684CFF64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Q as ne}from"./chunk-xhvknqvn.js";import{_ as C}from"./chunk-e1fhy2h5.js";import"./chunk-4gmhx2ba.js";import{aa as _}from"./chunk-p462p2xe.js";import{$k as c,dl as F}from"./chunk-aprjvzrz.js";var x=c(_(),1),T=c(C(),1);var q=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var D=c(ne(),1);var u=c(_(),1),m=c(C(),1);var W=300000,h="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var j=async(e,o={},r)=>{let{SSOOIDCClient:t}=await import("./chunk-63xekerg.js").then((m)=>c(m.default,1)),n=(f)=>o.clientConfig?.[f]??o.parentClientConfig?.[f]??r?.[f];return new t(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))};var X=async(e,o,r={},t)=>{let{CreateTokenCommand:n}=await import("./chunk-63xekerg.js").then((m)=>c(m.default,1));return(await j(o,r,t)).send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var z=c(_(),1);var P=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new z.TokenProviderError(`Token is expired. ${h}`,!1)};var J=c(_(),1);var g=(e,o,r=!1)=>{if(typeof o>"u")throw new J.TokenProviderError(`Value not present for '${e}' in SSO Token${r?". Cannot refresh":""}. ${h}`,!1)};var V=c(C(),1);import{promises as re}from"fs";var{writeFile:te}=re,Y=(e,o)=>{let r=V.getSSOTokenFilepath(e),t=JSON.stringify(o,null,2);return te(r,t)};var B=new Date(0),Q=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await m.parseKnownFiles(e),t=m.getProfileName({profile:e.profile??o?.profile}),n=r[t];if(!n)throw new u.TokenProviderError(`Profile '${t}' could not be found in shared credentials file.`,!1);else if(!n.sso_session)throw new u.TokenProviderError(`Profile '${t}' is missing required property 'sso_session'.`);let a=n.sso_session,p=(await m.loadSsoSessionData(e))[a];if(!p)throw new u.TokenProviderError(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(let i of["sso_start_url","sso_region"])if(!p[i])throw new u.TokenProviderError(`Sso session '${a}' is missing required property '${i}'.`,!1);let{sso_start_url:S,sso_region:I}=p,s;try{s=await m.getSSOTokenFromFile(a)}catch(i){throw new u.TokenProviderError(`The SSO session token associated with profile=${t} was not found or is invalid. ${h}`,!1)}g("accessToken",s.accessToken),g("expiresAt",s.expiresAt);let{accessToken:y,expiresAt:E}=s,l={token:y,expiration:new Date(E)};if(l.expiration.getTime()-Date.now()>W)return l;if(Date.now()-B.getTime()<30000)return P(l),l;g("clientId",s.clientId,!0),g("clientSecret",s.clientSecret,!0),g("refreshToken",s.refreshToken,!0);try{B.setTime(Date.now());let i=await X(s,I,e,o);g("accessToken",i.accessToken),g("expiresIn",i.expiresIn);let O=new Date(Date.now()+i.expiresIn*1000);try{await Y(a,{...s,accessToken:i.accessToken,expiresAt:O.toISOString(),refreshToken:i.refreshToken})}catch(R){}return{token:i.accessToken,expiration:O}}catch(i){return P(l),l}};var k=c(_(),1),Z=c(C(),1),A=!1,$=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:a,clientConfig:f,parentClientConfig:p,callerClientConfig:S,profile:I,filepath:s,configFilepath:y,ignoreCache:E,logger:l})=>{let i,O="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{let w=await Q({profile:I,filepath:s,configFilepath:y,ignoreCache:E})();i={accessToken:w.token,expiresAt:new Date(w.expiration).toISOString()}}catch(w){throw new k.CredentialsProviderError(w.message,{tryNextLink:A,logger:l})}else try{i=await Z.getSSOTokenFromFile(e)}catch(w){throw new k.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:A,logger:l})}if(new Date(i.expiresAt).getTime()-Date.now()<=0)throw new k.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:A,logger:l});let{accessToken:R}=i,{SSOClient:d,GetRoleCredentialsCommand:N}=await import("./chunk-zc5962gh.js"),se=a||new d(Object.assign({},f??{},{logger:f?.logger??S?.logger??p?.logger,region:f?.region??t,userAgentAppId:f?.userAgentAppId??S?.userAgentAppId??p?.userAgentAppId})),L;try{L=await se.send(new N({accountId:r,roleName:n,accessToken:R}))}catch(w){throw new k.CredentialsProviderError(w,{tryNextLink:A,logger:l})}let{roleCredentials:{accessKeyId:M,secretAccessKey:G,sessionToken:K,expiration:b,credentialScope:H,accountId:U}={}}=L;if(!M||!G||!K||!b)throw new k.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:A,logger:l});let v={accessKeyId:M,secretAccessKey:G,sessionToken:K,expiration:new Date(b),...H&&{credentialScope:H},...U&&{accountId:U}};if(o)D.setCredentialFeature(v,"CREDENTIALS_SSO","s");else D.setCredentialFeature(v,"CREDENTIALS_SSO_LEGACY","u");return v};var ee=c(_(),1),oe=(e,o)=>{let{sso_start_url:r,sso_account_id:t,sso_region:n,sso_role_name:a}=e;if(!r||!t||!n||!a)throw new ee.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
2
+ import{Q as ne}from"./chunk-5pdgh9a1.js";import{_ as C}from"./chunk-jgx8ggbz.js";import"./chunk-0eamc2tr.js";import{aa as _}from"./chunk-xvvsc58s.js";import{al as c,el as F}from"./chunk-rnp5k8m3.js";var x=c(_(),1),T=c(C(),1);var q=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var D=c(ne(),1);var u=c(_(),1),m=c(C(),1);var W=300000,h="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var j=async(e,o={},r)=>{let{SSOOIDCClient:t}=await import("./chunk-3g5q0cj5.js").then((m)=>c(m.default,1)),n=(f)=>o.clientConfig?.[f]??o.parentClientConfig?.[f]??r?.[f];return new t(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))};var X=async(e,o,r={},t)=>{let{CreateTokenCommand:n}=await import("./chunk-3g5q0cj5.js").then((m)=>c(m.default,1));return(await j(o,r,t)).send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var z=c(_(),1);var P=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new z.TokenProviderError(`Token is expired. ${h}`,!1)};var J=c(_(),1);var g=(e,o,r=!1)=>{if(typeof o>"u")throw new J.TokenProviderError(`Value not present for '${e}' in SSO Token${r?". Cannot refresh":""}. ${h}`,!1)};var V=c(C(),1);import{promises as re}from"fs";var{writeFile:te}=re,Y=(e,o)=>{let r=V.getSSOTokenFilepath(e),t=JSON.stringify(o,null,2);return te(r,t)};var B=new Date(0),Q=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await m.parseKnownFiles(e),t=m.getProfileName({profile:e.profile??o?.profile}),n=r[t];if(!n)throw new u.TokenProviderError(`Profile '${t}' could not be found in shared credentials file.`,!1);else if(!n.sso_session)throw new u.TokenProviderError(`Profile '${t}' is missing required property 'sso_session'.`);let a=n.sso_session,p=(await m.loadSsoSessionData(e))[a];if(!p)throw new u.TokenProviderError(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(let i of["sso_start_url","sso_region"])if(!p[i])throw new u.TokenProviderError(`Sso session '${a}' is missing required property '${i}'.`,!1);let{sso_start_url:S,sso_region:I}=p,s;try{s=await m.getSSOTokenFromFile(a)}catch(i){throw new u.TokenProviderError(`The SSO session token associated with profile=${t} was not found or is invalid. ${h}`,!1)}g("accessToken",s.accessToken),g("expiresAt",s.expiresAt);let{accessToken:y,expiresAt:E}=s,l={token:y,expiration:new Date(E)};if(l.expiration.getTime()-Date.now()>W)return l;if(Date.now()-B.getTime()<30000)return P(l),l;g("clientId",s.clientId,!0),g("clientSecret",s.clientSecret,!0),g("refreshToken",s.refreshToken,!0);try{B.setTime(Date.now());let i=await X(s,I,e,o);g("accessToken",i.accessToken),g("expiresIn",i.expiresIn);let O=new Date(Date.now()+i.expiresIn*1000);try{await Y(a,{...s,accessToken:i.accessToken,expiresAt:O.toISOString(),refreshToken:i.refreshToken})}catch(R){}return{token:i.accessToken,expiration:O}}catch(i){return P(l),l}};var k=c(_(),1),Z=c(C(),1),A=!1,$=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:a,clientConfig:f,parentClientConfig:p,callerClientConfig:S,profile:I,filepath:s,configFilepath:y,ignoreCache:E,logger:l})=>{let i,O="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{let w=await Q({profile:I,filepath:s,configFilepath:y,ignoreCache:E})();i={accessToken:w.token,expiresAt:new Date(w.expiration).toISOString()}}catch(w){throw new k.CredentialsProviderError(w.message,{tryNextLink:A,logger:l})}else try{i=await Z.getSSOTokenFromFile(e)}catch(w){throw new k.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:A,logger:l})}if(new Date(i.expiresAt).getTime()-Date.now()<=0)throw new k.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:A,logger:l});let{accessToken:R}=i,{SSOClient:d,GetRoleCredentialsCommand:N}=await import("./chunk-s025aycr.js"),se=a||new d(Object.assign({},f??{},{logger:f?.logger??S?.logger??p?.logger,region:f?.region??t,userAgentAppId:f?.userAgentAppId??S?.userAgentAppId??p?.userAgentAppId})),L;try{L=await se.send(new N({accountId:r,roleName:n,accessToken:R}))}catch(w){throw new k.CredentialsProviderError(w,{tryNextLink:A,logger:l})}let{roleCredentials:{accessKeyId:M,secretAccessKey:G,sessionToken:K,expiration:b,credentialScope:H,accountId:U}={}}=L;if(!M||!G||!K||!b)throw new k.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:A,logger:l});let v={accessKeyId:M,secretAccessKey:G,sessionToken:K,expiration:new Date(b),...H&&{credentialScope:H},...U&&{accountId:U}};if(o)D.setCredentialFeature(v,"CREDENTIALS_SSO","s");else D.setCredentialFeature(v,"CREDENTIALS_SSO_LEGACY","u");return v};var ee=c(_(),1),oe=(e,o)=>{let{sso_start_url:r,sso_account_id:t,sso_region:n,sso_role_name:a}=e;if(!r||!t||!n||!a)throw new ee.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
3
3
  Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e};var Ce=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:r,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoSession:f}=e,{ssoClient:p}=e,S=T.getProfileName({profile:e.profile??o?.profile});if(!r&&!t&&!n&&!a&&!f){let s=(await T.parseKnownFiles(e))[S];if(!s)throw new x.CredentialsProviderError(`Profile ${S} was not found.`,{logger:e.logger});if(!q(s))throw new x.CredentialsProviderError(`Profile ${S} is not configured with SSO credentials.`,{logger:e.logger});if(s?.sso_session){let d=(await T.loadSsoSessionData(e))[s.sso_session],N=` configurations in profile ${S} and sso-session ${s.sso_session}`;if(n&&n!==d.sso_region)throw new x.CredentialsProviderError("Conflicting SSO region"+N,{tryNextLink:!1,logger:e.logger});if(r&&r!==d.sso_start_url)throw new x.CredentialsProviderError("Conflicting SSO start_url"+N,{tryNextLink:!1,logger:e.logger});s.sso_region=d.sso_region,s.sso_start_url=d.sso_start_url}let{sso_start_url:y,sso_account_id:E,sso_region:l,sso_role_name:i,sso_session:O}=oe(s,e.logger);return $({ssoStartUrl:y,ssoSession:O,ssoAccountId:E,ssoRegion:l,ssoRoleName:i,ssoClient:p,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:S,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}else if(!r||!t||!n||!a)throw new x.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger});else return $({ssoStartUrl:r,ssoSession:f,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoClient:p,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:S,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})};export{oe as validateSsoProfile,q as isSsoProfile,Ce as fromSSO};
4
4
 
5
- //# debugId=33462877B9CCDC3264756E2164756E21
5
+ //# debugId=C1E2C610889B08D764756E2164756E21
@@ -15,6 +15,6 @@
15
15
  "import { CredentialsProviderError } from \"@smithy/property-provider\";\nexport const validateSsoProfile = (profile, logger) => {\n const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;\n if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {\n throw new CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters \"sso_account_id\", ` +\n `\"sso_region\", \"sso_role_name\", \"sso_start_url\". Got ${Object.keys(profile).join(\", \")}\\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });\n }\n return profile;\n};\n"
16
16
  ],
17
17
  "mappings": ";+NAAA,SACA,KCDO,FAAM,JAAe,CAAC,IAAQ,IAChC,OAAO,EAAI,gBAAkB,UAC1B,OAAO,EAAI,iBAAmB,UAC9B,OAAO,EAAI,cAAgB,UAC3B,OAAO,EAAI,aAAe,UAC1B,OAAO,EAAI,gBAAkB,UCLrC,gBCAA,eACA,WCDO,IAAM,EAAmB,OACnB,EAAkB,kFCDxB,IAAM,EAAmB,MAAO,EAAW,EAAO,CAAC,EAAG,IAAuB,CAChF,IAAQ,iBAAkB,KAAa,yDACjC,EAAW,CAAC,IAAS,EAAK,eAAe,IAAS,EAAK,qBAAqB,IAAS,IAAqB,GAMhH,OALsB,IAAI,EAAc,OAAO,OAAO,CAAC,EAAG,EAAK,cAAgB,CAAC,EAAG,CAC/E,OAAQ,GAAa,EAAK,cAAc,OACxC,OAAQ,EAAS,QAAQ,EACzB,eAAgB,EAAS,gBAAgB,CAC7C,CAAC,CAAC,GCNC,IAAM,EAAqB,MAAO,EAAU,EAAW,EAAO,CAAC,EAAG,IAAuB,CAC5F,IAAQ,sBAAuB,KAAa,yDAE5C,OADsB,MAAM,EAAiB,EAAW,EAAM,CAAkB,GAC3D,KAAK,IAAI,EAAmB,CAC7C,SAAU,EAAS,SACnB,aAAc,EAAS,aACvB,aAAc,EAAS,aACvB,UAAW,eACf,CAAC,CAAC,GCTN,eAEO,IAAM,EAAsB,CAAC,IAAU,CAC1C,GAAI,EAAM,YAAc,EAAM,WAAW,QAAQ,EAAI,KAAK,IAAI,EAC1D,MAAM,IAAI,qBAAmB,qBAAqB,IAAmB,EAAK,GCJlF,eAEO,IAAM,EAAmB,CAAC,EAAK,EAAO,EAAa,KAAU,CAChE,GAAI,OAAO,EAAU,IACjB,MAAM,IAA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AAU,EAAK,SACf,eAAgB,EAAK,eACrB,YAAa,EAAK,YAClB,OAAQ,EAAK,MACjB,CAAC,EAEA,QAAI,CAAC,GAAe,CAAC,GAAgB,CAAC,GAAa,CAAC,EACrD,MAAM,IAAI,2BAAyB,+HAC8B,CAAE,YAAa,GAAO,OAAQ,EAAK,MAAO,CAAC,EAG5G,YAAO,EAAsB,CACzB,cACA,aACA,eACA,YACA,cACA,YACA,aAAc,EAAK,aACnB,mBAAoB,EAAK,mBACzB,mBAAoB,EAAK,mBACzB,QAAS,EACT,SAAU,EAAK,SACf,eAAgB,EAAK,eACrB,YAAa,EAAK,YAClB,OAAQ,EAAK,MACjB,CAAC",
18
- "debugId": "33462877B9CCDC3264756E2164756E21",
18
+ "debugId": "C1E2C610889B08D764756E2164756E21",
19
19
  "names": []
20
20
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ki as $,Qi as F,Si as R,Ti as T}from"./chunk-3xy41vc0.js";import{Nj as A,Pj as B}from"./chunk-0q68t71d.js";async function K(O,L={}){let P=typeof O==="string"?$(O):O,C=P.$schema,M=[...F(C)];if(M.length===0)throw Error(`${C.name} has no encrypted columns (mark a String field /// @gemi.encrypted).`);let D=C.primaryKey;if(D.length===0)throw Error(`${C.name} has no primary key, so its rows cannot be rewritten one by one.`);let N=R(),V=Math.max(1,Math.floor(L.batchSize??500)),j={model:C.name,fields:M,scanned:0,rotated:0,skipped:0,plaintext:0},X=T({}),W=Object.fromEntries([...D,...M].map((q)=>[q,!0])),k=D.map((q)=>({[q]:"asc"})),J=D.length===1?D[0]:void 0;return await A(()=>B(C.name,"with",async()=>{let q=void 0,Y=0;for(;;){let G=await P.$exec("findMany",{select:W,orderBy:k,take:V,...J!==void 0&&q!==void 0?{where:{[J]:{gt:q}}}:{},...J===void 0?{skip:Y}:{}},X);if(G.length===0)break;for(let Z of G){j.scanned+=1;let Q={},U={};for(let H of D)U[H]=Z[H];for(let H of M){let I=Z[H];if(typeof I!=="string"||!N.needsReencryption(I))continue;let _=N.isEncrypted(I);if(!_&&!L.encryptPlaintext){j.plaintext+=1;continue}let z=_?N.decrypt(I):I;Q[H]=N.encrypt(z),U[H]=I}if(Object.keys(Q).length===0)continue;if(L.dryRun){j.rotated+=1;continue}let{count:x}=await P.$exec("updateMany",{where:U,data:Q},X);if(x===1)j.rotated+=1;else j.skipped+=1}if(L.onBatch?.({...j}),G.length<V)break;if(J!==void 0)q=G[G.length-1][J];else Y+=G.length}})),j}
2
+ import{Li as $,Ri as F,Ti as R,Ui as T}from"./chunk-z61dj480.js";import{Oj as A,Qj as B}from"./chunk-z9xxthp1.js";async function K(O,L={}){let P=typeof O==="string"?$(O):O,C=P.$schema,M=[...F(C)];if(M.length===0)throw Error(`${C.name} has no encrypted columns (mark a String field /// @gemi.encrypted).`);let D=C.primaryKey;if(D.length===0)throw Error(`${C.name} has no primary key, so its rows cannot be rewritten one by one.`);let N=R(),V=Math.max(1,Math.floor(L.batchSize??500)),j={model:C.name,fields:M,scanned:0,rotated:0,skipped:0,plaintext:0},X=T({}),W=Object.fromEntries([...D,...M].map((q)=>[q,!0])),k=D.map((q)=>({[q]:"asc"})),J=D.length===1?D[0]:void 0;return await A(()=>B(C.name,"with",async()=>{let q=void 0,Y=0;for(;;){let G=await P.$exec("findMany",{select:W,orderBy:k,take:V,...J!==void 0&&q!==void 0?{where:{[J]:{gt:q}}}:{},...J===void 0?{skip:Y}:{}},X);if(G.length===0)break;for(let Z of G){j.scanned+=1;let Q={},U={};for(let H of D)U[H]=Z[H];for(let H of M){let I=Z[H];if(typeof I!=="string"||!N.needsReencryption(I))continue;let _=N.isEncrypted(I);if(!_&&!L.encryptPlaintext){j.plaintext+=1;continue}let z=_?N.decrypt(I):I;Q[H]=N.encrypt(z),U[H]=I}if(Object.keys(Q).length===0)continue;if(L.dryRun){j.rotated+=1;continue}let{count:x}=await P.$exec("updateMany",{where:U,data:Q},X);if(x===1)j.rotated+=1;else j.skipped+=1}if(L.onBatch?.({...j}),G.length<V)break;if(J!==void 0)q=G[G.length-1][J];else Y+=G.length}})),j}
3
3
  export{K as ba};
4
4
 
5
- //# debugId=64AB5108A4E9A7CB64756E2164756E21
5
+ //# debugId=172F12BAFBDDE01764756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "import { runAsSystem, runWithTrashed } from \"./context\";\nimport { currentEncrypter, encryptedFields, markEncryptionRaw } from \"./encryption\";\nimport type { Model } from \"./Model\";\nimport * as registry from \"./registry\";\nimport type { ModelSchema } from \"./schema\";\n\nexport interface RotateEncryptionOptions {\n /** Rows read and rewritten per round trip. Default 500. */\n batchSize?: number;\n /** Count what would be re-encrypted, and write nothing. */\n dryRun?: boolean;\n /**\n * Also encrypt values that are not encrypted at all — the rows a column held\n * before it was marked `@gemi.encrypted`. Off by default, so a value that is\n * not an envelope is reported rather than silently treated as plaintext.\n */\n encryptPlaintext?: boolean;\n /** Called after each batch, for progress output. */\n onBatch?: (report: RotateEncryptionReport) => void;\n}\n\nexport interface RotateEncryptionReport {\n model: string;\n fields: string[];\n /** Rows read. */\n scanned: number;\n /** Rows rewritten (or, on a dry run, that would be). */\n rotated: number;\n /** Rows a concurrent write changed between the read and the rewrite; already current. */\n skipped: number;\n /** Values that are not envelopes, left alone because `encryptPlaintext` is off. */\n plaintext: number;\n}\n\n/**\n * Re-encrypts `model`'s encrypted columns under the current key: every value\n * still under an older key and, with `encryptPlaintext`, every value not\n * encrypted yet. What `gemi run encryption:rotate` runs.\n *\n * Walks the table in primary-key order in batches, so it can run against a\n * live database and be re-run safely: each row is rewritten with a\n * compare-and-swap on the values it read, so a row written concurrently (and\n * therefore already under the current key) is skipped rather than\n * overwritten. Runs as the system (no policies) and includes soft-deleted\n * rows — they are still encrypted with the old key.\n *\n * Remove the old key from `encryption.keys` only after this reports nothing\n * left to rotate.\n */\nexport async function rotateEncryptedColumns(\n model: string | typeof Model,\n options: RotateEncryptionOptions = {},\n): Promise<RotateEncryptionReport> {\n const target = (typeof model === \"string\" ? registry.get<typeof Model>(model) : model) as typeof Model & {\n $exec: typeof Model.$exec;\n };\n const schema: ModelSchema = target.$schema;\n const fields = [...encryptedFields(schema)];\n if (fields.length === 0) {\n throw new Error(`${schema.name} has no encrypted columns (mark a String field /// @gemi.encrypted).`);\n }\n const primaryKey = schema.primaryKey;\n if (primaryKey.length === 0) {\n throw new Error(`${schema.name} has no primary key, so its rows cannot be rewritten one by one.`);\n }\n\n const encrypter = currentEncrypter();\n const batchSize = Math.max(1, Math.floor(options.batchSize ?? 500));\n const report: RotateEncryptionReport = {\n model: schema.name,\n fields,\n scanned: 0,\n rotated: 0,\n skipped: 0,\n plaintext: 0,\n };\n\n const raw = markEncryptionRaw({});\n const select = Object.fromEntries([...primaryKey, ...fields].map((name) => [name, true]));\n const orderBy = primaryKey.map((name) => ({ [name]: \"asc\" }));\n const single = primaryKey.length === 1 ? primaryKey[0] : undefined;\n\n await runAsSystem(() =>\n runWithTrashed(schema.name, \"with\", async () => {\n let after: unknown = undefined;\n let offset = 0;\n\n for (;;) {\n // Keyset pagination on a single-column key, so a rewrite never moves a\n // row across a page boundary. A compound key pages by offset, which is\n // stable here because rewriting a column does not change the key.\n const rows = (await target.$exec(\n \"findMany\",\n {\n select,\n orderBy,\n take: batchSize,\n ...(single !== undefined && after !== undefined ? { where: { [single]: { gt: after } } } : {}),\n ...(single === undefined ? { skip: offset } : {}),\n },\n raw,\n )) as Record<string, unknown>[];\n if (rows.length === 0) break;\n\n for (const row of rows) {\n report.scanned += 1;\n const data: Record<string, string> = {};\n const where: Record<string, unknown> = {};\n for (const name of primaryKey) where[name] = row[name];\n\n for (const field of fields) {\n const value = row[field];\n if (typeof value !== \"string\" || !encrypter.needsReencryption(value)) continue;\n const isEnvelope = encrypter.isEncrypted(value);\n if (!isEnvelope && !options.encryptPlaintext) {\n report.plaintext += 1;\n continue;\n }\n const plaintext = isEnvelope ? encrypter.decrypt(value) : value;\n data[field] = encrypter.encrypt(plaintext);\n where[field] = value;\n }\n\n if (Object.keys(data).length === 0) continue;\n if (options.dryRun) {\n report.rotated += 1;\n continue;\n }\n const { count } = (await target.$exec(\"updateMany\", { where, data }, raw)) as {\n count: number;\n };\n if (count === 1) report.rotated += 1;\n else report.skipped += 1;\n }\n\n options.onBatch?.({ ...report });\n if (rows.length < batchSize) break;\n if (single !== undefined) after = rows[rows.length - 1][single];\n else offset += rows.length;\n }\n }),\n );\n\n return report;\n}\n\n"
6
6
  ],
7
7
  "mappings": ";wHAiDA,SAAsB,CAAsB,CAC1C,EACA,EAAmC,CAAC,EACH,CACjC,IAAM,EAAU,OAAO,IAAU,SAAoB,EAAkB,CAAK,EAAI,EAG1E,EAAsB,EAAO,QAC7B,EAAS,CAAC,GAAG,EAAgB,CAAM,CAAC,EAC1C,GAAI,EAAO,SAAW,EACpB,MAAU,MAAM,GAAG,EAAO,0EAA0E,EAEtG,IAAM,EAAa,EAAO,WAC1B,GAAI,EAAW,SAAW,EACxB,MAAU,MAAM,GAAG,EAAO,sEAAsE,EAGlG,IAAM,EAAY,EAAiB,EAC7B,EAAY,KAAK,IAAI,EAAG,KAAK,MAAM,EAAQ,WAAa,GAAG,CAAC,EAC5D,EAAiC,CACrC,MAAO,EAAO,KACd,SACA,QAAS,EACT,QAAS,EACT,QAAS,EACT,UAAW,CACb,EAEM,EAAM,EAAkB,CAAC,CAAC,EAC1B,EAAS,OAAO,YAAY,CAAC,GAAG,EAAY,GAAG,CAAM,EAAE,IAAI,CAAC,IAAS,CAAC,EAAM,EAAI,CAAC,CAAC,EAClF,EAAU,EAAW,IAAI,CAAC,KAAU,EAAG,GAAO,KAAM,EAAE,EACtD,EAAS,EAAW,SAAW,EAAI,EAAW,GAAK,OA+DzD,OA7DA,MAAM,EAAY,IAChB,EAAe,EAAO,KAAM,OAAQ,SAAY,CAC9C,IAAI,EAAiB,OACjB,EAAS,EAEb,OAAS,CAIP,IAAM,EAAQ,MAAM,EAAO,MACzB,WACA,CACE,SACA,UACA,KAAM,KACF,IAAW,QAAa,IAAU,OAAY,CAAE,MAAO,EAAG,GAAS,CAAE,GAAI,CAAM,CAAE,CAAE,EAAI,CAAC,KACxF,IAAW,OAAY,CAAE,KAAM,CAAO,EAAI,CAAC,CACjD,EACA,CACF,EACA,GAAI,EAAK,SAAW,EAAG,MAEvB,QAAW,KAAO,EAAM,CACtB,EAAO,SAAW,EAClB,IAAM,EAA+B,CAAC,EAChC,EAAiC,CAAC,EACxC,QAAW,KAAQ,EAAY,EAAM,GAAQ,EAAI,GAEjD,QAAW,KAAS,EAAQ,CAC1B,IAAM,EAAQ,EAAI,GAClB,GAAI,OAAO,IAAU,UAAY,CAAC,EAAU,kBAAkB,CAAK,EAAG,SACtE,IAAM,EAAa,EAAU,YAAY,CAAK,EAC9C,GAAI,CAAC,GAAc,CAAC,EAAQ,iBAAkB,CAC5C,EAAO,WAAa,EACpB,SAEF,IAAM,EAAY,EAAa,EAAU,QAAQ,CAAK,EAAI,EAC1D,EAAK,GAAS,EAAU,QAAQ,CAAS,EACzC,EAAM,GAAS,EAGjB,GAAI,OAAO,KAAK,CAAI,EAAE,SAAW,EAAG,SACpC,GAAI,EAAQ,OAAQ,CAClB,EAAO,SAAW,EAClB,SAEF,IAAQ,SAAW,MAAM,EAAO,MAAM,aAAc,CAAE,QAAO,MAAK,EAAG,CAAG,EAGxE,GAAI,IAAU,EAAG,EAAO,SAAW,EAC9B,OAAO,SAAW,EAIzB,GADA,EAAQ,UAAU,IAAK,CAAO,CAAC,EAC3B,EAAK,OAAS,EAAW,MAC7B,GAAI,IAAW,OAAW,EAAQ,EAAK,EAAK,OAAS,GAAG,GACnD,QAAU,EAAK,QAEvB,CACH,EAEO",
8
- "debugId": "64AB5108A4E9A7CB64756E2164756E21",
8
+ "debugId": "172F12BAFBDDE01764756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
2
  function v(j){return j==="/api"||j.startsWith("/api/")}function z(j){return v(j)?j.slice(4):j}
3
- export{v as Zk,z as _k};
3
+ export{v as _k,z as $k};
4
4
 
5
- //# debugId=47223D1E173689EC64756E2164756E21
5
+ //# debugId=3BE9D068F6B7280B64756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "/**\n * The prefix every api route is served under. The browser adds it when it\n * fetches (`/api${path}`) and the server strips it before matching, so an api\n * router's own paths never carry it.\n */\nexport const API_PREFIX = \"/api\";\n\n/**\n * Whether a request pathname is an api request: `/api` itself or anything\n * under `/api/`. A bare `startsWith(\"/api\")` also claims `/apidocs`,\n * `/api-keys` and `/apiary`, so a view route there would never render — the\n * api dispatcher would answer its 404 JSON instead.\n */\nexport function isApiPath(pathname: string): boolean {\n return pathname === API_PREFIX || pathname.startsWith(`${API_PREFIX}/`);\n}\n\n/**\n * The api router path a request pathname addresses: `/api/users/1` is\n * `/users/1`, `/api/` is `/` and `/api` is `\"\"`. Only the leading prefix is\n * stripped — `replace(\"/api\", \"\")` would also strip an `/api` inside the path\n * of a request that did not start with one (`/files/api` becoming `/files`).\n * A pathname outside `/api` comes back unchanged, so the dispatcher can still\n * be handed a request by its route path directly.\n */\nexport function apiPath(pathname: string): string {\n return isApiPath(pathname) ? pathname.slice(API_PREFIX.length) : pathname;\n}\n"
6
6
  ],
7
7
  "mappings": ";AAaO,SAAS,CAAS,CAAC,EAA2B,CACnD,OAAO,IATiB,QASU,EAAS,WAAW,OAAgB,EAWjE,SAAS,CAAO,CAAC,EAA0B,CAChD,OAAO,EAAU,CAAQ,EAAI,EAAS,MAAM,CAAiB,EAAI",
8
- "debugId": "47223D1E173689EC64756E2164756E21",
8
+ "debugId": "3BE9D068F6B7280B64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -0,0 +1,6 @@
1
+ // @bun
2
+ import{Ba as y}from"./chunk-kk18xqgc.js";import{createElement as k}from"react";function z(i,n){let s=Object.keys(n).sort((p,e)=>e.length-p.length).map((p)=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),b=new RegExp(s.join("|"),"g");return i.replace(b,(p)=>n[p])}async function L(i,n,s=[],b){let p=[...s.map((t)=>`${i}/views/${t}.tsx`),b?`${i}/views/${b}.tsx`:`${i}/views/RootLayout.tsx`],e=new Set;for(let t of p){let u=n.moduleGraph.getModulesByFile(t);if(u)for(let l of u)e.add(l)}let g=[],x=[],r={};for(let t of e)if(t)for(let u of t.importedModules){if(u.file.includes("module.css"))r[u.file]=u.ssrTransformResult.map.sourcesContent.join("");if(u.file.includes(".css"))x.push(u.file)}for(let t of x){let u=await n.transformRequest(t+"?direct"),l=t.includes("module.css"),v="";if(l)v=z(r[t],u.default);g.push({isDev:!0,id:t,content:l?v:u.code})}return g.map((t,u)=>{return k("style",{key:u,type:"text/css","data-vite-dev-id":t.id,dangerouslySetInnerHTML:{__html:t.content}})})}async function _(i=[]){return i.map((n,s)=>{return k("style",{key:s,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as J}from"fs";import{basename as N}from"path";import{networkInterfaces as O}from"os";var q={name:"gemi",version:"0.133.0",private:!1,license:"MIT",author:"Enes Tufekci <enes@gemijs.dev>",repository:{type:"git",url:"git+https://github.com/nstfkc/gemi.git",directory:"packages/gemi"},bin:{gemi:"./dist/bin/gemi.js","gemi-orm-generator":"./dist/bin/orm-generator.js"},files:["dist/**/*","ide/typescript-plugin/package.json","skills/**/*"],module:!0,exports:{"./http":"./http/index.ts","./client":"./client/index.ts","./ai":"./ai/index.ts","./ai/client":"./ai/client/index.ts","./ai/voice":"./ai/voice/index.ts","./testing":"./testing/index.ts","./app":"./app/index.ts","./facades":"./facades/index.ts","./email":"./email/index.ts","./vite":"./dist/vite/index.mjs","./kernel":"./kernel/index.ts","./services":"./services/index.ts","./i18n":"./i18n/index.ts","./dictionary":"./i18n/dictionaryRuntime.ts","./server":"./server/index.ts","./config":"./config/index.ts","./container":"./container/index.ts","./foundation":"./foundation/index.ts","./database":"./database/index.ts","./orm":"./orm/index.ts","./support":"./support/index.ts","./console/run":"./console/run.ts","./queue/work":"./services/queue/work.ts","./stats/route-table":"./stats/route-table.ts","./ide/typescript-plugin":"./ide/typescript-plugin/index.ts","./bun/preload":"./bun/preload.ts","./bun/plugin":"./bun/plugin.ts","./vitest":"./vitest/index.ts"},scripts:{lint:"oxlint",typecheck:"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.browser.json && tsc --noEmit -p ide/typescript-plugin/tsconfig.json",build:"NODE_ENV=production bun run build:core && bun run build:bin && bun run build:types && bun run build:client && bun run build:plugin && bun run build:ts-plugin && bun run build:client-types && bun run build:augmentation","build:core":"bun ./scripts/build.ts","build:bin":"bun build --outdir=./dist/bin --target=bun --external=vite --external=react-dom --external=react/jsx-runtime --external=bun --external=sharp --external=@azure/storage-blob --external=typescript --sourcemap ./bin/gemi.ts ./bin/orm-generator.ts && bun ./scripts/prepare-bin.ts","build:client":"rm -rf dist/client dist/testing dist/ai/client dist/ai/voice dist/chunks && vite build -c vite.client.config.mts","build:plugin":"vite build -c vite.plugin.config.mts","build:ts-plugin":"bun ./scripts/build-ts-plugin.ts","build:types":"tsc -p tsconfig.build.json","build:client-types":"tsc -p tsconfig.browser.json",test:"bun --bun x vitest","test:types":"vitest run --typecheck.only","test:live":"bun --bun x vitest run ai/live","test:packaging":"bun --bun x vitest run --config vitest.packaging.config.ts","build:publish":"bun scripts/build-publish.ts",prepublishOnly:"echo 'Do not publish from this directory \u2014 its exports point at TS source. Run: bun run build:publish, then publish from .publish/' && exit 1","build:augmentation":"bun ./scripts/wire-augmentation.ts"},dependencies:{"@aws-sdk/client-s3":"^3.629.0","@aws-sdk/s3-request-presigner":"^3.629.0","ast-types":"^0.14.2",commander:"^12.1.0",history:"^5.3.0","jsx-email":"2.0.0-rc2.1","magic-string":"^0.30.17",open:"^10.1.0","react-error-boundary":"^6.0.0",recast:"^0.23.9",resend:"^6.12.3",satori:"^0.12.2","temporal-polyfill":"^0.2.5","twitter-api-v2":"^1.20.2","urlpattern-polyfill":"^10.0.0",uuid:"^9.0.1"},devDependencies:{"@babel/parser":"^7.25.4","@prisma/generator-helper":"^6.5.0","@repo/typescript-config":"*","@testing-library/react":"^16.3.2","@types/bun":"^1.3.14","@types/eslint":"^8.56.5","@types/node":"^20.11.24","@types/react":"^19.0.2","@types/react-dom":"^19.0.2",eslint:"^8.57.0",jsdom:"^30.0.1",oxlint:"^1.39.0",postgres:"^3.4.5",react:"19.2.3","react-dom":"19.2.3",typescript:"^5.7.3",vitest:"^4.0.0"},peerDependencies:{"@azure/storage-blob":"^12.28.0",react:">=19","react-dom":">=19",sharp:"^0.34.2",typescript:">=5",vite:"^8.0.0",postgres:"^3.4.0"},peerDependenciesMeta:{"@azure/storage-blob":{optional:!0},typescript:{optional:!0},postgres:{optional:!0}}};var Q=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557","\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551","\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D"],W=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,c=(i,n)=>W?`\x1B[${i}m${n}\x1B[0m`:n,X=(i)=>c("1",i),d=(i)=>c("2",i),j=(i)=>c("36",i),Y=(i)=>c("32",i),Z=(i)=>c("35",i);function $(){return q.version??"?"}function f(i){for(let n of Object.values(O()))for(let s of n??[])if((s.family==="IPv4"||s.family===4)&&!s.internal)return`http://${s.address}:${i}`;return null}function H(i){return y(i).filter((n)=>J(n)).map((n)=>N(n))}function T(i){let{port:n,rootDir:s}=i,b=`http://localhost:${n}`,p=f(n),e=H(s),g=(r,t)=>` ${Y("\u279C")} ${X(r.padEnd(9))}${t}`,x=["",...Q.map((r)=>Z(r)),"",` ${d("gemi")} ${j(`v${$()}`)}`,"",g("Local:",j(b)),g("Network:",p?j(p):d("unavailable")),g("Env:",e.length?e.join(", "):d("none")),""];console.log(x.join(`
3
+ `))}function D(i=process.env.SERVER_IDLE_TIMEOUT){if(i===void 0||i.trim()==="")return 10;let n=Number(i.trim());if(!Number.isInteger(n)||n<0||n>255)throw Error(`SERVER_IDLE_TIMEOUT must be a whole number of seconds from 0 to 255 (0 disables the timeout), got ${JSON.stringify(i)}.`);return n}
4
+ export{L as R,_ as S,T,D as U};
5
+
6
+ //# debugId=BE91EE18CD33A91064756E2164756E21
@@ -6,7 +6,7 @@
6
6
  "import { existsSync } from \"node:fs\";\nimport { basename } from \"node:path\";\nimport { networkInterfaces } from \"node:os\";\nimport { envFiles } from \"./watchEnv\";\nimport pkg from \"../package.json\";\n\n// \"GEMI\" — ANSI Shadow figlet font.\nconst ART = [\n \" ██████╗ ███████╗███╗ ███╗██╗\",\n \"██╔════╝ ██╔════╝████╗ ████║██║\",\n \"██║ ███╗█████╗ ██╔████╔██║██║\",\n \"██║ ██║██╔══╝ ██║╚██╔╝██║██║\",\n \"╚██████╔╝███████╗██║ ╚═╝ ██║██║\",\n \" ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝\",\n];\n\nconst useColor = Boolean(process.stdout.isTTY) && !process.env.NO_COLOR;\nconst paint = (code: string, text: string) =>\n useColor ? `\\x1b[${code}m${text}\\x1b[0m` : text;\nconst bold = (t: string) => paint(\"1\", t);\nconst dim = (t: string) => paint(\"2\", t);\nconst cyan = (t: string) => paint(\"36\", t);\nconst green = (t: string) => paint(\"32\", t);\nconst magenta = (t: string) => paint(\"35\", t);\n\nfunction gemiVersion(): string {\n return (pkg as { version?: string }).version ?? \"?\";\n}\n\nfunction networkUrl(port: number | string): string | null {\n for (const ifaces of Object.values(networkInterfaces())) {\n for (const iface of ifaces ?? []) {\n // Node <18 reported `family` as the number 4; newer Bun/Node use \"IPv4\".\n const isV4 = iface.family === \"IPv4\" || (iface.family as unknown) === 4;\n if (isV4 && !iface.internal) return `http://${iface.address}:${port}`;\n }\n }\n return null;\n}\n\nfunction loadedEnvFiles(rootDir: string): string[] {\n return envFiles(rootDir)\n .filter((file) => existsSync(file))\n .map((file) => basename(file));\n}\n\nexport function printStartupBanner(params: {\n port: number | string;\n rootDir: string;\n}) {\n const { port, rootDir } = params;\n const local = `http://localhost:${port}`;\n const network = networkUrl(port);\n const env = loadedEnvFiles(rootDir);\n\n const row = (label: string, value: string) =>\n ` ${green(\"➜\")} ${bold(label.padEnd(9))}${value}`;\n\n const out = [\n \"\",\n ...ART.map((line) => magenta(line)),\n \"\",\n ` ${dim(\"gemi\")} ${cyan(`v${gemiVersion()}`)}`,\n \"\",\n row(\"Local:\", cyan(local)),\n row(\"Network:\", network ? cyan(network) : dim(\"unavailable\")),\n row(\"Env:\", env.length ? env.join(\", \") : dim(\"none\")),\n \"\",\n ];\n\n console.log(out.join(\"\\n\"));\n}\n",
7
7
  "/**\n * Bun's default, and what both servers use when `SERVER_IDLE_TIMEOUT` is unset.\n */\nexport const DEFAULT_SERVER_IDLE_TIMEOUT = 10;\n\n/**\n * The `idleTimeout` (seconds) both `gemi dev` and `gemi start` pass to\n * `Bun.serve`, from `SERVER_IDLE_TIMEOUT` (#787).\n *\n * One reader for both servers, so a long-poll that works under `gemi start`\n * also works under `gemi dev`. Before this, only `httpProd` read the variable\n * and the dev server always ran at Bun's 10 seconds.\n *\n * It is the time a connection may stay silent, a response that has not started\n * included, before Bun closes it; `0` disables it. It does not apply to an\n * upgraded websocket (the HMR relay included), which has its own\n * `websocket.idleTimeout`.\n *\n * Unset or blank means the default. Anything that is not a whole number from 0\n * to 255 (Bun's own limits) fails the boot with the variable's name, instead\n * of Bun's \"expects idleTimeout to be an integer\", which does not say where the\n * value came from.\n */\nexport function serverIdleTimeout(raw: string | undefined = process.env.SERVER_IDLE_TIMEOUT): number {\n if (raw === undefined || raw.trim() === \"\") return DEFAULT_SERVER_IDLE_TIMEOUT;\n\n const seconds = Number(raw.trim());\n if (!Number.isInteger(seconds) || seconds < 0 || seconds > 255) {\n throw new Error(\n `SERVER_IDLE_TIMEOUT must be a whole number of seconds from 0 to 255 ` +\n `(0 disables the timeout), got ${JSON.stringify(raw)}.`,\n );\n }\n return seconds;\n}\n"
8
8
  ],
9
- "mappings": ";yCAAA,wBAAS,cAGT,SAAS,CAAc,CAAC,EAAc,EAAwC,CAC5E,IAAM,EAAc,OAAO,KAAK,CAAM,EACnC,KAAK,CAAC,EAAG,IAAM,EAAE,OAAS,EAAE,MAAM,EAClC,IAAI,CAAC,IAAQ,EAAI,QAAQ,sBAAuB,MAAM,CAAC,EAGpD,EAAQ,IAAI,OAAO,EAAY,KAAK,GAAG,EAAG,GAAG,EAEnD,OAAO,EAAK,QAAQ,EAAO,CAAC,IAAU,EAAO,EAAM,EAGrD,eAAsB,CAAe,CACnC,EACA,EACA,EAAyB,CAAC,EAE1B,EACA,CACA,IAAM,EAAQ,CACZ,GAAG,EAAa,IAAI,CAAC,IAAS,GAAG,WAAgB,OAAU,EAC3D,EAAS,GAAG,WAAgB,QAAe,GAAG,wBAChD,EAEM,EAAU,IAAI,IACpB,QAAW,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAK,YAAY,iBAAiB,CAAI,EAClD,GAAI,EACF,QAAW,KAA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:new Map,renderThenables:new Map,order:[],warmed:new Map,activeLocale:null},{registry:W,resolved:Z,inFlight:V,renderThenables:I,order:E,warmed:X}=j;function N(q,x){return`${q}\x00${x}`}function D(q){if(W.has(q.id))return;W.set(q.id,q),E.push(q.id)}function H(){return E.length}function P(q,x){return Z.get(q)?.get(x)}function $(q,x,A){let z=Z.get(q);if(!z)z=new Map,Z.set(q,z);z.set(x,A)}function U(q,x){let A=P(q,x);if(A)return A;let z=N(q,x),C=V.get(z);if(C)return C;let B=W.get(q);if(!B)throw Error(`Unknown dictionary "${q}". A dictionary must be created with defineDictionary() and its module must have been evaluated before it is read.`);let J=B.load(x);if(!(J instanceof Promise))return $(q,x,J),J;let O=J.then((Q)=>{return $(q,x,Q),V.delete(z),Q},(Q)=>{throw V.delete(z),Q});return V.set(z,O),O}function K(q,x){let A=N(q,x),z=P(q,x),C=I.get(A);if(C&&!(C.degraded&&z))return C;if(z)return G(A,M(z,!C));let B=U(q,x);if(!(B instanceof Promise))return G(A,M(B,!0));let J=B.then((O)=>O,(O)=>{return console.error(`Failed to load dictionary ${q} for locale ${x}; rendering keys instead.`,O),J.degraded=!0,Y});return G(A,J)}function G(q,x){return I.set(q,x),x}function M(q,x){return Object.assign(Promise.resolve(q),{status:"fulfilled",value:q,inHand:x?q:void 0})}var Y={};async function S(q,x){let A=x??X.get(q)??0,z=E.slice(A);if(z.length===0)return;let C=await Promise.all(z.map(async(B)=>{try{return await U(B,_(B,q)),!0}catch{return!1}}));if(x===void 0){let B=C.indexOf(!1),J=B===-1?z.length:B;X.set(q,Math.max(X.get(q)??0,A+J))}}function _(q,x){if(x)return x;return W.get(q)?.locales[0]??x}function L(q,x){if(!q)return;for(let[A,z]of Object.entries(q))$(A,x,z)}function R(q){if(q)j.activeLocale=q}function w(){return j.activeLocale}if(typeof window<"u"){let q=window,x=([z,C,B])=>{$(z,C,B)},A=Array.isArray(q.__GEMI_DICT__)?q.__GEMI_DICT__:[];q.__GEMI_DICT__={push:x};for(let z of A)x(z)}function F(){W.clear(),Z.clear(),V.clear(),I.clear(),X.clear(),E.length=0,j.activeLocale=null}function f(){let q=new Set,x=[],A=[];return{use(z,C,B){let J=`${z} ${C}`;if(q.has(J))return;q.add(J);let O={id:z,locale:C,strings:B};if(x.length===0){A.push(O);return}for(let Q of x)Q(O)},onUse(z){x.push(z);while(A.length>0)z(A.shift())}}}
3
- export{D as gk,H as hk,U as ik,K as jk,S as kk,L as lk,R as mk,w as nk,F as ok,f as pk};
3
+ export{D as hk,H as ik,U as jk,K as kk,S as lk,L as mk,R as nk,w as ok,F as pk,f as qk};
4
4
 
5
- //# debugId=272F4C7E149E39A764756E2164756E21
5
+ //# debugId=44D2F54A524D020164756E2164756E21
@@ -6,6 +6,6 @@
6
6
  "import type { LocaleStrings } from \"./dictionaryShape\";\n\n/**\n * Collects the dictionaries one SSR render actually read.\n *\n * Scoped per request by living in React context rather than in module state: a\n * streaming server has several renders in flight at once, so a module-level\n * collector would mix one page's dictionaries into another's payload. Context\n * is per render tree, which is exactly the boundary wanted, and it needs no\n * async-local storage to survive React's internal scheduling.\n *\n * Why stream these rather than put them in `__GEMI_DATA__`: that snapshot is\n * serialized before `renderToReadableStream` is even called, and which\n * dictionaries a page reads is only known once it has rendered. A suspended\n * segment reveals later still, long after the shell has flushed.\n *\n * The sink deliberately emits data, not markup — `streamQueryInjection` owns\n * script formatting and the `</script>`-safe encoding that goes with it.\n */\nexport interface DictionaryUse {\n id: string;\n locale: string;\n strings: LocaleStrings;\n}\n\nexport interface DictionarySink {\n /** Called during render, the first time a dictionary is read. */\n use(id: string, locale: string, strings: LocaleStrings): void;\n /** The response injector subscribes to receive uses as they happen. */\n onUse(cb: (use: DictionaryUse) => void): void;\n}\n\nexport function createDictionarySink(): DictionarySink {\n const seen = new Set<string>();\n const listeners: Array<(use: DictionaryUse) => void> = [];\n // Uses recorded before the injector subscribed — the render begins before the\n // response stream is wrapped.\n const pending: DictionaryUse[] = [];\n\n return {\n use(id, locale, strings) {\n const key = `${id} ${locale}`;\n if (seen.has(key)) return;\n seen.add(key);\n const entry: DictionaryUse = { id, locale, strings };\n if (listeners.length === 0) {\n pending.push(entry);\n return;\n }\n for (const listener of listeners) listener(entry);\n },\n onUse(cb) {\n listeners.push(cb);\n while (pending.length > 0) {\n cb(pending.shift()!);\n }\n },\n };\n}\n"
7
7
  ],
8
8
  "mappings": ";AA6FA,IAAM,EAAyB,WAFZ,+BAE+C,CAChE,SAAU,IAAI,IACd,SAAU,IAAI,IACd,SAAU,IAAI,IACd,gBAAiB,IAAI,IACrB,MAAO,CAAC,EACR,OAAQ,IAAI,IACZ,aAAc,IAChB,GAEQ,WAAU,WAAU,WAAU,kBAAiB,QAAO,UAAW,EAEzE,SAAS,CAAQ,CAAC,EAAY,EAAgB,CAC5C,MAAO,GAAG,QAAO,IAGZ,SAAS,CAAkB,CAAC,EAA6B,CAM9D,GAAI,EAAS,IAAI,EAAM,EAAE,EACvB,OAEF,EAAS,IAAI,EAAM,GAAI,CAAK,EAC5B,EAAM,KAAK,EAAM,EAAE,EAId,SAAS,CAA0B,EAAW,CACnD,OAAO,EAAM,OAGR,SAAS,CAAW,CACzB,EACA,EAC2B,CAC3B,OAAO,EAAS,IAAI,CAAE,GAAG,IAAI,CAAM,EAGrC,SAAS,CAAW,CAAC,EAAY,EAAgB,EAAwB,CACvE,IAAI,EAAW,EAAS,IAAI,CAAE,EAC9B,GAAI,CAAC,EACH,EAAW,IAAI,IACf,EAAS,IAAI,EAAI,CAAQ,EAE3B,EAAS,IAAI,EAAQ,CAAO,EAQvB,SAAS,CAAc,CAC5B,EACA,EACwC,CACxC,IAAM,EAAU,EAAY,EAAI,CAAM,EACtC,GAAI,EACF,OAAO,EAGT,IAAM,EAAM,EAAS,EAAI,CAAM,EACzB,EAAU,EAAS,IAAI,CAAG,EAChC,GAAI,EACF,OAAO,EAGT,IAAM,EAAQ,EAAS,IAAI,CAAE,EAC7B,GAAI,CAAC,EACH,MAAU,MACR,uBAAuB,qHACzB,EAGF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EAElC,MAAO,CACL,GAAG,CAAC,EAAI,EAAQ,EAAS,CACvB,IAAM,EAAM,GAAG,KAAM,IACrB,GAAI,EAAK,IAAI,CAAG,EAAG,OACnB,EAAK,IAAI,CAAG,EACZ,IAAM,EAAuB,CAAE,KAAI,SAAQ,SAAQ,EACnD,GAAI,EAAU,SAAW,EAAG,CAC1B,EAAQ,KAAK,CAAK,EAClB,OAEF,QAAW,KAAY,EAAW,EAAS,CAAK,GAElD,KAAK,CAAC,EAAI,CACR,EAAU,KAAK,CAAE,EACjB,MAAO,EAAQ,OAAS,EACtB,EAAG,EAAQ,MAAM,CAAE,EAGzB",
9
- "debugId": "272F4C7E149E39A764756E2164756E21",
9
+ "debugId": "44D2F54A524D020164756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -2,6 +2,6 @@
2
2
  import{existsSync as $,readdirSync as B}from"fs";import{join as Y,relative as G}from"path";function J(K,Q=[]){let U=[],X=(H)=>{let z=G(K,H).split("\\").join("/");return Q.some((q)=>z===q||z.startsWith(`${q}/`))},V=(H)=>{for(let z of B(H,{withFileTypes:!0}).sort((q,Z)=>q.name<Z.name?-1:q.name>Z.name?1:0)){let q=Y(H,z.name);if(X(q))continue;if(z.isDirectory()){if(z.name.startsWith(".")||z.name==="node_modules")continue;if($(Y(q,"package.json")))continue;V(q);continue}if(!z.name.endsWith(".ts")&&!z.name.endsWith(".tsx"))continue;if(z.name.endsWith(".d.ts"))continue;if(/\.(test|test-d|spec|bench)\.tsx?$/.test(z.name))continue;U.push(q)}};if(!$(K))return U;return V(K),U}class A extends Error{constructor(K,Q){super(K,Q);this.name="DiscoveryError"}}async function W(K,Q,U=[],X){let V=new Set;for(let H of J(K,U)){let z;try{z=await import(H)}catch(q){throw new A(`${H} could not be imported, so the classes in it could not be discovered:
3
3
  ${q.message}
4
4
  List the classes explicitly in the config slice for this directory to skip the walk.`,{cause:q})}for(let q of Object.values(z)){if(typeof q==="function"&&q!==Q&&Object.prototype.isPrototypeOf.call(Q,q)){V.add(q);continue}X?.(q,H)}}return[...V]}function F(){return Y(process.cwd(),process.env.GEMI_PROJECT_DIR??"")}
5
- export{J as Vk,A as Wk,W as Xk,F as Yk};
5
+ export{J as Wk,A as Xk,W as Yk,F as Zk};
6
6
 
7
- //# debugId=382DF89DE0B304FA64756E2164756E21
7
+ //# debugId=5874AF67C52D129564756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "import { existsSync, readdirSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\n\n/**\n * Finding the classes an application declared and never imported — the walk\n * #322 and #323 both end at.\n *\n * ### Why it has to run the files\n *\n * A job that is written and not listed does not fail; it disappears.\n * `QueueManager.run` looks a dispatched name up in the map its config built and\n * drops what is not there, so the dispatch is simply lost. A cron drifts worse:\n * nothing is waiting on a tick, so a job that never fires reports nothing to\n * anyone. What both come down to is that `app/config/queue.ts` naming every\n * `Job` subclass is the *only* thing putting those classes in the module graph —\n * the list and the directory are two spellings of one set, kept in step by hand.\n *\n * The way out of that is to read the directory, and there is no static read that\n * will do: the class does not exist until its module has run. So **every file\n * walked here is imported**, and a file that *does something* when imported does\n * it here — at boot, in production, on every start. `gemi check models` makes\n * the same trade for the same reason and pays it once per CI run; a caller of\n * this pays it once per process.\n *\n * ### What that asks of a caller\n *\n * **Point it at a directory of class declarations, not at `app/`.** The skip\n * rules on `sourceFiles` drop what certainly is not one — tests, benchmarks,\n * `.d.ts`, vendored packages — and nothing else. Widening the guesses is how a\n * discovery pass ends up quietly covering less than the directory holds, which\n * is the same silence in a new place.\n *\n * **Let a broken file stop the boot.** `discoverClasses` rethrows an import\n * failure naming the file rather than dropping it and carrying on, for the same\n * reason: four classes found out of five looks exactly like five out of five.\n *\n * **Leave a way out.** Discovery is what should happen when an app said\n * nothing. An app that lists its classes explicitly must not reach this file at\n * all — that is the escape hatch for a directory holding something this cannot\n * import, and it is the sentence an error from here should point at.\n *\n * ### One more thing worth knowing\n *\n * This imports by absolute path, while the application imports the same files\n * through the `@/app/*` alias. Bun keys its module registry by the *resolved*\n * path, so those two specifiers land on one module: a job already reached from\n * a controller is not evaluated a second time here, and the class object is the\n * same one. `gemi build` leaves that true in production — `packages: \"external\"`\n * keeps the app's own code out of `dist/server/server.mjs` and resolves it from\n * source at runtime, exactly as `gemi dev` does.\n *\n * Nothing here depends on that holding, and deliberately: `QueueManager` and the\n * `Scheduler`'s cross-reload registry are both keyed by name rather than by\n * class identity, so a build that did inline the app's modules would produce a\n * duplicate class object and still register the right job. Worth knowing before\n * writing a registry keyed the other way.\n */\n\n/**\n * The files under `dir` that could declare a class.\n *\n * Everything underneath it, because apps do group classes into folders, minus\n * what cannot be one. Each of these is going to be *imported*, so the exclusions\n * are about what is certainly not source rather than about what is probably not:\n *\n * - **Declaration files.** `.d.ts` has no runtime module behind it.\n * - **Tests, type tests and benchmarks**, by the suffix a runner already\n * recognises.\n * - **Dot-directories and `node_modules`.**\n * - **Any directory holding a `package.json`.** That is a package that happens\n * to live here — a vendored client, a generated SDK — not this app's source,\n * and importing its entry point runs somebody else's module graph. The\n * template has two under `app/models`.\n *\n * `ignore` is the escape hatch for the rest: a path prefix, relative to `dir`,\n * naming a file or a directory of adjacent code that runs something on import.\n * Nothing is ignored by default.\n *\n * The order is the same on every run over the same tree, which matters because\n * the caller is going to import in it: entries are sorted per directory before\n * recursing, and `readdirSync` order is the filesystem's rather than\n * alphabetical — a tree written `A.ts` then `B.ts` reads back `B.ts` first on\n * the machines this was tested on. Sorting per directory rather than sorting the\n * finished list is deliberate: for a tree holding both `a.ts` and `a/b.ts`, this\n * emits `a/b.ts` first, because the directory sorts before the file.\n *\n * A directory that does not exist yields an empty list rather than throwing.\n * \"The app has no jobs yet\" is an ordinary state and not this function's to\n * complain about — but it is indistinguishable from \"the app's source did not\n * ship\", so a caller that boots on the answer owes the reader a word about which\n * one it got.\n */\nexport function sourceFiles(dir: string, ignore: string[] = []): string[] {\n const out: string[] = [];\n\n const ignored = (path: string) => {\n const rel = relative(dir, path).split(\"\\\\\").join(\"/\");\n return ignore.some(\n (pattern) => rel === pattern || rel.startsWith(`${pattern}/`),\n );\n };\n\n const walk = (current: string) => {\n for (const entry of readdirSync(current, { withFileTypes: true }).sort(\n (a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0),\n )) {\n const path = join(current, entry.name);\n if (ignored(path)) continue;\n\n if (entry.isDirectory()) {\n if (entry.name.startsWith(\".\") || entry.name === \"node_modules\")\n continue;\n if (existsSync(join(path, \"package.json\"))) continue;\n walk(path);\n continue;\n }\n\n if (!entry.name.endsWith(\".ts\") && !entry.name.endsWith(\".tsx\")) continue;\n if (entry.name.endsWith(\".d.ts\")) continue;\n if (/\\.(test|test-d|spec|bench)\\.tsx?$/.test(entry.name)) continue;\n\n out.push(path);\n }\n };\n\n if (!existsSync(dir)) return out;\n\n walk(dir);\n return out;\n}\n\n/**\n * A class, as much of one as this file can name. `abstract` so that a base an\n * app never instantiates directly is a legal argument.\n */\ntype ClassLike = abstract new (...args: never[]) => unknown;\n\n/**\n * A file that would not import, reported with the file that would not import.\n *\n * Separate from a bare rethrow because the stack of a failed dynamic import\n * names the module that failed to *resolve*, several frames deep, and says\n * nothing about the walk that asked for it — so the reader learns that some\n * `?raw` specifier is unresolvable without learning that discovery is what\n * imported it, or that listing the classes explicitly is how they get their boot\n * back.\n */\nexport class DiscoveryError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = \"DiscoveryError\";\n }\n}\n\n/**\n * Every exported class under `dir` whose prototype chain reaches `base`.\n *\n * `base` is a parameter rather than an import so that this file names no\n * service and stays cheap to depend on — `bin/check-models.ts` uses the walker\n * above and is bundled into `dist/bin/gemi.js`, which is not somewhere gemi's\n * service layer should end up. It is also what lets a test hand in a base class\n * of its own instead of standing up a project that can resolve `gemi/services`.\n *\n * `base` itself is never returned. A directory whose files import their base\n * from a sibling — the shape an app reaches for when several jobs share a gate —\n * re-exports it as often as not, and a framework that scheduled the abstract\n * base along with its subclasses would be running a job nobody wrote.\n *\n * A class is returned once no matter how many exports name it. A barrel in the\n * directory re-exporting everything beside it is the ordinary case, and it makes\n * every class reachable twice.\n *\n * The order is the walk's, and within a file the module namespace's, which the\n * language sorts by name. So the answer is the same on every run — worth having\n * where the caller is a scheduler and the alternative is a boot order that\n * depends on the filesystem.\n *\n * `onSkipped` is handed every export that did *not* match, with the file it came\n * from. Discovery's characteristic failure is a thing the author wrote and this\n * walk cannot see, and by the time an export has been discarded here the\n * information about why is gone — the caller is left holding \"four classes\"\n * where the directory holds five. A caller that can recognise its own\n * near-misses, as `discoverCommands` recognises a builder chain that was never\n * finished, uses this to say so by name instead.\n *\n * @throws DiscoveryError if a walked file cannot be imported. Not a skip: a file\n * that will not load is a class the caller was going to be told about and now is\n * not, which is the failure discovery exists to remove.\n */\nexport async function discoverClasses<T extends ClassLike>(\n dir: string,\n base: T,\n ignore: string[] = [],\n onSkipped?: (value: unknown, file: string) => void,\n): Promise<T[]> {\n const found = new Set<T>();\n\n for (const path of sourceFiles(dir, ignore)) {\n let module: Record<string, unknown>;\n\n try {\n module = (await import(path)) as Record<string, unknown>;\n } catch (error) {\n throw new DiscoveryError(\n `${path} could not be imported, so the classes in it could not be ` +\n `discovered:\\n ${(error as Error).message}\\n` +\n `List the classes explicitly in the config slice for this directory ` +\n `to skip the walk.`,\n { cause: error },\n );\n }\n\n for (const value of Object.values(module)) {\n if (\n typeof value === \"function\" &&\n value !== base &&\n Object.prototype.isPrototypeOf.call(base, value)\n ) {\n found.add(value as unknown as T);\n continue;\n }\n\n onSkipped?.(value, path);\n }\n }\n\n return [...found];\n}\n\n/**\n * The directory an app's `app/` sits in, as the running process can know it.\n *\n * `ROOT_DIR` is the obvious answer and is not available: `Server.start` awaits\n * `waitForBoot()` — every provider's `register` and `boot` — and only then\n * imports the http layer that sets it. Anything resolving paths during boot is\n * earlier than the variable it would want.\n *\n * What it can use is the same rule `httpProd` computes `ROOT_DIR` with a moment\n * later, which is why that file now calls this instead of repeating it. `gemi\n * dev` and `gemi start` both spawn the server with no `cwd`, so the process\n * inherits the CLI's, and the CLI takes `process.cwd()` for the project root\n * itself — `bun/preload.ts` reads `gemi.config` from it on the same assumption.\n *\n * `httpDev` computes a bare `process.cwd()`, so it and `httpProd` already\n * disagree whenever `GEMI_PROJECT_DIR` is set. Nothing in this repo sets it and\n * `gemi start` ignores it when locating the built entry point, so the two rules\n * are the same rule for every configuration that runs today; the divergence is\n * older than this function and wants its own fix.\n */\nexport function projectRoot(): string {\n return join(process.cwd(), process.env.GEMI_PROJECT_DIR ?? \"\");\n}\n"
6
6
  ],
7
7
  "mappings": ";AAAA,qBAAS,iBAAY,WACrB,eAAS,cAAM,aA2FR,SAAS,CAAW,CAAC,EAAa,EAAmB,CAAC,EAAa,CACxE,IAAM,EAAgB,CAAC,EAEjB,EAAU,CAAC,IAAiB,CAChC,IAAM,EAAM,EAAS,EAAK,CAAI,EAAE,MAAM,IAAI,EAAE,KAAK,GAAG,EACpD,OAAO,EAAO,KACZ,CAAC,IAAY,IAAQ,GAAW,EAAI,WAAW,GAAG,IAAU,CAC9D,GAGI,EAAO,CAAC,IAAoB,CAChC,QAAW,KAAS,EAAY,EAAS,CAAE,cAAe,EAAK,CAAC,EAAE,KAChE,CAAC,EAAG,IAAO,EAAE,KAAO,EAAE,KAAO,GAAK,EAAE,KAAO,EAAE,KAAO,EAAI,CAC1D,EAAG,CACD,IAAM,EAAO,EAAK,EAAS,EAAM,IAAI,EACrC,GAAI,EAAQ,CAAI,EAAG,SAEnB,GAAI,EAAM,YAAY,EAAG,CACvB,GAAI,EAAM,KAAK,WAAW,GAAG,GAAK,EAAM,OAAS,eAC/C,SACF,GAAI,EAAW,EAAK,EAAM,cAAc,CAAC,EAAG,SAC5C,EAAK,CAAI,EACT,SAGF,GAAI,CAAC,EAAM,KAAK,SAAS,KAAK,GAAK,CAAC,EAAM,KAAK,SAAS,MAAM,EAAG,SACjE,GAAI,EAAM,KAAK,SAAS,OAAO,EAAG,SAClC,GAAI,oCAAoC,KAAK,EAAM,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