@the_library/canonical-schemas 0.0.0-stage → 1.0.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 ADDED
@@ -0,0 +1,44 @@
1
+ D-OPEN CODE SOVEREIGN LICENCE v1.0
2
+
3
+ Copyright © 2026 DataPond Public Library Trust ("The Sanctuary")
4
+ Technical Guardian: Pond Enterprise Pty Ltd ("The Shield")
5
+
6
+ Full licence text, legal definitions, and governing terms:
7
+ https://registry.worldbibliotech.com/licence.html
8
+
9
+ Source file: apps/registry/licence.html
10
+
11
+ ---
12
+
13
+ SUMMARY OF KEY TERMS
14
+
15
+ This software is a fundamental component of the DataPond Ecosystem, designed
16
+ to build a decentralised, indestructible public library. Unlike standard
17
+ open-source licences, the D-Open Code Sovereign Licence is a conditional
18
+ grant of rights tied strictly to the ethical and technical preservation of
19
+ the Public Domain.
20
+
21
+ The Trust grants you a worldwide, royalty-free, non-exclusive licence to use,
22
+ copy, modify, and distribute this software, subject to:
23
+
24
+ 1. PUBLIC ACCESS — You may not restrict access to the underlying public data
25
+ via paywalls or mandatory registration.
26
+
27
+ 2. D-SAFE INTEGRITY — Content served by this software must adhere to D-SAFE
28
+ Label standards.
29
+
30
+ 3. TECHNICAL ANCHORS — You may not modify hard-coded Smart Contract addresses
31
+ to point to non-certified ledgers, and you may not fork this package to
32
+ redirect the DataPond canonical models to a private, centralised database.
33
+
34
+ 4. OFFLINE RIGHTS — Deployment in fully offline environments (air-gapped
35
+ schools, remote field operations) is explicitly permitted under snapshot
36
+ terms.
37
+
38
+ 5. BREACH — Violations trigger automatic termination with a 30-day cure
39
+ period before legal action.
40
+
41
+ THE FULL LICENCE TEXT AT THE URL ABOVE GOVERNS. THIS SUMMARY IS FOR
42
+ INFORMATIONAL PURPOSES ONLY AND DOES NOT CONSTITUTE LEGAL ADVICE.
43
+
44
+ Governing law: South Australia.
package/README.md CHANGED
@@ -1,3 +1,542 @@
1
- # Temporary Holding Version
1
+ # `@the_library/canonical-schemas`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The governance artifact and TypeScript type library at the heart of the D-SAFE ecosystem. This package is the single source of truth for all canonical model definitions, international standard definitions, and their multilingual translations. Every D-SAFE application — from DataPond's own frontend to any third-party institution building on the sovereign library stack — installs this package as a dependency.
4
+
5
+ > **No runtime code lives here.** `@the_library/canonical-schemas` ships JSON governance files and TypeScript interfaces only. Executable adapter logic lives in the companion package [`@the_library/standard-adapters`](#dependency-on-the_librarystandard-adapters).
6
+
7
+ ---
8
+
9
+ ## Licence
10
+
11
+ This package is released under the **D-Open Code Sovereign Licence v1.0**.
12
+
13
+ Full text: [registry.worldbibliotech.com/licence.html](https://registry.worldbibliotech.com/licence.html)
14
+
15
+ See the [`LICENSE`](./LICENSE) file in this directory. [Read more about the licence below.](#the-d-open-code-sovereign-licence--source-code)
16
+
17
+ ---
18
+
19
+ ## Package layout
20
+
21
+ ```
22
+ packages/canonical-schemas/
23
+ standards/ International standard definitions (StandardDefinition JSON)
24
+ isbn.json ISO 2108:2017 — International Standard Book Number
25
+ issn.json ISO 3297:2007 — International Standard Serial Number
26
+ isni.json ISO 27729:2012 — International Standard Name Identifier
27
+ orcid.json Open Researcher and Contributor ID
28
+ ddc.json Dewey Decimal Classification (OCLC / Library of Congress)
29
+ lcc.json Library of Congress Classification
30
+ udc.json Universal Decimal Classification (UDC Consortium)
31
+ clc.json Chinese Library Classification (National Library of China)
32
+ bbk.json Library-Bibliographical Classification (Russian State Library)
33
+ tlc.json Thai Library Classification (National Library of Thailand)
34
+ cc.json Colon Classification (S.R. Ranganathan)
35
+
36
+ types/ TypeScript interface definitions — zero runtime code
37
+ StandardAdapter.ts StandardAdapter<TProps, TApis>, StandardApiAdapter, ValidationResult
38
+ StandardDefinition.ts StandardDefinition, StandardProp, ExternalApiEntry, FieldMapping
39
+
40
+ definitions/
41
+ canonical/ ModelDefinition files for canonical entity types
42
+ Book.json multipleInstances: true; instanceUidStrategy drives isbn codegen
43
+ Person.json uidStrategy: ["isni", "orcid"]
44
+ Tag.json uidStrategy: ["ddc"]
45
+ enums/
46
+ CopyrightStatus.json
47
+ QualityScore.json
48
+
49
+ schemas/
50
+ StandardDefinition.1.0.json JSON Schema (meta-schema) for all standards/ files
51
+
52
+ governance/
53
+ GOVERNANCE.md Rules for proposing changes to canonical definitions
54
+ changelog.md Every decision: who approved what and when
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Architecture: the two-tier definition hierarchy
60
+
61
+ Schema definitions in the D-SAFE ecosystem are split into two tiers.
62
+
63
+ ```
64
+ @the_library/canonical-schemas ← governance package (DataPond publishes and controls)
65
+ definitions/canonical/
66
+ Book.json ← canonical: true
67
+ Person.json
68
+ Tag.json
69
+
70
+ packages/db_schemas ← compiler + codec (consumes canonical-schemas)
71
+ definitions/ ← app-level definitions only
72
+ member.json ← canonical: false (DataPond-specific)
73
+ ```
74
+
75
+ The canonical package is an **npm dependency** that every D-SAFE app installs. Third-party developers never edit it directly; they open a PR against the canonical repo to propose new models or translations. This design solves the **cross-app conflict problem**: without a shared authority, two apps that both define a `Book.title` prop could assign conflicting binary layouts, causing silent data corruption when records from different libraries are merged. With this package, canonical propIds are seeded first (IDs 0–511) and every app's compiler enforces the no-override invariant: a local definition may extend a canonical model but may never alter its prop names, types, bit widths, or enum references.
76
+
77
+ ---
78
+
79
+ ## Standards
80
+
81
+ Each file in `standards/` is a `StandardDefinition` — a machine-readable description of one international identifier standard. It specifies:
82
+
83
+ - The **props** the standard contributes to implementing models (name, wire type, normalization, display, check digit algorithm, regex pattern)
84
+ - The **Mode S URI scheme** used for standards-first entity addressing (`sfcuid()`)
85
+ - The **Linked Data URI template** for RDF/LOD output
86
+ - **Discovery metadata** for external APIs, including field mappings and rate limits
87
+
88
+ ### Initial release: identifier standards
89
+
90
+ | Standard | ID | Governing body | ISO ref | Check digit |
91
+ |---|---|---|---|---|
92
+ | ISBN-13 | `isbn` | International ISBN Agency | ISO 2108:2017 | isbn-13-luhn |
93
+ | ISSN | `issn` | ISSN International Centre | ISO 3297:2007 | iso7064-mod11-2 |
94
+ | ISNI | `isni` | ISNI International Agency | ISO 27729:2012 | iso7064-mod11-2 |
95
+ | ORCID iD | `orcid` | ORCID Inc. | — | iso7064-mod11-2 |
96
+
97
+ ### Classification standards
98
+
99
+ | Standard | ID | Governing body |
100
+ |---|---|---|
101
+ | Dewey Decimal Classification | `ddc` | OCLC (licensed from Library of Congress) |
102
+ | Library of Congress Classification | `lcc` | Library of Congress |
103
+ | Universal Decimal Classification | `udc` | UDC Consortium |
104
+ | Chinese Library Classification | `clc` | National Library of China |
105
+ | Library-Bibliographical Classification (ББК) | `bbk` | Russian State Library |
106
+ | Thai Library Classification | `tlc` | National Library of Thailand |
107
+ | Colon Classification | `cc` | S.R. Ranganathan (historical) |
108
+
109
+ Classification standards (ddc and friends) have `externalApis: []` — the classifier assigns notations based on content; no external lookup is needed.
110
+
111
+ ### Normalization and display algorithms
112
+
113
+ Each `props[]` entry declares `normalize` and `display` algorithm IDs. The `@the_library/db_schemas` compiler and `@the_library/standard-adapters` both implement these:
114
+
115
+ | Algorithm | Used by | Normalized form |
116
+ |---|---|---|
117
+ | `compact-13` | ISBN | 13 compact digits; ISBN-10 converted to ISBN-13 |
118
+ | `hyphenated-8` | ISSN | `NNNN-NNNX` |
119
+ | `compact-16` | ISNI | 16 compact digits |
120
+ | `hyphenated-4x4` | ORCID | `NNNN-NNNN-NNNN-NNNX` |
121
+ | `ddc-notation` | DDC | Trim trailing zeros; normalize dots |
122
+
123
+ The normalized form is always the standard's own authoritative storage format, not a universal compactness rule. ORCID retains hyphens because the ORCID spec mandates `NNNN-NNNN-NNNN-NNNX`; ISBN strips them because library convention does.
124
+
125
+ ---
126
+
127
+ ## ModelDefinition and `uidStrategy`
128
+
129
+ `ModelDefinition` files in `definitions/canonical/` may declare a `uidStrategy` field that references standard IDs. This is what links a canonical model to its external identifiers.
130
+
131
+ ```json
132
+ // definitions/canonical/Book.json (excerpt)
133
+ {
134
+ "name": "Book",
135
+ "canonical": true,
136
+ "uidStrategy": "native-only",
137
+ "multipleInstances": true,
138
+ "instanceUidStrategy": ["isbn"]
139
+ }
140
+ ```
141
+
142
+ ```json
143
+ // definitions/canonical/Person.json (excerpt)
144
+ {
145
+ "name": "Person",
146
+ "canonical": true,
147
+ "uidStrategy": ["isni", "orcid"]
148
+ }
149
+ ```
150
+
151
+ | `uidStrategy` value | Meaning |
152
+ |---|---|
153
+ | `"native-only"` | No universal external standard. Generated class uses Mode N UIDs only. |
154
+ | `["isni", "orcid"]` | Implements two standards in priority order. `sfcuid()` returns Mode S from the first whose prop is non-null; falls back to Mode N. |
155
+ | `["ddc"]` | Implements one classification standard. `sfcuid()` returns `ddc:{notation}` when non-null. |
156
+
157
+ `instanceUidStrategy` applies the same logic to instance sub-objects of a `multipleInstances: true` model. `Book.instanceUidStrategy: ["isbn"]` injects the `isbn` prop onto `InstanceData`, generates `Book.LoadInstance("isbn:...")`, and registers an `isbnToInstance` crosswalk map in the Worker.
158
+
159
+ The `@the_library/db_schemas` compiler enforces at build time that every standard ID in a `uidStrategy` array exists in this package's `standards/` directory, has a non-null `uriScheme`, and declares a `pk` prop.
160
+
161
+ ---
162
+
163
+ ## Multilingual ORM (`i18N`)
164
+
165
+ Translations live inside the canonical definition files — not in app code. The French name for `Book.title` is `titre` as a canonical, governance-controlled fact, subject to the same review process as the prop itself. This ensures that any two French-locale apps built on D-SAFE use identical API surfaces, making cross-app interop structurally guaranteed rather than a coordination agreement.
166
+
167
+ ```json
168
+ // definitions/canonical/Book.json (translations excerpt)
169
+ {
170
+ "translations": {
171
+ "fr": {
172
+ "className": "Livre",
173
+ "staticMethods": { "Load": "Construit", "Query": "Chercher" },
174
+ "props": { "title": "titre", "description": "description" }
175
+ },
176
+ "de": { "className": "Buch", "props": { "title": "Titel" } }
177
+ }
178
+ }
179
+ ```
180
+
181
+ The `@the_library/public/models` schema generator's `--locale <lang>` flag emits thin TypeScript facade classes from these entries:
182
+
183
+ ```typescript
184
+ // AUTO-GENERATED: Livre.ts (fr locale facade for Book)
185
+ import { Book } from "./Book.ts";
186
+
187
+ export class Livre extends Book {
188
+ get titre() { return this.title; }
189
+ set titre(v) { this.title = v; }
190
+ static Construit(id: number) { return Book.Load(id); }
191
+ }
192
+ ```
193
+
194
+ The canonical English class is always the structural base. The wire format, `binary.json` propIds, and all on-chain patches are untouched by locale. A French app's `Livre` is 100% binary-compatible with an English app's `Book` — they patch the same propIds.
195
+
196
+ Standard-contributed props also carry translation entries. See the `translations` field in each `standards/*.json` file.
197
+
198
+ ---
199
+
200
+ ## EVM-compatible TypeScript classes
201
+
202
+ The definitions governed by this package are the foundation of a full ORM whose generated output is **natively compatible with EVM smart contract storage**. The `@the_library/public/models` schema generator reads `ModelDefinition` files from `definitions/canonical/` and emits TypeScript classes whose state is binary-encoded into on-chain patches — not stored in a traditional database.
203
+
204
+ ### How the stack connects
205
+
206
+ ```
207
+ @the_library/canonical-schemas ← defines props, types, propIds
208
+ │
209
+ ▼ (consumed at build time)
210
+ packages/db_schemas ← compiler: assigns binary propIds, builds binary.json
211
+ │
212
+ ▼ (code generation)
213
+ packages/public/src/models → generated-src/ ← TypeScript classes with toPatch() / fromPatch()
214
+ │
215
+ ▼ (EVM calldata)
216
+ contracts/ — Factory, BouncerStorage, ← smart contracts receive binary-encoded patches
217
+ ScientistStorage, BackupStorage, on SONIC mainnet (chain 146) and
218
+ AddressRegistry SONIC_BLAZE testnet (chain 14601)
219
+ ```
220
+
221
+ ### Binary encoding
222
+
223
+ Every prop in `definitions/canonical/` maps to a globally stable numeric `propId` in `packages/db_schemas/dist/binary.json`. Canonical props occupy IDs **0–511**; app-level props start at **512**. This range split is what makes cross-institutional interoperability a structural property: any two apps built on the same canonical version agree on canonical propIds without any coordination — their on-chain patches are binary-compatible by construction.
224
+
225
+ The generated class encodes its state into a compact binary patch:
226
+
227
+ ```typescript
228
+ // AUTO-GENERATED (@the_library/public/models output)
229
+ import { Book } from '@my-app/models';
230
+
231
+ const book = new Book();
232
+ book.title = "Thinking, Fast and Slow";
233
+ book.copyrightStatus = CopyrightStatus.InCopyright;
234
+
235
+ // Serialize to binary-encoded EVM calldata:
236
+ const patch = book.toPatch(); // Uint8Array — propId + value pairs, packed per binary.json
237
+
238
+ // Submit via the Factory contract (@the_library/public's EVM client):
239
+ await factory.write.submitPatch([patch]);
240
+ ```
241
+
242
+ The patch codec (`@the_library/db_schemas`'s `src/codec.ts`), `binary.json`, `versions.json`, and the EVM contracts are entirely unaffected by locale, translations, or which external APIs are configured. The ORM's i18N layer and the standard-adapter field-mapping layer both live **above** the wire format — the chain sees only propIds and values.
243
+
244
+ ### What the smart contracts store
245
+
246
+ The four core contracts handle different write concerns:
247
+
248
+ | Contract | Role |
249
+ |---|---|
250
+ | `BouncerStorage` | Access control — enforces member permissions before any write reaches storage |
251
+ | `ScientistStorage` | Content metadata — stores canonical model patches (Book, Person, Tag records) |
252
+ | `BackupStorage` | Arweave sidecar links — permanent-web content addresses anchored on-chain |
253
+ | `Factory` | Write orchestration — routes patches to the correct storage contract |
254
+ | `AddressRegistry` | Canonical address book — resolves contract addresses dynamically to survive hard-forks |
255
+
256
+ Every model write goes through this pipeline: TypeScript ORM class → binary patch → `Factory.submitPatch()` → `BouncerStorage` (access check) → `ScientistStorage` (write). The canonical `propId` values from this package are what the contracts index and the crosswalk Worker queries.
257
+
258
+ ---
259
+
260
+ ## Dependency on `@the_library/standard-adapters`
261
+
262
+ `@the_library/canonical-schemas` ships **only interfaces and JSON**. The companion package `@the_library/standard-adapters` ships the runtime implementations.
263
+
264
+ ```
265
+ @the_library/canonical-schemas ← no runtime imports; standalone
266
+ │ exports: standards/*.json
267
+ │ exports: types/StandardAdapter.ts (interfaces only)
268
+ │ exports: types/StandardDefinition.ts
269
+ │
270
+ ▼ (implements the interfaces)
271
+ @the_library/standard-adapters ← runtime library; imports types from canonical-schemas
272
+ │ exports: ISBNAdapter, ISSNAdapter, ISNIAdapter, ORCIDAdapter, DDCAdapter, ...
273
+ │ exports: apiKeyDictionary
274
+ │
275
+ ▼ (consumes both)
276
+ packages/db_schemas / apps/vue.datapond.earth / apps/book-manager
277
+ ```
278
+
279
+ **Strict dependency rule:** `@the_library/canonical-schemas` must never import anything from `@the_library/standard-adapters`. This is enforced by the pnpm workspace dependency graph — `canonical-schemas/package.json` declares no dependency on `standard-adapters`. The `apiKeyDictionary` singleton that manages runtime API credentials lives entirely in `standard-adapters` and is unknown to this package.
280
+
281
+ ### `StandardAdapter` interface (defined here, implemented in `standard-adapters`)
282
+
283
+ ```typescript
284
+ // types/StandardAdapter.ts
285
+
286
+ export interface StandardAdapter<TProps, TApis> {
287
+ readonly standardId: string;
288
+ readonly uriScheme: string | null;
289
+ readonly apis: TApis;
290
+ normalize(value: string): string;
291
+ display(value: string): string;
292
+ validate(value: string | null | undefined): ValidationResult;
293
+ toLinkedDataUri(value: string): string;
294
+ }
295
+ ```
296
+
297
+ Each adapter in `standard-adapters` implements this interface. The `@the_library/db_schemas` compiler imports `standard-adapters` at build time and validates that every `externalApis[].id` in a standard's JSON definition has a matching key in the corresponding adapter's `apis` object. A missing key is a fatal compile error.
298
+
299
+ ### `externalApis` and field mapping
300
+
301
+ The `externalApis[]` array in each standard definition describes the external APIs that support that standard and how their response fields map onto model props:
302
+
303
+ ```json
304
+ {
305
+ "id": "openlibrary",
306
+ "kind": "lookup",
307
+ "rateLimit": { "requests": 100, "windowSeconds": 60 },
308
+ "fieldMapping": [
309
+ { "source": "title", "target": "title", "overwrite": "if-empty" },
310
+ { "source": "pageCount", "target": "pageCount", "overwrite": "if-empty" },
311
+ { "source": "publishDate", "target": "pubYear", "overwrite": "if-empty" }
312
+ ]
313
+ }
314
+ ```
315
+
316
+ - `"lookup"` — called with the standard's known pk value; populates or corrects model fields from an authoritative source.
317
+ - `"search"` — called with partial information (a name, a keyword); returns candidates for operator selection.
318
+ - `overwrite: "always"` — write unconditionally (use for pk fields and authoritative IDs).
319
+ - `overwrite: "if-empty"` — write only if the target prop is currently null.
320
+ - `overwrite: "never"` — fetch for UI comparison; do not auto-apply.
321
+
322
+ The `@the_library/public/models` codegen uses these entries to generate `fetchFrom{ApiId}()` and `searchFrom{ApiId}()` methods on the model class, with return types inferred from the adapter's TypeScript `TApis` map.
323
+
324
+ ### `ApiKeyDictionary`
325
+
326
+ Adapters that require an API key (marked `requiresApiKey: true` in `externalApis[]`) consume credentials through a global `apiKeyDictionary` singleton in `standard-adapters`. Consumer apps set keys once at startup:
327
+
328
+ ```typescript
329
+ import { apiKeyDictionary } from '@the_library/standard-adapters';
330
+
331
+ // Call before any adapter method that requires a key
332
+ apiKeyDictionary.set('googlebooks', import.meta.env.VITE_GOOGLE_BOOKS_API_KEY);
333
+ ```
334
+
335
+ If a key is missing when an adapter calls `apiKeyDictionary.require(apiId)`, it throws immediately with a clear error naming the missing key — fail fast at configuration time, not mid-request.
336
+
337
+ ---
338
+
339
+ ## Governance
340
+
341
+ `@the_library/canonical-schemas` follows semantic versioning with strict rules:
342
+
343
+ | Bump | Triggers |
344
+ |---|---|
345
+ | **Patch** | Typo fixes in labels or descriptions; translation additions; governance doc edits |
346
+ | **Minor** | New standard definition file; new `externalApis[]` entry; new canonical model prop or enum value |
347
+ | **Major** | Any change to a frozen field: `props[].name`, `props[].type`, `checkDigit.algorithm`, `uriScheme` variable names; removal of a standard; propId reassignment |
348
+
349
+ **Frozen forever once published:** `id`, `props[].name`, `props[].type`, `props[].checkDigit.algorithm`, and `uriScheme` template variable names. These fields are embedded in binary-encoded on-chain patches for the life of the protocol.
350
+
351
+ To propose a new standard or canonical model, open two coordinated PRs: one against this package (the JSON definition) and one against `@the_library/standard-adapters` (the TypeScript implementation). Both must be reviewed and merged together — a standard definition without a registered adapter is a fatal compile error in downstream apps.
352
+
353
+ See [`governance/GOVERNANCE.md`](./governance/GOVERNANCE.md) and [`governance/changelog.md`](./governance/changelog.md).
354
+
355
+ ---
356
+
357
+ ## JSON Schema validation
358
+
359
+ All files in `standards/` are validated against the meta-schema at `https://schemas.dsafe.us/StandardDefinition/1.0`. A local copy is bundled at [`schemas/StandardDefinition.1.0.json`](./schemas/StandardDefinition.1.0.json) and resolved via the package `exports` map for IDE tooling and CI validation before the remote endpoint is live.
360
+
361
+ ---
362
+
363
+ ## Licence Architecture
364
+
365
+ The D-SAFE ecosystem operates under **two distinct licences** covering two distinct concerns. Understanding which licence applies to what is essential before building on this stack.
366
+
367
+ ```
368
+ SOURCE CODE CONTENT
369
+ (this package, smart contracts) (books, works, knowledge artifacts)
370
+
371
+ D-Open Code Sovereign Licence ──── governs ────► D.I.C. + K (Ꭰ-Licence)
372
+ └─ takes full liability └─ Decentralized · Integral · Common
373
+ └─ non-modification clause └─ + K certification overlay
374
+ └─ compatible with D.I.C. └─ enforced on-chain by BouncerStorage
375
+ └─ fully D-SAFE by design └─ anchored on Arweave permanently
376
+ ```
377
+
378
+ They are designed to work together. The source code engine was built from the ground up to support D.I.C. natively: every architectural decision — immutable contracts, Arweave anchoring, the canonical schema, the BouncerStorage gate — exists to make D.I.C. compliance the path of least resistance for any application built on top.
379
+
380
+ ---
381
+
382
+ ## The D-Open Code Sovereign Licence · Source Code
383
+
384
+ This package, the EVM smart contracts, and the entire D-SAFE engine are published under the **D-Open Code Sovereign Licence v1.0**.
385
+
386
+ Full text: [registry.worldbibliotech.com/licence.html](https://registry.worldbibliotech.com/licence.html)
387
+
388
+ This is a licence for **source code** — the engine, the schema compiler, the ORM, the on-chain contracts. It is not a content licence. It governs what developers may do with the software itself.
389
+
390
+ ### What makes it different
391
+
392
+ Unlike every conventional open-source licence, the D-Open Code Sovereign Licence **takes liability rather than disclaiming it**. It establishes a two-layer accountability structure:
393
+
394
+ - **The Sanctuary** — DataPond Public Library Trust, a non-profit entity holding the assets. Provides the software and holds zero liability for damages, gas fees, or data loss.
395
+ - **The Shield** — Pond Enterprise Pty Ltd, the technical guardian. Absorbs all claims regarding technical performance, patent infringement, and professional indemnity related to the core architecture.
396
+
397
+ This is not a disclaimer. It is an **architecture of accountability** — named entities standing behind the technical warranty. For the first time, institutional partners, schools, and governments can deploy sovereign library infrastructure with a legal counterpart they can actually reach.
398
+
399
+ ### Core terms
400
+
401
+ ```
402
+ ┌──────────────────────────────────────────────────────────────────┐
403
+ │ D-OPEN CODE SOVEREIGN LICENCE — SOURCE CODE │
404
+ ├──────────────────────────────────────────────────────────────────┤
405
+ │ PERMITTED │
406
+ │ │
407
+ │ ✔ Use, copy, and distribute the source code freely │
408
+ │ ✔ Build D-SAFE-compliant applications on top of it │
409
+ │ ✔ Deploy in fully offline / air-gapped environments │
410
+ │ ✔ Snapshot the codebase for long-term archive deployments │
411
+ │ │
412
+ ├──────────────────────────────────────────────────────────────────┤
413
+ │ CONDITIONS │
414
+ │ │
415
+ │ ✘ No Modification of the certified source │
416
+ │ ✘ No redirecting canonical models to private databases │
417
+ │ ✘ No use in applications with paywalls or mandatory login │
418
+ │ ✘ No deployment in jurisdictions where decentralised │
419
+ │ storage or uncensored public-domain data is illegal │
420
+ └──────────────────────────────────────────────────────────────────┘
421
+ ```
422
+
423
+ **On the No Modification clause:** the contracts are immutable once deployed on-chain. A modified contract cannot be recalled. A mis-deployed fork could permanently corrupt member records or redirect library assets with no possibility of reversal. The prohibition is therefore not a restriction of developer freedom — it is a protection of the permanence that makes the library indestructible.
424
+
425
+ **On offline rights:** the licence explicitly grants snapshot and offline deployment rights. Hard-coded contract addresses in a D-SAFE certified snapshot are legally valid in air-gapped environments (schools, bunkers, remote field operations) where no connection to the canonical config or blockchain is possible. No other open-source licence has addressed this use case directly.
426
+
427
+ **On interoperability as a legal condition:** the licence prohibits forking this package to redirect the DataPond canonical models to a private, centralised database. Any institution building on `@the_library/canonical-schemas` is making a legally binding commitment to the shared canonical schema — not just a technical one. This is what makes cross-institutional data compatibility durable.
428
+
429
+ ---
430
+
431
+ ## The Ꭰ-Licence · Content (D.I.C. + K)
432
+
433
+ The **Ꭰ-Licence** governs the **knowledge artifacts** — books, works, records — that flow through the certified infrastructure. It is composed of two layers: the D.I.C. base licence and the K certification overlay.
434
+
435
+ > The Ꭰ character is Unicode `U+13A0`, the Cherokee letter A, visually identical to a Latin capital A. AI models, OCR engines, and search crawlers read it as A. Readers who know its meaning read it as D. The double-reading is intentional: open to machines, meaningful to those who built on it. It is a philosophical mark, not a security mechanism.
436
+
437
+ ### D.I.C. — the base licence
438
+
439
+ D.I.C. stands for **Decentralized · Integral · Common**. Each letter is a non-negotiable pillar:
440
+
441
+ ```
442
+ D · Decentralized
443
+ Content lives on Arweave — the Permaweb.
444
+ Guaranteed access for 250+ years.
445
+ No corporate kill-switch. No server a company can pull.
446
+ No database an operator can delete.
447
+
448
+ I · Integral
449
+ Zero money flow. An absolute prohibition on any extraction
450
+ of commercial value from the distribution of knowledge:
451
+
452
+ ✘ No advertising or sponsorships
453
+ ✘ No paywalls or subscriptions
454
+ ✘ No social media integration or engagement loops
455
+ ✘ No news feeds or algorithmic amplification
456
+
457
+ A pure, unmonetised distribution of knowledge. Nothing else.
458
+
459
+ C · Common
460
+ Based on Creative Commons CC BY-NC-ND 4.0:
461
+ · Attribution required in all reproductions
462
+ · Non-Commercial — the content itself cannot generate revenue
463
+ · No Derivatives — no modification of certified works
464
+ ```
465
+
466
+ ### K — the Knowledge certification overlay
467
+
468
+ D.I.C. is a licence anyone can apply to their work. The **K layer** is what earns the work the **D-SAFE label** — and it cannot be self-issued.
469
+
470
+ K certification requires:
471
+
472
+ 1. **Submission** — the work is submitted to the D-SAFE Registry with provenance documentation
473
+ 2. **Human review** — a manual audit against the zero-tolerance exclusion checklist
474
+ 3. **Authorship verification** — confirmation of human authorship
475
+ 4. **Audit record** — a cryptographic hash of the review published permanently to Arweave
476
+ 5. **Label issuance** — the D-SAFE label is granted and the work is published under the full Ꭰ-Licence
477
+
478
+ **The K layer is deliberately not automated.** No algorithm decides whether a work carries the D-SAFE label. Human review is a hard prerequisite by design. This is what distinguishes the D-SAFE certification from content moderation filters — it is a human judgement, not a classifier output.
479
+
480
+ A work can carry the D.I.C. licence without the D-SAFE label. It cannot carry the D-SAFE label without passing the K review.
481
+
482
+ ### The D-CODE Licence — formal name
483
+
484
+ The complete content licence applied to all D-SAFE certified works is formally named the **D-CODE Licence** (Digital Constitution of Open and Decentralized Ecosystems). It is the legal instrument binding publishers to the D.I.C. + K obligations:
485
+
486
+ - Content must be permanently and freely accessible to all
487
+ - Content cannot be placed behind a paywall, subscription, or access control of any kind
488
+ - Content cannot be removed or deleted by any party, including the original publisher
489
+ - Attribution must be preserved in all reproductions and derivatives
490
+ - Commercial use of the content itself is prohibited; the infrastructure hosting it may be commercial
491
+
492
+ The D-CODE Licence is implemented on-chain via the `BouncerStorage` smart contract on Sonic Chain (Chain ID 146). The human-readable licence text is stored alongside every certified work on Arweave — it travels permanently with the content.
493
+
494
+ ### The D-SAFE K.nowledge label — inherited by the smart contracts
495
+
496
+ Every piece of content accepted by the DataPond contracts is D-SAFE certified before it reaches storage. The `BouncerStorage` contract enforces D-SAFE compliance at the write boundary: a record without a valid D-SAFE label is rejected and never reaches `ScientistStorage`.
497
+
498
+ Because all content flowing through these contracts already carries the K certification, **the contracts themselves inherit the D-SAFE K.nowledge label**. The engine is certified D-SAFE not by declaration, but by construction.
499
+
500
+ ```
501
+ ┌────────────────────────────────────────────────────────────────┐
502
+ │ │
503
+ │ Ꭰ-SAFE · K.nowledge Label │
504
+ │ │
505
+ │ All content certified free of: │
506
+ │ · Hate speech │
507
+ │ · Explicit material │
508
+ │ · Environmental harm promotion │
509
+ │ · Advertising, paywalls, and social media feeds │
510
+ │ · AI-generated content (human authorship required) │
511
+ │ │
512
+ │ Verified by: dsafe.us · manual human review │
513
+ │ Audit record: Arweave · permanent, immutable │
514
+ │ Enforced by: BouncerStorage · Sonic Chain 146 │
515
+ │ │
516
+ └────────────────────────────────────────────────────────────────┘
517
+ ```
518
+
519
+ The certification chain is complete and unbroken:
520
+
521
+ ```
522
+ dsafe.us human review
523
+ → cryptographic audit hash published to Arweave
524
+ → BouncerStorage gate (on-chain enforcement)
525
+ → ScientistStorage write
526
+ → Arweave content anchor (permanent)
527
+ ```
528
+
529
+ Any institution reading data from these contracts can trust not just the schema (governed by this package) but the content itself. The Ꭰ-SAFE label travels with the knowledge from the moment of certification to the moment of retrieval, permanently and verifiably.
530
+
531
+ Full licence text: [registry.worldbibliotech.com/licence.html](https://registry.worldbibliotech.com/licence.html)
532
+
533
+ ---
534
+
535
+ ## Related packages
536
+
537
+ | Package | Role |
538
+ |---|---|
539
+ | [`@the_library/standard-adapters`](../standard-adapters) | Runtime StandardAdapter implementations for all standards in this package |
540
+ | [`@the_library/db_schemas`](../db_schemas) | ORM compiler and binary codec; consumes canonical definitions at build time |
541
+ | [`@the_library/public`](../public) — `src/models/` | TypeScript class generator; emits model classes and locale facade classes |
542
+ | [`@the_library/public`](../public) — `src/web3/` | EVM SDK: ABI files and deployed addresses for the on-chain registry |