apps 0.0.1-beta.1 → 0.0.1-beta.100

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.
Files changed (211) hide show
  1. package/README.md +112 -72
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/chunk-2CURR5Y7.js +264 -0
  5. package/js/chunk-2LSGC7XY.js +42 -0
  6. package/js/{chunk-YEJOQEII.js → chunk-4PIQKACY.js} +65 -10
  7. package/js/chunk-4UPC36ZL.js +5185 -0
  8. package/js/{chunk-4LPG6RCH.js → chunk-4X2UI4R2.js} +7 -27
  9. package/js/chunk-5C6RAGAS.js +335 -0
  10. package/js/chunk-62NVUKED.js +39 -0
  11. package/js/chunk-74H25C4X.js +95 -0
  12. package/js/chunk-7HG422GB.js +90 -0
  13. package/js/chunk-7STIP5CS.js +171 -0
  14. package/js/{chunk-QKHR7BMF.js → chunk-ACQXVKVQ.js} +87 -51
  15. package/js/{chunk-OHRT55C4.js → chunk-DILSCQPJ.js} +226 -265
  16. package/js/chunk-ILYCJ3HV.js +449 -0
  17. package/js/chunk-K6TSCYAO.js +712 -0
  18. package/js/{chunk-EVJUVWN2.js → chunk-KLSEU35Y.js} +463 -218
  19. package/js/chunk-OD3KFKZD.js +1617 -0
  20. package/js/chunk-OWN3DP2W.js +88 -0
  21. package/js/{chunk-ZTFQHGEB.js → chunk-PBGPES67.js} +3 -5
  22. package/js/chunk-QI66R4FP.js +786 -0
  23. package/js/chunk-RN4YB4JT.js +1922 -0
  24. package/js/{chunk-ZCAMUXSG.js → chunk-URKOTNDA.js} +795 -177
  25. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  26. package/js/{chunk-2HHMABB6.js → chunk-VAI3EVCS.js} +700 -78
  27. package/js/chunk-VCYWAA4N.js +49 -0
  28. package/js/{chunk-HDJH3RPR.js → chunk-YDW7DX3A.js} +4 -4
  29. package/js/chunk-YWVISRZD.js +268 -0
  30. package/js/{chunk-FW5HBOIK.js → chunk-ZKDXML77.js} +19272 -18299
  31. package/js/client.js +148 -100
  32. package/js/contracts.js +208 -24
  33. package/js/effect.js +18 -19
  34. package/js/es-DIULA3ZF.js +39371 -0
  35. package/js/graphql.js +62 -58
  36. package/js/host.js +83 -60
  37. package/js/index.js +381 -263
  38. package/js/mcp/effect.js +21 -21
  39. package/js/mcp.js +117 -74
  40. package/js/openapi.js +4613 -42691
  41. package/js/react.js +2 -3
  42. package/js/skills/effect.js +6 -4
  43. package/js/skills.js +233 -70
  44. package/js/storage/facet.js +1 -540
  45. package/js/ui/auth/contracts.js +8 -9
  46. package/js/ui/auth.js +16 -14
  47. package/js/ui/contracts.js +9 -8
  48. package/js/ui/serving.js +8609 -227
  49. package/package.json +3 -8
  50. package/runtime.json +1 -1
  51. package/types/app-cache/src/contracts/cache.d.ts +60 -2
  52. package/types/app-cache/src/index.d.ts +92 -2
  53. package/types/app-data/src/contracts/database.d.ts +33 -6
  54. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  55. package/types/apps/src/contracts/app.d.ts +63 -17
  56. package/types/apps/src/contracts/cache.d.ts +24 -1
  57. package/types/apps/src/contracts/context.d.ts +60 -17
  58. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  59. package/types/apps/src/contracts/events.d.ts +94 -0
  60. package/types/apps/src/contracts/failure.d.ts +54 -0
  61. package/types/apps/src/contracts/graphql.d.ts +2 -1
  62. package/types/apps/src/contracts/host.d.ts +1325 -534
  63. package/types/apps/src/contracts/icons.d.ts +28 -0
  64. package/types/apps/src/contracts/live.d.ts +2 -0
  65. package/types/apps/src/contracts/mcp.d.ts +97 -20
  66. package/types/apps/src/contracts/network.d.ts +120 -0
  67. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  68. package/types/apps/src/contracts/openapi-document.d.ts +1 -1
  69. package/types/apps/src/contracts/openapi.d.ts +51 -9
  70. package/types/apps/src/contracts/operations.d.ts +14 -12
  71. package/types/apps/src/contracts/placement.d.ts +102 -0
  72. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  73. package/types/apps/src/contracts/protocols/1.d.ts +2241 -0
  74. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  75. package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
  76. package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
  77. package/types/apps/src/contracts/protocols/2.d.ts +711 -0
  78. package/types/apps/src/contracts/protocols/3.d.ts +776 -0
  79. package/types/apps/src/contracts/protocols/4.d.ts +1306 -0
  80. package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
  81. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  82. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  83. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  84. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  85. package/types/apps/src/contracts/protocols/current.d.ts +6857 -0
  86. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  87. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  88. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  89. package/types/apps/src/contracts/provider.d.ts +140 -10
  90. package/types/apps/src/contracts/router.d.ts +59 -0
  91. package/types/apps/src/contracts/schedules.d.ts +7 -1
  92. package/types/apps/src/contracts/schema.d.ts +21 -0
  93. package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
  94. package/types/apps/src/contracts/skills.d.ts +60 -14
  95. package/types/apps/src/contracts/sql.d.ts +63 -0
  96. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  97. package/types/apps/src/contracts/ui.d.ts +70 -30
  98. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  99. package/types/apps/src/contracts/workflows.d.ts +89 -36
  100. package/types/apps/src/facet.d.ts +4 -5
  101. package/types/apps/src/graphql.d.ts +1 -3
  102. package/types/apps/src/host.d.ts +5 -0
  103. package/types/apps/src/implementation/account-router.d.ts +13 -0
  104. package/types/apps/src/implementation/app.d.ts +44 -16
  105. package/types/apps/src/implementation/authoring.d.ts +25 -5
  106. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  107. package/types/apps/src/implementation/cache.d.ts +32 -3
  108. package/types/apps/src/implementation/catalog-cache.d.ts +43 -5
  109. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  110. package/types/apps/src/implementation/events.d.ts +64 -0
  111. package/types/apps/src/implementation/failure-detail.d.ts +48 -0
  112. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  113. package/types/apps/src/implementation/graphql.d.ts +4 -3
  114. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  115. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  116. package/types/apps/src/implementation/live.d.ts +2 -2
  117. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  118. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  119. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  120. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  121. package/types/apps/src/implementation/mcp.d.ts +52 -25
  122. package/types/apps/src/implementation/network.d.ts +16 -0
  123. package/types/apps/src/implementation/openapi-compile.d.ts +30 -8
  124. package/types/apps/src/implementation/openapi-document.d.ts +46 -21
  125. package/types/apps/src/implementation/openapi-names.d.ts +23 -0
  126. package/types/apps/src/implementation/openapi-request.d.ts +10 -3
  127. package/types/apps/src/implementation/openapi-source.d.ts +30 -8
  128. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  129. package/types/apps/src/implementation/operations.d.ts +84 -10
  130. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  131. package/types/apps/src/implementation/placement.d.ts +60 -0
  132. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  133. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  134. package/types/apps/src/implementation/provider.d.ts +26 -6
  135. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  136. package/types/apps/src/implementation/router-catalog.d.ts +227 -0
  137. package/types/apps/src/implementation/router.d.ts +78 -0
  138. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  139. package/types/apps/src/implementation/schedules.d.ts +39 -8
  140. package/types/apps/src/implementation/schema.d.ts +111 -15
  141. package/types/apps/src/implementation/skills.d.ts +18 -24
  142. package/types/apps/src/implementation/sql.d.ts +71 -0
  143. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  144. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  145. package/types/apps/src/implementation/ui-auth.d.ts +12 -6
  146. package/types/apps/src/implementation/ui-client.d.ts +3 -3
  147. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  148. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  149. package/types/apps/src/implementation/ui-serving.d.ts +31 -12
  150. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  151. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  152. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  153. package/types/apps/src/implementation/workflow-context.d.ts +17 -5
  154. package/types/apps/src/implementation/workflows.d.ts +11 -4
  155. package/types/apps/src/index.d.ts +71 -21
  156. package/types/apps/src/mcp.d.ts +25 -5
  157. package/types/apps/src/openapi.d.ts +11 -6
  158. package/types/apps/src/react.d.ts +1 -1
  159. package/types/apps/src/skills.d.ts +13 -8
  160. package/types/apps/src/ui-auth.d.ts +2 -2
  161. package/types/apps/src/ui-serving.d.ts +1 -1
  162. package/types/telemetry/src/app-records.d.ts +42 -0
  163. package/types/telemetry/src/browser-operations.d.ts +7 -4
  164. package/types/telemetry/src/browser.d.ts +8 -3
  165. package/types/telemetry/src/config.d.ts +2 -2
  166. package/types/telemetry/src/index.d.ts +2 -1
  167. package/types/telemetry/src/layer.d.ts +10 -4
  168. package/types/telemetry/src/measurements.d.ts +1 -1
  169. package/types/telemetry/src/ownership.d.ts +60 -0
  170. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  171. package/types/telemetry/src/relay.d.ts +16 -6
  172. package/types/telemetry/src/span-attributes.d.ts +17 -1
  173. package/types/telemetry/src/transport.d.ts +8 -1
  174. package/types/utils/src/api-error.d.ts +55 -0
  175. package/types/utils/src/connection-failure.d.ts +33 -0
  176. package/types/utils/src/legacy-keys.d.ts +20 -0
  177. package/types/utils/src/recorded-message.d.ts +18 -0
  178. package/types/utils/src/schema-definitions.d.ts +13 -0
  179. package/types/utils/src/user-facing-error.d.ts +83 -0
  180. package/js/chunk-6IIO4NPI.js +0 -29
  181. package/js/chunk-6YBRWRK3.js +0 -160
  182. package/js/chunk-BMOIAIVR.js +0 -138
  183. package/js/chunk-FZJOYIZO.js +0 -19
  184. package/js/chunk-G7IE6BKC.js +0 -224
  185. package/js/chunk-IHQ4ML7K.js +0 -2193
  186. package/js/chunk-KOXMLKTM.js +0 -1288
  187. package/js/chunk-M6ZRRIBI.js +0 -877
  188. package/js/chunk-PLCMJREA.js +0 -590
  189. package/js/chunk-PZ36XMXW.js +0 -93
  190. package/js/chunk-RBAC33PQ.js +0 -267
  191. package/js/chunk-SATWJKN6.js +0 -34
  192. package/js/chunk-SWPD52J7.js +0 -35
  193. package/js/chunk-TE4KO4HI.js +0 -47
  194. package/js/chunk-W7D7WVSY.js +0 -18
  195. package/js/chunk-X7SFGU4Q.js +0 -280
  196. package/js/chunk-ZJWDMTE3.js +0 -63
  197. package/js/mcp/stdio.js +0 -128
  198. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  199. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  200. package/types/app-data/src/implementation/promise.d.ts +0 -68
  201. package/types/app-data/src/implementation/range.d.ts +0 -8
  202. package/types/app-data/src/implementation/schema.d.ts +0 -33
  203. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  204. package/types/app-data/src/index.d.ts +0 -4
  205. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  206. package/types/apps/src/contracts/storage.d.ts +0 -68
  207. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  208. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  209. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  210. package/types/apps/src/implementation/storage.d.ts +0 -13
  211. package/types/apps/src/mcp-stdio.d.ts +0 -8
@@ -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,6 +1,13 @@
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
+ 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;
@@ -8,6 +15,10 @@ declare const SecretsMethod_base: new <A extends Record<string, any> = {}>(args:
8
15
  export declare class SecretsMethod<Fields extends Schema.Decoder<unknown>> extends SecretsMethod_base<{
9
16
  readonly label: string;
10
17
  readonly fields: Fields;
18
+ /** Fields marked with `plain()` or `raw()`. */
19
+ readonly exposure?: Readonly<Record<string, FieldExposure>>;
20
+ /** The only places the outbound network sends this method's secret fields; see `Placement`. */
21
+ readonly request?: readonly Placement[];
11
22
  }> {
12
23
  }
13
24
  /** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
@@ -15,11 +26,26 @@ export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_
15
26
  export type OAuthClientAuth = typeof OAuthClientAuth.Type;
16
27
  /** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
17
28
  export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
29
+ /** Parameters the host sets on every authorization request; a declaration cannot replace them. */
30
+ export declare const reservedAuthorizationParams: readonly ["response_type", "client_id", "redirect_uri", "state", "scope", "code_challenge", "code_challenge_method", "nonce", "resource", "request", "request_uri"];
31
+ /** A protocol parameter only the host sets on the authorization request. */
32
+ export type ReservedAuthorizationParam = (typeof reservedAuthorizationParams)[number];
18
33
  /**
19
34
  * Extra authorization request parameters, such as `access_type: "offline"`. RFC 6749 §3.1
20
35
  * lets services define their own; the protocol and security parameters stay host-owned.
21
36
  */
22
37
  export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Schema.String>;
38
+ /** How the token endpoint reads requests. RFC 6749 uses a form; some services want JSON. */
39
+ export declare const OAuthTokenRequestFormat: Schema.Literals<readonly ["form", "json"]>;
40
+ export type OAuthTokenRequestFormat = typeof OAuthTokenRequestFormat.Type;
41
+ /**
42
+ * Where a service nests the grant in its token response, as a dot-separated member path. Slack
43
+ * returns a user token under `authed_user`.
44
+ */
45
+ export declare const OAuthTokenResponse: Schema.Struct<{
46
+ readonly path: Schema.String;
47
+ }>;
48
+ export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
23
49
  /**
24
50
  * OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
25
51
  * host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
@@ -27,15 +53,23 @@ export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Sch
27
53
  */
28
54
  export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
29
55
  readonly discover: Schema.String;
56
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
57
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
30
58
  readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
31
59
  readonly tokenUrl: Schema.optionalKey<Schema.Never>;
32
60
  readonly revocationUrl: Schema.optionalKey<Schema.Never>;
33
61
  readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
62
+ readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
63
+ readonly path: Schema.String;
64
+ }>>;
34
65
  readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
35
66
  readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
36
67
  readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
37
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"]>>;
38
71
  }>, Schema.Struct<{
72
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
39
73
  readonly authorizationUrl: Schema.String;
40
74
  readonly tokenUrl: Schema.String;
41
75
  readonly revocationUrl: Schema.optionalKey<Schema.String>;
@@ -43,28 +77,41 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
43
77
  /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
44
78
  readonly issuer: Schema.optionalKey<Schema.String>;
45
79
  readonly discover: Schema.optionalKey<Schema.Never>;
80
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
81
+ readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
82
+ readonly path: Schema.String;
83
+ }>>;
46
84
  readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
47
85
  readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
48
86
  readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
49
87
  readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
88
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
89
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
50
90
  }>, Schema.Struct<{
91
+ readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
92
+ readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
93
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
94
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
51
95
  readonly grant: Schema.Literal<"client_credentials">;
52
96
  readonly discover: Schema.String;
97
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
98
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
53
99
  readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
54
100
  readonly tokenUrl: Schema.optionalKey<Schema.Never>;
55
101
  readonly revocationUrl: Schema.optionalKey<Schema.Never>;
56
102
  readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
103
+ }>, Schema.Struct<{
57
104
  readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
58
105
  readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
59
- }>, Schema.Struct<{
106
+ readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
107
+ readonly discover: Schema.optionalKey<Schema.Never>;
108
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
109
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
110
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
60
111
  readonly grant: Schema.Literal<"client_credentials">;
61
112
  readonly tokenUrl: Schema.String;
62
113
  readonly revocationUrl: Schema.optionalKey<Schema.String>;
63
114
  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
115
  }>]>;
69
116
  export type OAuth2Config = typeof OAuth2Config.Type;
70
117
  /** Default app-visible OAuth projection. Refresh tokens and client secrets remain with the host. */
@@ -78,16 +125,77 @@ declare const OAuth2Method_base: new <A extends Record<string, any> = {}>(args:
78
125
  export declare class OAuth2Method<Response extends Schema.Decoder<unknown>> extends OAuth2Method_base<{
79
126
  readonly config: OAuth2Config;
80
127
  readonly response: Response;
128
+ /** Response fields marked with `plain()` or `raw()`. */
129
+ readonly exposure?: Readonly<Record<string, FieldExposure>>;
130
+ /** The only places the outbound network sends this method's secret fields; see `Placement`. */
131
+ readonly request?: readonly Placement[];
81
132
  }> {
82
133
  }
83
134
  /** Supported declarations; these acquire credentials rather than normalize them. */
84
135
  export type AuthMethod = SecretsMethod<Schema.Decoder<unknown>> | OAuth2Method<Schema.Decoder<unknown>>;
85
136
  /** Auth method names are chosen by the provider author. */
86
137
  export type AuthMethods = Readonly<Record<string, AuthMethod>>;
87
- /** A provider declaration. The future host derives its identity from normalized content. */
138
+ /**
139
+ * Upstream identity that a passing account check may report for display. Only these fields are
140
+ * retained; the host never stores raw provider responses.
141
+ */
142
+ export declare const AccountInfo: Schema.Struct<{
143
+ readonly externalId: Schema.optionalKey<Schema.String>;
144
+ readonly displayName: Schema.optionalKey<Schema.String>;
145
+ readonly username: Schema.optionalKey<Schema.String>;
146
+ readonly email: Schema.optionalKey<Schema.String>;
147
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
148
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
149
+ }>;
150
+ export type AccountInfo = typeof AccountInfo.Type;
151
+ /** A passing account check. Failures are thrown, so there is no failing variant. */
152
+ export declare const AccountCheckResult: Schema.Struct<{
153
+ readonly accountInfo: Schema.optionalKey<Schema.Struct<{
154
+ readonly externalId: Schema.optionalKey<Schema.String>;
155
+ readonly displayName: Schema.optionalKey<Schema.String>;
156
+ readonly username: Schema.optionalKey<Schema.String>;
157
+ readonly email: Schema.optionalKey<Schema.String>;
158
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
159
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
160
+ }>>;
161
+ }>;
162
+ export type AccountCheckResult = typeof AccountCheckResult.Type;
163
+ /** The account a provider's check verifies, with invocation-owned HTTP and cancellation. */
164
+ export interface AccountCheckContext<Auth extends AuthMethods> {
165
+ readonly account: AccountOfMethods<Auth>;
166
+ readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
167
+ readonly signal: AbortSignal;
168
+ /**
169
+ * When the host stops waiting for the check, in milliseconds since the epoch. A check still
170
+ * running then fails without its own message, so a check that gives up must do so before it.
171
+ * Executor always sets it; a host that does not limit the check leaves it out.
172
+ */
173
+ readonly deadline?: number;
174
+ }
175
+ /**
176
+ * A safe authenticated read proving the account works for this app. Returning passes; a thrown
177
+ * `ProviderError` or HTTP status failure classifies the problem. Any other failure, including a
178
+ * timeout, means the check could not verify the account, not that its credentials are bad. A
179
+ * thrown error's own message is shown to the user, bounded and with the checked credentials
180
+ * replaced, so write it for them.
181
+ */
182
+ export interface AccountCheck<Auth extends AuthMethods> {
183
+ run(context: AccountCheckContext<Auth>): Effect.Effect<AccountCheckResult | void, unknown>;
184
+ }
185
+ /** A provider declaration. The host derives its identity from the declaration, never its check. */
88
186
  export declare class Provider<Auth extends AuthMethods> extends Data.Class<{
89
187
  readonly name: string;
90
188
  readonly auth: Auth;
189
+ /**
190
+ * The hosts this provider's credentials may be sent to. When present, secret fields reach app
191
+ * code as handles that the outbound network replaces only on requests to these hosts.
192
+ */
193
+ readonly hosts?: readonly string[];
194
+ /**
195
+ * Stored without its method types so a specific provider still fills a general slot. The host
196
+ * binds the account against this provider's methods before running it.
197
+ */
198
+ readonly health?: AccountCheck<AuthMethods>;
91
199
  }> {
92
200
  /** Declare zero or more accounts from this provider without performing I/O. */
93
201
  many(): ManyAccounts<Auth>;
@@ -102,12 +210,34 @@ export declare class ManyAccounts<Auth extends AuthMethods> extends ManyAccounts
102
210
  }
103
211
  /** Infer the data for one method from its native Effect decoder. */
104
212
  export type AuthMethodData<Method> = Method extends SecretsMethod<infer Fields> ? Fields["Type"] : Method extends OAuth2Method<infer Response> ? Response["Type"] : never;
105
- /** One selected account, discriminated by its author-chosen method name. */
106
- export type AccountOf<P> = P extends Provider<infer Auth> ? {
213
+ /**
214
+ * Render an account's credential placements. Each renders the method's `request` with the fields
215
+ * app code holds, so a request built with them is one the outbound network accepts.
216
+ */
217
+ export interface AccountRequest {
218
+ /**
219
+ * The headers the method's `request` places credentials in, by lowercase name. Spread them into
220
+ * a request's headers. Throws when the method declares no `request`.
221
+ */
222
+ headers(): Record<string, string>;
223
+ /**
224
+ * `input` with the query parameters the method's `request` places credentials in, replacing any
225
+ * of the same name. Throws when the method declares no `request`.
226
+ */
227
+ url(input: string | URL): string;
228
+ }
229
+ /** One account for these methods, discriminated by its author-chosen method name. */
230
+ export type AccountOfMethods<Auth extends AuthMethods> = {
107
231
  readonly [Method in keyof Auth & string]: {
108
232
  readonly id: AccountId;
109
233
  readonly method: Method;
110
234
  readonly fields: AuthMethodData<Auth[Method]>;
235
+ /** See `AccountRequest`. */
236
+ readonly headers: AccountRequest["headers"];
237
+ /** See `AccountRequest`. */
238
+ readonly url: AccountRequest["url"];
111
239
  };
112
- }[keyof Auth & string] : never;
240
+ }[keyof Auth & string];
241
+ /** One selected account, discriminated by its author-chosen method name. */
242
+ export type AccountOf<P> = P extends Provider<infer Auth> ? AccountOfMethods<Auth> : never;
113
243
  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;
@@ -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
- /** A named trigger attached to the mutation it invokes, including schema-validated arguments. */
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;