apps 0.0.1-beta.7 → 0.0.1-beta.70

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