apps 0.0.1-beta.2 → 0.0.1-beta.21

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 (119) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
  4. package/js/{chunk-WFSQXYUT.js → chunk-4QQ62BVS.js} +37 -3
  5. package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
  6. package/js/chunk-625MBYU4.js +524 -0
  7. package/js/{chunk-RN2MXB4R.js → chunk-BLI53LPN.js} +28 -9
  8. package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
  9. package/js/{chunk-J7O55ZV7.js → chunk-CHAK4P5C.js} +317 -176
  10. package/js/{chunk-HDTGZWP2.js → chunk-CMRKLZZY.js} +8 -8
  11. package/js/{chunk-OHRT55C4.js → chunk-IJX4CYZO.js} +3 -6
  12. package/js/{chunk-FDNTX5QJ.js → chunk-IPI4MFSN.js} +2 -2
  13. package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
  14. package/js/chunk-KUMBKVJD.js +39 -0
  15. package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
  16. package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
  17. package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
  18. package/js/{chunk-D47C7KG5.js → chunk-NKLWZJLE.js} +2 -2
  19. package/js/chunk-NMKHTJOQ.js +254 -0
  20. package/js/chunk-OD3KFKZD.js +1617 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-ODEIDRGW.js} +3 -4
  22. package/js/{chunk-5MQZEB6Y.js → chunk-OZ4UK3CD.js} +37 -12
  23. package/js/{chunk-M6ZRRIBI.js → chunk-PJJ24GU7.js} +1 -1
  24. package/js/{chunk-FZJOYIZO.js → chunk-PZB6T6KU.js} +1 -1
  25. package/js/{chunk-LGIYBDWA.js → chunk-R3EV5FTO.js} +13 -1
  26. package/js/{chunk-Z5NMEGJN.js → chunk-RAAPJMVZ.js} +21 -9
  27. package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
  28. package/js/{chunk-4LPG6RCH.js → chunk-VFZKSM3T.js} +5 -25
  29. package/js/{chunk-MYYEW3RA.js → chunk-VXWY44LE.js} +780 -55
  30. package/js/{chunk-JN55AYQH.js → chunk-XNCYIB4D.js} +61 -32
  31. package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
  32. package/js/client.js +10 -26
  33. package/js/contracts.js +74 -16
  34. package/js/effect.js +19 -20
  35. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  36. package/js/graphql.js +47 -49
  37. package/js/host.js +19 -20
  38. package/js/index.js +232 -201
  39. package/js/mcp/effect.js +21 -22
  40. package/js/mcp/stdio.js +25 -26
  41. package/js/mcp.js +74 -56
  42. package/js/openapi.js +3428 -1276
  43. package/js/react.js +3 -3
  44. package/js/skills/effect.js +3 -3
  45. package/js/skills.js +12 -13
  46. package/js/storage/facet.js +4 -4
  47. package/js/ui/auth/contracts.js +8 -9
  48. package/js/ui/auth.js +16 -14
  49. package/js/ui/contracts.js +4 -4
  50. package/js/ui/serving.js +71 -218
  51. package/package.json +1 -1
  52. package/runtime.json +1 -1
  53. package/types/app-data/src/contracts/database.d.ts +33 -6
  54. package/types/app-data/src/implementation/schema.d.ts +2 -17
  55. package/types/apps/src/contracts/app.d.ts +7 -6
  56. package/types/apps/src/contracts/failure.d.ts +25 -0
  57. package/types/apps/src/contracts/host.d.ts +31 -10
  58. package/types/apps/src/contracts/mcp.d.ts +16 -0
  59. package/types/apps/src/contracts/openapi.d.ts +5 -1
  60. package/types/apps/src/contracts/operations.d.ts +0 -5
  61. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  62. package/types/apps/src/contracts/protocols/1.d.ts +235 -67
  63. package/types/apps/src/contracts/protocols/2.d.ts +710 -0
  64. package/types/apps/src/contracts/protocols/3.d.ts +718 -0
  65. package/types/apps/src/contracts/protocols/4.d.ts +1299 -0
  66. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  67. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  68. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  69. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  70. package/types/apps/src/contracts/provider.d.ts +109 -10
  71. package/types/apps/src/contracts/router.d.ts +59 -0
  72. package/types/apps/src/contracts/storage.d.ts +3 -3
  73. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  74. package/types/apps/src/contracts/ui.d.ts +18 -0
  75. package/types/apps/src/contracts/workflows.d.ts +34 -3
  76. package/types/apps/src/graphql.d.ts +1 -3
  77. package/types/apps/src/implementation/account-router.d.ts +12 -0
  78. package/types/apps/src/implementation/app.d.ts +5 -4
  79. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  80. package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
  81. package/types/apps/src/implementation/elicitation.d.ts +2 -2
  82. package/types/apps/src/implementation/failure-detail.d.ts +26 -0
  83. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  84. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  85. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  86. package/types/apps/src/implementation/mcp.d.ts +35 -19
  87. package/types/apps/src/implementation/openapi-compile.d.ts +9 -5
  88. package/types/apps/src/implementation/openapi-document.d.ts +15 -2
  89. package/types/apps/src/implementation/openapi-request.d.ts +8 -1
  90. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  91. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  92. package/types/apps/src/implementation/operations.d.ts +36 -3
  93. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  94. package/types/apps/src/implementation/provider.d.ts +19 -5
  95. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  96. package/types/apps/src/implementation/router.d.ts +68 -0
  97. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  98. package/types/apps/src/implementation/schema.d.ts +44 -1
  99. package/types/apps/src/implementation/storage.d.ts +5 -3
  100. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  101. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  102. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  103. package/types/apps/src/implementation/ui-serving.d.ts +10 -4
  104. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  105. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  106. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  107. package/types/apps/src/index.d.ts +28 -11
  108. package/types/apps/src/mcp-stdio.d.ts +2 -5
  109. package/types/apps/src/mcp.d.ts +5 -4
  110. package/types/apps/src/openapi.d.ts +6 -6
  111. package/types/apps/src/ui-auth.d.ts +2 -2
  112. package/types/telemetry/src/browser-operations.d.ts +5 -2
  113. package/js/chunk-PYUYJRSK.js +0 -93
  114. package/js/chunk-SWPD52J7.js +0 -35
  115. package/js/chunk-TE4KO4HI.js +0 -47
  116. package/js/chunk-W7D7WVSY.js +0 -18
  117. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  118. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  119. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -0,0 +1,89 @@
1
+ /** OAuth declarations frozen for host protocols 1 through 5. */
2
+ import { Schema } from "effect";
3
+ /** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
4
+ export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
5
+ export type OAuthClientAuth = typeof OAuthClientAuth.Type;
6
+ /** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
7
+ export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
8
+ /** Parameters the host sets on every authorization request; a declaration cannot replace them. */
9
+ export declare const reservedAuthorizationParams: readonly ["response_type", "client_id", "redirect_uri", "state", "scope", "code_challenge", "code_challenge_method", "nonce", "resource", "request", "request_uri"];
10
+ /** A protocol parameter only the host sets on the authorization request. */
11
+ export type ReservedAuthorizationParam = (typeof reservedAuthorizationParams)[number];
12
+ /**
13
+ * Extra authorization request parameters, such as `access_type: "offline"`. RFC 6749 §3.1
14
+ * lets services define their own; the protocol and security parameters stay host-owned.
15
+ */
16
+ export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Schema.String>;
17
+ /** How the token endpoint reads requests. RFC 6749 uses a form; some services want JSON. */
18
+ export declare const OAuthTokenRequestFormat: Schema.Literals<readonly ["form", "json"]>;
19
+ export type OAuthTokenRequestFormat = typeof OAuthTokenRequestFormat.Type;
20
+ /**
21
+ * Where a service nests the grant in its token response, as a dot-separated member path. Slack
22
+ * returns a user token under `authed_user`.
23
+ */
24
+ export declare const OAuthTokenResponse: Schema.Struct<{
25
+ readonly path: Schema.String;
26
+ }>;
27
+ export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
28
+ /**
29
+ * OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
30
+ * host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
31
+ * server's `revocation_endpoint` metadata instead.
32
+ */
33
+ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
34
+ readonly discover: Schema.String;
35
+ readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
36
+ readonly tokenUrl: Schema.optionalKey<Schema.Never>;
37
+ readonly revocationUrl: Schema.optionalKey<Schema.Never>;
38
+ readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
39
+ readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
40
+ readonly path: Schema.String;
41
+ }>>;
42
+ readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
43
+ readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
44
+ readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
45
+ readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
46
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
47
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
48
+ }>, Schema.Struct<{
49
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
50
+ readonly authorizationUrl: Schema.String;
51
+ readonly tokenUrl: Schema.String;
52
+ readonly revocationUrl: Schema.optionalKey<Schema.String>;
53
+ readonly scopes: Schema.$Array<Schema.String>;
54
+ /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
55
+ readonly issuer: Schema.optionalKey<Schema.String>;
56
+ readonly discover: Schema.optionalKey<Schema.Never>;
57
+ readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
58
+ readonly path: Schema.String;
59
+ }>>;
60
+ readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
61
+ readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
62
+ readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
63
+ readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
64
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
65
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
66
+ }>, Schema.Struct<{
67
+ readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
68
+ readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
69
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
70
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
71
+ readonly grant: Schema.Literal<"client_credentials">;
72
+ readonly discover: Schema.String;
73
+ readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
74
+ readonly tokenUrl: Schema.optionalKey<Schema.Never>;
75
+ readonly revocationUrl: Schema.optionalKey<Schema.Never>;
76
+ readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
77
+ }>, Schema.Struct<{
78
+ readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
79
+ readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
80
+ readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
81
+ readonly discover: Schema.optionalKey<Schema.Never>;
82
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
83
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
84
+ readonly grant: Schema.Literal<"client_credentials">;
85
+ readonly tokenUrl: Schema.String;
86
+ readonly revocationUrl: Schema.optionalKey<Schema.String>;
87
+ readonly scopes: Schema.$Array<Schema.String>;
88
+ }>]>;
89
+ export type OAuth2Config = typeof OAuth2Config.Type;
@@ -1,6 +1,12 @@
1
1
  /** Provider declarations use native Effect schemas. The trusted host interprets them. */
2
- import { Data, Schema } from "effect";
2
+ import { Data, type Effect, Schema } from "effect";
3
3
  import { type AccountId } from "./schema.js";
4
+ /**
5
+ * How app code sees a field of a provider that declares hosts. Unmarked string fields are secret:
6
+ * app code receives sealed handles that only the host's outbound network turns into values.
7
+ * `plain` fields are not secret. `raw` fields are secret, but app code reads the real value.
8
+ */
9
+ export type FieldExposure = "plain" | "raw";
4
10
  declare const SecretsMethod_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Readonly<A> & {
5
11
  readonly _tag: "secrets";
6
12
  } & import("effect/Pipeable").Pipeable;
@@ -8,6 +14,8 @@ declare const SecretsMethod_base: new <A extends Record<string, any> = {}>(args:
8
14
  export declare class SecretsMethod<Fields extends Schema.Decoder<unknown>> extends SecretsMethod_base<{
9
15
  readonly label: string;
10
16
  readonly fields: Fields;
17
+ /** Fields marked with `plain()` or `raw()`. */
18
+ readonly exposure?: Readonly<Record<string, FieldExposure>>;
11
19
  }> {
12
20
  }
13
21
  /** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
@@ -15,11 +23,26 @@ export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_
15
23
  export type OAuthClientAuth = typeof OAuthClientAuth.Type;
16
24
  /** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
17
25
  export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
26
+ /** Parameters the host sets on every authorization request; a declaration cannot replace them. */
27
+ export declare const reservedAuthorizationParams: readonly ["response_type", "client_id", "redirect_uri", "state", "scope", "code_challenge", "code_challenge_method", "nonce", "resource", "request", "request_uri"];
28
+ /** A protocol parameter only the host sets on the authorization request. */
29
+ export type ReservedAuthorizationParam = (typeof reservedAuthorizationParams)[number];
18
30
  /**
19
31
  * Extra authorization request parameters, such as `access_type: "offline"`. RFC 6749 §3.1
20
32
  * lets services define their own; the protocol and security parameters stay host-owned.
21
33
  */
22
34
  export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Schema.String>;
35
+ /** How the token endpoint reads requests. RFC 6749 uses a form; some services want JSON. */
36
+ export declare const OAuthTokenRequestFormat: Schema.Literals<readonly ["form", "json"]>;
37
+ export type OAuthTokenRequestFormat = typeof OAuthTokenRequestFormat.Type;
38
+ /**
39
+ * Where a service nests the grant in its token response, as a dot-separated member path. Slack
40
+ * returns a user token under `authed_user`.
41
+ */
42
+ export declare const OAuthTokenResponse: Schema.Struct<{
43
+ readonly path: Schema.String;
44
+ }>;
45
+ export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
23
46
  /**
24
47
  * OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
25
48
  * host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
@@ -27,15 +50,23 @@ export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Sch
27
50
  */
28
51
  export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
29
52
  readonly discover: Schema.String;
53
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
54
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
30
55
  readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
31
56
  readonly tokenUrl: Schema.optionalKey<Schema.Never>;
32
57
  readonly revocationUrl: Schema.optionalKey<Schema.Never>;
33
58
  readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
59
+ readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
60
+ readonly path: Schema.String;
61
+ }>>;
34
62
  readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
35
63
  readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
36
64
  readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
37
65
  readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
66
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
67
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
38
68
  }>, Schema.Struct<{
69
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
39
70
  readonly authorizationUrl: Schema.String;
40
71
  readonly tokenUrl: Schema.String;
41
72
  readonly revocationUrl: Schema.optionalKey<Schema.String>;
@@ -43,28 +74,41 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
43
74
  /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
44
75
  readonly issuer: Schema.optionalKey<Schema.String>;
45
76
  readonly discover: Schema.optionalKey<Schema.Never>;
77
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
78
+ readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
79
+ readonly path: Schema.String;
80
+ }>>;
46
81
  readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
47
82
  readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
48
83
  readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
49
84
  readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
85
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
86
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
50
87
  }>, Schema.Struct<{
88
+ readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
89
+ readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
90
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
91
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
51
92
  readonly grant: Schema.Literal<"client_credentials">;
52
93
  readonly discover: Schema.String;
94
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
95
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
53
96
  readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
54
97
  readonly tokenUrl: Schema.optionalKey<Schema.Never>;
55
98
  readonly revocationUrl: Schema.optionalKey<Schema.Never>;
56
99
  readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
100
+ }>, Schema.Struct<{
57
101
  readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
58
102
  readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
59
- }>, Schema.Struct<{
103
+ readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
104
+ readonly discover: Schema.optionalKey<Schema.Never>;
105
+ readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
106
+ readonly scopeSeparator: Schema.optionalKey<Schema.String>;
107
+ readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
60
108
  readonly grant: Schema.Literal<"client_credentials">;
61
109
  readonly tokenUrl: Schema.String;
62
110
  readonly revocationUrl: Schema.optionalKey<Schema.String>;
63
111
  readonly scopes: Schema.$Array<Schema.String>;
64
- readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
65
- readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
66
- readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
67
- readonly discover: Schema.optionalKey<Schema.Never>;
68
112
  }>]>;
69
113
  export type OAuth2Config = typeof OAuth2Config.Type;
70
114
  /** Default app-visible OAuth projection. Refresh tokens and client secrets remain with the host. */
@@ -78,16 +122,69 @@ declare const OAuth2Method_base: new <A extends Record<string, any> = {}>(args:
78
122
  export declare class OAuth2Method<Response extends Schema.Decoder<unknown>> extends OAuth2Method_base<{
79
123
  readonly config: OAuth2Config;
80
124
  readonly response: Response;
125
+ /** Response fields marked with `plain()` or `raw()`. */
126
+ readonly exposure?: Readonly<Record<string, FieldExposure>>;
81
127
  }> {
82
128
  }
83
129
  /** Supported declarations; these acquire credentials rather than normalize them. */
84
130
  export type AuthMethod = SecretsMethod<Schema.Decoder<unknown>> | OAuth2Method<Schema.Decoder<unknown>>;
85
131
  /** Auth method names are chosen by the provider author. */
86
132
  export type AuthMethods = Readonly<Record<string, AuthMethod>>;
87
- /** A provider declaration. The future host derives its identity from normalized content. */
133
+ /**
134
+ * Upstream identity that a passing account check may report for display. Only these fields are
135
+ * retained; the host never stores raw provider responses.
136
+ */
137
+ export declare const AccountInfo: Schema.Struct<{
138
+ readonly externalId: Schema.optionalKey<Schema.String>;
139
+ readonly displayName: Schema.optionalKey<Schema.String>;
140
+ readonly username: Schema.optionalKey<Schema.String>;
141
+ readonly email: Schema.optionalKey<Schema.String>;
142
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
143
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
144
+ }>;
145
+ export type AccountInfo = typeof AccountInfo.Type;
146
+ /** A passing account check. Failures are thrown, so there is no failing variant. */
147
+ export declare const AccountCheckResult: Schema.Struct<{
148
+ readonly accountInfo: Schema.optionalKey<Schema.Struct<{
149
+ readonly externalId: Schema.optionalKey<Schema.String>;
150
+ readonly displayName: Schema.optionalKey<Schema.String>;
151
+ readonly username: Schema.optionalKey<Schema.String>;
152
+ readonly email: Schema.optionalKey<Schema.String>;
153
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
154
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
155
+ }>>;
156
+ }>;
157
+ export type AccountCheckResult = typeof AccountCheckResult.Type;
158
+ /** The account a provider's check verifies, with invocation-owned HTTP and cancellation. */
159
+ export interface AccountCheckContext<Auth extends AuthMethods> {
160
+ readonly account: AccountOfMethods<Auth>;
161
+ readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
162
+ readonly signal: AbortSignal;
163
+ }
164
+ /**
165
+ * A safe authenticated read proving the account works for this app. Returning passes; a thrown
166
+ * `ProviderError` or HTTP status failure classifies the problem. Any other failure, including a
167
+ * timeout, means the check could not verify the account, not that its credentials are bad. A
168
+ * thrown error's own message is shown to the user, bounded and with the checked credentials
169
+ * replaced, so write it for them.
170
+ */
171
+ export interface AccountCheck<Auth extends AuthMethods> {
172
+ run(context: AccountCheckContext<Auth>): Effect.Effect<AccountCheckResult | void, unknown>;
173
+ }
174
+ /** A provider declaration. The host derives its identity from the declaration, never its check. */
88
175
  export declare class Provider<Auth extends AuthMethods> extends Data.Class<{
89
176
  readonly name: string;
90
177
  readonly auth: Auth;
178
+ /**
179
+ * The hosts this provider's credentials may be sent to. When present, secret fields reach app
180
+ * code as handles that the outbound network replaces only on requests to these hosts.
181
+ */
182
+ readonly hosts?: readonly string[];
183
+ /**
184
+ * Stored without its method types so a specific provider still fills a general slot. The host
185
+ * binds the account against this provider's methods before running it.
186
+ */
187
+ readonly health?: AccountCheck<AuthMethods>;
91
188
  }> {
92
189
  /** Declare zero or more accounts from this provider without performing I/O. */
93
190
  many(): ManyAccounts<Auth>;
@@ -102,12 +199,14 @@ export declare class ManyAccounts<Auth extends AuthMethods> extends ManyAccounts
102
199
  }
103
200
  /** Infer the data for one method from its native Effect decoder. */
104
201
  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> ? {
202
+ /** One account for these methods, discriminated by its author-chosen method name. */
203
+ export type AccountOfMethods<Auth extends AuthMethods> = {
107
204
  readonly [Method in keyof Auth & string]: {
108
205
  readonly id: AccountId;
109
206
  readonly method: Method;
110
207
  readonly fields: AuthMethodData<Auth[Method]>;
111
208
  };
112
- }[keyof Auth & string] : never;
209
+ }[keyof Auth & string];
210
+ /** One selected account, discriminated by its author-chosen method name. */
211
+ export type AccountOf<P> = P extends Provider<infer Auth> ? AccountOfMethods<Auth> : never;
113
212
  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;
@@ -2,7 +2,7 @@
2
2
  import { Schema, type Effect } from "effect";
3
3
  import type { RowMetadata, ReadTable, WriteTable } from "../../../app-data/src/index.js";
4
4
  import type { Fields, ObjectValue } from "../implementation/schema.js";
5
- import type { DatabaseSchema, DatabaseSession, AppDatabaseError } from "../../../app-data/src/contracts/database.js";
5
+ import type { DatabaseSchema, DatabaseSession, DatabaseError } from "../../../app-data/src/contracts/database.js";
6
6
  /** Names for authored operations and tables. */
7
7
  export declare const StorageName: Schema.NonEmptyString;
8
8
  declare const AppStorageUnavailable_base: Schema.Class<AppStorageUnavailable, Schema.TaggedStruct<"AppStorageUnavailable", {}>, import("effect/Cause").YieldableError>;
@@ -15,8 +15,8 @@ export declare class AppStorageError extends AppStorageError_base {
15
15
  }
16
16
  /** The adapter owns the database connection and transaction for the whole authored invocation. */
17
17
  export interface AppStorage {
18
- readonly read: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError | AppStorageUnavailable | AppStorageError>;
19
- readonly mutate: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | AppDatabaseError | AppStorageUnavailable | AppStorageError>;
18
+ readonly read: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError | AppStorageUnavailable | AppStorageError>;
19
+ readonly mutate: <A, E>(schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError | AppStorageUnavailable | AppStorageError>;
20
20
  }
21
21
  type InputValue<F extends Fields> = {
22
22
  readonly [K in keyof F as F[K]["optionalValue"] extends true ? never : F[K] extends {
@@ -1,7 +1,5 @@
1
1
  /** Browser authentication protocol. Identity and session storage belong to the host. */
2
2
  import { Schema } from "effect";
3
- import { HttpApi, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
4
- import { UiFailed, UiForbidden, UiUnauthorized } from "./ui.js";
5
3
  /** Opaque correlation ID; possession alone does not authorize an app session. */
6
4
  export declare const AppSignInId: Schema.brand<Schema.String, "AppSignInId">;
7
5
  export type AppSignInId = typeof AppSignInId.Type;
@@ -10,19 +8,13 @@ export declare const AppSignInCode: Schema.RedactedFromValue<Schema.String>;
10
8
  /** A path on the current app origin, including its query and fragment; never a redirect to another host or host-owned route. */
11
9
  export declare const AppReturnPath: Schema.brand<Schema.String, "AppReturnPath">;
12
10
  export type AppReturnPath = typeof AppReturnPath.Type;
13
- /** The trusted callback exchanges an authorization code bound to a browser attempt. */
11
+ /** Callback query on the app origin. The code is single-use and works only with its attempt's cookie. */
14
12
  export declare const AppSignInCallback: Schema.Struct<{
15
13
  readonly request: Schema.brand<Schema.String, "AppSignInId">;
16
14
  readonly code: Schema.RedactedFromValue<Schema.String>;
17
15
  }>;
18
- /** Host-owned endpoints on every app origin, independent of the product's login mechanism. */
19
- export declare const AppSignInApi: HttpApi.HttpApi<"app-sign-in", HttpApiGroup.HttpApiGroup<"appSignIn", HttpApiEndpoint.HttpApiEndpoint<"start", "POST", "/_executor/auth/start", never, never, Schema.toCodecJson<Schema.Struct<{
20
- readonly returnTo: Schema.brand<Schema.String, "AppReturnPath">;
21
- }>>, never, Schema.toCodecJson<Schema.Struct<{
22
- readonly url: Schema.String;
23
- }>>, Schema.toCodecJson<typeof UiForbidden | typeof UiFailed>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"complete", "POST", "/_executor/auth/complete", never, never, Schema.toCodecJson<Schema.Struct<{
24
- readonly request: Schema.brand<Schema.String, "AppSignInId">;
25
- readonly code: Schema.RedactedFromValue<Schema.String>;
26
- }>>, never, Schema.toCodecJson<Schema.Struct<{
27
- readonly returnTo: Schema.brand<Schema.String, "AppReturnPath">;
28
- }>>, Schema.toCodecJson<typeof UiUnauthorized | typeof UiForbidden | typeof UiFailed>, never, never>, false>>;
16
+ /** Host-owned callback path on every app origin. */
17
+ export declare const appSignInCallbackPath = "/_executor/auth/callback";
18
+ /** Why the product could not authorize an attempt; the dashboard explains it without retrying. */
19
+ export declare const AppSignInFailure: Schema.Literals<readonly ["ended", "forbidden", "unavailable"]>;
20
+ export type AppSignInFailure = typeof AppSignInFailure.Type;
@@ -7,6 +7,24 @@ export declare const UiContext: Schema.Struct<{
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;
@@ -24,14 +24,33 @@ export declare const WorkflowStepOptions: Schema.Struct<{
24
24
  readonly timeout: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.NonEmptyString]>>;
25
25
  }>;
26
26
  export type WorkflowStepOptions = typeof WorkflowStepOptions.Type;
27
+ /**
28
+ * Where and why a run failed: the failing step and the error the app's own code raised, its
29
+ * message bounded and with account secrets replaced. Runs from before these fields existed have none.
30
+ */
31
+ export declare const WorkflowFailureDetail: {
32
+ step: Schema.optionalKey<Schema.String>;
33
+ errorName: Schema.optionalKey<Schema.String>;
34
+ message: Schema.optionalKey<Schema.String>;
35
+ };
36
+ /** A failed run's recorded step and app error. */
37
+ export declare const WorkflowRunFailure: Schema.Struct<{
38
+ step: Schema.optionalKey<Schema.String>;
39
+ errorName: Schema.optionalKey<Schema.String>;
40
+ message: Schema.optionalKey<Schema.String>;
41
+ }>;
42
+ export type WorkflowRunFailure = typeof WorkflowRunFailure.Type;
27
43
  declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedStruct<"WorkflowFailure", {
28
44
  readonly reason: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
29
45
  readonly retryable: Schema.Boolean;
46
+ readonly step: Schema.optionalKey<Schema.String>;
47
+ readonly errorName: Schema.optionalKey<Schema.String>;
48
+ readonly message: Schema.optionalKey<Schema.String>;
30
49
  }>, import("effect/Cause").YieldableError>;
31
- /** Safe failures cross host boundaries without authored exceptions or account fields. */
50
+ /** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
32
51
  export declare class WorkflowFailure extends WorkflowFailure_base {
33
52
  }
34
- /** Explicitly stop retrying an authored step. Its message stays inside the app runtime. */
53
+ /** Explicitly stop retrying an authored step. Its message is reported like any step error. */
35
54
  export declare class NonRetryableError extends Error {
36
55
  readonly name = "NonRetryableError";
37
56
  }
@@ -45,7 +64,7 @@ export declare const HostedWorkflow: Schema.Struct<{
45
64
  readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
46
65
  }>;
47
66
  export type HostedWorkflow = typeof HostedWorkflow.Type;
48
- /** Results are available only on completed runs; failure details are safe reason codes. */
67
+ /** Results are available only on completed runs; failures carry a reason code and app error detail. */
49
68
  export declare const WorkflowRun: Schema.Union<readonly [Schema.Struct<{
50
69
  readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "paused", "waitingForPause"]>;
51
70
  readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
@@ -66,6 +85,12 @@ export declare const WorkflowRun: Schema.Union<readonly [Schema.Struct<{
66
85
  }>, Schema.Struct<{
67
86
  readonly status: Schema.Literal<"errored">;
68
87
  readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
88
+ /** The failing step and the app's own error, when the run recorded them. */
89
+ readonly failure: Schema.optionalKey<Schema.Struct<{
90
+ step: Schema.optionalKey<Schema.String>;
91
+ errorName: Schema.optionalKey<Schema.String>;
92
+ message: Schema.optionalKey<Schema.String>;
93
+ }>>;
69
94
  readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
70
95
  readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
71
96
  readonly app: Schema.NonEmptyString;
@@ -104,6 +129,12 @@ export declare const WorkflowRunPage: Schema.Struct<{
104
129
  }>, Schema.Struct<{
105
130
  readonly status: Schema.Literal<"errored">;
106
131
  readonly error: Schema.Literals<readonly ["unavailable", "not_found", "input", "output", "operation", "approval", "credentials", "terminated", "execution", "conflict", "engine"]>;
132
+ /** The failing step and the app's own error, when the run recorded them. */
133
+ readonly failure: Schema.optionalKey<Schema.Struct<{
134
+ step: Schema.optionalKey<Schema.String>;
135
+ errorName: Schema.optionalKey<Schema.String>;
136
+ message: Schema.optionalKey<Schema.String>;
137
+ }>>;
107
138
  readonly profile: Schema.optionalKey<Schema.NonEmptyString>;
108
139
  readonly id: Schema.brand<Schema.NonEmptyString, "wfr">;
109
140
  readonly app: Schema.NonEmptyString;
@@ -4,7 +4,5 @@ import { type GraphqlCatalogOptions } from "./implementation/graphql-catalog.js"
4
4
  export { GraphqlError, type GraphqlToolsOptions } from "./contracts/graphql.js";
5
5
  export type { GraphqlCatalogOptions } from "./implementation/graphql-catalog.js";
6
6
  /** Lazy tools with optional persistent metadata caching for the selected account. */
7
- export declare const graphqlOperations: (options: GraphqlCatalogOptions, kinds?: OperationKinds) => Promise<{
8
- dynamicTools: import("./contracts/dynamic-tools.js").DynamicTools;
9
- }>;
7
+ export declare const graphqlRouter: (options: GraphqlCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
10
8
  export type { OperationKinds } from "./implementation/protocol-operations.js";
@@ -0,0 +1,12 @@
1
+ import { type RouterDeclaration } from "./router.js";
2
+ /**
3
+ * Discover each selected account's router and combine matching names.
4
+ * Calls take { accountId, input }; each branch retains its account's input schema,
5
+ * credentials, approval and output validation. Empty selections expose no operations.
6
+ * Discovery is sequential and cancellation follows the caller's signal.
7
+ */
8
+ export declare const accountRouter: <Account extends {
9
+ readonly id: string;
10
+ }>(accounts: readonly Account[], discover: (account: Account) => Promise<RouterDeclaration>, options: {
11
+ readonly signal: AbortSignal;
12
+ }) => Promise<RouterDeclaration>;
@@ -4,7 +4,7 @@ import type { AppRequirements, AppContext, QueryContext, MutationContext, Webhoo
4
4
  import { type PromiseMethods } from "./authoring.js";
5
5
  import { type WorkflowDeclaration } from "./workflows.js";
6
6
  import type { WorkflowContext } from "../contracts/workflows.js";
7
- import { type OperationDeclaration } from "./operations.js";
7
+ import { type RouterDeclaration } from "./router.js";
8
8
  import { type Schema } from "./schema.js";
9
9
  type PromiseCatalog<Catalog> = Catalog extends Readonly<Record<string, object>> ? {
10
10
  readonly [Name in keyof Catalog]: {
@@ -14,15 +14,16 @@ type PromiseCatalog<Catalog> = Catalog extends Readonly<Record<string, object>>
14
14
  /** Author definition projected from native capabilities. Excluding callable objects keeps
15
15
  * factories from being inferred as definitions and preserves contextual handler inference. */
16
16
  export type AppDefinition<Requirements extends AppRequirements> = {
17
- readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ? Readonly<Record<string, WorkflowDeclaration<WorkflowContext<Requirements>>>> : Key extends "schedules" ? Readonly<Record<string, ScheduleDeclaration<MutationContext<Requirements>>>> : Key extends "queries" ? Readonly<Record<string, OperationDeclaration<"query", QueryContext<Requirements>>>> : Key extends "mutations" ? Readonly<Record<string, OperationDeclaration<"mutation", MutationContext<Requirements>>>> : Key extends "webhooks" ? PromiseCatalog<NonNullable<NativeDefinition<WebhookContext<Requirements>>[Key]>> : NativeDefinition<WebhookContext<Requirements>>[Key];
17
+ readonly [Key in keyof NativeDefinition<WebhookContext<Requirements>>]: Key extends "workflows" ? Readonly<Record<string, WorkflowDeclaration<WorkflowContext<Requirements>>>> : Key extends "schedules" ? Readonly<Record<string, ScheduleDeclaration<MutationContext<Requirements>>>> : Key extends "tools" ? RouterDeclaration<QueryContext<Requirements>, MutationContext<Requirements>> : Key extends "webhooks" ? PromiseCatalog<NonNullable<NativeDefinition<WebhookContext<Requirements>>[Key]>> : NativeDefinition<WebhookContext<Requirements>>[Key];
18
18
  } & {
19
19
  readonly name?: never;
20
- readonly tools?: never;
20
+ readonly queries?: never;
21
+ readonly mutations?: never;
21
22
  readonly call?: never;
22
23
  };
23
24
  /** Adapt operation and webhook catalogs without evaluating their handlers. */
24
25
  export type EffectDefinition<Def> = {
25
- readonly [Key in keyof Def]: Key extends "dynamicTools" ? NonNullable<NativeDefinition<unknown>["dynamicTools"]> : Key extends "workflows" ? Readonly<Record<string, import("../contracts/workflows.js").AppWorkflow>> : Key extends "schedules" ? NonNullable<NativeDefinition<unknown>["schedules"]> : Key extends "queries" | "mutations" ? Readonly<Record<string, import("../contracts/operations.js").AppOperation>> : Key extends "webhooks" ? NonNullable<NativeDefinition<WebhookContext>["webhooks"]> : Key extends "skills" ? NonNullable<NativeDefinition<unknown>["skills"]> : Key extends "dynamicSkills" ? NonNullable<NativeDefinition<unknown>["dynamicSkills"]> : Def[Key];
26
+ readonly [Key in keyof Def]: Key extends "tools" ? NonNullable<NativeDefinition<unknown>["tools"]> : Key extends "workflows" ? Readonly<Record<string, import("../contracts/workflows.js").AppWorkflow>> : Key extends "schedules" ? NonNullable<NativeDefinition<unknown>["schedules"]> : Key extends "webhooks" ? NonNullable<NativeDefinition<WebhookContext>["webhooks"]> : Key extends "skills" ? NonNullable<NativeDefinition<unknown>["skills"]> : Key extends "dynamicSkills" ? NonNullable<NativeDefinition<unknown>["dynamicSkills"]> : Def[Key];
26
27
  };
27
28
  declare const InternalApp: unique symbol;
28
29
  /** Recognize a declaration from this framework instance before host adaptation. */
@@ -0,0 +1,6 @@
1
+ /** Compiled from src/browser/app-watch.ts. */
2
+ export declare const appWatchSource = "\"use strict\";(()=>{var s=()=>{let i=document.getElementById(\"executor-context\")?.textContent;if(!i)return;let n=JSON.parse(i);if(typeof n!=\"object\"||n===null||!(\"deployment\"in n))return;let r=n.deployment;if(typeof r!=\"string\"||r.length===0)return;let t=new EventSource(\"/_executor/version\"),l=!1,o=()=>{l||(l=!0,t.close(),location.reload())};t.addEventListener(\"version\",d=>{let e=JSON.parse(d.data);typeof e==\"object\"&&e!==null&&\"deployment\"in e&&(e.deployment===null||typeof e.deployment==\"string\")&&e.deployment!==r&&o()}),t.addEventListener(\"revoked\",o),window.addEventListener(\"executor:deployment-changed\",o),window.addEventListener(\"pagehide\",()=>t.close(),{once:!0}),window.addEventListener(\"pageshow\",d=>{d.persisted&&o()})};s();})();";
3
+ /** Compiled from src/browser/app-failure.ts. */
4
+ export declare const appFailureSource = "\"use strict\";(()=>{var D=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,A=/^(?:chrome|moz|safari-web)-extension:/,R=new Set([\"Error\",\"TypeError\",\"ReferenceError\",\"SyntaxError\",\"RangeError\",\"URIError\",\"EvalError\",\"AggregateError\"]),x=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith(\"/_executor/assets/\")||!a.pathname.endsWith(\".js\")||(r.push({key:\"code.file.path\",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:\"code.line.number\",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:\"code.column.number\",value:{intValue:String(i)}})),r},E=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,b=f.get(a);if(b!==void 0&&r-b<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:\"executor.ui.failure.suppressed\",value:{intValue:String(g)}}),g=0;let h=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,\"0\")).join(\"\"),S=`${Date.now()}000000`,n,u=\"Sending error report\\u2026\",k=()=>{if(d?.open)return;let s=document.createElement(\"div\"),V=s.attachShadow({mode:\"open\"}),o=document.createElement(\"dialog\");d=o,o.setAttribute(\"aria-labelledby\",\"executor-failure-title\");let y=document.createElement(\"h2\");y.id=\"executor-failure-title\",y.textContent=e===\"script\"?\"This app could not load\":\"This app stopped working\";let C=document.createElement(\"p\");C.textContent=e===\"script\"?\"A file needed by this page did not load. Reload the page to try again.\":\"The app encountered an unexpected error. Reload the page to try again.\";let L=document.createElement(\"p\");L.textContent=\"Copy any unsaved work before reloading.\";let T=document.createElement(\"details\"),v=document.createElement(\"summary\");v.textContent=\"Error details\";let c=document.createElement(\"textarea\");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute(\"aria-label\",\"Error details\"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${h}`,T.append(v,c),n=document.createElement(\"p\"),n.setAttribute(\"role\",\"status\"),n.textContent=u;let l=document.createElement(\"button\");l.type=\"button\",l.textContent=\"Reload page\",l.addEventListener(\"click\",()=>location.reload());let p=document.createElement(\"button\");p.type=\"button\",p.textContent=\"Close\",p.addEventListener(\"click\",()=>o.close()),o.addEventListener(\"close\",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,T,n,l,p),V.append(o),document.documentElement.append(s),o.showModal()};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",k,{once:!0}):k(),fetch(\"/_executor/api/telemetry/traces\",{method:\"POST\",headers:{\"content-type\":\"application/json\"},credentials:\"same-origin\",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:h,spanId:h.slice(0,16),name:\"ui.app.failure\",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:\"executor.ui.failure.kind\",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{u=s.ok?\"Error report sent.\":\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)},()=>{u=\"Could not send the error report. You can copy the error details.\",n&&(n.textContent=u)})};window.addEventListener(\"error\",e=>{if(e instanceof ErrorEvent){if(A.test(e.filename))return;let t=x(e.filename,e.lineno,e.colno);e.error instanceof Error&&R.has(e.error.name)&&t.push({key:\"exception.type\",value:{stringValue:e.error.name}}),E(\"runtime\",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&E(\"script\",`Could not load script: ${e.target.src}`,x(e.target.src))},!0),window.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;E(\"rejection\",t instanceof Error?t.stack??t.message:\"An app operation failed without handling its error.\")})};D();})();";
5
+ /** Compiled from src/browser/account-notice.ts. */
6
+ export declare const accountNoticeSource = "\"use strict\";(()=>{var g=()=>{let r=document.getElementById(\"executor-account-notice\")?.textContent;if(!r)return;let t=JSON.parse(r);if(typeof t!=\"object\"||t===null||!(\"items\"in t)||!(\"fix\"in t))return;let c=t.items,s=t.fix;if(!Array.isArray(c)||typeof s!=\"string\")return;let a=()=>{let i=document.createElement(\"div\"),x=i.attachShadow({mode:\"open\"}),d=document.createElement(\"style\");d.textContent=\"aside{position:fixed;right:16px;bottom:16px;z-index:2147483647;max-width:360px;box-sizing:border-box;padding:14px 16px;border-radius:10px;border:1px solid #fcd34d;background:#fffbeb;color:#451a03;font:14px/1.45 ui-sans-serif,system-ui,sans-serif;box-shadow:0 8px 24px rgb(0 0 0/.12)}strong{display:block;margin-bottom:4px}ul{margin:0 0 10px;padding-left:18px}div{display:flex;gap:12px;align-items:center}a{color:inherit;font-weight:600}button{margin-left:auto;font:inherit;background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}\";let e=document.createElement(\"aside\");e.setAttribute(\"role\",\"status\"),e.setAttribute(\"aria-label\",\"Account warning\");let l=document.createElement(\"strong\");l.textContent=\"Some things might not work\";let m=document.createElement(\"ul\");for(let f of c){let p=document.createElement(\"li\");p.textContent=String(f),m.append(p)}let u=document.createElement(\"div\"),n=document.createElement(\"a\");n.href=s,n.target=\"_top\",n.textContent=\"Review accounts\";let o=document.createElement(\"button\");o.type=\"button\",o.textContent=\"Dismiss\",o.addEventListener(\"click\",()=>i.remove()),u.append(n,o),e.append(l,m,u),x.append(d,e),document.documentElement.append(i)};document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",a,{once:!0}):a()};g();})();";