noteconnection 1.8.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/README.md +257 -1803
- package/dist/src/agent_workspace.contract.parity.test.js +105 -421
- package/dist/src/agent_workspace.frontend.test.js +410 -11
- 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/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 +265 -2
- 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 +44 -0
- package/dist/src/export/WorkspaceExportBundle.test.js +61 -0
- package/dist/src/foundation.release.evidence.contract.test.js +127 -9
- package/dist/src/foundation.sqlite.runtime.contract.test.js +6 -0
- package/dist/src/frontend/README.md +257 -1803
- package/dist/src/frontend/agent_workspace.js +665 -7
- package/dist/src/frontend/index.html +31 -2
- package/dist/src/frontend/knowledge_projection_contract.js +230 -0
- package/dist/src/frontend/knowledge_projection_store.js +214 -0
- package/dist/src/frontend/libs/path_core.js +158 -42
- package/dist/src/frontend/locales/en.json +32 -0
- package/dist/src/frontend/locales/zh.json +32 -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/path.html +6 -2
- package/dist/src/frontend/simulationWorker.js +1 -1
- package/dist/src/frontend/source_manager.js +110 -4
- package/dist/src/frontend/storage_provider.js +661 -71
- package/dist/src/frontend/styles.css +107 -13
- package/dist/src/frontend/workspace_panes.js +111 -7
- package/dist/src/frontend.runtime.assets.contract.test.js +81 -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 +22 -0
- package/dist/src/indexing/IndexLifecycle.test.js +24 -0
- package/dist/src/knowledge.api.contract.test.js +4 -2
- 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 +4687 -3892
- package/dist/src/learning/KnowledgeLearningPlatform.persistence.test.js +418 -0
- package/dist/src/learning/KnowledgeLearningPlatform.test.js +243 -6
- package/dist/src/learning/KnowledgeWorkspaceConversationRegression.js +25 -1
- package/dist/src/learning/KnowledgeWorkspaceConversationRegression.test.js +13 -5
- 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 +1191 -250
- package/dist/src/learning/answerReleaseReview.test.js +1293 -7
- package/dist/src/learning/answerTaskPlan.js +473 -0
- package/dist/src/learning/conversationComposer.js +627 -386
- package/dist/src/learning/conversationComposer.test.js +1403 -0
- package/dist/src/learning/evidenceContextAssembler.js +312 -120
- 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 +3 -13
- package/dist/src/learning/graphContextAssembler.test.js +2 -2
- 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 +1 -0
- package/dist/src/learning/mobileAnswerProjection.js +104 -0
- package/dist/src/learning/mobileAnswerProjection.test.js +102 -0
- package/dist/src/learning/queryBackend.js +34 -10
- package/dist/src/learning/queryBackend.test.js +21 -0
- package/dist/src/learning/ragContextPack.js +115 -16
- package/dist/src/learning/ragContextPack.test.js +151 -0
- package/dist/src/learning/ragEvidenceQuality.js +96 -0
- package/dist/src/learning/ragEvidenceQuality.test.js +29 -0
- package/dist/src/learning/ragPublicText.js +67 -4
- package/dist/src/learning/ragPublicText.test.js +57 -0
- package/dist/src/learning/ragSufficiencyJudge.js +11 -1
- package/dist/src/learning/ragSufficiencyProviderJudge.js +16 -26
- package/dist/src/learning/ragSufficiencyProviderJudge.test.js +51 -0
- package/dist/src/learning/requestNormalization.js +106 -0
- package/dist/src/learning/requestNormalization.test.js +101 -0
- package/dist/src/learning/store.js +116 -12
- package/dist/src/learning/store.test.js +299 -0
- package/dist/src/learning/vectorAccelerationAdapter.js +22 -6
- package/dist/src/learning/vectorAccelerationAdapter.test.js +30 -0
- package/dist/src/learning/workspaceHydration.js +168 -0
- package/dist/src/learning/workspaceHydration.test.js +30 -0
- package/dist/src/license.policy.contract.test.js +9 -4
- package/dist/src/markdown/MarkdownGateway.js +4 -0
- package/dist/src/markdown/MarkdownGateway.test.js +59 -0
- package/dist/src/middleware/SseResponseWriter.js +122 -0
- package/dist/src/middleware/SseResponseWriter.test.js +54 -0
- package/dist/src/middleware/auth.js +28 -7
- package/dist/src/middleware/auth.test.js +33 -0
- package/dist/src/middleware/index.js +2 -1
- 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/ContentGenerator.js +4 -9
- package/dist/src/notemd/FileProcessor.js +4 -9
- package/dist/src/notemd/NotemdService.js +12 -17
- package/dist/src/notemd/Translator.js +4 -9
- package/dist/src/notemd/progressReporter.js +9 -0
- package/dist/src/notemd.server.integration.test.js +119 -4
- package/dist/src/notemd.workflow.pipeline.test.js +1 -1
- package/dist/src/pathbridge.handshake.contract.test.js +29 -0
- package/dist/src/pathbridge.host-adapter.contract.test.js +133 -0
- package/dist/src/pathcore.bundle.contract.test.js +8 -0
- package/dist/src/platform/ExportProfile.js +28 -0
- package/dist/src/platform/MobileBudget.js +11 -0
- package/dist/src/platform/PlatformCapabilities.js +14 -0
- package/dist/src/platform/PlatformCapabilities.test.js +6 -0
- package/dist/src/query_backend.external_http.integration.test.js +2 -2
- package/dist/src/release.godot.mirror.contract.test.js +28 -4
- package/dist/src/resources/ResourceRegistry.js +40 -0
- package/dist/src/resources/ResourceRegistry.test.js +36 -0
- package/dist/src/routes/index.js +0 -4
- package/dist/src/routes/knowledge.js +46 -33
- package/dist/src/routes/knowledgePayload.js +185 -0
- package/dist/src/routes/knowledgePayload.test.js +53 -0
- package/dist/src/routes/markdown.js +8 -0
- package/dist/src/routes/notemd.js +990 -234
- package/dist/src/routes/registry.contract.test.js +5 -2
- package/dist/src/routes/registry.shadow.contract.test.js +22 -0
- package/dist/src/routes/render.js +14 -51
- package/dist/src/runtime.capabilities.test.js +18 -2
- package/dist/src/server.js +566 -1090
- package/dist/src/server.migration.test.js +417 -15
- 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 +6 -3
- package/dist/src/sidecar.supply.readiness.contract.test.js +11 -0
- package/dist/src/simulation.worker.offline.test.js +104 -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 +8 -0
- package/dist/src/tauri.window.evidence.execution.test.js +68 -0
- package/dist/src/utils/RuntimePaths.js +6 -0
- package/dist/src/utils/RuntimePaths.test.js +27 -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/workspace/WorkspaceRegistry.js +13 -0
- package/package.json +32 -10
- package/dist/src/routes/data.js +0 -267
- package/dist/src/routes/diagnostics.js +0 -51
|
@@ -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
|
+
});
|
|
@@ -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.');
|