apps 0.0.1-beta.7 → 0.0.1-beta.73

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 (178) hide show
  1. package/README.md +25 -22
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-RJDDBDSN.js → chunk-3CVQ3VPP.js} +762 -171
  4. package/js/chunk-3R3KFCDU.js +426 -0
  5. package/js/chunk-5FHWNLCI.js +88 -0
  6. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  7. package/js/chunk-7LMU3ER3.js +274 -0
  8. package/js/chunk-CDXQDN7W.js +92 -0
  9. package/js/{chunk-RFVIONFX.js → chunk-ECCWT5GJ.js} +79 -41
  10. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  11. package/js/{chunk-CMYUWAX7.js → chunk-G7L5DHQX.js} +126 -31
  12. package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
  13. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  14. package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
  15. package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
  16. package/js/{chunk-WLE7WX2U.js → chunk-JW5LYSER.js} +2262 -474
  17. package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
  18. package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  19. package/js/chunk-LTF4TLMO.js +347 -0
  20. package/js/chunk-MHB7IFG7.js +49 -0
  21. package/js/{chunk-FL2QR3XW.js → chunk-OBYMFSWA.js} +333 -69
  22. package/js/chunk-OD3KFKZD.js +1617 -0
  23. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  24. package/js/{chunk-72JNVHPK.js → chunk-QGHGYH5V.js} +4 -3
  25. package/js/{chunk-NKLWZJLE.js → chunk-RUP4JMKO.js} +25 -14
  26. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  27. package/js/{chunk-UESPOTUI.js → chunk-WCVV4PPS.js} +899 -190
  28. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  29. package/js/{chunk-Z5M2LQOZ.js → chunk-ZEJ3IKEC.js} +67 -55
  30. package/js/chunk-ZR7QAG67.js +171 -0
  31. package/js/client.js +142 -94
  32. package/js/contracts.js +125 -26
  33. package/js/effect.js +19 -19
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +50 -40
  36. package/js/host.js +83 -58
  37. package/js/index.js +131 -46
  38. package/js/mcp/effect.js +23 -21
  39. package/js/mcp/stdio.js +44 -34
  40. package/js/mcp.js +76 -53
  41. package/js/openapi.js +4071 -1357
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +208 -81
  45. package/js/storage/facet.js +1 -540
  46. package/js/ui/auth/contracts.js +2 -2
  47. package/js/ui/auth.js +5 -5
  48. package/js/ui/contracts.js +5 -4
  49. package/js/ui/serving.js +8517 -214
  50. package/package.json +3 -4
  51. package/runtime.json +1 -1
  52. package/types/app-cache/src/contracts/cache.d.ts +2 -0
  53. package/types/app-cache/src/index.d.ts +10 -1
  54. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  55. package/types/apps/src/contracts/app.d.ts +7 -3
  56. package/types/apps/src/contracts/cache.d.ts +20 -0
  57. package/types/apps/src/contracts/context.d.ts +19 -11
  58. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  59. package/types/apps/src/contracts/events.d.ts +93 -0
  60. package/types/apps/src/contracts/failure.d.ts +30 -1
  61. package/types/apps/src/contracts/graphql.d.ts +2 -1
  62. package/types/apps/src/contracts/host.d.ts +641 -16
  63. package/types/apps/src/contracts/live.d.ts +2 -0
  64. package/types/apps/src/contracts/mcp.d.ts +80 -10
  65. package/types/apps/src/contracts/network.d.ts +120 -0
  66. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  67. package/types/apps/src/contracts/openapi.d.ts +41 -9
  68. package/types/apps/src/contracts/operations.d.ts +8 -4
  69. package/types/apps/src/contracts/placement.d.ts +102 -0
  70. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  71. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  72. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  73. package/types/apps/src/contracts/protocols/2.d.ts +69 -26
  74. package/types/apps/src/contracts/protocols/3.d.ts +133 -33
  75. package/types/apps/src/contracts/protocols/4.d.ts +122 -45
  76. package/types/apps/src/contracts/protocols/5.d.ts +157 -47
  77. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  78. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  79. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  80. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  81. package/types/apps/src/contracts/protocols/current.d.ts +3842 -0
  82. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  83. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  84. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  85. package/types/apps/src/contracts/provider.d.ts +90 -6
  86. package/types/apps/src/contracts/skills.d.ts +50 -13
  87. package/types/apps/src/contracts/sql.d.ts +63 -0
  88. package/types/apps/src/contracts/ui.d.ts +19 -1
  89. package/types/apps/src/contracts/workflows.d.ts +6 -0
  90. package/types/apps/src/facet.d.ts +4 -5
  91. package/types/apps/src/host.d.ts +5 -0
  92. package/types/apps/src/implementation/account-router.d.ts +4 -3
  93. package/types/apps/src/implementation/authoring.d.ts +25 -5
  94. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  95. package/types/apps/src/implementation/cache.d.ts +4 -0
  96. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  97. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  98. package/types/apps/src/implementation/events.d.ts +59 -0
  99. package/types/apps/src/implementation/failure-detail.d.ts +25 -3
  100. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  101. package/types/apps/src/implementation/graphql.d.ts +4 -3
  102. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  103. package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
  104. package/types/apps/src/implementation/live.d.ts +2 -2
  105. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  106. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  107. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  108. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  109. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  110. package/types/apps/src/implementation/mcp.d.ts +20 -9
  111. package/types/apps/src/implementation/network.d.ts +16 -0
  112. package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
  113. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  114. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  115. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  116. package/types/apps/src/implementation/openapi-source.d.ts +18 -0
  117. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  118. package/types/apps/src/implementation/operations.d.ts +17 -2
  119. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  120. package/types/apps/src/implementation/placement.d.ts +60 -0
  121. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  122. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  123. package/types/apps/src/implementation/provider.d.ts +18 -3
  124. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  125. package/types/apps/src/implementation/router-catalog.d.ts +11 -13
  126. package/types/apps/src/implementation/router.d.ts +16 -5
  127. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  128. package/types/apps/src/implementation/schema.d.ts +90 -10
  129. package/types/apps/src/implementation/skills.d.ts +18 -24
  130. package/types/apps/src/implementation/sql.d.ts +71 -0
  131. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  132. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  133. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  134. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  135. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  136. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  137. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  138. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  139. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  140. package/types/apps/src/implementation/workflows.d.ts +1 -1
  141. package/types/apps/src/index.d.ts +55 -13
  142. package/types/apps/src/mcp.d.ts +20 -1
  143. package/types/apps/src/openapi.d.ts +1 -1
  144. package/types/apps/src/react.d.ts +1 -1
  145. package/types/apps/src/skills.d.ts +10 -8
  146. package/types/telemetry/src/app-records.d.ts +42 -0
  147. package/types/telemetry/src/browser-operations.d.ts +7 -4
  148. package/types/telemetry/src/browser.d.ts +8 -3
  149. package/types/telemetry/src/config.d.ts +2 -2
  150. package/types/telemetry/src/index.d.ts +2 -1
  151. package/types/telemetry/src/layer.d.ts +2 -2
  152. package/types/telemetry/src/measurements.d.ts +1 -1
  153. package/types/telemetry/src/ownership.d.ts +56 -0
  154. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  155. package/types/telemetry/src/relay.d.ts +16 -6
  156. package/types/telemetry/src/span-attributes.d.ts +17 -1
  157. package/types/telemetry/src/transport.d.ts +8 -1
  158. package/types/utils/src/api-error.d.ts +55 -0
  159. package/types/utils/src/connection-failure.d.ts +33 -0
  160. package/types/utils/src/recorded-message.d.ts +18 -0
  161. package/types/utils/src/user-facing-error.d.ts +83 -0
  162. package/js/chunk-MKWZPDR6.js +0 -63
  163. package/js/chunk-N7YDVXYJ.js +0 -186
  164. package/js/chunk-OCYUEU47.js +0 -224
  165. package/js/chunk-PJJ24GU7.js +0 -877
  166. package/js/chunk-PZB6T6KU.js +0 -19
  167. package/js/chunk-R3EV5FTO.js +0 -97
  168. package/js/chunk-YXQHV65J.js +0 -242
  169. package/js/chunk-ZQINWV4W.js +0 -630
  170. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  171. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  172. package/types/app-data/src/implementation/promise.d.ts +0 -68
  173. package/types/app-data/src/implementation/range.d.ts +0 -8
  174. package/types/app-data/src/implementation/schema.d.ts +0 -18
  175. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  176. package/types/app-data/src/index.d.ts +0 -4
  177. package/types/apps/src/contracts/storage.d.ts +0 -68
  178. package/types/apps/src/implementation/storage.d.ts +0 -15
@@ -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
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,6 +125,10 @@ 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. */
@@ -114,11 +165,19 @@ export interface AccountCheckContext<Auth extends AuthMethods> {
114
165
  readonly account: AccountOfMethods<Auth>;
115
166
  readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
116
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;
117
174
  }
118
175
  /**
119
176
  * A safe authenticated read proving the account works for this app. Returning passes; a thrown
120
177
  * `ProviderError` or HTTP status failure classifies the problem. Any other failure, including a
121
- * timeout, means the check could not verify the account, not that its credentials are bad.
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.
122
181
  */
123
182
  export interface AccountCheck<Auth extends AuthMethods> {
124
183
  run(context: AccountCheckContext<Auth>): Effect.Effect<AccountCheckResult | void, unknown>;
@@ -127,6 +186,11 @@ export interface AccountCheck<Auth extends AuthMethods> {
127
186
  export declare class Provider<Auth extends AuthMethods> extends Data.Class<{
128
187
  readonly name: string;
129
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[];
130
194
  /**
131
195
  * Stored without its method types so a specific provider still fills a general slot. The host
132
196
  * binds the account against this provider's methods before running it.
@@ -146,12 +210,32 @@ export declare class ManyAccounts<Auth extends AuthMethods> extends ManyAccounts
146
210
  }
147
211
  /** Infer the data for one method from its native Effect decoder. */
148
212
  export type AuthMethodData<Method> = Method extends SecretsMethod<infer Fields> ? Fields["Type"] : Method extends OAuth2Method<infer Response> ? Response["Type"] : never;
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
+ }
149
229
  /** One account for these methods, discriminated by its author-chosen method name. */
150
230
  export type AccountOfMethods<Auth extends AuthMethods> = {
151
231
  readonly [Method in keyof Auth & string]: {
152
232
  readonly id: AccountId;
153
233
  readonly method: Method;
154
234
  readonly fields: AuthMethodData<Auth[Method]>;
235
+ /** See `AccountRequest`. */
236
+ readonly headers: AccountRequest["headers"];
237
+ /** See `AccountRequest`. */
238
+ readonly url: AccountRequest["url"];
155
239
  };
156
240
  }[keyof Auth & string];
157
241
  /** One selected account, discriminated by its author-chosen method name. */
@@ -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
- declare const SkillDefinitionInvalid_base: Schema.Class<SkillDefinitionInvalid, Schema.TaggedStruct<"SkillDefinitionInvalid", {
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
- }>, import("effect/Cause").YieldableError>;
47
- /** Invalid selected skill files fail the load. Errors identify the file without disclosing its contents. */
48
- export declare class SkillDefinitionInvalid extends SkillDefinitionInvalid_base {
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, with the same policy as MCP tool catalogs. Pass
95
- * `ctx.cache` to keep the loaded catalog; without it every read fetches the source again.
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
- /** Serve the retained catalog while refreshing. Defaults to one day. */
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
- * A public GitHub repository and an optional immutable commit, tag or branch. With a cache, a
106
- * branch or tag is resolved again when the catalog refreshes, and each commit's file list is kept.
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 interface GitHubSkillsOptions extends SkillTransport, SkillCacheOptions {
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;
@@ -1,12 +1,30 @@
1
1
  /** Browser-to-host operations bind identity and authentication outside authored app code. */
2
2
  import { Schema } from "effect";
3
- import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
3
+ import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
4
4
  /** Non-secret page context injected by the serving host. */
5
5
  export declare const UiContext: Schema.Struct<{
6
6
  readonly deployment: Schema.NonEmptyString;
7
7
  readonly profile: Schema.optional<Schema.NonEmptyString>;
8
8
  readonly expectedProfileRevision: Schema.optional<Schema.Int>;
9
9
  }>;
10
+ /** A problem with one of the page profile's accounts, from stored state. Labels are the owner's own names. */
11
+ export type UiAccountProblem = {
12
+ readonly provider: string;
13
+ readonly reason: "missing" | "removed" | "incompatible";
14
+ } | {
15
+ readonly provider: string;
16
+ readonly account: string;
17
+ readonly reason: "credentials_rejected" | "forbidden" | "upstream_unavailable" | "check_failed";
18
+ };
19
+ /** Account problems found when the page opened, with dashboard links that resolve them. */
20
+ export interface UiAccountNotice {
21
+ readonly app: string;
22
+ readonly problems: readonly UiAccountProblem[];
23
+ /** The profile's accounts in the dashboard. */
24
+ readonly fix: string;
25
+ /** The dashboard chooser, returning to this page. */
26
+ readonly choose: string;
27
+ }
10
28
  /** Retained browser bytes. Hosts authorize access before reading or rendering them. */
11
29
  export interface AppUiAsset {
12
30
  readonly body: Uint8Array;