reviewflow 3.32.0 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/main/routes.d.ts.map +1 -1
- package/dist/main/routes.js +56 -5
- package/dist/main/routes.js.map +1 -1
- package/dist/main/server.d.ts.map +1 -1
- package/dist/main/server.js +5 -1
- package/dist/main/server.js.map +1 -1
- package/dist/modules/claude-invocation/entities/claudeSession/claudeSession.guard.d.ts +1 -1
- package/dist/modules/claude-invocation/entities/claudeSession/claudeSession.schema.d.ts +2 -0
- package/dist/modules/claude-invocation/entities/claudeSession/claudeSession.schema.d.ts.map +1 -1
- package/dist/modules/claude-invocation/entities/claudeSession/claudeSession.schema.js +1 -1
- package/dist/modules/claude-invocation/entities/claudeSession/claudeSession.schema.js.map +1 -1
- package/dist/modules/{ember-chat/interface-adapters/gateways/emberStreamJson.parser.d.ts → claude-invocation/interface-adapters/gateways/transcriptStreamJson.parser.d.ts} +1 -1
- package/dist/modules/claude-invocation/interface-adapters/gateways/transcriptStreamJson.parser.d.ts.map +1 -0
- package/dist/modules/{ember-chat/interface-adapters/gateways/emberStreamJson.parser.js → claude-invocation/interface-adapters/gateways/transcriptStreamJson.parser.js} +1 -1
- package/dist/modules/claude-invocation/interface-adapters/gateways/transcriptStreamJson.parser.js.map +1 -0
- package/dist/modules/ember-chat/interface-adapters/gateways/emberAnswerTransport.claude.gateway.js +1 -1
- package/dist/modules/ember-chat/interface-adapters/gateways/emberAnswerTransport.claude.gateway.js.map +1 -1
- package/dist/modules/platform-integration/entities/egressScan/egressScan.defaults.d.ts +3 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.defaults.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.defaults.js +9 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.defaults.js.map +1 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.gateway.d.ts +28 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.gateway.js +2 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.gateway.js.map +1 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.scanner.d.ts +11 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.scanner.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.scanner.js +70 -0
- package/dist/modules/platform-integration/entities/egressScan/egressScan.scanner.js.map +1 -0
- package/dist/modules/platform-integration/entities/egressScan/egressTrace.gateway.d.ts +5 -0
- package/dist/modules/platform-integration/entities/egressScan/egressTrace.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/egressScan/egressTrace.gateway.js +2 -0
- package/dist/modules/platform-integration/entities/egressScan/egressTrace.gateway.js.map +1 -0
- package/dist/modules/platform-integration/entities/executorToken/executorCapability.d.ts +9 -0
- package/dist/modules/platform-integration/entities/executorToken/executorCapability.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/executorToken/executorCapability.js +10 -0
- package/dist/modules/platform-integration/entities/executorToken/executorCapability.js.map +1 -0
- package/dist/modules/platform-integration/entities/idempotency/idempotencyStore.gateway.d.ts +4 -0
- package/dist/modules/platform-integration/entities/idempotency/idempotencyStore.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/idempotency/idempotencyStore.gateway.js +2 -0
- package/dist/modules/platform-integration/entities/idempotency/idempotencyStore.gateway.js.map +1 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.d.ts +27 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.gateway.d.ts +13 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.gateway.js +2 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.gateway.js.map +1 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.js +21 -0
- package/dist/modules/platform-integration/entities/memberAccess/memberAccess.js.map +1 -0
- package/dist/modules/platform-integration/entities/transport/cidr.d.ts +2 -0
- package/dist/modules/platform-integration/entities/transport/cidr.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/transport/cidr.js +36 -0
- package/dist/modules/platform-integration/entities/transport/cidr.js.map +1 -0
- package/dist/modules/platform-integration/entities/transport/clientIpResolver.gateway.d.ts +8 -0
- package/dist/modules/platform-integration/entities/transport/clientIpResolver.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/transport/clientIpResolver.gateway.js +2 -0
- package/dist/modules/platform-integration/entities/transport/clientIpResolver.gateway.js.map +1 -0
- package/dist/modules/platform-integration/entities/transport/transportContext.d.ts +16 -0
- package/dist/modules/platform-integration/entities/transport/transportContext.d.ts.map +1 -0
- package/dist/modules/platform-integration/entities/transport/transportContext.js +2 -0
- package/dist/modules/platform-integration/entities/transport/transportContext.js.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/github.controller.d.ts.map +1 -1
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/github.controller.js +4 -4
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/github.controller.js.map +1 -1
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/gitlab.controller.d.ts +5 -1
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/gitlab.controller.d.ts.map +1 -1
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/gitlab.controller.js +112 -18
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/gitlab.controller.js.map +1 -1
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/transportGuard.middleware.d.ts +25 -0
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/transportGuard.middleware.d.ts.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/transportGuard.middleware.js +26 -0
- package/dist/modules/platform-integration/interface-adapters/controllers/webhook/transportGuard.middleware.js.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.d.ts +14 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.js +34 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.js.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.gateway.d.ts +14 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.gateway.js +27 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.gateway.js.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/loggerEgressTrace.gateway.d.ts +9 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/loggerEgressTrace.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/loggerEgressTrace.gateway.js +14 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/loggerEgressTrace.gateway.js.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/memberAccess.gitlab.cli.gateway.d.ts +31 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/memberAccess.gitlab.cli.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/memberAccess.gitlab.cli.gateway.js +83 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/memberAccess.gitlab.cli.gateway.js.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/scopedGitLabExecutor.d.ts +17 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/scopedGitLabExecutor.d.ts.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/scopedGitLabExecutor.js +17 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/scopedGitLabExecutor.js.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/threadFetch.gitlab.gateway.d.ts +6 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/threadFetch.gitlab.gateway.d.ts.map +1 -1
- package/dist/modules/platform-integration/interface-adapters/gateways/threadFetch.gitlab.gateway.js +28 -1
- package/dist/modules/platform-integration/interface-adapters/gateways/threadFetch.gitlab.gateway.js.map +1 -1
- package/dist/modules/platform-integration/interface-adapters/gateways/transport/clientIpResolver.forwardedFor.gateway.d.ts +5 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/transport/clientIpResolver.forwardedFor.gateway.d.ts.map +1 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/transport/clientIpResolver.forwardedFor.gateway.js +16 -0
- package/dist/modules/platform-integration/interface-adapters/gateways/transport/clientIpResolver.forwardedFor.gateway.js.map +1 -0
- package/dist/modules/platform-integration/services/autoExecutorActionFilter.d.ts +9 -0
- package/dist/modules/platform-integration/services/autoExecutorActionFilter.d.ts.map +1 -0
- package/dist/modules/platform-integration/services/autoExecutorActionFilter.js +33 -0
- package/dist/modules/platform-integration/services/autoExecutorActionFilter.js.map +1 -0
- package/dist/modules/platform-integration/services/pinnedThreadFetchTarget.d.ts +23 -0
- package/dist/modules/platform-integration/services/pinnedThreadFetchTarget.d.ts.map +1 -0
- package/dist/modules/platform-integration/services/pinnedThreadFetchTarget.js +21 -0
- package/dist/modules/platform-integration/services/pinnedThreadFetchTarget.js.map +1 -0
- package/dist/modules/platform-integration/services/scopedExecutorEnvironment.d.ts +21 -0
- package/dist/modules/platform-integration/services/scopedExecutorEnvironment.d.ts.map +1 -0
- package/dist/modules/platform-integration/services/scopedExecutorEnvironment.js +39 -0
- package/dist/modules/platform-integration/services/scopedExecutorEnvironment.js.map +1 -0
- package/dist/modules/platform-integration/usecases/isTrustedActor.usecase.d.ts +17 -0
- package/dist/modules/platform-integration/usecases/isTrustedActor.usecase.d.ts.map +1 -0
- package/dist/modules/platform-integration/usecases/isTrustedActor.usecase.js +23 -0
- package/dist/modules/platform-integration/usecases/isTrustedActor.usecase.js.map +1 -0
- package/dist/modules/platform-integration/usecases/transport/evaluateTransport.usecase.d.ts +3 -0
- package/dist/modules/platform-integration/usecases/transport/evaluateTransport.usecase.d.ts.map +1 -0
- package/dist/modules/platform-integration/usecases/transport/evaluateTransport.usecase.js +18 -0
- package/dist/modules/platform-integration/usecases/transport/evaluateTransport.usecase.js.map +1 -0
- package/dist/modules/review-execution/entities/actionProvenance/actionProvenance.d.ts +9 -0
- package/dist/modules/review-execution/entities/actionProvenance/actionProvenance.d.ts.map +1 -0
- package/dist/modules/review-execution/entities/actionProvenance/actionProvenance.js +11 -0
- package/dist/modules/review-execution/entities/actionProvenance/actionProvenance.js.map +1 -0
- package/dist/modules/review-execution/entities/threadInventory/threadInventory.gateway.d.ts +13 -0
- package/dist/modules/review-execution/entities/threadInventory/threadInventory.gateway.d.ts.map +1 -0
- package/dist/modules/review-execution/entities/threadInventory/threadInventory.gateway.js +2 -0
- package/dist/modules/review-execution/entities/threadInventory/threadInventory.gateway.js.map +1 -0
- package/dist/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.d.ts +14 -0
- package/dist/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.d.ts.map +1 -0
- package/dist/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.js +31 -0
- package/dist/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.js.map +1 -0
- package/dist/modules/review-execution/services/constrainActionSurface.d.ts +19 -0
- package/dist/modules/review-execution/services/constrainActionSurface.d.ts.map +1 -0
- package/dist/modules/review-execution/services/constrainActionSurface.js +49 -0
- package/dist/modules/review-execution/services/constrainActionSurface.js.map +1 -0
- package/dist/modules/review-execution/services/contextActionsExecutor.d.ts +2 -1
- package/dist/modules/review-execution/services/contextActionsExecutor.d.ts.map +1 -1
- package/dist/modules/review-execution/services/contextActionsExecutor.js +20 -2
- package/dist/modules/review-execution/services/contextActionsExecutor.js.map +1 -1
- package/dist/modules/review-execution/services/dispatchConstrainedActions.d.ts +30 -0
- package/dist/modules/review-execution/services/dispatchConstrainedActions.d.ts.map +1 -0
- package/dist/modules/review-execution/services/dispatchConstrainedActions.js +20 -0
- package/dist/modules/review-execution/services/dispatchConstrainedActions.js.map +1 -0
- package/dist/modules/review-execution/services/publicOutputExecutor.d.ts +10 -0
- package/dist/modules/review-execution/services/publicOutputExecutor.d.ts.map +1 -0
- package/dist/modules/review-execution/services/publicOutputExecutor.js +27 -0
- package/dist/modules/review-execution/services/publicOutputExecutor.js.map +1 -0
- package/dist/modules/review-execution/services/resolveThreadInventory.d.ts +19 -0
- package/dist/modules/review-execution/services/resolveThreadInventory.d.ts.map +1 -0
- package/dist/modules/review-execution/services/resolveThreadInventory.js +39 -0
- package/dist/modules/review-execution/services/resolveThreadInventory.js.map +1 -0
- package/dist/modules/review-execution/services/threadActionsExecutor.d.ts +11 -1
- package/dist/modules/review-execution/services/threadActionsExecutor.d.ts.map +1 -1
- package/dist/modules/review-execution/services/threadActionsExecutor.js +24 -2
- package/dist/modules/review-execution/services/threadActionsExecutor.js.map +1 -1
- package/dist/modules/review-execution/usecases/gateClaudeInvocation.usecase.d.ts +6 -0
- package/dist/modules/review-execution/usecases/gateClaudeInvocation.usecase.d.ts.map +1 -1
- package/dist/modules/review-execution/usecases/gateClaudeInvocation.usecase.js +2 -1
- package/dist/modules/review-execution/usecases/gateClaudeInvocation.usecase.js.map +1 -1
- package/dist/modules/statistics-insights/entities/insight/aiInsightsSession.gateway.d.ts +13 -0
- package/dist/modules/statistics-insights/entities/insight/aiInsightsSession.gateway.d.ts.map +1 -0
- package/dist/modules/statistics-insights/entities/insight/aiInsightsSession.gateway.js +2 -0
- package/dist/modules/statistics-insights/entities/insight/aiInsightsSession.gateway.js.map +1 -0
- package/dist/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.d.ts +4 -2
- package/dist/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.d.ts.map +1 -1
- package/dist/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.js +6 -4
- package/dist/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.js.map +1 -1
- package/dist/modules/statistics-insights/interface-adapters/gateways/aiInsightsSession.claude.gateway.d.ts +31 -0
- package/dist/modules/statistics-insights/interface-adapters/gateways/aiInsightsSession.claude.gateway.d.ts.map +1 -0
- package/dist/modules/statistics-insights/interface-adapters/gateways/aiInsightsSession.claude.gateway.js +105 -0
- package/dist/modules/statistics-insights/interface-adapters/gateways/aiInsightsSession.claude.gateway.js.map +1 -0
- package/dist/modules/statistics-insights/usecases/insights/{generateAiInsights.usecase.d.ts → generateAiInsightsViaSession.usecase.d.ts} +7 -13
- package/dist/modules/statistics-insights/usecases/insights/generateAiInsightsViaSession.usecase.d.ts.map +1 -0
- package/dist/modules/statistics-insights/usecases/insights/generateAiInsightsViaSession.usecase.js +49 -0
- package/dist/modules/statistics-insights/usecases/insights/generateAiInsightsViaSession.usecase.js.map +1 -0
- package/dist/modules/statistics-insights/usecases/insights/parseAiInsightsResponse.d.ts +3 -0
- package/dist/modules/statistics-insights/usecases/insights/parseAiInsightsResponse.d.ts.map +1 -0
- package/dist/modules/statistics-insights/usecases/insights/parseAiInsightsResponse.js +20 -0
- package/dist/modules/statistics-insights/usecases/insights/parseAiInsightsResponse.js.map +1 -0
- package/dist/modules/statistics-insights/usecases/insights/persistAiInsights.usecase.d.ts +12 -0
- package/dist/modules/statistics-insights/usecases/insights/persistAiInsights.usecase.d.ts.map +1 -0
- package/dist/modules/statistics-insights/usecases/insights/persistAiInsights.usecase.js +14 -0
- package/dist/modules/statistics-insights/usecases/insights/persistAiInsights.usecase.js.map +1 -0
- package/dist/security/gitlabWebhookTokenSource.d.ts +9 -0
- package/dist/security/gitlabWebhookTokenSource.d.ts.map +1 -0
- package/dist/security/gitlabWebhookTokenSource.js +15 -0
- package/dist/security/gitlabWebhookTokenSource.js.map +1 -0
- package/dist/security/transportGuardConfig.d.ts +16 -0
- package/dist/security/transportGuardConfig.d.ts.map +1 -0
- package/dist/security/transportGuardConfig.js +38 -0
- package/dist/security/transportGuardConfig.js.map +1 -0
- package/dist/security/verifier.d.ts +9 -2
- package/dist/security/verifier.d.ts.map +1 -1
- package/dist/security/verifier.js +27 -10
- package/dist/security/verifier.js.map +1 -1
- package/dist/tests/acceptance/191-team-insights-bg-migration.acceptance.test.d.ts +2 -0
- package/dist/tests/acceptance/191-team-insights-bg-migration.acceptance.test.d.ts.map +1 -0
- package/dist/tests/acceptance/191-team-insights-bg-migration.acceptance.test.js +121 -0
- package/dist/tests/acceptance/191-team-insights-bg-migration.acceptance.test.js.map +1 -0
- package/dist/tests/factories/transportContext.factory.d.ts +5 -0
- package/dist/tests/factories/transportContext.factory.d.ts.map +1 -0
- package/dist/tests/factories/transportContext.factory.js +14 -0
- package/dist/tests/factories/transportContext.factory.js.map +1 -0
- package/dist/tests/stubs/aiInsightsSession.stub.d.ts +8 -0
- package/dist/tests/stubs/aiInsightsSession.stub.d.ts.map +1 -0
- package/dist/tests/stubs/aiInsightsSession.stub.js +15 -0
- package/dist/tests/stubs/aiInsightsSession.stub.js.map +1 -0
- package/dist/tests/stubs/egressScan.stub.d.ts +16 -0
- package/dist/tests/stubs/egressScan.stub.d.ts.map +1 -0
- package/dist/tests/stubs/egressScan.stub.js +28 -0
- package/dist/tests/stubs/egressScan.stub.js.map +1 -0
- package/dist/tests/stubs/idempotencyStore.stub.d.ts +9 -0
- package/dist/tests/stubs/idempotencyStore.stub.d.ts.map +1 -0
- package/dist/tests/stubs/idempotencyStore.stub.js +19 -0
- package/dist/tests/stubs/idempotencyStore.stub.js.map +1 -0
- package/dist/tests/stubs/memberAccess.stub.d.ts +24 -0
- package/dist/tests/stubs/memberAccess.stub.d.ts.map +1 -0
- package/dist/tests/stubs/memberAccess.stub.js +28 -0
- package/dist/tests/stubs/memberAccess.stub.js.map +1 -0
- package/dist/tests/units/architecture/noClaudePInProduction.test.js +0 -1
- package/dist/tests/units/architecture/noClaudePInProduction.test.js.map +1 -1
- package/dist/tests/units/entities/egressScan/egressScan.scanner.test.d.ts +2 -0
- package/dist/tests/units/entities/egressScan/egressScan.scanner.test.d.ts.map +1 -0
- package/dist/tests/units/entities/egressScan/egressScan.scanner.test.js +136 -0
- package/dist/tests/units/entities/egressScan/egressScan.scanner.test.js.map +1 -0
- package/dist/tests/units/interface-adapters/controllers/http/insights.routes.test.js +6 -4
- package/dist/tests/units/interface-adapters/controllers/http/insights.routes.test.js.map +1 -1
- package/dist/tests/units/interface-adapters/controllers/webhook/gitlab.controller.test.js +114 -0
- package/dist/tests/units/interface-adapters/controllers/webhook/gitlab.controller.test.js.map +1 -1
- package/dist/tests/units/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.test.d.ts +2 -0
- package/dist/tests/units/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.test.d.ts.map +1 -0
- package/dist/tests/units/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.test.js +116 -0
- package/dist/tests/units/interface-adapters/gateways/egressScanned.noteCommentPost.gateway.test.js.map +1 -0
- package/dist/tests/units/modules/claude-invocation/gateways/transcriptStreamJson.parser.test.d.ts +2 -0
- package/dist/tests/units/modules/claude-invocation/gateways/transcriptStreamJson.parser.test.d.ts.map +1 -0
- package/dist/tests/units/modules/{ember-chat/gateways/emberStreamJson.parser.test.js → claude-invocation/gateways/transcriptStreamJson.parser.test.js} +2 -2
- package/dist/tests/units/modules/claude-invocation/gateways/transcriptStreamJson.parser.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/controllers/gitlabProcessorProvenance.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/controllers/gitlabProcessorProvenance.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/controllers/gitlabProcessorProvenance.test.js +69 -0
- package/dist/tests/units/modules/platform-integration/controllers/gitlabProcessorProvenance.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/entities/executorCapability.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/entities/executorCapability.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/entities/executorCapability.test.js +28 -0
- package/dist/tests/units/modules/platform-integration/entities/executorCapability.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/entities/memberAccess/memberAccess.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/entities/memberAccess/memberAccess.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/entities/memberAccess/memberAccess.test.js +18 -0
- package/dist/tests/units/modules/platform-integration/entities/memberAccess/memberAccess.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/gateways/defaultGitLabExecutor.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/gateways/defaultGitLabExecutor.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/gateways/defaultGitLabExecutor.test.js +13 -0
- package/dist/tests/units/modules/platform-integration/gateways/defaultGitLabExecutor.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/gateways/memberAccess.gitlab.cli.gateway.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/gateways/memberAccess.gitlab.cli.gateway.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/gateways/memberAccess.gitlab.cli.gateway.test.js +105 -0
- package/dist/tests/units/modules/platform-integration/gateways/memberAccess.gitlab.cli.gateway.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/gateways/scopedGitLabExecutor.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/gateways/scopedGitLabExecutor.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/gateways/scopedGitLabExecutor.test.js +85 -0
- package/dist/tests/units/modules/platform-integration/gateways/scopedGitLabExecutor.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/controllers/webhook/gitlabIdempotency.controller.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/controllers/webhook/gitlabIdempotency.controller.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/controllers/webhook/gitlabIdempotency.controller.test.js +216 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/controllers/webhook/gitlabIdempotency.controller.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.test.js +48 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/gateways/inMemoryIdempotencyStore.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/clientIpResolver.forwardedFor.gateway.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/clientIpResolver.forwardedFor.gateway.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/clientIpResolver.forwardedFor.gateway.test.js +29 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/clientIpResolver.forwardedFor.gateway.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/transportGuard.middleware.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/transportGuard.middleware.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/transportGuard.middleware.test.js +66 -0
- package/dist/tests/units/modules/platform-integration/interface-adapters/transport/transportGuard.middleware.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorActionFilter.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorActionFilter.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorActionFilter.test.js +38 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorActionFilter.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorCapabilityGate.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorCapabilityGate.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorCapabilityGate.test.js +40 -0
- package/dist/tests/units/modules/platform-integration/services/autoExecutorCapabilityGate.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/pinnedThreadFetchTarget.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/services/pinnedThreadFetchTarget.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/pinnedThreadFetchTarget.test.js +76 -0
- package/dist/tests/units/modules/platform-integration/services/pinnedThreadFetchTarget.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/scopedExecutorEnvironment.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/services/scopedExecutorEnvironment.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/services/scopedExecutorEnvironment.test.js +120 -0
- package/dist/tests/units/modules/platform-integration/services/scopedExecutorEnvironment.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/usecases/isTrustedActor.usecase.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/usecases/isTrustedActor.usecase.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/usecases/isTrustedActor.usecase.test.js +33 -0
- package/dist/tests/units/modules/platform-integration/usecases/isTrustedActor.usecase.test.js.map +1 -0
- package/dist/tests/units/modules/platform-integration/usecases/transport/evaluateTransport.usecase.test.d.ts +2 -0
- package/dist/tests/units/modules/platform-integration/usecases/transport/evaluateTransport.usecase.test.d.ts.map +1 -0
- package/dist/tests/units/modules/platform-integration/usecases/transport/evaluateTransport.usecase.test.js +69 -0
- package/dist/tests/units/modules/platform-integration/usecases/transport/evaluateTransport.usecase.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/entities/actionProvenance/actionProvenance.test.d.ts +2 -0
- package/dist/tests/units/modules/review-execution/entities/actionProvenance/actionProvenance.test.d.ts.map +1 -0
- package/dist/tests/units/modules/review-execution/entities/actionProvenance/actionProvenance.test.js +26 -0
- package/dist/tests/units/modules/review-execution/entities/actionProvenance/actionProvenance.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.test.d.ts +2 -0
- package/dist/tests/units/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.test.d.ts.map +1 -0
- package/dist/tests/units/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.test.js +44 -0
- package/dist/tests/units/modules/review-execution/interface-adapters/gateways/threadInventory.gitlab.gateway.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.parity.test.d.ts +2 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.parity.test.d.ts.map +1 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.parity.test.js +29 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.parity.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.test.d.ts +2 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.test.d.ts.map +1 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.test.js +115 -0
- package/dist/tests/units/modules/review-execution/services/constrainActionSurface.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/services/contextActionsExecutor.autopath.test.d.ts +2 -0
- package/dist/tests/units/modules/review-execution/services/contextActionsExecutor.autopath.test.d.ts.map +1 -0
- package/dist/tests/units/modules/review-execution/services/contextActionsExecutor.autopath.test.js +52 -0
- package/dist/tests/units/modules/review-execution/services/contextActionsExecutor.autopath.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/services/dispatchConstrainedActions.test.d.ts +2 -0
- package/dist/tests/units/modules/review-execution/services/dispatchConstrainedActions.test.d.ts.map +1 -0
- package/dist/tests/units/modules/review-execution/services/dispatchConstrainedActions.test.js +124 -0
- package/dist/tests/units/modules/review-execution/services/dispatchConstrainedActions.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/services/resolveThreadInventory.test.d.ts +2 -0
- package/dist/tests/units/modules/review-execution/services/resolveThreadInventory.test.d.ts.map +1 -0
- package/dist/tests/units/modules/review-execution/services/resolveThreadInventory.test.js +67 -0
- package/dist/tests/units/modules/review-execution/services/resolveThreadInventory.test.js.map +1 -0
- package/dist/tests/units/modules/review-execution/usecases/gateClaudeInvocation.usecase.test.js +42 -0
- package/dist/tests/units/modules/review-execution/usecases/gateClaudeInvocation.usecase.test.js.map +1 -1
- package/dist/tests/units/security/gitlabTokenRotation.test.d.ts +2 -0
- package/dist/tests/units/security/gitlabTokenRotation.test.d.ts.map +1 -0
- package/dist/tests/units/security/gitlabTokenRotation.test.js +39 -0
- package/dist/tests/units/security/gitlabTokenRotation.test.js.map +1 -0
- package/dist/tests/units/security/noSpoofableTransportGuard.test.d.ts +2 -0
- package/dist/tests/units/security/noSpoofableTransportGuard.test.d.ts.map +1 -0
- package/dist/tests/units/security/noSpoofableTransportGuard.test.js +30 -0
- package/dist/tests/units/security/noSpoofableTransportGuard.test.js.map +1 -0
- package/dist/tests/units/security/transportGuardConfig.test.d.ts +2 -0
- package/dist/tests/units/security/transportGuardConfig.test.d.ts.map +1 -0
- package/dist/tests/units/security/transportGuardConfig.test.js +38 -0
- package/dist/tests/units/security/transportGuardConfig.test.js.map +1 -0
- package/dist/tests/units/security/verifier.test.js +33 -2
- package/dist/tests/units/security/verifier.test.js.map +1 -1
- package/dist/tests/units/services/contextActionsExecutor.egress.test.d.ts +2 -0
- package/dist/tests/units/services/contextActionsExecutor.egress.test.d.ts.map +1 -0
- package/dist/tests/units/services/contextActionsExecutor.egress.test.js +117 -0
- package/dist/tests/units/services/contextActionsExecutor.egress.test.js.map +1 -0
- package/dist/tests/units/services/contextActionsExecutor.test.js +24 -31
- package/dist/tests/units/services/contextActionsExecutor.test.js.map +1 -1
- package/dist/tests/units/services/publicOutputExecutor.test.d.ts +2 -0
- package/dist/tests/units/services/publicOutputExecutor.test.d.ts.map +1 -0
- package/dist/tests/units/services/publicOutputExecutor.test.js +72 -0
- package/dist/tests/units/services/publicOutputExecutor.test.js.map +1 -0
- package/dist/tests/units/services/threadActionsExecutor.egress.test.d.ts +2 -0
- package/dist/tests/units/services/threadActionsExecutor.egress.test.d.ts.map +1 -0
- package/dist/tests/units/services/threadActionsExecutor.egress.test.js +113 -0
- package/dist/tests/units/services/threadActionsExecutor.egress.test.js.map +1 -0
- package/dist/tests/units/services/threadActionsExecutor.test.js +32 -96
- package/dist/tests/units/services/threadActionsExecutor.test.js.map +1 -1
- package/dist/tests/units/usecases/insights/generateAiInsightsViaSession.usecase.test.d.ts +2 -0
- package/dist/tests/units/usecases/insights/generateAiInsightsViaSession.usecase.test.d.ts.map +1 -0
- package/dist/tests/units/usecases/insights/generateAiInsightsViaSession.usecase.test.js +114 -0
- package/dist/tests/units/usecases/insights/generateAiInsightsViaSession.usecase.test.js.map +1 -0
- package/dist/tests/units/usecases/insights/parseAiInsightsResponse.test.d.ts +2 -0
- package/dist/tests/units/usecases/insights/parseAiInsightsResponse.test.d.ts.map +1 -0
- package/dist/tests/units/usecases/insights/parseAiInsightsResponse.test.js +45 -0
- package/dist/tests/units/usecases/insights/parseAiInsightsResponse.test.js.map +1 -0
- package/dist/tests/units/usecases/insights/persistAiInsights.usecase.test.d.ts +2 -0
- package/dist/tests/units/usecases/insights/persistAiInsights.usecase.test.d.ts.map +1 -0
- package/dist/tests/units/usecases/insights/persistAiInsights.usecase.test.js +87 -0
- package/dist/tests/units/usecases/insights/persistAiInsights.usecase.test.js.map +1 -0
- package/package.json +9 -2
- package/dist/frameworks/claude/claudeInsightsInvoker.d.ts +0 -3
- package/dist/frameworks/claude/claudeInsightsInvoker.d.ts.map +0 -1
- package/dist/frameworks/claude/claudeInsightsInvoker.js +0 -58
- package/dist/frameworks/claude/claudeInsightsInvoker.js.map +0 -1
- package/dist/modules/ember-chat/interface-adapters/gateways/emberStreamJson.parser.d.ts.map +0 -1
- package/dist/modules/ember-chat/interface-adapters/gateways/emberStreamJson.parser.js.map +0 -1
- package/dist/modules/statistics-insights/usecases/insights/generateAiInsights.usecase.d.ts.map +0 -1
- package/dist/modules/statistics-insights/usecases/insights/generateAiInsights.usecase.js +0 -65
- package/dist/modules/statistics-insights/usecases/insights/generateAiInsights.usecase.js.map +0 -1
- package/dist/tests/units/modules/ember-chat/gateways/emberStreamJson.parser.test.d.ts +0 -2
- package/dist/tests/units/modules/ember-chat/gateways/emberStreamJson.parser.test.d.ts.map +0 -1
- package/dist/tests/units/modules/ember-chat/gateways/emberStreamJson.parser.test.js.map +0 -1
- package/dist/tests/units/usecases/insights/generateAiInsights.usecase.test.d.ts +0 -2
- package/dist/tests/units/usecases/insights/generateAiInsights.usecase.test.d.ts.map +0 -1
- package/dist/tests/units/usecases/insights/generateAiInsights.usecase.test.js +0 -253
- package/dist/tests/units/usecases/insights/generateAiInsights.usecase.test.js.map +0 -1
package/dist/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { generateAiInsightsViaSession } from '../../../../../modules/statistics-insights/usecases/insights/generateAiInsightsViaSession.usecase.js';
|
|
2
|
+
import { persistAiInsightsResult } from '../../../../../modules/statistics-insights/usecases/insights/persistAiInsights.usecase.js';
|
|
2
3
|
import { getInsightsWithAiStatus } from '../../../../../modules/statistics-insights/usecases/insights/getInsightsWithAiStatus.usecase.js';
|
|
3
4
|
import { InsightsPresenter } from '../../../../../modules/statistics-insights/interface-adapters/presenters/insights.presenter.js';
|
|
4
5
|
function isValidProjectPath(path) {
|
|
@@ -8,7 +9,7 @@ function isValidProjectPath(path) {
|
|
|
8
9
|
return trimmed.startsWith('/') && !trimmed.includes('..');
|
|
9
10
|
}
|
|
10
11
|
export const insightsRoutes = async (fastify, options) => {
|
|
11
|
-
const { statsGateway, insightsGateway, reviewFileGateway, reviewRequestTrackingGateway, logger,
|
|
12
|
+
const { statsGateway, insightsGateway, reviewFileGateway, reviewRequestTrackingGateway, logger, session, environment, language, } = options;
|
|
12
13
|
const presenter = new InsightsPresenter();
|
|
13
14
|
fastify.get('/api/insights', async (request, reply) => {
|
|
14
15
|
const projectPath = request.query.path?.trim() ?? null;
|
|
@@ -45,13 +46,14 @@ export const insightsRoutes = async (fastify, options) => {
|
|
|
45
46
|
? body.language
|
|
46
47
|
: language;
|
|
47
48
|
try {
|
|
48
|
-
const aiInsights = await
|
|
49
|
+
const aiInsights = await generateAiInsightsViaSession({
|
|
49
50
|
projectPath,
|
|
50
51
|
statsGateway,
|
|
51
52
|
reviewFileGateway,
|
|
52
53
|
reviewRequestTrackingGateway,
|
|
53
54
|
logger,
|
|
54
|
-
|
|
55
|
+
session,
|
|
56
|
+
environment,
|
|
55
57
|
language: requestLanguage,
|
|
56
58
|
});
|
|
57
59
|
persistAiInsightsResult({
|
package/dist/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insights.routes.js","sourceRoot":"","sources":["../../../../../../src/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insights.routes.js","sourceRoot":"","sources":["../../../../../../src/modules/statistics-insights/interface-adapters/controllers/http/insights.routes.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,4BAA4B,EAAE,MAAM,yFAAyF,CAAC;AACvI,OAAO,EAAE,uBAAuB,EAAE,MAAM,8EAA8E,CAAC;AACvH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oFAAoF,CAAC;AAC7H,OAAO,EAAE,iBAAiB,EAAE,MAAM,mFAAmF,CAAC;AAatH,SAAS,kBAAkB,CAAC,IAAmB;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,OAAO,OAAO,CAAC,U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AC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ClaudeSessionGateway } from '../../../../modules/claude-invocation/entities/claudeSession/claudeSession.gateway.js';
|
|
2
|
+
import type { AiInsightsSessionGateway, AiInsightsSessionResult } from '../../../../modules/statistics-insights/entities/insight/aiInsightsSession.gateway.js';
|
|
3
|
+
/**
|
|
4
|
+
* HUMBLE GLUE — NOT unit-tested. The generateAiInsightsViaSession use case is
|
|
5
|
+
* unit-tested against StubAiInsightsSessionGateway; this file is the swappable
|
|
6
|
+
* real implementation, validated by acceptance/manual only.
|
|
7
|
+
*
|
|
8
|
+
* Transport: ONE `claude --bg` dispatch per insights run (subscription / OAuth
|
|
9
|
+
* billing, the same path reviews and Ember use — NEVER `--print`/headless, which
|
|
10
|
+
* switches to API billing on 2026-06-15). After dispatch, tail the session
|
|
11
|
+
* transcript JSONL, accumulate every assistant text segment, and on the
|
|
12
|
+
* turn-complete marker return the full answer, then stop/remove the session.
|
|
13
|
+
*
|
|
14
|
+
* The insights prompt is self-contained (stats + review excerpts are embedded),
|
|
15
|
+
* so the session needs no MCP servers and only read-only tools.
|
|
16
|
+
*/
|
|
17
|
+
export interface AiInsightsSessionClaudeGatewayOptions {
|
|
18
|
+
homeDir: string;
|
|
19
|
+
model: string;
|
|
20
|
+
pollIntervalMs?: number;
|
|
21
|
+
maxAttempts?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class AiInsightsSessionClaudeGateway implements AiInsightsSessionGateway {
|
|
24
|
+
private readonly sessionGateway;
|
|
25
|
+
private readonly options;
|
|
26
|
+
constructor(sessionGateway: ClaudeSessionGateway, options: AiInsightsSessionClaudeGatewayOptions);
|
|
27
|
+
run(prompt: string): Promise<AiInsightsSessionResult>;
|
|
28
|
+
private readAnswer;
|
|
29
|
+
private cleanup;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=aiInsightsSession.claude.gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiInsightsSession.claude.gateway.d.ts","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/interface-adapters/gateways/aiInsightsSession.claude.gateway.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6EAA6E,CAAC;AAOxH,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,6EAA6E,CAAC;AAErF;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,qCAAqC;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,qBAAa,8BAA+B,YAAW,wBAAwB;IAE3E,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,cAAc,EAAE,oBAAoB,EACpC,OAAO,EAAE,qCAAqC;IAG3D,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;YAkC7C,UAAU;YAoDV,OAAO;CAItB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { readFileSync, existsSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { parseStreamJsonEvent, extractText, isTurnComplete, } from '../../../../modules/claude-invocation/interface-adapters/gateways/transcriptStreamJson.parser.js';
|
|
4
|
+
const DEFAULT_POLL_INTERVAL_MS = 1000;
|
|
5
|
+
const DEFAULT_MAX_ATTEMPTS = 300;
|
|
6
|
+
export class AiInsightsSessionClaudeGateway {
|
|
7
|
+
sessionGateway;
|
|
8
|
+
options;
|
|
9
|
+
constructor(sessionGateway, options) {
|
|
10
|
+
this.sessionGateway = sessionGateway;
|
|
11
|
+
this.options = options;
|
|
12
|
+
}
|
|
13
|
+
async run(prompt) {
|
|
14
|
+
const dispatch = await this.sessionGateway.dispatch({
|
|
15
|
+
prompt,
|
|
16
|
+
flags: {
|
|
17
|
+
model: this.options.model,
|
|
18
|
+
permissionMode: 'auto',
|
|
19
|
+
systemPrompt: '',
|
|
20
|
+
mcpConfigJson: '{"mcpServers":{}}',
|
|
21
|
+
allowedTools: 'Read,Glob,Grep',
|
|
22
|
+
disallowedTools: 'Edit,Write,Bash,Task',
|
|
23
|
+
},
|
|
24
|
+
localPath: this.options.homeDir,
|
|
25
|
+
jobId: `insights-${Date.now()}`,
|
|
26
|
+
jobType: 'insights',
|
|
27
|
+
});
|
|
28
|
+
if (dispatch.status !== 'dispatched') {
|
|
29
|
+
return { status: 'unavailable', reason: dispatch.status };
|
|
30
|
+
}
|
|
31
|
+
const sessionId = dispatch.sessionId;
|
|
32
|
+
const slug = this.options.homeDir.replace(/\//g, '-');
|
|
33
|
+
const projectDir = join(this.options.homeDir, '.claude', 'projects', slug);
|
|
34
|
+
try {
|
|
35
|
+
const answer = await this.readAnswer(projectDir, sessionId);
|
|
36
|
+
return answer === null
|
|
37
|
+
? { status: 'timed-out' }
|
|
38
|
+
: { status: 'completed', answer };
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
await this.cleanup(sessionId);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async readAnswer(projectDir, sessionId) {
|
|
45
|
+
const pollInterval = this.options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
46
|
+
const maxAttempts = this.options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
|
|
47
|
+
let transcriptPath = null;
|
|
48
|
+
let byteOffset = 0;
|
|
49
|
+
let pendingLine = '';
|
|
50
|
+
const chunks = [];
|
|
51
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
52
|
+
await delay(pollInterval);
|
|
53
|
+
if (transcriptPath === null) {
|
|
54
|
+
transcriptPath = resolveTranscript(projectDir, sessionId);
|
|
55
|
+
}
|
|
56
|
+
if (transcriptPath === null || !existsSync(transcriptPath)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
let raw;
|
|
60
|
+
try {
|
|
61
|
+
raw = readFileSync(transcriptPath, 'utf-8');
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const fresh = raw.slice(byteOffset);
|
|
67
|
+
byteOffset = raw.length;
|
|
68
|
+
pendingLine += fresh;
|
|
69
|
+
const lines = pendingLine.split('\n');
|
|
70
|
+
pendingLine = lines.pop() ?? '';
|
|
71
|
+
for (const line of lines) {
|
|
72
|
+
if (line.trim().length === 0) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const event = parseStreamJsonEvent(line);
|
|
76
|
+
if (event === null) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const text = extractText(event);
|
|
80
|
+
if (text !== null) {
|
|
81
|
+
chunks.push(text);
|
|
82
|
+
}
|
|
83
|
+
if (isTurnComplete(event)) {
|
|
84
|
+
return chunks.join('');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
async cleanup(sessionId) {
|
|
91
|
+
await this.sessionGateway.stop(sessionId);
|
|
92
|
+
await this.sessionGateway.remove(sessionId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function resolveTranscript(projectDir, sessionId) {
|
|
96
|
+
if (!existsSync(projectDir)) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const match = readdirSync(projectDir).find((name) => name.startsWith(sessionId) && name.endsWith('.jsonl'));
|
|
100
|
+
return match === undefined ? null : join(projectDir, match);
|
|
101
|
+
}
|
|
102
|
+
function delay(milliseconds) {
|
|
103
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=aiInsightsSession.claude.gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiInsightsSession.claude.gateway.js","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/interface-adapters/gateways/aiInsightsSession.claude.gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,cAAc,GACf,MAAM,wFAAwF,CAAC;AA4BhG,MAAM,wBAAwB,GAAG,IAAI,CAAC;AACtC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,MAAM,OAAO,8BAA8B;IAEtB;IACA;IAFnB,YACmB,cAAoC,EACpC,OAA8C;QAD9C,mBAAc,GAAd,cAAc,CAAsB;QACpC,YAAO,GAAP,OAAO,CAAuC;IAC9D,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,MAAc;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;YAClD,MAAM;YACN,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,cAAc,EAAE,MAAM;gBACtB,YAAY,EAAE,EAAE;gBAChB,aAAa,EAAE,mBAAmB;gBAClC,YAAY,EAAE,gBAAgB;gBAC9B,eAAe,EAAE,sBAAsB;aACxC;YACD,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC/B,KAAK,EAAE,YAAY,IAAI,CAAC,GAAG,EAAE,EAAE;YAC/B,OAAO,EAAE,UAAU;SACpB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;YACrC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,C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AAC,SAAS,CAAC,CAAC;QAC1C,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,UAAkB,EAAE,SAAoB;IACjE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAChE,CAAC;IACF,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,KAAK,CAAC,YAAoB;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import type { Logger } from 'pino';
|
|
2
2
|
import type { StatsGateway } from '../../../../modules/statistics-insights/entities/stats/stats.gateway.js';
|
|
3
|
-
import type { InsightsGateway } from '../../../../modules/statistics-insights/entities/insight/insights.gateway.js';
|
|
4
3
|
import type { ReviewFileGateway } from '../../../../modules/review-execution/entities/review/reviewFile.gateway.js';
|
|
5
4
|
import type { ReviewRequestTrackingGateway } from '../../../../modules/tracking/entities/tracking/reviewRequestTracking.gateway.js';
|
|
5
|
+
import type { EnvironmentGateway } from '../../../../modules/claude-invocation/entities/billingState/environment.gateway.js';
|
|
6
|
+
import type { AiInsightsSessionGateway } from '../../../../modules/statistics-insights/entities/insight/aiInsightsSession.gateway.js';
|
|
6
7
|
import type { AiInsightsResult } from '../../../../modules/statistics-insights/entities/insight/aiInsight.js';
|
|
7
8
|
import type { Language } from '../../../../modules/shared-kernel/entities/language/language.schema.js';
|
|
8
|
-
|
|
9
|
-
interface GenerateAiInsightsInput {
|
|
9
|
+
interface GenerateAiInsightsViaSessionInput {
|
|
10
10
|
projectPath: string;
|
|
11
11
|
statsGateway: StatsGateway;
|
|
12
12
|
reviewFileGateway: ReviewFileGateway;
|
|
13
13
|
reviewRequestTrackingGateway: ReviewRequestTrackingGateway;
|
|
14
14
|
logger: Logger;
|
|
15
|
-
|
|
15
|
+
session: AiInsightsSessionGateway;
|
|
16
|
+
environment: EnvironmentGateway;
|
|
16
17
|
language: Language;
|
|
17
18
|
}
|
|
18
|
-
export declare function
|
|
19
|
-
interface PersistAiInsightsInput {
|
|
20
|
-
projectPath: string;
|
|
21
|
-
aiInsights: AiInsightsResult;
|
|
22
|
-
statsGateway: StatsGateway;
|
|
23
|
-
insightsGateway: InsightsGateway;
|
|
24
|
-
}
|
|
25
|
-
export declare function persistAiInsightsResult(input: PersistAiInsightsInput): void;
|
|
19
|
+
export declare function generateAiInsightsViaSession(input: GenerateAiInsightsViaSessionInput): Promise<AiInsightsResult>;
|
|
26
20
|
export {};
|
|
27
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=generateAiInsightsViaSession.usecase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateAiInsightsViaSession.usecase.d.ts","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/usecases/insights/generateAiInsightsViaSession.usecase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uEAAuE,CAAC;AAC1H,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0EAA0E,CAAC;AACnH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6EAA6E,CAAC;AAC5H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8DAA8D,CAAC;AAW7F,UAAU,iCAAiC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,4BAA4B,EAAE,4BAA4B,CAAC;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,wBAAwB,CAAC;IAClC,WAAW,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,gBAAgB,CAAC,CA+D3B"}
|
package/dist/modules/statistics-insights/usecases/insights/generateAiInsightsViaSession.usecase.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { buildAiInsightsPrompt } from '../../../../modules/statistics-insights/usecases/insights/buildAiInsightsPrompt.js';
|
|
2
|
+
import { parseAiInsightsResponse } from '../../../../modules/statistics-insights/usecases/insights/parseAiInsightsResponse.js';
|
|
3
|
+
const NO_STATS_MESSAGE = 'Aucune statistique de review disponible pour ce projet';
|
|
4
|
+
const API_KEY_PRESENT_MESSAGE = "Impossible de générer les insights — l'abonnement Claude est requis, pas de clé API";
|
|
5
|
+
const UNAVAILABLE_MESSAGE = 'Impossible de générer les insights — connexion à l\'abonnement Claude requise';
|
|
6
|
+
const TIMEOUT_MESSAGE = 'La génération des insights a expiré';
|
|
7
|
+
export async function generateAiInsightsViaSession(input) {
|
|
8
|
+
const { projectPath, statsGateway, reviewFileGateway, reviewRequestTrackingGateway, logger, session, environment, language, } = input;
|
|
9
|
+
if (environment.hasAnthropicApiKey()) {
|
|
10
|
+
throw new Error(API_KEY_PRESENT_MESSAGE);
|
|
11
|
+
}
|
|
12
|
+
const stats = statsGateway.loadProjectStats(projectPath);
|
|
13
|
+
if (!stats || stats.reviews.length === 0) {
|
|
14
|
+
throw new Error(NO_STATS_MESSAGE);
|
|
15
|
+
}
|
|
16
|
+
const reviewFiles = await reviewFileGateway.listReviews(projectPath);
|
|
17
|
+
const reviewContents = new Map();
|
|
18
|
+
for (const reviewFile of reviewFiles) {
|
|
19
|
+
const content = await reviewFileGateway.readReview(projectPath, reviewFile.filename);
|
|
20
|
+
if (content) {
|
|
21
|
+
reviewContents.set(reviewFile.mrNumber, content);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const trackingData = reviewRequestTrackingGateway.loadTracking(projectPath);
|
|
25
|
+
const trackedMrs = trackingData?.mrs ?? [];
|
|
26
|
+
const prompt = buildAiInsightsPrompt({
|
|
27
|
+
reviews: stats.reviews,
|
|
28
|
+
reviewContents,
|
|
29
|
+
trackedMrs,
|
|
30
|
+
language,
|
|
31
|
+
});
|
|
32
|
+
logger.info({ promptLength: prompt.length }, 'Dispatching --bg session for AI insights');
|
|
33
|
+
const sessionResult = await session.run(prompt);
|
|
34
|
+
if (sessionResult.status === 'unavailable') {
|
|
35
|
+
logger.error({ reason: sessionResult.reason }, 'AI insights session unavailable');
|
|
36
|
+
throw new Error(UNAVAILABLE_MESSAGE);
|
|
37
|
+
}
|
|
38
|
+
if (sessionResult.status === 'timed-out') {
|
|
39
|
+
logger.error('AI insights session timed out');
|
|
40
|
+
throw new Error(TIMEOUT_MESSAGE);
|
|
41
|
+
}
|
|
42
|
+
logger.info({ answerLength: sessionResult.answer.length }, 'Received --bg answer for AI insights');
|
|
43
|
+
const result = parseAiInsightsResponse(sessionResult.answer);
|
|
44
|
+
return {
|
|
45
|
+
...result,
|
|
46
|
+
generatedAt: new Date().toISOString(),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=generateAiInsightsViaSession.usecase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateAiInsightsViaSession.usecase.js","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/usecases/insights/generateAiInsightsViaSession.usecase.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0EAA0E,CAAC;AACjH,OAAO,EAAE,uBAAuB,EAAE,MAAM,4EAA4E,CAAC;AAErH,MAAM,gBAAgB,GAAG,wDAAwD,CAAC;AAClF,MAAM,uBAAuB,GAC3B,qFAAqF,CAAC;AACxF,MAAM,mBAAmB,GACvB,+EAA+E,CAAC;AAClF,MAAM,eAAe,GAAG,qCAAqC,CAAC;AAa9D,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,KAAwC;IAExC,MAAM,EACJ,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,4BAA4B,EAC5B,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,GACT,GAAG,KAAK,CAAC;IAEV,IAAI,WAAW,CAAC,kBAAkB,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,KAAK,GAAG,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEjD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;QACrF,IAAI,OAAO,EAAE,CAAC;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{"version":3,"file":"parseAiInsightsResponse.d.ts","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/usecases/insights/parseAiInsightsResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAiBpG,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAIhG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { aiInsightsRawResponseSchema } from '../../../../modules/statistics-insights/entities/insight/aiInsight.schema.js';
|
|
2
|
+
function stripMarkdownFences(text) {
|
|
3
|
+
let cleaned = text.trim();
|
|
4
|
+
if (cleaned.startsWith('```')) {
|
|
5
|
+
const firstNewline = cleaned.indexOf('\n');
|
|
6
|
+
if (firstNewline !== -1) {
|
|
7
|
+
cleaned = cleaned.substring(firstNewline + 1);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
if (cleaned.endsWith('```')) {
|
|
11
|
+
cleaned = cleaned.substring(0, cleaned.length - 3).trim();
|
|
12
|
+
}
|
|
13
|
+
return cleaned;
|
|
14
|
+
}
|
|
15
|
+
export function parseAiInsightsResponse(rawOutput) {
|
|
16
|
+
const cleaned = stripMarkdownFences(rawOutput);
|
|
17
|
+
const parsed = JSON.parse(cleaned);
|
|
18
|
+
return aiInsightsRawResponseSchema.parse(parsed);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=parseAiInsightsResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseAiInsightsResponse.js","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/usecases/insights/parseAiInsightsResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oEAAoE,CAAC;AAEjH,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1B,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;YACxB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,SAAiB;IACvD,MAAM,OAAO,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StatsGateway } from '../../../../modules/statistics-insights/entities/stats/stats.gateway.js';
|
|
2
|
+
import type { InsightsGateway } from '../../../../modules/statistics-insights/entities/insight/insights.gateway.js';
|
|
3
|
+
import type { AiInsightsResult } from '../../../../modules/statistics-insights/entities/insight/aiInsight.js';
|
|
4
|
+
interface PersistAiInsightsInput {
|
|
5
|
+
projectPath: string;
|
|
6
|
+
aiInsights: AiInsightsResult;
|
|
7
|
+
statsGateway: StatsGateway;
|
|
8
|
+
insightsGateway: InsightsGateway;
|
|
9
|
+
}
|
|
10
|
+
export declare function persistAiInsightsResult(input: PersistAiInsightsInput): void;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=persistAiInsights.usecase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistAiInsights.usecase.d.ts","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/usecases/insights/persistAiInsights.usecase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oEAAoE,CAAC;AAC1G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAGpG,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAa3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { computeInsightsWithPersistence } from '../../../../modules/statistics-insights/usecases/insights/computeInsightsWithPersistence.usecase.js';
|
|
2
|
+
export function persistAiInsightsResult(input) {
|
|
3
|
+
const { projectPath, aiInsights, statsGateway, insightsGateway } = input;
|
|
4
|
+
const existingData = insightsGateway.loadPersistedInsights(projectPath);
|
|
5
|
+
const stats = statsGateway.loadProjectStats(projectPath);
|
|
6
|
+
const currentReviews = stats?.reviews ?? [];
|
|
7
|
+
const upToDateResult = computeInsightsWithPersistence(currentReviews, existingData);
|
|
8
|
+
insightsGateway.savePersistedInsights(projectPath, {
|
|
9
|
+
...upToDateResult.persistedData,
|
|
10
|
+
aiInsights,
|
|
11
|
+
reviewCountAtAiGeneration: upToDateResult.persistedData.processedReviewIds.length,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=persistAiInsights.usecase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistAiInsights.usecase.js","sourceRoot":"","sources":["../../../../../src/modules/statistics-insights/usecases/insights/persistAiInsights.usecase.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,8BAA8B,EAAE,MAAM,2FAA2F,CAAC;AAS3I,MAAM,UAAU,uBAAuB,CAAC,KAA6B;IACnE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,YAAY,GAAG,eAAe,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,cAAc,GAAG,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAG,8BAA8B,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAEpF,eAAe,CAAC,qBAAqB,CAAC,WAAW,EAAE;QACjD,GAAG,cAAc,CAAC,aAAa;QAC/B,UAAU;QACV,yBAAyB,EAAE,cAAc,CAAC,aAAa,CAAC,kBAAkB,CAAC,MAAM;KAClF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the current GitLab webhook token from the process environment on every
|
|
3
|
+
* call so the secret can be rotated without redeploying or restarting the
|
|
4
|
+
* process: an operator updates GITLAB_WEBHOOK_TOKEN (and the GitLab webhook
|
|
5
|
+
* secret), and the next verification already uses the new value.
|
|
6
|
+
*/
|
|
7
|
+
export declare function currentGitlabWebhookToken(): string | null;
|
|
8
|
+
export declare function __resetGitlabTokenCacheForTests(): void;
|
|
9
|
+
//# sourceMappingURL=gitlabWebhookTokenSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlabWebhookTokenSource.d.ts","sourceRoot":"","sources":["../../src/security/gitlabWebhookTokenSource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAGzD;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAGtD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the current GitLab webhook token from the process environment on every
|
|
3
|
+
* call so the secret can be rotated without redeploying or restarting the
|
|
4
|
+
* process: an operator updates GITLAB_WEBHOOK_TOKEN (and the GitLab webhook
|
|
5
|
+
* secret), and the next verification already uses the new value.
|
|
6
|
+
*/
|
|
7
|
+
export function currentGitlabWebhookToken() {
|
|
8
|
+
const token = process.env.GITLAB_WEBHOOK_TOKEN;
|
|
9
|
+
return typeof token === 'string' && token.length > 0 ? token : null;
|
|
10
|
+
}
|
|
11
|
+
export function __resetGitlabTokenCacheForTests() {
|
|
12
|
+
// No cache is kept; the token is read fresh on every call. This hook exists
|
|
13
|
+
// so rotation tests document the no-capture contract explicitly.
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=gitlabWebhookTokenSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlabWebhookTokenSource.js","sourceRoot":"","sources":["../../src/security/gitlabWebhookTokenSource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,4EAA4E;IAC5E,iEAAiE;AACnE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TransportGuardConfig } from '../modules/platform-integration/interface-adapters/controllers/webhook/transportGuard.middleware.js';
|
|
2
|
+
export declare const DEFAULT_LOOPBACK_HOP = "127.0.0.1";
|
|
3
|
+
/**
|
|
4
|
+
* The single trusted hop the app accepts connections from. Scoped to the
|
|
5
|
+
* loopback reverse proxy only; never a broad subnet, never `true`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveTrustedHopAddress(): string;
|
|
8
|
+
export declare function resolveAllowedCidrRanges(): string[];
|
|
9
|
+
export declare function resolveTransportGuardConfig(): TransportGuardConfig;
|
|
10
|
+
/**
|
|
11
|
+
* The value handed to Fastify's `trustProxy` option. It is always the single
|
|
12
|
+
* loopback hop, never `true` and never an arbitrary/broad value, so Express-style
|
|
13
|
+
* derived request attributes cannot be inflated from client-supplied headers.
|
|
14
|
+
*/
|
|
15
|
+
export declare function transportTrustProxyValue(): string;
|
|
16
|
+
//# sourceMappingURL=transportGuardConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transportGuardConfig.d.ts","sourceRoot":"","sources":["../../src/security/transportGuardConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oGAAoG,CAAC;AAE/I,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAYhD;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAKjD;AAED,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAEnD;AAED,wBAAgB,2BAA2B,IAAI,oBAAoB,CAKlE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const DEFAULT_LOOPBACK_HOP = '127.0.0.1';
|
|
2
|
+
function parseCidrRanges(raw) {
|
|
3
|
+
if (!raw) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
return raw
|
|
7
|
+
.split(',')
|
|
8
|
+
.map((range) => range.trim())
|
|
9
|
+
.filter((range) => range.length > 0);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The single trusted hop the app accepts connections from. Scoped to the
|
|
13
|
+
* loopback reverse proxy only; never a broad subnet, never `true`.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveTrustedHopAddress() {
|
|
16
|
+
const configured = process.env.WEBHOOK_TRUSTED_HOP;
|
|
17
|
+
return typeof configured === 'string' && configured.length > 0
|
|
18
|
+
? configured
|
|
19
|
+
: DEFAULT_LOOPBACK_HOP;
|
|
20
|
+
}
|
|
21
|
+
export function resolveAllowedCidrRanges() {
|
|
22
|
+
return parseCidrRanges(process.env.WEBHOOK_ALLOWED_CIDR_RANGES);
|
|
23
|
+
}
|
|
24
|
+
export function resolveTransportGuardConfig() {
|
|
25
|
+
return {
|
|
26
|
+
trustedHopAddress: resolveTrustedHopAddress(),
|
|
27
|
+
allowedCidrRanges: resolveAllowedCidrRanges(),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The value handed to Fastify's `trustProxy` option. It is always the single
|
|
32
|
+
* loopback hop, never `true` and never an arbitrary/broad value, so Express-style
|
|
33
|
+
* derived request attributes cannot be inflated from client-supplied headers.
|
|
34
|
+
*/
|
|
35
|
+
export function transportTrustProxyValue() {
|
|
36
|
+
return resolveTrustedHopAddress();
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=transportGuardConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transportGuardConfig.js","sourceRoot":"","sources":["../../src/security/transportGuardConfig.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAEhD,SAAS,eAAe,CAAC,GAAuB;IAC9C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACtC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACnD,OAAO,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;QAC5D,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,oBAAoB,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,iBAAiB,EAAE,wBAAwB,EAAE;QAC7C,iBAAiB,EAAE,wBAAwB,EAAE;KAC9C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,wBAAwB,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -4,8 +4,10 @@ export interface VerificationResult {
|
|
|
4
4
|
error?: string;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Verify GitLab webhook signature
|
|
8
|
-
* GitLab uses a simple secret token sent in the X-Gitlab-Token header
|
|
7
|
+
* Verify GitLab webhook signature.
|
|
8
|
+
* GitLab uses a simple secret token sent in the X-Gitlab-Token header.
|
|
9
|
+
* The expected token is read from the current configuration on every call so it
|
|
10
|
+
* can be rotated without restarting the process (see gitlabWebhookTokenSource).
|
|
9
11
|
*/
|
|
10
12
|
export declare function verifyGitLabSignature(request: FastifyRequest): VerificationResult;
|
|
11
13
|
/**
|
|
@@ -17,5 +19,10 @@ export declare function verifyGitHubSignature(request: FastifyRequest): Verifica
|
|
|
17
19
|
* Extract event type from request headers
|
|
18
20
|
*/
|
|
19
21
|
export declare function getGitLabEventType(request: FastifyRequest): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Extract the per-event delivery identifier from request headers.
|
|
24
|
+
* Symmetric to getGitLabEventType; reads X-Gitlab-Event-UUID.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getGitLabEventUuid(request: FastifyRequest): string | undefined;
|
|
20
27
|
export declare function getGitHubEventType(request: FastifyRequest): string | undefined;
|
|
21
28
|
//# sourceMappingURL=verifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../src/security/verifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../src/security/verifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAcD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,kBAAkB,CAiBjF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,kBAAkB,CAkCjF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAG9E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAG9E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAG9E"}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
1
|
+
import { createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
|
|
2
2
|
import { loadEnvSecrets } from '../config/loader.js';
|
|
3
|
+
import { currentGitlabWebhookToken } from '../security/gitlabWebhookTokenSource.js';
|
|
4
|
+
// Per-process random key used only to fold both candidate and expected tokens
|
|
5
|
+
// into fixed-length digests before comparison. It never leaves the process and
|
|
6
|
+
// is not a secret in the trust model; its sole purpose is to make timingSafeEqual
|
|
7
|
+
// operate on equal-length inputs so no length-based oracle precedes the compare.
|
|
8
|
+
const comparisonKey = randomBytes(32);
|
|
9
|
+
function constantTimeStringEqual(candidate, expected) {
|
|
10
|
+
const candidateDigest = createHmac('sha256', comparisonKey).update(candidate).digest();
|
|
11
|
+
const expectedDigest = createHmac('sha256', comparisonKey).update(expected).digest();
|
|
12
|
+
return timingSafeEqual(candidateDigest, expectedDigest);
|
|
13
|
+
}
|
|
3
14
|
/**
|
|
4
|
-
* Verify GitLab webhook signature
|
|
5
|
-
* GitLab uses a simple secret token sent in the X-Gitlab-Token header
|
|
15
|
+
* Verify GitLab webhook signature.
|
|
16
|
+
* GitLab uses a simple secret token sent in the X-Gitlab-Token header.
|
|
17
|
+
* The expected token is read from the current configuration on every call so it
|
|
18
|
+
* can be rotated without restarting the process (see gitlabWebhookTokenSource).
|
|
6
19
|
*/
|
|
7
20
|
export function verifyGitLabSignature(request) {
|
|
8
21
|
const token = request.headers['x-gitlab-token'];
|
|
9
22
|
if (!token || typeof token !== 'string') {
|
|
10
23
|
return { valid: false, error: 'Header X-Gitlab-Token manquant' };
|
|
11
24
|
}
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
// Use timing-safe comparison to prevent timing attacks
|
|
15
|
-
const tokenBuffer = Buffer.from(token);
|
|
16
|
-
const expectedBuffer = Buffer.from(expectedToken);
|
|
17
|
-
if (tokenBuffer.length !== expectedBuffer.length) {
|
|
25
|
+
const expectedToken = currentGitlabWebhookToken();
|
|
26
|
+
if (expectedToken === null) {
|
|
18
27
|
return { valid: false, error: 'Token invalide' };
|
|
19
28
|
}
|
|
20
|
-
if (!
|
|
29
|
+
if (!constantTimeStringEqual(token, expectedToken)) {
|
|
21
30
|
return { valid: false, error: 'Token invalide' };
|
|
22
31
|
}
|
|
23
32
|
return { valid: true };
|
|
@@ -60,6 +69,14 @@ export function getGitLabEventType(request) {
|
|
|
60
69
|
const eventHeader = request.headers['x-gitlab-event'];
|
|
61
70
|
return typeof eventHeader === 'string' ? eventHeader : undefined;
|
|
62
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Extract the per-event delivery identifier from request headers.
|
|
74
|
+
* Symmetric to getGitLabEventType; reads X-Gitlab-Event-UUID.
|
|
75
|
+
*/
|
|
76
|
+
export function getGitLabEventUuid(request) {
|
|
77
|
+
const uuidHeader = request.headers['x-gitlab-event-uuid'];
|
|
78
|
+
return typeof uuidHeader === 'string' ? uuidHeader : undefined;
|
|
79
|
+
}
|
|
63
80
|
export function getGitHubEventType(request) {
|
|
64
81
|
const eventHeader = request.headers['x-github-event'];
|
|
65
82
|
return typeof eventHeader === 'string' ? eventHeader : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../src/security/verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../src/security/verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAOnF,8EAA8E;AAC9E,+EAA+E;AAC/E,kFAAkF;AAClF,iFAAiF;AACjF,MAAM,aAAa,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;AAEtC,SAAS,uBAAuB,CAAC,SAAiB,EAAE,QAAgB;IAClE,MAAM,eAAe,GAAG,UAAU,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC;IACvF,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CA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AAS,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAuB;IACxD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtD,OAAO,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"191-team-insights-bg-migration.acceptance.test.d.ts","sourceRoot":"","sources":["../../../src/tests/acceptance/191-team-insights-bg-migration.acceptance.test.ts"],"names":[],"mappings":""}
|