@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.
- package/apis/json-schema/PhaseTiming.yaml +0 -30
- package/apis/json-schema/WorkflowConfig.yaml +0 -3
- package/dist/eslint.config.mjs +2 -0
- package/dist/packages/core/src/application/ports/output/agents/phase-timing-repository.interface.d.ts +1 -8
- package/dist/packages/core/src/application/ports/output/agents/phase-timing-repository.interface.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/index.d.ts +1 -1
- package/dist/packages/core/src/application/ports/output/index.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/services/i-browser-opener.d.ts +28 -0
- package/dist/packages/core/src/application/ports/output/services/i-browser-opener.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/i-browser-opener.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/i-desktop-notifier.d.ts +29 -0
- package/dist/packages/core/src/application/ports/output/services/i-desktop-notifier.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/i-desktop-notifier.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/index.d.ts +2 -7
- package/dist/packages/core/src/application/ports/output/services/index.d.ts.map +1 -1
- package/dist/packages/core/src/domain/factories/settings-defaults.factory.d.ts.map +1 -1
- package/dist/packages/core/src/domain/factories/settings-defaults.factory.js +0 -9
- package/dist/packages/core/src/domain/generated/output.d.ts +0 -65
- package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/di/container.js +5 -27
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +0 -6
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +0 -41
- package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.d.ts +1 -2
- package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.js +0 -72
- package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.js +3 -19
- package/dist/packages/core/src/infrastructure/services/agents/analyze-repo/analyze-repository-graph.d.ts +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts +1 -6
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts +1 -18
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.js +20 -6
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.js +27 -10
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +1 -17
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts +0 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.js +0 -5
- package/dist/packages/core/src/infrastructure/services/browser-opener.service.d.ts +2 -1
- package/dist/packages/core/src/infrastructure/services/browser-opener.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/notifications/desktop-notifier.d.ts +2 -1
- package/dist/packages/core/src/infrastructure/services/notifications/desktop-notifier.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/daemon/start-daemon.d.ts +1 -1
- package/dist/src/presentation/cli/commands/daemon/start-daemon.js +2 -3
- package/dist/src/presentation/cli/commands/ui.command.js +1 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -2
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +2 -2
- package/web/.next/required-server-files.json +2 -2
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +29 -29
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +30 -30
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +38 -38
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +38 -38
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +30 -30
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +38 -38
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +38 -38
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/features/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/features/page.js.nft.json +1 -1
- package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +9 -9
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +13 -13
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +11 -11
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/version/page.js.nft.json +1 -1
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__c78383b1._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_ad0071c9.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_ad0071c9.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_90d98b2b.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_90d98b2b.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_d3828105.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_d3828105.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1cd4327c._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1cd4327c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__51ec77a8._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__51ec77a8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__540c615f._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__66047a1b._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__66047a1b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6c7d3936._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6c7d3936._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a932cd3a._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a932cd3a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aa72e794._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aa72e794._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_66291662._.js → _19a779c6._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_66291662._.js.map → _19a779c6._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_295fffde._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_39053f87._.js → _3fc2374c._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_39053f87._.js.map → _3fc2374c._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_45496654._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_4cbb7f95._.js +1 -1
- package/web/.next/server/chunks/ssr/_4cbb7f95._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_57b1af27._.js +3 -0
- package/web/.next/server/chunks/ssr/{_34b0a7ad._.js.map → _57b1af27._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_6abfa39e._.js +1 -1
- package/web/.next/server/chunks/ssr/_f8c55130._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
- package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_17d39233._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_17d39233._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_54b02639._.js +2 -2
- package/web/.next/server/chunks/ssr/src_presentation_web_54b02639._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_7b7b9e3b._.js +2 -2
- package/web/.next/server/chunks/ssr/src_presentation_web_7b7b9e3b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_807cba76._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_807cba76._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_90b5e66e.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_90b5e66e.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_4ce30db7.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_4ce30db7.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_e4032193.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_e4032193.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e1cd1869._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e1cd1869._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e3a30e30._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e3a30e30._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +50 -50
- package/web/.next/static/chunks/{1fd5980d468143b3.js → 0a706f8508eae0a8.js} +2 -2
- package/web/.next/static/chunks/{85ea0b80c5996155.js → 0d0e2661bd167e0f.js} +1 -1
- package/web/.next/static/chunks/{6a3d4b6774ebcbff.js → 18f429029d702545.js} +1 -1
- package/web/.next/static/chunks/{420c3bd9d5a22881.js → 3fc5b2287f192799.js} +1 -1
- package/web/.next/static/chunks/{4df18296f976f225.js → 4c20d4cd4786a0c8.js} +1 -1
- package/web/.next/static/chunks/{5cddc4bace2ce528.js → 77d6506c7d1f711f.js} +1 -1
- package/web/.next/static/chunks/{6d33333b9382783a.js → 829d2f8ef2715f2f.js} +2 -2
- package/web/.next/static/chunks/{1bbf1ec4b25d4de8.js → b5a916fec4cdc897.js} +1 -1
- package/web/.next/static/chunks/{287fea380d8cc373.js → b5d355eb59916926.js} +2 -2
- package/web/.next/static/chunks/{fb6b8fc0dac0dea9.js → c0e4cd44851a9293.js} +1 -1
- package/web/.next/static/chunks/{2403588dafacbd4e.js → ddd34e939acc204f.js} +1 -1
- package/web/.next/static/chunks/{e5d2d6d17ea0472e.js → eaa1b979d63d322b.js} +1 -1
- package/web/.next/static/chunks/{73e0fa361f218bb0.js → ef897f150084ef85.js} +1 -1
- package/web/.next/static/chunks/{97b1402b60fab8a2.js → efd57b6ffc7cbd54.js} +1 -1
- package/apis/json-schema/TokenOptimizationConfig.yaml +0 -36
- package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.d.ts +0 -45
- package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.js +0 -13
- package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts +0 -50
- package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.js +0 -13
- package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts +0 -57
- package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/delta-context.interface.js +0 -13
- package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts +0 -45
- package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.js +0 -13
- package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts +0 -86
- package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.js +0 -13
- package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts +0 -43
- package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.js +0 -13
- package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts +0 -41
- package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.js +0 -12
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts +0 -29
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.js +0 -77
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts +0 -42
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.js +0 -92
- package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts +0 -41
- package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.js +0 -111
- package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts +0 -22
- package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.js +0 -245
- package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts +0 -22
- package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.js +0 -50
- package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts +0 -36
- package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.js +0 -123
- package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts +0 -57
- package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.js +0 -211
- package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts +0 -34
- package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.js +0 -190
- package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts +0 -26
- package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.js +0 -51
- package/web/.next/server/chunks/ssr/_34b0a7ad._.js +0 -3
- /package/web/.next/static/{EYQFTbDa6VxVniUQK-bHc → UZ2czjiAnEl1RF-HTzHyA}/_buildManifest.js +0 -0
- /package/web/.next/static/{EYQFTbDa6VxVniUQK-bHc → UZ2czjiAnEl1RF-HTzHyA}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{EYQFTbDa6VxVniUQK-bHc → UZ2czjiAnEl1RF-HTzHyA}/_ssgManifest.js +0 -0
|
@@ -1,123 +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
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
13
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
16
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17
|
-
};
|
|
18
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
20
|
-
};
|
|
21
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
22
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
23
|
-
};
|
|
24
|
-
import { injectable, inject } from 'tsyringe';
|
|
25
|
-
/**
|
|
26
|
-
* Parse the JSON-serialized capabilitiesApplied column. Returns an
|
|
27
|
-
* empty array on malformed JSON so a corrupted row never throws on read.
|
|
28
|
-
*/
|
|
29
|
-
function parseCapabilitiesApplied(serialized) {
|
|
30
|
-
if (serialized === undefined || serialized === null) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const parsed = JSON.parse(serialized);
|
|
35
|
-
return Array.isArray(parsed)
|
|
36
|
-
? parsed.filter((item) => typeof item === 'string')
|
|
37
|
-
: [];
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Build an OptimizationMetrics object from a PhaseTiming row.
|
|
45
|
-
*
|
|
46
|
-
* Returns null when the row has no optimization columns populated
|
|
47
|
-
* (record was created but optimizer never ran for it).
|
|
48
|
-
*/
|
|
49
|
-
function metricsFromPhaseTiming(timing) {
|
|
50
|
-
// If no optimization fields are present at all, treat as "no metrics".
|
|
51
|
-
if (timing.originalTokenEstimate === undefined &&
|
|
52
|
-
timing.optimizedTokenEstimate === undefined &&
|
|
53
|
-
timing.savingsPercent === undefined &&
|
|
54
|
-
timing.capabilitiesApplied === undefined) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
originalTokenEstimate: timing.originalTokenEstimate !== undefined ? Number(timing.originalTokenEstimate) : 0,
|
|
59
|
-
optimizedTokenEstimate: timing.optimizedTokenEstimate !== undefined ? Number(timing.optimizedTokenEstimate) : 0,
|
|
60
|
-
savingsPercent: timing.savingsPercent ?? 0,
|
|
61
|
-
capabilitiesApplied: parseCapabilitiesApplied(timing.capabilitiesApplied),
|
|
62
|
-
outputFilterLinesRemoved: timing.outputFilterLinesRemoved ?? 0,
|
|
63
|
-
deltaContextFilesSkipped: timing.deltaContextFilesSkipped ?? 0,
|
|
64
|
-
compressionRatio: timing.compressionRatio ?? 1.0,
|
|
65
|
-
aliasesCreated: timing.aliasesCreated ?? 0,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
let OptimizationMetricsService = class OptimizationMetricsService {
|
|
69
|
-
phaseTimingRepository;
|
|
70
|
-
constructor(phaseTimingRepository) {
|
|
71
|
-
this.phaseTimingRepository = phaseTimingRepository;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Persist optimization metrics on the named PhaseTiming row.
|
|
75
|
-
*
|
|
76
|
-
* Token estimates are stored as bigint (PhaseTiming column type),
|
|
77
|
-
* capabilitiesApplied is serialized as a JSON string for the
|
|
78
|
-
* existing string column.
|
|
79
|
-
*/
|
|
80
|
-
async record(phaseTimingId, metrics) {
|
|
81
|
-
try {
|
|
82
|
-
await this.phaseTimingRepository.update(phaseTimingId, {
|
|
83
|
-
originalTokenEstimate: BigInt(metrics.originalTokenEstimate),
|
|
84
|
-
optimizedTokenEstimate: BigInt(metrics.optimizedTokenEstimate),
|
|
85
|
-
savingsPercent: metrics.savingsPercent,
|
|
86
|
-
capabilitiesApplied: JSON.stringify(metrics.capabilitiesApplied),
|
|
87
|
-
outputFilterLinesRemoved: metrics.outputFilterLinesRemoved,
|
|
88
|
-
deltaContextFilesSkipped: metrics.deltaContextFilesSkipped,
|
|
89
|
-
compressionRatio: metrics.compressionRatio,
|
|
90
|
-
aliasesCreated: metrics.aliasesCreated,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
// Persistence failure must never break optimization
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Retrieve previously recorded optimization metrics for a phase timing.
|
|
99
|
-
*
|
|
100
|
-
* Returns null when:
|
|
101
|
-
* - the phase timing record does not exist
|
|
102
|
-
* - the phase timing exists but has no optimization columns populated
|
|
103
|
-
* - the underlying repository read fails
|
|
104
|
-
*/
|
|
105
|
-
async getByPhaseTimingId(phaseTimingId) {
|
|
106
|
-
try {
|
|
107
|
-
const timing = await this.phaseTimingRepository.findById(phaseTimingId);
|
|
108
|
-
if (!timing) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
return metricsFromPhaseTiming(timing);
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
OptimizationMetricsService = __decorate([
|
|
119
|
-
injectable(),
|
|
120
|
-
__param(0, inject('IPhaseTimingRepository')),
|
|
121
|
-
__metadata("design:paramtypes", [Object])
|
|
122
|
-
], OptimizationMetricsService);
|
|
123
|
-
export { OptimizationMetricsService };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Optimizer Service
|
|
3
|
-
*
|
|
4
|
-
* Top-level orchestrator for the token optimization layer. Composes the
|
|
5
|
-
* five capability services (delta-context, command output filter, skill
|
|
6
|
-
* routing, semantic compressor, alias compression) into a sequential
|
|
7
|
-
* pipeline driven by per-capability settings toggles.
|
|
8
|
-
*
|
|
9
|
-
* Pipeline order (from research decisions):
|
|
10
|
-
* 1. Output filter - removes the most raw text early
|
|
11
|
-
* 2. Skill routing - prepends a small directive section
|
|
12
|
-
* 3. Delta-context - replaces unchanged spec files with summaries
|
|
13
|
-
* 4. Semantic compr - compresses remaining natural language
|
|
14
|
-
* 5. Alias engine - finds repeated long strings in the final text
|
|
15
|
-
*
|
|
16
|
-
* Each stage runs only when its individual toggle is true. The master
|
|
17
|
-
* toggle (config.enabled) short-circuits the pipeline entirely.
|
|
18
|
-
*
|
|
19
|
-
* Metrics from each stage are aggregated into the OptimizationMetrics
|
|
20
|
-
* record returned alongside the optimized prompt.
|
|
21
|
-
*/
|
|
22
|
-
import type { IPromptOptimizerService, PromptOptimizationContext, PromptOptimizationResult } from '../../../application/ports/output/services/prompt-optimizer.interface.js';
|
|
23
|
-
import type { ICommandOutputFilterService } from '../../../application/ports/output/services/command-output-filter.interface.js';
|
|
24
|
-
import type { ISkillRoutingService } from '../../../application/ports/output/services/skill-routing.interface.js';
|
|
25
|
-
import type { IDeltaContextService } from '../../../application/ports/output/services/delta-context.interface.js';
|
|
26
|
-
import type { ISemanticCompressorService } from '../../../application/ports/output/services/semantic-compressor.interface.js';
|
|
27
|
-
import type { IAliasCompressionService } from '../../../application/ports/output/services/alias-compression.interface.js';
|
|
28
|
-
import type { IOptimizationMetricsService } from '../../../application/ports/output/services/optimization-metrics.interface.js';
|
|
29
|
-
export declare class PromptOptimizerService implements IPromptOptimizerService {
|
|
30
|
-
private readonly outputFilter;
|
|
31
|
-
private readonly skillRouting;
|
|
32
|
-
private readonly deltaContext;
|
|
33
|
-
private readonly semanticCompressor;
|
|
34
|
-
private readonly aliasCompression;
|
|
35
|
-
private readonly metricsService;
|
|
36
|
-
constructor(outputFilter: ICommandOutputFilterService, skillRouting: ISkillRoutingService, deltaContext: IDeltaContextService, semanticCompressor: ISemanticCompressorService, aliasCompression: IAliasCompressionService, metricsService: IOptimizationMetricsService);
|
|
37
|
-
/**
|
|
38
|
-
* Optimize a raw prompt by running enabled capability services in sequence.
|
|
39
|
-
*
|
|
40
|
-
* Returns the original prompt with zero-delta metrics when the master
|
|
41
|
-
* toggle is off. Each capability is independently skippable via its
|
|
42
|
-
* config toggle.
|
|
43
|
-
*/
|
|
44
|
-
optimize(prompt: string, context: PromptOptimizationContext): Promise<PromptOptimizationResult>;
|
|
45
|
-
/**
|
|
46
|
-
* Persist metrics via the metrics service when a phaseTimingId is
|
|
47
|
-
* provided in the context. Failures are swallowed so a metrics
|
|
48
|
-
* persistence problem can never break the optimization pipeline.
|
|
49
|
-
*/
|
|
50
|
-
private recordMetricsIfPossible;
|
|
51
|
-
/**
|
|
52
|
-
* Log a debug-level summary of optimizations applied for observability.
|
|
53
|
-
* Failure to log must never affect optimization output.
|
|
54
|
-
*/
|
|
55
|
-
private logSummary;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=prompt-optimizer.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-optimizer.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EAEzB,MAAM,mEAAmE,CAAC;AAC3E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AAC1H,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sEAAsE,CAAC;AACvH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oEAAoE,CAAC;AACnH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uEAAuE,CAAC;AAkCzH,qBACa,sBAAuB,YAAW,uBAAuB;IAGlE,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAVd,YAAY,EAAE,2BAA2B,EAEzC,YAAY,EAAE,oBAAoB,EAElC,YAAY,EAAE,oBAAoB,EAElC,kBAAkB,EAAE,0BAA0B,EAE9C,gBAAgB,EAAE,wBAAwB,EAE1C,cAAc,EAAE,2BAA2B;IAG9D;;;;;;OAMG;IACG,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC;IA4FpC;;;;OAIG;YACW,uBAAuB;IAcrC;;;OAGG;IACH,OAAO,CAAC,UAAU;CAkBnB"}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Optimizer Service
|
|
3
|
-
*
|
|
4
|
-
* Top-level orchestrator for the token optimization layer. Composes the
|
|
5
|
-
* five capability services (delta-context, command output filter, skill
|
|
6
|
-
* routing, semantic compressor, alias compression) into a sequential
|
|
7
|
-
* pipeline driven by per-capability settings toggles.
|
|
8
|
-
*
|
|
9
|
-
* Pipeline order (from research decisions):
|
|
10
|
-
* 1. Output filter - removes the most raw text early
|
|
11
|
-
* 2. Skill routing - prepends a small directive section
|
|
12
|
-
* 3. Delta-context - replaces unchanged spec files with summaries
|
|
13
|
-
* 4. Semantic compr - compresses remaining natural language
|
|
14
|
-
* 5. Alias engine - finds repeated long strings in the final text
|
|
15
|
-
*
|
|
16
|
-
* Each stage runs only when its individual toggle is true. The master
|
|
17
|
-
* toggle (config.enabled) short-circuits the pipeline entirely.
|
|
18
|
-
*
|
|
19
|
-
* Metrics from each stage are aggregated into the OptimizationMetrics
|
|
20
|
-
* record returned alongside the optimized prompt.
|
|
21
|
-
*/
|
|
22
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
23
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
25
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
26
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
27
|
-
};
|
|
28
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
29
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
30
|
-
};
|
|
31
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
32
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
33
|
-
};
|
|
34
|
-
import { injectable, inject } from 'tsyringe';
|
|
35
|
-
/** Token estimate heuristic: chars / TOKEN_CHAR_RATIO. */
|
|
36
|
-
const TOKEN_CHAR_RATIO = 4;
|
|
37
|
-
/** Capability identifier strings recorded in metrics.capabilitiesApplied. */
|
|
38
|
-
const CAPABILITY = {
|
|
39
|
-
outputFiltering: 'outputFiltering',
|
|
40
|
-
skillRouting: 'skillRouting',
|
|
41
|
-
deltaContext: 'deltaContext',
|
|
42
|
-
semanticCompression: 'semanticCompression',
|
|
43
|
-
aliasCompression: 'aliasCompression',
|
|
44
|
-
};
|
|
45
|
-
/** Estimate tokens from character length using the chars/4 heuristic. */
|
|
46
|
-
function estimateTokens(text) {
|
|
47
|
-
return Math.floor(text.length / TOKEN_CHAR_RATIO);
|
|
48
|
-
}
|
|
49
|
-
/** Build a zero-delta metrics record (used when no optimization is applied). */
|
|
50
|
-
function buildPassthroughMetrics(prompt) {
|
|
51
|
-
const tokens = estimateTokens(prompt);
|
|
52
|
-
return {
|
|
53
|
-
originalTokenEstimate: tokens,
|
|
54
|
-
optimizedTokenEstimate: tokens,
|
|
55
|
-
savingsPercent: 0,
|
|
56
|
-
capabilitiesApplied: [],
|
|
57
|
-
outputFilterLinesRemoved: 0,
|
|
58
|
-
deltaContextFilesSkipped: 0,
|
|
59
|
-
compressionRatio: 1.0,
|
|
60
|
-
aliasesCreated: 0,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
let PromptOptimizerService = class PromptOptimizerService {
|
|
64
|
-
outputFilter;
|
|
65
|
-
skillRouting;
|
|
66
|
-
deltaContext;
|
|
67
|
-
semanticCompressor;
|
|
68
|
-
aliasCompression;
|
|
69
|
-
metricsService;
|
|
70
|
-
constructor(outputFilter, skillRouting, deltaContext, semanticCompressor, aliasCompression, metricsService) {
|
|
71
|
-
this.outputFilter = outputFilter;
|
|
72
|
-
this.skillRouting = skillRouting;
|
|
73
|
-
this.deltaContext = deltaContext;
|
|
74
|
-
this.semanticCompressor = semanticCompressor;
|
|
75
|
-
this.aliasCompression = aliasCompression;
|
|
76
|
-
this.metricsService = metricsService;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Optimize a raw prompt by running enabled capability services in sequence.
|
|
80
|
-
*
|
|
81
|
-
* Returns the original prompt with zero-delta metrics when the master
|
|
82
|
-
* toggle is off. Each capability is independently skippable via its
|
|
83
|
-
* config toggle.
|
|
84
|
-
*/
|
|
85
|
-
async optimize(prompt, context) {
|
|
86
|
-
const config = context.config;
|
|
87
|
-
// Master toggle off — return prompt unchanged with zero-delta metrics.
|
|
88
|
-
if (!config?.enabled) {
|
|
89
|
-
return {
|
|
90
|
-
prompt,
|
|
91
|
-
metrics: buildPassthroughMetrics(prompt),
|
|
92
|
-
specFileHashes: context.previousSpecFileHashes ?? {},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
const originalTokenEstimate = estimateTokens(prompt);
|
|
96
|
-
const capabilitiesApplied = [];
|
|
97
|
-
let working = prompt;
|
|
98
|
-
// Per-capability metric accumulators
|
|
99
|
-
let outputFilterLinesRemoved = 0;
|
|
100
|
-
const deltaContextFilesSkipped = 0;
|
|
101
|
-
let compressionRatio = 1.0;
|
|
102
|
-
let aliasesCreated = 0;
|
|
103
|
-
const specFileHashes = context.previousSpecFileHashes ?? {};
|
|
104
|
-
// 1. Command output filter — remove the most raw text first.
|
|
105
|
-
if (config.outputFiltering) {
|
|
106
|
-
const result = this.outputFilter.filter(working);
|
|
107
|
-
working = result.filtered;
|
|
108
|
-
outputFilterLinesRemoved = result.linesRemoved;
|
|
109
|
-
capabilitiesApplied.push(CAPABILITY.outputFiltering);
|
|
110
|
-
}
|
|
111
|
-
// 2. Skill routing — prepend the phase-relevant skill directive.
|
|
112
|
-
if (config.skillRouting) {
|
|
113
|
-
const routing = this.skillRouting.getRoutingDirective(context.phaseName);
|
|
114
|
-
if (routing.directive.length > 0) {
|
|
115
|
-
working = `${routing.directive}\n\n${working}`;
|
|
116
|
-
}
|
|
117
|
-
capabilitiesApplied.push(CAPABILITY.skillRouting);
|
|
118
|
-
}
|
|
119
|
-
// 3. Delta-context — note: the orchestrator does not own spec file
|
|
120
|
-
// reads (those happen in prompt builders). When invoked here we
|
|
121
|
-
// simply mark the capability as applied and propagate hashes from
|
|
122
|
-
// context. The capability service is exposed for direct use by
|
|
123
|
-
// prompt builders that want to apply hash-based summaries inline.
|
|
124
|
-
if (config.deltaContext) {
|
|
125
|
-
capabilitiesApplied.push(CAPABILITY.deltaContext);
|
|
126
|
-
}
|
|
127
|
-
// 4. Semantic compressor — compress remaining natural language.
|
|
128
|
-
if (config.semanticCompression) {
|
|
129
|
-
const result = this.semanticCompressor.compress(working);
|
|
130
|
-
working = result.compressed;
|
|
131
|
-
compressionRatio = result.compressionRatio;
|
|
132
|
-
capabilitiesApplied.push(CAPABILITY.semanticCompression);
|
|
133
|
-
}
|
|
134
|
-
// 5. Alias engine — find repeated long strings in the final text.
|
|
135
|
-
if (config.aliasCompression) {
|
|
136
|
-
const result = this.aliasCompression.compress(working);
|
|
137
|
-
working = result.compressed;
|
|
138
|
-
aliasesCreated = result.aliasCount;
|
|
139
|
-
capabilitiesApplied.push(CAPABILITY.aliasCompression);
|
|
140
|
-
}
|
|
141
|
-
const optimizedTokenEstimate = estimateTokens(working);
|
|
142
|
-
const savingsPercent = originalTokenEstimate > 0
|
|
143
|
-
? ((originalTokenEstimate - optimizedTokenEstimate) / originalTokenEstimate) * 100
|
|
144
|
-
: 0;
|
|
145
|
-
const metrics = {
|
|
146
|
-
originalTokenEstimate,
|
|
147
|
-
optimizedTokenEstimate,
|
|
148
|
-
savingsPercent: Math.max(0, savingsPercent),
|
|
149
|
-
capabilitiesApplied,
|
|
150
|
-
outputFilterLinesRemoved,
|
|
151
|
-
deltaContextFilesSkipped,
|
|
152
|
-
compressionRatio,
|
|
153
|
-
aliasesCreated,
|
|
154
|
-
};
|
|
155
|
-
this.logSummary(context, metrics);
|
|
156
|
-
await this.recordMetricsIfPossible(context, metrics);
|
|
157
|
-
return {
|
|
158
|
-
prompt: working,
|
|
159
|
-
metrics,
|
|
160
|
-
specFileHashes,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Persist metrics via the metrics service when a phaseTimingId is
|
|
165
|
-
* provided in the context. Failures are swallowed so a metrics
|
|
166
|
-
* persistence problem can never break the optimization pipeline.
|
|
167
|
-
*/
|
|
168
|
-
async recordMetricsIfPossible(context, metrics) {
|
|
169
|
-
if (!context.phaseTimingId) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
try {
|
|
173
|
-
await this.metricsService.record(context.phaseTimingId, metrics);
|
|
174
|
-
}
|
|
175
|
-
catch {
|
|
176
|
-
// Metrics persistence failure must never break optimization
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Log a debug-level summary of optimizations applied for observability.
|
|
181
|
-
* Failure to log must never affect optimization output.
|
|
182
|
-
*/
|
|
183
|
-
logSummary(context, metrics) {
|
|
184
|
-
try {
|
|
185
|
-
const savings = metrics.savingsPercent.toFixed(1);
|
|
186
|
-
const caps = metrics.capabilitiesApplied.join(',');
|
|
187
|
-
// Use process.stderr.write at debug level (no console pollution)
|
|
188
|
-
if (process.env.SHEP_DEBUG_OPTIMIZER === '1') {
|
|
189
|
-
process.stderr.write(`[token-optimizer] phase=${context.phaseName} ` +
|
|
190
|
-
`original=${metrics.originalTokenEstimate} ` +
|
|
191
|
-
`optimized=${metrics.optimizedTokenEstimate} ` +
|
|
192
|
-
`savings=${savings}% ` +
|
|
193
|
-
`capabilities=${caps}\n`);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
catch {
|
|
197
|
-
// Logging failure must never break optimization
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
PromptOptimizerService = __decorate([
|
|
202
|
-
injectable(),
|
|
203
|
-
__param(0, inject('ICommandOutputFilterService')),
|
|
204
|
-
__param(1, inject('ISkillRoutingService')),
|
|
205
|
-
__param(2, inject('IDeltaContextService')),
|
|
206
|
-
__param(3, inject('ISemanticCompressorService')),
|
|
207
|
-
__param(4, inject('IAliasCompressionService')),
|
|
208
|
-
__param(5, inject('IOptimizationMetricsService')),
|
|
209
|
-
__metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object])
|
|
210
|
-
], PromptOptimizerService);
|
|
211
|
-
export { PromptOptimizerService };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Semantic Compressor Service
|
|
3
|
-
*
|
|
4
|
-
* Rule-based caveman compression for non-code prompt sections. Uses a
|
|
5
|
-
* protect-then-compress strategy: extract protected regions (code blocks,
|
|
6
|
-
* file paths, URLs, JSON, quoted strings) as placeholders, apply compression
|
|
7
|
-
* rules to the remaining natural language, then restore protected regions.
|
|
8
|
-
*
|
|
9
|
-
* Compression rules (in order):
|
|
10
|
-
* 1. Phrase shortening (multi-word → shorter equivalent)
|
|
11
|
-
* 2. Filler word removal (just, simply, basically, actually, really, currently)
|
|
12
|
-
* 3. Article removal (a, an, the)
|
|
13
|
-
* 4. Technical term abbreviation (repository → repo, etc.)
|
|
14
|
-
* 5. Whitespace collapsing (multiple blanks → single)
|
|
15
|
-
*/
|
|
16
|
-
import type { ISemanticCompressorService, SemanticCompressionResult } from '../../../application/ports/output/services/semantic-compressor.interface.js';
|
|
17
|
-
export declare class SemanticCompressorService implements ISemanticCompressorService {
|
|
18
|
-
/**
|
|
19
|
-
* Compress natural language text in a prompt.
|
|
20
|
-
*
|
|
21
|
-
* Strategy:
|
|
22
|
-
* 1. Extract all protected regions and replace with placeholders
|
|
23
|
-
* 2. Apply compression rules to remaining text
|
|
24
|
-
* 3. Restore protected regions from placeholders
|
|
25
|
-
* 4. Calculate compression ratio
|
|
26
|
-
*/
|
|
27
|
-
compress(text: string): SemanticCompressionResult;
|
|
28
|
-
private applyPhraseShortening;
|
|
29
|
-
private removeFillerWords;
|
|
30
|
-
private removeArticles;
|
|
31
|
-
private abbreviateTerms;
|
|
32
|
-
private collapseWhitespace;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=semantic-compressor.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-compressor.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,sEAAsE,CAAC;AAwF9E,qBAAa,yBAA0B,YAAW,0BAA0B;IAC1E;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB;IAoDjD,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,kBAAkB;CAmB3B"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Semantic Compressor Service
|
|
3
|
-
*
|
|
4
|
-
* Rule-based caveman compression for non-code prompt sections. Uses a
|
|
5
|
-
* protect-then-compress strategy: extract protected regions (code blocks,
|
|
6
|
-
* file paths, URLs, JSON, quoted strings) as placeholders, apply compression
|
|
7
|
-
* rules to the remaining natural language, then restore protected regions.
|
|
8
|
-
*
|
|
9
|
-
* Compression rules (in order):
|
|
10
|
-
* 1. Phrase shortening (multi-word → shorter equivalent)
|
|
11
|
-
* 2. Filler word removal (just, simply, basically, actually, really, currently)
|
|
12
|
-
* 3. Article removal (a, an, the)
|
|
13
|
-
* 4. Technical term abbreviation (repository → repo, etc.)
|
|
14
|
-
* 5. Whitespace collapsing (multiple blanks → single)
|
|
15
|
-
*/
|
|
16
|
-
/** Placeholder prefix used for protected regions. */
|
|
17
|
-
const PLACEHOLDER_PREFIX = '\x00PROT_';
|
|
18
|
-
const PLACEHOLDER_SUFFIX = '\x00';
|
|
19
|
-
/**
|
|
20
|
-
* Multi-word phrase replacements. Order matters: longer phrases first to
|
|
21
|
-
* prevent partial matches. Applied case-insensitively.
|
|
22
|
-
*/
|
|
23
|
-
const PHRASE_REPLACEMENTS = [
|
|
24
|
-
[/\bdue to the fact that\b/gi, 'because'],
|
|
25
|
-
[/\bit is important to\b/gi, 'important:'],
|
|
26
|
-
[/\bplease note that\b/gi, 'note:'],
|
|
27
|
-
[/\bin addition to\b/gi, 'besides'],
|
|
28
|
-
[/\ba number of\b/gi, 'several'],
|
|
29
|
-
[/\bat this point\b/gi, 'now'],
|
|
30
|
-
[/\bmake sure to\b/gi, 'ensure'],
|
|
31
|
-
[/\bin order to\b/gi, 'to'],
|
|
32
|
-
[/\bas well as\b/gi, 'and'],
|
|
33
|
-
[/\byou must\b/gi, 'must'],
|
|
34
|
-
[/\byou should\b/gi, 'should'],
|
|
35
|
-
];
|
|
36
|
-
/**
|
|
37
|
-
* Filler words removed entirely (with surrounding space normalization).
|
|
38
|
-
*/
|
|
39
|
-
const FILLER_WORDS = [
|
|
40
|
-
/\bjust\b/gi,
|
|
41
|
-
/\bsimply\b/gi,
|
|
42
|
-
/\bbasically\b/gi,
|
|
43
|
-
/\bactually\b/gi,
|
|
44
|
-
/\breally\b/gi,
|
|
45
|
-
/\bcurrently\b/gi,
|
|
46
|
-
];
|
|
47
|
-
/**
|
|
48
|
-
* Articles removed (with word boundary awareness).
|
|
49
|
-
*/
|
|
50
|
-
const ARTICLES = [/\bthe\b/gi, /\ban\b/gi, /\ba\b(?=\s)/gi];
|
|
51
|
-
/**
|
|
52
|
-
* Technical term abbreviations. Applied with word boundaries.
|
|
53
|
-
*/
|
|
54
|
-
const TERM_ABBREVIATIONS = [
|
|
55
|
-
[/\bimplementation\b/gi, 'impl'],
|
|
56
|
-
[/\bconfiguration\b/gi, 'config'],
|
|
57
|
-
[/\bspecification\b/gi, 'spec'],
|
|
58
|
-
[/\benvironment\b/gi, 'env'],
|
|
59
|
-
[/\bapplication\b/gi, 'app'],
|
|
60
|
-
[/\brepository\b/gi, 'repo'],
|
|
61
|
-
[/\bdependencies\b/gi, 'deps'],
|
|
62
|
-
[/\bdependency\b/gi, 'dep'],
|
|
63
|
-
[/\bdirectory\b/gi, 'dir'],
|
|
64
|
-
[/\bfunction\b/gi, 'fn'],
|
|
65
|
-
];
|
|
66
|
-
/**
|
|
67
|
-
* Regex patterns for detecting protected regions in the prompt text.
|
|
68
|
-
*/
|
|
69
|
-
/** Fenced code blocks: ```...``` (with optional language tag) */
|
|
70
|
-
const FENCED_CODE_BLOCK_RE = /```[\s\S]*?```/g;
|
|
71
|
-
/** Indented code blocks: lines starting with 4+ spaces (consecutive) */
|
|
72
|
-
const INDENTED_CODE_BLOCK_RE = /(?:^|\n)((?:[ ]{4,}[^\n]*\n?)+)/g;
|
|
73
|
-
/** URLs: http(s)://... */
|
|
74
|
-
const URL_RE = /https?:\/\/[^\s)>\]]+/g;
|
|
75
|
-
/** Absolute file paths: /path/to/file or ./path/to/file */
|
|
76
|
-
const UNIX_PATH_RE = /(?:\.\/|\/)[a-zA-Z0-9_\-./]+\.[a-zA-Z0-9]+/g;
|
|
77
|
-
/** Windows file paths: C:\path\to\file */
|
|
78
|
-
const WINDOWS_PATH_RE = /[A-Z]:\\[^\s]+/g;
|
|
79
|
-
/** Double-quoted strings */
|
|
80
|
-
const DOUBLE_QUOTE_RE = /"[^"]*"/g;
|
|
81
|
-
/** Single-quoted strings */
|
|
82
|
-
const SINGLE_QUOTE_RE = /'[^']*'/g;
|
|
83
|
-
/** Backtick-quoted inline code */
|
|
84
|
-
const BACKTICK_RE = /`[^`]+`/g;
|
|
85
|
-
/** Inline JSON objects */
|
|
86
|
-
const INLINE_JSON_RE = /\{[^{}]*"[^"]*"[^{}]*\}/g;
|
|
87
|
-
export class SemanticCompressorService {
|
|
88
|
-
/**
|
|
89
|
-
* Compress natural language text in a prompt.
|
|
90
|
-
*
|
|
91
|
-
* Strategy:
|
|
92
|
-
* 1. Extract all protected regions and replace with placeholders
|
|
93
|
-
* 2. Apply compression rules to remaining text
|
|
94
|
-
* 3. Restore protected regions from placeholders
|
|
95
|
-
* 4. Calculate compression ratio
|
|
96
|
-
*/
|
|
97
|
-
compress(text) {
|
|
98
|
-
if (text === '') {
|
|
99
|
-
return { compressed: '', compressionRatio: 1.0 };
|
|
100
|
-
}
|
|
101
|
-
const originalLength = text.length;
|
|
102
|
-
// Step 1: Extract protected regions
|
|
103
|
-
const protectedRegions = [];
|
|
104
|
-
let working = text;
|
|
105
|
-
const protect = (regex) => {
|
|
106
|
-
working = working.replace(regex, (match) => {
|
|
107
|
-
const index = protectedRegions.length;
|
|
108
|
-
protectedRegions.push(match);
|
|
109
|
-
return `${PLACEHOLDER_PREFIX}${index}${PLACEHOLDER_SUFFIX}`;
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
// Order matters: code blocks first (they may contain other patterns)
|
|
113
|
-
protect(FENCED_CODE_BLOCK_RE);
|
|
114
|
-
protect(INDENTED_CODE_BLOCK_RE);
|
|
115
|
-
protect(URL_RE);
|
|
116
|
-
protect(WINDOWS_PATH_RE);
|
|
117
|
-
protect(UNIX_PATH_RE);
|
|
118
|
-
protect(INLINE_JSON_RE);
|
|
119
|
-
protect(DOUBLE_QUOTE_RE);
|
|
120
|
-
protect(SINGLE_QUOTE_RE);
|
|
121
|
-
protect(BACKTICK_RE);
|
|
122
|
-
// Step 2: Apply compression rules
|
|
123
|
-
working = this.applyPhraseShortening(working);
|
|
124
|
-
working = this.removeFillerWords(working);
|
|
125
|
-
working = this.removeArticles(working);
|
|
126
|
-
working = this.abbreviateTerms(working);
|
|
127
|
-
working = this.collapseWhitespace(working);
|
|
128
|
-
// Step 3: Restore protected regions
|
|
129
|
-
working = working.replace(new RegExp(`${escapeRegex(PLACEHOLDER_PREFIX)}(\\d+)${escapeRegex(PLACEHOLDER_SUFFIX)}`, 'g'), (_, indexStr) => {
|
|
130
|
-
const index = parseInt(indexStr, 10);
|
|
131
|
-
return protectedRegions[index] ?? '';
|
|
132
|
-
});
|
|
133
|
-
const compressedLength = working.length;
|
|
134
|
-
const compressionRatio = originalLength === 0 ? 1.0 : compressedLength / originalLength;
|
|
135
|
-
return { compressed: working, compressionRatio };
|
|
136
|
-
}
|
|
137
|
-
applyPhraseShortening(text) {
|
|
138
|
-
let result = text;
|
|
139
|
-
for (const [pattern, replacement] of PHRASE_REPLACEMENTS) {
|
|
140
|
-
result = result.replace(pattern, replacement);
|
|
141
|
-
}
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
removeFillerWords(text) {
|
|
145
|
-
let result = text;
|
|
146
|
-
for (const pattern of FILLER_WORDS) {
|
|
147
|
-
result = result.replace(pattern, '');
|
|
148
|
-
}
|
|
149
|
-
return result;
|
|
150
|
-
}
|
|
151
|
-
removeArticles(text) {
|
|
152
|
-
let result = text;
|
|
153
|
-
for (const pattern of ARTICLES) {
|
|
154
|
-
result = result.replace(pattern, '');
|
|
155
|
-
}
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
158
|
-
abbreviateTerms(text) {
|
|
159
|
-
let result = text;
|
|
160
|
-
for (const [pattern, replacement] of TERM_ABBREVIATIONS) {
|
|
161
|
-
result = result.replace(pattern, replacement);
|
|
162
|
-
}
|
|
163
|
-
return result;
|
|
164
|
-
}
|
|
165
|
-
collapseWhitespace(text) {
|
|
166
|
-
let result = text;
|
|
167
|
-
// Collapse multiple blank lines to a single blank line
|
|
168
|
-
result = result.replace(/\n{3,}/g, '\n\n');
|
|
169
|
-
// Collapse multiple spaces within lines to a single space
|
|
170
|
-
result = result.replace(/ {2,}/g, ' ');
|
|
171
|
-
// Trim leading/trailing spaces on each line (but keep indentation for protected restored content)
|
|
172
|
-
result = result
|
|
173
|
-
.split('\n')
|
|
174
|
-
.map((line) => {
|
|
175
|
-
// Only trim if line doesn't start with a placeholder
|
|
176
|
-
if (line.includes(PLACEHOLDER_PREFIX)) {
|
|
177
|
-
return line;
|
|
178
|
-
}
|
|
179
|
-
return line.replace(/^ +/, '').replace(/ +$/, '');
|
|
180
|
-
})
|
|
181
|
-
.join('\n');
|
|
182
|
-
return result;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Escape special regex characters in a string.
|
|
187
|
-
*/
|
|
188
|
-
function escapeRegex(str) {
|
|
189
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
190
|
-
}
|
package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill Routing Service
|
|
3
|
-
*
|
|
4
|
-
* Phase-aware skill routing that maps workflow phases to relevant skill sets
|
|
5
|
-
* and generates prompt directives guiding the agent to prioritize them.
|
|
6
|
-
*
|
|
7
|
-
* The default routing table follows FR-3 from the spec:
|
|
8
|
-
* - analyze / requirements: architecture-reviewer, domain modeling skills
|
|
9
|
-
* - research: architecture-reviewer, technology evaluation skills
|
|
10
|
-
* - plan: architecture-reviewer, tdd-guide, implementation-guide
|
|
11
|
-
* - implement / fast-implement: tdd-guide, implementation-guide, framework skills
|
|
12
|
-
* - merge: git-related skills only
|
|
13
|
-
* - evidence: testing and validation skills
|
|
14
|
-
*
|
|
15
|
-
* The routing table is configurable via constructor parameter (settings override).
|
|
16
|
-
*/
|
|
17
|
-
import type { ISkillRoutingService, SkillRoutingResult } from '../../../application/ports/output/services/skill-routing.interface.js';
|
|
18
|
-
export declare class SkillRoutingService implements ISkillRoutingService {
|
|
19
|
-
private readonly routingTable;
|
|
20
|
-
constructor(customRoutes?: Record<string, string[]>);
|
|
21
|
-
/**
|
|
22
|
-
* Get relevant skills and a prompt directive for a workflow phase.
|
|
23
|
-
*/
|
|
24
|
-
getRoutingDirective(phaseName: string): SkillRoutingResult;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=skill-routing.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-routing.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/skill-routing.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,gEAAgE,CAAC;AAgBxE,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8C;gBAE/D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAInD;;OAEG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB;CAiB3D"}
|