@shepai/cli 1.180.0 → 1.181.0-pr539.0993dc0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apis/json-schema/CavemanModeConfig.yaml +14 -0
- package/apis/json-schema/PhaseTiming.yaml +30 -0
- package/apis/json-schema/SubprocessFilterConfig.yaml +11 -0
- package/apis/json-schema/TokenOptimizationConfig.yaml +36 -0
- package/apis/json-schema/WorkflowConfig.yaml +9 -0
- package/dist/packages/core/src/application/ports/output/agents/agent-executor.interface.d.ts +8 -0
- package/dist/packages/core/src/application/ports/output/agents/agent-executor.interface.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/agents/phase-timing-repository.interface.d.ts +8 -1
- 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/alias-compression.interface.d.ts +45 -0
- package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/alias-compression.interface.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts +50 -0
- package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/command-output-filter.interface.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts +57 -0
- package/dist/packages/core/src/application/ports/output/services/delta-context.interface.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/delta-context.interface.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/index.d.ts +7 -0
- package/dist/packages/core/src/application/ports/output/services/index.d.ts.map +1 -1
- package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts +45 -0
- package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/optimization-metrics.interface.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts +86 -0
- package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/prompt-optimizer.interface.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts +43 -0
- package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/semantic-compressor.interface.js +13 -0
- package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts +41 -0
- package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.d.ts.map +1 -0
- package/dist/packages/core/src/application/ports/output/services/skill-routing.interface.js +12 -0
- 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 +21 -0
- package/dist/packages/core/src/domain/generated/output.d.ts +95 -0
- 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 +27 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +9 -0
- 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 +68 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts +29 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/055-add-token-optimization-config.js +77 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/056-add-caveman-mode-config.d.ts +21 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/056-add-caveman-mode-config.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/056-add-caveman-mode-config.js +29 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/057-add-subprocess-filter-config.d.ts +17 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/057-add-subprocess-filter-config.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/057-add-subprocess-filter-config.js +22 -0
- package/dist/packages/core/src/infrastructure/repositories/sqlite-phase-timing.repository.d.ts +2 -1
- 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 +72 -0
- 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 +19 -3
- 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/common/executors/claude-code-executor.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/common/executors/claude-code-executor.service.js +9 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/caveman-directive.d.ts +41 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/caveman-directive.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/caveman-directive.js +51 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts +6 -1
- 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 +18 -1
- 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-worker.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-worker.js +6 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.js +2 -2
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/fast-implement.node.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/fast-implement.node.js +3 -2
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.js +5 -4
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/merge.node.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/merge.node.js +3 -4
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts +27 -0
- 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 +71 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts +42 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/prompt-optimization-context.js +92 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts +1 -0
- 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 +5 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/subprocess-filter-context.d.ts +25 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/subprocess-filter-context.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/subprocess-filter-context.js +67 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/generic-filter.d.ts +13 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/generic-filter.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/generic-filter.js +21 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/git-filter.d.ts +15 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/git-filter.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/git-filter.js +189 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/npm-filter.d.ts +13 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/npm-filter.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/npm-filter.js +96 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/shared-helpers.d.ts +29 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/shared-helpers.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/shared-helpers.js +85 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/shep-filter.d.ts +27 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/shep-filter.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/shep-filter.js +89 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/shim-generator.d.ts +39 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/shim-generator.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/subprocess-filter/shim-generator.js +53 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts +41 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/alias-compression.service.js +111 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts +22 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.js +245 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts +22 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.js +50 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts +36 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/optimization-metrics.service.js +123 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts +57 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/prompt-optimizer.service.js +241 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts +34 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/semantic-compressor.service.js +190 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts +26 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/services/token-optimization/skill-routing.service.js +51 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- 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 +3 -3
- package/web/.next/required-server-files.json +3 -3
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +32 -32
- 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 +30 -30
- 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 +33 -33
- 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 +41 -41
- 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 +41 -41
- 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 +31 -31
- 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 +31 -31
- 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 +30 -30
- 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 +33 -33
- 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 +41 -41
- 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 +41 -41
- 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 +30 -30
- 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 +31 -31
- 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 +31 -31
- 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 +7 -7
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/application/[id]/page/server-reference-manifest.json +15 -15
- package/web/.next/server/app/application/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/application/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/features/page/server-reference-manifest.json +7 -7
- package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +15 -15
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +13 -13
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +7 -7
- 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]__b2a4bfcc._.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_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]__013a0318._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1925bef0._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__4ee8be85._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__e265da61._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0277d3b5._.js +1 -1
- package/web/.next/server/chunks/ssr/_0277d3b5._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_295fffde._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_45496654._.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/{_8caadb9a._.js → _688e1fd9._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_8caadb9a._.js.map → _688e1fd9._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_7931d3de._.js +3 -0
- package/web/.next/server/chunks/ssr/{_36489f2b._.js.map → _7931d3de._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_946a7fc6._.js +1 -1
- package/web/.next/server/chunks/ssr/_946a7fc6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_d44d091a._.js → _bd8c6d0b._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_d44d091a._.js.map → _bd8c6d0b._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{_63fc4647._.js → _ce7571dd._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_63fc4647._.js.map → _ce7571dd._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_eff1b518._.js +1 -1
- package/web/.next/server/chunks/ssr/_eff1b518._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f227429a._.js +1 -1
- package/web/.next/server/chunks/ssr/_f227429a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f5a56a3f._.js +3 -0
- package/web/.next/server/chunks/ssr/{_b8e8b690._.js.map → _f5a56a3f._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_f86fc1bf._.js +1 -1
- package/web/.next/server/chunks/ssr/_f86fc1bf._.js.map +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/src_presentation_web_36f2bc45._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +3 -3
- package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js.map +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_common_base-drawer_base-drawer_tsx_97dfbbc8._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.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_f1edcf5e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.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 +54 -54
- package/web/.next/static/chunks/{f6d47ff35d612852.js → 2bba4ee52a6464cd.js} +3 -3
- package/web/.next/static/chunks/4371be9a949c8fe0.js +1 -0
- package/web/.next/static/chunks/{490667b2a9bb58e2.js → 46bc202f80905332.js} +1 -1
- package/web/.next/static/chunks/{26e2ca76ab6c38b4.js → 51593e45475cb81d.js} +1 -1
- package/web/.next/static/chunks/{c0bd3ffcf94d1845.js → 75d1485ec29b8fd8.js} +1 -1
- package/web/.next/static/chunks/{e7da54dde18e7fb2.js → aba1ec85581d3f1b.js} +1 -1
- package/web/.next/static/chunks/{e2f9e224d1fa1faa.js → abc53f1cc59f4642.js} +1 -1
- package/web/.next/static/chunks/{a1098522326428d1.js → ac069319b2aeab27.js} +1 -1
- package/web/.next/static/chunks/{1fa1574b87bd2eb1.js → b5aadaa3b34d7b8e.js} +1 -1
- package/web/.next/static/chunks/{dfdcccf73de56960.js → b7e697748c35a4ce.js} +1 -1
- package/web/.next/static/chunks/{7849c6797be7c6ca.js → b9135c0d88735f54.js} +2 -2
- package/web/.next/static/chunks/{893a2a76546c66a7.js → c6b5b3f46622241d.js} +1 -1
- package/web/.next/static/chunks/{f28aef9cf5107c4b.js → c9c58949bf064dbe.js} +1 -1
- package/web/.next/static/chunks/{be89c20c257247ad.js → cbf7498ef586ebd3.js} +1 -1
- package/web/.next/static/chunks/{8746807722de67a8.js → d9f55661eb505770.js} +1 -1
- package/web/.next/static/chunks/{7bc7028587490fff.js → e3d4828e3b7291df.js} +1 -1
- package/web/.next/server/chunks/ssr/_36489f2b._.js +0 -3
- package/web/.next/server/chunks/ssr/_b8e8b690._.js +0 -3
- package/web/.next/static/chunks/1bc12075020723ed.js +0 -1
- /package/web/.next/static/{GQFJf3UCD4D5C4NCn8eXl → 73VlrUiVfmfr0uTiP1eN1}/_buildManifest.js +0 -0
- /package/web/.next/static/{GQFJf3UCD4D5C4NCn8eXl → 73VlrUiVfmfr0uTiP1eN1}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{GQFJf3UCD4D5C4NCn8eXl → 73VlrUiVfmfr0uTiP1eN1}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,245 @@
|
|
|
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
|
+
}
|
package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/packages/core/src/infrastructure/services/token-optimization/delta-context.service.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,123 @@
|
|
|
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 };
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;IA4HpC;;;;OAIG;YACW,uBAAuB;IAcrC;;;OAGG;IACH,OAAO,CAAC,UAAU;CAkBnB"}
|