@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,430 @@
|
|
|
1
|
+
// Bounded small-document evidence for grounded Repository Search (Issue #1285).
|
|
2
|
+
//
|
|
3
|
+
// Repository Search stays code-first, but a document that the user has EXPLICITLY connected to the
|
|
4
|
+
// chat (a `files` scope with `explicitConnection === true`) should no longer be silently dropped
|
|
5
|
+
// just because it is a `.docx`, `.xlsx`, or text-layer `.pdf`. This module reads those documents
|
|
6
|
+
// through the existing workspace path-safety primitives, extracts a bounded text projection via
|
|
7
|
+
// the reused Local Knowledge parsers (keiko-local-knowledge `extractBoundedDocumentText`), redacts
|
|
8
|
+
// the text, and turns the result into request-local `document-extract` evidence atoms + excerpt
|
|
9
|
+
// windows. Documents that cannot be used produce a stable skipped-document diagnostic instead of a
|
|
10
|
+
// crash or a silent omission.
|
|
11
|
+
//
|
|
12
|
+
// Trust-boundary notes:
|
|
13
|
+
// - The 2 MiB input ceiling is enforced via `fs.stat` BEFORE any bytes are read.
|
|
14
|
+
// - Bytes are read through `resolveWithinWorkspace` + `containedRealPathInfo` + the deny-list,
|
|
15
|
+
// identical to every other workspace read; denied/escaping paths never reach the parser.
|
|
16
|
+
// - Extracted text is `redact()`-ed here (the Local Knowledge extractor is pure and does not
|
|
17
|
+
// redact) before it enters any excerpt, so credential-shaped strings inside a document never
|
|
18
|
+
// reach the prompt, the citation surface, or the evidence manifest.
|
|
19
|
+
// - Nothing is persisted: no Local Knowledge capsule, vector, index, or cache is written.
|
|
20
|
+
import { extractBoundedDocumentText, } from "@oscharko-dev/keiko-local-knowledge";
|
|
21
|
+
import { isValidScopePath, } from "@oscharko-dev/keiko-contracts/connected-context";
|
|
22
|
+
import { stripUnsafeFormatChars } from "@oscharko-dev/keiko-contracts/text-safety";
|
|
23
|
+
import { redact } from "@oscharko-dev/keiko-security";
|
|
24
|
+
import { containedRealPathInfo, evidenceAtomStableId, isDenied, resolveWithinWorkspace, } from "@oscharko-dev/keiko-workspace";
|
|
25
|
+
import { createHash } from "node:crypto";
|
|
26
|
+
// ─── Bounds ──────────────────────────────────────────────────────────────────
|
|
27
|
+
export const MAX_DOCUMENT_INPUT_BYTES = 2 * 1024 * 1024; // 2 MiB, enforced before parser execution
|
|
28
|
+
export const MAX_DOCUMENT_EXTRACTED_BYTES = 32 * 1024; // per-document extracted-text ceiling
|
|
29
|
+
export const MAX_TOTAL_DOCUMENT_EXTRACTED_BYTES = 64 * 1024; // per grounded request, across documents
|
|
30
|
+
export const MAX_DOCUMENT_WINDOW_BYTES = 8 * 1024; // per excerpt window (matches the pack assembler)
|
|
31
|
+
export const MAX_DOCUMENT_WINDOWS = 8; // per document
|
|
32
|
+
export const DOCUMENT_PARSE_TIMEOUT_MS = 5_000; // per-document wall-clock budget
|
|
33
|
+
export const MAX_DOCUMENT_PARSE_UNITS = 5_000; // bounds paragraphs/rows/pages parsed
|
|
34
|
+
const TEXT_ENCODER = new TextEncoder();
|
|
35
|
+
const EXTENSION_BINDINGS = new Map([
|
|
36
|
+
[
|
|
37
|
+
"docx",
|
|
38
|
+
{
|
|
39
|
+
format: "docx",
|
|
40
|
+
mediaType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"xlsx",
|
|
45
|
+
{
|
|
46
|
+
format: "xlsx",
|
|
47
|
+
mediaType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
["pdf", { format: "pdf", mediaType: "application/pdf" }],
|
|
51
|
+
]);
|
|
52
|
+
// Document container formats that are deliberately out of scope for bounded extraction (legacy
|
|
53
|
+
// binary Office, presentations, OpenDocument, rich text, Apple iWork). A connected file with one of
|
|
54
|
+
// these extensions is reported with a stable `unsupported-format` diagnostic instead of being
|
|
55
|
+
// silently dropped on the binary excerpt path — Repository Search does not parse these (Issue
|
|
56
|
+
// #1285 Out of Scope), and Local Knowledge remains the path for them.
|
|
57
|
+
const UNSUPPORTED_DOCUMENT_EXTENSIONS = new Set([
|
|
58
|
+
"doc",
|
|
59
|
+
"dot",
|
|
60
|
+
"ppt",
|
|
61
|
+
"pptx",
|
|
62
|
+
"odt",
|
|
63
|
+
"ods",
|
|
64
|
+
"odp",
|
|
65
|
+
"rtf",
|
|
66
|
+
"pages",
|
|
67
|
+
"key",
|
|
68
|
+
"numbers",
|
|
69
|
+
]);
|
|
70
|
+
function extensionOf(scopePath) {
|
|
71
|
+
const name = scopePath.slice(scopePath.lastIndexOf("/") + 1);
|
|
72
|
+
const dot = name.lastIndexOf(".");
|
|
73
|
+
return dot < 0 ? "" : name.slice(dot + 1).toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
function documentBindingForPath(scopePath) {
|
|
76
|
+
return EXTENSION_BINDINGS.get(extensionOf(scopePath));
|
|
77
|
+
}
|
|
78
|
+
function normalizeScopePath(scopePath) {
|
|
79
|
+
return scopePath.replace(/\\/gu, "/");
|
|
80
|
+
}
|
|
81
|
+
function isWithinSelectedScope(searchScope, realRelativePath) {
|
|
82
|
+
if (searchScope.relativePaths.length === 0) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return searchScope.relativePaths.some((selectedPath) => {
|
|
86
|
+
const normalizedSelectedPath = normalizeScopePath(selectedPath);
|
|
87
|
+
return (realRelativePath === normalizedSelectedPath ||
|
|
88
|
+
realRelativePath.startsWith(`${normalizedSelectedPath}/`));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// True when `scopePath` is any document the bounded-extraction path owns — either a supported small
|
|
92
|
+
// document (DOCX/XLSX/PDF) or a known-but-unsupported document format. The orchestrator uses this
|
|
93
|
+
// to keep every such file off the code-first excerpt-read path so document handling (extraction or
|
|
94
|
+
// a stable unsupported diagnostic) is the single source of truth (Issue #1285).
|
|
95
|
+
export function isConnectedDocumentPath(scopePath) {
|
|
96
|
+
const extension = extensionOf(scopePath);
|
|
97
|
+
return EXTENSION_BINDINGS.has(extension) || UNSUPPORTED_DOCUMENT_EXTENSIONS.has(extension);
|
|
98
|
+
}
|
|
99
|
+
const EMPTY_RESULT = {
|
|
100
|
+
atoms: [],
|
|
101
|
+
candidates: [],
|
|
102
|
+
excerpts: new Map(),
|
|
103
|
+
omitted: [],
|
|
104
|
+
uncertainty: [],
|
|
105
|
+
};
|
|
106
|
+
// ─── Outcome → omission reason ───────────────────────────────────────────────────
|
|
107
|
+
function omissionReasonForOutcome(outcome) {
|
|
108
|
+
switch (outcome) {
|
|
109
|
+
case "oversized":
|
|
110
|
+
return "size-exceeded";
|
|
111
|
+
case "unsupported-format":
|
|
112
|
+
return "unsupported-format";
|
|
113
|
+
// A scanned PDF and an empty-but-valid container are both "supported container, no extractable
|
|
114
|
+
// text"; they share the no-text-layer diagnostic so the user sees one stable message.
|
|
115
|
+
case "no-text-layer":
|
|
116
|
+
case "empty":
|
|
117
|
+
return "no-text-layer";
|
|
118
|
+
case "malformed":
|
|
119
|
+
return "malformed-document";
|
|
120
|
+
case "encrypted":
|
|
121
|
+
return "encrypted-document";
|
|
122
|
+
case "timed-out":
|
|
123
|
+
return "budget-exhausted";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// ─── Excerpt windowing over extracted text ───────────────────────────────────────
|
|
127
|
+
function utf8ByteLength(value) {
|
|
128
|
+
return TEXT_ENCODER.encode(value).length;
|
|
129
|
+
}
|
|
130
|
+
// Splits a single line that exceeds the per-window byte cap into UTF-8-safe chunks, each at most
|
|
131
|
+
// MAX_DOCUMENT_WINDOW_BYTES. This guarantees no window ever exceeds the cap (which the pack
|
|
132
|
+
// assembler would otherwise clamp, dropping bounded-but-extracted text), even for a document whose
|
|
133
|
+
// extracted projection has a very long unbroken line (e.g. a PDF page with no line breaks).
|
|
134
|
+
function splitToWindowChunks(line) {
|
|
135
|
+
if (utf8ByteLength(line) <= MAX_DOCUMENT_WINDOW_BYTES) {
|
|
136
|
+
return [line];
|
|
137
|
+
}
|
|
138
|
+
const encoded = TEXT_ENCODER.encode(line);
|
|
139
|
+
const decoder = new TextDecoder("utf-8", { fatal: false });
|
|
140
|
+
const chunks = [];
|
|
141
|
+
let offset = 0;
|
|
142
|
+
while (offset < encoded.length) {
|
|
143
|
+
const end = Math.min(offset + MAX_DOCUMENT_WINDOW_BYTES, encoded.length);
|
|
144
|
+
const chunk = decoder.decode(encoded.subarray(offset, end)).replace(/�+$/u, "");
|
|
145
|
+
const consumed = utf8ByteLength(chunk) || end - offset;
|
|
146
|
+
chunks.push(chunk);
|
|
147
|
+
offset += consumed;
|
|
148
|
+
}
|
|
149
|
+
return chunks;
|
|
150
|
+
}
|
|
151
|
+
// Split already-redacted extracted text into non-overlapping windows, each at most
|
|
152
|
+
// MAX_DOCUMENT_WINDOW_BYTES and capped at MAX_DOCUMENT_WINDOWS. Line numbers index the extracted
|
|
153
|
+
// text projection itself (DOCX paragraph / XLSX row / PDF page lines), so a citation such as
|
|
154
|
+
// `[report.docx:1-40]` references a reproducible span of the extracted text rather than an
|
|
155
|
+
// original on-screen line.
|
|
156
|
+
function windowExtractedText(text) {
|
|
157
|
+
const lines = text.split("\n").flatMap((line) => splitToWindowChunks(line));
|
|
158
|
+
const windows = [];
|
|
159
|
+
let startIndex = 0;
|
|
160
|
+
let buffer = [];
|
|
161
|
+
let bufferBytes = 0;
|
|
162
|
+
const flush = (endIndexExclusive) => {
|
|
163
|
+
if (buffer.length === 0) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
windows.push({
|
|
167
|
+
startLine: startIndex + 1,
|
|
168
|
+
endLine: endIndexExclusive,
|
|
169
|
+
content: buffer.join("\n"),
|
|
170
|
+
});
|
|
171
|
+
buffer = [];
|
|
172
|
+
bufferBytes = 0;
|
|
173
|
+
startIndex = endIndexExclusive;
|
|
174
|
+
};
|
|
175
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
176
|
+
if (windows.length >= MAX_DOCUMENT_WINDOWS) {
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
const line = lines[i] ?? "";
|
|
180
|
+
const lineBytes = utf8ByteLength(line) + 1;
|
|
181
|
+
if (buffer.length > 0 && bufferBytes + lineBytes > MAX_DOCUMENT_WINDOW_BYTES) {
|
|
182
|
+
flush(i);
|
|
183
|
+
if (windows.length >= MAX_DOCUMENT_WINDOWS) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
buffer.push(line);
|
|
188
|
+
bufferBytes += lineBytes;
|
|
189
|
+
}
|
|
190
|
+
if (windows.length < MAX_DOCUMENT_WINDOWS) {
|
|
191
|
+
flush(startIndex + buffer.length);
|
|
192
|
+
}
|
|
193
|
+
return windows;
|
|
194
|
+
}
|
|
195
|
+
// ─── Atom construction ───────────────────────────────────────────────────────────
|
|
196
|
+
function documentQueryFingerprint(query) {
|
|
197
|
+
return createHash("sha256")
|
|
198
|
+
.update(JSON.stringify({
|
|
199
|
+
kind: "document-extract",
|
|
200
|
+
queryKind: query.kind,
|
|
201
|
+
text: query.text,
|
|
202
|
+
caseSensitive: query.caseSensitive,
|
|
203
|
+
}))
|
|
204
|
+
.digest("hex")
|
|
205
|
+
.slice(0, 16);
|
|
206
|
+
}
|
|
207
|
+
function documentAtom(scope, scopePath, window, queryFingerprint, nowMs) {
|
|
208
|
+
const lineRange = { startLine: window.startLine, endLine: window.endLine };
|
|
209
|
+
return {
|
|
210
|
+
schemaVersion: scope.schemaVersion,
|
|
211
|
+
stableId: evidenceAtomStableId({
|
|
212
|
+
scopeId: scope.scopeId,
|
|
213
|
+
scopePath,
|
|
214
|
+
lineRange,
|
|
215
|
+
provenanceKind: "document-extract",
|
|
216
|
+
provenanceTool: "repo.documentExtract",
|
|
217
|
+
queryFingerprint,
|
|
218
|
+
}),
|
|
219
|
+
scopePath,
|
|
220
|
+
lineRange,
|
|
221
|
+
score: 1,
|
|
222
|
+
provenance: {
|
|
223
|
+
kind: "document-extract",
|
|
224
|
+
tool: "repo.documentExtract",
|
|
225
|
+
queryFingerprint,
|
|
226
|
+
},
|
|
227
|
+
redactionState: "redacted",
|
|
228
|
+
emittedAtMs: nowMs,
|
|
229
|
+
ledgerRef: undefined,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function documentCandidate(scopePath) {
|
|
233
|
+
return {
|
|
234
|
+
scopePath,
|
|
235
|
+
score: 1,
|
|
236
|
+
signals: [{ name: "document-extract", value: 1 }],
|
|
237
|
+
omitted: undefined,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function omit(acc, scopePath, reason, nowMs) {
|
|
241
|
+
acc.omitted.push({ scopePath, reason, omittedAtMs: nowMs });
|
|
242
|
+
}
|
|
243
|
+
function resolveDocument(inputs, scopePath) {
|
|
244
|
+
const normalizedScopePath = normalizeScopePath(scopePath);
|
|
245
|
+
if (isDenied(normalizedScopePath)) {
|
|
246
|
+
return "denied";
|
|
247
|
+
}
|
|
248
|
+
let contained;
|
|
249
|
+
try {
|
|
250
|
+
const absolute = resolveWithinWorkspace(inputs.searchScope.workspace.root, normalizedScopePath);
|
|
251
|
+
contained = containedRealPathInfo(inputs.fs, inputs.searchScope.workspace.root, absolute);
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return "denied";
|
|
255
|
+
}
|
|
256
|
+
const realRelative = normalizeScopePath(contained.realRelative);
|
|
257
|
+
if (isDenied(realRelative) || !isWithinSelectedScope(inputs.searchScope, realRelative)) {
|
|
258
|
+
return "denied";
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
const stat = inputs.fs.stat(contained.path);
|
|
262
|
+
if (!stat.isFile) {
|
|
263
|
+
return "unreadable";
|
|
264
|
+
}
|
|
265
|
+
if (stat.hardLinkCount !== undefined && stat.hardLinkCount > 1) {
|
|
266
|
+
return "denied";
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
absolutePath: contained.path,
|
|
270
|
+
realRelative,
|
|
271
|
+
sizeBytes: stat.size,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return "unreadable";
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
async function readDocumentBytes(inputs, absolutePath, sizeBytes) {
|
|
279
|
+
if (inputs.fs.readFileBytes === undefined) {
|
|
280
|
+
return "unreadable";
|
|
281
|
+
}
|
|
282
|
+
try {
|
|
283
|
+
return await inputs.fs.readFileBytes(absolutePath, Math.min(sizeBytes, MAX_DOCUMENT_INPUT_BYTES));
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
return "unreadable";
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
// Resolves and reads the document bytes through the workspace path-safety primitives, returning the
|
|
290
|
+
// bytes or the precise omission reason for an unusable path.
|
|
291
|
+
async function loadDocumentBytes(inputs, scopePath) {
|
|
292
|
+
const resolved = resolveDocument(inputs, scopePath);
|
|
293
|
+
if (resolved === "denied") {
|
|
294
|
+
return "outside-scope";
|
|
295
|
+
}
|
|
296
|
+
if (resolved === "unreadable") {
|
|
297
|
+
return "tool-unavailable";
|
|
298
|
+
}
|
|
299
|
+
if (resolved.sizeBytes > MAX_DOCUMENT_INPUT_BYTES) {
|
|
300
|
+
return "size-exceeded";
|
|
301
|
+
}
|
|
302
|
+
const bytes = await readDocumentBytes(inputs, resolved.absolutePath, resolved.sizeBytes);
|
|
303
|
+
return bytes === "unreadable" ? "tool-unavailable" : bytes;
|
|
304
|
+
}
|
|
305
|
+
// Redacts the extracted text and records the document atoms + excerpt windows, or an omission when
|
|
306
|
+
// redaction left no usable text.
|
|
307
|
+
function recordExtractedDocument(inputs, scopePath, extraction, queryFingerprint, acc, nowMs) {
|
|
308
|
+
// The Local Knowledge extractor is pure and does NOT redact; the document text is redacted here,
|
|
309
|
+
// before it enters any excerpt window, prompt, or citation surface (Issue #1285 trust boundary).
|
|
310
|
+
const windows = windowExtractedText(redact(stripUnsafeFormatChars(extraction.text)));
|
|
311
|
+
if (windows.length === 0) {
|
|
312
|
+
// All extracted text was redaction-stripped — disclose the document was reachable but unusable.
|
|
313
|
+
omit(acc, scopePath, "redacted-only", nowMs);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
for (const window of windows) {
|
|
317
|
+
acc.atoms.push(documentAtom(inputs.scope, scopePath, window, queryFingerprint, nowMs));
|
|
318
|
+
}
|
|
319
|
+
acc.candidates.push(documentCandidate(scopePath));
|
|
320
|
+
acc.excerpts.set(scopePath, windows);
|
|
321
|
+
acc.totalExtractedBytes += windows.reduce((sum, window) => sum + utf8ByteLength(window.content), 0);
|
|
322
|
+
if (extraction.truncated) {
|
|
323
|
+
// The document was clipped to the extraction byte budget; disclose that the evidence is partial.
|
|
324
|
+
acc.uncertainty.push({
|
|
325
|
+
kind: "scope-incomplete",
|
|
326
|
+
claim: `Document ${scopePath} was truncated to the extraction budget; its evidence is partial.`,
|
|
327
|
+
impactedAtomIds: [],
|
|
328
|
+
emittedAtMs: nowMs,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function processDocument(inputs, scopePath, binding, queryFingerprint, acc) {
|
|
333
|
+
const nowMs = inputs.nowMs();
|
|
334
|
+
const remainingBudget = MAX_TOTAL_DOCUMENT_EXTRACTED_BYTES - acc.totalExtractedBytes;
|
|
335
|
+
if (remainingBudget <= 0) {
|
|
336
|
+
omit(acc, scopePath, "budget-exhausted", nowMs);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const loaded = await loadDocumentBytes(inputs, scopePath);
|
|
340
|
+
if (typeof loaded === "string") {
|
|
341
|
+
omit(acc, scopePath, loaded, nowMs);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const extraction = await extractBoundedDocumentText({ bytes: loaded, extension: binding.format, mediaType: binding.mediaType }, {
|
|
345
|
+
maxInputBytes: MAX_DOCUMENT_INPUT_BYTES,
|
|
346
|
+
maxOutputBytes: Math.min(MAX_DOCUMENT_EXTRACTED_BYTES, remainingBudget),
|
|
347
|
+
maxUnits: MAX_DOCUMENT_PARSE_UNITS,
|
|
348
|
+
timeoutMs: DOCUMENT_PARSE_TIMEOUT_MS,
|
|
349
|
+
now: inputs.nowMs,
|
|
350
|
+
...(inputs.signal === undefined ? {} : { signal: inputs.signal }),
|
|
351
|
+
});
|
|
352
|
+
if (extraction.outcome !== "extracted") {
|
|
353
|
+
omit(acc, scopePath, omissionReasonForOutcome(extraction.outcome), nowMs);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
recordExtractedDocument(inputs, scopePath, { text: extraction.text, truncated: extraction.truncated }, queryFingerprint, acc, nowMs);
|
|
357
|
+
}
|
|
358
|
+
// ─── Public entry ────────────────────────────────────────────────────────────────
|
|
359
|
+
function disclosureMarker(omittedCount, nowMs) {
|
|
360
|
+
return {
|
|
361
|
+
kind: "scope-incomplete",
|
|
362
|
+
claim: `${String(omittedCount)} connected document(s) were skipped: Repository Search reads text, code, and small DOCX/XLSX/text-layer-PDF files only.`,
|
|
363
|
+
impactedAtomIds: [],
|
|
364
|
+
emittedAtMs: nowMs,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
// Processes one connected scope entry: a supported document is extracted, a known-unsupported
|
|
368
|
+
// document format is reported, and anything else (code/text) is left to the code-first path.
|
|
369
|
+
async function processConnectedEntry(inputs, entry, seen, queryFingerprint, acc) {
|
|
370
|
+
if (!isValidScopePath(entry, { mustBeRelative: true })) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const scopePath = entry.replace(/\\/gu, "/");
|
|
374
|
+
if (seen.has(scopePath)) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
seen.add(scopePath);
|
|
378
|
+
const binding = documentBindingForPath(scopePath);
|
|
379
|
+
const knownUnsupportedDocument = UNSUPPORTED_DOCUMENT_EXTENSIONS.has(extensionOf(scopePath));
|
|
380
|
+
if ((binding !== undefined || knownUnsupportedDocument) && isDenied(scopePath)) {
|
|
381
|
+
omit(acc, scopePath, "outside-scope", inputs.nowMs());
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (binding !== undefined) {
|
|
385
|
+
await processDocument(inputs, scopePath, binding, queryFingerprint, acc);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
if (knownUnsupportedDocument) {
|
|
389
|
+
// A known-but-unsupported document container (e.g. legacy .doc): emit a stable diagnostic.
|
|
390
|
+
omit(acc, scopePath, "unsupported-format", inputs.nowMs());
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
// Enumerates the explicitly-connected document files in a `files` scope, extracts bounded redacted
|
|
394
|
+
// text from each, and returns request-local document evidence ready to merge into the grounded
|
|
395
|
+
// context-pack assembly. Returns empty evidence for any scope that is not an explicit `files`
|
|
396
|
+
// connection, keeping whole-workspace and directory scopes on the unchanged code-first path.
|
|
397
|
+
export async function collectConnectedDocumentEvidence(inputs) {
|
|
398
|
+
if (inputs.scope.kind !== "files" || inputs.scope.explicitConnection !== true) {
|
|
399
|
+
return EMPTY_RESULT;
|
|
400
|
+
}
|
|
401
|
+
const queryFingerprint = documentQueryFingerprint(inputs.query);
|
|
402
|
+
const acc = {
|
|
403
|
+
atoms: [],
|
|
404
|
+
candidates: [],
|
|
405
|
+
excerpts: new Map(),
|
|
406
|
+
omitted: [],
|
|
407
|
+
uncertainty: [],
|
|
408
|
+
totalExtractedBytes: 0,
|
|
409
|
+
};
|
|
410
|
+
const seen = new Set();
|
|
411
|
+
for (const entry of inputs.scope.relativePaths) {
|
|
412
|
+
if (inputs.signal?.aborted === true) {
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
await processConnectedEntry(inputs, entry, seen, queryFingerprint, acc);
|
|
416
|
+
}
|
|
417
|
+
// The skipped-document disclosure (one marker summarizing all omissions) plus any per-document
|
|
418
|
+
// truncation markers accumulated during extraction.
|
|
419
|
+
const uncertainty = [
|
|
420
|
+
...(acc.omitted.length > 0 ? [disclosureMarker(acc.omitted.length, inputs.nowMs())] : []),
|
|
421
|
+
...acc.uncertainty,
|
|
422
|
+
];
|
|
423
|
+
return {
|
|
424
|
+
atoms: acc.atoms,
|
|
425
|
+
candidates: acc.candidates,
|
|
426
|
+
excerpts: acc.excerpts,
|
|
427
|
+
omitted: acc.omitted,
|
|
428
|
+
uncertainty,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type UiHandlerDeps } from "./deps.js";
|
|
2
|
+
import type { RouteContext, RouteResult } from "./routes.js";
|
|
3
|
+
export declare function handleGroundedWorkflowHandoff(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
|
|
4
|
+
//# sourceMappingURL=grounded-handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grounded-handoff.d.ts","sourceRoot":"","sources":["../src/grounded-handoff.ts"],"names":[],"mappings":"AAmBA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAYxE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA8hB7D,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,WAAW,CAAC,CAOtB"}
|