@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,120 @@
|
|
|
1
|
+
// Default candidate producer for editor-driven test generation (Issue #1202, ADR-0042 D7).
|
|
2
|
+
//
|
|
3
|
+
// Reuses the existing `unit-test-generation` workflow (`@oscharko-dev/keiko-workflows`) in DRY-RUN
|
|
4
|
+
// (apply=false; the workflow fail-closes any patch write) to produce a reviewable candidate test patch,
|
|
5
|
+
// then translates its proposed unified diff into the content-free wire patch. This is the WAVE-2
|
|
6
|
+
// enablement seam: it is reached only when Gate B (KEIKO_EDITOR_TEST_GENERATION_EXECUTION) is set, which
|
|
7
|
+
// only an enforced deny-by-default egress boundary justifies. When the route produces a candidate, it
|
|
8
|
+
// immediately sends that candidate through the assured pre-filter before deciding whether the patch is
|
|
9
|
+
// apply-ready (`assured`) or untrusted evidence (`unverified`); the seam is proven by tests.
|
|
10
|
+
//
|
|
11
|
+
// Dry-run generation is a governed model call that produces a diff — it does NOT execute the generated
|
|
12
|
+
// tests (the workflow runs verification only in apply mode). The route owns the subsequent assured
|
|
13
|
+
// pre-filter execution step, so this runner only reports that one candidate was generated.
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import { resolve } from "node:path";
|
|
16
|
+
import { generateUnitTests, } from "@oscharko-dev/keiko-workflows";
|
|
17
|
+
import { nodeWorkspaceFs } from "@oscharko-dev/keiko-workspace/internal/fs";
|
|
18
|
+
import { notRunTestGenerationFunnel, } from "@oscharko-dev/keiko-contracts";
|
|
19
|
+
import { currentGatewayConfig } from "../deps.js";
|
|
20
|
+
import { translateDiffToWirePatch } from "./testGenerationPatch.js";
|
|
21
|
+
const GATEWAY_POLICY_VERSION = "editor-test-generation/1";
|
|
22
|
+
const PATCH_ID_LENGTH = 32;
|
|
23
|
+
function anchorPath(target) {
|
|
24
|
+
if (target.kind === "changed-file-set") {
|
|
25
|
+
// The parser guarantees a non-empty document set; `?? ""` only satisfies the index check.
|
|
26
|
+
return target.documents[0]?.path ?? "";
|
|
27
|
+
}
|
|
28
|
+
return target.document.path;
|
|
29
|
+
}
|
|
30
|
+
// Maps the governed editor target to the workflow's UnitTestTarget. The workflow supports file (with an
|
|
31
|
+
// optional target function), module, and changed-file targets; a selection maps to its file, a symbol /
|
|
32
|
+
// component maps to a file target function.
|
|
33
|
+
function toUnitTestTarget(target) {
|
|
34
|
+
if (target.kind === "changed-file-set") {
|
|
35
|
+
return { kind: "changedFiles", filePaths: target.documents.map((document) => document.path) };
|
|
36
|
+
}
|
|
37
|
+
if (target.kind === "symbol") {
|
|
38
|
+
return { kind: "file", filePath: target.document.path, targetFunction: target.symbol.name };
|
|
39
|
+
}
|
|
40
|
+
if (target.kind === "frontend-component") {
|
|
41
|
+
return { kind: "file", filePath: target.document.path, targetFunction: target.componentName };
|
|
42
|
+
}
|
|
43
|
+
return { kind: "file", filePath: target.document.path };
|
|
44
|
+
}
|
|
45
|
+
function resolveModelId(deps) {
|
|
46
|
+
return currentGatewayConfig(deps)?.providers[0]?.modelId;
|
|
47
|
+
}
|
|
48
|
+
// A content-free, deterministic SHA-256 over length-prefixed parts (ids/paths only, never content).
|
|
49
|
+
// Length-prefixing makes the encoding unambiguous, so distinct part lists can never collide.
|
|
50
|
+
function contentFreeHash(parts) {
|
|
51
|
+
const hash = createHash("sha256");
|
|
52
|
+
for (const part of parts) {
|
|
53
|
+
hash.update(`${part.length.toString()}:${part}`);
|
|
54
|
+
}
|
|
55
|
+
return hash.digest("hex");
|
|
56
|
+
}
|
|
57
|
+
function originalReader(realRoot) {
|
|
58
|
+
return (relativePath) => {
|
|
59
|
+
const absolute = resolve(realRoot, relativePath);
|
|
60
|
+
try {
|
|
61
|
+
return nodeWorkspaceFs.exists(absolute) ? nodeWorkspaceFs.readFileUtf8(absolute) : undefined;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// One generated candidate produced this round; the assured pre-filter (#1204/#1206) is `not-run`.
|
|
69
|
+
function generatedFunnel() {
|
|
70
|
+
return { ...notRunTestGenerationFunnel(), candidatesGenerated: 1, candidatesSurfaced: 1 };
|
|
71
|
+
}
|
|
72
|
+
function toAssuredVerificationKind(verification) {
|
|
73
|
+
return verification === "vitest" || verification === "playwright" ? verification : undefined;
|
|
74
|
+
}
|
|
75
|
+
function unsupportedVerificationReason(verification) {
|
|
76
|
+
if (toAssuredVerificationKind(verification) !== undefined) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
return "The generated candidate uses a test runner that is not supported by the assured pre-filter. It is returned as unverified review evidence only.";
|
|
80
|
+
}
|
|
81
|
+
export const defaultTestGenerationRunner = async (args) => {
|
|
82
|
+
const modelId = resolveModelId(args.deps);
|
|
83
|
+
if (modelId === undefined) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
const model = args.deps.modelPortFactory(modelId);
|
|
87
|
+
if (model === undefined) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const report = await generateUnitTests({
|
|
91
|
+
workspaceRoot: args.realRoot,
|
|
92
|
+
target: toUnitTestTarget(args.request.target),
|
|
93
|
+
apply: false,
|
|
94
|
+
modelId,
|
|
95
|
+
}, { model, signal: args.signal });
|
|
96
|
+
if (report.proposedDiff === undefined) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const anchor = anchorPath(args.request.target);
|
|
100
|
+
const patchId = contentFreeHash([modelId, anchor, String(args.nowMs)]).slice(0, PATCH_ID_LENGTH);
|
|
101
|
+
const patch = translateDiffToWirePatch(report.proposedDiff, patchId, originalReader(args.realRoot));
|
|
102
|
+
if (patch === undefined) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const verification = toAssuredVerificationKind(report.verification);
|
|
106
|
+
const reason = unsupportedVerificationReason(report.verification);
|
|
107
|
+
return {
|
|
108
|
+
patch,
|
|
109
|
+
provenance: {
|
|
110
|
+
modelId,
|
|
111
|
+
gatewayPolicyVersion: GATEWAY_POLICY_VERSION,
|
|
112
|
+
promptHash: contentFreeHash([modelId, anchor]),
|
|
113
|
+
producedAt: args.nowMs,
|
|
114
|
+
},
|
|
115
|
+
funnel: generatedFunnel(),
|
|
116
|
+
...(verification === undefined ? {} : { verification }),
|
|
117
|
+
...(reason === undefined ? {} : { unsupportedVerificationReason: reason }),
|
|
118
|
+
proposedDiff: report.proposedDiff,
|
|
119
|
+
};
|
|
120
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LanguagePosition, LanguageRange } from "@oscharko-dev/keiko-contracts";
|
|
2
|
+
export declare function computeLineStarts(text: string): readonly number[];
|
|
3
|
+
export declare function positionToOffset(text: string, lineStarts: readonly number[], position: LanguagePosition): number;
|
|
4
|
+
export declare function offsetToPosition(text: string, lineStarts: readonly number[], offset: number): LanguagePosition;
|
|
5
|
+
export declare function spanToRange(text: string, lineStarts: readonly number[], start: number | undefined, length: number | undefined): LanguageRange;
|
|
6
|
+
//# sourceMappingURL=textOffsets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textOffsets.d.ts","sourceRoot":"","sources":["../../src/editor/textOffsets.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAOrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAWjE;AA8BD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,MAAM,CAKR;AAID,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,MAAM,EAAE,MAAM,GACb,gBAAgB,CAalB;AAID,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,aAAa,CAOf"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Pure conversion between zero-based {line, character} positions (LSP 3.17) and absolute UTF-16
|
|
2
|
+
// code-unit offsets in a source buffer (Issue #1198). Deterministic: it maps an editor position
|
|
3
|
+
// onto the TypeScript offset model and maps analysis spans back to wire ranges. The TypeScript
|
|
4
|
+
// language service speaks in offsets; the editor wire contract speaks in line/character.
|
|
5
|
+
const LF = 0x0a;
|
|
6
|
+
const CR = 0x0d;
|
|
7
|
+
// The absolute offset at which each line begins. `lineStarts[0]` is always 0. Both LF and CRLF
|
|
8
|
+
// terminate a line; a lone CR also starts a new line (old-mac line endings).
|
|
9
|
+
export function computeLineStarts(text) {
|
|
10
|
+
const starts = [0];
|
|
11
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
12
|
+
const code = text.charCodeAt(index);
|
|
13
|
+
if (code === LF) {
|
|
14
|
+
starts.push(index + 1);
|
|
15
|
+
}
|
|
16
|
+
else if (code === CR && text.charCodeAt(index + 1) !== LF) {
|
|
17
|
+
starts.push(index + 1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return starts;
|
|
21
|
+
}
|
|
22
|
+
function clamp(value, min, max) {
|
|
23
|
+
if (value < min)
|
|
24
|
+
return min;
|
|
25
|
+
if (value > max)
|
|
26
|
+
return max;
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
// The offset just past the last content character of a line, excluding its terminator. Used to
|
|
30
|
+
// clamp a character offset so it never lands inside a line break. Never precedes `lineStart`, so the
|
|
31
|
+
// phantom empty line after a trailing newline maps to end-of-buffer rather than the prior line.
|
|
32
|
+
function lineContentEnd(text, lineStarts, line) {
|
|
33
|
+
const lineStart = lineStarts[line] ?? 0;
|
|
34
|
+
const nextLineStart = line + 1 < lineStarts.length ? (lineStarts[line + 1] ?? text.length) : text.length;
|
|
35
|
+
let end = nextLineStart;
|
|
36
|
+
if (end > lineStart && text.charCodeAt(end - 1) === LF) {
|
|
37
|
+
end -= 1;
|
|
38
|
+
if (end > lineStart && text.charCodeAt(end - 1) === CR) {
|
|
39
|
+
end -= 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (end > lineStart && text.charCodeAt(end - 1) === CR) {
|
|
43
|
+
// Old-Mac, lone-CR line terminator: strip it so a character offset never lands on the CR.
|
|
44
|
+
end -= 1;
|
|
45
|
+
}
|
|
46
|
+
return end;
|
|
47
|
+
}
|
|
48
|
+
// Maps a zero-based {line, character} position to an absolute offset, clamping out-of-range input
|
|
49
|
+
// into the buffer so a malformed editor position can never index outside the text.
|
|
50
|
+
export function positionToOffset(text, lineStarts, position) {
|
|
51
|
+
const line = clamp(position.line, 0, lineStarts.length - 1);
|
|
52
|
+
const lineStart = lineStarts[line] ?? 0;
|
|
53
|
+
const contentEnd = lineContentEnd(text, lineStarts, line);
|
|
54
|
+
return clamp(lineStart + position.character, lineStart, contentEnd);
|
|
55
|
+
}
|
|
56
|
+
// Maps an absolute offset back to a zero-based {line, character} position via binary search over the
|
|
57
|
+
// line-start table.
|
|
58
|
+
export function offsetToPosition(text, lineStarts, offset) {
|
|
59
|
+
const bounded = clamp(offset, 0, text.length);
|
|
60
|
+
let low = 0;
|
|
61
|
+
let high = lineStarts.length - 1;
|
|
62
|
+
while (low < high) {
|
|
63
|
+
const mid = low + Math.ceil((high - low) / 2);
|
|
64
|
+
if ((lineStarts[mid] ?? 0) <= bounded) {
|
|
65
|
+
low = mid;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
high = mid - 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return { line: low, character: bounded - (lineStarts[low] ?? 0) };
|
|
72
|
+
}
|
|
73
|
+
// Maps a TypeScript text span (start offset + length) to a wire range. A missing start (some global
|
|
74
|
+
// diagnostics carry none) collapses to the buffer origin.
|
|
75
|
+
export function spanToRange(text, lineStarts, start, length) {
|
|
76
|
+
const safeStart = start ?? 0;
|
|
77
|
+
const safeLength = length ?? 0;
|
|
78
|
+
return {
|
|
79
|
+
start: offsetToPosition(text, lineStarts, safeStart),
|
|
80
|
+
end: offsetToPosition(text, lineStarts, safeStart + safeLength),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescriptLanguageProvider.d.ts","sourceRoot":"","sources":["../../src/editor/typescriptLanguageProvider.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAGV,gBAAgB,EAGjB,MAAM,uBAAuB,CAAC;AAqP/B,wBAAgB,gCAAgC,IAAI,gBAAgB,CAcnE"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// The first deterministic language provider (Issue #1198): TypeScript/JavaScript backed by the
|
|
2
|
+
// TypeScript language service. Model-free and governed (ADR-0042 D4). It runs every query over the
|
|
3
|
+
// in-memory overlay so diagnostics reflect unsaved edits, threads the deadline/abort cancellation
|
|
4
|
+
// token into the service, and caps result counts so analysis stays bounded. A fresh language
|
|
5
|
+
// service is created per request and disposed afterwards, keeping each call stateless and
|
|
6
|
+
// deterministic.
|
|
7
|
+
import ts from "typescript";
|
|
8
|
+
import { MAX_LANGUAGE_FORMATTING_TAB_SIZE, } from "@oscharko-dev/keiko-contracts";
|
|
9
|
+
import { createContainedLanguageServiceHost, } from "./languageServiceHost.js";
|
|
10
|
+
import { computeLineStarts, positionToOffset, spanToRange } from "./textOffsets.js";
|
|
11
|
+
const TS_LANGUAGES = [
|
|
12
|
+
"typescript",
|
|
13
|
+
"typescriptreact",
|
|
14
|
+
"javascript",
|
|
15
|
+
"javascriptreact",
|
|
16
|
+
];
|
|
17
|
+
const DESCRIPTOR = {
|
|
18
|
+
id: "typescript",
|
|
19
|
+
languages: TS_LANGUAGES,
|
|
20
|
+
operations: ["diagnostics", "completion", "hover", "symbols", "formatting"],
|
|
21
|
+
availability: "available",
|
|
22
|
+
};
|
|
23
|
+
const SEVERITY_BY_CATEGORY = {
|
|
24
|
+
[ts.DiagnosticCategory.Error]: "error",
|
|
25
|
+
[ts.DiagnosticCategory.Warning]: "warning",
|
|
26
|
+
[ts.DiagnosticCategory.Suggestion]: "hint",
|
|
27
|
+
[ts.DiagnosticCategory.Message]: "info",
|
|
28
|
+
};
|
|
29
|
+
// Map (not an object literal) so a TypeScript element kind whose string value is "constructor"
|
|
30
|
+
// cannot collide with `Object.prototype.constructor`.
|
|
31
|
+
const COMPLETION_KIND_BY_ELEMENT = new Map([
|
|
32
|
+
[ts.ScriptElementKind.functionElement, "function"],
|
|
33
|
+
[ts.ScriptElementKind.localFunctionElement, "function"],
|
|
34
|
+
[ts.ScriptElementKind.memberFunctionElement, "method"],
|
|
35
|
+
[ts.ScriptElementKind.memberVariableElement, "property"],
|
|
36
|
+
[ts.ScriptElementKind.memberGetAccessorElement, "property"],
|
|
37
|
+
[ts.ScriptElementKind.memberSetAccessorElement, "property"],
|
|
38
|
+
[ts.ScriptElementKind.classElement, "class"],
|
|
39
|
+
[ts.ScriptElementKind.interfaceElement, "interface"],
|
|
40
|
+
[ts.ScriptElementKind.enumElement, "enum"],
|
|
41
|
+
[ts.ScriptElementKind.enumMemberElement, "enum"],
|
|
42
|
+
[ts.ScriptElementKind.moduleElement, "module"],
|
|
43
|
+
[ts.ScriptElementKind.variableElement, "variable"],
|
|
44
|
+
[ts.ScriptElementKind.letElement, "variable"],
|
|
45
|
+
[ts.ScriptElementKind.constElement, "constant"],
|
|
46
|
+
[ts.ScriptElementKind.alias, "variable"],
|
|
47
|
+
[ts.ScriptElementKind.parameterElement, "variable"],
|
|
48
|
+
[ts.ScriptElementKind.typeParameterElement, "typeParameter"],
|
|
49
|
+
[ts.ScriptElementKind.keyword, "keyword"],
|
|
50
|
+
[ts.ScriptElementKind.constructorImplementationElement, "constructor"],
|
|
51
|
+
[ts.ScriptElementKind.typeElement, "interface"],
|
|
52
|
+
]);
|
|
53
|
+
const SYMBOL_KIND_BY_ELEMENT = new Map([
|
|
54
|
+
[ts.ScriptElementKind.moduleElement, "module"],
|
|
55
|
+
[ts.ScriptElementKind.classElement, "class"],
|
|
56
|
+
[ts.ScriptElementKind.interfaceElement, "interface"],
|
|
57
|
+
[ts.ScriptElementKind.enumElement, "enum"],
|
|
58
|
+
[ts.ScriptElementKind.enumMemberElement, "enumMember"],
|
|
59
|
+
[ts.ScriptElementKind.functionElement, "function"],
|
|
60
|
+
[ts.ScriptElementKind.localFunctionElement, "function"],
|
|
61
|
+
[ts.ScriptElementKind.memberFunctionElement, "method"],
|
|
62
|
+
[ts.ScriptElementKind.memberVariableElement, "property"],
|
|
63
|
+
[ts.ScriptElementKind.memberGetAccessorElement, "property"],
|
|
64
|
+
[ts.ScriptElementKind.memberSetAccessorElement, "property"],
|
|
65
|
+
[ts.ScriptElementKind.constructorImplementationElement, "constructor"],
|
|
66
|
+
[ts.ScriptElementKind.variableElement, "variable"],
|
|
67
|
+
[ts.ScriptElementKind.letElement, "variable"],
|
|
68
|
+
[ts.ScriptElementKind.constElement, "constant"],
|
|
69
|
+
[ts.ScriptElementKind.typeParameterElement, "typeParameter"],
|
|
70
|
+
[ts.ScriptElementKind.typeElement, "interface"],
|
|
71
|
+
]);
|
|
72
|
+
function completionKind(kind) {
|
|
73
|
+
return COMPLETION_KIND_BY_ELEMENT.get(kind) ?? "text";
|
|
74
|
+
}
|
|
75
|
+
function symbolKind(kind) {
|
|
76
|
+
return SYMBOL_KIND_BY_ELEMENT.get(kind) ?? "variable";
|
|
77
|
+
}
|
|
78
|
+
function withService(ctx, run) {
|
|
79
|
+
const hostOptions = {
|
|
80
|
+
fs: ctx.fs,
|
|
81
|
+
realRoot: ctx.root,
|
|
82
|
+
overlayPath: ctx.overlayPath,
|
|
83
|
+
overlayText: ctx.overlayText,
|
|
84
|
+
languageId: ctx.languageId,
|
|
85
|
+
cancellation: ctx.cancellation.hostToken(),
|
|
86
|
+
limits: ctx.limits,
|
|
87
|
+
};
|
|
88
|
+
const host = createContainedLanguageServiceHost(hostOptions);
|
|
89
|
+
const service = ts.createLanguageService(host, ts.createDocumentRegistry());
|
|
90
|
+
try {
|
|
91
|
+
return run(service);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
service.dispose();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function buildDiagnostics(ctx, service) {
|
|
98
|
+
ctx.cancellation.throwIfCancellationRequested();
|
|
99
|
+
const syntactic = service.getSyntacticDiagnostics(ctx.overlayPath);
|
|
100
|
+
ctx.cancellation.throwIfCancellationRequested();
|
|
101
|
+
const semantic = service.getSemanticDiagnostics(ctx.overlayPath);
|
|
102
|
+
const lineStarts = computeLineStarts(ctx.overlayText);
|
|
103
|
+
const all = [...syntactic, ...semantic];
|
|
104
|
+
const capped = all.slice(0, ctx.limits.maxDiagnostics);
|
|
105
|
+
const diagnostics = capped.map((diagnostic) => {
|
|
106
|
+
const range = spanToRange(ctx.overlayText, lineStarts, diagnostic.start, diagnostic.length);
|
|
107
|
+
const severity = SEVERITY_BY_CATEGORY[diagnostic.category];
|
|
108
|
+
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
109
|
+
return { range, severity, message, source: DESCRIPTOR.id, code: String(diagnostic.code) };
|
|
110
|
+
});
|
|
111
|
+
return { diagnostics, truncated: all.length > capped.length };
|
|
112
|
+
}
|
|
113
|
+
function buildCompletionItem(entry) {
|
|
114
|
+
const base = {
|
|
115
|
+
label: entry.name,
|
|
116
|
+
kind: completionKind(entry.kind),
|
|
117
|
+
sortText: entry.sortText,
|
|
118
|
+
};
|
|
119
|
+
return entry.insertText !== undefined ? { ...base, insertText: entry.insertText } : base;
|
|
120
|
+
}
|
|
121
|
+
function buildCompletions(ctx, service, position) {
|
|
122
|
+
ctx.cancellation.throwIfCancellationRequested();
|
|
123
|
+
const lineStarts = computeLineStarts(ctx.overlayText);
|
|
124
|
+
const offset = positionToOffset(ctx.overlayText, lineStarts, position);
|
|
125
|
+
const completions = service.getCompletionsAtPosition(ctx.overlayPath, offset, {
|
|
126
|
+
includeCompletionsForModuleExports: false,
|
|
127
|
+
includeCompletionsForImportStatements: false,
|
|
128
|
+
includeInsertTextCompletions: true,
|
|
129
|
+
});
|
|
130
|
+
if (completions === undefined) {
|
|
131
|
+
return { items: [], isIncomplete: false, truncated: false };
|
|
132
|
+
}
|
|
133
|
+
const capped = completions.entries.slice(0, ctx.limits.maxCompletionItems);
|
|
134
|
+
return {
|
|
135
|
+
items: capped.map(buildCompletionItem),
|
|
136
|
+
isIncomplete: completions.isIncomplete ?? false,
|
|
137
|
+
truncated: completions.entries.length > capped.length,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function buildHover(ctx, service, position) {
|
|
141
|
+
ctx.cancellation.throwIfCancellationRequested();
|
|
142
|
+
const lineStarts = computeLineStarts(ctx.overlayText);
|
|
143
|
+
const offset = positionToOffset(ctx.overlayText, lineStarts, position);
|
|
144
|
+
const info = service.getQuickInfoAtPosition(ctx.overlayPath, offset);
|
|
145
|
+
if (info === undefined) {
|
|
146
|
+
return { contents: null };
|
|
147
|
+
}
|
|
148
|
+
const display = ts.displayPartsToString(info.displayParts);
|
|
149
|
+
const documentation = ts.displayPartsToString(info.documentation);
|
|
150
|
+
const contents = documentation.length > 0 ? `${display}\n\n${documentation}` : display;
|
|
151
|
+
const range = spanToRange(ctx.overlayText, lineStarts, info.textSpan.start, info.textSpan.length);
|
|
152
|
+
return { contents: contents.length > 0 ? contents : null, range };
|
|
153
|
+
}
|
|
154
|
+
function flattenSymbols(node, containerName, lineStarts, text, out, limit) {
|
|
155
|
+
for (const child of node.childItems ?? []) {
|
|
156
|
+
if (out.length >= limit)
|
|
157
|
+
return;
|
|
158
|
+
const span = child.spans[0];
|
|
159
|
+
const range = spanToRange(text, lineStarts, span?.start, span?.length);
|
|
160
|
+
const symbol = {
|
|
161
|
+
name: child.text,
|
|
162
|
+
kind: symbolKind(child.kind),
|
|
163
|
+
range,
|
|
164
|
+
...(containerName !== undefined ? { containerName } : {}),
|
|
165
|
+
};
|
|
166
|
+
out.push(symbol);
|
|
167
|
+
flattenSymbols(child, child.text, lineStarts, text, out, limit);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function buildSymbols(ctx, service) {
|
|
171
|
+
ctx.cancellation.throwIfCancellationRequested();
|
|
172
|
+
const tree = service.getNavigationTree(ctx.overlayPath);
|
|
173
|
+
const lineStarts = computeLineStarts(ctx.overlayText);
|
|
174
|
+
const out = [];
|
|
175
|
+
const limit = ctx.limits.maxSymbols;
|
|
176
|
+
flattenSymbols(tree, undefined, lineStarts, ctx.overlayText, out, limit + 1);
|
|
177
|
+
const truncated = out.length > limit;
|
|
178
|
+
return { symbols: truncated ? out.slice(0, limit) : out, truncated };
|
|
179
|
+
}
|
|
180
|
+
// Build the TypeScript formatter settings from the caller's preferences (Issue #1201). Starts from
|
|
181
|
+
// the compiler's own defaults (consistent, deterministic whitespace rules) and overrides only the
|
|
182
|
+
// indentation fields the editor supplies, so a buffer is reflowed to the active editor configuration
|
|
183
|
+
// rather than an arbitrary one. The newline is pinned to "\n" so the result is stable across hosts.
|
|
184
|
+
function buildFormatCodeSettings(options) {
|
|
185
|
+
const settings = { ...ts.getDefaultFormatCodeSettings("\n") };
|
|
186
|
+
if (options?.tabSize !== undefined) {
|
|
187
|
+
const tabSize = Math.min(Math.max(1, options.tabSize), MAX_LANGUAGE_FORMATTING_TAB_SIZE);
|
|
188
|
+
settings.tabSize = tabSize;
|
|
189
|
+
settings.indentSize = tabSize;
|
|
190
|
+
}
|
|
191
|
+
if (options?.insertSpaces !== undefined) {
|
|
192
|
+
settings.convertTabsToSpaces = options.insertSpaces;
|
|
193
|
+
}
|
|
194
|
+
return settings;
|
|
195
|
+
}
|
|
196
|
+
function buildFormatting(ctx, service, options) {
|
|
197
|
+
ctx.cancellation.throwIfCancellationRequested();
|
|
198
|
+
const changes = service.getFormattingEditsForDocument(ctx.overlayPath, buildFormatCodeSettings(options));
|
|
199
|
+
const lineStarts = computeLineStarts(ctx.overlayText);
|
|
200
|
+
const capped = changes.slice(0, ctx.limits.maxFormattingEdits);
|
|
201
|
+
const edits = capped.map((change) => ({
|
|
202
|
+
range: spanToRange(ctx.overlayText, lineStarts, change.span.start, change.span.length),
|
|
203
|
+
newText: change.newText,
|
|
204
|
+
}));
|
|
205
|
+
return { edits, truncated: changes.length > capped.length };
|
|
206
|
+
}
|
|
207
|
+
export function createTypescriptLanguageProvider() {
|
|
208
|
+
return {
|
|
209
|
+
descriptor: DESCRIPTOR,
|
|
210
|
+
supports: (languageId) => TS_LANGUAGES.includes(languageId),
|
|
211
|
+
getDiagnostics: (ctx) => withService(ctx, (svc) => buildDiagnostics(ctx, svc)),
|
|
212
|
+
getCompletions: (ctx, position) => withService(ctx, (svc) => buildCompletions(ctx, svc, position)),
|
|
213
|
+
getHover: (ctx, position) => withService(ctx, (svc) => buildHover(ctx, svc, position)),
|
|
214
|
+
getSymbols: (ctx) => withService(ctx, (svc) => buildSymbols(ctx, svc)),
|
|
215
|
+
getFormatting: (ctx, options) => withService(ctx, (svc) => buildFormatting(ctx, svc, options)),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type EvidenceReport, type EvidenceManifest } from "@oscharko-dev/keiko-evidence";
|
|
2
|
+
import { type RunResult } from "@oscharko-dev/keiko-harness";
|
|
3
|
+
import { type EnvSource } from "@oscharko-dev/keiko-model-gateway";
|
|
4
|
+
import type { EvidenceStore } from "@oscharko-dev/keiko-evidence";
|
|
5
|
+
import type { StreamEvent } from "./sink.js";
|
|
6
|
+
import type { RunKind } from "./run-request.js";
|
|
7
|
+
import type { RunStatus } from "./runs.js";
|
|
8
|
+
type TerminalStatus = Exclude<RunStatus, "running">;
|
|
9
|
+
export interface EvidencePersistContext {
|
|
10
|
+
readonly store: EvidenceStore;
|
|
11
|
+
readonly env: EnvSource;
|
|
12
|
+
readonly additionalSecrets?: readonly string[] | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface RunIdentity {
|
|
15
|
+
readonly runId: string;
|
|
16
|
+
readonly fingerprint: string;
|
|
17
|
+
readonly modelId: string;
|
|
18
|
+
readonly kind: RunKind;
|
|
19
|
+
readonly status: TerminalStatus;
|
|
20
|
+
readonly startedAt: number;
|
|
21
|
+
readonly finishedAt: number;
|
|
22
|
+
readonly workspaceRoot?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
export declare function persistWorkflowEvidence(identity: RunIdentity, report: unknown, events: readonly StreamEvent[], ctx: EvidencePersistContext, governedHandoff?: EvidenceManifest["governedHandoff"]): EvidenceReport;
|
|
25
|
+
export declare function persistExplainEvidence(identity: RunIdentity, result: RunResult, ctx: EvidencePersistContext): EvidenceReport;
|
|
26
|
+
export declare function persistVerifyEvidence(identity: RunIdentity, ctx: EvidencePersistContext, governedHandoff?: EvidenceManifest["governedHandoff"]): EvidenceReport;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAEtB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAmB,KAAK,SAAS,EAAiB,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,KAAK,cAAc,GAAG,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC5D;AAID,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C;AAWD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,GAAG,EAAE,sBAAsB,EAC3B,eAAe,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GACpD,cAAc,CAiBhB;AAKD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,sBAAsB,GAC1B,cAAc,CAMhB;AAYD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,WAAW,EACrB,GAAG,EAAE,sBAAsB,EAC3B,eAAe,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GACpD,cAAc,CAMhB"}
|
package/dist/evidence.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Evidence persistence for UI-initiated runs (ADR-0011 AC5; #10 audit public API only). The Wave 2
|
|
2
|
+
// BFF never persisted evidence, so UI runs (including cancellations) never reached the evidence
|
|
3
|
+
// browser. This module folds a terminated run into a redacted EvidenceManifest and writes it through
|
|
4
|
+
// the #10 EvidenceStore, composing the audit layer's PUBLIC API UNCHANGED (no frozen-core edit).
|
|
5
|
+
//
|
|
6
|
+
// The WORKFLOW manifest mapping now lives in the shared audit module `workflow-evidence.ts` (ADR-0012
|
|
7
|
+
// C2), so the evaluation harness and this BFF build it from one implementation. This module keeps the
|
|
8
|
+
// EXPLAIN-PLAN harness path (whose `usage` shape differs) local, and adapts the UI RunKind/RunStatus
|
|
9
|
+
// to the shared module's narrow workflow types. Persistence errors surface to the run engine so the
|
|
10
|
+
// final registry payload cannot silently omit required evidence.
|
|
11
|
+
import { buildEvidenceReport, createAuditRedactor, EVIDENCE_SCHEMA_VERSION, persistWorkflowEvidence as persistWorkflowEvidenceCore, } from "@oscharko-dev/keiko-evidence";
|
|
12
|
+
import { deepRedactStrings } from "@oscharko-dev/keiko-evidence";
|
|
13
|
+
import { HARNESS_VERSION } from "@oscharko-dev/keiko-harness";
|
|
14
|
+
import { resolveCostClass } from "@oscharko-dev/keiko-model-gateway";
|
|
15
|
+
// Only the two model-driven workflow kinds map to the shared audit core; explain-plan and verify
|
|
16
|
+
// follow their own manifest paths (different usage shape / no usage at all).
|
|
17
|
+
function toWorkflowKind(kind) {
|
|
18
|
+
return kind === "bug-investigation" ? "bug-investigation" : "unit-tests";
|
|
19
|
+
}
|
|
20
|
+
// Persists a terminated WORKFLOW run (unit-tests / bug-investigation) via the shared audit core. The
|
|
21
|
+
// UI run browser needs the review artifact after the in-memory run record is gone, so the diff is
|
|
22
|
+
// included through the evidence core's explicit redacted-diff opt-in.
|
|
23
|
+
export function persistWorkflowEvidence(identity, report, events, ctx, governedHandoff) {
|
|
24
|
+
return persistWorkflowEvidenceCore({
|
|
25
|
+
runId: identity.runId,
|
|
26
|
+
fingerprint: identity.fingerprint,
|
|
27
|
+
modelId: identity.modelId,
|
|
28
|
+
kind: toWorkflowKind(identity.kind),
|
|
29
|
+
status: identity.status,
|
|
30
|
+
startedAt: identity.startedAt,
|
|
31
|
+
finishedAt: identity.finishedAt,
|
|
32
|
+
...(identity.workspaceRoot === undefined ? {} : { workspaceRoot: identity.workspaceRoot }),
|
|
33
|
+
}, report, events, { ...ctx, costClassResolver: resolveCostClass }, { governedHandoff, includeDiff: true });
|
|
34
|
+
}
|
|
35
|
+
// Persists a terminated EXPLAIN-PLAN harness run. The RunResult carries the raw harness events whose
|
|
36
|
+
// `usage` shape the audit fold understands; the usage is folded directly so the explain path keeps a
|
|
37
|
+
// single manifest-build path independent of the shared workflow core (which folds top-level fields).
|
|
38
|
+
export function persistExplainEvidence(identity, result, ctx) {
|
|
39
|
+
const manifest = buildExplainManifest(identity, result);
|
|
40
|
+
const redactor = createAuditRedactor({ additionalSecrets: ctx.additionalSecrets ?? [] }, ctx.env);
|
|
41
|
+
const redacted = deepRedactStrings(manifest, redactor);
|
|
42
|
+
const location = ctx.store.put(redacted.run.runId, JSON.stringify(redacted));
|
|
43
|
+
return buildEvidenceReport(redacted, location);
|
|
44
|
+
}
|
|
45
|
+
const KIND_TO_TASK_TYPE = {
|
|
46
|
+
"unit-tests": "generate-unit-tests",
|
|
47
|
+
"bug-investigation": "investigate-bug",
|
|
48
|
+
"explain-plan": "explain-plan",
|
|
49
|
+
verify: "verify",
|
|
50
|
+
};
|
|
51
|
+
// Persists a terminated VERIFY run. Verify never calls a model, so usageTotals are all zero and
|
|
52
|
+
// stateTransitions/toolCalls/commandExecutions stay empty (the verification orchestrator's own
|
|
53
|
+
// audit summarisation lives in `@oscharko-dev/keiko-verification` and is out of scope for this leaf).
|
|
54
|
+
export function persistVerifyEvidence(identity, ctx, governedHandoff) {
|
|
55
|
+
const manifest = buildVerifyManifest(identity, governedHandoff);
|
|
56
|
+
const redactor = createAuditRedactor({ additionalSecrets: ctx.additionalSecrets ?? [] }, ctx.env);
|
|
57
|
+
const redacted = deepRedactStrings(manifest, redactor);
|
|
58
|
+
const location = ctx.store.put(redacted.run.runId, JSON.stringify(redacted));
|
|
59
|
+
return buildEvidenceReport(redacted, location);
|
|
60
|
+
}
|
|
61
|
+
function buildVerifyManifest(identity, governedHandoff) {
|
|
62
|
+
const context = identity.workspaceRoot === undefined
|
|
63
|
+
? undefined
|
|
64
|
+
: {
|
|
65
|
+
workspaceRoot: identity.workspaceRoot,
|
|
66
|
+
totalCandidates: 0,
|
|
67
|
+
usedBytes: 0,
|
|
68
|
+
budgetBytes: 0,
|
|
69
|
+
droppedForBudget: 0,
|
|
70
|
+
entries: [],
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
evidenceSchemaVersion: EVIDENCE_SCHEMA_VERSION,
|
|
74
|
+
run: {
|
|
75
|
+
runId: identity.runId,
|
|
76
|
+
fingerprint: identity.fingerprint,
|
|
77
|
+
harnessVersion: HARNESS_VERSION,
|
|
78
|
+
taskType: KIND_TO_TASK_TYPE[identity.kind],
|
|
79
|
+
outcome: identity.status,
|
|
80
|
+
startedAt: identity.startedAt,
|
|
81
|
+
finishedAt: identity.finishedAt,
|
|
82
|
+
durationMs: Math.max(0, identity.finishedAt - identity.startedAt),
|
|
83
|
+
},
|
|
84
|
+
model: { modelId: identity.modelId, costClass: resolveCostClass(identity.modelId) },
|
|
85
|
+
usageTotals: { promptTokens: 0, completionTokens: 0, requestCount: 0, totalLatencyMs: 0 },
|
|
86
|
+
...(context === undefined ? {} : { context }),
|
|
87
|
+
stateTransitions: [],
|
|
88
|
+
toolCalls: [],
|
|
89
|
+
commandExecutions: [],
|
|
90
|
+
verification: undefined,
|
|
91
|
+
patch: undefined,
|
|
92
|
+
failure: undefined,
|
|
93
|
+
...(governedHandoff === undefined ? {} : { governedHandoff }),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function buildExplainManifest(identity, result) {
|
|
97
|
+
const context = identity.workspaceRoot === undefined
|
|
98
|
+
? undefined
|
|
99
|
+
: {
|
|
100
|
+
workspaceRoot: identity.workspaceRoot,
|
|
101
|
+
totalCandidates: 0,
|
|
102
|
+
usedBytes: 0,
|
|
103
|
+
budgetBytes: 0,
|
|
104
|
+
droppedForBudget: 0,
|
|
105
|
+
entries: [],
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
evidenceSchemaVersion: EVIDENCE_SCHEMA_VERSION,
|
|
109
|
+
run: {
|
|
110
|
+
runId: identity.runId,
|
|
111
|
+
fingerprint: identity.fingerprint,
|
|
112
|
+
harnessVersion: HARNESS_VERSION,
|
|
113
|
+
taskType: KIND_TO_TASK_TYPE[identity.kind],
|
|
114
|
+
outcome: identity.status,
|
|
115
|
+
startedAt: identity.startedAt,
|
|
116
|
+
finishedAt: identity.finishedAt,
|
|
117
|
+
durationMs: Math.max(0, identity.finishedAt - identity.startedAt),
|
|
118
|
+
},
|
|
119
|
+
model: { modelId: identity.modelId, costClass: resolveCostClass(identity.modelId) },
|
|
120
|
+
usageTotals: foldHarnessUsage(result.events),
|
|
121
|
+
...(context === undefined ? {} : { context }),
|
|
122
|
+
stateTransitions: [],
|
|
123
|
+
toolCalls: [],
|
|
124
|
+
commandExecutions: [],
|
|
125
|
+
verification: undefined,
|
|
126
|
+
patch: undefined,
|
|
127
|
+
failure: undefined,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function foldHarnessUsage(events) {
|
|
131
|
+
let promptTokens = 0;
|
|
132
|
+
let completionTokens = 0;
|
|
133
|
+
let requestCount = 0;
|
|
134
|
+
let totalLatencyMs = 0;
|
|
135
|
+
for (const event of events) {
|
|
136
|
+
if (event.type !== "model:call:completed") {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
promptTokens += event.usage.promptTokens;
|
|
140
|
+
completionTokens += event.usage.completionTokens;
|
|
141
|
+
totalLatencyMs += event.usage.latencyMs;
|
|
142
|
+
requestCount += 1;
|
|
143
|
+
}
|
|
144
|
+
return { promptTokens, completionTokens, requestCount, totalLatencyMs };
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-deny.d.ts","sourceRoot":"","sources":["../src/files-deny.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,0DAA0D,CAAC;AAEtF,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Deny-list wiring for the Files BFF (`/api/files/*`). Reuses
|
|
2
|
+
// `src/workspace/ignore.ts` unchanged: `isDenied` is the always-on security
|
|
3
|
+
// gate that filters secret/dep/build/vcs/log entries from both tree listings
|
|
4
|
+
// and previews. See ADR-0016.
|
|
5
|
+
import { isDenied } from "@oscharko-dev/keiko-workspace";
|
|
6
|
+
// Generic, non-leaking deny message. NEVER include the requested path or the
|
|
7
|
+
// matched pattern: the deny list is treated as a server-side safety invariant
|
|
8
|
+
// the client must not be able to probe.
|
|
9
|
+
export const DENIED_MESSAGE = "The requested path is excluded from the read surface.";
|
|
10
|
+
export function pathIsDenied(relativePath) {
|
|
11
|
+
return isDenied(relativePath);
|
|
12
|
+
}
|