cvx-kit 0.1.15 → 0.1.16

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 (45) hide show
  1. package/README.md +59 -38
  2. package/dist/relations.mjs +1 -1
  3. package/dist/relations.mjs.map +1 -1
  4. package/dist/zod-table.d.mts +59 -2
  5. package/dist/zod-table.mjs +1 -1
  6. package/dist/zod-table.mjs.map +1 -1
  7. package/package.json +10 -3
  8. package/AGENTS.md +0 -47
  9. package/CHANGELOG.md +0 -337
  10. package/ROADMAP.md +0 -126
  11. package/docs/agent-tools.md +0 -41
  12. package/docs/approvals.md +0 -201
  13. package/docs/architecture.md +0 -124
  14. package/docs/auth.md +0 -443
  15. package/docs/command-context.md +0 -150
  16. package/docs/commands-legacy.md +0 -513
  17. package/docs/commands.md +0 -173
  18. package/docs/conventions.md +0 -345
  19. package/docs/crud.md +0 -66
  20. package/docs/domain-contracts.md +0 -148
  21. package/docs/domain-operations.md +0 -615
  22. package/docs/effect.md +0 -403
  23. package/docs/llms.md +0 -324
  24. package/docs/maintainability.md +0 -124
  25. package/docs/migration.md +0 -351
  26. package/docs/oxlint.md +0 -260
  27. package/docs/querying.md +0 -329
  28. package/docs/tenancy.md +0 -176
  29. package/docs/triggers.md +0 -77
  30. package/docs/upgrading.md +0 -287
  31. package/docs/webhooks.md +0 -58
  32. package/docs/zod-table.md +0 -278
  33. package/scripts/convex-config-bridge.mjs +0 -44
  34. package/scripts/convex-smoke-env.mjs +0 -33
  35. package/scripts/extract-changelog.mjs +0 -29
  36. package/scripts/owned-process.mjs +0 -140
  37. package/scripts/owned-process.test.mjs +0 -107
  38. package/scripts/smoke-packed-components.mjs +0 -341
  39. package/scripts/smoke-packed-effect.mjs +0 -439
  40. package/scripts/smoke-packed-querying.mjs +0 -298
  41. package/scripts/test-packed-auth.mjs +0 -72
  42. package/scripts/test-packed-effect.mjs +0 -482
  43. package/scripts/test-packed-ids.mjs +0 -150
  44. package/scripts/test-packed-oxlint.mjs +0 -167
  45. package/scripts/test-packed-querying.mjs +0 -185
package/CHANGELOG.md DELETED
@@ -1,337 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to cvx-kit are documented here. The format follows
4
- [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
-
6
- **Semver contract (from 0.1.0):** while on 0.x, breaking changes land only on
7
- minor bumps; patches are additive or fixes. The breaking window formally
8
- closes at the follow-up consolidation release (package-name decision + full
9
- export-name API audit) — until then, the six 0.1.0 helper surfaces may still
10
- be renamed in a minor. Every release tag gets a GitHub Release whose notes
11
- are this file's matching section.
12
-
13
- ## [Unreleased]
14
-
15
- ## [0.1.15] - 2026-10-11
16
-
17
- ### Added
18
-
19
- - Declare a global query engine with only `createQueryEngine({ schema, relations })`.
20
- - Load cursor secrets internally from server environment configuration on first pagination.
21
- - Configure optional engine overrides in a separate second argument, while preserving existing declarations.
22
-
23
- ### Changed
24
-
25
- - Document global engine setup, server cursor secrets, and the purpose of advanced options.
26
- - Publish releases after successful CI for the exact main commit, without repeating tests in the release workflow.
27
-
28
- ## [0.1.14] - 2026-10-11
29
-
30
- ### Added
31
-
32
- - Typed relational queries with scalar and relationship filters, conditional indexes, global ascending or descending order, and bounded stream pagination.
33
- - Explicit relationship declarations for direct, self, and junction relationships, with paginated child continuations.
34
- - Managed query authorization, shared read budgets, and encrypted cursors bound to the query, principal, tenant, and parent relationship.
35
- - Table DTO options for validated IDs and extensions, including `toPublicDto(row, true)`, plus native-derived `paginationOpts` and page DTO helpers.
36
- - Oxlint enforcement for manual ID projections, copied pagination contracts, and unsafe relational query boundaries.
37
- - Dedicated querying documentation and updated table and rule documentation in `src/docs`.
38
-
39
- ### Fixed
40
-
41
- - Preserve shared validator graphs during native auth registration to avoid repeated validator expansion.
42
-
43
- ### Verified
44
-
45
- - Source, type, rule, and packed-consumer checks; 308 independently audited relational stress sequences across installed and minimum peer versions.
46
- - 33 HTTP responses exercised encrypted cursor pagination and rejection paths on a local Convex backend. Hosted production performance remains unmeasured.
47
-
48
- ## [0.1.13] - 2026-10-10
49
-
50
- ### Added
51
-
52
- - Implement contracted operations with `command.handler(handler, options?)` and
53
- `query.handler(handler, options?)` in both Promise and Effect registries.
54
- - Infer each handler's input and result from its operation object key, without
55
- repeating the operation name; preserve existing named helpers.
56
-
57
- ### Verified
58
-
59
- - Cover contract binding, validation, audits, and handler inference with 684
60
- runtime tests and strict type fixtures.
61
- - Compile the documentation examples and test packed npm/Bun consumers with
62
- and without Effect.
63
-
64
- ## [0.1.12] - 2026-10-10
65
-
66
- ### Added
67
-
68
- - Declare optional domain contracts with root errors, command classification,
69
- and exact command/query implementation keys in both Effect and Promise registries (#26).
70
- - Share a registry-level command audit default with per-operation overrides,
71
- preserving replay bypass, schema inference, and transactional rollback.
72
- - Use `createFoundation` for typed Promise registries without installing Effect.
73
- - Enforce reserved domain file declarations through the packaged Oxlint plugin,
74
- including constructor provenance and declarative contract ownership.
75
- - Document both contract APIs with packed-compiled examples and audit guidance.
76
-
77
- ### Verified
78
-
79
- - Cover native validation, error projection, rollback, audit selection, agent tools,
80
- workflow integration, and npm/Bun consumers with and without Effect.
81
- - Pass 680 runtime tests, 340 lint-rule tests, and both packed-component CI smoke tests.
82
-
83
- ## [0.1.11] - 2026-10-09
84
-
85
- ### Added
86
-
87
- - Configure shared post-auth Effect services and command/query handles once across
88
- all auth, role, admin, and system constructors with `createEffectAuthFunctions` (#24).
89
- - Keep query, mutation, action, and internal system capabilities separately typed
90
- and configured; preserve secured database wrapping and live action membership.
91
- - Document the shared application factory with packed-compiled examples and
92
- constructor capability guidance for coding agents.
93
-
94
- ### Verified
95
-
96
- - Cover denied authentication, roles and membership, request-local scopes, context
97
- collisions, nested command auditing, and registered mutation rollback.
98
- - Preserve packed native auth context compatibility on Convex 1.45 and 1.46.
99
-
100
- ## [0.1.10] - 2026-10-09
101
-
102
- ### Fixed
103
-
104
- - Preserve native Convex context types in auth, role, admin, and system function
105
- constructors so secured handlers bind directly to Effect registries (#22).
106
- - Install Standard Schema types explicitly so native contract input and output
107
- inference works in clean installations.
108
-
109
- ### Changed
110
-
111
- - Update package dependencies and migrate the development toolchain to Vite+ 1.1.
112
- - Require Convex 1.46 or newer and convex-helpers 0.1.127 or newer (below 0.2.0),
113
- matching workflow 0.4.10.
114
-
115
- ## [0.1.7] - 2026-10-07
116
-
117
- ### Added
118
-
119
- - Add optional Effect 4 command and query registries with cohesive ordinary,
120
- Promise, generator, and function handlers, injected services, and scoped API
121
- execution through native and custom Convex builders.
122
- - Add asynchronous operation contracts, explicit schema adapters, and checked
123
- transport for declared safe errors.
124
- - Add injectable audited Effect CRUD, host-owned transactional idempotency
125
- receipts, native durable workflow bindings, and selected domain operation tools.
126
- - Document server-side declaration, composition, API consumption, receipts,
127
- workflows, and tools with compile-checked public-package examples.
128
-
129
- ### Fixed
130
-
131
- - Preserve native validators, trusted authorization, RLS, triggers, audit, and
132
- rollback across API, workflow, and tool integrations.
133
- - Reconcile late workflow outcomes without allowing stale generations or late
134
- completion to overwrite canceled runs.
135
- - Validate retained receipt versions before fingerprints and replay, and require
136
- current authorization before disclosing replayed results.
137
-
138
- ## [0.1.6] - 2026-09-19
139
-
140
- ### Added
141
-
142
- - Add five opt-in consumer Oxlint rules for project structure, root wiring,
143
- application orchestration, internal function ownership, and domain file
144
- responsibilities. The packaged plugin now includes 20 rules.
145
- - Check colocated test presence, runtime import cycles, and shared-code ownership.
146
- Export `checkArchitecture` for standalone checks without copying architecture
147
- test suites into applications. These static checks do not replace behavior tests.
148
-
149
- ### Fixed
150
-
151
- - Resolve tsconfig aliases when checking consumer import boundaries and reject
152
- migration dependencies from application code.
153
- - Enforce documented ownership of domain implementations, table aggregation,
154
- query side effects, and component boundaries.
155
-
156
- ## [0.1.5] - 2026-09-18
157
-
158
- ### Fixed
159
-
160
- - Correct `cvx-kit/oxlint` to enforce the documented consumer `convex/` layout
161
- rather than this repository's `src/` layout. Keep the six library-authoring
162
- rules in repository tooling and publish 15 consumer rules, with coverage for
163
- domain boundaries, auth builders, thin adapters, facade ownership, table
164
- placement, vocabularies, bounded read syntax, and trigger-owned timestamps.
165
- - Replace consumer `entryPoints`/`packageName` options with `convexDir`; document
166
- migration, allowed exceptions, and the checks that still need runtime tests.
167
- Validate the packaged plugin against consumer fixtures installed by npm and Bun.
168
-
169
- ## [0.1.4] - 2026-09-18
170
-
171
- ### Added
172
-
173
- - Publish the TypeScript Oxlint plugin as `cvx-kit/oxlint`, with six rules for
174
- component isolation, environment access, schema placement, public facades,
175
- API ordering, and named private helpers. Consumer entry points and package
176
- self-import boundaries are configurable.
177
- - Enforce all 15 generic anti-slop rules in the repository and verify the
178
- published plugin through fresh npm and Bun installations in CI.
179
-
180
- ### Changed
181
-
182
- - Replace cast-heavy command, CRUD, tenancy, auth, webhook, and tool boundaries
183
- with schema-derived types and validation. Preserve distinct agent-tool result
184
- types and validate the emitted declarations in packed consumers.
185
- - Tighten TypeScript contracts for query middleware, include transforms, audit
186
- metadata, and webhook targets. See `docs/upgrading.md` for migration details.
187
- - Format owned source, tests, scripts, and documentation consistently.
188
-
189
- ## [0.1.3] - 2026-09-06
190
-
191
- ### Fixed
192
-
193
- - Fix Convex ID validation across package boundaries by sharing `convex-helpers`
194
- as a peer dependency. Export `zid`, `zodToConvex`, and `convexToZod` from
195
- `cvx-kit/zod-table`; verify differing compatible host versions under npm and Bun (#10).
196
- - Add `Command.withContext<Context, Extension>()` for schema-inferred guards,
197
- audit callbacks, operation middleware, and correlated registry middleware (#11).
198
- - Add invocation-local `prepare` hooks with authorized, validated replay and
199
- completion after audit, inside observation. Durable storage remains host-owned (#12).
200
- - Accept concrete and generic `convex-test` backends directly in registration helpers (#13).
201
- - Parse command results once after middleware; handler and middleware result types
202
- describe schema inputs, while audit, completion, and executor results describe outputs.
203
- - Accept raw command schema inputs at executor call sites while inferring parsed
204
- outputs for callbacks; reject incompatible typed host contexts and registry middleware.
205
- - See `docs/upgrading.md` for helper peer installation and transformed-result migration.
206
-
207
- ## [0.1.2] - 2026-08-21
208
-
209
- ### Added
210
-
211
- - `resolveOrganization` hook on `createAuthFunctions`: identity providers
212
- whose tokens carry no org claims (custom credentials, magic codes,
213
- memberships in app tables) can resolve organization and role from the
214
- database. When configured, the hook overrides claim-based resolution and
215
- fails closed — `null` or an error rejects with `FORBIDDEN`; its `roleSlug`
216
- still passes `mapRole`, tenancy derives from the hook's organization, and
217
- `verifyMembership` for actions is unchanged. Hook-less configurations are
218
- unaffected. ([#8](https://github.com/ImRLopezAG/cvx-kit/issues/8))
219
-
220
- ## [0.1.1] - 2026-08-17
221
-
222
- ### Fixed
223
-
224
- - Package Convex component schemas exclusively as discoverable `schema.js` and
225
- `schema.d.ts` files. This restores the approvals tables and the
226
- `approvalDecisions.by_runId_and_decidedAt` and
227
- `approvalDecisions.by_runId_and_stepKey_and_actor_actorRef` indexes without
228
- consumer `patchedDependencies` workarounds or canonicalization conflicts.
229
- - Keep compiled component imports aligned with the discoverable `schema.js`
230
- filename when runtime functions use the schema directly.
231
- - Include `stepKey` in the public approval callback evidence contract and
232
- export canonical Zod and Convex callback validators for strict consumers.
233
- - Use component-safe cursor pagination for approval request lists instead of
234
- Convex's app-only built-in `.paginate()` implementation.
235
-
236
- ### Added
237
-
238
- - Packed-tarball content checks and clean anonymous-deployment smoke tests for
239
- every bundled component under both Bun and npm installation.
240
- - `components.approvals.health.check`, which verifies the approvals schema
241
- version and required decision indexes with an actionable failure diagnostic.
242
- - Supported Convex, Zod, Bun, Node.js, and npm versions plus an approvals
243
- packaging migration note.
244
- - Packed callback and paginated-list smoke coverage through real host wrappers.
245
-
246
- ## [0.1.0] - 2026-08-14
247
-
248
- The big one: the full helper surface, in one release.
249
-
250
- ### Added
251
-
252
- - **Pagination bridge** — `paginated(dto)` boundary schemas
253
- (`cvx-kit/zod-table`) and an `include(...).paginate(opts, transform?)`
254
- terminal (`cvx-kit/auth`): cursor pagination bounded by the same maxRows
255
- policy as `execute`. Under row-level security, pages may be shorter than
256
- `numItems` (filtered rows); cursors remain correct.
257
- - **CRUD command factory** — `createCrudCommands` (`cvx-kit/crud`):
258
- create/update/archive operations generated from a zodTable, fully inside
259
- the audited command pipeline; soft-delete only; `enrich` is required for
260
- tenantTables (fails fast with `CRUD_ENRICH_REQUIRED`).
261
- - **State-machine helper** — `createStateMachine` (`cvx-kit/state-machine`):
262
- typed transition legality from constants tuples; `assert` throws
263
- `INVALID_TRANSITION` via the injected ErrorFactory, dropping straight into
264
- command guards.
265
- - **Rate-limit middleware** — `rateLimit` (`cvx-kit/middleware`): the first
266
- packaged middleware, over an injected `@convex-dev/rate-limiter` instance
267
- (structural typing — zero new kit dependencies). Keyed by `ctx.tenant` by
268
- default; a missing key is a configuration error
269
- (`RATE_LIMIT_KEY_MISSING`), never a silent shared bucket.
270
- - **Webhook boundary** — `createWebhookBoundary`, `recordWebhookEvent`,
271
- `webhookEventsTable` (`cvx-kit/webhooks`): raw-body signature verification
272
- (fail closed), natural-key dedup transactional inside the target internal
273
- mutation, host-owned dedup table.
274
- - **Agent tool generator** — `createAgentTools` (`cvx-kit/agent-tools`):
275
- tool records from the table tool masks, shape-compatible with
276
- `@convex-dev/agent`'s `createTool` without depending on it; mutation
277
- handlers route through command executors so agents get audited commands.
278
- - **Typed middleware context** — `Command.middleware<Ctx, Extension>` /
279
- `Query.middleware<Ctx, Extension>`: `next({ context })` is typed against
280
- the declared extension; registries and operations accept typed middleware
281
- without casts (`AnyCommandMiddleware`/`AnyQueryMiddleware` variance seam).
282
- - **Upgrade guide** — `docs/upgrading.md` ships in the package: old way →
283
- new way per feature for consumers on 0.0.x.
284
-
285
- ### Changed
286
-
287
- - `tools.update` / `tools.id` masks now use `jsonSafeZid` instead of `zid`,
288
- so ids present as plain strings in generated JSON schemas (compile-time
289
- `Id<...>` types preserved).
290
- - Release workflow now creates a GitHub Release with this file's section as
291
- notes, and action pins are updated past the Node 20 deprecation.
292
-
293
- ## [0.0.8] - 2026-08-14
294
-
295
- - Composable next()-based middleware for Command and Query kernels, inside
296
- pipeline invariants (registry-wide + per-operation, context enrichment,
297
- result re-parse).
298
-
299
- ## [0.0.7] - 2026-08-14
300
-
301
- - `systemQuery` constructor: internal, include-equipped, RLS-unwrapped.
302
- BREAKING: `createAuthFunctions` config requires the `internalQuery` builder.
303
-
304
- ## [0.0.6] - 2026-08-14
305
-
306
- - Materialized `convex.config.js` bridges (Convex CLI discovers components by
307
- that literal filename). BREAKING: mount via
308
- `cvx-kit/components/<name>/convex.config`; client facades no longer
309
- default-export the component config.
310
-
311
- ## [0.0.5] - 2026-08-14
312
-
313
- - BREAKING: the Foundation facade is the only runtime surface — kernel
314
- classes and execution utilities destructure from the instance.
315
-
316
- ## [0.0.4] - 2026-08-14
317
-
318
- - Tarball ships only `dist`, `docs`, and the source test helper
319
- (`.npmignore`); `cvx-kit/test` registers compiled dist modules.
320
-
321
- ## [0.0.3] - 2026-08-14
322
-
323
- - Opt-in tenancy and security controls: `tenantTable`, `createModule`,
324
- `security` config on `createAuthFunctions` (role rules + tenant RLS),
325
- `ctx.tenant`, `cvx-kit/tenancy`, `tenantOwnership` trigger. Command
326
- guards, permission checks, and the aggregate allowlist.
327
-
328
- ## [0.0.2] - 2026-08-13
329
-
330
- - Shipped package documentation (architecture, conventions, migration,
331
- llms) at `docs/`; opinionated timestamps on every table; single-path
332
- component mounts.
333
-
334
- ## [0.0.1] - 2026-08-13
335
-
336
- - Initial release: foundation + approvals components, zod-table boundaries,
337
- auth constructors, triggers, audited command protocol.
package/ROADMAP.md DELETED
@@ -1,126 +0,0 @@
1
- # Roadmap to 1.0.0
2
-
3
- Where cvx-kit is going and what "stable" will mean. Tracked with checkboxes;
4
- each milestone ships as one minor version. From `0.1.0` on, **breaking
5
- changes only land on minor bumps** (0.x semver: minor = breaking, patch =
6
- fix/additive) and every release gets a CHANGELOG entry.
7
-
8
- ## 0.1.0 — the big one: API consolidation + the feature set
9
-
10
- Goal: one release that both closes the breaking window AND ships the full
11
- helper surface, so consumers adopt a complete kit once instead of chasing
12
- minors. Everything here may still rename freely — that's why the features
13
- belong in this milestone: they land already conforming to the frozen names.
14
-
15
- ### Consolidation (the last breaking pass)
16
-
17
- - [ ] Decide the published name (`cvx-kit` is a working title) and, if it
18
- changes, publish under the final name with `cvx-kit` deprecated.
19
- - [ ] API audit: review every exported name, option key, and error code
20
- against `conventions.md`'s own naming grammar; freeze the error-code
21
- taxonomy (`KitError` codes) as a documented tuple.
22
- - [x] Typed middleware context accumulation: `next({ context })` currently
23
- merges loosely; tighten so enrichment widens the downstream ctx type
24
- (TanStack-style), without breaking the loose form.
25
- - [x] Introduce `CHANGELOG.md` + release notes on the GitHub tag; adopt the
26
- 0.x semver contract above. (GitHub Releases automated in release.yml.)
27
- - [ ] CI hardening: add `--dry-run` pack + `attw` (Are The Types Wrong) next
28
- to publint; bump the deprecated actions pins.
29
-
30
- ### Features
31
-
32
- - [x] **Pagination bridge** — `paginated(table.publicDto)` arg/return
33
- helpers over Convex's pagination validators, and an
34
- `include(...).paginate(opts)` terminal next to `.execute(limit)`:
35
- cursors, not just bounded `take`.
36
- - [x] **CRUD command factory** — `createCrudCommands(table, policy)`
37
- generating the standard create/update/archive operations from a
38
- zodTable's masks: command input from `commandFields`, audit derivation
39
- from the aggregate, timestamps/tenant already structural. The single
40
- biggest remaining per-entity boilerplate.
41
- - [x] **State-machine helper** — `createStateMachine(STATES, transitions)`
42
- typed against the constants tuple, returning `isTransitionLegal` /
43
- `assertTransition` that drop straight into a command `guard`.
44
- - [x] **Rate-limit middleware factory** — the first official middleware:
45
- `rateLimit({ key: (ctx) => ctx.tenant, ... })` over
46
- `@convex-dev/rate-limiter`, packaged as `Command.middleware` /
47
- `Query.middleware` and the template for future middleware.
48
- - [x] **Webhook boundary helper** — signature verification + event dedup by
49
- natural key (`${event}:${id}:${updatedAt}`) + delegation to a
50
- `system*` function: the one boundary that genuinely needs dedup, as a
51
- first-class helper.
52
- - [x] **Agent tool generator** — `createAgentTools(table, executors)`
53
- emitting `@convex-dev/agent` tool definitions from the existing
54
- `tools.*` masks + `jsonSafeZid`, with handlers routed through the
55
- command protocol — agents get audited commands, never raw db access.
56
-
57
- Each feature ships with its own doc page (or section), tests on the real
58
- Convex runtime where applicable, and an `llms.md` entry.
59
-
60
- ## 0.2.0 — guardrails as a product
61
-
62
- Goal: the conventions the docs prescribe become importable tests, so a
63
- consumer gets the origin app's discipline on day one — enforced against the
64
- by-then-frozen 0.1.0 names.
65
-
66
- - [ ] `createArchitectureTest(rules)` — glob-based rule runner with the
67
- standard rules built in (no raw builders outside functions.ts, no
68
- inline tables/enums, no sibling-domain imports, no deep component
69
- imports, facades mount once), each rule fixture-proved, extensible
70
- with app-specific rules.
71
- - [ ] Tenancy exhaustiveness helper: assert every `tenantTable` is in the
72
- registry and vice versa; assert internal builders accept no tenant arg.
73
- - [ ] `llms.md` conformance check: an automated test that every export in
74
- its tables exists with that signature (also an rc gate — build it here).
75
- - [ ] Port the approvals copyability test (cp -r + tsc) into this repo's
76
- suite as the permanent portability guarantee for both components.
77
-
78
- ## 0.3.0 — scaffolding
79
-
80
- Goal: the first hour of a new app is generated, not hand-written.
81
-
82
- - [ ] WorkOS scaffold generator: `auth.ts`, `auth.config.ts`, `http.ts`,
83
- `functions.ts`, `foundation.ts`, `triggers.ts` from one command.
84
- - [ ] Audit facade helpers over any `convex-audit-log` instance:
85
- fingerprinted cursors, bounded windows, admin readers.
86
- - [ ] Decide on the optional idempotency/replay component (deferred from
87
- 0.0.x — only if a consumer demonstrates the need beyond Convex's
88
- exactly-once mutation delivery).
89
-
90
- ## 1.0.0-rc — proving it
91
-
92
- Entry gates, not work items. The rc ships when all are true:
93
-
94
- - [ ] Two real applications run the latest kit in production-like use for
95
- several weeks (the multi-tenant integration and one more).
96
- - [ ] One full minor cycle with zero breaking changes needed.
97
- - [ ] Docs complete and verified: the `llms.md` conformance check (built in
98
- 0.2.0) green in CI.
99
- - [ ] CI matrix: bun + node LTS, convex peer-range min and latest.
100
- - [ ] Public-API test coverage: every exported runtime symbol exercised by
101
- at least one test.
102
-
103
- ## 1.0.0
104
-
105
- - [ ] Freeze the export surface; document the semver contract (what counts
106
- as breaking, deprecation policy of one minor with warnings).
107
- - [ ] `MIGRATING.md` from 0.x.
108
- - [ ] Provenance, README badges, and a docs site or expanded README landing.
109
-
110
- ## Candidates (recorded, not committed)
111
-
112
- - Observability sink adapters: OTel/Axiom-shaped formatters for the
113
- injectable `emit`, so `command.execution` events land in real telemetry
114
- without per-consumer mapping.
115
- - Migration companion: a thin `@convex-dev/migrations` wrapper aligned with
116
- zodTable epochs ("make optional field required after backfill" as a
117
- declared step), closing the loop with `migration.md`.
118
-
119
- ## Explicitly out of scope for 1.0
120
-
121
- - General idempotency store (platform already covers single-call
122
- exactly-once; boundary dedup is the webhook helper's job).
123
- - Frontend helpers/React bindings.
124
- - Multi-provider auth abstractions beyond the injected-policy seam
125
- (`createAuthFunctions` already accepts any provider via `getAuthUser`/
126
- `mapRole`/`verifyMembership`).
@@ -1,41 +0,0 @@
1
- # `cvx-kit/agent-tools` — agents get audited commands
2
-
3
- `createAgentTools` turns a table's tool masks into framework-agnostic tool
4
- records `{ name, description, args, handler }` — directly spreadable into
5
- `@convex-dev/agent`'s `createTool`, adaptable to ai-sdk `tool()`, and the
6
- kit depends on neither (shape checked against `@convex-dev/agent@0.6.x`;
7
- re-verify at install).
8
-
9
- The point is the routing, not the shape: **mutation handlers go through
10
- command executors**, so every agent action is validated, guarded, audited,
11
- and observed. An agent never gets raw db access.
12
-
13
- ```ts
14
- import { createAgentTools } from 'cvx-kit/agent-tools'
15
-
16
- const tools = createAgentTools(<entities>, {
17
- // mutations — audited commands (createCrudCommands executors fit exactly):
18
- create: (ctx, input) => crud.executeCreate(ctx, input),
19
- update: (ctx, input) => crud.executeUpdate(ctx, input),
20
- archive: (ctx, input) => crud.executeArchive(ctx, input),
21
- // reads — caller-supplied query handlers (reads don't route through commands):
22
- get: (ctx, { id }) => loadDto(ctx, id),
23
- list: (ctx, { paginationOpts }) => listPage(ctx, paginationOpts),
24
- })
25
-
26
- // host-side, with @convex-dev/agent:
27
- // const agentTools = Object.fromEntries(Object.values(tools).map((t) =>
28
- // [t.name, createTool({ description: t.description, args: t.args, handler: t.handler })]))
29
- ```
30
-
31
- ## Contracts
32
-
33
- - **Args are the table masks, no drift**: `create` = `tools.insert`
34
- (`commandFields`), `update` = `tools.update`, `archive`/`get` = `tools.id`,
35
- `list` = the pagination opts boundary. Ids present as plain strings in
36
- generated JSON schemas (`jsonSafeZid`) while keeping `Id<...>` types.
37
- - **Only the kinds you supply handlers for are emitted**; names are
38
- `<tableName>_<verb>`; descriptions are derived and overridable via
39
- `options.descriptions`.
40
- - DTO discipline applies to reads: `get`/`list` handlers should return
41
- `toPublicDto`-projected data, same as any public query.