From 0fef37ac5332bc782f88d38071f40e37ddfd4435 Mon Sep 17 00:00:00 2001 From: "shumeiko.it" Date: Wed, 4 Nov 2026 10:19:05 +0100 Subject: [PATCH] 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. --- docs/oss/adr/0007-memory-contract.md | 16 +- docs/oss/upstream-fixes.md | 10 + package-lock.json | 2 +- packages/core/LICENSE-APACHE | 202 ++++++++++++++++++ packages/core/LICENSE.md | 47 ++++ packages/core/package.json | 2 +- packages/core/src/awareness.ts | 3 + packages/core/src/embeddings/api-embedder.ts | 3 + .../core/src/embeddings/embedding-provider.ts | 3 + packages/core/src/embeddings/embeddings.ts | 3 + .../core/src/embeddings/inprocess-embedder.ts | 3 + .../core/src/embeddings/litellm-embedder.ts | 3 + .../core/src/embeddings/ollama-embedder.ts | 3 + .../src/embeddings/transformers-model-load.ts | 3 + packages/core/src/execution-traces.ts | 3 + packages/core/src/identity.ts | 3 + packages/core/src/injection-scanner.ts | 3 + packages/core/src/logger.ts | 3 + packages/core/src/memory-ingress-guard.ts | 3 + .../core/src/recall/inprocess-reranker.ts | 3 + packages/core/src/recall/parse-date-window.ts | 3 + packages/core/src/recall/recall-context.ts | 3 + .../core/src/recall/resolve-relative-date.ts | 3 + packages/core/src/waggle-db.ts | 3 + packages/core/src/workspace-manager.ts | 3 + .../embeddings/embedding-provider.test.ts | 3 + .../embeddings/inprocess-embedder.test.ts | 3 + .../transformers-model-load.test.ts | 3 + packages/core/tests/license-headers.test.ts | 51 +++++ packages/core/tests/logger.test.ts | 3 + .../core/tests/memory-ingress-guard.test.ts | 3 + .../tests/recall/inprocess-reranker.test.ts | 3 + .../tests/recall/parse-date-window.test.ts | 3 + .../recall/resolve-relative-date.test.ts | 3 + packages/core/tests/workspace-manager.test.ts | 3 + 35 files changed, 406 insertions(+), 8 deletions(-) create mode 100644 packages/core/LICENSE-APACHE create mode 100644 packages/core/LICENSE.md create mode 100644 packages/core/tests/license-headers.test.ts diff --git a/docs/oss/adr/0007-memory-contract.md b/docs/oss/adr/0007-memory-contract.md index d1bd162..8bc0c01 100644 --- a/docs/oss/adr/0007-memory-contract.md +++ b/docs/oss/adr/0007-memory-contract.md @@ -94,12 +94,16 @@ copied these tables and the legacy memories (`importLegacyMindData`, `legacy-mem the owner removed both because the product is still in development and nobody has data to bring over. A data directory left by the commercial edition is ignored. -The logger, injection scanner, external-memory ingress guard, `WorkspaceManager` and the -embedders were copied from `@waggle/hive-mind-core` into `@waggle/core`, which exports its own -copies. Since P1.5 `@waggle/core` no longer depends on or re-exports the substrate; the -substrate keeps its copies until it is removed in P2.2. Those files came from an -Apache-2.0 package into the MIT `core` package; both are Egzakta's code, and the licence of the -copies is part of the licensing review. +The logger, injection scanner, external-memory ingress guard, `WorkspaceManager`, the +embedders, the recall helpers and execution traces were copied from `@waggle/hive-mind-core` +into `@waggle/core`, which exports its own copies; the awareness and identity layers and parts +of `WaggleDB` were adapted from it. Since P1.5 `@waggle/core` no longer depends on or +re-exports the substrate, which left the repository in P2.2. Those files came from an +Apache-2.0 package into the MIT `core` package and keep Apache-2.0 (settled on 2026-11-04, +no owner decision needed): each carries an `SPDX-License-Identifier: Apache-2.0` header with +the original copyright line, [`packages/core/LICENSE.md`](../../../packages/core/LICENSE.md) +lists them, `packages/core/package.json` declares `MIT AND Apache-2.0`, and +`THIRD_PARTY_NOTICES.md` names them with the Apache-2.0 text. ## The server on mem0 (P1.5, days 7 and 8) diff --git a/docs/oss/upstream-fixes.md b/docs/oss/upstream-fixes.md index 04a4579..614f83d 100644 --- a/docs/oss/upstream-fixes.md +++ b/docs/oss/upstream-fixes.md @@ -96,6 +96,7 @@ Baseline: commit `b20b138` of the main Waggle repository. | UF-065 | The Windows uninstaller names a "Data & Privacy" settings page that does not exist | Fixed | Desktop, Windows installer | | UF-066 | Installed builds have no capability packs and no starter skills | Fixed | Sidecar bundle, SDK | | UF-067 | The status bar names a default model that chats cannot use | Fixed | Sidecar, Web UI | +| UF-068 | The Apache-2.0 LICENSE of `hive-mind-core` is abridged | Fixed | Licensing | ## Entries @@ -675,3 +676,12 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14. - Cause: the chat route resolves the configured model to a usable one (`resolveUsableModel`), but the status endpoint returns the configured model as is. - What we did: the status endpoint resolves the model the same way, without changing the configured one. A test covers it. - Recommendation: same change in the main project. + +### UF-068. The Apache-2.0 LICENSE of `hive-mind-core` is abridged +- Status: Fixed +- Found: 2026-11-04 +- Where: at commit `b20b138`, `packages/hive-mind-core/LICENSE`; `packages/hive-mind-hooks-*/LICENSE` and `packages/hive-mind-shim-core/LICENSE` +- Symptom: the `hive-mind-core` LICENSE stops in the middle of section 1 (Definitions) with "For brevity, this is the standard Apache 2.0 license body" and a link, followed by the copyright notice. The LICENSE files of the hooks and shim packages hold only the copyright notice and a link. Apache-2.0 section 4(a) asks for a copy of the license with every redistribution, and these files are the only license text in the packages. +- Cause: the license files were shortened by hand. +- What we did: the files copied from `hive-mind-core` into `@waggle/core` keep Apache-2.0 with an SPDX header and the original copyright line, and `packages/core/LICENSE-APACHE` carries the full, unmodified Apache-2.0 text. `packages/core/LICENSE.md` lists the files. +- Recommendation: replace each abridged LICENSE with the full text from https://www.apache.org/licenses/LICENSE-2.0.txt, keeping the copyright line. diff --git a/package-lock.json b/package-lock.json index cc74c06..694bbcb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18818,7 +18818,7 @@ "packages/core": { "name": "@waggle/core", "version": "0.1.0", - "license": "MIT", + "license": "MIT AND Apache-2.0", "dependencies": { "@huggingface/transformers": "^3.8.1", "@waggle/memory-contract": "*", diff --git a/packages/core/LICENSE-APACHE b/packages/core/LICENSE-APACHE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/packages/core/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/core/LICENSE.md b/packages/core/LICENSE.md new file mode 100644 index 0000000..07f03c8 --- /dev/null +++ b/packages/core/LICENSE.md @@ -0,0 +1,47 @@ +# License of `@waggle/core` + +This package is licensed under the MIT License (the `LICENSE` file at the repository root), +except the files listed below. They were copied from `@waggle/hive-mind-core`, a package of +the commercial Waggle repository licensed under the Apache License, Version 2.0, and keep that +license. The full license text is in [`LICENSE-APACHE`](LICENSE-APACHE). + +Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai + +Each file starts with an `SPDX-License-Identifier: Apache-2.0` header, this copyright line and +the file it was copied from. The source files are bundled into the sidecar (`service.js`), so +`THIRD_PARTY_NOTICES.md` lists them as well; the tests do not ship. +`tests/license-headers.test.ts` checks that this list and the headers agree. + +| File | Copied from (`packages/hive-mind-core/`) | Changed | +|---|---|---| +| `src/awareness.ts` | `src/mind/awareness.ts` | yes | +| `src/embeddings/api-embedder.ts` | `src/mind/api-embedder.ts` | no | +| `src/embeddings/embedding-provider.ts` | `src/mind/embedding-provider.ts` | yes | +| `src/embeddings/embeddings.ts` | `src/mind/embeddings.ts` | parts (the `Embedder` interface) | +| `src/embeddings/inprocess-embedder.ts` | `src/mind/inprocess-embedder.ts` | yes | +| `src/embeddings/litellm-embedder.ts` | `src/mind/litellm-embedder.ts` | no | +| `src/embeddings/ollama-embedder.ts` | `src/mind/ollama-embedder.ts` | no | +| `src/embeddings/transformers-model-load.ts` | `src/mind/transformers-model-load.ts` | no | +| `src/execution-traces.ts` | `src/mind/execution-traces.ts` | yes | +| `src/identity.ts` | `src/mind/identity.ts` | yes | +| `src/injection-scanner.ts` | `src/injection-scanner.ts` | no | +| `src/logger.ts` | `src/logger.ts` | yes | +| `src/memory-ingress-guard.ts` | `src/memory-ingress-guard.ts` | no | +| `src/recall/inprocess-reranker.ts` | `src/mind/inprocess-reranker.ts` | yes | +| `src/recall/parse-date-window.ts` | `src/mind/parse-date-window.ts` | yes | +| `src/recall/recall-context.ts` | `src/mind/recall-context.ts` | no | +| `src/recall/resolve-relative-date.ts` | `src/mind/resolve-relative-date.ts` | yes | +| `src/waggle-db.ts` | `src/mind/db.ts` | parts (the connection setup and the meta accessors) | +| `src/workspace-manager.ts` | `src/workspace-manager.ts` | yes | +| `tests/embeddings/embedding-provider.test.ts` | `tests/mind/embedding-provider.test.ts` | yes | +| `tests/embeddings/inprocess-embedder.test.ts` | `tests/mind/inprocess-embedder.test.ts` | yes | +| `tests/embeddings/transformers-model-load.test.ts` | `tests/mind/transformers-model-load.test.ts` | yes | +| `tests/logger.test.ts` | `tests/logger.test.ts` | yes | +| `tests/memory-ingress-guard.test.ts` | `tests/memory-ingress-guard.test.ts` | yes | +| `tests/recall/inprocess-reranker.test.ts` | `tests/mind/inprocess-reranker.test.ts` | yes | +| `tests/recall/parse-date-window.test.ts` | `tests/mind/parse-date-window.test.ts` | yes | +| `tests/recall/resolve-relative-date.test.ts` | `tests/mind/resolve-relative-date.test.ts` | yes | +| `tests/workspace-manager.test.ts` | `tests/workspace-manager.test.ts` | yes | + +New files in this package and changes to the MIT files are MIT-licensed. A file added here +from `@waggle/hive-mind-core` needs the same header and a row in this table. diff --git a/packages/core/package.json b/packages/core/package.json index 81619c5..51ccae1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -27,5 +27,5 @@ "devDependencies": { "@types/better-sqlite3": "^7.6.13" }, - "license": "MIT" + "license": "MIT AND Apache-2.0" } diff --git a/packages/core/src/awareness.ts b/packages/core/src/awareness.ts index b08407d..e122f77 100644 --- a/packages/core/src/awareness.ts +++ b/packages/core/src/awareness.ts @@ -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 src/mind/awareness.ts and changed for @waggle/core. /** * AwarenessLayer — the agent's short-lived working items (tasks, recent * actions, pending items, context flags), per data scope, stored in waggle.db. diff --git a/packages/core/src/embeddings/api-embedder.ts b/packages/core/src/embeddings/api-embedder.ts index f8dc55a..ea3032c 100644 --- a/packages/core/src/embeddings/api-embedder.ts +++ b/packages/core/src/embeddings/api-embedder.ts @@ -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 src/mind/api-embedder.ts without changes. /** * API-backed embedder — calls Voyage AI or OpenAI embedding endpoints. * For users who configure API keys in the Vault UI. diff --git a/packages/core/src/embeddings/embedding-provider.ts b/packages/core/src/embeddings/embedding-provider.ts index 810e745..b2bc662 100644 --- a/packages/core/src/embeddings/embedding-provider.ts +++ b/packages/core/src/embeddings/embedding-provider.ts @@ -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 src/mind/embedding-provider.ts and changed for @waggle/core. /** * EmbeddingProvider — orchestrates the InProcess → Ollama → API → Mock fallback chain. * Single entry point for all embedding operations in Waggle. diff --git a/packages/core/src/embeddings/embeddings.ts b/packages/core/src/embeddings/embeddings.ts index 208719f..b728b8b 100644 --- a/packages/core/src/embeddings/embeddings.ts +++ b/packages/core/src/embeddings/embeddings.ts @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai +// Parts copied from @waggle/hive-mind-core src/mind/embeddings.ts and changed for @waggle/core. export interface Embedder { embed(text: string): Promise; embedBatch(texts: string[]): Promise; diff --git a/packages/core/src/embeddings/inprocess-embedder.ts b/packages/core/src/embeddings/inprocess-embedder.ts index 128a2d3..72bd006 100644 --- a/packages/core/src/embeddings/inprocess-embedder.ts +++ b/packages/core/src/embeddings/inprocess-embedder.ts @@ -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 src/mind/inprocess-embedder.ts and changed for @waggle/core. /** * In-process embedder using @huggingface/transformers (ONNX Runtime). * Default provider for ALL desktop users — zero config, works offline. diff --git a/packages/core/src/embeddings/litellm-embedder.ts b/packages/core/src/embeddings/litellm-embedder.ts index edd3c6a..edf8049 100644 --- a/packages/core/src/embeddings/litellm-embedder.ts +++ b/packages/core/src/embeddings/litellm-embedder.ts @@ -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 src/mind/litellm-embedder.ts without changes. /** * LiteLLM-backed embedder that calls the /embeddings endpoint. * Falls back to a deterministic mock (text→Float32Array hash) on API error diff --git a/packages/core/src/embeddings/ollama-embedder.ts b/packages/core/src/embeddings/ollama-embedder.ts index 7240595..45f6ef0 100644 --- a/packages/core/src/embeddings/ollama-embedder.ts +++ b/packages/core/src/embeddings/ollama-embedder.ts @@ -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 src/mind/ollama-embedder.ts without changes. /** * Ollama-backed embedder — calls local Ollama server for embeddings. * Power user option for users who have Ollama installed. diff --git a/packages/core/src/embeddings/transformers-model-load.ts b/packages/core/src/embeddings/transformers-model-load.ts index 16713d6..fdeea93 100644 --- a/packages/core/src/embeddings/transformers-model-load.ts +++ b/packages/core/src/embeddings/transformers-model-load.ts @@ -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 src/mind/transformers-model-load.ts without changes. import { createHash, randomUUID } from 'node:crypto'; import fs from 'node:fs'; import path from 'node:path'; diff --git a/packages/core/src/execution-traces.ts b/packages/core/src/execution-traces.ts index 0291df1..5d7880e 100644 --- a/packages/core/src/execution-traces.ts +++ b/packages/core/src/execution-traces.ts @@ -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 src/mind/execution-traces.ts and changed for @waggle/core. import type { WaggleDB } from './waggle-db.js'; /** diff --git a/packages/core/src/identity.ts b/packages/core/src/identity.ts index f5243c5..f4569e3 100644 --- a/packages/core/src/identity.ts +++ b/packages/core/src/identity.ts @@ -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 src/mind/identity.ts and changed for @waggle/core. /** * IdentityLayer — the user profile card, one per data scope, stored in * waggle.db. The card is what the user writes and edits; facts the agent diff --git a/packages/core/src/injection-scanner.ts b/packages/core/src/injection-scanner.ts index c61ca6d..650a312 100644 --- a/packages/core/src/injection-scanner.ts +++ b/packages/core/src/injection-scanner.ts @@ -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 src/injection-scanner.ts without changes. /** * Prompt-injection scanner — pattern-based detection for role-override, * prompt-extraction, and instruction-injection attempts. diff --git a/packages/core/src/logger.ts b/packages/core/src/logger.ts index 713ab4e..8525e41 100644 --- a/packages/core/src/logger.ts +++ b/packages/core/src/logger.ts @@ -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 src/logger.ts and changed for @waggle/core. /** Minimal structured logger for @waggle/core */ /** diff --git a/packages/core/src/memory-ingress-guard.ts b/packages/core/src/memory-ingress-guard.ts index 511183b..fb3c2d8 100644 --- a/packages/core/src/memory-ingress-guard.ts +++ b/packages/core/src/memory-ingress-guard.ts @@ -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 src/memory-ingress-guard.ts without changes. import { scanForInjection, type ScanResult } from './injection-scanner.js'; export interface ExternalMemoryIngressInput { diff --git a/packages/core/src/recall/inprocess-reranker.ts b/packages/core/src/recall/inprocess-reranker.ts index c63297d..781b555 100644 --- a/packages/core/src/recall/inprocess-reranker.ts +++ b/packages/core/src/recall/inprocess-reranker.ts @@ -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 src/mind/inprocess-reranker.ts and changed for @waggle/core. /** * In-process cross-encoder reranker using @huggingface/transformers (ONNX). * diff --git a/packages/core/src/recall/parse-date-window.ts b/packages/core/src/recall/parse-date-window.ts index d9a0de0..b79b007 100644 --- a/packages/core/src/recall/parse-date-window.ts +++ b/packages/core/src/recall/parse-date-window.ts @@ -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 src/mind/parse-date-window.ts and changed for @waggle/core. /** * parse-date-window.ts — deterministic query-side temporal-constraint parser * (W4.1b, production port of the benchmark-proven Wave-3.1 date-window lane; diff --git a/packages/core/src/recall/recall-context.ts b/packages/core/src/recall/recall-context.ts index df68766..e402ea0 100644 --- a/packages/core/src/recall/recall-context.ts +++ b/packages/core/src/recall/recall-context.ts @@ -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 src/mind/recall-context.ts without changes. /** * recall-context.ts — shared renderer for surfacing temporal information in * recalled-memory blocks. Single source of truth imported by both the Waggle diff --git a/packages/core/src/recall/resolve-relative-date.ts b/packages/core/src/recall/resolve-relative-date.ts index 152eea6..3e4253f 100644 --- a/packages/core/src/recall/resolve-relative-date.ts +++ b/packages/core/src/recall/resolve-relative-date.ts @@ -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 src/mind/resolve-relative-date.ts and changed for @waggle/core. /** * resolve-relative-date — write-time relative-date resolution for the memory substrate. * diff --git a/packages/core/src/waggle-db.ts b/packages/core/src/waggle-db.ts index 650b502..7163309 100644 --- a/packages/core/src/waggle-db.ts +++ b/packages/core/src/waggle-db.ts @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2026 Marko Marković · Egzakta Group · waggle-os.ai +// Parts copied from @waggle/hive-mind-core src/mind/db.ts and changed for @waggle/core. /** * waggle.db — Waggle's own data, kept apart from memory (ADR-0007). * diff --git a/packages/core/src/workspace-manager.ts b/packages/core/src/workspace-manager.ts index 4487631..7a6d4fc 100644 --- a/packages/core/src/workspace-manager.ts +++ b/packages/core/src/workspace-manager.ts @@ -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 src/workspace-manager.ts and changed for @waggle/core. import fs from 'node:fs'; import path from 'node:path'; import type { WorkspaceType } from '@waggle/shared'; diff --git a/packages/core/tests/embeddings/embedding-provider.test.ts b/packages/core/tests/embeddings/embedding-provider.test.ts index e8c4dfe..9070e87 100644 --- a/packages/core/tests/embeddings/embedding-provider.test.ts +++ b/packages/core/tests/embeddings/embedding-provider.test.ts @@ -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. diff --git a/packages/core/tests/embeddings/inprocess-embedder.test.ts b/packages/core/tests/embeddings/inprocess-embedder.test.ts index d13d8c5..0aa2d42 100644 --- a/packages/core/tests/embeddings/inprocess-embedder.test.ts +++ b/packages/core/tests/embeddings/inprocess-embedder.test.ts @@ -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. diff --git a/packages/core/tests/embeddings/transformers-model-load.test.ts b/packages/core/tests/embeddings/transformers-model-load.test.ts index cf63215..8fee4e9 100644 --- a/packages/core/tests/embeddings/transformers-model-load.test.ts +++ b/packages/core/tests/embeddings/transformers-model-load.test.ts @@ -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'; diff --git a/packages/core/tests/license-headers.test.ts b/packages/core/tests/license-headers.test.ts new file mode 100644 index 0000000..87f3d6c --- /dev/null +++ b/packages/core/tests/license-headers.test.ts @@ -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(); + 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'); + }); +}); diff --git a/packages/core/tests/logger.test.ts b/packages/core/tests/logger.test.ts index fe6ff68..cb4aec0 100644 --- a/packages/core/tests/logger.test.ts +++ b/packages/core/tests/logger.test.ts @@ -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. * diff --git a/packages/core/tests/memory-ingress-guard.test.ts b/packages/core/tests/memory-ingress-guard.test.ts index 4f62191..cc5cbfb 100644 --- a/packages/core/tests/memory-ingress-guard.test.ts +++ b/packages/core/tests/memory-ingress-guard.test.ts @@ -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, diff --git a/packages/core/tests/recall/inprocess-reranker.test.ts b/packages/core/tests/recall/inprocess-reranker.test.ts index 4138d4d..7dc90e7 100644 --- a/packages/core/tests/recall/inprocess-reranker.test.ts +++ b/packages/core/tests/recall/inprocess-reranker.test.ts @@ -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'; diff --git a/packages/core/tests/recall/parse-date-window.test.ts b/packages/core/tests/recall/parse-date-window.test.ts index 8165207..b2ea0d9 100644 --- a/packages/core/tests/recall/parse-date-window.test.ts +++ b/packages/core/tests/recall/parse-date-window.test.ts @@ -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'; diff --git a/packages/core/tests/recall/resolve-relative-date.test.ts b/packages/core/tests/recall/resolve-relative-date.test.ts index c232196..d749e54 100644 --- a/packages/core/tests/recall/resolve-relative-date.test.ts +++ b/packages/core/tests/recall/resolve-relative-date.test.ts @@ -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'; diff --git a/packages/core/tests/workspace-manager.test.ts b/packages/core/tests/workspace-manager.test.ts index 4249e28..17a03b6 100644 --- a/packages/core/tests/workspace-manager.test.ts +++ b/packages/core/tests/workspace-manager.test.ts @@ -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';