apps 0.0.1-beta.4 → 0.0.1-beta.6
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/README.md +65 -43
- package/framework-reference.json +1 -1
- package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
- package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
- package/js/{chunk-WFSQXYUT.js → chunk-5T57N25Q.js} +15 -3
- package/js/{chunk-EQB7JMAL.js → chunk-6BSSI67S.js} +8 -8
- package/js/{chunk-3M2MEDNL.js → chunk-B3EOZTK3.js} +351 -33
- package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
- package/js/{chunk-Z5NMEGJN.js → chunk-ECQFRCH4.js} +21 -9
- package/js/{chunk-G7ZIRKMK.js → chunk-IJX4CYZO.js} +3 -3
- package/js/{chunk-FDNTX5QJ.js → chunk-IPI4MFSN.js} +2 -2
- package/js/{chunk-2VPJHFOU.js → chunk-ITM77QPO.js} +28 -9
- package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
- package/js/{chunk-NQ3OMCA5.js → chunk-KUMBKVJD.js} +2 -2
- package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
- package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
- package/js/chunk-MNMNLXBL.js +507 -0
- package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
- package/js/{chunk-D47C7KG5.js → chunk-NKLWZJLE.js} +2 -2
- package/js/{chunk-DHUDODG5.js → chunk-OE3QQTSB.js} +41 -32
- package/js/{chunk-M6ZRRIBI.js → chunk-PJJ24GU7.js} +1 -1
- package/js/{chunk-FZJOYIZO.js → chunk-PZB6T6KU.js} +1 -1
- package/js/{chunk-LGIYBDWA.js → chunk-R3EV5FTO.js} +13 -1
- package/js/{chunk-5MQZEB6Y.js → chunk-RFVIONFX.js} +29 -12
- package/js/{chunk-ZCAMUXSG.js → chunk-RJDDBDSN.js} +3 -3
- package/js/{chunk-6VRYO2BG.js → chunk-SB4HEPNJ.js} +191 -170
- package/js/chunk-T7GKZBLP.js +209 -0
- package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
- package/js/{chunk-T2LAZCAD.js → chunk-VFZKSM3T.js} +1 -1
- package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
- package/js/client.js +10 -10
- package/js/contracts.js +52 -16
- package/js/effect.js +19 -20
- package/js/graphql.js +34 -40
- package/js/host.js +19 -20
- package/js/index.js +189 -178
- package/js/mcp/effect.js +21 -22
- package/js/mcp/stdio.js +25 -26
- package/js/mcp.js +60 -45
- package/js/openapi.js +182 -224
- package/js/react.js +3 -3
- package/js/skills/effect.js +3 -3
- package/js/skills.js +12 -13
- package/js/storage/facet.js +4 -4
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +4 -4
- package/js/ui/serving.js +8 -8
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/app-data/src/contracts/database.d.ts +33 -6
- package/types/app-data/src/implementation/schema.d.ts +2 -17
- package/types/apps/src/contracts/app.d.ts +2 -5
- package/types/apps/src/contracts/failure.d.ts +25 -0
- package/types/apps/src/contracts/host.d.ts +18 -9
- package/types/apps/src/contracts/mcp.d.ts +16 -0
- package/types/apps/src/contracts/openapi.d.ts +5 -1
- package/types/apps/src/contracts/operations.d.ts +0 -5
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +15 -1
- package/types/apps/src/contracts/protocols/2.d.ts +2 -2
- package/types/apps/src/contracts/protocols/3.d.ts +676 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/storage.d.ts +3 -3
- package/types/apps/src/contracts/workflows.d.ts +34 -3
- package/types/apps/src/graphql.d.ts +1 -3
- package/types/apps/src/implementation/account-router.d.ts +12 -0
- package/types/apps/src/implementation/app.d.ts +5 -4
- package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
- package/types/apps/src/implementation/elicitation.d.ts +1 -1
- package/types/apps/src/implementation/failure-detail.d.ts +25 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
- package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
- package/types/apps/src/implementation/mcp-client.d.ts +35 -19
- package/types/apps/src/implementation/mcp.d.ts +35 -19
- package/types/apps/src/implementation/openapi-compile.d.ts +2 -1
- package/types/apps/src/implementation/openapi-source.d.ts +2 -6
- package/types/apps/src/implementation/operations.d.ts +26 -3
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
- package/types/apps/src/implementation/router-catalog.d.ts +225 -0
- package/types/apps/src/implementation/router.d.ts +59 -0
- package/types/apps/src/implementation/schema.d.ts +5 -1
- package/types/apps/src/implementation/storage.d.ts +5 -3
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflow-context.d.ts +11 -3
- package/types/apps/src/index.d.ts +3 -2
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +5 -4
- package/types/apps/src/openapi.d.ts +6 -6
- package/js/chunk-PYUYJRSK.js +0 -93
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-W7D7WVSY.js +0 -18
- package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Routers group operations. Keys form tool paths; each operation keeps its own kind. */
|
|
2
|
+
import { Schema, type Effect } from "effect";
|
|
3
|
+
import type { HostedTool, HostedToolSummary } from "./host.js";
|
|
4
|
+
import type { AppOperation } from "./operations.js";
|
|
5
|
+
/** Object keys that JavaScript gives special meaning, so no router may use them. */
|
|
6
|
+
export declare const reservedRouterKeys: ReadonlySet<string>;
|
|
7
|
+
/** One static path segment. Dots separate segments, so a key never contains one. */
|
|
8
|
+
export declare const RouterKey: Schema.String;
|
|
9
|
+
/** An image a client may show beside a router, such as an MCP server's own icon. Models never read it. */
|
|
10
|
+
export declare const RouterIcon: Schema.Struct<{
|
|
11
|
+
readonly src: Schema.NonEmptyString;
|
|
12
|
+
readonly mimeType: Schema.optionalKey<Schema.String>;
|
|
13
|
+
readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
14
|
+
readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
|
|
15
|
+
}>;
|
|
16
|
+
export type RouterIcon = typeof RouterIcon.Type;
|
|
17
|
+
/**
|
|
18
|
+
* What an agent should know about a group of tools. `instructions` is published as a skill;
|
|
19
|
+
* `tags` describes labels that tools in this router carry, such as OpenAPI tags.
|
|
20
|
+
*/
|
|
21
|
+
export declare const RouterMeta: Schema.Struct<{
|
|
22
|
+
readonly title: Schema.optionalKey<Schema.String>;
|
|
23
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
24
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
25
|
+
readonly icons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
26
|
+
readonly src: Schema.NonEmptyString;
|
|
27
|
+
readonly mimeType: Schema.optionalKey<Schema.String>;
|
|
28
|
+
readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
29
|
+
readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
|
|
30
|
+
}>>>;
|
|
31
|
+
readonly tags: Schema.optionalKey<Schema.$Record<Schema.NonEmptyString, Schema.String>>;
|
|
32
|
+
}>;
|
|
33
|
+
export type RouterMeta = typeof RouterMeta.Type;
|
|
34
|
+
/** A statically declared router. Children are operations or further routers. */
|
|
35
|
+
export interface AppRouter {
|
|
36
|
+
readonly kind: "router";
|
|
37
|
+
readonly meta?: RouterMeta;
|
|
38
|
+
readonly children: Readonly<Record<string, AppNode>>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A router whose tools are discovered when read, such as an MCP server or OpenAPI document.
|
|
42
|
+
* Names are relative to the router and may contain dots. `readOnly: true` marks a query;
|
|
43
|
+
* anything else is a mutation. Resolution never requires listing.
|
|
44
|
+
*/
|
|
45
|
+
export interface DynamicRouter {
|
|
46
|
+
readonly kind: "dynamic";
|
|
47
|
+
/** Metadata supplied by the source. Author metadata on the router takes precedence. */
|
|
48
|
+
readonly meta?: () => Effect.Effect<RouterMeta, unknown>;
|
|
49
|
+
readonly list: () => Effect.Effect<readonly HostedTool[], unknown>;
|
|
50
|
+
readonly resolve: (name: string) => Effect.Effect<AppOperation | undefined, unknown>;
|
|
51
|
+
/** Names and descriptions without schemas. Omitted sources reduce list(). */
|
|
52
|
+
readonly summaries?: () => Effect.Effect<readonly HostedToolSummary[], unknown>;
|
|
53
|
+
/** One tool's full metadata without listing. Omitted sources search list(). */
|
|
54
|
+
readonly describe?: (name: string) => Effect.Effect<HostedTool | undefined, unknown>;
|
|
55
|
+
/** Static author metadata, merged over the source's metadata. */
|
|
56
|
+
readonly overrides?: RouterMeta;
|
|
57
|
+
}
|
|
58
|
+
/** Anything a router can contain. */
|
|
59
|
+
export type AppNode = AppOperation | AppRouter | DynamicRouter;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Schema, type Effect } from "effect";
|
|
3
3
|
import type { RowMetadata, ReadTable, WriteTable } from "../../../app-data/src/index.js";
|
|
4
4
|
import type { Fields, ObjectValue } from "../implementation/schema.js";
|
|
5
|
-
import type { DatabaseSchema, DatabaseSession,
|
|
5
|
+
import type { DatabaseSchema, DatabaseSession, DatabaseError } from "../../../app-data/src/contracts/database.js";
|
|
6
6
|
/** Names for authored operations and tables. */
|
|
7
7
|
export declare const StorageName: Schema.NonEmptyString;
|
|
8
8
|
declare const AppStorageUnavailable_base: Schema.Class<AppStorageUnavailable, Schema.TaggedStruct<"AppStorageUnavailable", {}>, import("effect/Cause").YieldableError>;
|
|
@@ -15,8 +15,8 @@ export declare class AppStorageError extends AppStorageError_base {
|
|
|
15
15
|
}
|
|
16
16
|
/** The adapter owns the database connection and transaction for the whole authored invocation. */
|
|
17
17
|
export interface AppStorage {
|
|
18
|
-
readonly read: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E |
|
|
19
|
-
readonly mutate: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E |
|
|
18
|
+
readonly read: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError | AppStorageUnavailable | AppStorageError>;
|
|
19
|
+
readonly mutate: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError | AppStorageUnavailable | AppStorageError>;
|
|
20
20
|
}
|
|
21
21
|
type InputValue<F extends Fields> = {
|
|
22
22
|
readonly [K in keyof F as F[K]["optionalValue"] extends true ? never : F[K] extends {
|
|
@@ -24,14 +24,33 @@ export declare const WorkflowStepOptions: Schema.Struct<{
|
|
|
24
24
|
readonly timeout: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.NonEmptyString]>>;
|
|
25
25
|
}>;
|
|
26
26
|
export type WorkflowStepOptions = typeof WorkflowStepOptions.Type;
|
|
27
|
+
/**
|
|
28
|
+
* Where and why a run failed: the failing step and the error the app's own code raised, its
|
|
29
|
+
* message bounded and with account secrets replaced. Runs from before these fields existed have none.
|
|
30
|
+
*/
|
|
31
|
+
export declare const WorkflowFailureDetail: {
|
|
32
|
+
step: Schema.optionalKey<Schema.String>;
|
|
33
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
34
|
+
message: Schema.optionalKey<Schema.String>;
|
|
35
|
+
};
|
|
36
|
+
/** A failed run's recorded step and app error. */
|
|
37
|
+
export declare const WorkflowRunFailure: Schema.Struct<{
|
|
38
|
+
step: Schema.optionalKey<Schema.String>;
|
|
39
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
40
|
+
message: Schema.optionalKey<Schema.String>;
|
|
41
|
+
}>;
|
|
42
|
+
export type WorkflowRunFailure = typeof WorkflowRunFailure.Type;
|
|
27
43
|
declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedStruct<"WorkflowFailure", {
|
|
28
44
|
readonly reason: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
29
45
|
readonly retryable: Schema.Boolean;
|
|
46
|
+
readonly step: Schema.optionalKey<Schema.String>;
|
|
47
|
+
readonly errorName: Schema.optionalKey<Schema.String>;
|
|
48
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
30
49
|
}>, import("effect/Cause").YieldableError>;
|
|
31
|
-
/**
|
|
50
|
+
/** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
|
|
32
51
|
export declare class WorkflowFailure extends WorkflowFailure_base {
|
|
33
52
|
}
|
|
34
|
-
/** Explicitly stop retrying an authored step. Its message
|
|
53
|
+
/** Explicitly stop retrying an authored step. Its message is reported like any step error. */
|
|
35
54
|
export declare class NonRetryableError extends Error {
|
|
36
55
|
readonly name = "NonRetryableError";
|
|
37
56
|
}
|
|
@@ -45,7 +64,7 @@ export declare const HostedWorkflow: Schema.Struct<{
|
|
|
45
64
|
readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
46
65
|
}>;
|
|
47
66
|
export type HostedWorkflow = typeof HostedWorkflow.Type;
|
|
48
|
-
/** Results are available only on completed runs;
|
|
67
|
+
/** Results are available only on completed runs; failures carry a reason code and app error detail. */
|
|
49
68
|
export declare const WorkflowRun: Schema.Union<readonly [Schema.Struct<{
|
|
50
69
|
readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "paused", "waitingForPause"]>;
|
|
51
70
|
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
@@ -66,6 +85,12 @@ export declare const WorkflowRun: Schema.Union<readonly [Schema.Struct<{
|
|
|
66
85
|
}>, Schema.Struct<{
|
|
67
86
|
readonly status: Schema.Literal<"errored">;
|
|
68
87
|
readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
88
|
+
/** The failing step and the app's own error, when the run recorded them. */
|
|
89
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
90
|
+
step: Schema.optionalKey<Schema.String>;
|
|
91
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
92
|
+
message: Schema.optionalKey<Schema.String>;
|
|
93
|
+
}>>;
|
|
69
94
|
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
70
95
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
71
96
|
readonly app: Schema.NonEmptyString;
|
|
@@ -104,6 +129,12 @@ export declare const WorkflowRunPage: Schema.Struct<{
|
|
|
104
129
|
}>, Schema.Struct<{
|
|
105
130
|
readonly status: Schema.Literal<"errored">;
|
|
106
131
|
readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
|
|
132
|
+
/** The failing step and the app's own error, when the run recorded them. */
|
|
133
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
134
|
+
step: Schema.optionalKey<Schema.String>;
|
|
135
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
136
|
+
message: Schema.optionalKey<Schema.String>;
|
|
137
|
+
}>>;
|
|
107
138
|
readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
|
|
108
139
|
readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
|
|
109
140
|
readonly app: Schema.NonEmptyString;
|
|
@@ -4,7 +4,5 @@ import { type GraphqlCatalogOptions } from "./implementation/graphql-catalog.js"
|
|
|
4
4
|
export { GraphqlError, type GraphqlToolsOptions } from "./contracts/graphql.js";
|
|
5
5
|
export type { GraphqlCatalogOptions } from "./implementation/graphql-catalog.js";
|
|
6
6
|
/** Lazy tools with optional persistent metadata caching for the selected account. */
|
|
7
|
-
export declare const
|
|
8
|
-
dynamicTools: import("./contracts/dynamic-tools.js").DynamicTools;
|
|
9
|
-
}>;
|
|
7
|
+
export declare const graphqlRouter: (options: GraphqlCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
10
8
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RouterDeclaration } from "./router.js";
|
|
2
|
+
/**
|
|
3
|
+
* Discover each selected account's router and combine matching names.
|
|
4
|
+
* Calls take { accountId, input }; each branch retains its account's input schema,
|
|
5
|
+
* credentials, approval and output validation. Empty selections expose no operations.
|
|
6
|
+
* Discovery is sequential and cancellation follows the caller's signal.
|
|
7
|
+
*/
|
|
8
|
+
export declare const accountRouter: <Account extends {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
}>(accounts: readonly Account[], discover: (account: Account) => Promise<RouterDeclaration>, options: {
|
|
11
|
+
readonly signal: AbortSignal;
|
|
12
|
+
}) => Promise<RouterDeclaration>;
|
|
@@ -4,7 +4,7 @@ import type { AppRequirements, AppContext, QueryContext, MutationContext, Webhoo
|
|
|
4
4
|
import { type PromiseMethods } from "./authoring.js";
|
|
5
5
|
import { type WorkflowDeclaration } from "./workflows.js";
|
|
6
6
|
import type { WorkflowContext } from "../contracts/workflows.js";
|
|
7
|
-
import { type
|
|
7
|
+
import { type RouterDeclaration } from "./router.js";
|
|
8
8
|
import { type Schema } from "./schema.js";
|
|
9
9
|
type PromiseCatalog<Catalog> = Catalog extends Readonly<Record<string, object>> ? {
|
|
10
10
|
readonly [Name in keyof Catalog]: {
|
|
@@ -14,15 +14,16 @@ type PromiseCatalog<Catalog> = Catalog extends Readonly<Record<string, object>>
|
|
|
14
14
|
/** Author definition projected from native capabilities. Excluding callable objects keeps
|
|
15
15
|
* factories from being inferred as definitions and preserves contextual handler inference. */
|
|
16
16
|
export type AppDefinition<Requirements extends AppRequirements> = {
|
|
17
|
-
readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ? Readonly<Record<string, WorkflowDeclaration<WorkflowContext<Requirements>>>> : Key extends "schedules" ? Readonly<Record<string, ScheduleDeclaration<MutationContext<Requirements>>>> : Key extends "
|
|
17
|
+
readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ? Readonly<Record<string, WorkflowDeclaration<WorkflowContext<Requirements>>>> : Key extends "schedules" ? Readonly<Record<string, ScheduleDeclaration<MutationContext<Requirements>>>> : Key extends "tools" ? RouterDeclaration<QueryContext<Requirements>, MutationContext<Requirements>> : Key extends "webhooks" ? PromiseCatalog<NonNullable<NativeDefinition<WebhookContext<Requirements>>[Key]>> : NativeDefinition<WebhookContext<Requirements>>[Key];
|
|
18
18
|
} & {
|
|
19
19
|
readonly name?: never;
|
|
20
|
-
readonly
|
|
20
|
+
readonly queries?: never;
|
|
21
|
+
readonly mutations?: never;
|
|
21
22
|
readonly call?: never;
|
|
22
23
|
};
|
|
23
24
|
/** Adapt operation and webhook catalogs without evaluating their handlers. */
|
|
24
25
|
export type EffectDefinition<Def> = {
|
|
25
|
-
readonly [Key in keyof Def]: Key extends "
|
|
26
|
+
readonly [Key in keyof Def]: Key extends "tools" ? NonNullable<NativeDefinition<unknown>["tools"]> : Key extends "workflows" ? Readonly<Record<string, import("../contracts/workflows.js").AppWorkflow>> : Key extends "schedules" ? NonNullable<NativeDefinition<unknown>["schedules"]> : Key extends "webhooks" ? NonNullable<NativeDefinition<WebhookContext>["webhooks"]> : Key extends "skills" ? NonNullable<NativeDefinition<unknown>["skills"]> : Key extends "dynamicSkills" ? NonNullable<NativeDefinition<unknown>["dynamicSkills"]> : Def[Key];
|
|
26
27
|
};
|
|
27
28
|
declare const InternalApp: unique symbol;
|
|
28
29
|
/** Recognize a declaration from this framework instance before host adaptation. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Duration, Effect, Schema } from "effect";
|
|
2
2
|
import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
|
-
import { type JsonValue } from "../contracts/schema.js";
|
|
3
|
+
import { JsonObject, type JsonValue } from "../contracts/schema.js";
|
|
4
4
|
export interface CatalogCacheOptions {
|
|
5
5
|
/** App/build scope, optionally narrowed to the current account. */
|
|
6
6
|
readonly cache?: AppCache;
|
|
@@ -11,6 +11,11 @@ export interface CatalogCacheOptions {
|
|
|
11
11
|
/** Await a fresh revision at an explicit logical connection or refresh boundary. */
|
|
12
12
|
readonly revalidate?: boolean;
|
|
13
13
|
}
|
|
14
|
+
/** One load: the tools, and optionally a record describing the whole catalog. */
|
|
15
|
+
export interface CatalogLoad<A> {
|
|
16
|
+
readonly tools: readonly A[];
|
|
17
|
+
readonly header?: JsonObject;
|
|
18
|
+
}
|
|
14
19
|
export declare const catalogCache: <A extends {
|
|
15
20
|
readonly name: string;
|
|
16
21
|
}, S>(options: CatalogCacheOptions & {
|
|
@@ -21,9 +26,11 @@ export declare const catalogCache: <A extends {
|
|
|
21
26
|
readonly schema: Schema.Decoder<S>;
|
|
22
27
|
readonly of: (tool: A) => S;
|
|
23
28
|
};
|
|
24
|
-
readonly load: (context?: CacheLoadContext) => Effect.Effect<
|
|
29
|
+
readonly load: (context?: CacheLoadContext) => Effect.Effect<CatalogLoad<A>, unknown>;
|
|
25
30
|
}) => Effect.Effect<{
|
|
26
31
|
list: () => Effect.Effect<readonly A[], unknown, never>;
|
|
32
|
+
/** The record stored with the current revision, if the source supplied one. */
|
|
33
|
+
header: () => Effect.Effect<JsonObject | undefined, unknown>;
|
|
27
34
|
summaries: () => Effect.Effect<S[], unknown, never>;
|
|
28
35
|
resolve: (name: string) => Effect.Effect<A | undefined, unknown, never>;
|
|
29
36
|
}, unknown, never>;
|
|
@@ -66,10 +66,10 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
66
66
|
} | {
|
|
67
67
|
readonly type: "number" | "integer";
|
|
68
68
|
readonly default?: number;
|
|
69
|
+
readonly maximum?: number;
|
|
69
70
|
readonly description?: string;
|
|
70
71
|
readonly title?: string;
|
|
71
72
|
readonly minimum?: number;
|
|
72
|
-
readonly maximum?: number;
|
|
73
73
|
} | {
|
|
74
74
|
readonly type: "boolean";
|
|
75
75
|
readonly default?: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Redacted } from "effect";
|
|
2
|
+
import type { ResolvedAccounts } from "../contracts/host.js";
|
|
3
|
+
/** Fields of `FailureDetail` as constructor input. */
|
|
4
|
+
export interface FailureDetail {
|
|
5
|
+
readonly source?: "app" | "storage" | "service";
|
|
6
|
+
readonly errorName?: string;
|
|
7
|
+
readonly code?: string;
|
|
8
|
+
readonly message?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Every credential field value of a slot-to-account record, longest first. Accepts both resolved
|
|
12
|
+
* host accounts and bound author accounts; each account keeps its credential values in `fields`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const accountFieldSecrets: (accounts: unknown) => string[];
|
|
15
|
+
/** Every credential field value of an invocation's selected accounts. */
|
|
16
|
+
export declare const accountSecrets: (accounts: Redacted.Redacted<ResolvedAccounts>) => string[];
|
|
17
|
+
/** Replace account secrets and bound the message for the runtime boundary. */
|
|
18
|
+
export declare const boundFailureMessage: (message: string, secrets: readonly string[]) => string;
|
|
19
|
+
/** `Name: message` for any thrown value, before redaction. */
|
|
20
|
+
export declare const describeFailure: (error: unknown) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Describe what an operation raised for the app's own caller. App data failures keep their
|
|
23
|
+
* reason as a code; any other thrown value is the app's own error. Account secrets are replaced.
|
|
24
|
+
*/
|
|
25
|
+
export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { GraphqlToolsOptions } from "../contracts/graphql.js";
|
|
3
|
-
import type { DynamicTools } from "../contracts/dynamic-tools.js";
|
|
4
3
|
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
5
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
6
5
|
export interface GraphqlCatalogOptions extends GraphqlToolsOptions, CatalogCacheOptions {
|
|
7
6
|
}
|
|
8
|
-
export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<
|
|
9
|
-
dynamicTools: DynamicTools;
|
|
10
|
-
}, unknown, never>;
|
|
7
|
+
export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import type { DynamicTools } from "../contracts/dynamic-tools.js";
|
|
3
2
|
import { McpToolsOptions } from "../contracts/mcp.js";
|
|
4
3
|
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
5
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
@@ -7,6 +6,4 @@ import { type OperationKinds } from "./protocol-operations.js";
|
|
|
7
6
|
export interface McpCatalogOptions extends McpToolsOptions, CatalogCacheOptions {
|
|
8
7
|
}
|
|
9
8
|
/** Construction opens no transport unless explicit revalidation is requested. */
|
|
10
|
-
export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<
|
|
11
|
-
dynamicTools: DynamicTools;
|
|
12
|
-
}, unknown, never>;
|
|
9
|
+
export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
|
|
@@ -14,26 +14,42 @@ export interface WithMcpClient {
|
|
|
14
14
|
/** Shared client operations never cache catalogs or account credentials. */
|
|
15
15
|
export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError): {
|
|
16
16
|
list: Effect.Effect<{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
tools: {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly inputSchema: {
|
|
20
|
+
readonly [x: string]: Schema.Json;
|
|
21
|
+
};
|
|
22
|
+
readonly description?: string | undefined;
|
|
23
|
+
readonly _meta?: {
|
|
24
|
+
readonly [x: string]: Schema.Json;
|
|
25
|
+
} | undefined;
|
|
26
|
+
readonly title?: string | undefined;
|
|
27
|
+
readonly annotations?: {
|
|
28
|
+
readonly title?: string;
|
|
29
|
+
readonly readOnlyHint?: boolean;
|
|
30
|
+
readonly destructiveHint?: boolean;
|
|
31
|
+
readonly idempotentHint?: boolean;
|
|
32
|
+
readonly openWorldHint?: boolean;
|
|
33
|
+
} | undefined;
|
|
34
|
+
readonly outputSchema?: {
|
|
35
|
+
readonly [x: string]: Schema.Json;
|
|
36
|
+
} | undefined;
|
|
37
|
+
}[];
|
|
38
|
+
server: {
|
|
39
|
+
readonly version?: string;
|
|
40
|
+
readonly name?: string;
|
|
41
|
+
readonly description?: string;
|
|
30
42
|
readonly title?: string;
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
readonly instructions?: string;
|
|
44
|
+
readonly icons?: readonly {
|
|
45
|
+
readonly src: string;
|
|
46
|
+
readonly mimeType?: string;
|
|
47
|
+
readonly sizes?: readonly string[];
|
|
48
|
+
readonly theme?: "light" | "dark";
|
|
49
|
+
}[];
|
|
50
|
+
readonly websiteUrl?: string;
|
|
51
|
+
} | {};
|
|
52
|
+
}, ProviderError | McpError, never>;
|
|
37
53
|
call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
|
|
38
54
|
readonly content: readonly {
|
|
39
55
|
readonly [x: string]: Schema.Json;
|
|
@@ -4,26 +4,42 @@ import { McpError, McpToolsOptions } from "../contracts/mcp.js";
|
|
|
4
4
|
/** Discover and call with a fresh selected-account transport for each operation. */
|
|
5
5
|
export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
|
|
6
6
|
list: Effect.Effect<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readonly
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
tools: {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly inputSchema: {
|
|
10
|
+
readonly [x: string]: Schema.Json;
|
|
11
|
+
};
|
|
12
|
+
readonly description?: string | undefined;
|
|
13
|
+
readonly _meta?: {
|
|
14
|
+
readonly [x: string]: Schema.Json;
|
|
15
|
+
} | undefined;
|
|
16
|
+
readonly title?: string | undefined;
|
|
17
|
+
readonly annotations?: {
|
|
18
|
+
readonly title?: string;
|
|
19
|
+
readonly readOnlyHint?: boolean;
|
|
20
|
+
readonly destructiveHint?: boolean;
|
|
21
|
+
readonly idempotentHint?: boolean;
|
|
22
|
+
readonly openWorldHint?: boolean;
|
|
23
|
+
} | undefined;
|
|
24
|
+
readonly outputSchema?: {
|
|
25
|
+
readonly [x: string]: Schema.Json;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}[];
|
|
28
|
+
server: {
|
|
29
|
+
readonly version?: string;
|
|
30
|
+
readonly name?: string;
|
|
31
|
+
readonly description?: string;
|
|
20
32
|
readonly title?: string;
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
readonly instructions?: string;
|
|
34
|
+
readonly icons?: readonly {
|
|
35
|
+
readonly src: string;
|
|
36
|
+
readonly mimeType?: string;
|
|
37
|
+
readonly sizes?: readonly string[];
|
|
38
|
+
readonly theme?: "light" | "dark";
|
|
39
|
+
}[];
|
|
40
|
+
readonly websiteUrl?: string;
|
|
41
|
+
} | {};
|
|
42
|
+
}, ProviderError | McpError, never>;
|
|
27
43
|
call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
|
|
28
44
|
readonly content: readonly {
|
|
29
45
|
readonly [x: string]: Schema.Json;
|
|
@@ -56,7 +56,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
56
56
|
readonly input: {
|
|
57
57
|
readonly [x: string]: Schema.Json;
|
|
58
58
|
};
|
|
59
|
-
readonly method: "
|
|
59
|
+
readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
60
60
|
readonly securitySchemes: {
|
|
61
61
|
readonly [x: string]: {
|
|
62
62
|
readonly [x: string]: Schema.Json;
|
|
@@ -67,6 +67,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
67
67
|
readonly outputSchema?: {
|
|
68
68
|
readonly [x: string]: Schema.Json;
|
|
69
69
|
};
|
|
70
|
+
readonly tags?: readonly string[];
|
|
70
71
|
readonly operationId?: string;
|
|
71
72
|
readonly streaming?: true;
|
|
72
73
|
readonly errorResponses?: readonly {
|
|
@@ -3,8 +3,8 @@ import { Duration } from "effect";
|
|
|
3
3
|
import type { AppCache } from "../contracts/cache.js";
|
|
4
4
|
import { OpenapiOperation, type OpenapiToolsOptions } from "../contracts/openapi.js";
|
|
5
5
|
import { JsonObject, JsonValue } from "../contracts/schema.js";
|
|
6
|
-
import type { DynamicTools } from "../contracts/dynamic-tools.js";
|
|
7
6
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
7
|
+
import { type RouterDeclaration } from "./router.js";
|
|
8
8
|
/** Static credential placement and destination are reviewed when the app is authored/imported. */
|
|
9
9
|
export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operations" | "definitions"> {
|
|
10
10
|
readonly cache: AppCache;
|
|
@@ -33,8 +33,4 @@ export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operati
|
|
|
33
33
|
/** JSON-object patches are static app configuration and are reapplied to every revision. */
|
|
34
34
|
export declare function patchOpenapi(root: JsonObject, patches: OpenapiSourceOptions["patches"]): JsonObject;
|
|
35
35
|
/** No I/O during app construction. All accounts share credential-free compilation. */
|
|
36
|
-
export declare const
|
|
37
|
-
readonly queries: {};
|
|
38
|
-
readonly mutations: {};
|
|
39
|
-
readonly dynamicTools: DynamicTools;
|
|
40
|
-
};
|
|
36
|
+
export declare const liveOpenapiRouter: (options: OpenapiSourceOptions) => RouterDeclaration;
|
|
@@ -7,16 +7,39 @@ import type { ToolAnnotations } from "../contracts/tools.js";
|
|
|
7
7
|
import type { JsonObject } from "../contracts/schema.js";
|
|
8
8
|
import { type Schema } from "./schema.js";
|
|
9
9
|
declare const NativeOperation: unique symbol;
|
|
10
|
-
declare const
|
|
11
|
-
|
|
10
|
+
declare const QueryHandlerContext: unique symbol;
|
|
11
|
+
declare const MutationHandlerContext: unique symbol;
|
|
12
|
+
/**
|
|
13
|
+
* A server-only declaration with its category preserved for catalog validation. Queries and
|
|
14
|
+
* mutations carry their handler context under different phantom keys, so a router can type a
|
|
15
|
+
* query's handler from its query context alone.
|
|
16
|
+
*/
|
|
12
17
|
export interface OperationDeclaration<Kind extends "query" | "mutation", Context = never> {
|
|
13
|
-
readonly [
|
|
18
|
+
readonly [QueryHandlerContext]?: "query" extends Kind ? (context: Context) => void : never;
|
|
19
|
+
readonly [MutationHandlerContext]?: "mutation" extends Kind ? (context: Context) => void : never;
|
|
14
20
|
readonly kind: Kind;
|
|
15
21
|
readonly [NativeOperation]: Omit<AppOperation<never>, "kind" | "input"> & {
|
|
16
22
|
readonly kind: Kind;
|
|
17
23
|
readonly input: EffectSchema.Decoder<unknown>;
|
|
18
24
|
};
|
|
19
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* A router declaration. The phantom contexts let `defineApp` type inline handlers; protocol
|
|
28
|
+
* routers accept any context because their operations only use the framework's own capabilities.
|
|
29
|
+
* The native router is held under a private key in implementation/router.ts.
|
|
30
|
+
*/
|
|
31
|
+
export interface RouterDeclaration<Query = unknown, Mutation = unknown> {
|
|
32
|
+
readonly [QueryHandlerContext]?: (context: Query) => void;
|
|
33
|
+
readonly [MutationHandlerContext]?: (context: Mutation) => void;
|
|
34
|
+
readonly [NativeRouterKey]: unknown;
|
|
35
|
+
}
|
|
36
|
+
/** An operation or nested router under one key. Each child is typed only by its own kind's context. */
|
|
37
|
+
export interface RouterChild<Query, Mutation> {
|
|
38
|
+
readonly [QueryHandlerContext]?: (context: Query) => void;
|
|
39
|
+
readonly [MutationHandlerContext]?: (context: Mutation) => void;
|
|
40
|
+
}
|
|
41
|
+
/** Private key for a router's native definition. */
|
|
42
|
+
export declare const NativeRouterKey: unique symbol;
|
|
20
43
|
/** Typed operation handles drive browser reference inference without bundling handlers. */
|
|
21
44
|
export interface Operation<Input, Output, Kind extends "query" | "mutation", Context = AppContext> extends OperationDeclaration<Kind, Context> {
|
|
22
45
|
readonly [NativeOperation]: AppOperation<Input, Output> & {
|
|
@@ -17,8 +17,7 @@ interface ProtocolOperation {
|
|
|
17
17
|
readonly run: (context: OperationContext, input: JsonValue) => Effect.Effect<unknown, unknown>;
|
|
18
18
|
}
|
|
19
19
|
/** Unknown behavior defaults to mutation. Classification never enforces an external service's behavior. */
|
|
20
|
-
export declare const protocolOperations: (operations: Readonly<Record<string, ProtocolOperation>>, kinds?: OperationKinds) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
20
|
+
export declare const protocolOperations: (operations: Readonly<Record<string, ProtocolOperation>>, kinds?: OperationKinds) => Record<string, Operation<Schema.Json, unknown, "query" | "mutation", OperationContext>>;
|
|
21
|
+
/** Operations already discovered, as a router keyed by upstream name. */
|
|
22
|
+
export declare const protocolRouter: (operations: Readonly<Record<string, ProtocolOperation>>, kinds?: OperationKinds) => import("./operations.js").RouterDeclaration<unknown, unknown>;
|
|
24
23
|
export {};
|