capable-kit 0.0.1-alpha.7 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +214 -0
- package/README.md +6 -0
- package/dist/ai-sdk.d.mts +3 -3
- package/dist/ai-sdk.mjs +9 -7
- package/dist/ai-sdk.mjs.map +1 -1
- package/dist/app.d.mts +2 -2
- package/dist/app.mjs +2 -2
- package/dist/bin.mjs +12 -9
- package/dist/bin.mjs.map +1 -1
- package/dist/cli.d.mts +9 -1
- package/dist/cli.mjs +1 -1
- package/dist/core.d.mts +3 -3
- package/dist/core.mjs +1 -1
- package/dist/eve.d.mts +82 -5
- package/dist/eve.mjs +364 -23
- package/dist/eve.mjs.map +1 -1
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-Dbc4g9WM.d.mts → index-1A44jLuE.d.mts} +54 -16
- package/dist/{index-DwXlaTXI.d.mts → index-CHuCLJIs.d.mts} +20 -4
- package/dist/{index-D2CRRUzH.d.mts → index-D-NV4PiU.d.mts} +6 -5
- package/dist/{index-Be8-UVBC.d.mts → index-WiBWfyTn.d.mts} +66 -27
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/mcp.d.mts +40 -5
- package/dist/mcp.mjs +1 -1
- package/dist/mount-BmLHp349.mjs +235 -0
- package/dist/mount-BmLHp349.mjs.map +1 -0
- package/dist/react-query.d.mts +2 -2
- package/dist/react-query.mjs +1 -1
- package/dist/react-query.mjs.map +1 -1
- package/dist/runtime-support.d.mts +1 -1
- package/dist/runtime-support.mjs +8 -8
- package/dist/runtime-support.mjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{src-Db6-XSnU.mjs → src-3LE9S4QE.mjs} +67 -38
- package/dist/src-3LE9S4QE.mjs.map +1 -0
- package/dist/{src-DdV82An-.mjs → src-B2WeUwUT.mjs} +69 -34
- package/dist/src-B2WeUwUT.mjs.map +1 -0
- package/dist/{src-CDxL6w3d.mjs → src-C5jGDnuu.mjs} +9 -6
- package/dist/src-C5jGDnuu.mjs.map +1 -0
- package/dist/src-DePlcG_t.mjs +787 -0
- package/dist/src-DePlcG_t.mjs.map +1 -0
- package/dist/{src-BF70JLxI.mjs → src-_6OmFRYa.mjs} +185 -38
- package/dist/src-_6OmFRYa.mjs.map +1 -0
- package/dist/{subscription-Bq792Ad2.d.mts → subscription-DPdwovhw.d.mts} +2 -2
- package/dist/swr.d.mts +2 -2
- package/dist/swr.mjs +1 -1
- package/dist/swr.mjs.map +1 -1
- package/docs/CONTEXT.md +42 -21
- package/docs/README.md +3 -0
- package/docs/internal/README.md +3 -0
- package/docs/internal/adr/0001-capability-is-the-semantic-boundary.md +1 -1
- package/docs/internal/adr/0002-version-the-capable-value-codec.md +24 -0
- package/docs/internal/adr/0003-capability-reference-customization.md +68 -0
- package/docs/internal/architecture.md +64 -19
- package/docs/internal/capability-first-model.md +127 -18
- package/docs/internal/eve-recovery-validation.md +86 -0
- package/docs/internal/feedback/v-ray/README.md +258 -0
- package/docs/internal/feedback/v-ray/inference.mjs +43 -0
- package/docs/internal/feedback/v-ray/reproduce.mjs +36 -0
- package/docs/internal/implementation-friction.md +481 -1
- package/docs/internal/releases.md +79 -0
- package/docs/site/capable-orpc-and-trpc.mdx +5 -5
- package/docs/site/concepts/apps.mdx +17 -8
- package/docs/site/concepts/architecture.mdx +10 -2
- package/docs/site/concepts/capabilities.mdx +41 -4
- package/docs/site/concepts/errors.mdx +11 -1
- package/docs/site/concepts/presentations.mdx +20 -0
- package/docs/site/hosting/any-fetch-host.mdx +2 -2
- package/docs/site/hosting/next-js.mdx +38 -4
- package/docs/site/hosting/standalone-server.mdx +2 -2
- package/docs/site/introduction.mdx +9 -6
- package/docs/site/patterns/composition.mdx +159 -11
- package/docs/site/patterns/remote-apps.mdx +68 -10
- package/docs/site/patterns/subscriptions.mdx +79 -32
- package/docs/site/quickstart.mdx +19 -14
- package/docs/site/reference/packages-and-entry-points.mdx +52 -5
- package/docs/site/reference/surface-metadata.mdx +7 -2
- package/docs/site/reference/the-cap-cli.mdx +2 -2
- package/docs/site/surfaces/ai-sdk.mdx +3 -3
- package/docs/site/surfaces/cli.mdx +47 -3
- package/docs/site/surfaces/eve.mdx +67 -20
- package/docs/site/surfaces/mcp.mdx +73 -5
- package/docs/site/surfaces/react-query.mdx +3 -3
- package/docs/site/surfaces/swr.mdx +3 -3
- package/docs/site/surfaces/typescript.mdx +8 -8
- package/docs/site/surfaces.mdx +1 -1
- package/package-docs.mjs +3 -0
- package/package.json +11 -11
- package/src/bin.ts +0 -0
- package/src/index.test.ts +2 -1
- package/src/index.ts +6 -1
- package/src/mcp.ts +4 -0
- package/src/package.test.ts +9 -0
- package/dist/mount-xvMsjz1B.mjs +0 -178
- package/dist/mount-xvMsjz1B.mjs.map +0 -1
- package/dist/src-BF70JLxI.mjs.map +0 -1
- package/dist/src-C2MGIlT0.mjs +0 -464
- package/dist/src-C2MGIlT0.mjs.map +0 -1
- package/dist/src-CDxL6w3d.mjs.map +0 -1
- package/dist/src-Db6-XSnU.mjs.map +0 -1
- package/dist/src-DdV82An-.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as CapabilityTree, O as AppContext, V as PresentationPart, Y as MaybePromise, a as CapabilityDefinition, ct as InferSchemaInput, j as CapabilityGroupDefinition, k as AppDefinition, m as CapabilityOutput, ot as AnyObjectSchema, s as CapabilityExecution, t as AnyCapability, v as SubscribableCapability } from "./index-WiBWfyTn.mjs";
|
|
2
2
|
//#region packages/app/src/manifest.d.ts
|
|
3
3
|
type JsonSchema = Readonly<Record<string, unknown>>;
|
|
4
4
|
type ManifestError = {
|
|
@@ -9,15 +9,20 @@ type ManifestError = {
|
|
|
9
9
|
};
|
|
10
10
|
type ManifestCapability = {
|
|
11
11
|
readonly type: "capability";
|
|
12
|
+
readonly customization?: {
|
|
13
|
+
/** Use the Capability's placed path for surface navigation. */
|
|
14
|
+
readonly navigation?: "destination";
|
|
15
|
+
readonly title?: string;
|
|
16
|
+
readonly description?: string;
|
|
17
|
+
readonly meta?: Readonly<Record<string, unknown>>;
|
|
18
|
+
};
|
|
12
19
|
readonly id: string;
|
|
13
20
|
readonly path: readonly string[];
|
|
14
21
|
readonly title?: string;
|
|
15
22
|
readonly description?: string;
|
|
16
23
|
readonly deprecated: boolean;
|
|
17
24
|
readonly effect?: "read" | "write" | "destructive";
|
|
18
|
-
readonly
|
|
19
|
-
readonly mode: "replace";
|
|
20
|
-
};
|
|
25
|
+
readonly execution: CapabilityExecution;
|
|
21
26
|
readonly input?: JsonSchema;
|
|
22
27
|
readonly output?: JsonSchema;
|
|
23
28
|
readonly errors: Readonly<Record<string, ManifestError>>;
|
|
@@ -33,13 +38,14 @@ type ManifestGroup = {
|
|
|
33
38
|
};
|
|
34
39
|
type ManifestNode = ManifestGroup | ManifestCapability;
|
|
35
40
|
type ApplicationManifest = {
|
|
36
|
-
readonly protocol: "capable.capabilities.
|
|
41
|
+
readonly protocol: "capable.capabilities.v4";
|
|
37
42
|
readonly name: string;
|
|
38
43
|
readonly version: string;
|
|
39
44
|
readonly description?: string;
|
|
40
45
|
readonly capabilities: readonly ManifestNode[];
|
|
41
46
|
};
|
|
42
47
|
declare function createAppManifest(definition: AppDefinition<any>): ApplicationManifest;
|
|
48
|
+
declare function flattenManifestCapabilities(nodes: readonly ManifestNode[]): readonly ManifestCapability[];
|
|
43
49
|
//#endregion
|
|
44
50
|
//#region packages/app/src/runtime.d.ts
|
|
45
51
|
type CapabilityCall = {
|
|
@@ -57,12 +63,12 @@ interface ApplicationTransport {
|
|
|
57
63
|
readonly signal?: AbortSignal;
|
|
58
64
|
}): Promise<ApplicationManifest>;
|
|
59
65
|
call(call: CapabilityCall): Promise<CapabilityResult>;
|
|
60
|
-
subscribe(call: CapabilityCall): AsyncIterableIterator<CapabilityResult
|
|
66
|
+
subscribe(call: CapabilityCall): Promise<AsyncIterableIterator<CapabilityResult>>;
|
|
61
67
|
}
|
|
62
68
|
declare const APP_RUNTIME_SYMBOL: unique symbol;
|
|
63
69
|
declare const APP_CAPABILITIES_SYMBOL: unique symbol;
|
|
64
|
-
type
|
|
65
|
-
readonly "~capable/capability"
|
|
70
|
+
type AppCapabilityReference<TCapability extends AnyCapability = AnyCapability> = {
|
|
71
|
+
readonly "~capable/capability": TCapability;
|
|
66
72
|
};
|
|
67
73
|
type AppCapabilityInput<TCapability extends AnyCapability> = TCapability extends CapabilityDefinition<any, infer TInput, any, any, any> ? TInput extends AnyObjectSchema ? InferSchemaInput<TInput> : Record<never, never> : never;
|
|
68
74
|
type AppCapabilityOutput<TCapability extends AnyCapability> = TCapability extends CapabilityDefinition<any, any, infer TOutput, any, any> ? TOutput : never;
|
|
@@ -70,9 +76,10 @@ type AppCapabilityOptions = {
|
|
|
70
76
|
readonly signal?: AbortSignal;
|
|
71
77
|
};
|
|
72
78
|
type AppCapabilityArgs<TCapability extends AnyCapability> = TCapability extends CapabilityDefinition<any, infer TInput, any, any, any> ? TInput extends undefined ? [input?: Record<never, never>, options?: AppCapabilityOptions] : Record<never, never> extends AppCapabilityInput<TCapability> ? [input?: AppCapabilityInput<TCapability>, options?: AppCapabilityOptions] : [input: AppCapabilityInput<TCapability>, options?: AppCapabilityOptions] : never;
|
|
73
|
-
type AppCapabilityCall<TCapability extends AnyCapability> = ((...args: AppCapabilityArgs<TCapability>) => Promise<AppCapabilityOutput<TCapability>>) &
|
|
74
|
-
type AppCapabilityIsSubscribable<TCall> = TCall extends
|
|
75
|
-
type
|
|
79
|
+
type AppCapabilityCall<TCapability extends AnyCapability> = ((...args: AppCapabilityArgs<TCapability>) => Promise<AppCapabilityOutput<TCapability>>) & AppCapabilityReference<TCapability>;
|
|
80
|
+
type AppCapabilityIsSubscribable<TCall> = TCall extends AppCapabilityReference<infer TCapability> ? TCapability["execution"] extends "live" | "events" ? true : false : false;
|
|
81
|
+
type AppCapabilityIsLive<TCall> = TCall extends AppCapabilityReference<infer TCapability> ? TCapability["execution"] extends "live" ? true : false : false;
|
|
82
|
+
type CallableTree<TTree> = TTree extends AnyCapability ? TTree["execution"] extends "events" ? AppCapabilityReference<TTree> : AppCapabilityCall<TTree> : TTree extends CapabilityGroupDefinition<infer TCapabilities, any, any> ? CallableTree<TCapabilities> : TTree extends CapabilityTree ? { readonly [TKey in keyof TTree]: CallableTree<TTree[TKey]>; } : never;
|
|
76
83
|
type App<TCapabilities extends CapabilityTree = CapabilityTree> = CallableTree<TCapabilities> & {
|
|
77
84
|
readonly [APP_RUNTIME_SYMBOL]: ApplicationTransport;
|
|
78
85
|
readonly [APP_CAPABILITIES_SYMBOL]?: TCapabilities;
|
|
@@ -87,7 +94,7 @@ type AppCapabilities<TApplication extends AnyApp> = TApplication extends {
|
|
|
87
94
|
} ? TCapabilities : never;
|
|
88
95
|
declare function getAppRuntime(app: AnyApp): ApplicationTransport;
|
|
89
96
|
declare function isApp(value: unknown): value is AnyApp;
|
|
90
|
-
declare function subscribe<const TCapability extends SubscribableCapability>(capabilityCall:
|
|
97
|
+
declare function subscribe<const TCapability extends SubscribableCapability>(capabilityCall: AppCapabilityReference<TCapability>, ...args: AppCapabilityArgs<TCapability>): AsyncIterableIterator<CapabilityOutput<TCapability>>;
|
|
91
98
|
type AppContextProvider<TContext> = (call: {
|
|
92
99
|
readonly id: string;
|
|
93
100
|
readonly signal?: AbortSignal;
|
|
@@ -110,10 +117,41 @@ declare class TransportError extends Error {
|
|
|
110
117
|
});
|
|
111
118
|
}
|
|
112
119
|
//#endregion
|
|
120
|
+
//#region packages/app/src/customization.d.ts
|
|
121
|
+
declare global {
|
|
122
|
+
interface CapableCustomizationMeta {}
|
|
123
|
+
}
|
|
124
|
+
type CapabilityCustomization = {
|
|
125
|
+
readonly title?: string;
|
|
126
|
+
readonly description?: string;
|
|
127
|
+
readonly meta?: keyof CapableCustomizationMeta extends never ? never : Partial<CapableCustomizationMeta>;
|
|
128
|
+
};
|
|
129
|
+
declare const CUSTOMIZED_SYMBOL: unique symbol;
|
|
130
|
+
type CustomizedCapability<TCapability extends AnyCapability = any> = {
|
|
131
|
+
readonly [CUSTOMIZED_SYMBOL]: true;
|
|
132
|
+
readonly reference: AppCapabilityReference<TCapability>;
|
|
133
|
+
readonly customization: CapabilityCustomization;
|
|
134
|
+
};
|
|
135
|
+
/** Customize a bound local or remote reference without changing its execution. */
|
|
136
|
+
declare function customize<TCapability extends AnyCapability>(reference: AppCapabilityReference<TCapability> | CustomizedCapability<TCapability>, options: CapabilityCustomization): CustomizedCapability<TCapability>;
|
|
137
|
+
/** Surface-facing fields only. Policies and executors retain the source contract. */
|
|
138
|
+
declare function getCapabilityDisplay(capability: ManifestCapability): {
|
|
139
|
+
readonly title?: string;
|
|
140
|
+
readonly description?: string;
|
|
141
|
+
readonly meta: Readonly<Record<string, unknown>>;
|
|
142
|
+
};
|
|
143
|
+
/** Navigation overrides come from the destination only for relocated leaves. */
|
|
144
|
+
declare function getCapabilityNavigationMeta<TSurface extends keyof CapableCustomizationMeta>(capability: ManifestCapability, surface: TSurface): CapableCustomizationMeta[TSurface] | undefined;
|
|
145
|
+
//#endregion
|
|
113
146
|
//#region packages/app/src/composition.d.ts
|
|
114
147
|
type UnionToIntersection<TValue> = (TValue extends unknown ? (value: TValue) => void : never) extends ((value: infer TIntersection) => void) ? TIntersection : never;
|
|
115
|
-
type
|
|
116
|
-
|
|
148
|
+
type AppComposition = AnyApp | {
|
|
149
|
+
readonly [key: string]: AppComposition | AppCapabilityReference | CustomizedCapability;
|
|
150
|
+
};
|
|
151
|
+
type ComposedNode<TNode> = TNode extends AnyApp ? AppCapabilities<TNode> : TNode extends CustomizedCapability<infer TCapability> ? TCapability : TNode extends AppCapabilityReference<infer TCapability> ? TCapability : TNode extends Readonly<Record<string, unknown>> ? { readonly [TKey in keyof TNode]: ComposedNode<TNode[TKey]>; } : never;
|
|
152
|
+
type ComposedCapabilities<TNodes extends readonly AppComposition[]> = UnionToIntersection<ComposedNode<TNodes[number]>> extends (infer TCapabilities extends CapabilityTree) ? TCapabilities : never;
|
|
153
|
+
/** Compose executable Apps, subtrees, and Capability references into one tree. */
|
|
154
|
+
declare function composeApps<const TNodes extends readonly [AppComposition, ...AppComposition[]]>(...nodes: TNodes): App<ComposedCapabilities<TNodes>>;
|
|
117
155
|
type SelectionNode<TTree> = TTree extends AnyCapability ? true : TTree extends CapabilityGroupDefinition<infer TCapabilities, any, any> ? true | SelectionNode<TCapabilities> : TTree extends CapabilityTree ? true | { readonly [TKey in keyof TTree]?: SelectionNode<TTree[TKey]>; } : never;
|
|
118
156
|
type ApplicationSelection<TCapabilities extends CapabilityTree = CapabilityTree> = {
|
|
119
157
|
readonly include?: Exclude<SelectionNode<TCapabilities>, true>;
|
|
@@ -121,5 +159,5 @@ type ApplicationSelection<TCapabilities extends CapabilityTree = CapabilityTree>
|
|
|
121
159
|
};
|
|
122
160
|
declare function selectApp<const TCapabilities extends CapabilityTree>(application: App<TCapabilities>, selection: ApplicationSelection<TCapabilities>): App<TCapabilities>;
|
|
123
161
|
//#endregion
|
|
124
|
-
export { JsonSchema as C,
|
|
125
|
-
//# sourceMappingURL=index-
|
|
162
|
+
export { JsonSchema as A, TransportError as C, isApp as D, getAppRuntime as E, createAppManifest as F, flattenManifestCapabilities as I, ManifestError as M, ManifestGroup as N, subscribe as O, ManifestNode as P, CapabilityResult as S, createRemoteApp as T, AppCapabilityReference as _, CustomizedCapability as a, CallableTree as b, getCapabilityNavigationMeta as c, AnyApp as d, App as f, AppCapabilityIsSubscribable as g, AppCapabilityIsLive as h, CapabilityCustomization as i, ManifestCapability as j, ApplicationManifest as k, APP_CAPABILITIES_SYMBOL as l, AppCapabilityCall as m, composeApps as n, customize as o, AppCapabilities as p, selectApp as r, getCapabilityDisplay as s, ApplicationSelection as t, APP_RUNTIME_SYMBOL as u, AppContextProvider as v, createApp as w, CapabilityCall as x, ApplicationTransport as y };
|
|
163
|
+
//# sourceMappingURL=index-1A44jLuE.d.mts.map
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { M as CapabilityTree, P as LocatedCapability, k as AppDefinition } from "./index-WiBWfyTn.mjs";
|
|
2
|
+
import { d as AnyApp, t as ApplicationSelection, y as ApplicationTransport } from "./index-1A44jLuE.mjs";
|
|
3
|
+
//#region packages/fetch/src/codec.d.ts
|
|
4
|
+
type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
5
|
+
readonly [key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
type ProtocolCodec = {
|
|
8
|
+
/** Stable identity used to reject mismatched protocol peers. */
|
|
9
|
+
readonly id: string;
|
|
10
|
+
/** Converts a runtime value into JSON-compatible protocol data. */
|
|
11
|
+
encode(value: unknown): JsonValue;
|
|
12
|
+
/** Restores a runtime value from JSON-compatible protocol data. */
|
|
13
|
+
decode(value: JsonValue): unknown;
|
|
14
|
+
};
|
|
15
|
+
declare function defineProtocolCodec(codec: ProtocolCodec): ProtocolCodec;
|
|
16
|
+
//#endregion
|
|
3
17
|
//#region packages/fetch/src/capable.d.ts
|
|
4
18
|
type FetchHandler = (request: Request) => Response | Promise<Response>;
|
|
5
19
|
declare function createProtocolHandler(application: AnyApp | ((request: Request) => AnyApp | Promise<AnyApp>), options?: {
|
|
6
20
|
readonly basePath?: string;
|
|
21
|
+
readonly codec?: ProtocolCodec;
|
|
7
22
|
}): {
|
|
8
23
|
readonly fetch: FetchHandler;
|
|
9
24
|
};
|
|
@@ -12,6 +27,7 @@ declare function createHttpTransport(options: {
|
|
|
12
27
|
readonly url: string | URL | (() => string | URL);
|
|
13
28
|
readonly fetch?: (request: Request) => Response | Promise<Response>;
|
|
14
29
|
readonly headers?: TransportHeaders;
|
|
30
|
+
readonly codec?: ProtocolCodec;
|
|
15
31
|
}): ApplicationTransport;
|
|
16
32
|
//#endregion
|
|
17
33
|
//#region packages/fetch/src/http.d.ts
|
|
@@ -53,5 +69,5 @@ declare function createHttpHandler<const TCapabilities extends CapabilityTree, T
|
|
|
53
69
|
readonly openapi: Readonly<Record<string, unknown>>;
|
|
54
70
|
};
|
|
55
71
|
//#endregion
|
|
56
|
-
export { HttpGroupMeta as a, FetchHandler as c, createProtocolHandler as d, HttpCapabilityMeta as i, TransportHeaders as l, CompiledHttpRoute as n, HttpMethod as o, ContextProvider as r, createHttpHandler as s, CapabilitySelection as t, createHttpTransport as u };
|
|
57
|
-
//# sourceMappingURL=index-
|
|
72
|
+
export { HttpGroupMeta as a, FetchHandler as c, createProtocolHandler as d, JsonValue as f, HttpCapabilityMeta as i, TransportHeaders as l, defineProtocolCodec as m, CompiledHttpRoute as n, HttpMethod as o, ProtocolCodec as p, ContextProvider as r, createHttpHandler as s, CapabilitySelection as t, createHttpTransport as u };
|
|
73
|
+
//# sourceMappingURL=index-CHuCLJIs.d.mts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ApplicationSelection } from "./index-
|
|
3
|
-
import { r as ContextProvider, t as CapabilitySelection } from "./index-
|
|
1
|
+
import { Y as MaybePromise, k as AppDefinition } from "./index-WiBWfyTn.mjs";
|
|
2
|
+
import { t as ApplicationSelection } from "./index-1A44jLuE.mjs";
|
|
3
|
+
import { p as ProtocolCodec, r as ContextProvider, t as CapabilitySelection } from "./index-CHuCLJIs.mjs";
|
|
4
4
|
//#region packages/server/src/index.d.ts
|
|
5
5
|
type ServerMount<TContext> = {
|
|
6
6
|
readonly kind: "capable.server.mount";
|
|
7
|
-
compile(app: AppDefinition<any, TContext>, context: ContextProvider<TContext> | undefined): CompiledServerMount;
|
|
7
|
+
compile(app: AppDefinition<any, TContext>, context: ContextProvider<TContext> | undefined, onError?: (error: unknown) => void): CompiledServerMount;
|
|
8
8
|
};
|
|
9
9
|
type CompiledServerMount = {
|
|
10
10
|
readonly name: string;
|
|
@@ -13,6 +13,7 @@ type CompiledServerMount = {
|
|
|
13
13
|
declare function protocol<TContext = any>(options?: {
|
|
14
14
|
readonly path?: string;
|
|
15
15
|
readonly selection?: ApplicationSelection;
|
|
16
|
+
readonly codec?: ProtocolCodec;
|
|
16
17
|
}): ServerMount<TContext>;
|
|
17
18
|
declare function http<TContext = any>(options?: {
|
|
18
19
|
readonly path?: string;
|
|
@@ -39,4 +40,4 @@ type CreateServerArgs<TContext> = [TContext] extends [undefined] ? [options?: Cr
|
|
|
39
40
|
declare function createServer<TContext>(app: AppDefinition<any, TContext>, ...[providedOptions]: CreateServerArgs<TContext>): CapableServer;
|
|
40
41
|
//#endregion
|
|
41
42
|
export { createServer as a, ServerMount as i, CompiledServerMount as n, http as o, ServerMiddleware as r, protocol as s, CapableServer as t };
|
|
42
|
-
//# sourceMappingURL=index-
|
|
43
|
+
//# sourceMappingURL=index-D-NV4PiU.d.mts.map
|
|
@@ -8,7 +8,9 @@ type AnyObjectSchema = Schema<any, Record<string, unknown>>;
|
|
|
8
8
|
type InferSchemaInput<TSchema extends AnySchema> = StandardSchemaV1.InferInput<TSchema>;
|
|
9
9
|
type InferSchemaOutput<TSchema extends AnySchema> = StandardSchemaV1.InferOutput<TSchema>;
|
|
10
10
|
declare function parseSchema<TSchema extends AnySchema>(schema: TSchema, value: unknown): Promise<InferSchemaOutput<TSchema>>;
|
|
11
|
-
declare function schemaToJsonSchema(schema: AnySchema, direction: "input" | "output"
|
|
11
|
+
declare function schemaToJsonSchema(schema: AnySchema, direction: "input" | "output", options?: {
|
|
12
|
+
readonly allowUnrepresentable?: boolean;
|
|
13
|
+
}): Readonly<Record<string, unknown>>;
|
|
12
14
|
declare class SchemaValidationError extends Error {
|
|
13
15
|
readonly issues: readonly StandardSchemaV1.Issue[];
|
|
14
16
|
constructor(issues: readonly StandardSchemaV1.Issue[]);
|
|
@@ -143,7 +145,7 @@ declare function group<const TCapabilities extends CapabilityTree, const TErrors
|
|
|
143
145
|
readonly title?: string;
|
|
144
146
|
readonly description?: string;
|
|
145
147
|
readonly errors?: TErrors;
|
|
146
|
-
readonly middleware?: readonly CapabilityMiddleware<
|
|
148
|
+
readonly middleware?: readonly CapabilityMiddleware<NoInfer<SharedContext<TCapabilities>>>[];
|
|
147
149
|
readonly meta?: TMeta;
|
|
148
150
|
readonly capabilities: TCapabilities;
|
|
149
151
|
}): CapabilityGroupDefinition<TCapabilities, TErrors, TMeta>;
|
|
@@ -160,19 +162,24 @@ type AppDefinition<TCapabilities extends CapabilityTree = CapabilityTree, TConte
|
|
|
160
162
|
readonly name: string;
|
|
161
163
|
readonly version: string;
|
|
162
164
|
readonly description?: string;
|
|
165
|
+
readonly errors: AnyDefinedErrors;
|
|
166
|
+
readonly middleware: readonly CapabilityMiddleware<any>[];
|
|
163
167
|
readonly capabilities: TCapabilities;
|
|
164
168
|
readonly locatedCapabilities: readonly LocatedCapability[];
|
|
165
169
|
readonly "~capable/context"?: TContext;
|
|
166
170
|
};
|
|
167
|
-
type CapabilityTreeContext<TTree> = TTree extends CapabilityDefinition<infer TContext, any, any, any, any> ? TContext : TTree extends CapabilityGroupDefinition<infer TCapabilities, any, any> ? CapabilityTreeContext<TCapabilities> : TTree extends Readonly<Record<string, unknown>> ? CapabilityTreeContext<TTree[keyof TTree]> : never;
|
|
171
|
+
type CapabilityTreeContext<TTree> = TTree extends CapabilityDefinition<infer TContext, any, any, any, any> ? TContext : TTree extends CapabilityGroupDefinition<infer TCapabilities, any, any> ? CapabilityTreeContext<TCapabilities> : TTree extends Readonly<Record<string, unknown>> ? CapabilityTree extends TTree ? unknown : CapabilityTreeContext<TTree[keyof TTree]> : never;
|
|
168
172
|
type UnionToIntersection<TValue> = (TValue extends unknown ? (value: TValue) => void : never) extends ((value: infer TIntersection) => void) ? TIntersection : never;
|
|
173
|
+
type SharedContext<TCapabilities> = [Exclude<CapabilityTreeContext<TCapabilities>, undefined>] extends [never] ? undefined : UnionToIntersection<Exclude<CapabilityTreeContext<TCapabilities>, undefined>>;
|
|
169
174
|
type AppContext<TDefinition extends AppDefinition<any, any>> = TDefinition extends AppDefinition<any, infer TContext> ? TContext : never;
|
|
170
175
|
declare function defineApp<const TCapabilities extends CapabilityTree>(config: {
|
|
171
176
|
readonly name?: string;
|
|
172
177
|
readonly version?: string;
|
|
173
178
|
readonly description?: string;
|
|
179
|
+
readonly errors?: AnyDefinedErrors;
|
|
180
|
+
readonly middleware?: readonly CapabilityMiddleware<NoInfer<SharedContext<TCapabilities>>>[];
|
|
174
181
|
readonly capabilities: TCapabilities;
|
|
175
|
-
}): AppDefinition<TCapabilities,
|
|
182
|
+
}): AppDefinition<TCapabilities, SharedContext<TCapabilities>>;
|
|
176
183
|
declare function isCapabilityGroup(value: unknown): value is AnyCapabilityGroup;
|
|
177
184
|
//#endregion
|
|
178
185
|
//#region packages/core/src/capability.d.ts
|
|
@@ -195,13 +202,19 @@ type CapabilitySubscriberArgs<TContext, TInput> = {
|
|
|
195
202
|
};
|
|
196
203
|
type CapabilitySubscriber<TContext, TInput, TOutput> = (args: CapabilitySubscriberArgs<TContext, TInput>) => AsyncIterable<TOutput>;
|
|
197
204
|
type CapabilityMiddlewareArgs<TContext, TInput = unknown> = {
|
|
205
|
+
readonly capability: {
|
|
206
|
+
readonly id: string;
|
|
207
|
+
readonly effect: CapabilityEffect | undefined;
|
|
208
|
+
};
|
|
209
|
+
readonly mode: "call" | "subscribe";
|
|
198
210
|
readonly input: TInput;
|
|
199
211
|
readonly context: TContext;
|
|
200
212
|
readonly signal?: AbortSignal;
|
|
201
213
|
next(): Promise<unknown>;
|
|
202
214
|
};
|
|
203
215
|
type CapabilityMiddleware<TContext, TInput = unknown> = (args: CapabilityMiddlewareArgs<TContext, TInput>) => MaybePromise<unknown>;
|
|
204
|
-
type
|
|
216
|
+
type CapabilityExecution = "unary" | "live" | "events";
|
|
217
|
+
type CapabilityDefinition<TContext = unknown, TInput extends AnyObjectSchema | undefined = AnyObjectSchema | undefined, TOutput = unknown, TErrors extends AnyDefinedErrors = AnyDefinedErrors, TMeta extends OpenMeta<CapabilityMetaRegistry> = OpenMeta<CapabilityMetaRegistry>, TExecution extends CapabilityExecution = CapabilityExecution> = {
|
|
205
218
|
readonly [CAPABILITY_SYMBOL]: true;
|
|
206
219
|
readonly id: string;
|
|
207
220
|
readonly title?: string;
|
|
@@ -213,19 +226,31 @@ type CapabilityDefinition<TContext = unknown, TInput extends AnyObjectSchema | u
|
|
|
213
226
|
readonly errors: TErrors;
|
|
214
227
|
readonly middleware: readonly CapabilityMiddleware<TContext, ParsedInput<TInput>>[];
|
|
215
228
|
readonly meta: TMeta;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
229
|
+
toPresentation?(output: TOutput, options: {
|
|
230
|
+
readonly context: TContext;
|
|
231
|
+
}): MaybePromise<PresentationValue>;
|
|
219
232
|
readonly "~capable/context"?: (context: TContext) => TContext;
|
|
220
233
|
readonly "~capable/input"?: TInput;
|
|
221
234
|
readonly "~capable/output"?: TOutput;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
235
|
+
} & (TExecution extends "events" ? {
|
|
236
|
+
readonly execution: "events";
|
|
237
|
+
readonly handler?: never;
|
|
238
|
+
readonly subscribe: CapabilitySubscriber<TContext, ParsedInput<TInput>, any>;
|
|
239
|
+
} : TExecution extends "live" ? {
|
|
240
|
+
readonly execution: "live";
|
|
241
|
+
readonly handler: (args: CapabilityHandlerArgs<TContext, ParsedInput<TInput>>) => MaybePromise<TOutput>;
|
|
242
|
+
readonly subscribe: CapabilitySubscriber<TContext, ParsedInput<TInput>, any>;
|
|
243
|
+
} : {
|
|
244
|
+
readonly execution: "unary";
|
|
245
|
+
readonly handler: (args: CapabilityHandlerArgs<TContext, ParsedInput<TInput>>) => MaybePromise<TOutput>;
|
|
246
|
+
readonly subscribe?: never;
|
|
247
|
+
});
|
|
248
|
+
type AnyCapability = CapabilityDefinition<any, any, any, any, any, CapabilityExecution>;
|
|
225
249
|
type CapabilityInput<TCapability extends AnyCapability> = TCapability extends CapabilityDefinition<any, infer TInput, any, any, any> ? TInput extends AnyObjectSchema ? InferSchemaInput<TInput> : EmptyInput : never;
|
|
226
250
|
type CapabilityOutput<TCapability extends AnyCapability> = TCapability extends CapabilityDefinition<any, any, infer TOutput, any, any> ? TOutput : never;
|
|
227
251
|
type CapabilityContext<TCapability extends AnyCapability> = TCapability extends CapabilityDefinition<infer TContext, any, any, any, any> ? TContext : never;
|
|
228
|
-
type SubscribableCapability = CapabilityDefinition<any, any, any, any, any,
|
|
252
|
+
type SubscribableCapability = CapabilityDefinition<any, any, any, any, any, "live" | "events">;
|
|
253
|
+
type CallableCapability = CapabilityDefinition<any, any, any, any, any, "unary" | "live">;
|
|
229
254
|
type ExecuteCapabilityOptions<TCapability extends AnyCapability> = TCapability extends CapabilityDefinition<infer TContext, infer TInput, any, any, any> ? (TInput extends AnyObjectSchema ? {
|
|
230
255
|
readonly input: InferSchemaInput<TInput>;
|
|
231
256
|
} : {
|
|
@@ -254,32 +279,46 @@ type ExplicitOutputCapabilityConfig<TContext, TInput extends AnyObjectSchema | u
|
|
|
254
279
|
readonly toPresentation?: PresentationRenderer<InferSchemaOutput<TOutput>, TContext>;
|
|
255
280
|
readonly subscribe?: CapabilitySubscriber<TContext, ParsedInput<TInput>, InferSchemaInput<TOutput>>;
|
|
256
281
|
};
|
|
257
|
-
type InferredOutputCapabilityConfig<TContext, TInput extends AnyObjectSchema | undefined,
|
|
282
|
+
type InferredOutputCapabilityConfig<TContext, TInput extends AnyObjectSchema | undefined, TReturn, TErrors extends AnyDefinedErrors, TMeta extends OpenMeta<CapabilityMetaRegistry>> = CapabilityBaseConfig<TContext, TInput, TErrors, TMeta> & {
|
|
283
|
+
readonly output?: never;
|
|
284
|
+
readonly handler: (args: CapabilityHandlerArgs<TContext, ParsedInput<TInput>>) => TReturn;
|
|
285
|
+
readonly toPresentation?: PresentationRenderer<Awaited<TReturn>, TContext>;
|
|
286
|
+
readonly subscribe?: CapabilitySubscriber<TContext, ParsedInput<TInput>, Awaited<TReturn>>;
|
|
287
|
+
};
|
|
288
|
+
type ExplicitEventConfig<TContext, TInput extends AnyObjectSchema | undefined, TOutput extends AnySchema, TErrors extends AnyDefinedErrors, TMeta extends OpenMeta<CapabilityMetaRegistry>> = Omit<ExplicitOutputCapabilityConfig<TContext, TInput, TOutput, TErrors, TMeta>, "handler" | "subscribe" | "effect"> & {
|
|
289
|
+
readonly handler?: never;
|
|
290
|
+
readonly effect: "read";
|
|
291
|
+
readonly subscribe: CapabilitySubscriber<TContext, ParsedInput<TInput>, InferSchemaInput<TOutput>>;
|
|
292
|
+
};
|
|
293
|
+
type InferredEventConfig<TContext, TInput extends AnyObjectSchema | undefined, TOutput, TErrors extends AnyDefinedErrors, TMeta extends OpenMeta<CapabilityMetaRegistry>> = CapabilityBaseConfig<TContext, TInput, TErrors, TMeta> & {
|
|
294
|
+
readonly handler?: never;
|
|
258
295
|
readonly output?: never;
|
|
259
|
-
readonly
|
|
260
|
-
readonly
|
|
261
|
-
readonly
|
|
296
|
+
readonly effect: "read";
|
|
297
|
+
readonly subscribe: CapabilitySubscriber<TContext, ParsedInput<TInput>, TOutput>;
|
|
298
|
+
readonly toPresentation?: PresentationRenderer<NoInfer<TOutput>, TContext>;
|
|
262
299
|
};
|
|
263
300
|
type CapabilityFactory<TContext> = {
|
|
301
|
+
<TInput extends AnyObjectSchema | undefined = undefined, TOutput extends AnySchema = AnySchema, const TErrors extends AnyDefinedErrors = DefinedNoErrors, const TMeta extends OpenMeta<CapabilityMetaRegistry> = {}>(config: ExplicitEventConfig<TContext, TInput, TOutput, TErrors, TMeta>): CapabilityDefinition<TContext, TInput, InferSchemaOutput<TOutput>, TErrors, TMeta, "events">;
|
|
302
|
+
<TInput extends AnyObjectSchema | undefined = undefined, TOutput = unknown, const TErrors extends AnyDefinedErrors = DefinedNoErrors, const TMeta extends OpenMeta<CapabilityMetaRegistry> = {}>(config: InferredEventConfig<TContext, TInput, TOutput, TErrors, TMeta>): CapabilityDefinition<TContext, TInput, TOutput, TErrors, TMeta, "events">;
|
|
264
303
|
<TInput extends AnyObjectSchema | undefined = undefined, TOutput extends AnySchema = AnySchema, const TErrors extends AnyDefinedErrors = DefinedNoErrors, const TMeta extends OpenMeta<CapabilityMetaRegistry> = {}>(config: ExplicitOutputCapabilityConfig<TContext, TInput, TOutput, TErrors, TMeta> & {
|
|
265
304
|
readonly subscribe: CapabilitySubscriber<TContext, ParsedInput<TInput>, InferSchemaInput<TOutput>>;
|
|
266
|
-
}): CapabilityDefinition<TContext, TInput, InferSchemaOutput<TOutput>, TErrors, TMeta,
|
|
305
|
+
}): CapabilityDefinition<TContext, TInput, InferSchemaOutput<TOutput>, TErrors, TMeta, "live">;
|
|
267
306
|
<TInput extends AnyObjectSchema | undefined = undefined, TOutput extends AnySchema = AnySchema, const TErrors extends AnyDefinedErrors = DefinedNoErrors, const TMeta extends OpenMeta<CapabilityMetaRegistry> = {}>(config: ExplicitOutputCapabilityConfig<TContext, TInput, TOutput, TErrors, TMeta> & {
|
|
268
307
|
readonly subscribe?: never;
|
|
269
|
-
}): CapabilityDefinition<TContext, TInput, InferSchemaOutput<TOutput>, TErrors, TMeta,
|
|
270
|
-
<TInput extends AnyObjectSchema | undefined = undefined,
|
|
271
|
-
readonly subscribe: CapabilitySubscriber<TContext, ParsedInput<TInput>, Awaited<
|
|
272
|
-
}): CapabilityDefinition<TContext, TInput, Awaited<
|
|
273
|
-
<TInput extends AnyObjectSchema | undefined = undefined,
|
|
308
|
+
}): CapabilityDefinition<TContext, TInput, InferSchemaOutput<TOutput>, TErrors, TMeta, "unary">;
|
|
309
|
+
<TInput extends AnyObjectSchema | undefined = undefined, TReturn = unknown, const TErrors extends AnyDefinedErrors = DefinedNoErrors, const TMeta extends OpenMeta<CapabilityMetaRegistry> = {}>(config: InferredOutputCapabilityConfig<TContext, TInput, TReturn, TErrors, TMeta> & {
|
|
310
|
+
readonly subscribe: CapabilitySubscriber<TContext, ParsedInput<TInput>, Awaited<TReturn>>;
|
|
311
|
+
}): CapabilityDefinition<TContext, TInput, Awaited<TReturn>, TErrors, TMeta, "live">;
|
|
312
|
+
<TInput extends AnyObjectSchema | undefined = undefined, TReturn = unknown, const TErrors extends AnyDefinedErrors = DefinedNoErrors, const TMeta extends OpenMeta<CapabilityMetaRegistry> = {}>(config: InferredOutputCapabilityConfig<TContext, TInput, TReturn, TErrors, TMeta> & {
|
|
274
313
|
readonly subscribe?: never;
|
|
275
|
-
}): CapabilityDefinition<TContext, TInput, Awaited<
|
|
314
|
+
}): CapabilityDefinition<TContext, TInput, Awaited<TReturn>, TErrors, TMeta, "unary">;
|
|
276
315
|
};
|
|
277
316
|
type CapabilityFunction = CapabilityFactory<undefined> & {
|
|
278
317
|
<TContext>(): CapabilityFactory<TContext>;
|
|
279
318
|
withContext<TContext>(): CapabilityFactory<TContext>;
|
|
280
319
|
};
|
|
281
320
|
declare const capability: CapabilityFunction;
|
|
282
|
-
declare function executeCapability<const TCapability extends
|
|
321
|
+
declare function executeCapability<const TCapability extends CallableCapability>(capability: TCapability, options: ExecuteCapabilityOptions<TCapability>): Promise<CapabilityOutput<TCapability>>;
|
|
283
322
|
declare function executeLocatedCapability(located: LocatedCapability, input: unknown, options: {
|
|
284
323
|
readonly context: unknown;
|
|
285
324
|
readonly signal?: AbortSignal;
|
|
@@ -289,8 +328,8 @@ declare function subscribeCapability<const TCapability extends SubscribableCapab
|
|
|
289
328
|
declare function subscribeLocatedCapability(located: LocatedCapability, input: unknown, options: {
|
|
290
329
|
readonly context: unknown;
|
|
291
330
|
readonly signal?: AbortSignal;
|
|
292
|
-
}): AsyncIterableIterator<unknown
|
|
331
|
+
}): Promise<AsyncIterableIterator<unknown>>;
|
|
293
332
|
declare function isCapability(value: unknown): value is AnyCapability;
|
|
294
333
|
//#endregion
|
|
295
|
-
export {
|
|
296
|
-
//# sourceMappingURL=index-
|
|
334
|
+
export { CapabilityErrorContract as $, CAPABILITY_GROUP_SYMBOL as A, MarkdownPresentationPart as B, isCapability as C, AnyCapabilityGroup as D, APPLICATION_SYMBOL as E, defineApp as F, TablePresentationPart as G, PresentationRenderer as H, group as I, renderPresentationMarkdown as J, normalizePresentation as K, isCapabilityGroup as L, CapabilityTree as M, GroupMetaRegistry as N, AppContext as O, LocatedCapability as P, CAPABILITY_ERRORS_SYMBOL as Q, FilePresentationPart as R, executeLocatedCapability as S, subscribeLocatedCapability as T, PresentationTableCell as U, PresentationPart as V, PresentationValue as W, md as X, MaybePromise as Y, AnyDefinedErrors as Z, ExecuteCapabilityOptions as _, CapabilityDefinition as a, defineErrors as at, capability as b, CapabilityFactory as c, InferSchemaInput as ct, CapabilityMetaRegistry as d, SchemaValidationError as dt, CapabilityErrorDefinition as et, CapabilityMiddleware as f, parseSchema as ft, CapabilitySubscriberArgs as g, CapabilitySubscriber as h, CapabilityContext as i, ErrorMetaRegistry as it, CapabilityGroupDefinition as j, AppDefinition as k, CapabilityHandlerArgs as l, InferSchemaOutput as lt, CapabilityOutput as m, CAPABILITY_SYMBOL as n, CapableError as nt, CapabilityEffect as o, AnyObjectSchema as ot, CapabilityMiddlewareArgs as p, schemaToJsonSchema as pt, present as q, CallableCapability as r, DefinedErrors as rt, CapabilityExecution as s, AnySchema as st, AnyCapability as t, CapabilityErrorFactory as tt, CapabilityInput as u, Schema as ut, SubscribableCapability as v, subscribeCapability as w, executeCapability as x, SubscribeCapabilityOptions as y, ImagePresentationPart as z };
|
|
335
|
+
//# sourceMappingURL=index-WiBWfyTn.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as watchQuery, t as WatchQueryOptions } from "./subscription-
|
|
3
|
-
import { _ as
|
|
4
|
-
export { type App, type AppCapabilityCall, type AppContext, type AppContextProvider, type AppDefinition, type ApplicationSelection, type CapabilityContext, type CapabilityDefinition, type CapabilityEffect, type CapabilityFactory, type CapabilityHandlerArgs, type CapabilityInput, type CapabilityMiddleware, type CapabilityMiddlewareArgs, type CapabilityOutput, type CapabilitySubscriber, type CapabilitySubscriberArgs, type CapabilityTree, type DefinedErrors, type ExecuteCapabilityOptions, type PresentationPart, type PresentationRenderer, type PresentationTableCell, type PresentationValue, type WatchQueryOptions, capability, createApp, createRemoteApp, defineApp, defineErrors, executeCapability, group, md,
|
|
1
|
+
import { F as defineApp, H as PresentationRenderer, I as group, M as CapabilityTree, O as AppContext, U as PresentationTableCell, V as PresentationPart, W as PresentationValue, X as md, _ as ExecuteCapabilityOptions, a as CapabilityDefinition, at as defineErrors, b as capability, c as CapabilityFactory, f as CapabilityMiddleware, g as CapabilitySubscriberArgs, h as CapabilitySubscriber, i as CapabilityContext, k as AppDefinition, l as CapabilityHandlerArgs, m as CapabilityOutput, o as CapabilityEffect, p as CapabilityMiddlewareArgs, q as present, rt as DefinedErrors, s as CapabilityExecution, u as CapabilityInput, x as executeCapability } from "./index-WiBWfyTn.mjs";
|
|
2
|
+
import { n as watchQuery, t as WatchQueryOptions } from "./subscription-DPdwovhw.mjs";
|
|
3
|
+
import { O as subscribe, T as createRemoteApp, _ as AppCapabilityReference, a as CustomizedCapability, f as App, i as CapabilityCustomization, m as AppCapabilityCall, n as composeApps, o as customize, r as selectApp, t as ApplicationSelection, v as AppContextProvider, w as createApp } from "./index-1A44jLuE.mjs";
|
|
4
|
+
export { type App, type AppCapabilityCall, type AppCapabilityReference, type AppContext, type AppContextProvider, type AppDefinition, type ApplicationSelection, type CapabilityContext, type CapabilityCustomization, type CapabilityDefinition, type CapabilityEffect, type CapabilityExecution, type CapabilityFactory, type CapabilityHandlerArgs, type CapabilityInput, type CapabilityMiddleware, type CapabilityMiddlewareArgs, type CapabilityOutput, type CapabilitySubscriber, type CapabilitySubscriberArgs, type CapabilityTree, type CustomizedCapability, type DefinedErrors, type ExecuteCapabilityOptions, type PresentationPart, type PresentationRenderer, type PresentationTableCell, type PresentationValue, type WatchQueryOptions, capability, composeApps, createApp, createRemoteApp, customize, defineApp, defineErrors, executeCapability, group, md, present, selectApp, subscribe, watchQuery };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as defineErrors, c as executeCapability, g as watchQuery, i as group, r as defineApp, s as capability, v as present } from "./src-
|
|
1
|
+
import { S as defineErrors, c as executeCapability, g as watchQuery, i as group, r as defineApp, s as capability, v as present } from "./src-B2WeUwUT.mjs";
|
|
2
2
|
import { t as md } from "./projection-Cgq2u0Wt.mjs";
|
|
3
|
-
import { n as selectApp,
|
|
4
|
-
export { capability, createApp, createRemoteApp, defineApp, defineErrors, executeCapability, group, md,
|
|
3
|
+
import { l as createApp, n as selectApp, p as subscribe, r as customize, t as composeApps, u as createRemoteApp } from "./src-DePlcG_t.mjs";
|
|
4
|
+
export { capability, composeApps, createApp, createRemoteApp, customize, defineApp, defineErrors, executeCapability, group, md, present, selectApp, subscribe, watchQuery };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as ServerMount } from "./index-
|
|
1
|
+
import { A as JsonSchema, S as CapabilityResult, d as AnyApp, t as ApplicationSelection } from "./index-1A44jLuE.mjs";
|
|
2
|
+
import { i as ServerMount } from "./index-D-NV4PiU.mjs";
|
|
3
3
|
//#region packages/mcp/src/index.d.ts
|
|
4
4
|
type McpCapabilityMeta = false | {
|
|
5
5
|
readonly name?: string;
|
|
6
|
+
readonly icons?: readonly McpIcon[];
|
|
7
|
+
readonly idempotentHint?: boolean;
|
|
8
|
+
readonly openWorldHint?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare global {
|
|
11
|
+
interface CapableCustomizationMeta {
|
|
12
|
+
readonly mcp?: McpCapabilityMeta;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
type McpIcon = {
|
|
16
|
+
readonly src: string;
|
|
17
|
+
readonly mimeType?: string;
|
|
18
|
+
readonly sizes?: readonly string[];
|
|
19
|
+
readonly theme?: "light" | "dark";
|
|
6
20
|
};
|
|
7
21
|
declare module "@capable/core" {
|
|
8
22
|
interface CapabilityMetaRegistry {
|
|
@@ -13,11 +27,17 @@ type McpTool = {
|
|
|
13
27
|
readonly name: string;
|
|
14
28
|
readonly title?: string;
|
|
15
29
|
readonly description?: string;
|
|
30
|
+
readonly icons?: readonly McpIcon[];
|
|
16
31
|
readonly inputSchema: JsonSchema;
|
|
17
32
|
readonly outputSchema?: JsonSchema;
|
|
33
|
+
readonly _meta: {
|
|
34
|
+
readonly "dev.capable/capabilityId": string;
|
|
35
|
+
};
|
|
18
36
|
readonly annotations: {
|
|
19
37
|
readonly readOnlyHint: boolean;
|
|
20
38
|
readonly destructiveHint: boolean;
|
|
39
|
+
readonly idempotentHint?: boolean;
|
|
40
|
+
readonly openWorldHint?: boolean;
|
|
21
41
|
};
|
|
22
42
|
call(input: unknown, options?: {
|
|
23
43
|
readonly signal?: AbortSignal;
|
|
@@ -26,11 +46,26 @@ type McpTool = {
|
|
|
26
46
|
declare function createMcp(app: AnyApp): Promise<readonly McpTool[]>;
|
|
27
47
|
//#endregion
|
|
28
48
|
//#region packages/mcp/src/mount.d.ts
|
|
29
|
-
|
|
49
|
+
type McpCacheHint = {
|
|
50
|
+
readonly ttlMs?: number;
|
|
51
|
+
readonly cacheScope?: "public" | "private";
|
|
52
|
+
};
|
|
53
|
+
type McpMountOptions = {
|
|
30
54
|
readonly path?: string;
|
|
31
55
|
readonly name?: string;
|
|
32
56
|
readonly version?: string;
|
|
33
|
-
|
|
57
|
+
readonly title?: string;
|
|
58
|
+
readonly description?: string;
|
|
59
|
+
readonly websiteUrl?: string;
|
|
60
|
+
readonly icons?: readonly McpIcon[];
|
|
61
|
+
readonly instructions?: string;
|
|
62
|
+
readonly selection?: ApplicationSelection;
|
|
63
|
+
readonly cache?: {
|
|
64
|
+
readonly discovery?: McpCacheHint;
|
|
65
|
+
readonly tools?: McpCacheHint;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
declare function mcp<TContext = any>(options?: McpMountOptions): ServerMount<TContext>;
|
|
34
69
|
//#endregion
|
|
35
|
-
export { McpCapabilityMeta, McpTool, createMcp, mcp };
|
|
70
|
+
export { type McpCacheHint, McpCapabilityMeta, McpIcon, type McpMountOptions, McpTool, createMcp, mcp };
|
|
36
71
|
//# sourceMappingURL=mcp.d.mts.map
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createMcp, t as mcp } from "./mount-
|
|
1
|
+
import { n as createMcp, t as mcp } from "./mount-BmLHp349.mjs";
|
|
2
2
|
export { createMcp, mcp };
|