noteconnection 1.7.0 → 1.9.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/LICENSE +674 -21
- package/README.md +260 -1626
- package/dist/src/agent_workspace.contract.parity.test.js +159 -0
- package/dist/src/agent_workspace.frontend.test.js +10388 -0
- package/dist/src/agent_workspace.locale.contract.test.js +95 -0
- package/dist/src/agent_workspace.runtime.behavior.test.js +5072 -0
- package/dist/src/android.knowledgebase.picker.contract.test.js +102 -0
- package/dist/src/appimage.patchelf.test.js +113 -0
- package/dist/src/appimage.portability.test.js +156 -0
- package/dist/src/backend/FileLoader.js +18 -4
- package/dist/src/backend/FileLoader.test.js +125 -0
- package/dist/src/backend/GraphBuilder.identity.test.js +86 -0
- package/dist/src/backend/GraphBuilder.js +66 -18
- package/dist/src/backend/GraphBuilder.matching.test.js +127 -0
- package/dist/src/backend/GraphMetrics.js +0 -3
- package/dist/src/backend/ResourceIdentity.js +155 -0
- package/dist/src/backend/ResourceIdentity.test.js +113 -0
- package/dist/src/backend/algorithms/CycleDetection.js +0 -1
- package/dist/src/backend/algorithms/HybridEngine.js +0 -3
- package/dist/src/backend/algorithms/LayoutEngine.js +0 -1
- package/dist/src/backend/algorithms/StatisticalAnalyzer.js +0 -4
- package/dist/src/backend/algorithms/TopologicalSort.js +0 -2
- package/dist/src/backend/build_dag.js +0 -1
- package/dist/src/capacitor.bridge.serialization.contract.test.js +3 -0
- package/dist/src/capacitor.runtime.contract.test.js +11 -2
- package/dist/src/copy.assets.contract.test.js +130 -0
- package/dist/src/core/Graph.js +138 -42
- package/dist/src/core/Graph.test.js +74 -0
- package/dist/src/core/NoteConnection.js +2 -2
- package/dist/src/core/PathBridge.js +293 -5
- package/dist/src/core/ResourceReference.js +17 -0
- package/dist/src/desktop.godot.pack.test.js +142 -0
- package/dist/src/desktop.runtime.graph.test.js +66 -0
- package/dist/src/export/WorkspaceExportBundle.js +1174 -0
- package/dist/src/export/WorkspaceExportBundle.test.js +1541 -0
- package/dist/src/export/index.js +18 -0
- package/dist/src/export/types.js +2 -0
- package/dist/src/fixrisk.issue.verifier.contract.test.js +3 -1
- package/dist/src/foundation.ann.runtime.contract.test.js +81 -0
- package/dist/src/foundation.release.evidence.contract.test.js +524 -0
- package/dist/src/foundation.sqlite.runtime.contract.test.js +88 -0
- package/dist/src/frontend/README.md +260 -1626
- package/dist/src/frontend/agent_workspace.js +6011 -0
- package/dist/src/frontend/agent_workspace_runtime.js +4434 -0
- package/dist/src/frontend/analysis.js +31 -4
- package/dist/src/frontend/app.js +2178 -62
- package/dist/src/frontend/focus_mode_interactions.js +33 -0
- package/dist/src/frontend/godot_future_path_renderer.js +540 -0
- package/dist/src/frontend/godot_tree_interactions.js +178 -0
- package/dist/src/frontend/graph_state.mjs +105 -0
- package/dist/src/frontend/hosted_future_path_runtime.js +157 -0
- package/dist/src/frontend/i18n.mjs +186 -0
- package/dist/src/frontend/index.html +672 -268
- package/dist/src/frontend/knowledge_projection_contract.js +230 -0
- package/dist/src/frontend/knowledge_projection_store.js +214 -0
- package/dist/src/frontend/layout_gpu.js +12 -4
- package/dist/src/frontend/libs/path_core.js +158 -42
- package/dist/src/frontend/locales/en.json +753 -5
- package/dist/src/frontend/locales/zh.json +753 -5
- package/dist/src/frontend/main.mjs +60 -0
- package/dist/src/frontend/markdown_runtime.js +827 -0
- package/dist/src/frontend/mobile_budget_runtime.js +33 -0
- package/dist/src/frontend/mobile_exact_analyzer.js +393 -0
- package/dist/src/frontend/mobile_identity_contract.js +221 -0
- package/dist/src/frontend/mobile_semantic_comparator.js +264 -0
- package/dist/src/frontend/notemd.css +49 -0
- package/dist/src/frontend/notemd.html +7 -1
- package/dist/src/frontend/notemd.js +64 -0
- package/dist/src/frontend/path.html +113 -2
- package/dist/src/frontend/path_app.js +2108 -130
- package/dist/src/frontend/path_layout.mjs +143 -0
- package/dist/src/frontend/path_mermaid_utils.mjs +108 -0
- package/dist/src/frontend/path_modules_bridge.js +486 -0
- package/dist/src/frontend/path_state.mjs +118 -0
- package/dist/src/frontend/path_styles.css +146 -0
- package/dist/src/frontend/path_worker_bridge.mjs +85 -0
- package/dist/src/frontend/reader.js +393 -33
- package/dist/src/frontend/runtime_bridge.js +67 -54
- package/dist/src/frontend/runtime_bridge.mjs +279 -0
- package/dist/src/frontend/settings.js +130 -12
- package/dist/src/frontend/simulationWorker.js +1 -1
- package/dist/src/frontend/source_manager.js +297 -22
- package/dist/src/frontend/storage_provider.js +661 -71
- package/dist/src/frontend/styles.css +2814 -72
- package/dist/src/frontend/workbench_state.mjs +101 -0
- package/dist/src/frontend/workspace_panes.js +10272 -0
- package/dist/src/frontend.locale.contract.test.js +62 -0
- package/dist/src/frontend.runtime.assets.contract.test.js +81 -0
- package/dist/src/godot.sidecar.bootstrap.contract.test.js +244 -0
- package/dist/src/graph.answer.operator.contract.test.js +72 -0
- package/dist/src/index.js +6 -2
- package/dist/src/index.knowledge-root.test.js +118 -0
- package/dist/src/indexing/IndexLifecycle.js +217 -0
- package/dist/src/indexing/IndexLifecycle.test.js +73 -0
- package/dist/src/indexing/SegmentBuilder.js +64 -0
- package/dist/src/indexing/UnitBuilder.js +48 -0
- package/dist/src/indexing/types.js +2 -0
- package/dist/src/knowledge.api.contract.test.js +172 -0
- package/dist/src/knowledge_projection.contract.test.js +134 -0
- package/dist/src/knowledge_projection_store.test.js +200 -0
- package/dist/src/learning/AnswerQualityEvaluation.js +153 -0
- package/dist/src/learning/AnswerQualityEvaluation.test.js +118 -0
- package/dist/src/learning/KnowledgeLearningPlatform.js +11181 -0
- package/dist/src/learning/KnowledgeLearningPlatform.persistence.test.js +745 -0
- package/dist/src/learning/KnowledgeLearningPlatform.program-f.test.js +99 -0
- package/dist/src/learning/KnowledgeLearningPlatform.test.js +3208 -0
- package/dist/src/learning/KnowledgeWorkspaceConversationRegression.js +2998 -0
- package/dist/src/learning/KnowledgeWorkspaceConversationRegression.test.js +3936 -0
- package/dist/src/learning/MeasurementEvidenceConflicts.test.js +78 -0
- package/dist/src/learning/PublicAnswerContract.test.js +85 -0
- package/dist/src/learning/PublicEvidenceSelection.test.js +94 -0
- package/dist/src/learning/PublicMeasurementDisclosure.test.js +54 -0
- package/dist/src/learning/agentConversationExecution.js +211 -0
- package/dist/src/learning/agentConversationExecution.test.js +209 -0
- package/dist/src/learning/agentConversationSerialization.js +266 -0
- package/dist/src/learning/agentConversationSerialization.test.js +165 -0
- package/dist/src/learning/agentResponseBudget.js +179 -0
- package/dist/src/learning/agentResponseBudget.test.js +97 -0
- package/dist/src/learning/agentWorkspaceCapabilityContracts.js +65 -0
- package/dist/src/learning/answerReleaseReview.js +5260 -0
- package/dist/src/learning/answerReleaseReview.test.js +4174 -0
- package/dist/src/learning/answerTaskPlan.js +473 -0
- package/dist/src/learning/api.js +2 -0
- package/dist/src/learning/conversationComposer.js +1721 -0
- package/dist/src/learning/conversationComposer.test.js +3220 -0
- package/dist/src/learning/domains/ConversationManager.js +53 -0
- package/dist/src/learning/domains/KnowledgeIngestor.js +238 -0
- package/dist/src/learning/domains/KnowledgeQuerier.js +187 -0
- package/dist/src/learning/domains/MasteryEngine.js +387 -0
- package/dist/src/learning/domains/MemoryPolicyManager.js +408 -0
- package/dist/src/learning/domains/QualityEvaluator.js +307 -0
- package/dist/src/learning/domains/TutorRouter.js +313 -0
- package/dist/src/learning/domains/index.js +33 -0
- package/dist/src/learning/domains/types.js +7 -0
- package/dist/src/learning/errors.js +29 -0
- package/dist/src/learning/evidenceContextAssembler.js +1368 -0
- package/dist/src/learning/evidenceContextAssembler.test.js +6332 -0
- package/dist/src/learning/graphAnswerCoverage.js +37 -0
- package/dist/src/learning/graphAnswerCoverage.test.js +93 -0
- package/dist/src/learning/graphAnswerCoverageCalibration.js +59 -0
- package/dist/src/learning/graphAnswerCoverageCalibration.test.js +46 -0
- package/dist/src/learning/graphAnswerFacts.js +94 -0
- package/dist/src/learning/graphAnswerFacts.test.js +39 -0
- package/dist/src/learning/graphAnswerPlan.js +908 -0
- package/dist/src/learning/graphAnswerPlan.test.js +907 -0
- package/dist/src/learning/graphAnswerQualityCalibration.js +255 -0
- package/dist/src/learning/graphAnswerQualityCalibration.test.js +72 -0
- package/dist/src/learning/graphAnswerQualityPolicy.js +30 -0
- package/dist/src/learning/graphClaimMatcher.js +104 -0
- package/dist/src/learning/graphConditionedContext.js +109 -0
- package/dist/src/learning/graphConditionedContext.test.js +99 -0
- package/dist/src/learning/graphContextAssembler.js +860 -0
- package/dist/src/learning/graphContextAssembler.test.js +1033 -0
- package/dist/src/learning/graphExpansionPolicy.js +22 -0
- package/dist/src/learning/graphExpansionPolicy.test.js +33 -0
- package/dist/src/learning/identityMetadata.test.js +26 -0
- package/dist/src/learning/index.js +29 -0
- package/dist/src/learning/mobileAnswerProjection.js +104 -0
- package/dist/src/learning/mobileAnswerProjection.test.js +102 -0
- package/dist/src/learning/queryBackend.js +1922 -0
- package/dist/src/learning/queryBackend.test.js +976 -0
- package/dist/src/learning/ragContextPack.js +356 -0
- package/dist/src/learning/ragContextPack.test.js +311 -0
- package/dist/src/learning/ragEvidenceQuality.js +96 -0
- package/dist/src/learning/ragEvidenceQuality.test.js +29 -0
- package/dist/src/learning/ragPublicText.js +101 -0
- package/dist/src/learning/ragPublicText.test.js +57 -0
- package/dist/src/learning/ragSufficiencyJudge.js +171 -0
- package/dist/src/learning/ragSufficiencyJudge.test.js +177 -0
- package/dist/src/learning/ragSufficiencyProviderJudge.js +217 -0
- package/dist/src/learning/ragSufficiencyProviderJudge.test.js +207 -0
- package/dist/src/learning/requestNormalization.js +304 -0
- package/dist/src/learning/requestNormalization.test.js +101 -0
- package/dist/src/learning/runtimeCapability.js +4677 -0
- package/dist/src/learning/runtimeCapability.test.js +3635 -0
- package/dist/src/learning/store.js +1344 -0
- package/dist/src/learning/store.test.js +1425 -0
- package/dist/src/learning/tutorAdapter.js +2 -0
- package/dist/src/learning/types.js +2 -0
- package/dist/src/learning/vectorAccelerationAdapter.js +958 -0
- package/dist/src/learning/vectorAccelerationAdapter.test.js +412 -0
- package/dist/src/learning/workspaceHydration.js +168 -0
- package/dist/src/learning/workspaceHydration.test.js +30 -0
- package/dist/src/lfs.asset.policy.contract.test.js +153 -0
- package/dist/src/license.policy.contract.test.js +71 -0
- package/dist/src/markdown/MarkdownGateway.js +4 -0
- package/dist/src/markdown/MarkdownGateway.test.js +59 -0
- package/dist/src/memory/MemoryGovernance.js +74 -0
- package/dist/src/memory/MemoryGovernance.test.js +46 -0
- package/dist/src/memory/types.js +2 -0
- package/dist/src/mermaid.frontend.guard.contract.test.js +77 -0
- package/dist/src/middleware/SseResponseWriter.js +122 -0
- package/dist/src/middleware/SseResponseWriter.test.js +54 -0
- package/dist/src/middleware/auth.js +38 -0
- package/dist/src/middleware/auth.test.js +33 -0
- package/dist/src/middleware/body-parser.js +45 -0
- package/dist/src/middleware/cors.js +44 -0
- package/dist/src/middleware/index.js +22 -0
- package/dist/src/middleware/request-trace.js +96 -0
- package/dist/src/mobile.android.evidence.contract.test.js +146 -0
- package/dist/src/mobile.android.signing.contract.test.js +66 -0
- package/dist/src/mobile.artifact.contract.test.js +144 -0
- package/dist/src/mobile.budget.contract.test.js +90 -0
- package/dist/src/mobile.canonical-id.readiness.test.js +54 -0
- package/dist/src/mobile.graph.parity.contract.test.js +207 -0
- package/dist/src/mobile.identity.contract.test.js +66 -0
- package/dist/src/mobile.identity.corpus.manifest.test.js +72 -0
- package/dist/src/mobile.identity.corpus.test.js +40 -0
- package/dist/src/mobile.native.recovery.contract.test.js +64 -0
- package/dist/src/mobile.pipeline.test.js +11 -1
- package/dist/src/mobile.profile.contract.test.js +225 -0
- package/dist/src/mobile.semantic.parity.test.js +92 -0
- package/dist/src/mobile_exact_analyzer.test.js +113 -0
- package/dist/src/notemd/AppConfigToml.js +6 -4
- package/dist/src/notemd/ContentGenerator.js +4 -9
- package/dist/src/notemd/FileProcessor.js +4 -9
- package/dist/src/notemd/MermaidProcessor.js +400 -50
- package/dist/src/notemd/NotemdService.js +506 -26
- package/dist/src/notemd/PromptManager.js +15 -0
- package/dist/src/notemd/Translator.js +4 -9
- package/dist/src/notemd/cli/commands.js +357 -0
- package/dist/src/notemd/cli/dispatcher.js +225 -0
- package/dist/src/notemd/cli/index.js +169 -0
- package/dist/src/notemd/cli/parser.js +68 -0
- package/dist/src/notemd/cli/types.js +2 -0
- package/dist/src/notemd/constants.js +43 -0
- package/dist/src/notemd/diagram/diagramGenerationService.js +78 -0
- package/dist/src/notemd/diagram/diagramSpec.js +79 -0
- package/dist/src/notemd/diagram/diagramSpecResponseParser.js +131 -0
- package/dist/src/notemd/diagram/intent.js +95 -0
- package/dist/src/notemd/diagram/planner.js +71 -0
- package/dist/src/notemd/diagram/prompts/diagramSpecPrompt.js +42 -0
- package/dist/src/notemd/diagram/types.js +18 -0
- package/dist/src/notemd/index.js +26 -0
- package/dist/src/notemd/operations/capabilityManifest.js +23 -0
- package/dist/src/notemd/operations/cliContracts.js +17 -0
- package/dist/src/notemd/operations/configProfileCommands.js +85 -0
- package/dist/src/notemd/operations/registry.contract.test.js +95 -0
- package/dist/src/notemd/operations/registry.js +991 -0
- package/dist/src/notemd/operations/types.js +2 -0
- package/dist/src/notemd/progressReporter.js +9 -0
- package/dist/src/notemd/providerDiagnostics.js +220 -0
- package/dist/src/notemd/providerProfiles.js +42 -0
- package/dist/src/notemd/providerTemplates.js +231 -0
- package/dist/src/notemd/search/DuckDuckGoProvider.js +39 -0
- package/dist/src/notemd/search/SearchManager.js +13 -0
- package/dist/src/notemd/search/SearchProvider.js +2 -0
- package/dist/src/notemd/search/TavilyProvider.js +44 -0
- package/dist/src/notemd.agent.manifest.test.js +85 -0
- package/dist/src/notemd.api.contract.test.js +14 -1
- package/dist/src/notemd.app_config_toml.test.js +2 -1
- package/dist/src/notemd.batch.workflow.test.js +117 -0
- package/dist/src/notemd.cli.e2e.test.js +136 -0
- package/dist/src/notemd.core.test.js +51 -0
- package/dist/src/notemd.diagram.pipeline.test.js +233 -0
- package/dist/src/notemd.providerTemplates.test.js +34 -0
- package/dist/src/notemd.server.integration.test.js +262 -39
- package/dist/src/notemd.workflow.pipeline.test.js +162 -0
- package/dist/src/pathbridge.handshake.contract.test.js +45 -2
- package/dist/src/pathbridge.host-adapter.contract.test.js +133 -0
- package/dist/src/pathcore.bundle.contract.test.js +8 -0
- package/dist/src/pathmode.background.contract.test.js +69 -0
- package/dist/src/pathmode.settings.api.contract.test.js +9 -0
- package/dist/src/pkg.sidecar.contract.test.js +9 -3
- package/dist/src/platform/ExportProfile.js +86 -0
- package/dist/src/platform/MobileBudget.js +11 -0
- package/dist/src/platform/PlatformCapabilities.js +59 -0
- package/dist/src/platform/PlatformCapabilities.test.js +36 -0
- package/dist/src/platform/RenderMaterializer.js +33 -0
- package/dist/src/platform/RenderMaterializer.test.js +32 -0
- package/dist/src/query_backend.external_http.integration.test.js +410 -0
- package/dist/src/reader_renderer.js +404 -3
- package/dist/src/reader_renderer.test.js +87 -0
- package/dist/src/release.godot.mirror.contract.test.js +97 -0
- package/dist/src/resources/ResourceRegistry.js +263 -0
- package/dist/src/resources/ResourceRegistry.test.js +97 -0
- package/dist/src/resources/types.js +2 -0
- package/dist/src/routes/agentWorkspaceDiagnostics.js +173 -0
- package/dist/src/routes/index.js +19 -0
- package/dist/src/routes/knowledge.js +981 -0
- package/dist/src/routes/knowledgePayload.js +185 -0
- package/dist/src/routes/knowledgePayload.test.js +53 -0
- package/dist/src/routes/markdown.js +295 -0
- package/dist/src/routes/notemd.js +1321 -0
- package/dist/src/routes/registry.contract.test.js +133 -0
- package/dist/src/routes/registry.shadow.contract.test.js +22 -0
- package/dist/src/routes/render.js +248 -0
- package/dist/src/routes/runtimeRunbookRouteOps.js +149 -0
- package/dist/src/routes/runtimeRunbookRouteOps.test.js +194 -0
- package/dist/src/routes/settings.js +6 -0
- package/dist/src/routes/staticFiles.js +94 -0
- package/dist/src/routes/types.js +2 -0
- package/dist/src/runtime.capabilities.test.js +18 -2
- package/dist/src/runtime.transport.adapter.contract.test.js +81 -0
- package/dist/src/server.js +10342 -1325
- package/dist/src/server.migration.test.js +584 -10
- package/dist/src/server.port.fallback.contract.test.js +63 -0
- package/dist/src/session/SessionStateStore.js +81 -0
- package/dist/src/session/SessionStateStore.test.js +58 -0
- package/dist/src/session/types.js +2 -0
- package/dist/src/settings.runtime.contract.test.js +50 -0
- package/dist/src/shared/types.contract.test.js +107 -0
- package/dist/src/shared/types.js +22 -0
- package/dist/src/sidecar.build.lock.contract.test.js +201 -0
- package/dist/src/sidecar.freshness.contract.test.js +184 -0
- package/dist/src/sidecar.replacement.boundary.contract.test.js +131 -0
- package/dist/src/sidecar.supply.readiness.contract.test.js +155 -0
- package/dist/src/simulation.worker.offline.test.js +104 -0
- package/dist/src/source_manager.loadflow.test.js +46 -0
- package/dist/src/startup.layout.snapshot.contract.test.js +57 -0
- package/dist/src/storage.provider.capacitor.content.contract.test.js +4 -1
- package/dist/src/storage.provider.contract.test.js +152 -1
- package/dist/src/tauri.frontend.build.contract.test.js +68 -0
- package/dist/src/tauri.sidecar.cleanup.contract.test.js +21 -0
- package/dist/src/tauri.window.evidence.execution.test.js +68 -0
- package/dist/src/utils/RuntimePaths.js +10 -13
- package/dist/src/utils/RuntimePaths.test.js +27 -0
- package/dist/src/utils/platform.js +153 -0
- package/dist/src/windows.installer.build.test.js +109 -0
- package/dist/src/windows.installer.payload.test.js +76 -0
- package/dist/src/windows.installer.runtime.test.js +69 -0
- package/dist/src/workflows/WorkflowArtifactStore.js +96 -0
- package/dist/src/workflows/WorkflowArtifactStore.test.js +80 -0
- package/dist/src/workflows/types.js +2 -0
- package/dist/src/workspace/WorkspaceRegistry.js +135 -0
- package/dist/src/workspace/WorkspaceRegistry.test.js +29 -0
- package/dist/src/workspace/types.js +2 -0
- package/package.json +80 -15
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getPlatform = getPlatform;
|
|
37
|
+
exports.getAppDataDir = getAppDataDir;
|
|
38
|
+
exports.getConfigDir = getConfigDir;
|
|
39
|
+
exports.getCacheDir = getCacheDir;
|
|
40
|
+
exports.getSidecarName = getSidecarName;
|
|
41
|
+
exports.getGodotEnv = getGodotEnv;
|
|
42
|
+
const os = __importStar(require("os"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const cachedPlatform = detectPlatform();
|
|
45
|
+
function detectPlatform() {
|
|
46
|
+
const rawOs = process.platform;
|
|
47
|
+
const rawArch = process.arch;
|
|
48
|
+
let osName;
|
|
49
|
+
if (rawOs === 'linux')
|
|
50
|
+
osName = 'linux';
|
|
51
|
+
else if (rawOs === 'darwin')
|
|
52
|
+
osName = 'macos';
|
|
53
|
+
else if (rawOs === 'win32')
|
|
54
|
+
osName = 'windows';
|
|
55
|
+
else if (rawOs === 'android')
|
|
56
|
+
osName = 'android';
|
|
57
|
+
else
|
|
58
|
+
osName = 'unknown';
|
|
59
|
+
let archName;
|
|
60
|
+
if (rawArch === 'x64')
|
|
61
|
+
archName = 'x64';
|
|
62
|
+
else if (rawArch === 'arm64')
|
|
63
|
+
archName = 'arm64';
|
|
64
|
+
else
|
|
65
|
+
archName = 'unknown';
|
|
66
|
+
const triplet = buildTargetTriple(osName, archName);
|
|
67
|
+
const exeSuffix = osName === 'windows' ? '.exe' : '';
|
|
68
|
+
const isWayland = osName === 'linux' && process.env.XDG_SESSION_TYPE === 'wayland';
|
|
69
|
+
return { os: osName, arch: archName, triplet, exeSuffix, isWayland };
|
|
70
|
+
}
|
|
71
|
+
function buildTargetTriple(osName, archName) {
|
|
72
|
+
switch (osName) {
|
|
73
|
+
case 'linux':
|
|
74
|
+
return `x86_64-unknown-linux-gnu`;
|
|
75
|
+
case 'macos':
|
|
76
|
+
return archName === 'arm64'
|
|
77
|
+
? 'aarch64-apple-darwin'
|
|
78
|
+
: 'x86_64-apple-darwin';
|
|
79
|
+
case 'windows':
|
|
80
|
+
return 'x86_64-pc-windows-msvc';
|
|
81
|
+
default:
|
|
82
|
+
return `${process.arch}-unknown-${process.platform}`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function getPlatform() {
|
|
86
|
+
return cachedPlatform;
|
|
87
|
+
}
|
|
88
|
+
function getAppDataDir() {
|
|
89
|
+
const home = os.homedir();
|
|
90
|
+
const platform = cachedPlatform.os;
|
|
91
|
+
switch (platform) {
|
|
92
|
+
case 'macos':
|
|
93
|
+
return path.join(home, 'Library', 'Application Support', 'NoteConnection');
|
|
94
|
+
case 'linux': {
|
|
95
|
+
const xdgData = process.env.XDG_DATA_HOME || path.join(home, '.local', 'share');
|
|
96
|
+
return path.join(xdgData, 'NoteConnection');
|
|
97
|
+
}
|
|
98
|
+
case 'windows': {
|
|
99
|
+
const localAppData = process.env.LOCALAPPDATA || path.join(home, 'AppData', 'Local');
|
|
100
|
+
return path.join(localAppData, 'NoteConnection');
|
|
101
|
+
}
|
|
102
|
+
default:
|
|
103
|
+
return path.join(home, '.noteconnection');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function getConfigDir() {
|
|
107
|
+
const home = os.homedir();
|
|
108
|
+
const platform = cachedPlatform.os;
|
|
109
|
+
switch (platform) {
|
|
110
|
+
case 'macos':
|
|
111
|
+
return path.join(home, 'Library', 'Preferences', 'NoteConnection');
|
|
112
|
+
case 'linux': {
|
|
113
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || path.join(home, '.config');
|
|
114
|
+
return path.join(xdgConfig, 'NoteConnection');
|
|
115
|
+
}
|
|
116
|
+
case 'windows': {
|
|
117
|
+
const appData = process.env.APPDATA || path.join(home, 'AppData', 'Roaming');
|
|
118
|
+
return path.join(appData, 'NoteConnection');
|
|
119
|
+
}
|
|
120
|
+
default:
|
|
121
|
+
return path.join(home, '.config', 'noteconnection');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function getCacheDir() {
|
|
125
|
+
const home = os.homedir();
|
|
126
|
+
const platform = cachedPlatform.os;
|
|
127
|
+
switch (platform) {
|
|
128
|
+
case 'macos':
|
|
129
|
+
return path.join(home, 'Library', 'Caches', 'NoteConnection');
|
|
130
|
+
case 'linux': {
|
|
131
|
+
const xdgCache = process.env.XDG_CACHE_HOME || path.join(home, '.cache');
|
|
132
|
+
return path.join(xdgCache, 'NoteConnection');
|
|
133
|
+
}
|
|
134
|
+
case 'windows': {
|
|
135
|
+
const localAppData = process.env.LOCALAPPDATA || path.join(home, 'AppData', 'Local');
|
|
136
|
+
return path.join(localAppData, 'NoteConnection', 'Cache');
|
|
137
|
+
}
|
|
138
|
+
default:
|
|
139
|
+
return path.join(home, '.cache', 'noteconnection');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function getSidecarName(baseName) {
|
|
143
|
+
return `${baseName}-${cachedPlatform.triplet}${cachedPlatform.exeSuffix}`;
|
|
144
|
+
}
|
|
145
|
+
function getGodotEnv() {
|
|
146
|
+
if (cachedPlatform.isWayland) {
|
|
147
|
+
return {
|
|
148
|
+
GDK_BACKEND: 'x11',
|
|
149
|
+
WEBKIT_DISABLE_DMABUF_RENDERER: '1',
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {};
|
|
153
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("node:fs"));
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const node_child_process_1 = require("node:child_process");
|
|
39
|
+
jest.mock('node:child_process', () => ({ ...jest.requireActual('node:child_process'), spawnSync: jest.fn() }));
|
|
40
|
+
const { recordInstallerBuild, readInstallerBuild } = require('../scripts/verify-windows-installers');
|
|
41
|
+
describe('installer build provenance across fresh runners', () => {
|
|
42
|
+
let directory;
|
|
43
|
+
let receiptPath;
|
|
44
|
+
const environment = { GITHUB_SHA: 'a'.repeat(40), GITHUB_RUN_ID: '123', GITHUB_RUN_ATTEMPT: '1' };
|
|
45
|
+
const write = (relative, contents) => {
|
|
46
|
+
const file = path.join(directory, relative);
|
|
47
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
48
|
+
fs.writeFileSync(file, contents);
|
|
49
|
+
};
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
const temporaryRoot = path.resolve(__dirname, '../output/verification/installer-build-tests');
|
|
52
|
+
fs.mkdirSync(temporaryRoot, { recursive: true });
|
|
53
|
+
directory = fs.mkdtempSync(path.join(temporaryRoot, 'receipt-'));
|
|
54
|
+
receiptPath = path.join(directory, 'output/verification/windows-installer-build.json');
|
|
55
|
+
write('package.json', JSON.stringify({ version: '1.8.0' }));
|
|
56
|
+
write('src/fixture.ts', 'export const source = 1;');
|
|
57
|
+
write('src-tauri/target/release/npm.exe', 'PE __TAURI_BUNDLE_TYPE_VAR_UNK fixture');
|
|
58
|
+
for (const name of ['server', 'godot', 'markdown-worker'])
|
|
59
|
+
write(`src-tauri/bin/${name}-x86_64-pc-windows-msvc.exe`, name);
|
|
60
|
+
write('output/desktop/path_mode.pck', 'GDPC fixture');
|
|
61
|
+
write('src-tauri/target/release/bundle/nsis/NoteConnection_1.8.0_x64-setup.exe', 'NSIS fixture');
|
|
62
|
+
write('src-tauri/target/release/bundle/msi/NoteConnection_1.8.0_x64_en-US.msi', 'MSI fixture');
|
|
63
|
+
recordInstallerBuild(directory, environment);
|
|
64
|
+
});
|
|
65
|
+
afterEach(() => {
|
|
66
|
+
expect(node_child_process_1.spawnSync).not.toHaveBeenCalled();
|
|
67
|
+
jest.clearAllMocks();
|
|
68
|
+
fs.rmSync(directory, { recursive: true, force: true });
|
|
69
|
+
});
|
|
70
|
+
test.each(['nsis', 'msi'])('accepts %s without build dependencies, including failed-only retries', format => {
|
|
71
|
+
// A qualification runner has only source, the receipt and its installer.
|
|
72
|
+
fs.rmSync(path.join(directory, 'src-tauri/bin'), { recursive: true });
|
|
73
|
+
fs.unlinkSync(path.join(directory, 'src-tauri/target/release/npm.exe'));
|
|
74
|
+
fs.rmSync(path.join(directory, 'output/desktop'), { recursive: true });
|
|
75
|
+
const receipt = readInstallerBuild(format, directory, { ...environment, GITHUB_RUN_ATTEMPT: '2' });
|
|
76
|
+
expect(receipt.buildRunAttempt).toBe('1');
|
|
77
|
+
expect(receipt.expectedFiles[format]).toHaveLength(5);
|
|
78
|
+
expect(readInstallerBuild(format, directory, environment)).toEqual(receipt);
|
|
79
|
+
});
|
|
80
|
+
test.each([
|
|
81
|
+
['sourceRevision', 'b'.repeat(40), /source revision differs/],
|
|
82
|
+
['runId', '456', /workflow run differs/],
|
|
83
|
+
['version', '9.0.0', /version differs/],
|
|
84
|
+
['buildRunAttempt', '0', /build attempt/],
|
|
85
|
+
['buildRunAttempt', '2', /build attempt/],
|
|
86
|
+
['sourceFingerprint', {}, /source fingerprint differs/],
|
|
87
|
+
])('rejects tampered %s before executing anything', (field, replacement, message) => {
|
|
88
|
+
const receipt = JSON.parse(fs.readFileSync(receiptPath, 'utf8'));
|
|
89
|
+
receipt[field] = replacement;
|
|
90
|
+
fs.writeFileSync(receiptPath, JSON.stringify(receipt));
|
|
91
|
+
expect(() => readInstallerBuild('msi', directory, environment)).toThrow(message);
|
|
92
|
+
});
|
|
93
|
+
test.each(['name', 'path'])('rejects redirected installer %s', field => {
|
|
94
|
+
const receipt = JSON.parse(fs.readFileSync(receiptPath, 'utf8'));
|
|
95
|
+
receipt.installers.msi[field] = '../other.msi';
|
|
96
|
+
fs.writeFileSync(receiptPath, JSON.stringify(receipt));
|
|
97
|
+
expect(() => readInstallerBuild('msi', directory, environment)).toThrow(/Installer (basename|path) differs/);
|
|
98
|
+
});
|
|
99
|
+
test.each(['MSI altered', 'truncated'])('rejects altered installer bytes (%s)', contents => {
|
|
100
|
+
write('src-tauri/target/release/bundle/msi/NoteConnection_1.8.0_x64_en-US.msi', contents);
|
|
101
|
+
expect(() => readInstallerBuild('msi', directory, environment)).toThrow(/Installer (size|hash) differs/);
|
|
102
|
+
});
|
|
103
|
+
test('rejects changed source and missing receipts without recomputing build expectations', () => {
|
|
104
|
+
write('src/fixture.ts', 'export const source = 2;');
|
|
105
|
+
expect(() => readInstallerBuild('msi', directory, environment)).toThrow(/source fingerprint differs/);
|
|
106
|
+
fs.unlinkSync(receiptPath);
|
|
107
|
+
expect(() => readInstallerBuild('msi', directory, environment)).toThrow(/ENOENT/);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const os = __importStar(require("os"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const { verifyInstalledPayload, fingerprintTauriInstallerExecutable } = require('../scripts/verify-windows-installers');
|
|
40
|
+
const { sha256File } = require('../scripts/sidecar-build-fingerprint');
|
|
41
|
+
describe('installed Windows payload verification', () => {
|
|
42
|
+
let directory;
|
|
43
|
+
let expected;
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
directory = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'installed payload '));
|
|
46
|
+
fs.writeFileSync(path.join(directory, 'path_mode.pck'), 'GDPC fixture');
|
|
47
|
+
expected = [{ name: 'path_mode.pck', bytes: 12, sha256: sha256File(path.join(directory, 'path_mode.pck')) }];
|
|
48
|
+
});
|
|
49
|
+
afterEach(() => fs.rmSync(directory, { recursive: true, force: true }));
|
|
50
|
+
test('matches exact packaged bytes under paths containing spaces', () => {
|
|
51
|
+
expect(verifyInstalledPayload(directory, expected)).toEqual(expected);
|
|
52
|
+
});
|
|
53
|
+
test('rejects missing resources even when the installer reported success', () => {
|
|
54
|
+
fs.unlinkSync(path.join(directory, 'path_mode.pck'));
|
|
55
|
+
expect(() => verifyInstalledPayload(directory, expected)).toThrow(/missing path_mode.pck/);
|
|
56
|
+
});
|
|
57
|
+
test('rejects same-sized stale resources', () => {
|
|
58
|
+
fs.writeFileSync(path.join(directory, 'path_mode.pck'), 'GDPC altered');
|
|
59
|
+
expect(() => verifyInstalledPayload(directory, expected)).toThrow(/hash differs/);
|
|
60
|
+
});
|
|
61
|
+
test.each(['NSS', 'MSI'])('checks the exact Tauri %s stamp without ignoring executable bytes', (bundleCode) => {
|
|
62
|
+
const executable = path.join(directory, 'build.exe');
|
|
63
|
+
fs.writeFileSync(executable, 'PE before\0__TAURI_BUNDLE_TYPE_VAR_UNK\0PE after');
|
|
64
|
+
const fingerprint = fingerprintTauriInstallerExecutable(executable, bundleCode);
|
|
65
|
+
fs.writeFileSync(path.join(directory, 'npm.exe'), `PE before\0__TAURI_BUNDLE_TYPE_VAR_${bundleCode}\0PE after`);
|
|
66
|
+
expect(verifyInstalledPayload(directory, [fingerprint])).toEqual([fingerprint]);
|
|
67
|
+
fs.writeFileSync(path.join(directory, 'npm.exe'), `PE edited\0__TAURI_BUNDLE_TYPE_VAR_${bundleCode}\0PE after`);
|
|
68
|
+
expect(() => verifyInstalledPayload(directory, [fingerprint])).toThrow(/hash differs/);
|
|
69
|
+
expect(fs.readFileSync(executable, 'utf8')).toContain('_VAR_UNK');
|
|
70
|
+
});
|
|
71
|
+
test.each(['missing marker', '__TAURI_BUNDLE_TYPE_VAR_UNK__TAURI_BUNDLE_TYPE_VAR_UNK'])('rejects missing or ambiguous bundle stamps (%s)', (contents) => {
|
|
72
|
+
const executable = path.join(directory, 'build.exe');
|
|
73
|
+
fs.writeFileSync(executable, contents);
|
|
74
|
+
expect(() => fingerprintTauriInstallerExecutable(executable, 'NSS')).toThrow(/exactly one/);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("node:fs"));
|
|
37
|
+
const os = __importStar(require("node:os"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const node_child_process_1 = require("node:child_process");
|
|
40
|
+
jest.mock('node:child_process', () => ({ ...jest.requireActual('node:child_process'), spawnSync: jest.fn() }));
|
|
41
|
+
const { verifyInstalledRuntime } = require('../scripts/verify-windows-installers');
|
|
42
|
+
const spawn = node_child_process_1.spawnSync;
|
|
43
|
+
describe('installed runtime evidence verdict', () => {
|
|
44
|
+
let directory;
|
|
45
|
+
let run;
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
directory = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'installer-runtime-'));
|
|
48
|
+
run = path.join(directory, 'runtime');
|
|
49
|
+
fs.mkdirSync(run);
|
|
50
|
+
spawn.mockReturnValue({ status: 0, stdout: '', stderr: '' });
|
|
51
|
+
fs.writeFileSync(path.join(run, 'report.json'), JSON.stringify({ passed: true, checks: { godotLayout: true, windowTransitions: true } }));
|
|
52
|
+
fs.writeFileSync(path.join(run, 'native-debug-policy.json'), '\uFEFF' + JSON.stringify({ policyValuesRemoved: true }));
|
|
53
|
+
});
|
|
54
|
+
afterEach(() => { jest.resetAllMocks(); fs.rmSync(directory, { recursive: true, force: true }); });
|
|
55
|
+
test('accepts completed runtime evidence only after temporary policies are removed', () => {
|
|
56
|
+
expect(verifyInstalledRuntime(directory, run).passed).toBe(true);
|
|
57
|
+
expect(spawn.mock.calls[0][0]).toBe('powershell.exe');
|
|
58
|
+
expect(spawn.mock.calls[0][1]).toContain(path.resolve(__dirname, '../scripts/verify-elevated-desktop-runtime.ps1'));
|
|
59
|
+
});
|
|
60
|
+
test('rejects a successful runtime when machine policy cleanup did not complete', () => {
|
|
61
|
+
fs.writeFileSync(path.join(run, 'native-debug-policy.json'), JSON.stringify({ policyValuesRemoved: false }));
|
|
62
|
+
expect(() => verifyInstalledRuntime(directory, run)).toThrow(/policies must be removed/);
|
|
63
|
+
});
|
|
64
|
+
test('does not accept an empty successful process or lose its setup failure', () => {
|
|
65
|
+
fs.unlinkSync(path.join(run, 'report.json'));
|
|
66
|
+
spawn.mockReturnValue({ status: 1, stdout: '', stderr: 'Existing app policy cannot be overwritten' });
|
|
67
|
+
expect(() => verifyInstalledRuntime(directory, run)).toThrow(/Existing app policy cannot be overwritten/);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowArtifactStore = void 0;
|
|
4
|
+
class WorkflowArtifactStore {
|
|
5
|
+
constructor(nextId) {
|
|
6
|
+
this.nextId = nextId;
|
|
7
|
+
this.artifacts = [];
|
|
8
|
+
}
|
|
9
|
+
clonePayload(payload) {
|
|
10
|
+
return JSON.parse(JSON.stringify(payload || {}));
|
|
11
|
+
}
|
|
12
|
+
cloneArtifact(record) {
|
|
13
|
+
return {
|
|
14
|
+
...record,
|
|
15
|
+
sourceResourceIds: [...record.sourceResourceIds],
|
|
16
|
+
sourceProjectionIds: [...record.sourceProjectionIds],
|
|
17
|
+
payload: this.clonePayload(record.payload),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
recordArtifact(input) {
|
|
21
|
+
const record = {
|
|
22
|
+
artifactId: this.nextId('workflow_artifact'),
|
|
23
|
+
kind: input.kind,
|
|
24
|
+
sessionId: input.sessionId || null,
|
|
25
|
+
userId: input.userId || null,
|
|
26
|
+
workspaceId: input.workspaceId || null,
|
|
27
|
+
corpusId: input.corpusId || null,
|
|
28
|
+
title: input.title,
|
|
29
|
+
sourceResourceIds: Array.from(new Set(input.sourceResourceIds)).filter(Boolean),
|
|
30
|
+
sourceProjectionIds: Array.from(new Set(input.sourceProjectionIds)).filter(Boolean),
|
|
31
|
+
summary: input.summary,
|
|
32
|
+
payload: this.clonePayload(input.payload || {}),
|
|
33
|
+
status: input.status,
|
|
34
|
+
createdAt: input.recordedAt,
|
|
35
|
+
updatedAt: input.recordedAt,
|
|
36
|
+
};
|
|
37
|
+
this.artifacts.unshift(record);
|
|
38
|
+
if (this.artifacts.length > 400) {
|
|
39
|
+
this.artifacts.splice(400);
|
|
40
|
+
}
|
|
41
|
+
return this.cloneArtifact(record);
|
|
42
|
+
}
|
|
43
|
+
getArtifactById(artifactId) {
|
|
44
|
+
const normalizedArtifactId = String(artifactId || '').trim();
|
|
45
|
+
if (!normalizedArtifactId) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const record = this.artifacts.find((artifact) => artifact.artifactId === normalizedArtifactId);
|
|
49
|
+
return record ? this.cloneArtifact(record) : null;
|
|
50
|
+
}
|
|
51
|
+
listAll() {
|
|
52
|
+
return this.artifacts.map((record) => this.cloneArtifact(record));
|
|
53
|
+
}
|
|
54
|
+
updateArtifact(artifactId, updater) {
|
|
55
|
+
const normalizedArtifactId = String(artifactId || '').trim();
|
|
56
|
+
if (!normalizedArtifactId) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const index = this.artifacts.findIndex((artifact) => artifact.artifactId === normalizedArtifactId);
|
|
60
|
+
if (index < 0) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const current = this.cloneArtifact(this.artifacts[index]);
|
|
64
|
+
const updated = updater(current);
|
|
65
|
+
this.artifacts[index] = this.cloneArtifact(updated);
|
|
66
|
+
return this.cloneArtifact(this.artifacts[index]);
|
|
67
|
+
}
|
|
68
|
+
listBySession(sessionId) {
|
|
69
|
+
return this.artifacts
|
|
70
|
+
.filter((record) => record.sessionId === String(sessionId || '').trim())
|
|
71
|
+
.map((record) => this.cloneArtifact(record));
|
|
72
|
+
}
|
|
73
|
+
listByWorkspace(workspaceId, userId) {
|
|
74
|
+
const normalizedWorkspaceId = String(workspaceId || '').trim().toLowerCase();
|
|
75
|
+
const normalizedUserId = String(userId || '').trim();
|
|
76
|
+
if (!normalizedWorkspaceId) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
return this.artifacts
|
|
80
|
+
.filter((record) => record.workspaceId === normalizedWorkspaceId)
|
|
81
|
+
.filter((record) => !normalizedUserId || record.userId === normalizedUserId)
|
|
82
|
+
.map((record) => this.cloneArtifact(record));
|
|
83
|
+
}
|
|
84
|
+
buildSnapshot() {
|
|
85
|
+
return {
|
|
86
|
+
artifacts: this.artifacts.map((artifact) => this.cloneArtifact(artifact)),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
restoreFromSnapshot(snapshot) {
|
|
90
|
+
this.artifacts.length = 0;
|
|
91
|
+
(snapshot?.artifacts || []).forEach((artifact) => {
|
|
92
|
+
this.artifacts.push(this.cloneArtifact(artifact));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.WorkflowArtifactStore = WorkflowArtifactStore;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const WorkflowArtifactStore_1 = require("./WorkflowArtifactStore");
|
|
4
|
+
describe('WorkflowArtifactStore', () => {
|
|
5
|
+
test('records artifacts and lists them by session and workspace', () => {
|
|
6
|
+
let idCounter = 0;
|
|
7
|
+
const store = new WorkflowArtifactStore_1.WorkflowArtifactStore((prefix = 'workflow_artifact') => `${prefix}_${++idCounter}`);
|
|
8
|
+
const artifact = store.recordArtifact({
|
|
9
|
+
kind: 'knowledge_run',
|
|
10
|
+
sessionId: 'session_a',
|
|
11
|
+
userId: 'user_a',
|
|
12
|
+
workspaceId: 'optics',
|
|
13
|
+
corpusId: 'optics',
|
|
14
|
+
title: 'Knowledge run',
|
|
15
|
+
sourceResourceIds: ['resource_1'],
|
|
16
|
+
sourceProjectionIds: ['projection_1'],
|
|
17
|
+
summary: 'Evidence claims recorded',
|
|
18
|
+
payload: {
|
|
19
|
+
knowledgeRun: {
|
|
20
|
+
runId: 'knowledge_run_1',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
status: 'active',
|
|
24
|
+
recordedAt: '2026-05-26T00:00:00.000Z',
|
|
25
|
+
});
|
|
26
|
+
expect(store.listBySession('session_a')).toEqual([artifact]);
|
|
27
|
+
expect(store.listByWorkspace('optics')).toHaveLength(1);
|
|
28
|
+
const restored = new WorkflowArtifactStore_1.WorkflowArtifactStore((prefix = 'workflow_artifact') => `${prefix}_${++idCounter}`);
|
|
29
|
+
restored.restoreFromSnapshot(store.buildSnapshot());
|
|
30
|
+
expect(restored.listByWorkspace('optics')[0]?.artifactId).toBe(artifact.artifactId);
|
|
31
|
+
});
|
|
32
|
+
test('updates persisted artifacts without exposing mutable internal references', () => {
|
|
33
|
+
let idCounter = 0;
|
|
34
|
+
const store = new WorkflowArtifactStore_1.WorkflowArtifactStore((prefix = 'workflow_artifact') => `${prefix}_${++idCounter}`);
|
|
35
|
+
const artifact = store.recordArtifact({
|
|
36
|
+
kind: 'flashcard_batch',
|
|
37
|
+
sessionId: 'session_b',
|
|
38
|
+
userId: 'user_b',
|
|
39
|
+
workspaceId: 'optics',
|
|
40
|
+
corpusId: 'optics',
|
|
41
|
+
title: 'Review batch',
|
|
42
|
+
sourceResourceIds: ['resource_2'],
|
|
43
|
+
sourceProjectionIds: ['projection_2'],
|
|
44
|
+
summary: 'Prepared 1 review card.',
|
|
45
|
+
payload: {
|
|
46
|
+
reviewState: {
|
|
47
|
+
consumedCardIds: [],
|
|
48
|
+
completedReviewCardCount: 0,
|
|
49
|
+
remainingReviewCardCount: 1,
|
|
50
|
+
completedAt: null,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
status: 'active',
|
|
54
|
+
recordedAt: '2026-05-26T01:00:00.000Z',
|
|
55
|
+
});
|
|
56
|
+
const updated = store.updateArtifact(artifact.artifactId, (current) => ({
|
|
57
|
+
...current,
|
|
58
|
+
status: 'archived',
|
|
59
|
+
updatedAt: '2026-05-26T01:05:00.000Z',
|
|
60
|
+
payload: {
|
|
61
|
+
...current.payload,
|
|
62
|
+
reviewState: {
|
|
63
|
+
consumedCardIds: ['card_1'],
|
|
64
|
+
completedReviewCardCount: 1,
|
|
65
|
+
remainingReviewCardCount: 0,
|
|
66
|
+
completedAt: '2026-05-26T01:05:00.000Z',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
70
|
+
expect(updated).not.toBeNull();
|
|
71
|
+
expect(updated?.status).toBe('archived');
|
|
72
|
+
expect((updated?.payload.reviewState).consumedCardIds).toEqual(['card_1']);
|
|
73
|
+
const fetched = store.getArtifactById(artifact.artifactId);
|
|
74
|
+
expect(fetched?.status).toBe('archived');
|
|
75
|
+
expect((fetched?.payload.reviewState).remainingReviewCardCount).toBe(0);
|
|
76
|
+
(updated?.payload.reviewState).consumedCardIds.push('card_2');
|
|
77
|
+
const refetched = store.getArtifactById(artifact.artifactId);
|
|
78
|
+
expect((refetched?.payload.reviewState).consumedCardIds).toEqual(['card_1']);
|
|
79
|
+
});
|
|
80
|
+
});
|