apps 0.0.1-beta.4 → 0.0.1-beta.41
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-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
- package/js/{chunk-EQB7JMAL.js → chunk-6XGB4BAL.js} +146 -31
- package/js/chunk-ADD6H64X.js +729 -0
- package/js/{chunk-6VRYO2BG.js → chunk-AHGGO2VY.js} +837 -254
- package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
- package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
- package/js/chunk-EM4UL26F.js +118 -0
- package/js/{chunk-2VPJHFOU.js → chunk-FXWRE655.js} +128 -24
- package/js/{chunk-5MQZEB6Y.js → chunk-JI3EP2GL.js} +40 -12
- package/js/chunk-JJSLEJ6T.js +156 -0
- package/js/chunk-KAQD3DTI.js +16 -0
- package/js/chunk-KIM5HXNK.js +49 -0
- package/js/chunk-MJZYV7IO.js +255 -0
- package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
- package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
- package/js/chunk-P7MGDPFD.js +240 -0
- package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
- package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
- package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
- package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
- package/js/chunk-UTJIGUSS.js +42 -0
- package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
- package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
- package/js/{chunk-WFSQXYUT.js → chunk-WPBR4AWB.js} +523 -63
- package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
- package/js/chunk-ZUKBIHMK.js +92 -0
- package/js/client.js +122 -88
- package/js/contracts.js +116 -25
- package/js/effect.js +19 -20
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +57 -55
- package/js/host.js +19 -20
- package/js/index.js +245 -212
- package/js/mcp/effect.js +23 -22
- package/js/mcp/stdio.js +34 -30
- package/js/mcp.js +104 -68
- package/js/openapi.js +4087 -1503
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +147 -65
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8517 -214
- package/package.json +2 -3
- package/runtime.json +1 -1
- package/types/app-data/src/contracts/database.d.ts +33 -6
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -8
- package/types/apps/src/contracts/cache.d.ts +14 -0
- package/types/apps/src/contracts/context.d.ts +12 -11
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/failure.d.ts +54 -0
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +44 -17
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +96 -10
- package/types/apps/src/contracts/network.d.ts +84 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
- package/types/apps/src/contracts/openapi.d.ts +45 -9
- package/types/apps/src/contracts/operations.d.ts +8 -9
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +263 -74
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/2.d.ts +66 -24
- package/types/apps/src/contracts/protocols/3.d.ts +715 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1297 -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/8.d.ts +1130 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +115 -10
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/skills.d.ts +39 -9
- package/types/apps/src/contracts/sql.d.ts +58 -0
- package/types/apps/src/contracts/ui.d.ts +19 -1
- package/types/apps/src/contracts/workflows.d.ts +40 -3
- package/types/apps/src/facet.d.ts +4 -5
- 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 +32 -5
- package/types/apps/src/implementation/elicitation.d.ts +12 -12
- package/types/apps/src/implementation/failure-detail.d.ts +47 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
- package/types/apps/src/implementation/mcp-client.d.ts +49 -25
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +52 -25
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +8 -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/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -5
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +223 -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 +95 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +66 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +11 -5
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- 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 +30 -13
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +25 -5
- package/types/apps/src/openapi.d.ts +6 -6
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +6 -3
- package/types/telemetry/src/browser.d.ts +2 -2
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/recorded-failure.d.ts +20 -0
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +53 -0
- package/types/utils/src/recorded-message.d.ts +15 -0
- package/js/chunk-BMOIAIVR.js +0 -138
- package/js/chunk-DHUDODG5.js +0 -213
- package/js/chunk-FZJOYIZO.js +0 -19
- package/js/chunk-LGIYBDWA.js +0 -85
- package/js/chunk-M6ZRRIBI.js +0 -877
- package/js/chunk-PLCMJREA.js +0 -590
- package/js/chunk-PYUYJRSK.js +0 -93
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-W7D7WVSY.js +0 -18
- package/js/chunk-Z5NMEGJN.js +0 -29
- package/js/chunk-ZJWDMTE3.js +0 -63
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -33
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
- package/types/apps/src/implementation/storage.d.ts +0 -13
|
@@ -157,6 +157,33 @@ export declare const DatabaseLimits: Schema.Struct<{
|
|
|
157
157
|
export type DatabaseLimits = typeof DatabaseLimits.Type;
|
|
158
158
|
/** Current per-invocation budgets, shared by every database adapter. */
|
|
159
159
|
export declare const defaultDatabaseLimits: DatabaseLimits;
|
|
160
|
+
/**
|
|
161
|
+
* The budget a query or mutation exhausted. `pageSize` bounds one take(n) or paginate call;
|
|
162
|
+
* `valueBytes` bounds one stored row; the rest accumulate across the whole invocation.
|
|
163
|
+
*/
|
|
164
|
+
export declare const DatabaseLimit: Schema.Literals<readonly ["scanCalls", "directGets", "rowsRead", "rowsReturned", "pageSize", "bytesRead", "writes", "valueBytes"]>;
|
|
165
|
+
export type DatabaseLimit = typeof DatabaseLimit.Type;
|
|
166
|
+
declare const DatabaseLimitExceeded_base: Schema.Class<DatabaseLimitExceeded, Schema.TaggedStruct<"DatabaseLimitExceeded", {
|
|
167
|
+
readonly limit: Schema.Literals<readonly ["scanCalls", "directGets", "rowsRead", "rowsReturned", "pageSize", "bytesRead", "writes", "valueBytes"]>;
|
|
168
|
+
readonly maximum: Schema.Int;
|
|
169
|
+
readonly requested: Schema.Int;
|
|
170
|
+
}>, import("effect/Cause").YieldableError>;
|
|
171
|
+
/** A query or mutation exceeded one of its database budgets. Nothing it wrote is committed. */
|
|
172
|
+
export declare class DatabaseLimitExceeded extends DatabaseLimitExceeded_base {
|
|
173
|
+
get message(): string;
|
|
174
|
+
}
|
|
175
|
+
/** Host-owned row metadata that authored tables cannot declare. */
|
|
176
|
+
export declare const reservedFieldNames: readonly ["id", "createdAt", "updatedAt"];
|
|
177
|
+
declare const DatabaseFieldReserved_base: Schema.Class<DatabaseFieldReserved, Schema.TaggedStruct<"DatabaseFieldReserved", {
|
|
178
|
+
readonly table: Schema.String;
|
|
179
|
+
readonly field: Schema.Literals<readonly ["id", "createdAt", "updatedAt"]>;
|
|
180
|
+
}>, import("effect/Cause").YieldableError>;
|
|
181
|
+
/** A table declared a field the host adds to every row. */
|
|
182
|
+
export declare class DatabaseFieldReserved extends DatabaseFieldReserved_base {
|
|
183
|
+
get message(): string;
|
|
184
|
+
}
|
|
185
|
+
/** Failures a database session reports to authored code and its host. */
|
|
186
|
+
export type DatabaseError = AppDatabaseError | DatabaseLimitExceeded;
|
|
160
187
|
/** Host resource bounds outside an individual database transaction. Durations are milliseconds. */
|
|
161
188
|
export declare const DatabaseRuntimeLimits: Schema.Struct<{
|
|
162
189
|
readonly maxCursorChars: Schema.Int;
|
|
@@ -173,21 +200,21 @@ export declare const defaultDatabaseRuntimeLimits: {
|
|
|
173
200
|
/** The host binds one database and read/write authority for the entire invocation. */
|
|
174
201
|
export interface DatabaseSession {
|
|
175
202
|
/** Host-only idempotency receipt, committed atomically with the mutation and validated result. */
|
|
176
|
-
readonly once: <E, R>(key: string, fingerprint: string, work: () => Effect.Effect<Schema.Json, E, R>) => Effect.Effect<Schema.Json, E |
|
|
203
|
+
readonly once: <E, R>(key: string, fingerprint: string, work: () => Effect.Effect<Schema.Json, E, R>) => Effect.Effect<Schema.Json, E | DatabaseError, R>;
|
|
177
204
|
readonly readTables: ReadonlySet<string>;
|
|
178
205
|
readonly changedTables: ReadonlySet<string>;
|
|
179
|
-
readonly execute: (operation: DatabaseOperation) => Effect.Effect<OperationResult,
|
|
206
|
+
readonly execute: (operation: DatabaseOperation) => Effect.Effect<OperationResult, DatabaseError>;
|
|
180
207
|
}
|
|
181
208
|
/** Native operation scope owns snapshot consistency, write rollback and commit notifications. */
|
|
182
209
|
export interface AppDatabase {
|
|
183
210
|
readonly schema: DatabaseSchema;
|
|
184
211
|
readonly schemaHash: string;
|
|
185
|
-
readonly read: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E |
|
|
186
|
-
readonly mutate: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E |
|
|
212
|
+
readonly read: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
|
|
213
|
+
readonly mutate: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
|
|
187
214
|
}
|
|
188
215
|
/** Product-independent app partitions. A host supplies persistent storage; callers never choose filenames. */
|
|
189
216
|
export interface AppDatabases {
|
|
190
|
-
readonly read: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E |
|
|
191
|
-
readonly mutate: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E |
|
|
217
|
+
readonly read: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
|
|
218
|
+
readonly mutate: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
|
|
192
219
|
}
|
|
193
220
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
/** Longest agent guidance an API error's recovery carries. */
|
|
3
|
+
export declare const maxApiErrorInstructionsLength = 4096;
|
|
2
4
|
/** Bounded recovery a declared API error published for its caller: a short next step and agent guidance. */
|
|
3
5
|
export declare const ApiErrorRecovery: Schema.Struct<{
|
|
4
6
|
readonly action: Schema.NonEmptyString;
|
|
@@ -6,6 +8,8 @@ export declare const ApiErrorRecovery: Schema.Struct<{
|
|
|
6
8
|
}>;
|
|
7
9
|
/** Recovery copied from an error response body; extra keys are dropped on decode. */
|
|
8
10
|
export type ApiErrorRecovery = typeof ApiErrorRecovery.Type;
|
|
11
|
+
/** Longest message an API error response carries. */
|
|
12
|
+
export declare const maxApiErrorMessageLength = 4096;
|
|
9
13
|
/** Bounded public fields from a response matching its declared API error schema. */
|
|
10
14
|
export declare const ApiErrorResponse: Schema.Struct<{
|
|
11
15
|
readonly code: Schema.NonEmptyString;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { AppSkillSource, SkillFile } from "./skills.js";
|
|
2
|
-
import type { DatabaseDefinition } from "./storage.js";
|
|
3
2
|
/** Native app contracts; factories and handlers compose in the host's Effect runtime. */
|
|
4
3
|
import { type Effect, Schema } from "effect";
|
|
5
4
|
import type { OperationSchedule } from "./schedules.js";
|
|
6
|
-
import type { AppOperation } from "./operations.js";
|
|
7
5
|
import type { AccountOf, AuthMethods, ManyAccounts, Provider } from "./provider.js";
|
|
8
6
|
import type { AppWorkflow, WorkflowReads } from "./workflows.js";
|
|
9
7
|
import type { Elicit } from "./elicitation.js";
|
|
@@ -11,8 +9,8 @@ import type { Elicit } from "./elicitation.js";
|
|
|
11
9
|
type Handler<Context> = (context: Context, input: never) => Effect.Effect<unknown, unknown>;
|
|
12
10
|
/** App capabilities share one account context. Package metadata belongs in package.json. */
|
|
13
11
|
export interface AppDefinition<Context> {
|
|
14
|
-
/**
|
|
15
|
-
readonly
|
|
12
|
+
/** The app's root router. Its keys form tool paths such as `issues.list`. */
|
|
13
|
+
readonly tools?: import("./router.js").AppRouter | import("./router.js").DynamicRouter;
|
|
16
14
|
/** Omission reads packaged skills/. An explicit catalog replaces that default, including []. */
|
|
17
15
|
readonly skills?: readonly AppSkillSource[];
|
|
18
16
|
/** Optional lazy skills, added to the static catalog. Only skill reads call them. */
|
|
@@ -21,8 +19,6 @@ export interface AppDefinition<Context> {
|
|
|
21
19
|
readonly schedules?: Readonly<Record<string, Omit<OperationSchedule, "name"> & {
|
|
22
20
|
readonly tool: string;
|
|
23
21
|
}>>;
|
|
24
|
-
readonly queries?: Readonly<Record<string, AppOperation>>;
|
|
25
|
-
readonly mutations?: Readonly<Record<string, AppOperation>>;
|
|
26
22
|
readonly webhooks?: Readonly<Record<string, {
|
|
27
23
|
readonly account: string;
|
|
28
24
|
readonly config: Schema.Decoder<unknown>;
|
|
@@ -46,7 +42,11 @@ export interface BoundContext<Slots extends AccountSlots> {
|
|
|
46
42
|
readonly workflows: WorkflowReads;
|
|
47
43
|
/** Ask for user input during this tool call. Unavailable during discovery and after the invocation closes. */
|
|
48
44
|
readonly elicit: Elicit;
|
|
49
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Invocation-owned HTTP requests with trace propagation and host cancellation. It lasts until the
|
|
47
|
+
* invocation and every app cache refresh it started in the background have ended, so a catalog
|
|
48
|
+
* loader given this fetch can refresh after the reply.
|
|
49
|
+
*/
|
|
50
50
|
readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
51
51
|
/** Host cancellation for this invocation. Pass it to fetch and other interruptible APIs. */
|
|
52
52
|
readonly signal: AbortSignal;
|
|
@@ -57,7 +57,6 @@ export interface BoundContext<Slots extends AccountSlots> {
|
|
|
57
57
|
/** The host evaluates this factory fresh with the configured app's selected accounts. */
|
|
58
58
|
export interface App<Slots extends AccountSlots, Def extends AppDefinition<never>> {
|
|
59
59
|
readonly accounts: Slots;
|
|
60
|
-
readonly database?: DatabaseDefinition;
|
|
61
60
|
readonly evaluate: (context: BoundContext<Slots>) => Effect.Effect<Def, unknown>;
|
|
62
61
|
}
|
|
63
62
|
declare const NotImplemented_base: Schema.Class<NotImplemented, Schema.TaggedStruct<"NotImplemented", {
|
|
@@ -37,6 +37,20 @@ export interface AppCache {
|
|
|
37
37
|
readonly id: string;
|
|
38
38
|
}) => AppCache;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* A credential a remote read sends, and the account it belongs to. A public source takes neither.
|
|
42
|
+
* A credential comes only with its account, so the read is cached in that account's scope.
|
|
43
|
+
*/
|
|
44
|
+
export type AccountCredential<Credential extends object> = ({
|
|
45
|
+
readonly account?: undefined;
|
|
46
|
+
} & {
|
|
47
|
+
readonly [Field in keyof Credential]?: undefined;
|
|
48
|
+
}) | ({
|
|
49
|
+
/** The selected account, as `accounts.<slot>` provides it. */
|
|
50
|
+
readonly account: {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
};
|
|
53
|
+
} & Credential);
|
|
40
54
|
/** Trusted storage and background ownership; never accepted from request JSON. */
|
|
41
55
|
export interface HostCache {
|
|
42
56
|
readonly transport: CacheTransport;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
/** Public handler contexts derive capabilities from one shared requirements declaration. */
|
|
2
2
|
import type { WorkflowControls } from "./workflows.js";
|
|
3
3
|
import type { AccountSlots, BoundContext } from "./app.js";
|
|
4
|
-
import type {
|
|
5
|
-
/** Requirements are pure values; selected accounts and
|
|
4
|
+
import type { Sql, SqlReader } from "./sql.js";
|
|
5
|
+
/** Requirements are pure values; selected accounts and SQL access belong to invocations. */
|
|
6
6
|
export interface AppRequirements {
|
|
7
7
|
readonly accounts: AccountSlots;
|
|
8
|
-
readonly database?: DatabaseDefinition;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Every handler has `ctx.sql`. The app's database exists once the build has SQL files in
|
|
11
|
+
* `migrations/`; before that, any statement fails and says so.
|
|
12
|
+
*/
|
|
13
|
+
type StorageContext<Writable extends boolean> = {
|
|
14
|
+
readonly sql: Writable extends true ? Sql : SqlReader;
|
|
15
|
+
};
|
|
15
16
|
/** Context available during dynamic app evaluation; storage opens only for handlers. */
|
|
16
17
|
export type AppContext<Requirements extends AppRequirements = AppRequirements> = BoundContext<Requirements["accounts"]>;
|
|
17
18
|
/** Interactive query context; declared storage exposes only read methods. */
|
|
18
|
-
export type QueryContext<Requirements extends AppRequirements = AppRequirements> = AppContext<Requirements> & StorageContext<
|
|
19
|
-
/** Interactive mutation context;
|
|
19
|
+
export type QueryContext<Requirements extends AppRequirements = AppRequirements> = AppContext<Requirements> & StorageContext<false>;
|
|
20
|
+
/** Interactive mutation context; outside calls happen between SQL transactions, never inside one. */
|
|
20
21
|
export type MutationContext<Requirements extends AppRequirements = AppRequirements> = Omit<AppContext<Requirements>, "workflows"> & {
|
|
21
22
|
readonly workflows: WorkflowControls;
|
|
22
|
-
} & StorageContext<
|
|
23
|
+
} & StorageContext<true>;
|
|
23
24
|
/** Background webhook context has account and storage access without interactive input. */
|
|
24
25
|
export type WebhookContext<Requirements extends AppRequirements = AppRequirements> = Omit<MutationContext<Requirements>, "elicit">;
|
|
25
26
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Shared MCP elicitation data. Delivery belongs to the host, independently of its transport. */
|
|
2
2
|
import { Schema, type Effect } from "effect";
|
|
3
|
-
import * as McpSchema from "effect/
|
|
3
|
+
import * as McpSchema from "effect/ai/McpSchema";
|
|
4
4
|
import { type JsonValue } from "./schema.js";
|
|
5
5
|
/** Maximum human-input wait, separate from active provider execution time. */
|
|
6
6
|
export declare const ElicitationLimits: Schema.Struct<{
|
|
@@ -15,10 +15,10 @@ export declare const defaultElicitationLimits: {
|
|
|
15
15
|
export declare const FormElicitation: Schema.Struct<{
|
|
16
16
|
readonly mode: Schema.Literal<"form">;
|
|
17
17
|
readonly requestedSchema: Schema.toEncoded<Schema.Struct<{
|
|
18
|
-
readonly $schema: Schema.decodeTo<Schema.optional<Schema.String
|
|
18
|
+
readonly $schema: Schema.decodeTo<Schema.toType<Schema.optional<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
19
19
|
readonly type: Schema.tag<"object">;
|
|
20
20
|
readonly properties: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [typeof McpSchema.LegacyTitledEnum, Schema.Union<readonly [typeof McpSchema.UntitledSingleSelectEnum, typeof McpSchema.TitledSingleSelectEnum]>, Schema.Union<readonly [typeof McpSchema.UntitledMultiSelectEnum, typeof McpSchema.TitledMultiSelectEnum]>]>, typeof McpSchema.ElicitationString, typeof McpSchema.ElicitationNumber, typeof McpSchema.ElicitationBoolean]>>;
|
|
21
|
-
readonly required: Schema.decodeTo<Schema.optional<Schema.$Array<Schema.String
|
|
21
|
+
readonly required: Schema.decodeTo<Schema.toType<Schema.optional<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
22
22
|
}>>;
|
|
23
23
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
24
24
|
readonly message: Schema.String;
|
|
@@ -28,7 +28,7 @@ export type FormElicitation = typeof FormElicitation.Type;
|
|
|
28
28
|
export declare const ElicitationResponse: Schema.Union<readonly [Schema.Struct<{
|
|
29
29
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
30
30
|
readonly action: Schema.Literal<"accept">;
|
|
31
|
-
readonly content: Schema.decodeTo<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]
|
|
31
|
+
readonly content: Schema.decodeTo<Schema.toType<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
|
|
32
32
|
}>, Schema.Struct<{
|
|
33
33
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
34
34
|
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
@@ -50,7 +50,7 @@ export declare const ElicitationReply: Schema.Union<readonly [Schema.Struct<{
|
|
|
50
50
|
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
51
51
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
52
52
|
readonly action: Schema.Literal<"accept">;
|
|
53
|
-
readonly content: Schema.decodeTo<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]
|
|
53
|
+
readonly content: Schema.decodeTo<Schema.toType<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
|
|
54
54
|
}>, Schema.Struct<{
|
|
55
55
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
56
56
|
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
@@ -75,7 +75,7 @@ export type ApprovalElicitation = typeof ApprovalElicitation.Type;
|
|
|
75
75
|
export declare const ApprovalResponse: Schema.Union<readonly [Schema.Struct<{
|
|
76
76
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
77
77
|
readonly action: Schema.Literal<"accept">;
|
|
78
|
-
readonly content: Schema.decodeTo<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]
|
|
78
|
+
readonly content: Schema.decodeTo<Schema.toType<Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
|
|
79
79
|
}>, Schema.Struct<{
|
|
80
80
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
81
81
|
readonly action: Schema.Literals<readonly ["cancel", "decline"]>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Failure detail that crosses the runtime boundary to the app's own caller. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** Longest failure message carried across the runtime boundary. */
|
|
4
|
+
export declare const maxFailureMessageLength = 2048;
|
|
5
|
+
/**
|
|
6
|
+
* `app` for errors thrown by authored code, `storage` for app data failures the host raised, and
|
|
7
|
+
* `service` for an external API the app called through a framework helper.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FailureSource: Schema.Literals<readonly ["app", "storage", "service"]>;
|
|
10
|
+
/** The thrown error's name, such as `TypeError`, or the host error's tag. */
|
|
11
|
+
export declare const FailureName: Schema.String;
|
|
12
|
+
/** A stable host failure code, such as an app data reason, or the thrown error's own `code`. */
|
|
13
|
+
export declare const FailureCode: Schema.String;
|
|
14
|
+
/** Bounded, with the invocation's account secrets replaced. */
|
|
15
|
+
export declare const FailureMessage: Schema.String;
|
|
16
|
+
/** Most fields of one thrown error carried across the runtime boundary. */
|
|
17
|
+
export declare const maxFailureFields = 8;
|
|
18
|
+
/** Longest text field value carried across the runtime boundary. */
|
|
19
|
+
export declare const maxFailureFieldLength = 256;
|
|
20
|
+
/** A field name as the error's code spells it, such as `reason` or `pointer`. */
|
|
21
|
+
export declare const FailureFieldName: Schema.String;
|
|
22
|
+
/** Bounded text with account secrets replaced, a finite number, or a boolean. */
|
|
23
|
+
export declare const FailureFieldValue: Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>;
|
|
24
|
+
/**
|
|
25
|
+
* The thrown error's own scalar fields beside its name, code and message, such as the `reason`
|
|
26
|
+
* and `pointer` a spec compiler sets. Nested values, stacks and causes are never carried.
|
|
27
|
+
*/
|
|
28
|
+
export declare const FailureFields: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
29
|
+
export type FailureFields = typeof FailureFields.Type;
|
|
30
|
+
/**
|
|
31
|
+
* The error an app's own code raised, or the specific host failure it hit. Stacks and cause
|
|
32
|
+
* values stay private. Builds from before these fields existed send none.
|
|
33
|
+
*/
|
|
34
|
+
export declare const FailureDetail: {
|
|
35
|
+
source: Schema.optionalKey<Schema.Literals<readonly ["app", "storage", "service"]>>;
|
|
36
|
+
errorName: Schema.optionalKey<Schema.String>;
|
|
37
|
+
code: Schema.optionalKey<Schema.String>;
|
|
38
|
+
message: Schema.optionalKey<Schema.String>;
|
|
39
|
+
fields: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>>;
|
|
40
|
+
};
|
|
41
|
+
/** Longest error message a service stated, as carried across the runtime boundary. */
|
|
42
|
+
export declare const maxUpstreamMessageLength = 1024;
|
|
43
|
+
/**
|
|
44
|
+
* The error a service stated in its own response: a JSON-RPC error's code and message, or an
|
|
45
|
+
* OAuth Bearer error code and description. Bounded, with the invocation's account secrets replaced.
|
|
46
|
+
*/
|
|
47
|
+
export declare const UpstreamError: Schema.Struct<{
|
|
48
|
+
readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
|
|
49
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
50
|
+
}>;
|
|
51
|
+
export type UpstreamError = typeof UpstreamError.Type;
|
|
52
|
+
/** Where a service failed: setting up a session, listing tools, or running one. */
|
|
53
|
+
export declare const FailurePhase: Schema.Literals<readonly ["connect", "discover", "call"]>;
|
|
54
|
+
export type FailurePhase = typeof FailurePhase.Type;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProviderError } from "./provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "./network.js";
|
|
2
3
|
/** GraphQL discovery contracts. Catalogs are evaluated with the selected account. */
|
|
3
4
|
import { Schema, type Effect } from "effect";
|
|
4
5
|
import { type JsonValue } from "./schema.js";
|
|
@@ -97,7 +98,7 @@ export interface GraphqlTool {
|
|
|
97
98
|
readonly description: string;
|
|
98
99
|
readonly readOnly: boolean;
|
|
99
100
|
readonly input: Schema.Decoder<JsonValue>;
|
|
100
|
-
readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError>;
|
|
101
|
+
readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError | NetworkRefused>;
|
|
101
102
|
}
|
|
102
103
|
/** One tool per root field; subscriptions require a separate long-lived host. */
|
|
103
104
|
export type GraphqlTools = Readonly<Record<string, GraphqlTool>>;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
export * from "./skills.js";
|
|
2
|
-
import {
|
|
2
|
+
import { type SkillFile } from "./skills.js";
|
|
3
3
|
import { ProviderError } from "./provider-error.js";
|
|
4
|
-
import { McpError } from "./mcp.js";
|
|
5
4
|
import { OpenapiResponseError } from "./api-response-error.js";
|
|
6
|
-
export { ApiErrorResponse, OpenapiResponseError } from "./api-response-error.js";
|
|
5
|
+
export { ApiErrorResponse, maxApiErrorInstructionsLength, maxApiErrorMessageLength, OpenapiResponseError, } from "./api-response-error.js";
|
|
7
6
|
export { ProviderError } from "./provider-error.js";
|
|
8
|
-
export {
|
|
7
|
+
export { FetchOptionUnsupported, NetworkRefusal, NetworkRefused, networkRefusalHeader, networkRefusalResponse, networkRefusalStatus, } from "./network.js";
|
|
9
8
|
import { WorkflowFailure, type WorkflowExecution, type WorkflowReplay, type WorkflowHostControls } from "./workflows.js";
|
|
10
9
|
export * from "./workflows.js";
|
|
10
|
+
export * from "./failure.js";
|
|
11
|
+
import { DatabaseFieldReserved, DatabaseLimitExceeded } from "../../../app-data/src/contracts/database.js";
|
|
12
|
+
export { DatabaseFieldReserved, DatabaseLimitExceeded } from "../../../app-data/src/contracts/database.js";
|
|
11
13
|
/** Portable framework dispatch contracts. Requests never carry account bindings. */
|
|
12
14
|
import { Context, Schema, type Effect, type Redacted } from "effect";
|
|
13
|
-
import type {
|
|
15
|
+
import type { AppSqlStorage } from "./sql.js";
|
|
14
16
|
import type { InvocationTelemetry } from "../../../telemetry/src/index.js";
|
|
15
|
-
export {
|
|
17
|
+
export { type AppSqlStorage, type Sql, type SqlCursor, type SqlReader, type SqlRow, type SqlValue, } from "./sql.js";
|
|
16
18
|
import { ElicitationFailed, type ElicitationHandler } from "./elicitation.js";
|
|
17
19
|
export { ElicitationLimits, defaultElicitationLimits, FormElicitation, ElicitationResponse, ElicitationReply, ElicitationFailed, type ElicitationHandler, ApprovalElicitation, ApprovalResponse, approvalElicitation, } from "./elicitation.js";
|
|
18
20
|
export { McpClientLimits, defaultMcpClientLimits } from "./mcp.js";
|
|
19
21
|
export * from "./webhook-protocol.js";
|
|
20
22
|
export { AccountId, HttpUrl } from "./schema.js";
|
|
21
|
-
export { OAuthClientAuth, OAuthSecretClientAuth } from "./provider.js";
|
|
23
|
+
export { OAuthClientAuth, OAuthSecretClientAuth, OAuthTokenRequestFormat, OAuthTokenResponse, } from "./provider.js";
|
|
22
24
|
/**
|
|
23
25
|
* The host protocol this framework speaks and its wire schemas. A later protocol replaces this
|
|
24
26
|
* re-export; released protocol modules stay unchanged for host adapters.
|
|
@@ -26,8 +28,23 @@ export { OAuthClientAuth, OAuthSecretClientAuth } from "./provider.js";
|
|
|
26
28
|
export { frameworkProtocol } from "./protocol-version.js";
|
|
27
29
|
export { protocol1 } from "./protocols/1.js";
|
|
28
30
|
export { protocol2 } from "./protocols/2.js";
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
+
export { protocol3 } from "./protocols/3.js";
|
|
32
|
+
export { protocol4 } from "./protocols/4.js";
|
|
33
|
+
export { protocol5 } from "./protocols/5.js";
|
|
34
|
+
export { protocol6 } from "./protocols/6.js";
|
|
35
|
+
export { protocol7, AccountCheckCommand, CredentialHost } from "./protocols/7.js";
|
|
36
|
+
export { protocol8 } from "./protocols/8.js";
|
|
37
|
+
export { protocol9 } from "./protocols/9.js";
|
|
38
|
+
export { protocol10, MigrateCommand, MigrateResult } from "./protocols/10.js";
|
|
39
|
+
export { AccountCheckResult, AccountInfo } from "./provider.js";
|
|
40
|
+
import { HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostInputInvalid, HostKindMismatch, HostOperationFailed, HostOperationNotFound, HostOutputInvalid, HostRequestInvalid, HostToolApprovalRequired, HostToolBlocked, HostToolNotFound, HostToolPolicyFailed, McpError, SkillLoadFailed, SkillSources, type InvocationDeadline, ResolvedAccounts, type SkillCatalogResponse, type TrustedToolApproval } from "./protocols/10.js";
|
|
41
|
+
export { DeclaredRequirements, HostRequest } from "./protocols/10.js";
|
|
42
|
+
/**
|
|
43
|
+
* The MCP and skill loader failures as they cross the host boundary. Apps throw the author-facing
|
|
44
|
+
* classes from `apps/mcp` and `apps/skills`.
|
|
45
|
+
*/
|
|
46
|
+
export { McpError, SkillLoadFailed } from "./protocols/10.js";
|
|
47
|
+
export { DeclaredAuthMethod, DeclaredProvider, ResolvedAccount, ResolvedAccounts, TrustedToolApproval, InvocationDeadline, HostedTool, HostedToolSummary, HostRouterError, HostedRouter, HostedCatalog, HostedCatalogSummary, SkillSources, SkillCatalogResponse, HostRequestInvalid, HostAccountsInvalid, HostDeclarationInvalid, HostEvaluationFailed, HostOperationNotFound, HostOperationFailed, HostToolNotFound, HostKindMismatch, InputProblem, maxInputProblems, HostInputInvalid, HostToolBlocked, HostToolApprovalRequired, HostToolPolicyFailed, HostOutputInvalid, HostError, HostResponse, HostInvocation, } from "./protocols/10.js";
|
|
31
48
|
/** Raw host inputs; the host boundary parses and redacts these immediately. */
|
|
32
49
|
export type ResolvedAccountsInput = typeof ResolvedAccounts.Encoded;
|
|
33
50
|
/** Trusted invocation context, supplied separately from the Request. */
|
|
@@ -46,7 +63,8 @@ export interface HostContext {
|
|
|
46
63
|
/** Trusted in-process tracing capability; never decoded from a public request. */
|
|
47
64
|
readonly telemetry?: InvocationTelemetry;
|
|
48
65
|
readonly approval?: TrustedToolApproval;
|
|
49
|
-
|
|
66
|
+
/** The data facet's SQLite storage, for apps that declare `sql`. Never exposed to app code. */
|
|
67
|
+
readonly storage?: AppSqlStorage;
|
|
50
68
|
readonly accounts: Redacted.Redacted<ResolvedAccounts>;
|
|
51
69
|
}
|
|
52
70
|
/** Skill commands. Send sources only to builds that declare skillSources. */
|
|
@@ -78,16 +96,24 @@ export declare const indexCommand: {
|
|
|
78
96
|
};
|
|
79
97
|
/** Keep only the requested tools from an inspection that may have described every tool. */
|
|
80
98
|
export declare const selectTools: (tools?: readonly string[]) => <A extends {
|
|
81
|
-
readonly
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
99
|
+
readonly tools: readonly {
|
|
100
|
+
readonly name: string;
|
|
101
|
+
}[];
|
|
102
|
+
}>(catalog: A) => A;
|
|
103
|
+
/** Declaration reads do not bind accounts or evaluate the app factory. A named declaration
|
|
104
|
+
* problem is reported so the deploy can explain it. */
|
|
105
|
+
export declare const HostRequirementsError: Schema.Union<readonly [typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof DatabaseFieldReserved]>;
|
|
85
106
|
/** Inspection can fail while binding accounts or evaluating the live definition. */
|
|
86
107
|
export declare const HostInspectError: Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>;
|
|
87
108
|
/** Tool invocation adds lookup, input, execution and output failures to inspection. */
|
|
88
|
-
export declare const HostCallError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostOperationFailed, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
|
|
109
|
+
export declare const HostCallError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostKindMismatch, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
|
|
110
|
+
/**
|
|
111
|
+
* An account check binds one account and runs the provider's check without evaluating the app.
|
|
112
|
+
* Timeouts arrive as WorkflowFailure from the shared deadline guard.
|
|
113
|
+
*/
|
|
114
|
+
export declare const HostAccountCheckError: Schema.Union<readonly [typeof ProviderError, typeof WorkflowFailure, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostOperationNotFound, typeof HostOperationFailed, typeof HostOutputInvalid]>;
|
|
89
115
|
/** Queries, mutations and agent calls use the same operation failures. */
|
|
90
|
-
export declare const HostDataError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostOperationFailed, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
|
|
116
|
+
export declare const HostDataError: Schema.Union<readonly [typeof OpenapiResponseError, typeof WorkflowFailure, Schema.Union<readonly [typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof HostRequestInvalid, typeof HostDeclarationInvalid, typeof HostAccountsInvalid, typeof HostEvaluationFailed]>, typeof HostToolNotFound, typeof HostOperationNotFound, typeof HostKindMismatch, typeof HostOperationFailed, typeof DatabaseLimitExceeded, typeof HostInputInvalid, typeof HostOutputInvalid, typeof HostToolBlocked, typeof HostToolApprovalRequired, typeof HostToolPolicyFailed, typeof ElicitationFailed]>;
|
|
91
117
|
/** Invocation-owned outcome sink. Framework adapters report semantic failures
|
|
92
118
|
* independently of successful JSON transport; customer output is never inspected. */
|
|
93
119
|
export declare const ToolResultObservation: Context.Reference<{
|
|
@@ -95,5 +121,6 @@ export declare const ToolResultObservation: Context.Reference<{
|
|
|
95
121
|
}>;
|
|
96
122
|
/** Native handler; context comes from host authority, never from request content. */
|
|
97
123
|
export type AppHandler = (request: Request, context: HostContext) => Effect.Effect<Response>;
|
|
98
|
-
export {
|
|
124
|
+
export { type AppOperation, type OperationContext } from "./operations.js";
|
|
125
|
+
export { RouterIcon, RouterKey, RouterMeta, type AppNode, type AppRouter, type DynamicRouter, } from "./router.js";
|
|
99
126
|
export * from "./schedules.js";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** Browser subscription contracts contain no executable server declarations. */
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import type { JsonValue } from "./schema.js";
|
|
4
|
+
/** Names of authored operations. */
|
|
5
|
+
export declare const OperationName: Schema.NonEmptyString;
|
|
4
6
|
/** Serializable named reference; the phantom field is never populated at runtime. */
|
|
5
7
|
export interface OperationReference<Input, Output, Kind extends "query" | "mutation"> {
|
|
6
8
|
readonly name: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ProviderError } from "./provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "./network.js";
|
|
2
3
|
/** MCP protocol data uses Effect Schema; executable tool methods use Effect. */
|
|
3
4
|
import { type Effect, type Redacted, Schema } from "effect";
|
|
4
5
|
import type { Elicit, ElicitationFailed } from "./elicitation.js";
|
|
6
|
+
import type { AccountCheckContext, AuthMethods } from "./provider.js";
|
|
5
7
|
import { type JsonValue } from "./schema.js";
|
|
6
8
|
/** Upstream MCP resource bounds, independent of the outer codemode execution budget. */
|
|
7
9
|
export declare const McpClientLimits: Schema.Struct<{
|
|
@@ -31,6 +33,37 @@ export declare const McpToolsOptions: Schema.Struct<{
|
|
|
31
33
|
readonly timeoutMs: Schema.optional<Schema.Number>;
|
|
32
34
|
}>;
|
|
33
35
|
export type McpToolsOptions = typeof McpToolsOptions.Type;
|
|
36
|
+
/**
|
|
37
|
+
* What `mcpHealth` checks, as decoded: its options, with the account's ID, signal and deadline
|
|
38
|
+
* taken from the check context.
|
|
39
|
+
*/
|
|
40
|
+
export declare const McpHealthInput: Schema.Struct<{
|
|
41
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
42
|
+
readonly deadline: Schema.optional<Schema.Finite>;
|
|
43
|
+
readonly url: Schema.String;
|
|
44
|
+
readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
|
|
45
|
+
readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
|
|
46
|
+
readonly timeoutMs: Schema.optional<Schema.Number>;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* The server a provider check verifies, and the headers that send the checked account's
|
|
50
|
+
* credentials. The account, signal and deadline come from the check context instead. Both attempts
|
|
51
|
+
* share one budget that ends `mcpHealthReserveMs` before the deadline. `timeoutMs` bounds the whole
|
|
52
|
+
* check too; it can shorten the budget, never extend it.
|
|
53
|
+
*/
|
|
54
|
+
export type McpHealthOptions = Pick<typeof McpHealthInput.Type, "url" | "headers" | "timeoutMs">;
|
|
55
|
+
/** What `mcpHealth` reads from the check context the host passes to a provider's `health`. */
|
|
56
|
+
export type McpHealthCheck = Pick<AccountCheckContext<AuthMethods>, "signal" | "deadline"> & {
|
|
57
|
+
readonly account: {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* How long before an account check's deadline `mcpHealth` stops waiting for the server, so it can
|
|
63
|
+
* still close its session, ending it and then its transport, each within `cleanupTimeoutMs`, and
|
|
64
|
+
* report why before the host stops waiting.
|
|
65
|
+
*/
|
|
66
|
+
export declare const mcpHealthReserveMs: number;
|
|
34
67
|
/** One parsed server and credential snapshot; never shared across account evaluations. */
|
|
35
68
|
export interface McpConnection {
|
|
36
69
|
readonly url: URL;
|
|
@@ -38,15 +71,21 @@ export interface McpConnection {
|
|
|
38
71
|
readonly timeoutMs: number;
|
|
39
72
|
}
|
|
40
73
|
export { ToolAnnotations as McpToolAnnotations } from "./tools.js";
|
|
41
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Native MCP result semantics, and the value every MCP tool call returns. A tool's output
|
|
76
|
+
* schema is built from this declaration. Protocol/transport failures use the Effect error channel.
|
|
77
|
+
*/
|
|
42
78
|
export declare const McpToolResult: Schema.Struct<{
|
|
43
79
|
readonly content: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
44
|
-
readonly structuredContent: Schema.
|
|
45
|
-
readonly isError: Schema.
|
|
46
|
-
readonly _meta: Schema.
|
|
80
|
+
readonly structuredContent: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
81
|
+
readonly isError: Schema.optionalKey<Schema.Boolean>;
|
|
82
|
+
readonly _meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
47
83
|
}>;
|
|
48
84
|
export type McpToolResult = typeof McpToolResult.Type;
|
|
49
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Remote metadata. Input/output schemas remain upstream JSON Schema documents; the upstream
|
|
87
|
+
* output schema describes only a result's `structuredContent`.
|
|
88
|
+
*/
|
|
50
89
|
export declare const McpToolMetadata: Schema.Struct<{
|
|
51
90
|
readonly name: Schema.String;
|
|
52
91
|
readonly title: Schema.optional<Schema.String>;
|
|
@@ -63,16 +102,37 @@ export declare const McpToolMetadata: Schema.Struct<{
|
|
|
63
102
|
readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
64
103
|
}>;
|
|
65
104
|
export type McpToolMetadata = typeof McpToolMetadata.Type;
|
|
105
|
+
/** What a server reports about itself when a session initializes. Icons are for display only. */
|
|
106
|
+
export declare const McpServerHeader: Schema.Struct<{
|
|
107
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
108
|
+
readonly title: Schema.optionalKey<Schema.String>;
|
|
109
|
+
readonly version: Schema.optionalKey<Schema.String>;
|
|
110
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
111
|
+
readonly websiteUrl: Schema.optionalKey<Schema.String>;
|
|
112
|
+
readonly icons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
113
|
+
readonly src: Schema.NonEmptyString;
|
|
114
|
+
readonly mimeType: Schema.optionalKey<Schema.String>;
|
|
115
|
+
readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
116
|
+
readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
|
|
117
|
+
}>>>;
|
|
118
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
119
|
+
}>;
|
|
120
|
+
export type McpServerHeader = typeof McpServerHeader.Type;
|
|
66
121
|
/** Direct callers can omit interaction capabilities. A server that asks for input then fails explicitly. */
|
|
67
122
|
export interface McpToolContext {
|
|
68
123
|
readonly elicit?: Elicit;
|
|
69
124
|
}
|
|
70
|
-
/**
|
|
71
|
-
|
|
125
|
+
/**
|
|
126
|
+
* A tool bound to one evaluation's account; do not reuse it with another account. `output`
|
|
127
|
+
* decodes and describes the `McpToolResult` that `run` returns, with the upstream output schema
|
|
128
|
+
* under `structuredContent`.
|
|
129
|
+
*/
|
|
130
|
+
export interface McpTool extends Omit<McpToolMetadata, "outputSchema"> {
|
|
72
131
|
readonly description: string;
|
|
73
132
|
readonly input: Schema.Decoder<JsonValue>;
|
|
133
|
+
readonly output: Schema.Decoder<JsonValue>;
|
|
74
134
|
readonly readOnly?: boolean;
|
|
75
|
-
readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | ElicitationFailed>;
|
|
135
|
+
readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | NetworkRefused | ElicitationFailed>;
|
|
76
136
|
}
|
|
77
137
|
/** The discovered catalog keyed by remote tool name. */
|
|
78
138
|
export type McpTools = Readonly<Record<string, McpTool>>;
|
|
@@ -80,10 +140,36 @@ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpErro
|
|
|
80
140
|
readonly phase: Schema.Literals<readonly ["connect", "discover", "call", "schema", "transport"]>;
|
|
81
141
|
readonly reason: Schema.Literals<readonly ["request", "unauthorized", "invalid_response", "timeout", "invalid_input"]>;
|
|
82
142
|
readonly status: Schema.optional<Schema.Number>;
|
|
143
|
+
readonly upstream: Schema.optional<Schema.Struct<{
|
|
144
|
+
readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
|
|
145
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
146
|
+
}>>;
|
|
147
|
+
readonly session: Schema.optional<Schema.Literal<true>>;
|
|
83
148
|
}>, import("effect/Cause").YieldableError>;
|
|
84
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* Safe protocol/transport failure; no raw upstream payloads or credentials. `status` is the HTTP
|
|
151
|
+
* status a `request` failure was redirected or refused with. Without one, a `request` failure in
|
|
152
|
+
* the `transport` phase never reached the server; in another phase it may be a JSON-RPC error the
|
|
153
|
+
* server answered with. `upstream` is that JSON-RPC error, bounded and with account secrets
|
|
154
|
+
* replaced. A response that is not MCP is `invalid_response`. `session` is set when the refused
|
|
155
|
+
* request carried the session ID the server issued at initialization.
|
|
156
|
+
*
|
|
157
|
+
* These fields describe the failure for whoever reads it. App code can set any of them, so they
|
|
158
|
+
* never show that the failure lies outside Executor.
|
|
159
|
+
*/
|
|
85
160
|
export declare class McpError extends McpError_base {
|
|
86
161
|
}
|
|
162
|
+
declare const McpCredentialsUnverified_base: Schema.Class<McpCredentialsUnverified, Schema.TaggedStruct<"McpCredentialsUnverified", {
|
|
163
|
+
readonly anonymous: Schema.Union<readonly [Schema.Literal<"answered">, typeof McpError, typeof ProviderError]>;
|
|
164
|
+
}>, import("effect/Cause").YieldableError>;
|
|
165
|
+
/**
|
|
166
|
+
* `mcpHealth` could not show that the server needs the account's credentials, although it accepted
|
|
167
|
+
* them. `anonymous` is what the same check without credentials met: `answered` when it succeeded,
|
|
168
|
+
* so a refused key would pass too, or the failure, other than a refusal, that left it undecided.
|
|
169
|
+
* Only app code raises it; the host reports its fixed message, so no host protocol carries it.
|
|
170
|
+
*/
|
|
171
|
+
export declare class McpCredentialsUnverified extends McpCredentialsUnverified_base {
|
|
172
|
+
}
|
|
87
173
|
/** Public process configuration. Credentials arrive through the selected account. */
|
|
88
174
|
export declare const ProcessConfig: Schema.Struct<{
|
|
89
175
|
readonly command: Schema.NonEmptyString;
|