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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** OAuth declarations frozen for host protocols 1 through 5. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
|
|
4
|
+
export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
5
|
+
export type OAuthClientAuth = typeof OAuthClientAuth.Type;
|
|
6
|
+
/** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
|
|
7
|
+
export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
8
|
+
/** Parameters the host sets on every authorization request; a declaration cannot replace them. */
|
|
9
|
+
export declare const reservedAuthorizationParams: readonly ["response_type", "client_id", "redirect_uri", "state", "scope", "code_challenge", "code_challenge_method", "nonce", "resource", "request", "request_uri"];
|
|
10
|
+
/** A protocol parameter only the host sets on the authorization request. */
|
|
11
|
+
export type ReservedAuthorizationParam = (typeof reservedAuthorizationParams)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Extra authorization request parameters, such as `access_type: "offline"`. RFC 6749 §3.1
|
|
14
|
+
* lets services define their own; the protocol and security parameters stay host-owned.
|
|
15
|
+
*/
|
|
16
|
+
export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Schema.String>;
|
|
17
|
+
/** How the token endpoint reads requests. RFC 6749 uses a form; some services want JSON. */
|
|
18
|
+
export declare const OAuthTokenRequestFormat: Schema.Literals<readonly ["form", "json"]>;
|
|
19
|
+
export type OAuthTokenRequestFormat = typeof OAuthTokenRequestFormat.Type;
|
|
20
|
+
/**
|
|
21
|
+
* Where a service nests the grant in its token response, as a dot-separated member path. Slack
|
|
22
|
+
* returns a user token under `authed_user`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const OAuthTokenResponse: Schema.Struct<{
|
|
25
|
+
readonly path: Schema.String;
|
|
26
|
+
}>;
|
|
27
|
+
export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
|
|
28
|
+
/**
|
|
29
|
+
* OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
|
|
30
|
+
* host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
|
|
31
|
+
* server's `revocation_endpoint` metadata instead.
|
|
32
|
+
*/
|
|
33
|
+
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
34
|
+
readonly discover: Schema.String;
|
|
35
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
36
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
37
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
38
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
39
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
40
|
+
readonly path: Schema.String;
|
|
41
|
+
}>>;
|
|
42
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
43
|
+
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
44
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
45
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
46
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
47
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
48
|
+
}>, Schema.Struct<{
|
|
49
|
+
/** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
|
|
50
|
+
readonly authorizationUrl: Schema.String;
|
|
51
|
+
readonly tokenUrl: Schema.String;
|
|
52
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
53
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
54
|
+
/** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
|
|
55
|
+
readonly issuer: Schema.optionalKey<Schema.String>;
|
|
56
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
57
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
58
|
+
readonly path: Schema.String;
|
|
59
|
+
}>>;
|
|
60
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
61
|
+
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
62
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
63
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
64
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
65
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
66
|
+
}>, Schema.Struct<{
|
|
67
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
68
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
69
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
70
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
71
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
72
|
+
readonly discover: Schema.String;
|
|
73
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
74
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
75
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
76
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
77
|
+
}>, Schema.Struct<{
|
|
78
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
79
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
80
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
81
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
82
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
83
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
84
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
85
|
+
readonly tokenUrl: Schema.String;
|
|
86
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
87
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
88
|
+
}>]>;
|
|
89
|
+
export type OAuth2Config = typeof OAuth2Config.Type;
|
|
@@ -3,12 +3,21 @@ declare const ProviderError_base: Schema.Class<ProviderError, Schema.TaggedStruc
|
|
|
3
3
|
readonly reason: Schema.Literals<readonly ["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]>;
|
|
4
4
|
readonly status: Schema.optional<Schema.Int>;
|
|
5
5
|
readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
|
|
6
|
+
readonly phase: Schema.optional<Schema.Literals<readonly ["connect", "discover", "call"]>>;
|
|
7
|
+
readonly upstream: Schema.optional<Schema.Struct<{
|
|
8
|
+
readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
|
|
9
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
10
|
+
}>>;
|
|
6
11
|
}>, import("effect/Cause").YieldableError>;
|
|
7
12
|
/**
|
|
8
13
|
* A recognized service failure. App authors can throw this ordinary Error from
|
|
9
14
|
* async code. Supply only a known reason and the account used for that request.
|
|
10
15
|
* Never include response bodies, messages, URLs or credentials. A bare 403 is
|
|
11
16
|
* `rejected`; `forbidden` requires explicit evidence of insufficient permission.
|
|
17
|
+
*
|
|
18
|
+
* The framework adds the phase the failure happened in, and `upstream`: the error code and
|
|
19
|
+
* description the service stated in its documented error format, such as a Bearer challenge's
|
|
20
|
+
* `error` and `error_description`. Account secrets in that text are replaced.
|
|
12
21
|
*/
|
|
13
22
|
export declare class ProviderError extends ProviderError_base {
|
|
14
23
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/** Provider declarations use native Effect schemas. The trusted host interprets them. */
|
|
2
|
-
import { Data, Schema } from "effect";
|
|
2
|
+
import { Data, type Effect, Schema } from "effect";
|
|
3
3
|
import { type AccountId } from "./schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* How app code sees a field of a provider that declares hosts. Unmarked string fields are secret:
|
|
6
|
+
* app code receives sealed handles that only the host's outbound network turns into values.
|
|
7
|
+
* `plain` fields are not secret. `raw` fields are secret, but app code reads the real value.
|
|
8
|
+
*/
|
|
9
|
+
export type FieldExposure = "plain" | "raw";
|
|
4
10
|
declare const SecretsMethod_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Readonly<A> & {
|
|
5
11
|
readonly _tag: "secrets";
|
|
6
12
|
} & import("effect/Pipeable").Pipeable;
|
|
@@ -8,6 +14,8 @@ declare const SecretsMethod_base: new <A extends Record<string, any> = {}>(args:
|
|
|
8
14
|
export declare class SecretsMethod<Fields extends Schema.Decoder<unknown>> extends SecretsMethod_base<{
|
|
9
15
|
readonly label: string;
|
|
10
16
|
readonly fields: Fields;
|
|
17
|
+
/** Fields marked with `plain()` or `raw()`. */
|
|
18
|
+
readonly exposure?: Readonly<Record<string, FieldExposure>>;
|
|
11
19
|
}> {
|
|
12
20
|
}
|
|
13
21
|
/** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
|
|
@@ -15,11 +23,26 @@ export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_
|
|
|
15
23
|
export type OAuthClientAuth = typeof OAuthClientAuth.Type;
|
|
16
24
|
/** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
|
|
17
25
|
export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
26
|
+
/** Parameters the host sets on every authorization request; a declaration cannot replace them. */
|
|
27
|
+
export declare const reservedAuthorizationParams: readonly ["response_type", "client_id", "redirect_uri", "state", "scope", "code_challenge", "code_challenge_method", "nonce", "resource", "request", "request_uri"];
|
|
28
|
+
/** A protocol parameter only the host sets on the authorization request. */
|
|
29
|
+
export type ReservedAuthorizationParam = (typeof reservedAuthorizationParams)[number];
|
|
18
30
|
/**
|
|
19
31
|
* Extra authorization request parameters, such as `access_type: "offline"`. RFC 6749 §3.1
|
|
20
32
|
* lets services define their own; the protocol and security parameters stay host-owned.
|
|
21
33
|
*/
|
|
22
34
|
export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Schema.String>;
|
|
35
|
+
/** How the token endpoint reads requests. RFC 6749 uses a form; some services want JSON. */
|
|
36
|
+
export declare const OAuthTokenRequestFormat: Schema.Literals<readonly ["form", "json"]>;
|
|
37
|
+
export type OAuthTokenRequestFormat = typeof OAuthTokenRequestFormat.Type;
|
|
38
|
+
/**
|
|
39
|
+
* Where a service nests the grant in its token response, as a dot-separated member path. Slack
|
|
40
|
+
* returns a user token under `authed_user`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const OAuthTokenResponse: Schema.Struct<{
|
|
43
|
+
readonly path: Schema.String;
|
|
44
|
+
}>;
|
|
45
|
+
export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
|
|
23
46
|
/**
|
|
24
47
|
* OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
|
|
25
48
|
* host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
|
|
@@ -27,15 +50,23 @@ export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Sch
|
|
|
27
50
|
*/
|
|
28
51
|
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
29
52
|
readonly discover: Schema.String;
|
|
53
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
54
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
30
55
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
31
56
|
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
32
57
|
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
33
58
|
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
59
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
60
|
+
readonly path: Schema.String;
|
|
61
|
+
}>>;
|
|
34
62
|
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
35
63
|
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
36
64
|
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
37
65
|
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
66
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
67
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
38
68
|
}>, Schema.Struct<{
|
|
69
|
+
/** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
|
|
39
70
|
readonly authorizationUrl: Schema.String;
|
|
40
71
|
readonly tokenUrl: Schema.String;
|
|
41
72
|
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
@@ -43,28 +74,41 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
|
43
74
|
/** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
|
|
44
75
|
readonly issuer: Schema.optionalKey<Schema.String>;
|
|
45
76
|
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
77
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
78
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
79
|
+
readonly path: Schema.String;
|
|
80
|
+
}>>;
|
|
46
81
|
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
47
82
|
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
48
83
|
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
49
84
|
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
85
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
86
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
50
87
|
}>, Schema.Struct<{
|
|
88
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
89
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
90
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
91
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
51
92
|
readonly grant: Schema.Literal<"client_credentials">;
|
|
52
93
|
readonly discover: Schema.String;
|
|
94
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
95
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
53
96
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
54
97
|
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
55
98
|
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
56
99
|
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
100
|
+
}>, Schema.Struct<{
|
|
57
101
|
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
58
102
|
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
59
|
-
|
|
103
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
104
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
105
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
106
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
107
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
60
108
|
readonly grant: Schema.Literal<"client_credentials">;
|
|
61
109
|
readonly tokenUrl: Schema.String;
|
|
62
110
|
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
63
111
|
readonly scopes: Schema.$Array<Schema.String>;
|
|
64
|
-
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
65
|
-
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
66
|
-
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
67
|
-
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
68
112
|
}>]>;
|
|
69
113
|
export type OAuth2Config = typeof OAuth2Config.Type;
|
|
70
114
|
/** Default app-visible OAuth projection. Refresh tokens and client secrets remain with the host. */
|
|
@@ -78,16 +122,75 @@ declare const OAuth2Method_base: new <A extends Record<string, any> = {}>(args:
|
|
|
78
122
|
export declare class OAuth2Method<Response extends Schema.Decoder<unknown>> extends OAuth2Method_base<{
|
|
79
123
|
readonly config: OAuth2Config;
|
|
80
124
|
readonly response: Response;
|
|
125
|
+
/** Response fields marked with `plain()` or `raw()`. */
|
|
126
|
+
readonly exposure?: Readonly<Record<string, FieldExposure>>;
|
|
81
127
|
}> {
|
|
82
128
|
}
|
|
83
129
|
/** Supported declarations; these acquire credentials rather than normalize them. */
|
|
84
130
|
export type AuthMethod = SecretsMethod<Schema.Decoder<unknown>> | OAuth2Method<Schema.Decoder<unknown>>;
|
|
85
131
|
/** Auth method names are chosen by the provider author. */
|
|
86
132
|
export type AuthMethods = Readonly<Record<string, AuthMethod>>;
|
|
87
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Upstream identity that a passing account check may report for display. Only these fields are
|
|
135
|
+
* retained; the host never stores raw provider responses.
|
|
136
|
+
*/
|
|
137
|
+
export declare const AccountInfo: Schema.Struct<{
|
|
138
|
+
readonly externalId: Schema.optionalKey<Schema.String>;
|
|
139
|
+
readonly displayName: Schema.optionalKey<Schema.String>;
|
|
140
|
+
readonly username: Schema.optionalKey<Schema.String>;
|
|
141
|
+
readonly email: Schema.optionalKey<Schema.String>;
|
|
142
|
+
readonly avatarUrl: Schema.optionalKey<Schema.String>;
|
|
143
|
+
readonly profileUrl: Schema.optionalKey<Schema.String>;
|
|
144
|
+
}>;
|
|
145
|
+
export type AccountInfo = typeof AccountInfo.Type;
|
|
146
|
+
/** A passing account check. Failures are thrown, so there is no failing variant. */
|
|
147
|
+
export declare const AccountCheckResult: Schema.Struct<{
|
|
148
|
+
readonly accountInfo: Schema.optionalKey<Schema.Struct<{
|
|
149
|
+
readonly externalId: Schema.optionalKey<Schema.String>;
|
|
150
|
+
readonly displayName: Schema.optionalKey<Schema.String>;
|
|
151
|
+
readonly username: Schema.optionalKey<Schema.String>;
|
|
152
|
+
readonly email: Schema.optionalKey<Schema.String>;
|
|
153
|
+
readonly avatarUrl: Schema.optionalKey<Schema.String>;
|
|
154
|
+
readonly profileUrl: Schema.optionalKey<Schema.String>;
|
|
155
|
+
}>>;
|
|
156
|
+
}>;
|
|
157
|
+
export type AccountCheckResult = typeof AccountCheckResult.Type;
|
|
158
|
+
/** The account a provider's check verifies, with invocation-owned HTTP and cancellation. */
|
|
159
|
+
export interface AccountCheckContext<Auth extends AuthMethods> {
|
|
160
|
+
readonly account: AccountOfMethods<Auth>;
|
|
161
|
+
readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
162
|
+
readonly signal: AbortSignal;
|
|
163
|
+
/**
|
|
164
|
+
* When the host stops waiting for the check, in milliseconds since the epoch. A check still
|
|
165
|
+
* running then fails without its own message, so a check that gives up must do so before it.
|
|
166
|
+
* Executor always sets it; a host that does not limit the check leaves it out.
|
|
167
|
+
*/
|
|
168
|
+
readonly deadline?: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A safe authenticated read proving the account works for this app. Returning passes; a thrown
|
|
172
|
+
* `ProviderError` or HTTP status failure classifies the problem. Any other failure, including a
|
|
173
|
+
* timeout, means the check could not verify the account, not that its credentials are bad. A
|
|
174
|
+
* thrown error's own message is shown to the user, bounded and with the checked credentials
|
|
175
|
+
* replaced, so write it for them.
|
|
176
|
+
*/
|
|
177
|
+
export interface AccountCheck<Auth extends AuthMethods> {
|
|
178
|
+
run(context: AccountCheckContext<Auth>): Effect.Effect<AccountCheckResult | void, unknown>;
|
|
179
|
+
}
|
|
180
|
+
/** A provider declaration. The host derives its identity from the declaration, never its check. */
|
|
88
181
|
export declare class Provider<Auth extends AuthMethods> extends Data.Class<{
|
|
89
182
|
readonly name: string;
|
|
90
183
|
readonly auth: Auth;
|
|
184
|
+
/**
|
|
185
|
+
* The hosts this provider's credentials may be sent to. When present, secret fields reach app
|
|
186
|
+
* code as handles that the outbound network replaces only on requests to these hosts.
|
|
187
|
+
*/
|
|
188
|
+
readonly hosts?: readonly string[];
|
|
189
|
+
/**
|
|
190
|
+
* Stored without its method types so a specific provider still fills a general slot. The host
|
|
191
|
+
* binds the account against this provider's methods before running it.
|
|
192
|
+
*/
|
|
193
|
+
readonly health?: AccountCheck<AuthMethods>;
|
|
91
194
|
}> {
|
|
92
195
|
/** Declare zero or more accounts from this provider without performing I/O. */
|
|
93
196
|
many(): ManyAccounts<Auth>;
|
|
@@ -102,12 +205,14 @@ export declare class ManyAccounts<Auth extends AuthMethods> extends ManyAccounts
|
|
|
102
205
|
}
|
|
103
206
|
/** Infer the data for one method from its native Effect decoder. */
|
|
104
207
|
export type AuthMethodData<Method> = Method extends SecretsMethod<infer Fields> ? Fields["Type"] : Method extends OAuth2Method<infer Response> ? Response["Type"] : never;
|
|
105
|
-
/** One
|
|
106
|
-
export type
|
|
208
|
+
/** One account for these methods, discriminated by its author-chosen method name. */
|
|
209
|
+
export type AccountOfMethods<Auth extends AuthMethods> = {
|
|
107
210
|
readonly [Method in keyof Auth & string]: {
|
|
108
211
|
readonly id: AccountId;
|
|
109
212
|
readonly method: Method;
|
|
110
213
|
readonly fields: AuthMethodData<Auth[Method]>;
|
|
111
214
|
};
|
|
112
|
-
}[keyof Auth & string]
|
|
215
|
+
}[keyof Auth & string];
|
|
216
|
+
/** One selected account, discriminated by its author-chosen method name. */
|
|
217
|
+
export type AccountOf<P> = P extends Provider<infer Auth> ? AccountOfMethods<Auth> : never;
|
|
113
218
|
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Routers group operations. Keys form tool paths; each operation keeps its own kind. */
|
|
2
|
+
import { Schema, type Effect } from "effect";
|
|
3
|
+
import type { HostedTool, HostedToolSummary } from "./host.js";
|
|
4
|
+
import type { AppOperation } from "./operations.js";
|
|
5
|
+
/** Object keys that JavaScript gives special meaning, so no router may use them. */
|
|
6
|
+
export declare const reservedRouterKeys: ReadonlySet<string>;
|
|
7
|
+
/** One static path segment. Dots separate segments, so a key never contains one. */
|
|
8
|
+
export declare const RouterKey: Schema.String;
|
|
9
|
+
/** An image a client may show beside a router, such as an MCP server's own icon. Models never read it. */
|
|
10
|
+
export declare const RouterIcon: Schema.Struct<{
|
|
11
|
+
readonly src: Schema.NonEmptyString;
|
|
12
|
+
readonly mimeType: Schema.optionalKey<Schema.String>;
|
|
13
|
+
readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
14
|
+
readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
|
|
15
|
+
}>;
|
|
16
|
+
export type RouterIcon = typeof RouterIcon.Type;
|
|
17
|
+
/**
|
|
18
|
+
* What an agent should know about a group of tools. `instructions` is published as a skill;
|
|
19
|
+
* `tags` describes labels that tools in this router carry, such as OpenAPI tags.
|
|
20
|
+
*/
|
|
21
|
+
export declare const RouterMeta: Schema.Struct<{
|
|
22
|
+
readonly title: Schema.optionalKey<Schema.String>;
|
|
23
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
24
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
25
|
+
readonly icons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
26
|
+
readonly src: Schema.NonEmptyString;
|
|
27
|
+
readonly mimeType: Schema.optionalKey<Schema.String>;
|
|
28
|
+
readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
29
|
+
readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
|
|
30
|
+
}>>>;
|
|
31
|
+
readonly tags: Schema.optionalKey<Schema.$Record<Schema.NonEmptyString, Schema.String>>;
|
|
32
|
+
}>;
|
|
33
|
+
export type RouterMeta = typeof RouterMeta.Type;
|
|
34
|
+
/** A statically declared router. Children are operations or further routers. */
|
|
35
|
+
export interface AppRouter {
|
|
36
|
+
readonly kind: "router";
|
|
37
|
+
readonly meta?: RouterMeta;
|
|
38
|
+
readonly children: Readonly<Record<string, AppNode>>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A router whose tools are discovered when read, such as an MCP server or OpenAPI document.
|
|
42
|
+
* Names are relative to the router and may contain dots. `readOnly: true` marks a query;
|
|
43
|
+
* anything else is a mutation. Resolution never requires listing.
|
|
44
|
+
*/
|
|
45
|
+
export interface DynamicRouter {
|
|
46
|
+
readonly kind: "dynamic";
|
|
47
|
+
/** Metadata supplied by the source. Author metadata on the router takes precedence. */
|
|
48
|
+
readonly meta?: () => Effect.Effect<RouterMeta, unknown>;
|
|
49
|
+
readonly list: () => Effect.Effect<readonly HostedTool[], unknown>;
|
|
50
|
+
readonly resolve: (name: string) => Effect.Effect<AppOperation | undefined, unknown>;
|
|
51
|
+
/** Names and descriptions without schemas. Omitted sources reduce list(). */
|
|
52
|
+
readonly summaries?: () => Effect.Effect<readonly HostedToolSummary[], unknown>;
|
|
53
|
+
/** One tool's full metadata without listing. Omitted sources search list(). */
|
|
54
|
+
readonly describe?: (name: string) => Effect.Effect<HostedTool | undefined, unknown>;
|
|
55
|
+
/** Static author metadata, merged over the source's metadata. */
|
|
56
|
+
readonly overrides?: RouterMeta;
|
|
57
|
+
}
|
|
58
|
+
/** Anything a router can contain. */
|
|
59
|
+
export type AppNode = AppOperation | AppRouter | DynamicRouter;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Portable Agent Skills returned by an app factory or loaded from published files. */
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
+
import { ApiError } from "../../../utils/src/api-error.js";
|
|
3
4
|
/** Canonical resource path within one skill. */
|
|
4
5
|
export declare const SkillFilePath: Schema.NonEmptyString;
|
|
5
6
|
/** UTF-8 text resource. Reading a resource never executes it. */
|
|
@@ -40,13 +41,25 @@ export declare const AppSkillSource: Schema.Struct<{
|
|
|
40
41
|
readonly "allowed-tools": Schema.optionalKey<Schema.String>;
|
|
41
42
|
}>;
|
|
42
43
|
export type AppSkillSource = typeof AppSkillSource.Type;
|
|
43
|
-
|
|
44
|
+
/** Invalid selected skill files fail the load. Errors identify the file without disclosing its contents. */
|
|
45
|
+
export declare const SkillDefinitionInvalid: Schema.Class<{
|
|
46
|
+
readonly file: string;
|
|
47
|
+
readonly reason: "metadata" | "files" | "directory" | "missing-document" | "frontmatter" | "name-mismatch";
|
|
48
|
+
} & ApiError & {
|
|
49
|
+
readonly _tag: "SkillDefinitionInvalid";
|
|
50
|
+
}, Omit<Schema.TaggedStruct<"SkillDefinitionInvalid", {
|
|
44
51
|
readonly file: Schema.NonEmptyString;
|
|
45
52
|
readonly reason: Schema.Literals<readonly ["files", "directory", "missing-document", "frontmatter", "metadata", "name-mismatch"]>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
} & {
|
|
54
|
+
readonly message: typeof import("../../../utils/src/api-error.js").MessageField;
|
|
55
|
+
}>, "~type.make.in"> & {
|
|
56
|
+
readonly "~type.make.in": {
|
|
57
|
+
readonly reason: "metadata" | "files" | "directory" | "missing-document" | "frontmatter" | "name-mismatch";
|
|
58
|
+
readonly file: string;
|
|
59
|
+
readonly _tag?: "SkillDefinitionInvalid";
|
|
60
|
+
};
|
|
61
|
+
}, ApiError>;
|
|
62
|
+
export type SkillDefinitionInvalid = typeof SkillDefinitionInvalid.Type;
|
|
50
63
|
/** One evaluated catalog cannot contain ambiguous names. */
|
|
51
64
|
export declare const AppSkills: Schema.$Array<Schema.Struct<{
|
|
52
65
|
readonly files: Schema.$Array<Schema.Struct<{
|
|
@@ -66,11 +79,16 @@ declare const SkillLoadFailed_base: Schema.Class<SkillLoadFailed, Schema.TaggedS
|
|
|
66
79
|
readonly reason: Schema.Literals<readonly ["source", "request", "rate_limited", "document", "limit", "changed", "encoding"]>;
|
|
67
80
|
readonly message: Schema.optional<Schema.String>;
|
|
68
81
|
readonly status: Schema.optional<Schema.Int>;
|
|
82
|
+
readonly missing: Schema.optional<Schema.Literals<readonly ["repository", "ref"]>>;
|
|
69
83
|
}>, import("effect/Cause").YieldableError>;
|
|
70
84
|
/**
|
|
71
85
|
* A skill loader failure shown to people. `message` is the explanation they read; write it for
|
|
72
86
|
* them and never include URLs, tokens or response bodies. `reason` selects the title and whether
|
|
73
87
|
* a retry can help. Custom loaders throw this error to get the same presentation as built-ins.
|
|
88
|
+
* With `source`, `missing` names what the service's answer points to as missing: the `repository`,
|
|
89
|
+
* or the branch or tag (`ref`). It may be missing, or not readable with the request's credentials.
|
|
90
|
+
* Without it, the source's settings or the paths it lists are not valid.
|
|
91
|
+
* These fields choose the explanation; they never show that the failure lies outside Executor.
|
|
74
92
|
*/
|
|
75
93
|
export declare class SkillLoadFailed extends SkillLoadFailed_base {
|
|
76
94
|
}
|
|
@@ -102,14 +120,26 @@ export interface SkillCacheOptions {
|
|
|
102
120
|
readonly staleFor?: import("effect").Duration.Input;
|
|
103
121
|
}
|
|
104
122
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
123
|
+
* Whose access reads the repository. A public repository needs neither field. A private one takes
|
|
124
|
+
* a GitHub account and its token, sent on every request of this read. The token comes only with
|
|
125
|
+
* its account, so the catalog is cached in that account's scope and failures name the account.
|
|
107
126
|
*/
|
|
108
|
-
export
|
|
127
|
+
export type GitHubSkillsAccount = import("./cache.js").AccountCredential<{
|
|
128
|
+
/**
|
|
129
|
+
* The account's token or its handle, such as `account.fields.token`. Its provider declares
|
|
130
|
+
* hosts `github.com` and `raw.githubusercontent.com`, so app code never holds the value.
|
|
131
|
+
*/
|
|
132
|
+
readonly token: string;
|
|
133
|
+
}>;
|
|
134
|
+
/**
|
|
135
|
+
* A GitHub repository and an optional immutable commit, tag or branch. With a cache, a branch or
|
|
136
|
+
* tag is resolved again when the catalog refreshes, and each commit's file list is kept.
|
|
137
|
+
*/
|
|
138
|
+
export type GitHubSkillsOptions = SkillTransport & SkillCacheOptions & GitHubSkillsAccount & {
|
|
109
139
|
readonly repo: string;
|
|
110
140
|
readonly path?: string;
|
|
111
141
|
readonly ref?: string;
|
|
112
|
-
}
|
|
142
|
+
};
|
|
113
143
|
/** A published directory index, including its listed skill documents and text references. */
|
|
114
144
|
export interface WellKnownSkillsOptions extends SkillTransport, SkillCacheOptions {
|
|
115
145
|
readonly url: string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-owned SQLite. An app with migrations in `migrations/` reads and writes its own database with
|
|
3
|
+
* plain SQL. The author API mirrors Cloudflare's `SqlStorage`, so tools built for Durable Object
|
|
4
|
+
* SQLite fit it.
|
|
5
|
+
*/
|
|
6
|
+
/** A value SQLite stores or returns. */
|
|
7
|
+
export type SqlValue = string | number | null | ArrayBuffer;
|
|
8
|
+
/** One result row, keyed by column name. */
|
|
9
|
+
export type SqlRow = Record<string, SqlValue>;
|
|
10
|
+
/** The rows of one statement, already read, and what the statement read and wrote. */
|
|
11
|
+
export interface SqlCursor<Row extends SqlRow = SqlRow> extends Iterable<Row> {
|
|
12
|
+
readonly columnNames: readonly string[];
|
|
13
|
+
readonly rowsRead: number;
|
|
14
|
+
readonly rowsWritten: number;
|
|
15
|
+
toArray(): Row[];
|
|
16
|
+
/** The only row. Throws unless the statement returned exactly one. */
|
|
17
|
+
one(): Row;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Read-only SQL. Query tools receive this. A query runs in a transaction that is always rolled
|
|
21
|
+
* back, so nothing it changes commits; one that changes rows fails.
|
|
22
|
+
*/
|
|
23
|
+
export interface SqlReader {
|
|
24
|
+
exec<Row extends SqlRow = SqlRow>(query: string, ...bindings: SqlValue[]): SqlCursor<Row>;
|
|
25
|
+
}
|
|
26
|
+
/** SQL inside one transaction. */
|
|
27
|
+
export type SqlTransaction = SqlReader;
|
|
28
|
+
/**
|
|
29
|
+
* Writable SQL. Outside a transaction every statement commits on its own. `transaction` runs its
|
|
30
|
+
* callback synchronously in one SQLite transaction, so no transaction can stay open while the app
|
|
31
|
+
* waits on anything else; throwing rolls it back. Apps call outside services between transactions.
|
|
32
|
+
*/
|
|
33
|
+
export interface Sql extends SqlReader {
|
|
34
|
+
transaction<T>(work: (tx: SqlTransaction) => Synchronous<T>): T;
|
|
35
|
+
}
|
|
36
|
+
/** A transaction callback's result: a Promise means the callback awaited, which is refused. */
|
|
37
|
+
export type Synchronous<T> = T extends PromiseLike<unknown> ? never : T;
|
|
38
|
+
/** The Durable Object storage a data facet hands its app. App code never receives it. */
|
|
39
|
+
export interface AppSqlStorage {
|
|
40
|
+
readonly sql: {
|
|
41
|
+
exec(query: string, ...bindings: SqlValue[]): {
|
|
42
|
+
readonly columnNames: string[];
|
|
43
|
+
readonly rowsRead: number;
|
|
44
|
+
readonly rowsWritten: number;
|
|
45
|
+
toArray(): Record<string, SqlValue>[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
transactionSync<T>(work: () => T): T;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Tables Executor keeps in an app's database: applied migrations, workflow step receipts, and
|
|
52
|
+
* `_executor_legacy_rows (table_name, id, body)`, the rows of the document API apps used before
|
|
53
|
+
* SQL, with JSON bodies (empty for apps that never stored any). Apps should only read them; a
|
|
54
|
+
* changed migration history fails the next deploy.
|
|
55
|
+
*/
|
|
56
|
+
export declare const reservedTablePrefix = "_executor_";
|
|
57
|
+
/** Where an app keeps its migrations: `0001_create_notes.sql`, applied in number order. */
|
|
58
|
+
export declare const migrationsDirectory = "migrations";
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
/** Browser-to-host operations bind identity and authentication outside authored app code. */
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/
|
|
3
|
+
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
|
|
4
4
|
/** Non-secret page context injected by the serving host. */
|
|
5
5
|
export declare const UiContext: Schema.Struct<{
|
|
6
6
|
readonly deployment: Schema.NonEmptyString;
|
|
7
7
|
readonly profile: Schema.optional<Schema.NonEmptyString>;
|
|
8
8
|
readonly expectedProfileRevision: Schema.optional<Schema.Int>;
|
|
9
9
|
}>;
|
|
10
|
+
/** A problem with one of the page profile's accounts, from stored state. Labels are the owner's own names. */
|
|
11
|
+
export type UiAccountProblem = {
|
|
12
|
+
readonly provider: string;
|
|
13
|
+
readonly reason: "missing" | "removed" | "incompatible";
|
|
14
|
+
} | {
|
|
15
|
+
readonly provider: string;
|
|
16
|
+
readonly account: string;
|
|
17
|
+
readonly reason: "credentials_rejected" | "forbidden" | "upstream_unavailable" | "check_failed";
|
|
18
|
+
};
|
|
19
|
+
/** Account problems found when the page opened, with dashboard links that resolve them. */
|
|
20
|
+
export interface UiAccountNotice {
|
|
21
|
+
readonly app: string;
|
|
22
|
+
readonly problems: readonly UiAccountProblem[];
|
|
23
|
+
/** The profile's accounts in the dashboard. */
|
|
24
|
+
readonly fix: string;
|
|
25
|
+
/** The dashboard chooser, returning to this page. */
|
|
26
|
+
readonly choose: string;
|
|
27
|
+
}
|
|
10
28
|
/** Retained browser bytes. Hosts authorize access before reading or rendering them. */
|
|
11
29
|
export interface AppUiAsset {
|
|
12
30
|
readonly body: Uint8Array;
|