capable-kit 0.0.1-alpha.8 → 0.1.0-alpha.9

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 (78) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/README.md +6 -0
  3. package/dist/ai-sdk.d.mts +2 -2
  4. package/dist/ai-sdk.mjs +1 -1
  5. package/dist/app.d.mts +2 -2
  6. package/dist/app.mjs +2 -2
  7. package/dist/bin.mjs +4 -4
  8. package/dist/cli.d.mts +4 -1
  9. package/dist/cli.mjs +1 -1
  10. package/dist/core.d.mts +2 -2
  11. package/dist/core.mjs +1 -1
  12. package/dist/eve.d.mts +82 -5
  13. package/dist/eve.mjs +358 -19
  14. package/dist/eve.mjs.map +1 -1
  15. package/dist/http.d.mts +1 -1
  16. package/dist/http.mjs +1 -1
  17. package/dist/{index-F4ba_olD.d.mts → index-D63DSGZG.d.mts} +10 -5
  18. package/dist/{index-Dl4NK9G0.d.mts → index-D8DWjQ9f.d.mts} +3 -3
  19. package/dist/{index-hdH_K5Zc.d.mts → index-DgxvtAmv.d.mts} +4 -4
  20. package/dist/{index-_qKFfWV4.d.mts → index-ftQx6OMr.d.mts} +23 -13
  21. package/dist/index.d.mts +4 -4
  22. package/dist/index.mjs +3 -3
  23. package/dist/mcp.d.mts +2 -2
  24. package/dist/mcp.mjs +1 -1
  25. package/dist/{mount-CEFAplR5.mjs → mount-B9TrHWHh.mjs} +3 -3
  26. package/dist/{mount-CEFAplR5.mjs.map → mount-B9TrHWHh.mjs.map} +1 -1
  27. package/dist/react-query.d.mts +1 -1
  28. package/dist/react-query.mjs +1 -1
  29. package/dist/runtime-support.d.mts +1 -1
  30. package/dist/runtime-support.mjs +3 -3
  31. package/dist/server.d.mts +1 -1
  32. package/dist/server.mjs +1 -1
  33. package/dist/{src-betOfnDL.mjs → src-B592M-6b.mjs} +143 -44
  34. package/dist/src-B592M-6b.mjs.map +1 -0
  35. package/dist/{src-D-cm2gQ6.mjs → src-Bd1Vnze8.mjs} +16 -2
  36. package/dist/src-Bd1Vnze8.mjs.map +1 -0
  37. package/dist/{src-BWxDO2Ua.mjs → src-CKC1BdXO.mjs} +3 -3
  38. package/dist/{src-BWxDO2Ua.mjs.map → src-CKC1BdXO.mjs.map} +1 -1
  39. package/dist/{src-D_0PIhqq.mjs → src-CL9eA6_p.mjs} +42 -25
  40. package/dist/src-CL9eA6_p.mjs.map +1 -0
  41. package/dist/{src-rkr5j_NH.mjs → src-Hw9WBgEW.mjs} +3 -3
  42. package/dist/{src-rkr5j_NH.mjs.map → src-Hw9WBgEW.mjs.map} +1 -1
  43. package/dist/{subscription-B-auXJbm.d.mts → subscription-DbnHcm7C.d.mts} +2 -2
  44. package/dist/swr.d.mts +1 -1
  45. package/dist/swr.mjs +1 -1
  46. package/docs/CONTEXT.md +17 -10
  47. package/docs/README.md +3 -0
  48. package/docs/internal/README.md +3 -0
  49. package/docs/internal/adr/0001-capability-is-the-semantic-boundary.md +1 -1
  50. package/docs/internal/architecture.md +11 -10
  51. package/docs/internal/capability-first-model.md +31 -8
  52. package/docs/internal/eve-recovery-validation.md +86 -0
  53. package/docs/internal/feedback/v-ray/README.md +258 -0
  54. package/docs/internal/feedback/v-ray/inference.mjs +43 -0
  55. package/docs/internal/feedback/v-ray/reproduce.mjs +36 -0
  56. package/docs/internal/implementation-friction.md +301 -1
  57. package/docs/internal/releases.md +79 -0
  58. package/docs/site/capable-orpc-and-trpc.mdx +2 -2
  59. package/docs/site/concepts/apps.mdx +6 -0
  60. package/docs/site/concepts/architecture.mdx +1 -1
  61. package/docs/site/concepts/capabilities.mdx +39 -2
  62. package/docs/site/concepts/errors.mdx +11 -1
  63. package/docs/site/concepts/presentations.mdx +16 -0
  64. package/docs/site/patterns/composition.mdx +50 -8
  65. package/docs/site/patterns/remote-apps.mdx +1 -1
  66. package/docs/site/quickstart.mdx +1 -1
  67. package/docs/site/reference/packages-and-entry-points.mdx +11 -3
  68. package/docs/site/surfaces/cli.mdx +33 -0
  69. package/docs/site/surfaces/eve.mdx +65 -18
  70. package/docs/site/surfaces/typescript.mdx +1 -1
  71. package/package-docs.mjs +3 -0
  72. package/package.json +10 -11
  73. package/src/bin.ts +0 -0
  74. package/src/index.test.ts +1 -1
  75. package/src/index.ts +1 -1
  76. package/dist/src-D-cm2gQ6.mjs.map +0 -1
  77. package/dist/src-D_0PIhqq.mjs.map +0 -1
  78. package/dist/src-betOfnDL.mjs.map +0 -1
@@ -0,0 +1,258 @@
1
+ # v-ray migration feedback review
2
+
3
+ Reviewed 2026-09-09 at Capable commit `88de060ddfec42c2c33b83a8fab25ccb8f9a6a04`.
4
+ The investigation below records the baseline at that commit.
5
+
6
+ ## Implemented follow-up
7
+
8
+ The current worktree now forwards markdansi's complete `RenderOptions` through
9
+ `createCli(app, { markdown: { codeBox: false } })`, including watch rendering.
10
+ Root empty/help-only invocations retain the app banner and command listing with
11
+ Capability arguments and options underneath; root `--json`
12
+ and `--watch` select execution, duplicate roots produce a usage error, and error
13
+ hints no longer contain a doubled space.
14
+
15
+ Inferred-output Capability overloads infer the handler return type directly,
16
+ then apply `Awaited` to derive canonical output, preserving mixed synchronous and
17
+ asynchronous return branches. Named
18
+ renderers pass in either property position on TS 5.8.3 and 7.0.1 RC, preserving
19
+ extra handler output fields and rejecting incompatible renderers. Untyped inline
20
+ renderers before `handler` still receive `unknown`; place inline renderers after
21
+ the handler. Explicit output schemas continue to work. The diagnostic script
22
+ therefore now reports success for both named cases against the current build;
23
+ the installed alpha.8 baseline remains unchanged.
24
+
25
+ Dependency restructuring, paragraph spacing, and end-of-options delimiter
26
+ handling remain follow-up work. No v-ray files or published packages changed.
27
+
28
+ ## Assessment and evidence
29
+
30
+ The migration demonstrates the intended boundary: one analysis Capability feeds
31
+ a local Next.js Server Component, the legacy HTTP adapter, the `/~capable/`
32
+ protocol, and local/remote CLI. The existing analyzer remains application code.
33
+ Presentation derives from the same result without changing canonical JSON.
34
+
35
+ The integration was inspected read-only in `/Volumes/Development/v-ray`:
36
+ `capable.app.ts`, `capable/presentation.ts`, `scripts/cli.ts`,
37
+ `test/capable.test.ts`, `README.md`, and `app/api/v2/providers/route.ts`.
38
+ Its package is the installed `capable-kit@0.0.1-alpha.8`, not a workspace link.
39
+ The worktree declares the same version; more importantly, the installed source
40
+ maps contain byte-identical copies of current `core/src/capability.ts`,
41
+ `core/src/presentation.ts`, `cli/src/index.ts`, and `cli/src/presentation.ts`.
42
+ Runtime reproductions produced identical output for the installed and locally
43
+ built packages. None of the four reported issues is already fixed here.
44
+
45
+ Reported Next.js production build, migration tests, typecheck, and fixture
46
+ end-to-end success are migration evidence supplied by the integration owner;
47
+ they were not rerun in v-ray during this review. Production deployment remains
48
+ unvalidated. The following findings use focused, deterministic local fixtures.
49
+
50
+ ## 1. P1: Route root help through the root Capability
51
+
52
+ Existing API already expresses the desired invocation; no new `root` flag is needed:
53
+
54
+ ```ts
55
+ capability({
56
+ id: 'analysis.url',
57
+ input: z.object({ url: z.string() }),
58
+ meta: { cli: { command: [], positional: ['url'] } },
59
+ handler: ({ input }) => analyzeURL(input.url),
60
+ });
61
+ await createCli(app, { invocationName: 'pnpm cli' }).run(process.argv.slice(2));
62
+ // pnpm cli vercel.com
63
+ // pnpm cli --help → proposed: detailed <url> help
64
+ ```
65
+
66
+ `packages/cli/src/index.ts` removes global flags and returns root/group help
67
+ when no tokens remain, before matching commands. Reproduced behavior:
68
+
69
+ | Arguments | Current result |
70
+ | --- | --- |
71
+ | `vercel.com` | Executes the root Capability successfully |
72
+ | empty, `--help`, or `-h` | Generic `<command>` help; omits detailed arguments |
73
+ | `--help --` | Detailed root `<url>` help, exit 0 |
74
+ | `--json` alone | Generic help on stdout, exit 0, even with a defaulted URL |
75
+ | `--wat` or excess positional arguments | Useful specific error, exit 2; help hint contains `pnpm cli --help` with two spaces |
76
+ | `-- vercel.com` | `Unknown option --`, exit 2 |
77
+
78
+ The workaround works because help returns before input parsing. `--` is not
79
+ currently a functioning end-of-options delimiter. Global flags are also removed
80
+ regardless of delimiter position. Do not document the workaround as delimiter support.
81
+
82
+ Small first patch: resolve a unique empty command before the empty-argv help
83
+ branch and render its command help for empty/help-only invocation. Keep existing
84
+ group behavior when no root Capability exists. Build command names with a token
85
+ join to remove the doubled space. Add tests for required/defaulted/no-input roots,
86
+ local/remote Apps, mixed root/subcommands, and duplicate root mappings. Reject
87
+ ambiguous roots instead of silently choosing by catalog order; preserve longer
88
+ subcommand precedence.
89
+
90
+ Separate follow-up: decide and document no-argument execution. A conservative
91
+ first patch retains bare invocation as help; explicit `--json` should select
92
+ execution (including schema defaults), or emit a missing-input error when
93
+ required input is absent. It should never return human help as successful JSON.
94
+ Test `--watch` with the same dispatch policy. Implement normal `--` handling in
95
+ the argument parser as a separate bounded fix, including global-flag handling
96
+ after the delimiter. These are dispatch/parser corrections, not a new CLI DSL.
97
+
98
+ ## 2. P1: Make output inference independent of renderer form/order
99
+
100
+ The reproduction uses an input schema, an async handler with inferred
101
+ `{ url: string; status: number }` output, and a named presentation function.
102
+ It also assigns the typed App call result to that output type.
103
+
104
+ | Form | TS 5.8.3 | TS 7.0.1 RC |
105
+ | --- | --- | --- |
106
+ | Named renderer before handler | TS2769, renderer expects `unknown` | Same |
107
+ | Named renderer after handler | TS2769 | Same |
108
+ | Inline renderer before handler | TS2345; App output is `unknown` (TS2322) | Same |
109
+ | Inline renderer after handler | Pass | Pass |
110
+ | Explicit output schema, named renderer before handler | Pass | Pass |
111
+
112
+ Results match for installed alpha.8 declarations and freshly built declarations.
113
+ Both runs use workspace Zod 4.4.3 to isolate compiler/package variables; this is
114
+ a minimized reproduction, not a compile of the full FetchResult type with v-ray's
115
+ Zod 4.5.4. The exact reported diagnostic does not require that full type.
116
+
117
+ Working current example:
118
+
119
+ ```ts
120
+ capability({
121
+ id: 'analysis.url',
122
+ input: z.object({ url: z.string() }),
123
+ handler: ({ input }) => analyzeURL(input.url),
124
+ toPresentation: result => presentAnalysis(result),
125
+ });
126
+ ```
127
+
128
+ Target: allow `toPresentation: presentAnalysis` in either property position,
129
+ preserving output inference and rejecting a renderer for an incompatible result.
130
+ Investigate the inferred-output overload's coupling of `THandler` and
131
+ `Awaited<ReturnType<THandler>>`; prototype inference isolation (`NoInfer`) or a
132
+ direct output type parameter before selecting a fix. Neither approach has been
133
+ validated here. Do not solve this with `any`, consumer casts, or a mandatory
134
+ output schema. An explicit schema is a useful contract decision, but adds runtime
135
+ validation and must not be demanded just to make renderer inference work.
136
+ Add compile fixtures for both supported compilers, property orders, named/inline
137
+ renderers, async output, incompatible renderers, and output transforms.
138
+
139
+ ## 3. P2: Expose the small renderer controls already available
140
+
141
+ Capable lowers all presentation parts to Markdown, then calls markdansi 0.3.2
142
+ with only `color` and `width` in a TTY. Redirected output is raw Markdown.
143
+ The runtime fixture confirms:
144
+
145
+ - Two Markdown paragraphs become adjacent terminal lines, without a blank line.
146
+ - Fenced code and tables receive boxes by default.
147
+ - markdansi's `codeBox: false` preserves aligned fenced rows without a box.
148
+ - `tableBorder: 'none', tableDense: true` removes the outside box, but retains
149
+ column `|` separators. This is not a complete key/value detail-row layout.
150
+ - Those controls do not fix ordinary paragraph spacing. Its documented
151
+ `spacing` option belongs to streaming, not the whole-document `render()` used here.
152
+
153
+ Start with a small CLI-owned option, not new core parts or a renderer callback.
154
+ Illustrative proposed API (not available today):
155
+
156
+ ```ts
157
+ createCli(app, {
158
+ invocationName: 'pnpm cli',
159
+ markdown: { codeBox: false, tableBorder: 'none', tableDense: true },
160
+ });
161
+ ```
162
+
163
+ This permits ordinary fenced text for response headers and duration bars;
164
+ the consumer no longer needs dynamic inline-code delimiters solely to avoid
165
+ terminal boxes. Keep escaping untrusted remote values. Verify narrow terminals,
166
+ long headers, wide Unicode labels, and non-TTY Markdown before changing defaults.
167
+
168
+ Handle paragraph spacing as a focused renderer issue with before/after fixtures;
169
+ do not regex-rewrite arbitrary Markdown. Only if spacing remains unsolved should
170
+ a narrowly scoped detail-row helper be considered, with a portable Markdown
171
+ lowering. Any new core part would also need normalization, HTTP and MCP support,
172
+ which is disproportionate to the first fix. Framework joins (`+`), provider-role
173
+ arrows, duration units, and proportional bar calculations remain v-ray policy.
174
+ The current headings are normal structure; inline-code alignment and the
175
+ `&nbsp;` footer spacer are the specific workarounds to remove.
176
+
177
+ ## 4. P2: Separate installed host dependencies from embedded usage
178
+
179
+ Both package manifests require Nitro `3.0.260610-beta`. The v-ray lockfile
180
+ resolves it with Vite 6.1.0 although its optional peer wants `^7 || ^8`.
181
+ Nitro's unstorage 2.0.0-alpha.7 dependency wants the optional peer
182
+ `@vercel/functions: ^2.2.12 || ^3.0.0`; v-ray resolves 2.2.4. These ranges
183
+ explain the reported warnings. No fresh v-ray install was run during this review.
184
+
185
+ Inspection of emitted module imports in both packages shows that the root,
186
+ `/core`, `/cli`, and `/next` entries do not reach Nitro. `/cli` imports markdansi.
187
+ The `cap` executable statically imports `nitro/builder`, including when invoking
188
+ toolchain CLI functionality. Nitro is external to Capable's emitted bundle but
189
+ installed transitively. Thus installed footprint is real; this evidence does
190
+ not show Nitro in v-ray's Next.js runtime bundle. No Next.js bundle size, cold
191
+ start, or deployment performance measurement was made.
192
+
193
+ Smallest packaging candidate: make Nitro an optional peer and load host code
194
+ lazily only for host commands. `optionalDependencies` alone still installs it
195
+ normally, and lazy imports alone do not reduce installation footprint. A
196
+ separate published host package is a larger alternative; current scoped packages
197
+ are private implementation boundaries and should not be advertised as installable.
198
+
199
+ Proposed install flow (not the current package contract):
200
+
201
+ ```sh
202
+ pnpm add capable-kit # embedded App, Next.js, createCli
203
+ pnpm add -D nitro@3.0.260610-beta # only when using cap dev/build host
204
+ ```
205
+
206
+ Retain current `createCli(app)` and Next mounting APIs. If choosing this option,
207
+ update generated standalone starters to include Nitro, give missing-host errors
208
+ an exact install command, and test packed installs with and without Nitro. Include
209
+ `cap --help`, local/remote `cap cli`, and `cap dev/build`: the executable must
210
+ remain usable without loading an absent host for unrelated commands. Consider
211
+ MCP's required SDK separately if install measurements justify doing so; do not
212
+ expand the initial packaging change to every surface.
213
+
214
+ ## Preserve the migration boundary
215
+
216
+ The legacy adapter owns truthy-flag coercion, deprecated
217
+ `force_browserbase_bypass`, URL normalization, plain-text 400 responses, GET 405,
218
+ and HTTP-200 analysis failures. Its positive fractional body limit floors to zero:
219
+
220
+ ```ts
221
+ const bodyMaxChars = typeof body_max_chars === 'number' && body_max_chars > 0
222
+ ? Math.floor(body_max_chars) : undefined;
223
+ const result = await app.analysis.url({ url: normalizedURL.href, body_max_chars: bodyMaxChars });
224
+ return new Response(JSON.stringify(result));
225
+ ```
226
+
227
+ That is why the Capability accepts a **nonnegative** integer. A stricter positive
228
+ schema would break compatibility. Returned error data remains canonical output;
229
+ thrown undeclared errors are normalized by Capable. Do not quietly convert one
230
+ into the other. Explicit output/error schemas are future v-ray work requiring
231
+ intentional compatibility decisions. Existing input schema direction/default
232
+ support already works here; the older default-requiredness friction entry should
233
+ not be mistaken for a present bug (defaulted URL help correctly shows optional).
234
+
235
+ MCP, `analyzeResponse()`, and sharing should follow concrete consumer demand.
236
+ The migration gives no reason to replace Next.js, introduce subscriptions, or
237
+ turn analyzer helpers into Capabilities.
238
+
239
+ ## Reproduction and validation
240
+
241
+ ```sh
242
+ pnpm install --frozen-lockfile
243
+ pnpm build
244
+ node docs/feedback/v-ray/reproduce.mjs
245
+ node docs/feedback/v-ray/reproduce.mjs /Volumes/Development/v-ray/node_modules/capable-kit
246
+ node docs/feedback/v-ray/inference.mjs
247
+ node docs/feedback/v-ray/inference.mjs /Volumes/Development/v-ray/node_modules/typescript/bin/tsc
248
+ node docs/feedback/v-ray/inference.mjs /Volumes/Development/v-ray/node_modules/typescript/bin/tsc /Volumes/Development/v-ray/node_modules/capable-kit
249
+ node docs/feedback/v-ray/inference.mjs node_modules/typescript/bin/tsc /Volumes/Development/v-ray/node_modules/capable-kit
250
+ pnpm exec vitest run packages/cli/src/cli.test.ts packages/core/src/presentation.test.ts
251
+ pnpm typecheck
252
+ ```
253
+
254
+ Build and typecheck passed; 12 existing focused tests passed. The reproduction
255
+ scripts print observations and compiler diagnostics, including expected current
256
+ failures; they are diagnostic tools, not passing regression assertions. The
257
+ inference script removes only its own temporary fixture directory. No v-ray
258
+ files were edited, no framework implementation changed, and nothing was published.
@@ -0,0 +1,43 @@
1
+ // Current compiler by default; pass an absolute tsc.js path for another compiler.
2
+ // Optional second argument selects an installed capable-kit package directory.
3
+ import { mkdtempSync, writeFileSync, rmSync } from 'node:fs';
4
+ import { resolve, join } from 'node:path';
5
+ import { spawnSync } from 'node:child_process';
6
+
7
+ const compiler = process.argv[2] ?? resolve('node_modules/typescript/bin/tsc');
8
+ const packageDirectory = process.argv[3] ?? resolve('packages/capable');
9
+ const temporary = mkdtempSync(resolve('.vray-inference-'));
10
+ try {
11
+ for (const form of ['named-before', 'named-after', 'inline-before', 'inline-after', 'explicit-output']) {
12
+ const handler = 'handler: ({ input }) => Promise.resolve({ url: input.url, status: 200 }),';
13
+ const renderer = form.startsWith('inline') ? 'toPresentation: result => presentAnalysis(result),' : 'toPresentation: presentAnalysis,';
14
+ const source = `
15
+ import { capability, createApp, defineApp, type PresentationValue } from 'capable-kit';
16
+ import { z } from 'zod';
17
+ type FetchResult = { url: string; status: number };
18
+ function presentAnalysis(result: FetchResult): PresentationValue { return result.url; }
19
+ const analysis = capability({
20
+ id: 'analysis.url',
21
+ input: z.object({ url: z.string() }),
22
+ ${form === 'explicit-output' ? 'output: z.object({ url: z.string(), status: z.number() }),' : ''}
23
+ ${form.endsWith('after') ? handler + renderer : renderer + handler}
24
+ });
25
+ const app = createApp(defineApp({ name: 'v-ray', capabilities: { analysis } }));
26
+ const result: FetchResult = await app.analysis({ url: 'vercel.com' });
27
+ const status: number = result.status;
28
+ `;
29
+ writeFileSync(join(temporary, 'case.ts'), source);
30
+ writeFileSync(join(temporary, 'tsconfig.json'), JSON.stringify({
31
+ compilerOptions: {
32
+ target: 'ES2022', module: 'Preserve', moduleResolution: 'Bundler',
33
+ strict: true, skipLibCheck: true, noEmit: true,
34
+ paths: { 'capable-kit': [resolve(packageDirectory, 'dist/index.d.mts')] },
35
+ }, files: ['./case.ts'],
36
+ }));
37
+ const result = spawnSync(process.execPath, [compiler, '-p', join(temporary, 'tsconfig.json')], { encoding: 'utf8' });
38
+ console.log(JSON.stringify({ form, exit: result.status, diagnostics: result.stdout + result.stderr }));
39
+ if (result.error) throw result.error;
40
+ }
41
+ } finally {
42
+ rmSync(temporary, { recursive: true, force: true });
43
+ }
@@ -0,0 +1,36 @@
1
+ // Run after pnpm build. Optional argument: absolute capable-kit package directory.
2
+ import { pathToFileURL } from 'node:url';
3
+ import { realpathSync } from 'node:fs';
4
+ import { resolve } from 'node:path';
5
+ import { createRequire } from 'node:module';
6
+ import { z } from 'zod';
7
+
8
+ const directory = process.argv[2] ?? resolve('packages/capable');
9
+ const entry = pathToFileURL(realpathSync(resolve(directory, 'dist/index.mjs')));
10
+ const { capability, defineApp, createApp } = await import(entry.href);
11
+ const { createCli } = await import(new URL('./cli.mjs', entry).href);
12
+ const { render } = await import(createRequire(entry).resolve('markdansi'));
13
+
14
+ for (const required of [true, false]) {
15
+ const app = createApp(defineApp({
16
+ name: 'v-ray',
17
+ capabilities: { analysis: { url: capability({
18
+ id: 'analysis.url',
19
+ description: 'Inspect a URL.',
20
+ input: z.object({ url: required ? z.string() : z.string().default('example.com') }),
21
+ meta: { cli: { command: [], positional: ['url'] } },
22
+ handler: ({ input }) => input,
23
+ }) } },
24
+ }));
25
+ for (const argv of [[], ['--help'], ['-h'], ['--help', '--'], ['vercel.com'], ['--json'], ['--wat'], ['one', 'two'], ['--', 'vercel.com']]) {
26
+ const stdout = [], stderr = [];
27
+ const exit = await createCli(app, { invocationName: 'pnpm cli', isTTY: false, color: false })
28
+ .run(argv, { io: { stdout: text => stdout.push(text), stderr: text => stderr.push(text) } });
29
+ console.log(JSON.stringify({ required, argv, exit, stdout, stderr }));
30
+ }
31
+ }
32
+ for (const markdown of ['First paragraph\n\nSecond paragraph', '### Headers\n\n```\nserver Vercel\ncache HIT\n```\n\nFooter', '| Header | Value |\n| --- | --- |\n| server | Vercel |']) {
33
+ for (const settings of [{}, { codeBox: false, tableBorder: 'none', tableDense: true }]) {
34
+ console.log(JSON.stringify({ markdown, settings, rendered: render(markdown, { color: false, width: 80, ...settings }) }));
35
+ }
36
+ }
@@ -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 `&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
+
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
- - **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.
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,183 @@ 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`.