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
package/CHANGELOG.md ADDED
@@ -0,0 +1,108 @@
1
+ # capable-kit
2
+
3
+ ## 0.1.0-alpha.9
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+
9
+ ```ts
10
+ import { defineApp } from "capable-kit";
11
+
12
+ const definition = defineApp({
13
+ capabilities: { todos },
14
+ middleware: [async ({ capability, mode, next }) => {
15
+ console.info({ capabilityId: capability.id, mode });
16
+ return next();
17
+ }],
18
+ });
19
+ ```
20
+
21
+ 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.
22
+ - 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.
23
+
24
+ Configure a single-operation CLI with an empty command path:
25
+
26
+ ```ts
27
+ capability({
28
+ id: "analysis.url",
29
+ input: z.object({ url: z.string() }),
30
+ meta: { cli: { command: [], positional: ["url"] } },
31
+ handler: ({ input }) => analyzeURL(input.url),
32
+ });
33
+ ```
34
+
35
+ Add `markdown` rendering options to `createCli()` and `runCli()`, including watched presentations:
36
+
37
+ ```ts
38
+ import { createCli } from "capable-kit/cli";
39
+
40
+ const cli = createCli(app, {
41
+ markdown: { codeBox: false, tableBorder: "none", tableDense: true },
42
+ });
43
+ ```
44
+
45
+ Explicit markdown color and width override CLI rendering defaults in a TTY. Redirected output stays Markdown and `--json` returns canonical output.
46
+ - 46cd32f: **Breaking:** Replace `mergeApps()` with `composeApps()` from `capable-kit` (also exported from `capable-kit/app`). Update imports and calls:
47
+
48
+ ```ts
49
+ // Before
50
+ import { mergeApps } from "capable-kit";
51
+ const app = mergeApps(remote, local);
52
+
53
+ // After
54
+ import { composeApps } from "capable-kit";
55
+ const app = composeApps(remote, local);
56
+ ```
57
+
58
+ Compose apps at the root or place them beneath named object branches:
59
+
60
+ ```ts
61
+ const app = composeApps(local, { integrations: { github, linear } });
62
+ await app.integrations.linear.issue({ id: "CAP-1" });
63
+ ```
64
+
65
+ 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.
66
+ - 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:
67
+
68
+ ```ts
69
+ import { createEveAgentAdapter } from "capable-kit/eve";
70
+
71
+ const agent = createEveAgentAdapter({ name: "research", client, authorize });
72
+ const { runId } = await agent.app.research.send({ message: "Research routing" });
73
+ await agent.app.research.send({ runId, message: "Focus on Next.js", wait: true });
74
+ ```
75
+
76
+ 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`:
77
+
78
+ ```sh
79
+ recipes research send "Research routing" --wait
80
+ recipes research send "Focus on Next.js" --run-id '<runId>' --wait
81
+ ```
82
+
83
+ **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.
84
+
85
+ **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.
86
+
87
+ 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.
88
+
89
+ ### Patch Changes
90
+
91
+ - 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:
92
+
93
+ ```ts
94
+ import { capability } from "capable-kit";
95
+
96
+ const render = (result: { name: string }) => result.name;
97
+ const hello = capability({
98
+ id: "hello",
99
+ toPresentation: render,
100
+ handler: () => ({ name: "World" }),
101
+ });
102
+ ```
103
+
104
+ For inline renderers with inferred parameters, continue placing `toPresentation` after `handler`. No runtime migration is required.
105
+ - 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.
106
+
107
+ Release history is recorded here starting with the first release using Changesets.
108
+ Earlier alpha releases are not documented in this file.
package/README.md CHANGED
@@ -84,6 +84,12 @@ Coding agents should start with
84
84
  writing Capable code. The package also includes its original TypeScript source
85
85
  under `src/` when a guide does not cover a lower-level API detail.
86
86
 
87
+ ## Changes and upgrades
88
+
89
+ Read [CHANGELOG.md](./CHANGELOG.md) for versioned features, fixes, and breaking
90
+ changes. When upgrading, use the target version’s changelog and apply all entries
91
+ after your installed version through your target version, oldest first.
92
+
87
93
  ## Package contents
88
94
 
89
95
  The published package includes compiled ESM in `dist/`, declaration files, the
package/dist/ai-sdk.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as CapabilityTree, c as CapabilityInput, f as CapabilityOutput, i as CapabilityDefinition, k as CapabilityGroupDefinition, t as AnyCapability } from "./index-_qKFfWV4.mjs";
2
- import { c as AppCapabilities, o as AnyApp } from "./index-F4ba_olD.mjs";
1
+ import { A as CapabilityTree, c as CapabilityInput, f as CapabilityOutput, i as CapabilityDefinition, k as CapabilityGroupDefinition, t as AnyCapability } from "./index-ftQx6OMr.mjs";
2
+ import { c as AppCapabilities, o as AnyApp } from "./index-D63DSGZG.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 { c as getAppRuntime } from "./src-betOfnDL.mjs";
1
+ import { c as getAppRuntime } from "./src-B592M-6b.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 { C as JsonSchema, D as ManifestNode, E as ManifestGroup, O as createAppManifest, S as ApplicationManifest, T as ManifestError, _ as createApp, a as APP_RUNTIME_SYMBOL, b as isApp, c as AppCapabilities, d as AppContextProvider, f as ApplicationTransport, g as TransportError, h as CapabilityResult, i as APP_CAPABILITIES_SYMBOL, l as AppCapabilityCall, m as CapabilityCall, n as mergeApps, o as AnyApp, p as CallableTree, r as selectApp, s as App, t as ApplicationSelection, u as AppCapabilityIsSubscribable, v as createRemoteApp, w as ManifestCapability, x as subscribe, y as getAppRuntime } from "./index-F4ba_olD.mjs";
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, isApp, mergeApps, selectApp, subscribe };
1
+ import { C as JsonSchema, D as ManifestNode, E as ManifestGroup, O as createAppManifest, S as ApplicationManifest, T as ManifestError, _ as createApp, a as APP_RUNTIME_SYMBOL, b as isApp, c as AppCapabilities, d as AppContextProvider, f as ApplicationTransport, g as TransportError, h as CapabilityResult, i as APP_CAPABILITIES_SYMBOL, l as AppCapabilityCall, m as CapabilityCall, n as composeApps, o as AnyApp, p as CallableTree, r as selectApp, s as App, t as ApplicationSelection, u as AppCapabilityIsSubscribable, v as createRemoteApp, w as ManifestCapability, x as subscribe, y as getAppRuntime } from "./index-D63DSGZG.mjs";
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, composeApps, createApp, createAppManifest, createRemoteApp, getAppRuntime, isApp, selectApp, subscribe };
package/dist/app.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as TransportError, c as getAppRuntime, d as createAppManifest, i as APP_RUNTIME_SYMBOL, l as isApp, n as selectApp, o as createApp, r as APP_CAPABILITIES_SYMBOL, s as createRemoteApp, t as mergeApps, u as subscribe } from "./src-betOfnDL.mjs";
2
- export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, TransportError, createApp, createAppManifest, createRemoteApp, getAppRuntime, isApp, mergeApps, selectApp, subscribe };
1
+ import { a as TransportError, c as getAppRuntime, d as createAppManifest, i as APP_RUNTIME_SYMBOL, l as isApp, n as selectApp, o as createApp, r as APP_CAPABILITIES_SYMBOL, s as createRemoteApp, t as composeApps, u as subscribe } from "./src-B592M-6b.mjs";
2
+ export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, TransportError, composeApps, createApp, createAppManifest, createRemoteApp, getAppRuntime, 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-D-cm2gQ6.mjs";
3
- import { l as isApp, o as createApp, s as createRemoteApp } from "./src-betOfnDL.mjs";
4
- import { a as createCliStyle, c as renderSection, l as supportsColor, n as runCli, o as descriptionColumn, s as renderRows } from "./src-D_0PIhqq.mjs";
5
- import { n as createHttpTransport } from "./src-rkr5j_NH.mjs";
2
+ import { t as APPLICATION_SYMBOL } from "./src-Bd1Vnze8.mjs";
3
+ import { l as isApp, o as createApp, s as createRemoteApp } from "./src-B592M-6b.mjs";
4
+ import { a as createCliStyle, c as renderSection, l as supportsColor, n as runCli, o as descriptionColumn, s as renderRows } from "./src-CL9eA6_p.mjs";
5
+ import { n as createHttpTransport } from "./src-Hw9WBgEW.mjs";
6
6
  import path from "node:path";
7
7
  import { spawn } from "node:child_process";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
package/dist/cli.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { o as AnyApp } from "./index-F4ba_olD.mjs";
1
+ import { o as AnyApp } from "./index-D63DSGZG.mjs";
2
+ import { RenderOptions } from "markdansi";
2
3
  //#region packages/cli/src/style.d.ts
3
4
  type CliStyle = {
4
5
  readonly bold: (text: string) => string;
@@ -50,6 +51,7 @@ type CreateCliOptions = {
50
51
  readonly color?: boolean;
51
52
  readonly isTTY?: boolean;
52
53
  readonly columns?: number;
54
+ readonly markdown?: RenderOptions;
53
55
  };
54
56
  declare function createCli(app: AnyApp, cliOptions?: CreateCliOptions): {
55
57
  run(argv: readonly string[], options?: {
@@ -63,6 +65,7 @@ declare function runCli(options: {
63
65
  readonly color?: boolean;
64
66
  readonly isTTY?: boolean;
65
67
  readonly columns?: number;
68
+ readonly markdown?: RenderOptions;
66
69
  readonly io?: Partial<CliIo>;
67
70
  }): Promise<number>;
68
71
  //#endregion
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createCliStyle, c as renderSection, i as ROW_INDENT, l as supportsColor, n as runCli, o as descriptionColumn, r as MARGIN, s as renderRows, t as createCli } from "./src-D_0PIhqq.mjs";
1
+ import { a as createCliStyle, c as renderSection, i as ROW_INDENT, l as supportsColor, n as runCli, o as descriptionColumn, r as MARGIN, s as renderRows, t as createCli } from "./src-CL9eA6_p.mjs";
2
2
  export { MARGIN, ROW_INDENT, createCli, createCliStyle, descriptionColumn, renderRows, renderSection, runCli, supportsColor };
package/dist/core.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as CapabilityErrorFactory, A as CapabilityTree, B as PresentationRenderer, C as subscribeLocatedCapability, D as AppDefinition, E as AppContext, F as isCapabilityGroup, G as present, H as PresentationValue, I as FilePresentationPart, J as md, K as renderPresentationMarkdown, L as ImagePresentationPart, M as LocatedCapability, N as defineApp, O as CAPABILITY_GROUP_SYMBOL, P as group, Q as CapabilityErrorDefinition, R as MarkdownPresentationPart, S as subscribeCapability, T as AnyCapabilityGroup, U as TablePresentationPart, V as PresentationTableCell, W as normalizePresentation, X as CAPABILITY_ERRORS_SYMBOL, Y as AnyDefinedErrors, Z as CapabilityErrorContract, _ as SubscribeCapabilityOptions, a as CapabilityEffect, at as AnySchema, b as executeLocatedCapability, c as CapabilityInput, ct as Schema, d as CapabilityMiddlewareArgs, dt as schemaToJsonSchema, et as CapableError, f as CapabilityOutput, g as SubscribableCapability, h as ExecuteCapabilityOptions, i as CapabilityDefinition, it as AnyObjectSchema, j as GroupMetaRegistry, k as CapabilityGroupDefinition, l as CapabilityMetaRegistry, lt as SchemaValidationError, m as CapabilitySubscriberArgs, n as CAPABILITY_SYMBOL, nt as ErrorMetaRegistry, o as CapabilityFactory, ot as InferSchemaInput, p as CapabilitySubscriber, q as MaybePromise, r as CapabilityContext, rt as defineErrors, s as CapabilityHandlerArgs, st as InferSchemaOutput, t as AnyCapability, tt as DefinedErrors, u as CapabilityMiddleware, ut as parseSchema, v as capability, w as APPLICATION_SYMBOL, x as isCapability, y as executeCapability, z as PresentationPart } from "./index-_qKFfWV4.mjs";
2
- import { n as watchQuery, t as WatchQueryOptions } from "./subscription-B-auXJbm.mjs";
1
+ import { $ as CapabilityErrorFactory, A as CapabilityTree, B as PresentationRenderer, C as subscribeLocatedCapability, D as AppDefinition, E as AppContext, F as isCapabilityGroup, G as present, H as PresentationValue, I as FilePresentationPart, J as md, K as renderPresentationMarkdown, L as ImagePresentationPart, M as LocatedCapability, N as defineApp, O as CAPABILITY_GROUP_SYMBOL, P as group, Q as CapabilityErrorDefinition, R as MarkdownPresentationPart, S as subscribeCapability, T as AnyCapabilityGroup, U as TablePresentationPart, V as PresentationTableCell, W as normalizePresentation, X as CAPABILITY_ERRORS_SYMBOL, Y as AnyDefinedErrors, Z as CapabilityErrorContract, _ as SubscribeCapabilityOptions, a as CapabilityEffect, at as AnySchema, b as executeLocatedCapability, c as CapabilityInput, ct as Schema, d as CapabilityMiddlewareArgs, dt as schemaToJsonSchema, et as CapableError, f as CapabilityOutput, g as SubscribableCapability, h as ExecuteCapabilityOptions, i as CapabilityDefinition, it as AnyObjectSchema, j as GroupMetaRegistry, k as CapabilityGroupDefinition, l as CapabilityMetaRegistry, lt as SchemaValidationError, m as CapabilitySubscriberArgs, n as CAPABILITY_SYMBOL, nt as ErrorMetaRegistry, o as CapabilityFactory, ot as InferSchemaInput, p as CapabilitySubscriber, q as MaybePromise, r as CapabilityContext, rt as defineErrors, s as CapabilityHandlerArgs, st as InferSchemaOutput, t as AnyCapability, tt as DefinedErrors, u as CapabilityMiddleware, ut as parseSchema, v as capability, w as APPLICATION_SYMBOL, x as isCapability, y as executeCapability, z as PresentationPart } from "./index-ftQx6OMr.mjs";
2
+ import { n as watchQuery, t as WatchQueryOptions } from "./subscription-DbnHcm7C.mjs";
3
3
  export { APPLICATION_SYMBOL, type AnyCapability, type AnyCapabilityGroup, type AnyDefinedErrors, type AnyObjectSchema, type AnySchema, type AppContext, type AppDefinition, CAPABILITY_ERRORS_SYMBOL, CAPABILITY_GROUP_SYMBOL, CAPABILITY_SYMBOL, type CapabilityContext, type CapabilityDefinition, type CapabilityEffect, type CapabilityErrorContract, type CapabilityErrorDefinition, type CapabilityErrorFactory, type CapabilityFactory, type CapabilityGroupDefinition, type CapabilityHandlerArgs, type CapabilityInput, type CapabilityMetaRegistry, type CapabilityMiddleware, type CapabilityMiddlewareArgs, type CapabilityOutput, type CapabilitySubscriber, type CapabilitySubscriberArgs, type CapabilityTree, CapableError, type DefinedErrors, type ErrorMetaRegistry, type ExecuteCapabilityOptions, type FilePresentationPart, type GroupMetaRegistry, type ImagePresentationPart, type InferSchemaInput, type InferSchemaOutput, type LocatedCapability, type MarkdownPresentationPart, type MaybePromise, type PresentationPart, type PresentationRenderer, type PresentationTableCell, type PresentationValue, type Schema, SchemaValidationError, type SubscribableCapability, type SubscribeCapabilityOptions, type TablePresentationPart, type WatchQueryOptions, capability, defineApp, defineErrors, executeCapability, executeLocatedCapability, group, isCapability, isCapabilityGroup, md, normalizePresentation, parseSchema, present, renderPresentationMarkdown, schemaToJsonSchema, subscribeCapability, subscribeLocatedCapability, watchQuery };
package/dist/core.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { S as defineErrors, _ as normalizePresentation, a as isCapabilityGroup, b as CAPABILITY_ERRORS_SYMBOL, c as executeCapability, d as subscribeCapability, f as subscribeLocatedCapability, g as watchQuery, h as schemaToJsonSchema, i as group, l as executeLocatedCapability, m as parseSchema, n as CAPABILITY_GROUP_SYMBOL, o as CAPABILITY_SYMBOL, p as SchemaValidationError, r as defineApp, s as capability, t as APPLICATION_SYMBOL, u as isCapability, v as present, x as CapableError, y as renderPresentationMarkdown } from "./src-D-cm2gQ6.mjs";
1
+ import { S as defineErrors, _ as normalizePresentation, a as isCapabilityGroup, b as CAPABILITY_ERRORS_SYMBOL, c as executeCapability, d as subscribeCapability, f as subscribeLocatedCapability, g as watchQuery, h as schemaToJsonSchema, i as group, l as executeLocatedCapability, m as parseSchema, n as CAPABILITY_GROUP_SYMBOL, o as CAPABILITY_SYMBOL, p as SchemaValidationError, r as defineApp, s as capability, t as APPLICATION_SYMBOL, u as isCapability, v as present, x as CapableError, y as renderPresentationMarkdown } from "./src-Bd1Vnze8.mjs";
2
2
  import { t as md } from "./projection-Cgq2u0Wt.mjs";
3
3
  export { APPLICATION_SYMBOL, CAPABILITY_ERRORS_SYMBOL, CAPABILITY_GROUP_SYMBOL, CAPABILITY_SYMBOL, CapableError, SchemaValidationError, capability, defineApp, defineErrors, executeCapability, executeLocatedCapability, group, isCapability, isCapabilityGroup, md, normalizePresentation, parseSchema, present, renderPresentationMarkdown, schemaToJsonSchema, subscribeCapability, subscribeLocatedCapability, watchQuery };
package/dist/eve.d.mts CHANGED
@@ -1,6 +1,83 @@
1
- import { o as AnyApp, w as ManifestCapability } from "./index-F4ba_olD.mjs";
1
+ import { ct as Schema, i as CapabilityDefinition, tt as DefinedErrors } from "./index-ftQx6OMr.mjs";
2
+ import { o as AnyApp, s as App, w as ManifestCapability } from "./index-D63DSGZG.mjs";
2
3
  import { DynamicResolveContext, DynamicSentinel, ToolDefinition } from "eve/tools";
3
4
  import { Approval } from "eve/tools/approval";
5
+ import { Client } from "eve/client";
6
+ //#region packages/eve/src/agent.d.ts
7
+ interface EveAgentQuestion {
8
+ requestId: string;
9
+ prompt: string;
10
+ display?: "confirmation" | "select" | "text" | undefined;
11
+ allowFreeform?: boolean | undefined;
12
+ options?: {
13
+ id: string;
14
+ label: string;
15
+ description?: string | undefined;
16
+ }[] | undefined;
17
+ }
18
+ type EveAgentData = string | number | boolean | null | EveAgentData[] | {
19
+ [key: string]: EveAgentData;
20
+ };
21
+ interface EveAgentResult {
22
+ status: "running" | "waiting" | "completed" | "failed" | "cancelled";
23
+ cursor: number;
24
+ eventCount: number;
25
+ requests: EveAgentQuestion[];
26
+ text?: string | undefined;
27
+ data?: EveAgentData | undefined;
28
+ dataOmitted?: boolean | undefined;
29
+ textTruncated?: boolean | undefined;
30
+ requiresHostInput?: boolean | undefined;
31
+ error?: string | undefined;
32
+ }
33
+ type AgentCapability<TInput extends Record<string, unknown>, TOutput, TParsed extends Record<string, unknown> = TInput> = CapabilityDefinition<undefined, Schema<TInput, TParsed>, TOutput, DefinedErrors<{}>, {}, false>;
34
+ type AgentCapabilities = {
35
+ send: AgentCapability<{
36
+ message: string;
37
+ runId?: string | undefined;
38
+ requestId?: string | undefined;
39
+ optionId?: string | undefined;
40
+ wait?: boolean | undefined;
41
+ timeoutMs?: number | undefined;
42
+ }, EveAgentResult & {
43
+ runId: string;
44
+ }>;
45
+ result: AgentCapability<{
46
+ runId: string;
47
+ cursor?: number | undefined;
48
+ }, EveAgentResult, {
49
+ runId: string;
50
+ cursor: number;
51
+ }>;
52
+ cancel: AgentCapability<{
53
+ runId: string;
54
+ turnId?: string | undefined;
55
+ }, {
56
+ status: "accepted" | "no_active_turn";
57
+ }>;
58
+ };
59
+ interface EveAgentAdapter<TName extends string> {
60
+ readonly app: App<{ [K in TName]: AgentCapabilities; }>;
61
+ /** Abort local requests without cancelling remote execution. */
62
+ dispose(): void;
63
+ }
64
+ type EveAgentOperation = "send" | "result" | "cancel";
65
+ interface EveAgentAdapterOptions<TName extends string> {
66
+ /** Namespace and capability ID prefix; unique within the composed App. */
67
+ readonly name: TName;
68
+ /** Host-configured client for ONE authenticated caller. Never share an adapter across callers. */
69
+ readonly client: Pick<Client, "sessions">;
70
+ /** Recheck host-owned authorization on every invocation, including reconstructed reads. Throw to deny. */
71
+ readonly authorize: (operation: EveAgentOperation, runId?: string) => void | Promise<void>;
72
+ readonly maxEventsPerRead?: number;
73
+ readonly readTimeoutMs?: number;
74
+ }
75
+ /**
76
+ * Wrap Eve execution as a caller-scoped Capable App.
77
+ * Eve session IDs are run IDs. Every read reconstructs state from durable events.
78
+ */
79
+ declare function createEveAgentAdapter<const TName extends string>(options: EveAgentAdapterOptions<TName>): EveAgentAdapter<TName>;
80
+ //#endregion
4
81
  //#region packages/eve/src/index.d.ts
5
82
  type EveCapabilityMeta = false | {
6
83
  readonly name?: string;
@@ -18,11 +95,11 @@ type EveTool = ToolDefinition<Record<string, unknown>, unknown>;
18
95
  /**
19
96
  * Projects an executable Capable App into native, in-process Eve tools.
20
97
  *
21
- * The returned dynamic definition resolves at `step.started`. Eve deliberately
22
- * keeps step-scoped executors live, so the Capable App and its context provider do
23
- * not have to cross a durable serialization boundary.
98
+ * Eve owns the live executor bindings and checkpoints each call and result.
99
+ * Session resolvers rebuild App bindings after a cold start. Define the App or
100
+ * provider in deployed module code and keep persistent data outside the process.
24
101
  */
25
102
  declare function createEveTools(app: EveAppProvider, options?: CreateEveToolsOptions): DynamicSentinel<Record<string, EveTool>>;
26
103
  //#endregion
27
- export { CreateEveToolsOptions, EveAppProvider, EveCapabilityMeta, createEveTools };
104
+ export { CreateEveToolsOptions, type EveAgentAdapter, type EveAgentAdapterOptions, type EveAgentData, type EveAgentOperation, type EveAgentQuestion, type EveAgentResult, EveAppProvider, EveCapabilityMeta, createEveAgentAdapter, createEveTools };
28
105
  //# sourceMappingURL=eve.d.mts.map