apps 0.0.1-beta.2 → 0.0.1-beta.21
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 +68 -44
- package/framework-reference.json +1 -1
- package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
- package/js/{chunk-WFSQXYUT.js → chunk-4QQ62BVS.js} +37 -3
- package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
- package/js/chunk-625MBYU4.js +524 -0
- package/js/{chunk-RN2MXB4R.js → chunk-BLI53LPN.js} +28 -9
- package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
- package/js/{chunk-J7O55ZV7.js → chunk-CHAK4P5C.js} +317 -176
- package/js/{chunk-HDTGZWP2.js → chunk-CMRKLZZY.js} +8 -8
- package/js/{chunk-OHRT55C4.js → chunk-IJX4CYZO.js} +3 -6
- package/js/{chunk-FDNTX5QJ.js → chunk-IPI4MFSN.js} +2 -2
- package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
- package/js/chunk-KUMBKVJD.js +39 -0
- package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
- package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
- package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
- package/js/{chunk-D47C7KG5.js → chunk-NKLWZJLE.js} +2 -2
- package/js/chunk-NMKHTJOQ.js +254 -0
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-ZCAMUXSG.js → chunk-ODEIDRGW.js} +3 -4
- package/js/{chunk-5MQZEB6Y.js → chunk-OZ4UK3CD.js} +37 -12
- 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-Z5NMEGJN.js → chunk-RAAPJMVZ.js} +21 -9
- package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
- package/js/{chunk-4LPG6RCH.js → chunk-VFZKSM3T.js} +5 -25
- package/js/{chunk-MYYEW3RA.js → chunk-VXWY44LE.js} +780 -55
- package/js/{chunk-JN55AYQH.js → chunk-XNCYIB4D.js} +61 -32
- package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
- package/js/client.js +10 -26
- package/js/contracts.js +74 -16
- package/js/effect.js +19 -20
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +47 -49
- package/js/host.js +19 -20
- package/js/index.js +232 -201
- package/js/mcp/effect.js +21 -22
- package/js/mcp/stdio.js +25 -26
- package/js/mcp.js +74 -56
- package/js/openapi.js +3428 -1276
- 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 +8 -9
- package/js/ui/auth.js +16 -14
- package/js/ui/contracts.js +4 -4
- package/js/ui/serving.js +71 -218
- 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 +7 -6
- package/types/apps/src/contracts/failure.d.ts +25 -0
- package/types/apps/src/contracts/host.d.ts +31 -10
- 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 +235 -67
- package/types/apps/src/contracts/protocols/2.d.ts +710 -0
- package/types/apps/src/contracts/protocols/3.d.ts +718 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1299 -0
- package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
- package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
- package/types/apps/src/contracts/provider.d.ts +109 -10
- 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/ui-auth.d.ts +6 -14
- package/types/apps/src/contracts/ui.d.ts +18 -0
- 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/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
- package/types/apps/src/implementation/elicitation.d.ts +2 -2
- package/types/apps/src/implementation/failure-detail.d.ts +26 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
- package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
- 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 +9 -5
- package/types/apps/src/implementation/openapi-document.d.ts +15 -2
- package/types/apps/src/implementation/openapi-request.d.ts +8 -1
- package/types/apps/src/implementation/openapi-source.d.ts +2 -6
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +36 -3
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
- package/types/apps/src/implementation/provider.d.ts +19 -5
- package/types/apps/src/implementation/router-catalog.d.ts +225 -0
- package/types/apps/src/implementation/router.d.ts +68 -0
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +44 -1
- package/types/apps/src/implementation/storage.d.ts +5 -3
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +11 -5
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +10 -4
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- 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 +28 -11
- 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/types/apps/src/ui-auth.d.ts +2 -2
- package/types/telemetry/src/browser-operations.d.ts +5 -2
- package/js/chunk-PYUYJRSK.js +0 -93
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-TE4KO4HI.js +0 -47
- 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,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a live router tree into tools, routers and router skills. A nested dynamic router that fails
|
|
3
|
+
* is reported on its own entry; the root failing fails the read, as a single-source app would.
|
|
4
|
+
*/
|
|
5
|
+
import { Effect, Schema } from "effect";
|
|
6
|
+
import { HostDeclarationInvalid, HostEvaluationFailed, type HostRouterError } from "../contracts/host.js";
|
|
7
|
+
import { McpError } from "../contracts/mcp.js";
|
|
8
|
+
import type { AppOperation } from "../contracts/operations.js";
|
|
9
|
+
import type { AppRouter, DynamicRouter, RouterMeta } from "../contracts/router.js";
|
|
10
|
+
import { SkillLoadFailed } from "../contracts/skills.js";
|
|
11
|
+
import type { OperationSchedule } from "../contracts/schedules.js";
|
|
12
|
+
/**
|
|
13
|
+
* Keep only a failure's safe fields. Anything unrecognized becomes an evaluation failure with the
|
|
14
|
+
* error's name and bounded message, with the given account secrets replaced.
|
|
15
|
+
*/
|
|
16
|
+
export declare const safeFailure: (error: unknown, secrets: readonly string[]) => HostRouterError;
|
|
17
|
+
/**
|
|
18
|
+
* Router skills are named `tools` for the root and `tools-<path>` below it, so a router's
|
|
19
|
+
* instructions never take an authored skill's name by accident.
|
|
20
|
+
*/
|
|
21
|
+
export declare const routerSkillPrefix = "tools";
|
|
22
|
+
/**
|
|
23
|
+
* The skill name for a router path. A path of lowercase letters and digits is spelled out:
|
|
24
|
+
* `issues.open` is `tools-issues-open`. Any other path, or one too long, is a readable slug
|
|
25
|
+
* followed by a hash of the exact path, such as `tools-issues-list-0123456789`. Plain segments
|
|
26
|
+
* start with a letter and a hash is all digits, so the two forms never meet, and paths that slug
|
|
27
|
+
* alike, such as `issues_list` and `issues.list`, get different names.
|
|
28
|
+
*/
|
|
29
|
+
export declare const routerSkillName: (path: string) => string;
|
|
30
|
+
/** A declared operation's catalog entry without schemas. `router` is its owning router's path. */
|
|
31
|
+
export declare const operationSummary: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly description: string;
|
|
34
|
+
readonly title?: string;
|
|
35
|
+
readonly annotations?: {
|
|
36
|
+
readonly title?: string;
|
|
37
|
+
readonly readOnlyHint?: boolean;
|
|
38
|
+
readonly destructiveHint?: boolean;
|
|
39
|
+
readonly idempotentHint?: boolean;
|
|
40
|
+
readonly openWorldHint?: boolean;
|
|
41
|
+
};
|
|
42
|
+
readonly schedules?: readonly {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly timing: {
|
|
45
|
+
readonly kind: "interval";
|
|
46
|
+
readonly milliseconds: number;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "cron";
|
|
49
|
+
readonly calendar: {
|
|
50
|
+
readonly expression: string;
|
|
51
|
+
readonly timezone: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly input: Schema.Json;
|
|
55
|
+
}[];
|
|
56
|
+
readonly readOnly?: boolean;
|
|
57
|
+
readonly router?: string;
|
|
58
|
+
readonly tags?: readonly string[];
|
|
59
|
+
}, HostDeclarationInvalid, never>;
|
|
60
|
+
/** A declared operation's full description, including rendered schemas. */
|
|
61
|
+
export declare const operationDescription: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly description: string;
|
|
64
|
+
readonly inputSchema: {
|
|
65
|
+
readonly [x: string]: Schema.Json;
|
|
66
|
+
};
|
|
67
|
+
readonly _meta?: {
|
|
68
|
+
readonly [x: string]: Schema.Json;
|
|
69
|
+
};
|
|
70
|
+
readonly title?: string;
|
|
71
|
+
readonly annotations?: {
|
|
72
|
+
readonly title?: string;
|
|
73
|
+
readonly readOnlyHint?: boolean;
|
|
74
|
+
readonly destructiveHint?: boolean;
|
|
75
|
+
readonly idempotentHint?: boolean;
|
|
76
|
+
readonly openWorldHint?: boolean;
|
|
77
|
+
};
|
|
78
|
+
readonly outputSchema?: {
|
|
79
|
+
readonly [x: string]: Schema.Json;
|
|
80
|
+
};
|
|
81
|
+
readonly schedules?: readonly {
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly timing: {
|
|
84
|
+
readonly kind: "interval";
|
|
85
|
+
readonly milliseconds: number;
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: "cron";
|
|
88
|
+
readonly calendar: {
|
|
89
|
+
readonly expression: string;
|
|
90
|
+
readonly timezone: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
readonly input: Schema.Json;
|
|
94
|
+
}[];
|
|
95
|
+
readonly readOnly?: boolean;
|
|
96
|
+
readonly router?: string;
|
|
97
|
+
readonly tags?: readonly string[];
|
|
98
|
+
}, HostDeclarationInvalid, never>;
|
|
99
|
+
/**
|
|
100
|
+
* A dynamic router over operations already discovered, such as an eager OpenAPI document or a
|
|
101
|
+
* stdio server. Upstream names can contain dots, which static router keys cannot.
|
|
102
|
+
*/
|
|
103
|
+
export declare const fixedRouter: (operations: Readonly<Record<string, AppOperation>>, meta?: RouterMeta) => DynamicRouter;
|
|
104
|
+
export interface CatalogOptions {
|
|
105
|
+
/** Omit schemas. */
|
|
106
|
+
readonly summary: boolean;
|
|
107
|
+
/** Account secrets that a failure's message must not reveal. */
|
|
108
|
+
readonly secrets: readonly string[];
|
|
109
|
+
/** Only these full tool names. Routers with none of them are not read. */
|
|
110
|
+
readonly wanted?: ReadonlySet<string>;
|
|
111
|
+
/** Schedules that target a declared operation, by full name. */
|
|
112
|
+
readonly schedules: (name: string) => readonly OperationSchedule[];
|
|
113
|
+
/**
|
|
114
|
+
* Only declared operations that have schedules. Schedules never target dynamic routers, and
|
|
115
|
+
* their catalogs can be expensive to discover, so none is read.
|
|
116
|
+
*/
|
|
117
|
+
readonly scheduled?: true;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Read a router tree. Every nested router is listed, for grouping; the root only when it has
|
|
121
|
+
* metadata. A nested dynamic source that fails is reported on its router's entry.
|
|
122
|
+
*/
|
|
123
|
+
export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined, options: CatalogOptions) => Effect.Effect<{
|
|
124
|
+
tools: ({
|
|
125
|
+
readonly name: string;
|
|
126
|
+
readonly description: string;
|
|
127
|
+
readonly inputSchema: {
|
|
128
|
+
readonly [x: string]: Schema.Json;
|
|
129
|
+
};
|
|
130
|
+
readonly _meta?: {
|
|
131
|
+
readonly [x: string]: Schema.Json;
|
|
132
|
+
};
|
|
133
|
+
readonly title?: string;
|
|
134
|
+
readonly annotations?: {
|
|
135
|
+
readonly title?: string;
|
|
136
|
+
readonly readOnlyHint?: boolean;
|
|
137
|
+
readonly destructiveHint?: boolean;
|
|
138
|
+
readonly idempotentHint?: boolean;
|
|
139
|
+
readonly openWorldHint?: boolean;
|
|
140
|
+
};
|
|
141
|
+
readonly outputSchema?: {
|
|
142
|
+
readonly [x: string]: Schema.Json;
|
|
143
|
+
};
|
|
144
|
+
readonly schedules?: readonly {
|
|
145
|
+
readonly name: string;
|
|
146
|
+
readonly timing: {
|
|
147
|
+
readonly kind: "interval";
|
|
148
|
+
readonly milliseconds: number;
|
|
149
|
+
} | {
|
|
150
|
+
readonly kind: "cron";
|
|
151
|
+
readonly calendar: {
|
|
152
|
+
readonly expression: string;
|
|
153
|
+
readonly timezone: string;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
readonly input: Schema.Json;
|
|
157
|
+
}[];
|
|
158
|
+
readonly readOnly?: boolean;
|
|
159
|
+
readonly router?: string;
|
|
160
|
+
readonly tags?: readonly string[];
|
|
161
|
+
} | {
|
|
162
|
+
readonly name: string;
|
|
163
|
+
readonly description: string;
|
|
164
|
+
readonly title?: string;
|
|
165
|
+
readonly annotations?: {
|
|
166
|
+
readonly title?: string;
|
|
167
|
+
readonly readOnlyHint?: boolean;
|
|
168
|
+
readonly destructiveHint?: boolean;
|
|
169
|
+
readonly idempotentHint?: boolean;
|
|
170
|
+
readonly openWorldHint?: boolean;
|
|
171
|
+
};
|
|
172
|
+
readonly schedules?: readonly {
|
|
173
|
+
readonly name: string;
|
|
174
|
+
readonly timing: {
|
|
175
|
+
readonly kind: "interval";
|
|
176
|
+
readonly milliseconds: number;
|
|
177
|
+
} | {
|
|
178
|
+
readonly kind: "cron";
|
|
179
|
+
readonly calendar: {
|
|
180
|
+
readonly expression: string;
|
|
181
|
+
readonly timezone: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
readonly input: Schema.Json;
|
|
185
|
+
}[];
|
|
186
|
+
readonly readOnly?: boolean;
|
|
187
|
+
readonly router?: string;
|
|
188
|
+
readonly tags?: readonly string[];
|
|
189
|
+
})[];
|
|
190
|
+
routers: {
|
|
191
|
+
readonly path: string;
|
|
192
|
+
readonly error?: import("../index.js").ProviderError | SkillLoadFailed | McpError | HostDeclarationInvalid | HostEvaluationFailed;
|
|
193
|
+
readonly description?: string;
|
|
194
|
+
readonly title?: string;
|
|
195
|
+
readonly tags?: {
|
|
196
|
+
readonly [x: string]: string;
|
|
197
|
+
};
|
|
198
|
+
readonly icons?: readonly {
|
|
199
|
+
readonly src: string;
|
|
200
|
+
readonly mimeType?: string;
|
|
201
|
+
readonly sizes?: readonly string[];
|
|
202
|
+
readonly theme?: "light" | "dark";
|
|
203
|
+
}[];
|
|
204
|
+
readonly skill?: string;
|
|
205
|
+
}[];
|
|
206
|
+
}, import("../index.js").ProviderError | SkillLoadFailed | McpError | HostDeclarationInvalid | HostEvaluationFailed, never>;
|
|
207
|
+
/**
|
|
208
|
+
* One skill for each router with instructions. Skills and tools fail independently: a dynamic
|
|
209
|
+
* router whose metadata cannot be read, including the root, contributes no skill and does not
|
|
210
|
+
* fail the others. Metadata comes through each source's catalog cache, like a tool listing.
|
|
211
|
+
*/
|
|
212
|
+
export declare const routerSkills: (root: AppRouter | DynamicRouter | undefined) => Effect.Effect<{
|
|
213
|
+
readonly name: string;
|
|
214
|
+
readonly description: string;
|
|
215
|
+
readonly files: readonly {
|
|
216
|
+
readonly path: string;
|
|
217
|
+
readonly content: string;
|
|
218
|
+
}[];
|
|
219
|
+
readonly license?: string;
|
|
220
|
+
readonly compatibility?: string;
|
|
221
|
+
readonly metadata?: {
|
|
222
|
+
readonly [x: string]: string;
|
|
223
|
+
};
|
|
224
|
+
readonly "allowed-tools"?: string;
|
|
225
|
+
}[], never, never>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { HostedTool } from "../contracts/host.js";
|
|
2
|
+
import type { AppOperation } from "../contracts/operations.js";
|
|
3
|
+
import { RouterMeta, type AppRouter, type DynamicRouter, type RouterIcon } from "../contracts/router.js";
|
|
4
|
+
import type { Approval } from "../approval.js";
|
|
5
|
+
import { type OperationDeclaration, type RouterChild, type RouterDeclaration } from "./operations.js";
|
|
6
|
+
export type { RouterChild, RouterDeclaration } from "./operations.js";
|
|
7
|
+
/** Author metadata for a router. Instructions become a skill named after the router's path. */
|
|
8
|
+
export interface RouterOptions {
|
|
9
|
+
readonly title?: string;
|
|
10
|
+
readonly description?: string;
|
|
11
|
+
readonly instructions?: string;
|
|
12
|
+
readonly icons?: readonly RouterIcon[];
|
|
13
|
+
readonly tags?: Readonly<Record<string, string>>;
|
|
14
|
+
}
|
|
15
|
+
/** Wrap a native router. Protocol helpers use this for the routers they build. */
|
|
16
|
+
export declare const routerDeclaration: (node: AppRouter | DynamicRouter) => RouterDeclaration;
|
|
17
|
+
/** Accept only framework-created routers. */
|
|
18
|
+
export declare const nativeRouter: (value: unknown) => AppRouter | DynamicRouter | undefined;
|
|
19
|
+
/** Author fields win; a field the author omits keeps the source's value. */
|
|
20
|
+
export declare const mergeMeta: (base: RouterMeta | undefined, override: RouterMeta | undefined) => RouterMeta | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Group operations and routers under path keys, like tRPC's nested routers, with metadata an
|
|
23
|
+
* agent can read. Passing an existing router instead of children overrides its metadata:
|
|
24
|
+
* `router(mcpRouter(options), { description: "..." })`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function router<Query = unknown, Mutation = unknown>(children: Readonly<Record<string, RouterChild<Query, Mutation>>>, options?: RouterOptions): RouterDeclaration<Query, Mutation>;
|
|
27
|
+
export declare function router<Query, Mutation>(source: RouterDeclaration<Query, Mutation>, options: RouterOptions): RouterDeclaration<Query, Mutation>;
|
|
28
|
+
/**
|
|
29
|
+
* Declare a router whose tools are discovered when read. `list` returns tools with names relative
|
|
30
|
+
* to this router; mark queries with `readOnly: true`. `resolve` receives one of those names.
|
|
31
|
+
*/
|
|
32
|
+
export declare const dynamicRouter: (source: {
|
|
33
|
+
readonly meta?: () => RouterOptions | Promise<RouterOptions>;
|
|
34
|
+
readonly list: () => readonly HostedTool[] | Promise<readonly HostedTool[]>;
|
|
35
|
+
readonly resolve: (name: string) => OperationDeclaration<"query" | "mutation", unknown> | undefined | Promise<OperationDeclaration<"query" | "mutation", unknown> | undefined>;
|
|
36
|
+
}) => RouterDeclaration;
|
|
37
|
+
/** Join a router path and a relative name. The root router's path is "". */
|
|
38
|
+
export declare const joinPath: (path: string, name: string) => string;
|
|
39
|
+
/** Where a full tool name points: a declared operation, or a name inside a dynamic router. */
|
|
40
|
+
export type Location = {
|
|
41
|
+
readonly kind: "operation";
|
|
42
|
+
readonly operation: AppOperation;
|
|
43
|
+
readonly router: string;
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: "dynamic";
|
|
46
|
+
readonly source: DynamicRouter;
|
|
47
|
+
readonly router: string;
|
|
48
|
+
readonly name: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Walk static keys until the name ends at an operation or enters a dynamic router, which receives
|
|
52
|
+
* the rest of the name. Static keys contain no dots, so every name has at most one location.
|
|
53
|
+
*/
|
|
54
|
+
export declare const locate: (root: AppRouter | DynamicRouter | undefined, name: string) => Location | undefined;
|
|
55
|
+
/** Every declared operation with its full name and owning router. Dynamic routers are not listed. */
|
|
56
|
+
export declare const declaredOperations: (root: AppRouter | undefined, path?: string) => Array<{
|
|
57
|
+
readonly name: string;
|
|
58
|
+
readonly router: string;
|
|
59
|
+
readonly operation: AppOperation;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Choose an approval for each operation a router contains, including tools a dynamic router
|
|
63
|
+
* resolves later. `policy` receives the operation and its name relative to this router; returning
|
|
64
|
+
* undefined keeps the operation's own approval. Read hints with `toolAnnotations(operation)`.
|
|
65
|
+
* Apply it to each account's router before `accountRouter` combines them, so every account keeps
|
|
66
|
+
* its own tools' hints.
|
|
67
|
+
*/
|
|
68
|
+
export declare const withApprovals: <Query, Mutation>(source: RouterDeclaration<Query, Mutation>, policy: (operation: OperationDeclaration<"query" | "mutation", never>, name: string) => Approval | undefined) => RouterDeclaration<Query, Mutation>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Let the runtime run its own tasks between long synchronous steps. In a Worker, a large OpenAPI
|
|
3
|
+
* compilation that never yields leaves the garbage collector only long, full pauses; yielding
|
|
4
|
+
* between steps measurably shortens it. A timer is used because a resolved promise would continue
|
|
5
|
+
* without leaving the current task.
|
|
6
|
+
*/
|
|
7
|
+
export declare const yieldToRuntime: () => Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** Author schema facade. Internals use the native decoder retained by each value. */
|
|
2
2
|
import { Effect, Schema as EffectSchema } from "effect";
|
|
3
|
-
import {
|
|
3
|
+
import { JsonObject, ValidationError } from "../contracts/schema.js";
|
|
4
4
|
import type { Field } from "../../../app-data/src/contracts/database.js";
|
|
5
|
+
import type { FieldExposure } from "../contracts/provider.js";
|
|
5
6
|
declare const StorageField: unique symbol;
|
|
6
7
|
declare const Decoder: unique symbol;
|
|
7
8
|
/** An author-facing value schema. Effect is never required in author code. */
|
|
@@ -59,6 +60,44 @@ export declare function literal<const T extends string | number | boolean | null
|
|
|
59
60
|
export declare const array: <T>(item: Schema<T, boolean>) => Schema<readonly T[]>;
|
|
60
61
|
/** Parse declared fields and omit undeclared fields. */
|
|
61
62
|
export declare function object<const F extends Fields>(fields: F): ObjectSchema<F>;
|
|
63
|
+
declare const Exposure: unique symbol;
|
|
64
|
+
/** A schema marked with how app code sees the field in a provider that declares hosts. */
|
|
65
|
+
export type Exposed<S, E extends FieldExposure = FieldExposure> = S & {
|
|
66
|
+
readonly [Exposure]: E;
|
|
67
|
+
};
|
|
68
|
+
/** The marking of one account field, if any. */
|
|
69
|
+
export declare const exposureOf: (schema: Schema<unknown, boolean>) => FieldExposure | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* A field that is not secret, such as a subdomain or region. App code reads its real value and
|
|
72
|
+
* the connect form shows it.
|
|
73
|
+
*/
|
|
74
|
+
export declare const plain: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "plain">;
|
|
75
|
+
/**
|
|
76
|
+
* A secret field that app code reads as its real value, for request signing and similar uses.
|
|
77
|
+
* The connect form warns that the app can read it. Prefer an unmarked field, which app code
|
|
78
|
+
* receives as a handle that only reaches the provider's declared hosts.
|
|
79
|
+
*/
|
|
80
|
+
export declare const raw: <S extends Schema<unknown, boolean>>(schema: S) => Exposed<S, "raw">;
|
|
81
|
+
/** Marked fields of an account object, by name. */
|
|
82
|
+
export declare const fieldExposure: (fields: Fields) => Readonly<Record<string, FieldExposure>>;
|
|
83
|
+
declare const Secret: unique symbol;
|
|
84
|
+
/**
|
|
85
|
+
* A secret account value. In a provider that declares hosts it is a handle, which the host's
|
|
86
|
+
* outbound network replaces with the real value only on requests to those hosts. Pass it to
|
|
87
|
+
* clients and headers as an ordinary string; do not decode or transform it.
|
|
88
|
+
*/
|
|
89
|
+
export type SecretString = string & {
|
|
90
|
+
readonly [Secret]: true;
|
|
91
|
+
};
|
|
92
|
+
type Sealed<T> = T extends string ? SecretString : T;
|
|
93
|
+
/** Account fields as app code receives them: unmarked string fields are secret. */
|
|
94
|
+
export type SecretFields<F extends Fields> = {
|
|
95
|
+
readonly [Key in keyof ObjectValue<F>]: Key extends keyof F ? F[Key] extends Exposed<unknown> ? ObjectValue<F>[Key] : Sealed<ObjectValue<F>[Key]> : ObjectValue<F>[Key];
|
|
96
|
+
};
|
|
97
|
+
/** An account object without declared fields, such as a default OAuth projection. */
|
|
98
|
+
export type SecretObject<T> = {
|
|
99
|
+
readonly [Key in keyof T]: Sealed<T[Key]>;
|
|
100
|
+
};
|
|
62
101
|
declare const ImportedJsonSchema: unique symbol;
|
|
63
102
|
/** Read the original document for an imported decoder without a lossy schema round trip. */
|
|
64
103
|
export declare const importedJsonSchema: (decoder: EffectSchema.Decoder<unknown>) => unknown | undefined;
|
|
@@ -91,4 +130,8 @@ export declare const storageFieldOf: (schema: Schema<unknown, boolean>) => Field
|
|
|
91
130
|
export declare const id: (table: string) => Schema<string>;
|
|
92
131
|
/** A host user identifier, stored as a string without imposing a product auth model. */
|
|
93
132
|
export declare const userId: () => Schema<string>;
|
|
133
|
+
/** Render a decoder as a JSON Schema document, keeping an imported upstream document as-is. */
|
|
134
|
+
export declare const jsonSchemaDocument: (decoder: EffectSchema.Decoder<unknown>) => Effect.Effect<{
|
|
135
|
+
readonly [x: string]: EffectSchema.Json;
|
|
136
|
+
}, EffectSchema.SchemaError, never>;
|
|
94
137
|
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { type DatabaseSession } from "../../../app-data/src/index.js";
|
|
1
|
+
import { type DatabaseSession, type reservedFieldNames } from "../../../app-data/src/index.js";
|
|
2
|
+
type ReservedFieldName = (typeof reservedFieldNames)[number];
|
|
2
3
|
import { type AppStorage } from "../contracts/storage.js";
|
|
3
4
|
import type { DatabaseDefinition, Database, Table, Tables } from "../contracts/storage.js";
|
|
4
5
|
import { type Fields } from "./schema.js";
|
|
5
6
|
export type { DatabaseDefinition, Database, DatabaseReader, Table, Tables, RowOf, } from "../contracts/storage.js";
|
|
6
|
-
/** Declare scalar columns using the same schemas as operation inputs.
|
|
7
|
-
|
|
7
|
+
/** Declare scalar columns using the same schemas as operation inputs. The host adds `id`,
|
|
8
|
+
* `createdAt` and `updatedAt` to every row, so tables cannot declare those names. */
|
|
9
|
+
export declare const table: <const F extends Fields & { readonly [K in ReservedFieldName]?: never; }>(fields: F) => Table<F>;
|
|
8
10
|
/** Build a fresh Promise database facade for one authorized invocation. */
|
|
9
11
|
export declare const authorDatabase: <T extends Tables>(tables: T, session: DatabaseSession, signal: AbortSignal, writable: boolean) => Database<T>;
|
|
10
12
|
/** Declare storage independently of handlers; the host binds each invocation's database. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Host-rendered account notices; no authored app code or provider responses enter them. */
|
|
2
|
+
import type { UiAccountNotice, UiAccountProblem } from "../contracts/ui.js";
|
|
3
|
+
/** Missing, removed, incompatible, or rejected accounts stop the app; other failed checks are advisory. */
|
|
4
|
+
export declare const accountProblemBlocks: (problem: UiAccountProblem) => boolean;
|
|
5
|
+
export declare const accountProblemText: (problem: UiAccountProblem) => string;
|
|
6
|
+
/** Full page shown instead of the app while an account problem stops it from working. */
|
|
7
|
+
export declare const accountBlockedPage: (notice: UiAccountNotice) => string;
|
|
8
|
+
/** Inline card for advisory problems; the app still loads underneath. */
|
|
9
|
+
export declare const accountNoticeBootstrap: (notice: UiAccountNotice) => string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Host responses around app sign-in. They carry no script and never contain product credentials. */
|
|
2
2
|
import { HttpServerResponse } from "effect/unstable/http";
|
|
3
|
+
import { type AppSignInId } from "../contracts/ui-auth.js";
|
|
3
4
|
/** Private app responses must not leak authentication URLs through caches or referrers. */
|
|
4
5
|
export declare const appPrivateHeaders: {
|
|
5
6
|
"cache-control": string;
|
|
@@ -7,7 +8,12 @@ export declare const appPrivateHeaders: {
|
|
|
7
8
|
"x-content-type-options": string;
|
|
8
9
|
"content-security-policy": string;
|
|
9
10
|
};
|
|
10
|
-
/**
|
|
11
|
-
export declare const
|
|
12
|
-
/**
|
|
13
|
-
|
|
11
|
+
/** Every sign-in hop is a server redirect, so the browser paints nothing until the app itself. */
|
|
12
|
+
export declare const appRedirect: (url: string) => HttpServerResponse.HttpServerResponse;
|
|
13
|
+
/**
|
|
14
|
+
* The callback URL carries the code in its query. It exists only as a redirect `Location`, never as
|
|
15
|
+
* a rendered document, and redeeming it also requires the attempt's HttpOnly cookie.
|
|
16
|
+
*/
|
|
17
|
+
export declare const appSignInCallback: (origin: string, request: AppSignInId, code: string) => string;
|
|
18
|
+
/** A failed callback explains itself without script; reopening the app URL starts a new attempt. */
|
|
19
|
+
export declare const appSignInFailed: () => HttpServerResponse.HttpServerResponse;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Inline host script: no app dependencies, credentials, or authored HTML enter its source. */
|
|
2
|
-
export declare const appFailureBootstrap:
|
|
2
|
+
export declare const appFailureBootstrap = "<script>\"use strict\";(()=>{var D=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,A=/^(?:chrome|moz|safari-web)-extension:/,R=new Set([\"Error\",\"TypeError\",\"ReferenceError\",\"SyntaxError\",\"RangeError\",\"URIError\",\"EvalError\",\"AggregateError\"]),x=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith(\"/_executor/assets/\")||!a.pathname.endsWith(\".js\")||(r.push({key:\"code.file.path\",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:\"code.line.number\",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:\"code.column.number\",value:{intValue:String(i)}})),r},E=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,b=f.get(a);if(b!==void 0&&r-b<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:\"executor.ui.failure.suppressed\",value:{intValue:String(g)}}),g=0;let h=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,\"0\")).join(\"\"),S=`${Date.now()}000000`,n,u=\"Sending error report\\u2026\",k=()=>{if(d?.open)return;let s=document.createElement(\"div\"),V=s.attachShadow({mode:\"open\"}),o=document.createElement(\"dialog\");d=o,o.setAttribute(\"aria-labelledby\",\"executor-failure-title\");let y=document.createElement(\"h2\");y.id=\"executor-failure-title\",y.textContent=e===\"script\"?\"This app could not load\":\"This app stopped working\";let C=document.createElement(\"p\");C.textContent=e===\"script\"?\"A file needed by this page did not load. Reload the page to try again.\":\"The app encountered an unexpected error. Reload the page to try again.\";let L=document.createElement(\"p\");L.textContent=\"Copy any unsaved work before reloading.\";let T=document.createElement(\"details\"),v=document.createElement(\"summary\");v.textContent=\"Error details\";let c=document.createElement(\"textarea\");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute(\"aria-label\",\"Error details\"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${h}`,T.append(v,c),n=document.createElement(\"p\"),n.setAttribute(\"role\",\"status\"),n.textContent=u;let l=document.createElement(\"button\");l.type=\"button\",l.textContent=\"Reload page\",l.addEventListener(\"click\",()=>location.reload());let p=document.createElement(\"button\");p.type=\"button\",p.textContent=\"Close\",p.addEventListener(\"click\",()=>o.close()),o.addEventListener(\"close\",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,T,n,l,p),V.append(o),document.documentElement.append(s),o.showModal()};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",k,{once:!0}):k(),fetch(\"/_executor/api/telemetry/traces\",{method:\"POST\",headers:{\"content-type\":\"application/json\"},credentials:\"same-origin\",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:h,spanId:h.slice(0,16),name:\"ui.app.failure\",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:\"executor.ui.failure.kind\",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{u=s.ok?\"Error report sent.\":\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)},()=>{u=\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)})};window.addEventListener(\"error\",e=>{if(e instanceof ErrorEvent){if(A.test(e.filename))return;let t=x(e.filename,e.lineno,e.colno);e.error instanceof Error&&R.has(e.error.name)&&t.push({key:\"exception.type\",value:{stringValue:e.error.name}}),E(\"runtime\",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&E(\"script\",`Could not load script: ${e.target.src}`,x(e.target.src))},!0),window.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;E(\"rejection\",t instanceof Error?t.stack??t.message:\"An app operation failed without handling its error.\")})};D();})();</script>";
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
3
|
-
import { UiForbidden, type AppUiAsset } from "../contracts/ui.js";
|
|
4
|
-
/**
|
|
3
|
+
import { UiForbidden, type AppUiAsset, type UiAccountNotice } from "../contracts/ui.js";
|
|
4
|
+
/**
|
|
5
|
+
* Render an authorized deployment with a host-owned deployment watcher. Account problems that stop
|
|
6
|
+
* the app replace its document with a page that links to their fix; others add a dismissible card.
|
|
7
|
+
*/
|
|
5
8
|
export declare const appDocument: <E, R>(options: {
|
|
6
9
|
readonly deployment: string;
|
|
7
10
|
readonly profile?: string | undefined;
|
|
8
11
|
readonly expectedProfileRevision?: number | undefined;
|
|
9
12
|
readonly origin: string;
|
|
13
|
+
readonly accounts?: UiAccountNotice | undefined;
|
|
10
14
|
readonly asset: (path: string) => Effect.Effect<AppUiAsset | undefined, E, R>;
|
|
11
15
|
}) => Effect.Effect<HttpServerResponse.HttpServerResponse, UiForbidden | E, HttpServerRequest.HttpServerRequest | R>;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
16
|
+
/** Serve an asset only after the host has checked current access and file existence.
|
|
17
|
+
* Asset URLs name their deployment, so their bytes never change: the browser keeps them for a year
|
|
18
|
+
* and does not ask again. Shared proxies never store them. Revoking access stops every new request
|
|
19
|
+
* and all app data, while bytes a browser already downloaded stay in its cache.
|
|
14
20
|
* HTML remains an uncached host-rendered entry point.
|
|
15
21
|
*/
|
|
16
22
|
export declare const appAsset: (asset: AppUiAsset | undefined, build: string, path: string) => Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpServerRequest.HttpServerRequest>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Dependency-free browser source served by each host after app authorization. */
|
|
2
|
-
export declare const appWatchScript
|
|
2
|
+
export declare const appWatchScript = "\"use strict\";(()=>{var s=()=>{let i=document.getElementById(\"executor-context\")?.textContent;if(!i)return;let n=JSON.parse(i);if(typeof n!=\"object\"||n===null||!(\"deployment\"in n))return;let r=n.deployment;if(typeof r!=\"string\"||r.length===0)return;let t=new EventSource(\"/_executor/version\"),l=!1,o=()=>{l||(l=!0,t.close(),location.reload())};t.addEventListener(\"version\",d=>{let e=JSON.parse(d.data);typeof e==\"object\"&&e!==null&&\"deployment\"in e&&(e.deployment===null||typeof e.deployment==\"string\")&&e.deployment!==r&&o()}),t.addEventListener(\"revoked\",o),window.addEventListener(\"executor:deployment-changed\",o),window.addEventListener(\"pagehide\",()=>t.close(),{once:!0}),window.addEventListener(\"pageshow\",d=>{d.persisted&&o()})};s();})();";
|
|
@@ -26,4 +26,4 @@ export declare const dispatchWebhook: <Context extends {
|
|
|
26
26
|
readonly [x: string]: string;
|
|
27
27
|
};
|
|
28
28
|
readonly body: string;
|
|
29
|
-
},
|
|
29
|
+
}, HostOperationNotFound | HostInputInvalid | HostOutputInvalid | HostDeclarationInvalid | HostOperationFailed, never>;
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import type { AppDefinition } from "../contracts/app.js";
|
|
4
4
|
import { WorkflowFailure, type WorkflowContext, type WorkflowExecution, type WorkflowStepContext } from "../contracts/workflows.js";
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Preserve typed failures and cancellation. Other errors keep their name and bounded message,
|
|
7
|
+
* with the given account secrets replaced.
|
|
8
|
+
*/
|
|
9
|
+
export declare const workflowSafe: <A>(work: Effect.Effect<A, unknown>, secrets: readonly string[]) => Effect.Effect<A, WorkflowFailure>;
|
|
7
10
|
/** Construct one replay's Promise context. Step callbacks acquire fresh capabilities per actual attempt. */
|
|
8
|
-
export declare const makeWorkflowContext: (execution: WorkflowExecution, definition: Pick<AppDefinition<never>, "
|
|
11
|
+
export declare const makeWorkflowContext: (execution: WorkflowExecution, definition: Pick<AppDefinition<never>, "tools">,
|
|
12
|
+
/** A step attempt's context, and the raw account secrets its failures must not reveal. */
|
|
13
|
+
fresh: (stepId: string, signal: AbortSignal) => Effect.Effect<{
|
|
14
|
+
readonly context: WorkflowStepContext;
|
|
15
|
+
readonly secrets: readonly string[];
|
|
16
|
+
}, WorkflowFailure>, signal: AbortSignal) => Effect.Effect<WorkflowContext>;
|
|
@@ -8,32 +8,49 @@ export { CacheError } from "../../app-cache/src/contracts/cache.js";
|
|
|
8
8
|
import { type Schema as EffectSchema } from "effect";
|
|
9
9
|
import type { WebhookContext } from "./contracts/context.js";
|
|
10
10
|
import { type JsonResponse as NativeResponse } from "./contracts/http.js";
|
|
11
|
-
import { type OAuth2Config, type OAuth2Method as NativeOAuth2Method, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
|
|
11
|
+
import { type OAuth2Config as NativeOAuth2Config, type OAuth2Method as NativeOAuth2Method, type ReservedAuthorizationParam, type SecretsMethod as NativeSecretsMethod } from "./contracts/provider.js";
|
|
12
12
|
import type { Webhook as NativeWebhook } from "./contracts/webhooks.js";
|
|
13
13
|
import { type PromiseMethods } from "./implementation/authoring.js";
|
|
14
|
-
import { type Fields, type Infer, type ObjectSchema, type Schema } from "./implementation/schema.js";
|
|
14
|
+
import { type Fields, type Infer, type ObjectSchema, type Schema, type SecretFields, type SecretObject } from "./implementation/schema.js";
|
|
15
15
|
export { type JsonObject, type JsonValue, ValidationError } from "./contracts/schema.js";
|
|
16
|
-
export { type Fields, type Infer, type ObjectSchema, type ObjectValue, type Schema, array, boolean, json, jsonSchema, literal, number, object, record, string, } from "./implementation/schema.js";
|
|
17
|
-
export { type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type
|
|
18
|
-
export { defineProvider } from "./implementation/provider.js";
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
16
|
+
export { type Fields, type Infer, type ObjectSchema, type ObjectValue, type Schema, array, boolean, json, jsonSchema, literal, number, object, record, string, plain, raw, type SecretString, } from "./implementation/schema.js";
|
|
17
|
+
export { type AccountCheckContext, type AccountCheckResult, type AccountInfo, type AccountOf, type AuthMethod, type AuthMethodData, type AuthMethods, type ManyAccounts, type Provider, type ReservedAuthorizationParam, } from "./contracts/provider.js";
|
|
18
|
+
export { defineProvider, type ProviderOptions } from "./implementation/provider.js";
|
|
19
|
+
export { accountRouter } from "./implementation/account-router.js";
|
|
20
|
+
export { router, dynamicRouter, withApprovals, type RouterDeclaration, type RouterChild, type RouterOptions, } from "./implementation/router.js";
|
|
21
|
+
export type { RouterIcon } from "./contracts/router.js";
|
|
21
22
|
export { dynamicSkills } from "./implementation/dynamic-skills.js";
|
|
22
23
|
export type { HostedTool as OperationDescription } from "./contracts/host.js";
|
|
24
|
+
/** Account fields as app code receives them from a method declared with this schema. */
|
|
25
|
+
type AccountFields<S> = S extends ObjectSchema<infer F> ? SecretFields<F> : SecretObject<Infer<S>>;
|
|
23
26
|
/** A secrets declaration inferred from an author schema. */
|
|
24
|
-
export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<
|
|
27
|
+
export type SecretsMethod<Shape extends ObjectSchema<Fields>> = NativeSecretsMethod<EffectSchema.Decoder<AccountFields<Shape>>>;
|
|
25
28
|
/** An OAuth declaration inferred from its author-facing response schema. */
|
|
26
|
-
export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAuth2Method<EffectSchema.Decoder<
|
|
29
|
+
export type OAuth2Method<Response extends Schema<unknown, boolean>> = NativeOAuth2Method<EffectSchema.Decoder<AccountFields<Response>>>;
|
|
27
30
|
/** Default OAuth fields visible to app code. Host-only grants and clients stay private. */
|
|
28
31
|
export declare const OAuth2AccessToken: Schema<{
|
|
29
32
|
readonly access_token: string;
|
|
30
33
|
}, false>;
|
|
34
|
+
/**
|
|
35
|
+
* OAuth options as authors write them. `authorizationParams` naming a host-owned protocol
|
|
36
|
+
* parameter such as `state` or `scope` is a type error as well as a declaration failure.
|
|
37
|
+
*/
|
|
38
|
+
export type OAuth2Config = WithoutReservedParams<NativeOAuth2Config>;
|
|
39
|
+
type WithoutReservedParams<Config> = Config extends unknown ? "authorizationParams" extends keyof Config ? Config & {
|
|
40
|
+
readonly authorizationParams?: {
|
|
41
|
+
readonly [Key in ReservedAuthorizationParam]?: never;
|
|
42
|
+
};
|
|
43
|
+
} : Config : never;
|
|
31
44
|
/** Declare a secrets method without requiring an Effect schema from the author. */
|
|
32
45
|
export declare const secrets: <const F extends Fields>(options: {
|
|
33
46
|
readonly label: string;
|
|
34
47
|
readonly fields: ObjectSchema<F>;
|
|
35
48
|
}) => SecretsMethod<ObjectSchema<F>>;
|
|
36
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Declare OAuth discovery/endpoints and an optional app-visible response projection.
|
|
51
|
+
* `authorizationParams` adds service-defined sign-in parameters; a declared `authorizationUrl`
|
|
52
|
+
* keeps its own query. Neither can set host-owned parameters, and each parameter appears once.
|
|
53
|
+
*/
|
|
37
54
|
export declare function oauth2(options: OAuth2Config): OAuth2Method<typeof OAuth2AccessToken>;
|
|
38
55
|
export declare function oauth2<Response extends Schema<unknown, boolean>>(options: OAuth2Config & {
|
|
39
56
|
readonly response: Response;
|
|
@@ -57,7 +74,7 @@ export { NotImplemented } from "./contracts/app.js";
|
|
|
57
74
|
export { ElicitationFailed, type FormElicitation, type ElicitationResponse, type Elicit, } from "./contracts/elicitation.js";
|
|
58
75
|
export { table, defineDatabase, type Table, type DatabaseReader, type Database, type DatabaseDefinition, } from "./implementation/storage.js";
|
|
59
76
|
export { id, userId } from "./implementation/schema.js";
|
|
60
|
-
export { query, mutation, withApproval, type Operation, type OperationOptions, } from "./implementation/operations.js";
|
|
77
|
+
export { query, mutation, withApproval, toolAnnotations, type Operation, type OperationOptions, } from "./implementation/operations.js";
|
|
61
78
|
export type { OperationContext } from "./contracts/operations.js";
|
|
62
79
|
export { workflow, type Workflow, type WorkflowDeclaration } from "./implementation/workflows.js";
|
|
63
80
|
export { NonRetryableError, WorkflowFailure, type WorkflowContext, type WorkflowStepContext, type WorkflowStep, type WorkflowStepOptions, type WorkflowDuration, type WorkflowReads, type WorkflowControls, } from "./contracts/workflows.js";
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ProcessConfig } from "./contracts/mcp.js";
|
|
2
2
|
import { type OperationKinds } from "./implementation/protocol-operations.js";
|
|
3
3
|
export { McpError, type McpToolContext, type ProcessConfig } from "./contracts/mcp.js";
|
|
4
|
-
/** Discover an account's tools; each discovery and call owns and closes its subprocess. */
|
|
5
|
-
export declare const
|
|
6
|
-
queries: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "query", import("./index.js").OperationContext>>;
|
|
7
|
-
mutations: Record<string, import("./index.js").Operation<import("effect/Schema").Json, unknown, "mutation", import("./index.js").OperationContext>>;
|
|
8
|
-
}>;
|
|
4
|
+
/** Discover an account's tools as a router; each discovery and call owns and closes its subprocess. */
|
|
5
|
+
export declare const stdioRouter: (config: ProcessConfig, signal?: AbortSignal, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
package/types/apps/src/mcp.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
|
3
3
|
import { type McpCatalogOptions } from "./implementation/mcp-catalog.js";
|
|
4
4
|
export type { McpCatalogOptions } from "./implementation/mcp-catalog.js";
|
|
5
5
|
export { McpError, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A router over a server's tools for the selected account. Its title, description and
|
|
8
|
+
* instructions come from the server. Kinds override uncertain upstream read-only hints.
|
|
9
|
+
*/
|
|
10
|
+
export declare const mcpRouter: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
10
11
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { type OperationKinds } from "./implementation/protocol-operations.js";
|
|
3
3
|
import type { OpenapiToolsOptions } from "./contracts/openapi.js";
|
|
4
4
|
export { OpenapiError, isOpenapiTextMedia, openapiBinaryResultSchema, OpenapiErrorResponse, type OpenapiToolsOptions, type OpenapiOperation, type CredentialBinding, OpenapiParameter, OpenapiRequestBody, openapiMediaKind, } from "./contracts/openapi.js";
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Discover a document's operations as a router for the selected account. Kinds override uncertain
|
|
7
|
+
* upstream read-only hints. Mount it under a key, or override its metadata with `router(...)`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const openapiRouter: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
10
10
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
11
11
|
export * from "./contracts/openapi-compile.js";
|
|
12
|
-
export {
|
|
12
|
+
export { liveOpenapiRouter, type OpenapiSourceOptions } from "./implementation/openapi-source.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** Host-only app authentication protocol
|
|
1
|
+
/** Host-only app authentication protocol; products supply identity and session lifecycle. */
|
|
2
2
|
export * from "./contracts/ui-auth.js";
|
|
3
|
-
export { appPrivateHeaders,
|
|
3
|
+
export { appPrivateHeaders, appRedirect, appSignInCallback, appSignInFailed, } from "./implementation/ui-auth.js";
|