apps 0.0.1-beta.9 → 0.0.1-beta.91

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 (191) hide show
  1. package/README.md +56 -38
  2. package/framework-reference.json +1 -1
  3. package/js/chunk-3LEVTFD4.js +712 -0
  4. package/js/chunk-5FHWNLCI.js +88 -0
  5. package/js/{chunk-FL2QR3XW.js → chunk-5MDA7MKL.js} +338 -73
  6. package/js/chunk-6XQLA5NC.js +5047 -0
  7. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  8. package/js/chunk-7PHHWYV4.js +335 -0
  9. package/js/chunk-DADXWWRZ.js +449 -0
  10. package/js/{chunk-27F7W2LG.js → chunk-DDHBUKXX.js} +18 -2
  11. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  12. package/js/{chunk-5T57N25Q.js → chunk-GQ33QSNB.js} +583 -69
  13. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  14. package/js/chunk-I5C7FD5Z.js +171 -0
  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-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  18. package/js/{chunk-RFVIONFX.js → chunk-KUCCHNVY.js} +123 -44
  19. package/js/chunk-OD3KFKZD.js +1617 -0
  20. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  21. package/js/{chunk-72JNVHPK.js → chunk-PYQLOLOC.js} +4 -3
  22. package/js/{chunk-ODEIDRGW.js → chunk-QWQM3CLH.js} +795 -176
  23. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  24. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  25. package/js/chunk-XPRZTLHD.js +1915 -0
  26. package/js/chunk-YNJ5CZMJ.js +93 -0
  27. package/js/chunk-YRGL4QEF.js +49 -0
  28. package/js/{chunk-Z5M2LQOZ.js → chunk-YWFUWTUJ.js} +113 -58
  29. package/js/client.js +142 -78
  30. package/js/contracts.js +142 -21
  31. package/js/effect.js +18 -19
  32. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  33. package/js/graphql.js +49 -40
  34. package/js/host.js +85 -62
  35. package/js/index.js +165 -70
  36. package/js/mcp/effect.js +21 -21
  37. package/js/mcp.js +76 -56
  38. package/js/openapi.js +4189 -1411
  39. package/js/react.js +2 -3
  40. package/js/skills/effect.js +6 -3
  41. package/js/skills.js +208 -81
  42. package/js/storage/facet.js +1 -540
  43. package/js/ui/auth/contracts.js +2 -2
  44. package/js/ui/auth.js +5 -5
  45. package/js/ui/contracts.js +5 -4
  46. package/js/ui/serving.js +8605 -225
  47. package/package.json +3 -8
  48. package/runtime.json +1 -1
  49. package/types/app-cache/src/contracts/cache.d.ts +18 -0
  50. package/types/app-cache/src/index.d.ts +34 -2
  51. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  52. package/types/apps/src/contracts/app.d.ts +60 -11
  53. package/types/apps/src/contracts/cache.d.ts +20 -0
  54. package/types/apps/src/contracts/context.d.ts +60 -17
  55. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  56. package/types/apps/src/contracts/events.d.ts +94 -0
  57. package/types/apps/src/contracts/failure.d.ts +30 -1
  58. package/types/apps/src/contracts/graphql.d.ts +2 -1
  59. package/types/apps/src/contracts/host.d.ts +1446 -17
  60. package/types/apps/src/contracts/icons.d.ts +28 -0
  61. package/types/apps/src/contracts/live.d.ts +2 -0
  62. package/types/apps/src/contracts/mcp.d.ts +81 -20
  63. package/types/apps/src/contracts/network.d.ts +120 -0
  64. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  65. package/types/apps/src/contracts/openapi.d.ts +41 -9
  66. package/types/apps/src/contracts/operations.d.ts +14 -7
  67. package/types/apps/src/contracts/placement.d.ts +102 -0
  68. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  69. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  70. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  71. package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
  72. package/types/apps/src/contracts/protocols/12.d.ts +3310 -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 +6669 -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/schedules.d.ts +7 -1
  87. package/types/apps/src/contracts/schema.d.ts +21 -0
  88. package/types/apps/src/contracts/skills.d.ts +50 -13
  89. package/types/apps/src/contracts/sql.d.ts +63 -0
  90. package/types/apps/src/contracts/ui.d.ts +44 -14
  91. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  92. package/types/apps/src/contracts/workflows.d.ts +19 -17
  93. package/types/apps/src/facet.d.ts +4 -5
  94. package/types/apps/src/host.d.ts +5 -0
  95. package/types/apps/src/implementation/account-router.d.ts +4 -3
  96. package/types/apps/src/implementation/app.d.ts +41 -14
  97. package/types/apps/src/implementation/authoring.d.ts +25 -5
  98. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  99. package/types/apps/src/implementation/cache.d.ts +29 -2
  100. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  101. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  102. package/types/apps/src/implementation/events.d.ts +64 -0
  103. package/types/apps/src/implementation/failure-detail.d.ts +28 -5
  104. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  105. package/types/apps/src/implementation/graphql.d.ts +4 -3
  106. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  107. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  108. package/types/apps/src/implementation/live.d.ts +2 -2
  109. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  110. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  111. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  112. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  113. package/types/apps/src/implementation/mcp.d.ts +20 -9
  114. package/types/apps/src/implementation/network.d.ts +16 -0
  115. package/types/apps/src/implementation/openapi-compile.d.ts +28 -7
  116. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  117. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  118. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  119. package/types/apps/src/implementation/openapi-source.d.ts +23 -1
  120. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  121. package/types/apps/src/implementation/operations.d.ts +57 -7
  122. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  123. package/types/apps/src/implementation/placement.d.ts +60 -0
  124. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  125. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  126. package/types/apps/src/implementation/provider.d.ts +19 -4
  127. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  128. package/types/apps/src/implementation/router-catalog.d.ts +20 -18
  129. package/types/apps/src/implementation/router.d.ts +24 -5
  130. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  131. package/types/apps/src/implementation/schedules.d.ts +39 -8
  132. package/types/apps/src/implementation/schema.d.ts +98 -11
  133. package/types/apps/src/implementation/skills.d.ts +18 -24
  134. package/types/apps/src/implementation/sql.d.ts +71 -0
  135. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  136. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  137. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  138. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  139. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  140. package/types/apps/src/implementation/ui-serving.d.ts +26 -9
  141. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  142. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  143. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  144. package/types/apps/src/implementation/workflow-context.d.ts +6 -2
  145. package/types/apps/src/implementation/workflows.d.ts +11 -4
  146. package/types/apps/src/index.d.ts +68 -19
  147. package/types/apps/src/mcp.d.ts +20 -1
  148. package/types/apps/src/openapi.d.ts +6 -1
  149. package/types/apps/src/react.d.ts +1 -1
  150. package/types/apps/src/skills.d.ts +10 -8
  151. package/types/apps/src/ui-serving.d.ts +1 -1
  152. package/types/telemetry/src/app-records.d.ts +42 -0
  153. package/types/telemetry/src/browser-operations.d.ts +2 -2
  154. package/types/telemetry/src/browser.d.ts +8 -3
  155. package/types/telemetry/src/config.d.ts +2 -2
  156. package/types/telemetry/src/index.d.ts +2 -1
  157. package/types/telemetry/src/layer.d.ts +10 -4
  158. package/types/telemetry/src/measurements.d.ts +1 -1
  159. package/types/telemetry/src/ownership.d.ts +60 -0
  160. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  161. package/types/telemetry/src/relay.d.ts +16 -6
  162. package/types/telemetry/src/span-attributes.d.ts +17 -1
  163. package/types/telemetry/src/transport.d.ts +8 -1
  164. package/types/utils/src/api-error.d.ts +55 -0
  165. package/types/utils/src/connection-failure.d.ts +33 -0
  166. package/types/utils/src/recorded-message.d.ts +18 -0
  167. package/types/utils/src/user-facing-error.d.ts +83 -0
  168. package/js/chunk-7EK2JDX4.js +0 -299
  169. package/js/chunk-IKS2C5MQ.js +0 -224
  170. package/js/chunk-MKWZPDR6.js +0 -63
  171. package/js/chunk-N7YDVXYJ.js +0 -186
  172. package/js/chunk-NKLWZJLE.js +0 -172
  173. package/js/chunk-PJJ24GU7.js +0 -877
  174. package/js/chunk-PZB6T6KU.js +0 -19
  175. package/js/chunk-R3EV5FTO.js +0 -97
  176. package/js/chunk-SJFZCGXG.js +0 -1243
  177. package/js/chunk-WLE7WX2U.js +0 -2645
  178. package/js/chunk-YXQHV65J.js +0 -242
  179. package/js/chunk-ZQINWV4W.js +0 -630
  180. package/js/mcp/stdio.js +0 -128
  181. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  182. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  183. package/types/app-data/src/implementation/promise.d.ts +0 -68
  184. package/types/app-data/src/implementation/range.d.ts +0 -8
  185. package/types/app-data/src/implementation/schema.d.ts +0 -18
  186. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  187. package/types/app-data/src/index.d.ts +0 -4
  188. package/types/apps/src/contracts/storage.d.ts +0 -68
  189. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  190. package/types/apps/src/implementation/storage.d.ts +0 -15
  191. package/types/apps/src/mcp-stdio.d.ts +0 -5
@@ -1,2645 +0,0 @@
1
- import {
2
- DatabaseFieldReserved,
3
- DatabaseLimitExceeded,
4
- DatabaseSchema
5
- } from "./chunk-N7YDVXYJ.js";
6
- import {
7
- CacheCommand,
8
- CacheReply,
9
- ProviderError
10
- } from "./chunk-R3EV5FTO.js";
11
- import {
12
- AppSkillName,
13
- AppSkills,
14
- SkillLoadFailed
15
- } from "./chunk-JU7VHODU.js";
16
- import {
17
- AccountId,
18
- HttpUrl,
19
- JsonObject as JsonObject2,
20
- JsonValue
21
- } from "./chunk-27F7W2LG.js";
22
- import {
23
- Any,
24
- ArraySchema,
25
- Boolean,
26
- Class2 as Class,
27
- Context_exports,
28
- Cron_exports,
29
- Data_exports,
30
- Defect,
31
- Error2,
32
- Finite,
33
- Int,
34
- Json,
35
- JsonObject,
36
- Literal,
37
- Literals,
38
- Never,
39
- Opaque,
40
- Record,
41
- Result_exports,
42
- Schema_exports,
43
- String,
44
- Struct,
45
- StructWithRest,
46
- TemplateLiteral,
47
- Uint8ArrayFromBase64,
48
- Union,
49
- Unknown,
50
- Void,
51
- add,
52
- constFalse,
53
- constTrue,
54
- declare,
55
- decode,
56
- decodeTo,
57
- empty2 as empty,
58
- flatMap,
59
- fromUndefinedOr,
60
- isBetween,
61
- isSchema,
62
- isStream,
63
- make6 as make,
64
- merge,
65
- optional,
66
- optionalKey,
67
- passthrough2 as passthrough,
68
- pipeArguments,
69
- symbol3 as symbol,
70
- sync2 as sync,
71
- tag,
72
- transformOptional,
73
- withConstructorDefault,
74
- 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
- });
183
-
184
- // src/contracts/api-response-error.ts
185
- var ApiErrorRecovery = Schema_exports.Struct({
186
- action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
187
- instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096))
188
- });
189
- var ApiErrorResponse = Schema_exports.Struct({
190
- code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
191
- status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
192
- message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096)),
193
- recovery: Schema_exports.optionalKey(ApiErrorRecovery)
194
- });
195
- var OpenapiResponseError = class extends Schema_exports.TaggedError()(
196
- "OpenapiResponseError",
197
- ApiErrorResponse.fields
198
- ) {
199
- };
200
- var OpenapiErrorLimits = Schema_exports.Struct({
201
- maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
202
- readTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
203
- });
204
- var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
205
- maxBodyBytes: 65536,
206
- readTimeoutMs: 2e3
207
- });
208
-
209
- // src/contracts/failure.ts
210
- var maxFailureMessageLength = 2048;
211
- var FailureSource = Schema_exports.Literals(["app", "storage", "service"]);
212
- var FailureName = Schema_exports.String.check(Schema_exports.isMaxLength(128));
213
- var FailureCode = Schema_exports.String.check(Schema_exports.isMaxLength(128));
214
- var FailureMessage = Schema_exports.String.check(Schema_exports.isMaxLength(maxFailureMessageLength));
215
- var FailureDetail = {
216
- source: Schema_exports.optionalKey(FailureSource),
217
- errorName: Schema_exports.optionalKey(FailureName),
218
- code: Schema_exports.optionalKey(FailureCode),
219
- message: Schema_exports.optionalKey(FailureMessage)
220
- };
221
-
222
- // src/contracts/workflows.ts
223
- var WorkflowRunId = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
224
- var WorkflowName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
225
- var durationUnits = {
226
- millisecond: 1,
227
- milliseconds: 1,
228
- second: 1e3,
229
- seconds: 1e3,
230
- minute: 6e4,
231
- minutes: 6e4,
232
- hour: 36e5,
233
- hours: 36e5,
234
- day: 864e5,
235
- days: 864e5,
236
- week: 6048e5,
237
- weeks: 6048e5
238
- };
239
- var workflowDurationMillis = (value) => {
240
- if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? value : void 0;
241
- const match = /^(\d+(?:\.\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(
242
- value
243
- );
244
- const unit = match?.[2] === void 0 ? void 0 : durationUnits[match[2]];
245
- if (unit === void 0) return void 0;
246
- const result = Number(match?.[1]) * unit;
247
- return Number.isFinite(result) ? result : void 0;
248
- };
249
- var WorkflowDuration = Schema_exports.Union([
250
- Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0)),
251
- Schema_exports.NonEmptyString
252
- ]).check(Schema_exports.makeFilter((value) => workflowDurationMillis(value) !== void 0));
253
- var WorkflowStepOptions = Schema_exports.Struct({
254
- retries: Schema_exports.optionalKey(
255
- Schema_exports.Struct({
256
- limit: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)),
257
- delay: WorkflowDuration,
258
- backoff: Schema_exports.optionalKey(Schema_exports.Literals(["constant", "linear", "exponential"]))
259
- })
260
- ),
261
- timeout: Schema_exports.optionalKey(WorkflowDuration)
262
- });
263
- var WorkflowFailureDetail = {
264
- step: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMaxLength(200))),
265
- errorName: Schema_exports.optionalKey(FailureName),
266
- message: Schema_exports.optionalKey(FailureMessage)
267
- };
268
- var WorkflowRunFailure = Schema_exports.Struct(WorkflowFailureDetail);
269
- var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailure", {
270
- ...WorkflowFailureDetail,
271
- reason: Schema_exports.Literals([
272
- "unavailable",
273
- "not_found",
274
- "input",
275
- "output",
276
- "operation",
277
- "approval",
278
- "credentials",
279
- "terminated",
280
- "execution",
281
- "conflict",
282
- "engine"
283
- ]),
284
- retryable: Schema_exports.Boolean
285
- }) {
286
- };
287
- var NonRetryableError = class extends Error {
288
- name = "NonRetryableError";
289
- };
290
- var WorkflowValue = JsonValue.check(
291
- Schema_exports.makeFilter(
292
- (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 1024 * 1024
293
- )
294
- );
295
- var HostedWorkflow = Schema_exports.Struct({
296
- name: WorkflowName,
297
- description: Schema_exports.optionalKey(Schema_exports.String),
298
- inputSchema: JsonObject2,
299
- outputSchema: Schema_exports.optionalKey(JsonObject2)
300
- });
301
- var runFields = {
302
- profile: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
303
- id: WorkflowRunId,
304
- app: Schema_exports.NonEmptyString,
305
- deployment: Schema_exports.NonEmptyString,
306
- workflow: WorkflowName,
307
- createdAt: Schema_exports.String
308
- };
309
- var WorkflowRun = Schema_exports.Union([
310
- Schema_exports.Struct({
311
- ...runFields,
312
- status: Schema_exports.Literals(["queued", "running", "waiting", "paused", "waitingForPause"])
313
- }),
314
- Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("complete"), output: WorkflowValue }),
315
- Schema_exports.Struct({
316
- ...runFields,
317
- status: Schema_exports.Literal("errored"),
318
- error: WorkflowFailure.fields.reason,
319
- /** The failing step and the app's own error, when the run recorded them. */
320
- failure: Schema_exports.optionalKey(WorkflowRunFailure)
321
- }),
322
- Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("terminated") })
323
- ]);
324
- var WorkflowRunPage = Schema_exports.Struct({
325
- items: Schema_exports.Array(WorkflowRun),
326
- next: Schema_exports.optionalKey(WorkflowRunId)
327
- });
328
- var WorkflowReplay = Schema_exports.Struct({
329
- key: Schema_exports.NonEmptyString,
330
- fingerprint: Schema_exports.NonEmptyString
331
- });
332
- var WorkflowCommand = Schema_exports.Union([
333
- Schema_exports.Struct({ operation: Schema_exports.Literal("workflows") }),
334
- Schema_exports.Struct({
335
- operation: Schema_exports.Literal("workflow-validate"),
336
- name: WorkflowName,
337
- input: JsonValue
338
- }),
339
- Schema_exports.Struct({
340
- operation: Schema_exports.Literal("workflow-run"),
341
- name: WorkflowName,
342
- input: JsonValue
343
- })
344
- ]);
345
- var WorkflowRpcCommand = Schema_exports.Union([
346
- Schema_exports.Struct({
347
- operation: Schema_exports.Literal("do"),
348
- name: WorkflowName,
349
- options: WorkflowStepOptions
350
- }),
351
- Schema_exports.Struct({
352
- operation: Schema_exports.Literal("sleep"),
353
- name: WorkflowName,
354
- duration: WorkflowDuration
355
- }),
356
- Schema_exports.Struct({
357
- operation: Schema_exports.Literal("until"),
358
- name: WorkflowName,
359
- timestamp: Schema_exports.Finite
360
- }),
361
- Schema_exports.Struct({ operation: Schema_exports.Literal("context") }),
362
- Schema_exports.Struct({
363
- operation: Schema_exports.Literal("invoke"),
364
- kind: Schema_exports.Literals(["query", "mutation"]),
365
- name: Schema_exports.NonEmptyString,
366
- input: JsonValue,
367
- stepId: Schema_exports.NonEmptyString,
368
- timeout: Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0))
369
- })
370
- ]);
371
- var WorkflowRpcResult = Schema_exports.Union([
372
- Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
373
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure })
374
- ]);
375
- var WorkflowControlCommand = Schema_exports.Union([
376
- Schema_exports.Struct({
377
- operation: Schema_exports.Literal("start"),
378
- workflow: WorkflowName,
379
- input: WorkflowValue,
380
- key: Schema_exports.optionalKey(Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)))
381
- }),
382
- Schema_exports.Struct({ operation: Schema_exports.Literal("get"), run: WorkflowRunId }),
383
- Schema_exports.Struct({
384
- operation: Schema_exports.Literal("list"),
385
- workflow: Schema_exports.optionalKey(WorkflowName),
386
- cursor: Schema_exports.optionalKey(WorkflowRunId),
387
- limit: Schema_exports.optionalKey(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: 100 })))
388
- }),
389
- Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
390
- ]);
391
-
392
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/RpcSchema.js
393
- var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
394
- var schema = /* @__PURE__ */ declare(isStream);
395
- function Stream(success, error) {
396
- return make(schema.ast, {
397
- [StreamSchemaTypeId]: StreamSchemaTypeId,
398
- success,
399
- error
400
- });
401
- }
402
-
403
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/Rpc.js
404
- var TypeId = "~effect/rpc/Rpc";
405
- var Proto = {
406
- [TypeId]: TypeId,
407
- pipe() {
408
- return pipeArguments(this, arguments);
409
- },
410
- setSuccess(successSchema) {
411
- return makeProto({
412
- _tag: this._tag,
413
- payloadSchema: this.payloadSchema,
414
- successSchema,
415
- errorSchema: this.errorSchema,
416
- defectSchema: this.defectSchema,
417
- annotations: this.annotations,
418
- middlewares: this.middlewares
419
- });
420
- },
421
- setError(errorSchema) {
422
- return makeProto({
423
- _tag: this._tag,
424
- payloadSchema: this.payloadSchema,
425
- successSchema: this.successSchema,
426
- errorSchema,
427
- defectSchema: this.defectSchema,
428
- annotations: this.annotations,
429
- middlewares: this.middlewares
430
- });
431
- },
432
- setPayload(payloadSchema) {
433
- return makeProto({
434
- _tag: this._tag,
435
- payloadSchema: isSchema(payloadSchema) ? payloadSchema : Struct(payloadSchema),
436
- successSchema: this.successSchema,
437
- errorSchema: this.errorSchema,
438
- defectSchema: this.defectSchema,
439
- annotations: this.annotations,
440
- middlewares: this.middlewares
441
- });
442
- },
443
- middleware(middleware) {
444
- return makeProto({
445
- _tag: this._tag,
446
- payloadSchema: this.payloadSchema,
447
- successSchema: this.successSchema,
448
- errorSchema: this.errorSchema,
449
- defectSchema: this.defectSchema,
450
- annotations: this.annotations,
451
- middlewares: /* @__PURE__ */ new Set([...this.middlewares, middleware])
452
- });
453
- },
454
- prefix(prefix) {
455
- return makeProto({
456
- _tag: `${prefix}${this._tag}`,
457
- payloadSchema: this.payloadSchema,
458
- successSchema: this.successSchema,
459
- errorSchema: this.errorSchema,
460
- defectSchema: this.defectSchema,
461
- annotations: this.annotations,
462
- middlewares: this.middlewares
463
- });
464
- },
465
- annotate(tag2, value) {
466
- return makeProto({
467
- _tag: this._tag,
468
- payloadSchema: this.payloadSchema,
469
- successSchema: this.successSchema,
470
- errorSchema: this.errorSchema,
471
- defectSchema: this.defectSchema,
472
- middlewares: this.middlewares,
473
- annotations: add(this.annotations, tag2, value)
474
- });
475
- },
476
- annotateMerge(context) {
477
- return makeProto({
478
- _tag: this._tag,
479
- payloadSchema: this.payloadSchema,
480
- successSchema: this.successSchema,
481
- errorSchema: this.errorSchema,
482
- defectSchema: this.defectSchema,
483
- middlewares: this.middlewares,
484
- annotations: merge(this.annotations, context)
485
- });
486
- }
487
- };
488
- var makeProto = (options) => {
489
- function Rpc() {
490
- }
491
- Object.setPrototypeOf(Rpc, Proto);
492
- Object.assign(Rpc, options);
493
- Rpc.key = `effect/rpc/Rpc/${options._tag}`;
494
- return Rpc;
495
- };
496
- var make2 = (tag2, options) => {
497
- const successSchema = options?.success ?? Void;
498
- const errorSchema = options?.error ?? Never;
499
- const defectSchema = options?.defect ?? Defect();
500
- let payloadSchema;
501
- if (options?.primaryKey) {
502
- payloadSchema = class Payload extends Class(`effect/rpc/Rpc/${tag2}`)(options.payload) {
503
- [symbol]() {
504
- return options.primaryKey(this);
505
- }
506
- };
507
- } else {
508
- payloadSchema = isSchema(options?.payload) ? options?.payload : options?.payload ? Struct(options?.payload) : Void;
509
- }
510
- return makeProto({
511
- _tag: tag2,
512
- payloadSchema,
513
- successSchema: options?.stream ? Stream(successSchema, errorSchema) : successSchema,
514
- errorSchema: options?.stream ? Never : errorSchema,
515
- defectSchema,
516
- annotations: empty(),
517
- middlewares: /* @__PURE__ */ new Set()
518
- });
519
- };
520
-
521
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/ai/McpSchema.js
522
- var optionalWithDefault = (schema2, defaultValue) => {
523
- const effect = sync(defaultValue);
524
- return optionalKey(schema2).pipe(decode({
525
- decode: withDefault(effect),
526
- encode: passthrough()
527
- }), withConstructorDefault(effect));
528
- };
529
- var optional2 = (schema2) => optionalKey(schema2).pipe(decodeTo(optional(schema2), {
530
- decode: passthrough(),
531
- encode: transformOptional(flatMap(fromUndefinedOr))
532
- }));
533
- var RequestId = /* @__PURE__ */ Union([String, Finite]);
534
- var ProgressToken = /* @__PURE__ */ Union([String, Finite]);
535
- var RequestMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
536
- _meta: /* @__PURE__ */ optional2(/* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
537
- /**
538
- * If specified, the caller is requesting out-of-band progress notifications
539
- * for this request (as represented by notifications/progress). The value of
540
- * this parameter is an opaque token that will be attached to any subsequent
541
- * notifications. The receiver is not obligated to provide these
542
- * notifications.
543
- */
544
- progressToken: /* @__PURE__ */ optional2(ProgressToken)
545
- }), [JsonObject]))
546
- }))) {
547
- };
548
- var ResultMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
549
- /**
550
- * This result property is reserved by the protocol to allow clients and
551
- * servers to attach additional metadata to their responses.
552
- */
553
- _meta: /* @__PURE__ */ optional2(JsonObject)
554
- }))) {
555
- };
556
- var NotificationMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
557
- /**
558
- * This parameter name is reserved by MCP to allow clients and servers to
559
- * attach additional metadata to their notifications.
560
- */
561
- _meta: /* @__PURE__ */ optional2(JsonObject)
562
- }))) {
563
- };
564
- var Cursor = String;
565
- var PaginatedRequestMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
566
- ...RequestMeta.fields,
567
- /**
568
- * An opaque token representing the current pagination position.
569
- * If provided, the server should return results starting after this cursor.
570
- */
571
- cursor: /* @__PURE__ */ optional2(Cursor)
572
- }))) {
573
- };
574
- var PaginatedResultMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
575
- ...ResultMeta.fields,
576
- /**
577
- * An opaque token representing the pagination position after the last returned result.
578
- * If present, there may be more results available.
579
- */
580
- nextCursor: /* @__PURE__ */ optional2(Cursor)
581
- }))) {
582
- };
583
- var Role = /* @__PURE__ */ Literals(["user", "assistant"]);
584
- var Annotations = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
585
- /**
586
- * Describes who the intended customer of this object or data is.
587
- *
588
- * It can include multiple entries to indicate content useful for multiple
589
- * audiences (e.g., `["user", "assistant"]`).
590
- */
591
- audience: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Role)),
592
- /**
593
- * Describes how important this data is for operating the server.
594
- *
595
- * A value of 1 means "most important," and indicates that the data is
596
- * effectively required, while 0 means "least important," and indicates that
597
- * the data is entirely optional.
598
- */
599
- priority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
600
- minimum: 0,
601
- maximum: 1
602
- }))),
603
- /**
604
- * The last time the annotated object was modified, formatted as an ISO 8601
605
- * timestamp.
606
- */
607
- lastModified: /* @__PURE__ */ optional2(String)
608
- }))) {
609
- };
610
- var Icon = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Icon")({
611
- /**
612
- * URI containing the icon image.
613
- */
614
- src: String,
615
- /**
616
- * MIME type of the icon, when known.
617
- */
618
- mimeType: /* @__PURE__ */ optional2(String),
619
- /**
620
- * Sizes supported by the icon, such as `"48x48"` or `"any"`.
621
- */
622
- sizes: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String)),
623
- /**
624
- * Color theme for which the icon was designed.
625
- */
626
- theme: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["light", "dark"]))
627
- })) {
628
- };
629
- var Implementation = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
630
- name: String,
631
- title: /* @__PURE__ */ optional2(String),
632
- version: String,
633
- icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
634
- description: /* @__PURE__ */ optional2(String),
635
- websiteUrl: /* @__PURE__ */ optional2(String)
636
- }))) {
637
- };
638
- var ClientCapabilities = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ClientCapabilities")({
639
- /**
640
- * Experimental, non-standard capabilities that the client supports.
641
- */
642
- experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, /* @__PURE__ */ Struct({}))),
643
- /**
644
- * Optional extensions capabilities advertised by the client.
645
- * Keys are extension identifiers following <vendor-prefix>/<extension-name> (e.g. "io.modelcontextprotocol/ui").
646
- */
647
- extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String, "/", String]), Json)),
648
- /**
649
- * Present if the client supports listing roots.
650
- */
651
- roots: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
652
- /**
653
- * Whether the client supports notifications for changes to the roots list.
654
- */
655
- listChanged: /* @__PURE__ */ optional2(Boolean)
656
- })),
657
- /**
658
- * Present if the client supports sampling from an LLM.
659
- */
660
- sampling: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
661
- /**
662
- * Present if the client supports context inclusion during sampling.
663
- */
664
- context: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
665
- /**
666
- * Present if the client supports tool use during sampling.
667
- */
668
- tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
669
- })),
670
- /**
671
- * Present if the client supports elicitation from the server.
672
- */
673
- elicitation: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
674
- /**
675
- * Present if the client supports form-mode elicitation.
676
- */
677
- form: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
678
- /**
679
- * Present if the client supports URL-mode elicitation.
680
- */
681
- url: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
682
- }))
683
- })) {
684
- };
685
- var ServerCapabilities = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
686
- /**
687
- * Experimental, non-standard capabilities that the server supports.
688
- */
689
- experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, /* @__PURE__ */ Struct({}))),
690
- /**
691
- * Optional extensions capabilities advertised by the server.
692
- * Keys are extension identifiers following <vendor-prefix>/<extension-name> (e.g. "io.modelcontextprotocol/ui").
693
- */
694
- extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String, "/", String]), Json)),
695
- /**
696
- * Present if the server supports sending log messages to the client.
697
- */
698
- logging: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
699
- /**
700
- * Present if the server supports argument autocompletion suggestions.
701
- */
702
- completions: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
703
- /**
704
- * Present if the server offers any prompt templates.
705
- */
706
- prompts: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
707
- /**
708
- * Whether this server supports notifications for changes to the prompt list.
709
- */
710
- listChanged: /* @__PURE__ */ optional2(Boolean)
711
- })),
712
- /**
713
- * Present if the server offers any resources to read.
714
- */
715
- resources: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
716
- /**
717
- * Whether this server supports subscribing to resource updates.
718
- */
719
- subscribe: /* @__PURE__ */ optional2(Boolean),
720
- /**
721
- * Whether this server supports notifications for changes to the resource list.
722
- */
723
- listChanged: /* @__PURE__ */ optional2(Boolean)
724
- })),
725
- /**
726
- * Present if the server offers any tools to call.
727
- */
728
- tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
729
- /**
730
- * Whether this server supports notifications for changes to the tool list.
731
- */
732
- listChanged: /* @__PURE__ */ optional2(Boolean)
733
- }))
734
- }))) {
735
- };
736
- var McpErrorBase = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/McpErrorBase")({
737
- /**
738
- * The error type that occurred.
739
- */
740
- code: Int,
741
- /**
742
- * A short description of the error. The message SHOULD be limited to a
743
- * concise single sentence.
744
- */
745
- message: String,
746
- /**
747
- * Additional information about the error. The value of this member is
748
- * defined by the sender (e.g. detailed error information, nested errors etc.).
749
- */
750
- data: /* @__PURE__ */ optional2(Any)
751
- })) {
752
- };
753
- var INVALID_REQUEST_ERROR_CODE = -32600;
754
- var METHOD_NOT_FOUND_ERROR_CODE = -32601;
755
- var INVALID_PARAMS_ERROR_CODE = -32602;
756
- var INTERNAL_ERROR_CODE = -32603;
757
- var PARSE_ERROR_CODE = -32700;
758
- var ParseError = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/ParseError")({
759
- ...McpErrorBase.fields,
760
- _tag: /* @__PURE__ */ tag("ParseError"),
761
- code: /* @__PURE__ */ tag(PARSE_ERROR_CODE)
762
- })) {
763
- };
764
- var InvalidRequest = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InvalidRequest")({
765
- ...McpErrorBase.fields,
766
- _tag: /* @__PURE__ */ tag("InvalidRequest"),
767
- code: /* @__PURE__ */ tag(INVALID_REQUEST_ERROR_CODE)
768
- })) {
769
- };
770
- var MethodNotFound = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/MethodNotFound")({
771
- ...McpErrorBase.fields,
772
- _tag: /* @__PURE__ */ tag("MethodNotFound"),
773
- code: /* @__PURE__ */ tag(METHOD_NOT_FOUND_ERROR_CODE)
774
- })) {
775
- };
776
- var InvalidParams = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InvalidParams")({
777
- ...McpErrorBase.fields,
778
- _tag: /* @__PURE__ */ tag("InvalidParams"),
779
- code: /* @__PURE__ */ tag(INVALID_PARAMS_ERROR_CODE)
780
- })) {
781
- };
782
- var InternalError = class _InternalError extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InternalError")({
783
- ...McpErrorBase.fields,
784
- _tag: /* @__PURE__ */ tag("InternalError"),
785
- code: /* @__PURE__ */ tag(INTERNAL_ERROR_CODE)
786
- })) {
787
- static notImplemented = /* @__PURE__ */ new _InternalError({
788
- message: "Not implemented"
789
- });
790
- };
791
- var McpError2 = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
792
- var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
793
- ...ResultMeta.fields,
794
- /**
795
- * The version of the Model Context Protocol that the server wants to use.
796
- * This may not match the version that the client requested. If the client
797
- * cannot support this version, it MUST disconnect.
798
- */
799
- protocolVersion: String,
800
- capabilities: ServerCapabilities,
801
- serverInfo: Implementation,
802
- /**
803
- * Instructions describing how to use the server and its features.
804
- *
805
- * This can be used by clients to improve the LLM's understanding of available
806
- * tools, resources, etc. It can be thought of like a "hint" to the model.
807
- * For example, this information MAY be added to the system prompt.
808
- */
809
- instructions: /* @__PURE__ */ optional2(String)
810
- }))) {
811
- };
812
- var Initialize = class extends (/* @__PURE__ */ make2("initialize", {
813
- success: InitializeResult,
814
- error: McpError2,
815
- payload: {
816
- ...RequestMeta.fields,
817
- /**
818
- * The latest version of the Model Context Protocol that the client
819
- * supports. The client MAY decide to support older versions as well.
820
- */
821
- protocolVersion: String,
822
- /**
823
- * Capabilities a client may support. Known capabilities are defined here,
824
- * in this schema, but this is not a closed set: any client can define its
825
- * own, additional capabilities.
826
- */
827
- capabilities: ClientCapabilities,
828
- /**
829
- * Describes the name and version of an MCP implementation.
830
- */
831
- clientInfo: Implementation
832
- }
833
- })) {
834
- };
835
- var CancelledNotification = class extends (/* @__PURE__ */ make2("notifications/cancelled", {
836
- payload: {
837
- ...NotificationMeta.fields,
838
- /**
839
- * The ID of the request to cancel.
840
- *
841
- * This MUST correspond to the ID of a request previously issued in the
842
- * same direction.
843
- */
844
- requestId: RequestId,
845
- /**
846
- * An optional string describing the reason for the cancellation. This MAY
847
- * be logged or presented to the user.
848
- */
849
- reason: /* @__PURE__ */ optional2(String)
850
- }
851
- })) {
852
- };
853
- var ProgressNotification = class extends (/* @__PURE__ */ make2("notifications/progress", {
854
- payload: {
855
- ...NotificationMeta.fields,
856
- /**
857
- * The progress token which was given in the initial request, used to
858
- * associate this notification with the request that is proceeding.
859
- */
860
- progressToken: ProgressToken,
861
- /**
862
- * The progress thus far. This should increase every time progress is made,
863
- * even if the total is unknown.
864
- */
865
- progress: Finite,
866
- /**
867
- * Total number of items to process (or total progress required), if known.
868
- */
869
- total: /* @__PURE__ */ optional2(Finite),
870
- /**
871
- * An optional message describing the current progress.
872
- */
873
- message: /* @__PURE__ */ optional2(String)
874
- }
875
- })) {
876
- };
877
- var Resource = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Resource")({
878
- /**
879
- * The URI of this resource.
880
- */
881
- uri: String,
882
- /**
883
- * A human-readable name for this resource.
884
- *
885
- * This can be used by clients to populate UI elements.
886
- */
887
- name: String,
888
- title: /* @__PURE__ */ optional2(String),
889
- /**
890
- * A description of what this resource represents.
891
- *
892
- * This can be used by clients to improve the LLM's understanding of available
893
- * resources. It can be thought of like a "hint" to the model.
894
- */
895
- description: /* @__PURE__ */ optional2(String),
896
- /**
897
- * The MIME type of this resource, if known.
898
- */
899
- mimeType: /* @__PURE__ */ optional2(String),
900
- /**
901
- * Optional annotations for the client.
902
- */
903
- annotations: /* @__PURE__ */ optional2(Annotations),
904
- /**
905
- * Icons that clients can display for this resource.
906
- */
907
- icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
908
- /**
909
- * The size of the raw resource content, in bytes (i.e., before base64
910
- * encoding or any tokenization), if known.
911
- *
912
- * This can be used by Hosts to display file sizes and estimate context
913
- * window usage.
914
- */
915
- size: /* @__PURE__ */ optional2(Int),
916
- /**
917
- * Optional additional metadata for the client.
918
- *
919
- * This parameter name is reserved by MCP to allow clients and servers to
920
- * attach additional metadata to resources.
921
- */
922
- _meta: /* @__PURE__ */ optional2(JsonObject)
923
- })) {
924
- };
925
- var ResourceTemplate = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ResourceTemplate")({
926
- /**
927
- * A URI template (according to RFC 6570) that can be used to construct
928
- * resource URIs.
929
- */
930
- uriTemplate: String,
931
- /**
932
- * A human-readable name for the type of resource this template refers to.
933
- *
934
- * This can be used by clients to populate UI elements.
935
- */
936
- name: String,
937
- title: /* @__PURE__ */ optional2(String),
938
- /**
939
- * A description of what this template is for.
940
- *
941
- * This can be used by clients to improve the LLM's understanding of available
942
- * resources. It can be thought of like a "hint" to the model.
943
- */
944
- description: /* @__PURE__ */ optional2(String),
945
- /**
946
- * The MIME type for all resources that match this template. This should only
947
- * be included if all resources matching this template have the same type.
948
- */
949
- mimeType: /* @__PURE__ */ optional2(String),
950
- /**
951
- * Optional annotations for the client.
952
- */
953
- annotations: /* @__PURE__ */ optional2(Annotations),
954
- /**
955
- * Icons that clients can display for this resource template.
956
- */
957
- icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
958
- /**
959
- * Optional additional metadata for the client.
960
- */
961
- _meta: /* @__PURE__ */ optional2(JsonObject)
962
- })) {
963
- };
964
- var ResourceContents = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
965
- /**
966
- * The URI of this resource.
967
- */
968
- uri: String,
969
- /**
970
- * The MIME type of this resource, if known.
971
- */
972
- mimeType: /* @__PURE__ */ optional2(String),
973
- /**
974
- * Optional additional metadata for the client.
975
- */
976
- _meta: /* @__PURE__ */ optional2(JsonObject)
977
- }))) {
978
- };
979
- var TextResourceContents = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
980
- ...ResourceContents.fields,
981
- /**
982
- * The text of the item. This must only be set if the item can actually be
983
- * represented as text (not binary data).
984
- */
985
- text: String
986
- }))) {
987
- };
988
- var BlobResourceContents = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
989
- ...ResourceContents.fields,
990
- /**
991
- * The binary data of the item decoded from a base64-encoded string.
992
- */
993
- blob: Uint8ArrayFromBase64
994
- }))) {
995
- };
996
- var ListResourcesResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListResourcesResult")({
997
- ...PaginatedResultMeta.fields,
998
- resources: /* @__PURE__ */ ArraySchema(Resource)
999
- })) {
1000
- };
1001
- var ListResourceTemplatesResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListResourceTemplatesResult")({
1002
- ...PaginatedResultMeta.fields,
1003
- resourceTemplates: /* @__PURE__ */ ArraySchema(ResourceTemplate)
1004
- })) {
1005
- };
1006
- var ReadResourceResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1007
- ...ResultMeta.fields,
1008
- contents: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]))
1009
- }))) {
1010
- };
1011
- var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
1012
- success: ReadResourceResult,
1013
- error: McpError2,
1014
- payload: {
1015
- ...RequestMeta.fields,
1016
- /**
1017
- * The URI of the resource to read. The URI can use any protocol; it is up
1018
- * to the server how to interpret it.
1019
- */
1020
- uri: String
1021
- }
1022
- })) {
1023
- };
1024
- var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
1025
- success: /* @__PURE__ */ Struct({}),
1026
- error: McpError2,
1027
- payload: {
1028
- ...RequestMeta.fields,
1029
- /**
1030
- * The URI of the resource to subscribe to. The URI can use any protocol;
1031
- * it is up to the server how to interpret it.
1032
- */
1033
- uri: String
1034
- }
1035
- })) {
1036
- };
1037
- var Unsubscribe = class extends (/* @__PURE__ */ make2("resources/unsubscribe", {
1038
- success: /* @__PURE__ */ Struct({}),
1039
- error: McpError2,
1040
- payload: {
1041
- ...RequestMeta.fields,
1042
- /**
1043
- * The URI of the resource to subscribe to. The URI can use any protocol;
1044
- * it is up to the server how to interpret it.
1045
- */
1046
- uri: String
1047
- }
1048
- })) {
1049
- };
1050
- var ResourceUpdatedNotification = class extends (/* @__PURE__ */ make2("notifications/resources/updated", {
1051
- payload: {
1052
- ...NotificationMeta.fields,
1053
- /**
1054
- * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
1055
- */
1056
- uri: String
1057
- }
1058
- })) {
1059
- };
1060
- var PromptArgument = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1061
- /**
1062
- * The name of the argument.
1063
- */
1064
- name: String,
1065
- title: /* @__PURE__ */ optional2(String),
1066
- /**
1067
- * A human-readable description of the argument.
1068
- */
1069
- description: /* @__PURE__ */ optional2(String),
1070
- /**
1071
- * Whether this argument must be provided.
1072
- */
1073
- required: /* @__PURE__ */ optional2(Boolean)
1074
- }))) {
1075
- };
1076
- var Prompt = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Prompt")({
1077
- /**
1078
- * The name of the prompt or prompt template.
1079
- */
1080
- name: String,
1081
- title: /* @__PURE__ */ optional2(String),
1082
- /**
1083
- * An optional description of what this prompt provides
1084
- */
1085
- description: /* @__PURE__ */ optional2(String),
1086
- /**
1087
- * A list of arguments to use for templating the prompt.
1088
- */
1089
- arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(PromptArgument)),
1090
- /**
1091
- * Icons that clients can display for this prompt.
1092
- */
1093
- icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
1094
- _meta: /* @__PURE__ */ optional2(JsonObject)
1095
- })) {
1096
- };
1097
- var TextContent = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1098
- type: /* @__PURE__ */ tag("text"),
1099
- /**
1100
- * The text content of the message.
1101
- */
1102
- text: String,
1103
- /**
1104
- * Optional annotations for the client.
1105
- */
1106
- annotations: /* @__PURE__ */ optional2(Annotations),
1107
- _meta: /* @__PURE__ */ optional2(JsonObject)
1108
- }))) {
1109
- };
1110
- var ImageContent = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1111
- type: /* @__PURE__ */ tag("image"),
1112
- /**
1113
- * The image data.
1114
- */
1115
- data: Uint8ArrayFromBase64,
1116
- /**
1117
- * The MIME type of the image. Different providers may support different
1118
- * image types.
1119
- */
1120
- mimeType: String,
1121
- /**
1122
- * Optional annotations for the client.
1123
- */
1124
- annotations: /* @__PURE__ */ optional2(Annotations),
1125
- _meta: /* @__PURE__ */ optional2(JsonObject)
1126
- }))) {
1127
- };
1128
- var AudioContent = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1129
- type: /* @__PURE__ */ tag("audio"),
1130
- /**
1131
- * The audio data.
1132
- */
1133
- data: Uint8ArrayFromBase64,
1134
- /**
1135
- * The MIME type of the audio. Different providers may support different
1136
- * audio types.
1137
- */
1138
- mimeType: String,
1139
- /**
1140
- * Optional annotations for the client.
1141
- */
1142
- annotations: /* @__PURE__ */ optional2(Annotations),
1143
- _meta: /* @__PURE__ */ optional2(JsonObject)
1144
- }))) {
1145
- };
1146
- var EmbeddedResource = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1147
- type: /* @__PURE__ */ tag("resource"),
1148
- resource: /* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]),
1149
- /**
1150
- * Optional annotations for the client.
1151
- */
1152
- annotations: /* @__PURE__ */ optional2(Annotations),
1153
- _meta: /* @__PURE__ */ optional2(JsonObject)
1154
- }))) {
1155
- };
1156
- var ResourceLink = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1157
- ...Resource.fields,
1158
- type: /* @__PURE__ */ tag("resource_link")
1159
- }))) {
1160
- };
1161
- var ContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, EmbeddedResource, ResourceLink]);
1162
- var PromptMessage = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1163
- role: Role,
1164
- content: ContentBlock
1165
- }))) {
1166
- };
1167
- var ListPromptsResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListPromptsResult")({
1168
- ...PaginatedResultMeta.fields,
1169
- prompts: /* @__PURE__ */ ArraySchema(Prompt)
1170
- })) {
1171
- };
1172
- var GetPromptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/GetPromptResult")({
1173
- ...ResultMeta.fields,
1174
- messages: /* @__PURE__ */ ArraySchema(PromptMessage),
1175
- /**
1176
- * An optional description for the prompt.
1177
- */
1178
- description: /* @__PURE__ */ optional2(String)
1179
- })) {
1180
- };
1181
- var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
1182
- success: GetPromptResult,
1183
- error: McpError2,
1184
- payload: {
1185
- ...RequestMeta.fields,
1186
- /**
1187
- * The name of the prompt or prompt template.
1188
- */
1189
- name: String,
1190
- title: /* @__PURE__ */ optional2(String),
1191
- /**
1192
- * Arguments to use for templating the prompt.
1193
- */
1194
- arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, String))
1195
- }
1196
- })) {
1197
- };
1198
- var ToolAnnotations2 = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1199
- /**
1200
- * A human-readable title for the tool.
1201
- */
1202
- title: /* @__PURE__ */ optional2(String),
1203
- /**
1204
- * If true, the tool does not modify its environment.
1205
- *
1206
- * Default: `false`
1207
- */
1208
- readOnlyHint: /* @__PURE__ */ optionalWithDefault(Boolean, constFalse),
1209
- /**
1210
- * If true, the tool may perform destructive updates to its environment.
1211
- * If false, the tool performs only additive updates.
1212
- *
1213
- * (This property is meaningful only when `readOnlyHint == false`)
1214
- *
1215
- * Default: `true`
1216
- */
1217
- destructiveHint: /* @__PURE__ */ optionalWithDefault(Boolean, constTrue),
1218
- /**
1219
- * If true, calling the tool repeatedly with the same arguments
1220
- * will have no additional effect on the its environment.
1221
- *
1222
- * (This property is meaningful only when `readOnlyHint == false`)
1223
- *
1224
- * Default: `false`
1225
- */
1226
- idempotentHint: /* @__PURE__ */ optionalWithDefault(Boolean, constFalse),
1227
- /**
1228
- * If true, this tool may interact with an "open world" of external
1229
- * entities. If false, the tool's domain of interaction is closed.
1230
- * For example, the world of a web search tool is open, whereas that
1231
- * of a memory tool is not.
1232
- *
1233
- * Default: `true`
1234
- */
1235
- openWorldHint: /* @__PURE__ */ optionalWithDefault(Boolean, constTrue)
1236
- }))) {
1237
- };
1238
- var ToolJson = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
1239
- type: /* @__PURE__ */ Literal("object"),
1240
- properties: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, JsonObject)),
1241
- required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
1242
- }), [JsonObject]);
1243
- var ToolOutputJson = JsonObject;
1244
- var Tool = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Tool")({
1245
- /**
1246
- * The name of the tool.
1247
- */
1248
- name: String,
1249
- title: /* @__PURE__ */ optional2(String),
1250
- /**
1251
- * A human-readable description of the tool.
1252
- *
1253
- * This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model.
1254
- */
1255
- description: /* @__PURE__ */ optional2(String),
1256
- /**
1257
- * A JSON Schema object defining the expected parameters for the tool.
1258
- */
1259
- inputSchema: ToolJson,
1260
- /**
1261
- * An optional JSON Schema object defining the structure of the tool output.
1262
- */
1263
- outputSchema: /* @__PURE__ */ optional2(ToolOutputJson),
1264
- /**
1265
- * Optional additional tool information.
1266
- */
1267
- annotations: /* @__PURE__ */ optional2(ToolAnnotations2),
1268
- /**
1269
- * Icons that clients can display for this tool.
1270
- */
1271
- icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
1272
- /**
1273
- * Optional additional metadata for the client.
1274
- *
1275
- * This parameter name is reserved by MCP to allow clients and servers to
1276
- * attach additional metadata to resources.
1277
- */
1278
- _meta: /* @__PURE__ */ optional2(JsonObject)
1279
- })) {
1280
- };
1281
- var ListToolsResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListToolsResult")({
1282
- ...PaginatedResultMeta.fields,
1283
- tools: /* @__PURE__ */ ArraySchema(Tool)
1284
- })) {
1285
- };
1286
- var CallToolResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/CallToolResult")({
1287
- ...ResultMeta.fields,
1288
- content: /* @__PURE__ */ ArraySchema(ContentBlock),
1289
- /**
1290
- * An optional JSON value containing the structured result of the tool call.
1291
- */
1292
- structuredContent: /* @__PURE__ */ optional2(Json),
1293
- /**
1294
- * Whether the tool call ended in an error.
1295
- *
1296
- * If not set, this is assumed to be false (the call was successful).
1297
- */
1298
- isError: /* @__PURE__ */ optional2(Boolean)
1299
- })) {
1300
- };
1301
- var CallTool = class extends (/* @__PURE__ */ make2("tools/call", {
1302
- success: CallToolResult,
1303
- error: McpError2,
1304
- payload: {
1305
- ...RequestMeta.fields,
1306
- name: String,
1307
- arguments: /* @__PURE__ */ optionalWithDefault(/* @__PURE__ */ Record(String, Any), () => ({}))
1308
- }
1309
- })) {
1310
- };
1311
- var LoggingLevel = /* @__PURE__ */ Literals(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
1312
- var SetLevel = class extends (/* @__PURE__ */ make2("logging/setLevel", {
1313
- payload: {
1314
- ...RequestMeta.fields,
1315
- /**
1316
- * The level of logging that the client wants to receive from the server.
1317
- * The server should send all logs at this level and higher (i.e., more
1318
- * severe) to the client as notifications/message.
1319
- */
1320
- level: LoggingLevel
1321
- },
1322
- success: /* @__PURE__ */ Struct({}),
1323
- error: McpError2
1324
- })) {
1325
- };
1326
- var LoggingMessageNotification = class extends (/* @__PURE__ */ make2("notifications/message", {
1327
- payload: /* @__PURE__ */ Struct({
1328
- ...NotificationMeta.fields,
1329
- /**
1330
- * The severity of this log message.
1331
- */
1332
- level: LoggingLevel,
1333
- /**
1334
- * An optional name of the logger issuing this message.
1335
- */
1336
- logger: /* @__PURE__ */ optional2(String),
1337
- /**
1338
- * The data to be logged, such as a string message or an object. Any JSON
1339
- * serializable type is allowed here.
1340
- */
1341
- data: Any
1342
- })
1343
- })) {
1344
- };
1345
- var ToolUseContent = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ToolUseContent")({
1346
- type: /* @__PURE__ */ tag("tool_use"),
1347
- /**
1348
- * Identifier used to associate a later tool result with this request.
1349
- */
1350
- id: String,
1351
- /**
1352
- * Name of the tool to invoke.
1353
- */
1354
- name: String,
1355
- /**
1356
- * Arguments supplied to the tool.
1357
- */
1358
- input: /* @__PURE__ */ Record(String, Unknown),
1359
- _meta: /* @__PURE__ */ optional2(JsonObject)
1360
- })) {
1361
- };
1362
- var ToolResultContent = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ToolResultContent")({
1363
- type: /* @__PURE__ */ tag("tool_result"),
1364
- /**
1365
- * Identifier of the tool-use request that produced this result.
1366
- */
1367
- toolUseId: String,
1368
- /**
1369
- * Content returned by the tool.
1370
- */
1371
- content: /* @__PURE__ */ ArraySchema(ContentBlock),
1372
- /**
1373
- * Optional structured result returned by the tool.
1374
- */
1375
- structuredContent: /* @__PURE__ */ optional2(Json),
1376
- /**
1377
- * Whether tool execution ended in an error.
1378
- */
1379
- isError: /* @__PURE__ */ optional2(Boolean),
1380
- _meta: /* @__PURE__ */ optional2(JsonObject)
1381
- })) {
1382
- };
1383
- var SamplingMessageContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, ToolUseContent, ToolResultContent]);
1384
- var SamplingMessage = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1385
- role: Role,
1386
- content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
1387
- _meta: /* @__PURE__ */ optional2(JsonObject)
1388
- }))) {
1389
- };
1390
- var ToolChoice = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ToolChoice")({
1391
- /**
1392
- * Tool-selection mode requested from the client.
1393
- */
1394
- mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["auto", "required", "none"]))
1395
- })) {
1396
- };
1397
- var ModelHint = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1398
- /**
1399
- * A hint for a model name.
1400
- *
1401
- * The client SHOULD treat this as a substring of a model name; for example:
1402
- * - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`
1403
- * - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.
1404
- * - `claude` should match any Claude model
1405
- *
1406
- * The client MAY also map the string to a different provider's model name or
1407
- * a different model family, as long as it fills a similar niche; for example:
1408
- * - `gemini-1.5-flash` could match `claude-3-haiku-20240307`
1409
- */
1410
- name: /* @__PURE__ */ optional2(String)
1411
- }))) {
1412
- };
1413
- var ModelPreferences = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ModelPreferences")({
1414
- /**
1415
- * Optional hints to use for model selection.
1416
- *
1417
- * If multiple hints are specified, the client MUST evaluate them in order
1418
- * (such that the first match is taken).
1419
- *
1420
- * The client SHOULD prioritize these hints over the numeric priorities, but
1421
- * MAY still use the priorities to select from ambiguous matches.
1422
- */
1423
- hints: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(ModelHint)),
1424
- /**
1425
- * How much to prioritize cost when selecting a model. A value of 0 means cost
1426
- * is not important, while a value of 1 means cost is the most important
1427
- * factor.
1428
- */
1429
- costPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
1430
- minimum: 0,
1431
- maximum: 1
1432
- }))),
1433
- /**
1434
- * How much to prioritize sampling speed (latency) when selecting a model. A
1435
- * value of 0 means speed is not important, while a value of 1 means speed is
1436
- * the most important factor.
1437
- */
1438
- speedPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
1439
- minimum: 0,
1440
- maximum: 1
1441
- }))),
1442
- /**
1443
- * How much to prioritize intelligence and capabilities when selecting a
1444
- * model. A value of 0 means intelligence is not important, while a value of 1
1445
- * means intelligence is the most important factor.
1446
- */
1447
- intelligencePriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
1448
- minimum: 0,
1449
- maximum: 1
1450
- })))
1451
- })) {
1452
- };
1453
- var CreateMessageResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/CreateMessageResult")({
1454
- role: Role,
1455
- content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
1456
- _meta: /* @__PURE__ */ optional2(JsonObject),
1457
- /**
1458
- * The name of the model that generated the message.
1459
- */
1460
- model: String,
1461
- /**
1462
- * The reason why sampling stopped, if known.
1463
- */
1464
- stopReason: /* @__PURE__ */ optional2(String)
1465
- })) {
1466
- };
1467
- var CreateMessage = class extends (/* @__PURE__ */ make2("sampling/createMessage", {
1468
- success: CreateMessageResult,
1469
- error: McpError2,
1470
- payload: {
1471
- messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
1472
- /**
1473
- * The server's preferences for which model to select. The client MAY ignore
1474
- * these preferences.
1475
- */
1476
- modelPreferences: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ModelPreferences.fields)),
1477
- /**
1478
- * An optional system prompt the server wants to use for sampling. The
1479
- * client MAY modify or omit this prompt.
1480
- */
1481
- systemPrompt: /* @__PURE__ */ optional2(String),
1482
- /**
1483
- * A request to include context from one or more MCP servers (including the
1484
- * caller), to be attached to the prompt. The client MAY ignore this request.
1485
- */
1486
- includeContext: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["none", "thisServer", "allServers"])),
1487
- temperature: /* @__PURE__ */ optional2(Finite),
1488
- /**
1489
- * The maximum number of tokens to sample, as requested by the server. The
1490
- * client MAY choose to sample fewer tokens than requested.
1491
- */
1492
- maxTokens: Int,
1493
- stopSequences: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String)),
1494
- /**
1495
- * Optional metadata to pass through to the LLM provider. The format of
1496
- * this metadata is provider-specific.
1497
- */
1498
- metadata: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, Unknown)),
1499
- /**
1500
- * Tools that the model may call while producing the response.
1501
- */
1502
- tools: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct(Tool.fields))),
1503
- /**
1504
- * Controls whether the model may or must call a tool.
1505
- */
1506
- toolChoice: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ToolChoice.fields))
1507
- }
1508
- })) {
1509
- };
1510
- var CompleteResult = class _CompleteResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1511
- ...ResultMeta.fields,
1512
- completion: /* @__PURE__ */ Struct({
1513
- /**
1514
- * An array of completion values. Must not exceed 100 items.
1515
- */
1516
- values: /* @__PURE__ */ ArraySchema(String),
1517
- /**
1518
- * The total number of completion options available. This can exceed the
1519
- * number of values actually sent in the response.
1520
- */
1521
- total: /* @__PURE__ */ optional2(Int),
1522
- /**
1523
- * Indicates whether there are additional completion options beyond those
1524
- * provided in the current response, even if the exact total is unknown.
1525
- */
1526
- hasMore: /* @__PURE__ */ optional2(Boolean)
1527
- })
1528
- }))) {
1529
- /**
1530
- * Empty completion result used when a completion request has no values.
1531
- *
1532
- * @since 4.0.0
1533
- */
1534
- static empty = /* @__PURE__ */ _CompleteResult.make({
1535
- completion: {
1536
- values: [],
1537
- total: 0,
1538
- hasMore: false
1539
- }
1540
- });
1541
- };
1542
- var ElicitationString = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitationString")({
1543
- type: /* @__PURE__ */ tag("string"),
1544
- title: /* @__PURE__ */ optional2(String),
1545
- description: /* @__PURE__ */ optional2(String),
1546
- minLength: /* @__PURE__ */ optional2(Int),
1547
- maxLength: /* @__PURE__ */ optional2(Int),
1548
- format: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["email", "uri", "date", "date-time"])),
1549
- default: /* @__PURE__ */ optional2(String)
1550
- })) {
1551
- };
1552
- var ElicitationNumber = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitationNumber")({
1553
- type: /* @__PURE__ */ Literals(["number", "integer"]),
1554
- title: /* @__PURE__ */ optional2(String),
1555
- description: /* @__PURE__ */ optional2(String),
1556
- minimum: /* @__PURE__ */ optional2(Finite),
1557
- maximum: /* @__PURE__ */ optional2(Finite),
1558
- default: /* @__PURE__ */ optional2(Finite)
1559
- })) {
1560
- };
1561
- var ElicitationBoolean = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitationBoolean")({
1562
- type: /* @__PURE__ */ tag("boolean"),
1563
- title: /* @__PURE__ */ optional2(String),
1564
- description: /* @__PURE__ */ optional2(String),
1565
- default: /* @__PURE__ */ optional2(Boolean)
1566
- })) {
1567
- };
1568
- var UntitledSingleSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/UntitledSingleSelectEnum")({
1569
- type: /* @__PURE__ */ tag("string"),
1570
- title: /* @__PURE__ */ optional2(String),
1571
- description: /* @__PURE__ */ optional2(String),
1572
- enum: /* @__PURE__ */ ArraySchema(String),
1573
- default: /* @__PURE__ */ optional2(String)
1574
- })) {
1575
- };
1576
- var TitledSingleSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/TitledSingleSelectEnum")({
1577
- type: /* @__PURE__ */ tag("string"),
1578
- title: /* @__PURE__ */ optional2(String),
1579
- description: /* @__PURE__ */ optional2(String),
1580
- oneOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
1581
- const: String,
1582
- title: String
1583
- })),
1584
- default: /* @__PURE__ */ optional2(String)
1585
- })) {
1586
- };
1587
- var SingleSelectEnum = /* @__PURE__ */ Union([UntitledSingleSelectEnum, TitledSingleSelectEnum]);
1588
- var UntitledMultiSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/UntitledMultiSelectEnum")({
1589
- type: /* @__PURE__ */ tag("array"),
1590
- title: /* @__PURE__ */ optional2(String),
1591
- description: /* @__PURE__ */ optional2(String),
1592
- minItems: /* @__PURE__ */ optional2(Int),
1593
- maxItems: /* @__PURE__ */ optional2(Int),
1594
- items: /* @__PURE__ */ Struct({
1595
- type: /* @__PURE__ */ tag("string"),
1596
- enum: /* @__PURE__ */ ArraySchema(String)
1597
- }),
1598
- default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
1599
- })) {
1600
- };
1601
- var TitledMultiSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/TitledMultiSelectEnum")({
1602
- type: /* @__PURE__ */ tag("array"),
1603
- title: /* @__PURE__ */ optional2(String),
1604
- description: /* @__PURE__ */ optional2(String),
1605
- minItems: /* @__PURE__ */ optional2(Int),
1606
- maxItems: /* @__PURE__ */ optional2(Int),
1607
- items: /* @__PURE__ */ Struct({
1608
- anyOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
1609
- const: String,
1610
- title: String
1611
- }))
1612
- }),
1613
- default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
1614
- })) {
1615
- };
1616
- var MultiSelectEnum = /* @__PURE__ */ Union([UntitledMultiSelectEnum, TitledMultiSelectEnum]);
1617
- var LegacyTitledEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/LegacyTitledEnum")({
1618
- type: /* @__PURE__ */ tag("string"),
1619
- title: /* @__PURE__ */ optional2(String),
1620
- description: /* @__PURE__ */ optional2(String),
1621
- enum: /* @__PURE__ */ ArraySchema(String),
1622
- enumNames: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String)),
1623
- default: /* @__PURE__ */ optional2(String)
1624
- })) {
1625
- };
1626
- var ElicitationEnum = /* @__PURE__ */ Union([LegacyTitledEnum, SingleSelectEnum, MultiSelectEnum]);
1627
- var PrimitiveSchemaDefinition = /* @__PURE__ */ Union([ElicitationEnum, ElicitationString, ElicitationNumber, ElicitationBoolean]);
1628
- var ElicitationForm = /* @__PURE__ */ Struct({
1629
- $schema: /* @__PURE__ */ optional2(String),
1630
- type: /* @__PURE__ */ tag("object"),
1631
- properties: /* @__PURE__ */ Record(String, PrimitiveSchemaDefinition),
1632
- required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
1633
- });
1634
- var ElicitRequestFormParams = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitRequestFormParams")({
1635
- ...RequestMeta.fields,
1636
- mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literal("form")),
1637
- message: String,
1638
- requestedSchema: ElicitationForm
1639
- })) {
1640
- };
1641
- var ElicitRequestURLParams = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitRequestURLParams")({
1642
- ...RequestMeta.fields,
1643
- mode: /* @__PURE__ */ Literal("url"),
1644
- message: String,
1645
- elicitationId: String,
1646
- url: String
1647
- })) {
1648
- };
1649
- var ElicitRequestParams = /* @__PURE__ */ Union([ElicitRequestFormParams, ElicitRequestURLParams]);
1650
- var ElicitAcceptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitAcceptResult")({
1651
- ...ResultMeta.fields,
1652
- /**
1653
- * The user action in response to the elicitation.
1654
- * - "accept": User submitted the form/confirmed the action
1655
- * - "decline": User explicitly declined the action
1656
- * - "cancel": User dismissed without making an explicit choice
1657
- */
1658
- action: /* @__PURE__ */ Literal("accept"),
1659
- /**
1660
- * The submitted form data, only present when action is "accept".
1661
- * Contains values matching the requested schema.
1662
- */
1663
- content: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, /* @__PURE__ */ Union([String, Finite, Boolean, /* @__PURE__ */ ArraySchema(String)])))
1664
- })) {
1665
- };
1666
- var ElicitDeclineResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitDeclineResult")({
1667
- ...ResultMeta.fields,
1668
- /**
1669
- * The user action in response to the elicitation.
1670
- * - "accept": User submitted the form/confirmed the action
1671
- * - "decline": User explicitly declined the action
1672
- * - "cancel": User dismissed without making an explicit choice
1673
- */
1674
- action: /* @__PURE__ */ Literals(["cancel", "decline"])
1675
- })) {
1676
- };
1677
- var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
1678
- var Elicit = class extends (/* @__PURE__ */ make2("elicitation/create", {
1679
- success: ElicitResult,
1680
- error: McpError2,
1681
- payload: ElicitRequestParams
1682
- })) {
1683
- };
1684
- var ElicitationDeclined = class extends (/* @__PURE__ */ Error2("@effect/ai/McpSchema/ElicitationDeclined")({
1685
- _tag: /* @__PURE__ */ tag("ElicitationDeclined"),
1686
- request: Elicit.payloadSchema,
1687
- cause: /* @__PURE__ */ optional2(/* @__PURE__ */ Defect())
1688
- })) {
1689
- };
1690
-
1691
- // src/contracts/elicitation.ts
1692
- var ElicitationLimits = Schema_exports.Struct({
1693
- timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1694
- });
1695
- var defaultElicitationLimits = ElicitationLimits.make({ timeoutMs: 15 * 60 * 1e3 });
1696
- var FormElicitation = Schema_exports.Struct({
1697
- ...ElicitRequestFormParams.fields,
1698
- mode: Schema_exports.Literal("form"),
1699
- requestedSchema: Schema_exports.toEncoded(ElicitRequestFormParams.fields.requestedSchema),
1700
- _meta: Schema_exports.optional(JsonObject2)
1701
- });
1702
- var ElicitationResponse = Schema_exports.Union([
1703
- Schema_exports.Struct({ ...ElicitAcceptResult.fields, _meta: Schema_exports.optional(JsonObject2) }),
1704
- Schema_exports.Struct({ ...ElicitDeclineResult.fields, _meta: Schema_exports.optional(JsonObject2) })
1705
- ]);
1706
- var ElicitationFailed = class extends Schema_exports.TaggedError()(
1707
- "ElicitationFailed",
1708
- {
1709
- reason: Schema_exports.Literals([
1710
- "unavailable",
1711
- "transaction",
1712
- "invalid-request",
1713
- "invalid-response",
1714
- "transport",
1715
- "expired",
1716
- "forbidden"
1717
- ])
1718
- }
1719
- ) {
1720
- };
1721
- var ElicitationReply = Schema_exports.Union([
1722
- Schema_exports.Struct({ ok: Schema_exports.Literal(true), response: ElicitationResponse }),
1723
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: ElicitationFailed })
1724
- ]);
1725
- var ApprovalElicitation = Schema_exports.Struct({
1726
- ...FormElicitation.fields,
1727
- requestedSchema: Schema_exports.Struct({
1728
- type: Schema_exports.Literal("object"),
1729
- properties: Schema_exports.Record(Schema_exports.String, Schema_exports.Never)
1730
- })
1731
- });
1732
- var ApprovalResponse = ElicitationResponse.check(
1733
- Schema_exports.makeFilter(
1734
- (response) => response.action !== "accept" || response.content === void 0 || Object.keys(response.content).length === 0
1735
- )
1736
- );
1737
- var approvalElicitation = (toolName, input) => ({
1738
- mode: "form",
1739
- message: `Approve ${toolName}?
1740
-
1741
- Arguments:
1742
- ${JSON.stringify(input, null, 2)}`,
1743
- requestedSchema: { type: "object", properties: {} }
1744
- });
1745
-
1746
- // src/contracts/webhook-protocol.ts
1747
- var WebhookTransportLimits = Schema_exports.Struct({
1748
- maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1749
- });
1750
- var defaultWebhookTransportLimits = WebhookTransportLimits.make({
1751
- maxBodyBytes: 1024 * 1024
1752
- });
1753
- var encodedBodyChars = 4 * Math.ceil(defaultWebhookTransportLimits.maxBodyBytes / 3);
1754
- var WebhookRequestData = Schema_exports.Struct({
1755
- 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))
1759
- });
1760
- var WebhookResponseData = Schema_exports.Struct({
1761
- status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 200, maximum: 599 })),
1762
- headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1763
- body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1764
- });
1765
- var ManualWebhookSetup = Schema_exports.Struct({
1766
- instructions: Schema_exports.NonEmptyString,
1767
- signingSecret: Schema_exports.Literals(["executor", "provider"])
1768
- });
1769
- var ManualWebhookDescriptor = Schema_exports.Struct({
1770
- ...ManualWebhookSetup.fields,
1771
- stateSchema: JsonObject2
1772
- });
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)
1778
- });
1779
- var identity = {
1780
- name: Schema_exports.NonEmptyString,
1781
- subscriptionId: Schema_exports.NonEmptyString,
1782
- sourceAccount: AccountId,
1783
- callbackUrl: HttpUrl,
1784
- secret: Schema_exports.String,
1785
- config: JsonValue
1786
- };
1787
- var WebhookCommand = Schema_exports.Union([
1788
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhooks") }),
1789
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-validate"), ...identity }),
1790
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-complete"), ...identity, state: JsonValue }),
1791
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-register"), ...identity }),
1792
- Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-unregister"), ...identity, state: JsonValue }),
1793
- Schema_exports.Struct({
1794
- operation: Schema_exports.Literal("webhook-handle"),
1795
- ...identity,
1796
- state: JsonValue,
1797
- request: WebhookRequestData
1798
- })
1799
- ]);
1800
-
1801
- // src/contracts/provider.ts
1802
- var SecretsMethod = class extends Data_exports.TaggedClass(
1803
- "secrets"
1804
- ) {
1805
- };
1806
- var OAuthClientAuth = Schema_exports.Literals([
1807
- "none",
1808
- "client_secret_post",
1809
- "client_secret_basic",
1810
- "client_secret_basic_raw"
1811
- ]);
1812
- var OAuthSecretClientAuth = Schema_exports.Literals([
1813
- "client_secret_post",
1814
- "client_secret_basic",
1815
- "client_secret_basic_raw"
1816
- ]);
1817
- var reservedAuthorizationParams = /* @__PURE__ */ new Set([
1818
- "response_type",
1819
- "client_id",
1820
- "redirect_uri",
1821
- "state",
1822
- "scope",
1823
- "code_challenge",
1824
- "code_challenge_method",
1825
- "nonce",
1826
- "resource",
1827
- "request",
1828
- "request_uri"
1829
- ]);
1830
- 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
- )
1837
- );
1838
- var oauthOptions = {
1839
- grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
1840
- authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams),
1841
- tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth),
1842
- /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
1843
- resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1844
- };
1845
- var OAuth2Config = Schema_exports.Union([
1846
- Schema_exports.Struct({
1847
- ...oauthOptions,
1848
- discover: HttpUrl,
1849
- authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1850
- tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1851
- revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1852
- scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
1853
- }),
1854
- Schema_exports.Struct({
1855
- ...oauthOptions,
1856
- authorizationUrl: HttpUrl,
1857
- tokenUrl: HttpUrl,
1858
- revocationUrl: Schema_exports.optionalKey(HttpUrl),
1859
- scopes: Schema_exports.Array(Schema_exports.String),
1860
- /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
1861
- issuer: Schema_exports.optionalKey(HttpUrl),
1862
- discover: Schema_exports.optionalKey(Schema_exports.Never)
1863
- }),
1864
- Schema_exports.Struct({
1865
- grant: Schema_exports.Literal("client_credentials"),
1866
- discover: HttpUrl,
1867
- authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1868
- tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1869
- revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1870
- scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
1871
- tokenEndpointAuthMethod: OAuthSecretClientAuth,
1872
- resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1873
- }),
1874
- Schema_exports.Struct({
1875
- grant: Schema_exports.Literal("client_credentials"),
1876
- tokenUrl: HttpUrl,
1877
- revocationUrl: Schema_exports.optionalKey(HttpUrl),
1878
- scopes: Schema_exports.Array(Schema_exports.String),
1879
- tokenEndpointAuthMethod: OAuthSecretClientAuth,
1880
- resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
1881
- authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1882
- discover: Schema_exports.optionalKey(Schema_exports.Never)
1883
- })
1884
- ]);
1885
- var OAuth2AccessToken = Schema_exports.Struct({ access_token: Schema_exports.String });
1886
- var OAuth2Method = class extends Data_exports.TaggedClass(
1887
- "oauth2"
1888
- ) {
1889
- };
1890
- var displayText = Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(255));
1891
- var AccountInfo = Schema_exports.Struct({
1892
- externalId: Schema_exports.optionalKey(displayText),
1893
- displayName: Schema_exports.optionalKey(displayText),
1894
- username: Schema_exports.optionalKey(displayText),
1895
- email: Schema_exports.optionalKey(displayText),
1896
- avatarUrl: Schema_exports.optionalKey(HttpUrl),
1897
- profileUrl: Schema_exports.optionalKey(HttpUrl)
1898
- });
1899
- var AccountCheckResult = Schema_exports.Struct({ accountInfo: Schema_exports.optionalKey(AccountInfo) });
1900
- var Provider = class extends Data_exports.Class {
1901
- /** Declare zero or more accounts from this provider without performing I/O. */
1902
- many() {
1903
- return new ManyAccounts({ provider: this });
1904
- }
1905
- };
1906
- var ManyAccounts = class extends Data_exports.TaggedClass("many") {
1907
- };
1908
-
1909
- // src/contracts/protocol-version.ts
1910
- var frameworkProtocol = 5;
1911
-
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 })
1920
- ]);
1921
- var CalendarSchedule = Schema_exports.Struct({
1922
- expression: Schema_exports.NonEmptyString,
1923
- timezone: Schema_exports.NonEmptyString
1924
- }).check(
1925
- Schema_exports.makeFilter(
1926
- (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
1927
- )
1928
- );
1929
- var ScheduleTiming = Schema_exports.Union([
1930
- Schema_exports.Struct({
1931
- kind: Schema_exports.Literal("interval"),
1932
- milliseconds: Schema_exports.Int.check(
1933
- Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds, {
1934
- message: "Schedule intervals must be at least 60 seconds"
1935
- }),
1936
- Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
1937
- )
1938
- }),
1939
- Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
1940
- ]);
1941
- var OperationSchedule = Schema_exports.Struct({
1942
- name: Schema_exports.NonEmptyString,
1943
- timing: ScheduleTiming,
1944
- input: JsonValue
1945
- });
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
- }) {
1964
- };
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,
1994
- auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod)
1995
- });
1996
- var DeclaredRequirements = Schema_exports.Struct({
1997
- /** Protocol support of this retained framework build, not an author-declared requirement. */
1998
- capabilities: Schema_exports.optionalKey(
1999
- Schema_exports.Struct({
2000
- skills: Schema_exports.Literal(true),
2001
- /** Accepts inspect detail and tools. Earlier builds reject both as excess fields. */
2002
- toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2003
- /** Accepts skills sources and reports whether the catalog includes a live loader. */
2004
- skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2005
- /** Accepts scheduled inspection. Earlier builds reject it as an excess field. */
2006
- scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
2007
- })
2008
- ),
2009
- database: Schema_exports.optionalKey(DatabaseSchema),
2010
- accounts: Schema_exports.Record(
2011
- Schema_exports.NonEmptyString,
2012
- Schema_exports.Struct({
2013
- definition: DeclaredProvider,
2014
- cardinality: Schema_exports.Literals(["one", "many"])
2015
- })
2016
- )
2017
- });
2018
- var ResolvedAccount = Schema_exports.Struct({
2019
- id: AccountId,
2020
- provider: DeclaredProvider,
2021
- method: Schema_exports.NonEmptyString,
2022
- /**
2023
- * Changes when the account is reconnected or its credentials replaced, not on renewal. Hosts
2024
- * send it since credential generations; `apps@0.0.1-beta.0` and `beta.1` ignore it.
2025
- */
2026
- generation: Schema_exports.optionalKey(Schema_exports.Int),
2027
- fields: JsonObject2
2028
- });
2029
- var ResolvedAccounts = Schema_exports.Record(
2030
- Schema_exports.NonEmptyString,
2031
- Schema_exports.Union([ResolvedAccount, Schema_exports.Array(ResolvedAccount)])
2032
- );
2033
- var TrustedToolApproval = Schema_exports.Struct({ tool: Schema_exports.NonEmptyString, input: JsonValue });
2034
- var InvocationDeadline = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
2035
- var HostedTool = Schema_exports.Struct({
2036
- schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
2037
- name: Schema_exports.NonEmptyString,
2038
- description: Schema_exports.String,
2039
- inputSchema: JsonObject2,
2040
- readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2041
- 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)
2045
- });
2046
- var HostedToolSummary = HostedTool.mapFields(
2047
- ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2048
- );
2049
- var SkillSources = Schema_exports.Struct({ skills: AppSkills, dynamic: Schema_exports.Boolean });
2050
- var SkillCatalogResponse = Schema_exports.Union([SkillSources, AppSkills]);
2051
- var HostRequest = Schema_exports.Union([
2052
- WorkflowCommand,
2053
- WebhookCommand,
2054
- Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
2055
- Schema_exports.Struct({
2056
- operation: Schema_exports.Literal("inspect"),
2057
- /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
2058
- detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
2059
- /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
2060
- tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2061
- /**
2062
- * Describe only declared operations that have schedules, without dynamic tool discovery.
2063
- * Only builds that declare the scheduledTools capability accept this.
2064
- */
2065
- scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
2066
- }),
2067
- Schema_exports.Struct({
2068
- operation: Schema_exports.Literal("skills"),
2069
- /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
2070
- sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
2071
- }),
2072
- Schema_exports.Struct({
2073
- operation: Schema_exports.Literal("query"),
2074
- name: Schema_exports.NonEmptyString,
2075
- input: JsonValue
2076
- }),
2077
- Schema_exports.Struct({
2078
- operation: Schema_exports.Literal("mutate"),
2079
- name: Schema_exports.NonEmptyString,
2080
- input: JsonValue
2081
- }),
2082
- Schema_exports.Struct({
2083
- operation: Schema_exports.Literal("call"),
2084
- tool: Schema_exports.NonEmptyString,
2085
- input: JsonValue
2086
- })
2087
- ]);
2088
- var HostRequestInvalid = class extends Schema_exports.TaggedError()(
2089
- "HostRequestInvalid",
2090
- {}
2091
- ) {
2092
- };
2093
- var HostAccountsInvalid = class extends Schema_exports.TaggedError()(
2094
- "HostAccountsInvalid",
2095
- {}
2096
- ) {
2097
- };
2098
- var HostDeclarationInvalid = class extends Schema_exports.TaggedError()(
2099
- "HostDeclarationInvalid",
2100
- {}
2101
- ) {
2102
- };
2103
- var HostEvaluationFailed = class extends Schema_exports.TaggedError()(
2104
- "HostEvaluationFailed",
2105
- {}
2106
- ) {
2107
- };
2108
- var HostOperationNotFound = class extends Schema_exports.TaggedError()(
2109
- "HostOperationNotFound",
2110
- {}
2111
- ) {
2112
- };
2113
- var HostOperationFailed = class extends Schema_exports.TaggedError()(
2114
- "HostOperationFailed",
2115
- {}
2116
- ) {
2117
- };
2118
- var HostToolNotFound = class extends Schema_exports.TaggedError()(
2119
- "HostToolNotFound",
2120
- {}
2121
- ) {
2122
- };
2123
- var InputProblem = Schema_exports.String.check(Schema_exports.isMaxLength(512));
2124
- var maxInputProblems = 10;
2125
- var HostInputInvalid = class extends Schema_exports.TaggedError()("HostInputInvalid", {
2126
- problems: Schema_exports.optionalKey(
2127
- Schema_exports.Array(InputProblem).check(Schema_exports.isMaxLength(maxInputProblems))
2128
- )
2129
- }) {
2130
- };
2131
- var HostToolBlocked = class extends Schema_exports.TaggedError()("HostToolBlocked", {}) {
2132
- };
2133
- var HostToolApprovalRequired = class extends Schema_exports.TaggedError()(
2134
- "HostToolApprovalRequired",
2135
- { input: JsonValue, elicitation: ApprovalElicitation }
2136
- ) {
2137
- };
2138
- var HostToolPolicyFailed = class extends Schema_exports.TaggedError()(
2139
- "HostToolPolicyFailed",
2140
- {}
2141
- ) {
2142
- };
2143
- var HostOutputInvalid = class extends Schema_exports.TaggedError()(
2144
- "HostOutputInvalid",
2145
- {}
2146
- ) {
2147
- };
2148
- var HostError = Schema_exports.Union([
2149
- OpenapiResponseError,
2150
- ProviderError,
2151
- McpError,
2152
- SkillLoadFailed,
2153
- WorkflowFailure2,
2154
- HostRequestInvalid,
2155
- HostAccountsInvalid,
2156
- HostDeclarationInvalid,
2157
- HostEvaluationFailed,
2158
- HostOperationNotFound,
2159
- HostOperationFailed,
2160
- HostToolNotFound,
2161
- HostInputInvalid,
2162
- HostOutputInvalid,
2163
- HostToolBlocked,
2164
- HostToolApprovalRequired,
2165
- HostToolPolicyFailed,
2166
- ElicitationFailed
2167
- ]);
2168
- var HostResponse = Schema_exports.Union([
2169
- Schema_exports.Struct({
2170
- ok: Schema_exports.Literal(true),
2171
- value: JsonValue,
2172
- toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2173
- }),
2174
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError })
2175
- ]);
2176
- var HostInvocation = Schema_exports.Struct({
2177
- command: HostRequest,
2178
- accounts: ResolvedAccounts,
2179
- approval: Schema_exports.optionalKey(TrustedToolApproval),
2180
- replay: Schema_exports.optionalKey(WorkflowReplay),
2181
- deadline: Schema_exports.optionalKey(InvocationDeadline),
2182
- workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2183
- });
2184
- var protocol1 = {
2185
- version: 1,
2186
- schemas: {
2187
- invocation: HostInvocation,
2188
- request: HostRequest,
2189
- response: HostResponse,
2190
- requirements: DeclaredRequirements,
2191
- tools: Schema_exports.Array(HostedTool),
2192
- toolSummaries: Schema_exports.Array(HostedToolSummary),
2193
- skills: SkillCatalogResponse,
2194
- elicitationRequest: FormElicitation,
2195
- elicitationReply: ElicitationReply,
2196
- workflowStep: WorkflowRpcCommand,
2197
- workflowStepReply: WorkflowRpcResult2,
2198
- workflowControl: WorkflowControlCommand,
2199
- cacheCommand: CacheCommand,
2200
- cacheReply: CacheReply
2201
- }
2202
- };
2203
-
2204
- // src/contracts/protocols/2.ts
2205
- var SkillSources2 = Schema_exports.Struct({
2206
- skills: AppSkills,
2207
- dynamic: Schema_exports.Boolean,
2208
- cached: Schema_exports.optionalKey(Schema_exports.Boolean)
2209
- });
2210
- var SkillCatalogResponse2 = Schema_exports.Union([SkillSources2, AppSkills]);
2211
- var protocol2 = {
2212
- version: 2,
2213
- schemas: { ...protocol1.schemas, skills: SkillCatalogResponse2 }
2214
- };
2215
-
2216
- // src/contracts/protocols/3.ts
2217
- var HostDeclarationInvalid2 = class extends Schema_exports.TaggedError()(
2218
- "HostDeclarationInvalid",
2219
- FailureDetail
2220
- ) {
2221
- };
2222
- var HostEvaluationFailed2 = class extends Schema_exports.TaggedError()(
2223
- "HostEvaluationFailed",
2224
- FailureDetail
2225
- ) {
2226
- };
2227
- var HostOperationFailed2 = class extends Schema_exports.TaggedError()(
2228
- "HostOperationFailed",
2229
- FailureDetail
2230
- ) {
2231
- };
2232
- var HostError2 = Schema_exports.Union([
2233
- OpenapiResponseError,
2234
- ProviderError,
2235
- McpError,
2236
- SkillLoadFailed,
2237
- WorkflowFailure,
2238
- HostRequestInvalid,
2239
- HostAccountsInvalid,
2240
- HostDeclarationInvalid2,
2241
- HostEvaluationFailed2,
2242
- HostOperationNotFound,
2243
- HostOperationFailed2,
2244
- DatabaseLimitExceeded,
2245
- DatabaseFieldReserved,
2246
- HostToolNotFound,
2247
- HostInputInvalid,
2248
- HostOutputInvalid,
2249
- HostToolBlocked,
2250
- HostToolApprovalRequired,
2251
- HostToolPolicyFailed,
2252
- ElicitationFailed
2253
- ]);
2254
- var HostResponse2 = Schema_exports.Union([
2255
- Schema_exports.Struct({
2256
- ok: Schema_exports.Literal(true),
2257
- value: JsonValue,
2258
- toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2259
- }),
2260
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError2 })
2261
- ]);
2262
- var protocol3 = {
2263
- version: 3,
2264
- schemas: {
2265
- invocation: HostInvocation,
2266
- request: HostRequest,
2267
- response: HostResponse2,
2268
- requirements: DeclaredRequirements,
2269
- tools: Schema_exports.Array(HostedTool),
2270
- toolSummaries: Schema_exports.Array(HostedToolSummary),
2271
- skills: SkillCatalogResponse2,
2272
- elicitationRequest: FormElicitation,
2273
- elicitationReply: ElicitationReply,
2274
- workflowStep: WorkflowRpcCommand,
2275
- workflowStepReply: WorkflowRpcResult,
2276
- workflowControl: WorkflowControlCommand,
2277
- cacheCommand: CacheCommand,
2278
- cacheReply: CacheReply
2279
- }
2280
- };
2281
-
2282
- // src/contracts/protocols/4.ts
2283
- var HostedTool2 = Schema_exports.Struct({
2284
- schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
2285
- name: Schema_exports.NonEmptyString,
2286
- router: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
2287
- tags: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2288
- description: Schema_exports.String,
2289
- inputSchema: JsonObject2,
2290
- readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2291
- title: Schema_exports.optionalKey(Schema_exports.String),
2292
- outputSchema: Schema_exports.optionalKey(JsonObject2),
2293
- annotations: Schema_exports.optionalKey(ToolAnnotations),
2294
- _meta: Schema_exports.optionalKey(JsonObject2)
2295
- });
2296
- var HostedToolSummary2 = HostedTool2.mapFields(
2297
- ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2298
- );
2299
- var HostRouterError = Schema_exports.Union([
2300
- ProviderError,
2301
- McpError,
2302
- SkillLoadFailed,
2303
- HostDeclarationInvalid2,
2304
- HostEvaluationFailed2
2305
- ]);
2306
- var HostedRouter = Schema_exports.Struct({
2307
- path: Schema_exports.String,
2308
- title: Schema_exports.optionalKey(Schema_exports.String),
2309
- description: Schema_exports.optionalKey(Schema_exports.String),
2310
- icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
2311
- tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String)),
2312
- skill: Schema_exports.optionalKey(AppSkillName),
2313
- error: Schema_exports.optionalKey(HostRouterError)
2314
- });
2315
- var HostedCatalog = Schema_exports.Struct({
2316
- tools: Schema_exports.Array(HostedTool2),
2317
- routers: Schema_exports.Array(HostedRouter)
2318
- });
2319
- var HostedCatalogSummary = Schema_exports.Struct({
2320
- tools: Schema_exports.Array(HostedToolSummary2),
2321
- routers: Schema_exports.Array(HostedRouter)
2322
- });
2323
- var ToolKind = Schema_exports.Literals(["query", "mutation"]);
2324
- var HostRequest2 = Schema_exports.Union([
2325
- WorkflowCommand,
2326
- WebhookCommand,
2327
- Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
2328
- Schema_exports.Struct({
2329
- operation: Schema_exports.Literal("inspect"),
2330
- /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
2331
- detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
2332
- /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
2333
- tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2334
- /**
2335
- * Describe only declared operations that have schedules, without dynamic tool discovery.
2336
- * Only builds that declare the scheduledTools capability accept this.
2337
- */
2338
- scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
2339
- }),
2340
- Schema_exports.Struct({
2341
- operation: Schema_exports.Literal("skills"),
2342
- /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
2343
- sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
2344
- }),
2345
- Schema_exports.Struct({
2346
- operation: Schema_exports.Literal("query"),
2347
- name: Schema_exports.NonEmptyString,
2348
- input: JsonValue
2349
- }),
2350
- Schema_exports.Struct({
2351
- operation: Schema_exports.Literal("mutate"),
2352
- name: Schema_exports.NonEmptyString,
2353
- input: JsonValue
2354
- }),
2355
- Schema_exports.Struct({
2356
- operation: Schema_exports.Literal("call"),
2357
- tool: Schema_exports.NonEmptyString,
2358
- /**
2359
- * The caller's claim; the bundle rejects a call whose tool has the other kind. The host omits
2360
- * it for a tool its catalog does not list, and then opens storage for writing.
2361
- */
2362
- kind: Schema_exports.optionalKey(ToolKind),
2363
- input: JsonValue
2364
- })
2365
- ]);
2366
- var HostKindMismatch = class extends Schema_exports.TaggedError()("HostKindMismatch", {
2367
- tool: Schema_exports.NonEmptyString,
2368
- requested: ToolKind,
2369
- actual: ToolKind
2370
- }) {
2371
- };
2372
- var HostError3 = Schema_exports.Union([...HostError2.members, HostKindMismatch]);
2373
- var HostResponse3 = Schema_exports.Union([
2374
- Schema_exports.Struct({
2375
- ok: Schema_exports.Literal(true),
2376
- value: JsonValue,
2377
- toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2378
- }),
2379
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError3 })
2380
- ]);
2381
- var HostInvocation2 = Schema_exports.Struct({
2382
- command: HostRequest2,
2383
- accounts: ResolvedAccounts,
2384
- approval: Schema_exports.optionalKey(TrustedToolApproval),
2385
- replay: Schema_exports.optionalKey(WorkflowReplay),
2386
- deadline: Schema_exports.optionalKey(InvocationDeadline),
2387
- workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2388
- });
2389
- var protocol4 = {
2390
- version: 4,
2391
- schemas: {
2392
- invocation: HostInvocation2,
2393
- request: HostRequest2,
2394
- response: HostResponse3,
2395
- requirements: DeclaredRequirements,
2396
- catalog: HostedCatalog,
2397
- catalogSummary: HostedCatalogSummary,
2398
- skills: SkillCatalogResponse2,
2399
- elicitationRequest: FormElicitation,
2400
- elicitationReply: ElicitationReply,
2401
- workflowStep: WorkflowRpcCommand,
2402
- workflowStepReply: WorkflowRpcResult,
2403
- workflowControl: WorkflowControlCommand,
2404
- 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
2458
- }
2459
- };
2460
-
2461
- // src/contracts/host.ts
2462
- var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
2463
- var skillCatalog = (response) => Schema_exports.is(SkillSources2)(response) ? response : { skills: response };
2464
- var inspectCommand = (tools, scheduled) => ({
2465
- operation: "inspect",
2466
- ...tools === void 0 ? {} : { tools: [...tools] },
2467
- ...scheduled === void 0 ? {} : { scheduled }
2468
- });
2469
- var indexCommand = { operation: "inspect", detail: "summary" };
2470
- var selectTools = (tools) => (catalog) => tools === void 0 ? catalog : { ...catalog, tools: catalog.tools.filter((tool) => tools.includes(tool.name)) };
2471
- var HostRequirementsError = Schema_exports.Union([
2472
- HostRequestInvalid,
2473
- HostDeclarationInvalid2,
2474
- DatabaseFieldReserved
2475
- ]);
2476
- var HostInspectError = Schema_exports.Union([
2477
- ProviderError,
2478
- McpError,
2479
- SkillLoadFailed,
2480
- HostRequestInvalid,
2481
- HostDeclarationInvalid2,
2482
- HostAccountsInvalid,
2483
- HostEvaluationFailed2
2484
- ]);
2485
- var HostCallError = Schema_exports.Union([
2486
- OpenapiResponseError,
2487
- WorkflowFailure,
2488
- HostInspectError,
2489
- HostToolNotFound,
2490
- HostOperationNotFound,
2491
- HostKindMismatch,
2492
- HostOperationFailed2,
2493
- DatabaseLimitExceeded,
2494
- HostInputInvalid,
2495
- HostOutputInvalid,
2496
- HostToolBlocked,
2497
- HostToolApprovalRequired,
2498
- HostToolPolicyFailed,
2499
- ElicitationFailed
2500
- ]);
2501
- var HostAccountCheckError = Schema_exports.Union([
2502
- ProviderError,
2503
- WorkflowFailure,
2504
- HostRequestInvalid,
2505
- HostDeclarationInvalid2,
2506
- HostAccountsInvalid,
2507
- HostOperationNotFound,
2508
- HostOperationFailed2,
2509
- HostOutputInvalid
2510
- ]);
2511
- var HostDataError = HostCallError;
2512
- var ToolResultObservation = Context_exports.Reference(
2513
- "apps/ToolResultObservation",
2514
- { defaultValue: () => ({ failed: () => {
2515
- } }) }
2516
- );
2517
-
2518
- export {
2519
- SecretsMethod,
2520
- OAuthClientAuth,
2521
- OAuthSecretClientAuth,
2522
- OAuth2Config,
2523
- OAuth2AccessToken,
2524
- OAuth2Method,
2525
- AccountInfo,
2526
- AccountCheckResult,
2527
- Provider,
2528
- 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,
2543
- ApiErrorRecovery,
2544
- ApiErrorResponse,
2545
- OpenapiResponseError,
2546
- defaultOpenapiErrorLimits,
2547
- maxFailureMessageLength,
2548
- FailureSource,
2549
- FailureName,
2550
- FailureCode,
2551
- FailureMessage,
2552
- FailureDetail,
2553
- WorkflowRunId,
2554
- WorkflowName,
2555
- workflowDurationMillis,
2556
- WorkflowDuration,
2557
- WorkflowStepOptions,
2558
- WorkflowFailureDetail,
2559
- WorkflowRunFailure,
2560
- WorkflowFailure,
2561
- NonRetryableError,
2562
- WorkflowValue,
2563
- HostedWorkflow,
2564
- WorkflowRun,
2565
- WorkflowRunPage,
2566
- WorkflowReplay,
2567
- WorkflowCommand,
2568
- WorkflowRpcCommand,
2569
- WorkflowRpcResult,
2570
- WorkflowControlCommand,
2571
- ElicitationLimits,
2572
- defaultElicitationLimits,
2573
- FormElicitation,
2574
- ElicitationResponse,
2575
- ElicitationFailed,
2576
- ElicitationReply,
2577
- ApprovalElicitation,
2578
- ApprovalResponse,
2579
- approvalElicitation,
2580
- WebhookTransportLimits,
2581
- defaultWebhookTransportLimits,
2582
- WebhookRequestData,
2583
- WebhookResponseData,
2584
- ManualWebhookSetup,
2585
- ManualWebhookDescriptor,
2586
- HostedWebhook,
2587
- WebhookCommand,
2588
- 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
- protocol1,
2612
- SkillSources2 as SkillSources,
2613
- SkillCatalogResponse2 as SkillCatalogResponse,
2614
- protocol2,
2615
- HostDeclarationInvalid2 as HostDeclarationInvalid,
2616
- HostEvaluationFailed2 as HostEvaluationFailed,
2617
- HostOperationFailed2 as HostOperationFailed,
2618
- 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
- protocol4,
2629
- DeclaredRequirements2 as DeclaredRequirements,
2630
- AccountCheckCommand,
2631
- HostRequest3 as HostRequest,
2632
- HostInvocation3 as HostInvocation,
2633
- protocol5,
2634
- skillsCommand,
2635
- skillCatalog,
2636
- inspectCommand,
2637
- indexCommand,
2638
- selectTools,
2639
- HostRequirementsError,
2640
- HostInspectError,
2641
- HostCallError,
2642
- HostAccountCheckError,
2643
- HostDataError,
2644
- ToolResultObservation
2645
- };