elanous 0.2.43 → 0.2.47

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 (706) hide show
  1. package/README.md +3 -3
  2. package/apps/pwa/out/404/index.html +1 -1
  3. package/apps/pwa/out/404.html +1 -1
  4. package/apps/pwa/out/_next/static/chunks/05181998.4f8efaf00572ba3b.js +122 -0
  5. package/apps/pwa/out/_next/static/chunks/1100-c0c1d80f649e121b.js +1 -0
  6. package/apps/pwa/out/_next/static/chunks/113.80a933f7c75c98f4.js +24 -0
  7. package/apps/pwa/out/_next/static/chunks/1170.2b91e0702fae25c2.js +1 -0
  8. package/apps/pwa/out/_next/static/chunks/120-0c4a26e7eedc1bb9.js +1 -0
  9. package/apps/pwa/out/_next/static/chunks/1279.d5c20b1a56b736bf.js +149 -0
  10. package/apps/pwa/out/_next/static/chunks/1372.9db49566ed0e4c02.js +104 -0
  11. package/apps/pwa/out/_next/static/chunks/{8062-7cd0bcc7f01455ba.js → 1395-be70dd3408dec106.js} +3 -3
  12. package/apps/pwa/out/_next/static/chunks/1449-4665277ec241284f.js +1 -0
  13. package/apps/pwa/out/_next/static/chunks/1473.ac3cee48c1d82bc6.js +1 -0
  14. package/apps/pwa/out/_next/static/chunks/1510.7b4ce4032d06097c.js +148 -0
  15. package/apps/pwa/out/_next/static/chunks/1575.33a2d7d2be3d23f9.js +1 -0
  16. package/apps/pwa/out/_next/static/chunks/1728-d9808a0d6be6aa40.js +1 -0
  17. package/apps/pwa/out/_next/static/chunks/{d96660fb.cbc21a2a88539dbb.js → 17673afb.ba8b2d0410a4be97.js} +7 -7
  18. package/apps/pwa/out/_next/static/chunks/{5824.da9527b15a3221e5.js → 2021.7d4dfac25daed3bc.js} +1 -1
  19. package/apps/pwa/out/_next/static/chunks/2128.368c63f8816ffc35.js +1 -0
  20. package/apps/pwa/out/_next/static/chunks/2272-2179b64be6512dcf.js +1 -0
  21. package/apps/pwa/out/_next/static/chunks/2282-7f396efa367b707d.js +1 -0
  22. package/apps/pwa/out/_next/static/chunks/{7900.096f455c7c1efc53.js → 2313.444bed0db65aadb0.js} +2 -2
  23. package/apps/pwa/out/_next/static/chunks/{2073-ba274e00e4f9efb4.js → 2408-017e04049c99038f.js} +1 -1
  24. package/apps/pwa/out/_next/static/chunks/2433.1108dd9eb7f009c0.js +1 -0
  25. package/apps/pwa/out/_next/static/chunks/2474-ce5b82a664d581f2.js +1 -0
  26. package/apps/pwa/out/_next/static/chunks/2532.376ea6de59f7c4f0.js +1 -0
  27. package/apps/pwa/out/_next/static/chunks/256.2a8e008d30947074.js +1 -0
  28. package/apps/pwa/out/_next/static/chunks/27.a383feedd4b99367.js +74 -0
  29. package/apps/pwa/out/_next/static/chunks/{6540.c7bef57ad8f90a87.js → 2767.71eaafcf158c9e24.js} +3 -3
  30. package/apps/pwa/out/_next/static/chunks/279-9a8b620470792271.js +1 -0
  31. package/apps/pwa/out/_next/static/chunks/{3113.d7472bbc27d580c7.js → 2791.6620db26a28b4ad4.js} +1 -1
  32. package/apps/pwa/out/_next/static/chunks/2831-6d9d315a32b98961.js +1 -0
  33. package/apps/pwa/out/_next/static/chunks/292.06ca375a02c7830b.js +1 -0
  34. package/apps/pwa/out/_next/static/chunks/2955-056d5f1facf64dd7.js +1 -0
  35. package/apps/pwa/out/_next/static/chunks/2979-9c9f85d058367133.js +1 -0
  36. package/apps/pwa/out/_next/static/chunks/2993.e25197cd7fb4e2e5.js +1 -0
  37. package/apps/pwa/out/_next/static/chunks/29a68040.431a2da0564d7724.js +1 -0
  38. package/apps/pwa/out/_next/static/chunks/{5930.8b4df3b46c32b05a.js → 3131.e7063655797e9743.js} +1 -1
  39. package/apps/pwa/out/_next/static/chunks/314-db68d7268a1f99aa.js +1 -0
  40. package/apps/pwa/out/_next/static/chunks/316.76984e210cf33c21.js +62 -0
  41. package/apps/pwa/out/_next/static/chunks/3255-80f60feecd5db880.js +1 -0
  42. package/apps/pwa/out/_next/static/chunks/3271.938bf60213f6cd17.js +8 -0
  43. package/apps/pwa/out/_next/static/chunks/3325-9699faf5a5294830.js +1 -0
  44. package/apps/pwa/out/_next/static/chunks/3418-f1ea6c6c710d5b94.js +1 -0
  45. package/apps/pwa/out/_next/static/chunks/342.050ac4b1738dfa5c.js +94 -0
  46. package/apps/pwa/out/_next/static/chunks/{9810-2543267050e58b82.js → 3545-5642d5df0667bcac.js} +1 -1
  47. package/apps/pwa/out/_next/static/chunks/3615-322e67bfc3b6907e.js +1 -0
  48. package/apps/pwa/out/_next/static/chunks/3805-5c39a4bf5012fe86.js +1 -0
  49. package/apps/pwa/out/_next/static/chunks/3892.b8cde90082048d8c.js +1 -0
  50. package/apps/pwa/out/_next/static/chunks/3900.b581090764d62bfb.js +1 -0
  51. package/apps/pwa/out/_next/static/chunks/3907.097fcec8956b021d.js +1 -0
  52. package/apps/pwa/out/_next/static/chunks/4110.8f14b59381558d7d.js +32 -0
  53. package/apps/pwa/out/_next/static/chunks/422.33fde3dd808ec96d.js +115 -0
  54. package/apps/pwa/out/_next/static/chunks/4512-11a489cb5444ef52.js +1 -0
  55. package/apps/pwa/out/_next/static/chunks/4537-2c8089e830054a19.js +1 -0
  56. package/apps/pwa/out/_next/static/chunks/{8967-7dfebf710c9dec9d.js → 4548-afc498c924849db3.js} +1 -1
  57. package/apps/pwa/out/_next/static/chunks/4588.3b7994fe28615549.js +23 -0
  58. package/apps/pwa/out/_next/static/chunks/4621-dcc3be02b7262bbe.js +1 -0
  59. package/apps/pwa/out/_next/static/chunks/4680-53705a02f53bd359.js +1 -0
  60. package/apps/pwa/out/_next/static/chunks/4705-16e4a3603923253d.js +1 -0
  61. package/apps/pwa/out/_next/static/chunks/4731.460c7a05f812951a.js +1 -0
  62. package/apps/pwa/out/_next/static/chunks/{3694.e0099884345f0198.js → 4818.6fdc817b8b12788a.js} +1 -1
  63. package/apps/pwa/out/_next/static/chunks/4875-dbc3d55494aa15bb.js +1 -0
  64. package/apps/pwa/out/_next/static/chunks/4890-100ef7fd2852528a.js +1 -0
  65. package/apps/pwa/out/_next/static/chunks/497.e875b212a877dc91.js +1 -0
  66. package/apps/pwa/out/_next/static/chunks/5106-1d9854b2e07d263b.js +1 -0
  67. package/apps/pwa/out/_next/static/chunks/{3091.a5a4143dea33d197.js → 5136.062e5b4ac043384f.js} +1 -1
  68. package/apps/pwa/out/_next/static/chunks/5190.7cb2cf1274606639.js +1 -0
  69. package/apps/pwa/out/_next/static/chunks/5290.80a8cd7d37adf0b4.js +1 -0
  70. package/apps/pwa/out/_next/static/chunks/543.67803b0449dc628e.js +1 -0
  71. package/apps/pwa/out/_next/static/chunks/5464-f8193c7ae973d9d1.js +1 -0
  72. package/apps/pwa/out/_next/static/chunks/5501.43770a36d11760e4.js +1 -0
  73. package/apps/pwa/out/_next/static/chunks/5672.2616c24baee6bb2f.js +34 -0
  74. package/apps/pwa/out/_next/static/chunks/5745-8a56d7701139e416.js +1 -0
  75. package/apps/pwa/out/_next/static/chunks/5757.eae58c9553985765.js +79 -0
  76. package/apps/pwa/out/_next/static/chunks/5848-9c1a3b9533bd0031.js +1 -0
  77. package/apps/pwa/out/_next/static/chunks/{8986.8e2e4efbfa655c59.js → 5987.3693cba0f39fc644.js} +1 -1
  78. package/apps/pwa/out/_next/static/chunks/{6944.309f4e3ea54d1537.js → 6006.3dcd594182d0cedb.js} +1 -1
  79. package/apps/pwa/out/_next/static/chunks/{aa57532f.510551854ff239b1.js → 607d4dc1.a4c4988d2c164d64.js} +1 -1
  80. package/apps/pwa/out/_next/static/chunks/6166-b2fc7231dee53e86.js +1 -0
  81. package/apps/pwa/out/_next/static/chunks/6250.7667f92b4d4465fb.js +1 -0
  82. package/apps/pwa/out/_next/static/chunks/{114.2b90424d1a3ce84c.js → 6293.4e33bcd25fa7fe80.js} +1 -1
  83. package/apps/pwa/out/_next/static/chunks/6312.11884f8b6fc01317.js +1 -0
  84. package/apps/pwa/out/_next/static/chunks/6329.cfe619f9146ddb60.js +287 -0
  85. package/apps/pwa/out/_next/static/chunks/6610-f0510f329e6c15e8.js +1 -0
  86. package/apps/pwa/out/_next/static/chunks/6840.046ad6790da728d9.js +1 -0
  87. package/apps/pwa/out/_next/static/chunks/6851.700470acf99ed58b.js +1 -0
  88. package/apps/pwa/out/_next/static/chunks/{0ad6802e.ae7afb63fdcb4491.js → 6c31d3a0.7f6d7568c2b7f9cc.js} +1 -1
  89. package/apps/pwa/out/_next/static/chunks/{5789.2da35c258292e1e5.js → 7134.373f7059f13a9ea9.js} +1 -1
  90. package/apps/pwa/out/_next/static/chunks/{1406.a1dc2ab6f8449374.js → 7216.dc82684f78870505.js} +2 -2
  91. package/apps/pwa/out/_next/static/chunks/{5564.9e72532188f57586.js → 7327.5bc587cdfbb7468b.js} +4 -4
  92. package/apps/pwa/out/_next/static/chunks/{8861-cc1fa1c7b920fa8e.js → 7340-55af4d0198f3c218.js} +1 -1
  93. package/apps/pwa/out/_next/static/chunks/7385.23cc541c89c2fa98.js +286 -0
  94. package/apps/pwa/out/_next/static/chunks/{5963-c4d8469c52a0828b.js → 7631-673b883cfbbcaed1.js} +1 -1
  95. package/apps/pwa/out/_next/static/chunks/7746.17ee8fc1f87b774f.js +1 -0
  96. package/apps/pwa/out/_next/static/chunks/{2573.387a707f6f9d720c.js → 7756.ba59333b9f5eb5b1.js} +2 -2
  97. package/apps/pwa/out/_next/static/chunks/7763.a7579952c4e6f1b4.js +1 -0
  98. package/apps/pwa/out/_next/static/chunks/8045.a714469921e805dd.js +1 -0
  99. package/apps/pwa/out/_next/static/chunks/{5394.5dabeb0c62293a28.js → 8073.57b55743909e9013.js} +2 -2
  100. package/apps/pwa/out/_next/static/chunks/8126.e5237d43a372cf65.js +1 -0
  101. package/apps/pwa/out/_next/static/chunks/81a72ea7-19d3ed13dbaabf14.js +1 -0
  102. package/apps/pwa/out/_next/static/chunks/8269-782b63932e10a2ae.js +1 -0
  103. package/apps/pwa/out/_next/static/chunks/8385-931a72cc6864b91f.js +1 -0
  104. package/apps/pwa/out/_next/static/chunks/8541-6801e6237710c920.js +1 -0
  105. package/apps/pwa/out/_next/static/chunks/8572.c425a14dcf1ffeb0.js +1 -0
  106. package/apps/pwa/out/_next/static/chunks/867-2d1e981b0167c29a.js +1 -0
  107. package/apps/pwa/out/_next/static/chunks/8723.ca926aacbbf3ac7f.js +1 -0
  108. package/apps/pwa/out/_next/static/chunks/8747.eeb006b94dad5759.js +41 -0
  109. package/apps/pwa/out/_next/static/chunks/895.5f73e50705fe1830.js +226 -0
  110. package/apps/pwa/out/_next/static/chunks/{5866.366966af47fdde5d.js → 8993.bbf6810d7afa70bf.js} +1 -1
  111. package/apps/pwa/out/_next/static/chunks/{c7945435-b44d4dbe90ba0dcb.js → 8f44ce90-05842a3e94de7716.js} +1 -1
  112. package/apps/pwa/out/_next/static/chunks/9066.629ebf156fcd2ab1.js +27 -0
  113. package/apps/pwa/out/_next/static/chunks/9133-06cf65777241d447.js +1 -0
  114. package/apps/pwa/out/_next/static/chunks/{3903.3ef4656c67572764.js → 9160.83b3cab34166c934.js} +1 -1
  115. package/apps/pwa/out/_next/static/chunks/{5628.6ddb2d5ffba4ff4c.js → 919.c8775745cc88225f.js} +4 -4
  116. package/apps/pwa/out/_next/static/chunks/{0966f8a1.745fcd44f64a87ea.js → 9270078e.402279bc985895b9.js} +1 -1
  117. package/apps/pwa/out/_next/static/chunks/9397.b3fbfb372280934a.js +1 -0
  118. package/apps/pwa/out/_next/static/chunks/{3402.44b565b314f2263c.js → 9605.c828819da413e8e0.js} +1 -1
  119. package/apps/pwa/out/_next/static/chunks/9635.f8d12ec73885ac29.js +1 -0
  120. package/apps/pwa/out/_next/static/chunks/{2144.25b292396712196d.js → 9695.d086738c907a0c2c.js} +2 -2
  121. package/apps/pwa/out/_next/static/chunks/{3072.01338851ca21a6f7.js → 9748.2866a5c59dbe980c.js} +2 -2
  122. package/apps/pwa/out/_next/static/chunks/9828.e6e68b558c521de6.js +24 -0
  123. package/apps/pwa/out/_next/static/chunks/{5154.5f56dc3902e3d275.js → 9893.7a7b6edae64e8ead.js} +2 -2
  124. package/apps/pwa/out/_next/static/chunks/9a51175e.fccb3ff43e50adbc.js +1 -0
  125. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-bedb21eab48baf18.js +1 -0
  126. package/apps/pwa/out/_next/static/chunks/app/approvals/page-07762315735dd0b2.js +1 -0
  127. package/apps/pwa/out/_next/static/chunks/app/autopilot/page-03f85a9f0a258ea8.js +1 -0
  128. package/apps/pwa/out/_next/static/chunks/app/board/page-e845d6c10f91d76b.js +1 -0
  129. package/apps/pwa/out/_next/static/chunks/app/botlab/page-fb3631f9f3a50179.js +1 -0
  130. package/apps/pwa/out/_next/static/chunks/app/bots/page-00f6e3c7a80a9bce.js +1 -0
  131. package/apps/pwa/out/_next/static/chunks/app/ceo/page-971a0c0861b98018.js +1 -0
  132. package/apps/pwa/out/_next/static/chunks/app/chat/page-651d5b7636a46cf6.js +1 -0
  133. package/apps/pwa/out/_next/static/chunks/app/consult/page-d02ad543024d8341.js +1 -0
  134. package/apps/pwa/out/_next/static/chunks/app/control/page-bb376bd8355baae6.js +1 -0
  135. package/apps/pwa/out/_next/static/chunks/app/decisions/page-28c4bec75794d1bd.js +1 -0
  136. package/apps/pwa/out/_next/static/chunks/app/design-check/page-2123da599d50838a.js +1 -0
  137. package/apps/pwa/out/_next/static/chunks/app/editor/page-2955f93723dcc402.js +1 -0
  138. package/apps/pwa/out/_next/static/chunks/app/exec/page-9223ba698a2a0188.js +1 -0
  139. package/apps/pwa/out/_next/static/chunks/app/field/{page-6b8b4267bab0a677.js → page-e81094cf3567e2f2.js} +1 -1
  140. package/apps/pwa/out/_next/static/chunks/app/healthz/route-bedb21eab48baf18.js +1 -0
  141. package/apps/pwa/out/_next/static/chunks/app/inside/page-7d654302ac3b3a4e.js +1 -0
  142. package/apps/pwa/out/_next/static/chunks/app/intake/page-2bc02d4bee167db4.js +1 -0
  143. package/apps/pwa/out/_next/static/chunks/app/layout-617df2f350b6d863.js +1 -0
  144. package/apps/pwa/out/_next/static/chunks/app/live/{page-eff819f0c2d5e084.js → page-499ad36f9c8d105c.js} +1 -1
  145. package/apps/pwa/out/_next/static/chunks/app/live-run/page-09acff44586be1c2.js +1 -0
  146. package/apps/pwa/out/_next/static/chunks/app/loops/page-5c18c95a9bd1c524.js +1 -0
  147. package/apps/pwa/out/_next/static/chunks/app/market/page-b7e45df4c89eda9d.js +1 -0
  148. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-9bd9e634f324e2d8.js +1 -0
  149. package/apps/pwa/out/_next/static/chunks/app/morning/{page-9ee28f7df07428ea.js → page-895823d15c5776c7.js} +1 -1
  150. package/apps/pwa/out/_next/static/chunks/app/not-found-76d702791c75b6f5.js +1 -0
  151. package/apps/pwa/out/_next/static/chunks/app/observatory/page-89cdfe958d836563.js +1 -0
  152. package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-65718fff9f43051d.js +1 -0
  153. package/apps/pwa/out/_next/static/chunks/app/ops/release/page-f0d6a675eb513720.js +1 -0
  154. package/apps/pwa/out/_next/static/chunks/app/ops/resources/page-a0d5bffbf9203c00.js +1 -0
  155. package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-9890ca9c1b120cf1.js +1 -0
  156. package/apps/pwa/out/_next/static/chunks/app/outputs/page-bb9cf5e9622532a0.js +1 -0
  157. package/apps/pwa/out/_next/static/chunks/app/page-44dfa774fa7c5533.js +1 -0
  158. package/apps/pwa/out/_next/static/chunks/app/reflection/page-93c8c51d77053d35.js +1 -0
  159. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-716bdba6d2ad3fcd.js +1 -0
  160. package/apps/pwa/out/_next/static/chunks/app/sessions/page-0f04eeda9894b67d.js +1 -0
  161. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-3835d43c61fa1af6.js +1 -0
  162. package/apps/pwa/out/_next/static/chunks/app/settings/page-41e8ba9c4feab48e.js +1 -0
  163. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-eedf8d31ba99ca9f.js +1 -0
  164. package/apps/pwa/out/_next/static/chunks/app/setup/layout-bedb21eab48baf18.js +1 -0
  165. package/apps/pwa/out/_next/static/chunks/app/setup/page-241ed1c971bfa1ac.js +1 -0
  166. package/apps/pwa/out/_next/static/chunks/app/share/page-93e2ce2a6e871642.js +1 -0
  167. package/apps/pwa/out/_next/static/chunks/app/showroom/page-561cf4fce14c622c.js +1 -0
  168. package/apps/pwa/out/_next/static/chunks/app/tasks/page-b71cab2d1ba15c2c.js +1 -0
  169. package/apps/pwa/out/_next/static/chunks/app/term/page-f86e352129f64ac6.js +1 -0
  170. package/apps/pwa/out/_next/static/chunks/app/today/page-5b0bd68768085bdb.js +1 -0
  171. package/apps/pwa/out/_next/static/chunks/app/trace/page-a6003c82802c5e93.js +1 -0
  172. package/apps/pwa/out/_next/static/chunks/app/vault/page-122887bd22818e86.js +1 -0
  173. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/{page-b4396321238798ec.js → page-a5e2267da13cac6d.js} +1 -1
  174. package/apps/pwa/out/_next/static/chunks/app/workflows/page-abac2741a74c7e0f.js +1 -0
  175. package/apps/pwa/out/_next/static/chunks/app/workspace/page-cc3091a30e35cbde.js +1 -0
  176. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-1b5ef5aad6c1eefc.js +1 -0
  177. package/apps/pwa/out/_next/static/chunks/{cb0f8df8.09a4a6be97e3fc5f.js → c0a97b40.42e62d6352afa9df.js} +1 -1
  178. package/apps/pwa/out/_next/static/chunks/{3557ac4a.c8931684475018ad.js → e866a15a.97493b74d66f48b3.js} +1 -1
  179. package/apps/pwa/out/_next/static/chunks/framework-52efbeade0c028ac.js +1 -0
  180. package/apps/pwa/out/_next/static/chunks/main-app-365b194cc7ba42f7.js +1 -0
  181. package/apps/pwa/out/_next/static/chunks/main-dc781b21621cd6de.js +1 -0
  182. package/apps/pwa/out/_next/static/chunks/pages/_app-c69e53f764eae97b.js +1 -0
  183. package/apps/pwa/out/_next/static/chunks/pages/_error-bd8106d7e595dfc3.js +1 -0
  184. package/apps/pwa/out/_next/static/chunks/webpack-e3f77df212a70fcb.js +1 -0
  185. package/apps/pwa/out/_next/static/css/700f225938e9488f.css +1 -0
  186. package/apps/pwa/out/_next/static/fMFwB4C7VwMRiuFGZdGVs/_buildManifest.js +1 -0
  187. package/apps/pwa/out/approvals/index.html +1 -1
  188. package/apps/pwa/out/approvals/index.txt +23 -23
  189. package/apps/pwa/out/autopilot/index.html +1 -1
  190. package/apps/pwa/out/autopilot/index.txt +23 -23
  191. package/apps/pwa/out/board/index.html +1 -1
  192. package/apps/pwa/out/board/index.txt +23 -23
  193. package/apps/pwa/out/botlab/index.html +1 -1
  194. package/apps/pwa/out/botlab/index.txt +22 -22
  195. package/apps/pwa/out/bots/index.html +1 -1
  196. package/apps/pwa/out/bots/index.txt +22 -22
  197. package/apps/pwa/out/ceo/index.html +1 -1
  198. package/apps/pwa/out/ceo/index.txt +23 -23
  199. package/apps/pwa/out/chat/index.html +1 -1
  200. package/apps/pwa/out/chat/index.txt +22 -22
  201. package/apps/pwa/out/consult/index.html +1 -1
  202. package/apps/pwa/out/consult/index.txt +23 -23
  203. package/apps/pwa/out/control/index.html +1 -1
  204. package/apps/pwa/out/control/index.txt +23 -23
  205. package/apps/pwa/out/decisions/index.html +1 -1
  206. package/apps/pwa/out/decisions/index.txt +22 -22
  207. package/apps/pwa/out/design-check/index.html +1 -1
  208. package/apps/pwa/out/design-check/index.txt +23 -23
  209. package/apps/pwa/out/editor/index.html +1 -1
  210. package/apps/pwa/out/editor/index.txt +23 -23
  211. package/apps/pwa/out/exec/index.html +1 -1
  212. package/apps/pwa/out/exec/index.txt +23 -23
  213. package/apps/pwa/out/field/index.html +1 -1
  214. package/apps/pwa/out/field/index.txt +23 -23
  215. package/apps/pwa/out/healthz +1 -1
  216. package/apps/pwa/out/index.html +1 -1
  217. package/apps/pwa/out/index.txt +22 -22
  218. package/apps/pwa/out/inside/index.html +1 -1
  219. package/apps/pwa/out/inside/index.txt +22 -22
  220. package/apps/pwa/out/intake/index.html +1 -1
  221. package/apps/pwa/out/intake/index.txt +23 -23
  222. package/apps/pwa/out/live/index.html +1 -1
  223. package/apps/pwa/out/live/index.txt +23 -23
  224. package/apps/pwa/out/live-run/index.html +1 -1
  225. package/apps/pwa/out/live-run/index.txt +23 -23
  226. package/apps/pwa/out/loops/index.html +1 -1
  227. package/apps/pwa/out/loops/index.txt +22 -22
  228. package/apps/pwa/out/market/index.html +1 -1
  229. package/apps/pwa/out/market/index.txt +22 -22
  230. package/apps/pwa/out/missions/placeholder/index.html +1 -1
  231. package/apps/pwa/out/missions/placeholder/index.txt +22 -22
  232. package/apps/pwa/out/morning/index.html +1 -1
  233. package/apps/pwa/out/morning/index.txt +23 -23
  234. package/apps/pwa/out/observatory/index.html +1 -1
  235. package/apps/pwa/out/observatory/index.txt +23 -23
  236. package/apps/pwa/out/ops/checklist/index.html +1 -1
  237. package/apps/pwa/out/ops/checklist/index.txt +22 -22
  238. package/apps/pwa/out/ops/release/index.html +1 -1
  239. package/apps/pwa/out/ops/release/index.txt +22 -22
  240. package/apps/pwa/out/ops/resources/index.html +1 -0
  241. package/apps/pwa/out/ops/resources/index.txt +30 -0
  242. package/apps/pwa/out/ops/seats/index.html +1 -1
  243. package/apps/pwa/out/ops/seats/index.txt +22 -22
  244. package/apps/pwa/out/outputs/index.html +1 -1
  245. package/apps/pwa/out/outputs/index.txt +22 -22
  246. package/apps/pwa/out/reflection/index.html +1 -1
  247. package/apps/pwa/out/reflection/index.txt +23 -23
  248. package/apps/pwa/out/scheduler/index.html +1 -1
  249. package/apps/pwa/out/scheduler/index.txt +23 -23
  250. package/apps/pwa/out/sessions/index.html +1 -1
  251. package/apps/pwa/out/sessions/index.txt +22 -22
  252. package/apps/pwa/out/settings/devices/index.html +1 -1
  253. package/apps/pwa/out/settings/devices/index.txt +23 -23
  254. package/apps/pwa/out/settings/index.html +1 -1
  255. package/apps/pwa/out/settings/index.txt +23 -23
  256. package/apps/pwa/out/setup/done/index.html +1 -1
  257. package/apps/pwa/out/setup/done/index.txt +23 -23
  258. package/apps/pwa/out/setup/index.html +1 -1
  259. package/apps/pwa/out/setup/index.txt +23 -23
  260. package/apps/pwa/out/share/index.html +1 -1
  261. package/apps/pwa/out/share/index.txt +23 -23
  262. package/apps/pwa/out/showroom/index.html +1 -1
  263. package/apps/pwa/out/showroom/index.txt +22 -22
  264. package/apps/pwa/out/tasks/index.html +1 -1
  265. package/apps/pwa/out/tasks/index.txt +23 -23
  266. package/apps/pwa/out/term/index.html +1 -1
  267. package/apps/pwa/out/term/index.txt +23 -23
  268. package/apps/pwa/out/today/index.html +1 -1
  269. package/apps/pwa/out/today/index.txt +23 -23
  270. package/apps/pwa/out/trace/index.html +1 -1
  271. package/apps/pwa/out/trace/index.txt +23 -23
  272. package/apps/pwa/out/vault/index.html +1 -1
  273. package/apps/pwa/out/vault/index.txt +23 -23
  274. package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
  275. package/apps/pwa/out/workflows/chat-ui/index.txt +23 -23
  276. package/apps/pwa/out/workflows/index.html +1 -1
  277. package/apps/pwa/out/workflows/index.txt +23 -23
  278. package/apps/pwa/out/workspace/index.html +1 -1
  279. package/apps/pwa/out/workspace/index.txt +23 -23
  280. package/apps/pwa/out/worktrees/index.html +1 -1
  281. package/apps/pwa/out/worktrees/index.txt +23 -23
  282. package/docs/goal-context/01-goal-authoring-checks.md +1 -0
  283. package/graphs/overlays/README.md +6 -0
  284. package/graphs/release/release-loop.yaml +33 -17
  285. package/graphs/steward/README.md +9 -0
  286. package/graphs/steward/entrance-dispatch-shadow.yaml +23 -0
  287. package/graphs/steward/recipes.yaml +3 -0
  288. package/graphs/units/verbs/make-doc.yaml +1 -0
  289. package/graphs/video/README.md +38 -0
  290. package/graphs/video/explainer-line.yaml +20 -7
  291. package/package.json +2 -1
  292. package/scripts/bench-metering-plan.ts +229 -0
  293. package/scripts/demo/demo1104-parallel-host.ts +56 -0
  294. package/scripts/demo/demo1104-parallel.ts +72 -0
  295. package/scripts/generate-ux-sim-device-manual.ts +21 -0
  296. package/scripts/intake-news.ts +10 -4
  297. package/scripts/intake-social.ts +10 -4
  298. package/scripts/lib/intake-check-cli.ts +15 -0
  299. package/scripts/measure-git-checkout-accel.ts +232 -0
  300. package/scripts/public-leak-baseline.txt +0 -1
  301. package/scripts/release-loop/docs-node.ts +4 -2
  302. package/scripts/release-loop/gate-baseline-receipt.ts +34 -3
  303. package/scripts/release-loop/gate-image-pin.ts +116 -2
  304. package/scripts/release-loop/gate-node-sim.ts +5 -1
  305. package/scripts/release-loop/gate-node.ts +633 -84
  306. package/scripts/release-loop/gate-progress-sim.ts +73 -0
  307. package/scripts/release-loop/gate-radius-live.ts +5 -4
  308. package/scripts/release-loop/gate-shard-dispatch.ts +99 -10
  309. package/scripts/release-loop/gate-shard-receipts.ts +81 -5
  310. package/scripts/release-loop/known-issues-node.ts +7 -2
  311. package/scripts/release-loop/node-verdict.ts +3 -1
  312. package/scripts/release-loop/notes-repair.ts +18 -1
  313. package/scripts/release-loop/preflight.ts +188 -8
  314. package/scripts/release-loop/render-warm-control-manifest.ts +22 -0
  315. package/scripts/release-loop/resume-release.ts +45 -12
  316. package/scripts/release-loop/resume.ts +93 -16
  317. package/scripts/release-loop/warm-control-forward.ts +178 -0
  318. package/scripts/retro-cycle.ts +30 -8
  319. package/scripts/rhythm/daily.ts +4 -1
  320. package/scripts/rhythm/linear-progress-sync.ts +28 -15
  321. package/scripts/sim-world-runner.ts +29 -0
  322. package/scripts/test-diet/node.ts +1 -1
  323. package/scripts/test-pod40-control-inbox-isolation.ts +39 -0
  324. package/scripts/ux-sim.ts +18 -1
  325. package/scripts/video-pipeline.ts +6 -1
  326. package/scripts/warm-pool-provider-config.ts +6 -1
  327. package/skills/explainer-video/engine/build.mjs +39 -2
  328. package/src/acp/core-turn-bridge.ts +30 -0
  329. package/src/agent/identity-env.ts +1 -0
  330. package/src/agent-mission/driver.ts +8 -5
  331. package/src/agent-mission/grok-auth-status.ts +119 -22
  332. package/src/agent-mission/mission-out.ts +2 -2
  333. package/src/agent-mission/resource-ladder.ts +11 -4
  334. package/src/agent-substrate/pr-reviewer.ts +211 -18
  335. package/src/agent-substrate/self-review-cli.ts +112 -39
  336. package/src/auto-research/question-ladder-contract.ts +2 -0
  337. package/src/auto-research/research-fanout.ts +221 -0
  338. package/src/auto-research/research-turn.ts +568 -47
  339. package/src/autopilot/mission-codebase-gate.ts +7 -3
  340. package/src/cli/config-test-sync.ts +6 -1
  341. package/src/cli/control-cli.ts +17 -6
  342. package/src/cli/decision-list-format.ts +9 -0
  343. package/src/cli/decision-list-since.ts +13 -0
  344. package/src/cli/decisions-cli.ts +84 -24
  345. package/src/cli/decisions-list-cli.ts +32 -0
  346. package/src/cli/doctor-cli.ts +2 -2
  347. package/src/cli/friendly-errors.ts +4 -0
  348. package/src/cli/intake-cli.ts +10 -5
  349. package/src/cli/light-entry-route.ts +25 -3
  350. package/src/cli/log-event-names.ts +8 -0
  351. package/src/cli/msg-cli.ts +5 -28
  352. package/src/cli/msg-list-cli.ts +73 -0
  353. package/src/cli/pr-cli.ts +42 -58
  354. package/src/cli/pr-land-options.ts +34 -0
  355. package/src/cli/provider-cli.ts +54 -0
  356. package/src/cli/pty-drive-cli.ts +25 -1
  357. package/src/cli/pty-takeover-cli.ts +9 -6
  358. package/src/cli/release-checklist-landed-cli.ts +273 -0
  359. package/src/cli/release-checklist-set-cli.ts +137 -0
  360. package/src/cli/release-checklist-write.ts +34 -0
  361. package/src/cli/release-cli.ts +8 -4
  362. package/src/cli/remote-eln-pty.ts +287 -0
  363. package/src/cli/resource-ledger-cli.ts +248 -0
  364. package/src/cli/runs-tree-cli.ts +256 -0
  365. package/src/cli/setup-cli.ts +42 -0
  366. package/src/cli/setup-keys.ts +100 -16
  367. package/src/cli/sim-cli.ts +89 -0
  368. package/src/cli/tasks-advance-cli.ts +185 -0
  369. package/src/cli/tasks-cli.ts +59 -92
  370. package/src/cli/tasks-read-cli.ts +32 -21
  371. package/src/cli/tui-test-cli.ts +159 -23
  372. package/src/compact/pipeline.ts +6 -1
  373. package/src/context-bus/nightly-condense.ts +8 -7
  374. package/src/control-plane/ledger.ts +42 -4
  375. package/src/control-plane/member-tokens.ts +25 -2
  376. package/src/control-plane/ports.ts +8 -3
  377. package/src/control-plane/server.ts +26 -5
  378. package/src/core-turn/research-policy.ts +7 -1
  379. package/src/core-turn/run-core-turn.ts +201 -48
  380. package/src/core-turn/types.ts +2 -0
  381. package/src/dashboard/acp-boot.ts +66 -10
  382. package/src/dashboard/classic-sidetab-mission-job.ts +129 -24
  383. package/src/dashboard/classic-sidetab-mission-pair.ts +3 -2
  384. package/src/dashboard/classic-sidetab-mission-trio.ts +125 -29
  385. package/src/dashboard/classic-sidetab-mission.ts +36 -17
  386. package/src/dashboard/index.ts +45 -35
  387. package/src/dashboard/sidetab-runtime.ts +2 -0
  388. package/src/dashboard/visible-mission-diagnostics.ts +14 -0
  389. package/src/decisions/decision-cards.ts +6 -1
  390. package/src/decisions/decision-ledger.ts +5 -0
  391. package/src/domains/retro-cycle-observation.ts +43 -0
  392. package/src/domains/retro-cycle.ts +13 -2
  393. package/src/domains/retro-proposals.ts +92 -0
  394. package/src/domains/retro-report.ts +6 -1
  395. package/src/error-report/report.ts +139 -4
  396. package/src/execution-loop/launch-gate.ts +115 -18
  397. package/src/fleet/host-doctor.ts +20 -20
  398. package/src/graph-runner/graph-cli.ts +27 -3
  399. package/src/graph-runner/graph-grow-llm.ts +3 -1
  400. package/src/graph-runner/runner.ts +241 -32
  401. package/src/grid/ssh-broker.ts +436 -0
  402. package/src/harness/browser-act.ts +11 -4
  403. package/src/harness/dispatch-backpressure.ts +111 -29
  404. package/src/harness/harness-cli-command.ts +40 -5
  405. package/src/harness/harness-pod-dispatch.ts +40 -1
  406. package/src/index.ts +156 -11
  407. package/src/light-cli.ts +52 -5
  408. package/src/llm/child-first-llm-observation.ts +112 -0
  409. package/src/llm/provider-credentials.ts +60 -4
  410. package/src/llm/provider-failure-evidence.ts +44 -0
  411. package/src/llm.ts +306 -32
  412. package/src/loops/orchestrator/tick.ts +29 -9
  413. package/src/maturity/feature-maturity.ts +2 -1
  414. package/src/mcp/client.ts +7 -0
  415. package/src/mcp/proxy-runtime.ts +6 -1
  416. package/src/mcp/server.ts +54 -0
  417. package/src/msg/msg-store.ts +5 -2
  418. package/src/native-tool-catalog.ts +15 -2
  419. package/src/nexus/api/consult-requests.ts +18 -6
  420. package/src/nexus/api/discord-trigger-bot.ts +6 -6
  421. package/src/nexus/api/graphs-api.ts +4 -2
  422. package/src/nexus/api/grokbot-trigger-bot.ts +206 -0
  423. package/src/nexus/api/http-server.ts +8 -0
  424. package/src/nexus/api/ops-api.ts +6 -0
  425. package/src/nexus/api/resource-guardian.ts +26 -0
  426. package/src/nexus/api/resource-ledger.ts +36 -0
  427. package/src/nexus/api/rest-route-paths.ts +3 -0
  428. package/src/nexus/api/telegram-trigger-bot.ts +6 -6
  429. package/src/nexus/api/ux-sim-devices.ts +36 -0
  430. package/src/nexus/boot/register-mcp-clients.ts +114 -8
  431. package/src/nexus/index.ts +15 -0
  432. package/src/nexus/outbound/grokbot-adapter.ts +71 -0
  433. package/src/nexus/outbound/router.ts +33 -13
  434. package/src/oauth/codex-owner-mirror.ts +47 -10
  435. package/src/oauth/codex-seat-home.ts +231 -0
  436. package/src/oauth/codex.ts +69 -16
  437. package/src/onboarding/first-run.ts +44 -6
  438. package/src/onboarding/web-first.ts +45 -14
  439. package/src/onboarding.ts +9 -0
  440. package/src/plugins/maker/wizard-generate.ts +13 -1
  441. package/src/preview/terminal.ts +22 -7
  442. package/src/prompt-enhance/enhance.ts +10 -0
  443. package/src/pty-shell/pty-manifest-query-cache.ts +18 -0
  444. package/src/pty-shell/pty-manifest.ts +76 -0
  445. package/src/pty-shell/pty-write-provenance.ts +21 -3
  446. package/src/pty-shell/registry.ts +9 -2
  447. package/src/pty-shell/remote-eln-inventory.ts +88 -0
  448. package/src/release-loop/gate-host-reservation.ts +5 -3
  449. package/src/release-loop/gate-shard-ledger.ts +2 -0
  450. package/src/release-loop/placement.ts +18 -8
  451. package/src/release-loop/proposal-auto-place.ts +83 -0
  452. package/src/release-loop/rehearsal.ts +86 -11
  453. package/src/release-loop/release-note.ts +84 -0
  454. package/src/release-loop/stage-mail.ts +71 -0
  455. package/src/research/axis-fanout.ts +107 -22
  456. package/src/research/entity-status-table.ts +305 -0
  457. package/src/research/evidence-attribution.ts +48 -0
  458. package/src/research/gap-followup.ts +6 -1
  459. package/src/research/lenses/second-order.ts +312 -0
  460. package/src/resource-ledger/guardian-reconcile.ts +172 -0
  461. package/src/resource-ledger/lease-automation.ts +112 -0
  462. package/src/resource-ledger/lease-heartbeat-worker.ts +169 -0
  463. package/src/resource-ledger/resource-ledger.ts +253 -0
  464. package/src/seat-loop/seat-loop.ts +2 -1
  465. package/src/self-dev/dev-cli.ts +3 -1
  466. package/src/self-dev/dev-pipeline.ts +67 -6
  467. package/src/self-dev/draft-sweep.ts +31 -10
  468. package/src/self-dev/draft-triage-rules.ts +60 -3
  469. package/src/self-dev/orchestrate-parent-dispatch.ts +44 -0
  470. package/src/self-dev/review-provider-fallback.ts +108 -10
  471. package/src/self-dev/run-supervisor.ts +152 -2
  472. package/src/self-implement/goal-author.ts +420 -30
  473. package/src/self-implement/graph-overlay-yaml.ts +151 -0
  474. package/src/self-implement/graph-yaml.ts +68 -2
  475. package/src/self-implement/orchestrator.ts +234 -59
  476. package/src/self-implement/pod-warm-pool-profile.ts +3 -0
  477. package/src/self-implement/seams.ts +42 -1
  478. package/src/self-implement/test-scenario-request.ts +37 -6
  479. package/src/session/chat.ts +2 -2
  480. package/src/session/index.ts +34 -0
  481. package/src/session/request-size-guard.ts +7 -7
  482. package/src/session-runtime/index.ts +37 -5
  483. package/src/session-runtime/search-processor.ts +5 -2
  484. package/src/sidetab-core/model.ts +213 -15
  485. package/src/sidetab-core/visible-agent-mission-pair.ts +51 -0
  486. package/src/sidetab-core/visible-agent-mission.ts +207 -60
  487. package/src/skills/tools/omni-search.ts +4 -2
  488. package/src/skills/tools/shell.ts +7 -4
  489. package/src/steward/entrance-dispatch-shadow-adapter-child.ts +26 -0
  490. package/src/steward/entrance-dispatch-shadow-adapter.ts +196 -0
  491. package/src/steward/entrance-dispatch-shadow.ts +318 -0
  492. package/src/storage/short-lived-read-cache.ts +119 -0
  493. package/src/task-agent/card-evidence.ts +2 -1
  494. package/src/task-agent/entrance-shadow.ts +178 -0
  495. package/src/task-agent/mission.ts +9 -19
  496. package/src/task-agent/parent-host.ts +93 -5
  497. package/src/task-agent/recall-inject.ts +98 -0
  498. package/src/task-agent/repair-cycle.ts +75 -1
  499. package/src/task-agent/task-card-state.ts +161 -0
  500. package/src/task-agent/task-hand.ts +66 -147
  501. package/src/task-agent/work-order-build.ts +22 -1
  502. package/src/task-orchestrator/surfaces/gate-pod-pool-policy.ts +161 -0
  503. package/src/task-orchestrator/surfaces/pod-artifact-return.ts +19 -1
  504. package/src/task-orchestrator/surfaces/pod-failure-reason.ts +15 -0
  505. package/src/task-orchestrator/surfaces/pod-si-warm-host.ts +21 -9
  506. package/src/task-orchestrator/surfaces/pod-warm-worker-pod.ts +1 -1
  507. package/src/task-orchestrator/surfaces/pod-warm-worker-provider.ts +490 -100
  508. package/src/task-orchestrator/surfaces/pod-warm-worker-runtime.ts +45 -3
  509. package/src/task-orchestrator/surfaces/self-implement-pod.ts +38 -8
  510. package/src/task-orchestrator/surfaces/warm-reuse-evidence.ts +61 -0
  511. package/src/tool-hints/gate.ts +45 -14
  512. package/src/tool-hints/signals.ts +1 -1
  513. package/src/tool-hints/types.ts +2 -0
  514. package/src/tool-runtime/browser-hand-runtime.ts +51 -11
  515. package/src/tool-runtime/browser-runtime.ts +31 -18
  516. package/src/tool-runtime/elanous-control-runtimes.ts +5 -2
  517. package/src/tool-runtime/elanous-linear-secretary-runtime.ts +152 -36
  518. package/src/tool-runtime/elanous-ux-sim-devices-runtime.ts +43 -0
  519. package/src/tool-runtime/index.ts +2 -0
  520. package/src/tool-runtime/types.ts +2 -0
  521. package/src/tui/entry.ts +55 -8
  522. package/src/tui/sidetab/attach.ts +324 -34
  523. package/src/tui/sidetab/list.ts +3 -2
  524. package/src/tui/sidetab/remote.ts +89 -0
  525. package/src/tui-client/dashboard-session.ts +2 -0
  526. package/src/tui-client/next-dashboard-runtime.ts +52 -0
  527. package/src/user-config.ts +3 -1
  528. package/src/ux-sim/author-reviewer-precheck-device.ts +78 -0
  529. package/src/ux-sim/codex-wire-capture.ts +26 -0
  530. package/src/ux-sim/draft-inventory-builder.ts +2 -1
  531. package/src/ux-sim/event-monkey.ts +20 -2
  532. package/src/ux-sim/fake-bin.ts +72 -1
  533. package/src/ux-sim/fake-cloud-vm.ts +227 -0
  534. package/src/ux-sim/fake-fleet.ts +123 -0
  535. package/src/ux-sim/fake-kubectl.ts +21 -6
  536. package/src/ux-sim/fake-llm.ts +14 -1
  537. package/src/ux-sim/fake-ssh.ts +125 -0
  538. package/src/ux-sim/fake-telegram-video.ts +54 -0
  539. package/src/ux-sim/fixtures/git-worktree-accel-linux.json +239 -0
  540. package/src/ux-sim/gate-shard-host-reroute.ts +7 -3
  541. package/src/ux-sim/graph-runtime-overlay-event-path-worker.ts +54 -0
  542. package/src/ux-sim/graph-runtime-overlay-event-path.ts +80 -0
  543. package/src/ux-sim/grid-chaos-driver.ts +198 -0
  544. package/src/ux-sim/grid-ledger.ts +259 -0
  545. package/src/ux-sim/grid-ready-tiers.ts +253 -0
  546. package/src/ux-sim/heal-reauthor-materialized.ts +115 -0
  547. package/src/ux-sim/linear-secretary.ts +4 -12
  548. package/src/ux-sim/mock-scenario-catalog.json +63 -32
  549. package/src/ux-sim/mock-scenario-catalog.ts +112 -7
  550. package/src/ux-sim/release-sim-rig.ts +63 -18
  551. package/src/ux-sim/research-decision-chain.ts +220 -0
  552. package/src/ux-sim/safe-public-copy-publish.ts +89 -0
  553. package/src/ux-sim/scenario.ts +107 -14
  554. package/src/ux-sim/seminar-rehearsal.ts +108 -0
  555. package/src/ux-sim/service-key-setup.ts +63 -0
  556. package/src/ux-sim/warm-pool-reuse-sim.ts +183 -0
  557. package/src/ux-sim/world-schema.ts +216 -0
  558. package/src/ux-sim/world-store.ts +328 -0
  559. package/src/ux-sim/world.ts +524 -0
  560. package/src/version/packed-revision.json +1 -1
  561. package/src/video-pipeline/recipes/explainer.ts +237 -10
  562. package/src/video-pipeline/telegram-video-sender.ts +47 -0
  563. package/apps/pwa/out/_next/static/Om5xS9jpjSXJCeTNGYEi4/_buildManifest.js +0 -1
  564. package/apps/pwa/out/_next/static/chunks/1151-5c2bb8f002ca2dd6.js +0 -1
  565. package/apps/pwa/out/_next/static/chunks/1200.6a37c202f9f17e9a.js +0 -226
  566. package/apps/pwa/out/_next/static/chunks/1261-a616d5728e02e624.js +0 -1
  567. package/apps/pwa/out/_next/static/chunks/1313-19f737e0222c4444.js +0 -1
  568. package/apps/pwa/out/_next/static/chunks/1357.3bbef3976c37f94a.js +0 -1
  569. package/apps/pwa/out/_next/static/chunks/1362-20adddfaf662b0fa.js +0 -1
  570. package/apps/pwa/out/_next/static/chunks/1737-9491fc6ab29b9ec6.js +0 -1
  571. package/apps/pwa/out/_next/static/chunks/1803-4f91a8e7dcaf042c.js +0 -1
  572. package/apps/pwa/out/_next/static/chunks/1961.a81b12872c3e93a9.js +0 -23
  573. package/apps/pwa/out/_next/static/chunks/1970cf59.2d4d8ce5d6c81853.js +0 -1
  574. package/apps/pwa/out/_next/static/chunks/1971-8890f3962ba7ee0a.js +0 -1
  575. package/apps/pwa/out/_next/static/chunks/2268-53861f339e0b65a2.js +0 -1
  576. package/apps/pwa/out/_next/static/chunks/2312.0c8b61e22d3136d7.js +0 -1
  577. package/apps/pwa/out/_next/static/chunks/273.f156eee28f11af77.js +0 -1
  578. package/apps/pwa/out/_next/static/chunks/2873.d2140e5a82546401.js +0 -1
  579. package/apps/pwa/out/_next/static/chunks/3095.dc44586a5f83b86d.js +0 -1
  580. package/apps/pwa/out/_next/static/chunks/3228-9650b6447b6fa288.js +0 -1
  581. package/apps/pwa/out/_next/static/chunks/360.ae9f9f4c33c395e8.js +0 -79
  582. package/apps/pwa/out/_next/static/chunks/3638.80412ea63aae8f3f.js +0 -286
  583. package/apps/pwa/out/_next/static/chunks/363bfab3.9623b9f89363541f.js +0 -1
  584. package/apps/pwa/out/_next/static/chunks/3744.54f87db52acfd1ab.js +0 -1
  585. package/apps/pwa/out/_next/static/chunks/3935.16701e33f8982dc9.js +0 -1
  586. package/apps/pwa/out/_next/static/chunks/3955.6922286237f2ac2b.js +0 -24
  587. package/apps/pwa/out/_next/static/chunks/3969.272ee7f9fd6c62e5.js +0 -34
  588. package/apps/pwa/out/_next/static/chunks/4199.ce86b281fd0a60b7.js +0 -1
  589. package/apps/pwa/out/_next/static/chunks/4311-6dd3144002cc0c2d.js +0 -1
  590. package/apps/pwa/out/_next/static/chunks/4426-2b230fad00c88930.js +0 -1
  591. package/apps/pwa/out/_next/static/chunks/4445.7990c76b3751a918.js +0 -115
  592. package/apps/pwa/out/_next/static/chunks/4447-14c5161fa59166c7.js +0 -1
  593. package/apps/pwa/out/_next/static/chunks/4856-b0b8075bba8c53f4.js +0 -1
  594. package/apps/pwa/out/_next/static/chunks/4870-de370d65e73c0bb5.js +0 -1
  595. package/apps/pwa/out/_next/static/chunks/4885-2c989165c4b29fad.js +0 -1
  596. package/apps/pwa/out/_next/static/chunks/4894.fec2ca9e99caefa2.js +0 -1
  597. package/apps/pwa/out/_next/static/chunks/5093.8f04b7f8cb899a95.js +0 -94
  598. package/apps/pwa/out/_next/static/chunks/5122-2bb177cebf89e19a.js +0 -1
  599. package/apps/pwa/out/_next/static/chunks/529.64ff7257180b2ac9.js +0 -1
  600. package/apps/pwa/out/_next/static/chunks/5461.08bf2404ff38ec85.js +0 -1
  601. package/apps/pwa/out/_next/static/chunks/5474-22e08a85583209b2.js +0 -1
  602. package/apps/pwa/out/_next/static/chunks/5567-265df39ed8fe9dcb.js +0 -1
  603. package/apps/pwa/out/_next/static/chunks/5570-a94ae19811cb2046.js +0 -1
  604. package/apps/pwa/out/_next/static/chunks/5574-b47c9ef2dceff1fd.js +0 -1
  605. package/apps/pwa/out/_next/static/chunks/5730.43d7ccc09988e646.js +0 -1
  606. package/apps/pwa/out/_next/static/chunks/6001.ec4049ceb3c43418.js +0 -27
  607. package/apps/pwa/out/_next/static/chunks/6120-471f03db1e299c0c.js +0 -1
  608. package/apps/pwa/out/_next/static/chunks/6175-41479e643aca1878.js +0 -1
  609. package/apps/pwa/out/_next/static/chunks/6291.a2de4f9787637075.js +0 -104
  610. package/apps/pwa/out/_next/static/chunks/6400-6699907c3537436a.js +0 -1
  611. package/apps/pwa/out/_next/static/chunks/6428.1f4327d6ae5fdf9a.js +0 -287
  612. package/apps/pwa/out/_next/static/chunks/644.02cb026fa44bcd0a.js +0 -1
  613. package/apps/pwa/out/_next/static/chunks/6466-6c87d60d3dd174fb.js +0 -1
  614. package/apps/pwa/out/_next/static/chunks/6773.d4264665ab31bec0.js +0 -1
  615. package/apps/pwa/out/_next/static/chunks/6822.3c789f1a8443e774.js +0 -1
  616. package/apps/pwa/out/_next/static/chunks/7261-8ff69d3b2ee671fd.js +0 -1
  617. package/apps/pwa/out/_next/static/chunks/7266.084c6bbc70035140.js +0 -1
  618. package/apps/pwa/out/_next/static/chunks/7271.5c0100e7320aa856.js +0 -1
  619. package/apps/pwa/out/_next/static/chunks/7429-bf5731358c8f2f68.js +0 -1
  620. package/apps/pwa/out/_next/static/chunks/7464.01f7a0ae1215fbe7.js +0 -1
  621. package/apps/pwa/out/_next/static/chunks/7479.0fcad5f37eb64f0c.js +0 -1
  622. package/apps/pwa/out/_next/static/chunks/7483.427a2fe2049e388d.js +0 -148
  623. package/apps/pwa/out/_next/static/chunks/7502-be74718178e13e56.js +0 -1
  624. package/apps/pwa/out/_next/static/chunks/7530.0889722b19572065.js +0 -24
  625. package/apps/pwa/out/_next/static/chunks/7645.5b2ee3ad45c55ea3.js +0 -1
  626. package/apps/pwa/out/_next/static/chunks/7788.7d1c79f1a8e18946.js +0 -1
  627. package/apps/pwa/out/_next/static/chunks/7910-6f139bcafd238b9f.js +0 -1
  628. package/apps/pwa/out/_next/static/chunks/7966.f71c8958d1637548.js +0 -1
  629. package/apps/pwa/out/_next/static/chunks/8073.f6cf2f2c71aafbd0.js +0 -1
  630. package/apps/pwa/out/_next/static/chunks/8201.190b94088980f430.js +0 -74
  631. package/apps/pwa/out/_next/static/chunks/8205.282ca4bb62d54a0a.js +0 -62
  632. package/apps/pwa/out/_next/static/chunks/8313-dfa1021bb58a46d6.js +0 -1
  633. package/apps/pwa/out/_next/static/chunks/837-81336ebaca8198a8.js +0 -1
  634. package/apps/pwa/out/_next/static/chunks/8447.7963352ef5f71b76.js +0 -1
  635. package/apps/pwa/out/_next/static/chunks/8574-868e8129525ef6d9.js +0 -1
  636. package/apps/pwa/out/_next/static/chunks/8588.d1c6a2903727ce87.js +0 -149
  637. package/apps/pwa/out/_next/static/chunks/8637.90f92d5c8db4732c.js +0 -1
  638. package/apps/pwa/out/_next/static/chunks/868.6e953be05bcf6dca.js +0 -41
  639. package/apps/pwa/out/_next/static/chunks/8706-e1fe0309343a2273.js +0 -1
  640. package/apps/pwa/out/_next/static/chunks/8749-06384cdfc4520add.js +0 -1
  641. package/apps/pwa/out/_next/static/chunks/8997-3c564dbb3b58b055.js +0 -1
  642. package/apps/pwa/out/_next/static/chunks/923.2034d10ae91e9c20.js +0 -1
  643. package/apps/pwa/out/_next/static/chunks/9312.bc1b89c5d4368033.js +0 -1
  644. package/apps/pwa/out/_next/static/chunks/943.39ae5e82f4f1893f.js +0 -1
  645. package/apps/pwa/out/_next/static/chunks/9469.0500480de55fb205.js +0 -32
  646. package/apps/pwa/out/_next/static/chunks/9770.5f75bc6088b16109.js +0 -1
  647. package/apps/pwa/out/_next/static/chunks/9870.8419702475254745.js +0 -8
  648. package/apps/pwa/out/_next/static/chunks/9941-376d1b74d51b01a4.js +0 -1
  649. package/apps/pwa/out/_next/static/chunks/9958.385434ab04241758.js +0 -1
  650. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-deea1450b17cb8dc.js +0 -1
  651. package/apps/pwa/out/_next/static/chunks/app/approvals/page-70985b904f8650ef.js +0 -1
  652. package/apps/pwa/out/_next/static/chunks/app/autopilot/page-a2e15e33e56a4353.js +0 -1
  653. package/apps/pwa/out/_next/static/chunks/app/board/page-fc72ce2db12d6ca9.js +0 -1
  654. package/apps/pwa/out/_next/static/chunks/app/botlab/page-be03e41f9436ebd9.js +0 -1
  655. package/apps/pwa/out/_next/static/chunks/app/bots/page-35a35999382da3f2.js +0 -1
  656. package/apps/pwa/out/_next/static/chunks/app/ceo/page-3ff5b1e6ca88b848.js +0 -1
  657. package/apps/pwa/out/_next/static/chunks/app/chat/page-a65101300a0ee5c1.js +0 -1
  658. package/apps/pwa/out/_next/static/chunks/app/consult/page-3aca5b6d67dba511.js +0 -1
  659. package/apps/pwa/out/_next/static/chunks/app/control/page-45b8ab0a71e61314.js +0 -1
  660. package/apps/pwa/out/_next/static/chunks/app/decisions/page-53046e282d4cda8e.js +0 -1
  661. package/apps/pwa/out/_next/static/chunks/app/design-check/page-17809e60e8354c17.js +0 -1
  662. package/apps/pwa/out/_next/static/chunks/app/editor/page-fd2442d347bf5898.js +0 -1
  663. package/apps/pwa/out/_next/static/chunks/app/exec/page-e9d720d6fc082e21.js +0 -1
  664. package/apps/pwa/out/_next/static/chunks/app/healthz/route-deea1450b17cb8dc.js +0 -1
  665. package/apps/pwa/out/_next/static/chunks/app/inside/page-8bcf6233ac7c17af.js +0 -1
  666. package/apps/pwa/out/_next/static/chunks/app/intake/page-7cc25591cfc2126f.js +0 -1
  667. package/apps/pwa/out/_next/static/chunks/app/layout-053e871f35c9beba.js +0 -1
  668. package/apps/pwa/out/_next/static/chunks/app/live-run/page-4d7e9d8db5274a87.js +0 -1
  669. package/apps/pwa/out/_next/static/chunks/app/loops/page-2b2d8f5aa5f69ad4.js +0 -1
  670. package/apps/pwa/out/_next/static/chunks/app/market/page-0b8f92c5062e68b1.js +0 -1
  671. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-1bd9d0fdac2ced3d.js +0 -1
  672. package/apps/pwa/out/_next/static/chunks/app/not-found-44b7a1ff468c6648.js +0 -1
  673. package/apps/pwa/out/_next/static/chunks/app/observatory/page-cbc6523711dc1b65.js +0 -1
  674. package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-fdad47899c2695be.js +0 -1
  675. package/apps/pwa/out/_next/static/chunks/app/ops/release/page-79a8b5fee4c20871.js +0 -1
  676. package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-03e8ac9606aeaffb.js +0 -1
  677. package/apps/pwa/out/_next/static/chunks/app/outputs/page-4cd55c55ec287e2f.js +0 -1
  678. package/apps/pwa/out/_next/static/chunks/app/page-db17b4305404161e.js +0 -1
  679. package/apps/pwa/out/_next/static/chunks/app/reflection/page-30041d848350fd02.js +0 -1
  680. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-c540da022dbf86b0.js +0 -1
  681. package/apps/pwa/out/_next/static/chunks/app/sessions/page-9399efc538da057f.js +0 -1
  682. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-ca2d09128c585ca4.js +0 -1
  683. package/apps/pwa/out/_next/static/chunks/app/settings/page-0e2635aecd343038.js +0 -1
  684. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-ef7f4399b6b7726e.js +0 -1
  685. package/apps/pwa/out/_next/static/chunks/app/setup/layout-deea1450b17cb8dc.js +0 -1
  686. package/apps/pwa/out/_next/static/chunks/app/setup/page-caf530535b875468.js +0 -1
  687. package/apps/pwa/out/_next/static/chunks/app/share/page-eaa20c1543a5fd8e.js +0 -1
  688. package/apps/pwa/out/_next/static/chunks/app/showroom/page-c541eb1b75120f61.js +0 -1
  689. package/apps/pwa/out/_next/static/chunks/app/tasks/page-ab5e213eda9479f4.js +0 -1
  690. package/apps/pwa/out/_next/static/chunks/app/term/page-0a815f34367b6db6.js +0 -1
  691. package/apps/pwa/out/_next/static/chunks/app/today/page-e858ba0ed9393b68.js +0 -1
  692. package/apps/pwa/out/_next/static/chunks/app/trace/page-1638ee9dd6e0582f.js +0 -1
  693. package/apps/pwa/out/_next/static/chunks/app/vault/page-4cf5a399109391f2.js +0 -1
  694. package/apps/pwa/out/_next/static/chunks/app/workflows/page-cb72bfd21006781a.js +0 -1
  695. package/apps/pwa/out/_next/static/chunks/app/workspace/page-6135d0242afbc434.js +0 -1
  696. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-a1dccf907eddb856.js +0 -1
  697. package/apps/pwa/out/_next/static/chunks/ea514caa.05a24f78d9dffe5f.js +0 -122
  698. package/apps/pwa/out/_next/static/chunks/fb7d20d5-6892502b6ee39ca6.js +0 -1
  699. package/apps/pwa/out/_next/static/chunks/framework-e8a911e19b1be41f.js +0 -1
  700. package/apps/pwa/out/_next/static/chunks/main-7022f418fabba021.js +0 -1
  701. package/apps/pwa/out/_next/static/chunks/main-app-e5f15df755756a1e.js +0 -1
  702. package/apps/pwa/out/_next/static/chunks/pages/_app-4525f91e36940c9b.js +0 -1
  703. package/apps/pwa/out/_next/static/chunks/pages/_error-140f0e519c085b0f.js +0 -1
  704. package/apps/pwa/out/_next/static/chunks/webpack-8f22ef63dcb865b1.js +0 -1
  705. package/apps/pwa/out/_next/static/css/d1f8bb401740a549.css +0 -1
  706. /package/apps/pwa/out/_next/static/{Om5xS9jpjSXJCeTNGYEi4 → fMFwB4C7VwMRiuFGZdGVs}/_ssgManifest.js +0 -0
@@ -1,7 +1,7 @@
1
1
  /** Fenced warm-Pod lease bridge. The Job remains authoritative. */
2
2
  import { spawn, spawnSync } from 'node:child_process';
3
- import { isAbsolute, join } from 'node:path';
4
- import { constants, closeSync, existsSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
3
+ import { dirname, isAbsolute, join } from 'node:path';
4
+ import { constants, closeSync, existsSync, fsyncSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
5
5
  import { tmpdir, userInfo } from 'node:os';
6
6
  import { dlopen, read, type Pointer } from 'bun:ffi';
7
7
  import { createHash, randomUUID } from 'node:crypto';
@@ -19,6 +19,8 @@ const POD_READY_WAIT_SECONDS = 900;
19
19
  const POD_READY_RECHECK_SECONDS = 300;
20
20
  const POD_READY_RETRY_DELAY_MS = 1_000;
21
21
  const WARM_CONTROL_REQUEST_TIMEOUT_MS = 2_000;
22
+ const WARM_POD_LIST_PAGE_SIZE = 25;
23
+ const WARM_POD_LIST_MAX_PAGES = 20;
22
24
 
23
25
  function throwIfPrepareAborted(signal?: AbortSignal): void {
24
26
  if (!signal?.aborted) return;
@@ -45,12 +47,17 @@ function waitForPrepareRetry(signal?: AbortSignal): Promise<void> {
45
47
  export type WarmReplayInput = Omit<WarmWorkerCommand, 'leaseId' | 'generation' | 'workerId' | 'key'>;
46
48
  export interface WarmReplayResult { command: WarmWorkerCommand | null; transport: WarmPodTransportResult }
47
49
  export interface WarmWorkerCandidate { host: string; tier: WarmPoolTier; spec: WarmPodSpec }
50
+ export interface WarmPodDeleteOptions {
51
+ apiVersion: 'v1'; kind: 'DeleteOptions'; preconditions: { uid: string };
52
+ }
48
53
  /** The OS `flock(fd, operation)` binding the prepare lease waits on. */
49
54
  export type WarmPrepareFlock = (fd: number, operation: number) => number;
50
55
  export interface WarmPodProviderOptions {
51
56
  candidates: readonly WarmWorkerCandidate[];
52
- /** One pinned template per host/tier. Each expands to the measured profile quota. */
57
+ /** One pinned template per host/tier. It creates one candidate unless expansion is opted in. */
53
58
  poolTemplates?: readonly WarmWorkerCandidate[];
59
+ /** Expand each pool template to its measured profile quota. Defaults to false. */
60
+ expandPoolTemplatesToQuota?: boolean;
54
61
  /** This address is resolved by the control-plane join/primary mechanism, never guessed from a Pod context. */
55
62
  controlUrl: string;
56
63
  memberToken: string;
@@ -67,14 +74,24 @@ export interface WarmPodProviderOptions {
67
74
  };
68
75
  /** Private directory for cross-process prepare leases; defaults to a per-user directory under tmpdir(). */
69
76
  prepareLockDirectory?: string;
77
+ /** Private durable slot-generation file. Set by loadWarmPodProvider for production reconciliation. */
78
+ rotationStatePath?: string;
79
+ /** Test-only loopback API endpoint for exercising the production DeleteOptions request. */
80
+ kubectlProxyUrlForTest?: string;
81
+ /** Test-only quota resolver injection; omitted keeps the production measured-host table. */
82
+ quotaResolverForTest?: typeof resolveWarmPoolQuota;
83
+ /** Separate fetch for the Kubernetes API; control-plane calls continue using fetch. */
84
+ kubernetesFetch?: typeof fetch;
70
85
  /** Cancels a prepare waiting for another process to finish the same host/worker slot. */
71
86
  prepareAbortSignal?: AbortSignal;
72
87
  /** Injects the prepare-lease flock binding. Omitted keeps this platform's binding; null/false declares it unsupported. */
73
88
  prepareFlock?: WarmPrepareFlock | null | false;
74
89
  /** Gate file this pool serves, used to bind cold prepare legs to their 1-file gate measurement key. */
75
90
  pairingGateFile?: string;
91
+ /** Test-only correlation for isolated reconcile simulations. */
92
+ observationRunIdForTest?: string;
76
93
  }
77
- type WarmPodProviderRuntimeOverrides = Pick<WarmPodProviderOptions, 'fetch' | 'kubectl' | 'prepareLockDirectory'>;
94
+ type WarmPodProviderRuntimeOverrides = Pick<WarmPodProviderOptions, 'controlUrl' | 'fetch' | 'kubectl' | 'prepareLockDirectory'>;
78
95
  export interface WarmPodProviderLoadOptions {
79
96
  pairingGateFile?: string;
80
97
  runtimeOverrides?: Partial<WarmPodProviderRuntimeOverrides>;
@@ -86,6 +103,19 @@ export interface WarmPoolReconcileResult {
86
103
  ready: number;
87
104
  failed: readonly string[];
88
105
  }
106
+ type WarmPoolFailureDecision = { stage: string; reason: string; stderr?: string };
107
+
108
+ const WARM_POOL_STDERR_LIMIT = 512;
109
+ function safeWarmPoolStderr(stderr: string, secrets: readonly string[]): string {
110
+ let safe = stderr;
111
+ for (const secret of secrets.filter(value => value.length >= 8)) safe = safe.split(secret).join('[REDACTED]');
112
+ safe = safe.replace(/(authorization\s*[:=]\s*bearer\s+)[^\s,;]+/gi, '$1[REDACTED]')
113
+ .replace(/(bearer\s+)[A-Za-z0-9._~+/=-]+/gi, '$1[REDACTED]')
114
+ .replace(/((?:token|password|secret|api[_-]?key|credential)\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi,
115
+ '$1[REDACTED]');
116
+ return safe.length > WARM_POOL_STDERR_LIMIT
117
+ ? `${safe.slice(0, WARM_POOL_STDERR_LIMIT)}…[truncated]` : safe;
118
+ }
89
119
 
90
120
  /** One leg of a read-only warm/cold prepare-time measurement pair, bound to one 1-file gate key. */
91
121
  export interface WarmPreparePairLeg {
@@ -229,7 +259,7 @@ async function withPrepareLease<T>(candidate: WarmWorkerCandidate, directory: st
229
259
  export class WarmPodProvider {
230
260
  private readonly fetcher: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
231
261
  private readonly now: () => number;
232
- private readonly candidates: readonly WarmWorkerCandidate[];
262
+ private readonly candidates: WarmWorkerCandidate[];
233
263
  private readonly profile: WarmPoolProfile;
234
264
  /** This process's own legs, echoed on CLI stdout. Pairing never reads this — see readWarmReuseTimePairs. */
235
265
  private readonly legs: WarmReuseTimeLegRow[] = [];
@@ -243,20 +273,24 @@ export class WarmPodProvider {
243
273
  private readonly standingWorkers = new Map<string, Promise<boolean>>();
244
274
  /** This instance's prepare-lease flock binding; null means the platform cannot lock and every slot fails. */
245
275
  private readonly prepareFlock: WarmPrepareFlock | null;
276
+ private readonly quotaResolver: typeof resolveWarmPoolQuota;
246
277
  constructor(private readonly options: WarmPodProviderOptions) {
247
278
  const url = new URL(options.controlUrl);
248
279
  if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash
249
280
  || url.pathname !== '/' || !token(options.memberToken)) throw new Error('invalid warm control address');
281
+ this.quotaResolver = options.quotaResolverForTest ?? resolveWarmPoolQuota;
250
282
  const profile = resolveWarmPoolProfile(options.profileConfig ?? getUserConfig());
251
283
  this.profile = profile;
252
284
  const templates = options.poolTemplates ?? [];
253
285
  if (new Set(templates.map(candidate => `${candidate.host}/${candidate.tier}`)).size !== templates.length)
254
286
  throw new Error('duplicate warm pool template');
255
287
  const expanded = templates.flatMap(candidate => {
256
- const quota = resolveWarmPoolQuota(profile, candidate.host, candidate.tier);
288
+ const quota = this.quotaResolver(profile, candidate.host, candidate.tier);
257
289
  if (!quota || !candidate.spec.nodeName) throw new Error('unmeasured warm pool template');
258
- return Array.from({ length: quota }, (_, index): WarmWorkerCandidate => ({
259
- host: candidate.host, tier: candidate.tier, spec: {
290
+ const slots = options.expandPoolTemplatesToQuota === true ? quota : 1;
291
+ return Array.from({ length: slots }, (_, index): WarmWorkerCandidate => ({
292
+ host: candidate.host, tier: candidate.tier,
293
+ spec: {
260
294
  ...candidate.spec,
261
295
  name: `warm-${candidate.host}-${candidate.tier}-${index + 1}`,
262
296
  // The template worker ID is a generation token. Rotate it when a slot is quarantined.
@@ -264,9 +298,16 @@ export class WarmPodProvider {
264
298
  },
265
299
  }));
266
300
  });
267
- this.candidates = [...options.candidates, ...expanded];
301
+ this.candidates = [...options.candidates.map(row => ({ ...row, spec: { ...row.spec } })), ...expanded];
302
+ if (options.rotationStatePath) {
303
+ const rotations = this.readRotations(options.rotationStatePath);
304
+ for (const row of this.candidates) {
305
+ const rotated = rotations[`${row.host}/${row.spec.name}`];
306
+ if (rotated) row.spec = { ...row.spec, workerId: rotated };
307
+ }
308
+ }
268
309
  if (this.candidates.some(candidate => !workerId(candidate.spec.workerId)
269
- || !candidate.host.trim() || resolveWarmPoolQuota(profile, candidate.host, candidate.tier) < 1
310
+ || !candidate.host.trim() || this.quotaResolver(profile, candidate.host, candidate.tier) < 1
270
311
  || candidate.spec.memoryLimit !== (candidate.tier === 'lite' ? '2Gi' : '16Gi')
271
312
  || !warmWorkerPodManifest(candidate.spec))) throw new Error('invalid warm candidate');
272
313
  if (new Set(this.candidates.map(candidate => candidate.spec.workerId)).size !== this.candidates.length)
@@ -279,7 +320,7 @@ export class WarmPodProvider {
279
320
  names.add(identity);
280
321
  const slot = `${candidate.host}/${candidate.tier}`;
281
322
  const count = (counts.get(slot) ?? 0) + 1;
282
- if (count > resolveWarmPoolQuota(profile, candidate.host, candidate.tier))
323
+ if (count > this.quotaResolver(profile, candidate.host, candidate.tier))
283
324
  throw new Error('warm candidate quota exceeded');
284
325
  counts.set(slot, count);
285
326
  }
@@ -301,7 +342,8 @@ export class WarmPodProvider {
301
342
  return { status: response.status, value };
302
343
  }
303
344
 
304
- private async controlBounded(path: string, credential: string, body: Record<string, unknown>, timeoutMs: number): Promise<{ status: number; value: any }> {
345
+ private async controlBounded(path: string, credential: string, body: Record<string, unknown> | undefined,
346
+ timeoutMs: number): Promise<{ status: number; value: any }> {
305
347
  let timer: ReturnType<typeof setTimeout> | undefined;
306
348
  try {
307
349
  return await Promise.race([this.control(path, credential, body), new Promise<never>((_, reject) => {
@@ -370,15 +412,20 @@ export class WarmPodProvider {
370
412
  warmReuseTimeLegs(): readonly WarmReuseTimeLegRow[] { return [...this.legs]; }
371
413
 
372
414
  /** Prepare one named slot. A foreign or replaced Pod is never deleted. */
373
- async ensureStandingWorker(candidate: WarmWorkerCandidate): Promise<boolean> {
415
+ async ensureStandingWorker(candidate: WarmWorkerCandidate,
416
+ onFailure?: (decision: WarmPoolFailureDecision) => void): Promise<boolean> {
374
417
  const configured = this.candidates.find(row => row.host === candidate.host
375
418
  && row.spec.workerId === candidate.spec.workerId);
376
419
  if (!configured) return false;
377
420
  const key = `${configured.host}/${configured.spec.workerId}`;
378
421
  const inFlight = this.standingWorkers.get(key);
379
- if (inFlight) return inFlight;
422
+ if (inFlight) {
423
+ const ready = await inFlight;
424
+ if (!ready) onFailure?.({ stage: 'prepare', reason: 'decision-unavailable' });
425
+ return ready;
426
+ }
380
427
  const preparation = withPrepareLease(configured, this.options.prepareLockDirectory,
381
- () => this.prepareStandingWorker(configured, this.options.prepareAbortSignal), this.options.prepareAbortSignal,
428
+ () => this.prepareStandingWorker(configured, this.options.prepareAbortSignal, onFailure), this.options.prepareAbortSignal,
382
429
  this.prepareFlock)
383
430
  .then(result => result === true);
384
431
  this.standingWorkers.set(key, preparation);
@@ -386,11 +433,32 @@ export class WarmPodProvider {
386
433
  finally { if (this.standingWorkers.get(key) === preparation) this.standingWorkers.delete(key); }
387
434
  }
388
435
 
389
- private async prepareStandingWorker(candidate: WarmWorkerCandidate, signal?: AbortSignal): Promise<boolean> {
436
+ private async prepareStandingWorker(candidate: WarmWorkerCandidate, signal?: AbortSignal,
437
+ onFailure?: (decision: WarmPoolFailureDecision) => void): Promise<boolean> {
390
438
  throwIfPrepareAborted(signal);
391
439
  const startedAt = this.now();
392
440
  const outcome: { preexisting: boolean; podUid: string | null } = { preexisting: false, podUid: null };
393
- const ok = await this.coldPrepare(candidate, outcome, signal);
441
+ let decision: WarmPoolFailureDecision | undefined;
442
+ let ok = await this.coldPrepare(candidate, outcome, signal, value => { decision = value; });
443
+ // Reaping is only relevant when normal, bounded reconciliation has found
444
+ // this exact Pod and its ledger proves that its generation is fenced.
445
+ // Empty slots must take the ordinary cold-create path without a namespace
446
+ // dump or a preflight recovery request.
447
+ if (!ok && decision?.reason === 'quarantined-pod-needs-reap') {
448
+ try {
449
+ if (await this.reapQuarantinedWorker(candidate)) {
450
+ outcome.preexisting = false;
451
+ outcome.podUid = null;
452
+ decision = undefined;
453
+ ok = await this.coldPrepare(candidate, outcome, signal, value => { decision = value; });
454
+ }
455
+ } catch (error) {
456
+ debug.log('pod.warm', 'quarantine-reap-failed', { host: candidate.host,
457
+ workerId: candidate.spec.workerId,
458
+ reason: error instanceof Error ? error.message : String(error) }, { level: 'warn' });
459
+ }
460
+ }
461
+ if (!ok) onFailure?.(decision ?? { stage: 'prepare', reason: 'decision-unavailable' });
394
462
  const totalDurationMs = this.now() - startedAt;
395
463
  const gateFile = this.options.pairingGateFile;
396
464
  // An unset gate file skips the measurement row entirely instead of recording an unpaired one.
@@ -400,8 +468,256 @@ export class WarmPodProvider {
400
468
  return ok;
401
469
  }
402
470
 
471
+ private readRotations(path: string): Record<string, string> {
472
+ if (!existsSync(path)) return {};
473
+ const info = lstatSync(path);
474
+ if (!info.isFile() || info.isSymbolicLink() || (info.mode & 0o077) !== 0)
475
+ throw new Error('unsafe warm rotation state');
476
+ const parsed: unknown = JSON.parse(readFileSync(path, 'utf8'));
477
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)
478
+ || Object.entries(parsed).some(([slot, id]) => !slot.includes('/') || typeof id !== 'string' || !workerId(id)))
479
+ throw new Error('invalid warm rotation state');
480
+ return parsed as Record<string, string>;
481
+ }
482
+
483
+ private writeRotation(slot: string, id: string): void {
484
+ const path = this.options.rotationStatePath;
485
+ if (!path) throw new Error('warm rotation state is not configured');
486
+ if (!this.prepareFlock) throw new Error('warm rotation state lock is unavailable');
487
+ const lockPath = `${path}.lock`;
488
+ const fd = openSync(lockPath, constants.O_CREAT | constants.O_RDWR | (constants.O_NOFOLLOW ?? 0), 0o600);
489
+ try {
490
+ const info = lstatSync(lockPath);
491
+ const uid = typeof process.getuid === 'function' ? process.getuid() : userInfo().uid;
492
+ if (!info.isFile() || info.isSymbolicLink() || info.uid !== uid || (info.mode & 0o077) !== 0
493
+ || this.prepareFlock(fd, LOCK_EX) !== 0) throw new Error('unsafe warm rotation state lock');
494
+ const rotations = this.readRotations(path);
495
+ rotations[slot] = id;
496
+ const temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;
497
+ writeFileSync(temporary, JSON.stringify(rotations), { mode: 0o600, flag: 'wx' });
498
+ const temporaryFd = openSync(temporary, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
499
+ try { fsyncSync(temporaryFd); } finally { closeSync(temporaryFd); }
500
+ try {
501
+ renameSync(temporary, path);
502
+ const directoryFd = openSync(dirname(path), constants.O_RDONLY | (constants.O_DIRECTORY ?? 0));
503
+ try { fsyncSync(directoryFd); } finally { closeSync(directoryFd); }
504
+ }
505
+ catch (error) { rmSync(temporary, { force: true }); throw error; }
506
+ } finally {
507
+ this.prepareFlock(fd, LOCK_UN);
508
+ closeSync(fd);
509
+ }
510
+ }
511
+
512
+ private async deletePodWithUid(spec: WarmPodSpec, uid: string): Promise<boolean> {
513
+ const deleteOptions: WarmPodDeleteOptions = {
514
+ apiVersion: 'v1', kind: 'DeleteOptions', preconditions: { uid },
515
+ };
516
+ const proxyUrl = this.options.kubectlProxyUrlForTest;
517
+ const path = `/api/v1/namespaces/${encodeURIComponent(spec.namespace)}/pods/${encodeURIComponent(spec.name)}`;
518
+ const acceptPath = `^${path.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`;
519
+ // Keep the random-port, loopback proxy alive only for this request and expose only this Pod DELETE path.
520
+ const child = proxyUrl ? null : spawn('kubectl', ['--context', spec.kubectlContext, '-n', spec.namespace,
521
+ 'proxy', '--address=127.0.0.1', '--port=0', `--accept-paths=${acceptPath}`],
522
+ { detached: true, stdio: ['ignore', 'pipe', 'pipe'] });
523
+ let output = '';
524
+ let timer: ReturnType<typeof setTimeout> | undefined;
525
+ let exitPromise: Promise<void> | null = null;
526
+ try {
527
+ let baseUrl = proxyUrl;
528
+ if (!child) {
529
+ if (!baseUrl || !/^http:\/\/127\.0\.0\.1:\d+$/.test(baseUrl)) throw new Error('invalid test Kubernetes API URL');
530
+ } else {
531
+ const port = await new Promise<number>((resolve, reject) => {
532
+ timer = setTimeout(() => reject(new Error('kubectl proxy start timed out')), 10_000);
533
+ const inspect = (chunk: Buffer | string) => {
534
+ output += String(chunk);
535
+ const match = output.match(/127\.0\.0\.1:(\d+)/);
536
+ if (match) { if (timer) clearTimeout(timer); resolve(Number(match[1])); }
537
+ };
538
+ child.stdout.on('data', inspect);
539
+ child.stderr.on('data', inspect);
540
+ child.once('error', reject);
541
+ child.once('exit', (code, signal) => reject(new Error(`kubectl proxy exited (${code ?? signal})`)));
542
+ });
543
+ exitPromise = new Promise(resolve => child.once('exit', () => resolve()));
544
+ baseUrl = `http://127.0.0.1:${port}`;
545
+ }
546
+ const response = await (this.options.kubernetesFetch ?? this.fetcher)(`${baseUrl}${path}`, {
547
+ method: 'DELETE', headers: { 'content-type': 'application/json' },
548
+ body: JSON.stringify(deleteOptions), signal: AbortSignal.timeout(15_000),
549
+ });
550
+ return response.ok;
551
+ } finally {
552
+ if (timer) clearTimeout(timer);
553
+ child?.kill('SIGTERM');
554
+ if (exitPromise) await Promise.race([exitPromise, new Promise(resolve => setTimeout(resolve, 1_000))]);
555
+ }
556
+ }
557
+
558
+ /** Delete only a UID-pinned Pod whose ledger row proves quarantine and has no competing lease. */
559
+ private async reapQuarantinedWorker(candidate: WarmWorkerCandidate): Promise<boolean> {
560
+ const { host, tier, spec } = candidate;
561
+ const credential = this.options.machineTokens?.[host];
562
+ const observeRefusal = (reason: string) => debug.log('pod.warm', 'quarantine-reap-refused', {
563
+ host, workerId: spec.workerId, pod: spec.name, reason,
564
+ }, { level: 'warn' });
565
+ if (!token(credential) || !this.options.rotationStatePath) {
566
+ observeRefusal('rotation-state-or-credential-unavailable');
567
+ return false;
568
+ }
569
+ const kubectl = (args: readonly string[]) => this.options.kubectl
570
+ ? this.options.kubectl(['--context', spec.kubectlContext, '-n', spec.namespace, ...args])
571
+ : spawnSync('kubectl', ['--context', spec.kubectlContext, '-n', spec.namespace, ...args],
572
+ { encoding: 'utf8', timeout: 30_000, maxBuffer: 2 * 1024 * 1024 });
573
+ const parse = (result: { status: number | null; stdout: string }) => {
574
+ if (result.status !== 0) return null;
575
+ try { return JSON.parse(result.stdout) as any; } catch { return null; }
576
+ };
577
+ const readPods = (query: URLSearchParams) => {
578
+ if (this.options.kubectl) {
579
+ const selector = query.get('fieldSelector')
580
+ ? [`--field-selector=${query.get('fieldSelector')}`]
581
+ : ['-l', query.get('labelSelector')!];
582
+ const continuation = query.get('continue');
583
+ return kubectl(['get', 'pods', ...selector, `--limit=${WARM_POD_LIST_PAGE_SIZE}`, '-o', 'json',
584
+ ...(continuation ? [`--continue=${continuation}`] : [])]);
585
+ }
586
+ return kubectl(['get', '--raw', `/api/v1/namespaces/${encodeURIComponent(spec.namespace)}/pods?${query}`]);
587
+ };
588
+ const exactResult = readPods(new URLSearchParams({ fieldSelector: `metadata.name=${spec.name}`,
589
+ limit: String(WARM_POD_LIST_PAGE_SIZE) }));
590
+ const exact = parse(exactResult);
591
+ if (!Array.isArray(exact?.items) || exact.items.length > 1) {
592
+ observeRefusal('exact-pod-lookup-unavailable'); return false;
593
+ }
594
+ const exactPod = exact.items.find((pod: any) => pod?.metadata?.name === spec.name);
595
+ const listedPods: any[] = [];
596
+ const seenContinuations = new Set<string>();
597
+ let continuation: string | undefined;
598
+ for (let page = 0; page < WARM_POD_LIST_MAX_PAGES; page++) {
599
+ const query = new URLSearchParams({ labelSelector: 'elanous.kind=warm-worker',
600
+ limit: String(WARM_POD_LIST_PAGE_SIZE), ...(continuation ? { continue: continuation } : {}) });
601
+ const result = parse(readPods(query));
602
+ if (!Array.isArray(result?.items) || !result.metadata || typeof result.metadata !== 'object'
603
+ || Array.isArray(result.metadata) || result.items.length > WARM_POD_LIST_PAGE_SIZE) {
604
+ observeRefusal('pod-list-page-unavailable'); return false;
605
+ }
606
+ listedPods.push(...result.items);
607
+ const next = result.metadata.continue;
608
+ if (next === undefined || next === '') { continuation = undefined; break; }
609
+ if (typeof next !== 'string' || seenContinuations.has(next)) {
610
+ observeRefusal('pod-list-page-token-invalid'); return false;
611
+ }
612
+ seenContinuations.add(next);
613
+ continuation = next;
614
+ }
615
+ if (continuation) { observeRefusal('pod-list-page-cap-reached'); return false; }
616
+ const matches = [exactPod, ...listedPods].filter((pod: any) => pod?.metadata?.name === spec.name
617
+ || pod?.metadata?.annotations?.['elanous.dev/warm-worker-id'] === spec.workerId);
618
+ const uniqueMatches = [...new Map(matches.map((pod: any) => [`${pod?.metadata?.name}/${pod?.metadata?.uid ?? ''}`, pod])).values()];
619
+ if (uniqueMatches.length === 0) {
620
+ // Recover a crash after successful deletion but before the durable ID rotation.
621
+ const query = new URLSearchParams({ kind: 'pod-worker-lease' });
622
+ try {
623
+ const response = await this.controlBounded(`/v1/resources?${query}`, credential, undefined,
624
+ WARM_CONTROL_REQUEST_TIMEOUT_MS);
625
+ const rows = response.status === 200 && Array.isArray(response.value?.resources) ? response.value.resources : null;
626
+ const own = rows?.filter((row: any) => row?.name === spec.workerId) ?? [];
627
+ // Empty slots are the normal cold-create path, not failed quarantine recovery.
628
+ if (rows && own.length === 0) return false;
629
+ const prior = own.length === 1 ? own[0] : null;
630
+ const uid = prior?.attrs?.podUid;
631
+ if (rows && prior?.kind === 'pod-worker-lease' && prior.machine === host && typeof uid === 'string'
632
+ && prior.attrs?.state === 'reaping'
633
+ && !rows.some((row: any) => row !== prior && row?.attrs?.podUid === uid)) {
634
+ const nextId = `reap-${randomUUID().replaceAll('-', '')}`;
635
+ this.writeRotation(`${host}/${spec.name}`, nextId);
636
+ candidate.spec = { ...spec, workerId: nextId };
637
+ debug.log('pod.warm', 'quarantine-reap-recovered', { host, tier, workerId: spec.workerId,
638
+ nextWorkerId: nextId, pod: spec.name, podUid: uid });
639
+ return true;
640
+ }
641
+ } catch { /* Uncertain state remains unavailable. */ }
642
+ observeRefusal('pod-absence-or-quarantine-unproven');
643
+ return false;
644
+ }
645
+ if (uniqueMatches.length !== 1) { observeRefusal('ambiguous-pod-identity'); return false; }
646
+ const pod = uniqueMatches[0];
647
+ const manifest = warmWorkerPodManifest(spec);
648
+ const expectedMetadata = manifest.metadata as { labels: Record<string, string>; annotations: Record<string, string> };
649
+ const uid = pod?.metadata?.uid;
650
+ if (pod?.metadata?.name !== spec.name || pod?.metadata?.namespace !== spec.namespace
651
+ || typeof uid !== 'string' || !uid || !pod.metadata.resourceVersion || pod.metadata.deletionTimestamp
652
+ || pod.metadata.ownerReferences?.length || pod.spec?.nodeName !== spec.nodeName
653
+ || pod.metadata.labels?.['elanous.kind'] !== 'warm-worker'
654
+ || pod.metadata.annotations?.['elanous.dev/warm-worker-id'] !== spec.workerId
655
+ || Object.entries(expectedMetadata.labels).some(([key, value]) => pod.metadata.labels?.[key] !== value)
656
+ || Object.entries(expectedMetadata.annotations).some(([key, value]) => pod.metadata.annotations?.[key] !== value)
657
+ || pod.spec?.containers?.[0]?.image !== spec.image
658
+ || pod.spec?.containers?.[0]?.resources?.limits?.memory !== spec.memoryLimit) {
659
+ observeRefusal('pod-identity-unproven');
660
+ return false;
661
+ }
662
+ const query = new URLSearchParams({ kind: 'pod-worker-lease' });
663
+ let response: { status: number; value: any };
664
+ try { response = await this.controlBounded(`/v1/resources?${query}`, credential, undefined,
665
+ WARM_CONTROL_REQUEST_TIMEOUT_MS); }
666
+ catch { observeRefusal('lease-ledger-unavailable'); return false; }
667
+ const rows = response.status === 200 && Array.isArray(response.value?.resources) ? response.value.resources : null;
668
+ const own = rows?.filter((row: any) => row?.name === spec.workerId) ?? [];
669
+ const ledger = own.length === 1 ? own[0] : null;
670
+ if (!rows || !ledger || ledger.kind !== 'pod-worker-lease' || ledger.machine !== host
671
+ || ledger.attrs?.podUid !== uid
672
+ || !['quarantined', 'timeout-fenced', 'reaping'].includes(ledger.attrs?.state)
673
+ || rows.some((row: any) => row !== ledger && row?.attrs?.podUid === uid)) {
674
+ observeRefusal('lease-or-identity-unproven');
675
+ return false;
676
+ }
677
+ let reservation: { status: number; value: any };
678
+ try {
679
+ reservation = await this.controlBounded(`/v1/leases/pod-worker/${encodeURIComponent(spec.workerId)}/reap`,
680
+ credential, { podUid: uid }, WARM_CONTROL_REQUEST_TIMEOUT_MS);
681
+ } catch { observeRefusal('reap-reservation-unavailable'); return false; }
682
+ if (reservation.status !== 200 || reservation.value?.attrs?.state !== 'reaping'
683
+ || reservation.value?.attrs?.podUid !== uid) {
684
+ observeRefusal('reap-reservation-refused');
685
+ return false;
686
+ }
687
+ let deleted: boolean;
688
+ try { deleted = await this.deletePodWithUid(spec, uid); }
689
+ catch { deleted = false; }
690
+ if (!deleted) { observeRefusal('uid-precondition-delete-failed'); return false; }
691
+ const after = parse(readPods(new URLSearchParams({ fieldSelector: `metadata.name=${spec.name}`,
692
+ limit: String(WARM_POD_LIST_PAGE_SIZE) })));
693
+ if (!Array.isArray(after?.items) || after.items.some((row: any) => row?.metadata?.name === spec.name)) {
694
+ observeRefusal('pod-removal-unconfirmed');
695
+ return false;
696
+ }
697
+ const nextId = `reap-${randomUUID().replaceAll('-', '')}`;
698
+ const slot = `${host}/${spec.name}`;
699
+ this.writeRotation(slot, nextId);
700
+ candidate.spec = { ...spec, workerId: nextId };
701
+ debug.log('pod.warm', 'quarantine-reaped', { host, tier, workerId: spec.workerId,
702
+ nextWorkerId: nextId, pod: spec.name, podUid: uid });
703
+ return true;
704
+ }
705
+
403
706
  private async coldPrepare(candidate: WarmWorkerCandidate,
404
- outcome: { preexisting: boolean; podUid: string | null }, signal?: AbortSignal): Promise<boolean> {
707
+ outcome: { preexisting: boolean; podUid: string | null }, signal?: AbortSignal,
708
+ onFailure?: (decision: WarmPoolFailureDecision) => void): Promise<boolean> {
709
+ const credentialValues = [this.options.memberToken, ...Object.values(this.options.machineTokens ?? {}),
710
+ ...Object.entries(process.env).filter(([name]) => /TOKEN|SECRET|PASSWORD|CREDENTIAL|API[_-]?KEY|AUTH/i.test(name))
711
+ .map(([, value]) => value ?? '')];
712
+ const fail = (stage: string, reason: string, stderr = ''): false => {
713
+ onFailure?.({ stage, reason, ...(stderr ? { stderr: safeWarmPoolStderr(stderr, credentialValues) } : {}) });
714
+ if (stage === 'pod-exact-lookup' || stage === 'pod-label-page') {
715
+ const listReason = reason === 'invalid-pod-list' || reason === 'invalid-pod-list-page'
716
+ ? 'malformed-output' : reason === 'kubectl-output-limit' ? 'output-too-large' : 'kubectl-failed';
717
+ debug.log('pod.warm', 'warm-pod-list-skipped', { reason: listReason }, { level: 'warn' });
718
+ }
719
+ return false;
720
+ };
405
721
  const configured = this.candidates.find(row => row.host === candidate.host
406
722
  && row.spec.workerId === candidate.spec.workerId && row.spec.cutSha === candidate.spec.cutSha
407
723
  && keyEquals(row.spec.key, candidate.spec.key));
@@ -412,19 +728,26 @@ export class WarmPodProvider {
412
728
  if (!configured || !configured.spec.nodeName
413
729
  || (configured.spec.name !== prefix && !/^[1-9][0-9]*$/.test(suffix)
414
730
  && !/^(lite|standard)-[1-9][0-9]*$/.test(suffix))
415
- || candidate.spec.name !== configured.spec.name || candidate.spec.nodeName !== configured.spec.nodeName) return false;
731
+ || candidate.spec.name !== configured.spec.name || candidate.spec.nodeName !== configured.spec.nodeName)
732
+ return fail('slot-validation', 'candidate-mismatch');
416
733
  throwIfPrepareAborted(signal);
417
734
  const { spec, host } = configured;
418
735
  const nodeName = spec.nodeName;
419
- if (!nodeName) return false;
736
+ if (!nodeName) return fail('slot-validation', 'node-unpinned');
420
737
  const credential = this.options.machineTokens?.[host];
421
- if (!token(credential)) return false;
738
+ if (!token(credential)) return fail('slot-validation', 'machine-credential-unavailable');
422
739
  const manifest = warmWorkerPodManifest(spec);
423
740
  const metadata = manifest.metadata as { labels: Record<string, string>; annotations: Record<string, string> };
424
741
  const template = manifest.spec as Record<string, unknown>;
425
- const kubectl = (args: readonly string[], input?: string) => {
742
+ const kubectl = (args: readonly string[], input?: string): { status: number | null; stdout: string; stderr: string; error?: NodeJS.ErrnoException } => {
426
743
  const argv = ['--context', spec.kubectlContext, '-n', spec.namespace, ...args];
427
- if (this.options.kubectl) return this.options.kubectl(argv, input);
744
+ if (this.options.kubectl) {
745
+ try { return this.options.kubectl(argv, input); }
746
+ catch (error) {
747
+ return { status: null, stdout: '', stderr: '', error: (error instanceof Error ? error : new Error(String(error))
748
+ ) as NodeJS.ErrnoException };
749
+ }
750
+ }
428
751
  const env = { ...process.env };
429
752
  for (const name of ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy', 'ALL_PROXY', 'all_proxy']) delete env[name];
430
753
  // A new standing worker can spend more than five minutes in its cold init
@@ -440,6 +763,25 @@ export class WarmPodProvider {
440
763
  if (result.status !== 0) return null;
441
764
  try { return JSON.parse(result.stdout) as any; } catch { return null; }
442
765
  };
766
+ const isOutputLimit = (result: { stderr?: string; error?: NodeJS.ErrnoException }) =>
767
+ result.error?.code === 'ENOBUFS'
768
+ || /maxBuffer|ENOBUFS|buffer length/i.test([result.stderr, result.error?.message].filter(Boolean).join('\n'));
769
+ const podListPage = (selector: { name?: string; continuation?: string }) => {
770
+ if (this.options.kubectl) {
771
+ const args = selector.name
772
+ ? ['get', 'pods', `--field-selector=metadata.name=${selector.name}`, '-o', 'json']
773
+ : ['get', 'pods', '-l', 'elanous.kind=warm-worker', `--limit=${WARM_POD_LIST_PAGE_SIZE}`, '-o', 'json',
774
+ ...(selector.continuation ? [`--continue=${selector.continuation}`] : [])];
775
+ return kubectl(args);
776
+ }
777
+ const query = new URLSearchParams({
778
+ ...(selector.name ? { fieldSelector: `metadata.name=${selector.name}` } : { labelSelector: 'elanous.kind=warm-worker' }),
779
+ limit: String(WARM_POD_LIST_PAGE_SIZE),
780
+ ...(selector.continuation ? { continue: selector.continuation } : {}),
781
+ });
782
+ const path = `/api/v1/namespaces/${encodeURIComponent(spec.namespace)}/pods?${query}`;
783
+ return kubectl(['get', '--raw', path]);
784
+ };
443
785
  const sameSpec = (actual: unknown, expected: unknown): boolean => {
444
786
  if (Array.isArray(expected)) return Array.isArray(actual) && actual.length === expected.length
445
787
  && expected.every((item, index) => sameSpec(actual[index], item));
@@ -486,80 +828,77 @@ export class WarmPodProvider {
486
828
  && Object.entries(metadata.annotations).every(([key, value]) => pod.metadata.annotations?.[key] === value)
487
829
  && pod.spec?.nodeName === nodeName
488
830
  && sameSpec(normalizedSpec(pod.spec), template);
489
- const skipDiscovery = (reason: string): false => {
490
- debug.log('pod.warm', 'warm-pod-list-skipped', { reason }, { level: 'warn' });
491
- return false;
492
- };
493
- const kubectlErrorCode = (error: unknown): string | undefined => {
494
- if (!error || typeof error !== 'object' || !('code' in error)) return undefined;
495
- return typeof error.code === 'string' ? error.code : undefined;
496
- };
497
- // Resolve the pinned Pod independently; namespace size must not affect this read.
498
- let namedResult: ReturnType<typeof kubectl>;
499
- try { namedResult = kubectl(['get', 'pods', `--field-selector=metadata.name=${spec.name}`, '-o', 'json']); }
500
- catch (error) {
501
- return skipDiscovery(kubectlErrorCode(error) === 'ENOBUFS' ? 'output-too-large' : 'kubectl-failed');
831
+ // Exact-name lookup finds the pinned candidate. A separate label query is
832
+ // paged so physical quota accounting never needs a namespace-wide dump.
833
+ const exactResult = kubectl(this.options.kubectl
834
+ ? ['get', 'pods', `--field-selector=metadata.name=${spec.name}`, '-o', 'json']
835
+ : ['get', '--raw', `/api/v1/namespaces/${encodeURIComponent(spec.namespace)}/pods?${new URLSearchParams({
836
+ fieldSelector: `metadata.name=${spec.name}`, limit: String(WARM_POD_LIST_PAGE_SIZE),
837
+ })}`]);
838
+ if (exactResult.status !== 0) {
839
+ const detail = [exactResult.stderr, 'error' in exactResult ? exactResult.error : ''].filter(Boolean).join('\n');
840
+ return fail('pod-exact-lookup', isOutputLimit(exactResult)
841
+ ? 'kubectl-output-limit' : 'kubectl-failed', detail);
502
842
  }
503
- if (kubectlErrorCode(namedResult.error) === 'ENOBUFS') return skipDiscovery('output-too-large');
504
- if (namedResult.status !== 0) return skipDiscovery('kubectl-failed');
505
- const namedList = parse(namedResult);
506
- if (!Array.isArray(namedList?.items) || !namedList.metadata || typeof namedList.metadata !== 'object'
507
- || Array.isArray(namedList.metadata)) return skipDiscovery('malformed-output');
508
- const namedMatches = namedList.items.filter((row: any) => row?.metadata?.name === spec.name);
509
- if (namedMatches.length > 1) return false;
510
- const namedPod = namedMatches[0] ?? null;
511
-
512
- // Kubectl's continuation token is consumed explicitly so no partial page can
513
- // authorize a create. A hard page cap turns a non-terminating listing into failure.
514
- const warmPods: any[] = [];
515
- let continuation = '';
843
+ const exact = parse(exactResult);
844
+ if (!Array.isArray(exact?.items)) return fail('pod-exact-lookup', 'invalid-pod-list');
845
+ const exactPod = exact.items.find((row: any) => row?.metadata?.name === spec.name);
846
+ const listed: any[] = [];
516
847
  const seenContinuations = new Set<string>();
517
- let completedPages = false;
518
- for (let page = 0; page < 100; page++) {
519
- const args = ['get', 'pods', '-l', 'elanous.kind=warm-worker', '--chunk-size=50', '-o', 'json'];
520
- if (continuation) args.splice(5, 0, '--continue', continuation);
521
- let result: ReturnType<typeof kubectl>;
522
- try { result = kubectl(args); }
523
- catch (error) {
524
- return skipDiscovery(kubectlErrorCode(error) === 'ENOBUFS' ? 'output-too-large' : 'kubectl-failed');
848
+ let continuation: string | undefined;
849
+ for (let page = 0; page < WARM_POD_LIST_MAX_PAGES; page++) {
850
+ const pageResult = podListPage({ continuation });
851
+ if (pageResult.status !== 0) {
852
+ const detail = [pageResult.stderr, 'error' in pageResult ? pageResult.error : ''].filter(Boolean).join('\n');
853
+ const reason = isOutputLimit(pageResult) ? 'kubectl-output-limit' : 'kubectl-failed';
854
+ return fail('pod-label-page', reason, detail);
525
855
  }
526
- if (kubectlErrorCode(result.error) === 'ENOBUFS') return skipDiscovery('output-too-large');
527
- if (result.status !== 0) return skipDiscovery('kubectl-failed');
528
- const listed = parse(result);
529
- if (!listed || !Array.isArray(listed.items) || !listed.metadata || typeof listed.metadata !== 'object'
530
- || Array.isArray(listed.metadata)
531
- || (listed.metadata.continue !== undefined && typeof listed.metadata.continue !== 'string'))
532
- return skipDiscovery('malformed-output');
533
- warmPods.push(...listed.items);
534
- continuation = listed.metadata?.continue ?? '';
535
- if (!continuation) { completedPages = true; break; }
536
- if (seenContinuations.has(continuation) || page === 99) return skipDiscovery('malformed-output');
537
- seenContinuations.add(continuation);
856
+ const result = parse(pageResult);
857
+ if (!Array.isArray(result?.items) || !result.metadata || typeof result.metadata !== 'object'
858
+ || Array.isArray(result.metadata)) return fail('pod-label-page', 'invalid-pod-list-page');
859
+ if (result.items.length > WARM_POD_LIST_PAGE_SIZE) return fail('pod-label-page', 'pod-list-page-over-cap');
860
+ listed.push(...result.items);
861
+ const next = result.metadata?.continue;
862
+ if (next === undefined || next === '') { continuation = undefined; break; }
863
+ if (typeof next !== 'string' || seenContinuations.has(next)) return fail('pod-label-page', 'pod-list-page-token-invalid');
864
+ seenContinuations.add(next);
865
+ continuation = next;
538
866
  }
539
- if (!completedPages) return skipDiscovery('malformed-output');
540
- const hostPods = warmPods.filter((row: any) => row?.metadata?.name === spec.name
541
- || row?.metadata?.annotations?.['elanous.dev/warm-worker-id'] === spec.workerId);
542
- if (namedPod && !hostPods.some((row: any) => row?.metadata?.name === spec.name)) hostPods.push(namedPod);
543
- if (hostPods.length > 1) return false;
544
- let pod = hostPods[0];
867
+ if (continuation) return fail('pod-label-page', 'pod-list-page-cap-reached');
868
+ // Read the complete label-selected set: a Pod for this host on another node
869
+ // must block creation, and warm Pods on the pinned node count against quota.
870
+ const hostPods = [exactPod, ...listed].filter((row: any) => !!row && (row?.metadata?.name === spec.name
871
+ || row?.metadata?.annotations?.['elanous.dev/warm-worker-id'] === spec.workerId));
872
+ const uniqueHostPods = [...new Map(hostPods.map((row: any) => [`${row?.metadata?.name}/${row?.metadata?.uid ?? ''}`, row])).values()];
873
+ if (uniqueHostPods.length > 1) return fail('pod-list', 'pod-list-over-cap');
874
+ let pod = uniqueHostPods[0];
545
875
  const preexisting = !!pod;
546
876
  outcome.preexisting = preexisting;
547
- if (pod && !matches(pod)) return false;
877
+ if (pod && !matches(pod)) {
878
+ const actualImage = pod.spec?.containers?.[0]?.image;
879
+ const actualMemory = pod.spec?.containers?.[0]?.resources?.limits?.memory;
880
+ const reason = actualImage !== spec.image ? 'image-pin-mismatch'
881
+ : actualMemory !== spec.memoryLimit ? 'profile-mismatch' : 'candidate-pod-mismatch';
882
+ return fail('pod-validation', reason);
883
+ }
548
884
  // Old generations still occupy memory even when their ledger rows are quarantined.
549
885
  // Count physical warm Pods on the pinned node before admitting a new one.
550
- const physical = warmPods.filter((row: any) => row?.metadata?.labels?.['elanous.kind'] === 'warm-worker'
886
+ const physical = listed.filter((row: any) => row?.metadata?.labels?.['elanous.kind'] === 'warm-worker'
551
887
  && row?.spec?.nodeName === nodeName && !row?.metadata?.deletionTimestamp
552
888
  && row?.status?.phase !== 'Succeeded' && row?.status?.phase !== 'Failed'
553
889
  && row?.spec?.containers?.[0]?.resources?.limits?.memory === spec.memoryLimit).length;
554
- if (!preexisting && physical >= resolveWarmPoolQuota(this.profile, host, configured.tier)) {
890
+ if (!preexisting && physical >= this.quotaResolver(this.profile, host, configured.tier)) {
555
891
  debug.log('pod.warm', 'pool-slot-refused', { host, tier: configured.tier,
556
892
  workerId: spec.workerId, reason: 'physical-quota', physical }, { level: 'warn' });
557
- return false;
893
+ return fail('pod-list', 'physical-quota');
558
894
  }
559
- const readLedger = async (): Promise<any[] | null> => {
895
+ const readLedger = async (): Promise<any[] | { error: string } | null> => {
560
896
  try {
561
897
  const query = new URLSearchParams({ kind: 'pod-worker-lease', machine: host, name: spec.workerId });
562
- const ledger = await this.control(`/v1/resources?${query}`, credential);
898
+ const ledger = await this.controlBounded(`/v1/resources?${query}`, credential, undefined,
899
+ WARM_CONTROL_REQUEST_TIMEOUT_MS);
900
+ if (ledger.status === 403 && ledger.value?.error === 'machine-scope')
901
+ return { error: 'machine-token-scope-mismatch' };
563
902
  return ledger.status === 200 && Array.isArray(ledger.value?.resources)
564
903
  && ledger.value.resources.length <= 1 ? ledger.value.resources : null;
565
904
  } catch { return null; }
@@ -568,9 +907,16 @@ export class WarmPodProvider {
568
907
  // A worker ID already bound to another UID must not leave a newly created, unregistered Pod.
569
908
  const before = await readLedger();
570
909
  throwIfPrepareAborted(signal);
571
- if (!before || before.length !== 0) return false;
572
- pod = parse(kubectl(['create', '-f', '-', '-o', 'json'], JSON.stringify(manifest)));
573
- if (!matches(pod)) return false;
910
+ if (before && !Array.isArray(before)) return fail('lease-preflight', before.error);
911
+ if (!before || before.length !== 0) return fail('lease-preflight', 'lease-unavailable');
912
+ const createResult = kubectl(['create', '-f', '-', '-o', 'json'], JSON.stringify(manifest));
913
+ if (createResult.status !== 0) {
914
+ const detail = [createResult.stderr, 'error' in createResult ? createResult.error : ''].filter(Boolean).join('\n');
915
+ const reason = /maxBuffer|ENOBUFS|buffer length/i.test(detail) ? 'kubectl-output-limit' : 'kubectl-create-denied';
916
+ return fail('pod-create', reason, detail);
917
+ }
918
+ pod = parse(createResult);
919
+ if (!matches(pod)) return fail('pod-create', 'created-pod-mismatch');
574
920
  }
575
921
  const uid = pod.metadata.uid as string;
576
922
  outcome.podUid = uid;
@@ -588,15 +934,20 @@ export class WarmPodProvider {
588
934
  const observed = parse(kubectl(['get', `pod/${spec.name}`, '-o', 'json']));
589
935
  throwIfPrepareAborted(signal);
590
936
  if (ready(observed)) { isReady = true; break; }
591
- if (!matches(observed) || observed.metadata.uid !== uid) return false;
937
+ if (!matches(observed) || observed.metadata.uid !== uid) return fail('pod-ready', 'pod-replaced-or-mismatched');
592
938
  if (this.now() < deadline) await waitForPrepareRetry(signal);
593
939
  }
594
- if (!isReady) return false;
940
+ if (!isReady) return fail('pod-ready', 'ready-deadline-exceeded');
595
941
  // Re-read after create: a registration racing the preflight must fail before our POST.
596
942
  const rows = await readLedger();
597
- if (!rows) return false;
943
+ if (rows && !Array.isArray(rows)) return fail('lease-registration', rows.error);
944
+ if (!rows) return fail('lease-registration', 'lease-read-failed');
598
945
  const existing = rows[0];
599
946
  const leaseTtlMs = this.options.leaseTtlMs ?? 30 * 60_000;
947
+ if (existing?.kind === 'pod-worker-lease' && existing.machine === host && existing.name === spec.workerId
948
+ && existing.attrs?.podUid === uid
949
+ && ['quarantined', 'timeout-fenced', 'reaping'].includes(existing.attrs?.state))
950
+ return fail('lease-registration', 'quarantined-pod-needs-reap');
600
951
  if (existing) return preexisting && existing.kind === 'pod-worker-lease'
601
952
  && existing.machine === host && existing.name === spec.workerId
602
953
  && (existing.attrs?.state === 'idle' || existing.attrs?.state === 'leased')
@@ -608,7 +959,7 @@ export class WarmPodProvider {
608
959
  && existing.attrs?.key && keyEquals(existing.attrs.key, spec.key);
609
960
  // An unregistered Pod could have been created by anyone with namespace access.
610
961
  // Only this invocation's successful create response may become a new ledger row.
611
- if (preexisting) return false;
962
+ if (preexisting) return fail('lease-registration', 'preexisting-pod-unregistered');
612
963
  throwIfPrepareAborted(signal);
613
964
  let registered: { status: number; value: any };
614
965
  try {
@@ -616,11 +967,15 @@ export class WarmPodProvider {
616
967
  workerId: spec.workerId, machine: host, podUid: uid, key: spec.key,
617
968
  ttlMs: leaseTtlMs,
618
969
  });
619
- } catch { return false; }
620
- return registered.status === 200 && registered.value?.name === spec.workerId
970
+ } catch { return fail('lease-registration', 'worker-registration-failed'); }
971
+ if (registered.status === 403 && registered.value?.error === 'machine-scope')
972
+ return fail('lease-registration', 'machine-token-scope-mismatch');
973
+ if (!(registered.status === 200 && registered.value?.name === spec.workerId
621
974
  && registered.value?.attrs?.state === 'idle'
622
975
  && registered.value?.attrs?.podUid === uid
623
- && !!registered.value.attrs.key && keyEquals(registered.value.attrs.key, spec.key);
976
+ && !!registered.value.attrs.key && keyEquals(registered.value.attrs.key, spec.key)))
977
+ return fail('lease-registration', 'worker-registration-rejected');
978
+ return true;
624
979
  }
625
980
 
626
981
  async prepareWorker(workerId: string): Promise<boolean> {
@@ -635,10 +990,27 @@ export class WarmPodProvider {
635
990
  let ready = 0;
636
991
  for (const candidate of this.candidates) {
637
992
  let prepared = false;
638
- try { prepared = await this.ensureStandingWorker(candidate); }
639
- catch { /* Uncertain state is never counted as ready. */ }
993
+ let decision: WarmPoolFailureDecision | undefined;
994
+ try { prepared = await this.ensureStandingWorker(candidate, value => { decision = value; }); }
995
+ catch (error) {
996
+ decision = { stage: 'prepare', reason: 'prepare-threw',
997
+ stderr: safeWarmPoolStderr(error instanceof Error ? error.message : String(error), [
998
+ this.options.memberToken, ...Object.values(this.options.machineTokens ?? {}),
999
+ ]) };
1000
+ }
640
1001
  if (prepared) ready++;
641
- else failed.push(candidate.spec.workerId);
1002
+ else {
1003
+ failed.push(candidate.spec.workerId);
1004
+ debug.log('pod.warm.provider', 'prepare-refused', { reason: decision?.reason ?? 'decision-unavailable',
1005
+ host: candidate.host, slot: candidate.spec.workerId,
1006
+ ...(this.options.observationRunIdForTest ? { runId: this.options.observationRunIdForTest } : {}) }, { level: 'warn' });
1007
+ debug.log('pod.warm', 'pool-reconcile-decision', { profile: this.profile,
1008
+ host: candidate.host, tier: candidate.tier, workerId: candidate.spec.workerId,
1009
+ stage: decision?.stage ?? 'prepare', reason: decision?.reason ?? 'decision-unavailable',
1010
+ ...(this.options.observationRunIdForTest ? { runId: this.options.observationRunIdForTest } : {}),
1011
+ ...(decision?.stderr ? { stderr: decision.stderr } : {}),
1012
+ }, { level: 'warn' });
1013
+ }
642
1014
  debug.log('pod.warm', 'pool-slot', { profile: this.profile,
643
1015
  host: candidate.host, tier: candidate.tier, workerId: candidate.spec.workerId,
644
1016
  pod: candidate.spec.name, ready: prepared }, { level: prepared ? 'info' : 'warn' });
@@ -661,6 +1033,7 @@ export class WarmPodProvider {
661
1033
  // host/key once so a busy first host cannot strand an idle second pool.
662
1034
  const tried = new Set<string>();
663
1035
  for (const candidate of matches) {
1036
+ if (input.deadlineAt <= this.now()) return lastFallback;
664
1037
  const { spec, host } = candidate;
665
1038
  const poolKey = `${host}/${spec.key.context}/${spec.key.imageDigest}/${spec.key.lockHash}/${spec.key.architecture}`;
666
1039
  if (tried.has(poolKey)) continue;
@@ -668,7 +1041,10 @@ export class WarmPodProvider {
668
1041
  const contextFailure = probeWarmPodContext(spec.kubectlContext, this.options.kubectl);
669
1042
  if (contextFailure) { lastFallback = { command: null, transport: contextFailure }; continue; }
670
1043
  let acquired: { status: number; value: any };
671
- const acquisition = this.control('/v1/leases/pod-worker', this.options.memberToken, {
1044
+ // Lease selection is a consumer action. Keep its owner at member scope so
1045
+ // finalize can release it; the machine token owns registration and sanitize.
1046
+ const acquisitionCredential = this.options.memberToken;
1047
+ const acquisition = this.control('/v1/leases/pod-worker', acquisitionCredential, {
672
1048
  machine: host, key: spec.key, runId: input.runId, attemptId: input.attemptId,
673
1049
  ttlMs: this.options.leaseTtlMs ?? 30 * 60_000,
674
1050
  });
@@ -730,7 +1106,10 @@ export class WarmPodProvider {
730
1106
  if (acquired.status === 409) {
731
1107
  try {
732
1108
  const query = new URLSearchParams({ kind: 'pod-worker-lease', machine: host, name: spec.workerId });
733
- const observed = await this.control(`/v1/resources?${query}`, this.options.memberToken);
1109
+ const remainingMs = input.deadlineAt - this.now();
1110
+ if (remainingMs <= 0) return lastFallback;
1111
+ const observed = await this.controlBounded(`/v1/resources?${query}`, this.options.memberToken,
1112
+ undefined, Math.min(WARM_CONTROL_REQUEST_TIMEOUT_MS, remainingMs));
734
1113
  const row = observed.status === 200 && Array.isArray(observed.value?.resources)
735
1114
  ? observed.value.resources.find((entry: any) => entry?.name === spec.workerId) : undefined;
736
1115
  if (row?.attrs?.state === 'quarantined' || row?.attrs?.state === 'timeout-fenced') {
@@ -790,9 +1169,16 @@ export class WarmPodProvider {
790
1169
  debug.log('pod.provenance', 'lease-start', { pod: leasedCandidate.spec.name, podUid: command.podUid,
791
1170
  leaseId: command.leaseId, runId: command.runId, attemptId: command.attemptId,
792
1171
  requestedAt: command.requestedAt, metadata: warmLeaseMetadata(command).annotations });
793
- try { await this.quarantine(command, 'lease-response-after-deadline'); }
1172
+ let quarantineTimer: ReturnType<typeof setTimeout> | undefined;
1173
+ try {
1174
+ await Promise.race([this.quarantine(command, 'lease-response-after-deadline'), new Promise<never>((_, reject) => {
1175
+ quarantineTimer = setTimeout(() => reject(new Error('warm late-lease quarantine timed out')),
1176
+ WARM_CONTROL_REQUEST_TIMEOUT_MS);
1177
+ })]);
1178
+ }
794
1179
  catch (error) { debug.log('pod.warm', 'late-lease-quarantine-failed', { workerId: command.workerId,
795
1180
  leaseId: command.leaseId, generation: command.generation, error: String(error) }, { level: 'warn' }); }
1181
+ finally { if (quarantineTimer) clearTimeout(quarantineTimer); }
796
1182
  return fallback('lease-unavailable');
797
1183
  }
798
1184
  // Acquisition is by pool key. A healthy sibling or replacement Pod must remain eligible.
@@ -963,7 +1349,7 @@ export function loadWarmPodProvider(path: string, pairingGateFileOrOptions?: str
963
1349
  if (!pairingGateFile.trim()) throw new Error('warm provider pairing gate file must not be empty');
964
1350
  options.pairingGateFile = pairingGateFile;
965
1351
  }
966
- return new WarmPodProvider({ ...options, ...runtimeOverrides });
1352
+ return new WarmPodProvider({ ...options, ...runtimeOverrides, rotationStatePath: options.rotationStatePath ?? `${path}.rotations` });
967
1353
  }
968
1354
  function currentProvider(): WarmPodProvider | null {
969
1355
  if (configuredProvider) return configuredProvider;
@@ -973,13 +1359,17 @@ function currentProvider(): WarmPodProvider | null {
973
1359
  catch { return null; }
974
1360
  return configuredProvider;
975
1361
  }
976
- export async function requestWarmPodReplay(input: WarmReplayInput): Promise<WarmReplayResult> {
977
- const provider = currentProvider();
1362
+ export async function requestWarmPodReplay(input: WarmReplayInput,
1363
+ providerOverrideForTest?: WarmPodProvider): Promise<WarmReplayResult> {
1364
+ const provider = providerOverrideForTest ?? currentProvider();
978
1365
  const result = provider ? await provider.request(input) : fallback('no-candidate');
979
1366
  debug.log('pod.warm', 'request-selection', { runId: input.runId, attemptId: input.attemptId,
980
1367
  cutSha: input.cutSha, selected: result.command !== null,
981
1368
  workerId: result.command?.workerId ?? null, status: result.transport.status,
982
1369
  reason: result.transport.reason });
1370
+ if (result.command && result.transport.status === 'observed' && result.transport.reason === 'complete')
1371
+ debug.log('pod.reuse', 'warm-worker-selected', { runId: input.runId,
1372
+ attemptId: input.attemptId, workerId: result.command.workerId, podUid: result.command.podUid });
983
1373
  return result;
984
1374
  }
985
1375
  export async function quarantineWarmPodReplay(command: WarmWorkerCommand, reason: string): Promise<void> {