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,144 @@
|
|
|
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 createStoredZip(entries) {
|
|
39
|
+
const localParts = [];
|
|
40
|
+
const centralParts = [];
|
|
41
|
+
let localOffset = 0;
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const name = Buffer.from(entry.name, 'utf8');
|
|
44
|
+
const local = Buffer.alloc(30 + name.length + entry.content.length);
|
|
45
|
+
local.writeUInt32LE(0x04034b50, 0);
|
|
46
|
+
local.writeUInt16LE(20, 4);
|
|
47
|
+
local.writeUInt16LE(0, 6);
|
|
48
|
+
local.writeUInt16LE(0, 8);
|
|
49
|
+
local.writeUInt16LE(0, 10);
|
|
50
|
+
local.writeUInt16LE(0, 12);
|
|
51
|
+
local.writeUInt32LE(0, 14);
|
|
52
|
+
local.writeUInt32LE(entry.content.length, 18);
|
|
53
|
+
local.writeUInt32LE(entry.content.length, 22);
|
|
54
|
+
local.writeUInt16LE(name.length, 26);
|
|
55
|
+
local.writeUInt16LE(0, 28);
|
|
56
|
+
name.copy(local, 30);
|
|
57
|
+
entry.content.copy(local, 30 + name.length);
|
|
58
|
+
localParts.push(local);
|
|
59
|
+
const central = Buffer.alloc(46 + name.length);
|
|
60
|
+
central.writeUInt32LE(0x02014b50, 0);
|
|
61
|
+
central.writeUInt16LE(20, 4);
|
|
62
|
+
central.writeUInt16LE(20, 6);
|
|
63
|
+
central.writeUInt16LE(0, 8);
|
|
64
|
+
central.writeUInt16LE(0, 10);
|
|
65
|
+
central.writeUInt16LE(0, 12);
|
|
66
|
+
central.writeUInt16LE(0, 14);
|
|
67
|
+
central.writeUInt32LE(0, 16);
|
|
68
|
+
central.writeUInt32LE(entry.content.length, 20);
|
|
69
|
+
central.writeUInt32LE(entry.content.length, 24);
|
|
70
|
+
central.writeUInt16LE(name.length, 28);
|
|
71
|
+
central.writeUInt16LE(0, 30);
|
|
72
|
+
central.writeUInt16LE(0, 32);
|
|
73
|
+
central.writeUInt16LE(0, 34);
|
|
74
|
+
central.writeUInt16LE(0, 36);
|
|
75
|
+
central.writeUInt32LE(0, 38);
|
|
76
|
+
central.writeUInt32LE(localOffset, 42);
|
|
77
|
+
name.copy(central, 46);
|
|
78
|
+
centralParts.push(central);
|
|
79
|
+
localOffset += local.length;
|
|
80
|
+
}
|
|
81
|
+
const localData = Buffer.concat(localParts);
|
|
82
|
+
const centralData = Buffer.concat(centralParts);
|
|
83
|
+
const eocd = Buffer.alloc(22);
|
|
84
|
+
eocd.writeUInt32LE(0x06054b50, 0);
|
|
85
|
+
eocd.writeUInt16LE(0, 8);
|
|
86
|
+
eocd.writeUInt16LE(entries.length, 10);
|
|
87
|
+
eocd.writeUInt32LE(centralData.length, 12);
|
|
88
|
+
eocd.writeUInt32LE(localData.length, 16);
|
|
89
|
+
return Buffer.concat([localData, centralData, eocd]);
|
|
90
|
+
}
|
|
91
|
+
describe('mobile APK/AAB artifact verifier contract', () => {
|
|
92
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
93
|
+
const verifier = require(path.join(repoRoot, 'scripts', 'verify-mobile-artifact.js'));
|
|
94
|
+
let fixtureRoot;
|
|
95
|
+
beforeEach(() => {
|
|
96
|
+
fixtureRoot = fs.mkdtempSync(path.join(repoRoot, '.tmp-mobile-artifact-'));
|
|
97
|
+
});
|
|
98
|
+
afterEach(() => {
|
|
99
|
+
fs.rmSync(fixtureRoot, { recursive: true, force: true });
|
|
100
|
+
});
|
|
101
|
+
test('checks APK entries and requires RSS in release mode', () => {
|
|
102
|
+
const artifactPath = path.join(fixtureRoot, 'app-arm64-v8a.apk');
|
|
103
|
+
const rssPath = path.join(fixtureRoot, 'rss.json');
|
|
104
|
+
fs.writeFileSync(artifactPath, createStoredZip([
|
|
105
|
+
{ name: 'assets/index.html', content: Buffer.from('<html />') },
|
|
106
|
+
{ name: 'lib/arm64-v8a/libnoteconnection.so', content: Buffer.from('runtime') },
|
|
107
|
+
]));
|
|
108
|
+
fs.writeFileSync(rssPath, JSON.stringify({ peakResidentBytes: 128 * 1024 * 1024 }));
|
|
109
|
+
const result = verifier.verifyMobileArtifact({
|
|
110
|
+
artifactPath,
|
|
111
|
+
profile: 'mobile-low',
|
|
112
|
+
rssEvidencePath: rssPath,
|
|
113
|
+
requireRss: true,
|
|
114
|
+
requireArm64Only: true,
|
|
115
|
+
});
|
|
116
|
+
expect(result.artifactKind).toBe('apk');
|
|
117
|
+
expect(result.rssStatus).toBe('within-budget');
|
|
118
|
+
expect(result.hasArm64Payload).toBe(true);
|
|
119
|
+
expect(result.nativeAbis).toEqual(['arm64-v8a']);
|
|
120
|
+
expect(result.compressedPayloadBytes).toBeGreaterThan(0);
|
|
121
|
+
});
|
|
122
|
+
test('rejects forbidden runtime entries and missing release RSS evidence', () => {
|
|
123
|
+
const artifactPath = path.join(fixtureRoot, 'app.aab');
|
|
124
|
+
fs.writeFileSync(artifactPath, createStoredZip([
|
|
125
|
+
{ name: 'assets/models/tiny.gguf', content: Buffer.from('model') },
|
|
126
|
+
]));
|
|
127
|
+
expect(() => verifier.verifyMobileArtifact({ artifactPath, profile: 'mobile-standard' }))
|
|
128
|
+
.toThrow(/Forbidden mobile artifact entries/);
|
|
129
|
+
const cleanArtifactPath = path.join(fixtureRoot, 'clean.aab');
|
|
130
|
+
fs.writeFileSync(cleanArtifactPath, createStoredZip([
|
|
131
|
+
{ name: 'assets/index.html', content: Buffer.from('<html />') },
|
|
132
|
+
]));
|
|
133
|
+
expect(() => verifier.verifyMobileArtifact({
|
|
134
|
+
artifactPath: cleanArtifactPath,
|
|
135
|
+
profile: 'mobile-standard',
|
|
136
|
+
requireRss: true,
|
|
137
|
+
})).toThrow(/RSS evidence is required/);
|
|
138
|
+
expect(() => verifier.verifyMobileArtifact({
|
|
139
|
+
artifactPath: cleanArtifactPath,
|
|
140
|
+
profile: 'mobile-standard',
|
|
141
|
+
requireSigned: true,
|
|
142
|
+
})).toThrow(/signature/i);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
const vm = __importStar(require("vm"));
|
|
39
|
+
const MobileBudget_1 = require("./platform/MobileBudget");
|
|
40
|
+
describe('versioned mobile budget contract', () => {
|
|
41
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
42
|
+
const contractPath = path.join(repoRoot, 'config', 'mobile-budget.v1.json');
|
|
43
|
+
const contractModulePath = path.join(repoRoot, 'scripts', 'mobile-budget-contract.js');
|
|
44
|
+
const slimVerifierPath = path.join(repoRoot, 'scripts', 'verify-mobile-slim-budget.js');
|
|
45
|
+
const artifactVerifierPath = path.join(repoRoot, 'scripts', 'verify-mobile-artifact.js');
|
|
46
|
+
const preparePath = path.join(repoRoot, 'scripts', 'prepare-mobile-slim.js');
|
|
47
|
+
const runtimeProjectionPath = path.join(repoRoot, 'src', 'frontend', 'mobile_budget_runtime.js');
|
|
48
|
+
test('declares matching low and standard artifact/RSS profiles plus runtime limits', () => {
|
|
49
|
+
const contract = JSON.parse(fs.readFileSync(contractPath, 'utf8'));
|
|
50
|
+
const loaded = require(contractModulePath);
|
|
51
|
+
const slimVerifier = require(slimVerifierPath);
|
|
52
|
+
const artifactVerifier = require(artifactVerifierPath);
|
|
53
|
+
expect(loaded.MOBILE_BUDGET_CONTRACT.schemaVersion).toBe(contract.schemaVersion);
|
|
54
|
+
expect(loaded.MOBILE_BUDGET_CONTRACT.profiles).toEqual(contract.profiles);
|
|
55
|
+
expect(loaded.MOBILE_BUDGET_CONTRACT.runtime).toEqual(contract.runtime);
|
|
56
|
+
expect(loaded.MOBILE_BUDGET_CONTRACT.contractSha256).toMatch(/^[a-f0-9]{64}$/);
|
|
57
|
+
expect(slimVerifier.DEFAULT_ASSET_BUDGET_BYTES).toBe(contract.profiles['mobile-low'].artifactCompressedBytes);
|
|
58
|
+
expect(slimVerifier.DEFAULT_MAX_RESIDENT_BYTES).toBe(contract.profiles['mobile-low'].maxResidentBytes);
|
|
59
|
+
expect(artifactVerifier.PROFILES['mobile-low'].compressedBudgetBytes).toBe(contract.profiles['mobile-low'].artifactCompressedBytes);
|
|
60
|
+
expect(artifactVerifier.PROFILES['mobile-standard'].maxResidentBytes).toBe(contract.profiles['mobile-standard'].maxResidentBytes);
|
|
61
|
+
expect(artifactVerifier.PROFILES['mobile-low'].maxDeviceRamBytes).toBe(contract.profiles['mobile-low'].maxDeviceRamBytes);
|
|
62
|
+
});
|
|
63
|
+
test('persists runtime budgets into the slim manifest and keeps the contract outside the runtime bundle', () => {
|
|
64
|
+
const prepareSource = fs.readFileSync(preparePath, 'utf8');
|
|
65
|
+
expect(prepareSource).toContain("require('./mobile-budget-contract')");
|
|
66
|
+
expect(prepareSource).toContain('contractSchemaVersion');
|
|
67
|
+
expect(prepareSource).toContain('runtime: MOBILE_BUDGET_CONTRACT.runtime');
|
|
68
|
+
expect(fs.readFileSync(contractPath, 'utf8')).not.toContain('mobile_exact_analyzer');
|
|
69
|
+
expect(prepareSource).toContain("profile: 'mobile-low'");
|
|
70
|
+
expect(prepareSource).toContain('contractSha256');
|
|
71
|
+
});
|
|
72
|
+
test('excludes Vite verification chunks from the mobile staging input', () => {
|
|
73
|
+
const prepare = require(preparePath);
|
|
74
|
+
expect(prepare.shouldExcludeSourceAsset('assets/main-stale.js')).toBe(true);
|
|
75
|
+
expect(prepare.shouldExcludeSourceAsset('vite-assets/main-stale.js')).toBe(true);
|
|
76
|
+
expect(prepare.shouldExcludeSourceAsset('workspace_panes.js')).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
test('browser budget projection stays aligned with the versioned contract', () => {
|
|
79
|
+
const contract = JSON.parse(fs.readFileSync(contractPath, 'utf8'));
|
|
80
|
+
const context = {};
|
|
81
|
+
vm.runInNewContext(fs.readFileSync(runtimeProjectionPath, 'utf8'), context);
|
|
82
|
+
const runtime = context.NoteConnectionMobileBudget;
|
|
83
|
+
expect(runtime?.schemaVersion).toBe(contract.schemaVersion);
|
|
84
|
+
expect(runtime?.profiles).toEqual(contract.profiles);
|
|
85
|
+
expect(runtime?.runtime).toEqual(contract.runtime);
|
|
86
|
+
expect(MobileBudget_1.MOBILE_LOW_ARTIFACT_BUDGET_BYTES).toBe(contract.profiles['mobile-low'].artifactCompressedBytes);
|
|
87
|
+
expect(MobileBudget_1.MOBILE_LOW_MAX_RESIDENT_BYTES).toBe(contract.profiles['mobile-low'].maxResidentBytes);
|
|
88
|
+
expect(MobileBudget_1.MOBILE_LOW_MAX_DEVICE_RAM_BYTES).toBe(contract.profiles['mobile-low'].maxDeviceRamBytes);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
describe('canonical ID migration readiness boundary', () => {
|
|
39
|
+
const scriptPath = path.resolve(process.cwd(), 'scripts', 'verify-canonical-id-readiness.js');
|
|
40
|
+
const manifestPath = path.resolve(process.cwd(), 'config', 'identity-corpus.v1.json');
|
|
41
|
+
test('keeps readiness read-only and public-ID cutover blocked', () => {
|
|
42
|
+
const source = fs.readFileSync(scriptPath, 'utf8');
|
|
43
|
+
expect(source).toContain("canonicalPublicIdCutover: 'blocked'");
|
|
44
|
+
expect(source).toContain('independentReviewRequired: true');
|
|
45
|
+
expect(source).toContain("nativeDeviceEvidence === true");
|
|
46
|
+
expect(source).toContain("process.argv.includes('--strict')");
|
|
47
|
+
expect(source).not.toContain('migratePublicIds(');
|
|
48
|
+
expect(source).not.toContain('switchPublicIds(');
|
|
49
|
+
});
|
|
50
|
+
test('manifest keeps all compatibility changes false before review', () => {
|
|
51
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
52
|
+
expect(Object.values(manifest.compatibility)).toEqual([false, false, false, false]);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,207 @@
|
|
|
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 vm = __importStar(require("vm"));
|
|
38
|
+
describe('Capacitor mobile graph edge contract', () => {
|
|
39
|
+
const modulePath = path.resolve(__dirname, 'frontend', 'storage_provider.js');
|
|
40
|
+
let graphBuilder;
|
|
41
|
+
let workerSourceFactory;
|
|
42
|
+
beforeAll(() => {
|
|
43
|
+
const runtimeGlobal = globalThis;
|
|
44
|
+
runtimeGlobal.window = {};
|
|
45
|
+
runtimeGlobal.NoteConnectionMobileIdentity = require(path.resolve(__dirname, 'frontend', 'mobile_identity_contract.js'));
|
|
46
|
+
const providerModule = require(modulePath);
|
|
47
|
+
graphBuilder = providerModule.buildCapacitorGraphData;
|
|
48
|
+
workerSourceFactory = providerModule.getCapacitorGraphBuildWorkerSource;
|
|
49
|
+
});
|
|
50
|
+
afterAll(() => {
|
|
51
|
+
const runtimeGlobal = globalThis;
|
|
52
|
+
delete runtimeGlobal.window;
|
|
53
|
+
delete runtimeGlobal.NoteConnectionMobileIdentity;
|
|
54
|
+
jest.resetModules();
|
|
55
|
+
});
|
|
56
|
+
test('uses source-to-target orientation and carries portable edge endpoints', () => {
|
|
57
|
+
const graph = graphBuilder([
|
|
58
|
+
{
|
|
59
|
+
id: 'base',
|
|
60
|
+
label: 'Base',
|
|
61
|
+
path: 'financial/base.md',
|
|
62
|
+
sourceUri: 'note://workspace/v1/financial/base.md',
|
|
63
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
64
|
+
content: '# Base',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'intro',
|
|
68
|
+
label: 'Intro',
|
|
69
|
+
path: 'financial/intro.md',
|
|
70
|
+
sourceUri: 'note://workspace/v1/financial/intro.md',
|
|
71
|
+
metadata: { tags: [], prerequisites: ['base'], next: [] },
|
|
72
|
+
content: '# Intro\n[[advanced]]',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'advanced',
|
|
76
|
+
label: 'Advanced',
|
|
77
|
+
path: 'financial/advanced.md',
|
|
78
|
+
sourceUri: 'note://workspace/v1/financial/advanced.md',
|
|
79
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
80
|
+
content: '# Advanced',
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
83
|
+
expect(graph.edges).toEqual(expect.arrayContaining([
|
|
84
|
+
expect.objectContaining({
|
|
85
|
+
source: 'base',
|
|
86
|
+
target: 'intro',
|
|
87
|
+
sourceUri: 'note://workspace/v1/financial/base.md',
|
|
88
|
+
targetUri: 'note://workspace/v1/financial/intro.md',
|
|
89
|
+
type: 'explicit-prerequisite',
|
|
90
|
+
}),
|
|
91
|
+
expect.objectContaining({
|
|
92
|
+
source: 'intro',
|
|
93
|
+
target: 'advanced',
|
|
94
|
+
sourceUri: 'note://workspace/v1/financial/intro.md',
|
|
95
|
+
targetUri: 'note://workspace/v1/financial/advanced.md',
|
|
96
|
+
type: 'wiki-link',
|
|
97
|
+
}),
|
|
98
|
+
]));
|
|
99
|
+
expect(graph.edges).not.toEqual(expect.arrayContaining([
|
|
100
|
+
expect.objectContaining({ source: 'advanced', target: 'intro', type: 'wiki-link' }),
|
|
101
|
+
]));
|
|
102
|
+
});
|
|
103
|
+
test('retains a path-derived canonical id alongside the legacy public id', () => {
|
|
104
|
+
const graph = graphBuilder([
|
|
105
|
+
{
|
|
106
|
+
id: 'Index',
|
|
107
|
+
canonicalId: 'algebra/index',
|
|
108
|
+
label: 'Index',
|
|
109
|
+
path: 'algebra/index.md',
|
|
110
|
+
sourceUri: 'note://workspace/v1/algebra/index.md',
|
|
111
|
+
identityAliases: ['Index', 'algebra/index.md'],
|
|
112
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
113
|
+
content: '# Index',
|
|
114
|
+
},
|
|
115
|
+
]);
|
|
116
|
+
expect(graph.nodes[0]).toEqual(expect.objectContaining({
|
|
117
|
+
id: 'Index',
|
|
118
|
+
canonicalId: 'algebra/index',
|
|
119
|
+
}));
|
|
120
|
+
});
|
|
121
|
+
test('resolves nested relative and markdown links by canonical path', () => {
|
|
122
|
+
const graph = graphBuilder([
|
|
123
|
+
{
|
|
124
|
+
id: 'base',
|
|
125
|
+
canonicalId: 'shared/base',
|
|
126
|
+
path: 'Knowledge_Base/shared/base.md',
|
|
127
|
+
sourceUri: 'note://workspace/v1/shared/base.md',
|
|
128
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
129
|
+
content: '# Base',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: 'intro',
|
|
133
|
+
canonicalId: 'algebra/intro',
|
|
134
|
+
path: 'Knowledge_Base/algebra/intro.md',
|
|
135
|
+
sourceUri: 'note://workspace/v1/algebra/intro.md',
|
|
136
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
137
|
+
content: '# Intro\n[base](../shared/base.md)',
|
|
138
|
+
},
|
|
139
|
+
]);
|
|
140
|
+
expect(graph.edges).toEqual(expect.arrayContaining([
|
|
141
|
+
expect.objectContaining({
|
|
142
|
+
source: 'intro',
|
|
143
|
+
target: 'base',
|
|
144
|
+
type: 'markdown-link',
|
|
145
|
+
sourceUri: 'note://workspace/v1/algebra/intro.md',
|
|
146
|
+
targetUri: 'note://workspace/v1/shared/base.md',
|
|
147
|
+
}),
|
|
148
|
+
]));
|
|
149
|
+
});
|
|
150
|
+
test('fails closed when legacy basenames are ambiguous across directories', () => {
|
|
151
|
+
expect(() => graphBuilder([
|
|
152
|
+
{
|
|
153
|
+
id: 'index',
|
|
154
|
+
canonicalId: 'algebra/index',
|
|
155
|
+
path: 'Knowledge_Base/algebra/index.md',
|
|
156
|
+
sourceUri: 'note://workspace/v1/algebra/index.md',
|
|
157
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
158
|
+
content: '# Algebra',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'INDEX',
|
|
162
|
+
canonicalId: 'physics/index',
|
|
163
|
+
path: 'Knowledge_Base/physics/index.md',
|
|
164
|
+
sourceUri: 'note://workspace/v1/physics/index.md',
|
|
165
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
166
|
+
content: '# Physics',
|
|
167
|
+
},
|
|
168
|
+
])).toThrow(/ambiguous legacy basename/i);
|
|
169
|
+
});
|
|
170
|
+
test('keeps worker and single-thread resolution equivalent for sourceUri-only files', () => {
|
|
171
|
+
const files = [
|
|
172
|
+
{
|
|
173
|
+
id: 'base',
|
|
174
|
+
sourceUri: 'note://workspace/v1/shared/base.md',
|
|
175
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
176
|
+
content: '# Base',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: 'intro',
|
|
180
|
+
sourceUri: 'note://workspace/v1/algebra/intro.md',
|
|
181
|
+
metadata: { tags: [], prerequisites: [], next: [] },
|
|
182
|
+
content: '# Intro\n[base](../shared/base.md)',
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
const singleThreadGraph = graphBuilder(files.map((file) => ({
|
|
186
|
+
...file,
|
|
187
|
+
metadata: { ...file.metadata },
|
|
188
|
+
})));
|
|
189
|
+
expect(files[0]).not.toHaveProperty('__canonicalId');
|
|
190
|
+
const messages = [];
|
|
191
|
+
const context = {
|
|
192
|
+
self: {
|
|
193
|
+
postMessage(message) {
|
|
194
|
+
messages.push(message);
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
vm.runInNewContext(workerSourceFactory(), context);
|
|
199
|
+
context.self.onmessage({
|
|
200
|
+
data: { files },
|
|
201
|
+
});
|
|
202
|
+
expect(messages).toHaveLength(1);
|
|
203
|
+
expect(messages[0].ok).toBe(true);
|
|
204
|
+
expect(messages[0].error).toBeUndefined();
|
|
205
|
+
expect(messages[0].graphData).toEqual(singleThreadGraph);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
describe('mobile portable identity contract', () => {
|
|
39
|
+
const repoRoot = path.resolve(__dirname, '..');
|
|
40
|
+
const modulePath = path.join(repoRoot, 'src', 'frontend', 'mobile_identity_contract.js');
|
|
41
|
+
const identity = require(modulePath);
|
|
42
|
+
test('ships as a browser-compatible asset and normalizes paths identically', () => {
|
|
43
|
+
expect(fs.readFileSync(modulePath, 'utf8')).toContain('NoteConnectionMobileIdentity');
|
|
44
|
+
expect(identity.normalizePortablePath('Knowledge_Base\\Algebra Notes\\Index #1.MD'))
|
|
45
|
+
.toBe('algebra notes/index #1.md');
|
|
46
|
+
expect(identity.createSourceUri('algebra notes/index #1.md'))
|
|
47
|
+
.toBe('note://workspace/v1/algebra%20notes/index%20%231.md');
|
|
48
|
+
});
|
|
49
|
+
test('uses SHA-256 even without Web Crypto and normalizes Unicode content', async () => {
|
|
50
|
+
expect(identity.sha256HexSync(''))
|
|
51
|
+
.toBe('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');
|
|
52
|
+
expect(identity.sha256HexSync('abc'))
|
|
53
|
+
.toBe('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad');
|
|
54
|
+
const decomposed = await identity.createResourceIdentity('notes/cafe.md', 'cafe', 'Cafe\u0301');
|
|
55
|
+
const composed = await identity.createResourceIdentity('notes/cafe.md', 'cafe', 'Caf\u00e9');
|
|
56
|
+
expect(decomposed.revision).toMatch(/^sha256:[0-9a-f]{64}$/);
|
|
57
|
+
expect(decomposed.revision).toBe(composed.revision);
|
|
58
|
+
expect(decomposed.identityAliases).toEqual(expect.arrayContaining(['notes/cafe.md', 'cafe']));
|
|
59
|
+
});
|
|
60
|
+
test('preserves the legacy id while exposing extension-inclusive portable identity', async () => {
|
|
61
|
+
const result = await identity.createResourceIdentity('algebra/index.md', 'index', '# Algebra');
|
|
62
|
+
expect(result.sourceUri).toBe('note://workspace/v1/algebra/index.md');
|
|
63
|
+
expect(result.canonicalId).toBe('algebra/index');
|
|
64
|
+
expect(result.identityAliases).toEqual(expect.arrayContaining(['index', 'index.md', 'algebra/index.md']));
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -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
|
+
describe('versioned identity corpus manifest', () => {
|
|
39
|
+
const manifestPath = path.resolve(process.cwd(), 'config', 'identity-corpus.v1.json');
|
|
40
|
+
const verifierPath = path.resolve(process.cwd(), 'scripts', 'verify-identity-corpus.js');
|
|
41
|
+
test('declares the complete G4 corpus and keeps compatibility cutover frozen', () => {
|
|
42
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
43
|
+
expect(manifest.schemaVersion).toBe(1);
|
|
44
|
+
expect(manifest.corpusId).toBe('noteconnection-identity-g4-v1');
|
|
45
|
+
expect(manifest.requiredCases).toEqual(expect.arrayContaining([
|
|
46
|
+
'legacy_snapshot_restore',
|
|
47
|
+
'same_content_isolation',
|
|
48
|
+
'cross_root_nfc_identity',
|
|
49
|
+
'nfc_case_collision_rejection',
|
|
50
|
+
'move_journal_restart_alias_delete',
|
|
51
|
+
'mixed_batch_rollback',
|
|
52
|
+
'four_owner_convergence',
|
|
53
|
+
'upsert_alias_collision_rejection',
|
|
54
|
+
]));
|
|
55
|
+
expect(manifest.requiredProjectionHosts).toEqual(['web', 'tauri', 'capacitor', 'android']);
|
|
56
|
+
expect(manifest.compatibility).toEqual({
|
|
57
|
+
publicIdsChanged: false,
|
|
58
|
+
snapshotSchemaChanged: false,
|
|
59
|
+
projectionSchemaChanged: false,
|
|
60
|
+
mobileRuntimeChanged: false,
|
|
61
|
+
});
|
|
62
|
+
expect(manifest.gates.canonicalPublicIdCutover).toContain('blocked');
|
|
63
|
+
});
|
|
64
|
+
test('verifier reports host-code evidence separately from native evidence', () => {
|
|
65
|
+
const verifier = fs.readFileSync(verifierPath, 'utf8');
|
|
66
|
+
expect(verifier).toContain("require('ts-node/register/transpile-only')");
|
|
67
|
+
expect(verifier).toContain("evidenceLevel: 'host-code-replay'");
|
|
68
|
+
expect(verifier).toContain('nativeDeviceEvidence: false');
|
|
69
|
+
expect(verifier).toContain("canonicalPublicIdCutover: 'blocked'");
|
|
70
|
+
expect(verifier).toContain('verify-mobile-projection-replay.js');
|
|
71
|
+
});
|
|
72
|
+
});
|