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,62 @@
|
|
|
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
|
+
function getNestedStringValue(record, dottedKey) {
|
|
39
|
+
const value = dottedKey.split('.').reduce((current, segment) => {
|
|
40
|
+
if (!current || typeof current !== 'object' || !(segment in current)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return current[segment];
|
|
44
|
+
}, record);
|
|
45
|
+
return typeof value === 'string' && value.trim().length > 0 ? value : null;
|
|
46
|
+
}
|
|
47
|
+
describe('frontend locale contract', () => {
|
|
48
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
49
|
+
const enLocale = JSON.parse(fs.readFileSync(path.join(repoRoot, 'src', 'frontend', 'locales', 'en.json'), 'utf8'));
|
|
50
|
+
const zhLocale = JSON.parse(fs.readFileSync(path.join(repoRoot, 'src', 'frontend', 'locales', 'zh.json'), 'utf8'));
|
|
51
|
+
const requiredKeys = [
|
|
52
|
+
'analysis_title',
|
|
53
|
+
'node_details',
|
|
54
|
+
'reader_loading',
|
|
55
|
+
'reader_outline_title',
|
|
56
|
+
'reader_outline_empty',
|
|
57
|
+
];
|
|
58
|
+
test('required reader and analysis keys resolve in both locales', () => {
|
|
59
|
+
const missing = requiredKeys.filter((key) => (!getNestedStringValue(enLocale, key) || !getNestedStringValue(zhLocale, key)));
|
|
60
|
+
expect(missing).toEqual([]);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
describe('frontend runtime asset verifier', () => {
|
|
40
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
41
|
+
const verifierPath = path.join(repoRoot, 'scripts', 'verify-frontend-runtime-assets.js');
|
|
42
|
+
let tempDir;
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
tempDir = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'noteconnection-frontend-assets-'));
|
|
45
|
+
});
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
48
|
+
});
|
|
49
|
+
test('rejects an index that references a missing legacy runtime script', () => {
|
|
50
|
+
fs.writeFileSync(path.join(tempDir, 'index.html'), '<script src="markdown_runtime.js"></script><script src="workspace_panes.js"></script>', 'utf8');
|
|
51
|
+
fs.writeFileSync(path.join(tempDir, 'markdown_runtime.js'), 'window.runtime = true;', 'utf8');
|
|
52
|
+
const { verifyFrontendRuntimeAssets } = require(verifierPath);
|
|
53
|
+
expect(() => verifyFrontendRuntimeAssets(tempDir)).toThrow(/workspace_panes\.js/);
|
|
54
|
+
});
|
|
55
|
+
test('accepts an index when every local runtime script is present', () => {
|
|
56
|
+
fs.writeFileSync(path.join(tempDir, 'index.html'), '<script src="markdown_runtime.js"></script><script src="workspace_panes.js"></script><script src="https://example.invalid/remote.js"></script>', 'utf8');
|
|
57
|
+
fs.writeFileSync(path.join(tempDir, 'markdown_runtime.js'), 'window.runtime = true;', 'utf8');
|
|
58
|
+
fs.writeFileSync(path.join(tempDir, 'workspace_panes.js'), 'window.panes = true;', 'utf8');
|
|
59
|
+
const { verifyFrontendRuntimeAssets } = require(verifierPath);
|
|
60
|
+
expect(() => verifyFrontendRuntimeAssets(tempDir)).not.toThrow();
|
|
61
|
+
});
|
|
62
|
+
test('rejects an index that references a missing local stylesheet or module preload', () => {
|
|
63
|
+
fs.writeFileSync(path.join(tempDir, 'index.html'), '<link rel="stylesheet" href="styles.css"><link rel="modulepreload" href="assets/main.js"><script src="workspace_panes.js"></script>', 'utf8');
|
|
64
|
+
fs.writeFileSync(path.join(tempDir, 'workspace_panes.js'), 'window.panes = true;', 'utf8');
|
|
65
|
+
const { verifyFrontendRuntimeAssets } = require(verifierPath);
|
|
66
|
+
expect(() => verifyFrontendRuntimeAssets(tempDir)).toThrow(/styles\.css.*assets\/main\.js|assets\/main\.js.*styles\.css/);
|
|
67
|
+
});
|
|
68
|
+
test('cleans only stale Vite-owned bundle directories from the runtime destination', () => {
|
|
69
|
+
const copierPath = path.join(repoRoot, 'scripts', 'copy-assets.js');
|
|
70
|
+
fs.mkdirSync(path.join(tempDir, 'assets'), { recursive: true });
|
|
71
|
+
fs.mkdirSync(path.join(tempDir, 'vite-assets'), { recursive: true });
|
|
72
|
+
fs.writeFileSync(path.join(tempDir, 'assets', 'stale.js'), 'stale', 'utf8');
|
|
73
|
+
fs.writeFileSync(path.join(tempDir, 'vite-assets', 'stale.js'), 'stale', 'utf8');
|
|
74
|
+
fs.writeFileSync(path.join(tempDir, 'workspace_panes.js'), 'runtime', 'utf8');
|
|
75
|
+
const { cleanGeneratedFrontendBundleDirectories } = require(copierPath);
|
|
76
|
+
cleanGeneratedFrontendBundleDirectories(tempDir);
|
|
77
|
+
expect(fs.existsSync(path.join(tempDir, 'assets'))).toBe(false);
|
|
78
|
+
expect(fs.existsSync(path.join(tempDir, 'vite-assets'))).toBe(false);
|
|
79
|
+
expect(fs.readFileSync(path.join(tempDir, 'workspace_panes.js'), 'utf8')).toBe('runtime');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,244 @@
|
|
|
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 crypto = __importStar(require("crypto"));
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const url_1 = require("url");
|
|
41
|
+
class TempDir {
|
|
42
|
+
constructor(prefix) {
|
|
43
|
+
this.path = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), `${prefix}-`));
|
|
44
|
+
}
|
|
45
|
+
child(relative) {
|
|
46
|
+
return path.join(this.path, relative);
|
|
47
|
+
}
|
|
48
|
+
mkdir(relative) {
|
|
49
|
+
const target = this.child(relative);
|
|
50
|
+
fs.mkdirSync(target, { recursive: true });
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
cleanup() {
|
|
54
|
+
fs.rmSync(this.path, { recursive: true, force: true });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function sha256File(filePath) {
|
|
58
|
+
return crypto.createHash('sha256').update(fs.readFileSync(filePath)).digest('hex');
|
|
59
|
+
}
|
|
60
|
+
describe('godot sidecar bootstrap contracts', () => {
|
|
61
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
62
|
+
const sidecarUtilsPath = path.join(repoRoot, 'scripts', 'tauri-sidecar-utils.js');
|
|
63
|
+
let sidecarUtils;
|
|
64
|
+
let temp;
|
|
65
|
+
beforeAll(() => {
|
|
66
|
+
sidecarUtils = require(sidecarUtilsPath);
|
|
67
|
+
});
|
|
68
|
+
beforeEach(() => {
|
|
69
|
+
temp = new TempDir('noteconnection-godot-bootstrap');
|
|
70
|
+
});
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
if (temp) {
|
|
73
|
+
temp.cleanup();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
test('downloads and caches a host godot binary when a pinned file URL is configured', async () => {
|
|
77
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
78
|
+
const downloadRoot = temp.mkdir('downloads');
|
|
79
|
+
const cacheRoot = temp.mkdir('cache');
|
|
80
|
+
const sourceBinaryPath = path.join(downloadRoot, 'godot-linux-x64');
|
|
81
|
+
const sourceBinary = Buffer.alloc(sidecarUtils.MIN_GODOT_BINARY_BYTES + 64, 7);
|
|
82
|
+
fs.writeFileSync(sourceBinaryPath, sourceBinary);
|
|
83
|
+
const result = await sidecarUtils.prepareGodotSidecar({
|
|
84
|
+
repoRoot: fakeRepoRoot,
|
|
85
|
+
platform: 'linux',
|
|
86
|
+
arch: 'x64',
|
|
87
|
+
env: {
|
|
88
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_URL: (0, url_1.pathToFileURL)(sourceBinaryPath).href,
|
|
89
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_SHA256: sha256File(sourceBinaryPath),
|
|
90
|
+
NOTE_CONNECTION_GODOT_CACHE_DIR: cacheRoot,
|
|
91
|
+
},
|
|
92
|
+
logger: console,
|
|
93
|
+
});
|
|
94
|
+
expect(result.outcome).toBe('prepared');
|
|
95
|
+
expect(result.sourceKind).toBe('download');
|
|
96
|
+
expect(fs.existsSync(result.targetPath)).toBe(true);
|
|
97
|
+
expect(fs.existsSync(result.cachePath)).toBe(true);
|
|
98
|
+
expect(fs.readFileSync(result.targetPath)).toEqual(sourceBinary);
|
|
99
|
+
expect(fs.readFileSync(result.cachePath)).toEqual(sourceBinary);
|
|
100
|
+
});
|
|
101
|
+
test('accepts GitHub Releases URLs as pinned bootstrap sources without provider-specific branching', () => {
|
|
102
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
103
|
+
const cacheRoot = temp.mkdir('cache');
|
|
104
|
+
const githubReleaseUrl = 'https://github.com/Jacobinwwey/NoteConnection/releases/download/v1.7.0/godot-x86_64-unknown-linux-gnu';
|
|
105
|
+
const context = sidecarUtils.resolveGodotBootstrapContext({
|
|
106
|
+
repoRoot: fakeRepoRoot,
|
|
107
|
+
platform: 'linux',
|
|
108
|
+
arch: 'x64',
|
|
109
|
+
env: {
|
|
110
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_URL: githubReleaseUrl,
|
|
111
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_SHA256: 'abc123',
|
|
112
|
+
NOTE_CONNECTION_GODOT_CACHE_DIR: cacheRoot,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
expect(context).not.toBeNull();
|
|
116
|
+
expect(context?.downloadUrl).toBe(githubReleaseUrl);
|
|
117
|
+
expect(context?.expectedSha256).toBe('abc123');
|
|
118
|
+
expect(context?.cachePath).toBe(path.join(cacheRoot, 'godot-x86_64-unknown-linux-gnu'));
|
|
119
|
+
expect(context?.targetPath).toBe(path.join(fakeRepoRoot, 'src-tauri', 'bin', 'godot-x86_64-unknown-linux-gnu'));
|
|
120
|
+
});
|
|
121
|
+
test('accepts generic object-storage mirror URLs through the same bootstrap contract', () => {
|
|
122
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
123
|
+
const cacheRoot = temp.mkdir('cache');
|
|
124
|
+
const objectStorageUrl = 'https://mirror.example.invalid/noteconnection/godot/godot-x86_64-unknown-linux-gnu';
|
|
125
|
+
const context = sidecarUtils.resolveGodotBootstrapContext({
|
|
126
|
+
repoRoot: fakeRepoRoot,
|
|
127
|
+
platform: 'linux',
|
|
128
|
+
arch: 'x64',
|
|
129
|
+
env: {
|
|
130
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_URL: objectStorageUrl,
|
|
131
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_SHA256: 'def456',
|
|
132
|
+
NOTE_CONNECTION_GODOT_CACHE_DIR: cacheRoot,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
expect(context).not.toBeNull();
|
|
136
|
+
expect(context?.downloadUrl).toBe(objectStorageUrl);
|
|
137
|
+
expect(context?.expectedSha256).toBe('def456');
|
|
138
|
+
expect(context?.cachePath).toBe(path.join(cacheRoot, 'godot-x86_64-unknown-linux-gnu'));
|
|
139
|
+
});
|
|
140
|
+
test('reuses cached godot binary when the original download source is gone', async () => {
|
|
141
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
142
|
+
const downloadRoot = temp.mkdir('downloads');
|
|
143
|
+
const cacheRoot = temp.mkdir('cache');
|
|
144
|
+
const sourceBinaryPath = path.join(downloadRoot, 'godot-linux-x64');
|
|
145
|
+
fs.writeFileSync(sourceBinaryPath, Buffer.alloc(sidecarUtils.MIN_GODOT_BINARY_BYTES + 32, 3));
|
|
146
|
+
const env = {
|
|
147
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_URL: (0, url_1.pathToFileURL)(sourceBinaryPath).href,
|
|
148
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_SHA256: sha256File(sourceBinaryPath),
|
|
149
|
+
NOTE_CONNECTION_GODOT_CACHE_DIR: cacheRoot,
|
|
150
|
+
};
|
|
151
|
+
const first = await sidecarUtils.prepareGodotSidecar({
|
|
152
|
+
repoRoot: fakeRepoRoot,
|
|
153
|
+
platform: 'linux',
|
|
154
|
+
arch: 'x64',
|
|
155
|
+
env,
|
|
156
|
+
logger: console,
|
|
157
|
+
});
|
|
158
|
+
expect(first.sourceKind).toBe('download');
|
|
159
|
+
fs.rmSync(sourceBinaryPath, { force: true });
|
|
160
|
+
fs.rmSync(first.targetPath, { force: true });
|
|
161
|
+
const second = await sidecarUtils.prepareGodotSidecar({
|
|
162
|
+
repoRoot: fakeRepoRoot,
|
|
163
|
+
platform: 'linux',
|
|
164
|
+
arch: 'x64',
|
|
165
|
+
env,
|
|
166
|
+
logger: console,
|
|
167
|
+
});
|
|
168
|
+
expect(second.outcome).toBe('prepared');
|
|
169
|
+
expect(second.sourceKind).toBe('cache');
|
|
170
|
+
expect(fs.existsSync(second.targetPath)).toBe(true);
|
|
171
|
+
});
|
|
172
|
+
test('rejects downloaded godot binaries when sha256 does not match the pinned value', async () => {
|
|
173
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
174
|
+
const downloadRoot = temp.mkdir('downloads');
|
|
175
|
+
const cacheRoot = temp.mkdir('cache');
|
|
176
|
+
const sourceBinaryPath = path.join(downloadRoot, 'godot-linux-x64');
|
|
177
|
+
fs.writeFileSync(sourceBinaryPath, Buffer.alloc(sidecarUtils.MIN_GODOT_BINARY_BYTES + 16, 9));
|
|
178
|
+
await expect(sidecarUtils.prepareGodotSidecar({
|
|
179
|
+
repoRoot: fakeRepoRoot,
|
|
180
|
+
platform: 'linux',
|
|
181
|
+
arch: 'x64',
|
|
182
|
+
env: {
|
|
183
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_URL: (0, url_1.pathToFileURL)(sourceBinaryPath).href,
|
|
184
|
+
NOTE_CONNECTION_GODOT_DOWNLOAD_SHA256: 'deadbeef',
|
|
185
|
+
NOTE_CONNECTION_GODOT_CACHE_DIR: cacheRoot,
|
|
186
|
+
},
|
|
187
|
+
logger: console,
|
|
188
|
+
})).rejects.toThrow(/sha256/i);
|
|
189
|
+
});
|
|
190
|
+
test('does not require a linux host godot binary by default when validating sidecars', () => {
|
|
191
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
192
|
+
const binDir = temp.mkdir(path.join('repo', 'src-tauri', 'bin'));
|
|
193
|
+
fs.writeFileSync(path.join(binDir, 'server-x86_64-unknown-linux-gnu'), 'server');
|
|
194
|
+
fs.writeFileSync(path.join(binDir, 'markdown-worker-x86_64-unknown-linux-gnu'), 'worker');
|
|
195
|
+
const result = sidecarUtils.validateTauriSidecars({
|
|
196
|
+
repoRoot: fakeRepoRoot,
|
|
197
|
+
platform: 'linux',
|
|
198
|
+
arch: 'x64',
|
|
199
|
+
});
|
|
200
|
+
expect(sidecarUtils.resolveHostGodotBinaryName({ platform: 'linux', arch: 'x64' })).toBe('godot-x86_64-unknown-linux-gnu');
|
|
201
|
+
expect(result.invalid).toEqual([]);
|
|
202
|
+
});
|
|
203
|
+
test('requires the windows host godot binary together with server and markdown worker sidecars', () => {
|
|
204
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
205
|
+
const binDir = temp.mkdir(path.join('repo', 'src-tauri', 'bin'));
|
|
206
|
+
fs.writeFileSync(path.join(binDir, 'server-x86_64-pc-windows-msvc.exe'), 'server');
|
|
207
|
+
fs.writeFileSync(path.join(binDir, 'markdown-worker-x86_64-pc-windows-msvc.exe'), 'worker');
|
|
208
|
+
const missingGodot = sidecarUtils.validateTauriSidecars({
|
|
209
|
+
repoRoot: fakeRepoRoot,
|
|
210
|
+
platform: 'win32',
|
|
211
|
+
arch: 'x64',
|
|
212
|
+
});
|
|
213
|
+
expect(missingGodot.invalid).toEqual([
|
|
214
|
+
expect.stringContaining('godot-x86_64-pc-windows-msvc.exe'),
|
|
215
|
+
]);
|
|
216
|
+
fs.writeFileSync(path.join(binDir, 'godot-x86_64-pc-windows-msvc.exe'), Buffer.alloc(sidecarUtils.MIN_GODOT_BINARY_BYTES + 8, 5));
|
|
217
|
+
const ready = sidecarUtils.validateTauriSidecars({
|
|
218
|
+
repoRoot: fakeRepoRoot,
|
|
219
|
+
platform: 'win32',
|
|
220
|
+
arch: 'x64',
|
|
221
|
+
});
|
|
222
|
+
expect(ready.invalid).toEqual([]);
|
|
223
|
+
});
|
|
224
|
+
test('treats git-lfs pointer placeholders as invalid server and markdown-worker sidecars', () => {
|
|
225
|
+
const fakeRepoRoot = temp.mkdir('repo');
|
|
226
|
+
const binDir = temp.mkdir(path.join('repo', 'src-tauri', 'bin'));
|
|
227
|
+
const lfsPointer = [
|
|
228
|
+
'version https://git-lfs.github.com/spec/v1',
|
|
229
|
+
'oid sha256:deadbeef',
|
|
230
|
+
'size 12345678',
|
|
231
|
+
].join('\n');
|
|
232
|
+
fs.writeFileSync(path.join(binDir, 'server-x86_64-unknown-linux-gnu'), lfsPointer);
|
|
233
|
+
fs.writeFileSync(path.join(binDir, 'markdown-worker-x86_64-unknown-linux-gnu'), lfsPointer);
|
|
234
|
+
const result = sidecarUtils.validateTauriSidecars({
|
|
235
|
+
repoRoot: fakeRepoRoot,
|
|
236
|
+
platform: 'linux',
|
|
237
|
+
arch: 'x64',
|
|
238
|
+
});
|
|
239
|
+
expect(result.invalid).toEqual([
|
|
240
|
+
expect.stringContaining('server-x86_64-unknown-linux-gnu'),
|
|
241
|
+
expect.stringContaining('markdown-worker-x86_64-unknown-linux-gnu'),
|
|
242
|
+
]);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
function extractFunctionBody(source, functionName) {
|
|
39
|
+
const functionStart = source.indexOf(`function ${functionName}(`);
|
|
40
|
+
if (functionStart < 0)
|
|
41
|
+
throw new Error(`Function not found: ${functionName}`);
|
|
42
|
+
const openBrace = source.indexOf('{', functionStart);
|
|
43
|
+
let depth = 0;
|
|
44
|
+
for (let index = openBrace; index < source.length; index += 1) {
|
|
45
|
+
if (source[index] === '{')
|
|
46
|
+
depth += 1;
|
|
47
|
+
if (source[index] === '}')
|
|
48
|
+
depth -= 1;
|
|
49
|
+
if (depth === 0)
|
|
50
|
+
return source.slice(openBrace, index + 1);
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Function body is incomplete: ${functionName}`);
|
|
53
|
+
}
|
|
54
|
+
describe('graph answer operator inspector contract', () => {
|
|
55
|
+
const frontendRoot = path.join(__dirname, 'frontend');
|
|
56
|
+
const workspaceSource = fs.readFileSync(path.join(frontendRoot, 'agent_workspace.js'), 'utf8');
|
|
57
|
+
const panesSource = fs.readFileSync(path.join(frontendRoot, 'workspace_panes.js'), 'utf8');
|
|
58
|
+
test('projects plan, coverage, and bounded expansion only through grounding diagnostics', () => {
|
|
59
|
+
expect(workspaceSource).toContain('graphAnswerPlan');
|
|
60
|
+
expect(workspaceSource).toContain('graphAnswerCoverage');
|
|
61
|
+
expect(workspaceSource).toContain('graphExpansion');
|
|
62
|
+
expect(panesSource).toContain('buildEvidenceGraphAnswerPlanHtml');
|
|
63
|
+
expect(panesSource).toContain("agentWorkspace.evidence.graphAnswerPlanLabel");
|
|
64
|
+
expect(panesSource).toContain('missingRequiredClaimIds');
|
|
65
|
+
expect(panesSource).toContain('executedSteps');
|
|
66
|
+
});
|
|
67
|
+
test('does not render plan scaffolding in the public assistant answer block', () => {
|
|
68
|
+
const answerRenderer = extractFunctionBody(workspaceSource, 'appendAssistantConversationResult');
|
|
69
|
+
expect(answerRenderer).not.toContain('graphAnswerPlan');
|
|
70
|
+
expect(answerRenderer).not.toContain('graphAnswerCoverage');
|
|
71
|
+
});
|
|
72
|
+
});
|
package/dist/src/index.js
CHANGED
|
@@ -42,7 +42,7 @@ async function buildGraph(options, maxWorkers, enableGPU, enableGPULayout, memor
|
|
|
42
42
|
const runtimePaths = (0, RuntimePaths_1.resolveRuntimePaths)(__dirname);
|
|
43
43
|
const projectRoot = runtimePaths.projectRoot;
|
|
44
44
|
const runtimeDataDir = runtimePaths.runtimeDataDir;
|
|
45
|
-
let buildOptions = { projectRoot };
|
|
45
|
+
let buildOptions = { projectRoot, knowledgeBaseRoot: runtimePaths.kbRoot };
|
|
46
46
|
if (typeof options === 'string') {
|
|
47
47
|
// Legacy signature support
|
|
48
48
|
buildOptions.targetPath = options;
|
|
@@ -54,7 +54,11 @@ async function buildGraph(options, maxWorkers, enableGPU, enableGPULayout, memor
|
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
// New object signature
|
|
57
|
-
buildOptions = {
|
|
57
|
+
buildOptions = {
|
|
58
|
+
...options,
|
|
59
|
+
projectRoot,
|
|
60
|
+
knowledgeBaseRoot: options.knowledgeBaseRoot ?? runtimePaths.kbRoot,
|
|
61
|
+
};
|
|
58
62
|
// Map frontend 'target' to backend 'targetPath'
|
|
59
63
|
// Frontend uses 'target', BuildOptions interface expects 'targetPath'
|
|
60
64
|
if (options.target && !buildOptions.targetPath) {
|
|
@@ -0,0 +1,118 @@
|
|
|
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 index_1 = require("./index");
|
|
40
|
+
const config_1 = require("./backend/config");
|
|
41
|
+
const NoteConnection_1 = require("./core/NoteConnection");
|
|
42
|
+
describe('Graph builds in the selected knowledge workspace', () => {
|
|
43
|
+
const environmentKeys = [
|
|
44
|
+
'NOTE_CONNECTION_PROJECT_ROOT',
|
|
45
|
+
'NOTE_CONNECTION_KB_ROOT',
|
|
46
|
+
'NOTE_CONNECTION_FRONTEND_DIR',
|
|
47
|
+
'NOTE_CONNECTION_RUNTIME_DATA_DIR',
|
|
48
|
+
];
|
|
49
|
+
const originalConfig = { ...config_1.config, exclusionList: [...config_1.config.exclusionList] };
|
|
50
|
+
let previousEnvironment;
|
|
51
|
+
let fixtureRoot;
|
|
52
|
+
let projectRoot;
|
|
53
|
+
let selectedRoot;
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
previousEnvironment = environmentKeys.map(key => process.env[key]);
|
|
56
|
+
fixtureRoot = fs.realpathSync.native(fs.mkdtempSync(path.join(os.tmpdir(), 'noteconnection-selected-kb-')));
|
|
57
|
+
projectRoot = path.join(fixtureRoot, 'application');
|
|
58
|
+
selectedRoot = path.join(fixtureRoot, 'selected-vault');
|
|
59
|
+
const frontendRoot = path.join(projectRoot, 'dist', 'src', 'frontend');
|
|
60
|
+
const runtimeRoot = path.join(fixtureRoot, 'runtime-data');
|
|
61
|
+
for (const directory of [path.join(projectRoot, 'Knowledge_Base'), path.join(selectedRoot, 'notes'), frontendRoot, runtimeRoot]) {
|
|
62
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
63
|
+
}
|
|
64
|
+
fs.writeFileSync(path.join(projectRoot, 'Knowledge_Base', 'Default.md'), '# Default\nThis is a different workspace.');
|
|
65
|
+
fs.writeFileSync(path.join(selectedRoot, 'notes', 'Alpha.md'), '# Alpha\nAlpha requires [[Beta]].');
|
|
66
|
+
fs.writeFileSync(path.join(selectedRoot, 'notes', 'Beta.md'), '# Beta\nBeta is the prerequisite foundation.');
|
|
67
|
+
[projectRoot, selectedRoot, frontendRoot, runtimeRoot].forEach((directory, index) => {
|
|
68
|
+
process.env[environmentKeys[index]] = directory;
|
|
69
|
+
});
|
|
70
|
+
Object.assign(config_1.config, {
|
|
71
|
+
enableTags: false,
|
|
72
|
+
enableStatisticalInference: false,
|
|
73
|
+
enableVectorSimilarity: false,
|
|
74
|
+
enableHybridInference: false,
|
|
75
|
+
enableGPU: false,
|
|
76
|
+
enableGPULayout: false,
|
|
77
|
+
clusteringStrategy: 'folder',
|
|
78
|
+
maxWorkers: 1,
|
|
79
|
+
exclusionList: [],
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
afterEach(() => {
|
|
83
|
+
environmentKeys.forEach((key, index) => {
|
|
84
|
+
const previous = previousEnvironment[index];
|
|
85
|
+
if (previous === undefined)
|
|
86
|
+
delete process.env[key];
|
|
87
|
+
else
|
|
88
|
+
process.env[key] = previous;
|
|
89
|
+
});
|
|
90
|
+
Object.assign(config_1.config, originalConfig);
|
|
91
|
+
fs.rmSync(fixtureRoot, { recursive: true, force: true });
|
|
92
|
+
});
|
|
93
|
+
test('builds an absolute native target with identities relative to the selected workspace', async () => {
|
|
94
|
+
const graph = await (0, index_1.buildGraph)({ targetPath: path.join(selectedRoot, 'notes') });
|
|
95
|
+
expect(graph.nodes.map((node) => node.id).sort()).toEqual(['Alpha', 'Beta']);
|
|
96
|
+
expect(graph.nodes.find((node) => node.id === 'Alpha')).toEqual(expect.objectContaining({
|
|
97
|
+
canonicalId: 'notes/alpha',
|
|
98
|
+
sourceUri: 'note://workspace/v1/notes/alpha.md',
|
|
99
|
+
}));
|
|
100
|
+
});
|
|
101
|
+
test('resolves a relative CLI target against the selected workspace', async () => {
|
|
102
|
+
const graph = await (0, index_1.buildGraph)('notes');
|
|
103
|
+
expect(graph.nodes.map((node) => node.canonicalId).sort()).toEqual(['notes/alpha', 'notes/beta']);
|
|
104
|
+
});
|
|
105
|
+
test('builds the entire selected workspace without reading the application default', async () => {
|
|
106
|
+
const graph = await (0, index_1.buildGraph)({});
|
|
107
|
+
expect(graph.nodes.map((node) => node.id).sort()).toEqual(['Alpha', 'Beta']);
|
|
108
|
+
});
|
|
109
|
+
test('preserves the direct library default independently of runtime environment overrides', async () => {
|
|
110
|
+
const result = await NoteConnection_1.NoteConnection.build({ projectRoot });
|
|
111
|
+
expect(result.data.nodes.map((node) => node.id)).toEqual(['Default']);
|
|
112
|
+
});
|
|
113
|
+
test('accepts an explicit library knowledge root without moving the application root', async () => {
|
|
114
|
+
const result = await NoteConnection_1.NoteConnection.build({ projectRoot, knowledgeBaseRoot: selectedRoot, targetPath: 'notes' });
|
|
115
|
+
expect(result.stats.fileCount).toBe(2);
|
|
116
|
+
expect(result.data.nodes.map((node) => node.canonicalId).sort()).toEqual(['notes/alpha', 'notes/beta']);
|
|
117
|
+
});
|
|
118
|
+
});
|