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
@@ -1,26 +1,24 @@
1
1
  import {
2
+ DatabaseFieldReserved,
3
+ DatabaseLimitExceeded,
2
4
  DatabaseSchema
3
- } from "./chunk-BMOIAIVR.js";
5
+ } from "./chunk-N7YDVXYJ.js";
4
6
  import {
5
7
  CacheCommand,
6
- CacheReply
7
- } from "./chunk-LGIYBDWA.js";
8
+ CacheReply,
9
+ ProviderError
10
+ } from "./chunk-R3EV5FTO.js";
8
11
  import {
12
+ AppSkillName,
9
13
  AppSkills,
10
14
  SkillLoadFailed
11
- } from "./chunk-YEJOQEII.js";
12
- import {
13
- OpenapiResponseError
14
- } from "./chunk-SWPD52J7.js";
15
- import {
16
- ProviderError
17
- } from "./chunk-W7D7WVSY.js";
15
+ } from "./chunk-JU7VHODU.js";
18
16
  import {
19
17
  AccountId,
20
18
  HttpUrl,
21
19
  JsonObject as JsonObject2,
22
20
  JsonValue
23
- } from "./chunk-SATWJKN6.js";
21
+ } from "./chunk-27F7W2LG.js";
24
22
  import {
25
23
  Any,
26
24
  ArraySchema,
@@ -74,7 +72,31 @@ import {
74
72
  transformOptional,
75
73
  withConstructorDefault,
76
74
  withDefault
77
- } from "./chunk-FW5HBOIK.js";
75
+ } from "./chunk-CDL5PM2Q.js";
76
+
77
+ // src/contracts/router.ts
78
+ var reservedRouterKeys = /* @__PURE__ */ new Set([
79
+ "__proto__",
80
+ "constructor",
81
+ "prototype"
82
+ ]);
83
+ var RouterKey = Schema_exports.String.check(
84
+ Schema_exports.isPattern(/^[A-Za-z_][A-Za-z0-9_-]{0,99}$/),
85
+ Schema_exports.makeFilter((key) => !reservedRouterKeys.has(key))
86
+ );
87
+ var RouterIcon = Schema_exports.Struct({
88
+ src: Schema_exports.NonEmptyString,
89
+ mimeType: Schema_exports.optionalKey(Schema_exports.String),
90
+ sizes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
91
+ theme: Schema_exports.optionalKey(Schema_exports.Literals(["light", "dark"]))
92
+ });
93
+ var RouterMeta = Schema_exports.Struct({
94
+ title: Schema_exports.optionalKey(Schema_exports.String),
95
+ description: Schema_exports.optionalKey(Schema_exports.String),
96
+ instructions: Schema_exports.optionalKey(Schema_exports.String),
97
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
98
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String))
99
+ });
78
100
 
79
101
  // src/contracts/tools.ts
80
102
  var ToolAnnotations = Schema_exports.Struct({
@@ -128,6 +150,15 @@ var McpToolMetadata = Schema_exports.Struct({
128
150
  annotations: Schema_exports.optional(ToolAnnotations),
129
151
  _meta: Schema_exports.optional(JsonObject2)
130
152
  });
153
+ var McpServerHeader = Schema_exports.Struct({
154
+ name: Schema_exports.optionalKey(Schema_exports.String),
155
+ title: Schema_exports.optionalKey(Schema_exports.String),
156
+ version: Schema_exports.optionalKey(Schema_exports.String),
157
+ description: Schema_exports.optionalKey(Schema_exports.String),
158
+ websiteUrl: Schema_exports.optionalKey(Schema_exports.String),
159
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
160
+ instructions: Schema_exports.optionalKey(Schema_exports.String)
161
+ });
131
162
  var McpError = class extends Schema_exports.TaggedError()("McpError", {
132
163
  phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
133
164
  reason: Schema_exports.Literals([
@@ -150,6 +181,44 @@ var ProcessConfig = Schema_exports.Struct({
150
181
  )
151
182
  });
152
183
 
184
+ // src/contracts/api-response-error.ts
185
+ var ApiErrorRecovery = Schema_exports.Struct({
186
+ action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
187
+ instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096))
188
+ });
189
+ var ApiErrorResponse = Schema_exports.Struct({
190
+ code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
191
+ status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
192
+ message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096)),
193
+ recovery: Schema_exports.optionalKey(ApiErrorRecovery)
194
+ });
195
+ var OpenapiResponseError = class extends Schema_exports.TaggedError()(
196
+ "OpenapiResponseError",
197
+ ApiErrorResponse.fields
198
+ ) {
199
+ };
200
+ var OpenapiErrorLimits = Schema_exports.Struct({
201
+ maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
202
+ readTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
203
+ });
204
+ var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
205
+ maxBodyBytes: 65536,
206
+ readTimeoutMs: 2e3
207
+ });
208
+
209
+ // src/contracts/failure.ts
210
+ var maxFailureMessageLength = 2048;
211
+ var FailureSource = Schema_exports.Literals(["app", "storage", "service"]);
212
+ var FailureName = Schema_exports.String.check(Schema_exports.isMaxLength(128));
213
+ var FailureCode = Schema_exports.String.check(Schema_exports.isMaxLength(128));
214
+ var FailureMessage = Schema_exports.String.check(Schema_exports.isMaxLength(maxFailureMessageLength));
215
+ var FailureDetail = {
216
+ source: Schema_exports.optionalKey(FailureSource),
217
+ errorName: Schema_exports.optionalKey(FailureName),
218
+ code: Schema_exports.optionalKey(FailureCode),
219
+ message: Schema_exports.optionalKey(FailureMessage)
220
+ };
221
+
153
222
  // src/contracts/workflows.ts
154
223
  var WorkflowRunId = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
155
224
  var WorkflowName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
@@ -191,7 +260,14 @@ var WorkflowStepOptions = Schema_exports.Struct({
191
260
  ),
192
261
  timeout: Schema_exports.optionalKey(WorkflowDuration)
193
262
  });
263
+ var WorkflowFailureDetail = {
264
+ step: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMaxLength(200))),
265
+ errorName: Schema_exports.optionalKey(FailureName),
266
+ message: Schema_exports.optionalKey(FailureMessage)
267
+ };
268
+ var WorkflowRunFailure = Schema_exports.Struct(WorkflowFailureDetail);
194
269
  var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailure", {
270
+ ...WorkflowFailureDetail,
195
271
  reason: Schema_exports.Literals([
196
272
  "unavailable",
197
273
  "not_found",
@@ -239,7 +315,9 @@ var WorkflowRun = Schema_exports.Union([
239
315
  Schema_exports.Struct({
240
316
  ...runFields,
241
317
  status: Schema_exports.Literal("errored"),
242
- error: WorkflowFailure.fields.reason
318
+ error: WorkflowFailure.fields.reason,
319
+ /** The failing step and the app's own error, when the run recorded them. */
320
+ failure: Schema_exports.optionalKey(WorkflowRunFailure)
243
321
  }),
244
322
  Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("terminated") })
245
323
  ]);
@@ -1736,7 +1814,7 @@ var OAuthSecretClientAuth = Schema_exports.Literals([
1736
1814
  "client_secret_basic",
1737
1815
  "client_secret_basic_raw"
1738
1816
  ]);
1739
- var reservedAuthorizationParams = /* @__PURE__ */ new Set([
1817
+ var reservedAuthorizationParams = [
1740
1818
  "response_type",
1741
1819
  "client_id",
1742
1820
  "redirect_uri",
@@ -1748,17 +1826,55 @@ var reservedAuthorizationParams = /* @__PURE__ */ new Set([
1748
1826
  "resource",
1749
1827
  "request",
1750
1828
  "request_uri"
1751
- ]);
1829
+ ];
1830
+ var reserved = new Set(reservedAuthorizationParams);
1752
1831
  var OAuthAuthorizationParams = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
1753
- Schema_exports.makeFilter(
1754
- (params) => Object.keys(params).every((key) => !reservedAuthorizationParams.has(key)),
1755
- {
1756
- message: "Authorization parameters cannot replace protocol parameters such as state or scope."
1757
- }
1758
- )
1832
+ Schema_exports.makeFilter((params) => Object.keys(params).every((key) => !reserved.has(key)), {
1833
+ message: "Authorization parameters cannot replace protocol parameters such as state or scope."
1834
+ })
1835
+ );
1836
+ var declaredAuthorizationQuery = Schema_exports.makeFilter(
1837
+ (config) => {
1838
+ const keys = [...new URL(config.authorizationUrl).searchParams.keys()];
1839
+ const owned = keys.filter((key) => reserved.has(key));
1840
+ if (owned.length > 0)
1841
+ return {
1842
+ path: ["authorizationUrl"],
1843
+ issue: `authorizationUrl cannot set protocol parameters: ${owned.join(", ")}.`
1844
+ };
1845
+ const repeated = keys.filter((key) => Object.hasOwn(config.authorizationParams ?? {}, key));
1846
+ if (repeated.length > 0)
1847
+ return {
1848
+ path: ["authorizationParams"],
1849
+ issue: `Declare each parameter once; authorizationUrl already sets: ${repeated.join(", ")}.`
1850
+ };
1851
+ return void 0;
1852
+ }
1759
1853
  );
1854
+ var OAuthTokenRequestFormat = Schema_exports.Literals(["form", "json"]);
1855
+ var OAuthTokenResponse = Schema_exports.Struct({
1856
+ path: Schema_exports.String.check(Schema_exports.isPattern(/^[^.]+(\.[^.]+)*$/))
1857
+ });
1858
+ var tokenRequestOptions = {
1859
+ /** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
1860
+ scopeSeparator: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMinLength(1))),
1861
+ /** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
1862
+ tokenRequestFormat: Schema_exports.optionalKey(OAuthTokenRequestFormat)
1863
+ };
1760
1864
  var oauthOptions = {
1865
+ ...tokenRequestOptions,
1866
+ /**
1867
+ * Read the grant from this nested member of the token response when the top-level response has
1868
+ * no access token or no scope. Slack's user tokens use `{ path: "authed_user" }`.
1869
+ */
1870
+ tokenResponse: Schema_exports.optionalKey(OAuthTokenResponse),
1761
1871
  grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
1872
+ /**
1873
+ * Service-defined authorization request parameters, such as Google's
1874
+ * `{ access_type: "offline", prompt: "consent" }`. Host-owned protocol parameters
1875
+ * (`state`, `scope`, `redirect_uri`, PKCE and the others in `reservedAuthorizationParams`)
1876
+ * are rejected. A discovered endpoint's own query parameter of the same name is replaced.
1877
+ */
1762
1878
  authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams),
1763
1879
  tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth),
1764
1880
  /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
@@ -1768,6 +1884,8 @@ var OAuth2Config = Schema_exports.Union([
1768
1884
  Schema_exports.Struct({
1769
1885
  ...oauthOptions,
1770
1886
  discover: HttpUrl,
1887
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
1888
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl),
1771
1889
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1772
1890
  tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1773
1891
  revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
@@ -1775,21 +1893,26 @@ var OAuth2Config = Schema_exports.Union([
1775
1893
  }),
1776
1894
  Schema_exports.Struct({
1777
1895
  ...oauthOptions,
1896
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
1778
1897
  authorizationUrl: HttpUrl,
1779
1898
  tokenUrl: HttpUrl,
1780
1899
  revocationUrl: Schema_exports.optionalKey(HttpUrl),
1781
1900
  scopes: Schema_exports.Array(Schema_exports.String),
1782
1901
  /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
1783
1902
  issuer: Schema_exports.optionalKey(HttpUrl),
1784
- discover: Schema_exports.optionalKey(Schema_exports.Never)
1785
- }),
1903
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
1904
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
1905
+ }).check(declaredAuthorizationQuery),
1786
1906
  Schema_exports.Struct({
1787
1907
  grant: Schema_exports.Literal("client_credentials"),
1788
1908
  discover: HttpUrl,
1909
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
1910
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl),
1789
1911
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1790
1912
  tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1791
1913
  revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1792
1914
  scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
1915
+ ...tokenRequestOptions,
1793
1916
  tokenEndpointAuthMethod: OAuthSecretClientAuth,
1794
1917
  resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1795
1918
  }),
@@ -1798,10 +1921,12 @@ var OAuth2Config = Schema_exports.Union([
1798
1921
  tokenUrl: HttpUrl,
1799
1922
  revocationUrl: Schema_exports.optionalKey(HttpUrl),
1800
1923
  scopes: Schema_exports.Array(Schema_exports.String),
1924
+ ...tokenRequestOptions,
1801
1925
  tokenEndpointAuthMethod: OAuthSecretClientAuth,
1802
1926
  resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
1803
1927
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1804
- discover: Schema_exports.optionalKey(Schema_exports.Never)
1928
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
1929
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
1805
1930
  })
1806
1931
  ]);
1807
1932
  var OAuth2AccessToken = Schema_exports.Struct({ access_token: Schema_exports.String });
@@ -1809,6 +1934,16 @@ var OAuth2Method = class extends Data_exports.TaggedClass(
1809
1934
  "oauth2"
1810
1935
  ) {
1811
1936
  };
1937
+ var displayText = Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(255));
1938
+ var AccountInfo = Schema_exports.Struct({
1939
+ externalId: Schema_exports.optionalKey(displayText),
1940
+ displayName: Schema_exports.optionalKey(displayText),
1941
+ username: Schema_exports.optionalKey(displayText),
1942
+ email: Schema_exports.optionalKey(displayText),
1943
+ avatarUrl: Schema_exports.optionalKey(HttpUrl),
1944
+ profileUrl: Schema_exports.optionalKey(HttpUrl)
1945
+ });
1946
+ var AccountCheckResult = Schema_exports.Struct({ accountInfo: Schema_exports.optionalKey(AccountInfo) });
1812
1947
  var Provider = class extends Data_exports.Class {
1813
1948
  /** Declare zero or more accounts from this provider without performing I/O. */
1814
1949
  many() {
@@ -1819,7 +1954,129 @@ var ManyAccounts = class extends Data_exports.TaggedClass("many") {
1819
1954
  };
1820
1955
 
1821
1956
  // src/contracts/protocol-version.ts
1822
- var frameworkProtocol = 1;
1957
+ var frameworkProtocol = 7;
1958
+
1959
+ // src/contracts/protocols/oauth.ts
1960
+ var OAuthClientAuth2 = Schema_exports.Literals([
1961
+ "none",
1962
+ "client_secret_post",
1963
+ "client_secret_basic",
1964
+ "client_secret_basic_raw"
1965
+ ]);
1966
+ var OAuthSecretClientAuth2 = Schema_exports.Literals([
1967
+ "client_secret_post",
1968
+ "client_secret_basic",
1969
+ "client_secret_basic_raw"
1970
+ ]);
1971
+ var reservedAuthorizationParams2 = [
1972
+ "response_type",
1973
+ "client_id",
1974
+ "redirect_uri",
1975
+ "state",
1976
+ "scope",
1977
+ "code_challenge",
1978
+ "code_challenge_method",
1979
+ "nonce",
1980
+ "resource",
1981
+ "request",
1982
+ "request_uri"
1983
+ ];
1984
+ var reserved2 = new Set(reservedAuthorizationParams2);
1985
+ var OAuthAuthorizationParams2 = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
1986
+ Schema_exports.makeFilter((params) => Object.keys(params).every((key) => !reserved2.has(key)), {
1987
+ message: "Authorization parameters cannot replace protocol parameters such as state or scope."
1988
+ })
1989
+ );
1990
+ var declaredAuthorizationQuery2 = Schema_exports.makeFilter(
1991
+ (config) => {
1992
+ const keys = [...new URL(config.authorizationUrl).searchParams.keys()];
1993
+ const owned = keys.filter((key) => reserved2.has(key));
1994
+ if (owned.length > 0)
1995
+ return {
1996
+ path: ["authorizationUrl"],
1997
+ issue: `authorizationUrl cannot set protocol parameters: ${owned.join(", ")}.`
1998
+ };
1999
+ const repeated = keys.filter((key) => Object.hasOwn(config.authorizationParams ?? {}, key));
2000
+ if (repeated.length > 0)
2001
+ return {
2002
+ path: ["authorizationParams"],
2003
+ issue: `Declare each parameter once; authorizationUrl already sets: ${repeated.join(", ")}.`
2004
+ };
2005
+ return void 0;
2006
+ }
2007
+ );
2008
+ var OAuthTokenRequestFormat2 = Schema_exports.Literals(["form", "json"]);
2009
+ var OAuthTokenResponse2 = Schema_exports.Struct({
2010
+ path: Schema_exports.String.check(Schema_exports.isPattern(/^[^.]+(\.[^.]+)*$/))
2011
+ });
2012
+ var tokenRequestOptions2 = {
2013
+ /** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
2014
+ scopeSeparator: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMinLength(1))),
2015
+ /** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
2016
+ tokenRequestFormat: Schema_exports.optionalKey(OAuthTokenRequestFormat2)
2017
+ };
2018
+ var oauthOptions2 = {
2019
+ ...tokenRequestOptions2,
2020
+ /**
2021
+ * Read the grant from this nested member of the token response when the top-level response has
2022
+ * no access token or no scope. Slack's user tokens use `{ path: "authed_user" }`.
2023
+ */
2024
+ tokenResponse: Schema_exports.optionalKey(OAuthTokenResponse2),
2025
+ grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
2026
+ /**
2027
+ * Service-defined authorization request parameters, such as Google's
2028
+ * `{ access_type: "offline", prompt: "consent" }`. Host-owned protocol parameters
2029
+ * (`state`, `scope`, `redirect_uri`, PKCE and the others in `reservedAuthorizationParams`)
2030
+ * are rejected. A discovered endpoint's own query parameter of the same name is replaced.
2031
+ */
2032
+ authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams2),
2033
+ tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth2),
2034
+ /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
2035
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
2036
+ };
2037
+ var OAuth2Config2 = Schema_exports.Union([
2038
+ Schema_exports.Struct({
2039
+ ...oauthOptions2,
2040
+ discover: HttpUrl,
2041
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2042
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
2043
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2044
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
2045
+ }),
2046
+ Schema_exports.Struct({
2047
+ ...oauthOptions2,
2048
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
2049
+ authorizationUrl: HttpUrl,
2050
+ tokenUrl: HttpUrl,
2051
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
2052
+ scopes: Schema_exports.Array(Schema_exports.String),
2053
+ /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
2054
+ issuer: Schema_exports.optionalKey(HttpUrl),
2055
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
2056
+ }).check(declaredAuthorizationQuery2),
2057
+ Schema_exports.Struct({
2058
+ grant: Schema_exports.Literal("client_credentials"),
2059
+ discover: HttpUrl,
2060
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2061
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
2062
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2063
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
2064
+ ...tokenRequestOptions2,
2065
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
2066
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
2067
+ }),
2068
+ Schema_exports.Struct({
2069
+ grant: Schema_exports.Literal("client_credentials"),
2070
+ tokenUrl: HttpUrl,
2071
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
2072
+ scopes: Schema_exports.Array(Schema_exports.String),
2073
+ ...tokenRequestOptions2,
2074
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
2075
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
2076
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2077
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
2078
+ })
2079
+ ]);
1823
2080
 
1824
2081
  // src/contracts/schedules.ts
1825
2082
  var minimumIntervalMilliseconds = 6e4;
@@ -1857,26 +2114,47 @@ var OperationSchedule = Schema_exports.Struct({
1857
2114
  });
1858
2115
 
1859
2116
  // src/contracts/protocols/1.ts
2117
+ var WorkflowFailure2 = class extends Schema_exports.TaggedError()("WorkflowFailure", {
2118
+ reason: Schema_exports.Literals([
2119
+ "unavailable",
2120
+ "not_found",
2121
+ "input",
2122
+ "output",
2123
+ "operation",
2124
+ "approval",
2125
+ "credentials",
2126
+ "terminated",
2127
+ "execution",
2128
+ "conflict",
2129
+ "engine"
2130
+ ]),
2131
+ retryable: Schema_exports.Boolean
2132
+ }) {
2133
+ };
2134
+ var WorkflowRpcResult2 = Schema_exports.Union([
2135
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
2136
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure2 })
2137
+ ]);
1860
2138
  var DeclaredAuthMethod = Schema_exports.Union([
1861
2139
  Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
1862
2140
  Schema_exports.Struct({
1863
2141
  type: Schema_exports.Literal("oauth2"),
1864
- ...OAuth2Config.members[0].fields,
2142
+ ...OAuth2Config2.members[0].fields,
1865
2143
  response: JsonObject2
1866
2144
  }),
1867
2145
  Schema_exports.Struct({
1868
2146
  type: Schema_exports.Literal("oauth2"),
1869
- ...OAuth2Config.members[1].fields,
2147
+ ...OAuth2Config2.members[1].fields,
1870
2148
  response: JsonObject2
1871
2149
  }),
1872
2150
  Schema_exports.Struct({
1873
2151
  type: Schema_exports.Literal("oauth2"),
1874
- ...OAuth2Config.members[2].fields,
2152
+ ...OAuth2Config2.members[2].fields,
1875
2153
  response: JsonObject2
1876
2154
  }),
1877
2155
  Schema_exports.Struct({
1878
2156
  type: Schema_exports.Literal("oauth2"),
1879
- ...OAuth2Config.members[3].fields,
2157
+ ...OAuth2Config2.members[3].fields,
1880
2158
  response: JsonObject2
1881
2159
  })
1882
2160
  ]);
@@ -2041,7 +2319,7 @@ var HostError = Schema_exports.Union([
2041
2319
  ProviderError,
2042
2320
  McpError,
2043
2321
  SkillLoadFailed,
2044
- WorkflowFailure,
2322
+ WorkflowFailure2,
2045
2323
  HostRequestInvalid,
2046
2324
  HostAccountsInvalid,
2047
2325
  HostDeclarationInvalid,
@@ -2085,6 +2363,84 @@ var protocol1 = {
2085
2363
  elicitationRequest: FormElicitation,
2086
2364
  elicitationReply: ElicitationReply,
2087
2365
  workflowStep: WorkflowRpcCommand,
2366
+ workflowStepReply: WorkflowRpcResult2,
2367
+ workflowControl: WorkflowControlCommand,
2368
+ cacheCommand: CacheCommand,
2369
+ cacheReply: CacheReply
2370
+ }
2371
+ };
2372
+
2373
+ // src/contracts/protocols/2.ts
2374
+ var SkillSources2 = Schema_exports.Struct({
2375
+ skills: AppSkills,
2376
+ dynamic: Schema_exports.Boolean,
2377
+ cached: Schema_exports.optionalKey(Schema_exports.Boolean)
2378
+ });
2379
+ var SkillCatalogResponse2 = Schema_exports.Union([SkillSources2, AppSkills]);
2380
+ var protocol2 = {
2381
+ version: 2,
2382
+ schemas: { ...protocol1.schemas, skills: SkillCatalogResponse2 }
2383
+ };
2384
+
2385
+ // src/contracts/protocols/3.ts
2386
+ var HostDeclarationInvalid2 = class extends Schema_exports.TaggedError()(
2387
+ "HostDeclarationInvalid",
2388
+ FailureDetail
2389
+ ) {
2390
+ };
2391
+ var HostEvaluationFailed2 = class extends Schema_exports.TaggedError()(
2392
+ "HostEvaluationFailed",
2393
+ FailureDetail
2394
+ ) {
2395
+ };
2396
+ var HostOperationFailed2 = class extends Schema_exports.TaggedError()(
2397
+ "HostOperationFailed",
2398
+ FailureDetail
2399
+ ) {
2400
+ };
2401
+ var HostError2 = Schema_exports.Union([
2402
+ OpenapiResponseError,
2403
+ ProviderError,
2404
+ McpError,
2405
+ SkillLoadFailed,
2406
+ WorkflowFailure,
2407
+ HostRequestInvalid,
2408
+ HostAccountsInvalid,
2409
+ HostDeclarationInvalid2,
2410
+ HostEvaluationFailed2,
2411
+ HostOperationNotFound,
2412
+ HostOperationFailed2,
2413
+ DatabaseLimitExceeded,
2414
+ DatabaseFieldReserved,
2415
+ HostToolNotFound,
2416
+ HostInputInvalid,
2417
+ HostOutputInvalid,
2418
+ HostToolBlocked,
2419
+ HostToolApprovalRequired,
2420
+ HostToolPolicyFailed,
2421
+ ElicitationFailed
2422
+ ]);
2423
+ var HostResponse2 = Schema_exports.Union([
2424
+ Schema_exports.Struct({
2425
+ ok: Schema_exports.Literal(true),
2426
+ value: JsonValue,
2427
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2428
+ }),
2429
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError2 })
2430
+ ]);
2431
+ var protocol3 = {
2432
+ version: 3,
2433
+ schemas: {
2434
+ invocation: HostInvocation,
2435
+ request: HostRequest,
2436
+ response: HostResponse2,
2437
+ requirements: DeclaredRequirements,
2438
+ tools: Schema_exports.Array(HostedTool),
2439
+ toolSummaries: Schema_exports.Array(HostedToolSummary),
2440
+ skills: SkillCatalogResponse2,
2441
+ elicitationRequest: FormElicitation,
2442
+ elicitationReply: ElicitationReply,
2443
+ workflowStep: WorkflowRpcCommand,
2088
2444
  workflowStepReply: WorkflowRpcResult,
2089
2445
  workflowControl: WorkflowControlCommand,
2090
2446
  cacheCommand: CacheCommand,
@@ -2092,28 +2448,351 @@ var protocol1 = {
2092
2448
  }
2093
2449
  };
2094
2450
 
2095
- // src/contracts/operations.ts
2096
- var OperationToolPrefixes = { query: "queries.", mutate: "mutations." };
2451
+ // src/contracts/protocols/4.ts
2452
+ var HostedTool2 = Schema_exports.Struct({
2453
+ schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
2454
+ name: Schema_exports.NonEmptyString,
2455
+ router: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
2456
+ tags: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2457
+ description: Schema_exports.String,
2458
+ inputSchema: JsonObject2,
2459
+ readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2460
+ title: Schema_exports.optionalKey(Schema_exports.String),
2461
+ outputSchema: Schema_exports.optionalKey(JsonObject2),
2462
+ annotations: Schema_exports.optionalKey(ToolAnnotations),
2463
+ _meta: Schema_exports.optionalKey(JsonObject2)
2464
+ });
2465
+ var HostedToolSummary2 = HostedTool2.mapFields(
2466
+ ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2467
+ );
2468
+ var HostRouterError = Schema_exports.Union([
2469
+ ProviderError,
2470
+ McpError,
2471
+ SkillLoadFailed,
2472
+ HostDeclarationInvalid2,
2473
+ HostEvaluationFailed2
2474
+ ]);
2475
+ var HostedRouter = Schema_exports.Struct({
2476
+ path: Schema_exports.String,
2477
+ title: Schema_exports.optionalKey(Schema_exports.String),
2478
+ description: Schema_exports.optionalKey(Schema_exports.String),
2479
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
2480
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String)),
2481
+ skill: Schema_exports.optionalKey(AppSkillName),
2482
+ error: Schema_exports.optionalKey(HostRouterError)
2483
+ });
2484
+ var HostedCatalog = Schema_exports.Struct({
2485
+ tools: Schema_exports.Array(HostedTool2),
2486
+ routers: Schema_exports.Array(HostedRouter)
2487
+ });
2488
+ var HostedCatalogSummary = Schema_exports.Struct({
2489
+ tools: Schema_exports.Array(HostedToolSummary2),
2490
+ routers: Schema_exports.Array(HostedRouter)
2491
+ });
2492
+ var ToolKind = Schema_exports.Literals(["query", "mutation"]);
2493
+ var HostRequest2 = Schema_exports.Union([
2494
+ WorkflowCommand,
2495
+ WebhookCommand,
2496
+ Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
2497
+ Schema_exports.Struct({
2498
+ operation: Schema_exports.Literal("inspect"),
2499
+ /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
2500
+ detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
2501
+ /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
2502
+ tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2503
+ /**
2504
+ * Describe only declared operations that have schedules, without dynamic tool discovery.
2505
+ * Only builds that declare the scheduledTools capability accept this.
2506
+ */
2507
+ scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
2508
+ }),
2509
+ Schema_exports.Struct({
2510
+ operation: Schema_exports.Literal("skills"),
2511
+ /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
2512
+ sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
2513
+ }),
2514
+ Schema_exports.Struct({
2515
+ operation: Schema_exports.Literal("query"),
2516
+ name: Schema_exports.NonEmptyString,
2517
+ input: JsonValue
2518
+ }),
2519
+ Schema_exports.Struct({
2520
+ operation: Schema_exports.Literal("mutate"),
2521
+ name: Schema_exports.NonEmptyString,
2522
+ input: JsonValue
2523
+ }),
2524
+ Schema_exports.Struct({
2525
+ operation: Schema_exports.Literal("call"),
2526
+ tool: Schema_exports.NonEmptyString,
2527
+ /**
2528
+ * The caller's claim; the bundle rejects a call whose tool has the other kind. The host omits
2529
+ * it for a tool its catalog does not list, and then opens storage for writing.
2530
+ */
2531
+ kind: Schema_exports.optionalKey(ToolKind),
2532
+ input: JsonValue
2533
+ })
2534
+ ]);
2535
+ var HostKindMismatch = class extends Schema_exports.TaggedError()("HostKindMismatch", {
2536
+ tool: Schema_exports.NonEmptyString,
2537
+ requested: ToolKind,
2538
+ actual: ToolKind
2539
+ }) {
2540
+ };
2541
+ var HostError3 = Schema_exports.Union([...HostError2.members, HostKindMismatch]);
2542
+ var HostResponse3 = Schema_exports.Union([
2543
+ Schema_exports.Struct({
2544
+ ok: Schema_exports.Literal(true),
2545
+ value: JsonValue,
2546
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2547
+ }),
2548
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError3 })
2549
+ ]);
2550
+ var HostInvocation2 = Schema_exports.Struct({
2551
+ command: HostRequest2,
2552
+ accounts: ResolvedAccounts,
2553
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2554
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2555
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2556
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2557
+ });
2558
+ var protocol4 = {
2559
+ version: 4,
2560
+ schemas: {
2561
+ invocation: HostInvocation2,
2562
+ request: HostRequest2,
2563
+ response: HostResponse3,
2564
+ requirements: DeclaredRequirements,
2565
+ catalog: HostedCatalog,
2566
+ catalogSummary: HostedCatalogSummary,
2567
+ skills: SkillCatalogResponse2,
2568
+ elicitationRequest: FormElicitation,
2569
+ elicitationReply: ElicitationReply,
2570
+ workflowStep: WorkflowRpcCommand,
2571
+ workflowStepReply: WorkflowRpcResult,
2572
+ workflowControl: WorkflowControlCommand,
2573
+ cacheCommand: CacheCommand,
2574
+ cacheReply: CacheReply
2575
+ }
2576
+ };
2577
+
2578
+ // src/contracts/protocols/5.ts
2579
+ var DeclaredRequirements2 = Schema_exports.Struct({
2580
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
2581
+ capabilities: Schema_exports.optionalKey(
2582
+ Schema_exports.Struct({
2583
+ skills: Schema_exports.Literal(true),
2584
+ toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2585
+ skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2586
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
2587
+ })
2588
+ ),
2589
+ database: Schema_exports.optionalKey(DatabaseSchema),
2590
+ accounts: Schema_exports.Record(
2591
+ Schema_exports.NonEmptyString,
2592
+ Schema_exports.Struct({
2593
+ definition: DeclaredProvider,
2594
+ cardinality: Schema_exports.Literals(["one", "many"]),
2595
+ /**
2596
+ * The slot's provider defines an account check. Kept beside the definition, not in it, so
2597
+ * adding or editing a check never changes the provider's identity.
2598
+ */
2599
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
2600
+ })
2601
+ )
2602
+ });
2603
+ var AccountCheckCommand = Schema_exports.Struct({
2604
+ operation: Schema_exports.Literal("account-check"),
2605
+ requirement: Schema_exports.NonEmptyString
2606
+ });
2607
+ var HostRequest3 = Schema_exports.Union([
2608
+ ...protocol4.schemas.request.members,
2609
+ AccountCheckCommand
2610
+ ]);
2611
+ var HostInvocation3 = Schema_exports.Struct({
2612
+ command: HostRequest3,
2613
+ accounts: ResolvedAccounts,
2614
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2615
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2616
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2617
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2618
+ });
2619
+ var protocol5 = {
2620
+ version: 5,
2621
+ schemas: {
2622
+ ...protocol4.schemas,
2623
+ invocation: HostInvocation3,
2624
+ request: HostRequest3,
2625
+ requirements: DeclaredRequirements2,
2626
+ accountCheck: AccountCheckResult
2627
+ }
2628
+ };
2629
+
2630
+ // src/contracts/protocols/6.ts
2631
+ var DeclaredAuthMethod2 = Schema_exports.Union([
2632
+ Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
2633
+ Schema_exports.Struct({
2634
+ type: Schema_exports.Literal("oauth2"),
2635
+ ...OAuth2Config.members[0].fields,
2636
+ response: JsonObject2
2637
+ }),
2638
+ Schema_exports.Struct({
2639
+ type: Schema_exports.Literal("oauth2"),
2640
+ ...OAuth2Config.members[1].fields,
2641
+ response: JsonObject2
2642
+ }),
2643
+ Schema_exports.Struct({
2644
+ type: Schema_exports.Literal("oauth2"),
2645
+ ...OAuth2Config.members[2].fields,
2646
+ response: JsonObject2
2647
+ }),
2648
+ Schema_exports.Struct({
2649
+ type: Schema_exports.Literal("oauth2"),
2650
+ ...OAuth2Config.members[3].fields,
2651
+ response: JsonObject2
2652
+ })
2653
+ ]);
2654
+ var DeclaredProvider2 = Schema_exports.Struct({
2655
+ name: Schema_exports.NonEmptyString,
2656
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod2)
2657
+ });
2658
+ var DeclaredRequirements3 = Schema_exports.Struct({
2659
+ ...DeclaredRequirements2.fields,
2660
+ accounts: Schema_exports.Record(
2661
+ Schema_exports.NonEmptyString,
2662
+ Schema_exports.Struct({
2663
+ definition: DeclaredProvider2,
2664
+ cardinality: Schema_exports.Literals(["one", "many"]),
2665
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
2666
+ })
2667
+ )
2668
+ });
2669
+ var ResolvedAccount2 = Schema_exports.Struct({
2670
+ ...ResolvedAccount.fields,
2671
+ provider: DeclaredProvider2
2672
+ });
2673
+ var ResolvedAccounts2 = Schema_exports.Record(
2674
+ Schema_exports.NonEmptyString,
2675
+ Schema_exports.Union([ResolvedAccount2, Schema_exports.Array(ResolvedAccount2)])
2676
+ );
2677
+ var HostInvocation4 = Schema_exports.Struct({
2678
+ ...HostInvocation3.fields,
2679
+ accounts: ResolvedAccounts2
2680
+ });
2681
+ var protocol6 = {
2682
+ version: 6,
2683
+ schemas: {
2684
+ ...protocol5.schemas,
2685
+ requirements: DeclaredRequirements3,
2686
+ accounts: ResolvedAccounts2,
2687
+ invocation: HostInvocation4
2688
+ }
2689
+ };
2690
+
2691
+ // src/contracts/protocols/7.ts
2692
+ var CredentialHost = Schema_exports.String.check(
2693
+ Schema_exports.isPattern(
2694
+ /^(\*\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$/
2695
+ )
2696
+ );
2697
+ var exposure = {
2698
+ /** Not secret: app code reads the real value and forms show it. */
2699
+ plain: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2700
+ /** Secret, but app code reads the real value, for signing and similar uses. */
2701
+ raw: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString))
2702
+ };
2703
+ var DeclaredAuthMethod3 = Schema_exports.Union([
2704
+ Schema_exports.Struct({
2705
+ type: Schema_exports.Literal("secrets"),
2706
+ label: Schema_exports.String,
2707
+ fields: JsonObject2,
2708
+ ...exposure
2709
+ }),
2710
+ Schema_exports.Struct({
2711
+ type: Schema_exports.Literal("oauth2"),
2712
+ ...OAuth2Config.members[0].fields,
2713
+ response: JsonObject2,
2714
+ ...exposure
2715
+ }),
2716
+ Schema_exports.Struct({
2717
+ type: Schema_exports.Literal("oauth2"),
2718
+ ...OAuth2Config.members[1].fields,
2719
+ response: JsonObject2,
2720
+ ...exposure
2721
+ }),
2722
+ Schema_exports.Struct({
2723
+ type: Schema_exports.Literal("oauth2"),
2724
+ ...OAuth2Config.members[2].fields,
2725
+ response: JsonObject2,
2726
+ ...exposure
2727
+ }),
2728
+ Schema_exports.Struct({
2729
+ type: Schema_exports.Literal("oauth2"),
2730
+ ...OAuth2Config.members[3].fields,
2731
+ response: JsonObject2,
2732
+ ...exposure
2733
+ })
2734
+ ]);
2735
+ var DeclaredProvider3 = Schema_exports.Struct({
2736
+ name: Schema_exports.NonEmptyString,
2737
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod3),
2738
+ hosts: Schema_exports.optionalKey(Schema_exports.Array(CredentialHost))
2739
+ });
2740
+ var DeclaredRequirements4 = Schema_exports.Struct({
2741
+ ...DeclaredRequirements3.fields,
2742
+ accounts: Schema_exports.Record(
2743
+ Schema_exports.NonEmptyString,
2744
+ Schema_exports.Struct({
2745
+ definition: DeclaredProvider3,
2746
+ cardinality: Schema_exports.Literals(["one", "many"]),
2747
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
2748
+ })
2749
+ )
2750
+ });
2751
+ var ResolvedAccount3 = Schema_exports.Struct({
2752
+ ...ResolvedAccount2.fields,
2753
+ provider: DeclaredProvider3
2754
+ });
2755
+ var ResolvedAccounts3 = Schema_exports.Record(
2756
+ Schema_exports.NonEmptyString,
2757
+ Schema_exports.Union([ResolvedAccount3, Schema_exports.Array(ResolvedAccount3)])
2758
+ );
2759
+ var HostInvocation5 = Schema_exports.Struct({
2760
+ ...HostInvocation4.fields,
2761
+ accounts: ResolvedAccounts3
2762
+ });
2763
+ var protocol7 = {
2764
+ version: 7,
2765
+ schemas: {
2766
+ ...protocol6.schemas,
2767
+ requirements: DeclaredRequirements4,
2768
+ accounts: ResolvedAccounts3,
2769
+ invocation: HostInvocation5
2770
+ }
2771
+ };
2097
2772
 
2098
2773
  // src/contracts/host.ts
2099
2774
  var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
2100
- var skillCatalog = (response) => Schema_exports.is(SkillSources)(response) ? response : { skills: response };
2775
+ var skillCatalog = (response) => Schema_exports.is(SkillSources2)(response) ? response : { skills: response };
2101
2776
  var inspectCommand = (tools, scheduled) => ({
2102
2777
  operation: "inspect",
2103
2778
  ...tools === void 0 ? {} : { tools: [...tools] },
2104
2779
  ...scheduled === void 0 ? {} : { scheduled }
2105
2780
  });
2106
2781
  var indexCommand = { operation: "inspect", detail: "summary" };
2107
- var selectTools = (tools) => (all) => tools === void 0 ? all : all.filter((tool) => tools.includes(tool.name));
2108
- var HostRequirementsError = Schema_exports.Union([HostRequestInvalid, HostDeclarationInvalid]);
2782
+ var selectTools = (tools) => (catalog) => tools === void 0 ? catalog : { ...catalog, tools: catalog.tools.filter((tool) => tools.includes(tool.name)) };
2783
+ var HostRequirementsError = Schema_exports.Union([
2784
+ HostRequestInvalid,
2785
+ HostDeclarationInvalid2,
2786
+ DatabaseFieldReserved
2787
+ ]);
2109
2788
  var HostInspectError = Schema_exports.Union([
2110
2789
  ProviderError,
2111
2790
  McpError,
2112
2791
  SkillLoadFailed,
2113
2792
  HostRequestInvalid,
2114
- HostDeclarationInvalid,
2793
+ HostDeclarationInvalid2,
2115
2794
  HostAccountsInvalid,
2116
- HostEvaluationFailed
2795
+ HostEvaluationFailed2
2117
2796
  ]);
2118
2797
  var HostCallError = Schema_exports.Union([
2119
2798
  OpenapiResponseError,
@@ -2121,7 +2800,9 @@ var HostCallError = Schema_exports.Union([
2121
2800
  HostInspectError,
2122
2801
  HostToolNotFound,
2123
2802
  HostOperationNotFound,
2124
- HostOperationFailed,
2803
+ HostKindMismatch,
2804
+ HostOperationFailed2,
2805
+ DatabaseLimitExceeded,
2125
2806
  HostInputInvalid,
2126
2807
  HostOutputInvalid,
2127
2808
  HostToolBlocked,
@@ -2129,6 +2810,16 @@ var HostCallError = Schema_exports.Union([
2129
2810
  HostToolPolicyFailed,
2130
2811
  ElicitationFailed
2131
2812
  ]);
2813
+ var HostAccountCheckError = Schema_exports.Union([
2814
+ ProviderError,
2815
+ WorkflowFailure,
2816
+ HostRequestInvalid,
2817
+ HostDeclarationInvalid2,
2818
+ HostAccountsInvalid,
2819
+ HostOperationNotFound,
2820
+ HostOperationFailed2,
2821
+ HostOutputInvalid
2822
+ ]);
2132
2823
  var HostDataError = HostCallError;
2133
2824
  var ToolResultObservation = Context_exports.Reference(
2134
2825
  "apps/ToolResultObservation",
@@ -2140,11 +2831,19 @@ export {
2140
2831
  SecretsMethod,
2141
2832
  OAuthClientAuth,
2142
2833
  OAuthSecretClientAuth,
2834
+ OAuthTokenRequestFormat,
2835
+ OAuthTokenResponse,
2143
2836
  OAuth2Config,
2144
2837
  OAuth2AccessToken,
2145
2838
  OAuth2Method,
2839
+ AccountInfo,
2840
+ AccountCheckResult,
2146
2841
  Provider,
2147
2842
  ManyAccounts,
2843
+ reservedRouterKeys,
2844
+ RouterKey,
2845
+ RouterIcon,
2846
+ RouterMeta,
2148
2847
  ToolAnnotations,
2149
2848
  McpClientLimits,
2150
2849
  defaultMcpClientLimits,
@@ -2152,13 +2851,26 @@ export {
2152
2851
  McpToolsOptions,
2153
2852
  McpToolResult,
2154
2853
  McpToolMetadata,
2854
+ McpServerHeader,
2155
2855
  McpError,
2156
2856
  ProcessConfig,
2857
+ ApiErrorRecovery,
2858
+ ApiErrorResponse,
2859
+ OpenapiResponseError,
2860
+ defaultOpenapiErrorLimits,
2861
+ maxFailureMessageLength,
2862
+ FailureSource,
2863
+ FailureName,
2864
+ FailureCode,
2865
+ FailureMessage,
2866
+ FailureDetail,
2157
2867
  WorkflowRunId,
2158
2868
  WorkflowName,
2159
2869
  workflowDurationMillis,
2160
2870
  WorkflowDuration,
2161
2871
  WorkflowStepOptions,
2872
+ WorkflowFailureDetail,
2873
+ WorkflowRunFailure,
2162
2874
  WorkflowFailure,
2163
2875
  NonRetryableError,
2164
2876
  WorkflowValue,
@@ -2193,24 +2905,11 @@ export {
2193
2905
  CalendarSchedule,
2194
2906
  ScheduleTiming,
2195
2907
  OperationSchedule,
2196
- DeclaredAuthMethod,
2197
- DeclaredProvider,
2198
- DeclaredRequirements,
2199
- ResolvedAccount,
2200
- ResolvedAccounts,
2201
2908
  TrustedToolApproval,
2202
2909
  InvocationDeadline,
2203
- HostedTool,
2204
- HostedToolSummary,
2205
- SkillSources,
2206
- SkillCatalogResponse,
2207
- HostRequest,
2208
2910
  HostRequestInvalid,
2209
2911
  HostAccountsInvalid,
2210
- HostDeclarationInvalid,
2211
- HostEvaluationFailed,
2212
2912
  HostOperationNotFound,
2213
- HostOperationFailed,
2214
2913
  HostToolNotFound,
2215
2914
  InputProblem,
2216
2915
  maxInputProblems,
@@ -2219,11 +2918,36 @@ export {
2219
2918
  HostToolApprovalRequired,
2220
2919
  HostToolPolicyFailed,
2221
2920
  HostOutputInvalid,
2222
- HostError,
2223
- HostResponse,
2224
- HostInvocation,
2225
2921
  protocol1,
2226
- OperationToolPrefixes,
2922
+ SkillSources2 as SkillSources,
2923
+ SkillCatalogResponse2 as SkillCatalogResponse,
2924
+ protocol2,
2925
+ HostDeclarationInvalid2 as HostDeclarationInvalid,
2926
+ HostEvaluationFailed2 as HostEvaluationFailed,
2927
+ HostOperationFailed2 as HostOperationFailed,
2928
+ protocol3,
2929
+ HostedTool2 as HostedTool,
2930
+ HostedToolSummary2 as HostedToolSummary,
2931
+ HostRouterError,
2932
+ HostedRouter,
2933
+ HostedCatalog,
2934
+ HostedCatalogSummary,
2935
+ HostKindMismatch,
2936
+ HostError3 as HostError,
2937
+ HostResponse3 as HostResponse,
2938
+ protocol4,
2939
+ AccountCheckCommand,
2940
+ HostRequest3 as HostRequest,
2941
+ protocol5,
2942
+ protocol6,
2943
+ CredentialHost,
2944
+ DeclaredAuthMethod3 as DeclaredAuthMethod,
2945
+ DeclaredProvider3 as DeclaredProvider,
2946
+ DeclaredRequirements4 as DeclaredRequirements,
2947
+ ResolvedAccount3 as ResolvedAccount,
2948
+ ResolvedAccounts3 as ResolvedAccounts,
2949
+ HostInvocation5 as HostInvocation,
2950
+ protocol7,
2227
2951
  skillsCommand,
2228
2952
  skillCatalog,
2229
2953
  inspectCommand,
@@ -2232,6 +2956,7 @@ export {
2232
2956
  HostRequirementsError,
2233
2957
  HostInspectError,
2234
2958
  HostCallError,
2959
+ HostAccountCheckError,
2235
2960
  HostDataError,
2236
2961
  ToolResultObservation
2237
2962
  };