@agent-profile/web 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +70 -29
  2. package/build/client/_app/immutable/assets/{0.BG6jUcBX.css → 0.8hVtEx5X.css} +1 -1
  3. package/build/client/_app/immutable/assets/0.8hVtEx5X.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.8hVtEx5X.css.gz +0 -0
  5. package/build/client/_app/immutable/assets/9.BsbC-D7w.css +1 -0
  6. package/build/client/_app/immutable/assets/9.BsbC-D7w.css.br +0 -0
  7. package/build/client/_app/immutable/assets/9.BsbC-D7w.css.gz +0 -0
  8. package/build/client/_app/immutable/chunks/4FiW6_9u.js +1 -0
  9. package/build/client/_app/immutable/chunks/4FiW6_9u.js.br +2 -0
  10. package/build/client/_app/immutable/chunks/4FiW6_9u.js.gz +0 -0
  11. package/build/client/_app/immutable/chunks/CF39CcoQ.js +3 -0
  12. package/build/client/_app/immutable/chunks/CF39CcoQ.js.br +0 -0
  13. package/build/client/_app/immutable/chunks/CF39CcoQ.js.gz +0 -0
  14. package/build/client/_app/immutable/chunks/CRcOA4L4.js +3 -0
  15. package/build/client/_app/immutable/chunks/CRcOA4L4.js.br +0 -0
  16. package/build/client/_app/immutable/chunks/CRcOA4L4.js.gz +0 -0
  17. package/build/client/_app/immutable/chunks/Cc9Av3g9.js +2 -0
  18. package/build/client/_app/immutable/chunks/Cc9Av3g9.js.br +0 -0
  19. package/build/client/_app/immutable/chunks/Cc9Av3g9.js.gz +0 -0
  20. package/build/client/_app/immutable/chunks/DUEBfJ-c.js +1 -0
  21. package/build/client/_app/immutable/chunks/DUEBfJ-c.js.br +4 -0
  22. package/build/client/_app/immutable/chunks/DUEBfJ-c.js.gz +0 -0
  23. package/build/client/_app/immutable/chunks/DvNNrklS.js +1 -0
  24. package/build/client/_app/immutable/chunks/DvNNrklS.js.br +2 -0
  25. package/build/client/_app/immutable/chunks/DvNNrklS.js.gz +0 -0
  26. package/build/client/_app/immutable/entry/app.ZULfIbKE.js +2 -0
  27. package/build/client/_app/immutable/entry/app.ZULfIbKE.js.br +0 -0
  28. package/build/client/_app/immutable/entry/app.ZULfIbKE.js.gz +0 -0
  29. package/build/client/_app/immutable/entry/start.XwZvWTgq.js +1 -0
  30. package/build/client/_app/immutable/entry/start.XwZvWTgq.js.br +0 -0
  31. package/build/client/_app/immutable/entry/start.XwZvWTgq.js.gz +0 -0
  32. package/build/client/_app/immutable/nodes/0.BTaKrNnR.js +1 -0
  33. package/build/client/_app/immutable/nodes/0.BTaKrNnR.js.br +0 -0
  34. package/build/client/_app/immutable/nodes/0.BTaKrNnR.js.gz +0 -0
  35. package/build/client/_app/immutable/nodes/1.B4GcuHvH.js +1 -0
  36. package/build/client/_app/immutable/nodes/1.B4GcuHvH.js.br +0 -0
  37. package/build/client/_app/immutable/nodes/1.B4GcuHvH.js.gz +0 -0
  38. package/build/client/_app/immutable/nodes/{10.BOQgahuX.js → 10.IHQDAuDz.js} +2 -2
  39. package/build/client/_app/immutable/nodes/10.IHQDAuDz.js.br +0 -0
  40. package/build/client/_app/immutable/nodes/10.IHQDAuDz.js.gz +0 -0
  41. package/build/client/_app/immutable/nodes/11.B5APptAv.js +1 -0
  42. package/build/client/_app/immutable/nodes/11.B5APptAv.js.br +0 -0
  43. package/build/client/_app/immutable/nodes/11.B5APptAv.js.gz +0 -0
  44. package/build/client/_app/immutable/nodes/2.BHUaWFMZ.js +10 -0
  45. package/build/client/_app/immutable/nodes/2.BHUaWFMZ.js.br +0 -0
  46. package/build/client/_app/immutable/nodes/2.BHUaWFMZ.js.gz +0 -0
  47. package/build/client/_app/immutable/nodes/3.DIhh3cSh.js +2 -0
  48. package/build/client/_app/immutable/nodes/3.DIhh3cSh.js.br +0 -0
  49. package/build/client/_app/immutable/nodes/3.DIhh3cSh.js.gz +0 -0
  50. package/build/client/_app/immutable/nodes/4.DjkBBmOF.js +4 -0
  51. package/build/client/_app/immutable/nodes/4.DjkBBmOF.js.br +0 -0
  52. package/build/client/_app/immutable/nodes/4.DjkBBmOF.js.gz +0 -0
  53. package/build/client/_app/immutable/nodes/5.BPcSAYs6.js +2 -0
  54. package/build/client/_app/immutable/nodes/5.BPcSAYs6.js.br +0 -0
  55. package/build/client/_app/immutable/nodes/5.BPcSAYs6.js.gz +0 -0
  56. package/build/client/_app/immutable/nodes/6.DZa-5yoH.js +5 -0
  57. package/build/client/_app/immutable/nodes/6.DZa-5yoH.js.br +0 -0
  58. package/build/client/_app/immutable/nodes/6.DZa-5yoH.js.gz +0 -0
  59. package/build/client/_app/immutable/nodes/7.v6t5o5IK.js +4 -0
  60. package/build/client/_app/immutable/nodes/7.v6t5o5IK.js.br +0 -0
  61. package/build/client/_app/immutable/nodes/7.v6t5o5IK.js.gz +0 -0
  62. package/build/client/_app/immutable/nodes/8.UWqOmBTc.js +1 -0
  63. package/build/client/_app/immutable/nodes/8.UWqOmBTc.js.br +0 -0
  64. package/build/client/_app/immutable/nodes/8.UWqOmBTc.js.gz +0 -0
  65. package/build/client/_app/immutable/nodes/9.xVCOCMfn.js +3 -0
  66. package/build/client/_app/immutable/nodes/9.xVCOCMfn.js.br +0 -0
  67. package/build/client/_app/immutable/nodes/9.xVCOCMfn.js.gz +0 -0
  68. package/build/client/_app/version.json +1 -1
  69. package/build/client/_app/version.json.br +0 -0
  70. package/build/client/_app/version.json.gz +0 -0
  71. package/build/client/marketing.js +105 -0
  72. package/build/client/marketing.js.br +0 -0
  73. package/build/client/marketing.js.gz +0 -0
  74. package/build/server/chunks/{0-aBAedq2p.js → 0-IAeZ4YD5.js} +17 -11
  75. package/build/server/chunks/0-IAeZ4YD5.js.map +1 -0
  76. package/build/server/chunks/{1-7SwLsXP7.js → 1--R3gZqoU.js} +3 -3
  77. package/build/server/chunks/{1-7SwLsXP7.js.map → 1--R3gZqoU.js.map} +1 -1
  78. package/build/server/chunks/10-B2v4GVik.js +9 -0
  79. package/build/server/chunks/{10-B1aX7ZZ8.js.map → 10-B2v4GVik.js.map} +1 -1
  80. package/build/server/chunks/{11-4z6b2WB8.js → 11-DbxvesJH.js} +6 -6
  81. package/build/server/chunks/{11-4z6b2WB8.js.map → 11-DbxvesJH.js.map} +1 -1
  82. package/build/server/chunks/2-CHviyPyI.js +21 -0
  83. package/build/server/chunks/2-CHviyPyI.js.map +1 -0
  84. package/build/server/chunks/3-CdNRNP5d.js +9 -0
  85. package/build/server/chunks/{3-CLWhM7Et.js.map → 3-CdNRNP5d.js.map} +1 -1
  86. package/build/server/chunks/{4-BehBrXcu.js → 4-CCj_Mhpz.js} +6 -6
  87. package/build/server/chunks/{4-BehBrXcu.js.map → 4-CCj_Mhpz.js.map} +1 -1
  88. package/build/server/chunks/5-CqBVRlNU.js +9 -0
  89. package/build/server/chunks/{5-C1YtO2Ru.js.map → 5-CqBVRlNU.js.map} +1 -1
  90. package/build/server/chunks/{6-DJ03bQJy.js → 6-BHxeFzUE.js} +3 -3
  91. package/build/server/chunks/{6-DJ03bQJy.js.map → 6-BHxeFzUE.js.map} +1 -1
  92. package/build/server/chunks/{7-BHefj3jR.js → 7-BUFOaHdC.js} +8 -8
  93. package/build/server/chunks/{7-BHefj3jR.js.map → 7-BUFOaHdC.js.map} +1 -1
  94. package/build/server/chunks/8-BbviFV5J.js +9 -0
  95. package/build/server/chunks/{8-BNb36pCU.js.map → 8-BbviFV5J.js.map} +1 -1
  96. package/build/server/chunks/9-kCTRECfO.js +67 -0
  97. package/build/server/chunks/9-kCTRECfO.js.map +1 -0
  98. package/build/server/chunks/{Badge-BrV_lIru.js → Badge-DCQxSQCS.js} +2 -2
  99. package/build/server/chunks/{Badge-BrV_lIru.js.map → Badge-DCQxSQCS.js.map} +1 -1
  100. package/build/server/chunks/{SafetyBadge-BSDbVVMY.js → SafetyBadge-BxEGojgX.js} +2 -2
  101. package/build/server/chunks/{SafetyBadge-BSDbVVMY.js.map → SafetyBadge-BxEGojgX.js.map} +1 -1
  102. package/build/server/chunks/{_layout.svelte-C6Ru_7YV.js → _layout.svelte-CQM4xaaq.js} +8 -8
  103. package/build/server/chunks/_layout.svelte-CQM4xaaq.js.map +1 -0
  104. package/build/server/chunks/{_page.svelte-Bv-w7cKm.js → _page.svelte-1wUrXGW-.js} +3 -3
  105. package/build/server/chunks/{_page.svelte-Bv-w7cKm.js.map → _page.svelte-1wUrXGW-.js.map} +1 -1
  106. package/build/server/chunks/{_page.svelte-BS9xpx67.js → _page.svelte-2W3EhlSt.js} +141 -60
  107. package/build/server/chunks/_page.svelte-2W3EhlSt.js.map +1 -0
  108. package/build/server/chunks/{_page.svelte-C8HqSRYY.js → _page.svelte-B3CasgD8.js} +2 -2
  109. package/build/server/chunks/{_page.svelte-C8HqSRYY.js.map → _page.svelte-B3CasgD8.js.map} +1 -1
  110. package/build/server/chunks/{_page.svelte-QyOMa9Ce.js → _page.svelte-B6d3qwTm.js} +5 -5
  111. package/build/server/chunks/{_page.svelte-QyOMa9Ce.js.map → _page.svelte-B6d3qwTm.js.map} +1 -1
  112. package/build/server/chunks/{_page.svelte-DRj4L7XZ.js → _page.svelte-BikYFdJv.js} +4 -4
  113. package/build/server/chunks/{_page.svelte-DRj4L7XZ.js.map → _page.svelte-BikYFdJv.js.map} +1 -1
  114. package/build/server/chunks/{_page.svelte-r2AHAn4f.js → _page.svelte-D8ffqrO3.js} +3 -3
  115. package/build/server/chunks/{_page.svelte-r2AHAn4f.js.map → _page.svelte-D8ffqrO3.js.map} +1 -1
  116. package/build/server/chunks/_page.svelte-DfUc4h7g.js +435 -0
  117. package/build/server/chunks/_page.svelte-DfUc4h7g.js.map +1 -0
  118. package/build/server/chunks/{_page.svelte-DYBnVmA8.js → _page.svelte-sygmDxbg.js} +6 -6
  119. package/build/server/chunks/{_page.svelte-DYBnVmA8.js.map → _page.svelte-sygmDxbg.js.map} +1 -1
  120. package/build/server/chunks/{_page.svelte-DyYKrY-D.js → _page.svelte-wL3fdD1l.js} +4 -4
  121. package/build/server/chunks/{_page.svelte-DyYKrY-D.js.map → _page.svelte-wL3fdD1l.js.map} +1 -1
  122. package/build/server/chunks/{_page.svelte-DuJcNgye.js → _page.svelte-xTZOj1o8.js} +3 -3
  123. package/build/server/chunks/{_page.svelte-DuJcNgye.js.map → _page.svelte-xTZOj1o8.js.map} +1 -1
  124. package/build/server/chunks/_server.ts-B7znNtap.js +100 -0
  125. package/build/server/chunks/_server.ts-B7znNtap.js.map +1 -0
  126. package/build/server/chunks/_server.ts-BjPyYUki.js +85 -0
  127. package/build/server/chunks/_server.ts-BjPyYUki.js.map +1 -0
  128. package/build/server/chunks/_server.ts-C8Fe0kql.js +8 -0
  129. package/build/server/chunks/_server.ts-C8Fe0kql.js.map +1 -0
  130. package/build/server/chunks/_server.ts-D1Ja2hnG.js +8 -0
  131. package/build/server/chunks/_server.ts-D1Ja2hnG.js.map +1 -0
  132. package/build/server/chunks/_server.ts-DsbQ4b7x.js +43 -0
  133. package/build/server/chunks/_server.ts-DsbQ4b7x.js.map +1 -0
  134. package/build/server/chunks/_server.ts-hEGlXjuB.js +8 -0
  135. package/build/server/chunks/_server.ts-hEGlXjuB.js.map +1 -0
  136. package/build/server/chunks/{client-CBew73li.js → client-h6Frgnzt.js} +3 -3
  137. package/build/server/chunks/{client-CBew73li.js.map → client-h6Frgnzt.js.map} +1 -1
  138. package/build/server/chunks/{dev-CrqJ3ZR3.js → dev-BdIdjvaY.js} +216 -82
  139. package/build/server/chunks/dev-BdIdjvaY.js.map +1 -0
  140. package/build/server/chunks/{doctorSummary-CGjSiyKU.js → doctorSummary-FyoWuR3R.js} +3 -3
  141. package/build/server/chunks/{doctorSummary-CGjSiyKU.js.map → doctorSummary-FyoWuR3R.js.map} +1 -1
  142. package/build/server/chunks/{error.svelte-C78Jl1J5.js → error.svelte-DYzh-S9t.js} +5 -5
  143. package/build/server/chunks/{error.svelte-C78Jl1J5.js.map → error.svelte-DYzh-S9t.js.map} +1 -1
  144. package/build/server/chunks/hooks.server-BKavEpqC.js +81 -0
  145. package/build/server/chunks/hooks.server-BKavEpqC.js.map +1 -0
  146. package/build/server/chunks/index-CLnuRv4X.js +134 -0
  147. package/build/server/chunks/index-CLnuRv4X.js.map +1 -0
  148. package/build/server/chunks/index-DBqjc0Yf.js +77 -0
  149. package/build/server/chunks/index-DBqjc0Yf.js.map +1 -0
  150. package/build/server/chunks/{internal-WBaPpipk.js → internal-Dz8-ksla.js} +23 -93
  151. package/build/server/chunks/internal-Dz8-ksla.js.map +1 -0
  152. package/build/server/chunks/marketingSeo-6Ec8IVzY.js +132 -0
  153. package/build/server/chunks/marketingSeo-6Ec8IVzY.js.map +1 -0
  154. package/build/server/chunks/profileApiHelpers-CUuQdn1G.js +180 -0
  155. package/build/server/chunks/profileApiHelpers-CUuQdn1G.js.map +1 -0
  156. package/build/server/chunks/{projectContext-C4-xYqFg.js → projectContext-fk5wtjwg.js} +1393 -69
  157. package/build/server/chunks/projectContext-fk5wtjwg.js.map +1 -0
  158. package/build/server/chunks/src2-BFardyAd.js +12 -0
  159. package/build/server/chunks/src2-BFardyAd.js.map +1 -0
  160. package/build/server/chunks/{dist--t-UlYlZ.js → src3-vKD2iyNK.js} +135 -3
  161. package/build/server/chunks/src3-vKD2iyNK.js.map +1 -0
  162. package/build/server/chunks/tokenStore-DQfTa-N3.js +57 -0
  163. package/build/server/chunks/tokenStore-DQfTa-N3.js.map +1 -0
  164. package/build/server/index.js +4592 -4
  165. package/build/server/index.js.map +1 -1
  166. package/build/server/manifest.js +57 -15
  167. package/build/server/manifest.js.map +1 -1
  168. package/package.json +12 -9
  169. package/build/client/_app/immutable/assets/0.BG6jUcBX.css.br +0 -0
  170. package/build/client/_app/immutable/assets/0.BG6jUcBX.css.gz +0 -0
  171. package/build/client/_app/immutable/chunks/B-io8J2C.js +0 -1
  172. package/build/client/_app/immutable/chunks/B-io8J2C.js.br +0 -2
  173. package/build/client/_app/immutable/chunks/B-io8J2C.js.gz +0 -0
  174. package/build/client/_app/immutable/chunks/BWDgWdtq.js +0 -3
  175. package/build/client/_app/immutable/chunks/BWDgWdtq.js.br +0 -0
  176. package/build/client/_app/immutable/chunks/BWDgWdtq.js.gz +0 -0
  177. package/build/client/_app/immutable/chunks/CBvCQPh1.js +0 -1
  178. package/build/client/_app/immutable/chunks/CBvCQPh1.js.br +0 -2
  179. package/build/client/_app/immutable/chunks/CBvCQPh1.js.gz +0 -0
  180. package/build/client/_app/immutable/chunks/DAWBIq3g.js +0 -2
  181. package/build/client/_app/immutable/chunks/DAWBIq3g.js.br +0 -0
  182. package/build/client/_app/immutable/chunks/DAWBIq3g.js.gz +0 -0
  183. package/build/client/_app/immutable/chunks/DCJP-V9E.js +0 -3
  184. package/build/client/_app/immutable/chunks/DCJP-V9E.js.br +0 -0
  185. package/build/client/_app/immutable/chunks/DCJP-V9E.js.gz +0 -0
  186. package/build/client/_app/immutable/chunks/SOrpfga1.js +0 -1
  187. package/build/client/_app/immutable/chunks/SOrpfga1.js.br +0 -0
  188. package/build/client/_app/immutable/chunks/SOrpfga1.js.gz +0 -0
  189. package/build/client/_app/immutable/entry/app.CvfSMy7S.js +0 -2
  190. package/build/client/_app/immutable/entry/app.CvfSMy7S.js.br +0 -0
  191. package/build/client/_app/immutable/entry/app.CvfSMy7S.js.gz +0 -0
  192. package/build/client/_app/immutable/entry/start.nKIgWfXU.js +0 -1
  193. package/build/client/_app/immutable/entry/start.nKIgWfXU.js.br +0 -0
  194. package/build/client/_app/immutable/entry/start.nKIgWfXU.js.gz +0 -0
  195. package/build/client/_app/immutable/nodes/0.l1JjQQQj.js +0 -1
  196. package/build/client/_app/immutable/nodes/0.l1JjQQQj.js.br +0 -0
  197. package/build/client/_app/immutable/nodes/0.l1JjQQQj.js.gz +0 -0
  198. package/build/client/_app/immutable/nodes/1.BzbldZDH.js +0 -1
  199. package/build/client/_app/immutable/nodes/1.BzbldZDH.js.br +0 -4
  200. package/build/client/_app/immutable/nodes/1.BzbldZDH.js.gz +0 -0
  201. package/build/client/_app/immutable/nodes/10.BOQgahuX.js.br +0 -0
  202. package/build/client/_app/immutable/nodes/10.BOQgahuX.js.gz +0 -0
  203. package/build/client/_app/immutable/nodes/11.BjwWla8T.js +0 -1
  204. package/build/client/_app/immutable/nodes/11.BjwWla8T.js.br +0 -0
  205. package/build/client/_app/immutable/nodes/11.BjwWla8T.js.gz +0 -0
  206. package/build/client/_app/immutable/nodes/2.BDMGSS6l.js +0 -9
  207. package/build/client/_app/immutable/nodes/2.BDMGSS6l.js.br +0 -0
  208. package/build/client/_app/immutable/nodes/2.BDMGSS6l.js.gz +0 -0
  209. package/build/client/_app/immutable/nodes/3.NnDkXnSG.js +0 -2
  210. package/build/client/_app/immutable/nodes/3.NnDkXnSG.js.br +0 -0
  211. package/build/client/_app/immutable/nodes/3.NnDkXnSG.js.gz +0 -0
  212. package/build/client/_app/immutable/nodes/4.8sZ5zCiS.js +0 -4
  213. package/build/client/_app/immutable/nodes/4.8sZ5zCiS.js.br +0 -0
  214. package/build/client/_app/immutable/nodes/4.8sZ5zCiS.js.gz +0 -0
  215. package/build/client/_app/immutable/nodes/5.CSOalQ9R.js +0 -2
  216. package/build/client/_app/immutable/nodes/5.CSOalQ9R.js.br +0 -0
  217. package/build/client/_app/immutable/nodes/5.CSOalQ9R.js.gz +0 -0
  218. package/build/client/_app/immutable/nodes/6.BMBuGW7y.js +0 -5
  219. package/build/client/_app/immutable/nodes/6.BMBuGW7y.js.br +0 -0
  220. package/build/client/_app/immutable/nodes/6.BMBuGW7y.js.gz +0 -0
  221. package/build/client/_app/immutable/nodes/7.CKFnFT6B.js +0 -4
  222. package/build/client/_app/immutable/nodes/7.CKFnFT6B.js.br +0 -0
  223. package/build/client/_app/immutable/nodes/7.CKFnFT6B.js.gz +0 -0
  224. package/build/client/_app/immutable/nodes/8.Dw5huUXy.js +0 -1
  225. package/build/client/_app/immutable/nodes/8.Dw5huUXy.js.br +0 -0
  226. package/build/client/_app/immutable/nodes/8.Dw5huUXy.js.gz +0 -0
  227. package/build/client/_app/immutable/nodes/9.CnkwRoxn.js +0 -5
  228. package/build/client/_app/immutable/nodes/9.CnkwRoxn.js.br +0 -0
  229. package/build/client/_app/immutable/nodes/9.CnkwRoxn.js.gz +0 -0
  230. package/build/server/chunks/0-aBAedq2p.js.map +0 -1
  231. package/build/server/chunks/10-B1aX7ZZ8.js +0 -9
  232. package/build/server/chunks/2-BT3hDge_.js +0 -9
  233. package/build/server/chunks/2-BT3hDge_.js.map +0 -1
  234. package/build/server/chunks/3-CLWhM7Et.js +0 -9
  235. package/build/server/chunks/5-C1YtO2Ru.js +0 -9
  236. package/build/server/chunks/8-BNb36pCU.js +0 -9
  237. package/build/server/chunks/9-LeS-ldcl.js +0 -57
  238. package/build/server/chunks/9-LeS-ldcl.js.map +0 -1
  239. package/build/server/chunks/_layout.svelte-C6Ru_7YV.js.map +0 -1
  240. package/build/server/chunks/_page.svelte-BS9xpx67.js.map +0 -1
  241. package/build/server/chunks/_page.svelte-IYyXbXcB.js +0 -424
  242. package/build/server/chunks/_page.svelte-IYyXbXcB.js.map +0 -1
  243. package/build/server/chunks/dev-CrqJ3ZR3.js.map +0 -1
  244. package/build/server/chunks/dist--t-UlYlZ.js.map +0 -1
  245. package/build/server/chunks/hooks.server-BU12K8IL.js +0 -38
  246. package/build/server/chunks/hooks.server-BU12K8IL.js.map +0 -1
  247. package/build/server/chunks/index-CNsiSQmW.js +0 -4727
  248. package/build/server/chunks/index-CNsiSQmW.js.map +0 -1
  249. package/build/server/chunks/internal-WBaPpipk.js.map +0 -1
  250. package/build/server/chunks/projectContext-C4-xYqFg.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { createRequire } from 'node:module';
2
- import { readFile } from 'node:fs/promises';
3
- import path from 'node:path';
1
+ import fsPromises, { readFile } from 'node:fs/promises';
4
2
  import require$$0 from 'process';
5
3
  import require$$0$1 from 'buffer';
6
- import { createHash } from 'node:crypto';
4
+ import { TextDecoder } from 'node:util';
5
+ import path from 'node:path';
6
+ import { randomBytes, createHash } from 'node:crypto';
7
7
 
8
8
  var ajv = {exports: {}};
9
9
 
@@ -13536,8 +13536,10 @@ function requireComposer () {
13536
13536
  }
13537
13537
  }
13538
13538
  if (afterDoc) {
13539
- Array.prototype.push.apply(doc.errors, this.errors);
13540
- Array.prototype.push.apply(doc.warnings, this.warnings);
13539
+ for (let i = 0; i < this.errors.length; ++i)
13540
+ doc.errors.push(this.errors[i]);
13541
+ for (let i = 0; i < this.warnings.length; ++i)
13542
+ doc.warnings.push(this.warnings[i]);
13541
13543
  }
13542
13544
  else {
13543
13545
  doc.errors = this.errors;
@@ -14510,7 +14512,7 @@ function requireLexer () {
14510
14512
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
14511
14513
  this.indentNext = this.indentValue + 1;
14512
14514
  this.indentValue += n;
14513
- return yield* this.parseBlockStart();
14515
+ return 'block-start';
14514
14516
  }
14515
14517
  return 'doc';
14516
14518
  }
@@ -14831,32 +14833,36 @@ function requireLexer () {
14831
14833
  return 0;
14832
14834
  }
14833
14835
  *pushIndicators() {
14834
- switch (this.charAt(0)) {
14835
- case '!':
14836
- return ((yield* this.pushTag()) +
14837
- (yield* this.pushSpaces(true)) +
14838
- (yield* this.pushIndicators()));
14839
- case '&':
14840
- return ((yield* this.pushUntil(isNotAnchorChar)) +
14841
- (yield* this.pushSpaces(true)) +
14842
- (yield* this.pushIndicators()));
14843
- case '-': // this is an error
14844
- case '?': // this is an error outside flow collections
14845
- case ':': {
14846
- const inFlow = this.flowLevel > 0;
14847
- const ch1 = this.charAt(1);
14848
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
14849
- if (!inFlow)
14850
- this.indentNext = this.indentValue + 1;
14851
- else if (this.flowKey)
14852
- this.flowKey = false;
14853
- return ((yield* this.pushCount(1)) +
14854
- (yield* this.pushSpaces(true)) +
14855
- (yield* this.pushIndicators()));
14836
+ let n = 0;
14837
+ loop: while (true) {
14838
+ switch (this.charAt(0)) {
14839
+ case '!':
14840
+ n += yield* this.pushTag();
14841
+ n += yield* this.pushSpaces(true);
14842
+ continue loop;
14843
+ case '&':
14844
+ n += yield* this.pushUntil(isNotAnchorChar);
14845
+ n += yield* this.pushSpaces(true);
14846
+ continue loop;
14847
+ case '-': // this is an error
14848
+ case '?': // this is an error outside flow collections
14849
+ case ':': {
14850
+ const inFlow = this.flowLevel > 0;
14851
+ const ch1 = this.charAt(1);
14852
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
14853
+ if (!inFlow)
14854
+ this.indentNext = this.indentValue + 1;
14855
+ else if (this.flowKey)
14856
+ this.flowKey = false;
14857
+ n += yield* this.pushCount(1);
14858
+ n += yield* this.pushSpaces(true);
14859
+ continue loop;
14860
+ }
14856
14861
  }
14857
14862
  }
14863
+ break loop;
14858
14864
  }
14859
- return 0;
14865
+ return n;
14860
14866
  }
14861
14867
  *pushTag() {
14862
14868
  if (this.charAt(1) === '<') {
@@ -15046,6 +15052,14 @@ function requireParser () {
15046
15052
  }
15047
15053
  return prev.splice(i, prev.length);
15048
15054
  }
15055
+ function arrayPushArray(target, source) {
15056
+ // May exhaust call stack with large `source` array
15057
+ if (source.length < 1e5)
15058
+ Array.prototype.push.apply(target, source);
15059
+ else
15060
+ for (let i = 0; i < source.length; ++i)
15061
+ target.push(source[i]);
15062
+ }
15049
15063
  function fixFlowSeqItems(fc) {
15050
15064
  if (fc.start.type === 'flow-seq-start') {
15051
15065
  for (const it of fc.items) {
@@ -15058,12 +15072,12 @@ function requireParser () {
15058
15072
  delete it.key;
15059
15073
  if (isFlowToken(it.value)) {
15060
15074
  if (it.value.end)
15061
- Array.prototype.push.apply(it.value.end, it.sep);
15075
+ arrayPushArray(it.value.end, it.sep);
15062
15076
  else
15063
15077
  it.value.end = it.sep;
15064
15078
  }
15065
15079
  else
15066
- Array.prototype.push.apply(it.start, it.sep);
15080
+ arrayPushArray(it.start, it.sep);
15067
15081
  delete it.sep;
15068
15082
  }
15069
15083
  }
@@ -15483,7 +15497,7 @@ function requireParser () {
15483
15497
  const prev = map.items[map.items.length - 2];
15484
15498
  const end = prev?.value?.end;
15485
15499
  if (Array.isArray(end)) {
15486
- Array.prototype.push.apply(end, it.start);
15500
+ arrayPushArray(end, it.start);
15487
15501
  end.push(this.sourceToken);
15488
15502
  map.items.pop();
15489
15503
  return;
@@ -15698,7 +15712,7 @@ function requireParser () {
15698
15712
  const prev = seq.items[seq.items.length - 2];
15699
15713
  const end = prev?.value?.end;
15700
15714
  if (Array.isArray(end)) {
15701
- Array.prototype.push.apply(end, it.start);
15715
+ arrayPushArray(end, it.start);
15702
15716
  end.push(this.sourceToken);
15703
15717
  seq.items.pop();
15704
15718
  return;
@@ -16124,8 +16138,500 @@ function requireDist () {
16124
16138
 
16125
16139
  var distExports = requireDist();
16126
16140
 
16127
- //#region ../../packages/core/dist/profile.js
16128
- var aiProfileSchema = createRequire(import.meta.url)("@agent-profile/schemas/ai-profile.schema.json");
16141
+ var ai_profile_schema_default = {
16142
+ $schema: "http://json-schema.org/draft-07/schema#",
16143
+ $id: "https://agent-profile.local/schemas/ai-profile.schema.json",
16144
+ title: "Agent Profile",
16145
+ description: "Version 1 canonical profile for Agent Profile Compiler.",
16146
+ type: "object",
16147
+ additionalProperties: false,
16148
+ required: [
16149
+ "version",
16150
+ "profile",
16151
+ "stack",
16152
+ "clients",
16153
+ "workflow"
16154
+ ],
16155
+ properties: {
16156
+ "version": {
16157
+ "type": "integer",
16158
+ "const": 1
16159
+ },
16160
+ "profile": {
16161
+ "type": "object",
16162
+ "additionalProperties": false,
16163
+ "required": ["name", "description"],
16164
+ "properties": {
16165
+ "name": {
16166
+ "type": "string",
16167
+ "minLength": 1,
16168
+ "pattern": "^[a-z0-9][a-z0-9._-]*$"
16169
+ },
16170
+ "description": {
16171
+ "type": "string",
16172
+ "minLength": 1
16173
+ }
16174
+ }
16175
+ },
16176
+ "stack": {
16177
+ "type": "object",
16178
+ "additionalProperties": false,
16179
+ "required": [
16180
+ "languages",
16181
+ "frameworks",
16182
+ "packageManagers",
16183
+ "testing"
16184
+ ],
16185
+ "properties": {
16186
+ "languages": { "$ref": "#/definitions/nonEmptySlugArray" },
16187
+ "frameworks": { "$ref": "#/definitions/slugArray" },
16188
+ "packageManagers": { "$ref": "#/definitions/slugArray" },
16189
+ "testing": { "$ref": "#/definitions/slugArray" }
16190
+ }
16191
+ },
16192
+ "clients": {
16193
+ "type": "object",
16194
+ "additionalProperties": false,
16195
+ "required": [
16196
+ "tabnine",
16197
+ "codex",
16198
+ "claude"
16199
+ ],
16200
+ "properties": {
16201
+ "tabnine": { "$ref": "#/definitions/client" },
16202
+ "codex": { "$ref": "#/definitions/client" },
16203
+ "claude": { "$ref": "#/definitions/client" }
16204
+ }
16205
+ },
16206
+ "safety": {
16207
+ "type": "object",
16208
+ "additionalProperties": false,
16209
+ "properties": {
16210
+ "mode": { "$ref": "#/definitions/safetyMode" },
16211
+ "requiresSandbox": { "type": "boolean" }
16212
+ }
16213
+ },
16214
+ "workflow": {
16215
+ "type": "object",
16216
+ "additionalProperties": false,
16217
+ "required": [
16218
+ "sdd",
16219
+ "tdd",
16220
+ "finalReview"
16221
+ ],
16222
+ "properties": {
16223
+ "sdd": { "type": "boolean" },
16224
+ "tdd": { "type": "boolean" },
16225
+ "finalReview": { "type": "boolean" },
16226
+ "codeReview": { "type": "boolean" },
16227
+ "refactoring": { "type": "boolean" },
16228
+ "documentation": { "type": "boolean" },
16229
+ "subagentDrivenDevelopment": { "type": "boolean" }
16230
+ }
16231
+ },
16232
+ "capabilities": {
16233
+ "type": "object",
16234
+ "additionalProperties": false,
16235
+ "properties": { "delegation": {
16236
+ "type": "object",
16237
+ "additionalProperties": false,
16238
+ "properties": { "subagents": { "$ref": "#/definitions/subagents" } }
16239
+ } }
16240
+ },
16241
+ "permissions": {
16242
+ "type": "object",
16243
+ "additionalProperties": false,
16244
+ "properties": {
16245
+ "filesystem": {
16246
+ "type": "object",
16247
+ "additionalProperties": false,
16248
+ "properties": {
16249
+ "read": { "$ref": "#/definitions/permissionMode" },
16250
+ "write": { "$ref": "#/definitions/permissionMode" }
16251
+ }
16252
+ },
16253
+ "shell": {
16254
+ "type": "object",
16255
+ "additionalProperties": false,
16256
+ "properties": { "run": { "$ref": "#/definitions/permissionMode" } }
16257
+ },
16258
+ "secrets": {
16259
+ "type": "object",
16260
+ "additionalProperties": false,
16261
+ "properties": { "access": {
16262
+ "type": "string",
16263
+ "const": "deny"
16264
+ } }
16265
+ },
16266
+ "dependencies": {
16267
+ "type": "object",
16268
+ "additionalProperties": false,
16269
+ "properties": { "install": { "$ref": "#/definitions/permissionMode" } }
16270
+ },
16271
+ "network": {
16272
+ "type": "object",
16273
+ "additionalProperties": false,
16274
+ "properties": { "external": { "$ref": "#/definitions/permissionMode" } }
16275
+ },
16276
+ "production": {
16277
+ "type": "object",
16278
+ "additionalProperties": false,
16279
+ "properties": { "access": {
16280
+ "type": "string",
16281
+ "const": "deny"
16282
+ } }
16283
+ }
16284
+ }
16285
+ }
16286
+ },
16287
+ definitions: {
16288
+ "client": {
16289
+ "type": "object",
16290
+ "additionalProperties": false,
16291
+ "required": ["enabled"],
16292
+ "properties": { "enabled": { "type": "boolean" } }
16293
+ },
16294
+ "permissionMode": {
16295
+ "type": "string",
16296
+ "enum": [
16297
+ "allow",
16298
+ "ask",
16299
+ "deny"
16300
+ ]
16301
+ },
16302
+ "safetyMode": {
16303
+ "type": "string",
16304
+ "enum": [
16305
+ "guarded",
16306
+ "balanced",
16307
+ "autonomous",
16308
+ "plan-only"
16309
+ ]
16310
+ },
16311
+ "slug": {
16312
+ "type": "string",
16313
+ "minLength": 1,
16314
+ "pattern": "^[a-z0-9][a-z0-9._-]*$"
16315
+ },
16316
+ "slugArray": {
16317
+ "type": "array",
16318
+ "uniqueItems": true,
16319
+ "items": { "$ref": "#/definitions/slug" }
16320
+ },
16321
+ "nonEmptySlugArray": {
16322
+ "type": "array",
16323
+ "minItems": 1,
16324
+ "uniqueItems": true,
16325
+ "items": { "$ref": "#/definitions/slug" }
16326
+ },
16327
+ "subagents": {
16328
+ "type": "object",
16329
+ "additionalProperties": false,
16330
+ "required": ["enabled"],
16331
+ "properties": {
16332
+ "enabled": { "type": "boolean" },
16333
+ "defaults": {
16334
+ "type": "object",
16335
+ "additionalProperties": false,
16336
+ "properties": {
16337
+ "maxConcurrent": {
16338
+ "type": "integer",
16339
+ "minimum": 1
16340
+ },
16341
+ "maxDepth": {
16342
+ "type": "integer",
16343
+ "minimum": 1
16344
+ }
16345
+ }
16346
+ },
16347
+ "agents": {
16348
+ "type": "array",
16349
+ "items": { "$ref": "#/definitions/subagent" }
16350
+ }
16351
+ },
16352
+ "if": {
16353
+ "properties": { "enabled": { "const": true } },
16354
+ "required": ["enabled"]
16355
+ },
16356
+ "then": {
16357
+ "required": ["agents"],
16358
+ "properties": { "agents": {
16359
+ "type": "array",
16360
+ "minItems": 1,
16361
+ "items": { "$ref": "#/definitions/subagent" }
16362
+ } }
16363
+ }
16364
+ },
16365
+ "subagent": { "oneOf": [{ "$ref": "#/definitions/subagentTemplateRef" }, { "$ref": "#/definitions/subagentInline" }] },
16366
+ "subagentTemplateRef": {
16367
+ "type": "object",
16368
+ "additionalProperties": false,
16369
+ "required": ["useTemplate"],
16370
+ "properties": { "useTemplate": {
16371
+ "type": "string",
16372
+ "enum": [
16373
+ "implementer",
16374
+ "spec-reviewer",
16375
+ "code-quality-reviewer"
16376
+ ]
16377
+ } }
16378
+ },
16379
+ "subagentInline": {
16380
+ "type": "object",
16381
+ "additionalProperties": false,
16382
+ "required": [
16383
+ "name",
16384
+ "description",
16385
+ "purpose",
16386
+ "prompt",
16387
+ "toolScope"
16388
+ ],
16389
+ "properties": {
16390
+ "name": {
16391
+ "type": "string",
16392
+ "minLength": 1,
16393
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
16394
+ "not": { "enum": [
16395
+ "default",
16396
+ "worker",
16397
+ "explorer",
16398
+ "explore",
16399
+ "plan",
16400
+ "general-purpose",
16401
+ "codebase_investigator",
16402
+ "remote-codebase-investigator",
16403
+ "generalist",
16404
+ "browser_agent"
16405
+ ] }
16406
+ },
16407
+ "description": {
16408
+ "type": "string",
16409
+ "minLength": 1,
16410
+ "pattern": "^[^\\r\\n]+$"
16411
+ },
16412
+ "purpose": {
16413
+ "type": "string",
16414
+ "minLength": 1,
16415
+ "pattern": "^[^\\r\\n]+$"
16416
+ },
16417
+ "prompt": {
16418
+ "type": "string",
16419
+ "minLength": 1
16420
+ },
16421
+ "toolScope": {
16422
+ "type": "string",
16423
+ "enum": ["read-only", "workspace-write"]
16424
+ },
16425
+ "modelPreference": {
16426
+ "type": "string",
16427
+ "enum": [
16428
+ "inherit",
16429
+ "fast",
16430
+ "balanced",
16431
+ "capable"
16432
+ ]
16433
+ },
16434
+ "maxTurns": {
16435
+ "type": "integer",
16436
+ "minimum": 1
16437
+ },
16438
+ "timeoutMinutes": {
16439
+ "type": "integer",
16440
+ "minimum": 1
16441
+ },
16442
+ "mcpServers": {
16443
+ "type": "array",
16444
+ "items": { "type": "string" },
16445
+ "maxItems": 0
16446
+ }
16447
+ }
16448
+ }
16449
+ }
16450
+ };
16451
+ //#endregion
16452
+ //#region ../../packages/core/src/profile.ts
16453
+ var SUBAGENT_TEMPLATE_NAMES = [
16454
+ "implementer",
16455
+ "spec-reviewer",
16456
+ "code-quality-reviewer"
16457
+ ];
16458
+ function isSubagentTemplateRef(entry) {
16459
+ return typeof entry.useTemplate === "string";
16460
+ }
16461
+ function freezeTemplate(template) {
16462
+ if (template.mcpServers !== void 0) Object.freeze(template.mcpServers);
16463
+ return Object.freeze(template);
16464
+ }
16465
+ function cloneTemplate(template) {
16466
+ const clone = {
16467
+ name: template.name,
16468
+ description: template.description,
16469
+ purpose: template.purpose,
16470
+ prompt: template.prompt,
16471
+ toolScope: template.toolScope
16472
+ };
16473
+ if (template.modelPreference !== void 0) clone.modelPreference = template.modelPreference;
16474
+ if (template.maxTurns !== void 0) clone.maxTurns = template.maxTurns;
16475
+ if (template.timeoutMinutes !== void 0) clone.timeoutMinutes = template.timeoutMinutes;
16476
+ if (template.mcpServers !== void 0) clone.mcpServers = [...template.mcpServers];
16477
+ return clone;
16478
+ }
16479
+ var SUBAGENT_TEMPLATES_RAW = {
16480
+ implementer: {
16481
+ name: "implementer",
16482
+ description: "Use for a bounded implementation task after the parent agent has provided the full task text, relevant spec excerpts, file ownership, constraints, and expected tests. Returns an explicit status and does not commit or push unless the parent request includes that requirement.",
16483
+ purpose: "Implement one scoped task with tests, self-review, and honest escalation when requirements or architecture are unclear.",
16484
+ prompt: `You are implementing one bounded task.
16485
+
16486
+ Work only from the task text, spec excerpts, file ownership, constraints,
16487
+ and allowed commands provided in the prompt. Do not assume hidden chat
16488
+ history. If essential context is missing, report NEEDS_CONTEXT instead of
16489
+ guessing.
16490
+
16491
+ Before editing, restate the goal, non-goals, acceptance criteria, and files
16492
+ you expect to touch. If the task is ambiguous, architectural, or broader than
16493
+ the prompt says, stop and report BLOCKED or NEEDS_CONTEXT.
16494
+
16495
+ Implement exactly what the task specifies. Follow the repository's SDD/TDD
16496
+ workflow. Add or update focused tests where practical, verify RED before
16497
+ behavior changes when the task changes behavior, implement the smallest
16498
+ passing change, then verify GREEN. Preserve existing patterns and avoid
16499
+ unrelated refactors.
16500
+
16501
+ Do not commit, push, create branches, install dependencies, access secrets,
16502
+ contact production systems, or upload source unless the parent prompt
16503
+ explicitly authorizes that action.
16504
+
16505
+ Before reporting back, self-review for completeness, quality, scope control,
16506
+ and test validity. Fix issues you find if they are inside the assigned scope.
16507
+
16508
+ Report exactly:
16509
+ - Status: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
16510
+ - What changed
16511
+ - Tests run and results
16512
+ - Files changed
16513
+ - Self-review findings
16514
+ - Concerns, missing context, or follow-up work`,
16515
+ toolScope: "workspace-write",
16516
+ modelPreference: "balanced",
16517
+ maxTurns: 18,
16518
+ timeoutMinutes: 20,
16519
+ mcpServers: []
16520
+ },
16521
+ "spec-reviewer": {
16522
+ name: "spec-reviewer",
16523
+ description: "Use after an implementation worker reports DONE or DONE_WITH_CONCERNS to verify the actual changed files against the task text, approved spec, acceptance criteria, and claimed result. Reads code and docs only; does not edit.",
16524
+ purpose: "Catch missing requirements, extra scope, and misunderstandings before code-quality review.",
16525
+ prompt: `You are reviewing whether an implementation matches its specification.
16526
+
16527
+ Work only from the full task text, approved spec excerpts, acceptance
16528
+ criteria, changed-file list, and implementer report provided in the prompt.
16529
+ Do not assume hidden chat history and do not trust the implementer report
16530
+ without checking the actual files.
16531
+
16532
+ Read the changed code and documentation. Compare actual behavior against the
16533
+ requested behavior line by line. Look for missing requirements, extra
16534
+ unrequested work, changed contracts, wrong interpretation, and fixture or
16535
+ documentation drift.
16536
+
16537
+ Do not edit files, run broad commands, install dependencies, read secrets,
16538
+ contact production systems, or upload source. If the prompt lacks enough
16539
+ context to review, report NEEDS_CONTEXT.
16540
+
16541
+ Report exactly:
16542
+ - Status: COMPLIANT | ISSUES_FOUND | NEEDS_CONTEXT
16543
+ - Requirements checked
16544
+ - Findings with severity, path, and line or symbol when available
16545
+ - Extra or out-of-scope work, if any
16546
+ - Missing tests or docs tied to acceptance criteria
16547
+ - Recommendation: proceed to code-quality review, fix first, or request context`,
16548
+ toolScope: "read-only",
16549
+ modelPreference: "capable",
16550
+ maxTurns: 10,
16551
+ timeoutMinutes: 8,
16552
+ mcpServers: []
16553
+ },
16554
+ "code-quality-reviewer": {
16555
+ name: "code-quality-reviewer",
16556
+ description: "Use only after spec review passes to assess maintainability, decomposition, tests, naming, risky mocks, and local code quality in the changed files. Reads code and docs only; does not edit.",
16557
+ purpose: "Catch maintainability and test-quality risks after the implementation is known to match the spec.",
16558
+ prompt: `You are reviewing code quality after spec compliance has passed.
16559
+
16560
+ Work only from the full task text, approved spec excerpts, changed-file list,
16561
+ spec-review result, test results, and implementer report provided in the
16562
+ prompt. Do not assume hidden chat history.
16563
+
16564
+ Review only the change's contribution. Do not flag pre-existing file size or
16565
+ architecture unless the change makes it materially worse. Check whether each
16566
+ touched file has a clear responsibility, whether names describe intent,
16567
+ whether complex predicates should be named, whether tests verify behavior
16568
+ rather than mocks, whether mocks preserve required real side effects, and
16569
+ whether new APIs exist only for tests.
16570
+
16571
+ Do not edit files, run broad commands, install dependencies, read secrets,
16572
+ contact production systems, or upload source. If the prompt lacks enough
16573
+ context to review, report NEEDS_CONTEXT.
16574
+
16575
+ Report exactly:
16576
+ - Status: ACCEPTABLE | ISSUES_FOUND | NEEDS_CONTEXT
16577
+ - Strengths
16578
+ - Issues grouped as Critical, Important, or Minor
16579
+ - Test-quality concerns
16580
+ - Maintainability concerns
16581
+ - Assessment: ready, fix first, or request context`,
16582
+ toolScope: "read-only",
16583
+ modelPreference: "capable",
16584
+ maxTurns: 10,
16585
+ timeoutMinutes: 8,
16586
+ mcpServers: []
16587
+ }
16588
+ };
16589
+ var SUBAGENT_TEMPLATES = {
16590
+ implementer: freezeTemplate(SUBAGENT_TEMPLATES_RAW.implementer),
16591
+ "spec-reviewer": freezeTemplate(SUBAGENT_TEMPLATES_RAW["spec-reviewer"]),
16592
+ "code-quality-reviewer": freezeTemplate(SUBAGENT_TEMPLATES_RAW["code-quality-reviewer"])
16593
+ };
16594
+ function expandSubagentEntry(entry) {
16595
+ if (isSubagentTemplateRef(entry)) return cloneTemplate(SUBAGENT_TEMPLATES[entry.useTemplate]);
16596
+ return entry;
16597
+ }
16598
+ function getSubagentTemplateRefs(profile) {
16599
+ const block = profile.capabilities?.delegation?.subagents;
16600
+ if (!block || block.enabled !== true) return [];
16601
+ const refs = [];
16602
+ for (const entry of block.agents ?? []) if (isSubagentTemplateRef(entry)) refs.push(entry.useTemplate);
16603
+ return refs;
16604
+ }
16605
+ function normalizeSubagentName(name) {
16606
+ return name.toLowerCase().replace(/_/gu, "-");
16607
+ }
16608
+ function getSubagentDefaults(profile) {
16609
+ const defaults = profile.capabilities?.delegation?.subagents?.defaults;
16610
+ return {
16611
+ maxConcurrent: defaults?.maxConcurrent ?? 3,
16612
+ maxDepth: defaults?.maxDepth ?? 1
16613
+ };
16614
+ }
16615
+ function getEnabledSubagents(profile) {
16616
+ const block = profile.capabilities?.delegation?.subagents;
16617
+ if (!block || block.enabled !== true) return [];
16618
+ return (block.agents ?? []).map((entry) => expandSubagentEntry(entry));
16619
+ }
16620
+ var SUBAGENT_BUILTIN_NAMES_NORMALIZED = new Set([
16621
+ "default",
16622
+ "worker",
16623
+ "explorer",
16624
+ "explore",
16625
+ "plan",
16626
+ "general-purpose",
16627
+ "codebase-investigator",
16628
+ "remote-codebase-investigator",
16629
+ "generalist",
16630
+ "browser-agent"
16631
+ ]);
16632
+ function isSubagentBuiltinNameCollision(name) {
16633
+ return SUBAGENT_BUILTIN_NAMES_NORMALIZED.has(normalizeSubagentName(name));
16634
+ }
16129
16635
  var compiledValidator;
16130
16636
  var DEFAULT_SAFETY = {
16131
16637
  mode: "guarded",
@@ -16209,6 +16715,11 @@ function validateProfileValue(value) {
16209
16715
  const validate = getValidator();
16210
16716
  if (validate(value)) {
16211
16717
  const profile = value;
16718
+ const subagentIssues = validateSubagentSemantics(profile);
16719
+ if (subagentIssues.length > 0) return {
16720
+ ok: false,
16721
+ issues: subagentIssues.sort((left, right) => compareIssues$1(left, right))
16722
+ };
16212
16723
  return {
16213
16724
  ok: true,
16214
16725
  profile,
@@ -16221,12 +16732,164 @@ function validateProfileValue(value) {
16221
16732
  issues: toValidationIssues(validate.errors ?? [], value)
16222
16733
  };
16223
16734
  }
16735
+ function validateSubagentSemantics(profile) {
16736
+ const subagents = profile.capabilities?.delegation?.subagents;
16737
+ if (!subagents || subagents.enabled !== true) return [];
16738
+ const entries = subagents.agents ?? [];
16739
+ const issues = [];
16740
+ const seenRaw = /* @__PURE__ */ new Map();
16741
+ const seenNormalized = /* @__PURE__ */ new Map();
16742
+ entries.forEach((entry, index) => {
16743
+ const name = expandSubagentEntry(entry).name;
16744
+ const rawIndex = seenRaw.get(name);
16745
+ if (rawIndex !== void 0) issues.push({
16746
+ code: "schema_validation_error",
16747
+ path: `/capabilities/delegation/subagents/agents/${index}/name`,
16748
+ expected: "unique subagent name",
16749
+ actual: "duplicate",
16750
+ message: `/capabilities/delegation/subagents/agents/${index}/name duplicates the name used at index ${rawIndex}.`
16751
+ });
16752
+ else seenRaw.set(name, index);
16753
+ const normalized = normalizeSubagentName(name);
16754
+ const normalizedIndex = seenNormalized.get(normalized);
16755
+ if (normalizedIndex !== void 0 && normalizedIndex !== index) {
16756
+ if (!(rawIndex !== void 0)) issues.push({
16757
+ code: "schema_validation_error",
16758
+ path: `/capabilities/delegation/subagents/agents/${index}/name`,
16759
+ expected: "unique normalized subagent id",
16760
+ actual: "duplicate after hyphen/underscore folding",
16761
+ message: `/capabilities/delegation/subagents/agents/${index}/name collides with the name used at index ${normalizedIndex} after normalization.`
16762
+ });
16763
+ } else if (normalizedIndex === void 0) seenNormalized.set(normalized, index);
16764
+ });
16765
+ return issues;
16766
+ }
16224
16767
  function normalizeSafety(profile) {
16225
16768
  return {
16226
16769
  mode: profile.safety?.mode ?? DEFAULT_SAFETY.mode,
16227
16770
  requiresSandbox: profile.safety?.requiresSandbox ?? DEFAULT_SAFETY.requiresSandbox
16228
16771
  };
16229
16772
  }
16773
+ /**
16774
+ * Serialize a validated AiProfile to deterministic YAML.
16775
+ *
16776
+ * - UTF-8, single trailing newline.
16777
+ * - Schema field order: version, profile, stack, clients, safety, workflow, permissions.
16778
+ * - Optional safety / permissions omitted when absent on the input object.
16779
+ * - Empty arrays render as [].
16780
+ * - Deterministic: two calls on the same object produce byte-identical output.
16781
+ */
16782
+ function renderProfileYaml(profile) {
16783
+ const doc = {};
16784
+ doc["version"] = profile.version;
16785
+ doc["profile"] = {
16786
+ name: profile.profile.name,
16787
+ description: profile.profile.description
16788
+ };
16789
+ doc["stack"] = {
16790
+ languages: profile.stack.languages,
16791
+ frameworks: profile.stack.frameworks,
16792
+ packageManagers: profile.stack.packageManagers,
16793
+ testing: profile.stack.testing
16794
+ };
16795
+ doc["clients"] = {
16796
+ tabnine: { enabled: profile.clients.tabnine.enabled },
16797
+ codex: { enabled: profile.clients.codex.enabled },
16798
+ claude: { enabled: profile.clients.claude.enabled }
16799
+ };
16800
+ if (profile.safety !== void 0) {
16801
+ const safety = {};
16802
+ if (profile.safety.mode !== void 0) safety["mode"] = profile.safety.mode;
16803
+ if (profile.safety.requiresSandbox !== void 0) safety["requiresSandbox"] = profile.safety.requiresSandbox;
16804
+ doc["safety"] = safety;
16805
+ }
16806
+ const workflow = {
16807
+ sdd: profile.workflow.sdd,
16808
+ tdd: profile.workflow.tdd,
16809
+ finalReview: profile.workflow.finalReview
16810
+ };
16811
+ if (profile.workflow.codeReview !== void 0) workflow["codeReview"] = profile.workflow.codeReview;
16812
+ if (profile.workflow.refactoring !== void 0) workflow["refactoring"] = profile.workflow.refactoring;
16813
+ if (profile.workflow.documentation !== void 0) workflow["documentation"] = profile.workflow.documentation;
16814
+ if (profile.workflow.subagentDrivenDevelopment !== void 0) workflow["subagentDrivenDevelopment"] = profile.workflow.subagentDrivenDevelopment;
16815
+ doc["workflow"] = workflow;
16816
+ if (profile.capabilities !== void 0) doc["capabilities"] = buildCapabilitiesDoc(profile.capabilities);
16817
+ if (profile.permissions !== void 0) doc["permissions"] = buildPermissionsDoc(profile.permissions);
16818
+ return distExports.stringify(doc, {
16819
+ lineWidth: 0,
16820
+ indent: 2,
16821
+ sortMapEntries: false
16822
+ }).replace(/\n+$/, "") + "\n";
16823
+ }
16824
+ function buildCapabilitiesDoc(capabilities) {
16825
+ const doc = {};
16826
+ if (capabilities.delegation !== void 0) {
16827
+ const delegation = {};
16828
+ const subagents = capabilities.delegation.subagents;
16829
+ if (subagents !== void 0) {
16830
+ const block = { enabled: subagents.enabled };
16831
+ if (subagents.defaults !== void 0) {
16832
+ const defaults = {};
16833
+ if (subagents.defaults.maxConcurrent !== void 0) defaults["maxConcurrent"] = subagents.defaults.maxConcurrent;
16834
+ if (subagents.defaults.maxDepth !== void 0) defaults["maxDepth"] = subagents.defaults.maxDepth;
16835
+ if (Object.keys(defaults).length > 0) block["defaults"] = defaults;
16836
+ }
16837
+ if (subagents.agents !== void 0) block["agents"] = subagents.agents.map((entry) => isSubagentTemplateRef(entry) ? { useTemplate: entry.useTemplate } : buildSubagentDoc(entry));
16838
+ delegation["subagents"] = block;
16839
+ }
16840
+ if (Object.keys(delegation).length > 0) doc["delegation"] = delegation;
16841
+ }
16842
+ return doc;
16843
+ }
16844
+ function buildSubagentDoc(agent) {
16845
+ const out = {
16846
+ name: agent.name,
16847
+ description: agent.description,
16848
+ purpose: agent.purpose,
16849
+ prompt: agent.prompt,
16850
+ toolScope: agent.toolScope
16851
+ };
16852
+ if (agent.modelPreference !== void 0) out["modelPreference"] = agent.modelPreference;
16853
+ if (agent.maxTurns !== void 0) out["maxTurns"] = agent.maxTurns;
16854
+ if (agent.timeoutMinutes !== void 0) out["timeoutMinutes"] = agent.timeoutMinutes;
16855
+ if (agent.mcpServers !== void 0) out["mcpServers"] = agent.mcpServers;
16856
+ return out;
16857
+ }
16858
+ function buildPermissionsDoc(p) {
16859
+ const doc = {};
16860
+ if (p.filesystem !== void 0) {
16861
+ const fs = {};
16862
+ if (p.filesystem.read !== void 0) fs["read"] = p.filesystem.read;
16863
+ if (p.filesystem.write !== void 0) fs["write"] = p.filesystem.write;
16864
+ if (Object.keys(fs).length > 0) doc["filesystem"] = fs;
16865
+ }
16866
+ if (p.shell !== void 0) {
16867
+ const sh = {};
16868
+ if (p.shell.run !== void 0) sh["run"] = p.shell.run;
16869
+ if (Object.keys(sh).length > 0) doc["shell"] = sh;
16870
+ }
16871
+ if (p.secrets !== void 0) {
16872
+ const sec = {};
16873
+ if (p.secrets.access !== void 0) sec["access"] = p.secrets.access;
16874
+ if (Object.keys(sec).length > 0) doc["secrets"] = sec;
16875
+ }
16876
+ if (p.dependencies !== void 0) {
16877
+ const dep = {};
16878
+ if (p.dependencies.install !== void 0) dep["install"] = p.dependencies.install;
16879
+ if (Object.keys(dep).length > 0) doc["dependencies"] = dep;
16880
+ }
16881
+ if (p.network !== void 0) {
16882
+ const net = {};
16883
+ if (p.network.external !== void 0) net["external"] = p.network.external;
16884
+ if (Object.keys(net).length > 0) doc["network"] = net;
16885
+ }
16886
+ if (p.production !== void 0) {
16887
+ const prod = {};
16888
+ if (p.production.access !== void 0) prod["access"] = p.production.access;
16889
+ if (Object.keys(prod).length > 0) doc["production"] = prod;
16890
+ }
16891
+ return doc;
16892
+ }
16230
16893
  function deriveEffectivePermissions(profile) {
16231
16894
  const safety = normalizeSafety(profile);
16232
16895
  const permissions = profile.permissions ?? {};
@@ -16252,7 +16915,7 @@ function getRemoteRefs(schema) {
16252
16915
  collectRemoteRefs(schema, refs);
16253
16916
  return refs.sort();
16254
16917
  }
16255
- function compileProfileSchema(schema = aiProfileSchema) {
16918
+ function compileProfileSchema(schema = ai_profile_schema_default) {
16256
16919
  assertNoRemoteRefs(schema);
16257
16920
  return new ajvExports.Ajv({
16258
16921
  allErrors: true,
@@ -16368,12 +17031,13 @@ function isRecord$1(value) {
16368
17031
  return typeof value === "object" && value !== null && !Array.isArray(value);
16369
17032
  }
16370
17033
  //#endregion
16371
- //#region ../../packages/core/dist/security.js
17034
+ //#region ../../packages/core/src/security.ts
16372
17035
  function containsSecretLikeLiteral(text) {
16373
17036
  return text.includes("SECRET_TOKEN_VALUE") || /-----BEGIN [A-Z ]*PRIVATE KEY-----/u.test(text) || /\b(?:api[_-]?key|token|secret|password)\b\s*[:=]\s*["']?(?!\$)[A-Za-z0-9_./+=-]{10,}/iu.test(text);
16374
17037
  }
16375
- //#endregion
16376
- //#region ../../packages/compiler/dist/shared.js
17038
+ new TextDecoder("utf-8", { fatal: true });
17039
+
17040
+ //#region ../../packages/compiler/src/shared.ts
16377
17041
  var AGENT_PROFILE_COMPILER = {
16378
17042
  name: "agent-profile",
16379
17043
  version: "0.1.0"
@@ -16384,12 +17048,15 @@ function getDefaultTargetIds() {
16384
17048
  "lockfile",
16385
17049
  "tabnine-guidelines",
16386
17050
  "tabnine-mcp-config",
17051
+ "tabnine-subagents",
16387
17052
  "codex-config",
16388
17053
  "codex-workflow-skills",
17054
+ "codex-subagents",
16389
17055
  "claude-settings",
16390
17056
  "claude-mcp",
16391
17057
  "claude-md",
16392
- "claude-workflow-skills"
17058
+ "claude-workflow-skills",
17059
+ "claude-subagents"
16393
17060
  ];
16394
17061
  }
16395
17062
  function createGeneratedTextFile(path, target, templateId, text) {
@@ -16423,7 +17090,7 @@ function compareText(left, right) {
16423
17090
  return 0;
16424
17091
  }
16425
17092
  //#endregion
16426
- //#region ../../packages/compiler/dist/lockfile.js
17093
+ //#region ../../packages/compiler/src/lockfile.ts
16427
17094
  function buildLockfile(input) {
16428
17095
  return {
16429
17096
  version: 1,
@@ -16658,7 +17325,222 @@ function compareLockOutputs(left, right) {
16658
17325
  return compareText(left.path, right.path) || compareText(left.target, right.target);
16659
17326
  }
16660
17327
  //#endregion
16661
- //#region ../../packages/compiler/dist/compiler.js
17328
+ //#region ../../packages/compiler/src/guidance-content.ts
17329
+ var REACT_STACK_TOPIC = {
17330
+ tabnineTitle: "TypeScript and React Stack",
17331
+ agentsMdTitle: "Stack Guidance — React",
17332
+ intro: "Use the existing TypeScript and React conventions in the repository.",
17333
+ subsections: [
17334
+ {
17335
+ heading: "TypeScript Discipline",
17336
+ bullets: [
17337
+ "Do not use `any` without a documented reason.",
17338
+ "Declare explicit types for exported functions, props, and return values.",
17339
+ "Reuse existing types and utilities before adding new ones."
17340
+ ]
17341
+ },
17342
+ {
17343
+ heading: "Component Conventions",
17344
+ bullets: [
17345
+ "Use function components with typed props.",
17346
+ "Co-locate components with the modules that own them.",
17347
+ "Keep render-only components free of side effects."
17348
+ ]
17349
+ },
17350
+ {
17351
+ heading: "Hook Discipline",
17352
+ bullets: [
17353
+ "Add memoization (`useMemo`, `useCallback`) only when a measured re-render or referential-identity problem exists.",
17354
+ "Keep state local; do not introduce a global store by default.",
17355
+ "Honor the rules of hooks; never call hooks conditionally."
17356
+ ]
17357
+ },
17358
+ {
17359
+ heading: "Styling",
17360
+ bullets: ["Follow the existing styling approach in the repository.", "Do not introduce a new CSS framework or component library."]
17361
+ },
17362
+ {
17363
+ heading: "API Calls",
17364
+ bullets: [
17365
+ "Reuse existing client utilities for HTTP and data access.",
17366
+ "Type both request payloads and response bodies.",
17367
+ "Handle error and loading states explicitly."
17368
+ ]
17369
+ },
17370
+ {
17371
+ heading: "SDD and TDD Focus",
17372
+ bullets: [
17373
+ "Cover state transitions, API success, error, and loading paths.",
17374
+ "Cover accessibility-affecting behavior (focus, keyboard, ARIA).",
17375
+ "Add or update focused tests before changing observable behavior."
17376
+ ]
17377
+ }
17378
+ ],
17379
+ tabnineChecklistReference: "See `90-final-review.md` for the shared final-review checklist.",
17380
+ agentsMdChecklistReference: "See the `## Completion Checklist` section for shared review steps."
17381
+ };
17382
+ var CODE_REVIEW_TOPIC = {
17383
+ tabnineTitle: "Code Review",
17384
+ agentsMdTitle: "Code Review",
17385
+ intro: "Use these rules when reviewing a pull request or proposed change.",
17386
+ subsections: [
17387
+ {
17388
+ heading: "Review Focus",
17389
+ bullets: [
17390
+ "Correctness and edge cases.",
17391
+ "Security, including input validation and secret handling.",
17392
+ "Performance hotspots and obvious complexity regressions.",
17393
+ "Unnecessary complexity or premature abstraction.",
17394
+ "Consistency with existing project style.",
17395
+ "Missing or weakened tests.",
17396
+ "Weak typing or unjustified `any`.",
17397
+ "Accessibility-affecting behavior in user-facing changes.",
17398
+ "Error handling and observability gaps.",
17399
+ "Dependency risk and license concerns.",
17400
+ "Spec compliance."
17401
+ ]
17402
+ },
17403
+ {
17404
+ heading: "Severity Labels",
17405
+ bullets: [
17406
+ "Blocker: must fix before merge (correctness, security, contract break).",
17407
+ "High: must fix before merge unless explicitly deferred.",
17408
+ "Medium: should fix before merge or open a tracked follow-up.",
17409
+ "Low: nit or polish; safe to defer."
17410
+ ]
17411
+ },
17412
+ {
17413
+ heading: "Output Format",
17414
+ bullets: [
17415
+ "Summary: one paragraph of intent and overall verdict.",
17416
+ "Spec Compliance: cite the spec and any deviation.",
17417
+ "Findings: grouped by severity, each with file, function, and concrete suggestion.",
17418
+ "Tests: list coverage gaps and whether tests were run.",
17419
+ "Safety Review: secrets, production access, dependency installs, network access.",
17420
+ "Final recommendation: approve, request changes, or block with reason."
17421
+ ]
17422
+ },
17423
+ {
17424
+ heading: "Review Discipline",
17425
+ bullets: [
17426
+ "Skip nitpicks the autoformatter or linter already handles.",
17427
+ "Do not propose broad rewrites; keep suggestions actionable.",
17428
+ "Reference the specific file, function, or component in every finding."
17429
+ ]
17430
+ }
17431
+ ],
17432
+ tabnineChecklistReference: "See `90-final-review.md` for the shared final-review checklist.",
17433
+ agentsMdChecklistReference: "See the `## Completion Checklist` section for shared review steps."
17434
+ };
17435
+ var REFACTORING_TOPIC = {
17436
+ tabnineTitle: "Refactoring",
17437
+ agentsMdTitle: "Refactoring",
17438
+ intro: "Use these rules when restructuring code without changing observable behavior.",
17439
+ subsections: [
17440
+ {
17441
+ heading: "Principles",
17442
+ bullets: [
17443
+ "Refactor to remove duplication, clarify intent, or unlock a planned change.",
17444
+ "Do not refactor for style preference alone or to chase a new pattern.",
17445
+ "Keep refactoring commits separate from behavior changes."
17446
+ ]
17447
+ },
17448
+ {
17449
+ heading: "Safe Refactoring Workflow",
17450
+ bullets: [
17451
+ "Identify the code smell or constraint that motivates the change.",
17452
+ "Check existing abstractions before introducing a new one.",
17453
+ "Define expected behavior in tests before restructuring.",
17454
+ "Make the smallest extraction that solves the problem.",
17455
+ "Preserve public behavior; run tests and golden fixtures after each step.",
17456
+ "Summarize what was intentionally not changed in the review notes."
17457
+ ]
17458
+ },
17459
+ {
17460
+ heading: "Restrictions",
17461
+ bullets: [
17462
+ "Do not rename public APIs without explicit approval.",
17463
+ "Do not move files across modules without explicit approval.",
17464
+ "Do not change schemas, endpoint contracts, or build tooling without explicit approval.",
17465
+ "Do not refactor and add features in the same change."
17466
+ ]
17467
+ }
17468
+ ],
17469
+ tabnineChecklistReference: "See `90-final-review.md` for the shared final-review checklist.",
17470
+ agentsMdChecklistReference: "See the `## Completion Checklist` section for shared review steps."
17471
+ };
17472
+ var DOCUMENTATION_TOPIC = {
17473
+ tabnineTitle: "Documentation",
17474
+ agentsMdTitle: "Documentation",
17475
+ intro: "Use these rules when adding or updating project documentation.",
17476
+ subsections: [
17477
+ {
17478
+ heading: "When to Update Documentation",
17479
+ bullets: [
17480
+ "Setup or onboarding steps changed.",
17481
+ "Workflow, command, or build step changed.",
17482
+ "Public API surface changed.",
17483
+ "Configuration or environment variables changed.",
17484
+ "Testing command changed.",
17485
+ "Deployment or release procedure changed.",
17486
+ "Troubleshooting guidance is newly known."
17487
+ ]
17488
+ },
17489
+ {
17490
+ heading: "Style",
17491
+ bullets: [
17492
+ "Write for maintainers, not marketing.",
17493
+ "Provide copy-pasteable commands where applicable.",
17494
+ "Keep examples current; remove examples that no longer run.",
17495
+ "Reference file paths when they help a reader navigate."
17496
+ ]
17497
+ },
17498
+ {
17499
+ heading: "README Rules",
17500
+ bullets: [
17501
+ "Keep the existing structure intact.",
17502
+ "Add only relevant new sections.",
17503
+ "Do not rewrite the README without an explicit request."
17504
+ ]
17505
+ },
17506
+ {
17507
+ heading: "Code Comment Policy",
17508
+ bullets: [
17509
+ "Comment non-obvious business rules and invariants.",
17510
+ "Comment tricky edge cases the code alone does not reveal.",
17511
+ "Comment surprising technical constraints and security-sensitive behavior.",
17512
+ "Do not write comments that restate the code."
17513
+ ]
17514
+ }
17515
+ ],
17516
+ tabnineChecklistReference: "See `90-final-review.md` for the shared final-review checklist.",
17517
+ agentsMdChecklistReference: "See the `## Completion Checklist` section for shared review steps."
17518
+ };
17519
+ function renderTopicAsTabnineGuideline(topic) {
17520
+ const sections = topic.subsections.map((subsection) => `## ${subsection.heading}\n\n${subsection.bullets.map((bullet) => `- ${bullet}`).join("\n")}\n`).join("\n");
17521
+ return `<!-- Generated by Agent Profile Compiler. Do not edit by hand. -->
17522
+
17523
+ # ${topic.tabnineTitle}
17524
+
17525
+ ${topic.intro}
17526
+
17527
+ ${sections}
17528
+ ${topic.tabnineChecklistReference}
17529
+ `;
17530
+ }
17531
+ function renderTopicAsAgentsMdSection(topic) {
17532
+ const subsections = topic.subsections.map((subsection) => `**${subsection.heading}**\n\n${subsection.bullets.map((bullet) => `- ${bullet}`).join("\n")}`).join("\n\n");
17533
+ return `## ${topic.agentsMdTitle}
17534
+
17535
+ ${topic.intro}
17536
+
17537
+ ${subsections}
17538
+
17539
+ ${topic.agentsMdChecklistReference}
17540
+ `;
17541
+ }
17542
+ //#endregion
17543
+ //#region ../../packages/compiler/src/compiler.ts
16662
17544
  var WORKFLOW_SKILLS = [
16663
17545
  {
16664
17546
  id: "sdd-change",
@@ -16671,6 +17553,10 @@ var WORKFLOW_SKILLS = [
16671
17553
  {
16672
17554
  id: "final-review",
16673
17555
  workflowFlag: "finalReview"
17556
+ },
17557
+ {
17558
+ id: "subagent-driven-change",
17559
+ workflowFlag: "subagentDrivenDevelopment"
16674
17560
  }
16675
17561
  ];
16676
17562
  var TEMPLATE_SOURCES = [
@@ -16680,6 +17566,10 @@ var TEMPLATE_SOURCES = [
16680
17566
  version: "1",
16681
17567
  source: renderAgentsMdTemplateSource()
16682
17568
  },
17569
+ agentsMdTopicTemplateSource("targets/agents-md/30-stack-typescript-react@1", REACT_STACK_TOPIC),
17570
+ agentsMdTopicTemplateSource("targets/agents-md/60-code-review@1", CODE_REVIEW_TOPIC),
17571
+ agentsMdTopicTemplateSource("targets/agents-md/70-refactoring@1", REFACTORING_TOPIC),
17572
+ agentsMdTopicTemplateSource("targets/agents-md/80-documentation@1", DOCUMENTATION_TOPIC),
16683
17573
  {
16684
17574
  id: "targets/lockfile@1",
16685
17575
  target: "lockfile",
@@ -16690,8 +17580,12 @@ var TEMPLATE_SOURCES = [
16690
17580
  guidelineTemplateSource("targets/tabnine-guidelines/10-sdd-workflow@1", renderSddWorkflowGuideline),
16691
17581
  guidelineTemplateSource("targets/tabnine-guidelines/20-tdd-workflow@1", renderTddWorkflowGuideline),
16692
17582
  guidelineTemplateSource("targets/tabnine-guidelines/30-stack-typescript-svelte@1", renderTypeScriptSvelteGuideline),
17583
+ guidelineTemplateSource("targets/tabnine-guidelines/30-stack-typescript-react@1", renderTypeScriptReactGuideline),
16693
17584
  guidelineTemplateSource("targets/tabnine-guidelines/40-stack-java-spring@1", renderJavaSpringGuideline),
16694
17585
  guidelineTemplateSource("targets/tabnine-guidelines/50-testing-playwright-junit@1", renderPlaywrightJunitGuideline),
17586
+ guidelineTemplateSource("targets/tabnine-guidelines/60-code-review@1", renderCodeReviewGuideline),
17587
+ guidelineTemplateSource("targets/tabnine-guidelines/70-refactoring@1", renderRefactoringGuideline),
17588
+ guidelineTemplateSource("targets/tabnine-guidelines/80-documentation@1", renderDocumentationGuideline),
16695
17589
  guidelineTemplateSource("targets/tabnine-guidelines/90-final-review@1", renderFinalReviewGuideline),
16696
17590
  {
16697
17591
  id: "targets/tabnine-mcp-config@1",
@@ -16706,8 +17600,9 @@ var TEMPLATE_SOURCES = [
16706
17600
  source: renderCodexConfigToml()
16707
17601
  },
16708
17602
  workflowSkillTemplateSource("targets/codex-workflow-skills/sdd-change@1", "codex-workflow-skills", "sdd-change"),
16709
- workflowSkillTemplateSource("targets/codex-workflow-skills/tdd-change@1", "codex-workflow-skills", "tdd-change"),
17603
+ workflowSkillTemplateSource("targets/codex-workflow-skills/tdd-change@2", "codex-workflow-skills", "tdd-change"),
16710
17604
  workflowSkillTemplateSource("targets/codex-workflow-skills/final-review@1", "codex-workflow-skills", "final-review"),
17605
+ workflowSkillTemplateSource("targets/codex-workflow-skills/subagent-driven-change@1", "codex-workflow-skills", "subagent-driven-change"),
16711
17606
  {
16712
17607
  id: "targets/claude-settings@1",
16713
17608
  target: "claude-settings",
@@ -16727,8 +17622,9 @@ var TEMPLATE_SOURCES = [
16727
17622
  source: renderClaudeMd()
16728
17623
  },
16729
17624
  workflowSkillTemplateSource("targets/claude-workflow-skills/sdd-change@1", "claude-workflow-skills", "sdd-change"),
16730
- workflowSkillTemplateSource("targets/claude-workflow-skills/tdd-change@1", "claude-workflow-skills", "tdd-change"),
16731
- workflowSkillTemplateSource("targets/claude-workflow-skills/final-review@1", "claude-workflow-skills", "final-review")
17625
+ workflowSkillTemplateSource("targets/claude-workflow-skills/tdd-change@2", "claude-workflow-skills", "tdd-change"),
17626
+ workflowSkillTemplateSource("targets/claude-workflow-skills/final-review@1", "claude-workflow-skills", "final-review"),
17627
+ workflowSkillTemplateSource("targets/claude-workflow-skills/subagent-driven-change@1", "claude-workflow-skills", "subagent-driven-change")
16732
17628
  ];
16733
17629
  function getDefaultTemplates() {
16734
17630
  return TEMPLATE_SOURCES.map(({ id, target, version, source }) => ({
@@ -16740,21 +17636,64 @@ function getDefaultTemplates() {
16740
17636
  }
16741
17637
  function compileProfile(request) {
16742
17638
  const targets = uniqueTargets(request.targets ?? getEnabledTargetIds(request.profile));
16743
- const templates = request.templates ?? getDefaultTemplates();
17639
+ const templates = request.templates ?? mergeTemplates(getDefaultTemplates(), getSubagentTemplates(request.profile));
16744
17640
  const issues = validateTargets(request.profile, targets, templates);
16745
17641
  if (issues.length > 0) return {
16746
17642
  ok: false,
16747
17643
  issues: issues.sort(compareIssues)
16748
17644
  };
17645
+ const files = targets.flatMap((target) => renderTarget(target, request.profile));
17646
+ const requiredTemplateIds = getRequiredTemplateIdSet(targets, request.profile);
16749
17647
  return {
16750
17648
  ok: true,
16751
- files: targets.flatMap((target) => renderTarget(target, request.profile)).sort(compareGeneratedFiles),
16752
- templates: templates.filter((template) => targets.includes(template.target)).sort(compareTemplates)
17649
+ files: files.sort(compareGeneratedFiles),
17650
+ templates: templates.filter((template) => requiredTemplateIds.has(template.id)).sort(compareTemplates)
16753
17651
  };
16754
17652
  }
17653
+ function mergeTemplates(base, extra) {
17654
+ const seen = new Set(base.map((template) => template.id));
17655
+ const result = [...base];
17656
+ for (const template of extra) if (!seen.has(template.id)) {
17657
+ seen.add(template.id);
17658
+ result.push(template);
17659
+ }
17660
+ return result.sort(compareTemplates);
17661
+ }
17662
+ function getSubagentTemplates(profile) {
17663
+ const agents = getEnabledSubagents(profile);
17664
+ if (agents.length === 0) return [];
17665
+ const effective = deriveEffectivePermissions(profile);
17666
+ const templates = [];
17667
+ if (profile.clients.claude.enabled) for (const agent of agents) templates.push({
17668
+ id: `targets/claude-subagents/${agent.name}@1`,
17669
+ target: "claude-subagents",
17670
+ version: "1",
17671
+ sha256: sha256Hex(normalizeGeneratedText(renderClaudeSubagent(agent, effective)))
17672
+ });
17673
+ if (profile.clients.codex.enabled) for (const agent of agents) templates.push({
17674
+ id: `targets/codex-subagents/${agent.name}@1`,
17675
+ target: "codex-subagents",
17676
+ version: "1",
17677
+ sha256: sha256Hex(normalizeGeneratedText(renderCodexSubagent(agent, effective)))
17678
+ });
17679
+ if (profile.clients.tabnine.enabled) for (const agent of agents) {
17680
+ if (agent.toolScope !== "read-only") continue;
17681
+ templates.push({
17682
+ id: `targets/tabnine-subagents/${agent.name}@1`,
17683
+ target: "tabnine-subagents",
17684
+ version: "1",
17685
+ sha256: sha256Hex(normalizeGeneratedText(renderTabnineSubagent(agent)))
17686
+ });
17687
+ }
17688
+ return templates;
17689
+ }
16755
17690
  function renderAgentsMd(profile) {
16756
17691
  const effectivePermissions = deriveEffectivePermissions(profile);
16757
17692
  const enabledClients = renderEnabledClients(profile);
17693
+ const reactSection = profile.stack.frameworks.includes("react") ? `\n${renderTopicAsAgentsMdSection(REACT_STACK_TOPIC)}` : "";
17694
+ const codeReviewSection = profile.workflow.codeReview === true ? `\n${renderTopicAsAgentsMdSection(CODE_REVIEW_TOPIC)}` : "";
17695
+ const refactoringSection = profile.workflow.refactoring === true ? `\n${renderTopicAsAgentsMdSection(REFACTORING_TOPIC)}` : "";
17696
+ const documentationSection = profile.workflow.documentation === true ? `\n${renderTopicAsAgentsMdSection(DOCUMENTATION_TOPIC)}` : "";
16758
17697
  return normalizeGeneratedText(`# AGENTS.md
16759
17698
 
16760
17699
  ## Project
@@ -16769,7 +17708,7 @@ Description: ${escapeMarkdownText(profile.profile.description)}
16769
17708
  - Frameworks: ${renderList(profile.stack.frameworks)}
16770
17709
  - Package managers: ${renderList(profile.stack.packageManagers)}
16771
17710
  - Testing: ${renderList(profile.stack.testing)}
16772
-
17711
+ ${reactSection}
16773
17712
  ## Enabled AI Clients
16774
17713
 
16775
17714
  ${enabledClients}
@@ -16779,7 +17718,7 @@ ${enabledClients}
16779
17718
  - SDD: ${renderRequired(profile.workflow.sdd)}
16780
17719
  - TDD: ${renderRequired(profile.workflow.tdd)}
16781
17720
  - Final implementation review: ${renderRequired(profile.workflow.finalReview)}
16782
-
17721
+ ${codeReviewSection}${refactoringSection}${documentationSection}
16783
17722
  ## Permissions
16784
17723
 
16785
17724
  | Permission | Mode |
@@ -16847,7 +17786,10 @@ function renderTarget(target, profile) {
16847
17786
  case "tabnine-guidelines": return renderTabnineGuidelines(profile);
16848
17787
  case "lockfile": return [];
16849
17788
  case "tabnine-mcp-config": return [createGeneratedTextFile(".tabnine/mcp_servers.json", "tabnine-mcp-config", "targets/tabnine-mcp-config@1", JSON.stringify({ mcpServers: {} }, null, 2))];
16850
- case "codex-config": return [createGeneratedTextFile(".codex/config.toml", "codex-config", "targets/codex-config@1", renderCodexConfigToml())];
17789
+ case "codex-config": return [createGeneratedTextFile(".codex/config.toml", "codex-config", "targets/codex-config@1", renderCodexConfigToml(profile))];
17790
+ case "codex-subagents": return renderCodexSubagentFiles(profile);
17791
+ case "claude-subagents": return renderClaudeSubagentFiles(profile);
17792
+ case "tabnine-subagents": return renderTabnineSubagentFiles(profile);
16851
17793
  case "codex-workflow-skills": return renderWorkflowSkillFiles(profile, "codex-workflow-skills", ".agents/skills");
16852
17794
  case "claude-settings": return [createGeneratedTextFile(".claude/settings.json", "claude-settings", "targets/claude-settings@1", renderClaudeSettingsJson())];
16853
17795
  case "claude-mcp": return [createGeneratedTextFile(".mcp.json", "claude-mcp", "targets/claude-mcp@1", JSON.stringify({ mcpServers: {} }, null, 2))];
@@ -16861,13 +17803,20 @@ function renderTabnineGuidelines(profile) {
16861
17803
  if (profile.workflow.sdd) files.push(createGeneratedTextFile(".tabnine/guidelines/10-sdd-workflow.md", common.target, "targets/tabnine-guidelines/10-sdd-workflow@1", renderSddWorkflowGuideline()));
16862
17804
  if (profile.workflow.tdd) files.push(createGeneratedTextFile(".tabnine/guidelines/20-tdd-workflow.md", common.target, "targets/tabnine-guidelines/20-tdd-workflow@1", renderTddWorkflowGuideline()));
16863
17805
  if (hasStack(profile, "languages", "typescript") && hasStack(profile, "frameworks", "sveltekit")) files.push(createGeneratedTextFile(".tabnine/guidelines/30-stack-typescript-svelte.md", common.target, "targets/tabnine-guidelines/30-stack-typescript-svelte@1", renderTypeScriptSvelteGuideline()));
17806
+ if (hasStack(profile, "frameworks", "react")) files.push(createGeneratedTextFile(".tabnine/guidelines/30-stack-typescript-react.md", common.target, "targets/tabnine-guidelines/30-stack-typescript-react@1", renderTypeScriptReactGuideline()));
16864
17807
  if (hasStack(profile, "languages", "java") && hasStack(profile, "frameworks", "spring-boot")) files.push(createGeneratedTextFile(".tabnine/guidelines/40-stack-java-spring.md", common.target, "targets/tabnine-guidelines/40-stack-java-spring@1", renderJavaSpringGuideline()));
16865
17808
  if (hasAnyStack(profile, "testing", ["playwright", "junit"])) files.push(createGeneratedTextFile(".tabnine/guidelines/50-testing-playwright-junit.md", common.target, "targets/tabnine-guidelines/50-testing-playwright-junit@1", renderPlaywrightJunitGuideline()));
17809
+ if (profile.workflow.codeReview === true) files.push(createGeneratedTextFile(".tabnine/guidelines/60-code-review.md", common.target, "targets/tabnine-guidelines/60-code-review@1", renderCodeReviewGuideline()));
17810
+ if (profile.workflow.refactoring === true) files.push(createGeneratedTextFile(".tabnine/guidelines/70-refactoring.md", common.target, "targets/tabnine-guidelines/70-refactoring@1", renderRefactoringGuideline()));
17811
+ if (profile.workflow.documentation === true) files.push(createGeneratedTextFile(".tabnine/guidelines/80-documentation.md", common.target, "targets/tabnine-guidelines/80-documentation@1", renderDocumentationGuideline()));
16866
17812
  if (profile.workflow.finalReview) files.push(createGeneratedTextFile(".tabnine/guidelines/90-final-review.md", common.target, "targets/tabnine-guidelines/90-final-review@1", renderFinalReviewGuideline()));
16867
17813
  return files;
16868
17814
  }
16869
17815
  function renderWorkflowSkillFiles(profile, target, rootPath) {
16870
- return WORKFLOW_SKILLS.filter((skill) => profile.workflow[skill.workflowFlag]).map((skill) => createGeneratedTextFile(`${rootPath}/${skill.id}/SKILL.md`, target, `targets/${target}/${skill.id}@1`, renderWorkflowSkill(skill.id)));
17816
+ return WORKFLOW_SKILLS.filter((skill) => profile.workflow[skill.workflowFlag]).map((skill) => createGeneratedTextFile(`${rootPath}/${skill.id}/SKILL.md`, target, getWorkflowSkillTemplateId(target, skill.id), renderWorkflowSkill(skill.id)));
17817
+ }
17818
+ function getWorkflowSkillTemplateId(target, skill) {
17819
+ return `targets/${target}/${skill}@${skill === "tdd-change" ? "2" : "1"}`;
16871
17820
  }
16872
17821
  function renderWorkflowSkill(skill) {
16873
17822
  switch (skill) {
@@ -16898,7 +17847,7 @@ description: Use when implementing a meaningful repository change that requires
16898
17847
  `;
16899
17848
  case "tdd-change": return `---
16900
17849
  name: tdd-change
16901
- description: Use when changing behavior where a focused failing test or golden fixture should lead the implementation.
17850
+ description: Use when changing behavior where a focused failing test or golden fixture must prove RED before implementation and GREEN after the minimal fix.
16902
17851
  ---
16903
17852
 
16904
17853
  <!-- Generated by Agent Profile Compiler. Do not edit by hand. -->
@@ -16908,11 +17857,24 @@ description: Use when changing behavior where a focused failing test or golden f
16908
17857
  ## Instructions
16909
17858
 
16910
17859
  1. Identify the smallest observable behavior covered by the approved spec.
16911
- 2. Add or update the focused failing test first when practical.
16912
- 3. For generated outputs, add or review the golden fixture intentionally.
16913
- 4. Implement the smallest change that satisfies the test and spec.
16914
- 5. Run the relevant test command and report any test that cannot be run.
16915
- 6. Do not update golden files only to hide an unexplained behavior change.
17860
+ 2. Add or update one focused failing test or golden fixture before changing behavior code.
17861
+ 3. Run the narrowest relevant test command and confirm RED: the test fails for the expected reason, not because of a typo, setup error, or unrelated failure.
17862
+ 4. Implement the smallest change that satisfies the failing test and the spec.
17863
+ 5. Run the same focused test command and confirm GREEN: the test passes without new warnings or unrelated failures.
17864
+ 6. Refactor only after GREEN, then rerun the focused test command.
17865
+ 7. Do not update golden files only to hide an unexplained behavior change.
17866
+
17867
+ ## Testing Anti-Patterns
17868
+
17869
+ - Do not assert on mock elements or mock call counts when a real behavior assertion is possible.
17870
+ - Do not add production methods, flags, or exports that exist only for tests.
17871
+ - Do not mock a dependency until you understand the side effects the test needs.
17872
+ - Keep test doubles structurally complete enough to match the real data shape consumed by the code.
17873
+ - If mock setup is larger than the behavior under test, consider a narrower integration test or a simpler production boundary.
17874
+
17875
+ ## Output
17876
+
17877
+ Report the RED command and expected failure, the GREEN command and passing result, any refactor rerun, and any TDD exception that required human approval.
16916
17878
 
16917
17879
  ## Safety
16918
17880
 
@@ -16941,6 +17903,55 @@ description: Use before handing off an implementation to compare the diff agains
16941
17903
  ## Output
16942
17904
 
16943
17905
  Return a concise final review with spec compliance, tests run, contract impact, security impact, and remaining risks.
17906
+ `;
17907
+ case "subagent-driven-change": return `---
17908
+ name: subagent-driven-change
17909
+ description: Use when a scoped implementation can be delegated to an implementation subagent and then independently reviewed for spec compliance before code quality.
17910
+ ---
17911
+
17912
+ <!-- Generated by Agent Profile Compiler. Do not edit by hand. -->
17913
+
17914
+ # Subagent-Driven Change
17915
+
17916
+ ## Preconditions
17917
+
17918
+ Use this workflow only when the task has a clear spec, acceptance criteria, and file ownership. Keep tightly coupled or architectural decisions in the parent session unless the user explicitly asks for delegation.
17919
+
17920
+ Required subagents: \`implementer\`, \`spec-reviewer\`, and \`code-quality-reviewer\`.
17921
+
17922
+ ## Fresh Context
17923
+
17924
+ Each subagent prompt must include the full task text, relevant spec excerpts, non-goals, acceptance criteria, file ownership, constraints, expected tests, and any command limits. Do not rely on hidden chat history or a previous subagent's memory.
17925
+
17926
+ ## Flow
17927
+
17928
+ 1. Dispatch \`implementer\` with one bounded task and the complete context it needs.
17929
+ 2. If \`implementer\` returns \`BLOCKED\` or \`NEEDS_CONTEXT\`, resolve that before continuing.
17930
+ 3. If \`implementer\` returns \`DONE_WITH_CONCERNS\`, read the concerns before review and decide whether to fix, narrow scope, or continue.
17931
+ 4. Dispatch \`spec-reviewer\` with the original task, relevant spec excerpts, changed files, and implementer report.
17932
+ 5. Fix or escalate every spec-review issue before requesting code-quality review.
17933
+ 6. Dispatch \`code-quality-reviewer\` only after spec review reports compliance.
17934
+ 7. Fix Critical and Important code-quality issues before handoff, or document why a finding is intentionally deferred.
17935
+ 8. Run the relevant tests, golden tests, and doctor/check commands required by the spec before final response.
17936
+
17937
+ ## Status Values
17938
+
17939
+ Implementation worker status values: \`DONE\`, \`DONE_WITH_CONCERNS\`, \`BLOCKED\`, \`NEEDS_CONTEXT\`.
17940
+
17941
+ Spec reviewer status values: \`COMPLIANT\`, \`ISSUES_FOUND\`, \`NEEDS_CONTEXT\`.
17942
+
17943
+ Code-quality reviewer status values: \`ACCEPTABLE\`, \`ISSUES_FOUND\`, \`NEEDS_CONTEXT\`.
17944
+
17945
+ ## Safety
17946
+
17947
+ - Do not ask subagents to commit, push, create branches, install dependencies, read secrets, contact production systems, or upload source unless the user explicitly requested that action.
17948
+ - Do not accept an implementation report without reading reviewer findings.
17949
+ - Do not run code-quality review before spec-compliance review passes.
17950
+ - Keep generated files deterministic and lockfile-tracked.
17951
+
17952
+ ## Output
17953
+
17954
+ Final handoff must list what changed, tests run, contract impact, security impact, remaining risks or TODOs, and whether the spec acceptance criteria are fully met.
16944
17955
  `;
16945
17956
  }
16946
17957
  }
@@ -17006,6 +18017,18 @@ Test-driven development is required for this project.
17006
18017
  - Do not update golden fixtures to hide an unexplained behavior change.
17007
18018
  `;
17008
18019
  }
18020
+ function renderTypeScriptReactGuideline() {
18021
+ return renderTopicAsTabnineGuideline(REACT_STACK_TOPIC);
18022
+ }
18023
+ function renderCodeReviewGuideline() {
18024
+ return renderTopicAsTabnineGuideline(CODE_REVIEW_TOPIC);
18025
+ }
18026
+ function renderRefactoringGuideline() {
18027
+ return renderTopicAsTabnineGuideline(REFACTORING_TOPIC);
18028
+ }
18029
+ function renderDocumentationGuideline() {
18030
+ return renderTopicAsTabnineGuideline(DOCUMENTATION_TOPIC);
18031
+ }
17009
18032
  function renderTypeScriptSvelteGuideline() {
17010
18033
  return `<!-- Generated by Agent Profile Compiler. Do not edit by hand. -->
17011
18034
 
@@ -17064,14 +18087,115 @@ Final implementation review is required for this project.
17064
18087
  - List remaining risks or TODOs before considering the task complete.
17065
18088
  `;
17066
18089
  }
17067
- function renderCodexConfigToml() {
17068
- return `approval_policy = "on-request"
18090
+ function renderCodexConfigToml(profile) {
18091
+ const base = `approval_policy = "on-request"
17069
18092
  sandbox_mode = "workspace-write"
17070
18093
  allow_login_shell = false
17071
18094
 
17072
18095
  [sandbox_workspace_write]
17073
18096
  network_access = false
17074
18097
  `;
18098
+ if (!profile || getEnabledSubagents(profile).length === 0) return base;
18099
+ const defaults = getSubagentDefaults(profile);
18100
+ return `${base}
18101
+ [agents]
18102
+ max_threads = ${defaults.maxConcurrent}
18103
+ max_depth = ${defaults.maxDepth}
18104
+ `;
18105
+ }
18106
+ function renderClaudeSubagentFiles(profile) {
18107
+ const agents = getEnabledSubagents(profile);
18108
+ const effective = deriveEffectivePermissions(profile);
18109
+ return agents.map((agent) => createGeneratedTextFile(`.claude/agents/${agent.name}.md`, "claude-subagents", `targets/claude-subagents/${agent.name}@1`, renderClaudeSubagent(agent, effective)));
18110
+ }
18111
+ function renderCodexSubagentFiles(profile) {
18112
+ const agents = getEnabledSubagents(profile);
18113
+ const effective = deriveEffectivePermissions(profile);
18114
+ return agents.map((agent) => createGeneratedTextFile(`.codex/agents/${agent.name}.toml`, "codex-subagents", `targets/codex-subagents/${agent.name}@1`, renderCodexSubagent(agent, effective)));
18115
+ }
18116
+ function renderTabnineSubagentFiles(profile) {
18117
+ return getEnabledSubagents(profile).filter((agent) => agent.toolScope === "read-only").map((agent) => createGeneratedTextFile(`.tabnine/agent/agents/${agent.name}.md`, "tabnine-subagents", `targets/tabnine-subagents/${agent.name}@1`, renderTabnineSubagent(agent)));
18118
+ }
18119
+ function titleCaseFromKebab(name) {
18120
+ return name.split("-").filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
18121
+ }
18122
+ function renderClaudeSubagent(agent, effective) {
18123
+ const lines = ["---", `name: ${yamlScalarSafe(agent.name)}`];
18124
+ lines.push(`description: ${yamlScalarSafe(agent.description)}`);
18125
+ if (agent.toolScope === "read-only") lines.push("tools: Read, Glob, Grep");
18126
+ else {
18127
+ const tools = [
18128
+ "Read",
18129
+ "Glob",
18130
+ "Grep"
18131
+ ];
18132
+ if (effective.filesystem.write === "allow") tools.push("Edit", "Write");
18133
+ if (effective.shell.run === "allow") tools.push("Bash");
18134
+ if (effective.network.external === "allow") tools.push("WebFetch");
18135
+ lines.push(`tools: ${tools.join(", ")}`);
18136
+ }
18137
+ const model = agent.modelPreference ?? "inherit";
18138
+ lines.push(`model: ${model === "inherit" ? "inherit" : "inherit"}`);
18139
+ if (agent.toolScope === "read-only") lines.push("permissionMode: plan");
18140
+ if (agent.maxTurns !== void 0) lines.push(`maxTurns: ${agent.maxTurns}`);
18141
+ lines.push("---", "");
18142
+ lines.push("<!-- Generated by Agent Profile Compiler. Do not edit by hand. -->");
18143
+ lines.push("");
18144
+ lines.push(`# ${titleCaseFromKebab(agent.name)}`);
18145
+ lines.push("");
18146
+ lines.push(agent.prompt.trim());
18147
+ lines.push("");
18148
+ return lines.join("\n");
18149
+ }
18150
+ function renderCodexSubagent(agent, effective) {
18151
+ const lines = [
18152
+ "# Generated by Agent Profile Compiler. Do not edit by hand.",
18153
+ "",
18154
+ `name = "${escapeTomlString(agent.name)}"`,
18155
+ `description = "${escapeTomlString(agent.description)}"`
18156
+ ];
18157
+ if (agent.toolScope === "workspace-write" && effective.filesystem.write !== "deny") lines.push(`sandbox_mode = "workspace-write"`);
18158
+ else lines.push(`sandbox_mode = "read-only"`);
18159
+ if (agent.prompt.includes(`"""`)) throw new Error(`Codex subagent ${agent.name} prompt contains a TOML triple-quote sequence; compile validation should have rejected this.`);
18160
+ lines.push("developer_instructions = \"\"\"");
18161
+ for (const promptLine of agent.prompt.trim().split(/\r?\n/u)) lines.push(promptLine);
18162
+ lines.push("\"\"\"");
18163
+ lines.push("");
18164
+ return lines.join("\n");
18165
+ }
18166
+ function renderTabnineSubagent(agent) {
18167
+ const lines = ["---", `name: ${yamlScalarSafe(agent.name)}`];
18168
+ lines.push(`description: ${yamlScalarSafe(agent.description)}`);
18169
+ lines.push("kind: local");
18170
+ lines.push("tools:");
18171
+ for (const tool of ["grep_search", "read_file"].sort()) lines.push(` - ${tool}`);
18172
+ if (agent.maxTurns !== void 0) lines.push(`max_turns: ${agent.maxTurns}`);
18173
+ if (agent.timeoutMinutes !== void 0) lines.push(`timeout_mins: ${agent.timeoutMinutes}`);
18174
+ lines.push("---", "");
18175
+ lines.push("<!-- Generated by Agent Profile Compiler. Do not edit by hand. -->");
18176
+ lines.push("");
18177
+ lines.push(`# ${titleCaseFromKebab(agent.name)}`);
18178
+ lines.push("");
18179
+ lines.push(agent.prompt.trim());
18180
+ lines.push("");
18181
+ return lines.join("\n");
18182
+ }
18183
+ function escapeTomlString(value) {
18184
+ return value.replace(/\\/gu, "\\\\").replace(/"/gu, "\\\"");
18185
+ }
18186
+ function yamlScalarSafe(value) {
18187
+ if (yamlScalarNeedsQuoting(value)) return JSON.stringify(value);
18188
+ return value;
18189
+ }
18190
+ function yamlScalarNeedsQuoting(value) {
18191
+ if (value.length === 0) return true;
18192
+ if (/[\r\n\t]/u.test(value)) return true;
18193
+ if (/^\s|\s$/u.test(value)) return true;
18194
+ if (/^[\-?:,\[\]{}#&*!|>'"%@`]/u.test(value)) return true;
18195
+ if (value.includes(": ") || value.includes(" #")) return true;
18196
+ if (/^(?:true|false|null|yes|no|on|off|~)$/iu.test(value)) return true;
18197
+ if (/^[+\-]?\d+(?:\.\d+)?(?:[eE][+\-]?\d+)?$/u.test(value)) return true;
18198
+ return false;
17075
18199
  }
17076
18200
  function renderAgentsMdTemplateSource() {
17077
18201
  return `# AGENTS.md
@@ -17110,6 +18234,14 @@ function guidelineTemplateSource(id, render) {
17110
18234
  source: render()
17111
18235
  };
17112
18236
  }
18237
+ function agentsMdTopicTemplateSource(id, topic) {
18238
+ return {
18239
+ id,
18240
+ target: "agents-md",
18241
+ version: "1",
18242
+ source: renderTopicAsAgentsMdSection(topic)
18243
+ };
18244
+ }
17113
18245
  function workflowSkillTemplateSource(id, target, skill) {
17114
18246
  return {
17115
18247
  id,
@@ -17148,9 +18280,19 @@ function renderClaudeSettingsJson() {
17148
18280
  }
17149
18281
  function getEnabledTargetIds(profile) {
17150
18282
  const targets = ["agents-md"];
17151
- if (profile.clients.tabnine.enabled) targets.push("tabnine-guidelines", "tabnine-mcp-config");
17152
- if (profile.clients.codex.enabled) targets.push("codex-config", "codex-workflow-skills");
17153
- if (profile.clients.claude.enabled) targets.push("claude-settings", "claude-mcp", "claude-md", "claude-workflow-skills");
18283
+ const subagentsEnabled = getEnabledSubagents(profile).length > 0;
18284
+ if (profile.clients.tabnine.enabled) {
18285
+ targets.push("tabnine-guidelines", "tabnine-mcp-config");
18286
+ if (subagentsEnabled) targets.push("tabnine-subagents");
18287
+ }
18288
+ if (profile.clients.codex.enabled) {
18289
+ targets.push("codex-config", "codex-workflow-skills");
18290
+ if (subagentsEnabled) targets.push("codex-subagents");
18291
+ }
18292
+ if (profile.clients.claude.enabled) {
18293
+ targets.push("claude-settings", "claude-mcp", "claude-md", "claude-workflow-skills");
18294
+ if (subagentsEnabled) targets.push("claude-subagents");
18295
+ }
17154
18296
  return targets;
17155
18297
  }
17156
18298
  function validateTargets(profile, targets, templates) {
@@ -17158,6 +18300,56 @@ function validateTargets(profile, targets, templates) {
17158
18300
  const templateIds = new Set(templates.map((template) => template.id));
17159
18301
  const enabledTargets = new Set(getEnabledTargetIds(profile));
17160
18302
  const issues = [];
18303
+ if (profile.workflow.subagentDrivenDevelopment === true) {
18304
+ const refs = new Set(getSubagentTemplateRefs(profile));
18305
+ const missing = SUBAGENT_TEMPLATE_NAMES.filter((name) => !refs.has(name));
18306
+ if (missing.length > 0) issues.push({
18307
+ code: "missing_required_template_reference",
18308
+ path: "/workflow/subagentDrivenDevelopment",
18309
+ expected: `useTemplate references for ${SUBAGENT_TEMPLATE_NAMES.join(", ")}`,
18310
+ actual: `missing ${missing.join(", ")}`,
18311
+ message: `workflow.subagentDrivenDevelopment requires capabilities.delegation.subagents.agents[].useTemplate references for ${missing.join(", ")}.`
18312
+ });
18313
+ }
18314
+ if (targets.includes("tabnine-subagents")) {
18315
+ const writeAgents = getEnabledSubagents(profile).filter((agent) => agent.toolScope === "workspace-write");
18316
+ for (const agent of writeAgents) issues.push({
18317
+ code: "unsafe_generated_content",
18318
+ path: `.tabnine/agent/agents/${agent.name}.md`,
18319
+ expected: "read-only Tabnine subagent",
18320
+ actual: "workspace-write Tabnine subagent",
18321
+ message: `tabnine-subagents cannot emit workspace-write agent ${agent.name} while Tabnine subagents are experimental/no-confirmation.`
18322
+ });
18323
+ }
18324
+ if (targets.includes("codex-subagents")) {
18325
+ const effective = deriveEffectivePermissions(profile);
18326
+ for (const agent of getEnabledSubagents(profile)) {
18327
+ if (agent.toolScope === "workspace-write" && effective.filesystem.write === "deny") issues.push({
18328
+ code: "unsafe_generated_content",
18329
+ path: `.codex/agents/${agent.name}.toml`,
18330
+ expected: "narrower than effectivePermissions",
18331
+ actual: "workspace-write subagent under filesystem.write=deny",
18332
+ message: `codex-subagents cannot emit workspace-write agent ${agent.name} because effectivePermissions.filesystem.write is deny.`
18333
+ });
18334
+ if (agent.prompt.includes(`"""`)) issues.push({
18335
+ code: "unsafe_generated_content",
18336
+ path: `.codex/agents/${agent.name}.toml`,
18337
+ expected: "prompt without TOML triple-quote sequence",
18338
+ actual: "prompt contains \"\"\" delimiter",
18339
+ message: `codex-subagents prompt for ${agent.name} contains a TOML triple-quote sequence that would break developer_instructions.`
18340
+ });
18341
+ }
18342
+ }
18343
+ if (targets.includes("claude-subagents")) {
18344
+ const effective = deriveEffectivePermissions(profile);
18345
+ for (const agent of getEnabledSubagents(profile)) if (agent.toolScope === "workspace-write" && effective.filesystem.write === "deny") issues.push({
18346
+ code: "unsafe_generated_content",
18347
+ path: `.claude/agents/${agent.name}.md`,
18348
+ expected: "narrower than effectivePermissions",
18349
+ actual: "workspace-write subagent under filesystem.write=deny",
18350
+ message: `claude-subagents cannot emit workspace-write agent ${agent.name} because effectivePermissions.filesystem.write is deny.`
18351
+ });
18352
+ }
17161
18353
  for (const target of targets) {
17162
18354
  if (!supportedTargets.has(target)) {
17163
18355
  issues.push({
@@ -17179,7 +18371,7 @@ function validateTargets(profile, targets, templates) {
17179
18371
  });
17180
18372
  continue;
17181
18373
  }
17182
- for (const templateId of getRequiredTemplateIds(target)) if (!templateIds.has(templateId)) issues.push({
18374
+ for (const templateId of getRequiredTemplateIds(target, profile)) if (!templateIds.has(templateId)) issues.push({
17183
18375
  code: "missing_template",
17184
18376
  path: target,
17185
18377
  expected: templateId,
@@ -17189,8 +18381,45 @@ function validateTargets(profile, targets, templates) {
17189
18381
  }
17190
18382
  return issues;
17191
18383
  }
17192
- function getRequiredTemplateIds(target) {
17193
- return TEMPLATE_SOURCES.filter((template) => template.target === target).map((template) => template.id);
18384
+ function getRequiredTemplateIdSet(targets, profile) {
18385
+ return new Set(targets.flatMap((target) => getRequiredTemplateIds(target, profile)));
18386
+ }
18387
+ function getRequiredTemplateIds(target, profile) {
18388
+ switch (target) {
18389
+ case "agents-md": return ["targets/agents-md@1", ...getRequiredAgentsMdTopicTemplateIds(profile)];
18390
+ case "tabnine-guidelines": return getRequiredTabnineGuidelineTemplateIds(profile);
18391
+ case "codex-workflow-skills": return getRequiredWorkflowSkillTemplateIds(profile, "codex-workflow-skills");
18392
+ case "claude-workflow-skills": return getRequiredWorkflowSkillTemplateIds(profile, "claude-workflow-skills");
18393
+ case "claude-subagents": return getEnabledSubagents(profile).map((agent) => `targets/claude-subagents/${agent.name}@1`);
18394
+ case "codex-subagents": return getEnabledSubagents(profile).map((agent) => `targets/codex-subagents/${agent.name}@1`);
18395
+ case "tabnine-subagents": return getEnabledSubagents(profile).filter((agent) => agent.toolScope === "read-only").map((agent) => `targets/tabnine-subagents/${agent.name}@1`);
18396
+ default: return TEMPLATE_SOURCES.filter((template) => template.target === target).map((template) => template.id);
18397
+ }
18398
+ }
18399
+ function getRequiredAgentsMdTopicTemplateIds(profile) {
18400
+ const ids = [];
18401
+ if (hasStack(profile, "frameworks", "react")) ids.push("targets/agents-md/30-stack-typescript-react@1");
18402
+ if (profile.workflow.codeReview === true) ids.push("targets/agents-md/60-code-review@1");
18403
+ if (profile.workflow.refactoring === true) ids.push("targets/agents-md/70-refactoring@1");
18404
+ if (profile.workflow.documentation === true) ids.push("targets/agents-md/80-documentation@1");
18405
+ return ids;
18406
+ }
18407
+ function getRequiredTabnineGuidelineTemplateIds(profile) {
18408
+ const ids = ["targets/tabnine-guidelines/00-general-agent-behavior@1"];
18409
+ if (profile.workflow.sdd) ids.push("targets/tabnine-guidelines/10-sdd-workflow@1");
18410
+ if (profile.workflow.tdd) ids.push("targets/tabnine-guidelines/20-tdd-workflow@1");
18411
+ if (hasStack(profile, "languages", "typescript") && hasStack(profile, "frameworks", "sveltekit")) ids.push("targets/tabnine-guidelines/30-stack-typescript-svelte@1");
18412
+ if (hasStack(profile, "frameworks", "react")) ids.push("targets/tabnine-guidelines/30-stack-typescript-react@1");
18413
+ if (hasStack(profile, "languages", "java") && hasStack(profile, "frameworks", "spring-boot")) ids.push("targets/tabnine-guidelines/40-stack-java-spring@1");
18414
+ if (hasAnyStack(profile, "testing", ["playwright", "junit"])) ids.push("targets/tabnine-guidelines/50-testing-playwright-junit@1");
18415
+ if (profile.workflow.codeReview === true) ids.push("targets/tabnine-guidelines/60-code-review@1");
18416
+ if (profile.workflow.refactoring === true) ids.push("targets/tabnine-guidelines/70-refactoring@1");
18417
+ if (profile.workflow.documentation === true) ids.push("targets/tabnine-guidelines/80-documentation@1");
18418
+ if (profile.workflow.finalReview) ids.push("targets/tabnine-guidelines/90-final-review@1");
18419
+ return ids;
18420
+ }
18421
+ function getRequiredWorkflowSkillTemplateIds(profile, target) {
18422
+ return WORKFLOW_SKILLS.filter((skill) => profile.workflow[skill.workflowFlag]).map((skill) => getWorkflowSkillTemplateId(target, skill.id));
17194
18423
  }
17195
18424
  function uniqueTargets(targets) {
17196
18425
  return Array.from(new Set(targets));
@@ -17227,6 +18456,101 @@ function compareIssues(left, right) {
17227
18456
  return compareText(left.path, right.path) || compareText(left.code, right.code) || compareText(left.message, right.message);
17228
18457
  }
17229
18458
  //#endregion
18459
+ //#region ../../packages/compiler/src/write-plan.ts
18460
+ function isContainedBy(rootPath, candidatePath) {
18461
+ const relative = path.relative(rootPath, candidatePath);
18462
+ return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
18463
+ }
18464
+ function isNodeError(error) {
18465
+ return error instanceof Error && "code" in error;
18466
+ }
18467
+ var PROFILE_FILENAME$1 = "ai-profile.yaml";
18468
+ var ProfileWriteError = class extends Error {
18469
+ code;
18470
+ constructor(code, message) {
18471
+ super(message);
18472
+ this.code = code;
18473
+ this.name = "ProfileWriteError";
18474
+ }
18475
+ };
18476
+ /**
18477
+ * Atomically write ai-profile.yaml after verifying:
18478
+ * - the target resolves within rootDir (path containment)
18479
+ * - the target is not a symlink
18480
+ * - the current on-disk ETag matches baseEtag (stale-check)
18481
+ *
18482
+ * Writes via temp-file + rename for atomicity.
18483
+ * Returns the new ETag of the written file.
18484
+ *
18485
+ * Phase 8 does NOT create a missing profile; callers must ensure the file
18486
+ * already exists.
18487
+ */
18488
+ async function writeProfileAtomic(rootDir, candidateBytes, baseEtag) {
18489
+ const rootRealPath = await fsPromises.realpath(path.resolve(rootDir));
18490
+ const targetAbsolute = path.join(rootRealPath, PROFILE_FILENAME$1);
18491
+ if (!isContainedBy(rootRealPath, targetAbsolute)) throw new ProfileWriteError("traversal", "Profile path escapes root.");
18492
+ let targetStat;
18493
+ try {
18494
+ targetStat = await fsPromises.lstat(targetAbsolute);
18495
+ } catch (err) {
18496
+ if (isNodeError(err) && err.code === "ENOENT") throw new ProfileWriteError("not_found", "ai-profile.yaml not found; run agent-profile init --write.");
18497
+ throw err;
18498
+ }
18499
+ if (targetStat.isSymbolicLink()) throw new ProfileWriteError("symlink", "ai-profile.yaml is a symlink; refusing to write.");
18500
+ const currentEtag = computeFileEtag(await fsPromises.readFile(targetAbsolute));
18501
+ if (currentEtag !== baseEtag) throw new ProfileWriteError("stale", "Profile has changed since last read; reload and retry.");
18502
+ const candidateEtag = computeFileEtag(candidateBytes);
18503
+ if (candidateEtag === currentEtag) return {
18504
+ action: "unchanged",
18505
+ bytes: candidateBytes.length,
18506
+ etag: candidateEtag
18507
+ };
18508
+ const tempName = `ai-profile.yaml.tmp-${randomBytes(8).toString("hex")}`;
18509
+ const tempAbsolute = path.join(rootRealPath, tempName);
18510
+ try {
18511
+ const fd = await fsPromises.open(tempAbsolute, "wx", 420);
18512
+ try {
18513
+ await fd.write(candidateBytes);
18514
+ await fd.sync();
18515
+ } finally {
18516
+ await fd.close();
18517
+ }
18518
+ await fsPromises.rename(tempAbsolute, targetAbsolute);
18519
+ await fsyncParentDirectory(rootRealPath);
18520
+ } catch (err) {
18521
+ try {
18522
+ await fsPromises.rm(tempAbsolute, { force: true });
18523
+ } catch {}
18524
+ throw err;
18525
+ }
18526
+ const writtenEtag = computeFileEtag(await fsPromises.readFile(targetAbsolute));
18527
+ if (writtenEtag !== candidateEtag) throw new ProfileWriteError("verify_failed", "Written bytes do not match expected hash.");
18528
+ return {
18529
+ action: "change",
18530
+ bytes: candidateBytes.length,
18531
+ etag: writtenEtag
18532
+ };
18533
+ }
18534
+ async function fsyncParentDirectory(directoryPath) {
18535
+ if (process.platform === "win32") return;
18536
+ let fd;
18537
+ try {
18538
+ fd = await fsPromises.open(directoryPath, "r");
18539
+ await fd.sync();
18540
+ } catch (err) {
18541
+ if (!isNodeError(err) || err.code !== "EINVAL" && err.code !== "EPERM") throw err;
18542
+ } finally {
18543
+ await fd?.close();
18544
+ }
18545
+ }
18546
+ /**
18547
+ * Compute an ETag for a file's bytes. Format: "sha256:<hex>".
18548
+ * Exposed so callers can compute the ETag for GET /api/profile responses.
18549
+ */
18550
+ function computeFileEtag(bytes) {
18551
+ return "sha256:" + createHash("sha256").update(bytes).digest("hex");
18552
+ }
18553
+ //#endregion
17230
18554
  //#region src/lib/server/projectContext.ts
17231
18555
  var PROFILE_FILENAME = "ai-profile.yaml";
17232
18556
  /**
@@ -17307,5 +18631,5 @@ function truncatePreview(text, capBytes = 256 * 1024) {
17307
18631
  };
17308
18632
  }
17309
18633
 
17310
- export { resolveProjectRoot as a, safeOutputPath as b, compileProfile as c, containsSecretLikeLiteral as d, createLockfileFile as e, deriveEffectivePermissions as f, loadProjectContext as l, normalizeSafety as n, parseProfileYaml as p, redactIfSecretLike as r, sha256Hex as s, truncatePreview as t, validateLockfileText as v };
17311
- //# sourceMappingURL=projectContext-C4-xYqFg.js.map
18634
+ export { ProfileWriteError as P, containsSecretLikeLiteral as a, createLockfileFile as b, compileProfile as c, deriveEffectivePermissions as d, sha256Hex as e, computeFileEtag as f, getEnabledSubagents as g, validateProfileValue as h, isSubagentBuiltinNameCollision as i, renderProfileYaml as j, redactIfSecretLike as k, loadProjectContext as l, normalizeSafety as n, parseProfileYaml as p, resolveProjectRoot as r, safeOutputPath as s, truncatePreview as t, validateLockfileText as v, writeProfileAtomic as w };
18635
+ //# sourceMappingURL=projectContext-fk5wtjwg.js.map