@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
package/dist/packages/core/src/infrastructure/services/subprocess-filter/filters/shared-helpers.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers used across all subprocess output filters.
|
|
3
|
+
*
|
|
4
|
+
* These are small, pure functions for text transformation —
|
|
5
|
+
* deduplication, blank-line collapsing, ANSI stripping, and
|
|
6
|
+
* middle-truncation. Each filter composes from these primitives.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Strip ANSI escape sequences (colors, cursor movement, etc.).
|
|
10
|
+
* Covers standard SGR sequences: \x1b[0;31m, \x1b[1m, etc.
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line no-control-regex
|
|
13
|
+
const ANSI_REGEX = /\x1b\[[0-9;]*[a-zA-Z]/g;
|
|
14
|
+
export function stripAnsi(text) {
|
|
15
|
+
return text.replace(ANSI_REGEX, '');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Collapse runs of 3+ consecutive blank lines into a single blank line.
|
|
19
|
+
* Trims trailing whitespace from each line as a side effect.
|
|
20
|
+
*/
|
|
21
|
+
export function collapseBlankLines(text) {
|
|
22
|
+
const lines = text.split('\n');
|
|
23
|
+
const result = [];
|
|
24
|
+
let consecutiveBlanks = 0;
|
|
25
|
+
for (const line of lines) {
|
|
26
|
+
const trimmed = line.trimEnd();
|
|
27
|
+
if (trimmed.length === 0) {
|
|
28
|
+
consecutiveBlanks++;
|
|
29
|
+
if (consecutiveBlanks <= 2) {
|
|
30
|
+
result.push('');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
consecutiveBlanks = 0;
|
|
35
|
+
result.push(trimmed);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return result.join('\n');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Deduplicate consecutive identical lines, appending a count.
|
|
42
|
+
*
|
|
43
|
+
* Example:
|
|
44
|
+
* "ok\nok\nok\nfail" → "ok (×3)\nfail"
|
|
45
|
+
*/
|
|
46
|
+
export function deduplicateLines(text) {
|
|
47
|
+
const lines = text.split('\n');
|
|
48
|
+
if (lines.length === 0)
|
|
49
|
+
return text;
|
|
50
|
+
const result = [];
|
|
51
|
+
let prevLine = lines[0];
|
|
52
|
+
let count = 1;
|
|
53
|
+
for (let i = 1; i < lines.length; i++) {
|
|
54
|
+
if (lines[i] === prevLine) {
|
|
55
|
+
count++;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
result.push(count > 1 ? `${prevLine} (×${count})` : prevLine);
|
|
59
|
+
prevLine = lines[i];
|
|
60
|
+
count = 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
result.push(count > 1 ? `${prevLine} (×${count})` : prevLine);
|
|
64
|
+
return result.join('\n');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Truncate text that exceeds maxLines by keeping the top half and
|
|
68
|
+
* bottom quarter, inserting an omission marker in the middle.
|
|
69
|
+
*
|
|
70
|
+
* Preserves the head (most likely context/setup) and tail (most
|
|
71
|
+
* likely summary/errors) which are the parts LLMs benefit from most.
|
|
72
|
+
*/
|
|
73
|
+
export function truncateMiddle(text, maxLines) {
|
|
74
|
+
const lines = text.split('\n');
|
|
75
|
+
if (lines.length <= maxLines)
|
|
76
|
+
return text;
|
|
77
|
+
const keepTop = Math.ceil(maxLines * 0.6);
|
|
78
|
+
const keepBottom = maxLines - keepTop - 1;
|
|
79
|
+
const omitted = lines.length - keepTop - keepBottom;
|
|
80
|
+
return [
|
|
81
|
+
...lines.slice(0, keepTop),
|
|
82
|
+
`... ${omitted} lines omitted ...`,
|
|
83
|
+
...lines.slice(lines.length - keepBottom),
|
|
84
|
+
].join('\n');
|
|
85
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shep-filter — tiny CLI entry point for subprocess output filtering.
|
|
3
|
+
*
|
|
4
|
+
* Invoked by PATH-shadow wrapper scripts inside the Claude Code
|
|
5
|
+
* subprocess:
|
|
6
|
+
*
|
|
7
|
+
* shep-filter git status --porcelain
|
|
8
|
+
* shep-filter npm test
|
|
9
|
+
*
|
|
10
|
+
* Flow:
|
|
11
|
+
* 1. Parse args to extract the real command name and its arguments
|
|
12
|
+
* 2. Spawn the real command (resolved from PATH, skipping our shim dir)
|
|
13
|
+
* 3. Capture stdout + stderr
|
|
14
|
+
* 4. Pipe stdout through the appropriate filter
|
|
15
|
+
* 5. Print filtered stdout, pass stderr through, exit with the child's code
|
|
16
|
+
*
|
|
17
|
+
* On any filter error: emit raw stdout unchanged (fail-open).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Run the filter pipeline. Exported for testing; the CLI entry point
|
|
21
|
+
* at the bottom of this file calls this with `process.argv`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function runFilter(argv: string[], env: NodeJS.ProcessEnv): {
|
|
24
|
+
stdout: string;
|
|
25
|
+
exitCode: number;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=shep-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shep-filter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/subprocess-filter/shep-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAeH;;;GAGG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAgDtC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shep-filter — tiny CLI entry point for subprocess output filtering.
|
|
3
|
+
*
|
|
4
|
+
* Invoked by PATH-shadow wrapper scripts inside the Claude Code
|
|
5
|
+
* subprocess:
|
|
6
|
+
*
|
|
7
|
+
* shep-filter git status --porcelain
|
|
8
|
+
* shep-filter npm test
|
|
9
|
+
*
|
|
10
|
+
* Flow:
|
|
11
|
+
* 1. Parse args to extract the real command name and its arguments
|
|
12
|
+
* 2. Spawn the real command (resolved from PATH, skipping our shim dir)
|
|
13
|
+
* 3. Capture stdout + stderr
|
|
14
|
+
* 4. Pipe stdout through the appropriate filter
|
|
15
|
+
* 5. Print filtered stdout, pass stderr through, exit with the child's code
|
|
16
|
+
*
|
|
17
|
+
* On any filter error: emit raw stdout unchanged (fail-open).
|
|
18
|
+
*/
|
|
19
|
+
import { execFileSync } from 'node:child_process';
|
|
20
|
+
import { filterGit } from './filters/git-filter.js';
|
|
21
|
+
import { filterNpm } from './filters/npm-filter.js';
|
|
22
|
+
import { filterGeneric } from './filters/generic-filter.js';
|
|
23
|
+
/** Dispatch table: command name → filter function(subcommand, output). */
|
|
24
|
+
const FILTERS = {
|
|
25
|
+
git: filterGit,
|
|
26
|
+
npm: filterNpm,
|
|
27
|
+
pnpm: filterNpm,
|
|
28
|
+
yarn: filterNpm,
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Run the filter pipeline. Exported for testing; the CLI entry point
|
|
32
|
+
* at the bottom of this file calls this with `process.argv`.
|
|
33
|
+
*/
|
|
34
|
+
export function runFilter(argv, env) {
|
|
35
|
+
// argv: [node, shep-filter.js, <command>, <subcommand?>, ...args]
|
|
36
|
+
const command = argv[2];
|
|
37
|
+
const subcommand = argv[3] ?? '';
|
|
38
|
+
const childArgs = argv.slice(3);
|
|
39
|
+
if (!command) {
|
|
40
|
+
return { stdout: '', exitCode: 1 };
|
|
41
|
+
}
|
|
42
|
+
// Resolve the REAL binary by stripping our shim dir from PATH.
|
|
43
|
+
// The shim dir is passed via SHEP_FILTER_SHIM_DIR env var so we
|
|
44
|
+
// know which PATH entry to skip.
|
|
45
|
+
const shimDir = env.SHEP_FILTER_SHIM_DIR ?? '';
|
|
46
|
+
const realPath = (env.PATH ?? '')
|
|
47
|
+
.split(':')
|
|
48
|
+
.filter((p) => p !== shimDir)
|
|
49
|
+
.join(':');
|
|
50
|
+
let rawStdout;
|
|
51
|
+
let exitCode;
|
|
52
|
+
try {
|
|
53
|
+
rawStdout = execFileSync(command, childArgs, {
|
|
54
|
+
encoding: 'utf-8',
|
|
55
|
+
env: { ...env, PATH: realPath },
|
|
56
|
+
stdio: ['inherit', 'pipe', 'inherit'],
|
|
57
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
58
|
+
});
|
|
59
|
+
exitCode = 0;
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
// execFileSync throws on non-zero exit. Extract output + code.
|
|
63
|
+
const execErr = err;
|
|
64
|
+
rawStdout = typeof execErr.stdout === 'string' ? execErr.stdout : '';
|
|
65
|
+
exitCode = typeof execErr.status === 'number' ? execErr.status : 1;
|
|
66
|
+
// On error, preserve full output — errors must never be filtered.
|
|
67
|
+
return { stdout: rawStdout, exitCode };
|
|
68
|
+
}
|
|
69
|
+
// Apply the filter (fail-open: if the filter crashes, emit raw).
|
|
70
|
+
try {
|
|
71
|
+
const filterFn = FILTERS[command];
|
|
72
|
+
const filtered = filterFn ? filterFn(subcommand, rawStdout) : filterGeneric(rawStdout);
|
|
73
|
+
return { stdout: filtered, exitCode };
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return { stdout: rawStdout, exitCode };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// --- CLI entry point ---
|
|
80
|
+
// Only runs when this file is the main module (not when imported for testing).
|
|
81
|
+
const isMainModule = typeof process !== 'undefined' &&
|
|
82
|
+
process.argv[1] &&
|
|
83
|
+
(process.argv[1].endsWith('shep-filter.js') || process.argv[1].endsWith('shep-filter.ts'));
|
|
84
|
+
if (isMainModule) {
|
|
85
|
+
const { stdout, exitCode } = runFilter(process.argv, process.env);
|
|
86
|
+
if (stdout)
|
|
87
|
+
process.stdout.write(stdout);
|
|
88
|
+
process.exit(exitCode);
|
|
89
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim generator — creates a per-worker temp directory containing
|
|
3
|
+
* wrapper scripts that shadow real commands (git, npm, pnpm, yarn)
|
|
4
|
+
* and pipe their output through shep-filter.
|
|
5
|
+
*
|
|
6
|
+
* The temp directory is prepended to PATH in the subprocess env so
|
|
7
|
+
* that when Claude Code's Bash tool runs `git status`, it hits our
|
|
8
|
+
* wrapper first. The wrapper:
|
|
9
|
+
*
|
|
10
|
+
* 1. Sets SHEP_FILTER_SHIM_DIR so shep-filter can skip our dir when
|
|
11
|
+
* resolving the real binary
|
|
12
|
+
* 2. Calls `node <path-to-shep-filter.js> <command> "$@"`
|
|
13
|
+
* 3. Exits with shep-filter's exit code
|
|
14
|
+
*
|
|
15
|
+
* On macOS/Linux the wrappers are bash scripts with +x.
|
|
16
|
+
* On Windows they are .cmd files (not yet implemented — TODO).
|
|
17
|
+
*/
|
|
18
|
+
export interface ShimDirectory {
|
|
19
|
+
/** Absolute path to the temp directory containing the shim scripts. */
|
|
20
|
+
path: string;
|
|
21
|
+
/** The commands that have shims in this directory. */
|
|
22
|
+
commands: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a temp directory with shim scripts for all supported commands.
|
|
26
|
+
*
|
|
27
|
+
* @param shepFilterPath - Absolute path to the compiled shep-filter.js
|
|
28
|
+
* @returns The shim directory info needed for PATH prepending
|
|
29
|
+
*/
|
|
30
|
+
export declare function createShimDirectory(shepFilterPath: string): ShimDirectory;
|
|
31
|
+
/**
|
|
32
|
+
* Build a modified PATH string with the shim directory prepended.
|
|
33
|
+
*
|
|
34
|
+
* @param shimDir - The shim directory path
|
|
35
|
+
* @param originalPath - The original PATH from the environment
|
|
36
|
+
* @returns The new PATH value with shimDir first
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildFilteredPath(shimDir: string, originalPath: string): string;
|
|
39
|
+
//# sourceMappingURL=shim-generator.d.ts.map
|
package/dist/packages/core/src/infrastructure/services/subprocess-filter/shim-generator.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim-generator.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/subprocess-filter/shim-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,CAiBzE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim generator — creates a per-worker temp directory containing
|
|
3
|
+
* wrapper scripts that shadow real commands (git, npm, pnpm, yarn)
|
|
4
|
+
* and pipe their output through shep-filter.
|
|
5
|
+
*
|
|
6
|
+
* The temp directory is prepended to PATH in the subprocess env so
|
|
7
|
+
* that when Claude Code's Bash tool runs `git status`, it hits our
|
|
8
|
+
* wrapper first. The wrapper:
|
|
9
|
+
*
|
|
10
|
+
* 1. Sets SHEP_FILTER_SHIM_DIR so shep-filter can skip our dir when
|
|
11
|
+
* resolving the real binary
|
|
12
|
+
* 2. Calls `node <path-to-shep-filter.js> <command> "$@"`
|
|
13
|
+
* 3. Exits with shep-filter's exit code
|
|
14
|
+
*
|
|
15
|
+
* On macOS/Linux the wrappers are bash scripts with +x.
|
|
16
|
+
* On Windows they are .cmd files (not yet implemented — TODO).
|
|
17
|
+
*/
|
|
18
|
+
import { mkdtempSync, writeFileSync, chmodSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { tmpdir } from 'node:os';
|
|
21
|
+
/** Commands we generate shims for. */
|
|
22
|
+
const SHIMMED_COMMANDS = ['git', 'npm', 'pnpm', 'yarn'];
|
|
23
|
+
/**
|
|
24
|
+
* Create a temp directory with shim scripts for all supported commands.
|
|
25
|
+
*
|
|
26
|
+
* @param shepFilterPath - Absolute path to the compiled shep-filter.js
|
|
27
|
+
* @returns The shim directory info needed for PATH prepending
|
|
28
|
+
*/
|
|
29
|
+
export function createShimDirectory(shepFilterPath) {
|
|
30
|
+
const shimDir = mkdtempSync(join(tmpdir(), 'shep-filter-'));
|
|
31
|
+
for (const cmd of SHIMMED_COMMANDS) {
|
|
32
|
+
const shimPath = join(shimDir, cmd);
|
|
33
|
+
const script = [
|
|
34
|
+
'#!/usr/bin/env bash',
|
|
35
|
+
'# Auto-generated shep-filter shim — do not edit',
|
|
36
|
+
`export SHEP_FILTER_SHIM_DIR="${shimDir}"`,
|
|
37
|
+
`exec node "${shepFilterPath}" "${cmd}" "$@"`,
|
|
38
|
+
].join('\n');
|
|
39
|
+
writeFileSync(shimPath, script, 'utf-8');
|
|
40
|
+
chmodSync(shimPath, 0o755);
|
|
41
|
+
}
|
|
42
|
+
return { path: shimDir, commands: SHIMMED_COMMANDS };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build a modified PATH string with the shim directory prepended.
|
|
46
|
+
*
|
|
47
|
+
* @param shimDir - The shim directory path
|
|
48
|
+
* @param originalPath - The original PATH from the environment
|
|
49
|
+
* @returns The new PATH value with shimDir first
|
|
50
|
+
*/
|
|
51
|
+
export function buildFilteredPath(shimDir, originalPath) {
|
|
52
|
+
return `${shimDir}:${originalPath}`;
|
|
53
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alias Compression Service
|
|
3
|
+
*
|
|
4
|
+
* Session dictionary-based alias compression for prompts. Scans text for
|
|
5
|
+
* repeated long strings (3+ occurrences, 20+ characters), assigns short
|
|
6
|
+
* aliases ($A1, $A2, ...), prepends a dictionary header, and replaces
|
|
7
|
+
* all occurrences. A net-positive check ensures the dictionary overhead
|
|
8
|
+
* does not exceed the savings from aliasing.
|
|
9
|
+
*/
|
|
10
|
+
import type { IAliasCompressionService, AliasCompressionResult } from '../../../application/ports/output/services/alias-compression.interface.js';
|
|
11
|
+
export declare class AliasCompressionService implements IAliasCompressionService {
|
|
12
|
+
/**
|
|
13
|
+
* Apply alias compression to a prompt string.
|
|
14
|
+
*
|
|
15
|
+
* Strategy:
|
|
16
|
+
* 1. Find all substrings appearing 3+ times that are 20+ chars
|
|
17
|
+
* 2. Sort by frequency (most frequent first) for optimal alias assignment
|
|
18
|
+
* 3. Compute net savings — skip if dictionary overhead exceeds body savings
|
|
19
|
+
* 4. Build dictionary header and replace occurrences
|
|
20
|
+
*/
|
|
21
|
+
compress(text: string): AliasCompressionResult;
|
|
22
|
+
/**
|
|
23
|
+
* Find all substrings that qualify for aliasing.
|
|
24
|
+
*
|
|
25
|
+
* Uses word-boundary-aware token extraction to find repeated multi-word
|
|
26
|
+
* strings. Scans for non-whitespace tokens of sufficient length, then
|
|
27
|
+
* checks if longer contiguous phrases also repeat enough times.
|
|
28
|
+
*/
|
|
29
|
+
private findCandidates;
|
|
30
|
+
/**
|
|
31
|
+
* Remove candidates that are substrings of longer candidates with
|
|
32
|
+
* equal or greater frequency (the longer alias provides more savings).
|
|
33
|
+
*/
|
|
34
|
+
private removeSubsumedCandidates;
|
|
35
|
+
/**
|
|
36
|
+
* Build the dictionary header string.
|
|
37
|
+
* Format: "## Aliases\n$A1 = "original"\n$A2 = "original"\n\n"
|
|
38
|
+
*/
|
|
39
|
+
private buildDictionaryHeader;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=alias-compression.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias-compression.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/alias-compression.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,oEAAoE,CAAC;AAmB5E,qBAAa,uBAAwB,YAAW,wBAAwB;IACtE;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB;IA6C9C;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAyBtB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAI9B"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alias Compression Service
|
|
3
|
+
*
|
|
4
|
+
* Session dictionary-based alias compression for prompts. Scans text for
|
|
5
|
+
* repeated long strings (3+ occurrences, 20+ characters), assigns short
|
|
6
|
+
* aliases ($A1, $A2, ...), prepends a dictionary header, and replaces
|
|
7
|
+
* all occurrences. A net-positive check ensures the dictionary overhead
|
|
8
|
+
* does not exceed the savings from aliasing.
|
|
9
|
+
*/
|
|
10
|
+
/** Minimum number of occurrences for a string to qualify for aliasing. */
|
|
11
|
+
const MIN_OCCURRENCES = 3;
|
|
12
|
+
/** Minimum character length for a string to qualify for aliasing. */
|
|
13
|
+
const MIN_LENGTH = 20;
|
|
14
|
+
/** Alias prefix format: $A1, $A2, ... */
|
|
15
|
+
const ALIAS_PREFIX = '$A';
|
|
16
|
+
export class AliasCompressionService {
|
|
17
|
+
/**
|
|
18
|
+
* Apply alias compression to a prompt string.
|
|
19
|
+
*
|
|
20
|
+
* Strategy:
|
|
21
|
+
* 1. Find all substrings appearing 3+ times that are 20+ chars
|
|
22
|
+
* 2. Sort by frequency (most frequent first) for optimal alias assignment
|
|
23
|
+
* 3. Compute net savings — skip if dictionary overhead exceeds body savings
|
|
24
|
+
* 4. Build dictionary header and replace occurrences
|
|
25
|
+
*/
|
|
26
|
+
compress(text) {
|
|
27
|
+
if (text === '') {
|
|
28
|
+
return { compressed: '', dictionaryHeader: '', aliasCount: 0 };
|
|
29
|
+
}
|
|
30
|
+
// Step 1: Find candidate strings
|
|
31
|
+
const candidates = this.findCandidates(text);
|
|
32
|
+
if (candidates.length === 0) {
|
|
33
|
+
return { compressed: text, dictionaryHeader: '', aliasCount: 0 };
|
|
34
|
+
}
|
|
35
|
+
// Step 2: Sort by frequency descending (most repeated first)
|
|
36
|
+
candidates.sort((a, b) => b.count - a.count);
|
|
37
|
+
// Step 3: Assign aliases and compute net savings
|
|
38
|
+
const aliases = candidates.map((candidate, index) => ({
|
|
39
|
+
...candidate,
|
|
40
|
+
alias: `${ALIAS_PREFIX}${index + 1}`,
|
|
41
|
+
}));
|
|
42
|
+
// Calculate savings
|
|
43
|
+
const dictionaryHeader = this.buildDictionaryHeader(aliases);
|
|
44
|
+
const bodySavings = aliases.reduce((total, { original, alias, count }) => total + count * (original.length - alias.length), 0);
|
|
45
|
+
const netSavings = bodySavings - dictionaryHeader.length;
|
|
46
|
+
if (netSavings <= 0) {
|
|
47
|
+
return { compressed: text, dictionaryHeader: '', aliasCount: 0 };
|
|
48
|
+
}
|
|
49
|
+
// Step 4: Replace occurrences in text
|
|
50
|
+
let body = text;
|
|
51
|
+
for (const { original, alias } of aliases) {
|
|
52
|
+
body = body.replaceAll(original, alias);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
compressed: dictionaryHeader + body,
|
|
56
|
+
dictionaryHeader,
|
|
57
|
+
aliasCount: aliases.length,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Find all substrings that qualify for aliasing.
|
|
62
|
+
*
|
|
63
|
+
* Uses word-boundary-aware token extraction to find repeated multi-word
|
|
64
|
+
* strings. Scans for non-whitespace tokens of sufficient length, then
|
|
65
|
+
* checks if longer contiguous phrases also repeat enough times.
|
|
66
|
+
*/
|
|
67
|
+
findCandidates(text) {
|
|
68
|
+
// Extract all non-whitespace tokens of 20+ chars
|
|
69
|
+
const longTokens = new Map();
|
|
70
|
+
// Match sequences of non-whitespace characters that are 20+ chars
|
|
71
|
+
const tokenRegex = /\S{20,}/g;
|
|
72
|
+
let match;
|
|
73
|
+
while ((match = tokenRegex.exec(text)) !== null) {
|
|
74
|
+
const token = match[0];
|
|
75
|
+
longTokens.set(token, (longTokens.get(token) ?? 0) + 1);
|
|
76
|
+
}
|
|
77
|
+
// Filter to candidates meeting the occurrence threshold
|
|
78
|
+
const candidates = [];
|
|
79
|
+
for (const [token, count] of longTokens) {
|
|
80
|
+
if (count >= MIN_OCCURRENCES && token.length >= MIN_LENGTH) {
|
|
81
|
+
candidates.push({ original: token, count });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Remove candidates that are substrings of other candidates with same or higher count
|
|
85
|
+
return this.removeSubsumedCandidates(candidates);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Remove candidates that are substrings of longer candidates with
|
|
89
|
+
* equal or greater frequency (the longer alias provides more savings).
|
|
90
|
+
*/
|
|
91
|
+
removeSubsumedCandidates(candidates) {
|
|
92
|
+
// Sort by length descending so longer strings are checked first
|
|
93
|
+
const sorted = [...candidates].sort((a, b) => b.original.length - a.original.length);
|
|
94
|
+
const result = [];
|
|
95
|
+
for (const candidate of sorted) {
|
|
96
|
+
const isSubsumed = result.some((existing) => existing.original.includes(candidate.original) && existing.count >= candidate.count);
|
|
97
|
+
if (!isSubsumed) {
|
|
98
|
+
result.push(candidate);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Build the dictionary header string.
|
|
105
|
+
* Format: "## Aliases\n$A1 = "original"\n$A2 = "original"\n\n"
|
|
106
|
+
*/
|
|
107
|
+
buildDictionaryHeader(aliases) {
|
|
108
|
+
const lines = aliases.map(({ alias, original }) => `${alias} = "${original}"`);
|
|
109
|
+
return `## Aliases\n${lines.join('\n')}\n\n`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Output Filter Service
|
|
3
|
+
*
|
|
4
|
+
* Regex-based filter that reduces test/build/git output tokens embedded in
|
|
5
|
+
* prompts while preserving all error-relevant lines. Applies configurable
|
|
6
|
+
* filter policies within fenced code blocks only.
|
|
7
|
+
*
|
|
8
|
+
* Safety guarantee: any line containing error-related keywords is preserved
|
|
9
|
+
* verbatim regardless of other filter rules.
|
|
10
|
+
*/
|
|
11
|
+
import type { ICommandOutputFilterService, CommandOutputFilterResult } from '../../../application/ports/output/services/command-output-filter.interface.js';
|
|
12
|
+
export declare class CommandOutputFilterService implements ICommandOutputFilterService {
|
|
13
|
+
/**
|
|
14
|
+
* Filter command output embedded in a prompt string.
|
|
15
|
+
*
|
|
16
|
+
* Detects fenced code blocks and applies reduction policies within them.
|
|
17
|
+
* Text outside code blocks is never modified. Lines containing error-related
|
|
18
|
+
* keywords are always preserved.
|
|
19
|
+
*/
|
|
20
|
+
filter(prompt: string): CommandOutputFilterResult;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=command-output-filter.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-output-filter.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/token-optimization/command-output-filter.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,wEAAwE,CAAC;AA2MhF,qBAAa,0BAA2B,YAAW,2BAA2B;IAC5E;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,yBAAyB;CAkDlD"}
|