chore(core): mark the files copied from hive-mind-core as Apache-2.0
The logger, injection scanner, ingress guard, WorkspaceManager, embedders, recall helpers and execution traces came from @waggle/hive-mind-core (Apache-2.0); awareness, identity and parts of WaggleDB were adapted from it. They keep Apache-2.0: an SPDX header with the original copyright line and the source file, packages/core/LICENSE.md listing them, LICENSE-APACHE with the full text, and "MIT AND Apache-2.0" in package.json. A test keeps the list and the headers in step. No code changes. Logs UF-069: the hive-mind-core LICENSE is an abridged Apache text.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/mind/embedding-provider.test.ts and changed for @waggle/core.
|
||||
/**
|
||||
* createEmbeddingProvider tests: the generic mock fallback, dimension respect,
|
||||
* deterministic-vector behavior, batch shape and the reprobe contract.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/mind/inprocess-embedder.test.ts and changed for @waggle/core.
|
||||
/**
|
||||
* In-process embedder tests: `normalizeDimensions(input, target)` and its
|
||||
* "no-copy fast path when dims match" contract.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/mind/transformers-model-load.test.ts and changed for @waggle/core.
|
||||
import { spawn, type ChildProcess } from 'node:child_process';
|
||||
import { once } from 'node:events';
|
||||
import fs from 'node:fs';
|
||||
|
||||
51
packages/core/tests/license-headers.test.ts
Normal file
51
packages/core/tests/license-headers.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* The Apache-2.0 files of @waggle/core (copied from @waggle/hive-mind-core)
|
||||
* carry an SPDX header, and LICENSE.md lists exactly those files.
|
||||
*/
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
const PACKAGE_DIR = path.resolve(import.meta.dirname, '..');
|
||||
const APACHE_HEADER = /^\/\/ SPDX-License-Identifier: Apache-2\.0\n\/\/ Copyright 2026 Marko Marković · Egzakta Group · waggle-os\.ai\n\/\/ (?:Parts copied|Copied) from @waggle\/hive-mind-core (\S+) (?:without changes|and changed for @waggle\/core)\.\n/;
|
||||
|
||||
function sourceFiles(dir: string): string[] {
|
||||
return fs.readdirSync(path.join(PACKAGE_DIR, dir), { withFileTypes: true }).flatMap((entry) => {
|
||||
const relative = `${dir}/${entry.name}`;
|
||||
if (entry.isDirectory()) return sourceFiles(relative);
|
||||
return /\.tsx?$/.test(entry.name) ? [relative] : [];
|
||||
});
|
||||
}
|
||||
|
||||
describe('@waggle/core license headers', () => {
|
||||
const headed = new Map<string, string>();
|
||||
for (const file of [...sourceFiles('src'), ...sourceFiles('tests')]) {
|
||||
const text = fs.readFileSync(path.join(PACKAGE_DIR, file), 'utf8');
|
||||
if (text.startsWith('// SPDX-License-Identifier')) {
|
||||
const match = APACHE_HEADER.exec(text);
|
||||
expect(match, `${file} has a malformed SPDX header`).not.toBeNull();
|
||||
headed.set(file, match![1]);
|
||||
}
|
||||
}
|
||||
const listed = new Map(
|
||||
[...fs.readFileSync(path.join(PACKAGE_DIR, 'LICENSE.md'), 'utf8')
|
||||
.matchAll(/^\| `([^`]+)` \| `([^`]+)` \|/gm)]
|
||||
.map((match) => [match[1], match[2]]),
|
||||
);
|
||||
|
||||
it('lists every Apache-2.0 file in LICENSE.md with the file it came from', () => {
|
||||
expect(headed.size).toBeGreaterThan(0);
|
||||
expect(Object.fromEntries(listed)).toEqual(Object.fromEntries(headed));
|
||||
});
|
||||
|
||||
it('ships the full Apache-2.0 text next to the note', () => {
|
||||
const text = fs.readFileSync(path.join(PACKAGE_DIR, 'LICENSE-APACHE'), 'utf8');
|
||||
expect(text).toContain('TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION');
|
||||
expect(text).toContain('END OF TERMS AND CONDITIONS');
|
||||
});
|
||||
|
||||
it('declares both licenses in package.json', () => {
|
||||
const manifest = JSON.parse(fs.readFileSync(path.join(PACKAGE_DIR, 'package.json'), 'utf8'));
|
||||
expect(manifest.license).toBe('MIT AND Apache-2.0');
|
||||
});
|
||||
});
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/logger.test.ts and changed for @waggle/core.
|
||||
/**
|
||||
* Logger stderr-routing tests.
|
||||
*
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/memory-ingress-guard.test.ts and changed for @waggle/core.
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import {
|
||||
evaluateExternalMemoryIngress,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/mind/inprocess-reranker.test.ts and changed for @waggle/core.
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/mind/parse-date-window.test.ts and changed for @waggle/core.
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { parseDateWindow } from '../../src/recall/parse-date-window.js';
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/mind/resolve-relative-date.test.ts and changed for @waggle/core.
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { resolveRelativeDate } from '../../src/recall/resolve-relative-date.js';
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai
|
||||
// Copied from @waggle/hive-mind-core tests/workspace-manager.test.ts and changed for @waggle/core.
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
Reference in New Issue
Block a user