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,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ResourceIdentity_1 = require("./backend/ResourceIdentity");
|
|
4
|
+
const Graph_1 = require("./core/Graph");
|
|
5
|
+
describe('mobile identity migration corpus', () => {
|
|
6
|
+
test('keeps same-content documents isolated while preserving cross-root identity', () => {
|
|
7
|
+
const first = (0, ResourceIdentity_1.createResourceIdentity)('notes/first.md', 'First', 'same body');
|
|
8
|
+
const second = (0, ResourceIdentity_1.createResourceIdentity)('notes/second.md', 'Second', 'same body');
|
|
9
|
+
const fromWindows = (0, ResourceIdentity_1.createResourceIdentity)('Notes\\Cafe\u0301.md', 'Cafe', 'body');
|
|
10
|
+
const fromPosix = (0, ResourceIdentity_1.createResourceIdentity)('notes/caf\u00e9.md', 'Cafe', 'body');
|
|
11
|
+
expect(first.revision).toBe(second.revision);
|
|
12
|
+
expect(first.sourceUri).not.toBe(second.sourceUri);
|
|
13
|
+
expect(fromWindows.sourceUri).toBe(fromPosix.sourceUri);
|
|
14
|
+
expect(fromWindows.revision).toBe(fromPosix.revision);
|
|
15
|
+
});
|
|
16
|
+
test('rejects NFC/case collisions before graph mutation', () => {
|
|
17
|
+
expect(() => (0, ResourceIdentity_1.assertUniqueLegacyResourceIds)([
|
|
18
|
+
{ filename: 'Cafe\u0301', filepath: 'one/Cafe\u0301.md' },
|
|
19
|
+
{ filename: 'Caf\u00e9', filepath: 'two/Caf\u00e9.md' },
|
|
20
|
+
])).toThrow(/ambiguous|duplicate/i);
|
|
21
|
+
});
|
|
22
|
+
test('replays a legacy snapshot and rolls back a corrupt candidate atomically', () => {
|
|
23
|
+
const graph = Graph_1.Graph.fromJSON({
|
|
24
|
+
nodes: [
|
|
25
|
+
{ id: 'legacy-a', label: 'A', inDegree: 0, outDegree: 1 },
|
|
26
|
+
{ id: 'legacy-b', label: 'B', inDegree: 1, outDegree: 0 },
|
|
27
|
+
],
|
|
28
|
+
edges: [{ source: 'legacy-a', target: 'legacy-b', type: 'legacy-link', weight: 1 }],
|
|
29
|
+
});
|
|
30
|
+
expect(graph.getOutgoingEdges('legacy-a')).toEqual([
|
|
31
|
+
{ source: 'legacy-a', target: 'legacy-b', type: 'legacy-link', weight: 1 },
|
|
32
|
+
]);
|
|
33
|
+
expect(() => graph.restore({
|
|
34
|
+
nodes: [{ id: 'candidate', label: 'Candidate' }],
|
|
35
|
+
edges: [{ source: 'candidate', target: 'missing' }],
|
|
36
|
+
})).toThrow(/undeclared node/i);
|
|
37
|
+
expect(graph.hasNode('legacy-a')).toBe(true);
|
|
38
|
+
expect(graph.hasNode('candidate')).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
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 verifier = require(path.resolve(__dirname, '..', 'scripts', 'verify-mobile-native-recovery.js'));
|
|
40
|
+
describe('mobile native recovery state-machine contract', () => {
|
|
41
|
+
test('replays all journal phases and fail-closed cases without claiming native evidence', () => {
|
|
42
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'noteconnection-recovery-contract-'));
|
|
43
|
+
const outputPath = path.join(root, 'report.json');
|
|
44
|
+
try {
|
|
45
|
+
const evidence = verifier.runRecoveryVerification({ outputPath });
|
|
46
|
+
expect(evidence.evidenceLevel).toBe('host-recovery-state-machine');
|
|
47
|
+
expect(evidence.nativeDeviceEvidence).toBe(false);
|
|
48
|
+
expect(evidence.scenarios).toEqual(expect.arrayContaining([
|
|
49
|
+
expect.objectContaining({ name: 'staging-target-wins', action: 'target-preserved' }),
|
|
50
|
+
expect.objectContaining({ name: 'backup-restored', action: 'previous-restored' }),
|
|
51
|
+
expect.objectContaining({ name: 'backup-rename-retry', action: 'recovery-pending', backupExists: true, journalExists: true }),
|
|
52
|
+
expect.objectContaining({ name: 'activated-target-wins', action: 'target-preserved' }),
|
|
53
|
+
expect.objectContaining({ name: 'orphan-backup-restored', action: 'orphan-backup-restored' }),
|
|
54
|
+
expect.objectContaining({ name: 'orphan-backup-retry', action: 'orphan-recovery-pending', backupExists: true }),
|
|
55
|
+
expect.objectContaining({ name: 'unsafe-journal-rejected', action: 'unsafe_import_journal' }),
|
|
56
|
+
expect.objectContaining({ name: 'unknown-schema-rejected', action: 'invalid_import_journal' }),
|
|
57
|
+
]));
|
|
58
|
+
expect(JSON.parse(fs.readFileSync(outputPath, 'utf8')).scenarios).toHaveLength(8);
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -59,6 +59,7 @@ describe('dual mobile pipeline configuration', () => {
|
|
|
59
59
|
const scripts = pkg.scripts || {};
|
|
60
60
|
expect(scripts['verify:android:env']).toContain('verify-tauri-android-prereqs.js');
|
|
61
61
|
expect(scripts['tauri:android:patch:pathmode']).toContain('apply-tauri-android-pathmode.js');
|
|
62
|
+
expect(scripts['configure:tauri:android:signing']).toContain('configure-tauri-android-signing.js');
|
|
62
63
|
expect(scripts['smoke:android:pathmode']).toContain('smoke-android-pathmode.js');
|
|
63
64
|
expect(scripts['mobile:build:capacitor']).toBe('build_apk.bat');
|
|
64
65
|
expect(scripts['capture:capacitor:evidence']).toContain('capture-capacitor-device-evidence.js');
|
|
@@ -72,8 +73,17 @@ describe('dual mobile pipeline configuration', () => {
|
|
|
72
73
|
expect(scripts['tauri:android:dev:universal']).toContain('NOTE_CONNECTION_TAURI_ANDROID_TARGET=universal');
|
|
73
74
|
expect(scripts['tauri:android:build:universal']).toContain('NOTE_CONNECTION_TAURI_ANDROID_TARGET=universal');
|
|
74
75
|
expect(scripts['mobile:build:tauri-android']).toBe('npm run tauri:android:build');
|
|
76
|
+
expect(scripts['mobile:build:release']).toBe('npm run mobile:build:tauri-android');
|
|
77
|
+
expect(scripts['mobile:build:release']).not.toContain('capacitor');
|
|
78
|
+
expect(scripts['mobile:build:compatibility']).toBe('npm run mobile:build:both');
|
|
75
79
|
expect(scripts['mobile:build:both']).toContain('mobile:build:capacitor');
|
|
76
80
|
expect(scripts['mobile:build:both']).toContain('mobile:build:tauri-android');
|
|
81
|
+
expect(scripts['verify:mobile:artifact']).toContain('verify-mobile-artifact.js');
|
|
82
|
+
expect(scripts['verify:mobile:artifact:release']).toContain('--require-rss');
|
|
83
|
+
expect(scripts['verify:mobile:artifact:release']).toContain('--require-arm64');
|
|
84
|
+
expect(scripts['verify:mobile:artifact:release']).toContain('--require-signed');
|
|
85
|
+
expect(scripts['capture:tauri:android:evidence']).toContain('capture-tauri-android-rss-evidence.js');
|
|
86
|
+
expect(fs.existsSync(path.join(repoRoot, 'scripts', 'verify-mobile-artifact.js'))).toBe(true);
|
|
77
87
|
});
|
|
78
88
|
test('defaults tauri android build/dev to arm64 target with override support', () => {
|
|
79
89
|
const runnerScript = fs.readFileSync(tauriAndroidRunnerPath, 'utf8');
|
|
@@ -90,7 +100,7 @@ describe('dual mobile pipeline configuration', () => {
|
|
|
90
100
|
expect(capacitorConfig).toContain("allowNavigation: ['localhost', '127.0.0.1']");
|
|
91
101
|
const buildApkScript = fs.readFileSync(buildApkScriptPath, 'utf8');
|
|
92
102
|
expect(buildApkScript).toContain('NOTE_CONNECTION_NO_PAUSE');
|
|
93
|
-
expect(buildApkScript).toContain("dist\\
|
|
103
|
+
expect(buildApkScript).toContain("dist\\mobile-slim\\frontend");
|
|
94
104
|
expect(buildApkScript).toContain('npx cap sync android');
|
|
95
105
|
expect(buildApkScript).toContain('align-capacitor-java-compat.js');
|
|
96
106
|
expect(buildApkScript).toContain('requires JDK 21 or newer.');
|
|
@@ -0,0 +1,225 @@
|
|
|
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 path = __importStar(require("path"));
|
|
39
|
+
const PlatformCapabilities_1 = require("./platform/PlatformCapabilities");
|
|
40
|
+
const RenderMaterializer_1 = require("./platform/RenderMaterializer");
|
|
41
|
+
describe('mobile-slim profile contract', () => {
|
|
42
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
43
|
+
const analyzerPath = path.join(repoRoot, 'src', 'frontend', 'mobile_exact_analyzer.js');
|
|
44
|
+
const projectionContractPath = path.join(repoRoot, 'src', 'frontend', 'knowledge_projection_contract.js');
|
|
45
|
+
const verifierPath = path.join(repoRoot, 'scripts', 'verify-mobile-slim-budget.js');
|
|
46
|
+
const preparePath = path.join(repoRoot, 'scripts', 'prepare-mobile-slim.js');
|
|
47
|
+
test('declares sidecar-free local analysis with optional remote inference and hard budgets', () => {
|
|
48
|
+
const capabilities = (0, PlatformCapabilities_1.resolvePlatformCapabilities)({ exportProfileId: 'mobile-slim' });
|
|
49
|
+
expect(capabilities.retrieval.supportsSidecar).toBe(false);
|
|
50
|
+
expect(capabilities.retrieval.supportsLocalIngest).toBe(true);
|
|
51
|
+
expect(capabilities.retrieval.supportsLocalExactQuery).toBe(true);
|
|
52
|
+
expect(capabilities.retrieval.supportsRemoteInference).toBe(true);
|
|
53
|
+
expect(capabilities.retrieval.requiresRemoteInference).toBe(false);
|
|
54
|
+
expect(capabilities.export.assetBudgetBytes).toBe(25 * 1024 * 1024);
|
|
55
|
+
expect(capabilities.export.maxResidentBytes).toBe(256 * 1024 * 1024);
|
|
56
|
+
});
|
|
57
|
+
test('rejects SVG materialization for mobile even when explicitly requested', () => {
|
|
58
|
+
const decision = (0, RenderMaterializer_1.resolveRenderMaterializationDecision)({
|
|
59
|
+
exportProfileId: 'mobile-slim',
|
|
60
|
+
includeSvg: true,
|
|
61
|
+
includeStages: true,
|
|
62
|
+
rendererPreference: 'frontend',
|
|
63
|
+
});
|
|
64
|
+
expect(decision.includeSvg).toBe(false);
|
|
65
|
+
expect(decision.vectorSuppressed).toBe(true);
|
|
66
|
+
expect(decision.responseArtifact).toBe('png');
|
|
67
|
+
expect(decision.rendererPreference).toBe('local');
|
|
68
|
+
});
|
|
69
|
+
test('ships a callable bounded exact graph analyzer without retaining document bodies', () => {
|
|
70
|
+
expect(fs.existsSync(analyzerPath)).toBe(true);
|
|
71
|
+
const analyzer = require(analyzerPath);
|
|
72
|
+
const index = analyzer.createMobileExactIndex({
|
|
73
|
+
nodes: [
|
|
74
|
+
{ id: 'fundamentals/alpha', label: 'Alpha', content: 'must not be retained' },
|
|
75
|
+
{ id: 'fundamentals/beta', label: 'Beta', metadata: { tags: ['core'] } },
|
|
76
|
+
{ id: 'advanced/gamma', label: 'Gamma' },
|
|
77
|
+
],
|
|
78
|
+
edges: [
|
|
79
|
+
{ source: 'fundamentals/alpha', target: 'fundamentals/beta', type: 'prerequisite' },
|
|
80
|
+
{ source: 'fundamentals/beta', target: 'advanced/gamma', type: 'next' },
|
|
81
|
+
],
|
|
82
|
+
});
|
|
83
|
+
expect(index.searchExact('beta')).toEqual([
|
|
84
|
+
expect.objectContaining({ id: 'fundamentals/beta' }),
|
|
85
|
+
]);
|
|
86
|
+
expect(index.searchExact('core')).toEqual([
|
|
87
|
+
expect.objectContaining({ id: 'fundamentals/beta' }),
|
|
88
|
+
]);
|
|
89
|
+
expect(index.neighbors('fundamentals/beta')).toEqual([
|
|
90
|
+
expect.objectContaining({ id: 'advanced/gamma' }),
|
|
91
|
+
expect.objectContaining({ id: 'fundamentals/alpha' }),
|
|
92
|
+
]);
|
|
93
|
+
expect(index.shortestPath('fundamentals/alpha', 'advanced/gamma')).toEqual([
|
|
94
|
+
'fundamentals/alpha',
|
|
95
|
+
'fundamentals/beta',
|
|
96
|
+
'advanced/gamma',
|
|
97
|
+
]);
|
|
98
|
+
expect(index.statistics()).toEqual({ nodeCount: 3, edgeCount: 2 });
|
|
99
|
+
expect(JSON.stringify(index.searchExact('alpha'))).not.toContain('must not be retained');
|
|
100
|
+
});
|
|
101
|
+
test('normalizes exact lookup keys independently of the device locale', () => {
|
|
102
|
+
const analyzerSource = fs.readFileSync(analyzerPath, 'utf8');
|
|
103
|
+
const analyzer = require(analyzerPath);
|
|
104
|
+
const index = analyzer.createMobileExactIndex({
|
|
105
|
+
nodes: [{ id: 'unicode-i', label: '\u0130' }],
|
|
106
|
+
edges: [],
|
|
107
|
+
});
|
|
108
|
+
expect(analyzerSource).not.toContain('.toLocaleLowerCase(');
|
|
109
|
+
expect(index.searchExact('i\u0307')).toEqual([
|
|
110
|
+
expect.objectContaining({ id: 'unicode-i' }),
|
|
111
|
+
]);
|
|
112
|
+
});
|
|
113
|
+
test('does not cross the requested visited-node ceiling during path traversal', () => {
|
|
114
|
+
const analyzer = require(analyzerPath);
|
|
115
|
+
const index = analyzer.createMobileExactIndex({
|
|
116
|
+
nodes: [
|
|
117
|
+
{ id: 'source' },
|
|
118
|
+
{ id: 'first-branch' },
|
|
119
|
+
{ id: 'target' },
|
|
120
|
+
],
|
|
121
|
+
edges: [
|
|
122
|
+
{ source: 'source', target: 'first-branch' },
|
|
123
|
+
{ source: 'source', target: 'target' },
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
expect(index.shortestPath('source', 'target', 2, 2)).toBeNull();
|
|
127
|
+
});
|
|
128
|
+
test('exposes exact query and path operations through the runtime storage boundary', () => {
|
|
129
|
+
const storageProvider = fs.readFileSync(path.join(repoRoot, 'src', 'frontend', 'storage_provider.js'), 'utf8');
|
|
130
|
+
const indexHtml = fs.readFileSync(path.join(repoRoot, 'src', 'frontend', 'index.html'), 'utf8');
|
|
131
|
+
const analyzerScriptOffset = indexHtml.indexOf('<script src="mobile_exact_analyzer.js"></script>');
|
|
132
|
+
const identityScriptOffset = indexHtml.indexOf('<script src="mobile_identity_contract.js"></script>');
|
|
133
|
+
const storageScriptOffset = indexHtml.indexOf('<script src="storage_provider.js"></script>');
|
|
134
|
+
expect(storageProvider).toContain('async queryKnowledgeBaseExact(request)');
|
|
135
|
+
expect(storageProvider).toContain('async findKnowledgePath(request)');
|
|
136
|
+
expect(storageProvider).toContain("this.readGeneratedAsset('graph_data.json')");
|
|
137
|
+
expect(analyzerScriptOffset).toBeGreaterThan(-1);
|
|
138
|
+
expect(identityScriptOffset).toBeGreaterThan(analyzerScriptOffset);
|
|
139
|
+
expect(identityScriptOffset).toBeLessThan(storageScriptOffset);
|
|
140
|
+
expect(analyzerScriptOffset).toBeLessThan(storageScriptOffset);
|
|
141
|
+
});
|
|
142
|
+
test('loads one versioned projection contract before both mobile consumers', () => {
|
|
143
|
+
const projectionContract = fs.readFileSync(projectionContractPath, 'utf8');
|
|
144
|
+
const storageProvider = fs.readFileSync(path.join(repoRoot, 'src', 'frontend', 'storage_provider.js'), 'utf8');
|
|
145
|
+
const indexHtml = fs.readFileSync(path.join(repoRoot, 'src', 'frontend', 'index.html'), 'utf8');
|
|
146
|
+
const projectionScriptOffset = indexHtml.indexOf('<script src="knowledge_projection_contract.js"></script>');
|
|
147
|
+
expect(projectionContract).toContain('schemaVersion: SCHEMA_VERSION');
|
|
148
|
+
expect(projectionContract).toContain('MAX_NEIGHBORS');
|
|
149
|
+
expect(storageProvider).toContain('window.NoteConnectionKnowledgeProjection');
|
|
150
|
+
expect(storageProvider).toContain('createKnowledgeProjection');
|
|
151
|
+
expect(storageProvider).toContain('createFileProjectionStore');
|
|
152
|
+
expect(storageProvider).toContain("fileName: 'graph_data.json'");
|
|
153
|
+
expect(projectionScriptOffset).toBeGreaterThan(-1);
|
|
154
|
+
expect(projectionScriptOffset).toBeLessThan(indexHtml.indexOf('<script src="mobile_exact_analyzer.js"></script>'));
|
|
155
|
+
expect(projectionScriptOffset).toBeLessThan(indexHtml.indexOf('<script src="storage_provider.js"></script>'));
|
|
156
|
+
});
|
|
157
|
+
test('fails closed for oversized, forbidden, and over-RSS mobile staging evidence', () => {
|
|
158
|
+
expect(fs.existsSync(verifierPath)).toBe(true);
|
|
159
|
+
const verifier = require(verifierPath);
|
|
160
|
+
const fixtureRoot = fs.mkdtempSync(path.join(repoRoot, '.mobile-slim-contract-'));
|
|
161
|
+
try {
|
|
162
|
+
fs.writeFileSync(path.join(fixtureRoot, 'index.html'), crypto.randomBytes(2048));
|
|
163
|
+
expect(() => verifier.assertMobileSlimBudget({
|
|
164
|
+
stagingDir: fixtureRoot,
|
|
165
|
+
assetBudgetBytes: 128,
|
|
166
|
+
maxResidentBytes: 1024,
|
|
167
|
+
})).toThrow(/compressed payload/i);
|
|
168
|
+
fs.rmSync(path.join(fixtureRoot, 'index.html'));
|
|
169
|
+
fs.writeFileSync(path.join(fixtureRoot, 'server-aarch64-linux'), 'forbidden');
|
|
170
|
+
expect(() => verifier.assertMobileSlimBudget({
|
|
171
|
+
stagingDir: fixtureRoot,
|
|
172
|
+
assetBudgetBytes: 4096,
|
|
173
|
+
maxResidentBytes: 1024,
|
|
174
|
+
})).toThrow(/forbidden mobile artifact/i);
|
|
175
|
+
fs.rmSync(path.join(fixtureRoot, 'server-aarch64-linux'));
|
|
176
|
+
fs.writeFileSync(path.join(fixtureRoot, 'index.html'), 'ok');
|
|
177
|
+
const rssEvidencePath = path.join(fixtureRoot, 'rss-evidence.json');
|
|
178
|
+
fs.writeFileSync(rssEvidencePath, JSON.stringify({ peakResidentBytes: 2048 }));
|
|
179
|
+
expect(() => verifier.assertMobileSlimBudget({
|
|
180
|
+
stagingDir: fixtureRoot,
|
|
181
|
+
assetBudgetBytes: 4096,
|
|
182
|
+
maxResidentBytes: 1024,
|
|
183
|
+
rssEvidencePath,
|
|
184
|
+
})).toThrow(/peak RSS/i);
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
fs.rmSync(fixtureRoot, { recursive: true, force: true });
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
test('routes both Android packagers through the deterministic mobile staging directory', () => {
|
|
191
|
+
expect(fs.existsSync(preparePath)).toBe(true);
|
|
192
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, 'package.json'), 'utf8'));
|
|
193
|
+
const capacitorConfig = fs.readFileSync(path.join(repoRoot, 'capacitor.config.ts'), 'utf8');
|
|
194
|
+
const capacitorBuild = fs.readFileSync(path.join(repoRoot, 'build_apk.bat'), 'utf8');
|
|
195
|
+
const tauriAndroidConfig = JSON.parse(fs.readFileSync(path.join(repoRoot, 'src-tauri', 'tauri.android.conf.json'), 'utf8'));
|
|
196
|
+
expect(pkg.scripts['mobile:prepare:slim']).toContain('prepare-mobile-slim.js');
|
|
197
|
+
expect(pkg.scripts['mobile:prepare:slim']).toContain('verify-mobile-slim-budget.js');
|
|
198
|
+
expect(pkg.scripts['tauri:android:init']).toContain('mobile:prepare:slim');
|
|
199
|
+
expect(pkg.scripts['verify:mobile:slim:budget']).toContain('verify-mobile-slim-budget.js');
|
|
200
|
+
expect(pkg.scripts['tauri:android:build']).toContain('mobile:prepare:slim');
|
|
201
|
+
expect(pkg.scripts['tauri:android:build']).not.toContain('build:sidecar');
|
|
202
|
+
expect(capacitorConfig).toContain('NOTE_CONNECTION_MOBILE_WEB_DIR');
|
|
203
|
+
expect(capacitorBuild).toContain('npm run mobile:prepare:slim');
|
|
204
|
+
expect(capacitorBuild).toContain('NOTE_CONNECTION_MOBILE_WEB_DIR');
|
|
205
|
+
expect(tauriAndroidConfig.build?.frontendDist).toBe('../dist/mobile-slim/frontend');
|
|
206
|
+
expect(tauriAndroidConfig.bundle?.externalBin).toEqual([]);
|
|
207
|
+
});
|
|
208
|
+
test('keeps Godot Android integration explicit instead of enabling it in mobile-slim', () => {
|
|
209
|
+
const runner = fs.readFileSync(path.join(repoRoot, 'scripts', 'run-tauri-android.js'), 'utf8');
|
|
210
|
+
const patcher = fs.readFileSync(path.join(repoRoot, 'scripts', 'apply-tauri-android-pathmode.js'), 'utf8');
|
|
211
|
+
expect(runner).toContain('NOTE_CONNECTION_ANDROID_INCLUDE_GODOT_PATHMODE');
|
|
212
|
+
expect(runner).toContain("runPathmodePatch({ mode: 'disable'");
|
|
213
|
+
expect(patcher).toContain("process.argv.includes('--disable')");
|
|
214
|
+
expect(patcher).toContain('removePathmodeAssets');
|
|
215
|
+
});
|
|
216
|
+
test('keeps the semantic comparator out of mobile-slim runtime staging', () => {
|
|
217
|
+
const prepareSource = fs.readFileSync(preparePath, 'utf8');
|
|
218
|
+
expect(prepareSource).toContain('mobile_semantic_comparator\\.js');
|
|
219
|
+
});
|
|
220
|
+
test('does not allocate the full-content graph on Android runtime builds', () => {
|
|
221
|
+
const rustSource = fs.readFileSync(path.join(repoRoot, 'src-tauri', 'src', 'lib.rs'), 'utf8');
|
|
222
|
+
expect(rustSource).toContain('#[cfg(not(target_os = "android"))]\n let full_nodes');
|
|
223
|
+
expect(rustSource).toContain('#[cfg(not(target_os = "android"))]\n let full_graph');
|
|
224
|
+
});
|
|
225
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
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 path = __importStar(require("path"));
|
|
37
|
+
const comparator = require(path.resolve(__dirname, 'frontend', 'mobile_semantic_comparator.js'));
|
|
38
|
+
const projectionContract = require(path.resolve(__dirname, 'frontend', 'knowledge_projection_contract.js'));
|
|
39
|
+
describe('cross-host mobile semantic parity', () => {
|
|
40
|
+
test('matches canonical nodes and directed edge provenance across host-specific ids', () => {
|
|
41
|
+
const left = projectionContract.createKnowledgeProjection({
|
|
42
|
+
nodes: [
|
|
43
|
+
{ id: 'base', canonicalId: 'financial/base', sourceUri: 'note://workspace/v1/financial/base.md' },
|
|
44
|
+
{ id: 'intro', canonicalId: 'financial/intro', sourceUri: 'note://workspace/v1/financial/intro.md' },
|
|
45
|
+
],
|
|
46
|
+
edges: [{
|
|
47
|
+
source: 'base',
|
|
48
|
+
target: 'intro',
|
|
49
|
+
sourceUri: 'note://workspace/v1/financial/base.md',
|
|
50
|
+
targetUri: 'note://workspace/v1/financial/intro.md',
|
|
51
|
+
type: 'explicit-prerequisite',
|
|
52
|
+
kind: 'explicit',
|
|
53
|
+
provenance: 'explicit-prerequisite',
|
|
54
|
+
}],
|
|
55
|
+
});
|
|
56
|
+
const right = projectionContract.createKnowledgeProjection({
|
|
57
|
+
nodes: [
|
|
58
|
+
{ id: 'financial/base', canonicalId: 'financial/base', sourceUri: 'note://workspace/v1/financial/base.md' },
|
|
59
|
+
{ id: 'financial/intro', canonicalId: 'financial/intro', sourceUri: 'note://workspace/v1/financial/intro.md' },
|
|
60
|
+
],
|
|
61
|
+
edges: [{
|
|
62
|
+
source: 'financial/base',
|
|
63
|
+
target: 'financial/intro',
|
|
64
|
+
type: 'explicit-prerequisite',
|
|
65
|
+
kind: 'explicit',
|
|
66
|
+
provenance: 'explicit-prerequisite',
|
|
67
|
+
}],
|
|
68
|
+
});
|
|
69
|
+
expect(comparator.compareSemanticProjections(left, right).equal).toBe(true);
|
|
70
|
+
expect(() => comparator.assertSemanticParity(left, right, 'fixture')).not.toThrow();
|
|
71
|
+
});
|
|
72
|
+
test('reports provenance changes instead of collapsing same-endpoint edges', () => {
|
|
73
|
+
const left = {
|
|
74
|
+
nodes: [
|
|
75
|
+
{ id: 'a', canonicalId: 'a', sourceUri: 'note://workspace/v1/a.md' },
|
|
76
|
+
{ id: 'b', canonicalId: 'b', sourceUri: 'note://workspace/v1/b.md' },
|
|
77
|
+
],
|
|
78
|
+
edges: [{ source: 'a', target: 'b', type: 'wiki-link', provenance: 'wiki-link' }],
|
|
79
|
+
};
|
|
80
|
+
const right = {
|
|
81
|
+
nodes: [
|
|
82
|
+
{ id: 'a', canonicalId: 'a', sourceUri: 'note://workspace/v1/a.md' },
|
|
83
|
+
{ id: 'b', canonicalId: 'b', sourceUri: 'note://workspace/v1/b.md' },
|
|
84
|
+
],
|
|
85
|
+
edges: [{ source: 'a', target: 'b', type: 'markdown-link', provenance: 'markdown-link' }],
|
|
86
|
+
};
|
|
87
|
+
const comparison = comparator.compareSemanticProjections(left, right);
|
|
88
|
+
expect(comparison.equal).toBe(false);
|
|
89
|
+
expect(comparison.extraEdges.length).toBeGreaterThan(0);
|
|
90
|
+
expect(() => comparator.assertSemanticParity(left, right, 'provenance')).toThrow(/semantic projection parity failed/);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
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 path = __importStar(require("path"));
|
|
37
|
+
// The analyzer is deliberately a browser-compatible CommonJS/IIFE artifact so
|
|
38
|
+
// the same projection can be replayed in Capacitor and the desktop test runner.
|
|
39
|
+
const analyzer = require(path.resolve(__dirname, 'frontend', 'mobile_exact_analyzer.js'));
|
|
40
|
+
describe('mobile exact projection contract', () => {
|
|
41
|
+
test('indexes stable URI aliases and separates explicit from inferred edges', () => {
|
|
42
|
+
const index = analyzer.createMobileExactIndex({
|
|
43
|
+
nodes: [
|
|
44
|
+
{
|
|
45
|
+
id: 'Legacy A',
|
|
46
|
+
label: 'A',
|
|
47
|
+
sourceUri: 'note://workspace/v1/a.md',
|
|
48
|
+
identityAliases: ['a.md'],
|
|
49
|
+
metadata: { tags: ['algebra'] },
|
|
50
|
+
},
|
|
51
|
+
{ id: 'B', label: 'B' },
|
|
52
|
+
],
|
|
53
|
+
edges: [
|
|
54
|
+
{ source: 'Legacy A', target: 'B', type: 'explicit-prerequisite' },
|
|
55
|
+
{ source: 'B', target: 'Legacy A', type: 'vector-association' },
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
expect(index.searchExact('note://workspace/v1/a.md', 5)[0]).toEqual(expect.objectContaining({
|
|
59
|
+
id: 'Legacy A',
|
|
60
|
+
sourceUri: 'note://workspace/v1/a.md',
|
|
61
|
+
}));
|
|
62
|
+
expect(index.neighbors('note://workspace/v1/a.md', 5, ['explicit'])).toEqual([
|
|
63
|
+
expect.objectContaining({ id: 'B', edgeKind: 'explicit' }),
|
|
64
|
+
]);
|
|
65
|
+
expect(index.statistics({ includeProvenance: true })).toEqual(expect.objectContaining({
|
|
66
|
+
projectionVersion: 1,
|
|
67
|
+
edgeCount: 2,
|
|
68
|
+
explicitEdgeCount: 1,
|
|
69
|
+
inferredEdgeCount: 1,
|
|
70
|
+
}));
|
|
71
|
+
});
|
|
72
|
+
test('resolves a source URI in bounded path queries', () => {
|
|
73
|
+
const index = analyzer.createMobileExactIndex({
|
|
74
|
+
nodes: [
|
|
75
|
+
{ id: 'A', sourceUri: 'note://workspace/v1/a.md' },
|
|
76
|
+
{ id: 'B', sourceUri: 'note://workspace/v1/b.md' },
|
|
77
|
+
],
|
|
78
|
+
edges: [{ source: 'A', target: 'B', type: 'sequence' }],
|
|
79
|
+
});
|
|
80
|
+
expect(index.shortestPath('note://workspace/v1/a.md', 'note://workspace/v1/b.md', 4, 10)).toEqual(['A', 'B']);
|
|
81
|
+
});
|
|
82
|
+
test('resolves a path-derived canonical id without changing the legacy node id', () => {
|
|
83
|
+
const index = analyzer.createMobileExactIndex({
|
|
84
|
+
nodes: [{ id: 'Index', canonicalId: 'algebra/index', label: 'Index' }],
|
|
85
|
+
edges: [],
|
|
86
|
+
});
|
|
87
|
+
expect(index.searchExact('algebra/index', 5)).toEqual([
|
|
88
|
+
expect.objectContaining({ id: 'Index', canonicalId: 'algebra/index' }),
|
|
89
|
+
]);
|
|
90
|
+
});
|
|
91
|
+
test('builds a bounded prerequisite-aware learning route from explicit graph edges', () => {
|
|
92
|
+
const index = analyzer.createMobileExactIndex({
|
|
93
|
+
nodes: [
|
|
94
|
+
{ id: 'water', label: 'Water molecules' },
|
|
95
|
+
{ id: 'ice', label: 'Amorphous ice' },
|
|
96
|
+
{ id: 'rdf', label: 'Radial distribution function g(r)' },
|
|
97
|
+
{ id: 'application', label: 'Applications' },
|
|
98
|
+
],
|
|
99
|
+
edges: [
|
|
100
|
+
{ source: 'water', target: 'ice', type: 'explicit-prerequisite' },
|
|
101
|
+
{ source: 'ice', target: 'rdf', type: 'sequence' },
|
|
102
|
+
{ source: 'ice', target: 'application', type: 'application' },
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
expect(index.learningRoute('ice', 6)).toEqual([
|
|
106
|
+
expect.objectContaining({ nodeId: 'water', role: 'prerequisite', order: 1, orderingBasis: 'explicit_prerequisite' }),
|
|
107
|
+
expect.objectContaining({ nodeId: 'ice', role: 'core', order: 2 }),
|
|
108
|
+
expect.objectContaining({ nodeId: 'rdf', role: 'mechanism', order: 3 }),
|
|
109
|
+
expect.objectContaining({ nodeId: 'application', role: 'application', order: 4 }),
|
|
110
|
+
]);
|
|
111
|
+
expect(index.learningRoute('ice', 2)).toHaveLength(2);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -48,6 +48,7 @@ const os = __importStar(require("os"));
|
|
|
48
48
|
const path = __importStar(require("path"));
|
|
49
49
|
const TOML = __importStar(require("@iarna/toml"));
|
|
50
50
|
const constants_1 = require("./constants");
|
|
51
|
+
const providerTemplates_1 = require("./providerTemplates");
|
|
51
52
|
const NOTEMD_BOOLEAN_KEYS = [
|
|
52
53
|
'developerMode',
|
|
53
54
|
'useCustomConceptNoteFolder',
|
|
@@ -142,8 +143,8 @@ exports.DEFAULT_PATH_MODE_SETTINGS = {
|
|
|
142
143
|
auto_reconstruct: true,
|
|
143
144
|
retain_history: true,
|
|
144
145
|
focus_mode: true,
|
|
145
|
-
background: '
|
|
146
|
-
bg_brightness: 1
|
|
146
|
+
background: '',
|
|
147
|
+
bg_brightness: 0.1,
|
|
147
148
|
reading_mode: 'window',
|
|
148
149
|
reader_render_mode: 'render',
|
|
149
150
|
reader_toggle_source_shortcut: 'Ctrl+M',
|
|
@@ -382,7 +383,7 @@ function normalizePathModeSettingsValue(raw) {
|
|
|
382
383
|
}
|
|
383
384
|
const brightness = readNumber(section, 'bg_brightness');
|
|
384
385
|
if (typeof brightness === 'number') {
|
|
385
|
-
merged.bg_brightness = clampNumber(brightness, 0.
|
|
386
|
+
merged.bg_brightness = clampNumber(brightness, 0.0, 0.1);
|
|
386
387
|
}
|
|
387
388
|
merged.reading_mode = normalizePathModeReadingMode(readString(section, 'reading_mode') || merged.reading_mode);
|
|
388
389
|
merged.reader_render_mode = normalizePathModeRenderMode(readString(section, 'reader_render_mode') || merged.reader_render_mode);
|
|
@@ -597,7 +598,7 @@ function extractNotemdSettingsFromAppConfig(appConfig) {
|
|
|
597
598
|
return mergedSettings;
|
|
598
599
|
}
|
|
599
600
|
function applyNotemdSettingsToAppConfig(appConfig, settings) {
|
|
600
|
-
|
|
601
|
+
let nextNotemdSection = isObjectRecord(appConfig.notemd) ? { ...appConfig.notemd } : {};
|
|
601
602
|
const activeProvider = settings.providers.find((provider) => provider.name === settings.activeProvider) ||
|
|
602
603
|
settings.providers[0] ||
|
|
603
604
|
constants_1.DEFAULT_SETTINGS.providers[0];
|
|
@@ -656,6 +657,7 @@ function applyNotemdSettingsToAppConfig(appConfig, settings) {
|
|
|
656
657
|
api_version: activeProvider.apiVersion || '',
|
|
657
658
|
temperature: activeProvider.temperature,
|
|
658
659
|
};
|
|
660
|
+
nextNotemdSection = (0, providerTemplates_1.mergeProviderTemplatesIntoNotemdSection)(nextNotemdSection);
|
|
659
661
|
return {
|
|
660
662
|
...appConfig,
|
|
661
663
|
notemd: nextNotemdSection,
|