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,57 @@
|
|
|
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 path = __importStar(require("path"));
|
|
38
|
+
describe('startup layout snapshot contract', () => {
|
|
39
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
40
|
+
const appPath = path.join(repoRoot, 'src', 'frontend', 'app.js');
|
|
41
|
+
test('rejects and purges degenerate persisted layout snapshots', () => {
|
|
42
|
+
const source = fs.readFileSync(appPath, 'utf8');
|
|
43
|
+
expect(source).toContain('async function deleteStartupLayoutSnapshotRecord(fingerprint)');
|
|
44
|
+
expect(source).toContain("reason: 'degenerate-layout'");
|
|
45
|
+
expect(source).toContain("reason: 'degenerate-layout-vs-source'");
|
|
46
|
+
expect(source).toContain('function isDegenerateLayoutSummary(summary)');
|
|
47
|
+
expect(source).toContain('function isSnapshotLayoutCollapsedVsSource(summary, sourceSummary)');
|
|
48
|
+
expect(source).toContain('if (validation.purge === true && record.fingerprint)');
|
|
49
|
+
});
|
|
50
|
+
test('restores startup snapshots without re-applying persisted fx/fy pinning and re-seeds collapsed layouts', () => {
|
|
51
|
+
const source = fs.readFileSync(appPath, 'utf8');
|
|
52
|
+
expect(source).toContain('n.fx = null;');
|
|
53
|
+
expect(source).toContain('n.fy = null;');
|
|
54
|
+
expect(source).toContain("restoreSourceLayoutOrJitterNodes(nodes, width, height, 'worker-init');");
|
|
55
|
+
expect(source).toContain('function restoreSourceLayoutOrJitterNodes(nodeList, viewportWidth, viewportHeight, reason = \'\')');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -41,6 +41,9 @@ describe('storage provider capacitor content mapping contract', () => {
|
|
|
41
41
|
test('maps desktop-style Knowledge_Base paths for capacitor content reads', () => {
|
|
42
42
|
const source = fs.readFileSync(storageProviderPath, 'utf8');
|
|
43
43
|
expect(source).toContain('function extractRelativePathFromKbMarker(rawFilePath)');
|
|
44
|
+
expect(source).toContain('function extractRelativePathFromWorkspaceUri(rawFilePath)');
|
|
45
|
+
expect(source).toContain("const prefix = 'note://workspace/v1/'");
|
|
46
|
+
expect(source).toContain('const relativeFromWorkspaceUri = extractRelativePathFromWorkspaceUri(raw);');
|
|
44
47
|
expect(source).toContain('function resolveCapacitorContentCandidatePath(rawFilePath)');
|
|
45
48
|
expect(source).toContain("if (/^[A-Za-z]:\\//.test(normalized) || normalized.startsWith('/')) {");
|
|
46
49
|
expect(source).toContain('Cannot map absolute desktop path on Capacitor without Knowledge_Base marker.');
|
|
@@ -49,6 +52,6 @@ describe('storage provider capacitor content mapping contract', () => {
|
|
|
49
52
|
const source = fs.readFileSync(storageProviderPath, 'utf8');
|
|
50
53
|
expect(source).toContain('if (isCapacitorNativeRuntime()) {');
|
|
51
54
|
expect(source).toContain('const capacitorPath = resolveCapacitorContentCandidatePath(filePath);');
|
|
52
|
-
expect(source).toContain('return await capacitorReadText(capacitorPath
|
|
55
|
+
expect(source).toContain('return await capacitorReadText(capacitorPath, {');
|
|
53
56
|
});
|
|
54
57
|
});
|
|
@@ -35,6 +35,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const fs = __importStar(require("fs"));
|
|
37
37
|
const path = __importStar(require("path"));
|
|
38
|
+
const browserTestWindow = {};
|
|
39
|
+
globalThis.window = browserTestWindow;
|
|
40
|
+
const storageProvider = require('./frontend/storage_provider.js');
|
|
38
41
|
describe('storage provider abstraction contract', () => {
|
|
39
42
|
const repoRoot = path.resolve(__dirname, '..');
|
|
40
43
|
const storageProviderPath = path.join(repoRoot, 'src', 'frontend', 'storage_provider.js');
|
|
@@ -43,6 +46,138 @@ describe('storage provider abstraction contract', () => {
|
|
|
43
46
|
expect(source).toContain('window.NoteConnectionStorage = {');
|
|
44
47
|
expect(source).toContain('createProvider');
|
|
45
48
|
expect(source).toContain('class RuntimeStorageProvider');
|
|
49
|
+
expect(source).toContain('getStorageResolution()');
|
|
50
|
+
expect(source).toContain('async refreshStorageResolution()');
|
|
51
|
+
expect(source).toContain("sidecarFetchJson('api/knowledge/store-diagnostics')");
|
|
52
|
+
expect(source).toContain('supportsProjection');
|
|
53
|
+
});
|
|
54
|
+
test('forces projection resolution on Android even when a stale SQLite capability is reported', () => {
|
|
55
|
+
const provider = storageProvider.createProvider({
|
|
56
|
+
runtimeCaps: {
|
|
57
|
+
platform: 'android',
|
|
58
|
+
supports_projection_store: true,
|
|
59
|
+
supports_sqlite: true,
|
|
60
|
+
storage_requested_provider: 'sqlite',
|
|
61
|
+
storage_resolved_provider: 'sqlite',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
expect(provider.getStorageResolution()).toEqual(expect.objectContaining({
|
|
65
|
+
requestedProvider: 'sqlite',
|
|
66
|
+
resolvedProvider: 'projection',
|
|
67
|
+
fallbackReason: 'native_sqlite_runtime_unavailable',
|
|
68
|
+
supportsSqlite: false,
|
|
69
|
+
supportsProjection: true,
|
|
70
|
+
}));
|
|
71
|
+
});
|
|
72
|
+
test('forces projection resolution for an iOS/mobile host without Capacitor globals', () => {
|
|
73
|
+
const provider = storageProvider.createProvider({
|
|
74
|
+
runtimeCaps: {
|
|
75
|
+
platform: 'ios',
|
|
76
|
+
supports_projection_store: true,
|
|
77
|
+
supports_sqlite: true,
|
|
78
|
+
storage_requested_provider: 'sqlite',
|
|
79
|
+
storage_resolved_provider: 'sqlite',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
expect(provider.getStorageResolution()).toEqual(expect.objectContaining({
|
|
83
|
+
requestedProvider: 'sqlite',
|
|
84
|
+
resolvedProvider: 'projection',
|
|
85
|
+
fallbackReason: 'native_sqlite_runtime_unavailable',
|
|
86
|
+
supportsSqlite: false,
|
|
87
|
+
supportsProjection: true,
|
|
88
|
+
}));
|
|
89
|
+
});
|
|
90
|
+
test('keeps SQLite as the desktop default and exposes file fallback explicitly', () => {
|
|
91
|
+
const sqliteProvider = storageProvider.createProvider({
|
|
92
|
+
runtimeCaps: {
|
|
93
|
+
platform: 'win32',
|
|
94
|
+
supports_sidecar: true,
|
|
95
|
+
supports_sqlite: true,
|
|
96
|
+
storage_resolved_provider: 'sqlite',
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
expect(sqliteProvider.getStorageResolution()).toEqual(expect.objectContaining({
|
|
100
|
+
requestedProvider: 'sqlite',
|
|
101
|
+
resolvedProvider: 'sqlite',
|
|
102
|
+
supportsSqlite: true,
|
|
103
|
+
}));
|
|
104
|
+
const fallbackProvider = storageProvider.createProvider({
|
|
105
|
+
runtimeCaps: {
|
|
106
|
+
platform: 'linux',
|
|
107
|
+
supports_sidecar: false,
|
|
108
|
+
supports_sqlite: false,
|
|
109
|
+
storage_requested_provider: 'sqlite',
|
|
110
|
+
storage_resolved_provider: 'file',
|
|
111
|
+
storage_fallback_reason: 'sqlite_runtime_unavailable',
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
expect(fallbackProvider.getStorageResolution()).toEqual(expect.objectContaining({
|
|
115
|
+
requestedProvider: 'sqlite',
|
|
116
|
+
resolvedProvider: 'file',
|
|
117
|
+
fallbackReason: 'sqlite_runtime_unavailable',
|
|
118
|
+
supportsSqlite: false,
|
|
119
|
+
supportsProjection: false,
|
|
120
|
+
}));
|
|
121
|
+
});
|
|
122
|
+
test('does not treat desktop capability support as an active SQLite resolution before diagnostics', () => {
|
|
123
|
+
const provider = storageProvider.createProvider({
|
|
124
|
+
runtimeCaps: {
|
|
125
|
+
platform: 'win32',
|
|
126
|
+
supports_sidecar: true,
|
|
127
|
+
supports_sqlite: true,
|
|
128
|
+
storage_requested_provider: 'sqlite',
|
|
129
|
+
storage_resolved_provider: 'unknown',
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
expect(provider.getStorageResolution()).toEqual(expect.objectContaining({
|
|
133
|
+
requestedProvider: 'sqlite',
|
|
134
|
+
resolvedProvider: undefined,
|
|
135
|
+
supportsSqlite: false,
|
|
136
|
+
}));
|
|
137
|
+
});
|
|
138
|
+
test('refreshes desktop resolution from authoritative sidecar diagnostics', async () => {
|
|
139
|
+
const previousWindow = globalThis.window;
|
|
140
|
+
const previousFetch = globalThis.fetch;
|
|
141
|
+
const runtimeWindow = {
|
|
142
|
+
NoteConnectionRuntime: {
|
|
143
|
+
buildUrl: (resourcePath) => `http://127.0.0.1:3000/${resourcePath}`,
|
|
144
|
+
buildFetchOptions: () => ({ cache: 'no-store' }),
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
globalThis.window = runtimeWindow;
|
|
148
|
+
globalThis.fetch = jest.fn().mockResolvedValue({
|
|
149
|
+
ok: true,
|
|
150
|
+
json: async () => ({
|
|
151
|
+
store: {
|
|
152
|
+
requestedProvider: 'sqlite',
|
|
153
|
+
resolvedProvider: 'file',
|
|
154
|
+
storageEngine: 'file',
|
|
155
|
+
fallbackReason: 'sqlite_runtime_unavailable',
|
|
156
|
+
},
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
159
|
+
try {
|
|
160
|
+
const provider = storageProvider.createProvider({
|
|
161
|
+
runtimeCaps: {
|
|
162
|
+
platform: 'win32',
|
|
163
|
+
supports_sidecar: true,
|
|
164
|
+
supports_sqlite: true,
|
|
165
|
+
storage_requested_provider: 'sqlite',
|
|
166
|
+
storage_resolved_provider: 'sqlite',
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
await expect(provider.refreshStorageResolution()).resolves.toEqual(expect.objectContaining({
|
|
170
|
+
requestedProvider: 'sqlite',
|
|
171
|
+
resolvedProvider: 'file',
|
|
172
|
+
fallbackReason: 'sqlite_runtime_unavailable',
|
|
173
|
+
supportsSqlite: false,
|
|
174
|
+
}));
|
|
175
|
+
expect(globalThis.fetch).toHaveBeenCalledWith('http://127.0.0.1:3000/api/knowledge/store-diagnostics', { cache: 'no-store' });
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
globalThis.window = previousWindow;
|
|
179
|
+
globalThis.fetch = previousFetch;
|
|
180
|
+
}
|
|
46
181
|
});
|
|
47
182
|
test('supports sidecar, tauri, and read-only capability branches', () => {
|
|
48
183
|
const source = fs.readFileSync(storageProviderPath, 'utf8');
|
|
@@ -53,6 +188,14 @@ describe('storage provider abstraction contract', () => {
|
|
|
53
188
|
expect(source).toContain('getCapacitorFilesystemPlugin()');
|
|
54
189
|
expect(source).toContain('ensureCapacitorFilesystemPermission');
|
|
55
190
|
expect(source).toContain('normalizeCapacitorPath');
|
|
191
|
+
expect(source).toContain('createMobileResourceIdentity');
|
|
192
|
+
expect(source).toContain('canonicalMobileNodeIdFromIdentity');
|
|
193
|
+
expect(source).toContain('NoteConnectionMobileIdentity');
|
|
194
|
+
expect(source).toContain('extractMarkdownLinks');
|
|
195
|
+
expect(source).toContain('sourceUri: file.sourceUri ||');
|
|
196
|
+
expect(source).toContain('canonicalId: file.canonicalId ||');
|
|
197
|
+
expect(source).toContain('identityAliases: Array.isArray(file.identityAliases)');
|
|
198
|
+
expect(source).toContain('Capacitor graph contains duplicate legacy node id');
|
|
56
199
|
expect(source).toContain('extractRelativePathFromKbMarker');
|
|
57
200
|
expect(source).toContain('resolveCapacitorContentCandidatePath');
|
|
58
201
|
expect(source).toContain('async function capacitorReadText(pathValue, options)');
|
|
@@ -64,11 +207,19 @@ describe('storage provider abstraction contract', () => {
|
|
|
64
207
|
expect(source).toContain('CAPACITOR_GRAPH_BUILD_WORKER_TIMEOUT_MS');
|
|
65
208
|
expect(source).toContain("buildMode: 'single-thread-fallback'");
|
|
66
209
|
expect(source).toContain("buildMode: 'worker'");
|
|
210
|
+
expect(source).toContain('var linkedFile = resolveReference(file, rawLink, referenceIndex);');
|
|
211
|
+
expect(source).toContain('addEdge(sourceId, linkedFile && linkedFile.id, "wiki-link")');
|
|
212
|
+
expect(source).toContain('function buildCapacitorReferenceIndex(files)');
|
|
213
|
+
expect(source).toContain('Capacitor graph contains an ambiguous legacy basename');
|
|
214
|
+
expect(source).toContain('sourceUri: sourceNode && sourceNode.sourceUri');
|
|
67
215
|
expect(source).toContain("const result = await capacitorBuildGraph(requestPayload || {}, this.runtimeCaps || {});");
|
|
68
216
|
expect(source).toContain('buildModeDetail: resolveCapacitorBuildModeDetail(buildResult.buildMode, runtimeCaps || {})');
|
|
69
217
|
expect(source).toContain('supportsMobileWasmCompute');
|
|
70
218
|
expect(source).toContain('mobileWasmReason');
|
|
71
219
|
expect(source).toContain("unsupportedOperationError('buildGraph')");
|
|
220
|
+
expect(source).toContain('storage_requested_provider');
|
|
221
|
+
expect(source).toContain('storage_resolved_provider');
|
|
222
|
+
expect(source).toContain('storage_fallback_reason');
|
|
72
223
|
});
|
|
73
224
|
test('defines core storage operations used by source manager and reader', () => {
|
|
74
225
|
const source = fs.readFileSync(storageProviderPath, 'utf8');
|
|
@@ -80,7 +231,7 @@ describe('storage provider abstraction contract', () => {
|
|
|
80
231
|
expect(source).toContain('async buildGraph(requestPayload)');
|
|
81
232
|
expect(source).toContain('async readContent(filePath)');
|
|
82
233
|
expect(source).toContain('const capacitorPath = resolveCapacitorContentCandidatePath(filePath);');
|
|
83
|
-
expect(source).toContain('return await capacitorReadText(capacitorPath
|
|
234
|
+
expect(source).toContain('return await capacitorReadText(capacitorPath, {');
|
|
84
235
|
expect(source).toContain('async setKbPath(kbPath)');
|
|
85
236
|
expect(source).toContain('async readGeneratedAsset(filename)');
|
|
86
237
|
});
|
|
@@ -0,0 +1,68 @@
|
|
|
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 path = __importStar(require("path"));
|
|
38
|
+
describe('tauri frontend build contracts', () => {
|
|
39
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
40
|
+
const packageJsonPath = path.join(repoRoot, 'package.json');
|
|
41
|
+
const tauriConfigPath = path.join(repoRoot, 'src-tauri', 'tauri.conf.json');
|
|
42
|
+
const wrapperScriptPath = path.join(repoRoot, 'scripts', 'run-tauri-frontend-build.js');
|
|
43
|
+
const viteConfigPath = path.join(repoRoot, 'vite.config.ts');
|
|
44
|
+
function readJson(filePath) {
|
|
45
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
46
|
+
}
|
|
47
|
+
test('tauri full build keeps explicit frontend full-mode through tauri beforeBuildCommand', () => {
|
|
48
|
+
const packageJson = readJson(packageJsonPath);
|
|
49
|
+
const tauriConfig = readJson(tauriConfigPath);
|
|
50
|
+
const scripts = packageJson.scripts || {};
|
|
51
|
+
expect(tauriConfig.build?.beforeBuildCommand).toBe('node scripts/run-tauri-frontend-build.js');
|
|
52
|
+
expect(scripts['tauri:build:full']).toContain('node scripts/run-tauri-build.js --frontend-build-mode full');
|
|
53
|
+
});
|
|
54
|
+
test('tauri frontend build wrapper defaults to runtime-first and supports explicit full mode', () => {
|
|
55
|
+
const wrapper = require(wrapperScriptPath);
|
|
56
|
+
expect(wrapper.resolveFrontendBuildCommand()).toBe('npm run build');
|
|
57
|
+
expect(wrapper.resolveFrontendBuildCommand({ frontendBuildMode: 'runtime-first' })).toBe('npm run build');
|
|
58
|
+
expect(wrapper.resolveFrontendBuildCommand({ frontendBuildMode: 'full' })).toBe('npm run build:full');
|
|
59
|
+
expect(() => wrapper.resolveFrontendBuildCommand({ frontendBuildMode: 'legacy-full' })).toThrow(/Unsupported tauri frontend build mode/i);
|
|
60
|
+
});
|
|
61
|
+
test('keeps Vite verification output separate from the Tauri runtime frontend directory', () => {
|
|
62
|
+
const viteConfig = fs.readFileSync(viteConfigPath, 'utf8');
|
|
63
|
+
expect(viteConfig).toContain("const viteVerificationDir = resolve(__dirname, 'dist', 'vite-verify')");
|
|
64
|
+
expect(viteConfig).toContain('outDir: viteVerificationDir');
|
|
65
|
+
expect(viteConfig).toContain('emptyOutDir: true');
|
|
66
|
+
expect(viteConfig).not.toContain('emptyOutDir: false');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -41,6 +41,7 @@ describe('tauri sidecar cleanup integration', () => {
|
|
|
41
41
|
const cleanupScriptPath = path.join(repoRoot, 'scripts', 'cleanup-tauri-sidecars.js');
|
|
42
42
|
const sidecarEnsureScriptPath = path.join(repoRoot, 'scripts', 'ensure-sidecar-ready.js');
|
|
43
43
|
const tauriBuildRunnerPath = path.join(repoRoot, 'scripts', 'run-tauri-build.js');
|
|
44
|
+
const tauriDevRunnerPath = path.join(repoRoot, 'scripts', 'run-tauri-dev.js');
|
|
44
45
|
const tauriRunnerPath = path.join(repoRoot, 'scripts', 'run-tauri-tests.js');
|
|
45
46
|
test('desktop tauri scripts run stale sidecar cleanup before cargo build flow', () => {
|
|
46
47
|
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
@@ -51,6 +52,8 @@ describe('tauri sidecar cleanup integration', () => {
|
|
|
51
52
|
expect(pkg.scripts['tauri:dev:mini']).toContain('npm run cleanup:tauri:sidecars');
|
|
52
53
|
expect(pkg.scripts['tauri:dev']).toContain('npm run ensure:sidecar:dev');
|
|
53
54
|
expect(pkg.scripts['tauri:dev:mini']).toContain('npm run ensure:sidecar:dev');
|
|
55
|
+
expect(pkg.scripts['tauri:dev']).toContain('node scripts/run-tauri-dev.js');
|
|
56
|
+
expect(pkg.scripts['tauri:dev:mini']).toContain('node scripts/run-tauri-dev.js');
|
|
54
57
|
expect(pkg.scripts['tauri:build']).toContain('npm run cleanup:tauri:sidecars');
|
|
55
58
|
expect(pkg.scripts['tauri:build:mini']).toContain('npm run cleanup:tauri:sidecars');
|
|
56
59
|
expect(pkg.scripts['tauri:build']).toContain('node scripts/run-tauri-build.js');
|
|
@@ -64,6 +67,15 @@ describe('tauri sidecar cleanup integration', () => {
|
|
|
64
67
|
expect(tauriBuildRunner).toContain('CARGO_PROFILE_RELEASE_OPT_LEVEL');
|
|
65
68
|
expect(tauriBuildRunner).toContain('CARGO_PROFILE_RELEASE_CODEGEN_UNITS');
|
|
66
69
|
expect(tauriBuildRunner).toContain("['tauri', 'build', '--ci'");
|
|
70
|
+
const tauriDevRunner = fs.readFileSync(tauriDevRunnerPath, 'utf8');
|
|
71
|
+
expect(tauriDevRunner).toContain('CARGO_TARGET_DIR');
|
|
72
|
+
expect(tauriDevRunner).toContain('target-dev-lowmem');
|
|
73
|
+
expect(tauriDevRunner).toContain('process.pid');
|
|
74
|
+
expect(tauriDevRunner).toContain('Date.now().toString(36)');
|
|
75
|
+
expect(tauriDevRunner).toContain('CARGO_BUILD_JOBS');
|
|
76
|
+
expect(tauriDevRunner).toContain('CARGO_PROFILE_DEV_DEBUG');
|
|
77
|
+
expect(tauriDevRunner).toContain('CARGO_INCREMENTAL');
|
|
78
|
+
expect(tauriDevRunner).toContain("['tauri', 'dev'");
|
|
67
79
|
const sidecarEnsureScript = fs.readFileSync(sidecarEnsureScriptPath, 'utf8');
|
|
68
80
|
expect(sidecarEnsureScript).toContain('Sidecar binaries are valid and up-to-date');
|
|
69
81
|
expect(sidecarEnsureScript).toContain("runNodeScript('build-sidecar.js')");
|
|
@@ -71,9 +83,18 @@ describe('tauri sidecar cleanup integration', () => {
|
|
|
71
83
|
});
|
|
72
84
|
test('cleanup script targets copied tauri sidecars in debug and release outputs', () => {
|
|
73
85
|
const script = fs.readFileSync(cleanupScriptPath, 'utf8');
|
|
86
|
+
expect(script).toContain("const defaultTargetRoots = [");
|
|
87
|
+
expect(script).toContain("path.join(repoRoot, 'src-tauri', 'target')");
|
|
88
|
+
expect(script).toContain("path.join(repoRoot, 'src-tauri', 'target-dev-lowmem')");
|
|
74
89
|
expect(script).toContain("const targetModes = ['debug', 'release'];");
|
|
75
90
|
expect(script).toContain("const sidecarNames = ['server', 'godot', 'markdown-worker'];");
|
|
91
|
+
expect(script).toContain('function resolveTargetRoots()');
|
|
92
|
+
expect(script).toContain('process.env.CARGO_TARGET_DIR');
|
|
76
93
|
expect(script).toContain("targetRoot, mode, `${name}.exe`");
|
|
94
|
+
expect(script).toContain('function removeExistingArtifacts(targetPaths)');
|
|
95
|
+
expect(script).toContain('function runPowerShellNameFallbackCleanup(targetPath)');
|
|
96
|
+
expect(script).toContain('KILLED_BY_NAME|');
|
|
97
|
+
expect(script).toContain('[Tauri Sidecar Cleanup] REMOVED|');
|
|
77
98
|
expect(script).toContain('Failed to terminate stale copied sidecars');
|
|
78
99
|
});
|
|
79
100
|
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
jest.mock('child_process', () => ({ ...jest.requireActual('child_process'), spawnSync: jest.fn() }));
|
|
5
|
+
const { runRustWindowEvidenceTests } = require('../scripts/verify-agent-workspace-tauri-window-evidence');
|
|
6
|
+
const { runRustContractTests } = require('../scripts/verify-agent-workspace-tauri-rust');
|
|
7
|
+
const spawn = child_process_1.spawnSync;
|
|
8
|
+
describe('native window test execution evidence', () => {
|
|
9
|
+
afterEach(() => jest.clearAllMocks());
|
|
10
|
+
test.each([
|
|
11
|
+
['empty filter', 'running 0 tests\n\ntest result: ok. 0 passed; 0 failed; 0 ignored; 30 filtered out;\n'],
|
|
12
|
+
['ignored test', 'test tests::{name} ... ignored\n\ntest result: ok. 0 passed; 0 failed; 1 ignored;\n'],
|
|
13
|
+
['different test', 'test tests::some_other_test ... ok\n\ntest result: ok. 1 passed; 0 failed; 0 ignored;\n'],
|
|
14
|
+
['failed test', 'test tests::{name} ... FAILED\n'],
|
|
15
|
+
])('does not qualify a zero-exit Cargo run with %s', (_label, stdout) => {
|
|
16
|
+
spawn.mockImplementation((_command, args) => ({ status: 0, stdout: stdout.replace('{name}', args[3]), stderr: '' }));
|
|
17
|
+
const results = runRustWindowEvidenceTests();
|
|
18
|
+
expect(results).toHaveLength(2);
|
|
19
|
+
expect(results.every((result) => result.passed === false)).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
test('requires the named test to pass even when other test executables run zero tests', () => {
|
|
22
|
+
spawn.mockImplementation((_command, args) => ({ status: 0, stderr: '', stdout: `running 0 tests\ntest result: ok. 0 passed; 0 failed;\n\ntest tests::${args[3]} ... ok\n\ntest result: ok. 1 passed; 0 failed;\n` }));
|
|
23
|
+
expect(runRustWindowEvidenceTests().every((result) => result.passed)).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
test('rejects a passing named test when Cargo later fails', () => {
|
|
26
|
+
spawn.mockImplementation((_command, args) => ({ status: 101, stderr: 'later test executable failed', stdout: `test tests::${args[3]} ... ok\n` }));
|
|
27
|
+
expect(runRustWindowEvidenceTests().every((result) => result.passed === false)).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
test('selects the native window feature and library target in separate Cargo processes', () => {
|
|
30
|
+
spawn.mockReturnValue({ status: 0, stdout: '', stderr: '' });
|
|
31
|
+
runRustWindowEvidenceTests();
|
|
32
|
+
expect(spawn).toHaveBeenCalledTimes(2);
|
|
33
|
+
for (const [command, args] of spawn.mock.calls) {
|
|
34
|
+
expect(command).toBe('cargo');
|
|
35
|
+
expect(args).toEqual(expect.arrayContaining(['--lib', '--locked', '--features', 'native-window-tests', '--ignored', '--show-output']));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('ordinary Rust contract execution evidence', () => {
|
|
40
|
+
afterEach(() => jest.clearAllMocks());
|
|
41
|
+
const names = [
|
|
42
|
+
'pathmode_window_toggle_plan_decouples_godot_signal_from_tauri_hide_restore_flags',
|
|
43
|
+
'pathmode_window_toggle_plan_restores_tauri_focus_when_restore_policy_is_enabled',
|
|
44
|
+
'pathmode_window_toggled_event_payload_contains_config_and_execution_plan',
|
|
45
|
+
];
|
|
46
|
+
test.each([
|
|
47
|
+
['empty selection', 0, 'running 0 tests\ntest result: ok. 0 passed; 0 failed;', ''],
|
|
48
|
+
['unrelated passing test', 0, 'test tests::unrelated ... ok', ''],
|
|
49
|
+
['ignored tests', 0, names.map(name => `test tests::${name} ... ignored`).join('\n'), ''],
|
|
50
|
+
['failed Cargo invocation mentioning zero tests', 101, '', '0 tests matched after failure'],
|
|
51
|
+
])('does not qualify %s', (_label, status, stdout, stderr) => {
|
|
52
|
+
spawn.mockReturnValue({ status, stdout, stderr });
|
|
53
|
+
const results = runRustContractTests();
|
|
54
|
+
expect(results.every((result) => result.passed === false)).toBe(true);
|
|
55
|
+
expect(results.every((result) => result.exitCode === status)).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
test('requires every named case, including both toggle policy tests', () => {
|
|
58
|
+
spawn.mockReturnValue({ status: 0, stdout: `test tests::${names[0]} ... ok\n`, stderr: '' });
|
|
59
|
+
expect(runRustContractTests().every((result) => result.passed === false)).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
test('qualifies executed names and preserves a later Cargo failure', () => {
|
|
62
|
+
const stdout = names.map(name => `test tests::${name} ... ok`).join('\n');
|
|
63
|
+
spawn.mockReturnValue({ status: 0, stdout, stderr: '' });
|
|
64
|
+
expect(runRustContractTests().every((result) => result.passed)).toBe(true);
|
|
65
|
+
spawn.mockReturnValue({ status: 101, stdout, stderr: 'process failed' });
|
|
66
|
+
expect(runRustContractTests().every((result) => result.passed === false)).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -37,6 +37,7 @@ exports.resolveRuntimePaths = resolveRuntimePaths;
|
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const os = __importStar(require("os"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
+
const platform_1 = require("./platform");
|
|
40
41
|
function isDirectory(targetPath) {
|
|
41
42
|
try {
|
|
42
43
|
return fs.existsSync(targetPath) && fs.statSync(targetPath).isDirectory();
|
|
@@ -65,17 +66,6 @@ function pickExisting(candidates) {
|
|
|
65
66
|
}
|
|
66
67
|
return null;
|
|
67
68
|
}
|
|
68
|
-
function resolveAppDataRoot(cwd) {
|
|
69
|
-
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
70
|
-
if (localAppData) {
|
|
71
|
-
return path.join(localAppData, 'NoteConnection');
|
|
72
|
-
}
|
|
73
|
-
const home = process.env.HOME || process.env.USERPROFILE;
|
|
74
|
-
if (home) {
|
|
75
|
-
return path.join(home, '.noteconnection');
|
|
76
|
-
}
|
|
77
|
-
return path.join(cwd, '.noteconnection');
|
|
78
|
-
}
|
|
79
69
|
function ensureWritableDirectory(targetPath) {
|
|
80
70
|
try {
|
|
81
71
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
@@ -138,19 +128,25 @@ function resolveRuntimePaths(moduleDir) {
|
|
|
138
128
|
path.join(moduleDir, 'frontend')
|
|
139
129
|
].filter((v) => Boolean(v)));
|
|
140
130
|
const frontendDir = pickExisting(frontendCandidates) || path.join(projectRoot, 'dist', 'src', 'frontend');
|
|
131
|
+
const appDataRoot = (0, platform_1.getAppDataDir)();
|
|
141
132
|
const runtimeDataCandidates = uniqPaths([
|
|
142
133
|
envRuntimeDataDir,
|
|
143
|
-
path.join(
|
|
134
|
+
path.join(appDataRoot, 'runtime_data'),
|
|
144
135
|
path.join(projectRoot, 'runtime_data'),
|
|
145
136
|
path.join(cwd, 'runtime_data'),
|
|
146
137
|
path.join(os.tmpdir(), 'noteconnection', 'runtime_data')
|
|
147
138
|
].filter((v) => Boolean(v)));
|
|
148
139
|
const runtimeDataDirCandidate = runtimeDataCandidates.find((candidate) => ensureWritableDirectory(candidate))
|
|
149
|
-
|| path.join(
|
|
140
|
+
|| path.join(appDataRoot, 'runtime_data');
|
|
150
141
|
if (!ensureWritableDirectory(runtimeDataDirCandidate)) {
|
|
151
142
|
throw new Error(`Unable to provision writable runtime data directory: ${runtimeDataDirCandidate}`);
|
|
152
143
|
}
|
|
153
144
|
const runtimeDataDir = path.resolve(runtimeDataDirCandidate);
|
|
145
|
+
// pkg's projectRoot is a virtual, read-only asset tree. Mutable discovery
|
|
146
|
+
// credentials belong to the writable runtime directory in packaged builds.
|
|
147
|
+
const runtimeManifestPath = process.pkg
|
|
148
|
+
? path.join(runtimeDataDir, 'active-sidecar-runtime.json')
|
|
149
|
+
: path.join(projectRoot, 'tmp', 'active-sidecar-runtime.json');
|
|
154
150
|
const kbCandidates = uniqPaths([
|
|
155
151
|
envKbRoot,
|
|
156
152
|
path.join(projectRoot, 'Knowledge_Base'),
|
|
@@ -163,6 +159,7 @@ function resolveRuntimePaths(moduleDir) {
|
|
|
163
159
|
projectRoot,
|
|
164
160
|
frontendDir,
|
|
165
161
|
runtimeDataDir,
|
|
162
|
+
runtimeManifestPath,
|
|
166
163
|
kbRoot
|
|
167
164
|
};
|
|
168
165
|
}
|
|
@@ -97,6 +97,33 @@ describe('resolveRuntimePaths', () => {
|
|
|
97
97
|
expect(resolved.runtimeDataDir).toBe(path.resolve(runtimeDataDir));
|
|
98
98
|
expect(resolved.kbRoot).toBe(path.resolve(kbRoot));
|
|
99
99
|
});
|
|
100
|
+
test('keeps packaged runtime manifests in the writable runtime directory', () => {
|
|
101
|
+
const previousPkg = Object.getOwnPropertyDescriptor(process, 'pkg');
|
|
102
|
+
Object.defineProperty(process, 'pkg', { configurable: true, value: { entrypoint: '/snapshot/app/server.js' } });
|
|
103
|
+
restoreEnv.push(() => {
|
|
104
|
+
if (previousPkg)
|
|
105
|
+
Object.defineProperty(process, 'pkg', previousPkg);
|
|
106
|
+
else
|
|
107
|
+
Reflect.deleteProperty(process, 'pkg');
|
|
108
|
+
});
|
|
109
|
+
const projectRoot = temp.mkdir('packaged_assets');
|
|
110
|
+
temp.mkdir(path.join('packaged_assets', 'dist', 'src', 'frontend'));
|
|
111
|
+
const runtimeDataDir = temp.mkdir('user_runtime');
|
|
112
|
+
restoreEnv.push(setEnv('NOTE_CONNECTION_PROJECT_ROOT', projectRoot));
|
|
113
|
+
restoreEnv.push(setEnv('NOTE_CONNECTION_RUNTIME_DATA_DIR', runtimeDataDir));
|
|
114
|
+
const resolved = (0, RuntimePaths_1.resolveRuntimePaths)(temp.child('module'));
|
|
115
|
+
expect('runtimeManifestPath' in resolved ? resolved.runtimeManifestPath : undefined)
|
|
116
|
+
.toBe(path.join(runtimeDataDir, 'active-sidecar-runtime.json'));
|
|
117
|
+
});
|
|
118
|
+
test('preserves the development manifest location used by diagnostic tools', () => {
|
|
119
|
+
const projectRoot = temp.mkdir('project');
|
|
120
|
+
temp.mkdir(path.join('project', 'Knowledge_Base'));
|
|
121
|
+
restoreEnv.push(setEnv('NOTE_CONNECTION_PROJECT_ROOT', projectRoot));
|
|
122
|
+
restoreEnv.push(setEnv('NOTE_CONNECTION_RUNTIME_DATA_DIR', temp.mkdir('runtime')));
|
|
123
|
+
const resolved = (0, RuntimePaths_1.resolveRuntimePaths)(temp.child('module'));
|
|
124
|
+
expect('runtimeManifestPath' in resolved ? resolved.runtimeManifestPath : undefined)
|
|
125
|
+
.toBe(path.join(projectRoot, 'tmp', 'active-sidecar-runtime.json'));
|
|
126
|
+
});
|
|
100
127
|
test('normalizes env kb path that points to a folder inside Knowledge_Base', () => {
|
|
101
128
|
const projectRoot = temp.mkdir('project');
|
|
102
129
|
const kbRoot = temp.mkdir(path.join('project', 'Knowledge_Base'));
|