@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,52 @@
|
|
|
1
|
+
import type { FigmaConnectorErrorCode } from "./figmaConnectorErrors.js";
|
|
2
|
+
import type { FigmaScopeRef } from "./figmaScopeRef.js";
|
|
3
|
+
export declare const FIGMA_AUDIT_SCHEMA_VERSION: 1;
|
|
4
|
+
/**
|
|
5
|
+
* The four AC1-audited connector actions (Issue #760). `"snapshot"`, `"resnapshot"`, and `"revoke"`
|
|
6
|
+
* are emitted at their respective operations. `"connect"` is emitted exactly once — at the operator's
|
|
7
|
+
* first read-only-scope acknowledgement (acknowledgeReadOnly on the first build for a scope), by the
|
|
8
|
+
* orchestration's `gateConsent` (figmaSnapshotOrchestration.ts) — the durable record of the operator
|
|
9
|
+
* establishing the connection. Re-acknowledging an already-consented scope emits no further connect.
|
|
10
|
+
*/
|
|
11
|
+
export type FigmaConnectorAction = "connect" | "snapshot" | "resnapshot" | "revoke";
|
|
12
|
+
export type FigmaConnectorOutcome = "ok" | "error";
|
|
13
|
+
/** Pure cardinalities only — never names, ids, links, or design content. */
|
|
14
|
+
export interface FigmaConnectorAuditCounts {
|
|
15
|
+
readonly screens: number;
|
|
16
|
+
readonly renders: number;
|
|
17
|
+
readonly skipped: number;
|
|
18
|
+
readonly designTokens: number;
|
|
19
|
+
/** Inter-screen transitions; present only when the IR carried links (nav graph #811 is additive). */
|
|
20
|
+
readonly navTransitions?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface FigmaConnectorAuditEntry {
|
|
23
|
+
readonly at: string;
|
|
24
|
+
readonly action: FigmaConnectorAction;
|
|
25
|
+
readonly outcome: FigmaConnectorOutcome;
|
|
26
|
+
/** Present only when `outcome === "error"`. A coded, safe error from the connector taxonomy. */
|
|
27
|
+
readonly errorCode?: FigmaConnectorErrorCode;
|
|
28
|
+
/** Present only on a successful action that produced board cardinalities. */
|
|
29
|
+
readonly counts?: FigmaConnectorAuditCounts;
|
|
30
|
+
}
|
|
31
|
+
export interface FigmaConnectorAuditArtifact {
|
|
32
|
+
readonly figmaAuditSchemaVersion: typeof FIGMA_AUDIT_SCHEMA_VERSION;
|
|
33
|
+
readonly scopeRef: FigmaScopeRef;
|
|
34
|
+
readonly auditLog: readonly FigmaConnectorAuditEntry[];
|
|
35
|
+
readonly lastUpdatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const loadFigmaConnectorAudit: (scopeRef: FigmaScopeRef, evidenceDir: string) => FigmaConnectorAuditArtifact | undefined;
|
|
38
|
+
export interface AppendFigmaConnectorAuditInput {
|
|
39
|
+
readonly scopeRef: FigmaScopeRef;
|
|
40
|
+
readonly evidenceDir: string;
|
|
41
|
+
readonly action: FigmaConnectorAction;
|
|
42
|
+
readonly outcome: FigmaConnectorOutcome;
|
|
43
|
+
readonly now: string;
|
|
44
|
+
readonly errorCode?: FigmaConnectorErrorCode;
|
|
45
|
+
readonly counts?: FigmaConnectorAuditCounts;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Append an append-only connector-action audit entry through the reused Evidence audit seam.
|
|
49
|
+
* Creates the artifact on first use. Returns the updated artifact. The caller authorises the action.
|
|
50
|
+
*/
|
|
51
|
+
export declare const appendFigmaConnectorAudit: (input: AppendFigmaConnectorAuditInput) => FigmaConnectorAuditArtifact;
|
|
52
|
+
//# sourceMappingURL=figmaConnectorAudit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figmaConnectorAudit.d.ts","sourceRoot":"","sources":["../../../src/qualityIntelligence/figma/figmaConnectorAudit.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AAGrD;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC;AACpF,MAAM,MAAM,qBAAqB,GAAG,IAAI,GAAG,OAAO,CAAC;AAEnD,4EAA4E;AAC5E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,qGAAqG;IACrG,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,gGAAgG;IAChG,QAAQ,CAAC,SAAS,CAAC,EAAE,uBAAuB,CAAC;IAC7C,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,yBAAyB,CAAC;CAC7C;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,uBAAuB,EAAE,OAAO,0BAA0B,CAAC;IACpE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACvD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAoBD,eAAO,MAAM,uBAAuB,GAClC,UAAU,aAAa,EACvB,aAAa,MAAM,KAClB,2BAA2B,GAAG,SAAiD,CAAC;AAEnF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,yBAAyB,CAAC;CAC7C;AAeD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GACpC,OAAO,8BAA8B,KACpC,2BAWF,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Connector-activity audit ledger for the Figma connector (Epic #750, Issue #760).
|
|
2
|
+
//
|
|
3
|
+
// Reuses the SAME Evidence audit seam the QI inline-edit audit uses (`appendEditAudit` in
|
|
4
|
+
// ../reviewStore.ts → `createNodeContainedJsonArtifactStore` in keiko-evidence): an append-only,
|
|
5
|
+
// contained, atomically-written JSON artifact under `<evidenceDir>/qi/`. This module does NOT build
|
|
6
|
+
// a parallel store — it records connector actions through that one seam under a distinct suffix.
|
|
7
|
+
//
|
|
8
|
+
// GOVERNANCE (load-bearing, #760): an audit entry carries ONLY
|
|
9
|
+
// - the action (connect | snapshot | resnapshot | revoke),
|
|
10
|
+
// - the opaque, non-reversible `scopeRef` (never the file key / node id / board link),
|
|
11
|
+
// - the outcome (ok | error) and, on error, a coded `errorCode`,
|
|
12
|
+
// - small INTEGER counts (screens, renders, skipped, design tokens, optional nav transitions),
|
|
13
|
+
// - a wall-clock `at`.
|
|
14
|
+
// It carries NO token, NO PII, NO board id / link / name, and NO design content (no screen names,
|
|
15
|
+
// no text). Counts are the only board-derived data and they are pure cardinalities.
|
|
16
|
+
import { createNodeContainedJsonArtifactStore, } from "@oscharko-dev/keiko-evidence";
|
|
17
|
+
export const FIGMA_AUDIT_SCHEMA_VERSION = 1;
|
|
18
|
+
const FIGMA_AUDIT_SUFFIX = ".figma-audit.json";
|
|
19
|
+
const parseArtifact = (value) => {
|
|
20
|
+
if (typeof value !== "object" || value === null)
|
|
21
|
+
return undefined;
|
|
22
|
+
const record = value;
|
|
23
|
+
if (record.figmaAuditSchemaVersion !== FIGMA_AUDIT_SCHEMA_VERSION)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (typeof record.scopeRef !== "string" || !Array.isArray(record.auditLog))
|
|
26
|
+
return undefined;
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
const storeFor = (evidenceDir) => createNodeContainedJsonArtifactStore(evidenceDir, FIGMA_AUDIT_SUFFIX, { parse: parseArtifact });
|
|
30
|
+
const emptyArtifact = (scopeRef, now) => ({
|
|
31
|
+
figmaAuditSchemaVersion: FIGMA_AUDIT_SCHEMA_VERSION,
|
|
32
|
+
scopeRef,
|
|
33
|
+
auditLog: [],
|
|
34
|
+
lastUpdatedAt: now,
|
|
35
|
+
});
|
|
36
|
+
export const loadFigmaConnectorAudit = (scopeRef, evidenceDir) => storeFor(evidenceDir).load(scopeRef);
|
|
37
|
+
// Builds the entry with only the governance-permitted fields present. `errorCode` is attached only
|
|
38
|
+
// for an error outcome; `counts` only when supplied. No other field is ever spread in, so customer
|
|
39
|
+
// content cannot reach the entry even if the caller passed extra data.
|
|
40
|
+
const buildEntry = (input) => ({
|
|
41
|
+
at: input.now,
|
|
42
|
+
action: input.action,
|
|
43
|
+
outcome: input.outcome,
|
|
44
|
+
...(input.outcome === "error" && input.errorCode !== undefined
|
|
45
|
+
? { errorCode: input.errorCode }
|
|
46
|
+
: {}),
|
|
47
|
+
...(input.counts !== undefined ? { counts: input.counts } : {}),
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Append an append-only connector-action audit entry through the reused Evidence audit seam.
|
|
51
|
+
* Creates the artifact on first use. Returns the updated artifact. The caller authorises the action.
|
|
52
|
+
*/
|
|
53
|
+
export const appendFigmaConnectorAudit = (input) => {
|
|
54
|
+
const current = loadFigmaConnectorAudit(input.scopeRef, input.evidenceDir) ??
|
|
55
|
+
emptyArtifact(input.scopeRef, input.now);
|
|
56
|
+
const next = {
|
|
57
|
+
...current,
|
|
58
|
+
auditLog: [...current.auditLog, buildEntry(input)],
|
|
59
|
+
lastUpdatedAt: input.now,
|
|
60
|
+
};
|
|
61
|
+
storeFor(input.evidenceDir).record(input.scopeRef, next);
|
|
62
|
+
return next;
|
|
63
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type FigmaConnectorErrorCode = "FIGMA_MALFORMED_URL" | "FIGMA_TOKEN_MISSING" | "FIGMA_CONSENT_REQUIRED" | "FIGMA_TOKEN_INVALID" | "FIGMA_TOKEN_EXPIRED" | "FIGMA_TOKEN_REVOKED" | "FIGMA_NOT_FOUND" | "FIGMA_NOT_READY" | "FIGMA_INSUFFICIENT_SCOPE" | "FIGMA_RENDER_FAILED" | "FIGMA_PROXY_EGRESS_FAILED" | "FIGMA_PROXY_UNREACHABLE" | "FIGMA_PROXY_AUTH_REQUIRED" | "FIGMA_PROXY_BLOCKED_BY_POLICY" | "FIGMA_TLS_CA_FAILURE" | "FIGMA_OVERSIZED_SCOPE" | "FIGMA_RESPONSE_TOO_LARGE" | "FIGMA_RATE_LIMITED" | "FIGMA_UPSTREAM_UNAVAILABLE" | "FIGMA_NETWORK_UNREACHABLE" | "FIGMA_EGRESS_TIMEOUT" | "FIGMA_EGRESS_FAILED" | "FIGMA_BUILD_TIMEOUT" | "FIGMA_INTERNAL";
|
|
2
|
+
export interface FigmaConnectorErrorBody {
|
|
3
|
+
readonly error: {
|
|
4
|
+
readonly code: FigmaConnectorErrorCode;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare const figmaConnectorErrorBody: (code: FigmaConnectorErrorCode) => FigmaConnectorErrorBody;
|
|
9
|
+
export declare class FigmaConnectorError extends Error {
|
|
10
|
+
readonly code: FigmaConnectorErrorCode;
|
|
11
|
+
constructor(code: FigmaConnectorErrorCode);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Classify a transport-level throw from `fetch` or the body read into a stable
|
|
15
|
+
* {@link FigmaConnectorErrorCode}. Side-effect-free and total — any non-Error
|
|
16
|
+
* throwable (string, undefined) maps to `FIGMA_EGRESS_FAILED`.
|
|
17
|
+
*
|
|
18
|
+
* Precedence:
|
|
19
|
+
* (a) OutboundHttpEgressError (or plain Error with outbound code, for cross-package resilience)
|
|
20
|
+
* → proxy/TLS-via-proxy codes. FIGMA_PROXY_* codes are ONLY reachable via this branch.
|
|
21
|
+
* (b) TLS trust codes / messages → FIGMA_TLS_CA_FAILURE.
|
|
22
|
+
* (c) Timeout / abort names (DOMException AbortError, Node TimeoutError) → FIGMA_EGRESS_TIMEOUT.
|
|
23
|
+
* (d) Direct connectivity codes / messages → FIGMA_NETWORK_UNREACHABLE.
|
|
24
|
+
* (e) Default → FIGMA_EGRESS_FAILED.
|
|
25
|
+
*
|
|
26
|
+
* Inspects `err.code`, `err.cause.code`, and `err.message` in that order of
|
|
27
|
+
* precedence so Node.js `TypeError: fetch failed` wrappers (undici wraps the
|
|
28
|
+
* underlying `cause.code`) are classified correctly.
|
|
29
|
+
*/
|
|
30
|
+
export declare const classifyFigmaTransportError: (err: unknown) => FigmaConnectorErrorCode;
|
|
31
|
+
//# sourceMappingURL=figmaConnectorErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figmaConnectorErrors.d.ts","sourceRoot":"","sources":["../../../src/qualityIntelligence/figma/figmaConnectorErrors.ts"],"names":[],"mappings":"AAmCA,MAAM,MAAM,uBAAuB,GAC/B,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,qBAAqB,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,0BAA0B,GAC1B,qBAAqB,GACrB,2BAA2B,GAC3B,yBAAyB,GACzB,2BAA2B,GAC3B,+BAA+B,GAC/B,sBAAsB,GACtB,uBAAuB,GACvB,0BAA0B,GAC1B,oBAAoB,GACpB,4BAA4B,GAC5B,2BAA2B,GAC3B,sBAAsB,GACtB,qBAAqB,GACrB,qBAAqB,GACrB,gBAAgB,CAAC;AAkDrB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACtF;AAED,eAAO,MAAM,uBAAuB,GAClC,MAAM,uBAAuB,KAC5B,uBAED,CAAC;AAEH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;gBAE3B,IAAI,EAAE,uBAAuB;CAK1C;AA0JD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,2BAA2B,GAAI,KAAK,OAAO,KAAG,uBAa1D,CAAC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// Figma connector error shapes (Epic #750, Issues #751, #758, #760, #884).
|
|
2
|
+
//
|
|
3
|
+
// Coded, safe errors for the server-side Figma connector. A FigmaConnectorError carries
|
|
4
|
+
// ONLY a stable code and a fixed, secret-free message — never the PAT, never a raw Figma
|
|
5
|
+
// payload, never an outbound URL or header value. Mirrors the QI connector error posture
|
|
6
|
+
// in ../connectorErrors.ts so the route tier can serialise it consistently.
|
|
7
|
+
//
|
|
8
|
+
// Complete coded taxonomy (#760, #884); every code is user-actionable. Each ticket-named
|
|
9
|
+
// category maps to one or more codes below:
|
|
10
|
+
// auth → FIGMA_TOKEN_MISSING | FIGMA_TOKEN_INVALID | FIGMA_TOKEN_EXPIRED
|
|
11
|
+
// | FIGMA_TOKEN_REVOKED
|
|
12
|
+
// consent → FIGMA_CONSENT_REQUIRED (no recorded read-only-scope acknowledgement)
|
|
13
|
+
// scope → FIGMA_INSUFFICIENT_SCOPE
|
|
14
|
+
// rate-limit → FIGMA_RATE_LIMITED
|
|
15
|
+
// not-found → FIGMA_NOT_FOUND
|
|
16
|
+
// readiness → FIGMA_NOT_READY
|
|
17
|
+
// oversized → FIGMA_OVERSIZED_SCOPE | FIGMA_RESPONSE_TOO_LARGE
|
|
18
|
+
// render-failed → FIGMA_RENDER_FAILED
|
|
19
|
+
// proxy egress → FIGMA_PROXY_UNREACHABLE (proxy host unreachable)
|
|
20
|
+
// | FIGMA_PROXY_AUTH_REQUIRED (proxy requires authentication)
|
|
21
|
+
// | FIGMA_PROXY_BLOCKED_BY_POLICY (proxy denied the request by policy)
|
|
22
|
+
// | FIGMA_PROXY_EGRESS_FAILED (generic proxy egress failure, retained for back-compat)
|
|
23
|
+
// direct egress → FIGMA_NETWORK_UNREACHABLE (DNS/connection/socket error, no proxy)
|
|
24
|
+
// | FIGMA_EGRESS_TIMEOUT (request timed out before completion)
|
|
25
|
+
// | FIGMA_EGRESS_FAILED (generic direct egress failure; new default)
|
|
26
|
+
// tls/ca → FIGMA_TLS_CA_FAILURE (custom-CA / TLS verification failure on egress)
|
|
27
|
+
// FIGMA_MALFORMED_URL, FIGMA_UPSTREAM_UNAVAILABLE, and FIGMA_INTERNAL cover input and last-resort
|
|
28
|
+
// faults. The proxy-aware + custom-CA HTTP client itself is #802; this connector only SURFACES
|
|
29
|
+
// these proxy/TLS codes — it does not implement the proxy transport.
|
|
30
|
+
import { OutboundHttpEgressError, } from "@oscharko-dev/keiko-model-gateway/internal/http";
|
|
31
|
+
const SAFE_MESSAGES = {
|
|
32
|
+
FIGMA_MALFORMED_URL: "The supplied link is not a scoped Figma node link. Paste a board or section link that includes a node id.",
|
|
33
|
+
FIGMA_TOKEN_MISSING: "The Figma connector is not configured. Set a read-only access token before fetching a board.",
|
|
34
|
+
FIGMA_CONSENT_REQUIRED: "Acknowledge the read-only, least-privilege Figma scope before the first fetch for this board.",
|
|
35
|
+
FIGMA_TOKEN_INVALID: "The Figma access token is invalid. Re-key the connector with a current read-only token.",
|
|
36
|
+
FIGMA_TOKEN_EXPIRED: "The Figma access token has expired. Re-key the connector with a new read-only token.",
|
|
37
|
+
FIGMA_TOKEN_REVOKED: "The Figma access token has been revoked. Re-key the connector with a new read-only token.",
|
|
38
|
+
FIGMA_NOT_FOUND: "The requested Figma node could not be found for the supplied link.",
|
|
39
|
+
FIGMA_NOT_READY: "The requested Figma scope is not release-ready. Pin a Figma version, select a Release section, or mark the frame Ready for dev before snapshotting.",
|
|
40
|
+
FIGMA_INSUFFICIENT_SCOPE: "The configured Figma access token is not permitted to read the requested node. Re-key the connector with a read-only token that can read this file.",
|
|
41
|
+
FIGMA_RENDER_FAILED: "Figma could not render the requested screens. Re-run the snapshot; if it persists, connect a narrower section.",
|
|
42
|
+
FIGMA_PROXY_EGRESS_FAILED: "The Figma request could not be routed through the platform egress proxy. Check proxy connectivity and try again.",
|
|
43
|
+
FIGMA_PROXY_UNREACHABLE: "The platform egress proxy is unreachable. Check the proxy host and port and try again.",
|
|
44
|
+
FIGMA_PROXY_AUTH_REQUIRED: "The forward proxy requires authentication for the Figma egress request. Configure proxy credentials or an allow rule.",
|
|
45
|
+
FIGMA_PROXY_BLOCKED_BY_POLICY: "The forward proxy blocked the Figma egress request by policy. Ask the proxy operator to allow api.figma.com and the Figma render hosts.",
|
|
46
|
+
FIGMA_TLS_CA_FAILURE: "The TLS certificate for the Figma egress could not be verified. Check the configured certificate authority bundle and try again.",
|
|
47
|
+
FIGMA_OVERSIZED_SCOPE: "The requested Figma node subtree is too large for a single scoped fetch. Connect a narrower section.",
|
|
48
|
+
FIGMA_RESPONSE_TOO_LARGE: "The Figma API response exceeded the maximum allowed size. Connect a narrower section to reduce the response.",
|
|
49
|
+
FIGMA_RATE_LIMITED: "Figma rate-limited the snapshot-build after repeated retries. Re-run with a narrower Release section or lower the Figma fetch limits.",
|
|
50
|
+
FIGMA_UPSTREAM_UNAVAILABLE: "The Figma service is currently unavailable. Try the scoped fetch again later.",
|
|
51
|
+
FIGMA_NETWORK_UNREACHABLE: "The outbound network request to Figma failed (DNS, connection, or socket error). Check network connectivity and egress policy.",
|
|
52
|
+
FIGMA_EGRESS_TIMEOUT: "The Figma request timed out before completing. Retry; if it persists, raise KEIKO_FIGMA_REQUEST_TIMEOUT_MS or check upstream latency.",
|
|
53
|
+
FIGMA_EGRESS_FAILED: "The outbound request to Figma failed before a response was received.",
|
|
54
|
+
FIGMA_BUILD_TIMEOUT: "The snapshot build exceeded the configured deadline. No partial snapshot was stored. Retry or raise KEIKO_FIGMA_BUILD_DEADLINE_MS.",
|
|
55
|
+
FIGMA_INTERNAL: "The Figma connector could not service the request.",
|
|
56
|
+
};
|
|
57
|
+
export const figmaConnectorErrorBody = (code) => ({
|
|
58
|
+
error: { code, message: SAFE_MESSAGES[code] },
|
|
59
|
+
});
|
|
60
|
+
export class FigmaConnectorError extends Error {
|
|
61
|
+
code;
|
|
62
|
+
constructor(code) {
|
|
63
|
+
super(SAFE_MESSAGES[code]);
|
|
64
|
+
this.name = "FigmaConnectorError";
|
|
65
|
+
this.code = code;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Node.js / undici error codes that indicate a TLS / certificate failure.
|
|
69
|
+
const TLS_CODES = new Set([
|
|
70
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
71
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
72
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
73
|
+
"CERT_HAS_EXPIRED",
|
|
74
|
+
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
75
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
76
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
77
|
+
]);
|
|
78
|
+
// Node.js / undici error codes that indicate a direct connectivity / DNS / socket failure.
|
|
79
|
+
// These are only reached when the error did NOT come through the OutboundHttpEgressError proxy
|
|
80
|
+
// path — a raw ECONNREFUSED means no proxy is involved.
|
|
81
|
+
const CONNECTIVITY_CODES = new Set([
|
|
82
|
+
"ECONNREFUSED",
|
|
83
|
+
"ECONNRESET",
|
|
84
|
+
"ETIMEDOUT",
|
|
85
|
+
"ENOTFOUND",
|
|
86
|
+
"EAI_AGAIN",
|
|
87
|
+
"EPIPE",
|
|
88
|
+
"ECONNABORTED",
|
|
89
|
+
"EHOSTUNREACH",
|
|
90
|
+
"ENETUNREACH",
|
|
91
|
+
"EPROTO",
|
|
92
|
+
"EPERM",
|
|
93
|
+
"EACCES",
|
|
94
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
95
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
96
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
97
|
+
"UND_ERR_SOCKET",
|
|
98
|
+
]);
|
|
99
|
+
// Mapping from OutboundHttpEgressError codes (proxy path) to FigmaConnectorErrorCodes.
|
|
100
|
+
// FIGMA_PROXY_* codes are ONLY reachable through the OutboundHttpEgressError branch.
|
|
101
|
+
const OUTBOUND_CODE_TO_FIGMA = {
|
|
102
|
+
TLS_CA_FAILURE: "FIGMA_TLS_CA_FAILURE",
|
|
103
|
+
PROXY_UNREACHABLE: "FIGMA_PROXY_UNREACHABLE",
|
|
104
|
+
PROXY_AUTH_REQUIRED: "FIGMA_PROXY_AUTH_REQUIRED",
|
|
105
|
+
PROXY_BLOCKED_BY_POLICY: "FIGMA_PROXY_BLOCKED_BY_POLICY",
|
|
106
|
+
PROXY_EGRESS_FAILED: "FIGMA_PROXY_EGRESS_FAILED",
|
|
107
|
+
};
|
|
108
|
+
// String set of OutboundHttpEgressError codes for cross-package-boundary instanceof fallback.
|
|
109
|
+
const OUTBOUND_EGRESS_CODES = new Set([
|
|
110
|
+
"TLS_CA_FAILURE",
|
|
111
|
+
"PROXY_UNREACHABLE",
|
|
112
|
+
"PROXY_AUTH_REQUIRED",
|
|
113
|
+
"PROXY_BLOCKED_BY_POLICY",
|
|
114
|
+
"PROXY_EGRESS_FAILED",
|
|
115
|
+
]);
|
|
116
|
+
const TLS_MSG_RE = /cert|self.?signed|unable to (?:verify|get).*(issuer|cert)|tls/i;
|
|
117
|
+
// "fetch failed" is the Node.js TypeError message for generic direct-network failures (undici).
|
|
118
|
+
const CONNECTIVITY_MSG_RE = /socket hang ?up|network|fetch failed|econn|enotfound/i;
|
|
119
|
+
const extractCode = (err) => {
|
|
120
|
+
if (err !== null && typeof err === "object") {
|
|
121
|
+
const code = err.code;
|
|
122
|
+
if (typeof code === "string")
|
|
123
|
+
return code;
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
};
|
|
127
|
+
const extractCauseCode = (err) => {
|
|
128
|
+
if (err !== null && typeof err === "object") {
|
|
129
|
+
return extractCode(err.cause);
|
|
130
|
+
}
|
|
131
|
+
return undefined;
|
|
132
|
+
};
|
|
133
|
+
const extractMessage = (err) => {
|
|
134
|
+
if (err instanceof Error)
|
|
135
|
+
return err.message;
|
|
136
|
+
if (typeof err === "string")
|
|
137
|
+
return err;
|
|
138
|
+
return "";
|
|
139
|
+
};
|
|
140
|
+
const extractName = (err) => {
|
|
141
|
+
if (err !== null && typeof err === "object") {
|
|
142
|
+
const name = err.name;
|
|
143
|
+
if (typeof name === "string")
|
|
144
|
+
return name;
|
|
145
|
+
}
|
|
146
|
+
return "";
|
|
147
|
+
};
|
|
148
|
+
const extractCause = (err) => err !== null && typeof err === "object" ? err.cause : undefined;
|
|
149
|
+
/** Map an outbound egress code string to a FigmaConnectorErrorCode, or return undefined. */
|
|
150
|
+
const mapOutboundCode = (code) => {
|
|
151
|
+
if (!OUTBOUND_EGRESS_CODES.has(code))
|
|
152
|
+
return undefined;
|
|
153
|
+
return OUTBOUND_CODE_TO_FIGMA[code] ?? "FIGMA_PROXY_EGRESS_FAILED";
|
|
154
|
+
};
|
|
155
|
+
// Cross-package-boundary fallback: plain Error with a string .code in the outbound set.
|
|
156
|
+
// Used when instanceof check fails because OutboundHttpEgressError came from a different
|
|
157
|
+
// package copy (e.g. stale dist during tests).
|
|
158
|
+
const mapOutboundCodeFallback = (topCode, causeCode) => {
|
|
159
|
+
if (topCode !== undefined && OUTBOUND_EGRESS_CODES.has(topCode)) {
|
|
160
|
+
return mapOutboundCode(topCode) ?? "FIGMA_PROXY_EGRESS_FAILED";
|
|
161
|
+
}
|
|
162
|
+
if (causeCode !== undefined && OUTBOUND_EGRESS_CODES.has(causeCode)) {
|
|
163
|
+
return mapOutboundCode(causeCode) ?? "FIGMA_PROXY_EGRESS_FAILED";
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
};
|
|
167
|
+
// (a) OutboundHttpEgressError path — a proxy was genuinely in play.
|
|
168
|
+
// FIGMA_PROXY_* codes are ONLY reachable through this function.
|
|
169
|
+
const classifyOutbound = (err, cause, topCode, causeCode) => {
|
|
170
|
+
const outbound = err instanceof OutboundHttpEgressError
|
|
171
|
+
? err
|
|
172
|
+
: cause instanceof OutboundHttpEgressError
|
|
173
|
+
? cause
|
|
174
|
+
: undefined;
|
|
175
|
+
if (outbound !== undefined)
|
|
176
|
+
return mapOutboundCode(outbound.code) ?? "FIGMA_PROXY_EGRESS_FAILED";
|
|
177
|
+
return mapOutboundCodeFallback(topCode, causeCode);
|
|
178
|
+
};
|
|
179
|
+
// (b) TLS by code or message.
|
|
180
|
+
const classifyTls = (code, msg) => (code !== undefined && TLS_CODES.has(code)) || TLS_MSG_RE.test(msg)
|
|
181
|
+
? "FIGMA_TLS_CA_FAILURE"
|
|
182
|
+
: undefined;
|
|
183
|
+
// (c) Timeout / abort names — check both err and its cause.
|
|
184
|
+
const isAbortName = (name) => name === "TimeoutError" || name === "AbortError";
|
|
185
|
+
const classifyTimeout = (err, cause) => isAbortName(extractName(err)) || isAbortName(extractName(cause))
|
|
186
|
+
? "FIGMA_EGRESS_TIMEOUT"
|
|
187
|
+
: undefined;
|
|
188
|
+
// (d) Direct connectivity codes / messages — no proxy involved.
|
|
189
|
+
const classifyConnectivity = (code, msg) => (code !== undefined && CONNECTIVITY_CODES.has(code)) || CONNECTIVITY_MSG_RE.test(msg)
|
|
190
|
+
? "FIGMA_NETWORK_UNREACHABLE"
|
|
191
|
+
: undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Classify a transport-level throw from `fetch` or the body read into a stable
|
|
194
|
+
* {@link FigmaConnectorErrorCode}. Side-effect-free and total — any non-Error
|
|
195
|
+
* throwable (string, undefined) maps to `FIGMA_EGRESS_FAILED`.
|
|
196
|
+
*
|
|
197
|
+
* Precedence:
|
|
198
|
+
* (a) OutboundHttpEgressError (or plain Error with outbound code, for cross-package resilience)
|
|
199
|
+
* → proxy/TLS-via-proxy codes. FIGMA_PROXY_* codes are ONLY reachable via this branch.
|
|
200
|
+
* (b) TLS trust codes / messages → FIGMA_TLS_CA_FAILURE.
|
|
201
|
+
* (c) Timeout / abort names (DOMException AbortError, Node TimeoutError) → FIGMA_EGRESS_TIMEOUT.
|
|
202
|
+
* (d) Direct connectivity codes / messages → FIGMA_NETWORK_UNREACHABLE.
|
|
203
|
+
* (e) Default → FIGMA_EGRESS_FAILED.
|
|
204
|
+
*
|
|
205
|
+
* Inspects `err.code`, `err.cause.code`, and `err.message` in that order of
|
|
206
|
+
* precedence so Node.js `TypeError: fetch failed` wrappers (undici wraps the
|
|
207
|
+
* underlying `cause.code`) are classified correctly.
|
|
208
|
+
*/
|
|
209
|
+
export const classifyFigmaTransportError = (err) => {
|
|
210
|
+
const cause = extractCause(err);
|
|
211
|
+
const topCode = extractCode(err);
|
|
212
|
+
const causeCode = extractCauseCode(err);
|
|
213
|
+
const code = topCode ?? causeCode;
|
|
214
|
+
const msg = extractMessage(err);
|
|
215
|
+
return (classifyOutbound(err, cause, topCode, causeCode) ??
|
|
216
|
+
classifyTls(code, msg) ??
|
|
217
|
+
classifyTimeout(err, cause) ??
|
|
218
|
+
classifyConnectivity(code, msg) ??
|
|
219
|
+
"FIGMA_EGRESS_FAILED");
|
|
220
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { QualityIntelligenceFigma } from "@oscharko-dev/keiko-quality-intelligence";
|
|
2
|
+
import type { FigmaSnapshot } from "./figmaSnapshotTypes.js";
|
|
3
|
+
/** Deterministic-vs-model augmentation tally. Supplied by the QI source (#754) as plain counts. */
|
|
4
|
+
export interface FigmaAugmentationTally {
|
|
5
|
+
readonly deterministic: number;
|
|
6
|
+
readonly modelAugmented: number;
|
|
7
|
+
}
|
|
8
|
+
export interface FigmaAugmentationShare {
|
|
9
|
+
readonly deterministic: number;
|
|
10
|
+
readonly modelAugmented: number;
|
|
11
|
+
/** modelAugmented / (deterministic + modelAugmented), rounded to 4 dp; 0 when the total is 0. */
|
|
12
|
+
readonly modelAugmentedShare: number;
|
|
13
|
+
}
|
|
14
|
+
/** Optional navigation-graph cardinalities (#811). Present only when links/screens are supplied. */
|
|
15
|
+
export interface FigmaNavGraphMetrics {
|
|
16
|
+
readonly screens: number;
|
|
17
|
+
readonly transitions: number;
|
|
18
|
+
}
|
|
19
|
+
/** Optional a11y-finding cardinalities (#812). Present only when a finding count is supplied. */
|
|
20
|
+
export interface FigmaA11yMetrics {
|
|
21
|
+
readonly findings: number;
|
|
22
|
+
}
|
|
23
|
+
export interface FigmaConnectorMetrics {
|
|
24
|
+
/** Share of the raw subtree removed by deterministic cleaning, in [0, 1]. */
|
|
25
|
+
readonly reductionRatio: number;
|
|
26
|
+
readonly screenCount: number;
|
|
27
|
+
/** Screens that produced a render in the Snapshot (≤ screenCount; the rest are skippedScreens). */
|
|
28
|
+
readonly renderCount: number;
|
|
29
|
+
readonly designTokenCount: number;
|
|
30
|
+
readonly augmentation: FigmaAugmentationShare;
|
|
31
|
+
readonly navGraph?: FigmaNavGraphMetrics;
|
|
32
|
+
readonly a11y?: FigmaA11yMetrics;
|
|
33
|
+
}
|
|
34
|
+
/** Optional, additive metric inputs from siblings not yet merged. */
|
|
35
|
+
export interface FigmaConnectorMetricsExtras {
|
|
36
|
+
/** A11y finding count from #812. Omit when the a11y baseline did not run. */
|
|
37
|
+
readonly a11yFindings?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compute the operational metrics from the deterministic IR, the assembled Snapshot, the
|
|
41
|
+
* augmentation tally, and any additive sibling inputs. Pure: same inputs → byte-identical metrics.
|
|
42
|
+
*/
|
|
43
|
+
export declare const computeFigmaConnectorMetrics: (ir: QualityIntelligenceFigma.ScreenIrResult, snapshot: FigmaSnapshot, augmentation: FigmaAugmentationTally, extras?: FigmaConnectorMetricsExtras) => FigmaConnectorMetrics;
|
|
44
|
+
//# sourceMappingURL=figmaConnectorMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figmaConnectorMetrics.d.ts","sourceRoot":"","sources":["../../../src/qualityIntelligence/figma/figmaConnectorMetrics.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,mGAAmG;AACnG,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,iGAAiG;IACjG,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC;AAED,oGAAoG;AACpG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,iGAAiG;AACjG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mGAAmG;IACnG,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;CAClC;AAED,qEAAqE;AACrE,MAAM,WAAW,2BAA2B;IAC1C,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AA2BD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACvC,IAAI,wBAAwB,CAAC,cAAc,EAC3C,UAAU,aAAa,EACvB,cAAc,sBAAsB,EACpC,SAAQ,2BAAgC,KACvC,qBAWF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Operational metrics for the Figma connector (Epic #750, Issue #760).
|
|
2
|
+
//
|
|
3
|
+
// A small, typed, PURE structure derived ENTIRELY from the stored Snapshot boundary inputs — the
|
|
4
|
+
// deterministic Screen-IR (#752) and the assembled Snapshot (#753) — plus a decoupled augmentation
|
|
5
|
+
// tally. Figma is never contacted here; metrics read only what the bounded snapshot-build already
|
|
6
|
+
// produced.
|
|
7
|
+
//
|
|
8
|
+
// GOVERNANCE (load-bearing, #760): every field is a NUMBER. No screen name, no board id / link /
|
|
9
|
+
// name, no design content, no token ever enters this structure. The augmentation tally is supplied
|
|
10
|
+
// by the QI source (#754) as two integers; this module does not inspect any test/candidate content.
|
|
11
|
+
//
|
|
12
|
+
// Optional `navGraph` and `a11y` are OMITTED ENTIRELY when their inputs are absent — the navigation
|
|
13
|
+
// graph (#811) and a11y baseline (#812) are not merged yet, and a later child wires them in
|
|
14
|
+
// additively. We never emit a zero/placeholder for an unmerged capability, so "absent" stays
|
|
15
|
+
// distinguishable from "present and zero".
|
|
16
|
+
const ROUND = 10_000;
|
|
17
|
+
const roundShare = (value) => Math.round(value * ROUND) / ROUND;
|
|
18
|
+
const computeShare = (tally) => {
|
|
19
|
+
const total = tally.deterministic + tally.modelAugmented;
|
|
20
|
+
return {
|
|
21
|
+
deterministic: tally.deterministic,
|
|
22
|
+
modelAugmented: tally.modelAugmented,
|
|
23
|
+
modelAugmentedShare: total === 0 ? 0 : roundShare(tally.modelAugmented / total),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const countDesignTokens = (tokens) => tokens.colors.length + tokens.typography.length + tokens.spacing.length + tokens.radius.length;
|
|
27
|
+
// The navigation graph is present whenever the IR carried any screens or links — i.e. the source
|
|
28
|
+
// material for #811 exists. We never synthesise it from nothing: an empty IR yields no nav graph.
|
|
29
|
+
const navGraphOf = (ir) => {
|
|
30
|
+
if (ir.screens.length === 0 && ir.links.length === 0)
|
|
31
|
+
return undefined;
|
|
32
|
+
return { screens: ir.screens.length, transitions: ir.links.length };
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Compute the operational metrics from the deterministic IR, the assembled Snapshot, the
|
|
36
|
+
* augmentation tally, and any additive sibling inputs. Pure: same inputs → byte-identical metrics.
|
|
37
|
+
*/
|
|
38
|
+
export const computeFigmaConnectorMetrics = (ir, snapshot, augmentation, extras = {}) => {
|
|
39
|
+
const navGraph = navGraphOf(ir);
|
|
40
|
+
return {
|
|
41
|
+
reductionRatio: ir.reduction.removedRatio,
|
|
42
|
+
screenCount: ir.screens.length,
|
|
43
|
+
renderCount: snapshot.screens.length,
|
|
44
|
+
designTokenCount: countDesignTokens(ir.tokens),
|
|
45
|
+
augmentation: computeShare(augmentation),
|
|
46
|
+
...(navGraph !== undefined ? { navGraph } : {}),
|
|
47
|
+
...(extras.a11yFindings !== undefined ? { a11y: { findings: extras.a11yFindings } } : {}),
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { FigmaScopeRef } from "./figmaScopeRef.js";
|
|
2
|
+
export declare const FIGMA_CONSENT_SCHEMA_VERSION: 1;
|
|
3
|
+
/**
|
|
4
|
+
* Display-only list of the least-privilege, read-only Figma scopes the connector relies on. Shown to
|
|
5
|
+
* the operator before the first fetch so they can confirm the PAT they minted is read-only. The
|
|
6
|
+
* connector reads file content and renders images; it never writes. This is the human-readable
|
|
7
|
+
* expectation for an out-of-band PAT grant, not an enforced grant.
|
|
8
|
+
*/
|
|
9
|
+
export declare const EXPECTED_FIGMA_SCOPES: readonly string[];
|
|
10
|
+
export interface FigmaScopeConsent {
|
|
11
|
+
readonly figmaConsentSchemaVersion: typeof FIGMA_CONSENT_SCHEMA_VERSION;
|
|
12
|
+
readonly scopeRef: FigmaScopeRef;
|
|
13
|
+
/** Always true once recorded: the operator acknowledged the read-only, least-privilege scope. */
|
|
14
|
+
readonly readOnlyAcknowledged: true;
|
|
15
|
+
/** Display-only echo of the scopes acknowledged. No token, no board reference. */
|
|
16
|
+
readonly acknowledgedScopes: readonly string[];
|
|
17
|
+
readonly acknowledgedBy: string;
|
|
18
|
+
readonly acknowledgedAt: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const loadReadOnlyConsent: (scopeRef: FigmaScopeRef, evidenceDir: string) => FigmaScopeConsent | undefined;
|
|
21
|
+
export declare const hasReadOnlyConsent: (scopeRef: FigmaScopeRef, evidenceDir: string) => boolean;
|
|
22
|
+
export interface RecordReadOnlyConsentInput {
|
|
23
|
+
readonly scopeRef: FigmaScopeRef;
|
|
24
|
+
readonly evidenceDir: string;
|
|
25
|
+
readonly acknowledgedBy: string;
|
|
26
|
+
readonly now: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Record the operator's explicit acknowledgement of the read-only, least-privilege scope. Idempotent
|
|
30
|
+
* by overwrite (re-acknowledging refreshes the timestamp). Returns the stored consent record.
|
|
31
|
+
*/
|
|
32
|
+
export declare const recordReadOnlyConsent: (input: RecordReadOnlyConsentInput) => FigmaScopeConsent;
|
|
33
|
+
/**
|
|
34
|
+
* Gate the first fetch on recorded consent. Throws a coded, safe error when the operator has not yet
|
|
35
|
+
* acknowledged the read-only scope for this connected scope. The connector calls this BEFORE token
|
|
36
|
+
* materialisation so an unconsented scope never reaches Figma.
|
|
37
|
+
*/
|
|
38
|
+
export declare const assertReadOnlyConsent: (scopeRef: FigmaScopeRef, evidenceDir: string) => void;
|
|
39
|
+
//# sourceMappingURL=figmaConsent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figmaConsent.d.ts","sourceRoot":"","sources":["../../../src/qualityIntelligence/figma/figmaConsent.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,eAAO,MAAM,4BAA4B,EAAG,CAAU,CAAC;AAGvD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAA0B,CAAC;AAE9E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,yBAAyB,EAAE,OAAO,4BAA4B,CAAC;IACxE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,iGAAiG;IACjG,QAAQ,CAAC,oBAAoB,EAAE,IAAI,CAAC;IACpC,kFAAkF;IAClF,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAaD,eAAO,MAAM,mBAAmB,GAC9B,UAAU,aAAa,EACvB,aAAa,MAAM,KAClB,iBAAiB,GAAG,SAAiD,CAAC;AAEzE,eAAO,MAAM,kBAAkB,GAAI,UAAU,aAAa,EAAE,aAAa,MAAM,KAAG,OACxB,CAAC;AAE3D,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,KAAG,iBAWzE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,aAAa,EAAE,aAAa,MAAM,KAAG,IAIpF,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Recorded read-only-scope consent for the Figma connector (Epic #750, Issue #760).
|
|
2
|
+
//
|
|
3
|
+
// There is NO OAuth grant flow: the operator mints a least-privilege, READ-ONLY Personal Access
|
|
4
|
+
// Token out of band. Before the FIRST scoped fetch for a connected scope, the operator must
|
|
5
|
+
// explicitly acknowledge that the configured PAT is read-only and least-privilege; this module
|
|
6
|
+
// records that acknowledgement as durable evidence. The expected scopes are DISPLAY-ONLY — the
|
|
7
|
+
// connector cannot grant or widen anything; it only shows what a least-privilege read-only token
|
|
8
|
+
// covers so the operator can confirm before the first fetch.
|
|
9
|
+
//
|
|
10
|
+
// The consent record carries NO token, NO PII, and NO board id / link / content — only the opaque
|
|
11
|
+
// `scopeRef`, the acknowledged read-only flag, an optional operator label, and a timestamp. It is
|
|
12
|
+
// persisted through the SAME reused Evidence contained-store seam as the connector audit.
|
|
13
|
+
import { createNodeContainedJsonArtifactStore, } from "@oscharko-dev/keiko-evidence";
|
|
14
|
+
import { FigmaConnectorError } from "./figmaConnectorErrors.js";
|
|
15
|
+
export const FIGMA_CONSENT_SCHEMA_VERSION = 1;
|
|
16
|
+
const FIGMA_CONSENT_SUFFIX = ".figma-consent.json";
|
|
17
|
+
/**
|
|
18
|
+
* Display-only list of the least-privilege, read-only Figma scopes the connector relies on. Shown to
|
|
19
|
+
* the operator before the first fetch so they can confirm the PAT they minted is read-only. The
|
|
20
|
+
* connector reads file content and renders images; it never writes. This is the human-readable
|
|
21
|
+
* expectation for an out-of-band PAT grant, not an enforced grant.
|
|
22
|
+
*/
|
|
23
|
+
export const EXPECTED_FIGMA_SCOPES = ["file_content:read"];
|
|
24
|
+
const parseConsent = (value) => {
|
|
25
|
+
if (typeof value !== "object" || value === null)
|
|
26
|
+
return undefined;
|
|
27
|
+
const record = value;
|
|
28
|
+
if (record.figmaConsentSchemaVersion !== FIGMA_CONSENT_SCHEMA_VERSION)
|
|
29
|
+
return undefined;
|
|
30
|
+
if (typeof record.scopeRef !== "string" || record.readOnlyAcknowledged !== true)
|
|
31
|
+
return undefined;
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
34
|
+
const storeFor = (evidenceDir) => createNodeContainedJsonArtifactStore(evidenceDir, FIGMA_CONSENT_SUFFIX, { parse: parseConsent });
|
|
35
|
+
export const loadReadOnlyConsent = (scopeRef, evidenceDir) => storeFor(evidenceDir).load(scopeRef);
|
|
36
|
+
export const hasReadOnlyConsent = (scopeRef, evidenceDir) => loadReadOnlyConsent(scopeRef, evidenceDir) !== undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Record the operator's explicit acknowledgement of the read-only, least-privilege scope. Idempotent
|
|
39
|
+
* by overwrite (re-acknowledging refreshes the timestamp). Returns the stored consent record.
|
|
40
|
+
*/
|
|
41
|
+
export const recordReadOnlyConsent = (input) => {
|
|
42
|
+
const consent = {
|
|
43
|
+
figmaConsentSchemaVersion: FIGMA_CONSENT_SCHEMA_VERSION,
|
|
44
|
+
scopeRef: input.scopeRef,
|
|
45
|
+
readOnlyAcknowledged: true,
|
|
46
|
+
acknowledgedScopes: EXPECTED_FIGMA_SCOPES,
|
|
47
|
+
acknowledgedBy: input.acknowledgedBy,
|
|
48
|
+
acknowledgedAt: input.now,
|
|
49
|
+
};
|
|
50
|
+
storeFor(input.evidenceDir).record(input.scopeRef, consent);
|
|
51
|
+
return consent;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Gate the first fetch on recorded consent. Throws a coded, safe error when the operator has not yet
|
|
55
|
+
* acknowledged the read-only scope for this connected scope. The connector calls this BEFORE token
|
|
56
|
+
* materialisation so an unconsented scope never reaches Figma.
|
|
57
|
+
*/
|
|
58
|
+
export const assertReadOnlyConsent = (scopeRef, evidenceDir) => {
|
|
59
|
+
if (!hasReadOnlyConsent(scopeRef, evidenceDir)) {
|
|
60
|
+
throw new FigmaConnectorError("FIGMA_CONSENT_REQUIRED");
|
|
61
|
+
}
|
|
62
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type OutboundHttpEgressConfig } from "@oscharko-dev/keiko-model-gateway/internal/http";
|
|
2
|
+
export interface FigmaHttpRequest {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
5
|
+
}
|
|
6
|
+
export interface FigmaHttpResponse {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly json: unknown;
|
|
9
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
10
|
+
}
|
|
11
|
+
export type FigmaHttpPort = (request: FigmaHttpRequest) => Promise<FigmaHttpResponse>;
|
|
12
|
+
/** Optional creation-time overrides for the default HTTP port. */
|
|
13
|
+
export interface FigmaHttpPortOptions {
|
|
14
|
+
readonly timeoutMs?: number;
|
|
15
|
+
readonly maxResponseBytes?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Thin default adapter over the platform `fetch`. This is the ONLY place `fetch` is named.
|
|
19
|
+
* It forwards the caller-built headers verbatim and reads the body as JSON with an explicit
|
|
20
|
+
* byte cap; it does not log, retry, or inspect the token. Resilience/backoff is out of scope
|
|
21
|
+
* here (#759); the proxy/custom-CA transport is the platform prerequisite (#802) that replaces
|
|
22
|
+
* this adapter.
|
|
23
|
+
*
|
|
24
|
+
* `redirect: "manual"` prevents the PAT auth header from following a cross-origin redirect.
|
|
25
|
+
* A 3xx response surfaces as a non-2xx port result; the connector treats non-2xx as upstream error.
|
|
26
|
+
*/
|
|
27
|
+
export declare const createDefaultFigmaHttpPort: (egress?: OutboundHttpEgressConfig, fetchImpl?: typeof fetch, options?: FigmaHttpPortOptions) => FigmaHttpPort;
|
|
28
|
+
//# sourceMappingURL=figmaHttpPort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figmaHttpPort.d.ts","sourceRoot":"","sources":["../../../src/qualityIntelligence/figma/figmaHttpPort.ts"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,iDAAiD,CAAC;AAQzD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAGvB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEtF,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAYD;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACrC,SAAS,wBAAwB,EACjC,YAAY,OAAO,KAAK,EACxB,UAAU,oBAAoB,KAC7B,aA4BF,CAAC"}
|