capable-kit 0.0.1-alpha.8 → 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.
- package/CHANGELOG.md +385 -0
- package/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/ai-sdk.d.mts +3 -3
- package/dist/ai-sdk.mjs +9 -7
- package/dist/ai-sdk.mjs.map +1 -1
- package/dist/app.d.mts +2 -2
- package/dist/app.mjs +2 -2
- package/dist/bin.mjs +19 -15
- package/dist/bin.mjs.map +1 -1
- package/dist/cli.d.mts +9 -1
- package/dist/cli.mjs +1 -1
- package/dist/core.d.mts +3 -3
- package/dist/core.mjs +2 -2
- package/dist/eve.d.mts +92 -9
- package/dist/eve.mjs +606 -26
- package/dist/eve.mjs.map +1 -1
- package/dist/http.d.mts +1 -1
- package/dist/http.mjs +1 -1
- package/dist/{index-_qKFfWV4.d.mts → index-BIO_hbXJ.d.mts} +69 -26
- package/dist/{index-hdH_K5Zc.d.mts → index-C0tU5Y2n.d.mts} +4 -4
- package/dist/{index-Dl4NK9G0.d.mts → index-CwvjDizW.d.mts} +5 -3
- package/dist/{index-F4ba_olD.d.mts → index-F_eaksy8.d.mts} +58 -17
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/mcp.d.mts +19 -4
- package/dist/mcp.mjs +2 -2
- package/dist/{mount-CEFAplR5.mjs → mount-pvIaehZC.mjs} +159 -107
- package/dist/mount-pvIaehZC.mjs.map +1 -0
- package/dist/react-query.d.mts +2 -2
- package/dist/react-query.mjs +1 -1
- package/dist/react-query.mjs.map +1 -1
- package/dist/runtime-support.d.mts +1 -1
- package/dist/runtime-support.mjs +3 -3
- package/dist/server.d.mts +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{src-rkr5j_NH.mjs → src-Bk3lEhI7.mjs} +63 -25
- package/dist/src-Bk3lEhI7.mjs.map +1 -0
- package/dist/src-C2OEkZ3c.mjs +760 -0
- package/dist/src-C2OEkZ3c.mjs.map +1 -0
- package/dist/{src-BWxDO2Ua.mjs → src-DFrxQ_S6.mjs} +9 -7
- package/dist/src-DFrxQ_S6.mjs.map +1 -0
- package/dist/{src-D_0PIhqq.mjs → src-DklM1g7V.mjs} +69 -40
- package/dist/src-DklM1g7V.mjs.map +1 -0
- package/dist/{src-D-cm2gQ6.mjs → src-TCQGaWar.mjs} +119 -45
- package/dist/src-TCQGaWar.mjs.map +1 -0
- package/dist/{subscription-B-auXJbm.d.mts → subscription-fVgS4T8P.d.mts} +2 -2
- package/dist/swr.d.mts +2 -2
- package/dist/swr.mjs +1 -1
- package/dist/swr.mjs.map +1 -1
- package/docs/CONTEXT.md +44 -22
- package/docs/README.md +3 -0
- package/docs/internal/README.md +3 -0
- package/docs/internal/adr/0001-capability-is-the-semantic-boundary.md +1 -1
- package/docs/internal/adr/0003-capability-reference-customization.md +68 -0
- package/docs/internal/architecture.md +31 -17
- package/docs/internal/capability-first-model.md +126 -17
- package/docs/internal/eve-recovery-validation.md +87 -0
- package/docs/internal/feedback/v-ray/README.md +258 -0
- package/docs/internal/feedback/v-ray/inference.mjs +43 -0
- package/docs/internal/feedback/v-ray/reproduce.mjs +36 -0
- package/docs/internal/implementation-friction.md +445 -1
- package/docs/internal/releases.md +79 -0
- package/docs/site/capable-orpc-and-trpc.mdx +2 -2
- package/docs/site/concepts/apps.mdx +7 -1
- package/docs/site/concepts/architecture.mdx +9 -1
- package/docs/site/concepts/capabilities.mdx +41 -4
- package/docs/site/concepts/errors.mdx +26 -4
- package/docs/site/concepts/presentations.mdx +20 -0
- package/docs/site/hosting/standalone-server.mdx +2 -0
- package/docs/site/patterns/composition.mdx +152 -8
- package/docs/site/patterns/remote-apps.mdx +29 -3
- package/docs/site/patterns/subscriptions.mdx +79 -32
- package/docs/site/quickstart.mdx +3 -2
- package/docs/site/reference/packages-and-entry-points.mdx +52 -4
- package/docs/site/reference/the-cap-cli.mdx +2 -2
- package/docs/site/surfaces/cli.mdx +44 -0
- package/docs/site/surfaces/eve.mdx +67 -18
- package/docs/site/surfaces/mcp.mdx +84 -2
- package/docs/site/surfaces/typescript.mdx +3 -3
- package/package-docs.mjs +3 -0
- package/package.json +17 -12
- package/src/bin.ts +0 -0
- package/src/index.test.ts +2 -1
- package/src/index.ts +8 -1
- package/src/package.test.ts +15 -0
- package/dist/mount-CEFAplR5.mjs.map +0 -1
- package/dist/src-BWxDO2Ua.mjs.map +0 -1
- package/dist/src-D-cm2gQ6.mjs.map +0 -1
- package/dist/src-D_0PIhqq.mjs.map +0 -1
- package/dist/src-betOfnDL.mjs +0 -481
- package/dist/src-betOfnDL.mjs.map +0 -1
- package/dist/src-rkr5j_NH.mjs.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# capable-kit
|
|
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
|
+
|
|
174
|
+
## 0.1.0-alpha.10
|
|
175
|
+
|
|
176
|
+
### Minor Changes
|
|
177
|
+
|
|
178
|
+
- fb54c20: Compose whole Apps, executable subtrees, or individual bound local and remote capabilities into an explicit command tree. References preserve their source ID, input/output types, execution context, middleware, errors, cancellation, and subscriptions.
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
import { composeApps, customize } from "capable-kit";
|
|
182
|
+
import { createCli } from "capable-kit/cli";
|
|
183
|
+
|
|
184
|
+
const cliApp = composeApps({
|
|
185
|
+
stop: customize(desktop.plugins.stop, {
|
|
186
|
+
description: "Stop a running desktop instance.",
|
|
187
|
+
meta: { cli: { positional: ["instanceId"] } },
|
|
188
|
+
}),
|
|
189
|
+
debug: {
|
|
190
|
+
status: desktop.plugins.status,
|
|
191
|
+
screenshot: local.screenshot,
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
await createCli(cliApp).run(process.argv.slice(2));
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`customize()` accepts title, description, and opted-in surface metadata (initially CLI and MCP), snapshots them without mutating the original reference, and returns a composition entry. Each supplied metadata namespace replaces that namespace. Bind local definitions with `createApp()` first; `defineApp()` continues to accept definitions only. Output renderers and execution fields cannot be overridden.
|
|
199
|
+
|
|
200
|
+
Individual CLI/MCP references use their destination tree names; authored naming overrides apply only when explicitly supplied through `customize()`. A placed App or Group gets its outer name from the destination key while its internal navigation and presentation remain authored.
|
|
201
|
+
|
|
202
|
+
Customizations survive nested composition, selection, and manifest serialization. Same-owner aliases may have different display settings. CLI, MCP, AI SDK, and Eve use customized descriptions; backend execution and policy metadata retain the source contract. Clients reading the new optional manifest `customization` field need this version to display overrides; older clients may reject customized aliases on rediscovery.
|
|
203
|
+
|
|
204
|
+
Offline help works with an `ApplicationTransport` whose `manifest()` returns a bundled contract while `call()` and `subscribe()` still use the backend.
|
|
205
|
+
- bf8249c: Added subscription-only read capabilities for logs and events. Omit `handler` to
|
|
206
|
+
emit individual events without a dummy unary result:
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
const logs = capability({
|
|
210
|
+
id: "runs.logs",
|
|
211
|
+
effect: "read",
|
|
212
|
+
async *subscribe({ signal }) {
|
|
213
|
+
yield* followLogs({ signal });
|
|
214
|
+
},
|
|
215
|
+
toPresentation: (entry) => entry.message,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
for await (const entry of subscribe(app.runs.logs, {}, { signal })) {
|
|
219
|
+
appendLog(entry);
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Each event is output-validated and optionally presented. Event streams may finish
|
|
224
|
+
without yielding and the HTTP/SSE transport establishes quiet streams without
|
|
225
|
+
waiting for an event. Opening a transport subscription parses input, resolves
|
|
226
|
+
context, enters middleware, and invokes the subscriber before its promise
|
|
227
|
+
resolves and before an event response is committed. Their failures retain
|
|
228
|
+
ordinary HTTP statuses, while failures inside an async-generator body use SSE
|
|
229
|
+
error frames. Readable CLI commands append event presentations by default;
|
|
230
|
+
`--json` emits NDJSON without materializing presentations. Event-only capabilities
|
|
231
|
+
have no unary call signature and are excluded from React Query/SWR state
|
|
232
|
+
projections and automatic HTTP/OpenAPI, MCP, AI SDK, and Eve tool projections.
|
|
233
|
+
Explicit unsupported HTTP or tool metadata is rejected; use `false` to disable
|
|
234
|
+
that projection. `handler` plus `subscribe` still means replacement snapshots,
|
|
235
|
+
including an initial snapshot supplied by the subscriber itself.
|
|
236
|
+
|
|
237
|
+
**Breaking:** The App manifest protocol changes from `capable.capabilities.v3`
|
|
238
|
+
to `capable.capabilities.v4`. Update clients and servers together and regenerate
|
|
239
|
+
bundled manifests. Custom transports and manifest consumers must replace the
|
|
240
|
+
old optional subscription field with the required execution kind:
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
// Before (other capability fields omitted)
|
|
244
|
+
{ subscription: { mode: "replace" } }
|
|
245
|
+
|
|
246
|
+
// After
|
|
247
|
+
{ execution: "live" } // handler + subscribe
|
|
248
|
+
{ execution: "unary" } // handler only
|
|
249
|
+
{ execution: "events" } // subscribe only
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
The rich-value codec remains `capable.rich-json.v1`; event values preserve Dates
|
|
253
|
+
just like existing calls and replacements.
|
|
254
|
+
|
|
255
|
+
**Breaking:** The sixth `CapabilityDefinition` type argument is now an execution
|
|
256
|
+
kind instead of a subscription boolean. For manually annotated definitions:
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
// Before
|
|
260
|
+
type Live = CapabilityDefinition<Context, Input, Output, Errors, Meta, true>;
|
|
261
|
+
// After
|
|
262
|
+
type Live = CapabilityDefinition<Context, Input, Output, Errors, Meta, "live">;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Replace `false` with `"unary"`, and `boolean` with `"unary" | "live"` when
|
|
266
|
+
describing the previous two forms. Prefer factory inference when possible.
|
|
267
|
+
App subscription helpers now accept `AppCapabilityReference`; event references
|
|
268
|
+
are not callable. `executeCapability()` accepts only callable definitions.
|
|
269
|
+
|
|
270
|
+
`ApplicationTransport.subscribe()` now returns a promise for the opened async
|
|
271
|
+
iterator. Custom transports should complete request setup before resolving it:
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
async subscribe(call) {
|
|
275
|
+
const response = await openSubscription(call);
|
|
276
|
+
return decodeEvents(response);
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## 0.1.0-alpha.9
|
|
281
|
+
|
|
282
|
+
### Minor Changes
|
|
283
|
+
|
|
284
|
+
- 46cd32f: Add app-wide `middleware` and declared `errors` to `defineApp()`. App, group, and capability middleware now receive a readonly `capability` descriptor (`id` and optional `effect`) and `mode` (`"call"` or `"subscribe"`), enabling centralized auditing and access policies.
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
import { defineApp } from "capable-kit";
|
|
288
|
+
|
|
289
|
+
const definition = defineApp({
|
|
290
|
+
capabilities: { todos },
|
|
291
|
+
middleware: [async ({ capability, mode, next }) => {
|
|
292
|
+
console.info({ capabilityId: capability.id, mode });
|
|
293
|
+
return next();
|
|
294
|
+
}],
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Execution proceeds through app middleware, outer-to-inner groups, capability middleware, and the handler. Subscriptions use the same chain for their lifetime. Capability identity remains unchanged by composition or path aliases. Input validation and context creation happen before middleware; app middleware does not narrow handler context, and direct `executeCapability()` calls do not inherit app or group policies.
|
|
299
|
+
- 46cd32f: Improve CLI root-command help and execution. Bare invocation and `--help` show app help plus root arguments and options. `--json` and `--watch` execute a root capability even without positional arguments, applying input defaults or reporting required input. Multiple root capabilities produce a usage error; longer subcommands take precedence.
|
|
300
|
+
|
|
301
|
+
Configure a single-operation CLI with an empty command path:
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
capability({
|
|
305
|
+
id: "analysis.url",
|
|
306
|
+
input: z.object({ url: z.string() }),
|
|
307
|
+
meta: { cli: { command: [], positional: ["url"] } },
|
|
308
|
+
handler: ({ input }) => analyzeURL(input.url),
|
|
309
|
+
});
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Add `markdown` rendering options to `createCli()` and `runCli()`, including watched presentations:
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
import { createCli } from "capable-kit/cli";
|
|
316
|
+
|
|
317
|
+
const cli = createCli(app, {
|
|
318
|
+
markdown: { codeBox: false, tableBorder: "none", tableDense: true },
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Explicit markdown color and width override CLI rendering defaults in a TTY. Redirected output stays Markdown and `--json` returns canonical output.
|
|
323
|
+
- 46cd32f: **Breaking:** Replace `mergeApps()` with `composeApps()` from `capable-kit` (also exported from `capable-kit/app`). Update imports and calls:
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
// Before
|
|
327
|
+
import { mergeApps } from "capable-kit";
|
|
328
|
+
const app = mergeApps(remote, local);
|
|
329
|
+
|
|
330
|
+
// After
|
|
331
|
+
import { composeApps } from "capable-kit";
|
|
332
|
+
const app = composeApps(remote, local);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Compose apps at the root or place them beneath named object branches:
|
|
336
|
+
|
|
337
|
+
```ts
|
|
338
|
+
const app = composeApps(local, { integrations: { github, linear } });
|
|
339
|
+
await app.integrations.linear.issue({ id: "CAP-1" });
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Placement changes callable paths without changing capability IDs or execution ownership. Direct calls resolve only the relevant branch; surfaces that request a complete manifest still discover the whole composition. The same app can appear at multiple paths as aliases, and repeating it at the same path is deduplicated. Different apps claiming the same capability ID are rejected.
|
|
343
|
+
- 46cd32f: Add `createEveAgentAdapter()` in `capable-kit/eve` to expose a remote Eve agent as an app with `send`, `result`, and `cancel` capabilities. Bind clients and authorization to the authenticated caller in the host:
|
|
344
|
+
|
|
345
|
+
```ts
|
|
346
|
+
import { createEveAgentAdapter } from "capable-kit/eve";
|
|
347
|
+
|
|
348
|
+
const agent = createEveAgentAdapter({ name: "research", client, authorize });
|
|
349
|
+
const { runId } = await agent.app.research.send({ message: "Research routing" });
|
|
350
|
+
await agent.app.research.send({ runId, message: "Focus on Next.js", wait: true });
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Run IDs are durable Eve session IDs, allowing later processes to resume a conversation. `send` supports waiting and answering typed questions; approvals remain host-owned. The adapter also supplies CLI messaging and presentation support. For an app exposed with invocation name `recipes`:
|
|
354
|
+
|
|
355
|
+
```sh
|
|
356
|
+
recipes research send "Research routing" --wait
|
|
357
|
+
recipes research send "Focus on Next.js" --run-id '<runId>' --wait
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**Breaking:** The Eve peer dependency is now exactly `0.52.3`, and the AI SDK peer minimum rises from `^7.0.0` to `^7.0.82`. Consumers of these optional integrations must use compatible versions.
|
|
361
|
+
|
|
362
|
+
**Breaking:** `createEveTools()` now discovers tools at `session.started` instead of `step.started` and reconstructs durable callbacks after cold starts. Providers may run again using the current execution session. Keep App/provider definitions in deployed module code and data in persistent storage; do not rely on rediscovering the tool catalog on every step. Side effects must tolerate replay.
|
|
363
|
+
|
|
364
|
+
Before, the published Eve SDK alone was sufficient. Now, Eve 0.52.3 also needs the `defineDurableCallback` backport: apply the repository's [Eve patch](https://github.com/vercel-labs/capable/blob/5e6fcfe/patches/eve%400.52.3.patch) using your package manager's patch mechanism (see the [patch instructions](https://github.com/vercel-labs/capable/blob/5e6fcfe/patches/README.md)). Installing unpatched Eve 0.52.3 is insufficient, and installing capable-kit does not apply the repository's pnpm patch to a consumer project.
|
|
365
|
+
|
|
366
|
+
### Patch Changes
|
|
367
|
+
|
|
368
|
+
- 46cd32f: Fix capability output inference for handlers that return a mix of synchronous values and promises. Typed named `toPresentation` renderers can appear before or after `handler` without losing output inference:
|
|
369
|
+
|
|
370
|
+
```ts
|
|
371
|
+
import { capability } from "capable-kit";
|
|
372
|
+
|
|
373
|
+
const render = (result: { name: string }) => result.name;
|
|
374
|
+
const hello = capability({
|
|
375
|
+
id: "hello",
|
|
376
|
+
toPresentation: render,
|
|
377
|
+
handler: () => ({ name: "World" }),
|
|
378
|
+
});
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
For inline renderers with inferred parameters, continue placing `toPresentation` after `handler`. No runtime migration is required.
|
|
382
|
+
- 46cd32f: Ship a versioned CHANGELOG.md with the npm package and link it from the bundled documentation and package reference. People and coding agents can read `node_modules/capable-kit/CHANGELOG.md` for features, fixes, and migration instructions. Release history starts with this release; earlier alpha changes are not reconstructed.
|
|
383
|
+
|
|
384
|
+
Release history is recorded here starting with the first release using Changesets.
|
|
385
|
+
Earlier alpha releases are not documented in this file.
|
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
|
|
|
@@ -84,6 +90,12 @@ Coding agents should start with
|
|
|
84
90
|
writing Capable code. The package also includes its original TypeScript source
|
|
85
91
|
under `src/` when a guide does not cover a lower-level API detail.
|
|
86
92
|
|
|
93
|
+
## Changes and upgrades
|
|
94
|
+
|
|
95
|
+
Read [CHANGELOG.md](./CHANGELOG.md) for versioned features, fixes, and breaking
|
|
96
|
+
changes. When upgrading, use the target version’s changelog and apply all entries
|
|
97
|
+
after your installed version through your target version, oldest first.
|
|
98
|
+
|
|
87
99
|
## Package contents
|
|
88
100
|
|
|
89
101
|
The published package includes compiled ESM in `dist/`, declaration files, the
|
package/dist/ai-sdk.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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 | {
|
|
@@ -21,7 +21,7 @@ type AiSdkCapabilityTool<TCapability extends AnyCapability> = WithoutExecute<Too
|
|
|
21
21
|
execute(input: CapabilityInput<TCapability>, options: ToolExecutionOptions<any>): Promise<CapabilityOutput<TCapability>>;
|
|
22
22
|
};
|
|
23
23
|
type WithoutExecute<TTool> = TTool extends unknown ? Omit<TTool, "execute"> : never;
|
|
24
|
-
type CapabilityToolEntry<TCapability extends AnyCapability, TPath extends string> = CapabilityToolName<TCapability, TPath> extends (infer TName extends string) ? { readonly [TKey in TName]: AiSdkCapabilityTool<TCapability>; } : {};
|
|
24
|
+
type CapabilityToolEntry<TCapability extends AnyCapability, TPath extends string> = TCapability["execution"] extends "events" ? {} : CapabilityToolName<TCapability, TPath> extends (infer TName extends string) ? { readonly [TKey in TName]: AiSdkCapabilityTool<TCapability>; } : {};
|
|
25
25
|
type AiSdkToolNode<TNode, TPath extends string> = TNode extends AnyCapability ? CapabilityToolEntry<TNode, TPath> : TNode extends CapabilityGroupDefinition<infer TCapabilities, any, any> ? AiSdkToolTree<TCapabilities, TPath> : TNode extends CapabilityTree ? AiSdkToolTree<TNode, TPath> : {};
|
|
26
26
|
type UnionToIntersection<TValue> = (TValue extends unknown ? (value: TValue) => void : never) extends ((value: infer TIntersection) => void) ? TIntersection : never;
|
|
27
27
|
type Simplify<TValue> = { readonly [TKey in keyof TValue]: TValue[TKey]; };
|
package/dist/ai-sdk.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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({
|
|
@@ -17,14 +17,19 @@ async function createAiSdkTools(app) {
|
|
|
17
17
|
const runtime = getAppRuntime(app);
|
|
18
18
|
const manifest = await runtime.manifest();
|
|
19
19
|
const tools = Object.create(null);
|
|
20
|
-
for (const capability of
|
|
20
|
+
for (const capability of flattenManifestCapabilities(manifest.capabilities)) {
|
|
21
|
+
const display = getCapabilityDisplay(capability);
|
|
21
22
|
const meta = capability.meta.aiSdk;
|
|
22
23
|
if (meta === false) continue;
|
|
24
|
+
if (capability.execution === "events") {
|
|
25
|
+
if (meta !== void 0) throw new Error(`Event Capability "${capability.id}" cannot be exposed as an AI SDK tool`);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
23
28
|
const name = meta?.name ?? capability.path.join("__");
|
|
24
29
|
if (!/^[A-Za-z0-9_-]{1,64}$/.test(name)) throw new Error(`AI SDK tool name "${name}" is invalid; set meta.aiSdk.name to 1-64 letters, numbers, underscores, or hyphens`);
|
|
25
30
|
if (Object.hasOwn(tools, name)) throw new Error(`Duplicate AI SDK tool name "${name}"`);
|
|
26
31
|
tools[name] = tool({
|
|
27
|
-
description:
|
|
32
|
+
description: display.description ?? display.title ?? `Run the Capable Capability at ${capability.path.join(".")}.`,
|
|
28
33
|
inputSchema: toAiSdkSchema(capability.input ?? emptyInputSchema),
|
|
29
34
|
...capability.output ? { outputSchema: toAiSdkSchema(capability.output) } : {},
|
|
30
35
|
...meta?.strict === void 0 ? {} : { strict: meta.strict },
|
|
@@ -32,7 +37,7 @@ async function createAiSdkTools(app) {
|
|
|
32
37
|
capabilityId: capability.id,
|
|
33
38
|
path: [...capability.path],
|
|
34
39
|
deprecated: capability.deprecated,
|
|
35
|
-
...
|
|
40
|
+
...display.title ? { title: display.title } : {},
|
|
36
41
|
...capability.effect ? { effect: capability.effect } : {}
|
|
37
42
|
} },
|
|
38
43
|
async execute(input, { abortSignal }) {
|
|
@@ -49,9 +54,6 @@ async function createAiSdkTools(app) {
|
|
|
49
54
|
function toAiSdkSchema(schema) {
|
|
50
55
|
return jsonSchema(schema);
|
|
51
56
|
}
|
|
52
|
-
function flatten(nodes) {
|
|
53
|
-
return nodes.flatMap((node) => node.type === "capability" ? [node] : flatten(node.children));
|
|
54
|
-
}
|
|
55
57
|
//#endregion
|
|
56
58
|
export { createAiSdkTools };
|
|
57
59
|
|
package/dist/ai-sdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-sdk.mjs","names":[],"sources":["../../ai-sdk/src/index.ts"],"sourcesContent":["import {\n getAppRuntime,\n
|
|
1
|
+
{"version":3,"file":"ai-sdk.mjs","names":[],"sources":["../../ai-sdk/src/index.ts"],"sourcesContent":["import {\n getAppRuntime,\n getCapabilityDisplay,\n flattenManifestCapabilities,\n type AnyApp,\n type AppCapabilities,\n type JsonSchema,\n} from \"@capable/app\";\nimport type {\n AnyCapability,\n CapabilityDefinition,\n CapabilityGroupDefinition,\n CapabilityInput,\n CapabilityMetaRegistry,\n CapabilityOutput,\n CapabilityTree,\n} from \"@capable/core\";\nimport {\n jsonSchema,\n tool,\n type JSONSchema7,\n type Tool,\n type ToolExecutionOptions,\n} from \"ai\";\n\nexport type AiSdkCapabilityMeta =\n | false\n | {\n readonly name?: string;\n readonly strict?: boolean;\n };\n\ndeclare module \"@capable/core\" {\n interface CapabilityMetaRegistry {\n readonly aiSdk?: AiSdkCapabilityMeta;\n }\n}\n\ntype JoinPath<TPrefix extends string, TKey extends string> =\n TPrefix extends \"\" ? TKey : `${TPrefix}__${TKey}`;\n\ntype CapabilityAiSdkMeta<TCapability extends AnyCapability> =\n TCapability extends CapabilityDefinition<any, any, any, any, infer TMeta, any>\n ? \"aiSdk\" extends keyof TMeta\n ? TMeta[\"aiSdk\"]\n : undefined\n : undefined;\n\ntype IsAny<TValue> = 0 extends (1 & TValue) ? true : false;\n\ntype CapabilityToolName<\n TCapability extends AnyCapability,\n TDefault extends string,\n> = IsAny<CapabilityAiSdkMeta<TCapability>> extends true\n ? TDefault\n : CapabilityAiSdkMeta<TCapability> extends false\n ? never\n : CapabilityAiSdkMeta<TCapability> extends {\n readonly name: infer TName extends string;\n }\n ? TName\n : TDefault;\n\nexport type AiSdkCapabilityTool<TCapability extends AnyCapability> =\n WithoutExecute<\n Tool<CapabilityInput<TCapability>, CapabilityOutput<TCapability>>\n > & {\n execute(\n input: CapabilityInput<TCapability>,\n options: ToolExecutionOptions<any>,\n ): Promise<CapabilityOutput<TCapability>>;\n };\n\ntype WithoutExecute<TTool> =\n TTool extends unknown ? Omit<TTool, \"execute\"> : never;\n\ntype CapabilityToolEntry<\n TCapability extends AnyCapability,\n TPath extends string,\n> = TCapability[\"execution\"] extends \"events\" ? {} : CapabilityToolName<TCapability, TPath> extends infer TName extends string\n ? { readonly [TKey in TName]: AiSdkCapabilityTool<TCapability> }\n : {};\n\ntype AiSdkToolNode<\n TNode,\n TPath extends string,\n> = TNode extends AnyCapability\n ? CapabilityToolEntry<TNode, TPath>\n : TNode extends CapabilityGroupDefinition<infer TCapabilities, any, any>\n ? AiSdkToolTree<TCapabilities, TPath>\n : TNode extends CapabilityTree\n ? AiSdkToolTree<TNode, TPath>\n : {};\n\ntype UnionToIntersection<TValue> =\n (TValue extends unknown ? (value: TValue) => void : never) extends\n (value: infer TIntersection) => void ? TIntersection : never;\n\ntype Simplify<TValue> = { readonly [TKey in keyof TValue]: TValue[TKey] };\n\ntype AiSdkToolTree<\n TTree extends CapabilityTree,\n TPrefix extends string = \"\",\n> = string extends keyof TTree\n ? Readonly<Record<string, AiSdkCapabilityTool<AnyCapability>>>\n : UnionToIntersection<\n {\n [TKey in Extract<keyof TTree, string>]: AiSdkToolNode<\n TTree[TKey],\n JoinPath<TPrefix, TKey>\n >;\n }[Extract<keyof TTree, string>]\n >;\n\nexport type AiSdkTools<TApp extends AnyApp> = Simplify<\n AiSdkToolTree<AppCapabilities<TApp>>\n>;\n\nconst emptyInputSchema: JsonSchema = Object.freeze({\n type: \"object\",\n properties: Object.freeze({}),\n additionalProperties: false,\n});\n\n/**\n * Projects an executable Capable App into an AI SDK v7 ToolSet.\n *\n * Tool names and input/output types are preserved when the App retains its\n * authored Capability tree type. Untyped remote Apps return a string-keyed tool\n * set with unknown inputs and outputs.\n */\nexport async function createAiSdkTools<const TApp extends AnyApp>(\n app: TApp,\n): Promise<AiSdkTools<TApp>> {\n const runtime = getAppRuntime(app);\n const manifest = await runtime.manifest();\n const tools: Record<string, Tool<any, any>> = Object.create(null);\n\n for (const capability of flattenManifestCapabilities(manifest.capabilities)) {\n const display = getCapabilityDisplay(capability);\n const meta = capability.meta.aiSdk as AiSdkCapabilityMeta | undefined;\n if (meta === false) continue;\n if (capability.execution === \"events\") {\n if (meta !== undefined) {\n throw new Error(\n `Event Capability \"${capability.id}\" cannot be exposed as an AI SDK tool`,\n );\n }\n continue;\n }\n\n const name = meta?.name ?? capability.path.join(\"__\");\n if (!/^[A-Za-z0-9_-]{1,64}$/.test(name)) {\n throw new Error(\n `AI SDK tool name \"${name}\" is invalid; set meta.aiSdk.name to 1-64 letters, numbers, underscores, or hyphens`,\n );\n }\n if (Object.hasOwn(tools, name)) {\n throw new Error(`Duplicate AI SDK tool name \"${name}\"`);\n }\n\n tools[name] = tool({\n description:\n display.description ??\n display.title ??\n `Run the Capable Capability at ${capability.path.join(\".\")}.`,\n inputSchema: toAiSdkSchema(capability.input ?? emptyInputSchema),\n ...(capability.output\n ? { outputSchema: toAiSdkSchema(capability.output) }\n : {}),\n ...(meta?.strict === undefined ? {} : { strict: meta.strict }),\n metadata: {\n capable: {\n capabilityId: capability.id,\n path: [...capability.path],\n deprecated: capability.deprecated,\n ...(display.title ? { title: display.title } : {}),\n ...(capability.effect ? { effect: capability.effect } : {}),\n },\n },\n async execute(input, { abortSignal }) {\n const result = await runtime.call({\n id: capability.id,\n input,\n ...(abortSignal ? { signal: abortSignal } : {}),\n });\n return result.output;\n },\n });\n }\n\n return Object.freeze(tools) as AiSdkTools<TApp>;\n}\n\nfunction toAiSdkSchema(schema: JsonSchema) {\n return jsonSchema(schema as JSONSchema7);\n}\n"],"mappings":";;;AAsHA,MAAM,mBAA+B,OAAO,OAAO;CACjD,MAAM;CACN,YAAY,OAAO,OAAO,CAAC,CAAC;CAC5B,sBAAsB;AACxB,CAAC;;;;;;;;AASD,eAAsB,iBACpB,KAC2B;CAC3B,MAAM,UAAU,cAAc,GAAG;CACjC,MAAM,WAAW,MAAM,QAAQ,SAAS;CACxC,MAAM,QAAwC,OAAO,OAAO,IAAI;CAEhE,KAAK,MAAM,cAAc,4BAA4B,SAAS,YAAY,GAAG;EAC3E,MAAM,UAAU,qBAAqB,UAAU;EAC/C,MAAM,OAAO,WAAW,KAAK;EAC7B,IAAI,SAAS,OAAO;EACpB,IAAI,WAAW,cAAc,UAAU;GACrC,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,MACR,qBAAqB,WAAW,GAAG,sCACrC;GAEF;EACF;EAEA,MAAM,OAAO,MAAM,QAAQ,WAAW,KAAK,KAAK,IAAI;EACpD,IAAI,CAAC,wBAAwB,KAAK,IAAI,GACpC,MAAM,IAAI,MACR,qBAAqB,KAAK,oFAC5B;EAEF,IAAI,OAAO,OAAO,OAAO,IAAI,GAC3B,MAAM,IAAI,MAAM,+BAA+B,KAAK,EAAE;EAGxD,MAAM,QAAQ,KAAK;GACjB,aACE,QAAQ,eACR,QAAQ,SACR,iCAAiC,WAAW,KAAK,KAAK,GAAG,EAAE;GAC7D,aAAa,cAAc,WAAW,SAAS,gBAAgB;GAC/D,GAAI,WAAW,SACX,EAAE,cAAc,cAAc,WAAW,MAAM,EAAE,IACjD,CAAC;GACL,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO;GAC5D,UAAU,EACR,SAAS;IACP,cAAc,WAAW;IACzB,MAAM,CAAC,GAAG,WAAW,IAAI;IACzB,YAAY,WAAW;IACvB,GAAI,QAAQ,QAAQ,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;IAChD,GAAI,WAAW,SAAS,EAAE,QAAQ,WAAW,OAAO,IAAI,CAAC;GAC3D,EACF;GACA,MAAM,QAAQ,OAAO,EAAE,eAAe;IAMpC,QAAO,MALc,QAAQ,KAAK;KAChC,IAAI,WAAW;KACf;KACA,GAAI,cAAc,EAAE,QAAQ,YAAY,IAAI,CAAC;IAC/C,CAAC,EAAA,CACa;GAChB;EACF,CAAC;CACH;CAEA,OAAO,OAAO,OAAO,KAAK;AAC5B;AAEA,SAAS,cAAc,QAAoB;CACzC,OAAO,WAAW,MAAqB;AACzC"}
|
package/dist/app.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, type AnyApp, type App, type AppCapabilities, type AppCapabilityCall, type AppCapabilityIsSubscribable, type AppContextProvider, type ApplicationManifest, type ApplicationSelection, type ApplicationTransport, type CallableTree, type CapabilityCall, type CapabilityResult, type JsonSchema, type ManifestCapability, type ManifestError, type ManifestGroup, type ManifestNode, TransportError, createApp, createAppManifest, createRemoteApp, getAppRuntime,
|
|
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
|
|
2
|
-
export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, TransportError, createApp, createAppManifest, createRemoteApp, getAppRuntime,
|
|
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
|
+
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-
|
|
3
|
-
import {
|
|
4
|
-
import { a as createCliStyle, c as renderSection, l as supportsColor, n as runCli, o as descriptionColumn, s as renderRows } from "./src-
|
|
5
|
-
import { n as createHttpTransport } from "./src-
|
|
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": "
|
|
359
|
-
zod: "^4.
|
|
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
|
-
|
|
415
|
-
|
|
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 {};
|