apps 0.0.1-beta.14 → 0.0.1-beta.140
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 +60 -42
- package/framework-reference.json +1 -1
- package/js/{chunk-M3B3DE4K.js → chunk-2XDCAXAR.js} +612 -246
- package/js/{chunk-IPI4MFSN.js → chunk-34RH47V5.js} +2 -2
- package/js/chunk-5JBDHSLK.js +449 -0
- package/js/{chunk-KUMBKVJD.js → chunk-6QZVXLF2.js} +2 -2
- package/js/chunk-7MPPHKRW.js +5418 -0
- package/js/chunk-DQ6FIDC3.js +335 -0
- package/js/{chunk-5T57N25Q.js → chunk-EKXBHVMR.js} +697 -70
- package/js/chunk-EYZHR4UA.js +1945 -0
- package/js/chunk-GJG5G6CH.js +1022 -0
- package/js/chunk-H2K7OZ47.js +90 -0
- package/js/chunk-I6QAWNUM.js +161 -0
- package/js/{chunk-ODEIDRGW.js → chunk-JH3MOQZR.js} +1166 -504
- package/js/{chunk-QS6CAHKC.js → chunk-JHAHT26O.js} +4 -3
- package/js/{chunk-RFVIONFX.js → chunk-JIXIOWZP.js} +136 -45
- package/js/chunk-LSOHA2RH.js +88 -0
- package/js/{chunk-UK573G7W.js → chunk-MB6L5YZE.js} +1817 -632
- package/js/chunk-OBT33ZDK.js +95 -0
- package/js/{chunk-JU7VHODU.js → chunk-QTX7OUFH.js} +65 -10
- package/js/chunk-RBSXSRPU.js +175 -0
- package/js/chunk-SB2DNKDL.js +593 -0
- package/js/{chunk-VFZKSM3T.js → chunk-VX36SA7Y.js} +3 -3
- package/js/chunk-YF7TYPDS.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-YFSOSNF3.js} +17265 -12477
- package/js/{chunk-IJX4CYZO.js → chunk-YVN2AMAU.js} +976 -447
- package/js/chunk-Z6DSU4VL.js +724 -0
- package/js/client.js +333 -98
- package/js/contracts.js +154 -21
- package/js/effect.js +18 -19
- package/js/graphql.js +231 -188
- package/js/host.js +138 -80
- package/js/index.js +153 -300
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4950 -4201
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +220 -81
- 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 +9 -8
- package/js/ui/serving.js +8618 -235
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +56 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +40 -2
- package/types/apps/src/contracts/help-text.d.ts +31 -0
- package/types/apps/src/contracts/host.d.ts +1493 -20
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +47 -8
- package/types/apps/src/contracts/operations.d.ts +14 -7
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +513 -15
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/13.d.ts +6001 -0
- package/types/apps/src/contracts/protocols/2.d.ts +9 -8
- package/types/apps/src/contracts/protocols/3.d.ts +73 -15
- package/types/apps/src/contracts/protocols/4.d.ts +22 -15
- package/types/apps/src/contracts/protocols/5.d.ts +37 -11
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +7114 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +56 -0
- package/types/apps/src/contracts/router.d.ts +2 -1
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +56 -34
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +20 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +16 -13
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/help-text.d.ts +5 -0
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- 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 +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +33 -5
- package/types/apps/src/implementation/openapi-document.d.ts +35 -18
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +2 -1
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/operations.d.ts +58 -7
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +20 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +22 -97
- package/types/apps/src/implementation/router.d.ts +26 -6
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +148 -17
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -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 +3 -3
- 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 +38 -12
- package/types/apps/src/implementation/upstream-error.d.ts +17 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +67 -17
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +22 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -2
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +3 -2
- package/types/telemetry/src/keepalive.d.ts +53 -0
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +6 -2
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +32 -7
- package/types/telemetry/src/span-attributes.d.ts +22 -3
- package/types/telemetry/src/transport.d.ts +10 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/legacy-keys.d.ts +20 -0
- package/types/utils/src/random-uuid.d.ts +6 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-27F7W2LG.js +0 -34
- package/js/chunk-4ASNKGCV.js +0 -242
- package/js/chunk-4DWF4ZWI.js +0 -1280
- package/js/chunk-57RKNWL2.js +0 -75
- package/js/chunk-6HSH75OI.js +0 -2688
- package/js/chunk-G4FT53I7.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-S73JGVR5.js +0 -507
- package/js/chunk-TG6DOCRO.js +0 -299
- package/js/chunk-YPKG2QO5.js +0 -209
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- 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 -18
- 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/storage.d.ts +0 -68
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/implementation/ui-watch.d.ts +0 -2
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth declarations frozen for host protocols 6 onward: `./oauth.ts`'s with an explicit
|
|
3
|
+
* authorization-server metadata URL on discovery. The module imports only `effect` and
|
|
4
|
+
* `./oauth.ts`, so no change elsewhere in the repository can alter it.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
/**
|
|
8
|
+
* OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
|
|
9
|
+
* host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
|
|
10
|
+
* server's `revocation_endpoint` metadata instead.
|
|
11
|
+
*/
|
|
12
|
+
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
13
|
+
readonly discover: Schema.String;
|
|
14
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
15
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
16
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
17
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
18
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
19
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
20
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
21
|
+
readonly path: Schema.String;
|
|
22
|
+
}>>;
|
|
23
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
24
|
+
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
25
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
26
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
27
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
28
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
29
|
+
}>, Schema.Struct<{
|
|
30
|
+
/** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
|
|
31
|
+
readonly authorizationUrl: Schema.String;
|
|
32
|
+
readonly tokenUrl: Schema.String;
|
|
33
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
34
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
35
|
+
/** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
|
|
36
|
+
readonly issuer: Schema.optionalKey<Schema.String>;
|
|
37
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
38
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
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
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
50
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
51
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
52
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
53
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
54
|
+
readonly discover: Schema.String;
|
|
55
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
56
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
57
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
58
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
59
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
60
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
61
|
+
}>, Schema.Struct<{
|
|
62
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
63
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
64
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
65
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
66
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
67
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
68
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
69
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
70
|
+
readonly tokenUrl: Schema.String;
|
|
71
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
72
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
73
|
+
}>]>;
|
|
74
|
+
export type OAuth2Config = typeof OAuth2Config.Type;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth declarations frozen for host protocols 1 through 5. The module imports only `effect`, so
|
|
3
|
+
* no change elsewhere in the repository can alter it. `./oauth-6.ts` holds the declaration later
|
|
4
|
+
* protocols use.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
/** Absolute HTTP(S) URL; local HTTP hosts are supported. */
|
|
8
|
+
export declare const HttpUrl: Schema.String;
|
|
9
|
+
/** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
|
|
10
|
+
export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
11
|
+
export type OAuthClientAuth = typeof OAuthClientAuth.Type;
|
|
12
|
+
/** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
|
|
13
|
+
export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
14
|
+
/** Parameters the host sets on every authorization request; a declaration cannot replace them. */
|
|
15
|
+
export declare const reservedAuthorizationParams: readonly ["response_type", "client_id", "redirect_uri", "state", "scope", "code_challenge", "code_challenge_method", "nonce", "resource", "request", "request_uri"];
|
|
16
|
+
/** A protocol parameter only the host sets on the authorization request. */
|
|
17
|
+
export type ReservedAuthorizationParam = (typeof reservedAuthorizationParams)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Extra authorization request parameters, such as `access_type: "offline"`. RFC 6749 §3.1
|
|
20
|
+
* lets services define their own; the protocol and security parameters stay host-owned.
|
|
21
|
+
*/
|
|
22
|
+
export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Schema.String>;
|
|
23
|
+
/**
|
|
24
|
+
* A declared `authorizationUrl` may carry its own query (RFC 6749 §3.1 keeps it). Each parameter
|
|
25
|
+
* is declared once, in the URL or in `authorizationParams`, and never names a host-owned one.
|
|
26
|
+
*/
|
|
27
|
+
export declare const declaredAuthorizationQuery: import("effect/SchemaAST").Filter<{
|
|
28
|
+
readonly authorizationUrl: string;
|
|
29
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
30
|
+
}>;
|
|
31
|
+
/** How the token endpoint reads requests. RFC 6749 uses a form; some services want JSON. */
|
|
32
|
+
export declare const OAuthTokenRequestFormat: Schema.Literals<readonly ["form", "json"]>;
|
|
33
|
+
export type OAuthTokenRequestFormat = typeof OAuthTokenRequestFormat.Type;
|
|
34
|
+
/**
|
|
35
|
+
* Where a service nests the grant in its token response, as a dot-separated member path. Slack
|
|
36
|
+
* returns a user token under `authed_user`.
|
|
37
|
+
*/
|
|
38
|
+
export declare const OAuthTokenResponse: Schema.Struct<{
|
|
39
|
+
readonly path: Schema.String;
|
|
40
|
+
}>;
|
|
41
|
+
export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
|
|
42
|
+
/** Options for services that differ from RFC 6749 in how they read requests. */
|
|
43
|
+
export declare const tokenRequestOptions: {
|
|
44
|
+
/** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
|
|
45
|
+
scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
46
|
+
/** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
|
|
47
|
+
tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
48
|
+
};
|
|
49
|
+
export declare const oauthOptions: {
|
|
50
|
+
/**
|
|
51
|
+
* Read the grant from this nested member of the token response when the top-level response has
|
|
52
|
+
* no access token or no scope. Slack's user tokens use `{ path: "authed_user" }`.
|
|
53
|
+
*/
|
|
54
|
+
tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
55
|
+
readonly path: Schema.String;
|
|
56
|
+
}>>;
|
|
57
|
+
grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
58
|
+
/**
|
|
59
|
+
* Service-defined authorization request parameters, such as Google's
|
|
60
|
+
* `{ access_type: "offline", prompt: "consent" }`. Host-owned protocol parameters
|
|
61
|
+
* (`state`, `scope`, `redirect_uri`, PKCE and the others in `reservedAuthorizationParams`)
|
|
62
|
+
* are rejected. A discovered endpoint's own query parameter of the same name is replaced.
|
|
63
|
+
*/
|
|
64
|
+
authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
65
|
+
tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
66
|
+
/** Omitted uses discovery; null explicitly suppresses the resource parameter. */
|
|
67
|
+
resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
68
|
+
/** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
|
|
69
|
+
scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
70
|
+
/** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
|
|
71
|
+
tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
|
|
75
|
+
* host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
|
|
76
|
+
* server's `revocation_endpoint` metadata instead.
|
|
77
|
+
*/
|
|
78
|
+
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
79
|
+
readonly discover: Schema.String;
|
|
80
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
81
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
82
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
83
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
84
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
85
|
+
readonly path: Schema.String;
|
|
86
|
+
}>>;
|
|
87
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
88
|
+
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
89
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
90
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
91
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
92
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
/** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
|
|
95
|
+
readonly authorizationUrl: Schema.String;
|
|
96
|
+
readonly tokenUrl: Schema.String;
|
|
97
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
98
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
99
|
+
/** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
|
|
100
|
+
readonly issuer: Schema.optionalKey<Schema.String>;
|
|
101
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
102
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
103
|
+
readonly path: Schema.String;
|
|
104
|
+
}>>;
|
|
105
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
106
|
+
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
107
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
108
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
109
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
110
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
111
|
+
}>, Schema.Struct<{
|
|
112
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
113
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
114
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
115
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
116
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
117
|
+
readonly discover: Schema.String;
|
|
118
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
119
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
120
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
121
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
122
|
+
}>, Schema.Struct<{
|
|
123
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
124
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
125
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
126
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
127
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
128
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
129
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
130
|
+
readonly tokenUrl: Schema.String;
|
|
131
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
132
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
133
|
+
}>]>;
|
|
134
|
+
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,13 +1,26 @@
|
|
|
1
1
|
/** Provider declarations use native Effect schemas. The trusted host interprets them. */
|
|
2
2
|
import { Data, type Effect, Schema } from "effect";
|
|
3
|
+
import type { Placement } from "./placement.js";
|
|
3
4
|
import { type AccountId } from "./schema.js";
|
|
5
|
+
/**
|
|
6
|
+
* How app code sees a field of a provider that declares hosts. Unmarked string fields are secret:
|
|
7
|
+
* app code receives sealed handles that only the host's outbound network turns into values.
|
|
8
|
+
* `plain` fields are not secret. `raw` fields are secret, but app code reads the real value.
|
|
9
|
+
*/
|
|
10
|
+
export type FieldExposure = "plain" | "raw";
|
|
4
11
|
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
12
|
readonly _tag: "secrets";
|
|
6
13
|
} & import("effect/Pipeable").Pipeable;
|
|
7
14
|
/** A named secrets method; its schema retains the provider's own field names. */
|
|
8
15
|
export declare class SecretsMethod<Fields extends Schema.Decoder<unknown>> extends SecretsMethod_base<{
|
|
9
16
|
readonly label: string;
|
|
17
|
+
/** Markdown the connect form shows above the fields: ordered setup, prerequisites, warnings. */
|
|
18
|
+
readonly guide?: string;
|
|
10
19
|
readonly fields: Fields;
|
|
20
|
+
/** Fields marked with `plain()` or `raw()`. */
|
|
21
|
+
readonly exposure?: Readonly<Record<string, FieldExposure>>;
|
|
22
|
+
/** The only places the outbound network sends this method's secret fields; see `Placement`. */
|
|
23
|
+
readonly request?: readonly Placement[];
|
|
11
24
|
}> {
|
|
12
25
|
}
|
|
13
26
|
/** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
|
|
@@ -42,6 +55,8 @@ export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
|
|
|
42
55
|
*/
|
|
43
56
|
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
44
57
|
readonly discover: Schema.String;
|
|
58
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
59
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
45
60
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
46
61
|
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
47
62
|
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
@@ -64,6 +79,7 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
|
64
79
|
/** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
|
|
65
80
|
readonly issuer: Schema.optionalKey<Schema.String>;
|
|
66
81
|
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
82
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
67
83
|
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
68
84
|
readonly path: Schema.String;
|
|
69
85
|
}>>;
|
|
@@ -80,6 +96,8 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
|
80
96
|
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
81
97
|
readonly grant: Schema.Literal<"client_credentials">;
|
|
82
98
|
readonly discover: Schema.String;
|
|
99
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
100
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
83
101
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
84
102
|
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
85
103
|
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
@@ -89,6 +107,7 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
|
89
107
|
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
90
108
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
91
109
|
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
110
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
92
111
|
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
93
112
|
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
94
113
|
readonly grant: Schema.Literal<"client_credentials">;
|
|
@@ -107,7 +126,13 @@ declare const OAuth2Method_base: new <A extends Record<string, any> = {}>(args:
|
|
|
107
126
|
/** OAuth declaration with an explicit schema for app-visible account fields. */
|
|
108
127
|
export declare class OAuth2Method<Response extends Schema.Decoder<unknown>> extends OAuth2Method_base<{
|
|
109
128
|
readonly config: OAuth2Config;
|
|
129
|
+
/** Markdown the connect form shows where a user enters an OAuth client for this service. */
|
|
130
|
+
readonly clientGuide?: string;
|
|
110
131
|
readonly response: Response;
|
|
132
|
+
/** Response fields marked with `plain()` or `raw()`. */
|
|
133
|
+
readonly exposure?: Readonly<Record<string, FieldExposure>>;
|
|
134
|
+
/** The only places the outbound network sends this method's secret fields; see `Placement`. */
|
|
135
|
+
readonly request?: readonly Placement[];
|
|
111
136
|
}> {
|
|
112
137
|
}
|
|
113
138
|
/** Supported declarations; these acquire credentials rather than normalize them. */
|
|
@@ -144,6 +169,12 @@ export interface AccountCheckContext<Auth extends AuthMethods> {
|
|
|
144
169
|
readonly account: AccountOfMethods<Auth>;
|
|
145
170
|
readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
146
171
|
readonly signal: AbortSignal;
|
|
172
|
+
/**
|
|
173
|
+
* When the host stops waiting for the check, in milliseconds since the epoch. A check still
|
|
174
|
+
* running then fails without its own message, so a check that gives up must do so before it.
|
|
175
|
+
* Executor always sets it; a host that does not limit the check leaves it out.
|
|
176
|
+
*/
|
|
177
|
+
readonly deadline?: number;
|
|
147
178
|
}
|
|
148
179
|
/**
|
|
149
180
|
* A safe authenticated read proving the account works for this app. Returning passes; a thrown
|
|
@@ -159,6 +190,11 @@ export interface AccountCheck<Auth extends AuthMethods> {
|
|
|
159
190
|
export declare class Provider<Auth extends AuthMethods> extends Data.Class<{
|
|
160
191
|
readonly name: string;
|
|
161
192
|
readonly auth: Auth;
|
|
193
|
+
/**
|
|
194
|
+
* The hosts this provider's credentials may be sent to. When present, secret fields reach app
|
|
195
|
+
* code as handles that the outbound network replaces only on requests to these hosts.
|
|
196
|
+
*/
|
|
197
|
+
readonly hosts?: readonly string[];
|
|
162
198
|
/**
|
|
163
199
|
* Stored without its method types so a specific provider still fills a general slot. The host
|
|
164
200
|
* binds the account against this provider's methods before running it.
|
|
@@ -178,12 +214,32 @@ export declare class ManyAccounts<Auth extends AuthMethods> extends ManyAccounts
|
|
|
178
214
|
}
|
|
179
215
|
/** Infer the data for one method from its native Effect decoder. */
|
|
180
216
|
export type AuthMethodData<Method> = Method extends SecretsMethod<infer Fields> ? Fields["Type"] : Method extends OAuth2Method<infer Response> ? Response["Type"] : never;
|
|
217
|
+
/**
|
|
218
|
+
* Render an account's credential placements. Each renders the method's `request` with the fields
|
|
219
|
+
* app code holds, so a request built with them is one the outbound network accepts.
|
|
220
|
+
*/
|
|
221
|
+
export interface AccountRequest {
|
|
222
|
+
/**
|
|
223
|
+
* The headers the method's `request` places credentials in, by lowercase name. Spread them into
|
|
224
|
+
* a request's headers. Throws when the method declares no `request`.
|
|
225
|
+
*/
|
|
226
|
+
headers(): Record<string, string>;
|
|
227
|
+
/**
|
|
228
|
+
* `input` with the query parameters the method's `request` places credentials in, replacing any
|
|
229
|
+
* of the same name. Throws when the method declares no `request`.
|
|
230
|
+
*/
|
|
231
|
+
url(input: string | URL): string;
|
|
232
|
+
}
|
|
181
233
|
/** One account for these methods, discriminated by its author-chosen method name. */
|
|
182
234
|
export type AccountOfMethods<Auth extends AuthMethods> = {
|
|
183
235
|
readonly [Method in keyof Auth & string]: {
|
|
184
236
|
readonly id: AccountId;
|
|
185
237
|
readonly method: Method;
|
|
186
238
|
readonly fields: AuthMethodData<Auth[Method]>;
|
|
239
|
+
/** See `AccountRequest`. */
|
|
240
|
+
readonly headers: AccountRequest["headers"];
|
|
241
|
+
/** See `AccountRequest`. */
|
|
242
|
+
readonly url: AccountRequest["url"];
|
|
187
243
|
};
|
|
188
244
|
}[keyof Auth & string];
|
|
189
245
|
/** One selected account, discriminated by its author-chosen method name. */
|
|
@@ -40,7 +40,8 @@ export interface AppRouter {
|
|
|
40
40
|
/**
|
|
41
41
|
* A router whose tools are discovered when read, such as an MCP server or OpenAPI document.
|
|
42
42
|
* Names are relative to the router and may contain dots. `readOnly: true` marks a query;
|
|
43
|
-
* anything else is a mutation.
|
|
43
|
+
* anything else is a mutation. `kindConfirmed: true` says the app's code or the protocol, not an
|
|
44
|
+
* upstream claim, decided the kind. Resolution never requires listing.
|
|
44
45
|
*/
|
|
45
46
|
export interface DynamicRouter {
|
|
46
47
|
readonly kind: "dynamic";
|
|
@@ -33,9 +33,15 @@ export declare const ScheduleTiming: Schema.Union<readonly [Schema.Struct<{
|
|
|
33
33
|
}>;
|
|
34
34
|
}>]>;
|
|
35
35
|
export type ScheduleTiming = typeof ScheduleTiming.Type;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* A named trigger attached to the mutation it invokes, including schema-validated arguments.
|
|
38
|
+
* `scope: "app"` marks an app schedule: one schedule, run without a caller with the app's accounts.
|
|
39
|
+
* Without it, each member who enables the schedule has a copy that runs as them; bundles of
|
|
40
|
+
* protocol 12 and earlier declare only those.
|
|
41
|
+
*/
|
|
37
42
|
export declare const OperationSchedule: Schema.Struct<{
|
|
38
43
|
readonly name: Schema.NonEmptyString;
|
|
44
|
+
readonly scope: Schema.optionalKey<Schema.Literal<"app">>;
|
|
39
45
|
readonly timing: Schema.Union<readonly [Schema.Struct<{
|
|
40
46
|
readonly kind: Schema.Literal<"interval">;
|
|
41
47
|
readonly milliseconds: Schema.Int;
|
|
@@ -12,6 +12,27 @@ export declare const AccountId: Schema.brand<Schema.String, "acc">;
|
|
|
12
12
|
export type AccountId = typeof AccountId.Type;
|
|
13
13
|
/** Absolute HTTP(S) URL; local HTTP hosts are supported. */
|
|
14
14
|
export declare const HttpUrl: Schema.String;
|
|
15
|
+
/** One problem with a declaration: where in it, and what is wrong there. */
|
|
16
|
+
export declare const DeclarationIssue: Schema.Struct<{
|
|
17
|
+
readonly path: Schema.$Array<Schema.String>;
|
|
18
|
+
readonly message: Schema.String;
|
|
19
|
+
}>;
|
|
20
|
+
export type DeclarationIssue = typeof DeclarationIssue.Type;
|
|
21
|
+
declare const DeclarationInvalid_base: Schema.Class<DeclarationInvalid, Schema.TaggedStruct<"DeclarationInvalid", {
|
|
22
|
+
readonly declaration: Schema.String;
|
|
23
|
+
readonly issues: Schema.$Array<Schema.Struct<{
|
|
24
|
+
readonly path: Schema.$Array<Schema.String>;
|
|
25
|
+
readonly message: Schema.String;
|
|
26
|
+
}>>;
|
|
27
|
+
}>, import("effect/Cause").YieldableError>;
|
|
28
|
+
/**
|
|
29
|
+
* An author's declaration, such as the options of `oauth2()`, did not match its schema. Unlike
|
|
30
|
+
* {@link ValidationError} it names each failing path and problem, because the value is the
|
|
31
|
+
* author's own source. Messages never include supplied values.
|
|
32
|
+
*/
|
|
33
|
+
export declare class DeclarationInvalid extends DeclarationInvalid_base {
|
|
34
|
+
get message(): string;
|
|
35
|
+
}
|
|
15
36
|
declare const ValidationError_base: Schema.Class<ValidationError, Schema.TaggedStruct<"ValidationError", {}>, import("effect/Cause").YieldableError>;
|
|
16
37
|
/** Invalid input. Never includes supplied values, credentials or response bodies. */
|
|
17
38
|
export declare class ValidationError extends ValidationError_base {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HostedCatalog, HostedRouter, HostedSharedCatalog, HostedTool } from "./protocols/current.js";
|
|
2
|
+
/** A catalog with each definition and each distinct `$defs` its tools' schemas hold sent once. */
|
|
3
|
+
export declare const shareCatalog: (catalog: {
|
|
4
|
+
readonly tools: ReadonlyArray<HostedTool>;
|
|
5
|
+
readonly routers: ReadonlyArray<HostedRouter>;
|
|
6
|
+
}) => HostedSharedCatalog;
|
|
7
|
+
/**
|
|
8
|
+
* The catalog a shared catalog was made from; undefined when it names a definition or `$defs`
|
|
9
|
+
* it does not send.
|
|
10
|
+
*/
|
|
11
|
+
export declare const restoreSharedCatalog: (catalog: HostedSharedCatalog) => HostedCatalog | undefined;
|
|
@@ -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
|
}
|
|
@@ -80,6 +98,8 @@ export declare const skillLoadLimits: {
|
|
|
80
98
|
readonly fileBytes: 2000000;
|
|
81
99
|
readonly totalBytes: 20000000;
|
|
82
100
|
readonly concurrency: 8;
|
|
101
|
+
/** The request that checks whether a kept catalog's publication changed. */
|
|
102
|
+
readonly checkMillis: 5000;
|
|
83
103
|
};
|
|
84
104
|
/** Invocation-owned transport and cancellation, supplied by the app context. */
|
|
85
105
|
export interface SkillTransport {
|
|
@@ -91,25 +111,42 @@ export interface SkillReaderOptions extends SkillTransport {
|
|
|
91
111
|
readonly service: string;
|
|
92
112
|
}
|
|
93
113
|
/**
|
|
94
|
-
* Catalog reuse shared by remote skill loaders
|
|
95
|
-
*
|
|
114
|
+
* Catalog reuse shared by remote skill loaders. Pass `ctx.cache` to keep the loaded catalog;
|
|
115
|
+
* without it every read fetches the source again. Unlike an MCP tool catalog, a skill catalog
|
|
116
|
+
* past `freshFor` is not served while it refreshes: the read first asks the source whether its
|
|
117
|
+
* publication changed, so agents never read skills that a refresh replaces moments later.
|
|
96
118
|
*/
|
|
97
119
|
export interface SkillCacheOptions {
|
|
98
120
|
readonly cache?: import("./cache.js").AppCache;
|
|
99
|
-
/** Reuse the catalog for this duration. Defaults to five minutes. */
|
|
121
|
+
/** Reuse the catalog without asking the source for this duration. Defaults to five minutes. */
|
|
100
122
|
readonly freshFor?: import("effect").Duration.Input;
|
|
101
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Keep the catalog this long after `freshFor`. A read then confirms it with one request and
|
|
125
|
+
* loads the files again only when the publication changed. Defaults to one day.
|
|
126
|
+
*/
|
|
102
127
|
readonly staleFor?: import("effect").Duration.Input;
|
|
103
128
|
}
|
|
104
129
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
130
|
+
* Whose access reads the repository. A public repository needs neither field. A private one takes
|
|
131
|
+
* a GitHub account and its token, sent on every request of this read. The token comes only with
|
|
132
|
+
* its account, so the catalog is cached in that account's scope and failures name the account.
|
|
107
133
|
*/
|
|
108
|
-
export
|
|
134
|
+
export type GitHubSkillsAccount = import("./cache.js").AccountCredential<{
|
|
135
|
+
/**
|
|
136
|
+
* The account's token or its handle, such as `account.fields.token`. Its provider declares
|
|
137
|
+
* hosts `github.com` and `raw.githubusercontent.com`, so app code never holds the value.
|
|
138
|
+
*/
|
|
139
|
+
readonly token: string;
|
|
140
|
+
}>;
|
|
141
|
+
/**
|
|
142
|
+
* A GitHub repository and an optional immutable commit, tag or branch. With a cache, a branch or
|
|
143
|
+
* tag is resolved again once the catalog is past `freshFor`, and each commit's file list is kept.
|
|
144
|
+
*/
|
|
145
|
+
export type GitHubSkillsOptions = SkillTransport & SkillCacheOptions & GitHubSkillsAccount & {
|
|
109
146
|
readonly repo: string;
|
|
110
147
|
readonly path?: string;
|
|
111
148
|
readonly ref?: string;
|
|
112
|
-
}
|
|
149
|
+
};
|
|
113
150
|
/** A published directory index, including its listed skill documents and text references. */
|
|
114
151
|
export interface WellKnownSkillsOptions extends SkillTransport, SkillCacheOptions {
|
|
115
152
|
readonly url: string;
|
|
@@ -0,0 +1,63 @@
|
|
|
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";
|
|
59
|
+
/**
|
|
60
|
+
* The most values one statement may bind. Durable Object SQLite sets `SQLITE_LIMIT_VARIABLE_NUMBER`
|
|
61
|
+
* to 100 on every host; `ctx.sql` checks it first so the error names the limit.
|
|
62
|
+
*/
|
|
63
|
+
export declare const sqlBindingsLimit = 100;
|