capable-kit 0.1.0-alpha.10 → 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 (71) hide show
  1. package/CHANGELOG.md +0 -106
  2. package/dist/ai-sdk.d.mts +3 -3
  3. package/dist/ai-sdk.mjs +7 -9
  4. package/dist/ai-sdk.mjs.map +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 +1 -6
  9. package/dist/cli.mjs +1 -1
  10. package/dist/core.d.mts +3 -3
  11. package/dist/core.mjs +1 -1
  12. package/dist/eve.d.mts +3 -3
  13. package/dist/eve.mjs +7 -9
  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-1A44jLuE.d.mts → index-D63DSGZG.d.mts} +17 -50
  18. package/dist/{index-CHuCLJIs.d.mts → index-D8DWjQ9f.d.mts} +3 -3
  19. package/dist/{index-D-NV4PiU.d.mts → index-DgxvtAmv.d.mts} +4 -4
  20. package/dist/{index-WiBWfyTn.d.mts → index-ftQx6OMr.d.mts} +16 -43
  21. package/dist/index.d.mts +4 -4
  22. package/dist/index.mjs +3 -3
  23. package/dist/mcp.d.mts +2 -7
  24. package/dist/mcp.mjs +1 -1
  25. package/dist/{mount-BmLHp349.mjs → mount-B9TrHWHh.mjs} +8 -16
  26. package/dist/mount-B9TrHWHh.mjs.map +1 -0
  27. package/dist/react-query.d.mts +2 -2
  28. package/dist/react-query.mjs +1 -1
  29. package/dist/react-query.mjs.map +1 -1
  30. package/dist/runtime-support.d.mts +1 -1
  31. package/dist/runtime-support.mjs +3 -3
  32. package/dist/server.d.mts +1 -1
  33. package/dist/server.mjs +1 -1
  34. package/dist/{src-DePlcG_t.mjs → src-B592M-6b.mjs} +105 -312
  35. package/dist/src-B592M-6b.mjs.map +1 -0
  36. package/dist/{src-B2WeUwUT.mjs → src-Bd1Vnze8.mjs} +31 -49
  37. package/dist/src-Bd1Vnze8.mjs.map +1 -0
  38. package/dist/{src-C5jGDnuu.mjs → src-CKC1BdXO.mjs} +3 -3
  39. package/dist/{src-C5jGDnuu.mjs.map → src-CKC1BdXO.mjs.map} +1 -1
  40. package/dist/{src-3LE9S4QE.mjs → src-CL9eA6_p.mjs} +17 -29
  41. package/dist/src-CL9eA6_p.mjs.map +1 -0
  42. package/dist/{src-_6OmFRYa.mjs → src-Hw9WBgEW.mjs} +10 -28
  43. package/dist/src-Hw9WBgEW.mjs.map +1 -0
  44. package/dist/{subscription-DPdwovhw.d.mts → subscription-DbnHcm7C.d.mts} +2 -2
  45. package/dist/swr.d.mts +2 -2
  46. package/dist/swr.mjs +1 -1
  47. package/dist/swr.mjs.map +1 -1
  48. package/docs/CONTEXT.md +11 -23
  49. package/docs/internal/architecture.md +14 -27
  50. package/docs/internal/capability-first-model.md +13 -99
  51. package/docs/internal/implementation-friction.md +0 -85
  52. package/docs/site/concepts/apps.mdx +1 -1
  53. package/docs/site/concepts/architecture.mdx +0 -8
  54. package/docs/site/concepts/capabilities.mdx +2 -2
  55. package/docs/site/concepts/presentations.mdx +0 -4
  56. package/docs/site/patterns/composition.mdx +5 -107
  57. package/docs/site/patterns/remote-apps.mdx +1 -5
  58. package/docs/site/patterns/subscriptions.mdx +32 -79
  59. package/docs/site/reference/packages-and-entry-points.mdx +2 -41
  60. package/docs/site/surfaces/cli.mdx +0 -11
  61. package/docs/site/surfaces/typescript.mdx +2 -2
  62. package/package.json +1 -1
  63. package/src/index.test.ts +0 -1
  64. package/src/index.ts +0 -5
  65. package/src/package.test.ts +0 -9
  66. package/dist/mount-BmLHp349.mjs.map +0 -1
  67. package/dist/src-3LE9S4QE.mjs.map +0 -1
  68. package/dist/src-B2WeUwUT.mjs.map +0 -1
  69. package/dist/src-DePlcG_t.mjs.map +0 -1
  70. package/dist/src-_6OmFRYa.mjs.map +0 -1
  71. package/docs/internal/adr/0003-capability-reference-customization.md +0 -68
package/CHANGELOG.md CHANGED
@@ -1,111 +1,5 @@
1
1
  # capable-kit
2
2
 
3
- ## 0.1.0-alpha.10
4
-
5
- ### Minor Changes
6
-
7
- - 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.
8
-
9
- ```ts
10
- import { composeApps, customize } from "capable-kit";
11
- import { createCli } from "capable-kit/cli";
12
-
13
- const cliApp = composeApps({
14
- stop: customize(desktop.plugins.stop, {
15
- description: "Stop a running desktop instance.",
16
- meta: { cli: { positional: ["instanceId"] } },
17
- }),
18
- debug: {
19
- status: desktop.plugins.status,
20
- screenshot: local.screenshot,
21
- },
22
- });
23
-
24
- await createCli(cliApp).run(process.argv.slice(2));
25
- ```
26
-
27
- `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.
28
-
29
- 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.
30
-
31
- 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.
32
-
33
- Offline help works with an `ApplicationTransport` whose `manifest()` returns a bundled contract while `call()` and `subscribe()` still use the backend.
34
- - bf8249c: Added subscription-only read capabilities for logs and events. Omit `handler` to
35
- emit individual events without a dummy unary result:
36
-
37
- ```ts
38
- const logs = capability({
39
- id: "runs.logs",
40
- effect: "read",
41
- async *subscribe({ signal }) {
42
- yield* followLogs({ signal });
43
- },
44
- toPresentation: (entry) => entry.message,
45
- });
46
-
47
- for await (const entry of subscribe(app.runs.logs, {}, { signal })) {
48
- appendLog(entry);
49
- }
50
- ```
51
-
52
- Each event is output-validated and optionally presented. Event streams may finish
53
- without yielding and the HTTP/SSE transport establishes quiet streams without
54
- waiting for an event. Opening a transport subscription parses input, resolves
55
- context, enters middleware, and invokes the subscriber before its promise
56
- resolves and before an event response is committed. Their failures retain
57
- ordinary HTTP statuses, while failures inside an async-generator body use SSE
58
- error frames. Readable CLI commands append event presentations by default;
59
- `--json` emits NDJSON without materializing presentations. Event-only capabilities
60
- have no unary call signature and are excluded from React Query/SWR state
61
- projections and automatic HTTP/OpenAPI, MCP, AI SDK, and Eve tool projections.
62
- Explicit unsupported HTTP or tool metadata is rejected; use `false` to disable
63
- that projection. `handler` plus `subscribe` still means replacement snapshots,
64
- including an initial snapshot supplied by the subscriber itself.
65
-
66
- **Breaking:** The App manifest protocol changes from `capable.capabilities.v3`
67
- to `capable.capabilities.v4`. Update clients and servers together and regenerate
68
- bundled manifests. Custom transports and manifest consumers must replace the
69
- old optional subscription field with the required execution kind:
70
-
71
- ```ts
72
- // Before (other capability fields omitted)
73
- { subscription: { mode: "replace" } }
74
-
75
- // After
76
- { execution: "live" } // handler + subscribe
77
- { execution: "unary" } // handler only
78
- { execution: "events" } // subscribe only
79
- ```
80
-
81
- The rich-value codec remains `capable.rich-json.v1`; event values preserve Dates
82
- just like existing calls and replacements.
83
-
84
- **Breaking:** The sixth `CapabilityDefinition` type argument is now an execution
85
- kind instead of a subscription boolean. For manually annotated definitions:
86
-
87
- ```ts
88
- // Before
89
- type Live = CapabilityDefinition<Context, Input, Output, Errors, Meta, true>;
90
- // After
91
- type Live = CapabilityDefinition<Context, Input, Output, Errors, Meta, "live">;
92
- ```
93
-
94
- Replace `false` with `"unary"`, and `boolean` with `"unary" | "live"` when
95
- describing the previous two forms. Prefer factory inference when possible.
96
- App subscription helpers now accept `AppCapabilityReference`; event references
97
- are not callable. `executeCapability()` accepts only callable definitions.
98
-
99
- `ApplicationTransport.subscribe()` now returns a promise for the opened async
100
- iterator. Custom transports should complete request setup before resolving it:
101
-
102
- ```ts
103
- async subscribe(call) {
104
- const response = await openSubscription(call);
105
- return decodeEvents(response);
106
- }
107
- ```
108
-
109
3
  ## 0.1.0-alpha.9
110
4
 
111
5
  ### Minor Changes
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 { 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 | {
@@ -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> = TCapability["execution"] extends "events" ? {} : CapabilityToolName<TCapability, TPath> extends (infer TName extends string) ? { readonly [TKey in TName]: AiSdkCapabilityTool<TCapability>; } : {};
24
+ type CapabilityToolEntry<TCapability extends AnyCapability, TPath extends string> = 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 { d as getAppRuntime, h as flattenManifestCapabilities, i as getCapabilityDisplay } from "./src-DePlcG_t.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({
@@ -17,19 +17,14 @@ 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 flattenManifestCapabilities(manifest.capabilities)) {
21
- const display = getCapabilityDisplay(capability);
20
+ for (const capability of flatten(manifest.capabilities)) {
22
21
  const meta = capability.meta.aiSdk;
23
22
  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
- }
28
23
  const name = meta?.name ?? capability.path.join("__");
29
24
  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`);
30
25
  if (Object.hasOwn(tools, name)) throw new Error(`Duplicate AI SDK tool name "${name}"`);
31
26
  tools[name] = tool({
32
- description: display.description ?? display.title ?? `Run the Capable Capability at ${capability.path.join(".")}.`,
27
+ description: capability.description ?? capability.title ?? `Run the Capable Capability at ${capability.path.join(".")}.`,
33
28
  inputSchema: toAiSdkSchema(capability.input ?? emptyInputSchema),
34
29
  ...capability.output ? { outputSchema: toAiSdkSchema(capability.output) } : {},
35
30
  ...meta?.strict === void 0 ? {} : { strict: meta.strict },
@@ -37,7 +32,7 @@ async function createAiSdkTools(app) {
37
32
  capabilityId: capability.id,
38
33
  path: [...capability.path],
39
34
  deprecated: capability.deprecated,
40
- ...display.title ? { title: display.title } : {},
35
+ ...capability.title ? { title: capability.title } : {},
41
36
  ...capability.effect ? { effect: capability.effect } : {}
42
37
  } },
43
38
  async execute(input, { abortSignal }) {
@@ -54,6 +49,9 @@ async function createAiSdkTools(app) {
54
49
  function toAiSdkSchema(schema) {
55
50
  return jsonSchema(schema);
56
51
  }
52
+ function flatten(nodes) {
53
+ return nodes.flatMap((node) => node.type === "capability" ? [node] : flatten(node.children));
54
+ }
57
55
  //#endregion
58
56
  export { createAiSdkTools };
59
57
 
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"ai-sdk.mjs","names":[],"sources":["../../ai-sdk/src/index.ts"],"sourcesContent":["import {\n getAppRuntime,\n type AnyApp,\n type AppCapabilities,\n type JsonSchema,\n type ManifestNode,\n type ManifestCapability,\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> = 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 flatten(manifest.capabilities)) {\n const meta = capability.meta.aiSdk as AiSdkCapabilityMeta | undefined;\n if (meta === false) continue;\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 capability.description ??\n capability.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 ...(capability.title ? { title: capability.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\nfunction flatten(\n nodes: readonly ManifestNode[],\n): readonly ManifestCapability[] {\n return nodes.flatMap((node) =>\n node.type === \"capability\" ? [node] : flatten(node.children)\n );\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,QAAQ,SAAS,YAAY,GAAG;EACvD,MAAM,OAAO,WAAW,KAAK;EAC7B,IAAI,SAAS,OAAO;EAEpB,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,WAAW,eACX,WAAW,SACX,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,WAAW,QAAQ,EAAE,OAAO,WAAW,MAAM,IAAI,CAAC;IACtD,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;AAEA,SAAS,QACP,OAC+B;CAC/B,OAAO,MAAM,SAAS,SACpB,KAAK,SAAS,eAAe,CAAC,IAAI,IAAI,QAAQ,KAAK,QAAQ,CAC7D;AACF"}
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 { 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 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";
2
- export { APP_CAPABILITIES_SYMBOL, APP_RUNTIME_SYMBOL, TransportError, composeApps, createApp, createAppManifest, createRemoteApp, customize, flattenManifestCapabilities, getAppRuntime, getCapabilityDisplay, getCapabilityNavigationMeta, isApp, 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-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-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,4 @@
1
- import { d as AnyApp } from "./index-1A44jLuE.mjs";
1
+ import { o as AnyApp } from "./index-D63DSGZG.mjs";
2
2
  import { RenderOptions } from "markdansi";
3
3
  //#region packages/cli/src/style.d.ts
4
4
  type CliStyle = {
@@ -31,11 +31,6 @@ type CliCapabilityMeta = false | {
31
31
  readonly command?: readonly string[];
32
32
  readonly positional?: readonly string[];
33
33
  };
34
- declare global {
35
- interface CapableCustomizationMeta {
36
- readonly cli?: CliCapabilityMeta;
37
- }
38
- }
39
34
  type CliGroupMeta = {
40
35
  readonly name?: string;
41
36
  };
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-3LE9S4QE.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 CapabilityErrorContract, A as CAPABILITY_GROUP_SYMBOL, B as MarkdownPresentationPart, C as isCapability, D as AnyCapabilityGroup, E as APPLICATION_SYMBOL, F as defineApp, G as TablePresentationPart, H as PresentationRenderer, I as group, J as renderPresentationMarkdown, K as normalizePresentation, L as isCapabilityGroup, M as CapabilityTree, N as GroupMetaRegistry, O as AppContext, P as LocatedCapability, Q as CAPABILITY_ERRORS_SYMBOL, R as FilePresentationPart, S as executeLocatedCapability, T as subscribeLocatedCapability, U as PresentationTableCell, V as PresentationPart, W as PresentationValue, X as md, Y as MaybePromise, Z as AnyDefinedErrors, _ as ExecuteCapabilityOptions, a as CapabilityDefinition, at as defineErrors, b as capability, c as CapabilityFactory, ct as InferSchemaInput, d as CapabilityMetaRegistry, dt as SchemaValidationError, et as CapabilityErrorDefinition, f as CapabilityMiddleware, ft as parseSchema, g as CapabilitySubscriberArgs, h as CapabilitySubscriber, i as CapabilityContext, it as ErrorMetaRegistry, j as CapabilityGroupDefinition, k as AppDefinition, l as CapabilityHandlerArgs, lt as InferSchemaOutput, m as CapabilityOutput, n as CAPABILITY_SYMBOL, nt as CapableError, o as CapabilityEffect, ot as AnyObjectSchema, p as CapabilityMiddlewareArgs, pt as schemaToJsonSchema, q as present, r as CallableCapability, rt as DefinedErrors, s as CapabilityExecution, st as AnySchema, t as AnyCapability, tt as CapabilityErrorFactory, u as CapabilityInput, ut as Schema, v as SubscribableCapability, w as subscribeCapability, x as executeCapability, y as SubscribeCapabilityOptions, z as ImagePresentationPart } from "./index-WiBWfyTn.mjs";
2
- import { n as watchQuery, t as WatchQueryOptions } from "./subscription-DPdwovhw.mjs";
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 CallableCapability, type CapabilityContext, type CapabilityDefinition, type CapabilityEffect, type CapabilityErrorContract, type CapabilityErrorDefinition, type CapabilityErrorFactory, type CapabilityExecution, 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 };
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
+ 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-B2WeUwUT.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,5 +1,5 @@
1
- import { a as CapabilityDefinition, rt as DefinedErrors, ut as Schema } from "./index-WiBWfyTn.mjs";
2
- import { d as AnyApp, f as App, j as ManifestCapability } from "./index-1A44jLuE.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";
3
3
  import { DynamicResolveContext, DynamicSentinel, ToolDefinition } from "eve/tools";
4
4
  import { Approval } from "eve/tools/approval";
5
5
  import { Client } from "eve/client";
@@ -30,7 +30,7 @@ interface EveAgentResult {
30
30
  requiresHostInput?: boolean | undefined;
31
31
  error?: string | undefined;
32
32
  }
33
- type AgentCapability<TInput extends Record<string, unknown>, TOutput, TParsed extends Record<string, unknown> = TInput> = CapabilityDefinition<undefined, Schema<TInput, TParsed>, TOutput, DefinedErrors<{}>, {}, "unary">;
33
+ type AgentCapability<TInput extends Record<string, unknown>, TOutput, TParsed extends Record<string, unknown> = TInput> = CapabilityDefinition<undefined, Schema<TInput, TParsed>, TOutput, DefinedErrors<{}>, {}, false>;
34
34
  type AgentCapabilities = {
35
35
  send: AgentCapability<{
36
36
  message: string;
package/dist/eve.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { r as defineApp, s as capability } from "./src-B2WeUwUT.mjs";
2
- import { d as getAppRuntime, h as flattenManifestCapabilities, i as getCapabilityDisplay, l as createApp } from "./src-DePlcG_t.mjs";
1
+ import { r as defineApp, s as capability } from "./src-Bd1Vnze8.mjs";
2
+ import { c as getAppRuntime, o as createApp } from "./src-B592M-6b.mjs";
3
3
  import { defineDurableCallback, defineDynamic, defineTool } from "eve/tools";
4
4
  import { z } from "zod";
5
5
  //#region packages/eve/src/agent-presentation.ts
@@ -330,7 +330,7 @@ function createEveTools(app, options = {}) {
330
330
  const capabilities = (resolvedApp) => {
331
331
  const existing = capabilitiesByApp.get(resolvedApp);
332
332
  if (existing) return existing;
333
- const resolved = getAppRuntime(resolvedApp).manifest().then((manifest) => flattenManifestCapabilities(manifest.capabilities));
333
+ const resolved = getAppRuntime(resolvedApp).manifest().then((manifest) => flatten(manifest.capabilities));
334
334
  capabilitiesByApp.set(resolvedApp, resolved);
335
335
  return resolved;
336
336
  };
@@ -339,13 +339,8 @@ function createEveTools(app, options = {}) {
339
339
  const tools = {};
340
340
  const names = /* @__PURE__ */ new Set();
341
341
  for (const capability of await capabilities(resolvedApp)) {
342
- const display = getCapabilityDisplay(capability);
343
342
  const meta = capability.meta.eve;
344
343
  if (meta === false) continue;
345
- if (capability.execution === "events") {
346
- if (meta !== void 0) throw new Error(`Event Capability "${capability.id}" cannot be exposed as an Eve tool`);
347
- continue;
348
- }
349
344
  const name = meta?.name ?? capability.path.join("__");
350
345
  if (!/^[A-Za-z0-9_-]{1,64}$/.test(name)) throw new Error(`Eve tool name "${name}" is invalid; set meta.eve.name to 1-64 letters, numbers, underscores, or hyphens`);
351
346
  if (names.has(name)) throw new Error(`Duplicate Eve tool name "${name}"`);
@@ -353,7 +348,7 @@ function createEveTools(app, options = {}) {
353
348
  const policy = options.approval?.(capability);
354
349
  const approval = policy && durableApproval(policy, capability.id);
355
350
  const definition = {
356
- description: display.description ?? display.title ?? `Run the Capable Capability at ${capability.path.join(".")}.`,
351
+ description: capability.description ?? capability.title ?? `Run the Capable Capability at ${capability.path.join(".")}.`,
357
352
  inputSchema: capability.input ?? emptyInputSchema,
358
353
  ...capability.output ? { outputSchema: capability.output } : {},
359
354
  ...approval ? { approval } : {}
@@ -396,6 +391,9 @@ function durableApproval(policy, id) {
396
391
  ...policy.response ? { response: durablePolicy(policy.response, id) } : {}
397
392
  };
398
393
  }
394
+ function flatten(nodes) {
395
+ return nodes.flatMap((node) => node.type === "capability" ? [node] : flatten(node.children));
396
+ }
399
397
  //#endregion
400
398
  export { createEveAgentAdapter, createEveTools };
401
399
 
package/dist/eve.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"eve.mjs","names":[],"sources":["../../eve/src/agent-presentation.ts","../../eve/src/agent.ts","../../eve/src/index.ts"],"sourcesContent":["import type { EveAgentResult } from \"./agent.ts\";\n\n/** Portable presentation shared by the CLI and other presentation-aware surfaces. */\nexport function presentAgentResult(result: EveAgentResult & { runId?: string }): string {\n const status = {\n running: \"Running. Check the result again to follow progress.\",\n waiting: \"Waiting for input.\",\n completed: \"Completed.\",\n failed: \"Agent execution failed.\",\n cancelled: \"Cancelled.\",\n }[result.status];\n const parts = [status];\n if (result.text) parts.push(result.text);\n if (result.data !== undefined) parts.push(JSON.stringify(result.data, null, 2));\n if (result.textTruncated) parts.push(\"The answer was truncated.\");\n if (result.dataOmitted) parts.push(\"Structured output was too large to include.\");\n for (const request of result.requests) {\n parts.push(request.prompt);\n parts.push(`Request ID: ${request.requestId}`);\n if (request.options?.length) {\n parts.push(request.options.map(option => `- ${option.label} (option ID: ${option.id})${option.description ? ` — ${option.description}` : \"\"}`).join(\"\\n\"));\n }\n if (request.allowFreeform === false || (request.options?.length && request.allowFreeform !== true)) {\n parts.push(\"Reply with an option ID.\");\n }\n }\n if (result.requiresHostInput) parts.push(\"Approval or authorization must be completed through the Eve host.\");\n if (result.runId) parts.push(`Run ID: ${result.runId}`);\n return parts.join(\"\\n\\n\");\n}\n","import { createApp, type App } from \"@capable/app\";\nimport { capability, defineApp, type CapabilityDefinition, type DefinedErrors, type Schema } from \"@capable/core\";\nimport type { Client } from \"eve/client\";\nimport { z } from \"zod\";\nimport { presentAgentResult } from \"./agent-presentation.ts\";\n\nconst runInput = z.object({ runId: z.string().min(1).describe(\"Eve session ID returned by send.\") });\nconst question = z.object({\n requestId: z.string(),\n prompt: z.string(),\n display: z.enum([\"confirmation\", \"select\", \"text\"]).optional(),\n allowFreeform: z.boolean().optional(),\n options: z.array(z.object({ id: z.string(), label: z.string(), description: z.string().optional() })).optional(),\n});\nconst resultSchema = z.object({\n status: z.enum([\"running\", \"waiting\", \"completed\", \"failed\", \"cancelled\"]),\n cursor: z.number().int().nonnegative(),\n eventCount: z.number().int().nonnegative(),\n requests: z.array(question),\n text: z.string().optional(),\n data: z.json().optional(),\n dataOmitted: z.boolean().optional(),\n textTruncated: z.boolean().optional(),\n requiresHostInput: z.boolean().optional(),\n error: z.string().optional(),\n});\nexport interface EveAgentQuestion {\n requestId: string;\n prompt: string;\n display?: \"confirmation\" | \"select\" | \"text\" | undefined;\n allowFreeform?: boolean | undefined;\n options?: { id: string; label: string; description?: string | undefined }[] | undefined;\n}\nexport type EveAgentData = string | number | boolean | null | EveAgentData[] | { [key: string]: EveAgentData };\nexport interface EveAgentResult {\n status: \"running\" | \"waiting\" | \"completed\" | \"failed\" | \"cancelled\";\n cursor: number;\n eventCount: number;\n requests: EveAgentQuestion[];\n text?: string | undefined;\n data?: EveAgentData | undefined;\n dataOmitted?: boolean | undefined;\n textTruncated?: boolean | undefined;\n requiresHostInput?: boolean | undefined;\n error?: string | undefined;\n}\n\ntype AgentCapability<TInput extends Record<string, unknown>, TOutput, TParsed extends Record<string, unknown> = TInput> =\n CapabilityDefinition<undefined, Schema<TInput, TParsed>, TOutput, DefinedErrors<{}>, {}, \"unary\">;\ntype AgentCapabilities = {\n send: AgentCapability<{\n message: string; runId?: string | undefined; requestId?: string | undefined;\n optionId?: string | undefined; wait?: boolean | undefined; timeoutMs?: number | undefined;\n }, EveAgentResult & { runId: string }>;\n result: AgentCapability<{ runId: string; cursor?: number | undefined }, EveAgentResult, { runId: string; cursor: number }>;\n cancel: AgentCapability<{ runId: string; turnId?: string | undefined }, { status: \"accepted\" | \"no_active_turn\" }>;\n};\nexport interface EveAgentAdapter<TName extends string> {\n readonly app: App<{ [K in TName]: AgentCapabilities }>;\n /** Abort local requests without cancelling remote execution. */\n dispose(): void;\n}\nexport type EveAgentOperation = \"send\" | \"result\" | \"cancel\";\n\nexport interface EveAgentAdapterOptions<TName extends string> {\n /** Namespace and capability ID prefix; unique within the composed App. */\n readonly name: TName;\n /** Host-configured client for ONE authenticated caller. Never share an adapter across callers. */\n readonly client: Pick<Client, \"sessions\">;\n /** Recheck host-owned authorization on every invocation, including reconstructed reads. Throw to deny. */\n readonly authorize: (operation: EveAgentOperation, runId?: string) => void | Promise<void>;\n readonly maxEventsPerRead?: number;\n readonly readTimeoutMs?: number;\n}\n\ntype Run = {\n sessionId: string;\n result: EveAgentResult;\n cancelled: boolean;\n hostInputs: Set<string>;\n authorizations: Set<string>;\n message: string | undefined;\n data: EveAgentData | undefined;\n dataOmitted: boolean;\n pending: Map<string, z.infer<typeof question>>;\n};\n\n/**\n * Wrap Eve execution as a caller-scoped Capable App.\n * Eve session IDs are run IDs. Every read reconstructs state from durable events.\n */\nexport function createEveAgentAdapter<const TName extends string>(options: EveAgentAdapterOptions<TName>): EveAgentAdapter<TName> {\n if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(options.name)) throw new Error(\"Invalid Eve agent namespace\");\n const maxEvents = positive(options.maxEventsPerRead ?? 10_000, \"maxEventsPerRead\");\n const timeoutMs = positive(options.readTimeoutMs ?? 1_000, \"readTimeoutMs\");\n const lifetime = new AbortController();\n\n async function authorize(operation: EveAgentOperation, runId?: string) {\n lifetime.signal.throwIfAborted();\n await options.authorize(operation, runId);\n lifetime.signal.throwIfAborted();\n }\n function signalFor(signal?: AbortSignal) {\n return AbortSignal.any([lifetime.signal, ...(signal ? [signal] : [])]);\n }\n async function readRun(runId: string, signal?: AbortSignal): Promise<Run> {\n const run: Run = {\n sessionId: runId,\n result: { status: \"running\", cursor: 0, eventCount: 0, requests: [] },\n cancelled: false, hostInputs: new Set(), authorizations: new Set(),\n message: undefined, data: undefined, dataOmitted: false, pending: new Map(),\n };\n const requestSignal = signalFor(signal);\n requestSignal.throwIfAborted();\n const read = new AbortController();\n const timer = setTimeout(() => read.abort(), timeoutMs);\n const combined = AbortSignal.any([requestSignal, read.signal]);\n try {\n const session = options.client.sessions.attach(runId);\n for await (const event of session.stream({ startIndex: 0, follow: false, signal: combined, streamReconnectPolicy: { reconnect: false } })) {\n if (run.result.cursor >= maxEvents) throw new Error(\"Eve history exceeds maxEventsPerRead\");\n if (event.type === \"input.requested\") {\n for (const request of event.data.requests) {\n if (request.kind === \"question\") {\n // Deliberate allowlist: no action input, tool names, IDs, or credentials.\n const safe = question.parse(request);\n if (JSON.stringify(safe).length > 65_536 || (!run.pending.has(safe.requestId) && run.pending.size >= 100)) throw new Error(\"Eve question limit exceeded\");\n run.pending.set(safe.requestId, safe);\n } else {\n remember(run.hostInputs, request.requestId);\n }\n }\n } else if (event.type === \"authorization.required\") {\n remember(run.authorizations, event.data.name);\n } else if (event.type === \"authorization.completed\") {\n run.authorizations.delete(event.data.name);\n } else if (event.type === \"input.resolved\") {\n for (const resolution of event.data.resolutions) {\n run.pending.delete(resolution.requestId);\n run.hostInputs.delete(resolution.requestId);\n }\n run.result.requests = [...run.pending.values()];\n } else if (event.type === \"turn.started\" || event.type === \"step.started\") {\n run.result = { status: \"running\", cursor: run.result.cursor, eventCount: 0, requests: [] };\n if (event.type === \"turn.started\") {\n run.cancelled = false;\n run.message = undefined;\n run.data = undefined;\n run.dataOmitted = false;\n }\n } else if (event.type === \"message.completed\" && event.data.finishReason !== \"tool-calls\") {\n run.message = event.data.message?.slice(0, 65_536);\n run.result.textTruncated = (event.data.message?.length ?? 0) > 65_536;\n } else if (event.type === \"result.completed\") {\n run.dataOmitted = JSON.stringify(event.data.result).length > 65_536;\n run.data = run.dataOmitted ? undefined : z.json().parse(event.data.result);\n } else if (event.type === \"turn.cancelled\") {\n run.cancelled = true;\n } else if (event.type === \"session.failed\" || event.type === \"turn.failed\") {\n run.result.status = \"failed\";\n // Raw failure details can include private tool arguments or credentials.\n run.result.error = \"Eve agent execution failed\";\n } else if (event.type === \"session.completed\" || event.type === \"session.waiting\") {\n run.result.status = run.cancelled ? \"cancelled\"\n : event.type === \"session.waiting\" && (run.pending.size > 0 || (run.hostInputs.size > 0 || run.authorizations.size > 0) || (run.message === undefined && run.data === undefined && !run.dataOmitted)) ? \"waiting\" : \"completed\";\n if (run.result.status === \"completed\" && run.message !== undefined) run.result.text = run.message;\n if (run.result.status === \"completed\") {\n run.result.requests = [];\n delete run.result.requiresHostInput;\n if (run.data !== undefined) run.result.data = run.data;\n if (run.dataOmitted) run.result.dataOmitted = true;\n }\n if (run.result.status === \"waiting\") {\n run.result.requests = [...run.pending.values()];\n run.result.requiresHostInput = (run.hostInputs.size > 0 || run.authorizations.size > 0) || run.pending.size === 0;\n }\n }\n\n run.result.cursor++;\n }\n // Eve can swallow stream aborts. Never validate an answer against partial history.\n combined.throwIfAborted();\n return run;\n } finally {\n clearTimeout(timer);\n read.abort();\n }\n }\n\n const capabilities = {\n send: capability({\n id: `${options.name}.send`, effect: \"write\",\n description: \"Send a message, optionally continuing an Eve session and waiting for its answer.\",\n meta: { cli: { positional: [\"message\"] } },\n input: z.object({\n message: z.string().min(1).max(65_536).describe(\"Message to send, or a text answer to a pending question. With option-id, only the selected option is submitted.\"),\n runId: z.string().min(1).optional().describe(\"Continue this Eve session. Omit to begin a new conversation.\"),\n requestId: z.string().min(1).optional().describe(\"Pending question to answer. Required when several questions are waiting; use with run-id.\"),\n optionId: z.string().min(1).optional().describe(\"Answer option ID shown by result. Required for questions that do not accept freeform text; use with run-id.\"),\n wait: z.boolean().optional().describe(\"Wait for an answer, pending input, failure, or cancellation. Otherwise return the run ID immediately.\"),\n timeoutMs: z.number().int().min(1).max(300_000).optional().describe(\"Wait limit in milliseconds after acceptance (default: 30000; maximum: 300000). Only used with wait. Expiry leaves Eve running.\"),\n }),\n output: resultSchema.extend({ runId: z.string() }),\n toPresentation: presentAgentResult,\n handler: async ({ input, signal }) => {\n await authorize(\"send\", input.runId);\n if (!input.runId && (input.requestId || input.optionId)) throw new Error(\"Question answers require a runId\");\n const waiting = new AbortController();\n const requestSignal = AbortSignal.any([signalFor(signal), waiting.signal]);\n const sendOptions = { signal: requestSignal, streamReconnectPolicy: { reconnect: false as const } };\n let response;\n if (input.runId) {\n const run = await readRun(input.runId, signal);\n const session = options.client.sessions.attach(input.runId, { streamIndex: run.result.cursor });\n if (input.requestId || run.pending.size) {\n const pending = input.requestId ? run.pending.get(input.requestId)\n : run.pending.size === 1 ? [...run.pending.values()][0] : undefined;\n if (!pending || run.result.status !== \"waiting\") throw new Error(\"Specify requestId for a current pending question\");\n if (input.optionId) {\n if (!pending.options?.some(option => option.id === input.optionId)) throw new Error(\"Unknown answer option\");\n } else if (pending.allowFreeform === false || (pending.options?.length && pending.allowFreeform !== true)) {\n throw new Error(\"This question requires optionId\");\n }\n response = await session.respond([{\n requestId: pending.requestId,\n ...(input.optionId ? { optionId: input.optionId } : { text: input.message }),\n }], sendOptions);\n } else {\n if (input.optionId) throw new Error(\"No pending question for optionId\");\n if (run.hostInputs.size || run.authorizations.size) throw new Error(\"Pending approval or authorization requires host action\");\n response = await session.send(input.message, sendOptions);\n }\n if (response.sessionId !== input.runId) throw new Error(\"Eve resumed a different session\");\n } else {\n ({ response } = await options.client.sessions.create({ message: input.message, ...sendOptions }));\n }\n const runId = response.sessionId;\n const accepted = { runId, status: \"running\" as const, cursor: 0, eventCount: 0, requests: [] };\n if (!input.wait) return accepted;\n // Eve correlates this stream with the accepted delivery, skipping old turn boundaries.\n // The timer starts after acceptance; aborting this local stream never cancels Eve.\n const timer = setTimeout(() => waiting.abort(), input.timeoutMs ?? 30_000);\n try {\n let count = 0;\n let boundary = false;\n for await (const event of response) {\n requestSignal.throwIfAborted();\n if (++count > maxEvents) throw new Error(\"Eve response exceeds maxEventsPerRead\");\n if ([\"session.waiting\", \"session.completed\", \"session.failed\", \"turn.failed\"].includes(event.type)) {\n boundary = true;\n break;\n }\n }\n requestSignal.throwIfAborted();\n if (!boundary) return accepted;\n const run = await readRun(runId, requestSignal);\n return { runId, ...run.result, eventCount: run.result.cursor };\n } catch (error) {\n signalFor(signal).throwIfAborted();\n if (waiting.signal.aborted) return accepted;\n throw error;\n } finally {\n clearTimeout(timer);\n waiting.abort();\n }\n },\n }),\n result: capability({\n id: `${options.name}.result`, effect: \"read\",\n description: \"Read bounded progress, pending questions, or the final output. Pass the last returned cursor.\",\n input: runInput.extend({ cursor: z.number().int().nonnegative().default(0).describe(\"Cursor from the previous result, used to count new events. Defaults to 0; the full current result is still returned.\") }),\n output: resultSchema,\n toPresentation: presentAgentResult,\n handler: async ({ input, signal }) => {\n await authorize(\"result\", input.runId);\n const run = await readRun(input.runId, signal);\n if (input.cursor > run.result.cursor) throw new Error(\"Eve cursor is ahead of this run\");\n return { ...run.result, eventCount: run.result.cursor - input.cursor };\n },\n }),\n cancel: capability({\n id: `${options.name}.cancel`, effect: \"write\",\n description: \"Request cooperative cancellation of the active Eve turn. Acceptance is not completion.\",\n input: runInput.extend({ turnId: z.string().min(1).optional().describe(\"Specific Eve turn to cancel. Omit to cancel the session’s active turn.\") }),\n output: z.object({ status: z.enum([\"accepted\", \"no_active_turn\"]) }),\n toPresentation: ({ status }) => status === \"accepted\"\n ? \"Cancellation requested. Check the result to confirm execution has stopped.\"\n : \"No active turn to cancel.\",\n handler: async ({ input, signal }) => {\n await authorize(\"cancel\", input.runId);\n signalFor(signal).throwIfAborted();\n // Cancellation can run alongside a bounded result read.\n const result = await options.client.sessions.attach(input.runId).cancel({\n signal: signalFor(signal),\n ...(input.turnId ? { turnId: input.turnId } : {}),\n });\n return { status: result.status };\n },\n }),\n };\n // Widen the key during construction: TypeScript cannot reduce context inference\n // for a generic mapped namespace, although all three capabilities are context-free.\n const checked: AgentCapabilities = capabilities;\n const app = createApp(defineApp({ capabilities: { [options.name]: checked } })) as App<{ [K in TName]: AgentCapabilities }>;\n return {\n app,\n dispose() {\n lifetime.abort();\n },\n };\n}\n\nfunction positive(value: number, name: string) {\n if (!Number.isSafeInteger(value) || value < 1) throw new Error(`${name} must be a positive safe integer`);\n return value;\n}\n\nfunction remember(values: Set<string>, value: string) {\n if (value.length > 65_536 || (!values.has(value) && values.size >= 100)) {\n throw new Error(\"Eve pending input limit exceeded\");\n }\n values.add(value);\n}\n","import {\n getAppRuntime,\n getCapabilityDisplay,\n flattenManifestCapabilities,\n type AnyApp,\n type ManifestCapability,\n} from \"@capable/app\";\nimport type { CapabilityMetaRegistry } from \"@capable/core\";\nimport {\n defineDynamic,\n defineTool,\n defineDurableCallback,\n type DynamicResolveContext,\n type DynamicSentinel,\n type ToolDefinition,\n type ToolContext,\n} from \"eve/tools\";\nimport type { Approval } from \"eve/tools/approval\";\n\nexport type EveCapabilityMeta =\n | false\n | {\n readonly name?: string;\n };\n\ndeclare module \"@capable/core\" {\n interface CapabilityMetaRegistry {\n readonly eve?: EveCapabilityMeta;\n }\n}\n\nexport type CreateEveToolsOptions = {\n readonly approval?: (\n capability: ManifestCapability,\n ) => Approval | undefined;\n};\n\nexport type EveAppProvider =\n | AnyApp\n | ((\n context: DynamicResolveContext,\n ) => AnyApp | Promise<AnyApp>);\n\nconst emptyInputSchema = Object.freeze({\n type: \"object\",\n properties: Object.freeze({}),\n additionalProperties: false,\n});\n\ntype EveTool = ToolDefinition<Record<string, unknown>, unknown>;\n\n/**\n * Projects an executable Capable App into native, in-process Eve tools.\n *\n * Eve owns the live executor bindings and checkpoints each call and result.\n * Session resolvers rebuild App bindings after a cold start. Define the App or\n * provider in deployed module code and keep persistent data outside the process.\n */\nexport function createEveTools(\n app: EveAppProvider,\n options: CreateEveToolsOptions = {},\n): DynamicSentinel<Record<string, EveTool>> {\n const capabilitiesByApp = new WeakMap<\n AnyApp,\n Promise<readonly ManifestCapability[]>\n >();\n const capabilities = (resolvedApp: AnyApp) => {\n const existing = capabilitiesByApp.get(resolvedApp);\n if (existing) return existing;\n const resolved = getAppRuntime(resolvedApp).manifest().then((manifest) =>\n flattenManifestCapabilities(manifest.capabilities)\n );\n capabilitiesByApp.set(resolvedApp, resolved);\n return resolved;\n };\n\n return defineDynamic({\n events: {\n \"session.started\": async (_event, resolveContext) => {\n const resolvedApp = typeof app === \"function\"\n ? await app(resolveContext)\n : app;\n const tools: Record<string, EveTool> = {};\n const names = new Set<string>();\n\n for (const capability of await capabilities(resolvedApp)) {\n const display = getCapabilityDisplay(capability);\n const meta = capability.meta.eve as EveCapabilityMeta | 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 Eve 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 `Eve tool name \"${name}\" is invalid; set meta.eve.name to 1-64 letters, numbers, underscores, or hyphens`,\n );\n }\n if (names.has(name)) {\n throw new Error(`Duplicate Eve tool name \"${name}\"`);\n }\n names.add(name);\n\n const policy = options.approval?.(capability);\n const approval = policy && durableApproval(policy, capability.id);\n const definition: Omit<EveTool, \"execute\"> = {\n description:\n display.description ??\n display.title ??\n `Run the Capable Capability at ${capability.path.join(\".\")}.`,\n inputSchema: (capability.input ??\n emptyInputSchema) as EveTool[\"inputSchema\"],\n ...(capability.output\n ? {\n outputSchema:\n capability.output as NonNullable<EveTool[\"outputSchema\"]>,\n }\n : {}),\n ...(approval ? { approval } : {}),\n };\n const id = capability.id;\n tools[name] = defineTool({\n ...definition,\n execute: defineDurableCallback({\n closure: { id },\n callback: async ({ id }, input: Record<string, unknown>, context: ToolContext) => {\n // A rejected approval can change the latest resolver's caller.\n // Rebuild per-caller Apps from the actual execution identity.\n const executionApp = typeof app === \"function\"\n ? await app({ ...resolveContext, session: context.session })\n : app;\n const result = await getAppRuntime(executionApp).call({\n id, input, signal: context.abortSignal,\n });\n return result.output;\n },\n }),\n });\n }\n\n return tools;\n },\n },\n });\n}\n\n/** The resolver reconstructs policies; persist identity and reject rebinding to a different capability. */\nfunction durablePolicy<T extends (...args: never[]) => unknown>(policy: T, id: string): T {\n return defineDurableCallback({\n closure: { id },\n callback: (snapshot, ...args: Parameters<T>) => {\n if (snapshot.id !== id) throw new Error(\"Eve capability identity changed during recovery\");\n return policy(...args);\n },\n }) as T;\n}\n\nfunction durableApproval(policy: Approval, id: string): Approval {\n if (typeof policy === \"function\") return durablePolicy(policy, id);\n return {\n request: durablePolicy(policy.request, id),\n ...(policy.response ? { response: durablePolicy(policy.response, id) } : {}),\n };\n}\n\nexport {\n createEveAgentAdapter,\n type EveAgentAdapter,\n type EveAgentAdapterOptions,\n type EveAgentOperation,\n type EveAgentData,\n type EveAgentQuestion,\n type EveAgentResult,\n} from \"./agent.ts\";\n"],"mappings":";;;;;;AAGA,SAAgB,mBAAmB,QAAqD;CAQtF,MAAM,QAAQ,CAPC;EACb,SAAS;EACT,SAAS;EACT,WAAW;EACX,QAAQ;EACR,WAAW;CACb,EAAE,OAAO,OACY;CACrB,IAAI,OAAO,MAAM,MAAM,KAAK,OAAO,IAAI;CACvC,IAAI,OAAO,SAAS,KAAA,GAAW,MAAM,KAAK,KAAK,UAAU,OAAO,MAAM,MAAM,CAAC,CAAC;CAC9E,IAAI,OAAO,eAAe,MAAM,KAAK,2BAA2B;CAChE,IAAI,OAAO,aAAa,MAAM,KAAK,6CAA6C;CAChF,KAAK,MAAM,WAAW,OAAO,UAAU;EACrC,MAAM,KAAK,QAAQ,MAAM;EACzB,MAAM,KAAK,eAAe,QAAQ,WAAW;EAC7C,IAAI,QAAQ,SAAS,QACnB,MAAM,KAAK,QAAQ,QAAQ,KAAI,WAAU,KAAK,OAAO,MAAM,eAAe,OAAO,GAAG,GAAG,OAAO,cAAc,MAAM,OAAO,gBAAgB,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;EAE3J,IAAI,QAAQ,kBAAkB,SAAU,QAAQ,SAAS,UAAU,QAAQ,kBAAkB,MAC3F,MAAM,KAAK,0BAA0B;CAEzC;CACA,IAAI,OAAO,mBAAmB,MAAM,KAAK,mEAAmE;CAC5G,IAAI,OAAO,OAAO,MAAM,KAAK,WAAW,OAAO,OAAO;CACtD,OAAO,MAAM,KAAK,MAAM;AAC1B;;;ACvBA,MAAM,WAAW,EAAE,OAAO,EAAE,O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S,QAAQ;MAAQ,CAAC,IACzD,GAC2C,CAAC,CAAC,KAAK;OACpD;OAAI;OAAO,QAAQ,QAAQ;MAC7B,CAAC,EAAA,CACa;KAChB;IACF,CAAC;GACH,CAAC;EACH;EAEA,OAAO;CACT,EACF,EACF,CAAC;AACH;;AAGA,SAAS,cAAuD,QAAW,IAAe;CACxF,OAAO,sBAAsB;EAC3B,SAAS,EAAE,GAAG;EACd,WAAW,UAAU,GAAG,SAAwB;GAC9C,IAAI,SAAS,OAAO,IAAI,MAAM,IAAI,MAAM,iDAAiD;GACzF,OAAO,OAAO,GAAG,IAAI;EACvB;CACF,CAAC;AACH;AAEA,SAAS,gBAAgB,QAAkB,IAAsB;CAC/D,IAAI,OAAO,WAAW,YAAY,OAAO,cAAc,QAAQ,EAAE;CACjE,OAAO;EACL,SAAS,cAAc,OAAO,SAAS,EAAE;EACzC,GAAI,OAAO,WAAW,EAAE,UAAU,cAAc,OAAO,UAAU,EAAE,EAAE,IAAI,CAAC;CAC5E;AACF"}
1
+ {"version":3,"file":"eve.mjs","names":[],"sources":["../../eve/src/agent-presentation.ts","../../eve/src/agent.ts","../../eve/src/index.ts"],"sourcesContent":["import type { EveAgentResult } from \"./agent.ts\";\n\n/** Portable presentation shared by the CLI and other presentation-aware surfaces. */\nexport function presentAgentResult(result: EveAgentResult & { runId?: string }): string {\n const status = {\n running: \"Running. Check the result again to follow progress.\",\n waiting: \"Waiting for input.\",\n completed: \"Completed.\",\n failed: \"Agent execution failed.\",\n cancelled: \"Cancelled.\",\n }[result.status];\n const parts = [status];\n if (result.text) parts.push(result.text);\n if (result.data !== undefined) parts.push(JSON.stringify(result.data, null, 2));\n if (result.textTruncated) parts.push(\"The answer was truncated.\");\n if (result.dataOmitted) parts.push(\"Structured output was too large to include.\");\n for (const request of result.requests) {\n parts.push(request.prompt);\n parts.push(`Request ID: ${request.requestId}`);\n if (request.options?.length) {\n parts.push(request.options.map(option => `- ${option.label} (option ID: ${option.id})${option.description ? ` — ${option.description}` : \"\"}`).join(\"\\n\"));\n }\n if (request.allowFreeform === false || (request.options?.length && request.allowFreeform !== true)) {\n parts.push(\"Reply with an option ID.\");\n }\n }\n if (result.requiresHostInput) parts.push(\"Approval or authorization must be completed through the Eve host.\");\n if (result.runId) parts.push(`Run ID: ${result.runId}`);\n return parts.join(\"\\n\\n\");\n}\n","import { createApp, type App } from \"@capable/app\";\nimport { capability, defineApp, type CapabilityDefinition, type DefinedErrors, type Schema } from \"@capable/core\";\nimport type { Client } from \"eve/client\";\nimport { z } from \"zod\";\nimport { presentAgentResult } from \"./agent-presentation.ts\";\n\nconst runInput = z.object({ runId: z.string().min(1).describe(\"Eve session ID returned by send.\") });\nconst question = z.object({\n requestId: z.string(),\n prompt: z.string(),\n display: z.enum([\"confirmation\", \"select\", \"text\"]).optional(),\n allowFreeform: z.boolean().optional(),\n options: z.array(z.object({ id: z.string(), label: z.string(), description: z.string().optional() })).optional(),\n});\nconst resultSchema = z.object({\n status: z.enum([\"running\", \"waiting\", \"completed\", \"failed\", \"cancelled\"]),\n cursor: z.number().int().nonnegative(),\n eventCount: z.number().int().nonnegative(),\n requests: z.array(question),\n text: z.string().optional(),\n data: z.json().optional(),\n dataOmitted: z.boolean().optional(),\n textTruncated: z.boolean().optional(),\n requiresHostInput: z.boolean().optional(),\n error: z.string().optional(),\n});\nexport interface EveAgentQuestion {\n requestId: string;\n prompt: string;\n display?: \"confirmation\" | \"select\" | \"text\" | undefined;\n allowFreeform?: boolean | undefined;\n options?: { id: string; label: string; description?: string | undefined }[] | undefined;\n}\nexport type EveAgentData = string | number | boolean | null | EveAgentData[] | { [key: string]: EveAgentData };\nexport interface EveAgentResult {\n status: \"running\" | \"waiting\" | \"completed\" | \"failed\" | \"cancelled\";\n cursor: number;\n eventCount: number;\n requests: EveAgentQuestion[];\n text?: string | undefined;\n data?: EveAgentData | undefined;\n dataOmitted?: boolean | undefined;\n textTruncated?: boolean | undefined;\n requiresHostInput?: boolean | undefined;\n error?: string | undefined;\n}\n\ntype AgentCapability<TInput extends Record<string, unknown>, TOutput, TParsed extends Record<string, unknown> = TInput> =\n CapabilityDefinition<undefined, Schema<TInput, TParsed>, TOutput, DefinedErrors<{}>, {}, false>;\ntype AgentCapabilities = {\n send: AgentCapability<{\n message: string; runId?: string | undefined; requestId?: string | undefined;\n optionId?: string | undefined; wait?: boolean | undefined; timeoutMs?: number | undefined;\n }, EveAgentResult & { runId: string }>;\n result: AgentCapability<{ runId: string; cursor?: number | undefined }, EveAgentResult, { runId: string; cursor: number }>;\n cancel: AgentCapability<{ runId: string; turnId?: string | undefined }, { status: \"accepted\" | \"no_active_turn\" }>;\n};\nexport interface EveAgentAdapter<TName extends string> {\n readonly app: App<{ [K in TName]: AgentCapabilities }>;\n /** Abort local requests without cancelling remote execution. */\n dispose(): void;\n}\nexport type EveAgentOperation = \"send\" | \"result\" | \"cancel\";\n\nexport interface EveAgentAdapterOptions<TName extends string> {\n /** Namespace and capability ID prefix; unique within the composed App. */\n readonly name: TName;\n /** Host-configured client for ONE authenticated caller. Never share an adapter across callers. */\n readonly client: Pick<Client, \"sessions\">;\n /** Recheck host-owned authorization on every invocation, including reconstructed reads. Throw to deny. */\n readonly authorize: (operation: EveAgentOperation, runId?: string) => void | Promise<void>;\n readonly maxEventsPerRead?: number;\n readonly readTimeoutMs?: number;\n}\n\ntype Run = {\n sessionId: string;\n result: EveAgentResult;\n cancelled: boolean;\n hostInputs: Set<string>;\n authorizations: Set<string>;\n message: string | undefined;\n data: EveAgentData | undefined;\n dataOmitted: boolean;\n pending: Map<string, z.infer<typeof question>>;\n};\n\n/**\n * Wrap Eve execution as a caller-scoped Capable App.\n * Eve session IDs are run IDs. Every read reconstructs state from durable events.\n */\nexport function createEveAgentAdapter<const TName extends string>(options: EveAgentAdapterOptions<TName>): EveAgentAdapter<TName> {\n if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(options.name)) throw new Error(\"Invalid Eve agent namespace\");\n const maxEvents = positive(options.maxEventsPerRead ?? 10_000, \"maxEventsPerRead\");\n const timeoutMs = positive(options.readTimeoutMs ?? 1_000, \"readTimeoutMs\");\n const lifetime = new AbortController();\n\n async function authorize(operation: EveAgentOperation, runId?: string) {\n lifetime.signal.throwIfAborted();\n await options.authorize(operation, runId);\n lifetime.signal.throwIfAborted();\n }\n function signalFor(signal?: AbortSignal) {\n return AbortSignal.any([lifetime.signal, ...(signal ? [signal] : [])]);\n }\n async function readRun(runId: string, signal?: AbortSignal): Promise<Run> {\n const run: Run = {\n sessionId: runId,\n result: { status: \"running\", cursor: 0, eventCount: 0, requests: [] },\n cancelled: false, hostInputs: new Set(), authorizations: new Set(),\n message: undefined, data: undefined, dataOmitted: false, pending: new Map(),\n };\n const requestSignal = signalFor(signal);\n requestSignal.throwIfAborted();\n const read = new AbortController();\n const timer = setTimeout(() => read.abort(), timeoutMs);\n const combined = AbortSignal.any([requestSignal, read.signal]);\n try {\n const session = options.client.sessions.attach(runId);\n for await (const event of session.stream({ startIndex: 0, follow: false, signal: combined, streamReconnectPolicy: { reconnect: false } })) {\n if (run.result.cursor >= maxEvents) throw new Error(\"Eve history exceeds maxEventsPerRead\");\n if (event.type === \"input.requested\") {\n for (const request of event.data.requests) {\n if (request.kind === \"question\") {\n // Deliberate allowlist: no action input, tool names, IDs, or credentials.\n const safe = question.parse(request);\n if (JSON.stringify(safe).length > 65_536 || (!run.pending.has(safe.requestId) && run.pending.size >= 100)) throw new Error(\"Eve question limit exceeded\");\n run.pending.set(safe.requestId, safe);\n } else {\n remember(run.hostInputs, request.requestId);\n }\n }\n } else if (event.type === \"authorization.required\") {\n remember(run.authorizations, event.data.name);\n } else if (event.type === \"authorization.completed\") {\n run.authorizations.delete(event.data.name);\n } else if (event.type === \"input.resolved\") {\n for (const resolution of event.data.resolutions) {\n run.pending.delete(resolution.requestId);\n run.hostInputs.delete(resolution.requestId);\n }\n run.result.requests = [...run.pending.values()];\n } else if (event.type === \"turn.started\" || event.type === \"step.started\") {\n run.result = { status: \"running\", cursor: run.result.cursor, eventCount: 0, requests: [] };\n if (event.type === \"turn.started\") {\n run.cancelled = false;\n run.message = undefined;\n run.data = undefined;\n run.dataOmitted = false;\n }\n } else if (event.type === \"message.completed\" && event.data.finishReason !== \"tool-calls\") {\n run.message = event.data.message?.slice(0, 65_536);\n run.result.textTruncated = (event.data.message?.length ?? 0) > 65_536;\n } else if (event.type === \"result.completed\") {\n run.dataOmitted = JSON.stringify(event.data.result).length > 65_536;\n run.data = run.dataOmitted ? undefined : z.json().parse(event.data.result);\n } else if (event.type === \"turn.cancelled\") {\n run.cancelled = true;\n } else if (event.type === \"session.failed\" || event.type === \"turn.failed\") {\n run.result.status = \"failed\";\n // Raw failure details can include private tool arguments or credentials.\n run.result.error = \"Eve agent execution failed\";\n } else if (event.type === \"session.completed\" || event.type === \"session.waiting\") {\n run.result.status = run.cancelled ? \"cancelled\"\n : event.type === \"session.waiting\" && (run.pending.size > 0 || (run.hostInputs.size > 0 || run.authorizations.size > 0) || (run.message === undefined && run.data === undefined && !run.dataOmitted)) ? \"waiting\" : \"completed\";\n if (run.result.status === \"completed\" && run.message !== undefined) run.result.text = run.message;\n if (run.result.status === \"completed\") {\n run.result.requests = [];\n delete run.result.requiresHostInput;\n if (run.data !== undefined) run.result.data = run.data;\n if (run.dataOmitted) run.result.dataOmitted = true;\n }\n if (run.result.status === \"waiting\") {\n run.result.requests = [...run.pending.values()];\n run.result.requiresHostInput = (run.hostInputs.size > 0 || run.authorizations.size > 0) || run.pending.size === 0;\n }\n }\n\n run.result.cursor++;\n }\n // Eve can swallow stream aborts. Never validate an answer against partial history.\n combined.throwIfAborted();\n return run;\n } finally {\n clearTimeout(timer);\n read.abort();\n }\n }\n\n const capabilities = {\n send: capability({\n id: `${options.name}.send`, effect: \"write\",\n description: \"Send a message, optionally continuing an Eve session and waiting for its answer.\",\n meta: { cli: { positional: [\"message\"] } },\n input: z.object({\n message: z.string().min(1).max(65_536).describe(\"Message to send, or a text answer to a pending question. With option-id, only the selected option is submitted.\"),\n runId: z.string().min(1).optional().describe(\"Continue this Eve session. Omit to begin a new conversation.\"),\n requestId: z.string().min(1).optional().describe(\"Pending question to answer. Required when several questions are waiting; use with run-id.\"),\n optionId: z.string().min(1).optional().describe(\"Answer option ID shown by result. Required for questions that do not accept freeform text; use with run-id.\"),\n wait: z.boolean().optional().describe(\"Wait for an answer, pending input, failure, or cancellation. Otherwise return the run ID immediately.\"),\n timeoutMs: z.number().int().min(1).max(300_000).optional().describe(\"Wait limit in milliseconds after acceptance (default: 30000; maximum: 300000). Only used with wait. Expiry leaves Eve running.\"),\n }),\n output: resultSchema.extend({ runId: z.string() }),\n toPresentation: presentAgentResult,\n handler: async ({ input, signal }) => {\n await authorize(\"send\", input.runId);\n if (!input.runId && (input.requestId || input.optionId)) throw new Error(\"Question answers require a runId\");\n const waiting = new AbortController();\n const requestSignal = AbortSignal.any([signalFor(signal), waiting.signal]);\n const sendOptions = { signal: requestSignal, streamReconnectPolicy: { reconnect: false as const } };\n let response;\n if (input.runId) {\n const run = await readRun(input.runId, signal);\n const session = options.client.sessions.attach(input.runId, { streamIndex: run.result.cursor });\n if (input.requestId || run.pending.size) {\n const pending = input.requestId ? run.pending.get(input.requestId)\n : run.pending.size === 1 ? [...run.pending.values()][0] : undefined;\n if (!pending || run.result.status !== \"waiting\") throw new Error(\"Specify requestId for a current pending question\");\n if (input.optionId) {\n if (!pending.options?.some(option => option.id === input.optionId)) throw new Error(\"Unknown answer option\");\n } else if (pending.allowFreeform === false || (pending.options?.length && pending.allowFreeform !== true)) {\n throw new Error(\"This question requires optionId\");\n }\n response = await session.respond([{\n requestId: pending.requestId,\n ...(input.optionId ? { optionId: input.optionId } : { text: input.message }),\n }], sendOptions);\n } else {\n if (input.optionId) throw new Error(\"No pending question for optionId\");\n if (run.hostInputs.size || run.authorizations.size) throw new Error(\"Pending approval or authorization requires host action\");\n response = await session.send(input.message, sendOptions);\n }\n if (response.sessionId !== input.runId) throw new Error(\"Eve resumed a different session\");\n } else {\n ({ response } = await options.client.sessions.create({ message: input.message, ...sendOptions }));\n }\n const runId = response.sessionId;\n const accepted = { runId, status: \"running\" as const, cursor: 0, eventCount: 0, requests: [] };\n if (!input.wait) return accepted;\n // Eve correlates this stream with the accepted delivery, skipping old turn boundaries.\n // The timer starts after acceptance; aborting this local stream never cancels Eve.\n const timer = setTimeout(() => waiting.abort(), input.timeoutMs ?? 30_000);\n try {\n let count = 0;\n let boundary = false;\n for await (const event of response) {\n requestSignal.throwIfAborted();\n if (++count > maxEvents) throw new Error(\"Eve response exceeds maxEventsPerRead\");\n if ([\"session.waiting\", \"session.completed\", \"session.failed\", \"turn.failed\"].includes(event.type)) {\n boundary = true;\n break;\n }\n }\n requestSignal.throwIfAborted();\n if (!boundary) return accepted;\n const run = await readRun(runId, requestSignal);\n return { runId, ...run.result, eventCount: run.result.cursor };\n } catch (error) {\n signalFor(signal).throwIfAborted();\n if (waiting.signal.aborted) return accepted;\n throw error;\n } finally {\n clearTimeout(timer);\n waiting.abort();\n }\n },\n }),\n result: capability({\n id: `${options.name}.result`, effect: \"read\",\n description: \"Read bounded progress, pending questions, or the final output. Pass the last returned cursor.\",\n input: runInput.extend({ cursor: z.number().int().nonnegative().default(0).describe(\"Cursor from the previous result, used to count new events. Defaults to 0; the full current result is still returned.\") }),\n output: resultSchema,\n toPresentation: presentAgentResult,\n handler: async ({ input, signal }) => {\n await authorize(\"result\", input.runId);\n const run = await readRun(input.runId, signal);\n if (input.cursor > run.result.cursor) throw new Error(\"Eve cursor is ahead of this run\");\n return { ...run.result, eventCount: run.result.cursor - input.cursor };\n },\n }),\n cancel: capability({\n id: `${options.name}.cancel`, effect: \"write\",\n description: \"Request cooperative cancellation of the active Eve turn. Acceptance is not completion.\",\n input: runInput.extend({ turnId: z.string().min(1).optional().describe(\"Specific Eve turn to cancel. Omit to cancel the session’s active turn.\") }),\n output: z.object({ status: z.enum([\"accepted\", \"no_active_turn\"]) }),\n toPresentation: ({ status }) => status === \"accepted\"\n ? \"Cancellation requested. Check the result to confirm execution has stopped.\"\n : \"No active turn to cancel.\",\n handler: async ({ input, signal }) => {\n await authorize(\"cancel\", input.runId);\n signalFor(signal).throwIfAborted();\n // Cancellation can run alongside a bounded result read.\n const result = await options.client.sessions.attach(input.runId).cancel({\n signal: signalFor(signal),\n ...(input.turnId ? { turnId: input.turnId } : {}),\n });\n return { status: result.status };\n },\n }),\n };\n // Widen the key during construction: TypeScript cannot reduce context inference\n // for a generic mapped namespace, although all three capabilities are context-free.\n const checked: AgentCapabilities = capabilities;\n const app = createApp(defineApp({ capabilities: { [options.name]: checked } })) as App<{ [K in TName]: AgentCapabilities }>;\n return {\n app,\n dispose() {\n lifetime.abort();\n },\n };\n}\n\nfunction positive(value: number, name: string) {\n if (!Number.isSafeInteger(value) || value < 1) throw new Error(`${name} must be a positive safe integer`);\n return value;\n}\n\nfunction remember(values: Set<string>, value: string) {\n if (value.length > 65_536 || (!values.has(value) && values.size >= 100)) {\n throw new Error(\"Eve pending input limit exceeded\");\n }\n values.add(value);\n}\n","import {\n getAppRuntime,\n type AnyApp,\n type ManifestNode,\n type ManifestCapability,\n} from \"@capable/app\";\nimport type { CapabilityMetaRegistry } from \"@capable/core\";\nimport {\n defineDynamic,\n defineTool,\n defineDurableCallback,\n type DynamicResolveContext,\n type DynamicSentinel,\n type ToolDefinition,\n type ToolContext,\n} from \"eve/tools\";\nimport type { Approval } from \"eve/tools/approval\";\n\nexport type EveCapabilityMeta =\n | false\n | {\n readonly name?: string;\n };\n\ndeclare module \"@capable/core\" {\n interface CapabilityMetaRegistry {\n readonly eve?: EveCapabilityMeta;\n }\n}\n\nexport type CreateEveToolsOptions = {\n readonly approval?: (\n capability: ManifestCapability,\n ) => Approval | undefined;\n};\n\nexport type EveAppProvider =\n | AnyApp\n | ((\n context: DynamicResolveContext,\n ) => AnyApp | Promise<AnyApp>);\n\nconst emptyInputSchema = Object.freeze({\n type: \"object\",\n properties: Object.freeze({}),\n additionalProperties: false,\n});\n\ntype EveTool = ToolDefinition<Record<string, unknown>, unknown>;\n\n/**\n * Projects an executable Capable App into native, in-process Eve tools.\n *\n * Eve owns the live executor bindings and checkpoints each call and result.\n * Session resolvers rebuild App bindings after a cold start. Define the App or\n * provider in deployed module code and keep persistent data outside the process.\n */\nexport function createEveTools(\n app: EveAppProvider,\n options: CreateEveToolsOptions = {},\n): DynamicSentinel<Record<string, EveTool>> {\n const capabilitiesByApp = new WeakMap<\n AnyApp,\n Promise<readonly ManifestCapability[]>\n >();\n const capabilities = (resolvedApp: AnyApp) => {\n const existing = capabilitiesByApp.get(resolvedApp);\n if (existing) return existing;\n const resolved = getAppRuntime(resolvedApp).manifest().then((manifest) =>\n flatten(manifest.capabilities)\n );\n capabilitiesByApp.set(resolvedApp, resolved);\n return resolved;\n };\n\n return defineDynamic({\n events: {\n \"session.started\": async (_event, resolveContext) => {\n const resolvedApp = typeof app === \"function\"\n ? await app(resolveContext)\n : app;\n const tools: Record<string, EveTool> = {};\n const names = new Set<string>();\n\n for (const capability of await capabilities(resolvedApp)) {\n const meta = capability.meta.eve as EveCapabilityMeta | undefined;\n if (meta === false) continue;\n\n const name = meta?.name ?? capability.path.join(\"__\");\n if (!/^[A-Za-z0-9_-]{1,64}$/.test(name)) {\n throw new Error(\n `Eve tool name \"${name}\" is invalid; set meta.eve.name to 1-64 letters, numbers, underscores, or hyphens`,\n );\n }\n if (names.has(name)) {\n throw new Error(`Duplicate Eve tool name \"${name}\"`);\n }\n names.add(name);\n\n const policy = options.approval?.(capability);\n const approval = policy && durableApproval(policy, capability.id);\n const definition: Omit<EveTool, \"execute\"> = {\n description:\n capability.description ??\n capability.title ??\n `Run the Capable Capability at ${capability.path.join(\".\")}.`,\n inputSchema: (capability.input ??\n emptyInputSchema) as EveTool[\"inputSchema\"],\n ...(capability.output\n ? {\n outputSchema:\n capability.output as NonNullable<EveTool[\"outputSchema\"]>,\n }\n : {}),\n ...(approval ? { approval } : {}),\n };\n const id = capability.id;\n tools[name] = defineTool({\n ...definition,\n execute: defineDurableCallback({\n closure: { id },\n callback: async ({ id }, input: Record<string, unknown>, context: ToolContext) => {\n // A rejected approval can change the latest resolver's caller.\n // Rebuild per-caller Apps from the actual execution identity.\n const executionApp = typeof app === \"function\"\n ? await app({ ...resolveContext, session: context.session })\n : app;\n const result = await getAppRuntime(executionApp).call({\n id, input, signal: context.abortSignal,\n });\n return result.output;\n },\n }),\n });\n }\n\n return tools;\n },\n },\n });\n}\n\n/** The resolver reconstructs policies; persist identity and reject rebinding to a different capability. */\nfunction durablePolicy<T extends (...args: never[]) => unknown>(policy: T, id: string): T {\n return defineDurableCallback({\n closure: { id },\n callback: (snapshot, ...args: Parameters<T>) => {\n if (snapshot.id !== id) throw new Error(\"Eve capability identity changed during recovery\");\n return policy(...args);\n },\n }) as T;\n}\n\nfunction durableApproval(policy: Approval, id: string): Approval {\n if (typeof policy === \"function\") return durablePolicy(policy, id);\n return {\n request: durablePolicy(policy.request, id),\n ...(policy.response ? { response: durablePolicy(policy.response, id) } : {}),\n };\n}\n\nfunction flatten(\n nodes: readonly ManifestNode[],\n): readonly ManifestCapability[] {\n return nodes.flatMap((node) =>\n node.type === \"capability\" ? [node] : flatten(node.children)\n );\n}\n\nexport {\n createEveAgentAdapter,\n type EveAgentAdapter,\n type EveAgentAdapterOptions,\n type EveAgentOperation,\n type EveAgentData,\n type EveAgentQuestion,\n type EveAgentResult,\n} from \"./agent.ts\";\n"],"mappings":";;;;;;AAGA,SAAgB,mBAAmB,QAAqD;CAQtF,MAAM,QAAQ,CAPC;EACb,SAAS;EACT,SAAS;EACT,WAAW;EACX,QAAQ;EACR,WAAW;CACb,EAAE,OAAO,OACY;CACrB,IAAI,OAAO,MAAM,MAAM,KAAK,OAAO,IAAI;CACvC,IAAI,OAAO,SAAS,KAAA,GAAW,MAAM,KAAK,KAAK,UAAU,OAAO,MAAM,MAAM,CAAC,CAAC;CAC9E,IAAI,OAAO,eAAe,MAAM,KAAK,2BAA2B;CAChE,IAAI,OAAO,aAAa,MAAM,KAAK,6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pGroupMeta, c as FetchHandler, d as createProtocolHandler, f as JsonValue, i as HttpCapabilityMeta, l as TransportHeaders, m as defineProtocolCodec, n as CompiledHttpRoute, o as HttpMethod, p as ProtocolCodec, r as ContextProvider, s as createHttpHandler, t as CapabilitySelection, u as createHttpTransport } from "./index-CHuCLJIs.mjs";
1
+ import { a as HttpGroupMeta, c as FetchHandler, d as createProtocolHandler, f as JsonValue, i as HttpCapabilityMeta, l as TransportHeaders, m as defineProtocolCodec, n as CompiledHttpRoute, o as HttpMethod, p as ProtocolCodec, r as ContextProvider, s as createHttpHandler, t as CapabilitySelection, u as createHttpTransport } from "./index-D8DWjQ9f.mjs";
2
2
  export { type CapabilitySelection, type CompiledHttpRoute, type ContextProvider, type FetchHandler, type HttpCapabilityMeta, type HttpGroupMeta, type HttpMethod, type JsonValue, type ProtocolCodec, type TransportHeaders, createHttpHandler, createHttpTransport, createProtocolHandler, defineProtocolCodec };
package/dist/http.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as defineProtocolCodec, n as createHttpTransport, r as createProtocolHandler, t as createHttpHandler } from "./src-_6OmFRYa.mjs";
1
+ import { i as defineProtocolCodec, n as createHttpTransport, r as createProtocolHandler, t as createHttpHandler } from "./src-Hw9WBgEW.mjs";
2
2
  export { createHttpHandler, createHttpTransport, createProtocolHandler, defineProtocolCodec };