@shepai/cli 1.176.0-pr539.02342cf → 1.177.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 (274) hide show
  1. package/apis/json-schema/PhaseTiming.yaml +0 -30
  2. package/apis/json-schema/WorkflowConfig.yaml +0 -3
  3. package/dist/eslint.config.mjs +2 -0
  4. package/dist/packages/core/src/application/ports/output/agents/phase-timing-repository.interface.d.ts +1 -8
  5. package/dist/packages/core/src/application/ports/output/agents/phase-timing-repository.interface.d.ts.map +1 -1
  6. package/dist/packages/core/src/application/ports/output/index.d.ts +1 -1
  7. package/dist/packages/core/src/application/ports/output/index.d.ts.map +1 -1
  8. package/dist/packages/core/src/application/ports/output/services/i-browser-opener.d.ts +28 -0
  9. package/dist/packages/core/src/application/ports/output/services/i-browser-opener.d.ts.map +1 -0
  10. package/dist/packages/core/src/application/ports/output/services/i-browser-opener.js +13 -0
  11. package/dist/packages/core/src/application/ports/output/services/i-desktop-notifier.d.ts +29 -0
  12. package/dist/packages/core/src/application/ports/output/services/i-desktop-notifier.d.ts.map +1 -0
  13. package/dist/packages/core/src/application/ports/output/services/i-desktop-notifier.js +13 -0
  14. package/dist/packages/core/src/application/ports/output/services/index.d.ts +2 -7
  15. package/dist/packages/core/src/application/ports/output/services/index.d.ts.map +1 -1
  16. package/dist/packages/core/src/domain/factories/settings-defaults.factory.d.ts.map +1 -1
  17. package/dist/packages/core/src/domain/factories/settings-defaults.factory.js +0 -9
  18. package/dist/packages/core/src/domain/generated/output.d.ts +0 -65
  19. package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
  20. package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
  21. package/dist/packages/core/src/infrastructure/di/container.js +5 -27
  22. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +0 -6
  23. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
  24. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +0 -41
  25. package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.d.ts +1 -2
  26. package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.d.ts.map +1 -1
  27. package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.js +0 -72
  28. package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.d.ts.map +1 -1
  29. package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.js +3 -19
  30. package/dist/packages/core/src/infrastructure/services/agents/analyze-repo/analyze-repository-graph.d.ts +1 -1
  31. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts +1 -6
  32. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts.map +1 -1
  33. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts +1 -18
  34. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts.map +1 -1
  35. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.js +20 -6
  36. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.d.ts.map +1 -1
  37. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.js +27 -10
  38. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -1
  39. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +1 -17
  40. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts +0 -1
  41. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts.map +1 -1
  42. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.js +0 -5
  43. package/dist/packages/core/src/infrastructure/services/browser-opener.service.d.ts +2 -1
  44. package/dist/packages/core/src/infrastructure/services/browser-opener.service.d.ts.map +1 -1
  45. package/dist/packages/core/src/infrastructure/services/notifications/desktop-notifier.d.ts +2 -1
  46. package/dist/packages/core/src/infrastructure/services/notifications/desktop-notifier.d.ts.map +1 -1
  47. package/dist/src/presentation/cli/commands/daemon/start-daemon.d.ts +1 -1
  48. package/dist/src/presentation/cli/commands/daemon/start-daemon.js +2 -3
  49. package/dist/src/presentation/cli/commands/ui.command.js +1 -2
  50. package/dist/tsconfig.build.tsbuildinfo +1 -1
  51. package/package.json +10 -2
  52. package/web/.next/BUILD_ID +1 -1
  53. package/web/.next/build-manifest.json +2 -2
  54. package/web/.next/fallback-build-manifest.json +2 -2
  55. package/web/.next/prerender-manifest.json +3 -3
  56. package/web/.next/required-server-files.js +2 -2
  57. package/web/.next/required-server-files.json +2 -2
  58. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +29 -29
  59. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  60. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  61. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +27 -27
  62. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  63. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  64. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +30 -30
  65. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  66. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  67. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +38 -38
  68. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  69. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  70. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +38 -38
  71. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  72. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  73. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  74. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  75. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  77. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  78. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  79. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +27 -27
  80. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  81. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  82. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +30 -30
  83. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  84. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  85. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +38 -38
  86. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  87. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  88. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +38 -38
  89. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  90. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  91. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +27 -27
  92. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  93. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  94. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  95. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  96. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  97. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  98. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  99. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  100. package/web/.next/server/app/_global-error.html +2 -2
  101. package/web/.next/server/app/_global-error.rsc +1 -1
  102. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  103. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  104. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  105. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  106. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  107. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +6 -6
  108. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  109. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  110. package/web/.next/server/app/features/page/server-reference-manifest.json +6 -6
  111. package/web/.next/server/app/features/page.js.nft.json +1 -1
  112. package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
  113. package/web/.next/server/app/settings/page/server-reference-manifest.json +9 -9
  114. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  115. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  116. package/web/.next/server/app/skills/page/server-reference-manifest.json +13 -13
  117. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  118. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  119. package/web/.next/server/app/tools/page/server-reference-manifest.json +11 -11
  120. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  121. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  122. package/web/.next/server/app/version/page/server-reference-manifest.json +6 -6
  123. package/web/.next/server/app/version/page.js.nft.json +1 -1
  124. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  125. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  126. package/web/.next/server/chunks/[root-of-the-server]__c78383b1._.js.map +1 -1
  127. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
  128. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_ad0071c9.js +1 -1
  129. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_ad0071c9.js.map +1 -1
  130. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_90d98b2b.js +1 -1
  131. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_90d98b2b.js.map +1 -1
  132. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_d3828105.js +1 -1
  133. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_d3828105.js.map +1 -1
  134. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  135. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  136. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
  137. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
  138. package/web/.next/server/chunks/ssr/[root-of-the-server]__1cd4327c._.js +1 -1
  139. package/web/.next/server/chunks/ssr/[root-of-the-server]__1cd4327c._.js.map +1 -1
  140. package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js +1 -1
  141. package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js.map +1 -1
  142. package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
  143. package/web/.next/server/chunks/ssr/[root-of-the-server]__51ec77a8._.js +1 -1
  144. package/web/.next/server/chunks/ssr/[root-of-the-server]__51ec77a8._.js.map +1 -1
  145. package/web/.next/server/chunks/ssr/[root-of-the-server]__540c615f._.js +2 -2
  146. package/web/.next/server/chunks/ssr/[root-of-the-server]__66047a1b._.js +1 -1
  147. package/web/.next/server/chunks/ssr/[root-of-the-server]__66047a1b._.js.map +1 -1
  148. package/web/.next/server/chunks/ssr/[root-of-the-server]__6c7d3936._.js +1 -1
  149. package/web/.next/server/chunks/ssr/[root-of-the-server]__6c7d3936._.js.map +1 -1
  150. package/web/.next/server/chunks/ssr/[root-of-the-server]__a932cd3a._.js +1 -1
  151. package/web/.next/server/chunks/ssr/[root-of-the-server]__a932cd3a._.js.map +1 -1
  152. package/web/.next/server/chunks/ssr/[root-of-the-server]__aa72e794._.js +1 -1
  153. package/web/.next/server/chunks/ssr/[root-of-the-server]__aa72e794._.js.map +1 -1
  154. package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js +1 -1
  155. package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js.map +1 -1
  156. package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
  157. package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
  158. package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
  159. package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
  160. package/web/.next/server/chunks/ssr/{_66291662._.js → _19a779c6._.js} +2 -2
  161. package/web/.next/server/chunks/ssr/{_66291662._.js.map → _19a779c6._.js.map} +1 -1
  162. package/web/.next/server/chunks/ssr/_295fffde._.js.map +1 -1
  163. package/web/.next/server/chunks/ssr/{_39053f87._.js → _3fc2374c._.js} +2 -2
  164. package/web/.next/server/chunks/ssr/{_39053f87._.js.map → _3fc2374c._.js.map} +1 -1
  165. package/web/.next/server/chunks/ssr/_45496654._.js.map +1 -1
  166. package/web/.next/server/chunks/ssr/_4cbb7f95._.js +1 -1
  167. package/web/.next/server/chunks/ssr/_4cbb7f95._.js.map +1 -1
  168. package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
  169. package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
  170. package/web/.next/server/chunks/ssr/_57b1af27._.js +3 -0
  171. package/web/.next/server/chunks/ssr/{_34b0a7ad._.js.map → _57b1af27._.js.map} +1 -1
  172. package/web/.next/server/chunks/ssr/_6abfa39e._.js +1 -1
  173. package/web/.next/server/chunks/ssr/_f8c55130._.js +1 -1
  174. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  175. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  176. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
  177. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js.map +1 -1
  178. package/web/.next/server/chunks/ssr/src_presentation_web_17d39233._.js +1 -1
  179. package/web/.next/server/chunks/ssr/src_presentation_web_17d39233._.js.map +1 -1
  180. package/web/.next/server/chunks/ssr/src_presentation_web_54b02639._.js +2 -2
  181. package/web/.next/server/chunks/ssr/src_presentation_web_54b02639._.js.map +1 -1
  182. package/web/.next/server/chunks/ssr/src_presentation_web_7b7b9e3b._.js +2 -2
  183. package/web/.next/server/chunks/ssr/src_presentation_web_7b7b9e3b._.js.map +1 -1
  184. package/web/.next/server/chunks/ssr/src_presentation_web_807cba76._.js +1 -1
  185. package/web/.next/server/chunks/ssr/src_presentation_web_807cba76._.js.map +1 -1
  186. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_90b5e66e.js +1 -1
  187. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_90b5e66e.js.map +1 -1
  188. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_4ce30db7.js +1 -1
  189. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_4ce30db7.js.map +1 -1
  190. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_e4032193.js +1 -1
  191. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_e4032193.js.map +1 -1
  192. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
  193. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
  194. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
  195. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  196. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  197. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
  198. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
  199. package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js +1 -1
  200. package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js.map +1 -1
  201. package/web/.next/server/chunks/ssr/src_presentation_web_e1cd1869._.js +1 -1
  202. package/web/.next/server/chunks/ssr/src_presentation_web_e1cd1869._.js.map +1 -1
  203. package/web/.next/server/chunks/ssr/src_presentation_web_e3a30e30._.js +1 -1
  204. package/web/.next/server/chunks/ssr/src_presentation_web_e3a30e30._.js.map +1 -1
  205. package/web/.next/server/pages/500.html +2 -2
  206. package/web/.next/server/server-reference-manifest.js +1 -1
  207. package/web/.next/server/server-reference-manifest.json +50 -50
  208. package/web/.next/static/chunks/{1fd5980d468143b3.js → 0a706f8508eae0a8.js} +2 -2
  209. package/web/.next/static/chunks/{85ea0b80c5996155.js → 0d0e2661bd167e0f.js} +1 -1
  210. package/web/.next/static/chunks/{6a3d4b6774ebcbff.js → 18f429029d702545.js} +1 -1
  211. package/web/.next/static/chunks/{420c3bd9d5a22881.js → 3fc5b2287f192799.js} +1 -1
  212. package/web/.next/static/chunks/{4df18296f976f225.js → 4c20d4cd4786a0c8.js} +1 -1
  213. package/web/.next/static/chunks/{5cddc4bace2ce528.js → 77d6506c7d1f711f.js} +1 -1
  214. package/web/.next/static/chunks/{6d33333b9382783a.js → 829d2f8ef2715f2f.js} +2 -2
  215. package/web/.next/static/chunks/{1bbf1ec4b25d4de8.js → b5a916fec4cdc897.js} +1 -1
  216. package/web/.next/static/chunks/{287fea380d8cc373.js → b5d355eb59916926.js} +2 -2
  217. package/web/.next/static/chunks/{fb6b8fc0dac0dea9.js → c0e4cd44851a9293.js} +1 -1
  218. package/web/.next/static/chunks/{2403588dafacbd4e.js → ddd34e939acc204f.js} +1 -1
  219. package/web/.next/static/chunks/{e5d2d6d17ea0472e.js → eaa1b979d63d322b.js} +1 -1
  220. package/web/.next/static/chunks/{73e0fa361f218bb0.js → ef897f150084ef85.js} +1 -1
  221. package/web/.next/static/chunks/{97b1402b60fab8a2.js → efd57b6ffc7cbd54.js} +1 -1
  222. package/apis/json-schema/TokenOptimizationConfig.yaml +0 -36
  223. package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.d.ts +0 -45
  224. package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.d.ts.map +0 -1
  225. package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.js +0 -13
  226. package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts +0 -50
  227. package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts.map +0 -1
  228. package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.js +0 -13
  229. package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts +0 -57
  230. package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts.map +0 -1
  231. package/dist/packages/core/src/application/ports/output/services/delta-context.interface.js +0 -13
  232. package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts +0 -45
  233. package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts.map +0 -1
  234. package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.js +0 -13
  235. package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts +0 -86
  236. package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts.map +0 -1
  237. package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.js +0 -13
  238. package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts +0 -43
  239. package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts.map +0 -1
  240. package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.js +0 -13
  241. package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts +0 -41
  242. package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts.map +0 -1
  243. package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.js +0 -12
  244. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts +0 -29
  245. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts.map +0 -1
  246. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.js +0 -77
  247. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts +0 -42
  248. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts.map +0 -1
  249. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.js +0 -92
  250. package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts +0 -41
  251. package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts.map +0 -1
  252. package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.js +0 -111
  253. package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts +0 -22
  254. package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts.map +0 -1
  255. package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.js +0 -245
  256. package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts +0 -22
  257. package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts.map +0 -1
  258. package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.js +0 -50
  259. package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts +0 -36
  260. package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts.map +0 -1
  261. package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.js +0 -123
  262. package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts +0 -57
  263. package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts.map +0 -1
  264. package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.js +0 -211
  265. package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts +0 -34
  266. package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts.map +0 -1
  267. package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.js +0 -190
  268. package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts +0 -26
  269. package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts.map +0 -1
  270. package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.js +0 -51
  271. package/web/.next/server/chunks/ssr/_34b0a7ad._.js +0 -3
  272. /package/web/.next/static/{EYQFTbDa6VxVniUQK-bHc → UZ2czjiAnEl1RF-HTzHyA}/_buildManifest.js +0 -0
  273. /package/web/.next/static/{EYQFTbDa6VxVniUQK-bHc → UZ2czjiAnEl1RF-HTzHyA}/_clientMiddlewareManifest.json +0 -0
  274. /package/web/.next/static/{EYQFTbDa6VxVniUQK-bHc → UZ2czjiAnEl1RF-HTzHyA}/_ssgManifest.js +0 -0
@@ -1,92 +0,0 @@
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 { hasSettings, getSettings } from '../../../services/settings.service.js';
15
- let contextOptimizer;
16
- let contextMetricsService;
17
- let contextRunId;
18
- let contextFeatureId;
19
- /**
20
- * Set the prompt-optimization context. Called once by the worker after DI init.
21
- */
22
- export function setPromptOptimizationContext(optimizer, metricsService, runId, featureId) {
23
- contextOptimizer = optimizer;
24
- contextMetricsService = metricsService;
25
- contextRunId = runId;
26
- contextFeatureId = featureId;
27
- }
28
- /**
29
- * Clear the prompt-optimization context. Useful for testing.
30
- */
31
- export function clearPromptOptimizationContext() {
32
- contextOptimizer = undefined;
33
- contextMetricsService = undefined;
34
- contextRunId = undefined;
35
- contextFeatureId = undefined;
36
- }
37
- /**
38
- * Resolve the effective TokenOptimizationConfig from settings. Returns
39
- * undefined if settings are not initialized.
40
- */
41
- function resolveConfig() {
42
- if (!hasSettings())
43
- return undefined;
44
- return getSettings().workflow?.tokenOptimization;
45
- }
46
- /**
47
- * Optimize the given prompt if the optimizer context is set and the
48
- * master toggle is enabled. Falls back to a passthrough result on any
49
- * error so node execution is never blocked by optimization failures.
50
- */
51
- export async function optimizePromptIfEnabled(prompt, phaseName, modelId, previousSpecFileHashes) {
52
- if (!contextOptimizer || !contextRunId || !contextFeatureId) {
53
- return { prompt, metrics: null, specFileHashes: previousSpecFileHashes ?? {} };
54
- }
55
- const config = resolveConfig();
56
- if (!config?.enabled) {
57
- return { prompt, metrics: null, specFileHashes: previousSpecFileHashes ?? {} };
58
- }
59
- try {
60
- const result = await contextOptimizer.optimize(prompt, {
61
- phaseName,
62
- modelId,
63
- featureId: contextFeatureId,
64
- agentRunId: contextRunId,
65
- previousSpecFileHashes,
66
- config,
67
- });
68
- return {
69
- prompt: result.prompt,
70
- metrics: result.metrics,
71
- specFileHashes: result.specFileHashes,
72
- };
73
- }
74
- catch {
75
- // Swallow — optimization failure must never block phase execution
76
- return { prompt, metrics: null, specFileHashes: previousSpecFileHashes ?? {} };
77
- }
78
- }
79
- /**
80
- * Persist optimization metrics on the given phase timing row.
81
- * No-op if context is not set, timingId is null, or metrics are null.
82
- */
83
- export async function recordOptimizationMetricsIfEnabled(timingId, metrics) {
84
- if (!contextMetricsService || !timingId || !metrics)
85
- return;
86
- try {
87
- await contextMetricsService.record(timingId, metrics);
88
- }
89
- catch {
90
- // Swallow — metrics persistence failure is non-fatal
91
- }
92
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * Alias Compression Service
3
- *
4
- * Session dictionary-based alias compression for prompts. Scans text for
5
- * repeated long strings (3+ occurrences, 20+ characters), assigns short
6
- * aliases ($A1, $A2, ...), prepends a dictionary header, and replaces
7
- * all occurrences. A net-positive check ensures the dictionary overhead
8
- * does not exceed the savings from aliasing.
9
- */
10
- import type { IAliasCompressionService, AliasCompressionResult } from '../../../application/ports/output/services/alias-compression.interface.js';
11
- export declare class AliasCompressionService implements IAliasCompressionService {
12
- /**
13
- * Apply alias compression to a prompt string.
14
- *
15
- * Strategy:
16
- * 1. Find all substrings appearing 3+ times that are 20+ chars
17
- * 2. Sort by frequency (most frequent first) for optimal alias assignment
18
- * 3. Compute net savings — skip if dictionary overhead exceeds body savings
19
- * 4. Build dictionary header and replace occurrences
20
- */
21
- compress(text: string): AliasCompressionResult;
22
- /**
23
- * Find all substrings that qualify for aliasing.
24
- *
25
- * Uses word-boundary-aware token extraction to find repeated multi-word
26
- * strings. Scans for non-whitespace tokens of sufficient length, then
27
- * checks if longer contiguous phrases also repeat enough times.
28
- */
29
- private findCandidates;
30
- /**
31
- * Remove candidates that are substrings of longer candidates with
32
- * equal or greater frequency (the longer alias provides more savings).
33
- */
34
- private removeSubsumedCandidates;
35
- /**
36
- * Build the dictionary header string.
37
- * Format: "## Aliases\n$A1 = "original"\n$A2 = "original"\n\n"
38
- */
39
- private buildDictionaryHeader;
40
- }
41
- //# sourceMappingURL=alias-compression.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alias-compression.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/alias-compression.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,oEAAoE,CAAC;AAmB5E,qBAAa,uBAAwB,YAAW,wBAAwB;IACtE;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB;IA6C9C;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAyBtB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAI9B"}
@@ -1,111 +0,0 @@
1
- /**
2
- * Alias Compression Service
3
- *
4
- * Session dictionary-based alias compression for prompts. Scans text for
5
- * repeated long strings (3+ occurrences, 20+ characters), assigns short
6
- * aliases ($A1, $A2, ...), prepends a dictionary header, and replaces
7
- * all occurrences. A net-positive check ensures the dictionary overhead
8
- * does not exceed the savings from aliasing.
9
- */
10
- /** Minimum number of occurrences for a string to qualify for aliasing. */
11
- const MIN_OCCURRENCES = 3;
12
- /** Minimum character length for a string to qualify for aliasing. */
13
- const MIN_LENGTH = 20;
14
- /** Alias prefix format: $A1, $A2, ... */
15
- const ALIAS_PREFIX = '$A';
16
- export class AliasCompressionService {
17
- /**
18
- * Apply alias compression to a prompt string.
19
- *
20
- * Strategy:
21
- * 1. Find all substrings appearing 3+ times that are 20+ chars
22
- * 2. Sort by frequency (most frequent first) for optimal alias assignment
23
- * 3. Compute net savings — skip if dictionary overhead exceeds body savings
24
- * 4. Build dictionary header and replace occurrences
25
- */
26
- compress(text) {
27
- if (text === '') {
28
- return { compressed: '', dictionaryHeader: '', aliasCount: 0 };
29
- }
30
- // Step 1: Find candidate strings
31
- const candidates = this.findCandidates(text);
32
- if (candidates.length === 0) {
33
- return { compressed: text, dictionaryHeader: '', aliasCount: 0 };
34
- }
35
- // Step 2: Sort by frequency descending (most repeated first)
36
- candidates.sort((a, b) => b.count - a.count);
37
- // Step 3: Assign aliases and compute net savings
38
- const aliases = candidates.map((candidate, index) => ({
39
- ...candidate,
40
- alias: `${ALIAS_PREFIX}${index + 1}`,
41
- }));
42
- // Calculate savings
43
- const dictionaryHeader = this.buildDictionaryHeader(aliases);
44
- const bodySavings = aliases.reduce((total, { original, alias, count }) => total + count * (original.length - alias.length), 0);
45
- const netSavings = bodySavings - dictionaryHeader.length;
46
- if (netSavings <= 0) {
47
- return { compressed: text, dictionaryHeader: '', aliasCount: 0 };
48
- }
49
- // Step 4: Replace occurrences in text
50
- let body = text;
51
- for (const { original, alias } of aliases) {
52
- body = body.replaceAll(original, alias);
53
- }
54
- return {
55
- compressed: dictionaryHeader + body,
56
- dictionaryHeader,
57
- aliasCount: aliases.length,
58
- };
59
- }
60
- /**
61
- * Find all substrings that qualify for aliasing.
62
- *
63
- * Uses word-boundary-aware token extraction to find repeated multi-word
64
- * strings. Scans for non-whitespace tokens of sufficient length, then
65
- * checks if longer contiguous phrases also repeat enough times.
66
- */
67
- findCandidates(text) {
68
- // Extract all non-whitespace tokens of 20+ chars
69
- const longTokens = new Map();
70
- // Match sequences of non-whitespace characters that are 20+ chars
71
- const tokenRegex = /\S{20,}/g;
72
- let match;
73
- while ((match = tokenRegex.exec(text)) !== null) {
74
- const token = match[0];
75
- longTokens.set(token, (longTokens.get(token) ?? 0) + 1);
76
- }
77
- // Filter to candidates meeting the occurrence threshold
78
- const candidates = [];
79
- for (const [token, count] of longTokens) {
80
- if (count >= MIN_OCCURRENCES && token.length >= MIN_LENGTH) {
81
- candidates.push({ original: token, count });
82
- }
83
- }
84
- // Remove candidates that are substrings of other candidates with same or higher count
85
- return this.removeSubsumedCandidates(candidates);
86
- }
87
- /**
88
- * Remove candidates that are substrings of longer candidates with
89
- * equal or greater frequency (the longer alias provides more savings).
90
- */
91
- removeSubsumedCandidates(candidates) {
92
- // Sort by length descending so longer strings are checked first
93
- const sorted = [...candidates].sort((a, b) => b.original.length - a.original.length);
94
- const result = [];
95
- for (const candidate of sorted) {
96
- const isSubsumed = result.some((existing) => existing.original.includes(candidate.original) && existing.count >= candidate.count);
97
- if (!isSubsumed) {
98
- result.push(candidate);
99
- }
100
- }
101
- return result;
102
- }
103
- /**
104
- * Build the dictionary header string.
105
- * Format: "## Aliases\n$A1 = "original"\n$A2 = "original"\n\n"
106
- */
107
- buildDictionaryHeader(aliases) {
108
- const lines = aliases.map(({ alias, original }) => `${alias} = "${original}"`);
109
- return `## Aliases\n${lines.join('\n')}\n\n`;
110
- }
111
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Command Output Filter Service
3
- *
4
- * Regex-based filter that reduces test/build/git output tokens embedded in
5
- * prompts while preserving all error-relevant lines. Applies configurable
6
- * filter policies within fenced code blocks only.
7
- *
8
- * Safety guarantee: any line containing error-related keywords is preserved
9
- * verbatim regardless of other filter rules.
10
- */
11
- import type { ICommandOutputFilterService, CommandOutputFilterResult } from '../../../application/ports/output/services/command-output-filter.interface.js';
12
- export declare class CommandOutputFilterService implements ICommandOutputFilterService {
13
- /**
14
- * Filter command output embedded in a prompt string.
15
- *
16
- * Detects fenced code blocks and applies reduction policies within them.
17
- * Text outside code blocks is never modified. Lines containing error-related
18
- * keywords are always preserved.
19
- */
20
- filter(prompt: string): CommandOutputFilterResult;
21
- }
22
- //# sourceMappingURL=command-output-filter.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-output-filter.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,wEAAwE,CAAC;AA2MhF,qBAAa,0BAA2B,YAAW,2BAA2B;IAC5E;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,yBAAyB;CAkDlD"}
@@ -1,245 +0,0 @@
1
- /**
2
- * Command Output Filter Service
3
- *
4
- * Regex-based filter that reduces test/build/git output tokens embedded in
5
- * prompts while preserving all error-relevant lines. Applies configurable
6
- * filter policies within fenced code blocks only.
7
- *
8
- * Safety guarantee: any line containing error-related keywords is preserved
9
- * verbatim regardless of other filter rules.
10
- */
11
- /**
12
- * Safety keywords — any line containing one of these (case-insensitive) is
13
- * preserved unconditionally. Biased toward preservation: when in doubt, keep.
14
- */
15
- const SAFETY_KEYWORDS = [
16
- /error/i,
17
- /fail/i,
18
- /warn/i,
19
- /warning/i,
20
- /enoent/i,
21
- /exception/i,
22
- /stack/i,
23
- /panic/i,
24
- /timeout/i,
25
- /denied/i,
26
- /unauthorized/i,
27
- /not found/i,
28
- /undefined/i,
29
- /\bnull\b/i,
30
- /\bnan\b/i,
31
- /syntax/i,
32
- /rejected/i,
33
- /type error/i,
34
- /segfault/i,
35
- /abort/i,
36
- /killed/i,
37
- ];
38
- /**
39
- * Patterns for lines that can be removed from test output.
40
- * Only applied within fenced code blocks.
41
- */
42
- const REMOVABLE_TEST_PATTERNS = [
43
- // Jest/Vitest PASS lines: "PASS src/file.test.ts"
44
- /^\s*PASS\s+\S/,
45
- // Checkmark passing lines: " ✓ test name (2ms)"
46
- /^\s*✓\s+/,
47
- // Vitest checkmark passing lines: " ✓ src/file.test.ts"
48
- /^\s*✓\s+\S/,
49
- ];
50
- /**
51
- * Patterns for lines that are always preserved (in addition to safety keywords).
52
- */
53
- const ALWAYS_PRESERVE_PATTERNS = [
54
- // Stack trace lines
55
- /^\s+at\s+/,
56
- // Test summary lines
57
- /^(Tests?|Test Suites?|Time|Snapshots?):\s+/,
58
- // Bullet points with test names (failure details)
59
- /^\s*●\s+/,
60
- // Cross mark failing lines
61
- /^\s*[✗×]\s+/,
62
- // Diff headers
63
- /^diff --git\s/,
64
- /^(---|\+\+\+)\s/,
65
- /^@@\s/,
66
- // Diff changed lines
67
- /^[+-][^+-]/,
68
- // Git index lines
69
- /^index\s+[0-9a-f]+/,
70
- ];
71
- /**
72
- * Patterns identifying context lines in git diffs that can be removed when
73
- * the diff is excessively long.
74
- */
75
- const DIFF_CONTEXT_LINE = /^ [^+-@]/;
76
- /** Maximum number of consecutive diff context lines to keep at start/end. */
77
- const MAX_DIFF_CONTEXT_LINES = 5;
78
- /**
79
- * Check whether a line contains any safety keyword.
80
- */
81
- function isSafeLine(line) {
82
- return SAFETY_KEYWORDS.some((kw) => kw.test(line));
83
- }
84
- /**
85
- * Check whether a line matches any always-preserve pattern.
86
- */
87
- function isPreservedPattern(line) {
88
- return ALWAYS_PRESERVE_PATTERNS.some((p) => p.test(line));
89
- }
90
- /**
91
- * Check whether a line matches a removable test pattern.
92
- */
93
- function isRemovableTestLine(line) {
94
- return REMOVABLE_TEST_PATTERNS.some((p) => p.test(line));
95
- }
96
- /**
97
- * Filter lines within a single code block. Returns the filtered lines and
98
- * the count of removed lines.
99
- */
100
- function filterCodeBlock(lines) {
101
- const isDiff = lines.some((l) => /^diff --git\s/.test(l));
102
- if (isDiff) {
103
- return filterDiffBlock(lines);
104
- }
105
- return filterTestOrBuildBlock(lines);
106
- }
107
- /**
108
- * Filter a git diff code block — truncate long runs of unchanged context
109
- * lines while preserving headers, changed lines, and hunk markers.
110
- */
111
- function filterDiffBlock(lines) {
112
- const result = [];
113
- let removed = 0;
114
- let contextRun = [];
115
- const flushContextRun = () => {
116
- if (contextRun.length <= MAX_DIFF_CONTEXT_LINES * 2) {
117
- result.push(...contextRun);
118
- }
119
- else {
120
- // Keep first N and last N context lines, remove middle
121
- const head = contextRun.slice(0, MAX_DIFF_CONTEXT_LINES);
122
- const tail = contextRun.slice(-MAX_DIFF_CONTEXT_LINES);
123
- const skipped = contextRun.length - head.length - tail.length;
124
- result.push(...head);
125
- result.push(` ... (${skipped} unchanged lines omitted)`);
126
- result.push(...tail);
127
- removed += skipped;
128
- }
129
- contextRun = [];
130
- };
131
- for (const line of lines) {
132
- if (DIFF_CONTEXT_LINE.test(line)) {
133
- contextRun.push(line);
134
- }
135
- else {
136
- if (contextRun.length > 0) {
137
- flushContextRun();
138
- }
139
- // Always keep non-context lines in diffs (headers, changed lines, hunks)
140
- result.push(line);
141
- }
142
- }
143
- // Flush trailing context
144
- if (contextRun.length > 0) {
145
- flushContextRun();
146
- }
147
- return { filtered: result, removed };
148
- }
149
- /**
150
- * Filter test/build/pnpm output — remove passing test lines and collapse
151
- * repeated blank lines while preserving everything error-related.
152
- */
153
- function filterTestOrBuildBlock(lines) {
154
- const result = [];
155
- let removed = 0;
156
- let consecutiveBlanks = 0;
157
- for (const line of lines) {
158
- const trimmed = line.trim();
159
- // Collapse multiple blank lines
160
- if (trimmed === '') {
161
- consecutiveBlanks++;
162
- if (consecutiveBlanks <= 1) {
163
- result.push(line);
164
- }
165
- else {
166
- removed++;
167
- }
168
- continue;
169
- }
170
- consecutiveBlanks = 0;
171
- // Safety keywords always preserved
172
- if (isSafeLine(line)) {
173
- result.push(line);
174
- continue;
175
- }
176
- // Always-preserve patterns (stack traces, summaries, failure markers)
177
- if (isPreservedPattern(line)) {
178
- result.push(line);
179
- continue;
180
- }
181
- // Removable test output lines
182
- if (isRemovableTestLine(line)) {
183
- removed++;
184
- continue;
185
- }
186
- // Default: preserve the line
187
- result.push(line);
188
- }
189
- return { filtered: result, removed };
190
- }
191
- export class CommandOutputFilterService {
192
- /**
193
- * Filter command output embedded in a prompt string.
194
- *
195
- * Detects fenced code blocks and applies reduction policies within them.
196
- * Text outside code blocks is never modified. Lines containing error-related
197
- * keywords are always preserved.
198
- */
199
- filter(prompt) {
200
- if (prompt === '') {
201
- return { filtered: '', linesRemoved: 0 };
202
- }
203
- const lines = prompt.split('\n');
204
- const result = [];
205
- let totalRemoved = 0;
206
- let inCodeBlock = false;
207
- let codeBlockLines = [];
208
- for (const line of lines) {
209
- // Detect code fence boundaries
210
- if (line.trimStart().startsWith('```')) {
211
- if (!inCodeBlock) {
212
- // Opening fence
213
- inCodeBlock = true;
214
- codeBlockLines = [];
215
- result.push(line);
216
- }
217
- else {
218
- // Closing fence — filter accumulated code block lines
219
- const { filtered, removed } = filterCodeBlock(codeBlockLines);
220
- result.push(...filtered);
221
- totalRemoved += removed;
222
- result.push(line);
223
- inCodeBlock = false;
224
- codeBlockLines = [];
225
- }
226
- continue;
227
- }
228
- if (inCodeBlock) {
229
- codeBlockLines.push(line);
230
- }
231
- else {
232
- // Outside code blocks — always preserve
233
- result.push(line);
234
- }
235
- }
236
- // If code block was never closed, include accumulated lines unfiltered
237
- if (inCodeBlock) {
238
- result.push(...codeBlockLines);
239
- }
240
- return {
241
- filtered: result.join('\n'),
242
- linesRemoved: totalRemoved,
243
- };
244
- }
245
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Delta-Context Service
3
- *
4
- * Hash-based spec file change detection using SHA-256. Compares current
5
- * file contents against hashes from the previous phase. Unchanged files
6
- * are replaced with compact summaries to reduce repeated context tokens
7
- * across multi-phase workflows.
8
- *
9
- * Safety: changed files and first-phase files always pass through with
10
- * full content. Only verified-unchanged files are summarized.
11
- */
12
- import type { IDeltaContextService, SpecFileEntry, DeltaContextResult } from '../../../application/ports/output/services/delta-context.interface.js';
13
- export declare class DeltaContextService implements IDeltaContextService {
14
- /**
15
- * Diff spec files against previous phase hashes.
16
- *
17
- * For unchanged files: replaces content with a compact summary.
18
- * For changed files or first phase (no previous hashes): returns full content.
19
- */
20
- diff(files: SpecFileEntry[], previousHashes: Record<string, string>, previousPhaseName?: string): DeltaContextResult;
21
- }
22
- //# sourceMappingURL=delta-context.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delta-context.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/delta-context.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EACnB,MAAM,gEAAgE,CAAC;AASxE,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D;;;;;OAKG;IACH,IAAI,CACF,KAAK,EAAE,aAAa,EAAE,EACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,iBAAiB,CAAC,EAAE,MAAM,GACzB,kBAAkB;CA4BtB"}
@@ -1,50 +0,0 @@
1
- /**
2
- * Delta-Context Service
3
- *
4
- * Hash-based spec file change detection using SHA-256. Compares current
5
- * file contents against hashes from the previous phase. Unchanged files
6
- * are replaced with compact summaries to reduce repeated context tokens
7
- * across multi-phase workflows.
8
- *
9
- * Safety: changed files and first-phase files always pass through with
10
- * full content. Only verified-unchanged files are summarized.
11
- */
12
- import { createHash } from 'node:crypto';
13
- /**
14
- * Compute the SHA-256 hex digest of a string.
15
- */
16
- function computeHash(content) {
17
- return createHash('sha256').update(content, 'utf8').digest('hex');
18
- }
19
- export class DeltaContextService {
20
- /**
21
- * Diff spec files against previous phase hashes.
22
- *
23
- * For unchanged files: replaces content with a compact summary.
24
- * For changed files or first phase (no previous hashes): returns full content.
25
- */
26
- diff(files, previousHashes, previousPhaseName) {
27
- const optimizedFiles = {};
28
- const currentHashes = {};
29
- let filesSkipped = 0;
30
- const hasPreviousHashes = Object.keys(previousHashes).length > 0;
31
- for (const file of files) {
32
- const hash = computeHash(file.content);
33
- currentHashes[file.fileName] = hash;
34
- const previousHash = previousHashes[file.fileName];
35
- const isUnchanged = hasPreviousHashes && previousHash === hash;
36
- if (isUnchanged) {
37
- const lineCount = file.content.split('\n').length;
38
- const shortHash = hash.slice(0, 8);
39
- const phase = previousPhaseName ?? 'previous';
40
- optimizedFiles[file.fileName] =
41
- `[${file.fileName} unchanged since ${phase} - ${lineCount} lines, hash ${shortHash}]`;
42
- filesSkipped++;
43
- }
44
- else {
45
- optimizedFiles[file.fileName] = file.content;
46
- }
47
- }
48
- return { optimizedFiles, currentHashes, filesSkipped };
49
- }
50
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Optimization Metrics Service
3
- *
4
- * Persists token optimization metrics on existing PhaseTiming records.
5
- * Updates the per-phase timing entry with optimization statistics so the
6
- * data is queryable alongside timing and cost data via the existing
7
- * phase timing infrastructure.
8
- *
9
- * Failure-tolerant: any persistence error is swallowed (after best-effort
10
- * logging) so optimization metric recording can never break a phase run.
11
- */
12
- import type { IOptimizationMetricsService } from '../../../application/ports/output/services/optimization-metrics.interface.js';
13
- import type { OptimizationMetrics } from '../../../application/ports/output/services/prompt-optimizer.interface.js';
14
- import type { IPhaseTimingRepository } from '../../../application/ports/output/agents/phase-timing-repository.interface.js';
15
- export declare class OptimizationMetricsService implements IOptimizationMetricsService {
16
- private readonly phaseTimingRepository;
17
- constructor(phaseTimingRepository: IPhaseTimingRepository);
18
- /**
19
- * Persist optimization metrics on the named PhaseTiming row.
20
- *
21
- * Token estimates are stored as bigint (PhaseTiming column type),
22
- * capabilitiesApplied is serialized as a JSON string for the
23
- * existing string column.
24
- */
25
- record(phaseTimingId: string, metrics: OptimizationMetrics): Promise<void>;
26
- /**
27
- * Retrieve previously recorded optimization metrics for a phase timing.
28
- *
29
- * Returns null when:
30
- * - the phase timing record does not exist
31
- * - the phase timing exists but has no optimization columns populated
32
- * - the underlying repository read fails
33
- */
34
- getByPhaseTimingId(phaseTimingId: string): Promise<OptimizationMetrics | null>;
35
- }
36
- //# sourceMappingURL=optimization-metrics.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"optimization-metrics.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uEAAuE,CAAC;AACzH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mEAAmE,CAAC;AAC7G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wEAAwE,CAAC;AAoDrH,qBACa,0BAA2B,YAAW,2BAA2B;IAG1E,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAArB,qBAAqB,EAAE,sBAAsB;IAGhE;;;;;;OAMG;IACG,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBhF;;;;;;;OAOG;IACG,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAWrF"}