@shepai/cli 1.180.0 → 1.181.0-pr539.0993dc0

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 (316) hide show
  1. package/apis/json-schema/CavemanModeConfig.yaml +14 -0
  2. package/apis/json-schema/PhaseTiming.yaml +30 -0
  3. package/apis/json-schema/SubprocessFilterConfig.yaml +11 -0
  4. package/apis/json-schema/TokenOptimizationConfig.yaml +36 -0
  5. package/apis/json-schema/WorkflowConfig.yaml +9 -0
  6. package/dist/packages/core/src/application/ports/output/agents/agent-executor.interface.d.ts +8 -0
  7. package/dist/packages/core/src/application/ports/output/agents/agent-executor.interface.d.ts.map +1 -1
  8. package/dist/packages/core/src/application/ports/output/agents/phase-timing-repository.interface.d.ts +8 -1
  9. package/dist/packages/core/src/application/ports/output/agents/phase-timing-repository.interface.d.ts.map +1 -1
  10. package/dist/packages/core/src/application/ports/output/index.d.ts +1 -1
  11. package/dist/packages/core/src/application/ports/output/index.d.ts.map +1 -1
  12. package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.d.ts +45 -0
  13. package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.d.ts.map +1 -0
  14. package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.js +13 -0
  15. package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts +50 -0
  16. package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts.map +1 -0
  17. package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.js +13 -0
  18. package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts +57 -0
  19. package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts.map +1 -0
  20. package/dist/packages/core/src/application/ports/output/services/delta-context.interface.js +13 -0
  21. package/dist/packages/core/src/application/ports/output/services/index.d.ts +7 -0
  22. package/dist/packages/core/src/application/ports/output/services/index.d.ts.map +1 -1
  23. package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts +45 -0
  24. package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts.map +1 -0
  25. package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.js +13 -0
  26. package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts +86 -0
  27. package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts.map +1 -0
  28. package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.js +13 -0
  29. package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts +43 -0
  30. package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts.map +1 -0
  31. package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.js +13 -0
  32. package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts +41 -0
  33. package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts.map +1 -0
  34. package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.js +12 -0
  35. package/dist/packages/core/src/domain/factories/settings-defaults.factory.d.ts.map +1 -1
  36. package/dist/packages/core/src/domain/factories/settings-defaults.factory.js +21 -0
  37. package/dist/packages/core/src/domain/generated/output.d.ts +95 -0
  38. package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
  39. package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
  40. package/dist/packages/core/src/infrastructure/di/container.js +27 -0
  41. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +9 -0
  42. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
  43. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +68 -0
  44. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts +29 -0
  45. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts.map +1 -0
  46. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.js +77 -0
  47. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/056-add-caveman-mode-config.d.ts +21 -0
  48. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/056-add-caveman-mode-config.d.ts.map +1 -0
  49. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/056-add-caveman-mode-config.js +29 -0
  50. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/057-add-subprocess-filter-config.d.ts +17 -0
  51. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/057-add-subprocess-filter-config.d.ts.map +1 -0
  52. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/057-add-subprocess-filter-config.js +22 -0
  53. package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.d.ts +2 -1
  54. package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.d.ts.map +1 -1
  55. package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.js +72 -0
  56. package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.d.ts.map +1 -1
  57. package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.js +19 -3
  58. package/dist/packages/core/src/infrastructure/services/agents/analyze-repo/analyze-repository-graph.d.ts +1 -1
  59. package/dist/packages/core/src/infrastructure/services/agents/common/executors/claude-code-executor.service.d.ts.map +1 -1
  60. package/dist/packages/core/src/infrastructure/services/agents/common/executors/claude-code-executor.service.js +9 -0
  61. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/caveman-directive.d.ts +41 -0
  62. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/caveman-directive.d.ts.map +1 -0
  63. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/caveman-directive.js +51 -0
  64. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts +6 -1
  65. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts.map +1 -1
  66. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts +18 -1
  67. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts.map +1 -1
  68. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.d.ts.map +1 -1
  69. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.js +6 -0
  70. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.d.ts.map +1 -1
  71. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.js +2 -2
  72. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/fast-implement.node.d.ts.map +1 -1
  73. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/fast-implement.node.js +3 -2
  74. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.d.ts.map +1 -1
  75. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.js +5 -4
  76. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/merge.node.d.ts.map +1 -1
  77. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/merge.node.js +3 -4
  78. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts +27 -0
  79. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -1
  80. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +71 -1
  81. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts +42 -0
  82. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts.map +1 -0
  83. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.js +92 -0
  84. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts +1 -0
  85. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts.map +1 -1
  86. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.js +5 -0
  87. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/subprocess-filter-context.d.ts +25 -0
  88. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/subprocess-filter-context.d.ts.map +1 -0
  89. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/subprocess-filter-context.js +67 -0
  90. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/generic-filter.d.ts +13 -0
  91. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/generic-filter.d.ts.map +1 -0
  92. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/generic-filter.js +21 -0
  93. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/git-filter.d.ts +15 -0
  94. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/git-filter.d.ts.map +1 -0
  95. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/git-filter.js +189 -0
  96. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/npm-filter.d.ts +13 -0
  97. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/npm-filter.d.ts.map +1 -0
  98. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/npm-filter.js +96 -0
  99. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/shared-helpers.d.ts +29 -0
  100. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/shared-helpers.d.ts.map +1 -0
  101. package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/shared-helpers.js +85 -0
  102. package/dist/packages/core/src/infrastructure/services/subprocess-filter/shep-filter.d.ts +27 -0
  103. package/dist/packages/core/src/infrastructure/services/subprocess-filter/shep-filter.d.ts.map +1 -0
  104. package/dist/packages/core/src/infrastructure/services/subprocess-filter/shep-filter.js +89 -0
  105. package/dist/packages/core/src/infrastructure/services/subprocess-filter/shim-generator.d.ts +39 -0
  106. package/dist/packages/core/src/infrastructure/services/subprocess-filter/shim-generator.d.ts.map +1 -0
  107. package/dist/packages/core/src/infrastructure/services/subprocess-filter/shim-generator.js +53 -0
  108. package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts +41 -0
  109. package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts.map +1 -0
  110. package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.js +111 -0
  111. package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts +22 -0
  112. package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts.map +1 -0
  113. package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.js +245 -0
  114. package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts +22 -0
  115. package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts.map +1 -0
  116. package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.js +50 -0
  117. package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts +36 -0
  118. package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts.map +1 -0
  119. package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.js +123 -0
  120. package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts +57 -0
  121. package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts.map +1 -0
  122. package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.js +241 -0
  123. package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts +34 -0
  124. package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts.map +1 -0
  125. package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.js +190 -0
  126. package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts +26 -0
  127. package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts.map +1 -0
  128. package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.js +51 -0
  129. package/dist/tsconfig.build.tsbuildinfo +1 -1
  130. package/package.json +1 -1
  131. package/web/.next/BUILD_ID +1 -1
  132. package/web/.next/build-manifest.json +2 -2
  133. package/web/.next/fallback-build-manifest.json +2 -2
  134. package/web/.next/prerender-manifest.json +3 -3
  135. package/web/.next/required-server-files.js +3 -3
  136. package/web/.next/required-server-files.json +3 -3
  137. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +32 -32
  138. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  139. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  140. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +30 -30
  141. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  142. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  143. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +33 -33
  144. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  145. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  146. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  147. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  148. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  149. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +41 -41
  150. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  151. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  152. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  153. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  154. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  155. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  156. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  157. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  158. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +30 -30
  159. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  160. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  161. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +33 -33
  162. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  163. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  164. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  165. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  166. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  167. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +41 -41
  168. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  169. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  170. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +30 -30
  171. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  172. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  173. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  174. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  175. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  176. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  177. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  178. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  179. package/web/.next/server/app/_global-error.html +2 -2
  180. package/web/.next/server/app/_global-error.rsc +1 -1
  181. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  182. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  183. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  184. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  185. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  186. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +7 -7
  187. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  188. package/web/.next/server/app/application/[id]/page/server-reference-manifest.json +15 -15
  189. package/web/.next/server/app/application/[id]/page.js.nft.json +1 -1
  190. package/web/.next/server/app/application/[id]/page_client-reference-manifest.js +1 -1
  191. package/web/.next/server/app/features/page/server-reference-manifest.json +7 -7
  192. package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
  193. package/web/.next/server/app/settings/page/server-reference-manifest.json +10 -10
  194. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  195. package/web/.next/server/app/skills/page/server-reference-manifest.json +15 -15
  196. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  197. package/web/.next/server/app/tools/page/server-reference-manifest.json +13 -13
  198. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  199. package/web/.next/server/app/version/page/server-reference-manifest.json +7 -7
  200. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  201. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  202. package/web/.next/server/chunks/[root-of-the-server]__b2a4bfcc._.js.map +1 -1
  203. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
  204. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  205. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  206. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
  207. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
  208. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js +1 -1
  209. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js.map +1 -1
  210. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js +1 -1
  211. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js.map +1 -1
  212. package/web/.next/server/chunks/ssr/[root-of-the-server]__1925bef0._.js +1 -1
  213. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js +1 -1
  214. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js.map +1 -1
  215. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js +2 -2
  216. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js.map +1 -1
  217. package/web/.next/server/chunks/ssr/[root-of-the-server]__4ee8be85._.js +1 -1
  218. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js +1 -1
  219. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js.map +1 -1
  220. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js +1 -1
  221. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js.map +1 -1
  222. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js +1 -1
  223. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js.map +1 -1
  224. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js +1 -1
  225. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js.map +1 -1
  226. package/web/.next/server/chunks/ssr/[root-of-the-server]__e265da61._.js +1 -1
  227. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js +1 -1
  228. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js.map +1 -1
  229. package/web/.next/server/chunks/ssr/_0277d3b5._.js +1 -1
  230. package/web/.next/server/chunks/ssr/_0277d3b5._.js.map +1 -1
  231. package/web/.next/server/chunks/ssr/_295fffde._.js.map +1 -1
  232. package/web/.next/server/chunks/ssr/_45496654._.js.map +1 -1
  233. package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
  234. package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
  235. package/web/.next/server/chunks/ssr/{_8caadb9a._.js → _688e1fd9._.js} +2 -2
  236. package/web/.next/server/chunks/ssr/{_8caadb9a._.js.map → _688e1fd9._.js.map} +1 -1
  237. package/web/.next/server/chunks/ssr/_7931d3de._.js +3 -0
  238. package/web/.next/server/chunks/ssr/{_36489f2b._.js.map → _7931d3de._.js.map} +1 -1
  239. package/web/.next/server/chunks/ssr/_946a7fc6._.js +1 -1
  240. package/web/.next/server/chunks/ssr/_946a7fc6._.js.map +1 -1
  241. package/web/.next/server/chunks/ssr/{_d44d091a._.js → _bd8c6d0b._.js} +2 -2
  242. package/web/.next/server/chunks/ssr/{_d44d091a._.js.map → _bd8c6d0b._.js.map} +1 -1
  243. package/web/.next/server/chunks/ssr/{_63fc4647._.js → _ce7571dd._.js} +2 -2
  244. package/web/.next/server/chunks/ssr/{_63fc4647._.js.map → _ce7571dd._.js.map} +1 -1
  245. package/web/.next/server/chunks/ssr/_eff1b518._.js +1 -1
  246. package/web/.next/server/chunks/ssr/_eff1b518._.js.map +1 -1
  247. package/web/.next/server/chunks/ssr/_f227429a._.js +1 -1
  248. package/web/.next/server/chunks/ssr/_f227429a._.js.map +1 -1
  249. package/web/.next/server/chunks/ssr/_f5a56a3f._.js +3 -0
  250. package/web/.next/server/chunks/ssr/{_b8e8b690._.js.map → _f5a56a3f._.js.map} +1 -1
  251. package/web/.next/server/chunks/ssr/_f86fc1bf._.js +1 -1
  252. package/web/.next/server/chunks/ssr/_f86fc1bf._.js.map +1 -1
  253. package/web/.next/server/chunks/ssr/_f8c55130._.js +1 -1
  254. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  255. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  256. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
  257. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js +1 -1
  258. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js.map +1 -1
  259. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js +1 -1
  260. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js.map +1 -1
  261. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js +1 -1
  262. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js.map +1 -1
  263. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js +1 -1
  264. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js.map +1 -1
  265. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js +1 -1
  266. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js.map +1 -1
  267. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js +1 -1
  268. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js.map +1 -1
  269. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js +1 -1
  270. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js.map +1 -1
  271. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js +1 -1
  272. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js.map +1 -1
  273. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js +1 -1
  274. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js.map +1 -1
  275. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +3 -3
  276. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js +1 -1
  277. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js.map +1 -1
  278. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
  279. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
  280. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js +1 -1
  281. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js.map +1 -1
  282. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  283. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  284. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
  285. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
  286. package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js +1 -1
  287. package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js.map +1 -1
  288. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js +1 -1
  289. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js.map +1 -1
  290. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js +1 -1
  291. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js.map +1 -1
  292. package/web/.next/server/pages/500.html +2 -2
  293. package/web/.next/server/server-reference-manifest.js +1 -1
  294. package/web/.next/server/server-reference-manifest.json +54 -54
  295. package/web/.next/static/chunks/{f6d47ff35d612852.js → 2bba4ee52a6464cd.js} +3 -3
  296. package/web/.next/static/chunks/4371be9a949c8fe0.js +1 -0
  297. package/web/.next/static/chunks/{490667b2a9bb58e2.js → 46bc202f80905332.js} +1 -1
  298. package/web/.next/static/chunks/{26e2ca76ab6c38b4.js → 51593e45475cb81d.js} +1 -1
  299. package/web/.next/static/chunks/{c0bd3ffcf94d1845.js → 75d1485ec29b8fd8.js} +1 -1
  300. package/web/.next/static/chunks/{e7da54dde18e7fb2.js → aba1ec85581d3f1b.js} +1 -1
  301. package/web/.next/static/chunks/{e2f9e224d1fa1faa.js → abc53f1cc59f4642.js} +1 -1
  302. package/web/.next/static/chunks/{a1098522326428d1.js → ac069319b2aeab27.js} +1 -1
  303. package/web/.next/static/chunks/{1fa1574b87bd2eb1.js → b5aadaa3b34d7b8e.js} +1 -1
  304. package/web/.next/static/chunks/{dfdcccf73de56960.js → b7e697748c35a4ce.js} +1 -1
  305. package/web/.next/static/chunks/{7849c6797be7c6ca.js → b9135c0d88735f54.js} +2 -2
  306. package/web/.next/static/chunks/{893a2a76546c66a7.js → c6b5b3f46622241d.js} +1 -1
  307. package/web/.next/static/chunks/{f28aef9cf5107c4b.js → c9c58949bf064dbe.js} +1 -1
  308. package/web/.next/static/chunks/{be89c20c257247ad.js → cbf7498ef586ebd3.js} +1 -1
  309. package/web/.next/static/chunks/{8746807722de67a8.js → d9f55661eb505770.js} +1 -1
  310. package/web/.next/static/chunks/{7bc7028587490fff.js → e3d4828e3b7291df.js} +1 -1
  311. package/web/.next/server/chunks/ssr/_36489f2b._.js +0 -3
  312. package/web/.next/server/chunks/ssr/_b8e8b690._.js +0 -3
  313. package/web/.next/static/chunks/1bc12075020723ed.js +0 -1
  314. /package/web/.next/static/{GQFJf3UCD4D5C4NCn8eXl → 73VlrUiVfmfr0uTiP1eN1}/_buildManifest.js +0 -0
  315. /package/web/.next/static/{GQFJf3UCD4D5C4NCn8eXl → 73VlrUiVfmfr0uTiP1eN1}/_clientMiddlewareManifest.json +0 -0
  316. /package/web/.next/static/{GQFJf3UCD4D5C4NCn8eXl → 73VlrUiVfmfr0uTiP1eN1}/_ssgManifest.js +0 -0
@@ -56,6 +56,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
56
56
  ciFixAttempts: number;
57
57
  ciFixHistory: import("../../../../domain/index.js").CiFixRecord[];
58
58
  ciFixStatus: "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted";
59
+ specFileHashes: Record<string, string>;
59
60
  }, {
60
61
  featureId?: string | undefined;
61
62
  repositoryPath?: string | undefined;
@@ -89,7 +90,8 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
89
90
  ciFixAttempts?: number | undefined;
90
91
  ciFixHistory?: import("../../../../domain/index.js").CiFixRecord[] | undefined;
91
92
  ciFixStatus?: "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted" | undefined;
92
- }, "implement" | "__start__" | "analyze" | "requirements" | "research" | "plan" | "validate_spec_analyze" | "validate_spec_requirements" | "validate_research" | "validate_plan_tasks" | "repair_spec_analyze" | "repair_spec_requirements" | "repair_research" | "repair_plan_tasks", {
93
+ specFileHashes?: Record<string, string> | undefined;
94
+ }, "analyze" | "requirements" | "research" | "plan" | "implement" | "__start__" | "validate_spec_analyze" | "validate_spec_requirements" | "validate_research" | "validate_plan_tasks" | "repair_spec_analyze" | "repair_spec_requirements" | "repair_research" | "repair_plan_tasks", {
93
95
  featureId: {
94
96
  (): import("@langchain/langgraph").LastValue<string>;
95
97
  (annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
@@ -142,6 +144,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
142
144
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
143
145
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
144
146
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
147
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
145
148
  }, {
146
149
  featureId: {
147
150
  (): import("@langchain/langgraph").LastValue<string>;
@@ -195,6 +198,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
195
198
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
196
199
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
197
200
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
201
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
198
202
  }, import("@langchain/langgraph").StateDefinition, {
199
203
  analyze: Partial<import("@langchain/langgraph").StateType<{
200
204
  featureId: {
@@ -249,6 +253,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
249
253
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
250
254
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
251
255
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
256
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
252
257
  }>>;
253
258
  requirements: Partial<import("@langchain/langgraph").StateType<{
254
259
  featureId: {
@@ -303,6 +308,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
303
308
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
304
309
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
305
310
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
311
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
306
312
  }>>;
307
313
  research: Partial<import("@langchain/langgraph").StateType<{
308
314
  featureId: {
@@ -357,6 +363,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
357
363
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
358
364
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
359
365
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
366
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
360
367
  }>>;
361
368
  plan: Partial<import("@langchain/langgraph").StateType<{
362
369
  featureId: {
@@ -411,6 +418,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
411
418
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
412
419
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
413
420
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
421
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
414
422
  }>>;
415
423
  implement: Partial<import("@langchain/langgraph").StateType<{
416
424
  featureId: {
@@ -465,6 +473,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
465
473
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
466
474
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
467
475
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
476
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
468
477
  }>>;
469
478
  validate_spec_analyze: Partial<import("@langchain/langgraph").StateType<{
470
479
  featureId: {
@@ -519,6 +528,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
519
528
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
520
529
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
521
530
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
531
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
522
532
  }>>;
523
533
  validate_spec_requirements: Partial<import("@langchain/langgraph").StateType<{
524
534
  featureId: {
@@ -573,6 +583,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
573
583
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
574
584
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
575
585
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
586
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
576
587
  }>>;
577
588
  validate_research: Partial<import("@langchain/langgraph").StateType<{
578
589
  featureId: {
@@ -627,6 +638,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
627
638
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
628
639
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
629
640
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
641
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
630
642
  }>>;
631
643
  validate_plan_tasks: Partial<import("@langchain/langgraph").StateType<{
632
644
  featureId: {
@@ -681,6 +693,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
681
693
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
682
694
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
683
695
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
696
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
684
697
  }>>;
685
698
  repair_spec_analyze: Partial<import("@langchain/langgraph").StateType<{
686
699
  featureId: {
@@ -735,6 +748,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
735
748
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
736
749
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
737
750
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
751
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
738
752
  }>>;
739
753
  repair_spec_requirements: Partial<import("@langchain/langgraph").StateType<{
740
754
  featureId: {
@@ -789,6 +803,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
789
803
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
790
804
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
791
805
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
806
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
792
807
  }>>;
793
808
  repair_research: Partial<import("@langchain/langgraph").StateType<{
794
809
  featureId: {
@@ -843,6 +858,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
843
858
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
844
859
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
845
860
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
861
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
846
862
  }>>;
847
863
  repair_plan_tasks: Partial<import("@langchain/langgraph").StateType<{
848
864
  featureId: {
@@ -897,6 +913,7 @@ export declare function createFeatureAgentGraph(depsOrExecutor: FeatureAgentGrap
897
913
  ciFixAttempts: import("@langchain/langgraph").BinaryOperatorAggregate<number, number>;
898
914
  ciFixHistory: import("@langchain/langgraph").BinaryOperatorAggregate<import("../../../../domain/index.js").CiFixRecord[], import("../../../../domain/index.js").CiFixRecord[]>;
899
915
  ciFixStatus: import("@langchain/langgraph").BinaryOperatorAggregate<"success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted", "success" | "timeout" | "idle" | "watching" | "fixing" | "exhausted">;
916
+ specFileHashes: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, string>, Record<string, string>>;
900
917
  }>>;
901
918
  }, unknown, unknown>;
902
919
  //# sourceMappingURL=feature-agent-graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-agent-graph.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AAOpG,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAelF,OAAO,EAAE,sBAAsB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsFnC"}
1
+ {"version":3,"file":"feature-agent-graph.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AAOpG,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAelF,OAAO,EAAE,sBAAsB,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;CACjD;AAwJD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,qBAAqB,GAAG,cAAc,EACtD,YAAY,CAAC,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsFnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature-agent-worker.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,kBAAkB,CAAC;AAiB1B,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAW7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAkF1D;AAgCD;;;GAGG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAiU/D"}
1
+ {"version":3,"file":"feature-agent-worker.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,kBAAkB,CAAC;AAiB1B,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAc7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAkF1D;AAgCD;;;GAGG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA8U/D"}
@@ -22,6 +22,7 @@ import { initializeSettings } from '../../../services/settings.service.js';
22
22
  import { InitializeSettingsUseCase } from '../../../../application/use-cases/settings/initialize-settings.use-case.js';
23
23
  import { setHeartbeatContext } from './heartbeat.js';
24
24
  import { setPhaseTimingContext, recordLifecycleEvent } from './phase-timing-context.js';
25
+ import { setPromptOptimizationContext } from './prompt-optimization-context.js';
25
26
  import { setLifecycleContext } from './lifecycle-context.js';
26
27
  import { setLogPrefix, getLogPrefix } from './log-context.js';
27
28
  import { UpdateFeatureLifecycleUseCase } from '../../../../application/use-cases/features/update/update-feature-lifecycle.use-case.js';
@@ -230,6 +231,11 @@ export async function runWorker(args) {
230
231
  // Set phase timing context so executeNode() records per-phase durations
231
232
  const timingRepository = container.resolve('IPhaseTimingRepository');
232
233
  setPhaseTimingContext(args.runId, timingRepository);
234
+ // Set prompt optimization context so executeNode() can run the
235
+ // token-optimization layer between buildPrompt() and executor.execute().
236
+ const promptOptimizer = container.resolve('IPromptOptimizerService');
237
+ const optimizationMetricsService = container.resolve('IOptimizationMetricsService');
238
+ setPromptOptimizationContext(promptOptimizer, optimizationMetricsService, args.runId, args.featureId);
233
239
  // Capture repos for SIGTERM handler
234
240
  runRepoForSignal = runRepository;
235
241
  timingRepoForSignal = timingRepository;
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.node.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AAEpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAqDrD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,IAG3C,OAAO,iBAAiB,KAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CA2J7E"}
1
+ {"version":3,"file":"evidence.node.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AAEpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAqDrD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,IAG3C,OAAO,iBAAiB,KAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAmK7E"}
@@ -22,7 +22,7 @@
22
22
  */
23
23
  import yaml from 'js-yaml';
24
24
  import { isGraphBubbleUp } from '@langchain/langgraph';
25
- import { createNodeLogger, getCompletedPhases, markPhaseComplete, readSpecFile, retryExecute, buildExecutorOptions, saveEvidenceManifest, } from './node-helpers.js';
25
+ import { createNodeLogger, getCompletedPhases, markPhaseComplete, readSpecFile, optimizeAndExecute, buildExecutorOptions, saveEvidenceManifest, } from './node-helpers.js';
26
26
  import { reportNodeStart } from '../heartbeat.js';
27
27
  import { recordPhaseStart, recordPhaseEnd } from '../phase-timing-context.js';
28
28
  import { updateNodeLifecycle } from '../lifecycle-context.js';
@@ -107,7 +107,7 @@ export function createEvidenceNode(executor) {
107
107
  });
108
108
  try {
109
109
  log.info(`Attempt ${attempt}/${maxRetries}: executing agent at cwd=${options.cwd}`);
110
- const result = await retryExecute(executor, prompt, options, { logger: log });
110
+ const { result } = await optimizeAndExecute(executor, `evidence:attempt-${attempt}`, prompt, options, state, timingId, { logger: log });
111
111
  const durationMs = Date.now() - attemptStart;
112
112
  const elapsed = (durationMs / 1000).toFixed(1);
113
113
  log.info(`Attempt ${attempt}: agent complete (${result.result.length} chars, ${elapsed}s)`);
@@ -1 +1 @@
1
- {"version":3,"file":"fast-implement.node.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/fast-implement.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAcrD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,IAGhD,OAAO,iBAAiB,KAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CA6F7E"}
1
+ {"version":3,"file":"fast-implement.node.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/fast-implement.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAcrD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,IAGhD,OAAO,iBAAiB,KAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAsG7E"}
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { execSync } from 'node:child_process';
13
13
  import { isGraphBubbleUp } from '@langchain/langgraph';
14
- import { createNodeLogger, buildExecutorOptions, retryExecute, getCompletedPhases, markPhaseComplete, } from './node-helpers.js';
14
+ import { createNodeLogger, buildExecutorOptions, optimizeAndExecute, getCompletedPhases, markPhaseComplete, } from './node-helpers.js';
15
15
  import { reportNodeStart } from '../heartbeat.js';
16
16
  import { recordPhaseStart, recordPhaseEnd } from '../phase-timing-context.js';
17
17
  import { updateNodeLifecycle } from '../lifecycle-context.js';
@@ -51,7 +51,7 @@ export function createFastImplementNode(executor) {
51
51
  const options = buildExecutorOptions(state, undefined, 'fast-implement');
52
52
  log.info(`Executing agent at cwd=${options.cwd}`);
53
53
  log.info(`Prompt length: ${prompt.length} chars`);
54
- const result = await retryExecute(executor, prompt, options, { logger: log });
54
+ const { result, specFileHashes } = await optimizeAndExecute(executor, 'fast-implement', prompt, options, state, timingId, { logger: log });
55
55
  const durationMs = Date.now() - startTime;
56
56
  const elapsed = (durationMs / 1000).toFixed(1);
57
57
  log.info(`Complete (${result.result.length} chars, ${elapsed}s)`);
@@ -90,6 +90,7 @@ export function createFastImplementNode(executor) {
90
90
  `[fast-implement] Evidence: ${evidence.length} record(s) captured`,
91
91
  ],
92
92
  _needsReexecution: false,
93
+ specFileHashes,
93
94
  };
94
95
  }
95
96
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"implement.node.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAoErD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,IAG5C,OAAO,iBAAiB,KAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAiQ7E"}
1
+ {"version":3,"file":"implement.node.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAoErD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,IAG5C,OAAO,iBAAiB,KAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAkR7E"}
@@ -10,7 +10,7 @@ import yaml from 'js-yaml';
10
10
  import { writeFileSync } from 'node:fs';
11
11
  import { join } from 'node:path';
12
12
  import { interrupt, isGraphBubbleUp } from '@langchain/langgraph';
13
- import { createNodeLogger, readSpecFile, buildExecutorOptions, shouldInterrupt, safeYamlLoad, safeYamlDump, retryExecute, getCompletedPhases, markPhaseComplete, } from './node-helpers.js';
13
+ import { createNodeLogger, readSpecFile, buildExecutorOptions, shouldInterrupt, safeYamlLoad, safeYamlDump, optimizeAndExecute, getCompletedPhases, markPhaseComplete, } from './node-helpers.js';
14
14
  import { reportNodeStart } from '../heartbeat.js';
15
15
  import { recordPhaseStart, recordPhaseEnd, recordApprovalWaitStart, updatePhasePrompt, } from '../phase-timing-context.js';
16
16
  import { updateNodeLifecycle } from '../lifecycle-context.js';
@@ -137,10 +137,11 @@ export function createImplementNode(executor) {
137
137
  return buildImplementPhasePrompt(state, singleTaskPhase, [task], promptContext);
138
138
  });
139
139
  await updatePhasePrompt(phaseTimingId, taskPrompts.join('\n\n---\n\n'));
140
- const results = await Promise.all(phaseTasks.map((task, idx) => {
140
+ const optimizedParallel = await Promise.all(phaseTasks.map((task, idx) => {
141
141
  log.info(` [parallel] Task ${task.id}: "${task.title}" — ${taskPrompts[idx].length} chars`);
142
- return retryExecute(executor, taskPrompts[idx], options, retryOpts);
142
+ return optimizeAndExecute(executor, `implement:${phase.id}`, taskPrompts[idx], options, state, phaseTimingId, retryOpts);
143
143
  }));
144
+ const results = optimizedParallel.map((o) => o.result);
144
145
  for (let j = 0; j < results.length; j++) {
145
146
  log.info(` [parallel] Task ${phaseTasks[j].id} complete (${results[j].result.length} chars)`);
146
147
  phaseInputTokens += results[j].usage?.inputTokens ?? 0;
@@ -155,7 +156,7 @@ export function createImplementNode(executor) {
155
156
  const prompt = buildImplementPhasePrompt(state, phase, phaseTasks, promptContext);
156
157
  await updatePhasePrompt(phaseTimingId, prompt);
157
158
  log.info(`Executing phase prompt — ${prompt.length} chars`);
158
- const result = await retryExecute(executor, prompt, options, retryOpts);
159
+ const { result } = await optimizeAndExecute(executor, `implement:${phase.id}`, prompt, options, state, phaseTimingId, retryOpts);
159
160
  log.info(`Phase complete (${result.result.length} chars)`);
160
161
  phaseInputTokens = result.usage?.inputTokens ?? 0;
161
162
  phaseOutputTokens = result.usage?.outputTokens ?? 0;
@@ -1 +1 @@
1
- {"version":3,"file":"merge.node.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/merge.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yEAAyE,CAAC;AAClH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACd,MAAM,iEAAiE,CAAC;AAwBzE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uEAAuE,CAAC;AAC3H,OAAO,KAAK,EAAE,eAAe,EAAE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,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,YAAY,EAAE,aAAa,CAAC;IAC5B,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,6BAA6B,EAAE,IAAI,CAAC,6BAA6B,EAAE,SAAS,CAAC,CAAC;CAC/E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,IAGnC,OAAO,iBAAiB,KAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CA8b7E"}
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import { interrupt, isGraphBubbleUp } from '@langchain/langgraph';
16
16
  import { SdlcLifecycle, PrStatus } from '../../../../../../domain/generated/output.js';
17
- import { createNodeLogger, shouldInterrupt, retryExecute, buildExecutorOptions, } from '../node-helpers.js';
17
+ import { createNodeLogger, shouldInterrupt, optimizeAndExecute, retryExecute, buildExecutorOptions, } from '../node-helpers.js';
18
18
  import { reportNodeStart } from '../../heartbeat.js';
19
19
  import { recordPhaseStart, recordPhaseEnd, recordApprovalWaitStart, updatePhasePrompt, } from '../../phase-timing-context.js';
20
20
  import { updateNodeLifecycle } from '../../lifecycle-context.js';
@@ -106,9 +106,8 @@ export function createMergeNode(deps) {
106
106
  log.info('Agent call 1: commit + push + PR');
107
107
  const commitPushPrPrompt = buildCommitPushPrPrompt(effectiveState, branch, baseBranch, repoUrl);
108
108
  await updatePhasePrompt(mergeTimingId, commitPushPrPrompt);
109
- const commitResult = await retryExecute(executor, commitPushPrPrompt, options, {
110
- logger: log,
111
- });
109
+ const { result: commitResult, specFileHashes: _mergeSpecHashes } = await optimizeAndExecute(executor, 'merge', commitPushPrPrompt, options, state, mergeTimingId, { logger: log });
110
+ void _mergeSpecHashes;
112
111
  totalInputTokens += commitResult.usage?.inputTokens ?? 0;
113
112
  totalOutputTokens += commitResult.usage?.outputTokens ?? 0;
114
113
  totalCostUsd += commitResult.usage?.costUsd ?? 0;
@@ -114,6 +114,33 @@ export interface RetryOptions {
114
114
  * retried (conservative stance: could be transient).
115
115
  */
116
116
  export declare function retryExecute(executor: IAgentExecutor, prompt: string, options: AgentExecutionOptions, retryOpts?: RetryOptions): Promise<AgentExecutionResult>;
117
+ /**
118
+ * Optimize a prompt, execute it with retries, and record optimization metrics.
119
+ *
120
+ * This is the integration seam for nodes that do NOT flow through
121
+ * {@link executeNode} (fast-implement, implement, merge, evidence). Without
122
+ * this helper, those nodes bypass the token optimization layer entirely —
123
+ * which defeats the purpose of the layer because they are the phases that
124
+ * consume the vast majority of tokens.
125
+ *
126
+ * Behavior:
127
+ * - Always calls {@link optimizePromptIfEnabled}. When the optimizer context
128
+ * is not set or the master toggle is disabled, that call returns the raw
129
+ * prompt unchanged and `metrics: null`.
130
+ * - Delegates the actual execution (plus retry/backoff) to
131
+ * {@link retryExecute} so the retry semantics are identical.
132
+ * - Calls {@link recordOptimizationMetricsIfEnabled} with the supplied
133
+ * `timingId` so the `phase_timings` row is updated in place with
134
+ * `original_token_estimate`, `optimized_token_estimate`, `savings_percent`,
135
+ * and `capabilities_applied`.
136
+ * - Returns the execution result alongside the updated spec-file hashes so
137
+ * the caller can persist them in the node's returned state partial —
138
+ * which is what enables delta-context on subsequent phases.
139
+ */
140
+ export declare function optimizeAndExecute(executor: IAgentExecutor, nodeName: string, rawPrompt: string, options: AgentExecutionOptions, state: FeatureAgentState, timingId: string | null, retryOpts?: RetryOptions): Promise<{
141
+ result: AgentExecutionResult;
142
+ specFileHashes: Record<string, string>;
143
+ }>;
117
144
  /**
118
145
  * Read completed phases from feature.yaml.
119
146
  */
@@ -1 +1 @@
1
- {"version":3,"file":"node-helpers.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACrB,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AKG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAa3E;AAKD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,UAAU,GACd,IAAI,CA6BN;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,UAAU,KAAK,MAAM,GACjE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAwInE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,QAAQ,EAAE,EACpB,GAAG,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACvC,IAAI,CAaN"}
1
+ {"version":3,"file":"node-helpers.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,+DAA+D,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgBrD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM;IAE7C,4DAA4D;gBAChD,IAAI;kBAGF,MAAM,GAAG,IAAI;mBAIZ,MAAM,GAAG,IAAI;EAK/B;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE7D;;GAEG;AACH,wBAAgB,YA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BAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAa3E;AAKD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,UAAU,GACd,IAAI,CA6BN;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,UAAU,KAAK,MAAM,GACjE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAiKnE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,QAAQ,EAAE,EACpB,GAAG,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACvC,IAAI,CAaN"}
@@ -12,6 +12,9 @@ import { interrupt, isGraphBubbleUp } from '@langchain/langgraph';
12
12
  import { hasSettings, getSettings } from '../../../../services/settings.service.js';
13
13
  import { reportNodeStart } from '../heartbeat.js';
14
14
  import { recordPhaseStart, recordPhaseEnd, recordApprovalWaitStart, } from '../phase-timing-context.js';
15
+ import { optimizePromptIfEnabled, recordOptimizationMetricsIfEnabled, } from '../prompt-optimization-context.js';
16
+ import { resolveCavemanDirective } from '../caveman-directive.js';
17
+ import { resolveSubprocessFilterShimDir } from '../subprocess-filter-context.js';
15
18
  import { updateNodeLifecycle } from '../lifecycle-context.js';
16
19
  import { getLogPrefix, setCurrentPhase } from '../log-context.js';
17
20
  /**
@@ -88,11 +91,28 @@ export function getStageTimeoutMs(nodeName) {
88
91
  export function buildExecutorOptions(state, overrides, nodeName) {
89
92
  const stage = nodeName ?? state.currentNode ?? '';
90
93
  const stageTimeout = getStageTimeoutMs(stage);
94
+ // Caveman mode — resolve a terse system-prompt directive from settings.
95
+ // The claude-code executor forwards `options.systemPrompt` to the
96
+ // `--append-system-prompt` CLI flag, which persists across every turn
97
+ // of the Claude Code session. Returns undefined (and the flag is
98
+ // skipped entirely) when caveman mode is off, settings are not
99
+ // initialized, or the current node is in CAVEMAN_EXEMPT_NODES.
100
+ const cavemanConfig = hasSettings() ? getSettings().workflow?.cavemanMode : undefined;
101
+ const systemPrompt = resolveCavemanDirective(stage, cavemanConfig?.enabled ?? false, cavemanConfig?.directive);
102
+ // Subprocess output filter — resolve the shim directory path when
103
+ // enabled in settings. The shim dir is created lazily on first call
104
+ // and reused for the lifetime of the worker process.
105
+ const subprocessFilterConfig = hasSettings()
106
+ ? getSettings().workflow?.subprocessFilter
107
+ : undefined;
108
+ const subprocessFilterShimDir = resolveSubprocessFilterShimDir(subprocessFilterConfig?.enabled ?? false);
91
109
  return {
92
110
  cwd: state.worktreePath || state.repositoryPath,
93
111
  maxTurns: 5000,
94
112
  timeout: stageTimeout,
95
113
  ...(state.model ? { model: state.model } : {}),
114
+ ...(systemPrompt !== undefined ? { systemPrompt } : {}),
115
+ ...(subprocessFilterShimDir !== undefined ? { subprocessFilterShimDir } : {}),
96
116
  ...overrides,
97
117
  };
98
118
  }
@@ -243,6 +263,41 @@ export async function retryExecute(executor, prompt, options, retryOpts) {
243
263
  }
244
264
  throw lastError;
245
265
  }
266
+ /**
267
+ * Optimize a prompt, execute it with retries, and record optimization metrics.
268
+ *
269
+ * This is the integration seam for nodes that do NOT flow through
270
+ * {@link executeNode} (fast-implement, implement, merge, evidence). Without
271
+ * this helper, those nodes bypass the token optimization layer entirely —
272
+ * which defeats the purpose of the layer because they are the phases that
273
+ * consume the vast majority of tokens.
274
+ *
275
+ * Behavior:
276
+ * - Always calls {@link optimizePromptIfEnabled}. When the optimizer context
277
+ * is not set or the master toggle is disabled, that call returns the raw
278
+ * prompt unchanged and `metrics: null`.
279
+ * - Delegates the actual execution (plus retry/backoff) to
280
+ * {@link retryExecute} so the retry semantics are identical.
281
+ * - Calls {@link recordOptimizationMetricsIfEnabled} with the supplied
282
+ * `timingId` so the `phase_timings` row is updated in place with
283
+ * `original_token_estimate`, `optimized_token_estimate`, `savings_percent`,
284
+ * and `capabilities_applied`.
285
+ * - Returns the execution result alongside the updated spec-file hashes so
286
+ * the caller can persist them in the node's returned state partial —
287
+ * which is what enables delta-context on subsequent phases.
288
+ */
289
+ export async function optimizeAndExecute(executor, nodeName, rawPrompt, options, state, timingId, retryOpts) {
290
+ const optimization = await optimizePromptIfEnabled(rawPrompt, nodeName, state.model, state.specFileHashes);
291
+ if (optimization.metrics) {
292
+ retryOpts?.logger?.info(`Prompt optimized: ${optimization.metrics.originalTokenEstimate} → ` +
293
+ `${optimization.metrics.optimizedTokenEstimate} tokens ` +
294
+ `(${optimization.metrics.savingsPercent.toFixed(1)}% saved, ` +
295
+ `capabilities=${optimization.metrics.capabilitiesApplied.join(',') || 'none'})`);
296
+ }
297
+ const result = await retryExecute(executor, optimization.prompt, options, retryOpts);
298
+ await recordOptimizationMetricsIfEnabled(timingId, optimization.metrics);
299
+ return { result, specFileHashes: optimization.specFileHashes };
300
+ }
246
301
  /**
247
302
  * Read completed phases from feature.yaml.
248
303
  */
@@ -491,7 +546,18 @@ export function executeNode(nodeName, executor, buildPrompt) {
491
546
  }
492
547
  const startTime = Date.now();
493
548
  const resumePrefix = buildResumeContext(state.resumeReason);
494
- const prompt = resumePrefix + buildPrompt(state, log);
549
+ const rawPrompt = resumePrefix + buildPrompt(state, log);
550
+ // Token optimization layer — single interceptor between prompt build
551
+ // and executor invocation. Falls back to the raw prompt on any error
552
+ // so optimization failures can never break a phase.
553
+ const optimization = await optimizePromptIfEnabled(rawPrompt, nodeName, state.model, state.specFileHashes);
554
+ const prompt = optimization.prompt;
555
+ if (optimization.metrics) {
556
+ log.info(`Prompt optimized: ${optimization.metrics.originalTokenEstimate} → ` +
557
+ `${optimization.metrics.optimizedTokenEstimate} tokens ` +
558
+ `(${optimization.metrics.savingsPercent.toFixed(1)}% saved, ` +
559
+ `capabilities=${optimization.metrics.capabilitiesApplied.join(',') || 'none'})`);
560
+ }
495
561
  const options = buildExecutorOptions(state, undefined, nodeName);
496
562
  // Record phase start with pre-execution metadata
497
563
  const timingId = await recordPhaseStart(nodeName, {
@@ -517,6 +583,9 @@ export function executeNode(nodeName, executor, buildPrompt) {
517
583
  durationApiMs: result.usage?.durationApiMs,
518
584
  exitCode: 'success',
519
585
  });
586
+ // Persist optimization metrics on the same phase timing row.
587
+ // No-op when optimization is disabled or context is not set.
588
+ await recordOptimizationMetricsIfEnabled(timingId, optimization.metrics);
520
589
  // Safety net: undo spec commits if commitSpecs=false
521
590
  removeSpecCommitsIfNeeded(state, nodeName, log);
522
591
  // Mark phase complete BEFORE interrupting so that on resume the
@@ -528,6 +597,7 @@ export function executeNode(nodeName, executor, buildPrompt) {
528
597
  _approvalAction: null,
529
598
  _rejectionFeedback: null,
530
599
  _needsReexecution: false,
600
+ specFileHashes: optimization.specFileHashes,
531
601
  };
532
602
  // Human-in-the-loop: interrupt after node execution for review.
533
603
  // This is the ONLY interrupt() call in the entire execution path.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Prompt Optimization Context
3
+ *
4
+ * Module-level singleton that exposes the token-optimization layer to
5
+ * executeNode() in node-helpers.ts without changing its public API.
6
+ *
7
+ * The worker calls setPromptOptimizationContext() once after DI init.
8
+ * Node helpers call optimizePromptIfEnabled() before invoking the agent
9
+ * executor and recordOptimizationMetricsIfEnabled() after the phase
10
+ * timing record is updated.
11
+ *
12
+ * Errors are swallowed so optimization failures never block graph execution.
13
+ */
14
+ import type { IPromptOptimizerService } from '../../../../application/ports/output/services/prompt-optimizer.interface.js';
15
+ import type { IOptimizationMetricsService } from '../../../../application/ports/output/services/optimization-metrics.interface.js';
16
+ import type { OptimizationMetrics } from '../../../../application/ports/output/services/prompt-optimizer.interface.js';
17
+ /**
18
+ * Set the prompt-optimization context. Called once by the worker after DI init.
19
+ */
20
+ export declare function setPromptOptimizationContext(optimizer: IPromptOptimizerService, metricsService: IOptimizationMetricsService, runId: string, featureId: string): void;
21
+ /**
22
+ * Clear the prompt-optimization context. Useful for testing.
23
+ */
24
+ export declare function clearPromptOptimizationContext(): void;
25
+ /** Result of an optimization attempt — exposes the prompt to send and metrics to record. */
26
+ export interface OptimizePromptResult {
27
+ prompt: string;
28
+ metrics: OptimizationMetrics | null;
29
+ specFileHashes: Record<string, string>;
30
+ }
31
+ /**
32
+ * Optimize the given prompt if the optimizer context is set and the
33
+ * master toggle is enabled. Falls back to a passthrough result on any
34
+ * error so node execution is never blocked by optimization failures.
35
+ */
36
+ export declare function optimizePromptIfEnabled(prompt: string, phaseName: string, modelId: string | undefined, previousSpecFileHashes: Record<string, string> | undefined): Promise<OptimizePromptResult>;
37
+ /**
38
+ * Persist optimization metrics on the given phase timing row.
39
+ * No-op if context is not set, timingId is null, or metrics are null.
40
+ */
41
+ export declare function recordOptimizationMetricsIfEnabled(timingId: string | null, metrics: OptimizationMetrics | null): Promise<void>;
42
+ //# sourceMappingURL=prompt-optimization-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-optimization-context.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mEAAmE,CAAC;AACjH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uEAAuE,CAAC;AACzH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mEAAmE,CAAC;AAS7G;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,uBAAuB,EAClC,cAAc,EAAE,2BAA2B,EAC3C,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAKrD;AAED,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAWD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACzD,OAAO,CAAC,oBAAoB,CAAC,CA4B/B;AAED;;;GAGG;AACH,wBAAsB,kCAAkC,CACtD,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAClC,OAAO,CAAC,IAAI,CAAC,CAQf"}