apps 0.0.1-beta.4 → 0.0.1-beta.40

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 (171) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
  4. package/js/chunk-4TLZGG4B.js +729 -0
  5. package/js/chunk-6KABJTDO.js +255 -0
  6. package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
  7. package/js/{chunk-EQB7JMAL.js → chunk-DHX2OI2X.js} +146 -31
  8. package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
  9. package/js/chunk-EM4UL26F.js +118 -0
  10. package/js/{chunk-WFSQXYUT.js → chunk-GHXRRFZA.js} +418 -52
  11. package/js/{chunk-5MQZEB6Y.js → chunk-KANDIVIH.js} +40 -12
  12. package/js/chunk-KAQD3DTI.js +16 -0
  13. package/js/chunk-KIM5HXNK.js +49 -0
  14. package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
  15. package/js/{chunk-2VPJHFOU.js → chunk-MYF7KWUB.js} +128 -24
  16. package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
  17. package/js/chunk-OD3KFKZD.js +1617 -0
  18. package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
  19. package/js/chunk-P7MGDPFD.js +240 -0
  20. package/js/chunk-PDS2E2OZ.js +42 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
  22. package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
  23. package/js/{chunk-6VRYO2BG.js → chunk-SALJXSS3.js} +779 -251
  24. package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
  25. package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
  26. package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
  27. package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
  28. package/js/chunk-XDGUGB2A.js +156 -0
  29. package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
  30. package/js/chunk-ZUKBIHMK.js +92 -0
  31. package/js/client.js +122 -88
  32. package/js/contracts.js +116 -25
  33. package/js/effect.js +19 -20
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +57 -55
  36. package/js/host.js +19 -20
  37. package/js/index.js +245 -212
  38. package/js/mcp/effect.js +23 -22
  39. package/js/mcp/stdio.js +34 -30
  40. package/js/mcp.js +104 -68
  41. package/js/openapi.js +4087 -1503
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +147 -65
  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-data/src/contracts/database.d.ts +33 -6
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +7 -8
  55. package/types/apps/src/contracts/cache.d.ts +14 -0
  56. package/types/apps/src/contracts/context.d.ts +12 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +44 -17
  61. package/types/apps/src/contracts/live.d.ts +2 -0
  62. package/types/apps/src/contracts/mcp.d.ts +96 -10
  63. package/types/apps/src/contracts/network.d.ts +84 -0
  64. package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
  65. package/types/apps/src/contracts/openapi.d.ts +45 -9
  66. package/types/apps/src/contracts/operations.d.ts +8 -9
  67. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  68. package/types/apps/src/contracts/protocols/1.d.ts +263 -74
  69. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  70. package/types/apps/src/contracts/protocols/2.d.ts +66 -24
  71. package/types/apps/src/contracts/protocols/3.d.ts +715 -0
  72. package/types/apps/src/contracts/protocols/4.d.ts +1297 -0
  73. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  74. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  75. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  76. package/types/apps/src/contracts/protocols/8.d.ts +1130 -0
  77. package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
  78. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  79. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  80. package/types/apps/src/contracts/provider.d.ts +115 -10
  81. package/types/apps/src/contracts/router.d.ts +59 -0
  82. package/types/apps/src/contracts/skills.d.ts +39 -9
  83. package/types/apps/src/contracts/sql.d.ts +58 -0
  84. package/types/apps/src/contracts/ui.d.ts +19 -1
  85. package/types/apps/src/contracts/workflows.d.ts +40 -3
  86. package/types/apps/src/facet.d.ts +4 -5
  87. package/types/apps/src/graphql.d.ts +1 -3
  88. package/types/apps/src/implementation/account-router.d.ts +12 -0
  89. package/types/apps/src/implementation/app.d.ts +5 -4
  90. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  91. package/types/apps/src/implementation/catalog-cache.d.ts +32 -5
  92. package/types/apps/src/implementation/elicitation.d.ts +9 -9
  93. package/types/apps/src/implementation/failure-detail.d.ts +47 -0
  94. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  95. package/types/apps/src/implementation/graphql.d.ts +4 -3
  96. package/types/apps/src/implementation/input-problems.d.ts +4 -1
  97. package/types/apps/src/implementation/live.d.ts +2 -2
  98. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  99. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  100. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  101. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  102. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  103. package/types/apps/src/implementation/mcp.d.ts +52 -25
  104. package/types/apps/src/implementation/network.d.ts +16 -0
  105. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  106. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  107. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  108. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  109. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  110. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  111. package/types/apps/src/implementation/operations.d.ts +36 -3
  112. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  113. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  114. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  115. package/types/apps/src/implementation/provider.d.ts +19 -5
  116. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  117. package/types/apps/src/implementation/router-catalog.d.ts +223 -0
  118. package/types/apps/src/implementation/router.d.ts +68 -0
  119. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  120. package/types/apps/src/implementation/schema.d.ts +86 -11
  121. package/types/apps/src/implementation/skills.d.ts +18 -24
  122. package/types/apps/src/implementation/sql.d.ts +66 -0
  123. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  125. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  126. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  127. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  128. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  129. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  130. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  131. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  132. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  133. package/types/apps/src/index.d.ts +30 -13
  134. package/types/apps/src/mcp-stdio.d.ts +2 -5
  135. package/types/apps/src/mcp.d.ts +25 -5
  136. package/types/apps/src/openapi.d.ts +6 -6
  137. package/types/apps/src/react.d.ts +1 -1
  138. package/types/apps/src/skills.d.ts +10 -8
  139. package/types/telemetry/src/app-records.d.ts +42 -0
  140. package/types/telemetry/src/browser-operations.d.ts +6 -3
  141. package/types/telemetry/src/browser.d.ts +2 -2
  142. package/types/telemetry/src/config.d.ts +2 -2
  143. package/types/telemetry/src/layer.d.ts +2 -2
  144. package/types/telemetry/src/recorded-failure.d.ts +20 -0
  145. package/types/telemetry/src/relay.d.ts +2 -2
  146. package/types/telemetry/src/transport.d.ts +8 -1
  147. package/types/utils/src/api-error.d.ts +53 -0
  148. package/types/utils/src/recorded-message.d.ts +15 -0
  149. package/js/chunk-BMOIAIVR.js +0 -138
  150. package/js/chunk-DHUDODG5.js +0 -213
  151. package/js/chunk-FZJOYIZO.js +0 -19
  152. package/js/chunk-LGIYBDWA.js +0 -85
  153. package/js/chunk-M6ZRRIBI.js +0 -877
  154. package/js/chunk-PLCMJREA.js +0 -590
  155. package/js/chunk-PYUYJRSK.js +0 -93
  156. package/js/chunk-SWPD52J7.js +0 -35
  157. package/js/chunk-W7D7WVSY.js +0 -18
  158. package/js/chunk-Z5NMEGJN.js +0 -29
  159. package/js/chunk-ZJWDMTE3.js +0 -63
  160. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  161. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  162. package/types/app-data/src/implementation/promise.d.ts +0 -68
  163. package/types/app-data/src/implementation/range.d.ts +0 -8
  164. package/types/app-data/src/implementation/schema.d.ts +0 -33
  165. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  166. package/types/app-data/src/index.d.ts +0 -4
  167. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  168. package/types/apps/src/contracts/storage.d.ts +0 -68
  169. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  170. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  171. package/types/apps/src/implementation/storage.d.ts +0 -13
@@ -1,26 +1,27 @@
1
- import {
2
- DatabaseSchema
3
- } from "./chunk-BMOIAIVR.js";
4
1
  import {
5
2
  CacheCommand,
6
- CacheReply
7
- } from "./chunk-LGIYBDWA.js";
8
- import {
9
- AppSkills,
10
- SkillLoadFailed
11
- } from "./chunk-YEJOQEII.js";
3
+ CacheReply,
4
+ FailureCode,
5
+ FailureDetail,
6
+ FailureMessage,
7
+ FailureName,
8
+ FailureSource,
9
+ ProviderError,
10
+ UpstreamError
11
+ } from "./chunk-P7MGDPFD.js";
12
12
  import {
13
- OpenapiResponseError
14
- } from "./chunk-SWPD52J7.js";
13
+ AppSkillName,
14
+ AppSkills
15
+ } from "./chunk-UOZMSUJ2.js";
15
16
  import {
16
- ProviderError
17
- } from "./chunk-W7D7WVSY.js";
17
+ RecordedMessage
18
+ } from "./chunk-KAQD3DTI.js";
18
19
  import {
19
20
  AccountId,
20
21
  HttpUrl,
21
22
  JsonObject as JsonObject2,
22
23
  JsonValue
23
- } from "./chunk-SATWJKN6.js";
24
+ } from "./chunk-YQ35E7KS.js";
24
25
  import {
25
26
  Any,
26
27
  ArraySchema,
@@ -56,13 +57,13 @@ import {
56
57
  declare,
57
58
  decode,
58
59
  decodeTo,
59
- empty2 as empty,
60
+ empty,
60
61
  flatMap,
61
62
  fromUndefinedOr,
62
63
  isBetween,
63
64
  isSchema,
64
65
  isStream,
65
- make6 as make,
66
+ make2 as make,
66
67
  merge,
67
68
  optional,
68
69
  optionalKey,
@@ -71,83 +72,37 @@ import {
71
72
  symbol3 as symbol,
72
73
  sync2 as sync,
73
74
  tag,
75
+ toType,
74
76
  transformOptional,
75
77
  withConstructorDefault,
76
78
  withDefault
77
- } from "./chunk-FW5HBOIK.js";
78
-
79
- // src/contracts/tools.ts
80
- var ToolAnnotations = Schema_exports.Struct({
81
- title: Schema_exports.optionalKey(Schema_exports.String),
82
- readOnlyHint: Schema_exports.optionalKey(Schema_exports.Boolean),
83
- destructiveHint: Schema_exports.optionalKey(Schema_exports.Boolean),
84
- idempotentHint: Schema_exports.optionalKey(Schema_exports.Boolean),
85
- openWorldHint: Schema_exports.optionalKey(Schema_exports.Boolean)
86
- });
79
+ } from "./chunk-MXDKXAY4.js";
87
80
 
88
- // src/contracts/mcp.ts
89
- var McpClientLimits = Schema_exports.Struct({
90
- timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
91
- maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
92
- maxTools: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
93
- maxPaginationCursors: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
94
- cleanupTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
95
- });
96
- var defaultMcpClientLimits = McpClientLimits.make({
97
- timeoutMs: 3e4,
98
- maxTimeoutMs: 3e5,
99
- maxTools: 5e4,
100
- maxPaginationCursors: 1e3,
101
- cleanupTimeoutMs: 1e3
102
- });
103
- var mcpSdkTimerCeilingMs = 2147483647;
104
- var McpToolsOptions = Schema_exports.Struct({
105
- url: HttpUrl,
106
- accountId: Schema_exports.optional(AccountId),
107
- headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
108
- signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
109
- timeoutMs: Schema_exports.optional(
110
- Schema_exports.Number.check(
111
- Schema_exports.isInt(),
112
- Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
113
- )
114
- )
115
- });
116
- var McpToolResult = Schema_exports.Struct({
117
- content: Schema_exports.Array(JsonObject2),
118
- structuredContent: Schema_exports.optional(JsonObject2),
119
- isError: Schema_exports.optional(Schema_exports.Boolean),
120
- _meta: Schema_exports.optional(JsonObject2)
81
+ // src/contracts/api-response-error.ts
82
+ var maxApiErrorInstructionsLength = 4096;
83
+ var ApiErrorRecovery = Schema_exports.Struct({
84
+ action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
85
+ instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(maxApiErrorInstructionsLength))
121
86
  });
122
- var McpToolMetadata = Schema_exports.Struct({
123
- name: Schema_exports.String,
124
- title: Schema_exports.optional(Schema_exports.String),
125
- description: Schema_exports.optional(Schema_exports.String),
126
- inputSchema: JsonObject2,
127
- outputSchema: Schema_exports.optional(JsonObject2),
128
- annotations: Schema_exports.optional(ToolAnnotations),
129
- _meta: Schema_exports.optional(JsonObject2)
87
+ var maxApiErrorMessageLength = 4096;
88
+ var ApiErrorResponse = Schema_exports.Struct({
89
+ code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
90
+ status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
91
+ message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(maxApiErrorMessageLength)),
92
+ recovery: Schema_exports.optionalKey(ApiErrorRecovery)
130
93
  });
131
- var McpError = class extends Schema_exports.TaggedError()("McpError", {
132
- phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
133
- reason: Schema_exports.Literals([
134
- "request",
135
- "unauthorized",
136
- "invalid_response",
137
- "timeout",
138
- "invalid_input"
139
- ]),
140
- status: Schema_exports.optional(Schema_exports.Number)
141
- }) {
94
+ var OpenapiResponseError = class extends Schema_exports.TaggedError()(
95
+ "OpenapiResponseError",
96
+ ApiErrorResponse.fields
97
+ ) {
142
98
  };
143
- var ProcessConfig = Schema_exports.Struct({
144
- command: Schema_exports.NonEmptyString,
145
- args: Schema_exports.Array(Schema_exports.String),
146
- cwd: Schema_exports.optional(Schema_exports.String),
147
- env: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
148
- timeoutMs: Schema_exports.Int.check(
149
- Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
150
- )
99
+ var OpenapiErrorLimits = Schema_exports.Struct({
100
+ maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
101
+ readTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
102
+ });
103
+ var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
104
+ maxBodyBytes: 65536,
105
+ readTimeoutMs: 2e3
151
106
  });
152
107
 
153
108
  // src/contracts/workflows.ts
@@ -191,7 +146,14 @@ var WorkflowStepOptions = Schema_exports.Struct({
191
146
  ),
192
147
  timeout: Schema_exports.optionalKey(WorkflowDuration)
193
148
  });
149
+ var WorkflowFailureDetail = {
150
+ step: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMaxLength(200))),
151
+ errorName: Schema_exports.optionalKey(FailureName),
152
+ message: Schema_exports.optionalKey(FailureMessage)
153
+ };
154
+ var WorkflowRunFailure = Schema_exports.Struct(WorkflowFailureDetail);
194
155
  var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailure", {
156
+ ...WorkflowFailureDetail,
195
157
  reason: Schema_exports.Literals([
196
158
  "unavailable",
197
159
  "not_found",
@@ -207,6 +169,13 @@ var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailur
207
169
  ]),
208
170
  retryable: Schema_exports.Boolean
209
171
  }) {
172
+ /**
173
+ * The step name and error detail are the app's. Its run's owner reads them; telemetry records
174
+ * only the reason, however the failure was built or decoded.
175
+ */
176
+ get [RecordedMessage]() {
177
+ return this.step === void 0 && this.errorName === void 0 && !this.message ? void 0 : `The workflow failed (${this.reason}); the app's error is not recorded`;
178
+ }
210
179
  };
211
180
  var NonRetryableError = class extends Error {
212
181
  name = "NonRetryableError";
@@ -239,7 +208,9 @@ var WorkflowRun = Schema_exports.Union([
239
208
  Schema_exports.Struct({
240
209
  ...runFields,
241
210
  status: Schema_exports.Literal("errored"),
242
- error: WorkflowFailure.fields.reason
211
+ error: WorkflowFailure.fields.reason,
212
+ /** The failing step and the app's own error, when the run recorded them. */
213
+ failure: Schema_exports.optionalKey(WorkflowRunFailure)
243
214
  }),
244
215
  Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("terminated") })
245
216
  ]);
@@ -311,7 +282,178 @@ var WorkflowControlCommand = Schema_exports.Union([
311
282
  Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
312
283
  ]);
313
284
 
314
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/RpcSchema.js
285
+ // ../app-data/src/contracts/database.ts
286
+ var DataName = Schema_exports.String.check(
287
+ Schema_exports.makeFilter((value) => /^[A-Za-z][A-Za-z0-9_]*$/.test(value) && value.length <= 128)
288
+ );
289
+ var Scalar = Schema_exports.Union([Schema_exports.String, Schema_exports.Finite, Schema_exports.Boolean]);
290
+ var Field = Schema_exports.Struct({
291
+ kind: Schema_exports.Literals(["string", "number", "boolean", "id", "userId"]),
292
+ optional: Schema_exports.optional(Schema_exports.Boolean),
293
+ default: Schema_exports.optional(Scalar),
294
+ references: Schema_exports.optional(DataName)
295
+ });
296
+ var Index = Schema_exports.Struct({ name: DataName, fields: Schema_exports.NonEmptyArray(DataName) });
297
+ var Table = Schema_exports.Struct({
298
+ fields: Schema_exports.Record(DataName, Field),
299
+ indexes: Schema_exports.Array(Index)
300
+ });
301
+ var DatabaseSchema = Schema_exports.Record(DataName, Table);
302
+ var Row = Schema_exports.Record(Schema_exports.String, Scalar);
303
+ var RowMetadata = Schema_exports.Struct({
304
+ id: Schema_exports.NonEmptyString,
305
+ createdAt: Schema_exports.String,
306
+ updatedAt: Schema_exports.String
307
+ });
308
+ var Patch = Schema_exports.Record(DataName, Schema_exports.NullOr(Scalar));
309
+ var RangeClause = Schema_exports.Struct({
310
+ field: DataName,
311
+ op: Schema_exports.Literals(["eq", "gt", "gte", "lt", "lte"]),
312
+ value: Schema_exports.NullOr(Scalar)
313
+ });
314
+ var QueryPlan = Schema_exports.Struct({
315
+ table: DataName,
316
+ index: DataName,
317
+ order: Schema_exports.Literals(["asc", "desc"]),
318
+ clauses: Schema_exports.Array(RangeClause)
319
+ });
320
+ var QueryTerminal = Schema_exports.Union([
321
+ Schema_exports.Struct({ kind: Schema_exports.Literal("collect") }),
322
+ Schema_exports.Struct({ kind: Schema_exports.Literal("count") }),
323
+ Schema_exports.Struct({ kind: Schema_exports.Literal("first") }),
324
+ Schema_exports.Struct({
325
+ kind: Schema_exports.Literal("take"),
326
+ count: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0))
327
+ }),
328
+ Schema_exports.Struct({
329
+ kind: Schema_exports.Literal("paginate"),
330
+ cursor: Schema_exports.NullOr(Schema_exports.String),
331
+ numItems: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
332
+ })
333
+ ]);
334
+ var DatabaseOperation = Schema_exports.Union([
335
+ Schema_exports.Struct({ kind: Schema_exports.Literal("get"), table: DataName, id: Schema_exports.NonEmptyString }),
336
+ Schema_exports.Struct({ kind: Schema_exports.Literal("insert"), table: DataName, value: Patch }),
337
+ Schema_exports.Struct({
338
+ kind: Schema_exports.Literal("update"),
339
+ table: DataName,
340
+ id: Schema_exports.NonEmptyString,
341
+ patch: Patch
342
+ }),
343
+ Schema_exports.Struct({ kind: Schema_exports.Literal("delete"), table: DataName, id: Schema_exports.NonEmptyString }),
344
+ Schema_exports.Struct({ kind: Schema_exports.Literal("query"), plan: QueryPlan, terminal: QueryTerminal })
345
+ ]);
346
+ var PaginationResult = Schema_exports.Struct({
347
+ page: Schema_exports.Array(Row),
348
+ continueCursor: Schema_exports.NullOr(Schema_exports.String),
349
+ isDone: Schema_exports.Boolean
350
+ });
351
+ var OperationResult = Schema_exports.Union([
352
+ Row,
353
+ Schema_exports.Array(Row),
354
+ PaginationResult,
355
+ Schema_exports.Boolean,
356
+ Schema_exports.Finite,
357
+ Schema_exports.Null
358
+ ]);
359
+ var AppDatabaseError = class extends Schema_exports.TaggedError()("AppDatabaseError", {
360
+ reason: Schema_exports.Literals([
361
+ "schema",
362
+ "schema_changed",
363
+ "table",
364
+ "index",
365
+ "range",
366
+ "value",
367
+ "readonly",
368
+ "cursor",
369
+ "limit",
370
+ "closed",
371
+ "storage",
372
+ "replay"
373
+ ])
374
+ }) {
375
+ };
376
+ var DatabaseLimits = Schema_exports.Struct({
377
+ rowsRead: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
378
+ rowsReturned: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
379
+ bytesRead: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
380
+ writes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
381
+ scanCalls: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
382
+ directGets: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
383
+ valueBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
384
+ indexBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
385
+ });
386
+ var defaultDatabaseLimits = {
387
+ rowsRead: 5e3,
388
+ rowsReturned: 1e3,
389
+ bytesRead: 4 * 1024 * 1024,
390
+ writes: 1e3,
391
+ scanCalls: 100,
392
+ directGets: 1e3,
393
+ valueBytes: 64 * 1024,
394
+ indexBytes: 2048
395
+ };
396
+ var DatabaseLimit = Schema_exports.Literals([
397
+ "scanCalls",
398
+ "directGets",
399
+ "rowsRead",
400
+ "rowsReturned",
401
+ "pageSize",
402
+ "bytesRead",
403
+ "writes",
404
+ "valueBytes"
405
+ ]);
406
+ var count = (value) => value.toLocaleString("en-US");
407
+ var limitMessages = {
408
+ scanCalls: (maximum, requested) => `This invocation made ${count(requested)} index queries; the limit is ${count(maximum)}. Each first(), take(), collect(), count() or paginate() call on withIndex(...) counts once. Read related rows with one take() or paginate() over a shared index prefix instead of one first() per item, use get(id) for known IDs, or split the work across workflow steps.`,
409
+ directGets: (maximum, requested) => `This invocation made ${count(requested)} get(id) calls, including those made by update and delete; the limit is ${count(maximum)}. Split the work across workflow steps or mutations.`,
410
+ rowsRead: (maximum, requested) => `This invocation read ${count(requested)} rows; the limit is ${count(maximum)}. Read fewer rows per call, through an index or a LIMIT, or split the work across calls or workflow steps.`,
411
+ rowsReturned: (maximum, requested) => `This invocation returned ${count(requested)} rows; the limit is ${count(maximum)}. collect() fails rather than truncating. Page with paginate() across calls or workflow steps.`,
412
+ pageSize: (maximum, requested) => `One call asked for ${count(requested)} rows; take(n) and paginate({ numItems }) accept at most ${count(maximum)}. Page with paginate() across calls or workflow steps.`,
413
+ bytesRead: (maximum, requested) => `This invocation read ${count(requested)} bytes; the limit is ${count(maximum)}. Read fewer or smaller rows per call, or page with paginate() across calls or workflow steps.`,
414
+ writes: (maximum, requested) => `This invocation wrote ${count(requested)} rows; the limit is ${count(maximum)}. Split large ingests into batches, one batch per mutation or workflow step.`,
415
+ valueBytes: (maximum, requested) => `A row encodes to ${count(requested)} bytes; each row may use at most ${count(maximum)}. Store large content outside the row or split it across rows.`
416
+ };
417
+ var DatabaseLimitExceeded = class extends Schema_exports.TaggedError()(
418
+ "DatabaseLimitExceeded",
419
+ {
420
+ limit: DatabaseLimit,
421
+ maximum: Schema_exports.Int,
422
+ requested: Schema_exports.Int
423
+ }
424
+ ) {
425
+ get message() {
426
+ return limitMessages[this.limit](this.maximum, this.requested);
427
+ }
428
+ };
429
+ var reservedFieldNames = ["id", "createdAt", "updatedAt"];
430
+ var DatabaseFieldReserved = class extends Schema_exports.TaggedError()(
431
+ "DatabaseFieldReserved",
432
+ {
433
+ table: Schema_exports.String,
434
+ field: Schema_exports.Literals(reservedFieldNames)
435
+ }
436
+ ) {
437
+ get message() {
438
+ return `Table "${this.table}" declares "${this.field}", which is reserved: the host adds id, createdAt and updatedAt to every row. Rename the field, or use the row's own ${this.field}.`;
439
+ }
440
+ };
441
+ var DatabaseRuntimeLimits = Schema_exports.Struct({
442
+ maxCursorChars: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
443
+ connectionCacheCapacity: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
444
+ connectionCacheTtlMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
445
+ });
446
+ var defaultDatabaseRuntimeLimits = DatabaseRuntimeLimits.make({
447
+ maxCursorChars: 8192,
448
+ connectionCacheCapacity: 64,
449
+ connectionCacheTtlMs: 5 * 60 * 1e3
450
+ });
451
+
452
+ // src/contracts/sql.ts
453
+ var reservedTablePrefix = "_executor_";
454
+ var migrationsDirectory = "migrations";
455
+
456
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/rpc/RpcSchema.js
315
457
  var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
316
458
  var schema = /* @__PURE__ */ declare(isStream);
317
459
  function Stream(success, error) {
@@ -322,7 +464,7 @@ function Stream(success, error) {
322
464
  });
323
465
  }
324
466
 
325
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/Rpc.js
467
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/rpc/Rpc.js
326
468
  var TypeId = "~effect/rpc/Rpc";
327
469
  var Proto = {
328
470
  [TypeId]: TypeId,
@@ -440,7 +582,7 @@ var make2 = (tag2, options) => {
440
582
  });
441
583
  };
442
584
 
443
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/ai/McpSchema.js
585
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/ai/McpSchema.js
444
586
  var optionalWithDefault = (schema2, defaultValue) => {
445
587
  const effect = sync(defaultValue);
446
588
  return optionalKey(schema2).pipe(decode({
@@ -448,7 +590,7 @@ var optionalWithDefault = (schema2, defaultValue) => {
448
590
  encode: passthrough()
449
591
  }), withConstructorDefault(effect));
450
592
  };
451
- var optional2 = (schema2) => optionalKey(schema2).pipe(decodeTo(optional(schema2), {
593
+ var optional2 = (schema2) => optionalKey(schema2).pipe(decodeTo(toType(optional(schema2)), {
452
594
  decode: passthrough(),
453
595
  encode: transformOptional(flatMap(fromUndefinedOr))
454
596
  }));
@@ -710,7 +852,7 @@ var InternalError = class _InternalError extends (/* @__PURE__ */ Error2("effect
710
852
  message: "Not implemented"
711
853
  });
712
854
  };
713
- var McpError2 = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
855
+ var McpError = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
714
856
  var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
715
857
  ...ResultMeta.fields,
716
858
  /**
@@ -733,7 +875,7 @@ var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ S
733
875
  };
734
876
  var Initialize = class extends (/* @__PURE__ */ make2("initialize", {
735
877
  success: InitializeResult,
736
- error: McpError2,
878
+ error: McpError,
737
879
  payload: {
738
880
  ...RequestMeta.fields,
739
881
  /**
@@ -932,7 +1074,7 @@ var ReadResourceResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */
932
1074
  };
933
1075
  var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
934
1076
  success: ReadResourceResult,
935
- error: McpError2,
1077
+ error: McpError,
936
1078
  payload: {
937
1079
  ...RequestMeta.fields,
938
1080
  /**
@@ -945,7 +1087,7 @@ var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
945
1087
  };
946
1088
  var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
947
1089
  success: /* @__PURE__ */ Struct({}),
948
- error: McpError2,
1090
+ error: McpError,
949
1091
  payload: {
950
1092
  ...RequestMeta.fields,
951
1093
  /**
@@ -958,7 +1100,7 @@ var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
958
1100
  };
959
1101
  var Unsubscribe = class extends (/* @__PURE__ */ make2("resources/unsubscribe", {
960
1102
  success: /* @__PURE__ */ Struct({}),
961
- error: McpError2,
1103
+ error: McpError,
962
1104
  payload: {
963
1105
  ...RequestMeta.fields,
964
1106
  /**
@@ -1102,7 +1244,7 @@ var GetPromptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema
1102
1244
  };
1103
1245
  var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
1104
1246
  success: GetPromptResult,
1105
- error: McpError2,
1247
+ error: McpError,
1106
1248
  payload: {
1107
1249
  ...RequestMeta.fields,
1108
1250
  /**
@@ -1117,7 +1259,7 @@ var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
1117
1259
  }
1118
1260
  })) {
1119
1261
  };
1120
- var ToolAnnotations2 = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1262
+ var ToolAnnotations = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1121
1263
  /**
1122
1264
  * A human-readable title for the tool.
1123
1265
  */
@@ -1186,7 +1328,7 @@ var Tool = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Tool")({
1186
1328
  /**
1187
1329
  * Optional additional tool information.
1188
1330
  */
1189
- annotations: /* @__PURE__ */ optional2(ToolAnnotations2),
1331
+ annotations: /* @__PURE__ */ optional2(ToolAnnotations),
1190
1332
  /**
1191
1333
  * Icons that clients can display for this tool.
1192
1334
  */
@@ -1222,7 +1364,7 @@ var CallToolResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/
1222
1364
  };
1223
1365
  var CallTool = class extends (/* @__PURE__ */ make2("tools/call", {
1224
1366
  success: CallToolResult,
1225
- error: McpError2,
1367
+ error: McpError,
1226
1368
  payload: {
1227
1369
  ...RequestMeta.fields,
1228
1370
  name: String,
@@ -1242,7 +1384,7 @@ var SetLevel = class extends (/* @__PURE__ */ make2("logging/setLevel", {
1242
1384
  level: LoggingLevel
1243
1385
  },
1244
1386
  success: /* @__PURE__ */ Struct({}),
1245
- error: McpError2
1387
+ error: McpError
1246
1388
  })) {
1247
1389
  };
1248
1390
  var LoggingMessageNotification = class extends (/* @__PURE__ */ make2("notifications/message", {
@@ -1388,7 +1530,7 @@ var CreateMessageResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1388
1530
  };
1389
1531
  var CreateMessage = class extends (/* @__PURE__ */ make2("sampling/createMessage", {
1390
1532
  success: CreateMessageResult,
1391
- error: McpError2,
1533
+ error: McpError,
1392
1534
  payload: {
1393
1535
  messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
1394
1536
  /**
@@ -1451,6 +1593,7 @@ var CompleteResult = class _CompleteResult extends (/* @__PURE__ */ Opaque()(/*
1451
1593
  /**
1452
1594
  * Empty completion result used when a completion request has no values.
1453
1595
  *
1596
+ * @stability unstable
1454
1597
  * @since 4.0.0
1455
1598
  */
1456
1599
  static empty = /* @__PURE__ */ _CompleteResult.make({
@@ -1599,7 +1742,7 @@ var ElicitDeclineResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1599
1742
  var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
1600
1743
  var Elicit = class extends (/* @__PURE__ */ make2("elicitation/create", {
1601
1744
  success: ElicitResult,
1602
- error: McpError2,
1745
+ error: McpError,
1603
1746
  payload: ElicitRequestParams
1604
1747
  })) {
1605
1748
  };
@@ -1665,6 +1808,126 @@ ${JSON.stringify(input, null, 2)}`,
1665
1808
  requestedSchema: { type: "object", properties: {} }
1666
1809
  });
1667
1810
 
1811
+ // src/contracts/router.ts
1812
+ var reservedRouterKeys = /* @__PURE__ */ new Set([
1813
+ "__proto__",
1814
+ "constructor",
1815
+ "prototype"
1816
+ ]);
1817
+ var RouterKey = Schema_exports.String.check(
1818
+ Schema_exports.isPattern(/^[A-Za-z_][A-Za-z0-9_-]{0,99}$/u),
1819
+ Schema_exports.makeFilter((key) => !reservedRouterKeys.has(key))
1820
+ );
1821
+ var RouterIcon = Schema_exports.Struct({
1822
+ src: Schema_exports.NonEmptyString,
1823
+ mimeType: Schema_exports.optionalKey(Schema_exports.String),
1824
+ sizes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
1825
+ theme: Schema_exports.optionalKey(Schema_exports.Literals(["light", "dark"]))
1826
+ });
1827
+ var RouterMeta = Schema_exports.Struct({
1828
+ title: Schema_exports.optionalKey(Schema_exports.String),
1829
+ description: Schema_exports.optionalKey(Schema_exports.String),
1830
+ instructions: Schema_exports.optionalKey(Schema_exports.String),
1831
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
1832
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String))
1833
+ });
1834
+
1835
+ // src/contracts/tools.ts
1836
+ var ToolAnnotations2 = Schema_exports.Struct({
1837
+ title: Schema_exports.optionalKey(Schema_exports.String),
1838
+ readOnlyHint: Schema_exports.optionalKey(Schema_exports.Boolean),
1839
+ destructiveHint: Schema_exports.optionalKey(Schema_exports.Boolean),
1840
+ idempotentHint: Schema_exports.optionalKey(Schema_exports.Boolean),
1841
+ openWorldHint: Schema_exports.optionalKey(Schema_exports.Boolean)
1842
+ });
1843
+
1844
+ // src/contracts/mcp.ts
1845
+ var McpClientLimits = Schema_exports.Struct({
1846
+ timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1847
+ maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1848
+ maxTools: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1849
+ maxPaginationCursors: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
1850
+ cleanupTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1851
+ });
1852
+ var defaultMcpClientLimits = McpClientLimits.make({
1853
+ timeoutMs: 3e4,
1854
+ maxTimeoutMs: 3e5,
1855
+ maxTools: 5e4,
1856
+ maxPaginationCursors: 1e3,
1857
+ cleanupTimeoutMs: 1e3
1858
+ });
1859
+ var mcpSdkTimerCeilingMs = 2147483647;
1860
+ var McpToolsOptions = Schema_exports.Struct({
1861
+ url: HttpUrl,
1862
+ accountId: Schema_exports.optional(AccountId),
1863
+ headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
1864
+ signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
1865
+ timeoutMs: Schema_exports.optional(
1866
+ Schema_exports.Number.check(
1867
+ Schema_exports.isInt(),
1868
+ Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
1869
+ )
1870
+ )
1871
+ });
1872
+ var McpHealthInput = Schema_exports.Struct({
1873
+ ...McpToolsOptions.fields,
1874
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1875
+ deadline: Schema_exports.optional(Schema_exports.Finite)
1876
+ });
1877
+ var mcpHealthReserveMs = 2 * defaultMcpClientLimits.cleanupTimeoutMs + 250;
1878
+ var McpToolResult = Schema_exports.Struct({
1879
+ content: Schema_exports.Array(JsonObject2),
1880
+ structuredContent: Schema_exports.optionalKey(JsonObject2),
1881
+ isError: Schema_exports.optionalKey(Schema_exports.Boolean),
1882
+ _meta: Schema_exports.optionalKey(JsonObject2)
1883
+ });
1884
+ var McpToolMetadata = Schema_exports.Struct({
1885
+ name: Schema_exports.String,
1886
+ title: Schema_exports.optional(Schema_exports.String),
1887
+ description: Schema_exports.optional(Schema_exports.String),
1888
+ inputSchema: JsonObject2,
1889
+ outputSchema: Schema_exports.optional(JsonObject2),
1890
+ annotations: Schema_exports.optional(ToolAnnotations2),
1891
+ _meta: Schema_exports.optional(JsonObject2)
1892
+ });
1893
+ var McpServerHeader = Schema_exports.Struct({
1894
+ name: Schema_exports.optionalKey(Schema_exports.String),
1895
+ title: Schema_exports.optionalKey(Schema_exports.String),
1896
+ version: Schema_exports.optionalKey(Schema_exports.String),
1897
+ description: Schema_exports.optionalKey(Schema_exports.String),
1898
+ websiteUrl: Schema_exports.optionalKey(Schema_exports.String),
1899
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
1900
+ instructions: Schema_exports.optionalKey(Schema_exports.String)
1901
+ });
1902
+ var McpError2 = class extends Schema_exports.TaggedError()("McpError", {
1903
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
1904
+ reason: Schema_exports.Literals([
1905
+ "request",
1906
+ "unauthorized",
1907
+ "invalid_response",
1908
+ "timeout",
1909
+ "invalid_input"
1910
+ ]),
1911
+ status: Schema_exports.optional(Schema_exports.Number),
1912
+ upstream: Schema_exports.optional(UpstreamError),
1913
+ session: Schema_exports.optional(Schema_exports.Literal(true))
1914
+ }) {
1915
+ };
1916
+ var McpCredentialsUnverified = class extends Schema_exports.TaggedError()(
1917
+ "McpCredentialsUnverified",
1918
+ { anonymous: Schema_exports.Union([Schema_exports.Literal("answered"), McpError2, ProviderError]) }
1919
+ ) {
1920
+ };
1921
+ var ProcessConfig = Schema_exports.Struct({
1922
+ command: Schema_exports.NonEmptyString,
1923
+ args: Schema_exports.Array(Schema_exports.String),
1924
+ cwd: Schema_exports.optional(Schema_exports.String),
1925
+ env: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1926
+ timeoutMs: Schema_exports.Int.check(
1927
+ Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
1928
+ )
1929
+ });
1930
+
1668
1931
  // src/contracts/webhook-protocol.ts
1669
1932
  var WebhookTransportLimits = Schema_exports.Struct({
1670
1933
  maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
@@ -1736,7 +1999,7 @@ var OAuthSecretClientAuth = Schema_exports.Literals([
1736
1999
  "client_secret_basic",
1737
2000
  "client_secret_basic_raw"
1738
2001
  ]);
1739
- var reservedAuthorizationParams = /* @__PURE__ */ new Set([
2002
+ var reservedAuthorizationParams = [
1740
2003
  "response_type",
1741
2004
  "client_id",
1742
2005
  "redirect_uri",
@@ -1748,17 +2011,55 @@ var reservedAuthorizationParams = /* @__PURE__ */ new Set([
1748
2011
  "resource",
1749
2012
  "request",
1750
2013
  "request_uri"
1751
- ]);
2014
+ ];
2015
+ var reserved = new Set(reservedAuthorizationParams);
1752
2016
  var OAuthAuthorizationParams = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
1753
- Schema_exports.makeFilter(
1754
- (params) => Object.keys(params).every((key) => !reservedAuthorizationParams.has(key)),
1755
- {
1756
- message: "Authorization parameters cannot replace protocol parameters such as state or scope."
1757
- }
1758
- )
2017
+ Schema_exports.makeFilter((params) => Object.keys(params).every((key) => !reserved.has(key)), {
2018
+ message: "Authorization parameters cannot replace protocol parameters such as state or scope."
2019
+ })
2020
+ );
2021
+ var declaredAuthorizationQuery = Schema_exports.makeFilter(
2022
+ (config) => {
2023
+ const keys = [...new URL(config.authorizationUrl).searchParams.keys()];
2024
+ const owned = keys.filter((key) => reserved.has(key));
2025
+ if (owned.length > 0)
2026
+ return {
2027
+ path: ["authorizationUrl"],
2028
+ issue: `authorizationUrl cannot set protocol parameters: ${owned.join(", ")}.`
2029
+ };
2030
+ const repeated = keys.filter((key) => Object.hasOwn(config.authorizationParams ?? {}, key));
2031
+ if (repeated.length > 0)
2032
+ return {
2033
+ path: ["authorizationParams"],
2034
+ issue: `Declare each parameter once; authorizationUrl already sets: ${repeated.join(", ")}.`
2035
+ };
2036
+ return void 0;
2037
+ }
1759
2038
  );
2039
+ var OAuthTokenRequestFormat = Schema_exports.Literals(["form", "json"]);
2040
+ var OAuthTokenResponse = Schema_exports.Struct({
2041
+ path: Schema_exports.String.check(Schema_exports.isPattern(/^[^.]+(\.[^.]+)*$/))
2042
+ });
2043
+ var tokenRequestOptions = {
2044
+ /** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
2045
+ scopeSeparator: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMinLength(1))),
2046
+ /** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
2047
+ tokenRequestFormat: Schema_exports.optionalKey(OAuthTokenRequestFormat)
2048
+ };
1760
2049
  var oauthOptions = {
2050
+ ...tokenRequestOptions,
2051
+ /**
2052
+ * Read the grant from this nested member of the token response when the top-level response has
2053
+ * no access token or no scope. Slack's user tokens use `{ path: "authed_user" }`.
2054
+ */
2055
+ tokenResponse: Schema_exports.optionalKey(OAuthTokenResponse),
1761
2056
  grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
2057
+ /**
2058
+ * Service-defined authorization request parameters, such as Google's
2059
+ * `{ access_type: "offline", prompt: "consent" }`. Host-owned protocol parameters
2060
+ * (`state`, `scope`, `redirect_uri`, PKCE and the others in `reservedAuthorizationParams`)
2061
+ * are rejected. A discovered endpoint's own query parameter of the same name is replaced.
2062
+ */
1762
2063
  authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams),
1763
2064
  tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth),
1764
2065
  /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
@@ -1768,6 +2069,8 @@ var OAuth2Config = Schema_exports.Union([
1768
2069
  Schema_exports.Struct({
1769
2070
  ...oauthOptions,
1770
2071
  discover: HttpUrl,
2072
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
2073
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl),
1771
2074
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1772
2075
  tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1773
2076
  revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
@@ -1775,21 +2078,26 @@ var OAuth2Config = Schema_exports.Union([
1775
2078
  }),
1776
2079
  Schema_exports.Struct({
1777
2080
  ...oauthOptions,
2081
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
1778
2082
  authorizationUrl: HttpUrl,
1779
2083
  tokenUrl: HttpUrl,
1780
2084
  revocationUrl: Schema_exports.optionalKey(HttpUrl),
1781
2085
  scopes: Schema_exports.Array(Schema_exports.String),
1782
2086
  /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
1783
2087
  issuer: Schema_exports.optionalKey(HttpUrl),
1784
- discover: Schema_exports.optionalKey(Schema_exports.Never)
1785
- }),
2088
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
2089
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
2090
+ }).check(declaredAuthorizationQuery),
1786
2091
  Schema_exports.Struct({
1787
2092
  grant: Schema_exports.Literal("client_credentials"),
1788
2093
  discover: HttpUrl,
2094
+ /** Fetch this exact metadata document and verify its issuer against discovery. */
2095
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(HttpUrl),
1789
2096
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1790
2097
  tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1791
2098
  revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1792
2099
  scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
2100
+ ...tokenRequestOptions,
1793
2101
  tokenEndpointAuthMethod: OAuthSecretClientAuth,
1794
2102
  resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1795
2103
  }),
@@ -1798,10 +2106,12 @@ var OAuth2Config = Schema_exports.Union([
1798
2106
  tokenUrl: HttpUrl,
1799
2107
  revocationUrl: Schema_exports.optionalKey(HttpUrl),
1800
2108
  scopes: Schema_exports.Array(Schema_exports.String),
2109
+ ...tokenRequestOptions,
1801
2110
  tokenEndpointAuthMethod: OAuthSecretClientAuth,
1802
2111
  resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
1803
2112
  authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1804
- discover: Schema_exports.optionalKey(Schema_exports.Never)
2113
+ discover: Schema_exports.optionalKey(Schema_exports.Never),
2114
+ authorizationServerMetadataUrl: Schema_exports.optionalKey(Schema_exports.Never)
1805
2115
  })
1806
2116
  ]);
1807
2117
  var OAuth2AccessToken = Schema_exports.Struct({ access_token: Schema_exports.String });
@@ -1809,6 +2119,16 @@ var OAuth2Method = class extends Data_exports.TaggedClass(
1809
2119
  "oauth2"
1810
2120
  ) {
1811
2121
  };
2122
+ var displayText = Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(255));
2123
+ var AccountInfo = Schema_exports.Struct({
2124
+ externalId: Schema_exports.optionalKey(displayText),
2125
+ displayName: Schema_exports.optionalKey(displayText),
2126
+ username: Schema_exports.optionalKey(displayText),
2127
+ email: Schema_exports.optionalKey(displayText),
2128
+ avatarUrl: Schema_exports.optionalKey(HttpUrl),
2129
+ profileUrl: Schema_exports.optionalKey(HttpUrl)
2130
+ });
2131
+ var AccountCheckResult = Schema_exports.Struct({ accountInfo: Schema_exports.optionalKey(AccountInfo) });
1812
2132
  var Provider = class extends Data_exports.Class {
1813
2133
  /** Declare zero or more accounts from this provider without performing I/O. */
1814
2134
  many() {
@@ -1819,64 +2139,239 @@ var ManyAccounts = class extends Data_exports.TaggedClass("many") {
1819
2139
  };
1820
2140
 
1821
2141
  // src/contracts/protocol-version.ts
1822
- var frameworkProtocol = 2;
2142
+ var frameworkProtocol = 10;
1823
2143
 
1824
- // src/contracts/schedules.ts
1825
- var minimumIntervalMilliseconds = 6e4;
1826
- var count = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
1827
- var absent = Schema_exports.optionalKey(Schema_exports.Never);
1828
- var Interval = Schema_exports.Union([
1829
- Schema_exports.Struct({ seconds: count, minutes: absent, hours: absent }),
1830
- Schema_exports.Struct({ seconds: absent, minutes: count, hours: absent }),
1831
- Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count })
2144
+ // src/contracts/protocols/oauth.ts
2145
+ var OAuthClientAuth2 = Schema_exports.Literals([
2146
+ "none",
2147
+ "client_secret_post",
2148
+ "client_secret_basic",
2149
+ "client_secret_basic_raw"
1832
2150
  ]);
1833
- var CalendarSchedule = Schema_exports.Struct({
1834
- expression: Schema_exports.NonEmptyString,
1835
- timezone: Schema_exports.NonEmptyString
1836
- }).check(
1837
- Schema_exports.makeFilter(
1838
- (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
1839
- )
1840
- );
1841
- var ScheduleTiming = Schema_exports.Union([
1842
- Schema_exports.Struct({
1843
- kind: Schema_exports.Literal("interval"),
1844
- milliseconds: Schema_exports.Int.check(
1845
- Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds, {
1846
- message: "Schedule intervals must be at least 60 seconds"
1847
- }),
1848
- Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
1849
- )
1850
- }),
1851
- Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
2151
+ var OAuthSecretClientAuth2 = Schema_exports.Literals([
2152
+ "client_secret_post",
2153
+ "client_secret_basic",
2154
+ "client_secret_basic_raw"
1852
2155
  ]);
1853
- var OperationSchedule = Schema_exports.Struct({
1854
- name: Schema_exports.NonEmptyString,
1855
- timing: ScheduleTiming,
1856
- input: JsonValue
2156
+ var reservedAuthorizationParams2 = [
2157
+ "response_type",
2158
+ "client_id",
2159
+ "redirect_uri",
2160
+ "state",
2161
+ "scope",
2162
+ "code_challenge",
2163
+ "code_challenge_method",
2164
+ "nonce",
2165
+ "resource",
2166
+ "request",
2167
+ "request_uri"
2168
+ ];
2169
+ var reserved2 = new Set(reservedAuthorizationParams2);
2170
+ var OAuthAuthorizationParams2 = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
2171
+ Schema_exports.makeFilter((params) => Object.keys(params).every((key) => !reserved2.has(key)), {
2172
+ message: "Authorization parameters cannot replace protocol parameters such as state or scope."
2173
+ })
2174
+ );
2175
+ var declaredAuthorizationQuery2 = Schema_exports.makeFilter(
2176
+ (config) => {
2177
+ const keys = [...new URL(config.authorizationUrl).searchParams.keys()];
2178
+ const owned = keys.filter((key) => reserved2.has(key));
2179
+ if (owned.length > 0)
2180
+ return {
2181
+ path: ["authorizationUrl"],
2182
+ issue: `authorizationUrl cannot set protocol parameters: ${owned.join(", ")}.`
2183
+ };
2184
+ const repeated = keys.filter((key) => Object.hasOwn(config.authorizationParams ?? {}, key));
2185
+ if (repeated.length > 0)
2186
+ return {
2187
+ path: ["authorizationParams"],
2188
+ issue: `Declare each parameter once; authorizationUrl already sets: ${repeated.join(", ")}.`
2189
+ };
2190
+ return void 0;
2191
+ }
2192
+ );
2193
+ var OAuthTokenRequestFormat2 = Schema_exports.Literals(["form", "json"]);
2194
+ var OAuthTokenResponse2 = Schema_exports.Struct({
2195
+ path: Schema_exports.String.check(Schema_exports.isPattern(/^[^.]+(\.[^.]+)*$/))
2196
+ });
2197
+ var tokenRequestOptions2 = {
2198
+ /** Joins requested scopes; Linear wants `","`. Defaults to RFC 6749's space. */
2199
+ scopeSeparator: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMinLength(1))),
2200
+ /** Encoding of token requests. Defaults to `"form"`; Atlassian, ClickUp and Notion need `"json"`. */
2201
+ tokenRequestFormat: Schema_exports.optionalKey(OAuthTokenRequestFormat2)
2202
+ };
2203
+ var oauthOptions2 = {
2204
+ ...tokenRequestOptions2,
2205
+ /**
2206
+ * Read the grant from this nested member of the token response when the top-level response has
2207
+ * no access token or no scope. Slack's user tokens use `{ path: "authed_user" }`.
2208
+ */
2209
+ tokenResponse: Schema_exports.optionalKey(OAuthTokenResponse2),
2210
+ grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
2211
+ /**
2212
+ * Service-defined authorization request parameters, such as Google's
2213
+ * `{ access_type: "offline", prompt: "consent" }`. Host-owned protocol parameters
2214
+ * (`state`, `scope`, `redirect_uri`, PKCE and the others in `reservedAuthorizationParams`)
2215
+ * are rejected. A discovered endpoint's own query parameter of the same name is replaced.
2216
+ */
2217
+ authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams2),
2218
+ tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth2),
2219
+ /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
2220
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
2221
+ };
2222
+ var OAuth2Config2 = Schema_exports.Union([
2223
+ Schema_exports.Struct({
2224
+ ...oauthOptions2,
2225
+ discover: HttpUrl,
2226
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2227
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
2228
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2229
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
2230
+ }),
2231
+ Schema_exports.Struct({
2232
+ ...oauthOptions2,
2233
+ /** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
2234
+ authorizationUrl: HttpUrl,
2235
+ tokenUrl: HttpUrl,
2236
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
2237
+ scopes: Schema_exports.Array(Schema_exports.String),
2238
+ /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
2239
+ issuer: Schema_exports.optionalKey(HttpUrl),
2240
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
2241
+ }).check(declaredAuthorizationQuery2),
2242
+ Schema_exports.Struct({
2243
+ grant: Schema_exports.Literal("client_credentials"),
2244
+ discover: HttpUrl,
2245
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2246
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
2247
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2248
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
2249
+ ...tokenRequestOptions2,
2250
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
2251
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
2252
+ }),
2253
+ Schema_exports.Struct({
2254
+ grant: Schema_exports.Literal("client_credentials"),
2255
+ tokenUrl: HttpUrl,
2256
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
2257
+ scopes: Schema_exports.Array(Schema_exports.String),
2258
+ ...tokenRequestOptions2,
2259
+ tokenEndpointAuthMethod: OAuthSecretClientAuth2,
2260
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
2261
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
2262
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
2263
+ })
2264
+ ]);
2265
+
2266
+ // src/contracts/schedules.ts
2267
+ var minimumIntervalMilliseconds = 6e4;
2268
+ var count2 = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
2269
+ var absent = Schema_exports.optionalKey(Schema_exports.Never);
2270
+ var Interval = Schema_exports.Union([
2271
+ Schema_exports.Struct({ seconds: count2, minutes: absent, hours: absent }),
2272
+ Schema_exports.Struct({ seconds: absent, minutes: count2, hours: absent }),
2273
+ Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count2 })
2274
+ ]);
2275
+ var CalendarSchedule = Schema_exports.Struct({
2276
+ expression: Schema_exports.NonEmptyString,
2277
+ timezone: Schema_exports.NonEmptyString
2278
+ }).check(
2279
+ Schema_exports.makeFilter(
2280
+ (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
2281
+ )
2282
+ );
2283
+ var ScheduleTiming = Schema_exports.Union([
2284
+ Schema_exports.Struct({
2285
+ kind: Schema_exports.Literal("interval"),
2286
+ milliseconds: Schema_exports.Int.check(
2287
+ Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds, {
2288
+ message: "Schedule intervals must be at least 60 seconds"
2289
+ }),
2290
+ Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
2291
+ )
2292
+ }),
2293
+ Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
2294
+ ]);
2295
+ var OperationSchedule = Schema_exports.Struct({
2296
+ name: Schema_exports.NonEmptyString,
2297
+ timing: ScheduleTiming,
2298
+ input: JsonValue
1857
2299
  });
1858
2300
 
1859
2301
  // src/contracts/protocols/1.ts
2302
+ var ProviderError2 = class extends Schema_exports.TaggedError()("ProviderError", {
2303
+ reason: Schema_exports.Literals(["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]),
2304
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
2305
+ accountId: Schema_exports.optional(AccountId)
2306
+ }) {
2307
+ };
2308
+ var McpError3 = class extends Schema_exports.TaggedError()("McpError", {
2309
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
2310
+ reason: Schema_exports.Literals([
2311
+ "request",
2312
+ "unauthorized",
2313
+ "invalid_response",
2314
+ "timeout",
2315
+ "invalid_input"
2316
+ ]),
2317
+ status: Schema_exports.optional(Schema_exports.Number)
2318
+ }) {
2319
+ };
2320
+ var SkillLoadFailed = class extends Schema_exports.TaggedError()("SkillLoadFailed", {
2321
+ reason: Schema_exports.Literals([
2322
+ "source",
2323
+ "request",
2324
+ "rate_limited",
2325
+ "document",
2326
+ "limit",
2327
+ "changed",
2328
+ "encoding"
2329
+ ]),
2330
+ message: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isMaxLength(500))),
2331
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 })))
2332
+ }) {
2333
+ };
2334
+ var WorkflowFailure2 = class extends Schema_exports.TaggedError()("WorkflowFailure", {
2335
+ reason: Schema_exports.Literals([
2336
+ "unavailable",
2337
+ "not_found",
2338
+ "input",
2339
+ "output",
2340
+ "operation",
2341
+ "approval",
2342
+ "credentials",
2343
+ "terminated",
2344
+ "execution",
2345
+ "conflict",
2346
+ "engine"
2347
+ ]),
2348
+ retryable: Schema_exports.Boolean
2349
+ }) {
2350
+ };
2351
+ var WorkflowRpcResult2 = Schema_exports.Union([
2352
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
2353
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure2 })
2354
+ ]);
1860
2355
  var DeclaredAuthMethod = Schema_exports.Union([
1861
2356
  Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
1862
2357
  Schema_exports.Struct({
1863
2358
  type: Schema_exports.Literal("oauth2"),
1864
- ...OAuth2Config.members[0].fields,
2359
+ ...OAuth2Config2.members[0].fields,
1865
2360
  response: JsonObject2
1866
2361
  }),
1867
2362
  Schema_exports.Struct({
1868
2363
  type: Schema_exports.Literal("oauth2"),
1869
- ...OAuth2Config.members[1].fields,
2364
+ ...OAuth2Config2.members[1].fields,
1870
2365
  response: JsonObject2
1871
2366
  }),
1872
2367
  Schema_exports.Struct({
1873
2368
  type: Schema_exports.Literal("oauth2"),
1874
- ...OAuth2Config.members[2].fields,
2369
+ ...OAuth2Config2.members[2].fields,
1875
2370
  response: JsonObject2
1876
2371
  }),
1877
2372
  Schema_exports.Struct({
1878
2373
  type: Schema_exports.Literal("oauth2"),
1879
- ...OAuth2Config.members[3].fields,
2374
+ ...OAuth2Config2.members[3].fields,
1880
2375
  response: JsonObject2
1881
2376
  })
1882
2377
  ]);
@@ -1931,7 +2426,7 @@ var HostedTool = Schema_exports.Struct({
1931
2426
  readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
1932
2427
  title: Schema_exports.optionalKey(Schema_exports.String),
1933
2428
  outputSchema: Schema_exports.optionalKey(JsonObject2),
1934
- annotations: Schema_exports.optionalKey(ToolAnnotations),
2429
+ annotations: Schema_exports.optionalKey(ToolAnnotations2),
1935
2430
  _meta: Schema_exports.optionalKey(JsonObject2)
1936
2431
  });
1937
2432
  var HostedToolSummary = HostedTool.mapFields(
@@ -2038,10 +2533,10 @@ var HostOutputInvalid = class extends Schema_exports.TaggedError()(
2038
2533
  };
2039
2534
  var HostError = Schema_exports.Union([
2040
2535
  OpenapiResponseError,
2041
- ProviderError,
2042
- McpError,
2536
+ ProviderError2,
2537
+ McpError3,
2043
2538
  SkillLoadFailed,
2044
- WorkflowFailure,
2539
+ WorkflowFailure2,
2045
2540
  HostRequestInvalid,
2046
2541
  HostAccountsInvalid,
2047
2542
  HostDeclarationInvalid,
@@ -2085,7 +2580,7 @@ var protocol1 = {
2085
2580
  elicitationRequest: FormElicitation,
2086
2581
  elicitationReply: ElicitationReply,
2087
2582
  workflowStep: WorkflowRpcCommand,
2088
- workflowStepReply: WorkflowRpcResult,
2583
+ workflowStepReply: WorkflowRpcResult2,
2089
2584
  workflowControl: WorkflowControlCommand,
2090
2585
  cacheCommand: CacheCommand,
2091
2586
  cacheReply: CacheReply
@@ -2104,8 +2599,603 @@ var protocol2 = {
2104
2599
  schemas: { ...protocol1.schemas, skills: SkillCatalogResponse2 }
2105
2600
  };
2106
2601
 
2107
- // src/contracts/operations.ts
2108
- var OperationToolPrefixes = { query: "queries.", mutate: "mutations." };
2602
+ // src/contracts/protocols/3.ts
2603
+ var FailureDetail2 = {
2604
+ source: Schema_exports.optionalKey(FailureSource),
2605
+ errorName: Schema_exports.optionalKey(FailureName),
2606
+ code: Schema_exports.optionalKey(FailureCode),
2607
+ message: Schema_exports.optionalKey(FailureMessage)
2608
+ };
2609
+ var HostDeclarationInvalid2 = class extends Schema_exports.TaggedError()(
2610
+ "HostDeclarationInvalid",
2611
+ FailureDetail2
2612
+ ) {
2613
+ };
2614
+ var HostEvaluationFailed2 = class extends Schema_exports.TaggedError()(
2615
+ "HostEvaluationFailed",
2616
+ FailureDetail2
2617
+ ) {
2618
+ };
2619
+ var HostOperationFailed2 = class extends Schema_exports.TaggedError()(
2620
+ "HostOperationFailed",
2621
+ FailureDetail2
2622
+ ) {
2623
+ };
2624
+ var HostError2 = Schema_exports.Union([
2625
+ OpenapiResponseError,
2626
+ ProviderError2,
2627
+ McpError3,
2628
+ SkillLoadFailed,
2629
+ WorkflowFailure,
2630
+ HostRequestInvalid,
2631
+ HostAccountsInvalid,
2632
+ HostDeclarationInvalid2,
2633
+ HostEvaluationFailed2,
2634
+ HostOperationNotFound,
2635
+ HostOperationFailed2,
2636
+ DatabaseLimitExceeded,
2637
+ DatabaseFieldReserved,
2638
+ HostToolNotFound,
2639
+ HostInputInvalid,
2640
+ HostOutputInvalid,
2641
+ HostToolBlocked,
2642
+ HostToolApprovalRequired,
2643
+ HostToolPolicyFailed,
2644
+ ElicitationFailed
2645
+ ]);
2646
+ var HostResponse2 = Schema_exports.Union([
2647
+ Schema_exports.Struct({
2648
+ ok: Schema_exports.Literal(true),
2649
+ value: JsonValue,
2650
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2651
+ }),
2652
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError2 })
2653
+ ]);
2654
+ var protocol3 = {
2655
+ version: 3,
2656
+ schemas: {
2657
+ invocation: HostInvocation,
2658
+ request: HostRequest,
2659
+ response: HostResponse2,
2660
+ requirements: DeclaredRequirements,
2661
+ tools: Schema_exports.Array(HostedTool),
2662
+ toolSummaries: Schema_exports.Array(HostedToolSummary),
2663
+ skills: SkillCatalogResponse2,
2664
+ elicitationRequest: FormElicitation,
2665
+ elicitationReply: ElicitationReply,
2666
+ workflowStep: WorkflowRpcCommand,
2667
+ workflowStepReply: WorkflowRpcResult,
2668
+ workflowControl: WorkflowControlCommand,
2669
+ cacheCommand: CacheCommand,
2670
+ cacheReply: CacheReply
2671
+ }
2672
+ };
2673
+
2674
+ // src/contracts/protocols/4.ts
2675
+ var HostedTool2 = Schema_exports.Struct({
2676
+ schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
2677
+ name: Schema_exports.NonEmptyString,
2678
+ router: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
2679
+ tags: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2680
+ description: Schema_exports.String,
2681
+ inputSchema: JsonObject2,
2682
+ readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2683
+ title: Schema_exports.optionalKey(Schema_exports.String),
2684
+ outputSchema: Schema_exports.optionalKey(JsonObject2),
2685
+ annotations: Schema_exports.optionalKey(ToolAnnotations2),
2686
+ _meta: Schema_exports.optionalKey(JsonObject2)
2687
+ });
2688
+ var HostedToolSummary2 = HostedTool2.mapFields(
2689
+ ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2690
+ );
2691
+ var HostRouterError = Schema_exports.Union([
2692
+ ProviderError2,
2693
+ McpError3,
2694
+ SkillLoadFailed,
2695
+ HostDeclarationInvalid2,
2696
+ HostEvaluationFailed2
2697
+ ]);
2698
+ var HostedRouter = Schema_exports.Struct({
2699
+ path: Schema_exports.String,
2700
+ title: Schema_exports.optionalKey(Schema_exports.String),
2701
+ description: Schema_exports.optionalKey(Schema_exports.String),
2702
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
2703
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String)),
2704
+ skill: Schema_exports.optionalKey(AppSkillName),
2705
+ error: Schema_exports.optionalKey(HostRouterError)
2706
+ });
2707
+ var HostedCatalog = Schema_exports.Struct({
2708
+ tools: Schema_exports.Array(HostedTool2),
2709
+ routers: Schema_exports.Array(HostedRouter)
2710
+ });
2711
+ var HostedCatalogSummary = Schema_exports.Struct({
2712
+ tools: Schema_exports.Array(HostedToolSummary2),
2713
+ routers: Schema_exports.Array(HostedRouter)
2714
+ });
2715
+ var ToolKind = Schema_exports.Literals(["query", "mutation"]);
2716
+ var HostRequest2 = Schema_exports.Union([
2717
+ WorkflowCommand,
2718
+ WebhookCommand,
2719
+ Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
2720
+ Schema_exports.Struct({
2721
+ operation: Schema_exports.Literal("inspect"),
2722
+ /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
2723
+ detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
2724
+ /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
2725
+ tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2726
+ /**
2727
+ * Describe only declared operations that have schedules, without dynamic tool discovery.
2728
+ * Only builds that declare the scheduledTools capability accept this.
2729
+ */
2730
+ scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
2731
+ }),
2732
+ Schema_exports.Struct({
2733
+ operation: Schema_exports.Literal("skills"),
2734
+ /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
2735
+ sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
2736
+ }),
2737
+ Schema_exports.Struct({
2738
+ operation: Schema_exports.Literal("query"),
2739
+ name: Schema_exports.NonEmptyString,
2740
+ input: JsonValue
2741
+ }),
2742
+ Schema_exports.Struct({
2743
+ operation: Schema_exports.Literal("mutate"),
2744
+ name: Schema_exports.NonEmptyString,
2745
+ input: JsonValue
2746
+ }),
2747
+ Schema_exports.Struct({
2748
+ operation: Schema_exports.Literal("call"),
2749
+ tool: Schema_exports.NonEmptyString,
2750
+ /**
2751
+ * The caller's claim; the bundle rejects a call whose tool has the other kind. The host omits
2752
+ * it for a tool its catalog does not list, and then opens storage for writing.
2753
+ */
2754
+ kind: Schema_exports.optionalKey(ToolKind),
2755
+ input: JsonValue
2756
+ })
2757
+ ]);
2758
+ var HostKindMismatch = class extends Schema_exports.TaggedError()("HostKindMismatch", {
2759
+ tool: Schema_exports.NonEmptyString,
2760
+ requested: ToolKind,
2761
+ actual: ToolKind
2762
+ }) {
2763
+ };
2764
+ var HostError3 = Schema_exports.Union([...HostError2.members, HostKindMismatch]);
2765
+ var HostResponse3 = Schema_exports.Union([
2766
+ Schema_exports.Struct({
2767
+ ok: Schema_exports.Literal(true),
2768
+ value: JsonValue,
2769
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
2770
+ }),
2771
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError3 })
2772
+ ]);
2773
+ var HostInvocation2 = Schema_exports.Struct({
2774
+ command: HostRequest2,
2775
+ accounts: ResolvedAccounts,
2776
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2777
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2778
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2779
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2780
+ });
2781
+ var protocol4 = {
2782
+ version: 4,
2783
+ schemas: {
2784
+ invocation: HostInvocation2,
2785
+ request: HostRequest2,
2786
+ response: HostResponse3,
2787
+ requirements: DeclaredRequirements,
2788
+ catalog: HostedCatalog,
2789
+ catalogSummary: HostedCatalogSummary,
2790
+ skills: SkillCatalogResponse2,
2791
+ elicitationRequest: FormElicitation,
2792
+ elicitationReply: ElicitationReply,
2793
+ workflowStep: WorkflowRpcCommand,
2794
+ workflowStepReply: WorkflowRpcResult,
2795
+ workflowControl: WorkflowControlCommand,
2796
+ cacheCommand: CacheCommand,
2797
+ cacheReply: CacheReply
2798
+ }
2799
+ };
2800
+
2801
+ // src/contracts/protocols/5.ts
2802
+ var DeclaredRequirements2 = Schema_exports.Struct({
2803
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
2804
+ capabilities: Schema_exports.optionalKey(
2805
+ Schema_exports.Struct({
2806
+ skills: Schema_exports.Literal(true),
2807
+ toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2808
+ skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2809
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
2810
+ })
2811
+ ),
2812
+ database: Schema_exports.optionalKey(DatabaseSchema),
2813
+ accounts: Schema_exports.Record(
2814
+ Schema_exports.NonEmptyString,
2815
+ Schema_exports.Struct({
2816
+ definition: DeclaredProvider,
2817
+ cardinality: Schema_exports.Literals(["one", "many"]),
2818
+ /**
2819
+ * The slot's provider defines an account check. Kept beside the definition, not in it, so
2820
+ * adding or editing a check never changes the provider's identity.
2821
+ */
2822
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
2823
+ })
2824
+ )
2825
+ });
2826
+ var AccountCheckCommand = Schema_exports.Struct({
2827
+ operation: Schema_exports.Literal("account-check"),
2828
+ requirement: Schema_exports.NonEmptyString
2829
+ });
2830
+ var HostRequest3 = Schema_exports.Union([
2831
+ ...protocol4.schemas.request.members,
2832
+ AccountCheckCommand
2833
+ ]);
2834
+ var HostInvocation3 = Schema_exports.Struct({
2835
+ command: HostRequest3,
2836
+ accounts: ResolvedAccounts,
2837
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2838
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2839
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2840
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2841
+ });
2842
+ var protocol5 = {
2843
+ version: 5,
2844
+ schemas: {
2845
+ ...protocol4.schemas,
2846
+ invocation: HostInvocation3,
2847
+ request: HostRequest3,
2848
+ requirements: DeclaredRequirements2,
2849
+ accountCheck: AccountCheckResult
2850
+ }
2851
+ };
2852
+
2853
+ // src/contracts/protocols/6.ts
2854
+ var DeclaredAuthMethod2 = Schema_exports.Union([
2855
+ Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
2856
+ Schema_exports.Struct({
2857
+ type: Schema_exports.Literal("oauth2"),
2858
+ ...OAuth2Config.members[0].fields,
2859
+ response: JsonObject2
2860
+ }),
2861
+ Schema_exports.Struct({
2862
+ type: Schema_exports.Literal("oauth2"),
2863
+ ...OAuth2Config.members[1].fields,
2864
+ response: JsonObject2
2865
+ }),
2866
+ Schema_exports.Struct({
2867
+ type: Schema_exports.Literal("oauth2"),
2868
+ ...OAuth2Config.members[2].fields,
2869
+ response: JsonObject2
2870
+ }),
2871
+ Schema_exports.Struct({
2872
+ type: Schema_exports.Literal("oauth2"),
2873
+ ...OAuth2Config.members[3].fields,
2874
+ response: JsonObject2
2875
+ })
2876
+ ]);
2877
+ var DeclaredProvider2 = Schema_exports.Struct({
2878
+ name: Schema_exports.NonEmptyString,
2879
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod2)
2880
+ });
2881
+ var DeclaredRequirements3 = Schema_exports.Struct({
2882
+ ...DeclaredRequirements2.fields,
2883
+ accounts: Schema_exports.Record(
2884
+ Schema_exports.NonEmptyString,
2885
+ Schema_exports.Struct({
2886
+ definition: DeclaredProvider2,
2887
+ cardinality: Schema_exports.Literals(["one", "many"]),
2888
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
2889
+ })
2890
+ )
2891
+ });
2892
+ var ResolvedAccount2 = Schema_exports.Struct({
2893
+ ...ResolvedAccount.fields,
2894
+ provider: DeclaredProvider2
2895
+ });
2896
+ var ResolvedAccounts2 = Schema_exports.Record(
2897
+ Schema_exports.NonEmptyString,
2898
+ Schema_exports.Union([ResolvedAccount2, Schema_exports.Array(ResolvedAccount2)])
2899
+ );
2900
+ var HostInvocation4 = Schema_exports.Struct({
2901
+ ...HostInvocation3.fields,
2902
+ accounts: ResolvedAccounts2
2903
+ });
2904
+ var protocol6 = {
2905
+ version: 6,
2906
+ schemas: {
2907
+ ...protocol5.schemas,
2908
+ requirements: DeclaredRequirements3,
2909
+ accounts: ResolvedAccounts2,
2910
+ invocation: HostInvocation4
2911
+ }
2912
+ };
2913
+
2914
+ // src/contracts/protocols/7.ts
2915
+ var CredentialHost = Schema_exports.String.check(
2916
+ Schema_exports.isPattern(
2917
+ /^(\*\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$/
2918
+ )
2919
+ );
2920
+ var exposure = {
2921
+ /** Not secret: app code reads the real value and forms show it. */
2922
+ plain: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2923
+ /** Secret, but app code reads the real value, for signing and similar uses. */
2924
+ raw: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString))
2925
+ };
2926
+ var DeclaredAuthMethod3 = Schema_exports.Union([
2927
+ Schema_exports.Struct({
2928
+ type: Schema_exports.Literal("secrets"),
2929
+ label: Schema_exports.String,
2930
+ fields: JsonObject2,
2931
+ ...exposure
2932
+ }),
2933
+ Schema_exports.Struct({
2934
+ type: Schema_exports.Literal("oauth2"),
2935
+ ...OAuth2Config.members[0].fields,
2936
+ response: JsonObject2,
2937
+ ...exposure
2938
+ }),
2939
+ Schema_exports.Struct({
2940
+ type: Schema_exports.Literal("oauth2"),
2941
+ ...OAuth2Config.members[1].fields,
2942
+ response: JsonObject2,
2943
+ ...exposure
2944
+ }),
2945
+ Schema_exports.Struct({
2946
+ type: Schema_exports.Literal("oauth2"),
2947
+ ...OAuth2Config.members[2].fields,
2948
+ response: JsonObject2,
2949
+ ...exposure
2950
+ }),
2951
+ Schema_exports.Struct({
2952
+ type: Schema_exports.Literal("oauth2"),
2953
+ ...OAuth2Config.members[3].fields,
2954
+ response: JsonObject2,
2955
+ ...exposure
2956
+ })
2957
+ ]);
2958
+ var DeclaredProvider3 = Schema_exports.Struct({
2959
+ name: Schema_exports.NonEmptyString,
2960
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod3),
2961
+ hosts: Schema_exports.optionalKey(Schema_exports.Array(CredentialHost))
2962
+ });
2963
+ var DeclaredRequirements4 = Schema_exports.Struct({
2964
+ ...DeclaredRequirements3.fields,
2965
+ accounts: Schema_exports.Record(
2966
+ Schema_exports.NonEmptyString,
2967
+ Schema_exports.Struct({
2968
+ definition: DeclaredProvider3,
2969
+ cardinality: Schema_exports.Literals(["one", "many"]),
2970
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
2971
+ })
2972
+ )
2973
+ });
2974
+ var ResolvedAccount3 = Schema_exports.Struct({
2975
+ ...ResolvedAccount2.fields,
2976
+ provider: DeclaredProvider3
2977
+ });
2978
+ var ResolvedAccounts3 = Schema_exports.Record(
2979
+ Schema_exports.NonEmptyString,
2980
+ Schema_exports.Union([ResolvedAccount3, Schema_exports.Array(ResolvedAccount3)])
2981
+ );
2982
+ var HostInvocation5 = Schema_exports.Struct({
2983
+ ...HostInvocation4.fields,
2984
+ accounts: ResolvedAccounts3
2985
+ });
2986
+ var protocol7 = {
2987
+ version: 7,
2988
+ schemas: {
2989
+ ...protocol6.schemas,
2990
+ requirements: DeclaredRequirements4,
2991
+ accounts: ResolvedAccounts3,
2992
+ invocation: HostInvocation5
2993
+ }
2994
+ };
2995
+
2996
+ // src/contracts/protocols/8.ts
2997
+ var McpError4 = class extends Schema_exports.TaggedError()("McpError", {
2998
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
2999
+ reason: Schema_exports.Literals([
3000
+ "request",
3001
+ "unauthorized",
3002
+ "invalid_response",
3003
+ "timeout",
3004
+ "invalid_input"
3005
+ ]),
3006
+ status: Schema_exports.optional(Schema_exports.Number),
3007
+ upstream: Schema_exports.optional(UpstreamError)
3008
+ }) {
3009
+ };
3010
+ var HostDeclarationInvalid3 = class extends Schema_exports.TaggedError()(
3011
+ "HostDeclarationInvalid",
3012
+ FailureDetail
3013
+ ) {
3014
+ };
3015
+ var HostEvaluationFailed3 = class extends Schema_exports.TaggedError()(
3016
+ "HostEvaluationFailed",
3017
+ FailureDetail
3018
+ ) {
3019
+ };
3020
+ var HostOperationFailed3 = class extends Schema_exports.TaggedError()(
3021
+ "HostOperationFailed",
3022
+ FailureDetail
3023
+ ) {
3024
+ };
3025
+ var HostRouterError2 = Schema_exports.Union([
3026
+ ProviderError,
3027
+ McpError4,
3028
+ SkillLoadFailed,
3029
+ HostDeclarationInvalid3,
3030
+ HostEvaluationFailed3
3031
+ ]);
3032
+ var HostedRouter2 = Schema_exports.Struct({
3033
+ ...HostedRouter.fields,
3034
+ error: Schema_exports.optionalKey(HostRouterError2)
3035
+ });
3036
+ var HostedCatalog2 = Schema_exports.Struct({
3037
+ ...HostedCatalog.fields,
3038
+ routers: Schema_exports.Array(HostedRouter2)
3039
+ });
3040
+ var HostedCatalogSummary2 = Schema_exports.Struct({
3041
+ ...HostedCatalogSummary.fields,
3042
+ routers: Schema_exports.Array(HostedRouter2)
3043
+ });
3044
+ var HostError4 = Schema_exports.Union([
3045
+ OpenapiResponseError,
3046
+ ProviderError,
3047
+ McpError4,
3048
+ SkillLoadFailed,
3049
+ WorkflowFailure,
3050
+ HostRequestInvalid,
3051
+ HostAccountsInvalid,
3052
+ HostDeclarationInvalid3,
3053
+ HostEvaluationFailed3,
3054
+ HostOperationNotFound,
3055
+ HostOperationFailed3,
3056
+ DatabaseLimitExceeded,
3057
+ DatabaseFieldReserved,
3058
+ HostToolNotFound,
3059
+ HostInputInvalid,
3060
+ HostOutputInvalid,
3061
+ HostToolBlocked,
3062
+ HostToolApprovalRequired,
3063
+ HostToolPolicyFailed,
3064
+ ElicitationFailed,
3065
+ HostKindMismatch
3066
+ ]);
3067
+ var HostResponse4 = Schema_exports.Union([
3068
+ Schema_exports.Struct({
3069
+ ok: Schema_exports.Literal(true),
3070
+ value: JsonValue,
3071
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
3072
+ }),
3073
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError4 })
3074
+ ]);
3075
+ var protocol8 = {
3076
+ version: 8,
3077
+ schemas: {
3078
+ ...protocol7.schemas,
3079
+ response: HostResponse4,
3080
+ catalog: HostedCatalog2,
3081
+ catalogSummary: HostedCatalogSummary2
3082
+ }
3083
+ };
3084
+
3085
+ // src/contracts/protocols/9.ts
3086
+ var McpError5 = class extends Schema_exports.TaggedError()("McpError", {
3087
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
3088
+ reason: Schema_exports.Literals([
3089
+ "request",
3090
+ "unauthorized",
3091
+ "invalid_response",
3092
+ "timeout",
3093
+ "invalid_input"
3094
+ ]),
3095
+ status: Schema_exports.optional(Schema_exports.Number),
3096
+ upstream: Schema_exports.optional(UpstreamError),
3097
+ session: Schema_exports.optional(Schema_exports.Literal(true))
3098
+ }) {
3099
+ };
3100
+ var SkillLoadFailed2 = class extends Schema_exports.TaggedError()("SkillLoadFailed", {
3101
+ reason: Schema_exports.Literals([
3102
+ "source",
3103
+ "request",
3104
+ "rate_limited",
3105
+ "document",
3106
+ "limit",
3107
+ "changed",
3108
+ "encoding"
3109
+ ]),
3110
+ message: Schema_exports.optional(Schema_exports.String.check(Schema_exports.isMaxLength(500))),
3111
+ status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
3112
+ missing: Schema_exports.optional(Schema_exports.Literals(["repository", "ref"]))
3113
+ }) {
3114
+ };
3115
+ var HostRouterError3 = Schema_exports.Union([
3116
+ ProviderError,
3117
+ McpError5,
3118
+ SkillLoadFailed2,
3119
+ HostDeclarationInvalid3,
3120
+ HostEvaluationFailed3
3121
+ ]);
3122
+ var HostedRouter3 = Schema_exports.Struct({
3123
+ ...HostedRouter2.fields,
3124
+ error: Schema_exports.optionalKey(HostRouterError3)
3125
+ });
3126
+ var HostedCatalog3 = Schema_exports.Struct({
3127
+ ...HostedCatalog2.fields,
3128
+ routers: Schema_exports.Array(HostedRouter3)
3129
+ });
3130
+ var HostedCatalogSummary3 = Schema_exports.Struct({
3131
+ ...HostedCatalogSummary2.fields,
3132
+ routers: Schema_exports.Array(HostedRouter3)
3133
+ });
3134
+ var HostError5 = Schema_exports.Union([
3135
+ OpenapiResponseError,
3136
+ ProviderError,
3137
+ McpError5,
3138
+ SkillLoadFailed2,
3139
+ WorkflowFailure,
3140
+ HostRequestInvalid,
3141
+ HostAccountsInvalid,
3142
+ HostDeclarationInvalid3,
3143
+ HostEvaluationFailed3,
3144
+ HostOperationNotFound,
3145
+ HostOperationFailed3,
3146
+ DatabaseLimitExceeded,
3147
+ DatabaseFieldReserved,
3148
+ HostToolNotFound,
3149
+ HostInputInvalid,
3150
+ HostOutputInvalid,
3151
+ HostToolBlocked,
3152
+ HostToolApprovalRequired,
3153
+ HostToolPolicyFailed,
3154
+ ElicitationFailed,
3155
+ HostKindMismatch
3156
+ ]);
3157
+ var HostResponse5 = Schema_exports.Union([
3158
+ Schema_exports.Struct({
3159
+ ok: Schema_exports.Literal(true),
3160
+ value: JsonValue,
3161
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
3162
+ }),
3163
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError5 })
3164
+ ]);
3165
+ var protocol9 = {
3166
+ version: 9,
3167
+ schemas: {
3168
+ ...protocol8.schemas,
3169
+ response: HostResponse5,
3170
+ catalog: HostedCatalog3,
3171
+ catalogSummary: HostedCatalogSummary3
3172
+ }
3173
+ };
3174
+
3175
+ // src/contracts/protocols/10.ts
3176
+ var DeclaredRequirements5 = Schema_exports.Struct({
3177
+ ...DeclaredRequirements4.fields,
3178
+ sql: Schema_exports.optionalKey(Schema_exports.Literal(true))
3179
+ });
3180
+ var MigrateCommand = Schema_exports.Struct({ operation: Schema_exports.Literal("migrate") });
3181
+ var MigrateResult = Schema_exports.Array(
3182
+ Schema_exports.Struct({ id: Schema_exports.Int, name: Schema_exports.NonEmptyString })
3183
+ );
3184
+ var HostRequest4 = Schema_exports.Union([...HostRequest3.members, MigrateCommand]);
3185
+ var HostInvocation6 = Schema_exports.Struct({
3186
+ ...HostInvocation5.fields,
3187
+ command: HostRequest4
3188
+ });
3189
+ var protocol10 = {
3190
+ version: 10,
3191
+ schemas: {
3192
+ ...protocol9.schemas,
3193
+ request: HostRequest4,
3194
+ requirements: DeclaredRequirements5,
3195
+ invocation: HostInvocation6,
3196
+ migrate: MigrateResult
3197
+ }
3198
+ };
2109
3199
 
2110
3200
  // src/contracts/host.ts
2111
3201
  var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
@@ -2116,16 +3206,20 @@ var inspectCommand = (tools, scheduled) => ({
2116
3206
  ...scheduled === void 0 ? {} : { scheduled }
2117
3207
  });
2118
3208
  var indexCommand = { operation: "inspect", detail: "summary" };
2119
- var selectTools = (tools) => (all) => tools === void 0 ? all : all.filter((tool) => tools.includes(tool.name));
2120
- var HostRequirementsError = Schema_exports.Union([HostRequestInvalid, HostDeclarationInvalid]);
3209
+ var selectTools = (tools) => (catalog) => tools === void 0 ? catalog : { ...catalog, tools: catalog.tools.filter((tool) => tools.includes(tool.name)) };
3210
+ var HostRequirementsError = Schema_exports.Union([
3211
+ HostRequestInvalid,
3212
+ HostDeclarationInvalid3,
3213
+ DatabaseFieldReserved
3214
+ ]);
2121
3215
  var HostInspectError = Schema_exports.Union([
2122
3216
  ProviderError,
2123
- McpError,
2124
- SkillLoadFailed,
3217
+ McpError5,
3218
+ SkillLoadFailed2,
2125
3219
  HostRequestInvalid,
2126
- HostDeclarationInvalid,
3220
+ HostDeclarationInvalid3,
2127
3221
  HostAccountsInvalid,
2128
- HostEvaluationFailed
3222
+ HostEvaluationFailed3
2129
3223
  ]);
2130
3224
  var HostCallError = Schema_exports.Union([
2131
3225
  OpenapiResponseError,
@@ -2133,7 +3227,9 @@ var HostCallError = Schema_exports.Union([
2133
3227
  HostInspectError,
2134
3228
  HostToolNotFound,
2135
3229
  HostOperationNotFound,
2136
- HostOperationFailed,
3230
+ HostKindMismatch,
3231
+ HostOperationFailed3,
3232
+ DatabaseLimitExceeded,
2137
3233
  HostInputInvalid,
2138
3234
  HostOutputInvalid,
2139
3235
  HostToolBlocked,
@@ -2141,6 +3237,16 @@ var HostCallError = Schema_exports.Union([
2141
3237
  HostToolPolicyFailed,
2142
3238
  ElicitationFailed
2143
3239
  ]);
3240
+ var HostAccountCheckError = Schema_exports.Union([
3241
+ ProviderError,
3242
+ WorkflowFailure,
3243
+ HostRequestInvalid,
3244
+ HostDeclarationInvalid3,
3245
+ HostAccountsInvalid,
3246
+ HostOperationNotFound,
3247
+ HostOperationFailed3,
3248
+ HostOutputInvalid
3249
+ ]);
2144
3250
  var HostDataError = HostCallError;
2145
3251
  var ToolResultObservation = Context_exports.Reference(
2146
3252
  "apps/ToolResultObservation",
@@ -2152,25 +3258,28 @@ export {
2152
3258
  SecretsMethod,
2153
3259
  OAuthClientAuth,
2154
3260
  OAuthSecretClientAuth,
3261
+ OAuthTokenRequestFormat,
3262
+ OAuthTokenResponse,
2155
3263
  OAuth2Config,
2156
3264
  OAuth2AccessToken,
2157
3265
  OAuth2Method,
3266
+ AccountInfo,
3267
+ AccountCheckResult,
2158
3268
  Provider,
2159
3269
  ManyAccounts,
2160
- ToolAnnotations,
2161
- McpClientLimits,
2162
- defaultMcpClientLimits,
2163
- mcpSdkTimerCeilingMs,
2164
- McpToolsOptions,
2165
- McpToolResult,
2166
- McpToolMetadata,
2167
- McpError,
2168
- ProcessConfig,
3270
+ maxApiErrorInstructionsLength,
3271
+ ApiErrorRecovery,
3272
+ maxApiErrorMessageLength,
3273
+ ApiErrorResponse,
3274
+ OpenapiResponseError,
3275
+ defaultOpenapiErrorLimits,
2169
3276
  WorkflowRunId,
2170
3277
  WorkflowName,
2171
3278
  workflowDurationMillis,
2172
3279
  WorkflowDuration,
2173
3280
  WorkflowStepOptions,
3281
+ WorkflowFailureDetail,
3282
+ WorkflowRunFailure,
2174
3283
  WorkflowFailure,
2175
3284
  NonRetryableError,
2176
3285
  WorkflowValue,
@@ -2182,6 +3291,10 @@ export {
2182
3291
  WorkflowRpcCommand,
2183
3292
  WorkflowRpcResult,
2184
3293
  WorkflowControlCommand,
3294
+ DatabaseLimitExceeded,
3295
+ DatabaseFieldReserved,
3296
+ reservedTablePrefix,
3297
+ migrationsDirectory,
2185
3298
  ElicitationLimits,
2186
3299
  defaultElicitationLimits,
2187
3300
  FormElicitation,
@@ -2191,6 +3304,23 @@ export {
2191
3304
  ApprovalElicitation,
2192
3305
  ApprovalResponse,
2193
3306
  approvalElicitation,
3307
+ reservedRouterKeys,
3308
+ RouterKey,
3309
+ RouterIcon,
3310
+ RouterMeta,
3311
+ ToolAnnotations2 as ToolAnnotations,
3312
+ McpClientLimits,
3313
+ defaultMcpClientLimits,
3314
+ mcpSdkTimerCeilingMs,
3315
+ McpToolsOptions,
3316
+ McpHealthInput,
3317
+ mcpHealthReserveMs,
3318
+ McpToolResult,
3319
+ McpToolMetadata,
3320
+ McpServerHeader,
3321
+ McpError2 as McpError,
3322
+ McpCredentialsUnverified,
3323
+ ProcessConfig,
2194
3324
  WebhookTransportLimits,
2195
3325
  defaultWebhookTransportLimits,
2196
3326
  WebhookRequestData,
@@ -2205,22 +3335,11 @@ export {
2205
3335
  CalendarSchedule,
2206
3336
  ScheduleTiming,
2207
3337
  OperationSchedule,
2208
- DeclaredAuthMethod,
2209
- DeclaredProvider,
2210
- DeclaredRequirements,
2211
- ResolvedAccount,
2212
- ResolvedAccounts,
2213
3338
  TrustedToolApproval,
2214
3339
  InvocationDeadline,
2215
- HostedTool,
2216
- HostedToolSummary,
2217
- HostRequest,
2218
3340
  HostRequestInvalid,
2219
3341
  HostAccountsInvalid,
2220
- HostDeclarationInvalid,
2221
- HostEvaluationFailed,
2222
3342
  HostOperationNotFound,
2223
- HostOperationFailed,
2224
3343
  HostToolNotFound,
2225
3344
  InputProblem,
2226
3345
  maxInputProblems,
@@ -2229,14 +3348,43 @@ export {
2229
3348
  HostToolApprovalRequired,
2230
3349
  HostToolPolicyFailed,
2231
3350
  HostOutputInvalid,
2232
- HostError,
2233
- HostResponse,
2234
- HostInvocation,
2235
3351
  protocol1,
2236
3352
  SkillSources2 as SkillSources,
2237
3353
  SkillCatalogResponse2 as SkillCatalogResponse,
2238
3354
  protocol2,
2239
- OperationToolPrefixes,
3355
+ protocol3,
3356
+ HostedTool2 as HostedTool,
3357
+ HostedToolSummary2 as HostedToolSummary,
3358
+ HostKindMismatch,
3359
+ protocol4,
3360
+ AccountCheckCommand,
3361
+ protocol5,
3362
+ protocol6,
3363
+ CredentialHost,
3364
+ DeclaredAuthMethod3 as DeclaredAuthMethod,
3365
+ DeclaredProvider3 as DeclaredProvider,
3366
+ ResolvedAccount3 as ResolvedAccount,
3367
+ ResolvedAccounts3 as ResolvedAccounts,
3368
+ protocol7,
3369
+ HostDeclarationInvalid3 as HostDeclarationInvalid,
3370
+ HostEvaluationFailed3 as HostEvaluationFailed,
3371
+ HostOperationFailed3 as HostOperationFailed,
3372
+ protocol8,
3373
+ McpError5 as McpError2,
3374
+ SkillLoadFailed2 as SkillLoadFailed,
3375
+ HostRouterError3 as HostRouterError,
3376
+ HostedRouter3 as HostedRouter,
3377
+ HostedCatalog3 as HostedCatalog,
3378
+ HostedCatalogSummary3 as HostedCatalogSummary,
3379
+ HostError5 as HostError,
3380
+ HostResponse5 as HostResponse,
3381
+ protocol9,
3382
+ DeclaredRequirements5 as DeclaredRequirements,
3383
+ MigrateCommand,
3384
+ MigrateResult,
3385
+ HostRequest4 as HostRequest,
3386
+ HostInvocation6 as HostInvocation,
3387
+ protocol10,
2240
3388
  skillsCommand,
2241
3389
  skillCatalog,
2242
3390
  inspectCommand,
@@ -2245,6 +3393,7 @@ export {
2245
3393
  HostRequirementsError,
2246
3394
  HostInspectError,
2247
3395
  HostCallError,
3396
+ HostAccountCheckError,
2248
3397
  HostDataError,
2249
3398
  ToolResultObservation
2250
3399
  };