@beignet/core 0.0.34 → 0.0.35

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 (120) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +142 -15
  3. package/dist/agent-capabilities/index.d.ts +167 -0
  4. package/dist/agent-capabilities/index.d.ts.map +1 -0
  5. package/dist/agent-capabilities/index.js +275 -0
  6. package/dist/agent-capabilities/index.js.map +1 -0
  7. package/dist/application/index.d.ts +2 -2
  8. package/dist/application/index.d.ts.map +1 -1
  9. package/dist/application/index.js +13 -3
  10. package/dist/application/index.js.map +1 -1
  11. package/dist/client/client.d.ts +2 -0
  12. package/dist/client/client.d.ts.map +1 -1
  13. package/dist/client/client.js +33 -16
  14. package/dist/client/client.js.map +1 -1
  15. package/dist/contracts/contract-builder.d.ts +5 -3
  16. package/dist/contracts/contract-builder.d.ts.map +1 -1
  17. package/dist/contracts/contract-builder.js +3 -12
  18. package/dist/contracts/contract-builder.js.map +1 -1
  19. package/dist/contracts/contract-group.d.ts +2 -2
  20. package/dist/contracts/contract-group.d.ts.map +1 -1
  21. package/dist/contracts/contract-group.js +2 -1
  22. package/dist/contracts/contract-group.js.map +1 -1
  23. package/dist/contracts/metadata.d.ts +3 -0
  24. package/dist/contracts/metadata.d.ts.map +1 -0
  25. package/dist/contracts/metadata.js +14 -0
  26. package/dist/contracts/metadata.js.map +1 -0
  27. package/dist/contracts/types.d.ts +20 -0
  28. package/dist/contracts/types.d.ts.map +1 -1
  29. package/dist/contracts/types.js.map +1 -1
  30. package/dist/events/index.d.ts +4 -4
  31. package/dist/events/index.d.ts.map +1 -1
  32. package/dist/events/index.js +5 -5
  33. package/dist/events/index.js.map +1 -1
  34. package/dist/idempotency/index.d.ts.map +1 -1
  35. package/dist/idempotency/index.js +14 -9
  36. package/dist/idempotency/index.js.map +1 -1
  37. package/dist/jobs/index.d.ts.map +1 -1
  38. package/dist/jobs/index.js +10 -4
  39. package/dist/jobs/index.js.map +1 -1
  40. package/dist/openapi/index.js +15 -8
  41. package/dist/openapi/index.js.map +1 -1
  42. package/dist/ports/auth.d.ts +2 -0
  43. package/dist/ports/auth.d.ts.map +1 -1
  44. package/dist/ports/auth.js +2 -0
  45. package/dist/ports/auth.js.map +1 -1
  46. package/dist/providers/index.d.ts +1 -1
  47. package/dist/providers/index.d.ts.map +1 -1
  48. package/dist/providers/index.js.map +1 -1
  49. package/dist/providers/provider.d.ts +9 -1
  50. package/dist/providers/provider.d.ts.map +1 -1
  51. package/dist/providers/provider.js.map +1 -1
  52. package/dist/schedules/index.d.ts +6 -13
  53. package/dist/schedules/index.d.ts.map +1 -1
  54. package/dist/schedules/index.js +24 -44
  55. package/dist/schedules/index.js.map +1 -1
  56. package/dist/server/index.d.ts +2 -2
  57. package/dist/server/index.d.ts.map +1 -1
  58. package/dist/server/index.js +1 -1
  59. package/dist/server/index.js.map +1 -1
  60. package/dist/server/request-executor.d.ts +72 -0
  61. package/dist/server/request-executor.d.ts.map +1 -0
  62. package/dist/server/request-executor.js +781 -0
  63. package/dist/server/request-executor.js.map +1 -0
  64. package/dist/server/request-preparation.d.ts +39 -0
  65. package/dist/server/request-preparation.d.ts.map +1 -0
  66. package/dist/server/request-preparation.js +248 -0
  67. package/dist/server/request-preparation.js.map +1 -0
  68. package/dist/server/response-finalization.d.ts +34 -0
  69. package/dist/server/response-finalization.d.ts.map +1 -0
  70. package/dist/server/response-finalization.js +279 -0
  71. package/dist/server/response-finalization.js.map +1 -0
  72. package/dist/server/route-definitions.d.ts +139 -0
  73. package/dist/server/route-definitions.d.ts.map +1 -0
  74. package/dist/server/route-definitions.js +94 -0
  75. package/dist/server/route-definitions.js.map +1 -0
  76. package/dist/server/route-matching.d.ts +15 -0
  77. package/dist/server/route-matching.d.ts.map +1 -0
  78. package/dist/server/route-matching.js +46 -0
  79. package/dist/server/route-matching.js.map +1 -0
  80. package/dist/server/server.d.ts +6 -147
  81. package/dist/server/server.d.ts.map +1 -1
  82. package/dist/server/server.js +29 -1350
  83. package/dist/server/server.js.map +1 -1
  84. package/dist/server/use-case-route.d.ts +1 -1
  85. package/dist/tracing/index.d.ts +1 -1
  86. package/dist/tracing/index.d.ts.map +1 -1
  87. package/dist/tracing/index.js.map +1 -1
  88. package/dist/uploads/client.js +4 -7
  89. package/dist/uploads/client.js.map +1 -1
  90. package/dist/uploads/index.d.ts.map +1 -1
  91. package/dist/uploads/index.js +59 -12
  92. package/dist/uploads/index.js.map +1 -1
  93. package/package.json +5 -1
  94. package/skills/app-architecture/SKILL.md +23 -1
  95. package/src/agent-capabilities/index.ts +578 -0
  96. package/src/application/index.ts +19 -5
  97. package/src/client/client.ts +41 -17
  98. package/src/contracts/contract-builder.ts +8 -16
  99. package/src/contracts/contract-group.ts +4 -6
  100. package/src/contracts/metadata.ts +20 -0
  101. package/src/contracts/types.ts +39 -0
  102. package/src/events/index.ts +16 -20
  103. package/src/idempotency/index.ts +17 -9
  104. package/src/jobs/index.ts +8 -3
  105. package/src/openapi/index.ts +24 -12
  106. package/src/ports/auth.ts +2 -0
  107. package/src/providers/index.ts +1 -0
  108. package/src/providers/provider.ts +17 -2
  109. package/src/schedules/index.ts +57 -63
  110. package/src/server/index.ts +4 -2
  111. package/src/server/request-executor.ts +1170 -0
  112. package/src/server/request-preparation.ts +409 -0
  113. package/src/server/response-finalization.ts +385 -0
  114. package/src/server/route-definitions.ts +338 -0
  115. package/src/server/route-matching.ts +64 -0
  116. package/src/server/server.ts +63 -2139
  117. package/src/server/use-case-route.ts +1 -1
  118. package/src/tracing/index.ts +1 -0
  119. package/src/uploads/client.ts +4 -7
  120. package/src/uploads/index.ts +70 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @beignet/core
2
2
 
3
+ ## 0.0.35
4
+
5
+ ### Patch Changes
6
+
7
+ - 2101386: Authorize agent capabilities against their exact parsed input and keep custom Agent Auth locations outside the Beignet execution bridge.
8
+ - 2290c4a: Add typed, validated agent capability registries and execution, plus a Better Auth Agent Auth bridge with constraint-safe validation, verified principals, grants, and redacted protocol errors.
9
+ - 42921da: Keep agent capability registries type-safe, observe pre-context failures, and preserve application error codes across Agent Auth execution modes.
10
+ - 2a5b224: Preserve idempotency and outbox delivery guarantees on persistence and handler failures, enforce multipart limits from actual bytes, support Date and JSON query serialization, and add bounded MySQL deadlock backoff.
11
+ - 74aad51: Replace the schedule-specific instrumentation sink with shared provider targets, serve bodyless HEAD responses from GET routes, improve missing JSON content-type diagnostics, and expose the auth error HTTP status.
12
+ - db79263: Align route, listener, auth-provider, and webhook-integration APIs before 1.0. Route declarations now use an app-bound `createRoutes<AppContext>()` builder, listeners put their stable name first, Better Auth exports `createBetterAuthProvider(...)`, and vendor webhook verifiers live in `@beignet/webhooks-*` packages outside provider audits.
13
+ - 397f106: Standardize framework-owned operational errors, degrade opaque OpenAPI path parameters safely, and add direct Redis, Pino, and Upstash adapters.
14
+ - 40f4155: Refresh package-shipped agent guidance for app-bound route builders, configured route-builder paths, webhook integrations, and operational error responses.
15
+ - d1c0efd: Make contract and contract-group OpenAPI metadata compose consistently across `meta()` and `openapi()` calls.
16
+ - c403db2: Isolate use-case observers, authenticate operational routes before context creation, honor configured generated-test roots, correct feature-helper linting, preserve optional OpenAPI descriptions, and keep upload resets stable.
17
+ - 4cc5254: Decompose the server runtime into focused internal modules while preserving the existing public API and request behavior.
18
+ - 7d0c795: Expose stable named provider types while keeping private config schemas out of package declarations and preserving validated config and contributed-port inference. Drizzle's Postgres and MySQL config schema constants are now internal; use the exported config interfaces for validated shapes.
19
+
3
20
  ## 0.0.34
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  > evaluation, and APIs may change between releases while the framework settles.
8
8
 
9
9
  This package provides Beignet's framework primitives: contracts, server runtime,
10
- typed client, use cases, ports, domain helpers, app errors, config, events,
10
+ typed client, use cases, agent capabilities, ports, domain helpers, app errors, config, events,
11
11
  idempotency, locks, outbox, mail, notifications, payments, search, webhooks,
12
12
  feature flags, error reporting, schedules, uploads, entitlements, pagination
13
13
  helpers, testing helpers, and OpenAPI generation.
@@ -46,6 +46,7 @@ name the framework area they depend on.
46
46
 
47
47
  | Import path | Responsibility |
48
48
  | --- | --- |
49
+ | `@beignet/core/agent-capabilities` | Typed agent capability definitions, registries, validation, and execution |
49
50
  | `@beignet/core/application` | Use case builder and test helpers |
50
51
  | `@beignet/core/client` | Typed HTTP client |
51
52
  | `@beignet/core/client-only` | Static lint marker for modules intended for client-side imports |
@@ -89,6 +90,74 @@ import "@beignet/core/client-only";
89
90
  import "@beignet/core/server-only";
90
91
  ```
91
92
 
93
+ ## Agent capabilities
94
+
95
+ Agent capabilities are validated application entrypoints for authenticated AI
96
+ agent transports. Definitions remain transport-neutral and should delegate
97
+ business behavior to the same use cases called by HTTP routes, jobs, and
98
+ scripts.
99
+
100
+ ```typescript
101
+ import {
102
+ createAgentCapabilities,
103
+ createAgentCapabilityExecutor,
104
+ } from "@beignet/core/agent-capabilities";
105
+ import { z } from "zod";
106
+ import type { AppContext } from "@/app-context";
107
+ import { createIssueUseCase } from "@/features/issues/use-cases";
108
+
109
+ type AgentPrincipal = { agentId: string; userId: string };
110
+
111
+ const { defineAgentCapability, defineAgentCapabilityRegistry } =
112
+ createAgentCapabilities<AppContext, AgentPrincipal>();
113
+
114
+ const createIssue = defineAgentCapability("issues.create", {
115
+ description: "Create an issue in one workspace.",
116
+ input: z.object({ workspaceId: z.string(), title: z.string().min(1) }),
117
+ output: z.object({ id: z.string(), title: z.string() }),
118
+ async handle({ ctx, input }) {
119
+ const { workspaceId: _workspaceId, ...useCaseInput } = input;
120
+ return createIssueUseCase.run({ ctx, input: useCaseInput });
121
+ },
122
+ });
123
+
124
+ const registry = defineAgentCapabilityRegistry([createIssue]);
125
+
126
+ export const executor = createAgentCapabilityExecutor({
127
+ registry,
128
+ async createContext({ principal, input }) {
129
+ const membership = await server.ports.members.findMembership({
130
+ workspaceId: input.workspaceId,
131
+ userId: principal.userId,
132
+ });
133
+ if (!membership) throw new Error("Not a workspace member");
134
+
135
+ return server.createServiceContext({
136
+ asUser: { id: principal.userId, role: membership.role },
137
+ tenantId: input.workspaceId,
138
+ });
139
+ },
140
+ });
141
+ ```
142
+
143
+ Input is validated before `createContext(...)` runs. Output is validated before
144
+ it reaches the transport. Context construction remains app-owned: authenticate
145
+ the transport first, re-read tenant membership from an authoritative port, and
146
+ call `server.createServiceContext(...)` instead of assembling `AppContext` by
147
+ hand. Use `@beignet/agent-auth-better-auth` to expose a registry through Better
148
+ Auth Agent Auth.
149
+
150
+ Registry creation comes from the same app-bound factory as
151
+ `defineAgentCapability`, so definitions with another context or principal type
152
+ are rejected. Executor hooks observe the complete attempt and include a
153
+ `stage`; `ctx` is undefined until context construction succeeds. Dynamic
154
+ transport adapters may provide `authorize(...)` to inspect the exact parsed
155
+ input before context construction without causing a second validation pass. Pass
156
+ an independent `instrumentation` target and `tracing` port to the executor when
157
+ lookup, input-validation, and context failures must be visible before an app
158
+ context exists. Without those options, successful context construction lets
159
+ the executor derive observability ports from `ctx`.
160
+
92
161
  ## Durable failure language
93
162
 
94
163
  Jobs, outbox delivery, and schedule runners use the same terms:
@@ -229,6 +298,13 @@ import type { providers } from "@/server/providers";
229
298
  export type AppRuntimePorts = AppPorts & InferProviderPorts<typeof providers>;
230
299
  ```
231
300
 
301
+ Reusable provider packages should export a named `ServiceProvider` return type
302
+ and use `AnyProviderConfigSchema<Config>` for its config generic. That keeps a
303
+ private Zod or other Standard Schema implementation out of the package
304
+ declaration while preserving the validated config output and exact
305
+ contributed-port inference. App-local providers should keep their concrete
306
+ schema inference because they do not have a package compatibility boundary.
307
+
232
308
  App-local providers can declare required ports, app context, and
233
309
  service-context input through the curried `createProvider()` form. `setup`
234
310
  then receives typed `ports` and a `createServiceContext` factory that returns
@@ -549,6 +625,15 @@ can compute the digest before `prepare`. Use `verifyFile(...)` for app-owned
549
625
  scanning, moderation, and quarantine decisions that run after the object exists
550
626
  in storage and before `onComplete(...)`.
551
627
 
628
+ `createUploadRouter(...)` bounds JSON request bodies and server-handled
629
+ multipart bodies. Multipart limits are enforced against both a declared
630
+ `Content-Length` and the bytes actually read, so chunked requests cannot bypass
631
+ `limits.multipartMaxBytes` before `formData()` parsing.
632
+
633
+ Upload route failures use Beignet's flat `{ code, message, details? }` error
634
+ body. The typed upload client maps that response to `UploadClientError` with
635
+ the same code, status, and details.
636
+
552
637
  ## Webhooks
553
638
 
554
639
  Use `@beignet/core/webhooks` for provider-neutral inbound webhook definitions,
@@ -584,8 +669,8 @@ export const issueWebhook = defineWebhook("issues.provider", {
584
669
 
585
670
  Use `createMemoryWebhookVerifier(...)` in tests and `createWebhookRoute(...)`
586
671
  from `@beignet/next` to expose raw-body webhook routes in Next.js apps. Use a
587
- provider package such as `@beignet/provider-webhooks-github` or
588
- `@beignet/provider-webhooks-stripe` when a vendor has signature semantics beyond
672
+ provider package such as `@beignet/webhooks-github` or
673
+ `@beignet/webhooks-stripe` when a vendor has signature semantics beyond
589
674
  the generic HMAC verifier. For billing flows backed by `ctx.ports.payments`,
590
675
  use `@beignet/core/payments` with `createPaymentWebhookRoute(...)` from
591
676
  `@beignet/next` instead of a generic webhook catalog.
@@ -780,10 +865,14 @@ may only be registered once, contract names must be unique across the route
780
865
  registry because typed clients, OpenAPI operations, and devtools key on them,
781
866
  and an introspectable `.pathParams(...)` object schema must declare exactly the
782
867
  `:param` keys from the path template. Mismatches fail server startup with the
783
- contract name and path. At dispatch time, a request that matches a registered
868
+ contract name and path. Opaque Standard Schemas skip that registration-time key
869
+ comparison; OpenAPI falls back to required string parameters from the literal
870
+ path template unless a custom schema introspector is supplied. At dispatch
871
+ time, a request that matches a registered
784
872
  path with an unregistered method receives a framework-owned `405
785
873
  METHOD_NOT_ALLOWED` response with an `Allow` header listing the registered
786
- methods; `HEAD` is intentionally not served by `GET` handlers.
874
+ methods. `GET` routes also serve `HEAD` when no explicit `HEAD` route exists;
875
+ explicit `HEAD` routes take precedence, and every `HEAD` response is bodyless.
787
876
 
788
877
  ### Runtime integrity
789
878
 
@@ -844,6 +933,10 @@ the returned handler at the route's own path.
844
933
  Use `.headers(...)` for request headers that are part of the endpoint contract. Declare header keys in lowercase; server and client runtime matching is case-insensitive.
845
934
 
846
935
  Request bodies are supported for `POST`, `PUT`, and `PATCH` contracts only.
936
+ JSON bodies require `Content-Type: application/json`; otherwise the runtime
937
+ passes the body to validation as text. When a missing content type accompanies
938
+ a valid JSON object or array that fails validation, the framework-owned error
939
+ includes a targeted `details.hint` without changing the response code.
847
940
 
848
941
  If you do not pass `name`, Beignet generates one from the HTTP method and full path:
849
942
 
@@ -1519,6 +1612,11 @@ a transaction-scoped `tx.idempotency` port from the app Unit of Work so
1519
1612
  reservation, business writes, audit records, domain-event records, and
1520
1613
  idempotency completion commit together.
1521
1614
 
1615
+ `runIdempotently(...)` releases a reservation only when the protected work
1616
+ throws. If the work succeeds but `complete(...)` fails, the reservation stays
1617
+ in progress and the completion error is rethrown so an immediate retry cannot
1618
+ repeat the successful work.
1619
+
1522
1620
  ### Outbox
1523
1621
 
1524
1622
  Use `@beignet/core/outbox` when events or jobs must be recorded in the same
@@ -1569,6 +1667,11 @@ await drainOutbox({
1569
1667
  The outbox is at-least-once delivery. Use idempotent listeners or jobs when a
1570
1668
  duplicate delivery would be harmful.
1571
1669
 
1670
+ When an inline dispatcher exposes Beignet's single-attempt delivery hook, an
1671
+ `onError` observer is still notified but cannot swallow the failure. The outbox
1672
+ retains retry and dead-letter ownership instead of marking the message
1673
+ delivered.
1674
+
1572
1675
  Use `OutboxAdminPort` only from operational contexts. It lets `beignet outbox`
1573
1676
  list, show, requeue, purge dead-lettered rows, and prune delivered rows without
1574
1677
  exposing those destructive operations to transaction-scoped use cases.
@@ -1585,7 +1688,7 @@ import { createInlineScheduleRunner } from "@beignet/core/schedules";
1585
1688
 
1586
1689
  const runner = createInlineScheduleRunner<AppContext>({
1587
1690
  ctx,
1588
- instrumentation: ctx.ports.devtools,
1691
+ instrumentation: ctx.ports,
1589
1692
  instrumentationContext: {
1590
1693
  requestId: ctx.requestId,
1591
1694
  traceId: ctx.traceId,
@@ -1596,9 +1699,10 @@ await runner.run(SendDailyDigestSchedule, { source: "vercel-cron" });
1596
1699
  ```
1597
1700
 
1598
1701
  `instrumentationContext` attaches request correlation fields to recorded
1599
- events. Recording failures are isolated from schedule execution and reported
1600
- to `onHookError` when provided. Handler failures still reject `runner.run(...)`
1601
- after `onError` runs so trigger hosts can retry.
1702
+ events. The shared provider instrumentation helper applies watcher checks,
1703
+ redaction, and sink-failure isolation. Lifecycle hook failures still reach
1704
+ `onHookError` when provided. Handler failures reject `runner.run(...)` after
1705
+ `onError` runs so trigger hosts can retry.
1602
1706
 
1603
1707
  ### Contract metadata and route hooks
1604
1708
 
@@ -1631,8 +1735,13 @@ install `createRateLimitHooks(...)` and `createIdempotencyHooks(...)` where the
1631
1735
  server is composed. Use route hooks for runtime enforcement of route-specific
1632
1736
  policy where the route is wired:
1633
1737
 
1738
+ Bind route declarations to the app context once in `lib/routes.ts` with
1739
+ `createRoutes<AppContext>()`, then import the resulting builders in feature
1740
+ route files.
1741
+
1634
1742
  ```ts
1635
- import { createAuthHooks, defineRouteGroup } from "@beignet/core/server";
1743
+ import { createAuthHooks } from "@beignet/core/server";
1744
+ import { defineRouteGroup } from "@/lib/routes";
1636
1745
  import type { AppContext } from "@/app-context";
1637
1746
 
1638
1747
  const auth = createAuthHooks<AppContext>()({
@@ -1641,7 +1750,7 @@ const auth = createAuthHooks<AppContext>()({
1641
1750
  },
1642
1751
  });
1643
1752
 
1644
- export const messageRoutes = defineRouteGroup<AppContext>()({
1753
+ export const messageRoutes = defineRouteGroup({
1645
1754
  name: "messages",
1646
1755
  routes: [
1647
1756
  {
@@ -1663,7 +1772,7 @@ contract's sole request schema by reference, the server skips the use case's
1663
1772
  input re-parse — one schema, one parse.
1664
1773
 
1665
1774
  Use `{ contract, handle }` as the escape hatch for response headers,
1666
- streaming, and multi-status responses. `defineRoute<AppContext>()` remains
1775
+ streaming, and multi-status responses. `defineRoute` remains
1667
1776
  available for full handlers that read hook-added `ctx` fields.
1668
1777
 
1669
1778
  When credentials live in request headers, declare a `headers` schema on the
@@ -1857,6 +1966,10 @@ port is installed, it also creates an active child span. Pass
1857
1966
  `instrumentation: false` to opt out of instrumentation events; tracing is
1858
1967
  controlled by whether the app installs `ports.tracing`.
1859
1968
 
1969
+ App-owned `onRun` observers are best-effort. Synchronous throws and rejected
1970
+ observer promises are ignored so instrumentation cannot fail a use case or
1971
+ replace its original error.
1972
+
1860
1973
  `createInstrumentedAuditLog({ audit, instrumentation })` from
1861
1974
  `@beignet/core/ports` writes durable audit entries first and mirrors sanitized
1862
1975
  audit activity into the resolved instrumentation sink.
@@ -1918,12 +2031,23 @@ export const getTodo = todos
1918
2031
  });
1919
2032
  ```
1920
2033
 
2034
+ `.openapi(...)` and `.meta({ openapi: ... })` share the same shallow merge
2035
+ semantics. OpenAPI fields from contract groups and earlier calls are preserved,
2036
+ while a later value replaces the same field. Structured fields such as
2037
+ `responses` are replaced as a whole rather than deep-merged. Prefer
2038
+ `.openapi(...)` for operation metadata; use `.meta(...)` when composing it with
2039
+ other metadata conventions.
2040
+
1921
2041
  Use `requestBody`, `responses`, and `parameters` overrides when an operation
1922
2042
  needs non-JSON media such as multipart uploads, binary downloads, event streams,
1923
2043
  or cookie parameters. `contractsToOpenAPI(...)` accepts `schemaConverters` for
1924
2044
  non-Zod Standard Schema libraries; custom converters run before Beignet's
1925
2045
  default Zod converter.
1926
2046
 
2047
+ Descriptions attached before `.optional()` are preserved on generated query
2048
+ and header parameters, matching descriptions attached to the outer optional
2049
+ schema.
2050
+
1927
2051
  ### Schema introspection
1928
2052
 
1929
2053
  Contracts expose their schemas for runtime introspection:
@@ -1980,8 +2104,8 @@ standard error envelope.
1980
2104
  | `.body(schema)` | Define request body schema |
1981
2105
  | `.responses({ ... })` | Define or merge response schemas by status code |
1982
2106
  | `.errors({ ... })` | Declare route-owned catalog errors using Beignet's standard error envelope; merges with group and earlier declarations |
1983
- | `.meta(metadata)` | Add custom metadata |
1984
- | `.openapi(options)` | Add OpenAPI metadata (summary, tags, etc.) |
2107
+ | `.meta(metadata)` | Merge custom metadata; nested `openapi` fields merge one level deep |
2108
+ | `.openapi(options)` | Merge OpenAPI metadata (summary, tags, etc.) |
1985
2109
 
1986
2110
  ## Standard Schema support
1987
2111
 
@@ -1991,7 +2115,10 @@ This package works with any [Standard Schema](https://github.com/standard-schema
1991
2115
  - **Valibot** - Lightweight alternative to Zod
1992
2116
  - **ArkType** - High-performance runtime validation
1993
2117
 
1994
- OpenAPI generation currently requires Zod schemas, even though core contracts can use any Standard Schema-compatible library.
2118
+ OpenAPI generation includes a Zod converter and introspector by default. Other
2119
+ Standard Schema libraries can supply `schemaConverters` and a
2120
+ `schemaIntrospector`; opaque path parameter schemas degrade to required string
2121
+ parameters derived from the contract path.
1995
2122
 
1996
2123
  ## Related packages
1997
2124
 
@@ -0,0 +1,167 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import { type ProviderInstrumentationTarget } from "../providers/index.js";
3
+ import type { TracingPort } from "../tracing/index.js";
4
+ /** Any Standard Schema compatible validator. */
5
+ export type AgentCapabilitySchema = StandardSchemaV1<unknown, unknown>;
6
+ /** Value or promise of that value. */
7
+ export type MaybePromise<T> = T | Promise<T>;
8
+ /** Infer the input accepted by a capability schema. */
9
+ export type InferAgentCapabilitySchemaInput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferInput<Schema>;
10
+ /** Infer the parsed output produced by a capability schema. */
11
+ export type InferAgentCapabilitySchemaOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;
12
+ /** A typed action that an authenticated agent transport may expose. */
13
+ export interface AgentCapabilityDef<Name extends string = string, Input extends AgentCapabilitySchema = AgentCapabilitySchema, Output extends AgentCapabilitySchema = AgentCapabilitySchema, Ctx = unknown, Principal = unknown> {
14
+ readonly kind: "agentCapability";
15
+ readonly name: Name;
16
+ readonly description: string;
17
+ readonly input: Input;
18
+ readonly output: Output;
19
+ readonly handle: (args: {
20
+ capability: AgentCapabilityDef<Name, Input, Output, Ctx, Principal>;
21
+ ctx: Ctx;
22
+ principal: Principal;
23
+ input: InferAgentCapabilitySchemaOutput<Input>;
24
+ }) => MaybePromise<InferAgentCapabilitySchemaInput<Output>>;
25
+ }
26
+ /** Broad capability definition shape tied to one context and principal. */
27
+ export interface AgentCapabilityFor<Ctx, Principal> {
28
+ readonly kind: "agentCapability";
29
+ readonly name: string;
30
+ readonly description: string;
31
+ readonly input: AgentCapabilitySchema;
32
+ readonly output: AgentCapabilitySchema;
33
+ readonly handle: (args: {
34
+ capability: never;
35
+ ctx: Ctx;
36
+ principal: Principal;
37
+ input: never;
38
+ }) => MaybePromise<unknown>;
39
+ }
40
+ /** Broad capability definition shape used by registries and adapters. */
41
+ export type AnyAgentCapabilityDef = AgentCapabilityFor<never, never>;
42
+ /** Infer a capability's application context. */
43
+ export type AgentCapabilityContext<Capability extends AnyAgentCapabilityDef> = Capability extends {
44
+ handle(args: {
45
+ ctx: infer Ctx;
46
+ }): unknown;
47
+ } ? Ctx : never;
48
+ /** Infer a capability's verified principal. */
49
+ export type AgentCapabilityPrincipal<Capability extends AnyAgentCapabilityDef> = Capability extends {
50
+ handle(args: {
51
+ principal: infer Principal;
52
+ }): unknown;
53
+ } ? Principal : never;
54
+ /** Infer a capability's raw input. */
55
+ export type AgentCapabilityInput<Capability extends AnyAgentCapabilityDef> = InferAgentCapabilitySchemaInput<Capability["input"]>;
56
+ /** Infer a capability's validated output. */
57
+ export type AgentCapabilityOutput<Capability extends AnyAgentCapabilityDef> = InferAgentCapabilitySchemaOutput<Capability["output"]>;
58
+ /** Options accepted by `defineAgentCapability(...)`. */
59
+ export interface DefineAgentCapabilityOptions<Name extends string, Input extends AgentCapabilitySchema, Output extends AgentCapabilitySchema, Ctx, Principal> {
60
+ description: string;
61
+ input: Input;
62
+ output: Output;
63
+ handle(args: {
64
+ capability: AgentCapabilityDef<Name, Input, Output, Ctx, Principal>;
65
+ ctx: Ctx;
66
+ principal: Principal;
67
+ input: InferAgentCapabilitySchemaOutput<Input>;
68
+ }): MaybePromise<InferAgentCapabilitySchemaInput<Output>>;
69
+ }
70
+ /** Context-bound capability definition helpers. */
71
+ export interface AgentCapabilities<Ctx, Principal> {
72
+ defineAgentCapability<const Name extends string, Input extends AgentCapabilitySchema, Output extends AgentCapabilitySchema>(name: Name, options: DefineAgentCapabilityOptions<Name, Input, Output, Ctx, Principal>): AgentCapabilityDef<Name, Input, Output, Ctx, Principal>;
73
+ defineAgentCapabilityRegistry<const Definitions extends readonly AgentCapabilityFor<Ctx, Principal>[]>(definitions: Definitions): AgentCapabilityRegistry<Definitions>;
74
+ }
75
+ /** Bind application context and principal types once for capability definitions. */
76
+ export declare function createAgentCapabilities<Ctx, Principal>(): AgentCapabilities<Ctx, Principal>;
77
+ /** Error thrown when a capability registry is ambiguous. */
78
+ export declare class AgentCapabilityRegistryError extends Error {
79
+ constructor(message: string);
80
+ }
81
+ /** Registered capability definitions available to execution adapters. */
82
+ export interface AgentCapabilityRegistry<Definitions extends readonly AnyAgentCapabilityDef[] = readonly AnyAgentCapabilityDef[]> {
83
+ readonly definitions: Definitions;
84
+ get(name: string): Definitions[number] | undefined;
85
+ }
86
+ /** Stable capability execution failure categories. */
87
+ export type AgentCapabilityErrorCode = "unknown_capability" | "invalid_input" | "invalid_output" | "execution_failed";
88
+ /** Error raised by capability lookup, validation, or execution. */
89
+ export declare class AgentCapabilityError extends Error {
90
+ readonly code: AgentCapabilityErrorCode;
91
+ readonly capabilityName: string;
92
+ readonly issues?: readonly StandardSchemaV1.Issue[];
93
+ readonly cause?: unknown;
94
+ constructor(args: {
95
+ code: AgentCapabilityErrorCode;
96
+ capabilityName: string;
97
+ message: string;
98
+ issues?: readonly StandardSchemaV1.Issue[];
99
+ cause?: unknown;
100
+ });
101
+ }
102
+ /** A parsed invocation passed to the app-owned context resolver. */
103
+ export type AgentCapabilityContextRequest<Definitions extends readonly AnyAgentCapabilityDef[], Principal> = {
104
+ [Capability in Definitions[number] as Capability["name"]]: {
105
+ capability: Capability;
106
+ name: Capability["name"];
107
+ principal: Principal;
108
+ input: InferAgentCapabilitySchemaOutput<Capability["input"]>;
109
+ };
110
+ }[Definitions[number]["name"]];
111
+ /** Stage reached by an agent capability attempt. */
112
+ export type AgentCapabilityRunStage = "lookup" | "input" | "authorization" | "context" | "handler" | "output";
113
+ /** Lifecycle event observed around a capability attempt. */
114
+ export interface AgentCapabilityRunEvent<Ctx, Principal> {
115
+ name: string;
116
+ phase: "start" | "end" | "error";
117
+ stage: AgentCapabilityRunStage;
118
+ ctx?: Ctx;
119
+ principal: Principal;
120
+ durationMs?: number;
121
+ error?: unknown;
122
+ }
123
+ /** Best-effort lifecycle observer for capability execution. */
124
+ export type AgentCapabilityHook<Ctx, Principal> = (event: AgentCapabilityRunEvent<Ctx, Principal>) => MaybePromise<void>;
125
+ /** Options for a capability executor. */
126
+ export interface CreateAgentCapabilityExecutorOptions<Ctx, Principal, Definitions extends readonly AnyAgentCapabilityDef[]> {
127
+ registry: AgentCapabilityRegistry<Definitions>;
128
+ createContext(request: AgentCapabilityContextRequest<Definitions, Principal>): MaybePromise<Ctx>;
129
+ hooks?: readonly AgentCapabilityHook<Ctx, Principal>[];
130
+ /** Independent target used to observe failures before context exists. */
131
+ instrumentation?: ProviderInstrumentationTarget;
132
+ tracing?: TracingPort;
133
+ }
134
+ /** Raw dynamic invocation accepted by protocol adapters. */
135
+ export interface DynamicAgentCapabilityInvocation<Principal> {
136
+ name: string;
137
+ principal: Principal;
138
+ input: unknown;
139
+ /**
140
+ * Transport-owned authorization against the exact parsed input that will be
141
+ * passed to context construction and the capability handler.
142
+ */
143
+ authorize?(request: DynamicAgentCapabilityAuthorization<Principal>): MaybePromise<void>;
144
+ }
145
+ /** Parsed invocation exposed to a dynamic transport authorization callback. */
146
+ export interface DynamicAgentCapabilityAuthorization<Principal> {
147
+ capability: AnyAgentCapabilityDef;
148
+ name: string;
149
+ principal: Principal;
150
+ input: unknown;
151
+ }
152
+ /** Typed and dynamic execution surface for one capability registry. */
153
+ export interface AgentCapabilityExecutor<Principal, Definitions extends readonly AnyAgentCapabilityDef[]> {
154
+ execute<Name extends Definitions[number]["name"]>(args: {
155
+ name: Name;
156
+ principal: Principal;
157
+ input: AgentCapabilityInput<Extract<Definitions[number], {
158
+ name: Name;
159
+ }>>;
160
+ }): Promise<AgentCapabilityOutput<Extract<Definitions[number], {
161
+ name: Name;
162
+ }>>>;
163
+ executeDynamic(args: DynamicAgentCapabilityInvocation<Principal>): Promise<unknown>;
164
+ }
165
+ /** Create a validated, traced executor for a capability registry. */
166
+ export declare function createAgentCapabilityExecutor<const Definitions extends readonly AnyAgentCapabilityDef[]>(options: CreateAgentCapabilityExecutorOptions<AgentCapabilityContext<Definitions[number]>, AgentCapabilityPrincipal<Definitions[number]>, Definitions>): AgentCapabilityExecutor<AgentCapabilityPrincipal<Definitions[number]>, Definitions>;
167
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent-capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,gDAAgD;AAChD,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAEvE,sCAAsC;AACtC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7C,uDAAuD;AACvD,MAAM,MAAM,+BAA+B,CAAC,MAAM,SAAS,gBAAgB,IACzE,gBAAgB,CAAC,UAAU,CAAC,MAAM,CAAC,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