capable-kit 0.1.0-alpha.10 → 0.1.0-alpha.11

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 (67) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/LICENSE +21 -0
  3. package/README.md +6 -0
  4. package/dist/ai-sdk.d.mts +2 -2
  5. package/dist/ai-sdk.mjs +1 -1
  6. package/dist/app.d.mts +2 -2
  7. package/dist/app.mjs +1 -1
  8. package/dist/bin.mjs +19 -15
  9. package/dist/bin.mjs.map +1 -1
  10. package/dist/cli.d.mts +1 -1
  11. package/dist/cli.mjs +1 -1
  12. package/dist/core.d.mts +3 -3
  13. package/dist/core.mjs +2 -2
  14. package/dist/eve.d.mts +20 -14
  15. package/dist/eve.mjs +450 -211
  16. package/dist/eve.mjs.map +1 -1
  17. package/dist/http.d.mts +1 -1
  18. package/dist/http.mjs +1 -1
  19. package/dist/{index-WiBWfyTn.d.mts → index-BIO_hbXJ.d.mts} +8 -2
  20. package/dist/{index-D-NV4PiU.d.mts → index-C0tU5Y2n.d.mts} +4 -4
  21. package/dist/{index-CHuCLJIs.d.mts → index-CwvjDizW.d.mts} +5 -3
  22. package/dist/{index-1A44jLuE.d.mts → index-F_eaksy8.d.mts} +7 -4
  23. package/dist/index.d.mts +4 -4
  24. package/dist/index.mjs +2 -2
  25. package/dist/mcp.d.mts +14 -4
  26. package/dist/mcp.mjs +2 -2
  27. package/dist/{mount-BmLHp349.mjs → mount-pvIaehZC.mjs} +148 -104
  28. package/dist/mount-pvIaehZC.mjs.map +1 -0
  29. package/dist/react-query.d.mts +1 -1
  30. package/dist/react-query.mjs +1 -1
  31. package/dist/runtime-support.d.mts +1 -1
  32. package/dist/runtime-support.mjs +3 -3
  33. package/dist/server.d.mts +1 -1
  34. package/dist/server.mjs +1 -1
  35. package/dist/{src-_6OmFRYa.mjs → src-Bk3lEhI7.mjs} +38 -18
  36. package/dist/src-Bk3lEhI7.mjs.map +1 -0
  37. package/dist/{src-DePlcG_t.mjs → src-C2OEkZ3c.mjs} +38 -65
  38. package/dist/src-C2OEkZ3c.mjs.map +1 -0
  39. package/dist/{src-C5jGDnuu.mjs → src-DFrxQ_S6.mjs} +9 -7
  40. package/dist/src-DFrxQ_S6.mjs.map +1 -0
  41. package/dist/{src-3LE9S4QE.mjs → src-DklM1g7V.mjs} +5 -5
  42. package/dist/src-DklM1g7V.mjs.map +1 -0
  43. package/dist/{src-B2WeUwUT.mjs → src-TCQGaWar.mjs} +60 -18
  44. package/dist/src-TCQGaWar.mjs.map +1 -0
  45. package/dist/{subscription-DPdwovhw.d.mts → subscription-fVgS4T8P.d.mts} +2 -2
  46. package/dist/swr.d.mts +1 -1
  47. package/dist/swr.mjs +1 -1
  48. package/docs/CONTEXT.md +5 -2
  49. package/docs/internal/eve-recovery-validation.md +12 -11
  50. package/docs/internal/implementation-friction.md +59 -0
  51. package/docs/site/concepts/errors.mdx +15 -3
  52. package/docs/site/hosting/standalone-server.mdx +2 -0
  53. package/docs/site/patterns/remote-apps.mdx +23 -1
  54. package/docs/site/quickstart.mdx +2 -1
  55. package/docs/site/reference/packages-and-entry-points.mdx +2 -1
  56. package/docs/site/reference/the-cap-cli.mdx +2 -2
  57. package/docs/site/surfaces/eve.mdx +6 -4
  58. package/docs/site/surfaces/mcp.mdx +84 -2
  59. package/package.json +13 -7
  60. package/src/index.ts +2 -0
  61. package/src/package.test.ts +6 -0
  62. package/dist/mount-BmLHp349.mjs.map +0 -1
  63. package/dist/src-3LE9S4QE.mjs.map +0 -1
  64. package/dist/src-B2WeUwUT.mjs.map +0 -1
  65. package/dist/src-C5jGDnuu.mjs.map +0 -1
  66. package/dist/src-DePlcG_t.mjs.map +0 -1
  67. package/dist/src-_6OmFRYa.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,176 @@
1
1
  # capable-kit
2
2
 
3
+ ## 0.1.0-alpha.11
4
+
5
+ ### Minor Changes
6
+
7
+ - ea745c1: **Breaking:** `capable-kit/eve` now targets Eve 1.x. The optional `eve` peer
8
+ dependency changes from exactly `0.52.3` to `^1.0.0`, and the Eve
9
+ `defineDurableCallback` patch is no longer needed. Remove it from your
10
+ `patchedDependencies` when you upgrade.
11
+
12
+ `createEveTools()` returns an Eve 1.x `defineDynamic(ctx => tools)` resolver
13
+ instead of a `session.started` event map. Eve evaluates it before every model
14
+ call. Capable memoizes the App manifest per session with `ctx.memo()` and still
15
+ rebuilds provider Apps from the execution session for each call. Provider
16
+ functions now receive only `{ session }`; the channel and message context are
17
+ gone. Approval policies are passed to Eve unchanged.
18
+
19
+ ```ts
20
+ // Before (Eve 0.52.3 + patch)
21
+ export default createEveTools(({ session }) => appForUser(session.auth.current!.principalId), {
22
+ approval: () => ({
23
+ request: () => "user-approval",
24
+ response: ({ responder, session }) =>
25
+ responder.principalId === session.initiator?.principalId
26
+ ? { status: "allowed" } : { status: "rejected", reason: "Not the initiator" },
27
+ }),
28
+ });
29
+
30
+ // After (Eve 1.x)
31
+ export default createEveTools(({ session }) => appForUser(session.auth.current!.principalId), {
32
+ approval: () => ({
33
+ request: () => "user-approval",
34
+ response: ({ response, session }) =>
35
+ response.principal.principalId === session.initiator?.principalId
36
+ ? { status: "allowed" } : { status: "rejected", reason: "Not the initiator" },
37
+ }),
38
+ });
39
+ ```
40
+
41
+ **Breaking:** `createEveAgentAdapter()` reads Eve's v27 session stream and needs
42
+ an Eve 1.x `Client` (`new Client({ baseUrl })` instead of `host`). Its result
43
+ shape is unchanged, but:
44
+
45
+ - `cursor` is now the next stream line to read, not an event count. Pass the
46
+ returned cursor back unchanged; do not compute it yourself.
47
+ - `requestId` is Eve's `interactionId`. Answers are sent as Eve `answers`.
48
+ - `send({ wait: true })` after answering a question now waits for the resumed
49
+ turn to settle or pause again.
50
+ - `cancel` waits up to `readTimeoutMs` for Eve to settle the cancel.
51
+ `accepted` now means the cancel applied, `no_active_turn` means Eve had
52
+ nothing to cancel, and the new `pending` means Eve accepted the request but
53
+ did not confirm it in time. A failed cancel throws.
54
+ - `send({ wait: true })` summarizes the turn for its own delivery, even when a
55
+ newer turn settles before the final read.
56
+ - f018f26: **Breaking:** Pass unexpected runtime errors through unchanged for in-process `executeCapability()` and local `createApp()` calls, and mask unexpected errors only at external wire boundaries (`http()`, `protocol()`, `mcp()`).
57
+
58
+ Before, every undeclared throw in a handler, middleware, context provider, or `toPresentation` renderer was wrapped in `CapableError("INTERNAL_SERVER_ERROR")` and then wrapped again in `TransportError("INTERNAL_SERVER_ERROR")` even for in-process callers and local CLIs:
59
+
60
+ ```ts
61
+ // Before
62
+ try {
63
+ await localApp.invoices.sync({});
64
+ } catch (error) {
65
+ // TransportError("INTERNAL_SERVER_ERROR") -> cause: CapableError -> cause: StripeError
66
+ }
67
+
68
+ // After
69
+ try {
70
+ await localApp.invoices.sync({});
71
+ } catch (error) {
72
+ // Throws the original StripeError directly; declared errors throw CapableError directly.
73
+ // errors.NOT_FOUND.is(error) continues to narrow both local and remote calls.
74
+ }
75
+ ```
76
+
77
+ External mounts (`http()`, `protocol()`, `mcp()`) continue to mask unexpected and undeclared errors to `INTERNAL_SERVER_ERROR` (500) before serializing a response, and now forward the original unexpected error to `createServer({ onError })` (as well as optional `onError` on `createHttpHandler()` and `createProtocolHandler()`). Undeclared `CapableError` instances thrown inside a handler still normalize to `INTERNAL_SERVER_ERROR`.
78
+
79
+ If in-process code caught `TransportError` for local `createApp()` calls, narrow declared errors with `MyErrors.CODE.is(error)` (which works for both local `CapableError` and remote `TransportError`) and catch unexpected errors by their real error class or `Error`.
80
+ - 41dadee: Upgrade Nitro to `3.0.261103-rc`, which roughly halves the install size of
81
+ `capable-kit` (about 48 MB to 26 MB in a fresh project). Rolldown is no longer
82
+ installed with Capable: only `cap build` needs it, so apps that use the
83
+ runtime, Next.js integration, or clients on their own stay light. `cap dev`
84
+ runs without it.
85
+
86
+ **Breaking:** `cap build` now requires `rolldown` in your project. Add it once:
87
+
88
+ ```sh
89
+ pnpm add -D rolldown
90
+ ```
91
+
92
+ Without it, `cap build` fails with an install hint instead of installing
93
+ Rolldown on demand. `cap init` adds `rolldown` to new and existing projects.
94
+
95
+ **Breaking:** Capable now requires Node.js 22.22 or newer. Node.js 20 reached
96
+ end-of-life on 2026-04-30; upgrade to Node.js 22.22+, 24, or 26.
97
+ - 815aabd: Add an app-level `toolName` formatter to `createMcp()` and `mcp()`, and support passing a static `manifest` to `createRemoteApp()`.
98
+
99
+ ### App-level MCP tool naming
100
+
101
+ Configure a surface-wide MCP tool naming convention without setting `meta.mcp.name` on every capability. Explicit `meta.mcp.name` and `customize()` overrides still win, and collisions are rejected.
102
+
103
+ ```ts
104
+ import { createMcp, mcp } from "capable-kit/mcp";
105
+
106
+ mcp({ toolName: (capability) => capability.path.join("_") });
107
+
108
+ const tools = await createMcp(app, {
109
+ toolName: (capability) => capability.id.replaceAll(".", "_"),
110
+ });
111
+ ```
112
+
113
+ ### Static manifests for `createRemoteApp()`
114
+
115
+ Pass `{ manifest }` to `createRemoteApp()` to validate a prebuilt manifest up front and skip the initial `GET /~capable/manifest` discovery round trip (useful for short-lived CLIs and offline `--help`). Generate the static manifest with `createAppManifest()` from `capable-kit/app`; `ApplicationManifest` and `CreateRemoteAppOptions` are also exported from `capable-kit`.
116
+
117
+ ```ts
118
+ import { createRemoteApp, type ApplicationManifest } from "capable-kit";
119
+ import { createAppManifest } from "capable-kit/app";
120
+ import { createHttpTransport } from "capable-kit/http";
121
+
122
+ const remote = createRemoteApp<AppDefinition>(
123
+ createHttpTransport({ url: "https://api.example.com/~capable/" }),
124
+ { manifest: prebuiltManifest as ApplicationManifest },
125
+ );
126
+ ```
127
+ - 9c57baf: Add `registerCapableTools()` to register App-backed tools on the native MCP SDK
128
+ server alongside handwritten tools and resources:
129
+
130
+ ```ts
131
+ import { McpServer } from "@modelcontextprotocol/server";
132
+ import { createMcp, registerCapableTools } from "capable-kit/mcp";
133
+
134
+ const server = new McpServer({ name: "tools", version: "1" });
135
+ const handles = registerCapableTools(server, await createMcp(app));
136
+ ```
137
+
138
+ The helper retains original schemas, metadata, presentation, Capable errors, and
139
+ request cancellation, and returns native SDK registration handles. The host owns
140
+ context and server lifecycle. Native registration rejects name collisions and
141
+ requires defined structured content when an output schema is declared; the
142
+ existing `mcp()` mount keeps its behavior.
143
+
144
+ ### Patch Changes
145
+
146
+ - 815aabd: Improve package metadata, dependency hygiene, schema error messages, and `cap init` defaults:
147
+
148
+ - License `capable-kit` under the MIT License, include `LICENSE` in the published package, and add `repository` metadata.
149
+ - Remove `zod` from `capable-kit`'s runtime dependencies (the internal Eve agent adapter no longer imports `zod`), so consumers bring a single schema library of their choice without duplicate Zod installs.
150
+ - Throw an actionable error in `schemaToJsonSchema()` when a schema does not implement Standard JSON Schema v1 (explicitly noting that Zod schemas require `zod >= 4.2`).
151
+ - Update `cap init` to scaffold `"capable-kit": "latest"` and `"zod": "^4.2.0"` instead of the stale `"alpha"` tag and `"^4.0.0"`.
152
+ - 815aabd: Preserve `CapableError` and `TransportError` thrown from `createApp()` and `createServer()` context providers instead of rewriting them to `INTERNAL_SERVER_ERROR` (500). Unexpected errors from context providers propagate in-process and normalize to `INTERNAL_SERVER_ERROR` at external wire boundaries.
153
+
154
+ ```ts
155
+ import { createServer, defineErrors, http, protocol } from "capable-kit";
156
+ import { mcp } from "capable-kit/mcp";
157
+
158
+ const authErrors = defineErrors({
159
+ UNAUTHENTICATED: { status: 401, message: "Invalid or missing token" },
160
+ });
161
+
162
+ const server = createServer(app, {
163
+ context: async ({ request }) => {
164
+ const user = await verifyBearerToken(request);
165
+ if (!user) throw authErrors.UNAUTHENTICATED();
166
+ return { user };
167
+ },
168
+ mounts: [protocol(), http(), mcp()],
169
+ });
170
+ ```
171
+
172
+ Context provider auth failures now report the same error code and status consistently across local calls, subscriptions, `/api`, `/~capable`, and `/mcp`.
173
+
3
174
  ## 0.1.0-alpha.10
4
175
 
5
176
  ### Minor Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vercel, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -41,6 +41,12 @@ cap dev
41
41
 
42
42
  ## Deploy
43
43
 
44
+ `cap build` bundles with Rolldown. Add it to the project once:
45
+
46
+ ```sh
47
+ pnpm add -D rolldown
48
+ ```
49
+
44
50
  Capable detects supported build environments such as Vercel and emits their
45
51
  native deployment output:
46
52
 
package/dist/ai-sdk.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as CapabilityTree, a as CapabilityDefinition, j as CapabilityGroupDefinition, m as CapabilityOutput, t as AnyCapability, u as CapabilityInput } from "./index-WiBWfyTn.mjs";
2
- import { d as AnyApp, p as AppCapabilities } from "./index-1A44jLuE.mjs";
1
+ import { M as CapabilityTree, a as CapabilityDefinition, j as CapabilityGroupDefinition, m as CapabilityOutput, t as AnyCapability, u as CapabilityInput } from "./index-BIO_hbXJ.mjs";
2
+ import { d as AnyApp, p as AppCapabilities } from "./index-F_eaksy8.mjs";
3
3
  import { Tool, ToolExecutionOptions } from "ai";
4
4
  //#region packages/ai-sdk/src/index.d.ts
5
5
  type AiSdkCapabilityMeta = false | {
package/dist/ai-sdk.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { d as getAppRuntime, h as flattenManifestCapabilities, i as getCapabilityDisplay } from "./src-DePlcG_t.mjs";
1
+ import { d as getAppRuntime, h as flattenManifestCapabilities, i as getCapabilityDisplay } from "./src-C2OEkZ3c.mjs";
2
2
  import { jsonSchema, tool } from "ai";
3
3
  //#region packages/ai-sdk/src/index.ts
4
4
  const emptyInputSchema = Object.freeze({
package/dist/app.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as JsonSchema, C as TransportError, D as isApp, E as getAppRuntime, F as createAppManifest, I as flattenManifestCapabilities, M as ManifestError, N as ManifestGroup, O as subscribe, P as ManifestNode, S as CapabilityResult, T as createRemoteApp, _ as AppCapabilityReference, a as CustomizedCapability, b as CallableTree, c as getCapabilityNavigationMeta, d as AnyApp, f as App, g as AppCapabilityIsSubscribable, h as AppCapabilityIsLive, i as CapabilityCustomization, j as ManifestCapability, k as ApplicationManifest, l as APP_CAPABILITIES_SYMBOL, m as AppCapabilityCall, n as composeApps, o as customize, p as AppCapabilities, r as selectApp, s as getCapabilityDisplay, t as ApplicationSelection, u as APP_RUNTIME_SYMBOL, v as AppContextProvider, w as createApp, x as CapabilityCall, y as ApplicationTransport } from "./index-1A44jLuE.mjs";
2
- export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, type AnyApp, type App, type AppCapabilities, type AppCapabilityCall, type AppCapabilityIsLive, type AppCapabilityIsSubscribable, type AppCapabilityReference, type AppContextProvider, type ApplicationManifest, type ApplicationSelection, type ApplicationTransport, type CallableTree, type CapabilityCall, type CapabilityCustomization, type CapabilityResult, type CustomizedCapability, type JsonSchema, type ManifestCapability, type ManifestError, type ManifestGroup, type ManifestNode, TransportError, composeApps, createApp, createAppManifest, createRemoteApp, customize, flattenManifestCapabilities, getAppRuntime, getCapabilityDisplay, getCapabilityNavigationMeta, isApp, selectApp, subscribe };
1
+ import { A as ApplicationManifest, C as CreateRemoteAppOptions, D as getAppRuntime, E as createRemoteApp, F as ManifestNode, I as createAppManifest, L as flattenManifestCapabilities, M as ManifestCapability, N as ManifestError, O as isApp, P as ManifestGroup, S as CapabilityResult, T as createApp, _ as AppCapabilityReference, a as CustomizedCapability, b as CallableTree, c as getCapabilityNavigationMeta, d as AnyApp, f as App, g as AppCapabilityIsSubscribable, h as AppCapabilityIsLive, i as CapabilityCustomization, j as JsonSchema, k as subscribe, l as APP_CAPABILITIES_SYMBOL, m as AppCapabilityCall, n as composeApps, o as customize, p as AppCapabilities, r as selectApp, s as getCapabilityDisplay, t as ApplicationSelection, u as APP_RUNTIME_SYMBOL, v as AppContextProvider, w as TransportError, x as CapabilityCall, y as ApplicationTransport } from "./index-F_eaksy8.mjs";
2
+ export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, type AnyApp, type App, type AppCapabilities, type AppCapabilityCall, type AppCapabilityIsLive, type AppCapabilityIsSubscribable, type AppCapabilityReference, type AppContextProvider, type ApplicationManifest, type ApplicationSelection, type ApplicationTransport, type CallableTree, type CapabilityCall, type CapabilityCustomization, type CapabilityResult, type CreateRemoteAppOptions, type CustomizedCapability, type JsonSchema, type ManifestCapability, type ManifestError, type ManifestGroup, type ManifestNode, TransportError, composeApps, createApp, createAppManifest, createRemoteApp, customize, flattenManifestCapabilities, getAppRuntime, getCapabilityDisplay, getCapabilityNavigationMeta, isApp, selectApp, subscribe };
package/dist/app.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as getCapabilityNavigationMeta, c as TransportError, d as getAppRuntime, f as isApp, h as flattenManifestCapabilities, i as getCapabilityDisplay, l as createApp, m as createAppManifest, n as selectApp, o as APP_CAPABILITIES_SYMBOL, p as subscribe, r as customize, s as APP_RUNTIME_SYMBOL, t as composeApps, u as createRemoteApp } from "./src-DePlcG_t.mjs";
1
+ import { a as getCapabilityNavigationMeta, c as TransportError, d as getAppRuntime, f as isApp, h as flattenManifestCapabilities, i as getCapabilityDisplay, l as createApp, m as createAppManifest, n as selectApp, o as APP_CAPABILITIES_SYMBOL, p as subscribe, r as customize, s as APP_RUNTIME_SYMBOL, t as composeApps, u as createRemoteApp } from "./src-C2OEkZ3c.mjs";
2
2
  export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, TransportError, composeApps, createApp, createAppManifest, createRemoteApp, customize, flattenManifestCapabilities, getAppRuntime, getCapabilityDisplay, getCapabilityNavigationMeta, isApp, selectApp, subscribe };
package/dist/bin.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { t as APPLICATION_SYMBOL } from "./src-B2WeUwUT.mjs";
3
- import { f as isApp, l as createApp, u as createRemoteApp } from "./src-DePlcG_t.mjs";
4
- import { a as createCliStyle, c as renderSection, l as supportsColor, n as runCli, o as descriptionColumn, s as renderRows } from "./src-3LE9S4QE.mjs";
5
- import { n as createHttpTransport } from "./src-_6OmFRYa.mjs";
2
+ import { t as APPLICATION_SYMBOL } from "./src-TCQGaWar.mjs";
3
+ import { f as isApp, l as createApp, u as createRemoteApp } from "./src-C2OEkZ3c.mjs";
4
+ import { a as createCliStyle, c as renderSection, l as supportsColor, n as runCli, o as descriptionColumn, s as renderRows } from "./src-DklM1g7V.mjs";
5
+ import { n as createHttpTransport } from "./src-Bk3lEhI7.mjs";
6
6
  import path from "node:path";
7
7
  import { spawn } from "node:child_process";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -117,11 +117,11 @@ function createCapableNitroConfig(project, options) {
117
117
  serverEntry: virtualServerEntry,
118
118
  serverDir: false,
119
119
  scanDirs: [],
120
- imports: false,
121
120
  noPublicDir: true,
122
121
  logLevel: 2,
123
122
  logging: { buildSuccess: false },
124
123
  framework: { name: "capable" },
124
+ deps: { install: false },
125
125
  ...options.outputDir ? { output: { dir: options.outputDir } } : {}
126
126
  };
127
127
  }
@@ -355,9 +355,10 @@ const SCRIPTS = {
355
355
  preview: "cap preview"
356
356
  };
357
357
  const DEPENDENCIES = {
358
- "capable-kit": "alpha",
359
- zod: "^4.0.0"
358
+ "capable-kit": "latest",
359
+ zod: "^4.2.0"
360
360
  };
361
+ const DEV_DEPENDENCIES = { rolldown: "^1.0.0" };
361
362
  async function initializeCapableProject(options) {
362
363
  const directory = path.resolve(options.directory);
363
364
  await mkdir(directory, { recursive: true });
@@ -399,7 +400,8 @@ function preparePackageJson(directory, existing) {
399
400
  version: "0.0.0",
400
401
  type: "module",
401
402
  scripts: SCRIPTS,
402
- dependencies: DEPENDENCIES
403
+ dependencies: DEPENDENCIES,
404
+ devDependencies: DEV_DEPENDENCIES
403
405
  }
404
406
  };
405
407
  let changed = false;
@@ -411,18 +413,20 @@ function preparePackageJson(directory, existing) {
411
413
  changed = true;
412
414
  }
413
415
  if (changed || !("scripts" in value)) value.scripts = scripts;
414
- const dependencies = readObjectField(value, "dependencies");
415
- for (const [name, version] of Object.entries(DEPENDENCIES)) {
416
- if (hasDeclaredDependency(value, name)) continue;
417
- dependencies[name] = version;
418
- changed = true;
419
- }
420
- if (Object.keys(dependencies).length || "dependencies" in value) value.dependencies = dependencies;
416
+ if (addMissingDependencies(value, "dependencies", DEPENDENCIES)) changed = true;
417
+ if (addMissingDependencies(value, "devDependencies", DEV_DEPENDENCIES)) changed = true;
421
418
  return {
422
419
  value,
423
420
  action: changed ? "updated" : "unchanged"
424
421
  };
425
422
  }
423
+ function addMissingDependencies(packageJson, field, wanted) {
424
+ const dependencies = readObjectField(packageJson, field);
425
+ const missing = Object.entries(wanted).filter(([name]) => !hasDeclaredDependency(packageJson, name));
426
+ for (const [name, version] of missing) dependencies[name] = version;
427
+ if (Object.keys(dependencies).length || field in packageJson) packageJson[field] = dependencies;
428
+ return missing.length > 0;
429
+ }
426
430
  function readObjectField(value, field) {
427
431
  const current = value[field];
428
432
  if (current === void 0) return {};