@oscharko-dev/keiko-server 0.2.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/dist/.tsbuildinfo +1 -0
- package/dist/assistant-response.d.ts +6 -0
- package/dist/assistant-response.d.ts.map +1 -0
- package/dist/assistant-response.js +12 -0
- package/dist/browser.d.ts +11 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +245 -0
- package/dist/chat-handlers.d.ts +48 -0
- package/dist/chat-handlers.d.ts.map +1 -0
- package/dist/chat-handlers.js +821 -0
- package/dist/chat-stream-handlers.d.ts +4 -0
- package/dist/chat-stream-handlers.d.ts.map +1 -0
- package/dist/chat-stream-handlers.js +136 -0
- package/dist/conversation-prompt.d.ts +8 -0
- package/dist/conversation-prompt.d.ts.map +1 -0
- package/dist/conversation-prompt.js +36 -0
- package/dist/conversation-validation.d.ts +26 -0
- package/dist/conversation-validation.d.ts.map +1 -0
- package/dist/conversation-validation.js +125 -0
- package/dist/credentialPersistence.d.ts +23 -0
- package/dist/credentialPersistence.d.ts.map +1 -0
- package/dist/credentialPersistence.js +93 -0
- package/dist/credentialVault.d.ts +30 -0
- package/dist/credentialVault.d.ts.map +1 -0
- package/dist/credentialVault.js +206 -0
- package/dist/csp.d.ts +3 -0
- package/dist/csp.d.ts.map +1 -0
- package/dist/csp.js +75 -0
- package/dist/deps.d.ts +78 -0
- package/dist/deps.d.ts.map +1 -0
- package/dist/deps.js +457 -0
- package/dist/editor/agentRoutes.d.ts +7 -0
- package/dist/editor/agentRoutes.d.ts.map +1 -0
- package/dist/editor/agentRoutes.js +197 -0
- package/dist/editor/assuredGateRunner.d.ts +36 -0
- package/dist/editor/assuredGateRunner.d.ts.map +1 -0
- package/dist/editor/assuredGateRunner.js +100 -0
- package/dist/editor/assuredPreFilter.d.ts +34 -0
- package/dist/editor/assuredPreFilter.d.ts.map +1 -0
- package/dist/editor/assuredPreFilter.js +134 -0
- package/dist/editor/assuredPreFilterRunner.d.ts +31 -0
- package/dist/editor/assuredPreFilterRunner.d.ts.map +1 -0
- package/dist/editor/assuredPreFilterRunner.js +312 -0
- package/dist/editor/builtinLanguageProviders.d.ts +6 -0
- package/dist/editor/builtinLanguageProviders.d.ts.map +1 -0
- package/dist/editor/builtinLanguageProviders.js +221 -0
- package/dist/editor/codingContext.d.ts +12 -0
- package/dist/editor/codingContext.d.ts.map +1 -0
- package/dist/editor/codingContext.js +121 -0
- package/dist/editor/codingContextEvidence.d.ts +7 -0
- package/dist/editor/codingContextEvidence.d.ts.map +1 -0
- package/dist/editor/codingContextEvidence.js +52 -0
- package/dist/editor/codingContextProviders.d.ts +36 -0
- package/dist/editor/codingContextProviders.d.ts.map +1 -0
- package/dist/editor/codingContextProviders.js +348 -0
- package/dist/editor/completionModelEvidence.d.ts +16 -0
- package/dist/editor/completionModelEvidence.d.ts.map +1 -0
- package/dist/editor/completionModelEvidence.js +50 -0
- package/dist/editor/completionRoutes.d.ts +37 -0
- package/dist/editor/completionRoutes.d.ts.map +1 -0
- package/dist/editor/completionRoutes.js +411 -0
- package/dist/editor/contextRoutes.d.ts +6 -0
- package/dist/editor/contextRoutes.d.ts.map +1 -0
- package/dist/editor/contextRoutes.js +411 -0
- package/dist/editor/disposableAssuredExecution.d.ts +22 -0
- package/dist/editor/disposableAssuredExecution.d.ts.map +1 -0
- package/dist/editor/disposableAssuredExecution.js +57 -0
- package/dist/editor/editorCompletionModel.d.ts +47 -0
- package/dist/editor/editorCompletionModel.d.ts.map +1 -0
- package/dist/editor/editorCompletionModel.js +156 -0
- package/dist/editor/editorInlineCompletionModel.d.ts +34 -0
- package/dist/editor/editorInlineCompletionModel.d.ts.map +1 -0
- package/dist/editor/editorInlineCompletionModel.js +112 -0
- package/dist/editor/editorModelTokenBudget.d.ts +46 -0
- package/dist/editor/editorModelTokenBudget.d.ts.map +1 -0
- package/dist/editor/editorModelTokenBudget.js +121 -0
- package/dist/editor/inlineCompletionRateLimiter.d.ts +19 -0
- package/dist/editor/inlineCompletionRateLimiter.d.ts.map +1 -0
- package/dist/editor/inlineCompletionRateLimiter.js +46 -0
- package/dist/editor/inlineCompletionRoutes.d.ts +26 -0
- package/dist/editor/inlineCompletionRoutes.d.ts.map +1 -0
- package/dist/editor/inlineCompletionRoutes.js +404 -0
- package/dist/editor/inlineCompletionTelemetryEvidence.d.ts +5 -0
- package/dist/editor/inlineCompletionTelemetryEvidence.d.ts.map +1 -0
- package/dist/editor/inlineCompletionTelemetryEvidence.js +42 -0
- package/dist/editor/languageCancellation.d.ts +19 -0
- package/dist/editor/languageCancellation.d.ts.map +1 -0
- package/dist/editor/languageCancellation.js +48 -0
- package/dist/editor/languageProvider.d.ts +39 -0
- package/dist/editor/languageProvider.d.ts.map +1 -0
- package/dist/editor/languageProvider.js +11 -0
- package/dist/editor/languageRoutes.d.ts +15 -0
- package/dist/editor/languageRoutes.d.ts.map +1 -0
- package/dist/editor/languageRoutes.js +106 -0
- package/dist/editor/languageSanitize.d.ts +8 -0
- package/dist/editor/languageSanitize.d.ts.map +1 -0
- package/dist/editor/languageSanitize.js +101 -0
- package/dist/editor/languageService.d.ts +36 -0
- package/dist/editor/languageService.d.ts.map +1 -0
- package/dist/editor/languageService.js +93 -0
- package/dist/editor/languageServiceHost.d.ts +14 -0
- package/dist/editor/languageServiceHost.d.ts.map +1 -0
- package/dist/editor/languageServiceHost.js +242 -0
- package/dist/editor/localKnowledgeRetrieval.d.ts +21 -0
- package/dist/editor/localKnowledgeRetrieval.d.ts.map +1 -0
- package/dist/editor/localKnowledgeRetrieval.js +44 -0
- package/dist/editor/patchApplyEvidence.d.ts +21 -0
- package/dist/editor/patchApplyEvidence.d.ts.map +1 -0
- package/dist/editor/patchApplyEvidence.js +87 -0
- package/dist/editor/patchApplyRoutes.d.ts +16 -0
- package/dist/editor/patchApplyRoutes.d.ts.map +1 -0
- package/dist/editor/patchApplyRoutes.js +307 -0
- package/dist/editor/postApplyVerification.d.ts +42 -0
- package/dist/editor/postApplyVerification.d.ts.map +1 -0
- package/dist/editor/postApplyVerification.js +177 -0
- package/dist/editor/testGenerationEvidence.d.ts +6 -0
- package/dist/editor/testGenerationEvidence.d.ts.map +1 -0
- package/dist/editor/testGenerationEvidence.js +72 -0
- package/dist/editor/testGenerationPatch.d.ts +10 -0
- package/dist/editor/testGenerationPatch.d.ts.map +1 -0
- package/dist/editor/testGenerationPatch.js +66 -0
- package/dist/editor/testGenerationRoutes.d.ts +21 -0
- package/dist/editor/testGenerationRoutes.d.ts.map +1 -0
- package/dist/editor/testGenerationRoutes.js +254 -0
- package/dist/editor/testGenerationRunner.d.ts +23 -0
- package/dist/editor/testGenerationRunner.d.ts.map +1 -0
- package/dist/editor/testGenerationRunner.js +120 -0
- package/dist/editor/textOffsets.d.ts +6 -0
- package/dist/editor/textOffsets.d.ts.map +1 -0
- package/dist/editor/textOffsets.js +82 -0
- package/dist/editor/typescriptLanguageProvider.d.ts +3 -0
- package/dist/editor/typescriptLanguageProvider.d.ts.map +1 -0
- package/dist/editor/typescriptLanguageProvider.js +217 -0
- package/dist/evidence.d.ts +28 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +145 -0
- package/dist/files-deny.d.ts +3 -0
- package/dist/files-deny.d.ts.map +1 -0
- package/dist/files-deny.js +12 -0
- package/dist/files.d.ts +97 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +733 -0
- package/dist/gateway-setup.d.ts +10 -0
- package/dist/gateway-setup.d.ts.map +1 -0
- package/dist/gateway-setup.js +896 -0
- package/dist/governed-workflow.d.ts +17 -0
- package/dist/governed-workflow.d.ts.map +1 -0
- package/dist/governed-workflow.js +147 -0
- package/dist/grounded-answer.d.ts +12 -0
- package/dist/grounded-answer.d.ts.map +1 -0
- package/dist/grounded-answer.js +69 -0
- package/dist/grounded-context-index.d.ts +25 -0
- package/dist/grounded-context-index.d.ts.map +1 -0
- package/dist/grounded-context-index.js +169 -0
- package/dist/grounded-document-evidence.d.ts +28 -0
- package/dist/grounded-document-evidence.d.ts.map +1 -0
- package/dist/grounded-document-evidence.js +430 -0
- package/dist/grounded-handoff.d.ts +4 -0
- package/dist/grounded-handoff.d.ts.map +1 -0
- package/dist/grounded-handoff.js +445 -0
- package/dist/grounded-orchestrator.d.ts +43 -0
- package/dist/grounded-orchestrator.d.ts.map +1 -0
- package/dist/grounded-orchestrator.js +1445 -0
- package/dist/grounded-prompt.d.ts +2 -0
- package/dist/grounded-prompt.d.ts.map +1 -0
- package/dist/grounded-prompt.js +17 -0
- package/dist/grounded-qa-hybrid.d.ts +36 -0
- package/dist/grounded-qa-hybrid.d.ts.map +1 -0
- package/dist/grounded-qa-hybrid.js +762 -0
- package/dist/grounded-qa-multi-source.d.ts +38 -0
- package/dist/grounded-qa-multi-source.d.ts.map +1 -0
- package/dist/grounded-qa-multi-source.js +461 -0
- package/dist/grounded-qa.d.ts +45 -0
- package/dist/grounded-qa.d.ts.map +1 -0
- package/dist/grounded-qa.js +877 -0
- package/dist/grounded-rerank.d.ts +26 -0
- package/dist/grounded-rerank.d.ts.map +1 -0
- package/dist/grounded-rerank.js +72 -0
- package/dist/grounded-turn-registry.d.ts +23 -0
- package/dist/grounded-turn-registry.d.ts.map +1 -0
- package/dist/grounded-turn-registry.js +102 -0
- package/dist/headers.d.ts +3 -0
- package/dist/headers.d.ts.map +1 -0
- package/dist/headers.js +22 -0
- package/dist/host-check.d.ts +3 -0
- package/dist/host-check.d.ts.map +1 -0
- package/dist/host-check.js +58 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/load-csp.d.ts +3 -0
- package/dist/load-csp.d.ts.map +1 -0
- package/dist/load-csp.js +100 -0
- package/dist/local-knowledge-grounded-qa.d.ts +42 -0
- package/dist/local-knowledge-grounded-qa.d.ts.map +1 -0
- package/dist/local-knowledge-grounded-qa.js +678 -0
- package/dist/local-knowledge-handlers.d.ts +24 -0
- package/dist/local-knowledge-handlers.d.ts.map +1 -0
- package/dist/local-knowledge-handlers.js +1285 -0
- package/dist/local-knowledge-indexing-registry.d.ts +13 -0
- package/dist/local-knowledge-indexing-registry.d.ts.map +1 -0
- package/dist/local-knowledge-indexing-registry.js +53 -0
- package/dist/localKnowledgeKeyProvider.d.ts +11 -0
- package/dist/localKnowledgeKeyProvider.d.ts.map +1 -0
- package/dist/localKnowledgeKeyProvider.js +48 -0
- package/dist/memory-audit-event-builders.d.ts +21 -0
- package/dist/memory-audit-event-builders.d.ts.map +1 -0
- package/dist/memory-audit-event-builders.js +187 -0
- package/dist/memory-audit-handler.d.ts +23 -0
- package/dist/memory-audit-handler.d.ts.map +1 -0
- package/dist/memory-audit-handler.js +191 -0
- package/dist/memory-capture-policy.d.ts +10 -0
- package/dist/memory-capture-policy.d.ts.map +1 -0
- package/dist/memory-capture-policy.js +44 -0
- package/dist/memory-consolidation-handlers.d.ts +6 -0
- package/dist/memory-consolidation-handlers.d.ts.map +1 -0
- package/dist/memory-consolidation-handlers.js +491 -0
- package/dist/memory-consolidation-registry.d.ts +47 -0
- package/dist/memory-consolidation-registry.d.ts.map +1 -0
- package/dist/memory-consolidation-registry.js +106 -0
- package/dist/memory-conv-handlers.d.ts +8 -0
- package/dist/memory-conv-handlers.d.ts.map +1 -0
- package/dist/memory-conv-handlers.js +369 -0
- package/dist/memory-conversation-context.d.ts +13 -0
- package/dist/memory-conversation-context.d.ts.map +1 -0
- package/dist/memory-conversation-context.js +22 -0
- package/dist/memory-diagnostics.d.ts +29 -0
- package/dist/memory-diagnostics.d.ts.map +1 -0
- package/dist/memory-diagnostics.js +122 -0
- package/dist/memory-embedding.d.ts +21 -0
- package/dist/memory-embedding.d.ts.map +1 -0
- package/dist/memory-embedding.js +264 -0
- package/dist/memory-handlers.d.ts +19 -0
- package/dist/memory-handlers.d.ts.map +1 -0
- package/dist/memory-handlers.js +1204 -0
- package/dist/memory-maintenance-handlers.d.ts +35 -0
- package/dist/memory-maintenance-handlers.d.ts.map +1 -0
- package/dist/memory-maintenance-handlers.js +219 -0
- package/dist/memory-record-builders.d.ts +4 -0
- package/dist/memory-record-builders.d.ts.map +1 -0
- package/dist/memory-record-builders.js +19 -0
- package/dist/memory-retention.d.ts +31 -0
- package/dist/memory-retention.d.ts.map +1 -0
- package/dist/memory-retention.js +151 -0
- package/dist/memory-retrieval-signals.d.ts +12 -0
- package/dist/memory-retrieval-signals.d.ts.map +1 -0
- package/dist/memory-retrieval-signals.js +100 -0
- package/dist/memory-salience.d.ts +12 -0
- package/dist/memory-salience.d.ts.map +1 -0
- package/dist/memory-salience.js +154 -0
- package/dist/memory-scope-sanitizer.d.ts +6 -0
- package/dist/memory-scope-sanitizer.d.ts.map +1 -0
- package/dist/memory-scope-sanitizer.js +106 -0
- package/dist/memory-target-resolver.d.ts +4 -0
- package/dist/memory-target-resolver.d.ts.map +1 -0
- package/dist/memory-target-resolver.js +73 -0
- package/dist/memory-workflow-port.d.ts +14 -0
- package/dist/memory-workflow-port.d.ts.map +1 -0
- package/dist/memory-workflow-port.js +186 -0
- package/dist/private-json.d.ts +3 -0
- package/dist/private-json.d.ts.map +1 -0
- package/dist/private-json.js +62 -0
- package/dist/promptEnhancer/index.d.ts +3 -0
- package/dist/promptEnhancer/index.d.ts.map +1 -0
- package/dist/promptEnhancer/index.js +5 -0
- package/dist/promptEnhancer/orchestrate.d.ts +2 -0
- package/dist/promptEnhancer/orchestrate.d.ts.map +1 -0
- package/dist/promptEnhancer/orchestrate.js +5 -0
- package/dist/promptEnhancer/routes.d.ts +9 -0
- package/dist/promptEnhancer/routes.d.ts.map +1 -0
- package/dist/promptEnhancer/routes.js +205 -0
- package/dist/qualityIntelligence/capsuleAdapter.d.ts +27 -0
- package/dist/qualityIntelligence/capsuleAdapter.d.ts.map +1 -0
- package/dist/qualityIntelligence/capsuleAdapter.js +57 -0
- package/dist/qualityIntelligence/connectorAuthorization.d.ts +22 -0
- package/dist/qualityIntelligence/connectorAuthorization.d.ts.map +1 -0
- package/dist/qualityIntelligence/connectorAuthorization.js +35 -0
- package/dist/qualityIntelligence/connectorErrors.d.ts +16 -0
- package/dist/qualityIntelligence/connectorErrors.d.ts.map +1 -0
- package/dist/qualityIntelligence/connectorErrors.js +56 -0
- package/dist/qualityIntelligence/connectorRoutes.d.ts +7 -0
- package/dist/qualityIntelligence/connectorRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/connectorRoutes.js +167 -0
- package/dist/qualityIntelligence/editRoutes.d.ts +5 -0
- package/dist/qualityIntelligence/editRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/editRoutes.js +293 -0
- package/dist/qualityIntelligence/exportAssembly.d.ts +22 -0
- package/dist/qualityIntelligence/exportAssembly.d.ts.map +1 -0
- package/dist/qualityIntelligence/exportAssembly.js +352 -0
- package/dist/qualityIntelligence/exportRoutes.d.ts +5 -0
- package/dist/qualityIntelligence/exportRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/exportRoutes.js +320 -0
- package/dist/qualityIntelligence/figma/figmaConcurrency.d.ts +8 -0
- package/dist/qualityIntelligence/figma/figmaConcurrency.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaConcurrency.js +34 -0
- package/dist/qualityIntelligence/figma/figmaConnector.d.ts +65 -0
- package/dist/qualityIntelligence/figma/figmaConnector.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaConnector.js +184 -0
- package/dist/qualityIntelligence/figma/figmaConnectorAudit.d.ts +52 -0
- package/dist/qualityIntelligence/figma/figmaConnectorAudit.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaConnectorAudit.js +63 -0
- package/dist/qualityIntelligence/figma/figmaConnectorErrors.d.ts +31 -0
- package/dist/qualityIntelligence/figma/figmaConnectorErrors.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaConnectorErrors.js +220 -0
- package/dist/qualityIntelligence/figma/figmaConnectorMetrics.d.ts +44 -0
- package/dist/qualityIntelligence/figma/figmaConnectorMetrics.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaConnectorMetrics.js +49 -0
- package/dist/qualityIntelligence/figma/figmaConsent.d.ts +39 -0
- package/dist/qualityIntelligence/figma/figmaConsent.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaConsent.js +62 -0
- package/dist/qualityIntelligence/figma/figmaHttpPort.d.ts +28 -0
- package/dist/qualityIntelligence/figma/figmaHttpPort.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaHttpPort.js +70 -0
- package/dist/qualityIntelligence/figma/figmaObservedActions.d.ts +49 -0
- package/dist/qualityIntelligence/figma/figmaObservedActions.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaObservedActions.js +89 -0
- package/dist/qualityIntelligence/figma/figmaReadiness.d.ts +32 -0
- package/dist/qualityIntelligence/figma/figmaReadiness.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaReadiness.js +67 -0
- package/dist/qualityIntelligence/figma/figmaRenderPort.d.ts +29 -0
- package/dist/qualityIntelligence/figma/figmaRenderPort.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaRenderPort.js +93 -0
- package/dist/qualityIntelligence/figma/figmaResnapshot.d.ts +28 -0
- package/dist/qualityIntelligence/figma/figmaResnapshot.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaResnapshot.js +38 -0
- package/dist/qualityIntelligence/figma/figmaRetry.d.ts +31 -0
- package/dist/qualityIntelligence/figma/figmaRetry.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaRetry.js +62 -0
- package/dist/qualityIntelligence/figma/figmaScopeRef.d.ts +9 -0
- package/dist/qualityIntelligence/figma/figmaScopeRef.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaScopeRef.js +18 -0
- package/dist/qualityIntelligence/figma/figmaScopedPagination.d.ts +86 -0
- package/dist/qualityIntelligence/figma/figmaScopedPagination.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaScopedPagination.js +308 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotBuilder.d.ts +31 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotBuilder.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotBuilder.js +314 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotHash.d.ts +18 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotHash.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotHash.js +63 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotTypes.d.ts +65 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotTypes.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaSnapshotTypes.js +13 -0
- package/dist/qualityIntelligence/figma/figmaTokenSource.d.ts +9 -0
- package/dist/qualityIntelligence/figma/figmaTokenSource.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaTokenSource.js +61 -0
- package/dist/qualityIntelligence/figma/figmaTokenStore.d.ts +19 -0
- package/dist/qualityIntelligence/figma/figmaTokenStore.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaTokenStore.js +156 -0
- package/dist/qualityIntelligence/figma/figmaUrl.d.ts +6 -0
- package/dist/qualityIntelligence/figma/figmaUrl.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/figmaUrl.js +36 -0
- package/dist/qualityIntelligence/figma/index.d.ts +20 -0
- package/dist/qualityIntelligence/figma/index.d.ts.map +1 -0
- package/dist/qualityIntelligence/figma/index.js +26 -0
- package/dist/qualityIntelligence/figmaCodegenRoutes.d.ts +28 -0
- package/dist/qualityIntelligence/figmaCodegenRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/figmaCodegenRoutes.js +165 -0
- package/dist/qualityIntelligence/figmaSnapshotAdapter.d.ts +55 -0
- package/dist/qualityIntelligence/figmaSnapshotAdapter.d.ts.map +1 -0
- package/dist/qualityIntelligence/figmaSnapshotAdapter.js +219 -0
- package/dist/qualityIntelligence/figmaSnapshotOrchestration.d.ts +64 -0
- package/dist/qualityIntelligence/figmaSnapshotOrchestration.d.ts.map +1 -0
- package/dist/qualityIntelligence/figmaSnapshotOrchestration.js +203 -0
- package/dist/qualityIntelligence/figmaSnapshotRoutes.d.ts +112 -0
- package/dist/qualityIntelligence/figmaSnapshotRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/figmaSnapshotRoutes.js +1063 -0
- package/dist/qualityIntelligence/figmaSnapshotScreenIds.d.ts +19 -0
- package/dist/qualityIntelligence/figmaSnapshotScreenIds.d.ts.map +1 -0
- package/dist/qualityIntelligence/figmaSnapshotScreenIds.js +75 -0
- package/dist/qualityIntelligence/generationPort.d.ts +15 -0
- package/dist/qualityIntelligence/generationPort.d.ts.map +1 -0
- package/dist/qualityIntelligence/generationPort.js +185 -0
- package/dist/qualityIntelligence/handoffErrors.d.ts +9 -0
- package/dist/qualityIntelligence/handoffErrors.d.ts.map +1 -0
- package/dist/qualityIntelligence/handoffErrors.js +21 -0
- package/dist/qualityIntelligence/handoffRoutes.d.ts +15 -0
- package/dist/qualityIntelligence/handoffRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/handoffRoutes.js +341 -0
- package/dist/qualityIntelligence/index.d.ts +17 -0
- package/dist/qualityIntelligence/index.d.ts.map +1 -0
- package/dist/qualityIntelligence/index.js +36 -0
- package/dist/qualityIntelligence/judgePort.d.ts +30 -0
- package/dist/qualityIntelligence/judgePort.d.ts.map +1 -0
- package/dist/qualityIntelligence/judgePort.js +326 -0
- package/dist/qualityIntelligence/modelSelection.d.ts +58 -0
- package/dist/qualityIntelligence/modelSelection.d.ts.map +1 -0
- package/dist/qualityIntelligence/modelSelection.js +148 -0
- package/dist/qualityIntelligence/reCheckRoutes.d.ts +6 -0
- package/dist/qualityIntelligence/reCheckRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/reCheckRoutes.js +1157 -0
- package/dist/qualityIntelligence/retentionEnforcement.d.ts +13 -0
- package/dist/qualityIntelligence/retentionEnforcement.d.ts.map +1 -0
- package/dist/qualityIntelligence/retentionEnforcement.js +47 -0
- package/dist/qualityIntelligence/retentionRoutes.d.ts +8 -0
- package/dist/qualityIntelligence/retentionRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/retentionRoutes.js +74 -0
- package/dist/qualityIntelligence/reviewRoutes.d.ts +5 -0
- package/dist/qualityIntelligence/reviewRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/reviewRoutes.js +145 -0
- package/dist/qualityIntelligence/reviewStore.d.ts +75 -0
- package/dist/qualityIntelligence/reviewStore.d.ts.map +1 -0
- package/dist/qualityIntelligence/reviewStore.js +170 -0
- package/dist/qualityIntelligence/runExecution.d.ts +36 -0
- package/dist/qualityIntelligence/runExecution.d.ts.map +1 -0
- package/dist/qualityIntelligence/runExecution.js +180 -0
- package/dist/qualityIntelligence/runIngestion.d.ts +70 -0
- package/dist/qualityIntelligence/runIngestion.d.ts.map +1 -0
- package/dist/qualityIntelligence/runIngestion.js +1235 -0
- package/dist/qualityIntelligence/runRegistry.d.ts +31 -0
- package/dist/qualityIntelligence/runRegistry.d.ts.map +1 -0
- package/dist/qualityIntelligence/runRegistry.js +66 -0
- package/dist/qualityIntelligence/runRoutes.d.ts +16 -0
- package/dist/qualityIntelligence/runRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/runRoutes.js +357 -0
- package/dist/qualityIntelligence/traceabilityRoutes.d.ts +5 -0
- package/dist/qualityIntelligence/traceabilityRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/traceabilityRoutes.js +173 -0
- package/dist/qualityIntelligence/uiRoutes.d.ts +7 -0
- package/dist/qualityIntelligence/uiRoutes.d.ts.map +1 -0
- package/dist/qualityIntelligence/uiRoutes.js +336 -0
- package/dist/read-handlers.d.ts +9 -0
- package/dist/read-handlers.d.ts.map +1 -0
- package/dist/read-handlers.js +265 -0
- package/dist/relationship-handlers.d.ts +191 -0
- package/dist/relationship-handlers.d.ts.map +1 -0
- package/dist/relationship-handlers.js +0 -0
- package/dist/routes.d.ts +37 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +507 -0
- package/dist/run-engine.d.ts +25 -0
- package/dist/run-engine.d.ts.map +1 -0
- package/dist/run-engine.js +385 -0
- package/dist/run-handlers.d.ts +9 -0
- package/dist/run-handlers.d.ts.map +1 -0
- package/dist/run-handlers.js +465 -0
- package/dist/run-request.d.ts +17 -0
- package/dist/run-request.d.ts.map +1 -0
- package/dist/run-request.js +219 -0
- package/dist/runs.d.ts +47 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +100 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +152 -0
- package/dist/sink.d.ts +28 -0
- package/dist/sink.d.ts.map +1 -0
- package/dist/sink.js +80 -0
- package/dist/sse-write.d.ts +9 -0
- package/dist/sse-write.d.ts.map +1 -0
- package/dist/sse-write.js +26 -0
- package/dist/sse.d.ts +8 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +27 -0
- package/dist/static.d.ts +5 -0
- package/dist/static.d.ts.map +1 -0
- package/dist/static.js +76 -0
- package/dist/store/chats.d.ts +17 -0
- package/dist/store/chats.d.ts.map +1 -0
- package/dist/store/chats.js +624 -0
- package/dist/store/db.d.ts +11 -0
- package/dist/store/db.d.ts.map +1 -0
- package/dist/store/db.js +203 -0
- package/dist/store/errors.d.ts +13 -0
- package/dist/store/errors.d.ts.map +1 -0
- package/dist/store/errors.js +30 -0
- package/dist/store/index.d.ts +7 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +6 -0
- package/dist/store/messages.d.ts +8 -0
- package/dist/store/messages.d.ts.map +1 -0
- package/dist/store/messages.js +149 -0
- package/dist/store/paths.d.ts +5 -0
- package/dist/store/paths.d.ts.map +1 -0
- package/dist/store/paths.js +84 -0
- package/dist/store/projects.d.ts +8 -0
- package/dist/store/projects.d.ts.map +1 -0
- package/dist/store/projects.js +59 -0
- package/dist/store/relationship-audit.d.ts +42 -0
- package/dist/store/relationship-audit.d.ts.map +1 -0
- package/dist/store/relationship-audit.js +155 -0
- package/dist/store/relationships.d.ts +191 -0
- package/dist/store/relationships.d.ts.map +1 -0
- package/dist/store/relationships.js +724 -0
- package/dist/store/schema.d.ts +4 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +220 -0
- package/dist/store/types.d.ts +29 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +8 -0
- package/dist/store/validation.d.ts +7 -0
- package/dist/store/validation.d.ts.map +1 -0
- package/dist/store/validation.js +117 -0
- package/dist/store-handlers.d.ts +17 -0
- package/dist/store-handlers.d.ts.map +1 -0
- package/dist/store-handlers.js +872 -0
- package/dist/terminal-errors.d.ts +22 -0
- package/dist/terminal-errors.d.ts.map +1 -0
- package/dist/terminal-errors.js +45 -0
- package/dist/terminal-evidence.d.ts +21 -0
- package/dist/terminal-evidence.d.ts.map +1 -0
- package/dist/terminal-evidence.js +65 -0
- package/dist/terminal-routes.d.ts +10 -0
- package/dist/terminal-routes.d.ts.map +1 -0
- package/dist/terminal-routes.js +219 -0
- package/dist/terminal.d.ts +68 -0
- package/dist/terminal.d.ts.map +1 -0
- package/dist/terminal.js +855 -0
- package/package.json +52 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AssuredGateRunner } from "./assuredPreFilter.js";
|
|
2
|
+
export interface SandboxedCommand {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly args: readonly string[];
|
|
5
|
+
}
|
|
6
|
+
export interface SandboxedRunResult {
|
|
7
|
+
readonly exitCode: number | null;
|
|
8
|
+
readonly networkEnforced: boolean;
|
|
9
|
+
readonly filesystemEnforced: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type SandboxedRun = (cmd: SandboxedCommand) => Promise<SandboxedRunResult>;
|
|
12
|
+
export type ReportReader = (relativePath: string) => unknown;
|
|
13
|
+
export declare function coveredDelta(baseline: unknown, patched: unknown, targetKeys: readonly string[]): {
|
|
14
|
+
readonly lineDelta: number;
|
|
15
|
+
readonly branchDelta: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function strykerKilled(report: unknown): {
|
|
18
|
+
readonly killed: number;
|
|
19
|
+
readonly total: number;
|
|
20
|
+
};
|
|
21
|
+
export interface SandboxedGateRunnerSpec {
|
|
22
|
+
readonly enforced: boolean;
|
|
23
|
+
readonly run: SandboxedRun;
|
|
24
|
+
readonly readReport: ReportReader;
|
|
25
|
+
readonly buildCommand: SandboxedCommand;
|
|
26
|
+
readonly testCommand: SandboxedCommand;
|
|
27
|
+
readonly coverageCommand: SandboxedCommand;
|
|
28
|
+
readonly mutationCommand: SandboxedCommand;
|
|
29
|
+
readonly baselineCoverageReportPath: string;
|
|
30
|
+
readonly patchedCoverageReportPath: string;
|
|
31
|
+
readonly mutationReportPath: string;
|
|
32
|
+
readonly targetCoverageKeys: readonly string[];
|
|
33
|
+
readonly minMutantsKilled: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function createSandboxedGateRunner(spec: SandboxedGateRunnerSpec): AssuredGateRunner;
|
|
36
|
+
//# sourceMappingURL=assuredGateRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assuredGateRunner.d.ts","sourceRoot":"","sources":["../../src/editor/assuredGateRunner.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC;AAGD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAGlF,MAAM,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;AAqC7D,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAM9D;AAwBD,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAYA;AAID,MAAM,WAAW,uBAAuB;IAEtC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC3C,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAG3C,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAEpC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAMD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,GAAG,iBAAiB,CA0B1F"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Effect adapter for the assured pre-filter (Issue #1202 wave-2; ADR-0043).
|
|
2
|
+
//
|
|
3
|
+
// Composes an injected sandboxed-command runner (in production: keiko-tools `runCommand` with
|
|
4
|
+
// `network: "none"`, rooted at a disposable execution copy) and an injected report reader into the
|
|
5
|
+
// AssuredGateRunner the pure orchestrator drives. The vitest-coverage-delta and Stryker-mutation
|
|
6
|
+
// parsers are pure and unit-tested; the command execution + report reads are the injected effects, so
|
|
7
|
+
// every gate runs inside the enforced egress boundary and the user's workspace is never written.
|
|
8
|
+
// ─── Pure parsers ──────────────────────────────────────────────────────────────────────────────────
|
|
9
|
+
function isRecord(value) {
|
|
10
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
function coveredCount(fileCoverage, metric) {
|
|
13
|
+
if (!isRecord(fileCoverage)) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
const dimension = fileCoverage[metric];
|
|
17
|
+
if (!isRecord(dimension)) {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
const covered = dimension.covered;
|
|
21
|
+
return typeof covered === "number" && Number.isFinite(covered) ? covered : 0;
|
|
22
|
+
}
|
|
23
|
+
function sumCovered(summary, targetKeys, metric) {
|
|
24
|
+
if (!isRecord(summary)) {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
let total = 0;
|
|
28
|
+
for (const key of targetKeys) {
|
|
29
|
+
total += coveredCount(summary[key], metric);
|
|
30
|
+
}
|
|
31
|
+
return total;
|
|
32
|
+
}
|
|
33
|
+
// The strict increase in covered lines/branches for the target files between the pre-patch baseline
|
|
34
|
+
// and the patched run. A vitest json-summary maps a file path to `{ lines: { covered }, branches: { covered } }`.
|
|
35
|
+
export function coveredDelta(baseline, patched, targetKeys) {
|
|
36
|
+
return {
|
|
37
|
+
lineDelta: sumCovered(patched, targetKeys, "lines") - sumCovered(baseline, targetKeys, "lines"),
|
|
38
|
+
branchDelta: sumCovered(patched, targetKeys, "branches") - sumCovered(baseline, targetKeys, "branches"),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Killed vs total injected mutants from a Stryker JSON report. A mutant is "detected" when Killed or
|
|
42
|
+
// Timeout; Ignored/NoCoverage mutants are excluded from the total so a non-covered region does not
|
|
43
|
+
// dilute the oracle-strength ratio.
|
|
44
|
+
function countFileMutants(file) {
|
|
45
|
+
if (!isRecord(file) || !Array.isArray(file.mutants)) {
|
|
46
|
+
return { killed: 0, total: 0 };
|
|
47
|
+
}
|
|
48
|
+
let killed = 0;
|
|
49
|
+
let total = 0;
|
|
50
|
+
for (const mutant of file.mutants) {
|
|
51
|
+
const status = isRecord(mutant) ? mutant.status : undefined;
|
|
52
|
+
if (status === "Ignored" || status === "NoCoverage") {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
total += 1;
|
|
56
|
+
if (status === "Killed" || status === "Timeout") {
|
|
57
|
+
killed += 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return { killed, total };
|
|
61
|
+
}
|
|
62
|
+
export function strykerKilled(report) {
|
|
63
|
+
if (!isRecord(report) || !isRecord(report.files)) {
|
|
64
|
+
return { killed: 0, total: 0 };
|
|
65
|
+
}
|
|
66
|
+
let killed = 0;
|
|
67
|
+
let total = 0;
|
|
68
|
+
for (const file of Object.values(report.files)) {
|
|
69
|
+
const counts = countFileMutants(file);
|
|
70
|
+
killed += counts.killed;
|
|
71
|
+
total += counts.total;
|
|
72
|
+
}
|
|
73
|
+
return { killed, total };
|
|
74
|
+
}
|
|
75
|
+
function ok(result) {
|
|
76
|
+
return result.exitCode === 0 && result.networkEnforced && result.filesystemEnforced;
|
|
77
|
+
}
|
|
78
|
+
export function createSandboxedGateRunner(spec) {
|
|
79
|
+
return {
|
|
80
|
+
enforced: spec.enforced,
|
|
81
|
+
build: async () => ({ ok: ok(await spec.run(spec.buildCommand)) }),
|
|
82
|
+
runTests: async () => ({ ok: ok(await spec.run(spec.testCommand)) }),
|
|
83
|
+
coverage: async () => {
|
|
84
|
+
const run = await spec.run(spec.coverageCommand);
|
|
85
|
+
if (!ok(run)) {
|
|
86
|
+
return { ok: false, lineDelta: 0, branchDelta: 0 };
|
|
87
|
+
}
|
|
88
|
+
const delta = coveredDelta(spec.readReport(spec.baselineCoverageReportPath), spec.readReport(spec.patchedCoverageReportPath), spec.targetCoverageKeys);
|
|
89
|
+
return { ok: delta.lineDelta > 0 || delta.branchDelta > 0, ...delta };
|
|
90
|
+
},
|
|
91
|
+
mutation: async () => {
|
|
92
|
+
const run = await spec.run(spec.mutationCommand);
|
|
93
|
+
if (!ok(run)) {
|
|
94
|
+
return { ok: false, killed: 0, total: 0 };
|
|
95
|
+
}
|
|
96
|
+
const counts = strykerKilled(spec.readReport(spec.mutationReportPath));
|
|
97
|
+
return { ok: counts.killed >= spec.minMutantsKilled, ...counts };
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type EditorTestGenerationAssurance, type EditorTestGenerationFunnel } from "@oscharko-dev/keiko-contracts";
|
|
2
|
+
export interface GateOutcome {
|
|
3
|
+
readonly ok: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface CoverageOutcome {
|
|
6
|
+
readonly ok: boolean;
|
|
7
|
+
readonly lineDelta: number;
|
|
8
|
+
readonly branchDelta: number;
|
|
9
|
+
}
|
|
10
|
+
export interface MutationOutcome {
|
|
11
|
+
readonly ok: boolean;
|
|
12
|
+
readonly killed: number;
|
|
13
|
+
readonly total: number;
|
|
14
|
+
}
|
|
15
|
+
export interface AssuredGateRunner {
|
|
16
|
+
readonly enforced: boolean;
|
|
17
|
+
readonly build: () => Promise<GateOutcome>;
|
|
18
|
+
readonly runTests: () => Promise<GateOutcome>;
|
|
19
|
+
readonly coverage: () => Promise<CoverageOutcome>;
|
|
20
|
+
readonly mutation: () => Promise<MutationOutcome>;
|
|
21
|
+
}
|
|
22
|
+
export interface AssuredPreFilterConfig {
|
|
23
|
+
readonly stabilityRuns: number;
|
|
24
|
+
readonly minMutantsKilled: number;
|
|
25
|
+
}
|
|
26
|
+
export declare const DEFAULT_ASSURED_PRE_FILTER_CONFIG: AssuredPreFilterConfig;
|
|
27
|
+
export interface AssuredPreFilterOutcome {
|
|
28
|
+
readonly funnel: EditorTestGenerationFunnel;
|
|
29
|
+
readonly assurance: EditorTestGenerationAssurance;
|
|
30
|
+
readonly surfaced: boolean;
|
|
31
|
+
readonly rejectionReason?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export declare function runAssuredPreFilter(runner: AssuredGateRunner, config?: AssuredPreFilterConfig): Promise<AssuredPreFilterOutcome>;
|
|
34
|
+
//# sourceMappingURL=assuredPreFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assuredPreFilter.d.ts","sourceRoot":"","sources":["../../src/editor/assuredPreFilter.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAEhC,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAGD,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,iCAAiC,EAAE,sBAG/C,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,6BAA6B,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C;AAiKD,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,iBAAiB,EACzB,MAAM,GAAE,sBAA0D,GACjE,OAAO,CAAC,uBAAuB,CAAC,CAoBlC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Assured pre-filter for editor-driven test generation (Issue #1202 wave-2; ADR-0042 D7, ADR-0043).
|
|
2
|
+
//
|
|
3
|
+
// Models Meta's "Automated Unit Test Improvement" assurance funnel: a generated candidate is surfaced
|
|
4
|
+
// as apply-ready ONLY if, in order, it builds → passes → is stable across N>=5 executions → strictly
|
|
5
|
+
// increases coverage for the target → kills enough injected mutants (oracle strength, which supersedes
|
|
6
|
+
// the qualitative anti-tautology rule for the first TS/JS stack). Every gate executes UNTRUSTED,
|
|
7
|
+
// model-generated code, so it runs through an enforced deny-by-default egress boundary (keiko-sandbox,
|
|
8
|
+
// ADR-0043). When the boundary is not enforced the pre-filter refuses to execute and reports the
|
|
9
|
+
// candidate as untrusted evidence only — never `assured` (owner decision on #1202).
|
|
10
|
+
//
|
|
11
|
+
// This module is the PURE sequencing + funnel/assurance decision over an injected AssuredGateRunner;
|
|
12
|
+
// the runner (which materialises a disposable execution root and runs build/vitest/Stryker through the
|
|
13
|
+
// sandboxed command boundary) is the effect, assembled in assuredGateRunner.ts.
|
|
14
|
+
import { EDITOR_TEST_GENERATION_STABILITY_RUNS, } from "@oscharko-dev/keiko-contracts";
|
|
15
|
+
export const DEFAULT_ASSURED_PRE_FILTER_CONFIG = {
|
|
16
|
+
stabilityRuns: EDITOR_TEST_GENERATION_STABILITY_RUNS,
|
|
17
|
+
minMutantsKilled: 1,
|
|
18
|
+
};
|
|
19
|
+
const NOT_ENFORCED_REASON = "The deny-by-default network-egress boundary required to execute the candidate is not enforced on " +
|
|
20
|
+
"this host; the candidate is shown as untrusted evidence only and is not assured.";
|
|
21
|
+
function allNotRun() {
|
|
22
|
+
return {
|
|
23
|
+
build: "not-run",
|
|
24
|
+
pass: "not-run",
|
|
25
|
+
stability: "not-run",
|
|
26
|
+
coverage: "not-run",
|
|
27
|
+
mutation: "not-run",
|
|
28
|
+
antiTautology: "not-run",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function toFunnel(states, surfaced, config, evidence) {
|
|
32
|
+
return {
|
|
33
|
+
executionEnabled: true,
|
|
34
|
+
candidatesGenerated: 1,
|
|
35
|
+
candidatesSurfaced: surfaced ? 1 : 0,
|
|
36
|
+
stabilityRunsRequired: config.stabilityRuns,
|
|
37
|
+
build: states.build,
|
|
38
|
+
pass: states.pass,
|
|
39
|
+
stability: states.stability,
|
|
40
|
+
coverage: states.coverage,
|
|
41
|
+
mutation: states.mutation,
|
|
42
|
+
antiTautology: states.antiTautology,
|
|
43
|
+
...(evidence.coverageLineDelta === undefined
|
|
44
|
+
? {}
|
|
45
|
+
: { coverageLineDelta: evidence.coverageLineDelta }),
|
|
46
|
+
...(evidence.coverageBranchDelta === undefined
|
|
47
|
+
? {}
|
|
48
|
+
: { coverageBranchDelta: evidence.coverageBranchDelta }),
|
|
49
|
+
...(evidence.mutantsKilled === undefined ? {} : { mutantsKilled: evidence.mutantsKilled }),
|
|
50
|
+
...(evidence.mutantsTotal === undefined ? {} : { mutantsTotal: evidence.mutantsTotal }),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function reject(states, config, reason, evidence = {}) {
|
|
54
|
+
return {
|
|
55
|
+
funnel: toFunnel(states, false, config, evidence),
|
|
56
|
+
assurance: "unverified",
|
|
57
|
+
surfaced: false,
|
|
58
|
+
rejectionReason: reason,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// Runs the candidate test `stabilityRuns` times. The first run is the `pass` gate; all runs together
|
|
62
|
+
// are the `stability` gate (no flakiness across N executions).
|
|
63
|
+
async function runStability(runner, runs) {
|
|
64
|
+
let firstOk = false;
|
|
65
|
+
let allOk = true;
|
|
66
|
+
for (let i = 0; i < runs; i += 1) {
|
|
67
|
+
const outcome = await runner.runTests();
|
|
68
|
+
if (i === 0) {
|
|
69
|
+
firstOk = outcome.ok;
|
|
70
|
+
}
|
|
71
|
+
if (!outcome.ok) {
|
|
72
|
+
allOk = false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { firstOk, allOk };
|
|
76
|
+
}
|
|
77
|
+
// Each gate mutates `states`/`evidence` and returns a rejection outcome to stop the funnel, or
|
|
78
|
+
// undefined to continue. Splitting per gate keeps the orchestrator short and within complexity limits.
|
|
79
|
+
async function buildGate(runner, states, config) {
|
|
80
|
+
const build = await runner.build();
|
|
81
|
+
states.build = build.ok ? "passed" : "failed";
|
|
82
|
+
return build.ok ? undefined : reject(states, config, "The generated candidate does not build.");
|
|
83
|
+
}
|
|
84
|
+
async function stabilityGate(runner, states, config) {
|
|
85
|
+
const stability = await runStability(runner, config.stabilityRuns);
|
|
86
|
+
states.pass = stability.firstOk ? "passed" : "failed";
|
|
87
|
+
if (!stability.firstOk) {
|
|
88
|
+
return reject(states, config, "The generated candidate test does not pass.");
|
|
89
|
+
}
|
|
90
|
+
states.stability = stability.allOk ? "passed" : "failed";
|
|
91
|
+
return stability.allOk
|
|
92
|
+
? undefined
|
|
93
|
+
: reject(states, config, "The generated candidate test is flaky across stability runs.");
|
|
94
|
+
}
|
|
95
|
+
async function coverageGate(runner, states, config, evidence) {
|
|
96
|
+
const cov = await runner.coverage();
|
|
97
|
+
states.coverage = cov.ok ? "passed" : "failed";
|
|
98
|
+
evidence.coverageLineDelta = cov.lineDelta;
|
|
99
|
+
evidence.coverageBranchDelta = cov.branchDelta;
|
|
100
|
+
return cov.ok
|
|
101
|
+
? undefined
|
|
102
|
+
: reject(states, config, "The generated candidate does not increase coverage.", evidence);
|
|
103
|
+
}
|
|
104
|
+
async function mutationGate(runner, states, config, evidence) {
|
|
105
|
+
const mut = await runner.mutation();
|
|
106
|
+
evidence.mutantsKilled = mut.killed;
|
|
107
|
+
evidence.mutantsTotal = mut.total;
|
|
108
|
+
states.mutation = mut.ok ? "passed" : "failed";
|
|
109
|
+
// Mutation (oracle strength) supersedes the qualitative anti-tautology rule for the first stack.
|
|
110
|
+
states.antiTautology = mut.ok ? "passed" : "failed";
|
|
111
|
+
return mut.ok
|
|
112
|
+
? undefined
|
|
113
|
+
: reject(states, config, "The generated candidate does not kill enough injected mutants (weak oracle).", evidence);
|
|
114
|
+
}
|
|
115
|
+
export async function runAssuredPreFilter(runner, config = DEFAULT_ASSURED_PRE_FILTER_CONFIG) {
|
|
116
|
+
if (!runner.enforced) {
|
|
117
|
+
return {
|
|
118
|
+
funnel: toFunnel(allNotRun(), false, config, {}),
|
|
119
|
+
assurance: "unverified",
|
|
120
|
+
surfaced: false,
|
|
121
|
+
rejectionReason: NOT_ENFORCED_REASON,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const states = allNotRun();
|
|
125
|
+
const evidence = {};
|
|
126
|
+
const rejected = (await buildGate(runner, states, config)) ??
|
|
127
|
+
(await stabilityGate(runner, states, config)) ??
|
|
128
|
+
(await coverageGate(runner, states, config, evidence)) ??
|
|
129
|
+
(await mutationGate(runner, states, config, evidence));
|
|
130
|
+
if (rejected !== undefined) {
|
|
131
|
+
return rejected;
|
|
132
|
+
}
|
|
133
|
+
return { funnel: toFunnel(states, true, config, evidence), assurance: "assured", surfaced: true };
|
|
134
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CommandRule, type EditorTestGenerationWirePatch, type EditorTestGenerationWireRequest, type EditorTestGenerationWireTarget } from "@oscharko-dev/keiko-contracts";
|
|
2
|
+
import type { AssuredPreFilterOutcome } from "./assuredPreFilter.js";
|
|
3
|
+
import type { SandboxedCommand } from "./assuredGateRunner.js";
|
|
4
|
+
export type AssuredVerificationKind = "vitest" | "playwright";
|
|
5
|
+
export interface AssuredPreFilterArgs {
|
|
6
|
+
readonly patch: EditorTestGenerationWirePatch;
|
|
7
|
+
readonly request: EditorTestGenerationWireRequest;
|
|
8
|
+
readonly realRoot: string;
|
|
9
|
+
readonly signal: AbortSignal;
|
|
10
|
+
readonly verification?: AssuredVerificationKind | undefined;
|
|
11
|
+
}
|
|
12
|
+
export type AssuredPreFilterPort = (args: AssuredPreFilterArgs) => Promise<AssuredPreFilterOutcome>;
|
|
13
|
+
export declare const ASSURED_COMMAND_RULES: readonly CommandRule[];
|
|
14
|
+
export declare function targetSourceRelPath(target: EditorTestGenerationWireTarget): string;
|
|
15
|
+
interface GateCommands {
|
|
16
|
+
readonly build: SandboxedCommand;
|
|
17
|
+
readonly test: SandboxedCommand;
|
|
18
|
+
readonly baseline: SandboxedCommand;
|
|
19
|
+
readonly coverage: SandboxedCommand;
|
|
20
|
+
readonly mutation: SandboxedCommand;
|
|
21
|
+
}
|
|
22
|
+
export declare function planGateCommands(kind?: AssuredVerificationKind): GateCommands;
|
|
23
|
+
export declare function relativizeCoverageSummary(summary: unknown, root: string): unknown;
|
|
24
|
+
export declare function candidateFileText(edits: readonly {
|
|
25
|
+
readonly newText: string;
|
|
26
|
+
}[]): string;
|
|
27
|
+
export declare function candidateWritePath(root: string, path: string): string;
|
|
28
|
+
export declare function writeCandidateInto(root: string, patch: EditorTestGenerationWirePatch): void;
|
|
29
|
+
export declare const defaultAssuredPreFilter: AssuredPreFilterPort;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=assuredPreFilterRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assuredPreFilterRunner.d.ts","sourceRoot":"","sources":["../../src/editor/assuredPreFilterRunner.ts"],"names":[],"mappings":"AAyBA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACpC,MAAM,+BAA+B,CAAC;AAUvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,wBAAwB,CAAC;AAYnF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,6BAA6B,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,+BAA+B,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,QAAQ,CAAC,YAAY,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;CAC7D;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAwBpG,eAAO,MAAM,qBAAqB,EAAE,SAAS,WAAW,EAOtD,CAAC;AAYH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,8BAA8B,GAAG,MAAM,CAIlF;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;CACrC;AA+CD,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,uBAAkC,GAAG,YAAY,CAEvF;AAID,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAUjF;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAExF;AAyID,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAYrE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,6BAA6B,GAAG,IAAI,CAS3F;AAqDD,eAAO,MAAM,uBAAuB,EAAE,oBAC0D,CAAC"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
// Production assembly of the assured pre-filter (Issue #1202 wave-2; ADR-0043).
|
|
2
|
+
//
|
|
3
|
+
// Wires the disposable-execution composition to real effects: a throwaway copy of the target project,
|
|
4
|
+
// a sandboxed command runner (keiko-tools `runCommand` with `network: "none"` — the enforced egress
|
|
5
|
+
// boundary), JSON report reads, and guaranteed cleanup. Enforcement is decided by keiko-sandbox; on a
|
|
6
|
+
// host with no enforcing backend the pre-filter fails closed (the candidate is untrusted evidence
|
|
7
|
+
// only, never `assured`). The TS/JS gate toolchain (tsc + vitest + Stryker) is the first stack the
|
|
8
|
+
// Review Addendum scopes; the project-specific isolated-execution harness it composes is the shared
|
|
9
|
+
// path #1204/#1206 generalise.
|
|
10
|
+
//
|
|
11
|
+
// The command/coverage-key builders are pure and unit-tested; the filesystem copy and sandboxed spawn
|
|
12
|
+
// are thin node effects exercised when the feature is enabled on a host with a sandbox backend.
|
|
13
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync, } from "node:fs";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
15
|
+
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
16
|
+
import { DEFAULT_SANDBOX_POLICY, isValidScopePath, } from "@oscharko-dev/keiko-contracts";
|
|
17
|
+
import { runCommand } from "@oscharko-dev/keiko-tools";
|
|
18
|
+
import { nodeSpawnFn } from "@oscharko-dev/keiko-tools/internal/exec";
|
|
19
|
+
import { containedRealPathInfo, isDenied, resolveWithinWorkspace, } from "@oscharko-dev/keiko-workspace";
|
|
20
|
+
import { nodeWorkspaceFs } from "@oscharko-dev/keiko-workspace/internal/fs";
|
|
21
|
+
import { runDisposableAssuredPreFilter, sandboxEnforcesAssuredIsolation, } from "./disposableAssuredExecution.js";
|
|
22
|
+
const ASSURED_DIR = ".keiko-assured";
|
|
23
|
+
const BASELINE_SUMMARY = `${ASSURED_DIR}/baseline/coverage-summary.json`;
|
|
24
|
+
const PATCHED_SUMMARY = `${ASSURED_DIR}/patched/coverage-summary.json`;
|
|
25
|
+
const MUTATION_REPORT = `${ASSURED_DIR}/mutation/mutation.json`;
|
|
26
|
+
const MUTATION_CONFIG = `${ASSURED_DIR}/mutation/stryker.conf.json`;
|
|
27
|
+
const PROOF_SNIPPET = [
|
|
28
|
+
"const fs = require('fs');",
|
|
29
|
+
"const path = require('path');",
|
|
30
|
+
"const [outsideRead, outsideWrite, insideWrite] = process.argv.slice(1);",
|
|
31
|
+
"let readOutside = false;",
|
|
32
|
+
"let wroteOutside = false;",
|
|
33
|
+
"let wroteInside = false;",
|
|
34
|
+
"try { fs.readFileSync(outsideRead, 'utf8'); readOutside = true; } catch {}",
|
|
35
|
+
"try { fs.writeFileSync(outsideWrite, 'outside'); wroteOutside = true; } catch {}",
|
|
36
|
+
"try { fs.mkdirSync(path.dirname(insideWrite), { recursive: true });",
|
|
37
|
+
" fs.writeFileSync(insideWrite, 'inside'); wroteInside = true; } catch {}",
|
|
38
|
+
"process.stdout.write(JSON.stringify({ readOutside, wroteOutside, wroteInside }));",
|
|
39
|
+
].join("");
|
|
40
|
+
// Command rules for the assured toolchain: only the deterministic node test toolchain, no network
|
|
41
|
+
// tools. Policy requires `npx --no-install <tool>` before every allowed tool, so the no-fetch invariant
|
|
42
|
+
// is enforced by the sandbox allowlist in addition to the command builders.
|
|
43
|
+
export const ASSURED_COMMAND_RULES = Object.freeze([
|
|
44
|
+
{
|
|
45
|
+
executable: "npx",
|
|
46
|
+
allowedSubcommands: Object.freeze(["tsc", "vitest", "stryker", "playwright"]),
|
|
47
|
+
requiredLeadingFlags: Object.freeze(["--no-install"]),
|
|
48
|
+
denyFlags: Object.freeze(["-c", "--call", "-y", "--yes"]),
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
const ASSURED_PROOF_RULES = Object.freeze([{ executable: "node" }]);
|
|
52
|
+
let assuredIsolationProof;
|
|
53
|
+
function npx(args) {
|
|
54
|
+
return { command: "npx", args };
|
|
55
|
+
}
|
|
56
|
+
// ─── Pure builders (unit-tested) ─────────────────────────────────────────────────────────────────
|
|
57
|
+
// The source file under test, relative to the project root, used as the coverage key whose covered
|
|
58
|
+
// lines must strictly increase.
|
|
59
|
+
export function targetSourceRelPath(target) {
|
|
60
|
+
return target.kind === "changed-file-set"
|
|
61
|
+
? (target.documents[0]?.path ?? "")
|
|
62
|
+
: target.document.path;
|
|
63
|
+
}
|
|
64
|
+
// The vitest gate commands (the #1202 default), all writing JSON reports under ASSURED_DIR so they can
|
|
65
|
+
// be read back deterministically. Baseline coverage runs the existing suite before the candidate is
|
|
66
|
+
// applied; the patched coverage run includes the candidate.
|
|
67
|
+
function vitestGateCommands() {
|
|
68
|
+
return {
|
|
69
|
+
build: npx(["--no-install", "tsc", "--noEmit"]),
|
|
70
|
+
test: npx(["--no-install", "vitest", "run"]),
|
|
71
|
+
baseline: npx([
|
|
72
|
+
"--no-install",
|
|
73
|
+
"vitest",
|
|
74
|
+
"run",
|
|
75
|
+
"--coverage",
|
|
76
|
+
"--coverage.reporter=json-summary",
|
|
77
|
+
`--coverage.reportsDirectory=${ASSURED_DIR}/baseline`,
|
|
78
|
+
]),
|
|
79
|
+
coverage: npx([
|
|
80
|
+
"--no-install",
|
|
81
|
+
"vitest",
|
|
82
|
+
"run",
|
|
83
|
+
"--coverage",
|
|
84
|
+
"--coverage.reporter=json-summary",
|
|
85
|
+
`--coverage.reportsDirectory=${ASSURED_DIR}/patched`,
|
|
86
|
+
]),
|
|
87
|
+
mutation: npx(["--no-install", "stryker", "run", MUTATION_CONFIG]),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// The Playwright gate commands (Issue #1203 browser-smoke). The candidate is type-checked and executed
|
|
91
|
+
// as a Playwright suite under the same hardened, no-install, no-network sandbox as the vitest toolchain.
|
|
92
|
+
// There is no vitest coverage/mutation oracle for an end-to-end smoke, so the coverage/baseline/mutation
|
|
93
|
+
// slots run the same suite and emit no JSON report — those gates therefore cannot pass and the candidate
|
|
94
|
+
// stays `unverified`, never `assured`.
|
|
95
|
+
function playwrightGateCommands() {
|
|
96
|
+
const run = npx(["--no-install", "playwright", "test"]);
|
|
97
|
+
return {
|
|
98
|
+
build: npx(["--no-install", "tsc", "--noEmit"]),
|
|
99
|
+
test: run,
|
|
100
|
+
baseline: run,
|
|
101
|
+
coverage: run,
|
|
102
|
+
mutation: run,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// Selects the gate commands for the verification toolchain. Defaults to vitest, so callers that do not
|
|
106
|
+
// pass a kind keep the exact #1202 command set.
|
|
107
|
+
export function planGateCommands(kind = "vitest") {
|
|
108
|
+
return kind === "playwright" ? playwrightGateCommands() : vitestGateCommands();
|
|
109
|
+
}
|
|
110
|
+
// Normalises a vitest coverage summary's absolute file keys to project-relative paths so the covered
|
|
111
|
+
// delta matches the relative target key regardless of where the disposable root lives.
|
|
112
|
+
export function relativizeCoverageSummary(summary, root) {
|
|
113
|
+
if (typeof summary !== "object" || summary === null) {
|
|
114
|
+
return summary;
|
|
115
|
+
}
|
|
116
|
+
const prefix = root.endsWith("/") ? root : `${root}/`;
|
|
117
|
+
const out = {};
|
|
118
|
+
for (const [key, value] of Object.entries(summary)) {
|
|
119
|
+
out[key.startsWith(prefix) ? key.slice(prefix.length) : key] = value;
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
// Concatenates a candidate file's edit text. The generated candidate is a new (or rewritten) test
|
|
124
|
+
// file, so the edits' newText is its content; deleted files contribute nothing.
|
|
125
|
+
export function candidateFileText(edits) {
|
|
126
|
+
return edits.map((edit) => edit.newText).join("");
|
|
127
|
+
}
|
|
128
|
+
// ─── Node effects ────────────────────────────────────────────────────────────────────────────────
|
|
129
|
+
function disposableWorkspace(root) {
|
|
130
|
+
return {
|
|
131
|
+
root,
|
|
132
|
+
name: undefined,
|
|
133
|
+
version: undefined,
|
|
134
|
+
testFramework: "unknown",
|
|
135
|
+
sourceDirs: [],
|
|
136
|
+
testDirs: [],
|
|
137
|
+
languages: [],
|
|
138
|
+
ignoreLines: [],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
// Runs one untrusted command in the disposable root through the enforced sandbox (network:"none").
|
|
142
|
+
async function runSandboxed(root, cmd, signal) {
|
|
143
|
+
const proof = (assuredIsolationProof ??= proveAssuredIsolation(root, signal));
|
|
144
|
+
if (!(await proof)) {
|
|
145
|
+
return { exitCode: 1, networkEnforced: false, filesystemEnforced: false };
|
|
146
|
+
}
|
|
147
|
+
const result = await runCommand({ command: cmd.command, args: cmd.args, cwd: undefined, timeoutMs: undefined, signal }, {
|
|
148
|
+
workspace: disposableWorkspace(root),
|
|
149
|
+
policy: {
|
|
150
|
+
...DEFAULT_SANDBOX_POLICY,
|
|
151
|
+
network: "none",
|
|
152
|
+
filesystem: "execution-root",
|
|
153
|
+
},
|
|
154
|
+
commandRules: ASSURED_COMMAND_RULES,
|
|
155
|
+
spawn: nodeSpawnFn,
|
|
156
|
+
processEnv: process.env,
|
|
157
|
+
now: () => Date.now(),
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
exitCode: result.exitCode,
|
|
161
|
+
networkEnforced: result.attestation?.networkEnforced === true,
|
|
162
|
+
filesystemEnforced: result.attestation?.filesystemEnforced === true,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
async function proveAssuredIsolation(root, signal) {
|
|
166
|
+
const outsideDir = join(dirname(root), `${basename(root)}-outside-proof`);
|
|
167
|
+
const outsideRead = join(outsideDir, "read.txt");
|
|
168
|
+
const outsideWrite = join(outsideDir, "write.txt");
|
|
169
|
+
const insideWrite = join(ASSURED_DIR, "proof", "inside.txt");
|
|
170
|
+
mkdirSync(outsideDir, { recursive: true });
|
|
171
|
+
writeFileSync(outsideRead, "outside\n", "utf8");
|
|
172
|
+
try {
|
|
173
|
+
const result = await runCommand({
|
|
174
|
+
command: "node",
|
|
175
|
+
args: ["-e", PROOF_SNIPPET, outsideRead, outsideWrite, insideWrite],
|
|
176
|
+
cwd: undefined,
|
|
177
|
+
timeoutMs: undefined,
|
|
178
|
+
signal,
|
|
179
|
+
}, {
|
|
180
|
+
workspace: disposableWorkspace(root),
|
|
181
|
+
policy: {
|
|
182
|
+
...DEFAULT_SANDBOX_POLICY,
|
|
183
|
+
network: "none",
|
|
184
|
+
filesystem: "execution-root",
|
|
185
|
+
},
|
|
186
|
+
commandRules: ASSURED_PROOF_RULES,
|
|
187
|
+
spawn: nodeSpawnFn,
|
|
188
|
+
processEnv: process.env,
|
|
189
|
+
now: () => Date.now(),
|
|
190
|
+
});
|
|
191
|
+
const { attestation } = result;
|
|
192
|
+
return (result.exitCode === 0 &&
|
|
193
|
+
attestation !== undefined &&
|
|
194
|
+
attestation.networkEnforced &&
|
|
195
|
+
attestation.filesystemEnforced &&
|
|
196
|
+
result.stdout.includes('"readOutside":false') &&
|
|
197
|
+
result.stdout.includes('"wroteOutside":false') &&
|
|
198
|
+
result.stdout.includes('"wroteInside":true'));
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
rmSync(outsideDir, { recursive: true, force: true });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function readJsonReport(root, relativePath) {
|
|
208
|
+
try {
|
|
209
|
+
return JSON.parse(readFileSync(join(root, relativePath), "utf8"));
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function isExcludedFromCopy(src) {
|
|
216
|
+
return (src.includes(`${sep}.git${sep}`) || src.endsWith(`${sep}.git`) || src.includes(ASSURED_DIR));
|
|
217
|
+
}
|
|
218
|
+
function isUnsafeRelativePath(path) {
|
|
219
|
+
return (path.length === 0 ||
|
|
220
|
+
path.includes("\u0000") ||
|
|
221
|
+
path.includes("\\") ||
|
|
222
|
+
path.startsWith("/") ||
|
|
223
|
+
/^[A-Za-z]:/.test(path) ||
|
|
224
|
+
!isValidScopePath(path, { mustBeRelative: true }) ||
|
|
225
|
+
isDenied(path));
|
|
226
|
+
}
|
|
227
|
+
function assertExistingParentContained(root, absolute) {
|
|
228
|
+
let parent = dirname(absolute);
|
|
229
|
+
while (!existsSync(parent)) {
|
|
230
|
+
const next = dirname(parent);
|
|
231
|
+
if (next === parent) {
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
parent = next;
|
|
235
|
+
}
|
|
236
|
+
const rootReal = realpathSync(root);
|
|
237
|
+
const parentInfo = containedRealPathInfo(nodeWorkspaceFs, rootReal, parent);
|
|
238
|
+
if (isDenied(parentInfo.realRelative)) {
|
|
239
|
+
throw new Error("candidate patch parent path is denied");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
export function candidateWritePath(root, path) {
|
|
243
|
+
if (isUnsafeRelativePath(path)) {
|
|
244
|
+
throw new Error("candidate patch path is unsafe");
|
|
245
|
+
}
|
|
246
|
+
const rootReal = realpathSync(root);
|
|
247
|
+
const absolute = resolveWithinWorkspace(rootReal, path);
|
|
248
|
+
const lexicalRelative = relative(rootReal, resolve(rootReal, path));
|
|
249
|
+
if (lexicalRelative.startsWith("..") || lexicalRelative === "" || isDenied(lexicalRelative)) {
|
|
250
|
+
throw new Error("candidate patch path escapes the disposable root");
|
|
251
|
+
}
|
|
252
|
+
assertExistingParentContained(rootReal, absolute);
|
|
253
|
+
return absolute;
|
|
254
|
+
}
|
|
255
|
+
export function writeCandidateInto(root, patch) {
|
|
256
|
+
for (const file of patch.files) {
|
|
257
|
+
if (file.changeKind === "deleted") {
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const absolute = candidateWritePath(root, file.path);
|
|
261
|
+
mkdirSync(dirname(absolute), { recursive: true });
|
|
262
|
+
writeFileSync(absolute, candidateFileText(file.edits), "utf8");
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function writeMutationConfig(root, target) {
|
|
266
|
+
const configPath = resolve(root, MUTATION_CONFIG);
|
|
267
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
268
|
+
const config = {
|
|
269
|
+
reporters: ["json"],
|
|
270
|
+
jsonReporter: { fileName: MUTATION_REPORT },
|
|
271
|
+
testRunner: "vitest",
|
|
272
|
+
packageManager: "npm",
|
|
273
|
+
mutate: [targetSourceRelPath(target)],
|
|
274
|
+
};
|
|
275
|
+
writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
276
|
+
}
|
|
277
|
+
function nodePorts(args, enforced) {
|
|
278
|
+
const cmds = planGateCommands(args.verification);
|
|
279
|
+
return {
|
|
280
|
+
enforced,
|
|
281
|
+
makeRoot: () => {
|
|
282
|
+
const root = mkdtempSync(join(tmpdir(), "keiko-assured-"));
|
|
283
|
+
cpSync(args.realRoot, root, { recursive: true, filter: (src) => !isExcludedFromCopy(src) });
|
|
284
|
+
writeMutationConfig(root, args.request.target);
|
|
285
|
+
return Promise.resolve(root);
|
|
286
|
+
},
|
|
287
|
+
measureBaseline: (root) => runSandboxed(root, cmds.baseline, args.signal).then(() => undefined),
|
|
288
|
+
applyCandidate: (root) => {
|
|
289
|
+
writeCandidateInto(root, args.patch);
|
|
290
|
+
return Promise.resolve();
|
|
291
|
+
},
|
|
292
|
+
run: (root, cmd) => runSandboxed(root, cmd, args.signal),
|
|
293
|
+
readReport: (root, relativePath) => relativePath === BASELINE_SUMMARY || relativePath === PATCHED_SUMMARY
|
|
294
|
+
? relativizeCoverageSummary(readJsonReport(root, relativePath), root)
|
|
295
|
+
: readJsonReport(root, relativePath),
|
|
296
|
+
dispose: (root) => {
|
|
297
|
+
rmSync(root, { recursive: true, force: true });
|
|
298
|
+
return Promise.resolve();
|
|
299
|
+
},
|
|
300
|
+
buildCommand: cmds.build,
|
|
301
|
+
testCommand: cmds.test,
|
|
302
|
+
coverageCommand: cmds.coverage,
|
|
303
|
+
mutationCommand: cmds.mutation,
|
|
304
|
+
baselineCoverageReportPath: BASELINE_SUMMARY,
|
|
305
|
+
patchedCoverageReportPath: PATCHED_SUMMARY,
|
|
306
|
+
mutationReportPath: MUTATION_REPORT,
|
|
307
|
+
targetCoverageKeys: [targetSourceRelPath(args.request.target)],
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
// The route's default pre-filter: decide enforcement, then run the assured funnel against a disposable
|
|
311
|
+
// execution root (or fail closed when egress cannot be enforced on this host).
|
|
312
|
+
export const defaultAssuredPreFilter = (args) => runDisposableAssuredPreFilter(nodePorts(args, sandboxEnforcesAssuredIsolation(args.realRoot)));
|