capable-kit 0.0.1-alpha.8 → 0.1.0-alpha.10
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.
- package/CHANGELOG.md +214 -0
- package/README.md +6 -0
- package/dist/ai-sdk.d.mts +3 -3
- package/dist/ai-sdk.mjs +9 -7
- package/dist/ai-sdk.mjs.map +1 -1
- package/dist/app.d.mts +2 -2
- package/dist/app.mjs +2 -2
- package/dist/bin.mjs +4 -4
- package/dist/cli.d.mts +9 -1
- package/dist/cli.mjs +1 -1
- package/dist/core.d.mts +3 -3
- package/dist/core.mjs +1 -1
- package/dist/eve.d.mts +82 -5
- package/dist/eve.mjs +364 -23
- package/dist/eve.mjs.map +1 -1
- package/dist/http.d.mts +1 -1
- package/dist/http.mjs +1 -1
- package/dist/{index-F4ba_olD.d.mts → index-1A44jLuE.d.mts} +54 -16
- package/dist/{index-Dl4NK9G0.d.mts → index-CHuCLJIs.d.mts} +3 -3
- package/dist/{index-hdH_K5Zc.d.mts → index-D-NV4PiU.d.mts} +4 -4
- package/dist/{index-_qKFfWV4.d.mts → index-WiBWfyTn.d.mts} +63 -26
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/mcp.d.mts +7 -2
- package/dist/mcp.mjs +1 -1
- package/dist/{mount-CEFAplR5.mjs → mount-BmLHp349.mjs} +16 -8
- package/dist/mount-BmLHp349.mjs.map +1 -0
- package/dist/react-query.d.mts +2 -2
- package/dist/react-query.mjs +1 -1
- package/dist/react-query.mjs.map +1 -1
- package/dist/runtime-support.d.mts +1 -1
- package/dist/runtime-support.mjs +3 -3
- package/dist/server.d.mts +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{src-D_0PIhqq.mjs → src-3LE9S4QE.mjs} +67 -38
- package/dist/src-3LE9S4QE.mjs.map +1 -0
- package/dist/{src-D-cm2gQ6.mjs → src-B2WeUwUT.mjs} +64 -32
- package/dist/src-B2WeUwUT.mjs.map +1 -0
- package/dist/{src-BWxDO2Ua.mjs → src-C5jGDnuu.mjs} +3 -3
- package/dist/{src-BWxDO2Ua.mjs.map → src-C5jGDnuu.mjs.map} +1 -1
- package/dist/src-DePlcG_t.mjs +787 -0
- package/dist/src-DePlcG_t.mjs.map +1 -0
- package/dist/{src-rkr5j_NH.mjs → src-_6OmFRYa.mjs} +28 -10
- package/dist/src-_6OmFRYa.mjs.map +1 -0
- package/dist/{subscription-B-auXJbm.d.mts → subscription-DPdwovhw.d.mts} +2 -2
- package/dist/swr.d.mts +2 -2
- package/dist/swr.mjs +1 -1
- package/dist/swr.mjs.map +1 -1
- package/docs/CONTEXT.md +39 -20
- package/docs/README.md +3 -0
- package/docs/internal/README.md +3 -0
- package/docs/internal/adr/0001-capability-is-the-semantic-boundary.md +1 -1
- package/docs/internal/adr/0003-capability-reference-customization.md +68 -0
- package/docs/internal/architecture.md +31 -17
- package/docs/internal/capability-first-model.md +126 -17
- package/docs/internal/eve-recovery-validation.md +86 -0
- package/docs/internal/feedback/v-ray/README.md +258 -0
- package/docs/internal/feedback/v-ray/inference.mjs +43 -0
- package/docs/internal/feedback/v-ray/reproduce.mjs +36 -0
- package/docs/internal/implementation-friction.md +386 -1
- package/docs/internal/releases.md +79 -0
- package/docs/site/capable-orpc-and-trpc.mdx +2 -2
- package/docs/site/concepts/apps.mdx +7 -1
- package/docs/site/concepts/architecture.mdx +9 -1
- package/docs/site/concepts/capabilities.mdx +41 -4
- package/docs/site/concepts/errors.mdx +11 -1
- package/docs/site/concepts/presentations.mdx +20 -0
- package/docs/site/patterns/composition.mdx +152 -8
- package/docs/site/patterns/remote-apps.mdx +6 -2
- package/docs/site/patterns/subscriptions.mdx +79 -32
- package/docs/site/quickstart.mdx +1 -1
- package/docs/site/reference/packages-and-entry-points.mdx +50 -3
- package/docs/site/surfaces/cli.mdx +44 -0
- package/docs/site/surfaces/eve.mdx +65 -18
- package/docs/site/surfaces/typescript.mdx +3 -3
- package/package-docs.mjs +3 -0
- package/package.json +10 -11
- package/src/bin.ts +0 -0
- package/src/index.test.ts +2 -1
- package/src/index.ts +6 -1
- package/src/package.test.ts +9 -0
- package/dist/mount-CEFAplR5.mjs.map +0 -1
- package/dist/src-D-cm2gQ6.mjs.map +0 -1
- package/dist/src-D_0PIhqq.mjs.map +0 -1
- package/dist/src-betOfnDL.mjs +0 -481
- package/dist/src-betOfnDL.mjs.map +0 -1
- package/dist/src-rkr5j_NH.mjs.map +0 -1
|
@@ -3,6 +3,125 @@
|
|
|
3
3
|
This is a live engineering log. Record awkward, unexpectedly heavy,
|
|
4
4
|
duplicated, or leaky implementation work as it appears.
|
|
5
5
|
|
|
6
|
+
## 2026-09-10 — App policy must share error inheritance and Context inference
|
|
7
|
+
|
|
8
|
+
- **Observed:** Central authorization needs both middleware and declared errors
|
|
9
|
+
at the app root. Attaching only middleware turns undeclared denials into
|
|
10
|
+
internal errors. Mixing Context-free and contextual capabilities also made
|
|
11
|
+
the existing Context intersection collapse to `never`.
|
|
12
|
+
- **Current choice:** Seed the existing located-capability traversal with app
|
|
13
|
+
middleware and errors. Ignore Context-free requirements when deriving the
|
|
14
|
+
shared Context for apps and Groups, and retain `undefined` when no capability
|
|
15
|
+
requires Context.
|
|
16
|
+
Infer middleware Context from separately declared capabilities; deeply nested
|
|
17
|
+
inline capability callbacks can prevent TypeScript from inferring it. Guard
|
|
18
|
+
fully erased recursive tree types so failed inference yields `unknown`, not
|
|
19
|
+
unbounded recursion. Typed dictionaries still contribute their value types.
|
|
20
|
+
- **Follow-up:** Keep future Resource work separate. This API consumes the
|
|
21
|
+
current Context contract and does not introduce a typed transformation chain.
|
|
22
|
+
|
|
23
|
+
## 2026-09-11 — String keys do not imply erased Capability types
|
|
24
|
+
|
|
25
|
+
- **Observed:** The Context recursion guard treated every string-indexed tree
|
|
26
|
+
as unknown. `Record<string, typeof secured>` therefore accepted a provider
|
|
27
|
+
missing the user required by `secured`, and execution failed at runtime.
|
|
28
|
+
- **Current choice:** Stop traversal only for trees broad enough to accept the
|
|
29
|
+
full recursive `CapabilityTree`. Traverse known dictionary values normally.
|
|
30
|
+
Compile-time tests reject missing and incorrect providers through both
|
|
31
|
+
dictionaries and Groups; erased trees still terminate with `unknown`.
|
|
32
|
+
|
|
33
|
+
## 2026-09-10 — Group authentication does not prove a handler has a user
|
|
34
|
+
|
|
35
|
+
- **Observed:** Auth-todo handlers used `context.user!` after a Group check.
|
|
36
|
+
Standalone execution skips that Group, including its authentication errors.
|
|
37
|
+
- **Current choice:** Each handler calls a small user-check helper and declares
|
|
38
|
+
its authentication error. Removed the redundant Group check: keeping it
|
|
39
|
+
without Group errors would make its contract depend on every child declaring
|
|
40
|
+
that error, while declaring the same error at both scopes is disallowed.
|
|
41
|
+
Standalone calls now return `UNAUTHENTICATED` before touching the database.
|
|
42
|
+
|
|
43
|
+
## 2026-09-09 — A root CLI Capability loses its own help
|
|
44
|
+
|
|
45
|
+
- **Resolution:** Root empty/help-only invocations keep the app banner and command
|
|
46
|
+
listing, adding the root Capability's arguments and options underneath;
|
|
47
|
+
explicit `--json`/`--watch` selects execution. Duplicate roots are rejected and
|
|
48
|
+
error hints use a token join. Local, remote, defaulted, and no-input roots are
|
|
49
|
+
covered. End-of-options delimiter handling remains deferred.
|
|
50
|
+
|
|
51
|
+
- **Observed:** v-ray uses `meta.cli.command: []` and `positional: ['url']` for
|
|
52
|
+
`pnpm cli vercel.com`. Execution works, but empty/help-only arguments enter
|
|
53
|
+
generic root help before command matching. `['--help', '--']` reaches detailed
|
|
54
|
+
help only because help bypasses parsing; ordinary `--` is rejected.
|
|
55
|
+
- **Why it matters:** Consumers need argument rewriting for a supported command
|
|
56
|
+
mapping. `--json` alone also returns human help successfully, and root usage
|
|
57
|
+
errors include a doubled space before `--help`.
|
|
58
|
+
- **Current choice:** Investigation only; alpha.8 and this worktree reproduce
|
|
59
|
+
identically. No framework behavior changed.
|
|
60
|
+
- **Follow-up:** P1: resolve unique root commands before help dispatch, preserve
|
|
61
|
+
group behavior, and test required/defaulted roots. Decide explicit execution
|
|
62
|
+
behavior and delimiter support separately. See the [review and reproduction](./feedback/v-ray/README.md).
|
|
63
|
+
|
|
64
|
+
## 2026-09-09 — Renderer assignment changes inferred Capability output
|
|
65
|
+
|
|
66
|
+
- **Resolution:** Infer the output type directly instead of extracting it from
|
|
67
|
+
a generic handler. Named renderers now pass in either property position on
|
|
68
|
+
both compilers without losing extra output fields. A `NoInfer` wrapper alone
|
|
69
|
+
did not fix this. Untyped inline renderers before `handler` still infer
|
|
70
|
+
`unknown`; keep them after the handler. Tests cover incompatible renderers,
|
|
71
|
+
async output, output transforms, and subscriptions.
|
|
72
|
+
|
|
73
|
+
- **Review correction:** Inferring through `MaybePromise<TOutput>` rejected
|
|
74
|
+
handlers returning a synchronous string or a `Promise<number>`. Infer the
|
|
75
|
+
complete handler return type first and use `Awaited<TReturn>` for presentation,
|
|
76
|
+
subscription, and canonical output types. Mixed-branch compile assertions and
|
|
77
|
+
runtime tests now cover this regression on both supported compilers.
|
|
78
|
+
|
|
79
|
+
- **Observed:** A named `toPresentation` accepting the handler's result fails
|
|
80
|
+
with TS2769 (`PresentationRenderer<unknown, undefined>`), even after moving it
|
|
81
|
+
after `handler`. An inline wrapper after the handler passes; before it, output
|
|
82
|
+
remains unknown. Explicit output schemas also pass.
|
|
83
|
+
- **Why it matters:** Function extraction and property order should not change
|
|
84
|
+
the typed App contract. This reproduces on TS 5.8.3 and 7.0.1 RC against both
|
|
85
|
+
installed alpha.8 and freshly built declarations.
|
|
86
|
+
- **Current choice:** Document the inline-after workaround without casts or
|
|
87
|
+
requiring consumers to introduce runtime output validation.
|
|
88
|
+
- **Follow-up:** P1: isolate handler-output inference and verify renderer
|
|
89
|
+
compatibility with a compiler matrix. Candidate type changes remain untested;
|
|
90
|
+
see the [fixture and results](./feedback/v-ray/README.md).
|
|
91
|
+
|
|
92
|
+
## 2026-09-09 — Terminal detail rows require Markdown decoration workarounds
|
|
93
|
+
|
|
94
|
+
- **Resolution:** `createCli` and `runCli` accept `markdown: RenderOptions` from
|
|
95
|
+
markdansi and forward it unchanged for TTY presentation rendering, including
|
|
96
|
+
watch frames. No Capable-specific renderer option vocabulary was introduced.
|
|
97
|
+
Paragraph spacing remains unresolved.
|
|
98
|
+
|
|
99
|
+
- **Observed:** v-ray uses inline code with hard breaks for aligned headers and
|
|
100
|
+
duration bars, plus an ` ` footer spacer. markdansi's whole-document
|
|
101
|
+
renderer collapses paragraph separation and boxes tables/fenced code.
|
|
102
|
+
- **Why it matters:** Consumers manipulate Markdown syntax to control terminal
|
|
103
|
+
styling. markdansi already supports `codeBox: false` and borderless tables,
|
|
104
|
+
but Capable exposes only width/color; those controls do not fix paragraphs.
|
|
105
|
+
- **Current choice:** Keep the shared Markdown baseline; do not add a layout
|
|
106
|
+
system based on one integration.
|
|
107
|
+
- **Follow-up:** P2: expose a small CLI renderer option and investigate paragraph
|
|
108
|
+
spacing with focused fixtures. Consider detail-row primitives only if these
|
|
109
|
+
fail. See [rendered observations and proposed usage](./feedback/v-ray/README.md).
|
|
110
|
+
|
|
111
|
+
## 2026-09-09 — Embedded installs inherit unused Nitro peer constraints
|
|
112
|
+
|
|
113
|
+
- **Observed:** capable-kit alpha.8 requires Nitro, whose Vite peer range does
|
|
114
|
+
not include v-ray's Vite 6; its unstorage dependency also wants newer
|
|
115
|
+
`@vercel/functions` than v-ray's 2.2.4. Current packaging is unchanged.
|
|
116
|
+
- **Why it matters:** Embedded Next/App/CLI consumers see host dependency
|
|
117
|
+
warnings despite root/core/CLI/Next import graphs not reaching Nitro. The
|
|
118
|
+
toolchain executable does statically import `nitro/builder`.
|
|
119
|
+
- **Current choice:** Distinguish install footprint from runtime bundling; no
|
|
120
|
+
Next.js bundle or production deployment impact was measured.
|
|
121
|
+
- **Follow-up:** P2: evaluate an optional Nitro peer plus lazy host imports and
|
|
122
|
+
starter dependency updates. Neither optionalDependencies nor lazy imports
|
|
123
|
+
alone solves normal installation footprint. See the [packaging proposal](./feedback/v-ray/README.md).
|
|
124
|
+
|
|
6
125
|
## 2026-09-01 — Surface selection has two execution paths
|
|
7
126
|
|
|
8
127
|
- **Observed:** App and MCP selection filters a resolved manifest, while the
|
|
@@ -279,7 +398,8 @@ duplicated, or leaky implementation work as it appears.
|
|
|
279
398
|
- **Why it matters:** A Capable App contains handlers and provider functions that
|
|
280
399
|
cannot cross a JSON workflow boundary. Hiding an MCP or HTTP hop inside the
|
|
281
400
|
adapter would avoid that constraint but would not be a native integration.
|
|
282
|
-
- **
|
|
401
|
+
- **Historical choice (superseded by the 2026-09-09 entry below):**
|
|
402
|
+
`createEveTools(app)` returned step-scoped dynamic tools.
|
|
283
403
|
Eve resolves the manifest and live executors before each model step, then
|
|
284
404
|
checkpoints the selected tool call and result using its normal durability
|
|
285
405
|
semantics.
|
|
@@ -843,3 +963,268 @@ duplicated, or leaky implementation work as it appears.
|
|
|
843
963
|
page shell derives the outline from those headings.
|
|
844
964
|
- **Follow-up:** Rendered-site tests now verify the outline and resolve every
|
|
845
965
|
internal hash link against the target page.
|
|
966
|
+
|
|
967
|
+
## 2026-09-09 — Remote Eve lifecycle and composition
|
|
968
|
+
|
|
969
|
+
- **Observed:** The latest published Eve SDK is 0.52.3. Execution uses fixed
|
|
970
|
+
session IDs, sessions.create/attach, typed input kinds, input resolution events,
|
|
971
|
+
finite catch-up streams, and abortable cooperative cancellation. These differ
|
|
972
|
+
from the previously pinned SDK and the read-only V reference.
|
|
973
|
+
- **Current choice:** Upgrade examples and the Eve peer range to 0.52.3, and use
|
|
974
|
+
its installed source and docs as the contract. Use Eve session IDs directly and reconstruct state from
|
|
975
|
+
finite event history on each read or response; Eve owns all durable execution.
|
|
976
|
+
Only typed questions cross the response boundary. Native Eve tool projection
|
|
977
|
+
remains separate and its approval test accounts for Eve's expanded union.
|
|
978
|
+
- **Limit:** Reconstruction rereads history, bounded by a configurable event
|
|
979
|
+
limit and deadline. Exceeding either fails rather than using partial state.
|
|
980
|
+
The create API has no idempotency option, so ambiguous acceptance still needs
|
|
981
|
+
host-level recovery design.
|
|
982
|
+
Finite reads require the server's stream version and tail headers.
|
|
983
|
+
- **Composition friction:** There is no mountApp for executable Apps, and the MCP
|
|
984
|
+
HTTP mount accepts definitions. The adapter authors a named capability group
|
|
985
|
+
with namespaced IDs, then uses mergeApps and createMcp for host-owned MCP tool
|
|
986
|
+
registration. A generic mapped namespace prevents TypeScript from reducing
|
|
987
|
+
createApp's context conditional, so construction widens the key and restores
|
|
988
|
+
the checked context-free mapped App type at this one boundary. The declaration
|
|
989
|
+
bundler also requires an explicit public adapter return type.
|
|
990
|
+
- **Dependency resolution friction:** Updating Eve also re-resolved unrelated
|
|
991
|
+
`latest` dependencies in auth-todo and selected a Better Auth version that no
|
|
992
|
+
longer exported the API required by its pinned OAuth provider. Preserve the
|
|
993
|
+
prior unrelated dependency graph and update only Eve, its required AI SDK,
|
|
994
|
+
and their transitive dependencies; frozen-lockfile installation verifies it.
|
|
995
|
+
|
|
996
|
+
## 2026-09-10 — App placement and root merging required two composition verbs
|
|
997
|
+
|
|
998
|
+
- **Observed:** Expressing the final callable tree required a root-level
|
|
999
|
+
`mergeApps()` plus a separate `mountApp(key, app)` wrapper. “Mount” also names
|
|
1000
|
+
the unrelated server operation that attaches HTTP surfaces, and the nesting
|
|
1001
|
+
of verbs hid the resulting App shape.
|
|
1002
|
+
- **Why it matters:** Composition is navigational data. Callers should be able
|
|
1003
|
+
to read the final typed tree directly from the value they author, while
|
|
1004
|
+
Capability identity, transport placement, and server mounting remain
|
|
1005
|
+
separate concerns.
|
|
1006
|
+
- **Current choice:** `composeApps()` accepts root Apps and named object trees.
|
|
1007
|
+
Apps contribute at the current root; object keys place Apps beneath matching
|
|
1008
|
+
branches. Composition flattens that declaration into placement records and
|
|
1009
|
+
builds one runtime rather than recursively wrapping an App at each object
|
|
1010
|
+
level. The path resolver dispatches directly to the owning transport, so a
|
|
1011
|
+
named direct call does not materialize unavailable sibling branches.
|
|
1012
|
+
Complete-manifest surfaces still resolve every branch and perform strict
|
|
1013
|
+
global conflict validation. Reusing one runtime creates aliases; different
|
|
1014
|
+
runtimes claiming the same Capability ID fail.
|
|
1015
|
+
- **Cost:** The in-process App runtime now has a private path-resolution method
|
|
1016
|
+
in addition to the transport contract. Empty composition objects fail eagerly
|
|
1017
|
+
rather than silently disappearing from the authored tree.
|
|
1018
|
+
|
|
1019
|
+
## 2026-09-09 — Live Eve compilation rejects captured App runtimes
|
|
1020
|
+
|
|
1021
|
+
- **Observed:** The real Eve 0.52.3 CLI test skipped all generated Capable tools:
|
|
1022
|
+
their execute callbacks captured a non-JSON App runtime. Unit tests invoking
|
|
1023
|
+
dynamic resolvers directly missed the compiler boundary. The earlier claim
|
|
1024
|
+
that step-scoped callbacks bypass serialization is obsolete.
|
|
1025
|
+
- **Superseded workaround:** Required an authored `tool: ({ id, definition }) =>
|
|
1026
|
+
defineTool({ ...definition, execute: ... })` factory in `createEveTools`.
|
|
1027
|
+
Its executor captures the string ID and references an imported App or a
|
|
1028
|
+
module-level provider. The authenticated example reconstructs its remote App
|
|
1029
|
+
from the executor's current Eve session, as well as during discovery.
|
|
1030
|
+
- **Cost:** This adds one executor wrapper per projection. Eve has no exported
|
|
1031
|
+
durable-callback registration helper for third-party adapter factories.
|
|
1032
|
+
Keep this explicit rather than using private symbols or a global App registry.
|
|
1033
|
+
- **Proof:** The opt-in CLI test starts the actual Eve compiler/runtime and a
|
|
1034
|
+
real model, then asserts both the durable tool result and final CLI output.
|
|
1035
|
+
It tests fresh CLI clients, not recovery of parked tools after a server restart.
|
|
1036
|
+
|
|
1037
|
+
## 2026-09-09 — Keep Eve executor registration inside the projection
|
|
1038
|
+
|
|
1039
|
+
- **Observed:** Requiring a public `tool` factory leaked identical executor
|
|
1040
|
+
plumbing to every caller. Capable should own the complete conversion.
|
|
1041
|
+
- **Current choice:** Restore `createEveTools(app, { approval })` and register
|
|
1042
|
+
library-generated executors and approval request/response callbacks using
|
|
1043
|
+
Eve's existing `stampDurableDynamicCallback` descriptor hook. A two-file pnpm
|
|
1044
|
+
patch exposes that helper and its type from `eve/tools`; no Eve runtime logic
|
|
1045
|
+
changes. There is no additional Capable registry or serialization of App values.
|
|
1046
|
+
- **Lifecycle:** These are live step-scoped callbacks. Eve owns their session,
|
|
1047
|
+
resolver, and scope bindings and cleanup. Missing bindings after a server
|
|
1048
|
+
restart fail closed. This does not claim durable reconstruction of the App.
|
|
1049
|
+
- **Distribution:** Stock Eve 0.52.3 does not export this hook. The checked-in
|
|
1050
|
+
patch is required, including for consumers outside this monorepo. Remove it
|
|
1051
|
+
only when upstream Eve exposes an equivalent supported hook. Do not claim
|
|
1052
|
+
unpatched-package compatibility when publishing the integration.
|
|
1053
|
+
- **Verification:** Run the original one-line API through the actual Eve
|
|
1054
|
+
compiler/runtime and assert the tool result in the durable event stream.
|
|
1055
|
+
|
|
1056
|
+
## 2026-09-09 — Recovery must not reuse discovery's caller for execution
|
|
1057
|
+
|
|
1058
|
+
- **Observed:** The real approval/restart test resumed a deleted todo successfully,
|
|
1059
|
+
but its audit receipt identified the wrong user. An unauthorized responder had
|
|
1060
|
+
triggered session resolver recovery before their approval was rejected. The
|
|
1061
|
+
reconstructed App still held that responder's identity when the initiator
|
|
1062
|
+
subsequently approved.
|
|
1063
|
+
- **Fix:** Use session-scoped discovery for recovery, but invoke an App provider
|
|
1064
|
+
again for each execution with Eve's live tool-call session. Discovery's channel
|
|
1065
|
+
and message context are retained; its session identity does not override the
|
|
1066
|
+
execution session. Static Apps must independently create appropriate per-call
|
|
1067
|
+
context and keep their data in persistent storage.
|
|
1068
|
+
- **Proof:** The local test stops the entire server while a deletion approval is
|
|
1069
|
+
pending, rejects a different authenticated responder after restart, then checks
|
|
1070
|
+
that the original call's persisted deletion records both the initiating user
|
|
1071
|
+
and the new server instance.
|
|
1072
|
+
|
|
1073
|
+
## 2026-09-09 — Validate recovery against the upstream provider helper
|
|
1074
|
+
|
|
1075
|
+
- **Change:** Backport `defineDurableCallback` from Eve PR #2981 at
|
|
1076
|
+
`8e6964036657082ce1405864cf3313ad11fc8d60`, replacing the private export patch.
|
|
1077
|
+
Switch discovery to `session.started`, which already supports rebinding missing
|
|
1078
|
+
callbacks. Persist the capability ID and reconstruct provider Apps for actual
|
|
1079
|
+
execution; no new public factory API or app registry is introduced.
|
|
1080
|
+
- **Storage:** The demo now shares file-backed records locally and a private
|
|
1081
|
+
Vercel Blob store when deployed. Deletion clears the title and retains an
|
|
1082
|
+
idempotent audit tombstone, allowing the test to verify user and instance identity.
|
|
1083
|
+
- **Deployment friction:** The first deployment of a newly created project was
|
|
1084
|
+
treated as production by the CLI despite omitting `--prod`. Subsequent test
|
|
1085
|
+
deployments explicitly use `--target preview`. The initial project-OIDC resume
|
|
1086
|
+
also hit an AI Gateway billing-setup error; the isolated test project's Preview
|
|
1087
|
+
environment uses the existing local-test gateway credential as a sensitive
|
|
1088
|
+
variable instead. No billing settings were changed.
|
|
1089
|
+
- **Evidence:** Local recovery was exercised with a real model and a fully stopped
|
|
1090
|
+
server, not only a cleared JavaScript registry. Deployed recovery additionally
|
|
1091
|
+
compares persisted approval and execution instance IDs across previews.
|
|
1092
|
+
|
|
1093
|
+
### Eve CLI missing credentials hide behind an internal error
|
|
1094
|
+
|
|
1095
|
+
Running the demo CLI without `EVE_DEMO_TOKEN` sends an unauthenticated request.
|
|
1096
|
+
Eve correctly returns HTTP 401, but its SDK error is undeclared by the adapter
|
|
1097
|
+
and Capable sanitizes it to `INTERNAL_SERVER_ERROR`. The example now detects a
|
|
1098
|
+
missing token before invoking agent commands and explains that the CLI and
|
|
1099
|
+
server need the same token. Mapping upstream authentication failures into
|
|
1100
|
+
declared adapter errors remains a separate improvement for wrong or expired tokens.
|
|
1101
|
+
|
|
1102
|
+
### A single Eve send operation with bounded waiting
|
|
1103
|
+
|
|
1104
|
+
The public adapter now exposes `send`, `result`, and `cancel`. CLI positional
|
|
1105
|
+
metadata already existed, so `send "message" --run-id ID --wait` uses the normal
|
|
1106
|
+
CLI projection. `send` answers one pending question automatically, requires a
|
|
1107
|
+
request ID for ambiguity, and otherwise sends a follow-up to the same Eve ID.
|
|
1108
|
+
It never converts text into tool approval. Waiting consumes Eve's delivery-aware
|
|
1109
|
+
response stream, then reads a bounded snapshot; polling old session boundaries
|
|
1110
|
+
could otherwise return the previous answer. The wait deadline begins after
|
|
1111
|
+
acceptance and returns the accepted ID with `running` when no boundary was
|
|
1112
|
+
confirmed. Cancellation of local waiting does not cancel remote execution.
|
|
1113
|
+
|
|
1114
|
+
### Agent results need the existing presentation hook
|
|
1115
|
+
|
|
1116
|
+
The Eve adapter initially exposed structured results without `toPresentation`,
|
|
1117
|
+
so human CLI usage fell back to JSON. Agent send/result/cancel now provide
|
|
1118
|
+
portable presentations through the existing capability hook. CLI formatting
|
|
1119
|
+
stays in the CLI surface, and `--json` retains canonical output.
|
|
1120
|
+
|
|
1121
|
+
## Changesets setup: dependency resolution during tooling installation
|
|
1122
|
+
|
|
1123
|
+
- **Observed:** Adding Changesets with pnpm refreshed unrelated workspace `latest`
|
|
1124
|
+
dependencies, including better-auth, which broke the auth integration's
|
|
1125
|
+
`verifyAccessToken` import.
|
|
1126
|
+
- **Resolution:** Preserved all existing lockfile resolutions and added only the
|
|
1127
|
+
Changesets dependency graph, then installed with `--frozen-lockfile`.
|
|
1128
|
+
- **Follow-up:** Keep release-tooling additions separate from runtime dependency
|
|
1129
|
+
upgrades; review lockfile importer changes before validating a release.
|
|
1130
|
+
|
|
1131
|
+
## First Changesets release: generated formatting noise
|
|
1132
|
+
|
|
1133
|
+
- **Observed:** `pnpm install --lockfile-only` rewrote hundreds of lockfile lines
|
|
1134
|
+
without changing the parsed YAML. Changesets also generated whitespace-only
|
|
1135
|
+
changelog lines that failed `git diff --check`.
|
|
1136
|
+
- **Resolution:** Compared parsed lockfile contents before restoring the original
|
|
1137
|
+
formatting, and removed whitespace from blank lines in the new release entry.
|
|
1138
|
+
|
|
1139
|
+
## Alpha publishing: Changesets selects latest for prerelease-only history
|
|
1140
|
+
|
|
1141
|
+
- **Observed:** Changesets 3 selected `latest` despite alpha mode because all
|
|
1142
|
+
published versions were alphas and the registry already had a `latest` tag.
|
|
1143
|
+
- **Resolution:** Confirmed that `latest` is the intended default while there is
|
|
1144
|
+
no stable release, retained the standard Changesets publish flow, and corrected
|
|
1145
|
+
the release guide's unconditional claim that prerelease mode uses `alpha`.
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
## 2026-09-11 — Event streams exposed replacement assumptions across surfaces
|
|
1149
|
+
|
|
1150
|
+
- **Observed:** Capability definitions and App references assumed a unary handler;
|
|
1151
|
+
the manifest's subscription flag could describe only replacements. Empty
|
|
1152
|
+
subscriptions failed, and SSE waited for the first value before responding.
|
|
1153
|
+
- **Why it matters:** Logs can remain quiet or finish with no entries. Treating
|
|
1154
|
+
them as live state also causes the CLI to erase earlier entries and state
|
|
1155
|
+
projections to retain only the last event.
|
|
1156
|
+
- **Current choice:** Derive one execution kind (`unary`, `live`, `events`) from
|
|
1157
|
+
handler/subscriber presence. Use it in core, manifest v4, and projections. Keep
|
|
1158
|
+
lazy App proxies, with non-callable event references in types and runtime unary
|
|
1159
|
+
rejection. Make transport subscription opening asynchronous, so local, composed,
|
|
1160
|
+
remote, and HTTP runtimes await validation and middleware without a second
|
|
1161
|
+
readiness protocol. Event SSE responses then flush a comment without inventing
|
|
1162
|
+
an event.
|
|
1163
|
+
- **Type friction:** An empty inferred generator yields `never`; a stored
|
|
1164
|
+
`PresentationRenderer<never>` was not assignable to the erased definition's
|
|
1165
|
+
`PresentationRenderer<any>`. Store it as a method signature, whose parameter is
|
|
1166
|
+
assignable after type erasure, while authored configs retain strict renderer
|
|
1167
|
+
checking and the return remains a `PresentationValue`.
|
|
1168
|
+
- **Follow-up:** State projections remain synchronous proxies. Event-only paths
|
|
1169
|
+
are omitted from their static types, while direct untyped unary invocation is
|
|
1170
|
+
rejected by the App runtime. Async-generator bodies still start on first pull,
|
|
1171
|
+
so buffering, replay, and source-listener readiness remain application
|
|
1172
|
+
responsibilities.
|
|
1173
|
+
|
|
1174
|
+
## Individual references and customization
|
|
1175
|
+
|
|
1176
|
+
- **Observed:** Reconstructing remote leaves as core definitions would duplicate
|
|
1177
|
+
validation/execution and lose source group policy. The existing lazy proxy
|
|
1178
|
+
already stores the runtime/path binding used by subscriptions.
|
|
1179
|
+
- **Current choice:** Share that binding reader with composition. Keep
|
|
1180
|
+
`defineApp()` definition-only and bind local capabilities before composition.
|
|
1181
|
+
- **Observed:** Selection and composition duplicated cached ID dispatch and
|
|
1182
|
+
NOT_FOUND checks; MCP, AI SDK, and Eve each repeated the manifest walker.
|
|
1183
|
+
- **Current choice:** Share one derived-runtime dispatcher and the existing
|
|
1184
|
+
manifest walker. Retain `selectApp()` for filtering without relocation.
|
|
1185
|
+
- **Observed:** Alias checks compare source metadata, which cannot safely be
|
|
1186
|
+
treated as display-only. Policy callbacks also consume the original manifest.
|
|
1187
|
+
- **Current choice:** Store `customization` separately; surfaces explicitly read
|
|
1188
|
+
display fields. Only opted-in namespaces are typed as customizable. No proxy
|
|
1189
|
+
method or additional reserved command key is needed.
|
|
1190
|
+
- **Observed:** A contextless fixture with group middleware annotated as
|
|
1191
|
+
`CapabilityMiddleware<undefined>` widened inference to unknown in the current
|
|
1192
|
+
group/definition types. This is independent of reference composition.
|
|
1193
|
+
- **Current choice:** The fixture uses context-agnostic middleware and explicitly
|
|
1194
|
+
supplies an undefined context, preserving its concrete capability tree. A core
|
|
1195
|
+
inference change is outside this feature.
|
|
1196
|
+
- **Observed:** The declaration bundler leaves module augmentations aimed at
|
|
1197
|
+
private workspace modules rather than the bundled interface. Source typechecks
|
|
1198
|
+
passed while a built-package fixture accepted invalid customization namespaces.
|
|
1199
|
+
- **Current choice:** Use a global `CapableCustomizationMeta` interface for the
|
|
1200
|
+
new closed registry, loaded by surface imports. This avoids declaration-file
|
|
1201
|
+
rewriting or public-to-private module dependencies. Existing core metadata
|
|
1202
|
+
uses an open registry; changing that older API is outside this feature.
|
|
1203
|
+
- **Observed:** Treating lazy Group proxies as invalid required a type-only marker
|
|
1204
|
+
and a separate runtime branch even though the proxy already carried the same
|
|
1205
|
+
runtime/path binding as a Capability reference.
|
|
1206
|
+
- **Resolution:** Executable Group proxies place their complete subtree. Whole
|
|
1207
|
+
Apps, Group subtrees, and Capability leaves now share one source-path placement
|
|
1208
|
+
model, so the marker and the missing-leaf special case were removed. Subtree
|
|
1209
|
+
placement preserves internal paths and Group presentation but adds no local
|
|
1210
|
+
semantic middleware.
|
|
1211
|
+
- **Observed:** Manifest conflict checks treated a wrapping composed runtime as
|
|
1212
|
+
the owner, while direct path resolution already returned the terminal
|
|
1213
|
+
transport. Re-referencing the same operation through a nested composition
|
|
1214
|
+
therefore produced a false ownership conflict.
|
|
1215
|
+
- **Resolution:** Resolve and cache each placed Capability's terminal transport
|
|
1216
|
+
while assembling the composed manifest. Alias checks and ID dispatch now use
|
|
1217
|
+
that same owner identity.
|
|
1218
|
+
- **Observed:** Authored CLI root commands and MCP names could defeat the curated
|
|
1219
|
+
tree. Identical customization objects could also conflict due to key order.
|
|
1220
|
+
- **Current choice:** Individual references carry an explicit destination-
|
|
1221
|
+
navigation marker beside any customization; CLI/MCP use destination names
|
|
1222
|
+
unless explicitly overridden there. A placed Group also gets its outer name
|
|
1223
|
+
from the destination key while preserving its authored interior. Snapshot
|
|
1224
|
+
object keys canonically so equivalent customizations deduplicate. A typed
|
|
1225
|
+
navigation-metadata helper keeps that destination/source choice out of the
|
|
1226
|
+
individual surface packages.
|
|
1227
|
+
- **Observed:** Full composition resolution returned the same terminal transport
|
|
1228
|
+
map twice as `owners` and `targets`, even though conflict checks and dispatch
|
|
1229
|
+
need the same identity.
|
|
1230
|
+
- **Resolution:** Keep one typed `owners` map and build dispatch from it.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Releases
|
|
2
|
+
|
|
3
|
+
`capable-kit` is the public release unit. Private workspace packages are bundled
|
|
4
|
+
into it; changes to their public behavior need a changeset for `capable-kit`.
|
|
5
|
+
|
|
6
|
+
## Record a change
|
|
7
|
+
|
|
8
|
+
Run `pnpm changeset`, or write a uniquely named Markdown file under `.changeset/`:
|
|
9
|
+
|
|
10
|
+
````md
|
|
11
|
+
---
|
|
12
|
+
"capable-kit": patch
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Added a versioned changelog to the installed package. Read
|
|
16
|
+
`node_modules/capable-kit/CHANGELOG.md` before upgrading.
|
|
17
|
+
````
|
|
18
|
+
|
|
19
|
+
Use `patch` for fixes and documentation, and `minor` for features. While the
|
|
20
|
+
stable base is 0.x, also use `minor` for breaking changes and explicitly label
|
|
21
|
+
these **Breaking**. Include before/after code, affected entry points, and any
|
|
22
|
+
behavior or configuration changes. Never infer compatibility from alpha numbers.
|
|
23
|
+
Internal-only changes do not require a changeset.
|
|
24
|
+
|
|
25
|
+
## Prepare and publish an alpha
|
|
26
|
+
|
|
27
|
+
The repository is in Changesets prerelease mode with the `alpha` tag. Keep
|
|
28
|
+
`.changeset/pre.json` and `.changeset/pre/` committed: these preserve prerelease
|
|
29
|
+
mode and entries already included in alpha releases.
|
|
30
|
+
Do not re-enter prerelease mode for each release.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pnpm changeset status
|
|
34
|
+
pnpm release:version
|
|
35
|
+
pnpm install --lockfile-only
|
|
36
|
+
pnpm check
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Review and commit the changed package version, lockfile, changelog, and Changesets
|
|
40
|
+
state together. The next version is calculated from the pending bump types and
|
|
41
|
+
prerelease state; do not assume it will simply increment the existing alpha suffix.
|
|
42
|
+
|
|
43
|
+
When ready to publish from that reviewed commit:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
pnpm release:publish
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This validates the repository and publishes unpublished public packages. While
|
|
50
|
+
all published versions are alphas and `latest` already exists, Changesets 3
|
|
51
|
+
publishes to `latest`. This is intentional: the current alpha is the default
|
|
52
|
+
installation while there is no stable release. After a stable release exists,
|
|
53
|
+
prerelease mode uses the `alpha` dist-tag. Review the publish plan when that
|
|
54
|
+
transition happens. Package prepack also rebuilds and
|
|
55
|
+
verifies the exported files and bundles documentation. Publishing needs npm
|
|
56
|
+
credentials. Push the release commit and generated tags after a successful release.
|
|
57
|
+
Changesets does not create GitHub Releases with this setup.
|
|
58
|
+
|
|
59
|
+
To leave alpha, run `pnpm exec changeset pre exit`, then follow the version/review
|
|
60
|
+
steps above. Review the resulting stable version and dist-tag before publishing.
|
|
61
|
+
|
|
62
|
+
## Find changes as a consumer or agent
|
|
63
|
+
|
|
64
|
+
Read `node_modules/capable-kit/CHANGELOG.md` for the installed version's release
|
|
65
|
+
history. When upgrading, read the target version's changelog and apply entries
|
|
66
|
+
newer than the installed version through the target version, oldest first.
|
|
67
|
+
Use exact versions from the lockfile, not only the range in `package.json`.
|
|
68
|
+
|
|
69
|
+
The same canonical changelog is linked from the website's package reference.
|
|
70
|
+
Repository main may contain newer releases than a locally installed package.
|
|
71
|
+
Release history starts with this setup; older alpha changes are not reconstructed.
|
|
72
|
+
|
|
73
|
+
## Initial release-note backfill
|
|
74
|
+
|
|
75
|
+
The initial pending notes cover user-facing changes after published
|
|
76
|
+
`0.0.1-alpha.8`, using release commit `69941bd` as the baseline. The npm
|
|
77
|
+
package's Eve, MCP, app-composition, and CLI source-map contents were checked
|
|
78
|
+
against that commit. Notes cover changes through `b8fada3` from main, plus the
|
|
79
|
+
Changesets setup. Already-shipped alpha.8 features are not listed as new.
|
|
@@ -83,11 +83,11 @@ import {
|
|
|
83
83
|
createApp,
|
|
84
84
|
createEveTools,
|
|
85
85
|
createRemoteApp,
|
|
86
|
-
|
|
86
|
+
composeApps,
|
|
87
87
|
} from "capable-kit";
|
|
88
88
|
|
|
89
89
|
const supportApp = createRemoteApp<typeof support>(supportTransport);
|
|
90
|
-
const app =
|
|
90
|
+
const app = composeApps(
|
|
91
91
|
supportApp,
|
|
92
92
|
createApp(localDefinition, {
|
|
93
93
|
context: createLocalContext,
|
|
@@ -176,10 +176,16 @@ The provider runs per call, so it can read a request-scoped session, open a tran
|
|
|
176
176
|
|
|
177
177
|
> **then is reserved**
|
|
178
178
|
>
|
|
179
|
-
> Every level of the tree is a
|
|
179
|
+
> Every traversable level of the tree is a lazy proxy. Capability leaves are callable unless they are subscription-only. Capable reserves `then` at every path so an app can never be mistaken for a promise by `await`.
|
|
180
180
|
|
|
181
181
|
## Give one branch a different policy [#decorate]
|
|
182
182
|
|
|
183
|
+
Use `defineApp({ capabilities, middleware: [authorizeCapability], errors: AccessErrors })`
|
|
184
|
+
for policy shared by the whole app. App middleware runs before group and capability
|
|
185
|
+
middleware for both local and remote invocations executed by that definition.
|
|
186
|
+
See [Capability middleware](/concepts/capabilities#middleware) for the identity
|
|
187
|
+
arguments and a complete example.
|
|
188
|
+
|
|
183
189
|
A `group()` is useful when one branch needs shared behaviour that would be wrong for the rest of the app. Here the catalog stays public, while everything under `account` requires an authenticated user. Define the decorated subtree separately so the app remains a simple composition.
|
|
184
190
|
|
|
185
191
|
```ts title="capable.app.ts"
|
|
@@ -35,7 +35,7 @@ defineApp() a named tree of capabilities
|
|
|
35
35
|
| +-- { context } only when declared
|
|
36
36
|
+-- createRemoteApp(transport) lazy remote placement
|
|
37
37
|
|
|
|
38
|
-
|
|
38
|
+
composeApps() / selectApp() one typed app
|
|
39
39
|
|
|
|
40
40
|
+-- app.todos.list({}) direct call
|
|
41
41
|
+-- createCli(app) commands
|
|
@@ -65,6 +65,14 @@ interface ApplicationTransport {
|
|
|
65
65
|
output: unknown;
|
|
66
66
|
presentation?: readonly PresentationPart[];
|
|
67
67
|
}>;
|
|
68
|
+
subscribe(args: {
|
|
69
|
+
id: string;
|
|
70
|
+
input: unknown;
|
|
71
|
+
signal?: AbortSignal;
|
|
72
|
+
}): Promise<AsyncIterableIterator<{
|
|
73
|
+
output: unknown;
|
|
74
|
+
presentation?: readonly PresentationPart[];
|
|
75
|
+
}>>;
|
|
68
76
|
}
|
|
69
77
|
|
|
70
78
|
const app = createRemoteApp(transport);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Capabilities"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Define input, output, errors, middleware, and a handler or subscriber."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import { DocsPage, docMetadata } from "../../_components/docs-page";
|
|
@@ -145,6 +145,43 @@ export const listTodos = todoCapability({
|
|
|
145
145
|
|
|
146
146
|
Put middleware on a `group()` when several capabilities in one branch share the policy and the rest of the app does not.
|
|
147
147
|
|
|
148
|
+
Put middleware on `defineApp()` to apply it to every capability in that app.
|
|
149
|
+
All three scopes receive a readonly `capability` descriptor containing the
|
|
150
|
+
authored `id` and optional `effect`, plus `mode: "call" | "subscribe"`.
|
|
151
|
+
The ID stays the same when a capability moves to another application path.
|
|
152
|
+
An omitted effect remains `undefined`.
|
|
153
|
+
|
|
154
|
+
```ts title="capable.app.ts"
|
|
155
|
+
const AccessErrors = defineErrors({
|
|
156
|
+
FORBIDDEN: { status: 403, message: "Access denied" },
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const definition = defineApp({
|
|
160
|
+
capabilities: { todos },
|
|
161
|
+
errors: AccessErrors,
|
|
162
|
+
middleware: [async ({ capability, mode, context, next }) => {
|
|
163
|
+
if (!await canCall(context.user, capability.id)) {
|
|
164
|
+
throw AccessErrors.FORBIDDEN();
|
|
165
|
+
}
|
|
166
|
+
console.info({ capabilityId: capability.id, mode });
|
|
167
|
+
return next();
|
|
168
|
+
}],
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
App middleware uses the Context required by the app's capabilities. It does
|
|
173
|
+
not add or narrow Context fields. Declare capabilities separately, then
|
|
174
|
+
compose them into the app so TypeScript can infer that Context before typing
|
|
175
|
+
the middleware. Input is parsed before middleware runs; at app and group
|
|
176
|
+
scope it is typed as `unknown`, because each capability can have a different
|
|
177
|
+
input schema. Middleware receives identity, not the handler or internal
|
|
178
|
+
capability definition.
|
|
179
|
+
|
|
180
|
+
The order is app middleware, outer-to-inner group middleware, capability
|
|
181
|
+
middleware, then the handler. Return values unwind in reverse order.
|
|
182
|
+
Subscriptions use the same chain for the complete subscription lifetime.
|
|
183
|
+
Middleware does not see input-validation failures or Context-provider failures.
|
|
184
|
+
|
|
148
185
|
## Describe each surface with metadata [#metadata]
|
|
149
186
|
|
|
150
187
|
App paths give every surface enough information to derive routes, commands, and tool names. Add `meta` when a surface needs details that the capability itself cannot express.
|
|
@@ -187,7 +224,7 @@ Only surfaces that need a presentation ask the runtime to produce it. The CLI re
|
|
|
187
224
|
Once these pieces are present, every caller enters the same lifecycle. A surface only translates its own transport into an input object.
|
|
188
225
|
|
|
189
226
|
1. **Parse input.** The input schema runs once.
|
|
190
|
-
2. **Run middleware.**
|
|
227
|
+
2. **Run middleware.** App middleware runs outermost, followed by outer-to-inner group middleware and capability middleware, in declaration order.
|
|
191
228
|
3. **Run the handler.** It receives `{ input, context, signal }`.
|
|
192
229
|
4. **Normalize errors.** Declared errors keep their contract; unexpected failures become `INTERNAL_SERVER_ERROR`.
|
|
193
230
|
5. **Validate output.** The optional output schema runs before the canonical result is returned.
|
|
@@ -206,13 +243,13 @@ const todo = await executeCapability(getTodo, {
|
|
|
206
243
|
});
|
|
207
244
|
```
|
|
208
245
|
|
|
209
|
-
Direct execution applies the capability's own validation, middleware, and declared errors. Middleware and errors contributed by
|
|
246
|
+
Direct execution applies the capability's own validation, middleware, and declared errors. Middleware and errors contributed by an app or group only exist when the capability is executed through the app tree that contains it. A handler that requires a user must check that requirement itself if it can also be executed directly; a check in group middleware does not narrow the handler's Context type.
|
|
210
247
|
|
|
211
248
|
## Put it all together [#complete]
|
|
212
249
|
|
|
213
250
|
A capability can grow into the full declaration below, but only as each concern becomes real. The handler remains the centre; every other field either strengthens its contract, shares semantic policy, or helps a surface present it.
|
|
214
251
|
|
|
215
|
-
|
|
252
|
+
A read capability can add `subscribe` beside its handler to emit replacement snapshots, or define only `subscribe` to emit individual events such as logs. Event-only capabilities have no unary handler. See [Subscriptions](/patterns/subscriptions).
|
|
216
253
|
|
|
217
254
|
```ts title="capabilities.ts"
|
|
218
255
|
import { capability, defineErrors, md } from "capable-kit";
|
|
@@ -88,6 +88,16 @@ const todos = group({
|
|
|
88
88
|
});
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
An app can contribute errors to every capability, including failures from app-wide middleware:
|
|
92
|
+
|
|
93
|
+
```ts title="capable.app.ts"
|
|
94
|
+
const definition = defineApp({
|
|
95
|
+
capabilities: { todos },
|
|
96
|
+
errors: AccessErrors,
|
|
97
|
+
middleware: [authorizeCapability],
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
An app, its nested groups, and a capability may not redeclare an inherited error code. The conflict is reported when the app definition is created, not at call time. Inherited errors appear on each affected capability in the manifest and OpenAPI. Standalone `executeCapability()` calls only use errors declared on that capability.
|
|
92
102
|
|
|
93
103
|
</DocsPage>
|