apps 0.0.1-beta.6 → 0.0.1-beta.61

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 (173) hide show
  1. package/README.md +24 -21
  2. package/framework-reference.json +1 -1
  3. package/js/chunk-2A26IT3X.js +171 -0
  4. package/js/chunk-4HYFEAR7.js +49 -0
  5. package/js/chunk-5FHWNLCI.js +88 -0
  6. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  7. package/js/{chunk-MNMNLXBL.js → chunk-7QBUFK6I.js} +316 -69
  8. package/js/{chunk-SB4HEPNJ.js → chunk-A4RQSTHG.js} +883 -189
  9. package/js/{chunk-T7GKZBLP.js → chunk-ANN7H2FL.js} +67 -55
  10. package/js/{chunk-NKLWZJLE.js → chunk-AQU56EPI.js} +9 -5
  11. package/js/chunk-CDXQDN7W.js +92 -0
  12. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  13. package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
  14. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  15. package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
  16. package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
  17. package/js/{chunk-RFVIONFX.js → chunk-JSAZHHWI.js} +79 -41
  18. package/js/{chunk-RJDDBDSN.js → chunk-K6P2US3D.js} +635 -89
  19. package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
  20. package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  21. package/js/chunk-MWKHKOTL.js +240 -0
  22. package/js/chunk-NFHURZBA.js +340 -0
  23. package/js/chunk-OD3KFKZD.js +1617 -0
  24. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  25. package/js/{chunk-ITM77QPO.js → chunk-QE4JSN3X.js} +126 -31
  26. package/js/chunk-S34PXQUC.js +266 -0
  27. package/js/{chunk-B3EOZTK3.js → chunk-TLWLJ7PD.js} +2227 -453
  28. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  29. package/js/{chunk-ECQFRCH4.js → chunk-VHUR5HUL.js} +4 -3
  30. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  31. package/js/client.js +142 -94
  32. package/js/contracts.js +103 -26
  33. package/js/effect.js +19 -19
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +50 -40
  36. package/js/host.js +83 -58
  37. package/js/index.js +90 -61
  38. package/js/mcp/effect.js +23 -21
  39. package/js/mcp/stdio.js +44 -34
  40. package/js/mcp.js +76 -53
  41. package/js/openapi.js +4050 -1354
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +208 -81
  45. package/js/storage/facet.js +1 -540
  46. package/js/ui/auth/contracts.js +2 -2
  47. package/js/ui/auth.js +5 -5
  48. package/js/ui/contracts.js +5 -4
  49. package/js/ui/serving.js +8517 -214
  50. package/package.json +2 -3
  51. package/runtime.json +1 -1
  52. package/types/app-cache/src/index.d.ts +10 -1
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +7 -3
  55. package/types/apps/src/contracts/cache.d.ts +20 -0
  56. package/types/apps/src/contracts/context.d.ts +19 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/events.d.ts +93 -0
  59. package/types/apps/src/contracts/failure.d.ts +30 -1
  60. package/types/apps/src/contracts/graphql.d.ts +2 -1
  61. package/types/apps/src/contracts/host.d.ts +48 -13
  62. package/types/apps/src/contracts/live.d.ts +2 -0
  63. package/types/apps/src/contracts/mcp.d.ts +80 -10
  64. package/types/apps/src/contracts/network.d.ts +84 -0
  65. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  66. package/types/apps/src/contracts/openapi.d.ts +41 -9
  67. package/types/apps/src/contracts/operations.d.ts +8 -4
  68. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  69. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  70. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  71. package/types/apps/src/contracts/protocols/2.d.ts +69 -26
  72. package/types/apps/src/contracts/protocols/3.d.ts +133 -33
  73. package/types/apps/src/contracts/protocols/4.d.ts +122 -45
  74. package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
  75. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  76. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  77. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  78. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  79. package/types/apps/src/contracts/protocols/current.d.ts +2476 -0
  80. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  81. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  82. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  83. package/types/apps/src/contracts/provider.d.ts +115 -10
  84. package/types/apps/src/contracts/skills.d.ts +50 -13
  85. package/types/apps/src/contracts/sql.d.ts +58 -0
  86. package/types/apps/src/contracts/ui.d.ts +19 -1
  87. package/types/apps/src/contracts/workflows.d.ts +6 -0
  88. package/types/apps/src/facet.d.ts +4 -5
  89. package/types/apps/src/host.d.ts +5 -0
  90. package/types/apps/src/implementation/account-router.d.ts +4 -3
  91. package/types/apps/src/implementation/authoring.d.ts +25 -5
  92. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  93. package/types/apps/src/implementation/cache.d.ts +4 -0
  94. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  95. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  96. package/types/apps/src/implementation/events.d.ts +59 -0
  97. package/types/apps/src/implementation/failure-detail.d.ts +25 -3
  98. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  99. package/types/apps/src/implementation/graphql.d.ts +4 -3
  100. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  101. package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
  102. package/types/apps/src/implementation/live.d.ts +2 -2
  103. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  104. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  105. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  106. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  107. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  108. package/types/apps/src/implementation/mcp.d.ts +20 -9
  109. package/types/apps/src/implementation/network.d.ts +16 -0
  110. package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
  111. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  112. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  113. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  114. package/types/apps/src/implementation/openapi-source.d.ts +18 -0
  115. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  116. package/types/apps/src/implementation/operations.d.ts +17 -2
  117. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  118. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  119. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  120. package/types/apps/src/implementation/provider.d.ts +19 -5
  121. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  122. package/types/apps/src/implementation/router-catalog.d.ts +11 -13
  123. package/types/apps/src/implementation/router.d.ts +16 -5
  124. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  125. package/types/apps/src/implementation/schema.d.ts +90 -10
  126. package/types/apps/src/implementation/skills.d.ts +18 -24
  127. package/types/apps/src/implementation/sql.d.ts +71 -0
  128. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  129. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  130. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  131. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  132. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  133. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  134. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  135. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  136. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  137. package/types/apps/src/implementation/workflows.d.ts +1 -1
  138. package/types/apps/src/index.d.ts +30 -12
  139. package/types/apps/src/mcp.d.ts +20 -1
  140. package/types/apps/src/openapi.d.ts +1 -1
  141. package/types/apps/src/react.d.ts +1 -1
  142. package/types/apps/src/skills.d.ts +10 -8
  143. package/types/telemetry/src/app-records.d.ts +42 -0
  144. package/types/telemetry/src/browser-operations.d.ts +7 -4
  145. package/types/telemetry/src/browser.d.ts +8 -3
  146. package/types/telemetry/src/config.d.ts +2 -2
  147. package/types/telemetry/src/index.d.ts +1 -0
  148. package/types/telemetry/src/layer.d.ts +2 -2
  149. package/types/telemetry/src/ownership.d.ts +56 -0
  150. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  151. package/types/telemetry/src/relay.d.ts +11 -3
  152. package/types/telemetry/src/transport.d.ts +8 -1
  153. package/types/utils/src/api-error.d.ts +55 -0
  154. package/types/utils/src/connection-failure.d.ts +33 -0
  155. package/types/utils/src/recorded-message.d.ts +18 -0
  156. package/types/utils/src/user-facing-error.d.ts +83 -0
  157. package/js/chunk-6BSSI67S.js +0 -224
  158. package/js/chunk-MKWZPDR6.js +0 -63
  159. package/js/chunk-N7YDVXYJ.js +0 -186
  160. package/js/chunk-OE3QQTSB.js +0 -222
  161. package/js/chunk-PJJ24GU7.js +0 -877
  162. package/js/chunk-PZB6T6KU.js +0 -19
  163. package/js/chunk-R3EV5FTO.js +0 -97
  164. package/js/chunk-ZQINWV4W.js +0 -630
  165. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  166. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  167. package/types/app-data/src/implementation/promise.d.ts +0 -68
  168. package/types/app-data/src/implementation/range.d.ts +0 -8
  169. package/types/app-data/src/implementation/schema.d.ts +0 -18
  170. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  171. package/types/app-data/src/index.d.ts +0 -4
  172. package/types/apps/src/contracts/storage.d.ts +0 -68
  173. package/types/apps/src/implementation/storage.d.ts +0 -15
@@ -1,24 +1,25 @@
1
- import {
2
- DatabaseFieldReserved,
3
- DatabaseLimitExceeded,
4
- DatabaseSchema
5
- } from "./chunk-N7YDVXYJ.js";
6
1
  import {
7
2
  CacheCommand,
8
3
  CacheReply,
9
- ProviderError
10
- } from "./chunk-R3EV5FTO.js";
4
+ FailureDetail,
5
+ FailureMessage,
6
+ FailureName,
7
+ ProviderError,
8
+ UpstreamError
9
+ } from "./chunk-MWKHKOTL.js";
11
10
  import {
12
11
  AppSkillName,
13
- AppSkills,
14
- SkillLoadFailed
15
- } from "./chunk-JU7VHODU.js";
12
+ AppSkills
13
+ } from "./chunk-H72MEDMN.js";
14
+ import {
15
+ RecordedMessage
16
+ } from "./chunk-5FHWNLCI.js";
16
17
  import {
17
18
  AccountId,
18
19
  HttpUrl,
19
20
  JsonObject as JsonObject2,
20
21
  JsonValue
21
- } from "./chunk-27F7W2LG.js";
22
+ } from "./chunk-H2CJWXA3.js";
22
23
  import {
23
24
  Any,
24
25
  ArraySchema,
@@ -54,13 +55,13 @@ import {
54
55
  declare,
55
56
  decode,
56
57
  decodeTo,
57
- empty2 as empty,
58
+ empty,
58
59
  flatMap,
59
60
  fromUndefinedOr,
60
61
  isBetween,
61
62
  isSchema,
62
63
  isStream,
63
- make6 as make,
64
+ make2 as make,
64
65
  merge,
65
66
  optional,
66
67
  optionalKey,
@@ -69,127 +70,23 @@ import {
69
70
  symbol3 as symbol,
70
71
  sync2 as sync,
71
72
  tag,
73
+ toType,
72
74
  transformOptional,
73
75
  withConstructorDefault,
74
76
  withDefault
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
- });
100
-
101
- // src/contracts/tools.ts
102
- var ToolAnnotations = Schema_exports.Struct({
103
- title: Schema_exports.optionalKey(Schema_exports.String),
104
- readOnlyHint: Schema_exports.optionalKey(Schema_exports.Boolean),
105
- destructiveHint: Schema_exports.optionalKey(Schema_exports.Boolean),
106
- idempotentHint: Schema_exports.optionalKey(Schema_exports.Boolean),
107
- openWorldHint: Schema_exports.optionalKey(Schema_exports.Boolean)
108
- });
109
-
110
- // src/contracts/mcp.ts
111
- var McpClientLimits = Schema_exports.Struct({
112
- timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
113
- maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
114
- maxTools: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
115
- maxPaginationCursors: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
116
- cleanupTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
117
- });
118
- var defaultMcpClientLimits = McpClientLimits.make({
119
- timeoutMs: 3e4,
120
- maxTimeoutMs: 3e5,
121
- maxTools: 5e4,
122
- maxPaginationCursors: 1e3,
123
- cleanupTimeoutMs: 1e3
124
- });
125
- var mcpSdkTimerCeilingMs = 2147483647;
126
- var McpToolsOptions = Schema_exports.Struct({
127
- url: HttpUrl,
128
- accountId: Schema_exports.optional(AccountId),
129
- headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
130
- signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
131
- timeoutMs: Schema_exports.optional(
132
- Schema_exports.Number.check(
133
- Schema_exports.isInt(),
134
- Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
135
- )
136
- )
137
- });
138
- var McpToolResult = Schema_exports.Struct({
139
- content: Schema_exports.Array(JsonObject2),
140
- structuredContent: Schema_exports.optional(JsonObject2),
141
- isError: Schema_exports.optional(Schema_exports.Boolean),
142
- _meta: Schema_exports.optional(JsonObject2)
143
- });
144
- var McpToolMetadata = Schema_exports.Struct({
145
- name: Schema_exports.String,
146
- title: Schema_exports.optional(Schema_exports.String),
147
- description: Schema_exports.optional(Schema_exports.String),
148
- inputSchema: JsonObject2,
149
- outputSchema: Schema_exports.optional(JsonObject2),
150
- annotations: Schema_exports.optional(ToolAnnotations),
151
- _meta: Schema_exports.optional(JsonObject2)
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
- });
162
- var McpError = class extends Schema_exports.TaggedError()("McpError", {
163
- phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
164
- reason: Schema_exports.Literals([
165
- "request",
166
- "unauthorized",
167
- "invalid_response",
168
- "timeout",
169
- "invalid_input"
170
- ]),
171
- status: Schema_exports.optional(Schema_exports.Number)
172
- }) {
173
- };
174
- var ProcessConfig = Schema_exports.Struct({
175
- command: Schema_exports.NonEmptyString,
176
- args: Schema_exports.Array(Schema_exports.String),
177
- cwd: Schema_exports.optional(Schema_exports.String),
178
- env: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
179
- timeoutMs: Schema_exports.Int.check(
180
- Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
181
- )
182
- });
77
+ } from "./chunk-IFJU5SYQ.js";
183
78
 
184
79
  // src/contracts/api-response-error.ts
80
+ var maxApiErrorInstructionsLength = 4096;
185
81
  var ApiErrorRecovery = Schema_exports.Struct({
186
82
  action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
187
- instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096))
83
+ instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(maxApiErrorInstructionsLength))
188
84
  });
85
+ var maxApiErrorMessageLength = 4096;
189
86
  var ApiErrorResponse = Schema_exports.Struct({
190
87
  code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
191
88
  status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
192
- message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096)),
89
+ message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(maxApiErrorMessageLength)),
193
90
  recovery: Schema_exports.optionalKey(ApiErrorRecovery)
194
91
  });
195
92
  var OpenapiResponseError = class extends Schema_exports.TaggedError()(
@@ -206,19 +103,6 @@ var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
206
103
  readTimeoutMs: 2e3
207
104
  });
208
105
 
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
-
222
106
  // src/contracts/workflows.ts
223
107
  var WorkflowRunId = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
224
108
  var WorkflowName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
@@ -283,6 +167,13 @@ var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailur
283
167
  ]),
284
168
  retryable: Schema_exports.Boolean
285
169
  }) {
170
+ /**
171
+ * The step name and error detail are the app's. Its run's owner reads them; telemetry records
172
+ * only the reason, however the failure was built or decoded.
173
+ */
174
+ get [RecordedMessage]() {
175
+ return this.step === void 0 && this.errorName === void 0 && !this.message ? void 0 : `The workflow failed (${this.reason}); the app's error is not recorded`;
176
+ }
286
177
  };
287
178
  var NonRetryableError = class extends Error {
288
179
  name = "NonRetryableError";
@@ -389,7 +280,178 @@ var WorkflowControlCommand = Schema_exports.Union([
389
280
  Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
390
281
  ]);
391
282
 
392
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/RpcSchema.js
283
+ // ../app-data/src/contracts/database.ts
284
+ var DataName = Schema_exports.String.check(
285
+ Schema_exports.makeFilter((value) => /^[A-Za-z][A-Za-z0-9_]*$/.test(value) && value.length <= 128)
286
+ );
287
+ var Scalar = Schema_exports.Union([Schema_exports.String, Schema_exports.Finite, Schema_exports.Boolean]);
288
+ var Field = Schema_exports.Struct({
289
+ kind: Schema_exports.Literals(["string", "number", "boolean", "id", "userId"]),
290
+ optional: Schema_exports.optional(Schema_exports.Boolean),
291
+ default: Schema_exports.optional(Scalar),
292
+ references: Schema_exports.optional(DataName)
293
+ });
294
+ var Index = Schema_exports.Struct({ name: DataName, fields: Schema_exports.NonEmptyArray(DataName) });
295
+ var Table = Schema_exports.Struct({
296
+ fields: Schema_exports.Record(DataName, Field),
297
+ indexes: Schema_exports.Array(Index)
298
+ });
299
+ var DatabaseSchema = Schema_exports.Record(DataName, Table);
300
+ var Row = Schema_exports.Record(Schema_exports.String, Scalar);
301
+ var RowMetadata = Schema_exports.Struct({
302
+ id: Schema_exports.NonEmptyString,
303
+ createdAt: Schema_exports.String,
304
+ updatedAt: Schema_exports.String
305
+ });
306
+ var Patch = Schema_exports.Record(DataName, Schema_exports.NullOr(Scalar));
307
+ var RangeClause = Schema_exports.Struct({
308
+ field: DataName,
309
+ op: Schema_exports.Literals(["eq", "gt", "gte", "lt", "lte"]),
310
+ value: Schema_exports.NullOr(Scalar)
311
+ });
312
+ var QueryPlan = Schema_exports.Struct({
313
+ table: DataName,
314
+ index: DataName,
315
+ order: Schema_exports.Literals(["asc", "desc"]),
316
+ clauses: Schema_exports.Array(RangeClause)
317
+ });
318
+ var QueryTerminal = Schema_exports.Union([
319
+ Schema_exports.Struct({ kind: Schema_exports.Literal("collect") }),
320
+ Schema_exports.Struct({ kind: Schema_exports.Literal("count") }),
321
+ Schema_exports.Struct({ kind: Schema_exports.Literal("first") }),
322
+ Schema_exports.Struct({
323
+ kind: Schema_exports.Literal("take"),
324
+ count: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0))
325
+ }),
326
+ Schema_exports.Struct({
327
+ kind: Schema_exports.Literal("paginate"),
328
+ cursor: Schema_exports.NullOr(Schema_exports.String),
329
+ numItems: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
330
+ })
331
+ ]);
332
+ var DatabaseOperation = Schema_exports.Union([
333
+ Schema_exports.Struct({ kind: Schema_exports.Literal("get"), table: DataName, id: Schema_exports.NonEmptyString }),
334
+ Schema_exports.Struct({ kind: Schema_exports.Literal("insert"), table: DataName, value: Patch }),
335
+ Schema_exports.Struct({
336
+ kind: Schema_exports.Literal("update"),
337
+ table: DataName,
338
+ id: Schema_exports.NonEmptyString,
339
+ patch: Patch
340
+ }),
341
+ Schema_exports.Struct({ kind: Schema_exports.Literal("delete"), table: DataName, id: Schema_exports.NonEmptyString }),
342
+ Schema_exports.Struct({ kind: Schema_exports.Literal("query"), plan: QueryPlan, terminal: QueryTerminal })
343
+ ]);
344
+ var PaginationResult = Schema_exports.Struct({
345
+ page: Schema_exports.Array(Row),
346
+ continueCursor: Schema_exports.NullOr(Schema_exports.String),
347
+ isDone: Schema_exports.Boolean
348
+ });
349
+ var OperationResult = Schema_exports.Union([
350
+ Row,
351
+ Schema_exports.Array(Row),
352
+ PaginationResult,
353
+ Schema_exports.Boolean,
354
+ Schema_exports.Finite,
355
+ Schema_exports.Null
356
+ ]);
357
+ var AppDatabaseError = class extends Schema_exports.TaggedError()("AppDatabaseError", {
358
+ reason: Schema_exports.Literals([
359
+ "schema",
360
+ "schema_changed",
361
+ "table",
362
+ "index",
363
+ "range",
364
+ "value",
365
+ "readonly",
366
+ "cursor",
367
+ "limit",
368
+ "closed",
369
+ "storage",
370
+ "replay"
371
+ ])
372
+ }) {
373
+ };
374
+ var DatabaseLimits = Schema_exports.Struct({
375
+ rowsRead: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
376
+ rowsReturned: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
377
+ bytesRead: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
378
+ writes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
379
+ scanCalls: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
380
+ directGets: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
381
+ valueBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
382
+ indexBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
383
+ });
384
+ var defaultDatabaseLimits = {
385
+ rowsRead: 5e3,
386
+ rowsReturned: 1e3,
387
+ bytesRead: 4 * 1024 * 1024,
388
+ writes: 1e3,
389
+ scanCalls: 100,
390
+ directGets: 1e3,
391
+ valueBytes: 64 * 1024,
392
+ indexBytes: 2048
393
+ };
394
+ var DatabaseLimit = Schema_exports.Literals([
395
+ "scanCalls",
396
+ "directGets",
397
+ "rowsRead",
398
+ "rowsReturned",
399
+ "pageSize",
400
+ "bytesRead",
401
+ "writes",
402
+ "valueBytes"
403
+ ]);
404
+ var count = (value) => value.toLocaleString("en-US");
405
+ var limitMessages = {
406
+ scanCalls: (maximum, requested) => `This invocation made ${count(requested)} index queries; the limit is ${count(maximum)}. Each first(), take(), collect(), count() or paginate() call on withIndex(...) counts once. Read related rows with one take() or paginate() over a shared index prefix instead of one first() per item, use get(id) for known IDs, or split the work across workflow steps.`,
407
+ directGets: (maximum, requested) => `This invocation made ${count(requested)} get(id) calls, including those made by update and delete; the limit is ${count(maximum)}. Split the work across workflow steps or mutations.`,
408
+ rowsRead: (maximum, requested) => `This invocation read ${count(requested)} rows; the limit is ${count(maximum)}. Read fewer rows per call, through an index or a LIMIT, or split the work across calls or workflow steps.`,
409
+ rowsReturned: (maximum, requested) => `This invocation returned ${count(requested)} rows; the limit is ${count(maximum)}. collect() fails rather than truncating. Page with paginate() across calls or workflow steps.`,
410
+ pageSize: (maximum, requested) => `One call asked for ${count(requested)} rows; take(n) and paginate({ numItems }) accept at most ${count(maximum)}. Page with paginate() across calls or workflow steps.`,
411
+ bytesRead: (maximum, requested) => `This invocation read ${count(requested)} bytes; the limit is ${count(maximum)}. Read fewer or smaller rows per call, or page with paginate() across calls or workflow steps.`,
412
+ writes: (maximum, requested) => `This invocation wrote ${count(requested)} rows; the limit is ${count(maximum)}. Split large ingests into batches, one batch per mutation or workflow step.`,
413
+ valueBytes: (maximum, requested) => `A row encodes to ${count(requested)} bytes; each row may use at most ${count(maximum)}. Store large content outside the row or split it across rows.`
414
+ };
415
+ var DatabaseLimitExceeded = class extends Schema_exports.TaggedError()(
416
+ "DatabaseLimitExceeded",
417
+ {
418
+ limit: DatabaseLimit,
419
+ maximum: Schema_exports.Int,
420
+ requested: Schema_exports.Int
421
+ }
422
+ ) {
423
+ get message() {
424
+ return limitMessages[this.limit](this.maximum, this.requested);
425
+ }
426
+ };
427
+ var reservedFieldNames = ["id", "createdAt", "updatedAt"];
428
+ var DatabaseFieldReserved = class extends Schema_exports.TaggedError()(
429
+ "DatabaseFieldReserved",
430
+ {
431
+ table: Schema_exports.String,
432
+ field: Schema_exports.Literals(reservedFieldNames)
433
+ }
434
+ ) {
435
+ get message() {
436
+ return `Table "${this.table}" declares "${this.field}", which is reserved: the host adds id, createdAt and updatedAt to every row. Rename the field, or use the row's own ${this.field}.`;
437
+ }
438
+ };
439
+ var DatabaseRuntimeLimits = Schema_exports.Struct({
440
+ maxCursorChars: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
441
+ connectionCacheCapacity: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
442
+ connectionCacheTtlMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
443
+ });
444
+ var defaultDatabaseRuntimeLimits = DatabaseRuntimeLimits.make({
445
+ maxCursorChars: 8192,
446
+ connectionCacheCapacity: 64,
447
+ connectionCacheTtlMs: 5 * 60 * 1e3
448
+ });
449
+
450
+ // src/contracts/sql.ts
451
+ var reservedTablePrefix = "_executor_";
452
+ var migrationsDirectory = "migrations";
453
+
454
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/rpc/RpcSchema.js
393
455
  var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
394
456
  var schema = /* @__PURE__ */ declare(isStream);
395
457
  function Stream(success, error) {
@@ -400,7 +462,7 @@ function Stream(success, error) {
400
462
  });
401
463
  }
402
464
 
403
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/Rpc.js
465
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/rpc/Rpc.js
404
466
  var TypeId = "~effect/rpc/Rpc";
405
467
  var Proto = {
406
468
  [TypeId]: TypeId,
@@ -518,7 +580,7 @@ var make2 = (tag2, options) => {
518
580
  });
519
581
  };
520
582
 
521
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/ai/McpSchema.js
583
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/ai/McpSchema.js
522
584
  var optionalWithDefault = (schema2, defaultValue) => {
523
585
  const effect = sync(defaultValue);
524
586
  return optionalKey(schema2).pipe(decode({
@@ -526,7 +588,7 @@ var optionalWithDefault = (schema2, defaultValue) => {
526
588
  encode: passthrough()
527
589
  }), withConstructorDefault(effect));
528
590
  };
529
- var optional2 = (schema2) => optionalKey(schema2).pipe(decodeTo(optional(schema2), {
591
+ var optional2 = (schema2) => optionalKey(schema2).pipe(decodeTo(toType(optional(schema2)), {
530
592
  decode: passthrough(),
531
593
  encode: transformOptional(flatMap(fromUndefinedOr))
532
594
  }));
@@ -788,7 +850,7 @@ var InternalError = class _InternalError extends (/* @__PURE__ */ Error2("effect
788
850
  message: "Not implemented"
789
851
  });
790
852
  };
791
- var McpError2 = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
853
+ var McpError = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
792
854
  var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
793
855
  ...ResultMeta.fields,
794
856
  /**
@@ -811,7 +873,7 @@ var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ S
811
873
  };
812
874
  var Initialize = class extends (/* @__PURE__ */ make2("initialize", {
813
875
  success: InitializeResult,
814
- error: McpError2,
876
+ error: McpError,
815
877
  payload: {
816
878
  ...RequestMeta.fields,
817
879
  /**
@@ -1010,7 +1072,7 @@ var ReadResourceResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */
1010
1072
  };
1011
1073
  var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
1012
1074
  success: ReadResourceResult,
1013
- error: McpError2,
1075
+ error: McpError,
1014
1076
  payload: {
1015
1077
  ...RequestMeta.fields,
1016
1078
  /**
@@ -1023,7 +1085,7 @@ var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
1023
1085
  };
1024
1086
  var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
1025
1087
  success: /* @__PURE__ */ Struct({}),
1026
- error: McpError2,
1088
+ error: McpError,
1027
1089
  payload: {
1028
1090
  ...RequestMeta.fields,
1029
1091
  /**
@@ -1036,7 +1098,7 @@ var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
1036
1098
  };
1037
1099
  var Unsubscribe = class extends (/* @__PURE__ */ make2("resources/unsubscribe", {
1038
1100
  success: /* @__PURE__ */ Struct({}),
1039
- error: McpError2,
1101
+ error: McpError,
1040
1102
  payload: {
1041
1103
  ...RequestMeta.fields,
1042
1104
  /**
@@ -1180,7 +1242,7 @@ var GetPromptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema
1180
1242
  };
1181
1243
  var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
1182
1244
  success: GetPromptResult,
1183
- error: McpError2,
1245
+ error: McpError,
1184
1246
  payload: {
1185
1247
  ...RequestMeta.fields,
1186
1248
  /**
@@ -1195,7 +1257,7 @@ var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
1195
1257
  }
1196
1258
  })) {
1197
1259
  };
1198
- var ToolAnnotations2 = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1260
+ var ToolAnnotations = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1199
1261
  /**
1200
1262
  * A human-readable title for the tool.
1201
1263
  */
@@ -1264,7 +1326,7 @@ var Tool = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Tool")({
1264
1326
  /**
1265
1327
  * Optional additional tool information.
1266
1328
  */
1267
- annotations: /* @__PURE__ */ optional2(ToolAnnotations2),
1329
+ annotations: /* @__PURE__ */ optional2(ToolAnnotations),
1268
1330
  /**
1269
1331
  * Icons that clients can display for this tool.
1270
1332
  */
@@ -1300,7 +1362,7 @@ var CallToolResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/
1300
1362
  };
1301
1363
  var CallTool = class extends (/* @__PURE__ */ make2("tools/call", {
1302
1364
  success: CallToolResult,
1303
- error: McpError2,
1365
+ error: McpError,
1304
1366
  payload: {
1305
1367
  ...RequestMeta.fields,
1306
1368
  name: String,
@@ -1320,7 +1382,7 @@ var SetLevel = class extends (/* @__PURE__ */ make2("logging/setLevel", {
1320
1382
  level: LoggingLevel
1321
1383
  },
1322
1384
  success: /* @__PURE__ */ Struct({}),
1323
- error: McpError2
1385
+ error: McpError
1324
1386
  })) {
1325
1387
  };
1326
1388
  var LoggingMessageNotification = class extends (/* @__PURE__ */ make2("notifications/message", {
@@ -1466,7 +1528,7 @@ var CreateMessageResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1466
1528
  };
1467
1529
  var CreateMessage = class extends (/* @__PURE__ */ make2("sampling/createMessage", {
1468
1530
  success: CreateMessageResult,
1469
- error: McpError2,
1531
+ error: McpError,
1470
1532
  payload: {
1471
1533
  messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
1472
1534
  /**
@@ -1529,6 +1591,7 @@ var CompleteResult = class _CompleteResult extends (/* @__PURE__ */ Opaque()(/*
1529
1591
  /**
1530
1592
  * Empty completion result used when a completion request has no values.
1531
1593
  *
1594
+ * @stability unstable
1532
1595
  * @since 4.0.0
1533
1596
  */
1534
1597
  static empty = /* @__PURE__ */ _CompleteResult.make({
@@ -1677,7 +1740,7 @@ var ElicitDeclineResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1677
1740
  var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
1678
1741
  var Elicit = class extends (/* @__PURE__ */ make2("elicitation/create", {
1679
1742
  success: ElicitResult,
1680
- error: McpError2,
1743
+ error: McpError,
1681
1744
  payload: ElicitRequestParams
1682
1745
  })) {
1683
1746
  };
@@ -1743,40 +1806,160 @@ ${JSON.stringify(input, null, 2)}`,
1743
1806
  requestedSchema: { type: "object", properties: {} }
1744
1807
  });
1745
1808
 
1746
- // src/contracts/webhook-protocol.ts
1747
- var WebhookTransportLimits = Schema_exports.Struct({
1748
- maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1809
+ // src/contracts/router.ts
1810
+ var reservedRouterKeys = /* @__PURE__ */ new Set([
1811
+ "__proto__",
1812
+ "constructor",
1813
+ "prototype"
1814
+ ]);
1815
+ var RouterKey = Schema_exports.String.check(
1816
+ Schema_exports.isPattern(/^[A-Za-z_][A-Za-z0-9_-]{0,99}$/u),
1817
+ Schema_exports.makeFilter((key) => !reservedRouterKeys.has(key))
1818
+ );
1819
+ var RouterIcon = Schema_exports.Struct({
1820
+ src: Schema_exports.NonEmptyString,
1821
+ mimeType: Schema_exports.optionalKey(Schema_exports.String),
1822
+ sizes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
1823
+ theme: Schema_exports.optionalKey(Schema_exports.Literals(["light", "dark"]))
1749
1824
  });
1750
- var defaultWebhookTransportLimits = WebhookTransportLimits.make({
1751
- maxBodyBytes: 1024 * 1024
1825
+ var RouterMeta = Schema_exports.Struct({
1826
+ title: Schema_exports.optionalKey(Schema_exports.String),
1827
+ description: Schema_exports.optionalKey(Schema_exports.String),
1828
+ instructions: Schema_exports.optionalKey(Schema_exports.String),
1829
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
1830
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String))
1752
1831
  });
1753
- var encodedBodyChars = 4 * Math.ceil(defaultWebhookTransportLimits.maxBodyBytes / 3);
1754
- var WebhookRequestData = Schema_exports.Struct({
1832
+
1833
+ // src/contracts/tools.ts
1834
+ var ToolAnnotations2 = Schema_exports.Struct({
1835
+ title: Schema_exports.optionalKey(Schema_exports.String),
1836
+ readOnlyHint: Schema_exports.optionalKey(Schema_exports.Boolean),
1837
+ destructiveHint: Schema_exports.optionalKey(Schema_exports.Boolean),
1838
+ idempotentHint: Schema_exports.optionalKey(Schema_exports.Boolean),
1839
+ openWorldHint: Schema_exports.optionalKey(Schema_exports.Boolean)
1840
+ });
1841
+
1842
+ // src/contracts/mcp.ts
1843
+ var McpClientLimits = Schema_exports.Struct({
1844
+ timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1845
+ maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1846
+ maxTools: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1847
+ maxPaginationCursors: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1848
+ cleanupTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1849
+ });
1850
+ var defaultMcpClientLimits = McpClientLimits.make({
1851
+ timeoutMs: 3e4,
1852
+ maxTimeoutMs: 3e5,
1853
+ maxTools: 5e4,
1854
+ maxPaginationCursors: 1e3,
1855
+ cleanupTimeoutMs: 1e3
1856
+ });
1857
+ var mcpSdkTimerCeilingMs = 2147483647;
1858
+ var McpToolsOptions = Schema_exports.Struct({
1755
1859
  url: HttpUrl,
1756
- method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]),
1757
- headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1758
- body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1860
+ accountId: Schema_exports.optional(AccountId),
1861
+ headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
1862
+ signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
1863
+ timeoutMs: Schema_exports.optional(
1864
+ Schema_exports.Number.check(
1865
+ Schema_exports.isInt(),
1866
+ Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
1867
+ )
1868
+ )
1759
1869
  });
1760
- var WebhookResponseData = Schema_exports.Struct({
1761
- status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 200, maximum: 599 })),
1870
+ var McpHealthInput = Schema_exports.Struct({
1871
+ ...McpToolsOptions.fields,
1762
1872
  headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1763
- body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1873
+ deadline: Schema_exports.optional(Schema_exports.Finite)
1764
1874
  });
1765
- var ManualWebhookSetup = Schema_exports.Struct({
1766
- instructions: Schema_exports.NonEmptyString,
1767
- signingSecret: Schema_exports.Literals(["executor", "provider"])
1875
+ var mcpHealthReserveMs = 2 * defaultMcpClientLimits.cleanupTimeoutMs + 250;
1876
+ var McpToolResult = Schema_exports.Struct({
1877
+ content: Schema_exports.Array(JsonObject2),
1878
+ structuredContent: Schema_exports.optionalKey(JsonObject2),
1879
+ isError: Schema_exports.optionalKey(Schema_exports.Boolean),
1880
+ _meta: Schema_exports.optionalKey(JsonObject2)
1768
1881
  });
1769
- var ManualWebhookDescriptor = Schema_exports.Struct({
1770
- ...ManualWebhookSetup.fields,
1771
- stateSchema: JsonObject2
1882
+ var McpToolMetadata = Schema_exports.Struct({
1883
+ name: Schema_exports.String,
1884
+ title: Schema_exports.optional(Schema_exports.String),
1885
+ description: Schema_exports.optional(Schema_exports.String),
1886
+ inputSchema: JsonObject2,
1887
+ outputSchema: Schema_exports.optional(JsonObject2),
1888
+ annotations: Schema_exports.optional(ToolAnnotations2),
1889
+ _meta: Schema_exports.optional(JsonObject2)
1772
1890
  });
1773
- var HostedWebhook = Schema_exports.Struct({
1774
- name: Schema_exports.NonEmptyString,
1775
- account: Schema_exports.NonEmptyString,
1776
- configSchema: JsonObject2,
1777
- setup: Schema_exports.optionalKey(ManualWebhookDescriptor)
1891
+ var McpServerHeader = Schema_exports.Struct({
1892
+ name: Schema_exports.optionalKey(Schema_exports.String),
1893
+ title: Schema_exports.optionalKey(Schema_exports.String),
1894
+ version: Schema_exports.optionalKey(Schema_exports.String),
1895
+ description: Schema_exports.optionalKey(Schema_exports.String),
1896
+ websiteUrl: Schema_exports.optionalKey(Schema_exports.String),
1897
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
1898
+ instructions: Schema_exports.optionalKey(Schema_exports.String)
1778
1899
  });
1779
- var identity = {
1900
+ var McpError2 = class extends Schema_exports.TaggedError()("McpError", {
1901
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
1902
+ reason: Schema_exports.Literals([
1903
+ "request",
1904
+ "unauthorized",
1905
+ "invalid_response",
1906
+ "timeout",
1907
+ "invalid_input"
1908
+ ]),
1909
+ status: Schema_exports.optional(Schema_exports.Number),
1910
+ upstream: Schema_exports.optional(UpstreamError),
1911
+ session: Schema_exports.optional(Schema_exports.Literal(true))
1912
+ }) {
1913
+ };
1914
+ var McpCredentialsUnverified = class extends Schema_exports.TaggedError()(
1915
+ "McpCredentialsUnverified",
1916
+ { anonymous: Schema_exports.Union([Schema_exports.Literal("answered"), McpError2, ProviderError]) }
1917
+ ) {
1918
+ };
1919
+ var ProcessConfig = Schema_exports.Struct({
1920
+ command: Schema_exports.NonEmptyString,
1921
+ args: Schema_exports.Array(Schema_exports.String),
1922
+ cwd: Schema_exports.optional(Schema_exports.String),
1923
+ env: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1924
+ timeoutMs: Schema_exports.Int.check(
1925
+ Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
1926
+ )
1927
+ });
1928
+
1929
+ // src/contracts/webhook-protocol.ts
1930
+ var WebhookTransportLimits = Schema_exports.Struct({
1931
+ maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1932
+ });
1933
+ var defaultWebhookTransportLimits = WebhookTransportLimits.make({
1934
+ maxBodyBytes: 1024 * 1024
1935
+ });
1936
+ var encodedBodyChars = 4 * Math.ceil(defaultWebhookTransportLimits.maxBodyBytes / 3);
1937
+ var WebhookRequestData = Schema_exports.Struct({
1938
+ url: HttpUrl,
1939
+ method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]),
1940
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1941
+ body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1942
+ });
1943
+ var WebhookResponseData = Schema_exports.Struct({
1944
+ status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 200, maximum: 599 })),
1945
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1946
+ body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1947
+ });
1948
+ var ManualWebhookSetup = Schema_exports.Struct({
1949
+ instructions: Schema_exports.NonEmptyString,
1950
+ signingSecret: Schema_exports.Literals(["executor", "provider"])
1951
+ });
1952
+ var ManualWebhookDescriptor = Schema_exports.Struct({
1953
+ ...ManualWebhookSetup.fields,
1954
+ stateSchema: JsonObject2
1955
+ });
1956
+ var HostedWebhook = Schema_exports.Struct({
1957
+ name: Schema_exports.NonEmptyString,
1958
+ account: Schema_exports.NonEmptyString,
1959
+ configSchema: JsonObject2,
1960
+ setup: Schema_exports.optionalKey(ManualWebhookDescriptor)
1961
+ });
1962
+ var identity = {
1780
1963
  name: Schema_exports.NonEmptyString,
1781
1964
  subscriptionId: Schema_exports.NonEmptyString,
1782
1965
  sourceAccount: AccountId,
@@ -1798,6 +1981,52 @@ var WebhookCommand = Schema_exports.Union([
1798
1981
  })
1799
1982
  ]);
1800
1983
 
1984
+ // src/contracts/events.ts
1985
+ var EventName = Schema_exports.String.check(
1986
+ Schema_exports.isPattern(/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/u),
1987
+ Schema_exports.isMaxLength(64)
1988
+ );
1989
+ var EventFilterValue = Schema_exports.Union([Schema_exports.String, Schema_exports.Finite, Schema_exports.Boolean]);
1990
+ var EventLimits = Schema_exports.Struct({
1991
+ /** An occurrence's `data`, leaving room under a 256 KiB delivery for its envelope. */
1992
+ maxDataBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1993
+ maxEventsPerInvocation: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1994
+ maxDescriptionLength: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1995
+ maxIdLength: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1996
+ });
1997
+ var defaultEventLimits = EventLimits.make({
1998
+ maxDataBytes: 250 * 1024,
1999
+ maxEventsPerInvocation: 100,
2000
+ maxDescriptionLength: 1e3,
2001
+ maxIdLength: 200
2002
+ });
2003
+ var DeclaredEvent = Schema_exports.Struct({
2004
+ description: Schema_exports.String.check(
2005
+ Schema_exports.isMinLength(1),
2006
+ Schema_exports.isMaxLength(defaultEventLimits.maxDescriptionLength)
2007
+ ),
2008
+ /** An object of scalar fields. Subscribers may name any of them to narrow an event. */
2009
+ filters: JsonObject2,
2010
+ /** The shape of each occurrence's `data`. */
2011
+ payload: JsonObject2
2012
+ });
2013
+ var DeclaredEvents = Schema_exports.Record(EventName, DeclaredEvent);
2014
+ var EmittedEvent = Schema_exports.Struct({
2015
+ name: EventName,
2016
+ id: Schema_exports.String.check(
2017
+ Schema_exports.isMinLength(1),
2018
+ Schema_exports.isMaxLength(defaultEventLimits.maxIdLength)
2019
+ ),
2020
+ /** Milliseconds since the epoch when the event happened. */
2021
+ occurredAt: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)),
2022
+ data: JsonValue,
2023
+ filters: Schema_exports.Record(Schema_exports.String, EventFilterValue),
2024
+ account: Schema_exports.NullOr(AccountId)
2025
+ });
2026
+ var EmittedEvents = Schema_exports.Array(EmittedEvent).check(
2027
+ Schema_exports.isMaxLength(defaultEventLimits.maxEventsPerInvocation)
2028
+ );
2029
+
1801
2030
  // src/contracts/provider.ts
1802
2031
  var SecretsMethod = class extends Data_exports.TaggedClass(
1803
2032
  "secrets"
@@ -1814,7 +2043,7 @@ var OAuthSecretClientAuth = Schema_exports.Literals([
1814
2043
  "client_secret_basic",
1815
2044
  "client_secret_basic_raw"
1816
2045
  ]);
1817
- var reservedAuthorizationParams = /* @__PURE__ */ new Set([
2046
+ var reservedAuthorizationParams = [
1818
2047
  "response_type",
1819
2048
  "client_id",
1820
2049
  "redirect_uri",
@@ -1826,17 +2055,55 @@ var reservedAuthorizationParams = /* @__PURE__ */ new Set([
1826
2055
  "resource",
1827
2056
  "request",
1828
2057
  "request_uri"
1829
- ]);
2058
+ ];
2059
+ var reserved = new Set(reservedAuthorizationParams);
1830
2060
  var OAuthAuthorizationParams = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
1831
- Schema_exports.makeFilter(
1832
- (params) => Object.keys(params).every((key) => !reservedAuthorizationParams.has(key)),
1833
- {
1834
- message: "Authorization parameters cannot replace protocol parameters such as state or scope."
1835
- }
1836
- )
2061
+ Schema_exports.makeFilter((params) => Object.keys(params).every((key) => !reserved.has(key)), {
2062
+ message: "Authorization parameters cannot replace protocol parameters such as state or scope."
2063
+ })
2064
+ );
2065
+ var declaredAuthorizationQuery = Schema_exports.makeFilter(
2066
+ (config) => {
2067
+ const keys = [...new URL(config.authorizationUrl).searchParams.keys()];
2068
+ const owned = keys.filter((key) => reserved.has(key));
2069
+ if (owned.length > 0)
2070
+ return {
2071
+ path: ["authorizationUrl"],
2072
+ issue: `authorizationUrl cannot set protocol parameters: ${owned.join(", ")}.`
2073
+ };
2074
+ const repeated = keys.filter((key) => Object.hasOwn(config.authorizationParams ?? {}, key));
2075
+ if (repeated.length > 0)
2076
+ return {
2077
+ path: ["authorizationParams"],
2078
+ issue: `Declare each parameter once; authorizationUrl already sets: ${repeated.join(", ")}.`
2079
+ };
2080
+ return void 0;
2081
+ }
1837
2082
  );
2083
+ var OAuthTokenRequestFormat = Schema_exports.Literals(["form", "json"]);
2084
+ var OAuthTokenResponse = Schema_exports.Struct({
2085
+ path: Schema_exports.String.check(Schema_exports.isPattern(/^[^.]+(\.[^.]+)*$/))
2086
+ });
2087
+ var tokenRequestOptions = {
2088
+ /** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
2089
+ scopeSeparator: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMinLength(1))),
2090
+ /** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
2091
+ tokenRequestFormat: Schema_exports.optionalKey(OAuthTokenRequestFormat)
2092
+ };
1838
2093
  var oauthOptions = {
2094
+ ...tokenRequestOptions,
2095
+ /**
2096
+ * Read the grant from this nested member of the token response when the top-level response has
2097
+ * no access token or no scope. Slack's user tokens use `{ path: "authed_user" }`.
2098
+ */
2099
+ tokenResponse: Schema_exports.optionalKey(OAuthTokenResponse),
1839
2100
  grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
2101
+ /**
2102
+ * Service-defined authorization request parameters, such as Google's
2103
+ * `{ access_type: "offline", prompt: "consent" }`. Host-owned protocol parameters
2104
+ * (`state`, `scope`, `redirect_uri`, PKCE and the others in `reservedAuthorizationParams`)
2105
+ * are rejected. A discovered endpoint's own query parameter of the same name is replaced.
2106
+ */
1840
2107
  authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams),
1841
2108
  tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth),
1842
2109
  /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
@@ -1846,6 +2113,8 @@ var OAuth2Config = Schema_exports.Union([
1846
2113
  Schema_exports.Struct({
1847
2114
  ...oauthOptions,
1848
2115
  discover: HttpUrl,
2116
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
2117
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl),
1849
2118
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1850
2119
  tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1851
2120
  revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
@@ -1853,21 +2122,26 @@ var OAuth2Config = Schema_exports.Union([
1853
2122
  }),
1854
2123
  Schema_exports.Struct({
1855
2124
  ...oauthOptions,
2125
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
1856
2126
  authorizationUrl: HttpUrl,
1857
2127
  tokenUrl: HttpUrl,
1858
2128
  revocationUrl: Schema_exports.optionalKey(HttpUrl),
1859
2129
  scopes: Schema_exports.Array(Schema_exports.String),
1860
2130
  /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
1861
2131
  issuer: Schema_exports.optionalKey(HttpUrl),
1862
- discover: Schema_exports.optionalKey(Schema_exports.Never)
1863
- }),
2132
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
2133
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
2134
+ }).check(declaredAuthorizationQuery),
1864
2135
  Schema_exports.Struct({
1865
2136
  grant: Schema_exports.Literal("client_credentials"),
1866
2137
  discover: HttpUrl,
2138
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
2139
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl),
1867
2140
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1868
2141
  tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1869
2142
  revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1870
2143
  scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
2144
+ ...tokenRequestOptions,
1871
2145
  tokenEndpointAuthMethod: OAuthSecretClientAuth,
1872
2146
  resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1873
2147
  }),
@@ -1876,10 +2150,12 @@ var OAuth2Config = Schema_exports.Union([
1876
2150
  tokenUrl: HttpUrl,
1877
2151
  revocationUrl: Schema_exports.optionalKey(HttpUrl),
1878
2152
  scopes: Schema_exports.Array(Schema_exports.String),
2153
+ ...tokenRequestOptions,
1879
2154
  tokenEndpointAuthMethod: OAuthSecretClientAuth,
1880
2155
  resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
1881
2156
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1882
- discover: Schema_exports.optionalKey(Schema_exports.Never)
2157
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
2158
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
1883
2159
  })
1884
2160
  ]);
1885
2161
  var OAuth2AccessToken = Schema_exports.Struct({ access_token: Schema_exports.String });
@@ -1887,6 +2163,16 @@ var OAuth2Method = class extends Data_exports.TaggedClass(
1887
2163
  "oauth2"
1888
2164
  ) {
1889
2165
  };
2166
+ var displayText = Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(255));
2167
+ var AccountInfo = Schema_exports.Struct({
2168
+ externalId: Schema_exports.optionalKey(displayText),
2169
+ displayName: Schema_exports.optionalKey(displayText),
2170
+ username: Schema_exports.optionalKey(displayText),
2171
+ email: Schema_exports.optionalKey(displayText),
2172
+ avatarUrl: Schema_exports.optionalKey(HttpUrl),
2173
+ profileUrl: Schema_exports.optionalKey(HttpUrl)
2174
+ });
2175
+ var AccountCheckResult = Schema_exports.Struct({ accountInfo: Schema_exports.optionalKey(AccountInfo) });
1890
2176
  var Provider = class extends Data_exports.Class {
1891
2177
  /** Declare zero or more accounts from this provider without performing I/O. */
1892
2178
  many() {
@@ -1897,17 +2183,263 @@ var ManyAccounts = class extends Data_exports.TaggedClass("many") {
1897
2183
  };
1898
2184
 
1899
2185
  // src/contracts/protocol-version.ts
1900
- var frameworkProtocol = 4;
2186
+ var frameworkProtocol = 11;
1901
2187
 
1902
- // src/contracts/schedules.ts
1903
- var minimumIntervalMilliseconds = 6e4;
1904
- var count = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
1905
- var absent = Schema_exports.optionalKey(Schema_exports.Never);
1906
- var Interval = Schema_exports.Union([
1907
- Schema_exports.Struct({ seconds: count, minutes: absent, hours: absent }),
1908
- Schema_exports.Struct({ seconds: absent, minutes: count, hours: absent }),
1909
- Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count })
2188
+ // src/contracts/protocols/oauth.ts
2189
+ var HttpUrl2 = Schema_exports.String.check(
2190
+ Schema_exports.makeFilter((value) => {
2191
+ try {
2192
+ const url = new URL(value);
2193
+ return url.protocol === "https:" || url.protocol === "http:";
2194
+ } catch {
2195
+ return false;
2196
+ }
2197
+ })
2198
+ );
2199
+ var OAuthClientAuth2 = Schema_exports.Literals([
2200
+ "none",
2201
+ "client_secret_post",
2202
+ "client_secret_basic",
2203
+ "client_secret_basic_raw"
2204
+ ]);
2205
+ var OAuthSecretClientAuth2 = Schema_exports.Literals([
2206
+ "client_secret_post",
2207
+ "client_secret_basic",
2208
+ "client_secret_basic_raw"
2209
+ ]);
2210
+ var reservedAuthorizationParams2 = [
2211
+ "response_type",
2212
+ "client_id",
2213
+ "redirect_uri",
2214
+ "state",
2215
+ "scope",
2216
+ "code_challenge",
2217
+ "code_challenge_method",
2218
+ "nonce",
2219
+ "resource",
2220
+ "request",
2221
+ "request_uri"
2222
+ ];
2223
+ var reserved2 = new Set(reservedAuthorizationParams2);
2224
+ var OAuthAuthorizationParams2 = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
2225
+ Schema_exports.makeFilter((params) => Object.keys(params).every((key) => !reserved2.has(key)), {
2226
+ message: "Authorization parameters cannot replace protocol parameters such as state or scope."
2227
+ })
2228
+ );
2229
+ var declaredAuthorizationQuery2 = Schema_exports.makeFilter(
2230
+ (config) => {
2231
+ const keys = [...new URL(config.authorizationUrl).searchParams.keys()];
2232
+ const owned = keys.filter((key) => reserved2.has(key));
2233
+ if (owned.length > 0)
2234
+ return {
2235
+ path: ["authorizationUrl"],
2236
+ issue: `authorizationUrl cannot set protocol parameters: ${owned.join(", ")}.`
2237
+ };
2238
+ const repeated = keys.filter((key) => Object.hasOwn(config.authorizationParams ?? {}, key));
2239
+ if (repeated.length > 0)
2240
+ return {
2241
+ path: ["authorizationParams"],
2242
+ issue: `Declare each parameter once; authorizationUrl already sets: ${repeated.join(", ")}.`
2243
+ };
2244
+ return void 0;
2245
+ }
2246
+ );
2247
+ var OAuthTokenRequestFormat2 = Schema_exports.Literals(["form", "json"]);
2248
+ var OAuthTokenResponse2 = Schema_exports.Struct({
2249
+ path: Schema_exports.String.check(Schema_exports.isPattern(/^[^.]+(\.[^.]+)*$/))
2250
+ });
2251
+ var tokenRequestOptions2 = {
2252
+ /** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
2253
+ scopeSeparator: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMinLength(1))),
2254
+ /** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
2255
+ tokenRequestFormat: Schema_exports.optionalKey(OAuthTokenRequestFormat2)
2256
+ };
2257
+ var oauthOptions2 = {
2258
+ ...tokenRequestOptions2,
2259
+ /**
2260
+ * Read the grant from this nested member of the token response when the top-level response has
2261
+ * no access token or no scope. Slack's user tokens use `{ path: "authed_user" }`.
2262
+ */
2263
+ tokenResponse: Schema_exports.optionalKey(OAuthTokenResponse2),
2264
+ grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
2265
+ /**
2266
+ * Service-defined authorization request parameters, such as Google's
2267
+ * `{ access_type: "offline", prompt: "consent" }`. Host-owned protocol parameters
2268
+ * (`state`, `scope`, `redirect_uri`, PKCE and the others in `reservedAuthorizationParams`)
2269
+ * are rejected. A discovered endpoint's own query parameter of the same name is replaced.
2270
+ */
2271
+ authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams2),
2272
+ tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth2),
2273
+ /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
2274
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl2))
2275
+ };
2276
+ var OAuth2Config2 = Schema_exports.Union([
2277
+ Schema_exports.Struct({
2278
+ ...oauthOptions2,
2279
+ discover: HttpUrl2,
2280
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2281
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
2282
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2283
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
2284
+ }),
2285
+ Schema_exports.Struct({
2286
+ ...oauthOptions2,
2287
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
2288
+ authorizationUrl: HttpUrl2,
2289
+ tokenUrl: HttpUrl2,
2290
+ revocationUrl: Schema_exports.optionalKey(HttpUrl2),
2291
+ scopes: Schema_exports.Array(Schema_exports.String),
2292
+ /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
2293
+ issuer: Schema_exports.optionalKey(HttpUrl2),
2294
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
2295
+ }).check(declaredAuthorizationQuery2),
2296
+ Schema_exports.Struct({
2297
+ grant: Schema_exports.Literal("client_credentials"),
2298
+ discover: HttpUrl2,
2299
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2300
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
2301
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2302
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
2303
+ ...tokenRequestOptions2,
2304
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
2305
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl2))
2306
+ }),
2307
+ Schema_exports.Struct({
2308
+ grant: Schema_exports.Literal("client_credentials"),
2309
+ tokenUrl: HttpUrl2,
2310
+ revocationUrl: Schema_exports.optionalKey(HttpUrl2),
2311
+ scopes: Schema_exports.Array(Schema_exports.String),
2312
+ ...tokenRequestOptions2,
2313
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
2314
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl2)),
2315
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2316
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
2317
+ })
2318
+ ]);
2319
+
2320
+ // src/contracts/protocols/1.ts
2321
+ var JsonValue2 = Schema_exports.Json;
2322
+ var JsonObject3 = Schema_exports.Record(Schema_exports.String, JsonValue2);
2323
+ var AccountId2 = Schema_exports.String.pipe(
2324
+ Schema_exports.check(Schema_exports.isStartingWith("acc_"), Schema_exports.isMinLength(5)),
2325
+ Schema_exports.brand("acc")
2326
+ );
2327
+ var CacheError = class extends Schema_exports.TaggedError()("CacheError", {
2328
+ reason: Schema_exports.Literals(["unavailable", "storage", "invalid", "capacity", "timeout"])
2329
+ }) {
2330
+ };
2331
+ var Key = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{64}$/));
2332
+ var Time = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
2333
+ var CacheEntry = Schema_exports.Struct({
2334
+ value: Schema_exports.Json,
2335
+ version: Schema_exports.String,
2336
+ freshUntil: Time,
2337
+ staleUntil: Time
2338
+ });
2339
+ var CacheCommand2 = Schema_exports.Union([
2340
+ Schema_exports.Struct({ operation: Schema_exports.Literal("read"), keys: Schema_exports.Array(Key) }),
2341
+ Schema_exports.Struct({
2342
+ operation: Schema_exports.Literal("acquire"),
2343
+ key: Key,
2344
+ /** Claim even a fresh entry, as an explicit refresh does. */
2345
+ refresh: Schema_exports.Boolean,
2346
+ /** Claim only while the entry still has this version. Absent accepts the current one. */
2347
+ version: Schema_exports.optionalKey(Schema_exports.NullOr(Schema_exports.String))
2348
+ }),
2349
+ Schema_exports.Struct({
2350
+ operation: Schema_exports.Literal("claim"),
2351
+ key: Key,
2352
+ version: Schema_exports.NullOr(Schema_exports.String)
2353
+ }),
2354
+ Schema_exports.Struct({
2355
+ operation: Schema_exports.Literal("publish"),
2356
+ key: Key,
2357
+ lease: Schema_exports.String,
2358
+ entry: CacheEntry
2359
+ }),
2360
+ Schema_exports.Struct({ operation: Schema_exports.Literal("release"), key: Key, lease: Schema_exports.String }),
2361
+ /** Extend a lease its holder still owns. Replies false once the lease lapsed or was replaced. */
2362
+ Schema_exports.Struct({ operation: Schema_exports.Literal("renew"), key: Key, lease: Schema_exports.String }),
2363
+ Schema_exports.Struct({
2364
+ operation: Schema_exports.Literal("write"),
2365
+ entries: Schema_exports.Array(Schema_exports.Struct({ key: Key, entry: CacheEntry }))
2366
+ }),
2367
+ Schema_exports.Struct({ operation: Schema_exports.Literal("invalidate"), key: Key })
2368
+ ]);
2369
+ var CacheReply2 = Schema_exports.Union([
2370
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: Schema_exports.Json }),
2371
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: CacheError })
2372
+ ]);
2373
+ var DataName2 = Schema_exports.String.check(
2374
+ Schema_exports.makeFilter((value) => /^[A-Za-z][A-Za-z0-9_]*$/.test(value) && value.length <= 128)
2375
+ );
2376
+ var Scalar2 = Schema_exports.Union([Schema_exports.String, Schema_exports.Finite, Schema_exports.Boolean]);
2377
+ var Field2 = Schema_exports.Struct({
2378
+ kind: Schema_exports.Literals(["string", "number", "boolean", "id", "userId"]),
2379
+ optional: Schema_exports.optional(Schema_exports.Boolean),
2380
+ default: Schema_exports.optional(Scalar2),
2381
+ references: Schema_exports.optional(DataName2)
2382
+ });
2383
+ var Index2 = Schema_exports.Struct({ name: DataName2, fields: Schema_exports.NonEmptyArray(DataName2) });
2384
+ var Table2 = Schema_exports.Struct({
2385
+ fields: Schema_exports.Record(DataName2, Field2),
2386
+ indexes: Schema_exports.Array(Index2)
2387
+ });
2388
+ var DatabaseSchema2 = Schema_exports.Record(DataName2, Table2);
2389
+ var maxApiErrorInstructionsLength2 = 4096;
2390
+ var ApiErrorRecovery2 = Schema_exports.Struct({
2391
+ action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
2392
+ instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(maxApiErrorInstructionsLength2))
2393
+ });
2394
+ var maxApiErrorMessageLength2 = 4096;
2395
+ var ApiErrorResponse2 = Schema_exports.Struct({
2396
+ code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
2397
+ status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
2398
+ message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(maxApiErrorMessageLength2)),
2399
+ recovery: Schema_exports.optionalKey(ApiErrorRecovery2)
2400
+ });
2401
+ var OpenapiResponseError2 = class extends Schema_exports.TaggedError()(
2402
+ "OpenapiResponseError",
2403
+ ApiErrorResponse2.fields
2404
+ ) {
2405
+ };
2406
+ var FormElicitation2 = Schema_exports.Struct({
2407
+ ...ElicitRequestFormParams.fields,
2408
+ mode: Schema_exports.Literal("form"),
2409
+ requestedSchema: Schema_exports.toEncoded(ElicitRequestFormParams.fields.requestedSchema),
2410
+ _meta: Schema_exports.optional(JsonObject3)
2411
+ });
2412
+ var ElicitationResponse2 = Schema_exports.Union([
2413
+ Schema_exports.Struct({ ...ElicitAcceptResult.fields, _meta: Schema_exports.optional(JsonObject3) }),
2414
+ Schema_exports.Struct({ ...ElicitDeclineResult.fields, _meta: Schema_exports.optional(JsonObject3) })
2415
+ ]);
2416
+ var ElicitationFailed2 = class extends Schema_exports.TaggedError()(
2417
+ "ElicitationFailed",
2418
+ {
2419
+ reason: Schema_exports.Literals([
2420
+ "unavailable",
2421
+ "transaction",
2422
+ "invalid-request",
2423
+ "invalid-response",
2424
+ "transport",
2425
+ "expired",
2426
+ "forbidden"
2427
+ ])
2428
+ }
2429
+ ) {
2430
+ };
2431
+ var ElicitationReply2 = Schema_exports.Union([
2432
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), response: ElicitationResponse2 }),
2433
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: ElicitationFailed2 })
1910
2434
  ]);
2435
+ var ApprovalElicitation2 = Schema_exports.Struct({
2436
+ ...FormElicitation2.fields,
2437
+ requestedSchema: Schema_exports.Struct({
2438
+ type: Schema_exports.Literal("object"),
2439
+ properties: Schema_exports.Record(Schema_exports.String, Schema_exports.Never)
2440
+ })
2441
+ });
2442
+ var minimumIntervalMilliseconds = 6e4;
1911
2443
  var CalendarSchedule = Schema_exports.Struct({
1912
2444
  expression: Schema_exports.NonEmptyString,
1913
2445
  timezone: Schema_exports.NonEmptyString
@@ -1931,62 +2463,282 @@ var ScheduleTiming = Schema_exports.Union([
1931
2463
  var OperationSchedule = Schema_exports.Struct({
1932
2464
  name: Schema_exports.NonEmptyString,
1933
2465
  timing: ScheduleTiming,
1934
- input: JsonValue
2466
+ input: JsonValue2
1935
2467
  });
1936
-
1937
- // src/contracts/protocols/1.ts
1938
- var WorkflowFailure2 = class extends Schema_exports.TaggedError()("WorkflowFailure", {
1939
- reason: Schema_exports.Literals([
1940
- "unavailable",
1941
- "not_found",
1942
- "input",
1943
- "output",
1944
- "operation",
1945
- "approval",
1946
- "credentials",
1947
- "terminated",
1948
- "execution",
1949
- "conflict",
1950
- "engine"
1951
- ]),
1952
- retryable: Schema_exports.Boolean
1953
- }) {
2468
+ var SkillFilePath = Schema_exports.NonEmptyString.check(
2469
+ Schema_exports.makeFilter(
2470
+ (path) => !path.startsWith("/") && !path.includes("\\") && !path.includes("\0") && path.split("/").every((part) => part !== "" && part !== "." && part !== "..")
2471
+ )
2472
+ );
2473
+ var SkillFile = Schema_exports.Struct({ path: SkillFilePath, content: Schema_exports.String });
2474
+ var skillFormatLimits = {
2475
+ nameCharacters: 64,
2476
+ descriptionCharacters: 1024,
2477
+ compatibilityCharacters: 500
1954
2478
  };
1955
- var WorkflowRpcResult2 = Schema_exports.Union([
1956
- Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
1957
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure2 })
1958
- ]);
1959
- var DeclaredAuthMethod = Schema_exports.Union([
1960
- Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
1961
- Schema_exports.Struct({
1962
- type: Schema_exports.Literal("oauth2"),
1963
- ...OAuth2Config.members[0].fields,
1964
- response: JsonObject2
1965
- }),
1966
- Schema_exports.Struct({
1967
- type: Schema_exports.Literal("oauth2"),
1968
- ...OAuth2Config.members[1].fields,
1969
- response: JsonObject2
1970
- }),
1971
- Schema_exports.Struct({
1972
- type: Schema_exports.Literal("oauth2"),
1973
- ...OAuth2Config.members[2].fields,
1974
- response: JsonObject2
1975
- }),
1976
- Schema_exports.Struct({
1977
- type: Schema_exports.Literal("oauth2"),
1978
- ...OAuth2Config.members[3].fields,
1979
- response: JsonObject2
1980
- })
1981
- ]);
1982
- var DeclaredProvider = Schema_exports.Struct({
1983
- name: Schema_exports.NonEmptyString,
1984
- auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod)
2479
+ var AppSkillName2 = Schema_exports.NonEmptyString.check(
2480
+ Schema_exports.makeFilter(
2481
+ (value) => value === value.toLowerCase() && /^[\p{L}\p{N}]+(?:-[\p{L}\p{N}]+)*$/u.test(value) && [...value].length <= skillFormatLimits.nameCharacters
2482
+ )
2483
+ );
2484
+ var AppSkillMetadata = Schema_exports.Struct({
2485
+ name: AppSkillName2,
2486
+ description: Schema_exports.String.check(
2487
+ Schema_exports.makeFilter(
2488
+ (value) => value.trim().length > 0 && [...value].length <= skillFormatLimits.descriptionCharacters
2489
+ )
2490
+ ),
2491
+ license: Schema_exports.optionalKey(Schema_exports.String),
2492
+ compatibility: Schema_exports.optionalKey(
2493
+ Schema_exports.String.check(
2494
+ Schema_exports.makeFilter(
2495
+ (value) => value.trim().length > 0 && [...value].length <= skillFormatLimits.compatibilityCharacters
2496
+ )
2497
+ )
2498
+ ),
2499
+ metadata: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
2500
+ "allowed-tools": Schema_exports.optionalKey(Schema_exports.String)
1985
2501
  });
1986
- var DeclaredRequirements = Schema_exports.Struct({
1987
- /** Protocol support of this retained framework build, not an author-declared requirement. */
1988
- capabilities: Schema_exports.optionalKey(
1989
- Schema_exports.Struct({
2502
+ var AppSkillSource = Schema_exports.Struct({
2503
+ ...AppSkillMetadata.fields,
2504
+ files: Schema_exports.Array(SkillFile).check(
2505
+ Schema_exports.makeFilter(
2506
+ (files) => files.some((file) => file.path === "SKILL.md") && new Set(files.map((file) => file.path)).size === files.length
2507
+ )
2508
+ )
2509
+ });
2510
+ var AppSkills2 = Schema_exports.Array(AppSkillSource).check(
2511
+ Schema_exports.makeFilter((skills) => new Set(skills.map((skill) => skill.name)).size === skills.length)
2512
+ );
2513
+ var ToolAnnotations3 = Schema_exports.Struct({
2514
+ title: Schema_exports.optionalKey(Schema_exports.String),
2515
+ readOnlyHint: Schema_exports.optionalKey(Schema_exports.Boolean),
2516
+ destructiveHint: Schema_exports.optionalKey(Schema_exports.Boolean),
2517
+ idempotentHint: Schema_exports.optionalKey(Schema_exports.Boolean),
2518
+ openWorldHint: Schema_exports.optionalKey(Schema_exports.Boolean)
2519
+ });
2520
+ var WebhookTransportLimits2 = Schema_exports.Struct({
2521
+ maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
2522
+ });
2523
+ var defaultWebhookTransportLimits2 = WebhookTransportLimits2.make({
2524
+ maxBodyBytes: 1024 * 1024
2525
+ });
2526
+ var encodedBodyChars2 = 4 * Math.ceil(defaultWebhookTransportLimits2.maxBodyBytes / 3);
2527
+ var WebhookRequestData2 = Schema_exports.Struct({
2528
+ url: HttpUrl2,
2529
+ method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]),
2530
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
2531
+ body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars2))
2532
+ });
2533
+ var identity2 = {
2534
+ name: Schema_exports.NonEmptyString,
2535
+ subscriptionId: Schema_exports.NonEmptyString,
2536
+ sourceAccount: AccountId2,
2537
+ callbackUrl: HttpUrl2,
2538
+ secret: Schema_exports.String,
2539
+ config: JsonValue2
2540
+ };
2541
+ var WebhookCommand2 = Schema_exports.Union([
2542
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhooks") }),
2543
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-validate"), ...identity2 }),
2544
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-complete"), ...identity2, state: JsonValue2 }),
2545
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-register"), ...identity2 }),
2546
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-unregister"), ...identity2, state: JsonValue2 }),
2547
+ Schema_exports.Struct({
2548
+ operation: Schema_exports.Literal("webhook-handle"),
2549
+ ...identity2,
2550
+ state: JsonValue2,
2551
+ request: WebhookRequestData2
2552
+ })
2553
+ ]);
2554
+ var WorkflowRunId2 = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
2555
+ var WorkflowName2 = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
2556
+ var durationUnits2 = {
2557
+ millisecond: 1,
2558
+ milliseconds: 1,
2559
+ second: 1e3,
2560
+ seconds: 1e3,
2561
+ minute: 6e4,
2562
+ minutes: 6e4,
2563
+ hour: 36e5,
2564
+ hours: 36e5,
2565
+ day: 864e5,
2566
+ days: 864e5,
2567
+ week: 6048e5,
2568
+ weeks: 6048e5
2569
+ };
2570
+ var workflowDurationMillis2 = (value) => {
2571
+ if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? value : void 0;
2572
+ const match = /^(\d+(?:\.\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(
2573
+ value
2574
+ );
2575
+ const unit = match?.[2] === void 0 ? void 0 : durationUnits2[match[2]];
2576
+ if (unit === void 0) return void 0;
2577
+ const result = Number(match?.[1]) * unit;
2578
+ return Number.isFinite(result) ? result : void 0;
2579
+ };
2580
+ var WorkflowDuration2 = Schema_exports.Union([
2581
+ Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0)),
2582
+ Schema_exports.NonEmptyString
2583
+ ]).check(Schema_exports.makeFilter((value) => workflowDurationMillis2(value) !== void 0));
2584
+ var WorkflowStepOptions2 = Schema_exports.Struct({
2585
+ retries: Schema_exports.optionalKey(
2586
+ Schema_exports.Struct({
2587
+ limit: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)),
2588
+ delay: WorkflowDuration2,
2589
+ backoff: Schema_exports.optionalKey(Schema_exports.Literals(["constant", "linear", "exponential"]))
2590
+ })
2591
+ ),
2592
+ timeout: Schema_exports.optionalKey(WorkflowDuration2)
2593
+ });
2594
+ var WorkflowValue2 = JsonValue2.check(
2595
+ Schema_exports.makeFilter(
2596
+ (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 1024 * 1024
2597
+ )
2598
+ );
2599
+ var WorkflowReplay2 = Schema_exports.Struct({
2600
+ key: Schema_exports.NonEmptyString,
2601
+ fingerprint: Schema_exports.NonEmptyString
2602
+ });
2603
+ var WorkflowCommand2 = Schema_exports.Union([
2604
+ Schema_exports.Struct({ operation: Schema_exports.Literal("workflows") }),
2605
+ Schema_exports.Struct({
2606
+ operation: Schema_exports.Literal("workflow-validate"),
2607
+ name: WorkflowName2,
2608
+ input: JsonValue2
2609
+ }),
2610
+ Schema_exports.Struct({
2611
+ operation: Schema_exports.Literal("workflow-run"),
2612
+ name: WorkflowName2,
2613
+ input: JsonValue2
2614
+ })
2615
+ ]);
2616
+ var WorkflowRpcCommand2 = Schema_exports.Union([
2617
+ Schema_exports.Struct({
2618
+ operation: Schema_exports.Literal("do"),
2619
+ name: WorkflowName2,
2620
+ options: WorkflowStepOptions2
2621
+ }),
2622
+ Schema_exports.Struct({
2623
+ operation: Schema_exports.Literal("sleep"),
2624
+ name: WorkflowName2,
2625
+ duration: WorkflowDuration2
2626
+ }),
2627
+ Schema_exports.Struct({
2628
+ operation: Schema_exports.Literal("until"),
2629
+ name: WorkflowName2,
2630
+ timestamp: Schema_exports.Finite
2631
+ }),
2632
+ Schema_exports.Struct({ operation: Schema_exports.Literal("context") }),
2633
+ Schema_exports.Struct({
2634
+ operation: Schema_exports.Literal("invoke"),
2635
+ kind: Schema_exports.Literals(["query", "mutation"]),
2636
+ name: Schema_exports.NonEmptyString,
2637
+ input: JsonValue2,
2638
+ stepId: Schema_exports.NonEmptyString,
2639
+ timeout: Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0))
2640
+ })
2641
+ ]);
2642
+ var WorkflowControlCommand2 = Schema_exports.Union([
2643
+ Schema_exports.Struct({
2644
+ operation: Schema_exports.Literal("start"),
2645
+ workflow: WorkflowName2,
2646
+ input: WorkflowValue2,
2647
+ key: Schema_exports.optionalKey(Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)))
2648
+ }),
2649
+ Schema_exports.Struct({ operation: Schema_exports.Literal("get"), run: WorkflowRunId2 }),
2650
+ Schema_exports.Struct({
2651
+ operation: Schema_exports.Literal("list"),
2652
+ workflow: Schema_exports.optionalKey(WorkflowName2),
2653
+ cursor: Schema_exports.optionalKey(WorkflowRunId2),
2654
+ limit: Schema_exports.optionalKey(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: 100 })))
2655
+ }),
2656
+ Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId2 })
2657
+ ]);
2658
+ var ProviderError2 = class extends Schema_exports.TaggedError()("ProviderError", {
2659
+ reason: Schema_exports.Literals(["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]),
2660
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
2661
+ accountId: Schema_exports.optional(AccountId2)
2662
+ }) {
2663
+ };
2664
+ var McpError3 = class extends Schema_exports.TaggedError()("McpError", {
2665
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
2666
+ reason: Schema_exports.Literals([
2667
+ "request",
2668
+ "unauthorized",
2669
+ "invalid_response",
2670
+ "timeout",
2671
+ "invalid_input"
2672
+ ]),
2673
+ status: Schema_exports.optional(Schema_exports.Number)
2674
+ }) {
2675
+ };
2676
+ var SkillLoadFailed = class extends Schema_exports.TaggedError()("SkillLoadFailed", {
2677
+ reason: Schema_exports.Literals([
2678
+ "source",
2679
+ "request",
2680
+ "rate_limited",
2681
+ "document",
2682
+ "limit",
2683
+ "changed",
2684
+ "encoding"
2685
+ ]),
2686
+ message: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isMaxLength(500))),
2687
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 })))
2688
+ }) {
2689
+ };
2690
+ var WorkflowFailure2 = class extends Schema_exports.TaggedError()("WorkflowFailure", {
2691
+ reason: Schema_exports.Literals([
2692
+ "unavailable",
2693
+ "not_found",
2694
+ "input",
2695
+ "output",
2696
+ "operation",
2697
+ "approval",
2698
+ "credentials",
2699
+ "terminated",
2700
+ "execution",
2701
+ "conflict",
2702
+ "engine"
2703
+ ]),
2704
+ retryable: Schema_exports.Boolean
2705
+ }) {
2706
+ };
2707
+ var WorkflowRpcResult2 = Schema_exports.Union([
2708
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue2 }),
2709
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure2 })
2710
+ ]);
2711
+ var DeclaredAuthMethod = Schema_exports.Union([
2712
+ Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject3 }),
2713
+ Schema_exports.Struct({
2714
+ type: Schema_exports.Literal("oauth2"),
2715
+ ...OAuth2Config2.members[0].fields,
2716
+ response: JsonObject3
2717
+ }),
2718
+ Schema_exports.Struct({
2719
+ type: Schema_exports.Literal("oauth2"),
2720
+ ...OAuth2Config2.members[1].fields,
2721
+ response: JsonObject3
2722
+ }),
2723
+ Schema_exports.Struct({
2724
+ type: Schema_exports.Literal("oauth2"),
2725
+ ...OAuth2Config2.members[2].fields,
2726
+ response: JsonObject3
2727
+ }),
2728
+ Schema_exports.Struct({
2729
+ type: Schema_exports.Literal("oauth2"),
2730
+ ...OAuth2Config2.members[3].fields,
2731
+ response: JsonObject3
2732
+ })
2733
+ ]);
2734
+ var DeclaredProvider = Schema_exports.Struct({
2735
+ name: Schema_exports.NonEmptyString,
2736
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod)
2737
+ });
2738
+ var DeclaredRequirements = Schema_exports.Struct({
2739
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
2740
+ capabilities: Schema_exports.optionalKey(
2741
+ Schema_exports.Struct({
1990
2742
  skills: Schema_exports.Literal(true),
1991
2743
  /** Accepts inspect detail and tools. Earlier builds reject both as excess fields. */
1992
2744
  toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
@@ -1996,7 +2748,7 @@ var DeclaredRequirements = Schema_exports.Struct({
1996
2748
  scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
1997
2749
  })
1998
2750
  ),
1999
- database: Schema_exports.optionalKey(DatabaseSchema),
2751
+ database: Schema_exports.optionalKey(DatabaseSchema2),
2000
2752
  accounts: Schema_exports.Record(
2001
2753
  Schema_exports.NonEmptyString,
2002
2754
  Schema_exports.Struct({
@@ -2006,7 +2758,7 @@ var DeclaredRequirements = Schema_exports.Struct({
2006
2758
  )
2007
2759
  });
2008
2760
  var ResolvedAccount = Schema_exports.Struct({
2009
- id: AccountId,
2761
+ id: AccountId2,
2010
2762
  provider: DeclaredProvider,
2011
2763
  method: Schema_exports.NonEmptyString,
2012
2764
  /**
@@ -2014,33 +2766,33 @@ var ResolvedAccount = Schema_exports.Struct({
2014
2766
  * send it since credential generations; `apps@0.0.1-beta.0` and `beta.1` ignore it.
2015
2767
  */
2016
2768
  generation: Schema_exports.optionalKey(Schema_exports.Int),
2017
- fields: JsonObject2
2769
+ fields: JsonObject3
2018
2770
  });
2019
2771
  var ResolvedAccounts = Schema_exports.Record(
2020
2772
  Schema_exports.NonEmptyString,
2021
2773
  Schema_exports.Union([ResolvedAccount, Schema_exports.Array(ResolvedAccount)])
2022
2774
  );
2023
- var TrustedToolApproval = Schema_exports.Struct({ tool: Schema_exports.NonEmptyString, input: JsonValue });
2775
+ var TrustedToolApproval = Schema_exports.Struct({ tool: Schema_exports.NonEmptyString, input: JsonValue2 });
2024
2776
  var InvocationDeadline = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
2025
2777
  var HostedTool = Schema_exports.Struct({
2026
2778
  schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
2027
2779
  name: Schema_exports.NonEmptyString,
2028
2780
  description: Schema_exports.String,
2029
- inputSchema: JsonObject2,
2781
+ inputSchema: JsonObject3,
2030
2782
  readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2031
2783
  title: Schema_exports.optionalKey(Schema_exports.String),
2032
- outputSchema: Schema_exports.optionalKey(JsonObject2),
2033
- annotations: Schema_exports.optionalKey(ToolAnnotations),
2034
- _meta: Schema_exports.optionalKey(JsonObject2)
2784
+ outputSchema: Schema_exports.optionalKey(JsonObject3),
2785
+ annotations: Schema_exports.optionalKey(ToolAnnotations3),
2786
+ _meta: Schema_exports.optionalKey(JsonObject3)
2035
2787
  });
2036
2788
  var HostedToolSummary = HostedTool.mapFields(
2037
2789
  ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2038
2790
  );
2039
- var SkillSources = Schema_exports.Struct({ skills: AppSkills, dynamic: Schema_exports.Boolean });
2040
- var SkillCatalogResponse = Schema_exports.Union([SkillSources, AppSkills]);
2791
+ var SkillSources = Schema_exports.Struct({ skills: AppSkills2, dynamic: Schema_exports.Boolean });
2792
+ var SkillCatalogResponse = Schema_exports.Union([SkillSources, AppSkills2]);
2041
2793
  var HostRequest = Schema_exports.Union([
2042
- WorkflowCommand,
2043
- WebhookCommand,
2794
+ WorkflowCommand2,
2795
+ WebhookCommand2,
2044
2796
  Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
2045
2797
  Schema_exports.Struct({
2046
2798
  operation: Schema_exports.Literal("inspect"),
@@ -2062,17 +2814,17 @@ var HostRequest = Schema_exports.Union([
2062
2814
  Schema_exports.Struct({
2063
2815
  operation: Schema_exports.Literal("query"),
2064
2816
  name: Schema_exports.NonEmptyString,
2065
- input: JsonValue
2817
+ input: JsonValue2
2066
2818
  }),
2067
2819
  Schema_exports.Struct({
2068
2820
  operation: Schema_exports.Literal("mutate"),
2069
2821
  name: Schema_exports.NonEmptyString,
2070
- input: JsonValue
2822
+ input: JsonValue2
2071
2823
  }),
2072
2824
  Schema_exports.Struct({
2073
2825
  operation: Schema_exports.Literal("call"),
2074
2826
  tool: Schema_exports.NonEmptyString,
2075
- input: JsonValue
2827
+ input: JsonValue2
2076
2828
  })
2077
2829
  ]);
2078
2830
  var HostRequestInvalid = class extends Schema_exports.TaggedError()(
@@ -2122,7 +2874,7 @@ var HostToolBlocked = class extends Schema_exports.TaggedError()("HostToolBlocke
2122
2874
  };
2123
2875
  var HostToolApprovalRequired = class extends Schema_exports.TaggedError()(
2124
2876
  "HostToolApprovalRequired",
2125
- { input: JsonValue, elicitation: ApprovalElicitation }
2877
+ { input: JsonValue2, elicitation: ApprovalElicitation2 }
2126
2878
  ) {
2127
2879
  };
2128
2880
  var HostToolPolicyFailed = class extends Schema_exports.TaggedError()(
@@ -2136,9 +2888,9 @@ var HostOutputInvalid = class extends Schema_exports.TaggedError()(
2136
2888
  ) {
2137
2889
  };
2138
2890
  var HostError = Schema_exports.Union([
2139
- OpenapiResponseError,
2140
- ProviderError,
2141
- McpError,
2891
+ OpenapiResponseError2,
2892
+ ProviderError2,
2893
+ McpError3,
2142
2894
  SkillLoadFailed,
2143
2895
  WorkflowFailure2,
2144
2896
  HostRequestInvalid,
@@ -2153,12 +2905,12 @@ var HostError = Schema_exports.Union([
2153
2905
  HostToolBlocked,
2154
2906
  HostToolApprovalRequired,
2155
2907
  HostToolPolicyFailed,
2156
- ElicitationFailed
2908
+ ElicitationFailed2
2157
2909
  ]);
2158
2910
  var HostResponse = Schema_exports.Union([
2159
2911
  Schema_exports.Struct({
2160
2912
  ok: Schema_exports.Literal(true),
2161
- value: JsonValue,
2913
+ value: JsonValue2,
2162
2914
  toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2163
2915
  }),
2164
2916
  Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError })
@@ -2167,9 +2919,9 @@ var HostInvocation = Schema_exports.Struct({
2167
2919
  command: HostRequest,
2168
2920
  accounts: ResolvedAccounts,
2169
2921
  approval: Schema_exports.optionalKey(TrustedToolApproval),
2170
- replay: Schema_exports.optionalKey(WorkflowReplay),
2922
+ replay: Schema_exports.optionalKey(WorkflowReplay2),
2171
2923
  deadline: Schema_exports.optionalKey(InvocationDeadline),
2172
- workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2924
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId2)
2173
2925
  });
2174
2926
  var protocol1 = {
2175
2927
  version: 1,
@@ -2181,97 +2933,964 @@ var protocol1 = {
2181
2933
  tools: Schema_exports.Array(HostedTool),
2182
2934
  toolSummaries: Schema_exports.Array(HostedToolSummary),
2183
2935
  skills: SkillCatalogResponse,
2184
- elicitationRequest: FormElicitation,
2185
- elicitationReply: ElicitationReply,
2186
- workflowStep: WorkflowRpcCommand,
2936
+ elicitationRequest: FormElicitation2,
2937
+ elicitationReply: ElicitationReply2,
2938
+ workflowStep: WorkflowRpcCommand2,
2187
2939
  workflowStepReply: WorkflowRpcResult2,
2188
- workflowControl: WorkflowControlCommand,
2189
- cacheCommand: CacheCommand,
2190
- cacheReply: CacheReply
2940
+ workflowControl: WorkflowControlCommand2,
2941
+ cacheCommand: CacheCommand2,
2942
+ cacheReply: CacheReply2
2191
2943
  }
2192
2944
  };
2193
2945
 
2194
2946
  // src/contracts/protocols/2.ts
2195
2947
  var SkillSources2 = Schema_exports.Struct({
2196
- skills: AppSkills,
2948
+ skills: AppSkills2,
2197
2949
  dynamic: Schema_exports.Boolean,
2198
2950
  cached: Schema_exports.optionalKey(Schema_exports.Boolean)
2199
2951
  });
2200
- var SkillCatalogResponse2 = Schema_exports.Union([SkillSources2, AppSkills]);
2952
+ var SkillCatalogResponse2 = Schema_exports.Union([SkillSources2, AppSkills2]);
2201
2953
  var protocol2 = {
2202
2954
  version: 2,
2203
2955
  schemas: { ...protocol1.schemas, skills: SkillCatalogResponse2 }
2204
2956
  };
2205
2957
 
2206
2958
  // src/contracts/protocols/3.ts
2959
+ var maxFailureMessageLength = 2048;
2960
+ var FailureSource = Schema_exports.Literals(["app", "storage", "service"]);
2961
+ var FailureName2 = Schema_exports.String.check(Schema_exports.isMaxLength(128));
2962
+ var FailureCode = Schema_exports.String.check(Schema_exports.isMaxLength(128));
2963
+ var FailureMessage2 = Schema_exports.String.check(Schema_exports.isMaxLength(maxFailureMessageLength));
2964
+ var WorkflowFailureDetail2 = {
2965
+ step: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMaxLength(200))),
2966
+ errorName: Schema_exports.optionalKey(FailureName2),
2967
+ message: Schema_exports.optionalKey(FailureMessage2)
2968
+ };
2969
+ var WorkflowFailure3 = class extends Schema_exports.TaggedError()("WorkflowFailure", {
2970
+ ...WorkflowFailureDetail2,
2971
+ reason: Schema_exports.Literals([
2972
+ "unavailable",
2973
+ "not_found",
2974
+ "input",
2975
+ "output",
2976
+ "operation",
2977
+ "approval",
2978
+ "credentials",
2979
+ "terminated",
2980
+ "execution",
2981
+ "conflict",
2982
+ "engine"
2983
+ ]),
2984
+ retryable: Schema_exports.Boolean
2985
+ }) {
2986
+ };
2987
+ var WorkflowRpcResult3 = Schema_exports.Union([
2988
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue2 }),
2989
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure3 })
2990
+ ]);
2991
+ var DatabaseLimit2 = Schema_exports.Literals([
2992
+ "scanCalls",
2993
+ "directGets",
2994
+ "rowsRead",
2995
+ "rowsReturned",
2996
+ "pageSize",
2997
+ "bytesRead",
2998
+ "writes",
2999
+ "valueBytes"
3000
+ ]);
3001
+ var DatabaseLimitExceeded2 = class extends Schema_exports.TaggedError()(
3002
+ "DatabaseLimitExceeded",
3003
+ {
3004
+ limit: DatabaseLimit2,
3005
+ maximum: Schema_exports.Int,
3006
+ requested: Schema_exports.Int
3007
+ }
3008
+ ) {
3009
+ };
3010
+ var reservedFieldNames2 = ["id", "createdAt", "updatedAt"];
3011
+ var DatabaseFieldReserved2 = class extends Schema_exports.TaggedError()(
3012
+ "DatabaseFieldReserved",
3013
+ {
3014
+ table: Schema_exports.String,
3015
+ field: Schema_exports.Literals(reservedFieldNames2)
3016
+ }
3017
+ ) {
3018
+ };
3019
+ var FailureDetail2 = {
3020
+ source: Schema_exports.optionalKey(FailureSource),
3021
+ errorName: Schema_exports.optionalKey(FailureName2),
3022
+ code: Schema_exports.optionalKey(FailureCode),
3023
+ message: Schema_exports.optionalKey(FailureMessage2)
3024
+ };
2207
3025
  var HostDeclarationInvalid2 = class extends Schema_exports.TaggedError()(
2208
3026
  "HostDeclarationInvalid",
2209
- FailureDetail
3027
+ FailureDetail2
2210
3028
  ) {
2211
3029
  };
2212
3030
  var HostEvaluationFailed2 = class extends Schema_exports.TaggedError()(
2213
3031
  "HostEvaluationFailed",
2214
- FailureDetail
3032
+ FailureDetail2
2215
3033
  ) {
2216
3034
  };
2217
3035
  var HostOperationFailed2 = class extends Schema_exports.TaggedError()(
2218
3036
  "HostOperationFailed",
2219
- FailureDetail
3037
+ FailureDetail2
2220
3038
  ) {
2221
3039
  };
2222
- var HostError2 = Schema_exports.Union([
2223
- OpenapiResponseError,
2224
- ProviderError,
2225
- McpError,
2226
- SkillLoadFailed,
2227
- WorkflowFailure,
2228
- HostRequestInvalid,
2229
- HostAccountsInvalid,
2230
- HostDeclarationInvalid2,
2231
- HostEvaluationFailed2,
2232
- HostOperationNotFound,
2233
- HostOperationFailed2,
2234
- DatabaseLimitExceeded,
2235
- DatabaseFieldReserved,
2236
- HostToolNotFound,
2237
- HostInputInvalid,
2238
- HostOutputInvalid,
2239
- HostToolBlocked,
2240
- HostToolApprovalRequired,
2241
- HostToolPolicyFailed,
2242
- ElicitationFailed
2243
- ]);
2244
- var HostResponse2 = Schema_exports.Union([
3040
+ var HostError2 = Schema_exports.Union([
3041
+ OpenapiResponseError2,
3042
+ ProviderError2,
3043
+ McpError3,
3044
+ SkillLoadFailed,
3045
+ WorkflowFailure3,
3046
+ HostRequestInvalid,
3047
+ HostAccountsInvalid,
3048
+ HostDeclarationInvalid2,
3049
+ HostEvaluationFailed2,
3050
+ HostOperationNotFound,
3051
+ HostOperationFailed2,
3052
+ DatabaseLimitExceeded2,
3053
+ DatabaseFieldReserved2,
3054
+ HostToolNotFound,
3055
+ HostInputInvalid,
3056
+ HostOutputInvalid,
3057
+ HostToolBlocked,
3058
+ HostToolApprovalRequired,
3059
+ HostToolPolicyFailed,
3060
+ ElicitationFailed2
3061
+ ]);
3062
+ var HostResponse2 = Schema_exports.Union([
3063
+ Schema_exports.Struct({
3064
+ ok: Schema_exports.Literal(true),
3065
+ value: JsonValue2,
3066
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
3067
+ }),
3068
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError2 })
3069
+ ]);
3070
+ var protocol3 = {
3071
+ version: 3,
3072
+ schemas: {
3073
+ invocation: HostInvocation,
3074
+ request: HostRequest,
3075
+ response: HostResponse2,
3076
+ requirements: DeclaredRequirements,
3077
+ tools: protocol1.schemas.tools,
3078
+ toolSummaries: protocol1.schemas.toolSummaries,
3079
+ skills: SkillCatalogResponse2,
3080
+ elicitationRequest: FormElicitation2,
3081
+ elicitationReply: ElicitationReply2,
3082
+ workflowStep: WorkflowRpcCommand2,
3083
+ workflowStepReply: WorkflowRpcResult3,
3084
+ workflowControl: WorkflowControlCommand2,
3085
+ cacheCommand: CacheCommand2,
3086
+ cacheReply: CacheReply2
3087
+ }
3088
+ };
3089
+
3090
+ // src/contracts/protocols/4.ts
3091
+ var RouterIcon2 = Schema_exports.Struct({
3092
+ src: Schema_exports.NonEmptyString,
3093
+ mimeType: Schema_exports.optionalKey(Schema_exports.String),
3094
+ sizes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
3095
+ theme: Schema_exports.optionalKey(Schema_exports.Literals(["light", "dark"]))
3096
+ });
3097
+ var HostedTool2 = Schema_exports.Struct({
3098
+ schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
3099
+ name: Schema_exports.NonEmptyString,
3100
+ router: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
3101
+ tags: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
3102
+ description: Schema_exports.String,
3103
+ inputSchema: JsonObject3,
3104
+ readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
3105
+ title: Schema_exports.optionalKey(Schema_exports.String),
3106
+ outputSchema: Schema_exports.optionalKey(JsonObject3),
3107
+ annotations: Schema_exports.optionalKey(ToolAnnotations3),
3108
+ _meta: Schema_exports.optionalKey(JsonObject3)
3109
+ });
3110
+ var HostedToolSummary2 = HostedTool2.mapFields(
3111
+ ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
3112
+ );
3113
+ var HostRouterError = Schema_exports.Union([
3114
+ ProviderError2,
3115
+ McpError3,
3116
+ SkillLoadFailed,
3117
+ HostDeclarationInvalid2,
3118
+ HostEvaluationFailed2
3119
+ ]);
3120
+ var HostedRouter = Schema_exports.Struct({
3121
+ path: Schema_exports.String,
3122
+ title: Schema_exports.optionalKey(Schema_exports.String),
3123
+ description: Schema_exports.optionalKey(Schema_exports.String),
3124
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon2)),
3125
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String)),
3126
+ skill: Schema_exports.optionalKey(AppSkillName2),
3127
+ error: Schema_exports.optionalKey(HostRouterError)
3128
+ });
3129
+ var HostedCatalog = Schema_exports.Struct({
3130
+ tools: Schema_exports.Array(HostedTool2),
3131
+ routers: Schema_exports.Array(HostedRouter)
3132
+ });
3133
+ var HostedCatalogSummary = Schema_exports.Struct({
3134
+ tools: Schema_exports.Array(HostedToolSummary2),
3135
+ routers: Schema_exports.Array(HostedRouter)
3136
+ });
3137
+ var ToolKind = Schema_exports.Literals(["query", "mutation"]);
3138
+ var HostRequest2 = Schema_exports.Union([
3139
+ WorkflowCommand2,
3140
+ WebhookCommand2,
3141
+ Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
3142
+ Schema_exports.Struct({
3143
+ operation: Schema_exports.Literal("inspect"),
3144
+ /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
3145
+ detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
3146
+ /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
3147
+ tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
3148
+ /**
3149
+ * Describe only declared operations that have schedules, without dynamic tool discovery.
3150
+ * Only builds that declare the scheduledTools capability accept this.
3151
+ */
3152
+ scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
3153
+ }),
3154
+ Schema_exports.Struct({
3155
+ operation: Schema_exports.Literal("skills"),
3156
+ /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
3157
+ sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
3158
+ }),
3159
+ Schema_exports.Struct({
3160
+ operation: Schema_exports.Literal("query"),
3161
+ name: Schema_exports.NonEmptyString,
3162
+ input: JsonValue2
3163
+ }),
3164
+ Schema_exports.Struct({
3165
+ operation: Schema_exports.Literal("mutate"),
3166
+ name: Schema_exports.NonEmptyString,
3167
+ input: JsonValue2
3168
+ }),
3169
+ Schema_exports.Struct({
3170
+ operation: Schema_exports.Literal("call"),
3171
+ tool: Schema_exports.NonEmptyString,
3172
+ /**
3173
+ * The caller's claim; the bundle rejects a call whose tool has the other kind. The host omits
3174
+ * it for a tool its catalog does not list, and then opens storage for writing.
3175
+ */
3176
+ kind: Schema_exports.optionalKey(ToolKind),
3177
+ input: JsonValue2
3178
+ })
3179
+ ]);
3180
+ var HostKindMismatch = class extends Schema_exports.TaggedError()("HostKindMismatch", {
3181
+ tool: Schema_exports.NonEmptyString,
3182
+ requested: ToolKind,
3183
+ actual: ToolKind
3184
+ }) {
3185
+ };
3186
+ var HostError3 = Schema_exports.Union([...HostError2.members, HostKindMismatch]);
3187
+ var HostResponse3 = Schema_exports.Union([
3188
+ Schema_exports.Struct({
3189
+ ok: Schema_exports.Literal(true),
3190
+ value: JsonValue2,
3191
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
3192
+ }),
3193
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError3 })
3194
+ ]);
3195
+ var HostInvocation2 = Schema_exports.Struct({
3196
+ command: HostRequest2,
3197
+ accounts: ResolvedAccounts,
3198
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
3199
+ replay: Schema_exports.optionalKey(WorkflowReplay2),
3200
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
3201
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId2)
3202
+ });
3203
+ var protocol4 = {
3204
+ version: 4,
3205
+ schemas: {
3206
+ invocation: HostInvocation2,
3207
+ request: HostRequest2,
3208
+ response: HostResponse3,
3209
+ requirements: protocol3.schemas.requirements,
3210
+ catalog: HostedCatalog,
3211
+ catalogSummary: HostedCatalogSummary,
3212
+ skills: protocol3.schemas.skills,
3213
+ elicitationRequest: protocol3.schemas.elicitationRequest,
3214
+ elicitationReply: protocol3.schemas.elicitationReply,
3215
+ workflowStep: protocol3.schemas.workflowStep,
3216
+ workflowStepReply: protocol3.schemas.workflowStepReply,
3217
+ workflowControl: protocol3.schemas.workflowControl,
3218
+ cacheCommand: protocol3.schemas.cacheCommand,
3219
+ cacheReply: protocol3.schemas.cacheReply
3220
+ }
3221
+ };
3222
+
3223
+ // src/contracts/protocols/5.ts
3224
+ var displayText2 = Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(255));
3225
+ var AccountInfo2 = Schema_exports.Struct({
3226
+ externalId: Schema_exports.optionalKey(displayText2),
3227
+ displayName: Schema_exports.optionalKey(displayText2),
3228
+ username: Schema_exports.optionalKey(displayText2),
3229
+ email: Schema_exports.optionalKey(displayText2),
3230
+ avatarUrl: Schema_exports.optionalKey(HttpUrl2),
3231
+ profileUrl: Schema_exports.optionalKey(HttpUrl2)
3232
+ });
3233
+ var AccountCheckResult2 = Schema_exports.Struct({ accountInfo: Schema_exports.optionalKey(AccountInfo2) });
3234
+ var DeclaredRequirements2 = Schema_exports.Struct({
3235
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
3236
+ capabilities: Schema_exports.optionalKey(
3237
+ Schema_exports.Struct({
3238
+ skills: Schema_exports.Literal(true),
3239
+ toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
3240
+ skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
3241
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
3242
+ })
3243
+ ),
3244
+ database: Schema_exports.optionalKey(DatabaseSchema2),
3245
+ accounts: Schema_exports.Record(
3246
+ Schema_exports.NonEmptyString,
3247
+ Schema_exports.Struct({
3248
+ definition: DeclaredProvider,
3249
+ cardinality: Schema_exports.Literals(["one", "many"]),
3250
+ /**
3251
+ * The slot's provider defines an account check. Kept beside the definition, not in it, so
3252
+ * adding or editing a check never changes the provider's identity.
3253
+ */
3254
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
3255
+ })
3256
+ )
3257
+ });
3258
+ var AccountCheckCommand = Schema_exports.Struct({
3259
+ operation: Schema_exports.Literal("account-check"),
3260
+ requirement: Schema_exports.NonEmptyString
3261
+ });
3262
+ var HostRequest3 = Schema_exports.Union([
3263
+ ...protocol4.schemas.request.members,
3264
+ AccountCheckCommand
3265
+ ]);
3266
+ var HostInvocation3 = Schema_exports.Struct({
3267
+ command: HostRequest3,
3268
+ accounts: ResolvedAccounts,
3269
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
3270
+ replay: Schema_exports.optionalKey(WorkflowReplay2),
3271
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
3272
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId2)
3273
+ });
3274
+ var protocol5 = {
3275
+ version: 5,
3276
+ schemas: {
3277
+ ...protocol4.schemas,
3278
+ invocation: HostInvocation3,
3279
+ request: HostRequest3,
3280
+ requirements: DeclaredRequirements2,
3281
+ accountCheck: AccountCheckResult2
3282
+ }
3283
+ };
3284
+
3285
+ // src/contracts/protocols/oauth-6.ts
3286
+ var OAuth2Config3 = Schema_exports.Union([
3287
+ Schema_exports.Struct({
3288
+ ...oauthOptions2,
3289
+ discover: HttpUrl2,
3290
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
3291
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl2),
3292
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
3293
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
3294
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
3295
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
3296
+ }),
3297
+ Schema_exports.Struct({
3298
+ ...oauthOptions2,
3299
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
3300
+ authorizationUrl: HttpUrl2,
3301
+ tokenUrl: HttpUrl2,
3302
+ revocationUrl: Schema_exports.optionalKey(HttpUrl2),
3303
+ scopes: Schema_exports.Array(Schema_exports.String),
3304
+ /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
3305
+ issuer: Schema_exports.optionalKey(HttpUrl2),
3306
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
3307
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
3308
+ }).check(declaredAuthorizationQuery2),
3309
+ Schema_exports.Struct({
3310
+ grant: Schema_exports.Literal("client_credentials"),
3311
+ discover: HttpUrl2,
3312
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
3313
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl2),
3314
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
3315
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
3316
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
3317
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
3318
+ ...tokenRequestOptions2,
3319
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
3320
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl2))
3321
+ }),
3322
+ Schema_exports.Struct({
3323
+ grant: Schema_exports.Literal("client_credentials"),
3324
+ tokenUrl: HttpUrl2,
3325
+ revocationUrl: Schema_exports.optionalKey(HttpUrl2),
3326
+ scopes: Schema_exports.Array(Schema_exports.String),
3327
+ ...tokenRequestOptions2,
3328
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
3329
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl2)),
3330
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
3331
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
3332
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
3333
+ })
3334
+ ]);
3335
+
3336
+ // src/contracts/protocols/6.ts
3337
+ var DeclaredAuthMethod2 = Schema_exports.Union([
3338
+ Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject3 }),
3339
+ Schema_exports.Struct({
3340
+ type: Schema_exports.Literal("oauth2"),
3341
+ ...OAuth2Config3.members[0].fields,
3342
+ response: JsonObject3
3343
+ }),
3344
+ Schema_exports.Struct({
3345
+ type: Schema_exports.Literal("oauth2"),
3346
+ ...OAuth2Config3.members[1].fields,
3347
+ response: JsonObject3
3348
+ }),
3349
+ Schema_exports.Struct({
3350
+ type: Schema_exports.Literal("oauth2"),
3351
+ ...OAuth2Config3.members[2].fields,
3352
+ response: JsonObject3
3353
+ }),
3354
+ Schema_exports.Struct({
3355
+ type: Schema_exports.Literal("oauth2"),
3356
+ ...OAuth2Config3.members[3].fields,
3357
+ response: JsonObject3
3358
+ })
3359
+ ]);
3360
+ var DeclaredProvider2 = Schema_exports.Struct({
3361
+ name: Schema_exports.NonEmptyString,
3362
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod2)
3363
+ });
3364
+ var DeclaredRequirements3 = Schema_exports.Struct({
3365
+ ...DeclaredRequirements2.fields,
3366
+ accounts: Schema_exports.Record(
3367
+ Schema_exports.NonEmptyString,
3368
+ Schema_exports.Struct({
3369
+ definition: DeclaredProvider2,
3370
+ cardinality: Schema_exports.Literals(["one", "many"]),
3371
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
3372
+ })
3373
+ )
3374
+ });
3375
+ var ResolvedAccount2 = Schema_exports.Struct({
3376
+ ...ResolvedAccount.fields,
3377
+ provider: DeclaredProvider2
3378
+ });
3379
+ var ResolvedAccounts2 = Schema_exports.Record(
3380
+ Schema_exports.NonEmptyString,
3381
+ Schema_exports.Union([ResolvedAccount2, Schema_exports.Array(ResolvedAccount2)])
3382
+ );
3383
+ var HostInvocation4 = Schema_exports.Struct({
3384
+ ...HostInvocation3.fields,
3385
+ accounts: ResolvedAccounts2
3386
+ });
3387
+ var protocol6 = {
3388
+ version: 6,
3389
+ schemas: {
3390
+ ...protocol5.schemas,
3391
+ requirements: DeclaredRequirements3,
3392
+ accounts: ResolvedAccounts2,
3393
+ invocation: HostInvocation4
3394
+ }
3395
+ };
3396
+
3397
+ // src/contracts/protocols/7.ts
3398
+ var CredentialHost = Schema_exports.String.check(
3399
+ Schema_exports.isPattern(
3400
+ /^(\*\.)?[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})?$/
3401
+ )
3402
+ );
3403
+ var exposure = {
3404
+ /** Not secret: app code reads the real value and forms show it. */
3405
+ plain: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
3406
+ /** Secret, but app code reads the real value, for signing and similar uses. */
3407
+ raw: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString))
3408
+ };
3409
+ var DeclaredAuthMethod3 = Schema_exports.Union([
3410
+ Schema_exports.Struct({
3411
+ type: Schema_exports.Literal("secrets"),
3412
+ label: Schema_exports.String,
3413
+ fields: JsonObject3,
3414
+ ...exposure
3415
+ }),
3416
+ Schema_exports.Struct({
3417
+ type: Schema_exports.Literal("oauth2"),
3418
+ ...OAuth2Config3.members[0].fields,
3419
+ response: JsonObject3,
3420
+ ...exposure
3421
+ }),
3422
+ Schema_exports.Struct({
3423
+ type: Schema_exports.Literal("oauth2"),
3424
+ ...OAuth2Config3.members[1].fields,
3425
+ response: JsonObject3,
3426
+ ...exposure
3427
+ }),
3428
+ Schema_exports.Struct({
3429
+ type: Schema_exports.Literal("oauth2"),
3430
+ ...OAuth2Config3.members[2].fields,
3431
+ response: JsonObject3,
3432
+ ...exposure
3433
+ }),
3434
+ Schema_exports.Struct({
3435
+ type: Schema_exports.Literal("oauth2"),
3436
+ ...OAuth2Config3.members[3].fields,
3437
+ response: JsonObject3,
3438
+ ...exposure
3439
+ })
3440
+ ]);
3441
+ var DeclaredProvider3 = Schema_exports.Struct({
3442
+ name: Schema_exports.NonEmptyString,
3443
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod3),
3444
+ hosts: Schema_exports.optionalKey(Schema_exports.Array(CredentialHost))
3445
+ });
3446
+ var DeclaredRequirements4 = Schema_exports.Struct({
3447
+ ...DeclaredRequirements3.fields,
3448
+ accounts: Schema_exports.Record(
3449
+ Schema_exports.NonEmptyString,
3450
+ Schema_exports.Struct({
3451
+ definition: DeclaredProvider3,
3452
+ cardinality: Schema_exports.Literals(["one", "many"]),
3453
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
3454
+ })
3455
+ )
3456
+ });
3457
+ var ResolvedAccount3 = Schema_exports.Struct({
3458
+ ...ResolvedAccount2.fields,
3459
+ provider: DeclaredProvider3
3460
+ });
3461
+ var ResolvedAccounts3 = Schema_exports.Record(
3462
+ Schema_exports.NonEmptyString,
3463
+ Schema_exports.Union([ResolvedAccount3, Schema_exports.Array(ResolvedAccount3)])
3464
+ );
3465
+ var HostInvocation5 = Schema_exports.Struct({
3466
+ ...HostInvocation4.fields,
3467
+ accounts: ResolvedAccounts3
3468
+ });
3469
+ var protocol7 = {
3470
+ version: 7,
3471
+ schemas: {
3472
+ ...protocol6.schemas,
3473
+ requirements: DeclaredRequirements4,
3474
+ accounts: ResolvedAccounts3,
3475
+ invocation: HostInvocation5
3476
+ }
3477
+ };
3478
+
3479
+ // src/contracts/protocols/8.ts
3480
+ var maxFailureFields = 8;
3481
+ var maxFailureFieldLength = 256;
3482
+ var FailureFieldName = Schema_exports.String.check(
3483
+ Schema_exports.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]{0,63}$/)
3484
+ );
3485
+ var FailureFieldValue = Schema_exports.Union([
3486
+ Schema_exports.String.check(Schema_exports.isMaxLength(maxFailureFieldLength)),
3487
+ Schema_exports.Finite,
3488
+ Schema_exports.Boolean
3489
+ ]);
3490
+ var FailureFields = Schema_exports.Record(FailureFieldName, FailureFieldValue).check(
3491
+ Schema_exports.isMaxProperties(maxFailureFields)
3492
+ );
3493
+ var FailureDetail3 = {
3494
+ source: Schema_exports.optionalKey(FailureSource),
3495
+ errorName: Schema_exports.optionalKey(FailureName2),
3496
+ code: Schema_exports.optionalKey(FailureCode),
3497
+ message: Schema_exports.optionalKey(FailureMessage2),
3498
+ fields: Schema_exports.optionalKey(FailureFields)
3499
+ };
3500
+ var maxUpstreamMessageLength = 1024;
3501
+ var UpstreamError2 = Schema_exports.Struct({
3502
+ code: Schema_exports.Union([
3503
+ Schema_exports.Int,
3504
+ Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(128))
3505
+ ]),
3506
+ message: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMaxLength(maxUpstreamMessageLength)))
3507
+ });
3508
+ var FailurePhase = Schema_exports.Literals(["connect", "discover", "call"]);
3509
+ var ProviderError3 = class extends Schema_exports.TaggedError()("ProviderError", {
3510
+ reason: Schema_exports.Literals(["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]),
3511
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
3512
+ accountId: Schema_exports.optional(AccountId2),
3513
+ phase: Schema_exports.optional(FailurePhase),
3514
+ upstream: Schema_exports.optional(UpstreamError2)
3515
+ }) {
3516
+ };
3517
+ var McpError4 = class extends Schema_exports.TaggedError()("McpError", {
3518
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
3519
+ reason: Schema_exports.Literals([
3520
+ "request",
3521
+ "unauthorized",
3522
+ "invalid_response",
3523
+ "timeout",
3524
+ "invalid_input"
3525
+ ]),
3526
+ status: Schema_exports.optional(Schema_exports.Number),
3527
+ upstream: Schema_exports.optional(UpstreamError2)
3528
+ }) {
3529
+ };
3530
+ var HostDeclarationInvalid3 = class extends Schema_exports.TaggedError()(
3531
+ "HostDeclarationInvalid",
3532
+ FailureDetail3
3533
+ ) {
3534
+ };
3535
+ var HostEvaluationFailed3 = class extends Schema_exports.TaggedError()(
3536
+ "HostEvaluationFailed",
3537
+ FailureDetail3
3538
+ ) {
3539
+ };
3540
+ var HostOperationFailed3 = class extends Schema_exports.TaggedError()(
3541
+ "HostOperationFailed",
3542
+ FailureDetail3
3543
+ ) {
3544
+ };
3545
+ var HostRouterError2 = Schema_exports.Union([
3546
+ ProviderError3,
3547
+ McpError4,
3548
+ SkillLoadFailed,
3549
+ HostDeclarationInvalid3,
3550
+ HostEvaluationFailed3
3551
+ ]);
3552
+ var HostedRouter2 = Schema_exports.Struct({
3553
+ ...HostedRouter.fields,
3554
+ error: Schema_exports.optionalKey(HostRouterError2)
3555
+ });
3556
+ var HostedCatalog2 = Schema_exports.Struct({
3557
+ ...HostedCatalog.fields,
3558
+ routers: Schema_exports.Array(HostedRouter2)
3559
+ });
3560
+ var HostedCatalogSummary2 = Schema_exports.Struct({
3561
+ ...HostedCatalogSummary.fields,
3562
+ routers: Schema_exports.Array(HostedRouter2)
3563
+ });
3564
+ var HostError4 = Schema_exports.Union([
3565
+ OpenapiResponseError2,
3566
+ ProviderError3,
3567
+ McpError4,
3568
+ SkillLoadFailed,
3569
+ WorkflowFailure3,
3570
+ HostRequestInvalid,
3571
+ HostAccountsInvalid,
3572
+ HostDeclarationInvalid3,
3573
+ HostEvaluationFailed3,
3574
+ HostOperationNotFound,
3575
+ HostOperationFailed3,
3576
+ DatabaseLimitExceeded2,
3577
+ DatabaseFieldReserved2,
3578
+ HostToolNotFound,
3579
+ HostInputInvalid,
3580
+ HostOutputInvalid,
3581
+ HostToolBlocked,
3582
+ HostToolApprovalRequired,
3583
+ HostToolPolicyFailed,
3584
+ ElicitationFailed2,
3585
+ HostKindMismatch
3586
+ ]);
3587
+ var HostResponse4 = Schema_exports.Union([
3588
+ Schema_exports.Struct({
3589
+ ok: Schema_exports.Literal(true),
3590
+ value: JsonValue2,
3591
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
3592
+ }),
3593
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError4 })
3594
+ ]);
3595
+ var protocol8 = {
3596
+ version: 8,
3597
+ schemas: {
3598
+ ...protocol7.schemas,
3599
+ response: HostResponse4,
3600
+ catalog: HostedCatalog2,
3601
+ catalogSummary: HostedCatalogSummary2
3602
+ }
3603
+ };
3604
+
3605
+ // src/contracts/protocols/9.ts
3606
+ var McpError5 = class extends Schema_exports.TaggedError()("McpError", {
3607
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
3608
+ reason: Schema_exports.Literals([
3609
+ "request",
3610
+ "unauthorized",
3611
+ "invalid_response",
3612
+ "timeout",
3613
+ "invalid_input"
3614
+ ]),
3615
+ status: Schema_exports.optional(Schema_exports.Number),
3616
+ upstream: Schema_exports.optional(UpstreamError2),
3617
+ session: Schema_exports.optional(Schema_exports.Literal(true))
3618
+ }) {
3619
+ };
3620
+ var SkillLoadFailed2 = class extends Schema_exports.TaggedError()("SkillLoadFailed", {
3621
+ reason: Schema_exports.Literals([
3622
+ "source",
3623
+ "request",
3624
+ "rate_limited",
3625
+ "document",
3626
+ "limit",
3627
+ "changed",
3628
+ "encoding"
3629
+ ]),
3630
+ message: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isMaxLength(500))),
3631
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
3632
+ missing: Schema_exports.optional(Schema_exports.Literals(["repository", "ref"]))
3633
+ }) {
3634
+ };
3635
+ var HostRouterError3 = Schema_exports.Union([
3636
+ ProviderError3,
3637
+ McpError5,
3638
+ SkillLoadFailed2,
3639
+ HostDeclarationInvalid3,
3640
+ HostEvaluationFailed3
3641
+ ]);
3642
+ var HostedRouter3 = Schema_exports.Struct({
3643
+ ...HostedRouter2.fields,
3644
+ error: Schema_exports.optionalKey(HostRouterError3)
3645
+ });
3646
+ var HostedCatalog3 = Schema_exports.Struct({
3647
+ ...HostedCatalog2.fields,
3648
+ routers: Schema_exports.Array(HostedRouter3)
3649
+ });
3650
+ var HostedCatalogSummary3 = Schema_exports.Struct({
3651
+ ...HostedCatalogSummary2.fields,
3652
+ routers: Schema_exports.Array(HostedRouter3)
3653
+ });
3654
+ var HostError5 = Schema_exports.Union([
3655
+ OpenapiResponseError2,
3656
+ ProviderError3,
3657
+ McpError5,
3658
+ SkillLoadFailed2,
3659
+ WorkflowFailure3,
3660
+ HostRequestInvalid,
3661
+ HostAccountsInvalid,
3662
+ HostDeclarationInvalid3,
3663
+ HostEvaluationFailed3,
3664
+ HostOperationNotFound,
3665
+ HostOperationFailed3,
3666
+ DatabaseLimitExceeded2,
3667
+ DatabaseFieldReserved2,
3668
+ HostToolNotFound,
3669
+ HostInputInvalid,
3670
+ HostOutputInvalid,
3671
+ HostToolBlocked,
3672
+ HostToolApprovalRequired,
3673
+ HostToolPolicyFailed,
3674
+ ElicitationFailed2,
3675
+ HostKindMismatch
3676
+ ]);
3677
+ var HostResponse5 = Schema_exports.Union([
3678
+ Schema_exports.Struct({
3679
+ ok: Schema_exports.Literal(true),
3680
+ value: JsonValue2,
3681
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
3682
+ }),
3683
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError5 })
3684
+ ]);
3685
+ var protocol9 = {
3686
+ version: 9,
3687
+ schemas: {
3688
+ ...protocol8.schemas,
3689
+ response: HostResponse5,
3690
+ catalog: HostedCatalog3,
3691
+ catalogSummary: HostedCatalogSummary3
3692
+ }
3693
+ };
3694
+
3695
+ // src/contracts/protocols/10.ts
3696
+ var DeclaredRequirements5 = Schema_exports.Struct({
3697
+ ...DeclaredRequirements4.fields,
3698
+ sql: Schema_exports.optionalKey(Schema_exports.Literal(true))
3699
+ });
3700
+ var MigrateCommand = Schema_exports.Struct({ operation: Schema_exports.Literal("migrate") });
3701
+ var MigrateResult = Schema_exports.Array(
3702
+ Schema_exports.Struct({ id: Schema_exports.Int, name: Schema_exports.NonEmptyString })
3703
+ );
3704
+ var HostRequest4 = Schema_exports.Union([...HostRequest3.members, MigrateCommand]);
3705
+ var HostInvocation6 = Schema_exports.Struct({
3706
+ ...HostInvocation5.fields,
3707
+ command: HostRequest4
3708
+ });
3709
+ var protocol10 = {
3710
+ version: 10,
3711
+ schemas: {
3712
+ ...protocol9.schemas,
3713
+ request: HostRequest4,
3714
+ requirements: DeclaredRequirements5,
3715
+ invocation: HostInvocation6,
3716
+ migrate: MigrateResult
3717
+ }
3718
+ };
3719
+
3720
+ // src/contracts/schedules.ts
3721
+ var minimumIntervalMilliseconds2 = 6e4;
3722
+ var count2 = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
3723
+ var absent = Schema_exports.optionalKey(Schema_exports.Never);
3724
+ var Interval = Schema_exports.Union([
3725
+ Schema_exports.Struct({ seconds: count2, minutes: absent, hours: absent }),
3726
+ Schema_exports.Struct({ seconds: absent, minutes: count2, hours: absent }),
3727
+ Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count2 })
3728
+ ]);
3729
+ var CalendarSchedule2 = Schema_exports.Struct({
3730
+ expression: Schema_exports.NonEmptyString,
3731
+ timezone: Schema_exports.NonEmptyString
3732
+ }).check(
3733
+ Schema_exports.makeFilter(
3734
+ (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
3735
+ )
3736
+ );
3737
+ var ScheduleTiming2 = Schema_exports.Union([
3738
+ Schema_exports.Struct({
3739
+ kind: Schema_exports.Literal("interval"),
3740
+ milliseconds: Schema_exports.Int.check(
3741
+ Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds2, {
3742
+ message: "Schedule intervals must be at least 60 seconds"
3743
+ }),
3744
+ Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
3745
+ )
3746
+ }),
3747
+ Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule2 })
3748
+ ]);
3749
+ var OperationSchedule2 = Schema_exports.Struct({
3750
+ name: Schema_exports.NonEmptyString,
3751
+ timing: ScheduleTiming2,
3752
+ input: JsonValue
3753
+ });
3754
+
3755
+ // src/contracts/protocols/current.ts
3756
+ var McpError6 = class extends Schema_exports.TaggedError()("McpError", {
3757
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
3758
+ reason: Schema_exports.Literals([
3759
+ "request",
3760
+ "unauthorized",
3761
+ "invalid_response",
3762
+ "timeout",
3763
+ "invalid_input"
3764
+ ]),
3765
+ status: Schema_exports.optional(Schema_exports.Number),
3766
+ /** The JSON-RPC error the server stated. */
3767
+ upstream: Schema_exports.optional(UpstreamError),
3768
+ /**
3769
+ * The refused request carried the session ID the server issued at initialization, so a 404 reads
3770
+ * as a session the server may have lost. Chooses the explanation only; the host never decides from
3771
+ * it whose side a failure is on.
3772
+ */
3773
+ session: Schema_exports.optional(Schema_exports.Literal(true))
3774
+ }) {
3775
+ };
3776
+ var SkillLoadFailed3 = class extends Schema_exports.TaggedError()("SkillLoadFailed", {
3777
+ reason: Schema_exports.Literals([
3778
+ "source",
3779
+ "request",
3780
+ "rate_limited",
3781
+ "document",
3782
+ "limit",
3783
+ "changed",
3784
+ "encoding"
3785
+ ]),
3786
+ message: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isMaxLength(500))),
3787
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
3788
+ /** What the service's answer points to as missing: the repository, or the branch or tag. */
3789
+ missing: Schema_exports.optional(Schema_exports.Literals(["repository", "ref"]))
3790
+ }) {
3791
+ };
3792
+ var CredentialHost2 = Schema_exports.String.check(
3793
+ Schema_exports.isPattern(
3794
+ /^(\*\.)?[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})?$/
3795
+ )
3796
+ );
3797
+ var exposure2 = {
3798
+ /** Not secret: app code reads the real value and forms show it. */
3799
+ plain: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
3800
+ /** Secret, but app code reads the real value, for signing and similar uses. */
3801
+ raw: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString))
3802
+ };
3803
+ var DeclaredAuthMethod4 = Schema_exports.Union([
2245
3804
  Schema_exports.Struct({
2246
- ok: Schema_exports.Literal(true),
2247
- value: JsonValue,
2248
- toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
3805
+ type: Schema_exports.Literal("secrets"),
3806
+ label: Schema_exports.String,
3807
+ fields: JsonObject2,
3808
+ ...exposure2
2249
3809
  }),
2250
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError2 })
3810
+ Schema_exports.Struct({
3811
+ type: Schema_exports.Literal("oauth2"),
3812
+ ...OAuth2Config.members[0].fields,
3813
+ response: JsonObject2,
3814
+ ...exposure2
3815
+ }),
3816
+ Schema_exports.Struct({
3817
+ type: Schema_exports.Literal("oauth2"),
3818
+ ...OAuth2Config.members[1].fields,
3819
+ response: JsonObject2,
3820
+ ...exposure2
3821
+ }),
3822
+ Schema_exports.Struct({
3823
+ type: Schema_exports.Literal("oauth2"),
3824
+ ...OAuth2Config.members[2].fields,
3825
+ response: JsonObject2,
3826
+ ...exposure2
3827
+ }),
3828
+ Schema_exports.Struct({
3829
+ type: Schema_exports.Literal("oauth2"),
3830
+ ...OAuth2Config.members[3].fields,
3831
+ response: JsonObject2,
3832
+ ...exposure2
3833
+ })
2251
3834
  ]);
2252
- var protocol3 = {
2253
- version: 3,
2254
- schemas: {
2255
- invocation: HostInvocation,
2256
- request: HostRequest,
2257
- response: HostResponse2,
2258
- requirements: DeclaredRequirements,
2259
- tools: Schema_exports.Array(HostedTool),
2260
- toolSummaries: Schema_exports.Array(HostedToolSummary),
2261
- skills: SkillCatalogResponse2,
2262
- elicitationRequest: FormElicitation,
2263
- elicitationReply: ElicitationReply,
2264
- workflowStep: WorkflowRpcCommand,
2265
- workflowStepReply: WorkflowRpcResult,
2266
- workflowControl: WorkflowControlCommand,
2267
- cacheCommand: CacheCommand,
2268
- cacheReply: CacheReply
2269
- }
2270
- };
2271
-
2272
- // src/contracts/protocols/4.ts
2273
- var HostedTool2 = Schema_exports.Struct({
2274
- schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
3835
+ var DeclaredProvider4 = Schema_exports.Struct({
3836
+ name: Schema_exports.NonEmptyString,
3837
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod4),
3838
+ hosts: Schema_exports.optionalKey(Schema_exports.Array(CredentialHost2))
3839
+ });
3840
+ var DeclaredRequirements6 = Schema_exports.Struct({
3841
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
3842
+ capabilities: Schema_exports.optionalKey(
3843
+ Schema_exports.Struct({
3844
+ skills: Schema_exports.Literal(true),
3845
+ /** Accepts inspect detail and tools. Earlier builds reject both as excess fields. */
3846
+ toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
3847
+ /** Accepts skills sources and reports whether the catalog includes a live loader. */
3848
+ skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
3849
+ /** Accepts scheduled inspection. Earlier builds reject it as an excess field. */
3850
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
3851
+ })
3852
+ ),
3853
+ /**
3854
+ * The document database an app of protocol 9 or earlier declared. Apps of this protocol declare
3855
+ * `sql` instead; the field remains so requirements read from older retained builds keep their meaning.
3856
+ */
3857
+ database: Schema_exports.optionalKey(DatabaseSchema),
3858
+ accounts: Schema_exports.Record(
3859
+ Schema_exports.NonEmptyString,
3860
+ Schema_exports.Struct({
3861
+ definition: DeclaredProvider4,
3862
+ cardinality: Schema_exports.Literals(["one", "many"]),
3863
+ /**
3864
+ * The slot's provider defines an account check. Kept beside the definition, not in it, so
3865
+ * adding or editing a check never changes the provider's identity.
3866
+ */
3867
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
3868
+ })
3869
+ ),
3870
+ /** The build has SQL files in `migrations/` and owns a raw SQLite database. */
3871
+ sql: Schema_exports.optionalKey(Schema_exports.Literal(true)),
3872
+ /** The events the app declares, so a host lists them without evaluating the app. */
3873
+ events: Schema_exports.optionalKey(DeclaredEvents)
3874
+ });
3875
+ var ResolvedAccount4 = Schema_exports.Struct({
3876
+ id: AccountId,
3877
+ provider: DeclaredProvider4,
3878
+ method: Schema_exports.NonEmptyString,
3879
+ /**
3880
+ * Changes when the account is reconnected or its credentials replaced, not on renewal. Hosts
3881
+ * send it since credential generations; `apps@0.0.1-beta.0` and `beta.1` ignore it.
3882
+ */
3883
+ generation: Schema_exports.optionalKey(Schema_exports.Int),
3884
+ fields: JsonObject2
3885
+ });
3886
+ var ResolvedAccounts4 = Schema_exports.Record(
3887
+ Schema_exports.NonEmptyString,
3888
+ Schema_exports.Union([ResolvedAccount4, Schema_exports.Array(ResolvedAccount4)])
3889
+ );
3890
+ var TrustedToolApproval2 = Schema_exports.Struct({ tool: Schema_exports.NonEmptyString, input: JsonValue });
3891
+ var InvocationDeadline2 = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
3892
+ var HostedTool3 = Schema_exports.Struct({
3893
+ schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule2)),
2275
3894
  name: Schema_exports.NonEmptyString,
2276
3895
  router: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
2277
3896
  tags: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
@@ -2280,38 +3899,62 @@ var HostedTool2 = Schema_exports.Struct({
2280
3899
  readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2281
3900
  title: Schema_exports.optionalKey(Schema_exports.String),
2282
3901
  outputSchema: Schema_exports.optionalKey(JsonObject2),
2283
- annotations: Schema_exports.optionalKey(ToolAnnotations),
3902
+ annotations: Schema_exports.optionalKey(ToolAnnotations2),
2284
3903
  _meta: Schema_exports.optionalKey(JsonObject2)
2285
3904
  });
2286
- var HostedToolSummary2 = HostedTool2.mapFields(
3905
+ var HostedToolSummary3 = HostedTool3.mapFields(
2287
3906
  ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2288
3907
  );
2289
- var HostRouterError = Schema_exports.Union([
3908
+ var HostDeclarationInvalid4 = class extends Schema_exports.TaggedError()(
3909
+ "HostDeclarationInvalid",
3910
+ FailureDetail
3911
+ ) {
3912
+ };
3913
+ var HostEvaluationFailed4 = class extends Schema_exports.TaggedError()(
3914
+ "HostEvaluationFailed",
3915
+ FailureDetail
3916
+ ) {
3917
+ };
3918
+ var HostRouterError4 = Schema_exports.Union([
2290
3919
  ProviderError,
2291
- McpError,
2292
- SkillLoadFailed,
2293
- HostDeclarationInvalid2,
2294
- HostEvaluationFailed2
3920
+ McpError6,
3921
+ SkillLoadFailed3,
3922
+ HostDeclarationInvalid4,
3923
+ HostEvaluationFailed4
2295
3924
  ]);
2296
- var HostedRouter = Schema_exports.Struct({
3925
+ var HostedRouter4 = Schema_exports.Struct({
2297
3926
  path: Schema_exports.String,
2298
3927
  title: Schema_exports.optionalKey(Schema_exports.String),
2299
3928
  description: Schema_exports.optionalKey(Schema_exports.String),
2300
3929
  icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
2301
3930
  tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String)),
2302
3931
  skill: Schema_exports.optionalKey(AppSkillName),
2303
- error: Schema_exports.optionalKey(HostRouterError)
3932
+ error: Schema_exports.optionalKey(HostRouterError4)
2304
3933
  });
2305
- var HostedCatalog = Schema_exports.Struct({
2306
- tools: Schema_exports.Array(HostedTool2),
2307
- routers: Schema_exports.Array(HostedRouter)
3934
+ var HostedCatalog4 = Schema_exports.Struct({
3935
+ tools: Schema_exports.Array(HostedTool3),
3936
+ routers: Schema_exports.Array(HostedRouter4)
2308
3937
  });
2309
- var HostedCatalogSummary = Schema_exports.Struct({
2310
- tools: Schema_exports.Array(HostedToolSummary2),
2311
- routers: Schema_exports.Array(HostedRouter)
3938
+ var HostedCatalogSummary4 = Schema_exports.Struct({
3939
+ tools: Schema_exports.Array(HostedToolSummary3),
3940
+ routers: Schema_exports.Array(HostedRouter4)
2312
3941
  });
2313
- var ToolKind = Schema_exports.Literals(["query", "mutation"]);
2314
- var HostRequest2 = Schema_exports.Union([
3942
+ var SkillSources3 = Schema_exports.Struct({
3943
+ skills: AppSkills,
3944
+ dynamic: Schema_exports.Boolean,
3945
+ cached: Schema_exports.optionalKey(Schema_exports.Boolean)
3946
+ });
3947
+ var SkillCatalogResponse3 = Schema_exports.Union([SkillSources3, AppSkills]);
3948
+ var ToolKind2 = Schema_exports.Literals(["query", "mutation"]);
3949
+ var AccountCheckCommand2 = Schema_exports.Struct({
3950
+ operation: Schema_exports.Literal("account-check"),
3951
+ requirement: Schema_exports.NonEmptyString
3952
+ });
3953
+ var MigrateCommand2 = Schema_exports.Struct({ operation: Schema_exports.Literal("migrate") });
3954
+ var MigrateResult2 = Schema_exports.Array(
3955
+ Schema_exports.Struct({ id: Schema_exports.Int, name: Schema_exports.NonEmptyString })
3956
+ );
3957
+ var HostRequest5 = Schema_exports.Union([
2315
3958
  WorkflowCommand,
2316
3959
  WebhookCommand,
2317
3960
  Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
@@ -2349,56 +3992,135 @@ var HostRequest2 = Schema_exports.Union([
2349
3992
  * The caller's claim; the bundle rejects a call whose tool has the other kind. The host omits
2350
3993
  * it for a tool its catalog does not list, and then opens storage for writing.
2351
3994
  */
2352
- kind: Schema_exports.optionalKey(ToolKind),
3995
+ kind: Schema_exports.optionalKey(ToolKind2),
2353
3996
  input: JsonValue
2354
- })
3997
+ }),
3998
+ AccountCheckCommand2,
3999
+ MigrateCommand2
2355
4000
  ]);
2356
- var HostKindMismatch = class extends Schema_exports.TaggedError()("HostKindMismatch", {
4001
+ var HostRequestInvalid2 = class extends Schema_exports.TaggedError()(
4002
+ "HostRequestInvalid",
4003
+ {}
4004
+ ) {
4005
+ };
4006
+ var HostAccountsInvalid2 = class extends Schema_exports.TaggedError()(
4007
+ "HostAccountsInvalid",
4008
+ {}
4009
+ ) {
4010
+ };
4011
+ var HostOperationNotFound2 = class extends Schema_exports.TaggedError()(
4012
+ "HostOperationNotFound",
4013
+ {}
4014
+ ) {
4015
+ };
4016
+ var HostOperationFailed4 = class extends Schema_exports.TaggedError()(
4017
+ "HostOperationFailed",
4018
+ FailureDetail
4019
+ ) {
4020
+ };
4021
+ var HostToolNotFound2 = class extends Schema_exports.TaggedError()(
4022
+ "HostToolNotFound",
4023
+ {}
4024
+ ) {
4025
+ };
4026
+ var HostKindMismatch2 = class extends Schema_exports.TaggedError()("HostKindMismatch", {
2357
4027
  tool: Schema_exports.NonEmptyString,
2358
- requested: ToolKind,
2359
- actual: ToolKind
4028
+ requested: ToolKind2,
4029
+ actual: ToolKind2
2360
4030
  }) {
2361
4031
  };
2362
- var HostError3 = Schema_exports.Union([...HostError2.members, HostKindMismatch]);
2363
- var HostResponse3 = Schema_exports.Union([
4032
+ var InputProblem2 = Schema_exports.String.check(Schema_exports.isMaxLength(512));
4033
+ var maxInputProblems2 = 10;
4034
+ var HostInputInvalid2 = class extends Schema_exports.TaggedError()("HostInputInvalid", {
4035
+ problems: Schema_exports.optionalKey(
4036
+ Schema_exports.Array(InputProblem2).check(Schema_exports.isMaxLength(maxInputProblems2))
4037
+ )
4038
+ }) {
4039
+ };
4040
+ var HostToolBlocked2 = class extends Schema_exports.TaggedError()("HostToolBlocked", {}) {
4041
+ };
4042
+ var HostToolApprovalRequired2 = class extends Schema_exports.TaggedError()(
4043
+ "HostToolApprovalRequired",
4044
+ { input: JsonValue, elicitation: ApprovalElicitation }
4045
+ ) {
4046
+ };
4047
+ var HostToolPolicyFailed2 = class extends Schema_exports.TaggedError()(
4048
+ "HostToolPolicyFailed",
4049
+ {}
4050
+ ) {
4051
+ };
4052
+ var HostOutputInvalid2 = class extends Schema_exports.TaggedError()(
4053
+ "HostOutputInvalid",
4054
+ {}
4055
+ ) {
4056
+ };
4057
+ var HostError6 = Schema_exports.Union([
4058
+ OpenapiResponseError,
4059
+ ProviderError,
4060
+ McpError6,
4061
+ SkillLoadFailed3,
4062
+ WorkflowFailure,
4063
+ HostRequestInvalid2,
4064
+ HostAccountsInvalid2,
4065
+ HostDeclarationInvalid4,
4066
+ HostEvaluationFailed4,
4067
+ HostOperationNotFound2,
4068
+ HostOperationFailed4,
4069
+ DatabaseLimitExceeded,
4070
+ DatabaseFieldReserved,
4071
+ HostToolNotFound2,
4072
+ HostInputInvalid2,
4073
+ HostOutputInvalid2,
4074
+ HostToolBlocked2,
4075
+ HostToolApprovalRequired2,
4076
+ HostToolPolicyFailed2,
4077
+ ElicitationFailed,
4078
+ HostKindMismatch2
4079
+ ]);
4080
+ var HostResponse6 = Schema_exports.Union([
2364
4081
  Schema_exports.Struct({
2365
4082
  ok: Schema_exports.Literal(true),
2366
4083
  value: JsonValue,
2367
- toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
4084
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true)),
4085
+ /** The occurrences this invocation emitted, kept only because it succeeded. */
4086
+ events: Schema_exports.optionalKey(EmittedEvents)
2368
4087
  }),
2369
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError3 })
4088
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError6 })
2370
4089
  ]);
2371
- var HostInvocation2 = Schema_exports.Struct({
2372
- command: HostRequest2,
2373
- accounts: ResolvedAccounts,
2374
- approval: Schema_exports.optionalKey(TrustedToolApproval),
4090
+ var HostInvocation7 = Schema_exports.Struct({
4091
+ command: HostRequest5,
4092
+ accounts: ResolvedAccounts4,
4093
+ approval: Schema_exports.optionalKey(TrustedToolApproval2),
2375
4094
  replay: Schema_exports.optionalKey(WorkflowReplay),
2376
- deadline: Schema_exports.optionalKey(InvocationDeadline),
4095
+ deadline: Schema_exports.optionalKey(InvocationDeadline2),
2377
4096
  workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2378
4097
  });
2379
- var protocol4 = {
2380
- version: 4,
4098
+ var current = {
4099
+ version: frameworkProtocol,
2381
4100
  schemas: {
2382
- invocation: HostInvocation2,
2383
- request: HostRequest2,
2384
- response: HostResponse3,
2385
- requirements: DeclaredRequirements,
2386
- catalog: HostedCatalog,
2387
- catalogSummary: HostedCatalogSummary,
2388
- skills: SkillCatalogResponse2,
4101
+ invocation: HostInvocation7,
4102
+ request: HostRequest5,
4103
+ response: HostResponse6,
4104
+ requirements: DeclaredRequirements6,
4105
+ catalog: HostedCatalog4,
4106
+ catalogSummary: HostedCatalogSummary4,
4107
+ skills: SkillCatalogResponse3,
2389
4108
  elicitationRequest: FormElicitation,
2390
4109
  elicitationReply: ElicitationReply,
2391
4110
  workflowStep: WorkflowRpcCommand,
2392
4111
  workflowStepReply: WorkflowRpcResult,
2393
4112
  workflowControl: WorkflowControlCommand,
2394
4113
  cacheCommand: CacheCommand,
2395
- cacheReply: CacheReply
4114
+ cacheReply: CacheReply,
4115
+ accountCheck: AccountCheckResult,
4116
+ accounts: ResolvedAccounts4,
4117
+ migrate: MigrateResult2
2396
4118
  }
2397
4119
  };
2398
4120
 
2399
4121
  // src/contracts/host.ts
2400
4122
  var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
2401
- var skillCatalog = (response) => Schema_exports.is(SkillSources2)(response) ? response : { skills: response };
4123
+ var skillCatalog = (response) => Schema_exports.is(SkillSources3)(response) ? response : { skills: response };
2402
4124
  var inspectCommand = (tools, scheduled) => ({
2403
4125
  operation: "inspect",
2404
4126
  ...tools === void 0 ? {} : { tools: [...tools] },
@@ -2407,75 +4129,82 @@ var inspectCommand = (tools, scheduled) => ({
2407
4129
  var indexCommand = { operation: "inspect", detail: "summary" };
2408
4130
  var selectTools = (tools) => (catalog) => tools === void 0 ? catalog : { ...catalog, tools: catalog.tools.filter((tool) => tools.includes(tool.name)) };
2409
4131
  var HostRequirementsError = Schema_exports.Union([
2410
- HostRequestInvalid,
2411
- HostDeclarationInvalid2,
4132
+ HostRequestInvalid2,
4133
+ HostDeclarationInvalid4,
2412
4134
  DatabaseFieldReserved
2413
4135
  ]);
2414
4136
  var HostInspectError = Schema_exports.Union([
2415
4137
  ProviderError,
2416
- McpError,
2417
- SkillLoadFailed,
2418
- HostRequestInvalid,
2419
- HostDeclarationInvalid2,
2420
- HostAccountsInvalid,
2421
- HostEvaluationFailed2
4138
+ McpError6,
4139
+ SkillLoadFailed3,
4140
+ HostRequestInvalid2,
4141
+ HostDeclarationInvalid4,
4142
+ HostAccountsInvalid2,
4143
+ HostEvaluationFailed4
2422
4144
  ]);
2423
4145
  var HostCallError = Schema_exports.Union([
2424
4146
  OpenapiResponseError,
2425
4147
  WorkflowFailure,
2426
4148
  HostInspectError,
2427
- HostToolNotFound,
2428
- HostOperationNotFound,
2429
- HostKindMismatch,
2430
- HostOperationFailed2,
4149
+ HostToolNotFound2,
4150
+ HostOperationNotFound2,
4151
+ HostKindMismatch2,
4152
+ HostOperationFailed4,
2431
4153
  DatabaseLimitExceeded,
2432
- HostInputInvalid,
2433
- HostOutputInvalid,
2434
- HostToolBlocked,
2435
- HostToolApprovalRequired,
2436
- HostToolPolicyFailed,
4154
+ HostInputInvalid2,
4155
+ HostOutputInvalid2,
4156
+ HostToolBlocked2,
4157
+ HostToolApprovalRequired2,
4158
+ HostToolPolicyFailed2,
2437
4159
  ElicitationFailed
2438
4160
  ]);
4161
+ var HostAccountCheckError = Schema_exports.Union([
4162
+ ProviderError,
4163
+ WorkflowFailure,
4164
+ HostRequestInvalid2,
4165
+ HostDeclarationInvalid4,
4166
+ HostAccountsInvalid2,
4167
+ HostOperationNotFound2,
4168
+ HostOperationFailed4,
4169
+ HostOutputInvalid2
4170
+ ]);
2439
4171
  var HostDataError = HostCallError;
2440
4172
  var ToolResultObservation = Context_exports.Reference(
2441
4173
  "apps/ToolResultObservation",
2442
4174
  { defaultValue: () => ({ failed: () => {
2443
4175
  } }) }
2444
4176
  );
4177
+ var InvocationTiming = Schema_exports.Struct({
4178
+ elapsedMs: Schema_exports.Finite,
4179
+ upstreamMs: Schema_exports.Finite,
4180
+ elicitationMs: Schema_exports.Finite,
4181
+ authoredMs: Schema_exports.Finite
4182
+ });
4183
+ var InvocationTimingSink = Context_exports.Reference(
4184
+ "apps/InvocationTimingSink",
4185
+ { defaultValue: () => () => {
4186
+ } }
4187
+ );
2445
4188
 
2446
4189
  export {
2447
4190
  SecretsMethod,
2448
4191
  OAuthClientAuth,
2449
4192
  OAuthSecretClientAuth,
4193
+ OAuthTokenRequestFormat,
4194
+ OAuthTokenResponse,
2450
4195
  OAuth2Config,
2451
4196
  OAuth2AccessToken,
2452
4197
  OAuth2Method,
4198
+ AccountInfo,
4199
+ AccountCheckResult,
2453
4200
  Provider,
2454
4201
  ManyAccounts,
2455
- reservedRouterKeys,
2456
- RouterKey,
2457
- RouterIcon,
2458
- RouterMeta,
2459
- ToolAnnotations,
2460
- McpClientLimits,
2461
- defaultMcpClientLimits,
2462
- mcpSdkTimerCeilingMs,
2463
- McpToolsOptions,
2464
- McpToolResult,
2465
- McpToolMetadata,
2466
- McpServerHeader,
2467
- McpError,
2468
- ProcessConfig,
4202
+ maxApiErrorInstructionsLength,
2469
4203
  ApiErrorRecovery,
4204
+ maxApiErrorMessageLength,
2470
4205
  ApiErrorResponse,
2471
4206
  OpenapiResponseError,
2472
4207
  defaultOpenapiErrorLimits,
2473
- maxFailureMessageLength,
2474
- FailureSource,
2475
- FailureName,
2476
- FailureCode,
2477
- FailureMessage,
2478
- FailureDetail,
2479
4208
  WorkflowRunId,
2480
4209
  WorkflowName,
2481
4210
  workflowDurationMillis,
@@ -2494,6 +4223,10 @@ export {
2494
4223
  WorkflowRpcCommand,
2495
4224
  WorkflowRpcResult,
2496
4225
  WorkflowControlCommand,
4226
+ DatabaseLimitExceeded,
4227
+ DatabaseFieldReserved,
4228
+ reservedTablePrefix,
4229
+ migrationsDirectory,
2497
4230
  ElicitationLimits,
2498
4231
  defaultElicitationLimits,
2499
4232
  FormElicitation,
@@ -2503,6 +4236,23 @@ export {
2503
4236
  ApprovalElicitation,
2504
4237
  ApprovalResponse,
2505
4238
  approvalElicitation,
4239
+ reservedRouterKeys,
4240
+ RouterKey,
4241
+ RouterIcon,
4242
+ RouterMeta,
4243
+ ToolAnnotations2 as ToolAnnotations,
4244
+ McpClientLimits,
4245
+ defaultMcpClientLimits,
4246
+ mcpSdkTimerCeilingMs,
4247
+ McpToolsOptions,
4248
+ McpHealthInput,
4249
+ mcpHealthReserveMs,
4250
+ McpToolResult,
4251
+ McpToolMetadata,
4252
+ McpServerHeader,
4253
+ McpError2 as McpError,
4254
+ McpCredentialsUnverified,
4255
+ ProcessConfig,
2506
4256
  WebhookTransportLimits,
2507
4257
  defaultWebhookTransportLimits,
2508
4258
  WebhookRequestData,
@@ -2511,50 +4261,71 @@ export {
2511
4261
  ManualWebhookDescriptor,
2512
4262
  HostedWebhook,
2513
4263
  WebhookCommand,
4264
+ EventName,
4265
+ EventFilterValue,
4266
+ EventLimits,
4267
+ defaultEventLimits,
4268
+ DeclaredEvent,
4269
+ DeclaredEvents,
4270
+ EmittedEvent,
4271
+ EmittedEvents,
2514
4272
  frameworkProtocol,
2515
- minimumIntervalMilliseconds,
2516
- Interval,
2517
- CalendarSchedule,
2518
- ScheduleTiming,
2519
- OperationSchedule,
2520
- DeclaredAuthMethod,
2521
- DeclaredProvider,
2522
- DeclaredRequirements,
2523
- ResolvedAccount,
2524
- ResolvedAccounts,
2525
- TrustedToolApproval,
2526
- InvocationDeadline,
2527
- HostRequestInvalid,
2528
- HostAccountsInvalid,
2529
- HostOperationNotFound,
2530
- HostToolNotFound,
2531
- InputProblem,
2532
- maxInputProblems,
2533
- HostInputInvalid,
2534
- HostToolBlocked,
2535
- HostToolApprovalRequired,
2536
- HostToolPolicyFailed,
2537
- HostOutputInvalid,
2538
4273
  protocol1,
2539
- SkillSources2 as SkillSources,
2540
- SkillCatalogResponse2 as SkillCatalogResponse,
2541
4274
  protocol2,
2542
- HostDeclarationInvalid2 as HostDeclarationInvalid,
2543
- HostEvaluationFailed2 as HostEvaluationFailed,
2544
- HostOperationFailed2 as HostOperationFailed,
2545
4275
  protocol3,
2546
- HostedTool2 as HostedTool,
2547
- HostedToolSummary2 as HostedToolSummary,
2548
- HostRouterError,
2549
- HostedRouter,
2550
- HostedCatalog,
2551
- HostedCatalogSummary,
2552
- HostRequest2 as HostRequest,
2553
- HostKindMismatch,
2554
- HostError3 as HostError,
2555
- HostResponse3 as HostResponse,
2556
- HostInvocation2 as HostInvocation,
2557
4276
  protocol4,
4277
+ protocol5,
4278
+ protocol6,
4279
+ protocol7,
4280
+ protocol8,
4281
+ protocol9,
4282
+ protocol10,
4283
+ minimumIntervalMilliseconds2 as minimumIntervalMilliseconds,
4284
+ Interval,
4285
+ CalendarSchedule2 as CalendarSchedule,
4286
+ ScheduleTiming2 as ScheduleTiming,
4287
+ OperationSchedule2 as OperationSchedule,
4288
+ McpError6 as McpError2,
4289
+ SkillLoadFailed3 as SkillLoadFailed,
4290
+ CredentialHost2 as CredentialHost,
4291
+ DeclaredAuthMethod4 as DeclaredAuthMethod,
4292
+ DeclaredProvider4 as DeclaredProvider,
4293
+ DeclaredRequirements6 as DeclaredRequirements,
4294
+ ResolvedAccount4 as ResolvedAccount,
4295
+ ResolvedAccounts4 as ResolvedAccounts,
4296
+ TrustedToolApproval2 as TrustedToolApproval,
4297
+ InvocationDeadline2 as InvocationDeadline,
4298
+ HostedTool3 as HostedTool,
4299
+ HostedToolSummary3 as HostedToolSummary,
4300
+ HostDeclarationInvalid4 as HostDeclarationInvalid,
4301
+ HostEvaluationFailed4 as HostEvaluationFailed,
4302
+ HostRouterError4 as HostRouterError,
4303
+ HostedRouter4 as HostedRouter,
4304
+ HostedCatalog4 as HostedCatalog,
4305
+ HostedCatalogSummary4 as HostedCatalogSummary,
4306
+ SkillSources3 as SkillSources,
4307
+ SkillCatalogResponse3 as SkillCatalogResponse,
4308
+ AccountCheckCommand2 as AccountCheckCommand,
4309
+ MigrateCommand2 as MigrateCommand,
4310
+ MigrateResult2 as MigrateResult,
4311
+ HostRequest5 as HostRequest,
4312
+ HostRequestInvalid2 as HostRequestInvalid,
4313
+ HostAccountsInvalid2 as HostAccountsInvalid,
4314
+ HostOperationNotFound2 as HostOperationNotFound,
4315
+ HostOperationFailed4 as HostOperationFailed,
4316
+ HostToolNotFound2 as HostToolNotFound,
4317
+ HostKindMismatch2 as HostKindMismatch,
4318
+ InputProblem2 as InputProblem,
4319
+ maxInputProblems2 as maxInputProblems,
4320
+ HostInputInvalid2 as HostInputInvalid,
4321
+ HostToolBlocked2 as HostToolBlocked,
4322
+ HostToolApprovalRequired2 as HostToolApprovalRequired,
4323
+ HostToolPolicyFailed2 as HostToolPolicyFailed,
4324
+ HostOutputInvalid2 as HostOutputInvalid,
4325
+ HostError6 as HostError,
4326
+ HostResponse6 as HostResponse,
4327
+ HostInvocation7 as HostInvocation,
4328
+ current,
2558
4329
  skillsCommand,
2559
4330
  skillCatalog,
2560
4331
  inspectCommand,
@@ -2563,6 +4334,9 @@ export {
2563
4334
  HostRequirementsError,
2564
4335
  HostInspectError,
2565
4336
  HostCallError,
4337
+ HostAccountCheckError,
2566
4338
  HostDataError,
2567
- ToolResultObservation
4339
+ ToolResultObservation,
4340
+ InvocationTiming,
4341
+ InvocationTimingSink
2568
4342
  };