@weave-kit/engine 0.10.0 → 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.
Files changed (269) hide show
  1. package/CHANGELOG.md +240 -165
  2. package/README.md +40 -20
  3. package/dist/adapters/auth/index.d.ts +1 -1
  4. package/dist/adapters/auth/index.d.ts.map +1 -1
  5. package/dist/adapters/auth/index.js +1 -1
  6. package/dist/adapters/auth/index.js.map +1 -1
  7. package/dist/adapters/auth/source.d.ts +3 -0
  8. package/dist/adapters/auth/source.d.ts.map +1 -1
  9. package/dist/adapters/auth/source.js.map +1 -1
  10. package/dist/adapters/auth/subject.d.ts +6 -0
  11. package/dist/adapters/auth/subject.d.ts.map +1 -1
  12. package/dist/adapters/auth/subject.js +15 -0
  13. package/dist/adapters/auth/subject.js.map +1 -1
  14. package/dist/adapters/auth/verify.d.ts +2 -0
  15. package/dist/adapters/auth/verify.d.ts.map +1 -1
  16. package/dist/adapters/events/index.d.ts.map +1 -1
  17. package/dist/adapters/events/index.js +6 -1
  18. package/dist/adapters/events/index.js.map +1 -1
  19. package/dist/adapters/graphql/http.d.ts.map +1 -1
  20. package/dist/adapters/graphql/http.js +4 -2
  21. package/dist/adapters/graphql/http.js.map +1 -1
  22. package/dist/adapters/graphql/resolvers.d.ts.map +1 -1
  23. package/dist/adapters/graphql/resolvers.js +1 -0
  24. package/dist/adapters/graphql/resolvers.js.map +1 -1
  25. package/dist/adapters/graphql/security.d.ts.map +1 -1
  26. package/dist/adapters/graphql/security.js +14 -4
  27. package/dist/adapters/graphql/security.js.map +1 -1
  28. package/dist/adapters/graphql/types.d.ts +2 -0
  29. package/dist/adapters/graphql/types.d.ts.map +1 -1
  30. package/dist/adapters/mcp/generate.d.ts.map +1 -1
  31. package/dist/adapters/mcp/generate.js +3 -0
  32. package/dist/adapters/mcp/generate.js.map +1 -1
  33. package/dist/adapters/mcp/http.d.ts.map +1 -1
  34. package/dist/adapters/mcp/http.js +30 -7
  35. package/dist/adapters/mcp/http.js.map +1 -1
  36. package/dist/adapters/mcp/tools.d.ts.map +1 -1
  37. package/dist/adapters/mcp/tools.js +12 -1
  38. package/dist/adapters/mcp/tools.js.map +1 -1
  39. package/dist/adapters/mcp/types.d.ts +6 -0
  40. package/dist/adapters/mcp/types.d.ts.map +1 -1
  41. package/dist/adapters/mcp/types.js.map +1 -1
  42. package/dist/adapters/openapi/document.d.ts.map +1 -1
  43. package/dist/adapters/openapi/document.js +2 -1
  44. package/dist/adapters/openapi/document.js.map +1 -1
  45. package/dist/adapters/openapi/types.d.ts +1 -0
  46. package/dist/adapters/openapi/types.d.ts.map +1 -1
  47. package/dist/adapters/ops/index.d.ts.map +1 -1
  48. package/dist/adapters/ops/index.js +2 -1
  49. package/dist/adapters/ops/index.js.map +1 -1
  50. package/dist/adapters/rest/audit.d.ts.map +1 -1
  51. package/dist/adapters/rest/audit.js +14 -2
  52. package/dist/adapters/rest/audit.js.map +1 -1
  53. package/dist/adapters/rest/ingress.d.ts.map +1 -1
  54. package/dist/adapters/rest/ingress.js +4 -1
  55. package/dist/adapters/rest/ingress.js.map +1 -1
  56. package/dist/adapters/rest/plugin.d.ts.map +1 -1
  57. package/dist/adapters/rest/plugin.js +14 -5
  58. package/dist/adapters/rest/plugin.js.map +1 -1
  59. package/dist/adapters/rest/proxy.d.ts.map +1 -1
  60. package/dist/adapters/rest/proxy.js +4 -1
  61. package/dist/adapters/rest/proxy.js.map +1 -1
  62. package/dist/cli/commands/deploy.d.ts.map +1 -1
  63. package/dist/cli/commands/deploy.js +60 -1
  64. package/dist/cli/commands/deploy.js.map +1 -1
  65. package/dist/cli/commands/doctor.d.ts +6 -0
  66. package/dist/cli/commands/doctor.d.ts.map +1 -0
  67. package/dist/cli/commands/doctor.js +159 -0
  68. package/dist/cli/commands/doctor.js.map +1 -0
  69. package/dist/cli/commands/migrate.d.ts.map +1 -1
  70. package/dist/cli/commands/migrate.js +13 -0
  71. package/dist/cli/commands/migrate.js.map +1 -1
  72. package/dist/cli/index.js +9 -1
  73. package/dist/cli/index.js.map +1 -1
  74. package/dist/cli/types/commands.d.ts +18 -0
  75. package/dist/cli/types/commands.d.ts.map +1 -1
  76. package/dist/cli/types/index.d.ts +3 -3
  77. package/dist/cli/types/index.d.ts.map +1 -1
  78. package/dist/cli/types/index.js +1 -1
  79. package/dist/cli/types/index.js.map +1 -1
  80. package/dist/cli/types/values.d.ts +9 -0
  81. package/dist/cli/types/values.d.ts.map +1 -1
  82. package/dist/cli/types/values.js +8 -0
  83. package/dist/cli/types/values.js.map +1 -1
  84. package/dist/core/audit/types.d.ts +23 -3
  85. package/dist/core/audit/types.d.ts.map +1 -1
  86. package/dist/core/audit/types.js.map +1 -1
  87. package/dist/core/i18n/ar.d.ts.map +1 -1
  88. package/dist/core/i18n/ar.js +3 -0
  89. package/dist/core/i18n/ar.js.map +1 -1
  90. package/dist/core/i18n/de.d.ts.map +1 -1
  91. package/dist/core/i18n/de.js +3 -0
  92. package/dist/core/i18n/de.js.map +1 -1
  93. package/dist/core/i18n/en.d.ts +3 -0
  94. package/dist/core/i18n/en.d.ts.map +1 -1
  95. package/dist/core/i18n/en.js +3 -0
  96. package/dist/core/i18n/en.js.map +1 -1
  97. package/dist/core/i18n/es.d.ts.map +1 -1
  98. package/dist/core/i18n/es.js +3 -0
  99. package/dist/core/i18n/es.js.map +1 -1
  100. package/dist/core/i18n/fr.d.ts.map +1 -1
  101. package/dist/core/i18n/fr.js +3 -0
  102. package/dist/core/i18n/fr.js.map +1 -1
  103. package/dist/core/i18n/hi.d.ts.map +1 -1
  104. package/dist/core/i18n/hi.js +3 -0
  105. package/dist/core/i18n/hi.js.map +1 -1
  106. package/dist/core/i18n/id.d.ts.map +1 -1
  107. package/dist/core/i18n/id.js +3 -0
  108. package/dist/core/i18n/id.js.map +1 -1
  109. package/dist/core/i18n/ja.d.ts.map +1 -1
  110. package/dist/core/i18n/ja.js +3 -0
  111. package/dist/core/i18n/ja.js.map +1 -1
  112. package/dist/core/i18n/ko.d.ts.map +1 -1
  113. package/dist/core/i18n/ko.js +3 -0
  114. package/dist/core/i18n/ko.js.map +1 -1
  115. package/dist/core/i18n/pt.d.ts.map +1 -1
  116. package/dist/core/i18n/pt.js +3 -0
  117. package/dist/core/i18n/pt.js.map +1 -1
  118. package/dist/core/i18n/ru.d.ts.map +1 -1
  119. package/dist/core/i18n/ru.js +3 -0
  120. package/dist/core/i18n/ru.js.map +1 -1
  121. package/dist/core/i18n/vi.d.ts.map +1 -1
  122. package/dist/core/i18n/vi.js +3 -0
  123. package/dist/core/i18n/vi.js.map +1 -1
  124. package/dist/core/i18n/zh-hant.d.ts.map +1 -1
  125. package/dist/core/i18n/zh-hant.js +3 -0
  126. package/dist/core/i18n/zh-hant.js.map +1 -1
  127. package/dist/core/i18n/zh.d.ts.map +1 -1
  128. package/dist/core/i18n/zh.js +3 -0
  129. package/dist/core/i18n/zh.js.map +1 -1
  130. package/dist/core/index.d.ts +2 -0
  131. package/dist/core/index.d.ts.map +1 -1
  132. package/dist/core/index.js +2 -0
  133. package/dist/core/index.js.map +1 -1
  134. package/dist/core/limiter/index.d.ts +1 -1
  135. package/dist/core/limiter/index.d.ts.map +1 -1
  136. package/dist/core/limiter/index.js +1 -1
  137. package/dist/core/limiter/index.js.map +1 -1
  138. package/dist/core/limiter/quota.d.ts +5 -0
  139. package/dist/core/limiter/quota.d.ts.map +1 -1
  140. package/dist/core/limiter/quota.js +7 -0
  141. package/dist/core/limiter/quota.js.map +1 -1
  142. package/dist/core/object/system-objects.d.ts.map +1 -1
  143. package/dist/core/object/system-objects.js +2 -0
  144. package/dist/core/object/system-objects.js.map +1 -1
  145. package/dist/core/object/validate/field.d.ts.map +1 -1
  146. package/dist/core/object/validate/field.js +4 -2
  147. package/dist/core/object/validate/field.js.map +1 -1
  148. package/dist/core/observability/index.d.ts +64 -0
  149. package/dist/core/observability/index.d.ts.map +1 -0
  150. package/dist/core/observability/index.js +41 -0
  151. package/dist/core/observability/index.js.map +1 -0
  152. package/dist/core/provider/identity/directory.d.ts +3 -0
  153. package/dist/core/provider/identity/directory.d.ts.map +1 -1
  154. package/dist/core/provider/identity/types.d.ts +2 -0
  155. package/dist/core/provider/identity/types.d.ts.map +1 -1
  156. package/dist/core/proxy/types.d.ts +3 -0
  157. package/dist/core/proxy/types.d.ts.map +1 -1
  158. package/dist/core/proxy/types.js.map +1 -1
  159. package/dist/core/rbac/rls.d.ts +3 -1
  160. package/dist/core/rbac/rls.d.ts.map +1 -1
  161. package/dist/core/rbac/rls.js +12 -1
  162. package/dist/core/rbac/rls.js.map +1 -1
  163. package/dist/core/rbac/rowScope.d.ts.map +1 -1
  164. package/dist/core/rbac/rowScope.js +15 -0
  165. package/dist/core/rbac/rowScope.js.map +1 -1
  166. package/dist/core/script/types.d.ts +2 -0
  167. package/dist/core/script/types.d.ts.map +1 -1
  168. package/dist/core/script/types.js.map +1 -1
  169. package/dist/core/storage/impact.d.ts +49 -0
  170. package/dist/core/storage/impact.d.ts.map +1 -0
  171. package/dist/core/storage/impact.js +130 -0
  172. package/dist/core/storage/impact.js.map +1 -0
  173. package/dist/core/storage/index.d.ts +2 -0
  174. package/dist/core/storage/index.d.ts.map +1 -1
  175. package/dist/core/storage/index.js +1 -0
  176. package/dist/core/storage/index.js.map +1 -1
  177. package/dist/core/storage/system-tables.d.ts +1 -0
  178. package/dist/core/storage/system-tables.d.ts.map +1 -1
  179. package/dist/core/storage/system-tables.js +38 -0
  180. package/dist/core/storage/system-tables.js.map +1 -1
  181. package/dist/core/tools/index.d.ts +2 -0
  182. package/dist/core/tools/index.d.ts.map +1 -1
  183. package/dist/core/tools/index.js +2 -0
  184. package/dist/core/tools/index.js.map +1 -1
  185. package/dist/core/tools/pipeline.d.ts +25 -0
  186. package/dist/core/tools/pipeline.d.ts.map +1 -1
  187. package/dist/core/tools/types.d.ts +8 -0
  188. package/dist/core/tools/types.d.ts.map +1 -1
  189. package/dist/core/trace.d.ts +29 -0
  190. package/dist/core/trace.d.ts.map +1 -0
  191. package/dist/core/trace.js +41 -0
  192. package/dist/core/trace.js.map +1 -0
  193. package/dist/core/types/fields.d.ts +2 -0
  194. package/dist/core/types/fields.d.ts.map +1 -1
  195. package/dist/core/types/principal.d.ts +11 -3
  196. package/dist/core/types/principal.d.ts.map +1 -1
  197. package/dist/core/types/principal.js +19 -5
  198. package/dist/core/types/principal.js.map +1 -1
  199. package/dist/core/types/values.d.ts +3 -1
  200. package/dist/core/types/values.d.ts.map +1 -1
  201. package/dist/core/types/values.js +3 -1
  202. package/dist/core/types/values.js.map +1 -1
  203. package/dist/core/types/workflow.d.ts +7 -1
  204. package/dist/core/types/workflow.d.ts.map +1 -1
  205. package/dist/core/types/workflow.js.map +1 -1
  206. package/dist/index.d.ts +2 -1
  207. package/dist/index.d.ts.map +1 -1
  208. package/dist/index.js +2 -1
  209. package/dist/index.js.map +1 -1
  210. package/dist/runtime/data-access/cursor.d.ts +2 -0
  211. package/dist/runtime/data-access/cursor.d.ts.map +1 -1
  212. package/dist/runtime/data-access/cursor.js +1 -1
  213. package/dist/runtime/data-access/cursor.js.map +1 -1
  214. package/dist/runtime/data-access/index.d.ts +2 -2
  215. package/dist/runtime/data-access/index.d.ts.map +1 -1
  216. package/dist/runtime/data-access/index.js +2 -2
  217. package/dist/runtime/data-access/index.js.map +1 -1
  218. package/dist/runtime/data-access/query-budget.d.ts.map +1 -1
  219. package/dist/runtime/data-access/query-budget.js +6 -3
  220. package/dist/runtime/data-access/query-budget.js.map +1 -1
  221. package/dist/runtime/data-access/query.d.ts +22 -0
  222. package/dist/runtime/data-access/query.d.ts.map +1 -1
  223. package/dist/runtime/data-access/query.js +121 -3
  224. package/dist/runtime/data-access/query.js.map +1 -1
  225. package/dist/runtime/data-access/rbac.d.ts +2 -0
  226. package/dist/runtime/data-access/rbac.d.ts.map +1 -1
  227. package/dist/runtime/data-access/rbac.js +29 -20
  228. package/dist/runtime/data-access/rbac.js.map +1 -1
  229. package/dist/runtime/data-access/sql-executor.d.ts +2 -0
  230. package/dist/runtime/data-access/sql-executor.d.ts.map +1 -1
  231. package/dist/runtime/data-access/sql-executor.js +3 -0
  232. package/dist/runtime/data-access/sql-executor.js.map +1 -1
  233. package/dist/runtime/data-access/types.d.ts +8 -0
  234. package/dist/runtime/data-access/types.d.ts.map +1 -1
  235. package/dist/runtime/data-access/types.js +5 -1
  236. package/dist/runtime/data-access/types.js.map +1 -1
  237. package/dist/runtime/engine.d.ts +43 -3
  238. package/dist/runtime/engine.d.ts.map +1 -1
  239. package/dist/runtime/engine.js +56 -17
  240. package/dist/runtime/engine.js.map +1 -1
  241. package/dist/runtime/tools/executor.d.ts +9 -1
  242. package/dist/runtime/tools/executor.d.ts.map +1 -1
  243. package/dist/runtime/tools/executor.js +84 -32
  244. package/dist/runtime/tools/executor.js.map +1 -1
  245. package/dist/subsystems/audit/index.d.ts +12 -1
  246. package/dist/subsystems/audit/index.d.ts.map +1 -1
  247. package/dist/subsystems/audit/index.js +16 -0
  248. package/dist/subsystems/audit/index.js.map +1 -1
  249. package/dist/subsystems/audit/store.d.ts.map +1 -1
  250. package/dist/subsystems/audit/store.js +32 -11
  251. package/dist/subsystems/audit/store.js.map +1 -1
  252. package/dist/subsystems/evidence/index.d.ts +2 -1
  253. package/dist/subsystems/evidence/index.d.ts.map +1 -1
  254. package/dist/subsystems/evidence/index.js +1 -1
  255. package/dist/subsystems/evidence/index.js.map +1 -1
  256. package/dist/subsystems/evidence/store.d.ts +7 -1
  257. package/dist/subsystems/evidence/store.d.ts.map +1 -1
  258. package/dist/subsystems/evidence/store.js +71 -3
  259. package/dist/subsystems/evidence/store.js.map +1 -1
  260. package/dist/subsystems/script/backend/types.d.ts +1 -0
  261. package/dist/subsystems/script/backend/types.d.ts.map +1 -1
  262. package/dist/subsystems/script/bridge.d.ts.map +1 -1
  263. package/dist/subsystems/script/bridge.js +7 -2
  264. package/dist/subsystems/script/bridge.js.map +1 -1
  265. package/dist/version.d.ts +8 -1
  266. package/dist/version.d.ts.map +1 -1
  267. package/dist/version.js +8 -1
  268. package/dist/version.js.map +1 -1
  269. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,165 +1,240 @@
1
- # Changelog
2
-
3
- All notable changes to `@weave-kit/engine`. Format follows [Keep a Changelog](https://keepachangelog.com/);
4
- the project uses [Semantic Versioning](https://semver.org/).
5
-
6
- ## [0.10.0]
7
-
8
- ### Added
9
-
10
- - **QueryBudget.** `EngineConfig.queryBudget` bounds a read/query across the engine:
11
- rows / filters / sorts in data-access (all list paths), joins / SQL length / statement timeout in
12
- restricted SQL (`this.db.query`), and GraphQL depth. Exported `QueryBudget` / `QUERY_BUDGET_DEFAULTS`
13
- / `resolveQueryBudget` / `assertQueryBudget` (`runtime/data-access/query-budget.ts`); a per-context
14
- `DataAccessContext.budget` overrides the instance default. Additive — default limits only.
15
-
16
- ## [0.9.0]
17
-
18
- A **breaking** consistency/authorization release. Read the **Breaking** section before upgrading.
19
-
20
- ### Breaking
21
-
22
- - **`DataAccessContext.principal` is now required; the implicit `subject` field is removed.** The old
23
- convention — omit `subject` and get unrestricted access — is gone, so a forgotten actor is now a
24
- **compile error** instead of a silent RBAC bypass. Migrate:
25
- - a user call → `principal: userPrincipal(subject)` (or a literal `{ kind: 'user', subject }`);
26
- - an internal/seed/system call → `principal: systemPrincipal(SYSTEM_CAPABILITIES.INTERNAL_ADMIN)`
27
- (or `{ kind: 'system', capability: 'internal.admin' }`).
28
- `AccessPrincipal`, `userPrincipal`, `systemPrincipal` and `SYSTEM_CAPABILITIES` are exported from
29
- the package root. `withRbac` passes through only for an explicit **system** principal.
30
-
31
- ### Added
32
-
33
- - **Global schema revisions + atomic deploys.** New `weavekit_schema_revision` (append-only, anchored
34
- on a deterministic aggregate `computeSchemaHash(files)`). `weave migrate` / `weave deploy apply` now
35
- commit the DDL, the metadata cache and the schema revision in **one transaction** (serialized by an
36
- advisory lock) — a failure rolls the whole deploy back. New CLI: `weave deploy plan` (read-only
37
- preview + risk) and `weave deploy apply`.
38
- - **Audit durability modes.** `subsystems.audit.mode`: `best-effort` (default, unchanged),
39
- `transactional` (audit row written in the business transaction) and `durable` (transactional outbox
40
- `weavekit_audit_outbox` + a crash-safe, at-least-once relay). New `AuditSink.recordInTx(event,
41
- client)` seam; audit events gain `requestId` / `traceId` (new indexed columns).
42
- - **Cursor pagination.** `FindOptions.cursor` + `FindResult.nextCursor` / `hasMore` (opaque keyset on
43
- the single primary key). MCP `search_records` accepts `cursor` and returns `hasMore`/`nextCursor`;
44
- offset remains supported.
45
- - **Access principal types** (`core/types/principal.ts`): `AccessPrincipal`, `SYSTEM_CAPABILITIES`,
46
- `userPrincipal`, `systemPrincipal`, `principalSubject`, `principalActorId`.
47
-
48
- ### Changed
49
-
50
- - **MCP compiled-surface cache** key now includes a schema signature (registry-derived) and the
51
- custom-tool set, and the cache is bounded — a schema/tool change no longer serves stale tools.
52
- - **Workflow privileged operations** (`releaseWorkflowLock` / `workflowTodos` / `overrideWorkflow`)
53
- are now guarded in the RBAC decorator (fail-closed read/update checks) instead of passing through.
54
-
55
- ### Fixed
56
-
57
- - **Implicit-unrestricted holes** in the custom-tool base context and the transition guardrail
58
- context: both now carry a user principal, so a tool/policy cannot read unrestricted by omission.
59
-
60
- ## [0.8.0]
61
-
62
- ### Added
63
-
64
- - **GraphQL adapter (opt-in).** `adapters.graphql` compiles the same `schema.json` into a read/write
65
- GraphQL endpoint (`/graphql`, POST + GET) that reuses the engine's RBAC / RLS / audit unchanged:
66
- queries (`<object>` pages + `<object>_by_id`, with nested relations batched per request),
67
- mutations (`create`/`update`/`delete` plus workflow `transition`), query hardening
68
- (depth / complexity / alias limits), an operation allow list, and an introspection toggle.
69
- Its only runtime dependency is `graphql@16` — the engine speaks GraphQL-over-HTTP itself
70
- (`graphql-http` is not required). New CLI: `weave graphql:schema` emits the SDL offline. **Off by
71
- default** (`adapters.graphql.enabled`).
72
- - **Named enums (schema v6).** Declare an enum once in `enums/<name>.json` and reference it from any
73
- field with `{ "type": "enum", "enumType": "<name>" }`. Values validate centrally, generate named
74
- TypeScript unions (`weave types`), surface as shared OpenAPI `components.schemas` (with
75
- `x-enumLabels`), and are listed with `weave enum:list` / `weave enum:check`; `weave field:add
76
- --enum` wires a new field to an existing enum. The on-disk format is bumped to **v6**
77
- (`SCHEMA_FORMAT_VERSION`); existing v5 files migrate on read (additive — run `weave schema:upgrade`
78
- to stamp them).
79
-
80
- ### Changed
81
-
82
- - **Uncategorized `SchemaError`s now map to HTTP 400** instead of falling through to 500. The error
83
- space is dominated by request conditions (bad params/fields, RBAC, not-found); genuine server
84
- faults keep 500 via an explicit set (`http.internal`, `data.schemaDrift`, and script runtime
85
- failures `script.timeout` / `script.busy` / `script.compile` / `script.sandbox.unavailable`).
86
-
87
- ### Fixed
88
-
89
- - **MCP session ↔ agent binding.** A follow-up request on an existing session now re-verifies that
90
- the presented Bearer key is the one that established the session (compared by a non-secret SHA-256
91
- fingerprint); a different key reusing a session id is rejected with `mcp.session.agentMismatch`.
92
- The raw API key is no longer stored on the session or written to the audit log — audit `actorId`
93
- is the credential fingerprint and the agent principal id stays in `meta`.
94
-
95
- ## [0.7.0]
96
-
97
- ### Added
98
-
99
- - **Node 22 support.** The engine, CLI and scaffolded projects now run on Node **22+** (verified on
100
- Node 22 and Node 24). `engines.node` is `>=22`; generated projects declare the same.
101
-
102
- ### Changed
103
-
104
- - `isolated-vm` — the optional native dependency behind the script sandbox — is pinned to
105
- **`^6.2.0`**, which ships prebuilt binaries for both Node 22 and Node 24 (7.x drops Node 22).
106
- Behavior is unchanged (the sandbox, RPC bridge and timeout/`__done` handling are covered by the
107
- same tests on both runtimes). Note: prebuilds are no longer published for Node 26 — on that
108
- runtime the script sandbox may fall back to a source build.
109
-
110
- ## [0.6.0]
111
-
112
- A breaking release. The data model, access control and workflow were reworked end to end. Read the
113
- **Breaking** section before upgrading.
114
-
115
- ### Breaking
116
-
117
- - **Record ids are the `record_key`.** A record's external id is now a single URL-safe string that
118
- encodes the (possibly composite) primary key, surfaced as the read-only `weave_id` field. REST
119
- `/{id}`, MCP `id` and batch `ids[]` all take this string — read it from a result or `describe_object`
120
- instead of composing the raw primary key.
121
- - **Field types are bucketed** into PG-native value types and engine-shipped custom types. `person`
122
- was renamed to `user`; `SCALAR` was removed; `currency` accepts an optional ISO 4217 code (and an
123
- optional `precision`); `json` now maps to PostgreSQL `json` — use `jsonb` for the old behavior. Run
124
- `weave schema:upgrade`.
125
- - **Row scopes add `department`** (`own | department | all`) plus a separate `manage` scope for writes,
126
- and a scope column's ids can be `internal` (engine ids) or `external` (customer ids).
127
- - **Identity directory** — the engine now owns `weavekit_user` / `weavekit_department`; sync an external
128
- source with `weave sync:identity`, authenticate through a verifier, and manage users over the admin
129
- REST surface.
130
- - **`multiRelation` uses a link table** (real FK per side, `ON DELETE CASCADE`) instead of a column;
131
- reads and filters are scoped to the targets the subject can read.
132
- - **Workflow rewritten to a single-line node chain** (`workflow.json` format v2). v1 state-machine
133
- files are linearized on read. Instance/step/workitem state lives in engine tables
134
- (`weavekit_workflow_instances` / `_steps` / `_workitems`, plus locks/definitions/timers). New
135
- REST + MCP surface; `weave workflow:migrate` was **removed**; the side-table column
136
- `workflow_id` was renamed to `workflow_instance_id`; `weave migrate` drops and recreates the timer
137
- table.
138
- - **Engine-owned system tables + runtime zero-DDL.** All DDL is emitted by `weave migrate`; the runtime
139
- never alters or drops customer columns (reads only).
140
- - **Security hardening** — formula references respect RBAC, `details` children inherit (and can only
141
- narrow) their parent's permissions, DDL literals are escaped, and script SQL is gated by an AST pass.
142
-
143
- ### Added
144
-
145
- - Record-metadata side tables with `weave_*` virtual fields (`weave_id`, `weave_status`,
146
- `weave_owner_id`, `weave_created_by`/`_modified_by`, `weave_created_time`/`_modified_time`,
147
- `weave_workflow_instance_id`) — request them in `fields`, and they work in `filter` / `sort`.
148
- - Field types: native PG enums for static `enum`s, data-driven `enum` options, `seq_no`, `uuid`,
149
- `smallint`/`bigint`/`real`/`double`/`char`, numeric `precision`/`scale`, `json`/`jsonb`.
150
- - Reverse-modeling: `weave introspect` handles composite primary keys and native enum/array columns;
151
- `weave schema:map` reports schema↔column drift.
152
- - Workflow actions `submit` / `approve` / `reject` / `forward` / `withdraw` / `cancel` / `reactivate`,
153
- any-one / all approvals, node timeouts, an admin override, and definition write-back.
154
- - `describe_object` exposes a field's resolved type `base`.
155
-
156
- ### Changed
157
-
158
- - `weave migrate` registers content-addressed workflow definitions; instances pin the hash they started
159
- under, so editing `workflow.json` only affects new records.
160
- - Live `record.transitioned` events carry `from` / `to` / `action`.
161
-
162
- ### Fixed
163
-
164
- - Correct row-scope parameter offset on `update` / `delete` / `transition`.
165
- - `record_key` encoding is single-sourced in SQL (contract-tested).
1
+ # Changelog
2
+
3
+ All notable changes to `@weave-kit/engine`. Format follows [Keep a Changelog](https://keepachangelog.com/);
4
+ the project uses [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [1.0.0]
7
+
8
+ The **G1 contract-freeze** release: the public surface (schema/workflow formats, REST routes, MCP tool
9
+ names, event types, error codes, data-access/RBAC contracts, package exports) is now frozen under
10
+ `CONTRACT_VERSION` (`1`) and evolves **additively** from here. It also lands multi-tenancy, the
11
+ observability seam and operational tooling.
12
+
13
+ ### Added
14
+
15
+ - **Multi-tenancy (row).** `EngineConfig.tenants = { enabled?, defaultTenant? }`; an object field
16
+ marked `"tenant": true` scopes every read/write to the subject's tenant — RBAC row scope (even for
17
+ `read: "all"`) + native RLS (`weavekit.tenant_id` GUC) + audit (`tenant_id`). The tenant is forced
18
+ on create and immutable on update (`object.tenant.immutable`); `withDefaultTenant` stamps a subject
19
+ that lacks one. Absent tenant = single-tenant (unchanged). Exported `principalTenantId`, `tenantOf`,
20
+ `scopedQuotaKey`, `ROW_SCOPE_MARKERS.TENANT`.
21
+ - **Contract freeze (G1).** `CONTRACT_VERSION` (exported from the package root; mirrored in
22
+ `GET /version` and the OpenAPI `info.x-contract-version`) plus a freeze gate test and the
23
+ contract-freeze / deprecation policy.
24
+ - **Observability seam.** `MetricsSink` / `TraceSink` + single-source `METRIC_NAMES`
25
+ (`core/observability`), injected via `EngineConfig.observability`; the engine emits request
26
+ latency/status, `rbac.deny` and `query.budget.reject`, and records spans. `core/trace.ts`
27
+ (`parseTraceparent`) parses the inbound W3C `traceparent`; the `traceId` threads through
28
+ audit / evidence / events. No-op default; no telemetry backend bundled.
29
+ - **`weave doctor` preflight** — read-only (connection, PostgreSQL compatibility, schema↔DB drift,
30
+ engine system tables, RLS role + sandbox), `--json` supported; `weave migrate --preflight` runs it
31
+ first and aborts on any failure.
32
+ - **`weave deploy plan` schema-impact analysis** (`analyzeImpact` / `SchemaImpact`): creates, column
33
+ adds, constraints, indexes, enum + RLS changes, a data-compat risk and an API-breaking flag, plus
34
+ the live schema revision and a **config-drift** flag.
35
+ - **Audit + evidence keyset cursor.** `AuditQuery.cursor` / `AuditQueryResult.nextCursor` and
36
+ `EvidenceQuery` / `EvidenceQueryResult` + `queryEvidence` (stable `(ts DESC, id DESC)` paging;
37
+ offset still supported).
38
+ - **Enterprise seams** documented and annotated (`@enterprise-reserved`): `AuditSink`,
39
+ `ApprovalsBackend`, `WorkflowTimerStore` / `WorkflowBackend`, `IdentityStore`,
40
+ `AuthSource` / `AuthVerifier`, `GuardrailPolicy`, `ProxyTargetResolver`, `MetricsSink` / `TraceSink`.
41
+
42
+ ### Changed
43
+
44
+ - **GraphQL query cost is weighted by the list `limit`** (was a raw field count), matching the
45
+ documented behavior.
46
+ - Query-budget filter counting is robust against malformed `$or` groups.
47
+
48
+ ### Fixed
49
+
50
+ - **System-principal audit `actorId` is `'system'`** again (matches the documented contract; the
51
+ specific capability is kept on the event's `meta.capability`).
52
+ - **Tenant write isolation**: `create` forces the tenant column to the subject's tenant, and `update`
53
+ rejects moving a row to another tenant (`object.tenant.immutable`).
54
+ - MCP argument-validation denials are audited under `tool.args.invalid` (not `mcp.tool.notFound`).
55
+
56
+ ### Removed
57
+
58
+ - `EngineAuditConfig.retention` — the no-op placeholder is gone (retention / export / compliance are
59
+ the enterprise E2 layer).
60
+
61
+ ## [0.11.0]
62
+
63
+ ### Added
64
+
65
+ - **Agent Execution pipeline + Evidence.** A protocol-agnostic orchestrator (`runPipeline`,
66
+ `EXECUTION_STAGES` / `ExecutionPlan` / `Evidence` / `EvidenceSink`) runs one execution through
67
+ Plan → Validate → Authorize → Guardrail → Approval → Execute → Commit → Evidence. The custom-tool
68
+ executor and the data-access write path (`create`/`update`/`delete`, action
69
+ `object.<object>.<op>`) now share the same guardrail/approval gate, so REST / MCP generic CRUD /
70
+ GraphQL / script writes are all covered (previously only custom tools and workflow transitions
71
+ were). Tool arguments are validated against the declared `ToolJsonSchema` (`tool.args.invalid`).
72
+ Enable `evidence.enabled` to record one `weavekit_evidence` row per gated execution
73
+ (request/trace/schema-revision correlated). Additive — with no guardrail policies configured and
74
+ evidence disabled, behavior and queries are unchanged.
75
+
76
+ ### Fixed
77
+
78
+ - Guardrail/approval is no longer bypassed by MCP generic CRUD and REST writes (new action
79
+ `object.<object>.<op>`).
80
+
81
+ ## [0.10.0]
82
+
83
+ ### Added
84
+
85
+ - **QueryBudget.** `EngineConfig.queryBudget` bounds a read/query across the engine:
86
+ rows / filters / sorts in data-access (all list paths), joins / SQL length / statement timeout in
87
+ restricted SQL (`this.db.query`), and GraphQL depth. Exported `QueryBudget` / `QUERY_BUDGET_DEFAULTS`
88
+ / `resolveQueryBudget` / `assertQueryBudget` (`runtime/data-access/query-budget.ts`); a per-context
89
+ `DataAccessContext.budget` overrides the instance default. Additive — default limits only.
90
+
91
+ ## [0.9.0]
92
+
93
+ A **breaking** consistency/authorization release. Read the **Breaking** section before upgrading.
94
+
95
+ ### Breaking
96
+
97
+ - **`DataAccessContext.principal` is now required; the implicit `subject` field is removed.** The old
98
+ convention — omit `subject` and get unrestricted access — is gone, so a forgotten actor is now a
99
+ **compile error** instead of a silent RBAC bypass. Migrate:
100
+ - a user call → `principal: userPrincipal(subject)` (or a literal `{ kind: 'user', subject }`);
101
+ - an internal/seed/system call → `principal: systemPrincipal(SYSTEM_CAPABILITIES.INTERNAL_ADMIN)`
102
+ (or `{ kind: 'system', capability: 'internal.admin' }`).
103
+ `AccessPrincipal`, `userPrincipal`, `systemPrincipal` and `SYSTEM_CAPABILITIES` are exported from
104
+ the package root. `withRbac` passes through only for an explicit **system** principal.
105
+
106
+ ### Added
107
+
108
+ - **Global schema revisions + atomic deploys.** New `weavekit_schema_revision` (append-only, anchored
109
+ on a deterministic aggregate `computeSchemaHash(files)`). `weave migrate` / `weave deploy apply` now
110
+ commit the DDL, the metadata cache and the schema revision in **one transaction** (serialized by an
111
+ advisory lock) — a failure rolls the whole deploy back. New CLI: `weave deploy plan` (read-only
112
+ preview + risk) and `weave deploy apply`.
113
+ - **Audit durability modes.** `subsystems.audit.mode`: `best-effort` (default, unchanged),
114
+ `transactional` (audit row written in the business transaction) and `durable` (transactional outbox
115
+ `weavekit_audit_outbox` + a crash-safe, at-least-once relay). New `AuditSink.recordInTx(event,
116
+ client)` seam; audit events gain `requestId` / `traceId` (new indexed columns).
117
+ - **Cursor pagination.** `FindOptions.cursor` + `FindResult.nextCursor` / `hasMore` (opaque keyset on
118
+ the single primary key). MCP `search_records` accepts `cursor` and returns `hasMore`/`nextCursor`;
119
+ offset remains supported.
120
+ - **Access principal types** (`core/types/principal.ts`): `AccessPrincipal`, `SYSTEM_CAPABILITIES`,
121
+ `userPrincipal`, `systemPrincipal`, `principalSubject`, `principalActorId`.
122
+
123
+ ### Changed
124
+
125
+ - **MCP compiled-surface cache** key now includes a schema signature (registry-derived) and the
126
+ custom-tool set, and the cache is bounded — a schema/tool change no longer serves stale tools.
127
+ - **Workflow privileged operations** (`releaseWorkflowLock` / `workflowTodos` / `overrideWorkflow`)
128
+ are now guarded in the RBAC decorator (fail-closed read/update checks) instead of passing through.
129
+
130
+ ### Fixed
131
+
132
+ - **Implicit-unrestricted holes** in the custom-tool base context and the transition guardrail
133
+ context: both now carry a user principal, so a tool/policy cannot read unrestricted by omission.
134
+
135
+ ## [0.8.0]
136
+
137
+ ### Added
138
+
139
+ - **GraphQL adapter (opt-in).** `adapters.graphql` compiles the same `schema.json` into a read/write
140
+ GraphQL endpoint (`/graphql`, POST + GET) that reuses the engine's RBAC / RLS / audit unchanged:
141
+ queries (`<object>` pages + `<object>_by_id`, with nested relations batched per request),
142
+ mutations (`create`/`update`/`delete` plus workflow `transition`), query hardening
143
+ (depth / complexity / alias limits), an operation allow list, and an introspection toggle.
144
+ Its only runtime dependency is `graphql@16` — the engine speaks GraphQL-over-HTTP itself
145
+ (`graphql-http` is not required). New CLI: `weave graphql:schema` emits the SDL offline. **Off by
146
+ default** (`adapters.graphql.enabled`).
147
+ - **Named enums (schema v6).** Declare an enum once in `enums/<name>.json` and reference it from any
148
+ field with `{ "type": "enum", "enumType": "<name>" }`. Values validate centrally, generate named
149
+ TypeScript unions (`weave types`), surface as shared OpenAPI `components.schemas` (with
150
+ `x-enumLabels`), and are listed with `weave enum:list` / `weave enum:check`; `weave field:add
151
+ --enum` wires a new field to an existing enum. The on-disk format is bumped to **v6**
152
+ (`SCHEMA_FORMAT_VERSION`); existing v5 files migrate on read (additive — run `weave schema:upgrade`
153
+ to stamp them).
154
+
155
+ ### Changed
156
+
157
+ - **Uncategorized `SchemaError`s now map to HTTP 400** instead of falling through to 500. The error
158
+ space is dominated by request conditions (bad params/fields, RBAC, not-found); genuine server
159
+ faults keep 500 via an explicit set (`http.internal`, `data.schemaDrift`, and script runtime
160
+ failures `script.timeout` / `script.busy` / `script.compile` / `script.sandbox.unavailable`).
161
+
162
+ ### Fixed
163
+
164
+ - **MCP session ↔ agent binding.** A follow-up request on an existing session now re-verifies that
165
+ the presented Bearer key is the one that established the session (compared by a non-secret SHA-256
166
+ fingerprint); a different key reusing a session id is rejected with `mcp.session.agentMismatch`.
167
+ The raw API key is no longer stored on the session or written to the audit log — audit `actorId`
168
+ is the credential fingerprint and the agent principal id stays in `meta`.
169
+
170
+ ## [0.7.0]
171
+
172
+ ### Added
173
+
174
+ - **Node 22 support.** The engine, CLI and scaffolded projects now run on Node **22+** (verified on
175
+ Node 22 and Node 24). `engines.node` is `>=22`; generated projects declare the same.
176
+
177
+ ### Changed
178
+
179
+ - `isolated-vm` — the optional native dependency behind the script sandbox — is pinned to
180
+ **`^6.2.0`**, which ships prebuilt binaries for both Node 22 and Node 24 (7.x drops Node 22).
181
+ Behavior is unchanged (the sandbox, RPC bridge and timeout/`__done` handling are covered by the
182
+ same tests on both runtimes). Note: prebuilds are no longer published for Node 26 — on that
183
+ runtime the script sandbox may fall back to a source build.
184
+
185
+ ## [0.6.0]
186
+
187
+ A breaking release. The data model, access control and workflow were reworked end to end. Read the
188
+ **Breaking** section before upgrading.
189
+
190
+ ### Breaking
191
+
192
+ - **Record ids are the `record_key`.** A record's external id is now a single URL-safe string that
193
+ encodes the (possibly composite) primary key, surfaced as the read-only `weave_id` field. REST
194
+ `/{id}`, MCP `id` and batch `ids[]` all take this string — read it from a result or `describe_object`
195
+ instead of composing the raw primary key.
196
+ - **Field types are bucketed** into PG-native value types and engine-shipped custom types. `person`
197
+ was renamed to `user`; `SCALAR` was removed; `currency` accepts an optional ISO 4217 code (and an
198
+ optional `precision`); `json` now maps to PostgreSQL `json` — use `jsonb` for the old behavior. Run
199
+ `weave schema:upgrade`.
200
+ - **Row scopes add `department`** (`own | department | all`) plus a separate `manage` scope for writes,
201
+ and a scope column's ids can be `internal` (engine ids) or `external` (customer ids).
202
+ - **Identity directory** — the engine now owns `weavekit_user` / `weavekit_department`; sync an external
203
+ source with `weave sync:identity`, authenticate through a verifier, and manage users over the admin
204
+ REST surface.
205
+ - **`multiRelation` uses a link table** (real FK per side, `ON DELETE CASCADE`) instead of a column;
206
+ reads and filters are scoped to the targets the subject can read.
207
+ - **Workflow rewritten to a single-line node chain** (`workflow.json` format v2). v1 state-machine
208
+ files are linearized on read. Instance/step/workitem state lives in engine tables
209
+ (`weavekit_workflow_instances` / `_steps` / `_workitems`, plus locks/definitions/timers). New
210
+ REST + MCP surface; `weave workflow:migrate` was **removed**; the side-table column
211
+ `workflow_id` was renamed to `workflow_instance_id`; `weave migrate` drops and recreates the timer
212
+ table.
213
+ - **Engine-owned system tables + runtime zero-DDL.** All DDL is emitted by `weave migrate`; the runtime
214
+ never alters or drops customer columns (reads only).
215
+ - **Security hardening** — formula references respect RBAC, `details` children inherit (and can only
216
+ narrow) their parent's permissions, DDL literals are escaped, and script SQL is gated by an AST pass.
217
+
218
+ ### Added
219
+
220
+ - Record-metadata side tables with `weave_*` virtual fields (`weave_id`, `weave_status`,
221
+ `weave_owner_id`, `weave_created_by`/`_modified_by`, `weave_created_time`/`_modified_time`,
222
+ `weave_workflow_instance_id`) — request them in `fields`, and they work in `filter` / `sort`.
223
+ - Field types: native PG enums for static `enum`s, data-driven `enum` options, `seq_no`, `uuid`,
224
+ `smallint`/`bigint`/`real`/`double`/`char`, numeric `precision`/`scale`, `json`/`jsonb`.
225
+ - Reverse-modeling: `weave introspect` handles composite primary keys and native enum/array columns;
226
+ `weave schema:map` reports schema↔column drift.
227
+ - Workflow actions `submit` / `approve` / `reject` / `forward` / `withdraw` / `cancel` / `reactivate`,
228
+ any-one / all approvals, node timeouts, an admin override, and definition write-back.
229
+ - `describe_object` exposes a field's resolved type `base`.
230
+
231
+ ### Changed
232
+
233
+ - `weave migrate` registers content-addressed workflow definitions; instances pin the hash they started
234
+ under, so editing `workflow.json` only affects new records.
235
+ - Live `record.transitioned` events carry `from` / `to` / `action`.
236
+
237
+ ### Fixed
238
+
239
+ - Correct row-scope parameter offset on `update` / `delete` / `transition`.
240
+ - `record_key` encoding is single-sourced in SQL (contract-tested).
package/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  <h1 align="center">Let AI agents operate your data — safely</h1>
2
2
 
3
- Define your data model once in `schema.json`, and WeaveKit compiles it into PostgreSQL tables, a
4
- REST API with row- and field-level RBAC, an immutable audit log, and an MCP tool surface that AI
5
- agents call with typed tools — never raw SQL. Self-hosted: your data stays in your database.
3
+ Define your data model once in `schema.json`, and WeaveKit compiles it into PostgreSQL tables, REST
4
+ and GraphQL APIs with row- and field-level RBAC, an immutable audit log with execution evidence, and
5
+ an MCP tool surface that AI agents call with typed tools — never raw SQL. Self-hosted: your data
6
+ stays in your database.
6
7
 
7
8
  ```
8
9
  objects/leads/schema.json → Git commit (source of truth)
9
10
  PostgreSQL tables + indexes + RLS
10
- REST API (CRUD + RBAC)
11
- MCP tools (per-identity surface + guardrails)
12
- Immutable audit log
11
+ REST + GraphQL APIs (CRUD + RBAC)
12
+ MCP tools (per-identity surface + guardrails + approvals)
13
+ Immutable audit log + execution evidence
13
14
  TypeScript types
14
15
  ```
15
16
 
@@ -29,8 +30,8 @@ objects/leads/schema.json → Git commit (source of truth)
29
30
  - **Typed tools in minutes, not weeks** — hand-writing an MCP server (tools + permissions + audit)
30
31
  for a few tables takes days; here it is a few `schema.json` files, and new fields or tables
31
32
  extend the tool surface automatically.
32
- - **More than MCP** — the same schema also drives a REST API and generated TypeScript types, so
33
- people and agents share one governed contract.
33
+ - **More than MCP** — the same schema also drives REST and GraphQL APIs and generated TypeScript
34
+ types, so people and agents share one governed contract.
34
35
  - **Self-hosted** — the engine runs in your environment; no data leaves your database.
35
36
 
36
37
  ## How it works
@@ -52,23 +53,38 @@ write.
52
53
  types. Declared in a project-local, Git-committed `field-types/` directory.
53
54
  - **Named enums** — declare a shared enum once in `enums/` and reference it from any object by
54
55
  `enumType`; every field shares one native PostgreSQL type and one set of per-value labels.
55
- - **Governed REST API** — object CRUD with row-level (`all`/`own`/`team`) and field-level RBAC and a
56
- uniform error contract.
56
+ - **Governed REST API** — object CRUD with row-level (`all`/`own`/`department`) and field-level RBAC
57
+ and a uniform error contract.
57
58
  - **MCP tool surface** — a streamable HTTP endpoint at `/mcp` with a per-identity tool surface and
58
59
  guardrails.
59
60
  - **GraphQL API** — an opt-in read/write GraphQL endpoint compiled from the same `schema.json`, with
60
61
  nested relations, the same RBAC/audit, per-request batching and query hardening.
61
- - **Audit log** — an immutable event log for data mutations.
62
+ - **Schema revisions & atomic deploys** — `weave deploy plan` previews the diff; `weave deploy apply`
63
+ commits the DDL, the metadata cache and a global **schema revision** in one transaction (no
64
+ half-applied deploys).
65
+ - **Agent execution pipeline** — every write and tool call runs through one
66
+ Plan → Validate → Authorize → Guardrail → Approval → Execute → Commit → Evidence pipeline, so
67
+ guardrails and approvals cover REST, MCP and GraphQL alike; enable `evidence` to record a
68
+ `weavekit_evidence` row per execution (correlated by request / trace / schema revision).
69
+ - **Query budget** — bound a read/query across the engine: rows, filters and sorts in data-access,
70
+ joins / SQL length / statement timeout in restricted SQL, and GraphQL depth.
71
+ - **Multi-tenancy (row)** — mark a field `"tenant": true` and every read/write is scoped to the
72
+ subject's tenant (RBAC row scope + PostgreSQL RLS + audit); single-tenant by default.
73
+ - **Audit log** — an immutable event log for data mutations, with durability modes
74
+ (`best-effort` / `transactional` / `durable`) and a keyset-cursor query.
75
+ - **Observability** — a low-level metrics/trace seam (`MetricsSink` / `TraceSink`, `METRIC_NAMES`)
76
+ that emits request latency, RBAC denials, query-budget rejects and W3C `traceparent`-correlated
77
+ spans; the engine ships a no-op default and brings no backend.
62
78
  - **Sandboxed hooks** — `*.server.js` lifecycle hooks running in isolated workers.
63
79
  - **Type generation** — object-level TypeScript types derived from the schema.
64
80
  - **Live events** — an SSE stream with replay.
65
- - **Operations** — health / readiness / version endpoints, request rate limiting, CORS and
66
- structured logging.
81
+ - **Operations** — `weave doctor` preflight, health / readiness / version endpoints, request rate
82
+ limiting, CORS and structured logging.
67
83
 
68
84
  ## Requirements
69
85
 
70
86
  - Node.js 22+
71
- - PostgreSQL
87
+ - PostgreSQL 12+ (the engine's tested floor; `weave doctor` reports the version)
72
88
 
73
89
  ## Quick start
74
90
 
@@ -100,11 +116,11 @@ Full documentation: **[docs.weavekit.io/engine](https://docs.weavekit.io/engine)
100
116
 
101
117
  - [Getting started](https://docs.weavekit.io/engine/guides/getting-started) — scaffold, migrate, run, consume
102
118
  - [Git-versioned metadata](https://docs.weavekit.io/engine/guides/model/git-versioned-metadata) — your data model as reviewable Git commits
103
- - [Schema guide](https://docs.weavekit.io/engine/guides/model/schema) · [RBAC](https://docs.weavekit.io/engine/guides/access/rbac) · [Formulas](https://docs.weavekit.io/engine/guides/model/formulas) · [Audit](https://docs.weavekit.io/engine/guides/platform/audit)
104
- - [CLI reference](https://docs.weavekit.io/engine/guides/platform/cli) · [MCP](https://docs.weavekit.io/engine/guides/agents/mcp) · [Script hooks](https://docs.weavekit.io/engine/guides/automation/script-hooks)
105
- - [Custom tools & guardrails](https://docs.weavekit.io/engine/guides/agents/custom-tools-and-guardrails) · [Custom field types](https://docs.weavekit.io/engine/reference/schema/custom-field-types) · [Quotas](https://docs.weavekit.io/engine/guides/automation/quotas) · [Inbound events](https://docs.weavekit.io/engine/guides/integration/ingress)
106
- - [Public API & dependency budget](https://docs.weavekit.io/engine/reference/api/public-api)
107
- - [Practices & operations](https://docs.weavekit.io/engine/practices/agent/existing-crm-to-mcp) — real integration and deployment walkthroughs
119
+ - [Schema guide](https://docs.weavekit.io/engine/guides/model/schema) · [RBAC](https://docs.weavekit.io/engine/guides/access/rbac) · [Multi-tenancy](https://docs.weavekit.io/engine/guides/access/multi-tenancy) · [Formulas](https://docs.weavekit.io/engine/guides/model/formulas) · [Audit](https://docs.weavekit.io/engine/guides/platform/audit)
120
+ - [CLI reference](https://docs.weavekit.io/engine/guides/platform/cli) · [Observability](https://docs.weavekit.io/engine/guides/platform/observability) · [MCP](https://docs.weavekit.io/engine/guides/agents/mcp) · [Execution & evidence](https://docs.weavekit.io/engine/guides/agents/execution-and-evidence) · [Script hooks](https://docs.weavekit.io/engine/guides/automation/script-hooks)
121
+ - [Custom tools & guardrails](https://docs.weavekit.io/engine/guides/agents/custom-tools-and-guardrails) · [Query budget](https://docs.weavekit.io/engine/guides/automation/query-budget) · [Custom field types](https://docs.weavekit.io/engine/reference/schema/custom-field-types) · [Quotas](https://docs.weavekit.io/engine/guides/automation/quotas) · [Inbound events](https://docs.weavekit.io/engine/guides/integration/ingress)
122
+ - [Public API & dependency budget](https://docs.weavekit.io/engine/reference/api/public-api) · [Enterprise seams](https://docs.weavekit.io/engine/reference/enterprise-seams) · [Contract freeze](https://docs.weavekit.io/engine/reference/contract-freeze)
123
+ - [Practices & operations](https://docs.weavekit.io/engine/practices/agent/existing-crm-to-mcp) · [Release checklist](https://docs.weavekit.io/engine/operations/release) — real integration and deployment walkthroughs
108
124
 
109
125
  The Markdown sources live in [`docs/`](https://github.com/weavekit/engine/tree/main/docs).
110
126
 
@@ -135,6 +151,8 @@ await engine.app.listen({ port: 3000 });
135
151
  | Command | Description |
136
152
  | --- | --- |
137
153
  | `weave migrate [--dry-run]` | State-diff migration + metadata cache + auto-commit |
154
+ | `weave deploy plan` / `weave deploy apply` | Preview / atomically apply schema changes and record a global schema revision |
155
+ | `weave doctor` | Read-only preflight (connection, PostgreSQL compatibility, drift, system tables, RLS + sandbox) |
138
156
  | `weave dev [--port]` | Run with hot reload |
139
157
  | `weave build` | Bundle the server entry (esbuild) |
140
158
  | `weave test` | Proxy the project test suite |
@@ -152,7 +170,7 @@ await engine.app.listen({ port: 3000 });
152
170
  | `weave field-type:check` | Validate registrations + schemas against the registry |
153
171
  | `weave enum:list` | List declared named enums (`enums/<name>.json`) |
154
172
  | `weave enum:check` | Validate enum declarations + schema references |
155
- | `weave module:add` / `module:remove <name>` | Enable/disable an optional subsystem (audit/script) |
173
+ | `weave module:add` / `module:remove <name>` | Enable/disable an optional subsystem (audit/script/workflow) |
156
174
 
157
175
  ## Object-level types
158
176
 
@@ -174,8 +192,10 @@ const { rows } = await leads.find({ filter: { status: 'open' } });
174
192
  npm install
175
193
  npm run build # tsc → dist
176
194
  npm test # unit + e2e (e2e needs DATABASE_URL)
195
+ npm run test:coverage # coverage gate on security-critical paths
177
196
  npm run typecheck
178
197
  npm run lint
198
+ node scripts/check-exports.mjs # verify package exports + contract names
179
199
  ```
180
200
 
181
201
  Issues and pull requests are welcome. See [`AGENTS.md`](AGENTS.md) for architecture notes and
@@ -4,7 +4,7 @@ import { type AuthConfig, type Authenticator } from './source.js';
4
4
  export type { Authenticator, AuthConfig, AuthResolver, AuthSource } from './source.js';
5
5
  export { createAuth } from './source.js';
6
6
  export type { AuthVerifier } from './verify.js';
7
- export { createDirectoryAuthenticator, enforceSyncedIdentity } from './subject.js';
7
+ export { createDirectoryAuthenticator, enforceSyncedIdentity, withDefaultTenant } from './subject.js';
8
8
  /**
9
9
  * Resolve the Authorization header into a subject, or throw a 401-family
10
10
  * {@link SchemaError}. Missing header → `auth.missingKey`; present but
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAc,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9E,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEnF;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC,CAK1B;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAEpE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAc,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9E,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtG;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC,CAK1B;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAEpE"}
@@ -1,7 +1,7 @@
1
1
  import { SchemaError } from '../../core/index.js';
2
2
  import { createAuth } from './source.js';
3
3
  export { createAuth } from './source.js';
4
- export { createDirectoryAuthenticator, enforceSyncedIdentity } from './subject.js';
4
+ export { createDirectoryAuthenticator, enforceSyncedIdentity, withDefaultTenant } from './subject.js';
5
5
  /**
6
6
  * Resolve the Authorization header into a subject, or throw a 401-family
7
7
  * {@link SchemaError}. Missing header → `auth.missingKey`; present but
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAuC,MAAM,aAAa,CAAC;AAG9E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEnF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,aAA4B,EAC5B,MAA0B,EAC1B,MAAc;IAEd,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IACrC,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/E,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,MAAkB;IACnD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAuC,MAAM,aAAa,CAAC;AAG9E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtG;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,aAA4B,EAC5B,MAA0B,EAC1B,MAAc;IAEd,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IACrC,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/E,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,MAAkB;IACnD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
@@ -13,6 +13,9 @@ export type AuthResolver = (header: string | undefined) => IdentitySubject | nul
13
13
  /**
14
14
  * The authentication source: either a static key map or a resolver function.
15
15
  * `source` is required whenever `auth` is configured (fail fast otherwise).
16
+ *
17
+ * Stable seam (`@enterprise-reserved`): SSO/OIDC/SAML is enterprise E1; the
18
+ * engine ships static-key and custom-resolver sources.
16
19
  */
17
20
  export type AuthSource = Record<string, IdentitySubject> | AuthResolver;
18
21
  /** authentication config — the single source of truth is `source` */
@@ -1 +1 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,+FAA+F;AAC/F,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CAC/F;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;AAEpH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,YAAY,CAAC;AAExE,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAiB5D"}
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,+FAA+F;AAC/F,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CAC/F;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;AAEpH;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,YAAY,CAAC;AAExE,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAiB5D"}