capable-kit 0.0.1-alpha.7 → 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.
Files changed (104) hide show
  1. package/CHANGELOG.md +214 -0
  2. package/README.md +6 -0
  3. package/dist/ai-sdk.d.mts +3 -3
  4. package/dist/ai-sdk.mjs +9 -7
  5. package/dist/ai-sdk.mjs.map +1 -1
  6. package/dist/app.d.mts +2 -2
  7. package/dist/app.mjs +2 -2
  8. package/dist/bin.mjs +12 -9
  9. package/dist/bin.mjs.map +1 -1
  10. package/dist/cli.d.mts +9 -1
  11. package/dist/cli.mjs +1 -1
  12. package/dist/core.d.mts +3 -3
  13. package/dist/core.mjs +1 -1
  14. package/dist/eve.d.mts +82 -5
  15. package/dist/eve.mjs +364 -23
  16. package/dist/eve.mjs.map +1 -1
  17. package/dist/http.d.mts +2 -2
  18. package/dist/http.mjs +2 -2
  19. package/dist/{index-Dbc4g9WM.d.mts → index-1A44jLuE.d.mts} +54 -16
  20. package/dist/{index-DwXlaTXI.d.mts → index-CHuCLJIs.d.mts} +20 -4
  21. package/dist/{index-D2CRRUzH.d.mts → index-D-NV4PiU.d.mts} +6 -5
  22. package/dist/{index-Be8-UVBC.d.mts → index-WiBWfyTn.d.mts} +66 -27
  23. package/dist/index.d.mts +4 -4
  24. package/dist/index.mjs +3 -3
  25. package/dist/mcp.d.mts +40 -5
  26. package/dist/mcp.mjs +1 -1
  27. package/dist/mount-BmLHp349.mjs +235 -0
  28. package/dist/mount-BmLHp349.mjs.map +1 -0
  29. package/dist/react-query.d.mts +2 -2
  30. package/dist/react-query.mjs +1 -1
  31. package/dist/react-query.mjs.map +1 -1
  32. package/dist/runtime-support.d.mts +1 -1
  33. package/dist/runtime-support.mjs +8 -8
  34. package/dist/runtime-support.mjs.map +1 -1
  35. package/dist/server.d.mts +1 -1
  36. package/dist/server.mjs +1 -1
  37. package/dist/{src-Db6-XSnU.mjs → src-3LE9S4QE.mjs} +67 -38
  38. package/dist/src-3LE9S4QE.mjs.map +1 -0
  39. package/dist/{src-DdV82An-.mjs → src-B2WeUwUT.mjs} +69 -34
  40. package/dist/src-B2WeUwUT.mjs.map +1 -0
  41. package/dist/{src-CDxL6w3d.mjs → src-C5jGDnuu.mjs} +9 -6
  42. package/dist/src-C5jGDnuu.mjs.map +1 -0
  43. package/dist/src-DePlcG_t.mjs +787 -0
  44. package/dist/src-DePlcG_t.mjs.map +1 -0
  45. package/dist/{src-BF70JLxI.mjs → src-_6OmFRYa.mjs} +185 -38
  46. package/dist/src-_6OmFRYa.mjs.map +1 -0
  47. package/dist/{subscription-Bq792Ad2.d.mts → subscription-DPdwovhw.d.mts} +2 -2
  48. package/dist/swr.d.mts +2 -2
  49. package/dist/swr.mjs +1 -1
  50. package/dist/swr.mjs.map +1 -1
  51. package/docs/CONTEXT.md +42 -21
  52. package/docs/README.md +3 -0
  53. package/docs/internal/README.md +3 -0
  54. package/docs/internal/adr/0001-capability-is-the-semantic-boundary.md +1 -1
  55. package/docs/internal/adr/0002-version-the-capable-value-codec.md +24 -0
  56. package/docs/internal/adr/0003-capability-reference-customization.md +68 -0
  57. package/docs/internal/architecture.md +64 -19
  58. package/docs/internal/capability-first-model.md +127 -18
  59. package/docs/internal/eve-recovery-validation.md +86 -0
  60. package/docs/internal/feedback/v-ray/README.md +258 -0
  61. package/docs/internal/feedback/v-ray/inference.mjs +43 -0
  62. package/docs/internal/feedback/v-ray/reproduce.mjs +36 -0
  63. package/docs/internal/implementation-friction.md +481 -1
  64. package/docs/internal/releases.md +79 -0
  65. package/docs/site/capable-orpc-and-trpc.mdx +5 -5
  66. package/docs/site/concepts/apps.mdx +17 -8
  67. package/docs/site/concepts/architecture.mdx +10 -2
  68. package/docs/site/concepts/capabilities.mdx +41 -4
  69. package/docs/site/concepts/errors.mdx +11 -1
  70. package/docs/site/concepts/presentations.mdx +20 -0
  71. package/docs/site/hosting/any-fetch-host.mdx +2 -2
  72. package/docs/site/hosting/next-js.mdx +38 -4
  73. package/docs/site/hosting/standalone-server.mdx +2 -2
  74. package/docs/site/introduction.mdx +9 -6
  75. package/docs/site/patterns/composition.mdx +159 -11
  76. package/docs/site/patterns/remote-apps.mdx +68 -10
  77. package/docs/site/patterns/subscriptions.mdx +79 -32
  78. package/docs/site/quickstart.mdx +19 -14
  79. package/docs/site/reference/packages-and-entry-points.mdx +52 -5
  80. package/docs/site/reference/surface-metadata.mdx +7 -2
  81. package/docs/site/reference/the-cap-cli.mdx +2 -2
  82. package/docs/site/surfaces/ai-sdk.mdx +3 -3
  83. package/docs/site/surfaces/cli.mdx +47 -3
  84. package/docs/site/surfaces/eve.mdx +67 -20
  85. package/docs/site/surfaces/mcp.mdx +73 -5
  86. package/docs/site/surfaces/react-query.mdx +3 -3
  87. package/docs/site/surfaces/swr.mdx +3 -3
  88. package/docs/site/surfaces/typescript.mdx +8 -8
  89. package/docs/site/surfaces.mdx +1 -1
  90. package/package-docs.mjs +3 -0
  91. package/package.json +11 -11
  92. package/src/bin.ts +0 -0
  93. package/src/index.test.ts +2 -1
  94. package/src/index.ts +6 -1
  95. package/src/mcp.ts +4 -0
  96. package/src/package.test.ts +9 -0
  97. package/dist/mount-xvMsjz1B.mjs +0 -178
  98. package/dist/mount-xvMsjz1B.mjs.map +0 -1
  99. package/dist/src-BF70JLxI.mjs.map +0 -1
  100. package/dist/src-C2MGIlT0.mjs +0 -464
  101. package/dist/src-C2MGIlT0.mjs.map +0 -1
  102. package/dist/src-CDxL6w3d.mjs.map +0 -1
  103. package/dist/src-Db6-XSnU.mjs.map +0 -1
  104. package/dist/src-DdV82An-.mjs.map +0 -1
@@ -3,6 +3,220 @@
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 `&nbsp;` 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
+
125
+ ## 2026-09-01 — Surface selection has two execution paths
126
+
127
+ - **Observed:** App and MCP selection filters a resolved manifest, while the
128
+ HTTP projection filters locally located Capabilities. Making selection paths
129
+ fail closed exposed that these paths implement the same tree semantics in
130
+ different packages.
131
+ - **Why it matters:** A stale or misspelled selection must not silently expose
132
+ a different surface, and its validation behavior should not depend on which
133
+ surface consumes it.
134
+ - **Current choice:** Validate resolved App-manifest selection now, which
135
+ covers `selectApp()` and MCP mounts. Keep the existing HTTP projection
136
+ behavior unchanged in this MCP-focused change.
137
+ - **Follow-up:** Move tree matching and path validation behind one
138
+ surface-neutral App helper, then use it from both manifest and HTTP
139
+ selection.
140
+
141
+ ## 2026-09-01 — Structured surface metadata crosses remote App boundaries unvalidated
142
+
143
+ - **Observed:** Adding MCP icon descriptors made the projection call array
144
+ operations on `meta.mcp.icons`. Local definitions are type-checked, but a
145
+ remote App manifest preserves open surface metadata as unknown JSON, so a
146
+ malformed icon value could otherwise throw an incidental `TypeError` during
147
+ MCP tool discovery.
148
+ - **Why it matters:** `@capable/app` cannot validate registry-specific metadata
149
+ without depending on every surface, while each surface must still treat a
150
+ remote manifest as untrusted input.
151
+ - **Current choice:** Validate the MCP metadata fields at the MCP projection
152
+ boundary and report the Capability ID plus the invalid field. Keep the App
153
+ manifest open and transport-neutral.
154
+ - **Follow-up:** If another surface needs the same structured-metadata checks,
155
+ extract a small validation helper in `@capable/app`; do not add a generic
156
+ closed metadata schema to core.
157
+
158
+ ## 2026-08-05 — An internal-looking protocol path collided with Next routing
159
+
160
+ - **Observed:** The original `/_capable` default looked implementation-private,
161
+ but Next.js treats underscore-prefixed App Router folders as non-routable and
162
+ required the surprising `app/%5Fcapable` spelling. A plain `/capable` path
163
+ removed that friction but gave a framework protocol a common page name.
164
+ - **Why it matters:** The protocol path crosses every host, generated caller,
165
+ development splash, proxy rule, and example. Its default should be literal in
166
+ first-party route files and unlikely to collide with application pages.
167
+ - **Current choice:** Use `/~capable` as the flag-day default with no legacy
168
+ alias. Keep `protocol({ path })` available for custom mounts.
169
+ - **Follow-up:** Keep a literal-folder Next integration test and URL-routing
170
+ coverage so future host changes cannot encode, strip, or reinterpret `~`.
171
+
172
+ ## 2026-08-05 — Relative transport URLs only have meaning in a browser
173
+
174
+ - **Observed:** Public browser examples used `"/_capable/"`, but the transport
175
+ passed every configured base through the single-argument `URL` constructor,
176
+ which rejects relative paths. Requiring every client component to defer a
177
+ `window.location.origin` lookup made the common case noisy.
178
+ - **Why it matters:** `createHttpTransport()` is shared by browsers, servers,
179
+ workers, CLIs, and tests. Only browsers provide an unambiguous ambient origin;
180
+ silently inventing one elsewhere would make requests environment-dependent.
181
+ - **Current choice:** Resolve relative URLs against `window.location.origin` at
182
+ request time when `window` exists. Outside a browser, keep the explicit error
183
+ and require an absolute URL or a request-aware `url` function.
184
+ - **Follow-up:** Add another ambient base only if a host exposes one with
185
+ equally clear semantics.
186
+
187
+ ## 2026-08-05 — Hand-written MCP output wrapping bypassed protocol projection
188
+
189
+ - **Observed:** The MCP adapter wrapped arrays and primitives under `value` and
190
+ rewrote their output schemas before handing them to the MCP v2 server. The
191
+ SDK already owns an era-aware projection: MCP 2026-07-28 supports natural
192
+ JSON values, while legacy clients require a matching object wrapper.
193
+ - **Why it matters:** The custom wrapper made modern MCP output differ from the
194
+ canonical Capability output and duplicated evolving wire-protocol policy in
195
+ Capable.
196
+ - **Current choice:** Keep the natural Capability output and schema inside the
197
+ projection, then call the SDK's `projectCallToolResult()`. The SDK preserves
198
+ modern values and applies the legacy `result` wrapper consistently to both
199
+ `tools/list` and `tools/call`.
200
+ - **Follow-up:** Keep protocol-version adaptation in the SDK unless Capable has
201
+ a semantic requirement the SDK cannot express.
202
+
203
+ ## 2026-08-05 — Runtime values and JSON Schema have different jobs
204
+
205
+ - **Observed:** Plain JSON transport converted a schema-valid `Date` into a
206
+ string before remote output validation, while Zod refused to project
207
+ `z.date()` into the manifest because JSON Schema has no equivalent type.
208
+ - **Why it matters:** A remote App could retain the authored TypeScript type but
209
+ return a different runtime value, and runtime-only schemas could prevent the
210
+ whole manifest from being exposed.
211
+ - **Current choice:** The private Capable protocol uses the versioned
212
+ `capable.rich-json.v1` codec, backed by an isolated SuperJSON instance, and
213
+ accepts matched custom `ProtocolCodec`s. Standard JSON Schema projection asks
214
+ the schema library to represent unrepresentable runtime values as unconstrained
215
+ JSON (`{}`) only for App manifests. Authored HTTP and OpenAPI remain strict,
216
+ plain JSON projections.
217
+ - **Follow-up:** Add a new codec ID and manifest protocol version for any wire
218
+ format change; do not inherit a dependency's format changes silently.
219
+
6
220
  ## 2026-08-05 — Markdown negotiation must run before static page matching
7
221
 
8
222
  - **Observed:** The `dom-md` Next.js example returns a flat rewrite list, which
@@ -184,7 +398,8 @@ duplicated, or leaky implementation work as it appears.
184
398
  - **Why it matters:** A Capable App contains handlers and provider functions that
185
399
  cannot cross a JSON workflow boundary. Hiding an MCP or HTTP hop inside the
186
400
  adapter would avoid that constraint but would not be a native integration.
187
- - **Current choice:** `createEveTools(app)` returns step-scoped dynamic tools.
401
+ - **Historical choice (superseded by the 2026-09-09 entry below):**
402
+ `createEveTools(app)` returned step-scoped dynamic tools.
188
403
  Eve resolves the manifest and live executors before each model step, then
189
404
  checkpoints the selected tool call and result using its normal durability
190
405
  semantics.
@@ -748,3 +963,268 @@ duplicated, or leaky implementation work as it appears.
748
963
  page shell derives the outline from those headings.
749
964
  - **Follow-up:** Rendered-site tests now verify the outline and resolve every
750
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.
@@ -41,10 +41,10 @@ You do not give up the normal full-stack experience by choosing Capable. A brows
41
41
  import { createRemoteApp } from "capable-kit";
42
42
  import { createHttpTransport } from "capable-kit/http";
43
43
  import { createReactQuery } from "capable-kit/react-query";
44
- import type definition from "../capable.app";
44
+ import type { AppDefinition } from "../capable.app";
45
45
 
46
- const app = createRemoteApp<typeof definition>(
47
- createHttpTransport({ url: "/_capable/" }),
46
+ const app = createRemoteApp<AppDefinition>(
47
+ createHttpTransport({ url: "/~capable/" }),
48
48
  );
49
49
 
50
50
  export const query = createReactQuery(app);
@@ -83,11 +83,11 @@ import {
83
83
  createApp,
84
84
  createEveTools,
85
85
  createRemoteApp,
86
- mergeApps,
86
+ composeApps,
87
87
  } from "capable-kit";
88
88
 
89
89
  const supportApp = createRemoteApp<typeof support>(supportTransport);
90
- const app = mergeApps(
90
+ const app = composeApps(
91
91
  supportApp,
92
92
  createApp(localDefinition, {
93
93
  context: createLocalContext,