@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,491 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { buildConsolidationJob, runConsolidation, transitionJob, } from "@oscharko-dev/keiko-memory-consolidation";
|
|
3
|
+
import { MEMORY_SCOPE_KINDS, MEMORY_STATUSES, MEMORY_TYPES, } from "@oscharko-dev/keiko-contracts";
|
|
4
|
+
import { errorBody } from "./routes.js";
|
|
5
|
+
const MAX_BODY_BYTES = 64_000;
|
|
6
|
+
const DEFAULT_JACCARD_THRESHOLD = 0.85;
|
|
7
|
+
const DEFAULT_STALE_CONFIDENCE_THRESHOLD = 0.3;
|
|
8
|
+
const DEFAULT_MAX_AGE_MS = 90 * 24 * 60 * 60 * 1000;
|
|
9
|
+
const DEFAULT_MAX_CLUSTERS_PER_RUN = 100;
|
|
10
|
+
const DEFAULT_MAX_RECORDS_PER_RUN = 1_000;
|
|
11
|
+
const MAX_CLUSTERS_PER_RUN_LIMIT = 1_000;
|
|
12
|
+
const MAX_RECORDS_PER_RUN_LIMIT = 1_000;
|
|
13
|
+
class BodyTooLargeError extends Error {
|
|
14
|
+
constructor() {
|
|
15
|
+
super("request body too large");
|
|
16
|
+
this.name = "BodyTooLargeError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function isRecord(value) {
|
|
20
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21
|
+
}
|
|
22
|
+
function isRouteResult(value) {
|
|
23
|
+
return isRecord(value) && typeof value.status === "number";
|
|
24
|
+
}
|
|
25
|
+
function readBody(req) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const chunks = [];
|
|
28
|
+
let total = 0;
|
|
29
|
+
let capped = false;
|
|
30
|
+
req.on("data", (chunk) => {
|
|
31
|
+
total += chunk.length;
|
|
32
|
+
if (total > MAX_BODY_BYTES) {
|
|
33
|
+
if (!capped) {
|
|
34
|
+
capped = true;
|
|
35
|
+
chunks.length = 0;
|
|
36
|
+
reject(new BodyTooLargeError());
|
|
37
|
+
req.resume();
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
chunks.push(chunk);
|
|
42
|
+
});
|
|
43
|
+
req.on("end", () => {
|
|
44
|
+
if (!capped)
|
|
45
|
+
resolve(Buffer.concat(chunks).toString("utf8"));
|
|
46
|
+
});
|
|
47
|
+
req.on("error", reject);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function readJsonBody(req) {
|
|
51
|
+
let raw;
|
|
52
|
+
try {
|
|
53
|
+
raw = await readBody(req);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (error instanceof BodyTooLargeError) {
|
|
57
|
+
return { status: 413, body: errorBody("PAYLOAD_TOO_LARGE", "Request body too large.") };
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
let parsed;
|
|
62
|
+
try {
|
|
63
|
+
parsed = raw.length === 0 ? {} : JSON.parse(raw);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return { status: 400, body: errorBody("BAD_REQUEST", "Request body is not valid JSON.") };
|
|
67
|
+
}
|
|
68
|
+
if (!isRecord(parsed)) {
|
|
69
|
+
return { status: 400, body: errorBody("BAD_REQUEST", "Request body must be a JSON object.") };
|
|
70
|
+
}
|
|
71
|
+
return parsed;
|
|
72
|
+
}
|
|
73
|
+
function resolveVault(deps) {
|
|
74
|
+
if (deps.memoryVault === undefined) {
|
|
75
|
+
return {
|
|
76
|
+
status: 503,
|
|
77
|
+
body: errorBody("MEMORY_UNAVAILABLE", "Memory vault is not configured."),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return deps.memoryVault;
|
|
81
|
+
}
|
|
82
|
+
function resolveJobRegistry(deps) {
|
|
83
|
+
if (deps.consolidationJobs === undefined) {
|
|
84
|
+
return {
|
|
85
|
+
status: 503,
|
|
86
|
+
body: errorBody("MEMORY_UNAVAILABLE", "Consolidation jobs are not configured."),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return deps.consolidationJobs;
|
|
90
|
+
}
|
|
91
|
+
function isScopeKind(value) {
|
|
92
|
+
return typeof value === "string" && MEMORY_SCOPE_KINDS.includes(value);
|
|
93
|
+
}
|
|
94
|
+
function readString(raw, key) {
|
|
95
|
+
const value = raw[key];
|
|
96
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
97
|
+
}
|
|
98
|
+
function parseScopedId(raw, key) {
|
|
99
|
+
const value = readString(raw, key);
|
|
100
|
+
return value ?? null;
|
|
101
|
+
}
|
|
102
|
+
function parseScopeWithId(raw, key, build) {
|
|
103
|
+
const value = parseScopedId(raw, key);
|
|
104
|
+
return value === null ? null : build(value);
|
|
105
|
+
}
|
|
106
|
+
function parseScope(raw) {
|
|
107
|
+
if (!isRecord(raw) || !isScopeKind(raw.kind))
|
|
108
|
+
return null;
|
|
109
|
+
if (raw.kind === "global")
|
|
110
|
+
return { kind: "global" };
|
|
111
|
+
if (raw.kind === "user") {
|
|
112
|
+
return parseScopeWithId(raw, "userId", (userId) => ({
|
|
113
|
+
kind: "user",
|
|
114
|
+
userId: userId,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
if (raw.kind === "workspace") {
|
|
118
|
+
return parseScopeWithId(raw, "workspaceId", (workspaceId) => ({
|
|
119
|
+
kind: "workspace",
|
|
120
|
+
workspaceId: workspaceId,
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
if (raw.kind === "project") {
|
|
124
|
+
return parseScopeWithId(raw, "projectId", (projectId) => ({
|
|
125
|
+
kind: "project",
|
|
126
|
+
projectId: projectId,
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
return parseScopeWithId(raw, "workflowDefinitionId", (workflowDefinitionId) => ({
|
|
130
|
+
kind: "workflow",
|
|
131
|
+
workflowDefinitionId: workflowDefinitionId,
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
function parseScopes(raw) {
|
|
135
|
+
if (raw === undefined)
|
|
136
|
+
return [{ kind: "global" }];
|
|
137
|
+
if (!Array.isArray(raw) || raw.length === 0)
|
|
138
|
+
return null;
|
|
139
|
+
const scopes = [];
|
|
140
|
+
for (const item of raw) {
|
|
141
|
+
const scope = parseScope(item);
|
|
142
|
+
if (scope === null)
|
|
143
|
+
return null;
|
|
144
|
+
scopes.push(scope);
|
|
145
|
+
}
|
|
146
|
+
return scopes;
|
|
147
|
+
}
|
|
148
|
+
function parseTypes(raw) {
|
|
149
|
+
if (raw === undefined)
|
|
150
|
+
return undefined;
|
|
151
|
+
if (!Array.isArray(raw))
|
|
152
|
+
return null;
|
|
153
|
+
const types = [];
|
|
154
|
+
for (const item of raw) {
|
|
155
|
+
if (typeof item !== "string" || !MEMORY_TYPES.includes(item)) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
types.push(item);
|
|
159
|
+
}
|
|
160
|
+
return types;
|
|
161
|
+
}
|
|
162
|
+
function parseStatuses(raw) {
|
|
163
|
+
if (raw === undefined)
|
|
164
|
+
return undefined;
|
|
165
|
+
if (!Array.isArray(raw))
|
|
166
|
+
return null;
|
|
167
|
+
const statuses = [];
|
|
168
|
+
for (const item of raw) {
|
|
169
|
+
if (typeof item !== "string" || !MEMORY_STATUSES.includes(item)) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
statuses.push(item);
|
|
173
|
+
}
|
|
174
|
+
return statuses;
|
|
175
|
+
}
|
|
176
|
+
function parseOptionalNumber(raw) {
|
|
177
|
+
if (raw === undefined)
|
|
178
|
+
return undefined;
|
|
179
|
+
return typeof raw === "number" && Number.isFinite(raw) ? raw : null;
|
|
180
|
+
}
|
|
181
|
+
function parseSettingsRecord(raw) {
|
|
182
|
+
if (raw === undefined)
|
|
183
|
+
return {};
|
|
184
|
+
return isRecord(raw) ? raw : null;
|
|
185
|
+
}
|
|
186
|
+
const SETTING_BOUNDS = {
|
|
187
|
+
jaccardThreshold: { lo: 0, hi: 1 },
|
|
188
|
+
staleConfidenceThreshold: { lo: 0, hi: 1 },
|
|
189
|
+
maxAgeMs: { lo: 0, hi: Number.MAX_SAFE_INTEGER },
|
|
190
|
+
maxClustersPerRun: { lo: 0, hi: MAX_CLUSTERS_PER_RUN_LIMIT, integerOnly: true },
|
|
191
|
+
maxRecordsPerRun: { lo: 0, hi: MAX_RECORDS_PER_RUN_LIMIT, integerOnly: true },
|
|
192
|
+
};
|
|
193
|
+
function resolveSetting(raw, key, fallback) {
|
|
194
|
+
const value = parseOptionalNumber(raw[key]);
|
|
195
|
+
if (value === null)
|
|
196
|
+
return null;
|
|
197
|
+
const n = value ?? fallback;
|
|
198
|
+
const bounds = SETTING_BOUNDS[key];
|
|
199
|
+
if (n < bounds.lo || n > bounds.hi)
|
|
200
|
+
return null;
|
|
201
|
+
if (bounds.integerOnly === true && !Number.isInteger(n))
|
|
202
|
+
return null;
|
|
203
|
+
return n;
|
|
204
|
+
}
|
|
205
|
+
function parseSettings(raw) {
|
|
206
|
+
const record = parseSettingsRecord(raw);
|
|
207
|
+
if (record === null) {
|
|
208
|
+
return badRequest("settings must be an object containing optional numeric consolidation settings.");
|
|
209
|
+
}
|
|
210
|
+
const keys = Object.keys(SETTING_BOUNDS);
|
|
211
|
+
const defaults = {
|
|
212
|
+
jaccardThreshold: DEFAULT_JACCARD_THRESHOLD,
|
|
213
|
+
staleConfidenceThreshold: DEFAULT_STALE_CONFIDENCE_THRESHOLD,
|
|
214
|
+
maxAgeMs: DEFAULT_MAX_AGE_MS,
|
|
215
|
+
maxClustersPerRun: DEFAULT_MAX_CLUSTERS_PER_RUN,
|
|
216
|
+
maxRecordsPerRun: DEFAULT_MAX_RECORDS_PER_RUN,
|
|
217
|
+
};
|
|
218
|
+
const result = {};
|
|
219
|
+
for (const key of keys) {
|
|
220
|
+
const value = resolveSetting(record, key, defaults[key]);
|
|
221
|
+
if (value === null) {
|
|
222
|
+
const bounds = SETTING_BOUNDS[key];
|
|
223
|
+
const extra = bounds.integerOnly === true ? ", integer" : "";
|
|
224
|
+
return badRequest(`settings.${key} must be a finite number in [${String(bounds.lo)}, ${String(bounds.hi)}]${extra}.`);
|
|
225
|
+
}
|
|
226
|
+
result[key] = value;
|
|
227
|
+
}
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
function badRequest(message) {
|
|
231
|
+
return { status: 400, body: errorBody("BAD_REQUEST", message) };
|
|
232
|
+
}
|
|
233
|
+
function parseSelection(raw) {
|
|
234
|
+
const scopes = parseScopes(raw.scopes);
|
|
235
|
+
if (scopes === null) {
|
|
236
|
+
return badRequest("scopes must be a non-empty array of valid MemoryScope.");
|
|
237
|
+
}
|
|
238
|
+
const types = parseTypes(raw.types);
|
|
239
|
+
if (raw.types !== undefined && types === null) {
|
|
240
|
+
return badRequest(`types must be an array of: ${MEMORY_TYPES.join(", ")}.`);
|
|
241
|
+
}
|
|
242
|
+
const statuses = parseStatuses(raw.statuses);
|
|
243
|
+
if (raw.statuses !== undefined && statuses === null) {
|
|
244
|
+
return badRequest(`statuses must be an array of: ${MEMORY_STATUSES.join(", ")}.`);
|
|
245
|
+
}
|
|
246
|
+
if (typeof raw.includeExpired !== "undefined" && typeof raw.includeExpired !== "boolean") {
|
|
247
|
+
return badRequest("includeExpired must be a boolean when provided.");
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
scopes,
|
|
251
|
+
types: types ?? undefined,
|
|
252
|
+
statuses: statuses ?? undefined,
|
|
253
|
+
includeExpired: raw.includeExpired === true,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function parseCreateInput(raw) {
|
|
257
|
+
const selection = parseSelection(raw);
|
|
258
|
+
if (isRouteResult(selection))
|
|
259
|
+
return selection;
|
|
260
|
+
const settings = parseSettings(raw.settings);
|
|
261
|
+
if (isRouteResult(settings))
|
|
262
|
+
return settings;
|
|
263
|
+
return { selection, settings };
|
|
264
|
+
}
|
|
265
|
+
function loadSelectedMemories(vault, selection, maxRecords) {
|
|
266
|
+
const seen = new Map();
|
|
267
|
+
const statuses = selection.statuses?.filter((status) => status === "accepted") ?? ["accepted"];
|
|
268
|
+
if (statuses.length === 0 || maxRecords <= 0)
|
|
269
|
+
return { records: [], truncated: false };
|
|
270
|
+
const detectionLimit = maxRecords + 1;
|
|
271
|
+
for (const scope of selection.scopes) {
|
|
272
|
+
const remaining = detectionLimit - seen.size;
|
|
273
|
+
if (remaining <= 0)
|
|
274
|
+
break;
|
|
275
|
+
const records = vault.listMemoriesByScope(scope, {
|
|
276
|
+
...(selection.types !== undefined ? { type: selection.types } : {}),
|
|
277
|
+
status: statuses,
|
|
278
|
+
includeExpired: selection.includeExpired,
|
|
279
|
+
limit: remaining,
|
|
280
|
+
orderBy: "updatedAt",
|
|
281
|
+
orderDir: "asc",
|
|
282
|
+
});
|
|
283
|
+
for (const record of records) {
|
|
284
|
+
seen.set(record.id, record);
|
|
285
|
+
if (seen.size >= detectionLimit)
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const sorted = [...seen.values()]
|
|
290
|
+
.sort((a, b) => {
|
|
291
|
+
if (a.updatedAt !== b.updatedAt)
|
|
292
|
+
return a.updatedAt - b.updatedAt;
|
|
293
|
+
return a.id.localeCompare(b.id);
|
|
294
|
+
})
|
|
295
|
+
.slice(0, maxRecords);
|
|
296
|
+
return {
|
|
297
|
+
records: sorted,
|
|
298
|
+
truncated: seen.size > maxRecords,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function redactJob(deps, record) {
|
|
302
|
+
return deps.redactor({
|
|
303
|
+
id: record.job.id,
|
|
304
|
+
state: record.job.state,
|
|
305
|
+
startedAt: record.job.startedAt,
|
|
306
|
+
completedAt: record.job.completedAt,
|
|
307
|
+
result: record.job.result,
|
|
308
|
+
error: record.job.error,
|
|
309
|
+
createdAt: record.createdAt,
|
|
310
|
+
selection: record.selection,
|
|
311
|
+
settings: record.settings,
|
|
312
|
+
memoryCount: record.memoryCount,
|
|
313
|
+
cancelRequested: record.cancelRequested,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function newMemoryEdgeId() {
|
|
317
|
+
return randomUUID();
|
|
318
|
+
}
|
|
319
|
+
function buildRunOptions(scheduledRecord, createdAt, settings) {
|
|
320
|
+
return {
|
|
321
|
+
nowMs: createdAt,
|
|
322
|
+
newEdgeId: newMemoryEdgeId,
|
|
323
|
+
newReviewItemId: () => randomUUID(),
|
|
324
|
+
jaccardThreshold: settings.jaccardThreshold,
|
|
325
|
+
staleConfidenceThreshold: settings.staleConfidenceThreshold,
|
|
326
|
+
maxAgeMs: settings.maxAgeMs,
|
|
327
|
+
maxClustersPerRun: settings.maxClustersPerRun,
|
|
328
|
+
maxRecordsPerRun: settings.maxRecordsPerRun,
|
|
329
|
+
// Capture the record reference at schedule-time rather than re-fetching via the registry on
|
|
330
|
+
// every poll — eliminates a theoretical race where the registry entry is replaced under the
|
|
331
|
+
// closure before the signal is first checked.
|
|
332
|
+
cancellationSignal: () => scheduledRecord?.cancelRequested === true,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function finalizeTerminalJob(registry, running, jobId, memories, result, selectionTruncated = false) {
|
|
336
|
+
const completedAt = Date.now();
|
|
337
|
+
const finalResult = selectionTruncated && !result.truncated ? { ...result, truncated: true } : result;
|
|
338
|
+
if (result.state === "completed") {
|
|
339
|
+
registry.complete(jobId, transitionJob(running, "completed", { completedAt, result: finalResult }), memories.length);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (result.state === "canceled") {
|
|
343
|
+
registry.complete(jobId, transitionJob(running, "canceled", { completedAt, result: finalResult }), memories.length);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const message = "Consolidation run failed.";
|
|
347
|
+
registry.fail(jobId, transitionJob(running, "failed", { completedAt, result: finalResult, error: message }), message, memories.length);
|
|
348
|
+
}
|
|
349
|
+
function failScheduledJob(registry, running, jobId, memories, error) {
|
|
350
|
+
const completedAt = Date.now();
|
|
351
|
+
const message = error instanceof Error ? error.message : "Consolidation run failed unexpectedly.";
|
|
352
|
+
registry.fail(jobId, transitionJob(running, "failed", { completedAt, error: message }), message, memories.length);
|
|
353
|
+
}
|
|
354
|
+
function emptyConsolidationResult(state) {
|
|
355
|
+
return {
|
|
356
|
+
state,
|
|
357
|
+
edgesProposed: [],
|
|
358
|
+
updatesProposed: [],
|
|
359
|
+
staleFlags: [],
|
|
360
|
+
reviewItems: [],
|
|
361
|
+
clustersInspected: 0,
|
|
362
|
+
conflictPairsDetected: 0,
|
|
363
|
+
recordsInspected: 0,
|
|
364
|
+
truncated: false,
|
|
365
|
+
elapsedMs: 0,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function scheduleJob(deps, jobId, vault, selection, settings) {
|
|
369
|
+
const registry = deps.consolidationJobs;
|
|
370
|
+
if (registry === undefined)
|
|
371
|
+
return;
|
|
372
|
+
setImmediate(() => {
|
|
373
|
+
const queued = registry.get(jobId);
|
|
374
|
+
if (queued?.job.state !== "queued")
|
|
375
|
+
return;
|
|
376
|
+
if (queued.cancelRequested) {
|
|
377
|
+
const canceled = transitionJob(queued.job, "canceled", { completedAt: Date.now() });
|
|
378
|
+
registry.complete(jobId, canceled, 0);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const loaded = loadSelectedMemories(vault, selection, settings.maxRecordsPerRun);
|
|
382
|
+
const memories = loaded.records;
|
|
383
|
+
const afterLoad = registry.get(jobId);
|
|
384
|
+
if (afterLoad?.job.state !== "queued")
|
|
385
|
+
return;
|
|
386
|
+
if (afterLoad.cancelRequested) {
|
|
387
|
+
const canceled = transitionJob(afterLoad.job, "canceled", { completedAt: Date.now() });
|
|
388
|
+
registry.complete(jobId, canceled, memories.length);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (memories.length === 0 || settings.maxClustersPerRun === 0) {
|
|
392
|
+
const result = emptyConsolidationResult("skipped");
|
|
393
|
+
const skipped = transitionJob(afterLoad.job, "skipped", {
|
|
394
|
+
completedAt: Date.now(),
|
|
395
|
+
result,
|
|
396
|
+
});
|
|
397
|
+
registry.complete(jobId, skipped, memories.length);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const running = transitionJob(afterLoad.job, "running");
|
|
401
|
+
registry.setRunning(jobId, running);
|
|
402
|
+
const scheduledRecord = registry.get(jobId);
|
|
403
|
+
try {
|
|
404
|
+
const result = runConsolidation(memories, buildRunOptions(scheduledRecord, queued.createdAt, settings));
|
|
405
|
+
finalizeTerminalJob(registry, running, jobId, memories, result, loaded.truncated);
|
|
406
|
+
}
|
|
407
|
+
catch (error) {
|
|
408
|
+
failScheduledJob(registry, running, jobId, memories, error);
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
function registerJobLimit(error) {
|
|
413
|
+
return {
|
|
414
|
+
status: 409,
|
|
415
|
+
body: errorBody("CONSOLIDATION_JOB_LIMIT", error instanceof Error ? error.message : "Consolidation job limit reached."),
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function createJobResponse(deps, record) {
|
|
419
|
+
return { status: 202, body: { job: redactJob(deps, record) } };
|
|
420
|
+
}
|
|
421
|
+
export async function handleCreateConsolidationJob(ctx, deps) {
|
|
422
|
+
const vault = resolveVault(deps);
|
|
423
|
+
if (isRouteResult(vault))
|
|
424
|
+
return vault;
|
|
425
|
+
const registry = resolveJobRegistry(deps);
|
|
426
|
+
if (isRouteResult(registry))
|
|
427
|
+
return registry;
|
|
428
|
+
const body = await readJsonBody(ctx.req);
|
|
429
|
+
if (isRouteResult(body))
|
|
430
|
+
return body;
|
|
431
|
+
const input = parseCreateInput(body);
|
|
432
|
+
if (isRouteResult(input))
|
|
433
|
+
return input;
|
|
434
|
+
const createdAt = Date.now();
|
|
435
|
+
const jobId = randomUUID();
|
|
436
|
+
const job = buildConsolidationJob(jobId, createdAt);
|
|
437
|
+
let record;
|
|
438
|
+
try {
|
|
439
|
+
record = registry.register({
|
|
440
|
+
job,
|
|
441
|
+
createdAt,
|
|
442
|
+
selection: input.selection,
|
|
443
|
+
settings: input.settings,
|
|
444
|
+
memoryCount: 0,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
catch (error) {
|
|
448
|
+
return registerJobLimit(error);
|
|
449
|
+
}
|
|
450
|
+
scheduleJob(deps, jobId, vault, input.selection, input.settings);
|
|
451
|
+
return createJobResponse(deps, record);
|
|
452
|
+
}
|
|
453
|
+
export function handleGetConsolidationJob(ctx, deps) {
|
|
454
|
+
const registry = resolveJobRegistry(deps);
|
|
455
|
+
if (isRouteResult(registry))
|
|
456
|
+
return registry;
|
|
457
|
+
const jobId = ctx.params.jobId;
|
|
458
|
+
if (jobId === undefined) {
|
|
459
|
+
return { status: 404, body: errorBody("NOT_FOUND", "Consolidation job not found.") };
|
|
460
|
+
}
|
|
461
|
+
const record = registry.get(jobId);
|
|
462
|
+
if (record === undefined) {
|
|
463
|
+
return {
|
|
464
|
+
status: 404,
|
|
465
|
+
body: errorBody("NOT_FOUND", "Consolidation job not found."),
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
return { status: 200, body: { job: redactJob(deps, record) } };
|
|
469
|
+
}
|
|
470
|
+
export function handleCancelConsolidationJob(ctx, deps) {
|
|
471
|
+
const registry = resolveJobRegistry(deps);
|
|
472
|
+
if (isRouteResult(registry))
|
|
473
|
+
return registry;
|
|
474
|
+
const jobId = ctx.params.jobId;
|
|
475
|
+
if (jobId === undefined) {
|
|
476
|
+
return { status: 404, body: errorBody("NOT_FOUND", "Consolidation job not found.") };
|
|
477
|
+
}
|
|
478
|
+
const updated = registry.requestCancel(jobId);
|
|
479
|
+
if (updated === undefined) {
|
|
480
|
+
return {
|
|
481
|
+
status: 404,
|
|
482
|
+
body: errorBody("NOT_FOUND", "Consolidation job not found."),
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
if (updated.job.state === "queued") {
|
|
486
|
+
const canceled = transitionJob(updated.job, "canceled", { completedAt: Date.now() });
|
|
487
|
+
const finalRecord = registry.complete(updated.job.id, canceled, updated.memoryCount) ?? updated;
|
|
488
|
+
return { status: 202, body: { job: redactJob(deps, finalRecord) } };
|
|
489
|
+
}
|
|
490
|
+
return { status: 202, body: { job: redactJob(deps, updated) } };
|
|
491
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ConsolidationJob } from "@oscharko-dev/keiko-memory-consolidation";
|
|
2
|
+
export interface ConsolidationJobSettings {
|
|
3
|
+
readonly jaccardThreshold: number;
|
|
4
|
+
readonly staleConfidenceThreshold: number;
|
|
5
|
+
readonly maxAgeMs: number;
|
|
6
|
+
readonly maxClustersPerRun: number;
|
|
7
|
+
readonly maxRecordsPerRun: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ConsolidationJobSelection {
|
|
10
|
+
readonly scopes: readonly import("@oscharko-dev/keiko-contracts").MemoryScope[];
|
|
11
|
+
readonly types?: readonly import("@oscharko-dev/keiko-contracts").MemoryType[] | undefined;
|
|
12
|
+
readonly statuses?: readonly import("@oscharko-dev/keiko-contracts").MemoryStatus[] | undefined;
|
|
13
|
+
readonly includeExpired: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ConsolidationJobRecord {
|
|
16
|
+
readonly job: ConsolidationJob;
|
|
17
|
+
readonly createdAt: number;
|
|
18
|
+
readonly selection: ConsolidationJobSelection;
|
|
19
|
+
readonly settings: ConsolidationJobSettings;
|
|
20
|
+
readonly memoryCount: number;
|
|
21
|
+
readonly cancelRequested: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface RegisterConsolidationJobInput {
|
|
24
|
+
readonly job: ConsolidationJob;
|
|
25
|
+
readonly createdAt: number;
|
|
26
|
+
readonly selection: ConsolidationJobSelection;
|
|
27
|
+
readonly settings: ConsolidationJobSettings;
|
|
28
|
+
readonly memoryCount: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ConsolidationJobRegistryOptions {
|
|
31
|
+
readonly maxJobs?: number | undefined;
|
|
32
|
+
readonly now?: (() => number) | undefined;
|
|
33
|
+
}
|
|
34
|
+
export declare class ConsolidationJobRegistryLimitError extends Error {
|
|
35
|
+
constructor(limit: number);
|
|
36
|
+
}
|
|
37
|
+
export interface ConsolidationJobRegistry {
|
|
38
|
+
readonly register: (input: RegisterConsolidationJobInput) => ConsolidationJobRecord;
|
|
39
|
+
readonly get: (jobId: string) => ConsolidationJobRecord | undefined;
|
|
40
|
+
readonly setRunning: (jobId: string, job: ConsolidationJob) => ConsolidationJobRecord | undefined;
|
|
41
|
+
readonly complete: (jobId: string, job: ConsolidationJob, memoryCount: number) => ConsolidationJobRecord | undefined;
|
|
42
|
+
readonly fail: (jobId: string, job: ConsolidationJob, error: string, memoryCount: number) => ConsolidationJobRecord | undefined;
|
|
43
|
+
readonly requestCancel: (jobId: string) => ConsolidationJobRecord | undefined;
|
|
44
|
+
readonly size: () => number;
|
|
45
|
+
}
|
|
46
|
+
export declare function createConsolidationJobRegistry(options?: ConsolidationJobRegistryOptions): ConsolidationJobRegistry;
|
|
47
|
+
//# sourceMappingURL=memory-consolidation-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-consolidation-registry.d.ts","sourceRoot":"","sources":["../src/memory-consolidation-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,+BAA+B,EAAE,WAAW,EAAE,CAAC;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,OAAO,+BAA+B,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,OAAO,+BAA+B,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IAChG,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC;CAC3C;AAED,qBAAa,kCAAmC,SAAQ,KAAK;gBACxC,KAAK,EAAE,MAAM;CAIjC;AAwFD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,sBAAsB,CAAC;IACpF,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,sBAAsB,GAAG,SAAS,CAAC;IACpE,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,KAAK,sBAAsB,GAAG,SAAS,CAAC;IAClG,QAAQ,CAAC,QAAQ,EAAE,CACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,MAAM,KAChB,sBAAsB,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,CACb,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,KAChB,sBAAsB,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,sBAAsB,GAAG,SAAS,CAAC;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,+BAAoC,GAC5C,wBAAwB,CAuC1B"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export class ConsolidationJobRegistryLimitError extends Error {
|
|
2
|
+
constructor(limit) {
|
|
3
|
+
super(`consolidation job registry limit reached (${String(limit)})`);
|
|
4
|
+
this.name = "ConsolidationJobRegistryLimitError";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
const DEFAULT_MAX_JOBS = 32;
|
|
8
|
+
function isTerminal(job) {
|
|
9
|
+
return (job.state === "completed" ||
|
|
10
|
+
job.state === "failed" ||
|
|
11
|
+
job.state === "canceled" ||
|
|
12
|
+
job.state === "skipped");
|
|
13
|
+
}
|
|
14
|
+
function oldestTerminalJobId(state) {
|
|
15
|
+
let candidateId;
|
|
16
|
+
let candidateTs = Number.POSITIVE_INFINITY;
|
|
17
|
+
for (const [jobId, record] of state.records) {
|
|
18
|
+
if (!isTerminal(record.job))
|
|
19
|
+
continue;
|
|
20
|
+
const ts = record.job.completedAt ?? record.createdAt;
|
|
21
|
+
if (ts < candidateTs) {
|
|
22
|
+
candidateTs = ts;
|
|
23
|
+
candidateId = jobId;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return candidateId;
|
|
27
|
+
}
|
|
28
|
+
function enforceCapacity(state) {
|
|
29
|
+
while (state.records.size >= state.maxJobs) {
|
|
30
|
+
const evictId = oldestTerminalJobId(state);
|
|
31
|
+
if (evictId === undefined) {
|
|
32
|
+
throw new ConsolidationJobRegistryLimitError(state.maxJobs);
|
|
33
|
+
}
|
|
34
|
+
state.records.delete(evictId);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function updateRecord(state, jobId, patch) {
|
|
38
|
+
const record = state.records.get(jobId);
|
|
39
|
+
if (record === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
const next = { ...record, ...patch };
|
|
42
|
+
state.records.set(jobId, next);
|
|
43
|
+
return next;
|
|
44
|
+
}
|
|
45
|
+
function withElapsedMs(result, startedAt, completedAt) {
|
|
46
|
+
return { ...result, elapsedMs: Math.max(0, completedAt - startedAt) };
|
|
47
|
+
}
|
|
48
|
+
function createRegistryState(options) {
|
|
49
|
+
return {
|
|
50
|
+
records: new Map(),
|
|
51
|
+
maxJobs: options.maxJobs ?? DEFAULT_MAX_JOBS,
|
|
52
|
+
now: options.now ?? Date.now,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function finalizeJob(job, startedAt, completedAt, error) {
|
|
56
|
+
const result = job.result;
|
|
57
|
+
if (result === undefined) {
|
|
58
|
+
return error === undefined ? job : { ...job, error };
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
...job,
|
|
62
|
+
...(error === undefined ? {} : { error }),
|
|
63
|
+
result: withElapsedMs(result, startedAt, completedAt),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export function createConsolidationJobRegistry(options = {}) {
|
|
67
|
+
const state = createRegistryState(options);
|
|
68
|
+
return {
|
|
69
|
+
register: (input) => {
|
|
70
|
+
enforceCapacity(state);
|
|
71
|
+
const record = {
|
|
72
|
+
job: input.job,
|
|
73
|
+
createdAt: input.createdAt,
|
|
74
|
+
selection: input.selection,
|
|
75
|
+
settings: input.settings,
|
|
76
|
+
memoryCount: input.memoryCount,
|
|
77
|
+
cancelRequested: false,
|
|
78
|
+
};
|
|
79
|
+
state.records.set(input.job.id, record);
|
|
80
|
+
return record;
|
|
81
|
+
},
|
|
82
|
+
get: (jobId) => state.records.get(jobId),
|
|
83
|
+
setRunning: (jobId, job) => updateRecord(state, jobId, { job }),
|
|
84
|
+
complete: (jobId, job, memoryCount) => {
|
|
85
|
+
const startedAt = job.startedAt ?? state.now();
|
|
86
|
+
const completedAt = job.completedAt ?? state.now();
|
|
87
|
+
const finalJob = finalizeJob(job, startedAt, completedAt);
|
|
88
|
+
return updateRecord(state, jobId, { job: finalJob, memoryCount });
|
|
89
|
+
},
|
|
90
|
+
fail: (jobId, job, error, memoryCount) => {
|
|
91
|
+
const startedAt = job.startedAt ?? state.now();
|
|
92
|
+
const completedAt = job.completedAt ?? state.now();
|
|
93
|
+
const finalJob = finalizeJob(job, startedAt, completedAt, error);
|
|
94
|
+
return updateRecord(state, jobId, { job: finalJob, memoryCount });
|
|
95
|
+
},
|
|
96
|
+
requestCancel: (jobId) => {
|
|
97
|
+
const record = state.records.get(jobId);
|
|
98
|
+
if (record === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
if (record.cancelRequested)
|
|
101
|
+
return record;
|
|
102
|
+
return updateRecord(state, jobId, { cancelRequested: true });
|
|
103
|
+
},
|
|
104
|
+
size: () => state.records.size,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type MemoryQueryPort } from "@oscharko-dev/keiko-memory-retrieval";
|
|
2
|
+
import type { MemoryVaultStore } from "@oscharko-dev/keiko-memory-vault";
|
|
3
|
+
import type { UiHandlerDeps } from "./deps.js";
|
|
4
|
+
import type { RouteContext, RouteResult } from "./routes.js";
|
|
5
|
+
export declare function vaultAsQueryPort(vault: MemoryVaultStore): MemoryQueryPort;
|
|
6
|
+
export declare function handleMemoryRetrieveContext(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
|
|
7
|
+
export declare function handleMemoryCaptureFromConversation(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
|
|
8
|
+
//# sourceMappingURL=memory-conv-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-conv-handlers.d.ts","sourceRoot":"","sources":["../src/memory-conv-handlers.ts"],"names":[],"mappings":"AA0BA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,sCAAsC,CAAC;AAgB9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkH7D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,eAAe,CAezE;AAgJD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,WAAW,CAAC,CAwCtB;AAkED,wBAAsB,mCAAmC,CACvD,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,WAAW,CAAC,CA0BtB"}
|