@gnolith/taproot 0.1.0-rc.0 → 0.3.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/COMPATIBILITY.md +15 -3
  3. package/LICENSE +21 -21
  4. package/README.md +122 -46
  5. package/SECURITY.md +10 -3
  6. package/SUPPORT.md +6 -1
  7. package/dist/authorization-maintenance.d.ts +55 -0
  8. package/dist/authorization-maintenance.d.ts.map +1 -0
  9. package/dist/authorization-maintenance.js +686 -0
  10. package/dist/authorization-maintenance.js.map +1 -0
  11. package/dist/authorization.d.ts +98 -0
  12. package/dist/authorization.d.ts.map +1 -0
  13. package/dist/authorization.js +1137 -0
  14. package/dist/authorization.js.map +1 -0
  15. package/dist/canonical.d.ts +2 -1
  16. package/dist/canonical.d.ts.map +1 -1
  17. package/dist/canonical.js +9 -1
  18. package/dist/canonical.js.map +1 -1
  19. package/dist/errors.d.ts +10 -0
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/errors.js +10 -0
  22. package/dist/errors.js.map +1 -1
  23. package/dist/index.d.ts +127 -50
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +352 -44
  26. package/dist/index.js.map +1 -1
  27. package/dist/migrations.d.ts +42 -0
  28. package/dist/migrations.d.ts.map +1 -0
  29. package/dist/migrations.js +550 -0
  30. package/dist/migrations.js.map +1 -0
  31. package/dist/rdf.js +1 -1
  32. package/dist/rdf.js.map +1 -1
  33. package/dist/repository.d.ts +22 -11
  34. package/dist/repository.d.ts.map +1 -1
  35. package/dist/repository.js +596 -63
  36. package/dist/repository.js.map +1 -1
  37. package/dist/schema.d.ts +41 -7
  38. package/dist/schema.d.ts.map +1 -1
  39. package/dist/schema.js +722 -83
  40. package/dist/schema.js.map +1 -1
  41. package/dist/types.d.ts +59 -0
  42. package/dist/types.d.ts.map +1 -1
  43. package/docs/api.md +70 -18
  44. package/docs/architecture.md +21 -8
  45. package/docs/authorization.md +82 -0
  46. package/docs/completion-audit.md +22 -16
  47. package/docs/operations.md +48 -9
  48. package/docs/product-scope.md +11 -4
  49. package/docs/release-policy.md +4 -0
  50. package/docs/testing.md +31 -5
  51. package/docs/threat-model.md +38 -6
  52. package/examples/d1-diamond-interop/README.md +12 -0
  53. package/examples/d1-diamond-interop/demo.ts +281 -0
  54. package/migrations/0002_audit_operations.sql +4 -3
  55. package/migrations/0003_canonical_statement_text.sql +31 -0
  56. package/migrations/0004_canonical_authorization_policy.sql +213 -0
  57. package/package.json +12 -7
  58. package/examples/codex-site/.openai/hosting.json +0 -3
  59. package/examples/codex-site/README.md +0 -13
  60. package/examples/codex-site/demo.ts +0 -152
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ - **Breaking 0.3 API:** removed `TaprootRepository`, `createTaproot`, and every
6
+ unscoped canonical read helper from the normal package export. Canonical
7
+ entity, history, list, term-search, audit, export, integrity, and repair
8
+ access now exists only through mandatory `AuthorizedTaprootReader` context.
9
+ - Added host-issued non-extractable AES-GCM cursor capability, authenticated
10
+ cursors bound to caller/grants/query/filter/auth revision/data generation,
11
+ fixed-size plaintext padding, identifier-only candidate scans, denied-heavy
12
+ page filling, and final authorization rechecks. Revision and audit generation
13
+ invalidate cursors after writes and repair. Stale, tampered, and cross-context
14
+ cursors fail generically.
15
+ - Public mutation helpers now return minimal receipts and reject validator/RDF
16
+ factory callbacks and configurable entity-size probes, so write configuration
17
+ cannot observe preexisting canonical content. They require a process-local
18
+ opaque installation authorization guard bound to the exact database object
19
+ and installation base IRI. Normal writes require current `knowledge:write`;
20
+ policy changes require orthogonal `knowledge:policy`. Raw repository
21
+ internals are not package-exported.
22
+ - Added host-created authorization contexts, canonical CNF visibility scopes,
23
+ lossless scope intersection, portable fingerprints, explicit `search:admin`
24
+ checks, and fail-closed pre/post-hydration canonical reads.
25
+ - Added checksummed migration 4 with immutable installation authorization
26
+ state, current and per-revision entity/statement policy, atomic projection
27
+ outbox and counter advances, fail-closed legacy quarantine, and bounded
28
+ hash-attested `search:admin` backfill. Unique durable advance IDs prevent
29
+ same-target ABA races for canonical and cross-package ordered batches.
30
+ - Runtime JavaScript writes now fail closed when authorization metadata is
31
+ omitted, authorize before loading existing canonical state, validate redirect
32
+ targets and historical reverts against current policy, and preserve generic
33
+ denial behavior for missing, stale, or inaccessible targets.
34
+ - Cross-package authorization fencing is guard-executed and inseparable from
35
+ the ordered database batch. Authorization singleton/audit rows reject
36
+ replacement, readiness verifies current and historical statement-policy
37
+ coverage, and authorized bulk import advances its context between entities.
38
+ - Added host-issued fence-only domain guards bound to one exact non-Knowledge
39
+ capability. Task/Memory-style writes can share the installation revision
40
+ without borrowing Knowledge authority or advancing counters; Knowledge
41
+ advances require orthogonal policy authority and bind the prior durable
42
+ advance ID.
43
+ - Authorization readiness and persisted sources now require exact parity
44
+ between mutable current policy and its immutable matching revision, and
45
+ recompute historical statement coverage/effective visibility before use.
46
+ Operational inspection also validates exact trigger definitions.
47
+
48
+ - Added required, explicitly authored nonblank `Statement.text` to canonical
49
+ JSON and to every logical statement mutation.
50
+ - Added canonical JSON migration 3. Existing databases with no unauthored
51
+ statements upgrade atomically; persisted statements without text fail closed
52
+ rather than receiving inferred fallback prose.
53
+ - Whole-entity replacement and historical revert now require an exact
54
+ statement-ID-to-text resupply map, preventing silent stale-text carry.
55
+
56
+ ## 0.2.0
57
+
58
+ - Added a runtime-neutral SQLite persistence surface while retaining D1
59
+ compatibility types and injection.
60
+ - Added checksummed Taproot migration plan, inspect, conservative adoption,
61
+ and apply APIs.
62
+ - Made the canonical HTTP(S) base IRI a durable, immutable database identity.
63
+ - Added Workerd D1 and process-local Node SQLite parity coverage for reopen,
64
+ rollback, and concurrent writers.
65
+
3
66
  ## 0.1.0
4
67
 
5
68
  - Complete Wikibase Item/Property JSON model and validated editing API.
package/COMPATIBILITY.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Wikibase compatibility target
2
2
 
3
+ Taproot 0.3.x requires `@gnolith/diamond` 0.4.0 exactly. Existing Cloudflare D1
4
+ objects remain compatible with the exported `D1DatabaseLike` surface. New
5
+ embedders may use the equivalent `SqliteDatabaseLike`; both require one
6
+ adapter/connection with ordered atomic batch semantics.
7
+
8
+ Fresh databases require an explicit durable absolute HTTP(S) base IRI. A
9
+ version-one database is adopted only when its known table and version markers
10
+ match the supported legacy layout; arbitrary partial schemas fail closed.
11
+
3
12
  Taproot targets the canonical entity shapes and RDF vocabulary paths used by
4
13
  the Wikibase API/RDF model, with site-owned entity/property namespaces. The
5
14
  fixtures under `test/fixtures` are the named interoperability baseline.
@@ -16,8 +25,10 @@ Intentional differences:
16
25
  lifecycle RDF; deleted content remains available in immutable revisions.
17
26
  - Search is a deterministic D1 term projection using case-insensitive
18
27
  substring matching. FTS5 is not required.
19
- - Taproot stores attribution claims but does not authenticate them. Identity
20
- verification, authorization, and agent/MCP transport remain host concerns.
28
+ - Taproot stores attribution claims but does not authenticate them. Normal
29
+ canonical reads require a host-created authorization context and use
30
+ Taproot's persisted canonical policy. Authentication, principals,
31
+ memberships, sessions, and agent/MCP transport remain host concerns.
21
32
  - The compatibility target is Wikibase core Items and Properties. Lexemes,
22
33
  Forms, Senses, EntitySchemas, MediaInfo, MediaWiki page metadata, and
23
34
  normalized external-ID formatter URLs are not claimed as supported entity
@@ -27,7 +38,8 @@ Intentional differences:
27
38
  link datatypes without claiming storage for those target entity documents.
28
39
  - Math, musical notation, geo-shape, and tabular-data values round-trip and
29
40
  project with Wikibase property types. Geo-shape/tabular-data values use
30
- Commons data IRIs; deployments remain responsible for those resources.
41
+ Commons data IRIs; availability of those external resources is outside this
42
+ package.
31
43
  - Taproot adds a site-owned mapping-version triple and retains
32
44
  `schema:isBasedOn` beside standard `prov:wasDerivedFrom` for backward
33
45
  compatibility. These additive triples do not change Wikibase query paths.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Gnolith contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gnolith contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Taproot
2
2
 
3
- **The D1-native, Wikibase-compatible knowledge layer for Gnolith.**
3
+ **The portable SQLite and D1, Wikibase-compatible knowledge layer for Gnolith.**
4
4
 
5
- Taproot gives a Codex Site one authoritative Wikibase-shaped Item/Property
5
+ Taproot gives a D1-backed consumer one authoritative Wikibase-shaped Item/Property
6
6
  document, tamper-evident revision and attribution history, typed and batched
7
7
  editing commands, term search, repairable projections, and a deterministic RDF projection stored and queried by
8
8
  [`@gnolith/diamond`](https://github.com/gnolith/diamond).
@@ -12,15 +12,17 @@ editing commands, term search, repairable projections, and a deterministic RDF p
12
12
 
13
13
  ## Status
14
14
 
15
- Version `0.1.0` is the first public release. Taproot supports Node 22 and 24 and
16
- depends on the registry release of Diamond that exposes transaction-composable
17
- quad patches.
15
+ Version `0.3.0` supports Node 22 and 24 and depends exactly on Diamond `0.4.0`,
16
+ which exposes transaction-composable RDF patches, a runtime-neutral SQLite
17
+ capability, and a process-local `node:sqlite` adapter.
18
18
 
19
19
  ## What it owns
20
20
 
21
21
  - Items and Properties with Wikibase-style canonical JSON.
22
22
  - Labels, descriptions, aliases, sitelinks, statements, qualifiers,
23
23
  references, ranks, and all three snak types.
24
+ - Nonblank, explicitly authored text for every logical statement revision;
25
+ Taproot never generates prose from properties or values.
24
26
  - Item, Property, Lexeme, Form, Sense, and EntitySchema links; string,
25
27
  external ID, URL, Commons media, monolingual text, time,
26
28
  quantity, coordinate, math, musical notation, geo-shape, and tabular-data
@@ -42,30 +44,63 @@ there is no relational statement store.
42
44
 
43
45
  Taproot requires Diamond's transaction-composable quad-patch API. Initialize a
44
46
  D1 binding once; the programmatic initializer creates both Diamond and Taproot
45
- tables idempotently:
47
+ tables idempotently. First initialization requires the database's permanent
48
+ identity:
46
49
 
47
50
  ```ts
48
- import { TaprootRepository, initializeTaproot } from '@gnolith/taproot';
49
-
50
- await initializeTaproot(env.DB);
51
- const knowledge = new TaprootRepository(env.DB, {
51
+ import {
52
+ createAuthorizationCursorCodec,
53
+ createAuthorizedTaproot,
54
+ createItem,
55
+ bootstrapTaprootAuthorization,
56
+ createInstallationAuthorizationGuard,
57
+ createTaprootHostWriteCapability,
58
+ initializeTaproot,
59
+ setLabel,
60
+ } from '@gnolith/taproot';
61
+
62
+ await initializeTaproot(env.DB, { baseIri: 'https://knowledge.example' });
63
+ const options = {
52
64
  baseIri: 'https://knowledge.example',
65
+ };
66
+ const writeCapability = createTaprootHostWriteCapability(
67
+ env.DB,
68
+ options,
69
+ nonExtractableHmacSha256Key,
70
+ );
71
+ await bootstrapTaprootAuthorization(
72
+ env.DB,
73
+ options,
74
+ writeCapability,
75
+ 'installation-1',
76
+ );
77
+ const guard = await createInstallationAuthorizationGuard(
78
+ env.DB,
79
+ options,
80
+ writeCapability,
81
+ );
82
+
83
+ const item = await createItem(env.DB, options, guard, writeContext, {
84
+ labels: { en: { language: 'en', value: 'Ada Lovelace' } },
85
+ authorization: canonicalPolicy,
53
86
  });
54
87
 
55
- const property = await knowledge.createProperty({
56
- datatype: 'string',
57
- labels: { en: { language: 'en', value: 'occupation' } },
58
- });
59
- const item = await knowledge.createItem({
60
- labels: { en: { language: 'en', value: 'Ada Lovelace' } },
88
+ // The host derives context only from authenticated state. Taproot loads its
89
+ // persisted canonical policy itself. The cursor key is durable and host-held.
90
+ const knowledge = createAuthorizedTaproot(env.DB, options, readContext, {
91
+ cursorCodec: createAuthorizationCursorCodec(nonExtractableAesGcmKey),
61
92
  });
93
+ const canonical = await knowledge.getEntity(item.entityId);
62
94
  ```
63
95
 
64
- For migration-driven deployments, apply Diamond's migrations and the numbered
65
- Taproot SQL files, then call `initializeTaproot()`. The initializer performs
66
- the application-level SHA-256 backfill that SQLite SQL alone cannot perform,
67
- reprojects older RDF mapping versions, installs immutability triggers, and is
68
- safe to run on every startup/deploy.
96
+ Never accept either host key, host capability, authorization guard, context, or
97
+ policy from a request, MCP argument, prompt, or query.
98
+
99
+ Use Taproot's `planTaprootMigrations`, `applyTaprootMigrations`, and
100
+ `initializeTaproot` APIs for schema changes. The numbered SQL files document
101
+ the historical 0.1 layout and are not an operator migration interface in 0.3.
102
+ The package APIs own checksums, conservative adoption, application-level
103
+ SHA-256 backfills, and RDF reprojection.
69
104
 
70
105
  ## Editing
71
106
 
@@ -77,35 +112,72 @@ Diamond patch together. A stale guard or any SQL/RDF failure rolls the whole
77
112
  batch back.
78
113
 
79
114
  ```ts
80
- const edited = await knowledge.setLabel(item.entityId, 'fr', 'Ada Lovelace', {
81
- expectedRevision: item.newRevision,
82
- attribution: {
83
- id: 'agent:cataloguer',
84
- kind: 'agent',
85
- tool: 'gnolith-mcp',
115
+ const edited = await setLabel(
116
+ env.DB,
117
+ options,
118
+ guard,
119
+ currentWriteContext,
120
+ item.entityId,
121
+ 'fr',
122
+ 'Ada Lovelace',
123
+ {
124
+ expectedRevision: item.newRevision,
125
+ attribution: {
126
+ id: 'agent:cataloguer',
127
+ kind: 'agent',
128
+ tool: 'gnolith-mcp',
129
+ },
130
+ editSummary: 'add French label',
131
+ tags: ['agent'],
132
+ requestId: 'mcp-request-123',
133
+ authorization: currentCanonicalPolicy,
86
134
  },
87
- editSummary: 'add French label',
88
- tags: ['agent'],
89
- requestId: 'mcp-request-123',
90
- });
135
+ );
91
136
  ```
92
137
 
93
- The public API includes reads/search; create/import/replace; soft delete,
94
- restore, and redirect; all term/sitelink commands; complete statement,
95
- qualifier, reference, and rank commands; audit/history and integrity reads;
96
- bulk workflows; and canonical JSON parse, validate, create, and export helpers. Top-level function forms are exported alongside
97
- `TaprootRepository`.
98
-
99
- Set `requireAttribution: true` to reject unattributed writes. `validators`
100
- provide host policy checks without coupling Taproot to authentication, and
101
- `observe` receives isolated success/error timing records for committed writes.
138
+ The public API exposes canonical reads only on `AuthorizedTaprootReader`.
139
+ Entity/history/list/term-search/audit/export and integrity operations require a
140
+ host-created authorization context and Taproot's persisted policy source.
141
+ Public mutation helpers require the DB/installation-bound opaque authorization
142
+ guard, a current context with exact `knowledge:write`, and canonical policy
143
+ input. Policy changes additionally require exact `knowledge:policy`. They
144
+ return only entity ID, previous/new revision, authorization/search generation,
145
+ and committed status;
146
+ they do not return canonical JSON, text, RDF counts, hashes, or audit bodies.
147
+ `TaprootRepository` and raw read helpers are intentionally absent from package
148
+ exports in the breaking 0.3 line.
149
+
150
+ The opaque guard also owns execution of ordered cross-package batches that
151
+ need an exact authorization-revision fence or advance. It does not expose raw
152
+ counter-update statements that a caller could separate from the corresponding
153
+ audit, assertion, or domain writes.
154
+ Hosts issue a distinct fence-only domain guard for each exact non-Knowledge
155
+ domain capability, such as Task or Memory writes. The capability is bound at
156
+ issuance, cannot be supplied at the call site, and an ordinary domain fence
157
+ does not advance authorization or search counters. Knowledge authorization
158
+ advances additionally require `knowledge:policy`.
159
+
160
+ Statement creation and replacement include `text` on the `Statement` itself.
161
+ Rank, qualifier, and reference mutation methods require authored text for the
162
+ new logical statement revision. `replaceEntity` and `revertEntity` require an
163
+ exact `statementTexts` map for every statement they carry forward. Reusing old
164
+ wording is allowed only when the caller deliberately supplies it again.
165
+
166
+ Set `requireAttribution: true` to reject unattributed writes. `observe` receives
167
+ isolated success/error timing records. Public write options cannot install
168
+ validators or RDF factories over canonical state and cannot vary the canonical
169
+ entity-size limit; hosts perform domain validation before invoking the write
170
+ using separately authorized input.
102
171
 
103
172
  ## SPARQL prefixes
104
173
 
105
174
  `wikibasePrefixes(baseIri)` returns site-owned `wd:`, `wds:`, `wdv:`,
106
175
  `wdref:`, `wdt:`, `p:`, `ps:`, `psv:`, `pq:`, `pqv:`, `pr:`, `prv:`, and
107
- `wdno:` namespaces. Pass the D1 binding to Diamond's read-only SPARQL handler
108
- to query them.
176
+ `wdno:` namespaces. Diamond's database-level SPARQL handler can query them, but
177
+ it sees the complete graph and is privileged host maintenance/debug
178
+ infrastructure. Do not expose it to a user, agent, MCP, or search caller.
179
+ Normal SPARQL needs an authorization-scoped dataset and final canonical policy
180
+ recheck in the owning host.
109
181
 
110
182
  ## Limits
111
183
 
@@ -115,13 +187,17 @@ that as `QuadPatchTooLargeError`. Store PDFs, images, audio, OCR, transcripts,
115
187
  and article bodies externally and represent them as knowledge Items.
116
188
 
117
189
  Bulk imports default to create-only, can opt into `upsert`, are capped at 100
118
- entities by default, and commit one entity atomically at a time. Multi-command
119
- edits apply up to 100 commands in one revision. All list limits are capped at 500.
190
+ entities by default, and commit one entity atomically at a time. Authorized
191
+ bulk policies use sequential expected authorization revisions; Taproot carries
192
+ each successful advance into the next entity's context. Multi-command edits
193
+ apply up to 100 commands in one revision. All list limits are capped at 500.
120
194
 
121
- See the [Codex Site example](examples/codex-site/README.md),
195
+ See the [local D1 and Diamond interoperability example](examples/d1-diamond-interop/README.md),
122
196
  [`COMPATIBILITY.md`](COMPATIBILITY.md), and the architecture, API, operations,
123
197
  and release documents under `docs/`. Run `npm run check` for the complete local
124
- release-quality gate.
198
+ package release-quality gate. These checks do not assemble, provision, deploy,
199
+ or accept a complete Gnolith Site; the Codex agent creating a Site owns those
200
+ responsibilities.
125
201
 
126
202
  ## License
127
203
 
package/SECURITY.md CHANGED
@@ -11,9 +11,16 @@ canonical history or RDF query results, and whether untrusted JSON or SPARQL
11
11
  input is required. Do not include production data or credentials.
12
12
 
13
13
  Taproot records attribution claims but does not authenticate identities or
14
- authorize writes. Hosts must keep mutation routes trusted. Canonical JSON,
15
- revision/audit immutability, size limits, optimistic revision guards, and
16
- read-only Diamond SPARQL are security boundaries; projection tables are not.
14
+ persist principals, memberships, or sessions. It does persist canonical entity
15
+ authorization policy and requires a host-created current context plus an
16
+ opaque DB-bound guard for normal writes. Canonical JSON, authorization policy,
17
+ revision/audit immutability, size limits, optimistic revision/authorization
18
+ guards, and read-only Diamond SPARQL are security boundaries; rebuildable
19
+ projection content is not authoritative.
17
20
 
18
21
  The threat model and host responsibilities are documented in
19
22
  `docs/threat-model.md`.
23
+
24
+ Package security checks do not qualify a deployed Site. The Codex agent creating
25
+ a Site owns its authentication, routing, provisioning, deployment, and
26
+ production acceptance.
package/SUPPORT.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # Support
2
2
 
3
3
  Use GitHub Issues for reproducible defects and scoped feature requests. Include
4
- the Taproot, Diamond, Node, Workerd/Wrangler, and schema versions; the smallest
4
+ the Taproot, Diamond, Node, D1 adapter, relevant Miniflare/Workerd, and schema
5
+ versions; the smallest
5
6
  canonical entity or command that reproduces the problem; and observed versus
6
7
  expected behavior.
7
8
 
9
+ Taproot support covers package behavior. Provisioning, remote migrations,
10
+ hosting, deployment, and complete-Site acceptance belong to the Codex agent
11
+ creating that Site.
12
+
8
13
  Only versions listed as supported in `SECURITY.md` receive security fixes.
9
14
  There is no guaranteed response time or commercial support commitment.
10
15
  Do not disclose vulnerabilities publicly; use GitHub private vulnerability
@@ -0,0 +1,55 @@
1
+ import type { SqliteDatabaseLike } from '@gnolith/diamond';
2
+ import type { EntityId, VisibilityScopeV1, AuthorizationContext } from './types.js';
3
+ export type AuthorizationReadinessCode = 'missing-current-policy' | 'current-revision-mismatch' | 'cross-installation-policy' | 'authorization-revision-invalid' | 'entity-policy-mismatch' | 'missing-revision-policy' | 'statement-policy-mismatch';
4
+ export interface AuthorizationReadinessIssue {
5
+ entityId: EntityId;
6
+ currentRevision: number;
7
+ codes: AuthorizationReadinessCode[];
8
+ }
9
+ export interface AuthorizationReadinessInspection {
10
+ installationId: string;
11
+ authorizationRevision: number;
12
+ searchGeneration: number;
13
+ counts: {
14
+ canonicalEntities: number;
15
+ canonicalRevisions: number;
16
+ currentPolicies: number;
17
+ revisionPolicies: number;
18
+ quarantinedEntities: number;
19
+ revisionPolicyMismatches: number;
20
+ entityPolicyMismatches: number;
21
+ statementPolicyMismatches: number;
22
+ currentHistoryParityMismatches: number;
23
+ };
24
+ ready: boolean;
25
+ issues: AuthorizationReadinessIssue[];
26
+ cursor: EntityId | null;
27
+ }
28
+ export interface AuthorizationBackfillRevisionInput {
29
+ revision: number;
30
+ contentHash: string;
31
+ workspaceId: string | null;
32
+ ownerPrincipalId: string;
33
+ visibility: VisibilityScopeV1;
34
+ statementRestrictions: Readonly<Record<string, readonly VisibilityScopeV1[]>>;
35
+ }
36
+ export interface AuthorizationBackfillEntityInput {
37
+ entityId: EntityId;
38
+ revisions: readonly AuthorizationBackfillRevisionInput[];
39
+ }
40
+ export interface AuthorizationBackfillPlan {
41
+ planId: string;
42
+ installationId: string;
43
+ baseAuthorizationRevision: number;
44
+ manifestHash: string;
45
+ entityCount: number;
46
+ revisionCount: number;
47
+ status: 'planned' | 'complete';
48
+ }
49
+ export declare function inspectAuthorizationReadiness(db: SqliteDatabaseLike, rawContext: AuthorizationContext, options?: {
50
+ limit?: number;
51
+ cursor?: EntityId;
52
+ }): Promise<AuthorizationReadinessInspection>;
53
+ export declare function planAuthorizationBackfill(db: SqliteDatabaseLike, rawContext: AuthorizationContext, inputs: readonly AuthorizationBackfillEntityInput[], now?: string): Promise<AuthorizationBackfillPlan>;
54
+ export declare function applyAuthorizationBackfill(db: SqliteDatabaseLike, rawContext: AuthorizationContext, planId: string, now?: string): Promise<AuthorizationBackfillPlan>;
55
+ //# sourceMappingURL=authorization-maintenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-maintenance.d.ts","sourceRoot":"","sources":["../src/authorization-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,kBAAkB,CAAC;AAc1B,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EAEjB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAOpB,MAAM,MAAM,0BAA0B,GAClC,wBAAwB,GACxB,2BAA2B,GAC3B,2BAA2B,GAC3B,gCAAgC,GAChC,wBAAwB,GACxB,yBAAyB,GACzB,2BAA2B,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