Clean up architecture specs: remove stale references, align docs with code, improve readability
- Replace stale DD references (DD3, DD6, DD9, DD10) with proper ADR links - Fix 'Open Question 1' → OQ-01/OQ-03 cross-references - Rewrite metagraph-module.md 'Why TypeBox Modules' to describe capabilities directly instead of framing as SchemaBuilder replacement - Remove 'Transition from SchemaBuilder' section, replace with Source Structure - Clean up implementation path: strikethrough phases → status table - Fix data model diagram: remove non-existent nodeTypeId, fix EdgeType label - Align EdgeConstraints examples with actual code (add default values) - Clarify validateNode/validateEdge error behavior in docs - Align EncryptedDataSchema code example with actual implementation - Fix overview.md: correct dependency table, update current state, fix TypeBox URL - Fix forward-look.md garbled text about dbtype element migration - Fix open-questions.md: correct OQ count (4→7 open), add summary table - Update doc statuses: schema-evolution, encrypted-data, open-questions → reviewed - Update AGENTS.md to reflect current implementation state
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
status: reviewed
|
||||
last_updated: 2026-05-29
|
||||
last_updated: 2026-05-30
|
||||
---
|
||||
|
||||
# @alkdev/storage — Overview
|
||||
@@ -29,23 +29,32 @@ ecosystem.
|
||||
@alkdev/storage/
|
||||
├── mod.ts → re-exports graphs/ (zero db deps)
|
||||
├── src/
|
||||
│ ├── graphs/ → Metagraph Module, bridge functions (no db deps)
|
||||
│ ├── graphs/ → Metagraph Module, bridge functions, crypto (no db deps)
|
||||
│ │ ├── modules/ → TypeBox Module definitions
|
||||
│ │ │ ├── metagraph.ts → Config, BaseNode, BaseEdge
|
||||
│ │ │ ├── call-graph.ts → CallGraph reference Module
|
||||
│ │ │ ├── secret-graph.ts → SecretGraph reference Module
|
||||
│ │ │ └── index.ts → barrel re-export
|
||||
│ │ ├── bridge.ts → moduleToDbSchema, validateNode, validateEdge
|
||||
│ │ ├── crypto.ts → encrypt, decrypt, generateEncryptionKey, EncryptedDataSchema
|
||||
│ │ └── mod.ts → re-exports all graphs exports
|
||||
│ ├── sqlite/ → SQLite host (drizzle-orm/libsql)
|
||||
│ │ ├── tables/ → drizzle table definitions
|
||||
│ │ ├── relations.ts → drizzle relational mappings
|
||||
│ │ ├── schema.ts → barrel re-export
|
||||
│ │ └── client.ts → injectable createSqliteDatabase()
|
||||
│ └── pg/ → PostgreSQL host (NOT YET IMPLEMENTED)
|
||||
└── test/ → empty — tests not yet written
|
||||
└── test/
|
||||
└── reference-modules.test.ts → Metagraph, bridge, crypto tests
|
||||
```
|
||||
|
||||
### Subpath Exports (JSR/npm)
|
||||
|
||||
| Export | Contents | Dependencies |
|
||||
| ------------------------ | --------------------------------------- | --------------------------------------- |
|
||||
| `@alkdev/storage` | Graph schema types, Metagraph Module | `@alkdev/typebox`, `@alkdev/drizzlebox` |
|
||||
| `@alkdev/storage` | Graph schema types, Metagraph Module | `@alkdev/typebox` |
|
||||
| `@alkdev/storage/graphs` | Same as `.` — alias for the main export | Same as `.` |
|
||||
| `@alkdev/storage/sqlite` | SQLite tables, relations, client | + `drizzle-orm`, `@libsql/client` |
|
||||
| `@alkdev/storage/sqlite` | SQLite tables, relations, client | `@alkdev/drizzlebox`, `drizzle-orm`, `@libsql/client` |
|
||||
| `@alkdev/storage/pg` | PostgreSQL tables, relations, client | ⚠️ NOT YET IMPLEMENTED |
|
||||
|
||||
The `./graphs` subpath exists because the source code lives in `src/graphs/` and
|
||||
@@ -105,22 +114,24 @@ consumed by the hub and spokes, not by storage itself.
|
||||
|
||||
### Implemented
|
||||
|
||||
- Graph schema types and Metagraph Module (replaces SchemaBuilder)
|
||||
- Metagraph Module (`Type.Module` with Config, BaseNode, BaseEdge entries)
|
||||
- Bridge functions (`moduleToDbSchema`, `validateNode`, `validateEdge`)
|
||||
- Reference graph type Modules (CallGraph, SecretGraph)
|
||||
- Crypto utility (AES-256-GCM + PBKDF2, `EncryptedDataSchema`)
|
||||
- SQLite host: 6 metagraph tables + actors table + Drizzle relations + client
|
||||
factory
|
||||
- TypeBox select/insert schemas generated from Drizzle tables (drizzlebox)
|
||||
- Reference module tests (bridge functions, validation, Module composition)
|
||||
|
||||
### Not Yet Implemented
|
||||
|
||||
| Gap | Priority | Notes |
|
||||
| ----------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------- |
|
||||
| Encrypted data node type + crypto utility | **Critical** | ⚠️ Not yet implemented. API keys and secrets at rest. See [encrypted-data.md](./encrypted-data.md). |
|
||||
| Repository/CRUD layer | High | ⚠️ Not yet implemented. Typed insert, find, update, delete functions for graphs, nodes, edges. No dependency on `@alkdev/operations` — consumer wires CRUD into registry. |
|
||||
| Tests | High | Zero tests exist. Needed before any real use. |
|
||||
| PostgreSQL host | Medium | Same table shapes, `pgTable` + `jsonb` + `timestamp` + `pgEnum`. Stub only. |
|
||||
| Call graph type | Medium | Informed by `@alkdev/flowgraph`'s `CallNodeAttrs`/`CallEdgeAttrs` schemas and `@alkdev/operations`' call protocol events. Not hub-specific — any consumer that tracks call invocations needs this. |
|
||||
| ACL graph type | Medium | Access control as a graph. Informed by `@alkdev/operations`' `Identity` and `AccessControl`. Depends on encrypted data and CRUD layer. |
|
||||
| ACL graph type | Medium | Access control as a graph. Informed by `@alkdev/operations`' `Identity` and `AccessControl`. Depends on CRUD layer. |
|
||||
| Task graph type | Low | Informed by `@alkdev/taskgraph`'s `TaskGraphNodeAttributes` and `DependencyEdge` schemas. |
|
||||
| Graphology bridge | Low | `moduleToGraphology()` and `fromGraphologyExport()` — Phase 4 of the metagraph implementation path. |
|
||||
|
||||
## Ecosystem Integration
|
||||
|
||||
@@ -232,5 +243,5 @@ questions affecting this package:
|
||||
- Source heritage: `@ade/ade-v0/packages/core/graphs` and
|
||||
`@ade/ade-v0/packages/storage_sqlite`
|
||||
- Drizzle ORM: https://orm.drizzle.team/
|
||||
- TypeBox: https://github.com/sinclairzx/typebox
|
||||
- TypeBox: `/workspace/@alkdev/typebox/`
|
||||
- JSR: https://jsr.io/
|
||||
|
||||
Reference in New Issue
Block a user