apps 0.0.1-beta.5 → 0.0.1-beta.55

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