apps 0.0.1-beta.0 → 0.0.1-beta.10

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 (141) hide show
  1. package/README.md +145 -30
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-36DNRFZQ.js → chunk-27F7W2LG.js} +1 -1
  5. package/js/{chunk-VFUZI3NY.js → chunk-57RKNWL2.js} +4 -4
  6. package/js/{chunk-BPEFS4YF.js → chunk-5T57N25Q.js} +122 -18
  7. package/js/chunk-72JNVHPK.js +41 -0
  8. package/js/{chunk-2OTCEKL2.js → chunk-CDL5PM2Q.js} +2643 -1646
  9. package/js/{chunk-KWTCHVLT.js → chunk-CRDWFA74.js} +69 -54
  10. package/js/chunk-CZ7CSFO4.js +39 -0
  11. package/js/{chunk-WIDTG42X.js → chunk-EPT3ZP52.js} +79 -26
  12. package/js/chunk-FL2QR3XW.js +507 -0
  13. package/js/{chunk-3ANFZFCV.js → chunk-IJX4CYZO.js} +15 -18
  14. package/js/chunk-IPI4MFSN.js +78 -0
  15. package/js/chunk-JU7VHODU.js +104 -0
  16. package/js/chunk-KUMBKVJD.js +39 -0
  17. package/js/{chunk-YDR4CPJA.js → chunk-M3B3DE4K.js} +8 -8
  18. package/js/chunk-MKWZPDR6.js +63 -0
  19. package/js/{chunk-7JXHF5IF.js → chunk-N7YDVXYJ.js} +49 -1
  20. package/js/chunk-NKLWZJLE.js +172 -0
  21. package/js/{chunk-OWD2YICM.js → chunk-ODEIDRGW.js} +116 -88
  22. package/js/{chunk-D6BKYP2L.js → chunk-PJJ24GU7.js} +4 -4
  23. package/js/{chunk-EP6AEUZO.js → chunk-PZB6T6KU.js} +1 -1
  24. package/js/chunk-R3EV5FTO.js +97 -0
  25. package/js/chunk-RFVIONFX.js +189 -0
  26. package/js/{chunk-W7Q5EOTS.js → chunk-UK573G7W.js} +32 -32
  27. package/js/chunk-UVL56Z6E.js +6641 -0
  28. package/js/{chunk-Q2FD5IBM.js → chunk-V5KNQVCT.js} +505 -124
  29. package/js/{chunk-SBKHUC5L.js → chunk-VFZKSM3T.js} +5 -25
  30. package/js/{chunk-HP7E42X6.js → chunk-WLE7WX2U.js} +1158 -232
  31. package/js/{chunk-X3YBZCJW.js → chunk-YXQHV65J.js} +58 -62
  32. package/js/chunk-Z5M2LQOZ.js +209 -0
  33. package/js/{chunk-R6JMJSVT.js → chunk-ZQINWV4W.js} +60 -20
  34. package/js/client.js +11 -27
  35. package/js/contracts.js +138 -27
  36. package/js/effect.js +20 -15
  37. package/js/es-APDZKREY.js +40968 -0
  38. package/js/graphql.js +220 -123
  39. package/js/host.js +75 -19
  40. package/js/index.js +261 -117
  41. package/js/mcp/effect.js +24 -17
  42. package/js/mcp/stdio.js +26 -21
  43. package/js/mcp.js +127 -26
  44. package/js/openapi.js +3048 -150
  45. package/js/operations/approval.js +1 -1
  46. package/js/react.js +4 -4
  47. package/js/skills/effect.js +11 -0
  48. package/js/skills.js +893 -0
  49. package/js/storage/facet.js +7 -7
  50. package/js/ui/auth/contracts.js +9 -10
  51. package/js/ui/auth.js +17 -15
  52. package/js/ui/contracts.js +5 -5
  53. package/js/ui/serving.js +14 -13
  54. package/package.json +9 -1
  55. package/runtime.json +1 -1
  56. package/types/app-cache/src/contracts/cache.d.ts +119 -0
  57. package/types/app-cache/src/index.d.ts +93 -0
  58. package/types/app-data/src/contracts/database.d.ts +33 -6
  59. package/types/app-data/src/implementation/schema.d.ts +2 -17
  60. package/types/apps/src/contracts/api-response-error.d.ts +43 -0
  61. package/types/apps/src/contracts/app.d.ts +16 -4
  62. package/types/apps/src/contracts/cache.d.ts +44 -0
  63. package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
  64. package/types/apps/src/contracts/failure.d.ts +25 -0
  65. package/types/apps/src/contracts/graphql.d.ts +18 -1
  66. package/types/apps/src/contracts/host.d.ts +76 -528
  67. package/types/apps/src/contracts/mcp.d.ts +19 -1
  68. package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
  69. package/types/apps/src/contracts/openapi-document.d.ts +53 -0
  70. package/types/apps/src/contracts/openapi.d.ts +160 -30
  71. package/types/apps/src/contracts/operations.d.ts +0 -5
  72. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  73. package/types/apps/src/contracts/protocols/1.d.ts +1589 -0
  74. package/types/apps/src/contracts/protocols/2.d.ts +668 -0
  75. package/types/apps/src/contracts/protocols/3.d.ts +676 -0
  76. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  77. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  78. package/types/apps/src/contracts/provider-error.d.ts +15 -0
  79. package/types/apps/src/contracts/provider.d.ts +69 -6
  80. package/types/apps/src/contracts/router.d.ts +59 -0
  81. package/types/apps/src/contracts/skills.d.ts +122 -0
  82. package/types/apps/src/contracts/storage.d.ts +3 -3
  83. package/types/apps/src/contracts/swagger-client.d.ts +29 -0
  84. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  85. package/types/apps/src/contracts/workflows.d.ts +34 -3
  86. package/types/apps/src/graphql.d.ts +5 -7
  87. package/types/apps/src/host.d.ts +1 -0
  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/cache-session.d.ts +7 -0
  91. package/types/apps/src/implementation/cache.d.ts +8 -0
  92. package/types/apps/src/implementation/catalog-cache.d.ts +36 -0
  93. package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
  94. package/types/apps/src/implementation/elicitation.d.ts +13 -13
  95. package/types/apps/src/implementation/failure-detail.d.ts +25 -0
  96. package/types/apps/src/implementation/git.d.ts +25 -0
  97. package/types/apps/src/implementation/graphql-catalog.d.ts +7 -0
  98. package/types/apps/src/implementation/graphql.d.ts +81 -3
  99. package/types/apps/src/implementation/inflate.d.ts +16 -0
  100. package/types/apps/src/implementation/input-problems.d.ts +3 -0
  101. package/types/apps/src/implementation/mcp-call.d.ts +3 -2
  102. package/types/apps/src/implementation/mcp-catalog.d.ts +9 -0
  103. package/types/apps/src/implementation/mcp-client.d.ts +39 -22
  104. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  105. package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
  106. package/types/apps/src/implementation/mcp.d.ts +55 -2
  107. package/types/apps/src/implementation/openapi-compile.d.ts +120 -0
  108. package/types/apps/src/implementation/openapi-document.d.ts +51 -0
  109. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  110. package/types/apps/src/implementation/openapi-request.d.ts +10 -4
  111. package/types/apps/src/implementation/openapi-source.d.ts +36 -0
  112. package/types/apps/src/implementation/openapi.d.ts +39 -3
  113. package/types/apps/src/implementation/operations.d.ts +26 -3
  114. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  115. package/types/apps/src/implementation/provider-error.d.ts +10 -0
  116. package/types/apps/src/implementation/provider.d.ts +9 -4
  117. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  118. package/types/apps/src/implementation/router.d.ts +59 -0
  119. package/types/apps/src/implementation/schema.d.ts +11 -6
  120. package/types/apps/src/implementation/skill-files.d.ts +10 -0
  121. package/types/apps/src/implementation/skills.d.ts +43 -0
  122. package/types/apps/src/implementation/storage.d.ts +5 -3
  123. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  125. package/types/apps/src/implementation/ui-serving.d.ts +4 -2
  126. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  127. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  128. package/types/apps/src/index.d.ts +11 -3
  129. package/types/apps/src/mcp-stdio.d.ts +2 -5
  130. package/types/apps/src/mcp.d.ts +8 -7
  131. package/types/apps/src/openapi.d.ts +8 -6
  132. package/types/apps/src/skills.d.ts +75 -0
  133. package/types/apps/src/ui-auth.d.ts +2 -2
  134. package/types/telemetry/src/browser-operations.d.ts +5 -2
  135. package/types/telemetry/src/config.d.ts +2 -0
  136. package/js/chunk-22WRQZT7.js +0 -389
  137. package/js/chunk-BKVL7XAJ.js +0 -47
  138. package/js/chunk-C24KEZXR.js +0 -59
  139. package/js/chunk-LOKGDT6B.js +0 -28
  140. package/js/chunk-MLKGABMK.js +0 -9
  141. package/types/apps/src/implementation/account-operations.d.ts +0 -32
@@ -1,13 +1,30 @@
1
1
  import {
2
+ DatabaseFieldReserved,
3
+ DatabaseLimitExceeded,
4
+ DatabaseSchema
5
+ } from "./chunk-N7YDVXYJ.js";
6
+ import {
7
+ CacheCommand,
8
+ CacheReply,
9
+ ProviderError
10
+ } from "./chunk-R3EV5FTO.js";
11
+ import {
12
+ AppSkillName,
13
+ AppSkills,
14
+ SkillLoadFailed
15
+ } from "./chunk-JU7VHODU.js";
16
+ import {
17
+ AccountId,
2
18
  HttpUrl,
3
19
  JsonObject as JsonObject2,
4
20
  JsonValue
5
- } from "./chunk-36DNRFZQ.js";
21
+ } from "./chunk-27F7W2LG.js";
6
22
  import {
7
23
  Any,
8
24
  ArraySchema,
9
25
  Boolean,
10
26
  Class2 as Class,
27
+ Context_exports,
11
28
  Cron_exports,
12
29
  Data_exports,
13
30
  Defect,
@@ -55,114 +72,324 @@ import {
55
72
  transformOptional,
56
73
  withConstructorDefault,
57
74
  withDefault
58
- } from "./chunk-2OTCEKL2.js";
75
+ } from "./chunk-CDL5PM2Q.js";
59
76
 
60
- // src/contracts/provider.ts
61
- var SecretsMethod = class extends Data_exports.TaggedClass(
62
- "secrets"
77
+ // src/contracts/router.ts
78
+ var reservedRouterKeys = /* @__PURE__ */ new Set([
79
+ "__proto__",
80
+ "constructor",
81
+ "prototype"
82
+ ]);
83
+ var RouterKey = Schema_exports.String.check(
84
+ Schema_exports.isPattern(/^[A-Za-z_][A-Za-z0-9_-]{0,99}$/),
85
+ Schema_exports.makeFilter((key) => !reservedRouterKeys.has(key))
86
+ );
87
+ var RouterIcon = Schema_exports.Struct({
88
+ src: Schema_exports.NonEmptyString,
89
+ mimeType: Schema_exports.optionalKey(Schema_exports.String),
90
+ sizes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
91
+ theme: Schema_exports.optionalKey(Schema_exports.Literals(["light", "dark"]))
92
+ });
93
+ var RouterMeta = Schema_exports.Struct({
94
+ title: Schema_exports.optionalKey(Schema_exports.String),
95
+ description: Schema_exports.optionalKey(Schema_exports.String),
96
+ instructions: Schema_exports.optionalKey(Schema_exports.String),
97
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
98
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String))
99
+ });
100
+
101
+ // src/contracts/tools.ts
102
+ var ToolAnnotations = Schema_exports.Struct({
103
+ title: Schema_exports.optionalKey(Schema_exports.String),
104
+ readOnlyHint: Schema_exports.optionalKey(Schema_exports.Boolean),
105
+ destructiveHint: Schema_exports.optionalKey(Schema_exports.Boolean),
106
+ idempotentHint: Schema_exports.optionalKey(Schema_exports.Boolean),
107
+ openWorldHint: Schema_exports.optionalKey(Schema_exports.Boolean)
108
+ });
109
+
110
+ // src/contracts/mcp.ts
111
+ var McpClientLimits = Schema_exports.Struct({
112
+ timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
113
+ maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
114
+ maxTools: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
115
+ maxPaginationCursors: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
116
+ cleanupTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
117
+ });
118
+ var defaultMcpClientLimits = McpClientLimits.make({
119
+ timeoutMs: 3e4,
120
+ maxTimeoutMs: 3e5,
121
+ maxTools: 5e4,
122
+ maxPaginationCursors: 1e3,
123
+ cleanupTimeoutMs: 1e3
124
+ });
125
+ var mcpSdkTimerCeilingMs = 2147483647;
126
+ var McpToolsOptions = Schema_exports.Struct({
127
+ url: HttpUrl,
128
+ accountId: Schema_exports.optional(AccountId),
129
+ headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
130
+ signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
131
+ timeoutMs: Schema_exports.optional(
132
+ Schema_exports.Number.check(
133
+ Schema_exports.isInt(),
134
+ Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
135
+ )
136
+ )
137
+ });
138
+ var McpToolResult = Schema_exports.Struct({
139
+ content: Schema_exports.Array(JsonObject2),
140
+ structuredContent: Schema_exports.optional(JsonObject2),
141
+ isError: Schema_exports.optional(Schema_exports.Boolean),
142
+ _meta: Schema_exports.optional(JsonObject2)
143
+ });
144
+ var McpToolMetadata = Schema_exports.Struct({
145
+ name: Schema_exports.String,
146
+ title: Schema_exports.optional(Schema_exports.String),
147
+ description: Schema_exports.optional(Schema_exports.String),
148
+ inputSchema: JsonObject2,
149
+ outputSchema: Schema_exports.optional(JsonObject2),
150
+ annotations: Schema_exports.optional(ToolAnnotations),
151
+ _meta: Schema_exports.optional(JsonObject2)
152
+ });
153
+ var McpServerHeader = Schema_exports.Struct({
154
+ name: Schema_exports.optionalKey(Schema_exports.String),
155
+ title: Schema_exports.optionalKey(Schema_exports.String),
156
+ version: Schema_exports.optionalKey(Schema_exports.String),
157
+ description: Schema_exports.optionalKey(Schema_exports.String),
158
+ websiteUrl: Schema_exports.optionalKey(Schema_exports.String),
159
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
160
+ instructions: Schema_exports.optionalKey(Schema_exports.String)
161
+ });
162
+ var McpError = class extends Schema_exports.TaggedError()("McpError", {
163
+ phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
164
+ reason: Schema_exports.Literals([
165
+ "request",
166
+ "unauthorized",
167
+ "invalid_response",
168
+ "timeout",
169
+ "invalid_input"
170
+ ]),
171
+ status: Schema_exports.optional(Schema_exports.Number)
172
+ }) {
173
+ };
174
+ var ProcessConfig = Schema_exports.Struct({
175
+ command: Schema_exports.NonEmptyString,
176
+ args: Schema_exports.Array(Schema_exports.String),
177
+ cwd: Schema_exports.optional(Schema_exports.String),
178
+ env: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
179
+ timeoutMs: Schema_exports.Int.check(
180
+ Schema_exports.isBetween({ minimum: 1, maximum: defaultMcpClientLimits.maxTimeoutMs })
181
+ )
182
+ });
183
+
184
+ // src/contracts/api-response-error.ts
185
+ var ApiErrorRecovery = Schema_exports.Struct({
186
+ action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
187
+ instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096))
188
+ });
189
+ var ApiErrorResponse = Schema_exports.Struct({
190
+ code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
191
+ status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
192
+ message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096)),
193
+ recovery: Schema_exports.optionalKey(ApiErrorRecovery)
194
+ });
195
+ var OpenapiResponseError = class extends Schema_exports.TaggedError()(
196
+ "OpenapiResponseError",
197
+ ApiErrorResponse.fields
63
198
  ) {
64
199
  };
65
- var OAuthClientAuth = Schema_exports.Literals([
66
- "none",
67
- "client_secret_post",
68
- "client_secret_basic",
69
- "client_secret_basic_raw"
200
+ var OpenapiErrorLimits = Schema_exports.Struct({
201
+ maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
202
+ readTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
203
+ });
204
+ var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
205
+ maxBodyBytes: 65536,
206
+ readTimeoutMs: 2e3
207
+ });
208
+
209
+ // src/contracts/failure.ts
210
+ var maxFailureMessageLength = 2048;
211
+ var FailureSource = Schema_exports.Literals(["app", "storage", "service"]);
212
+ var FailureName = Schema_exports.String.check(Schema_exports.isMaxLength(128));
213
+ var FailureCode = Schema_exports.String.check(Schema_exports.isMaxLength(128));
214
+ var FailureMessage = Schema_exports.String.check(Schema_exports.isMaxLength(maxFailureMessageLength));
215
+ var FailureDetail = {
216
+ source: Schema_exports.optionalKey(FailureSource),
217
+ errorName: Schema_exports.optionalKey(FailureName),
218
+ code: Schema_exports.optionalKey(FailureCode),
219
+ message: Schema_exports.optionalKey(FailureMessage)
220
+ };
221
+
222
+ // src/contracts/workflows.ts
223
+ var WorkflowRunId = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
224
+ var WorkflowName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
225
+ var durationUnits = {
226
+ millisecond: 1,
227
+ milliseconds: 1,
228
+ second: 1e3,
229
+ seconds: 1e3,
230
+ minute: 6e4,
231
+ minutes: 6e4,
232
+ hour: 36e5,
233
+ hours: 36e5,
234
+ day: 864e5,
235
+ days: 864e5,
236
+ week: 6048e5,
237
+ weeks: 6048e5
238
+ };
239
+ var workflowDurationMillis = (value) => {
240
+ if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? value : void 0;
241
+ const match = /^(\d+(?:\.\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(
242
+ value
243
+ );
244
+ const unit = match?.[2] === void 0 ? void 0 : durationUnits[match[2]];
245
+ if (unit === void 0) return void 0;
246
+ const result = Number(match?.[1]) * unit;
247
+ return Number.isFinite(result) ? result : void 0;
248
+ };
249
+ var WorkflowDuration = Schema_exports.Union([
250
+ Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0)),
251
+ Schema_exports.NonEmptyString
252
+ ]).check(Schema_exports.makeFilter((value) => workflowDurationMillis(value) !== void 0));
253
+ var WorkflowStepOptions = Schema_exports.Struct({
254
+ retries: Schema_exports.optionalKey(
255
+ Schema_exports.Struct({
256
+ limit: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)),
257
+ delay: WorkflowDuration,
258
+ backoff: Schema_exports.optionalKey(Schema_exports.Literals(["constant", "linear", "exponential"]))
259
+ })
260
+ ),
261
+ timeout: Schema_exports.optionalKey(WorkflowDuration)
262
+ });
263
+ var WorkflowFailureDetail = {
264
+ step: Schema_exports.optionalKey(Schema_exports.String.check(Schema_exports.isMaxLength(200))),
265
+ errorName: Schema_exports.optionalKey(FailureName),
266
+ message: Schema_exports.optionalKey(FailureMessage)
267
+ };
268
+ var WorkflowRunFailure = Schema_exports.Struct(WorkflowFailureDetail);
269
+ var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailure", {
270
+ ...WorkflowFailureDetail,
271
+ reason: Schema_exports.Literals([
272
+ "unavailable",
273
+ "not_found",
274
+ "input",
275
+ "output",
276
+ "operation",
277
+ "approval",
278
+ "credentials",
279
+ "terminated",
280
+ "execution",
281
+ "conflict",
282
+ "engine"
283
+ ]),
284
+ retryable: Schema_exports.Boolean
285
+ }) {
286
+ };
287
+ var NonRetryableError = class extends Error {
288
+ name = "NonRetryableError";
289
+ };
290
+ var WorkflowValue = JsonValue.check(
291
+ Schema_exports.makeFilter(
292
+ (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 1024 * 1024
293
+ )
294
+ );
295
+ var HostedWorkflow = Schema_exports.Struct({
296
+ name: WorkflowName,
297
+ description: Schema_exports.optionalKey(Schema_exports.String),
298
+ inputSchema: JsonObject2,
299
+ outputSchema: Schema_exports.optionalKey(JsonObject2)
300
+ });
301
+ var runFields = {
302
+ profile: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
303
+ id: WorkflowRunId,
304
+ app: Schema_exports.NonEmptyString,
305
+ deployment: Schema_exports.NonEmptyString,
306
+ workflow: WorkflowName,
307
+ createdAt: Schema_exports.String
308
+ };
309
+ var WorkflowRun = Schema_exports.Union([
310
+ Schema_exports.Struct({
311
+ ...runFields,
312
+ status: Schema_exports.Literals(["queued", "running", "waiting", "paused", "waitingForPause"])
313
+ }),
314
+ Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("complete"), output: WorkflowValue }),
315
+ Schema_exports.Struct({
316
+ ...runFields,
317
+ status: Schema_exports.Literal("errored"),
318
+ error: WorkflowFailure.fields.reason,
319
+ /** The failing step and the app's own error, when the run recorded them. */
320
+ failure: Schema_exports.optionalKey(WorkflowRunFailure)
321
+ }),
322
+ Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("terminated") })
70
323
  ]);
71
- var OAuthSecretClientAuth = Schema_exports.Literals([
72
- "client_secret_post",
73
- "client_secret_basic",
74
- "client_secret_basic_raw"
324
+ var WorkflowRunPage = Schema_exports.Struct({
325
+ items: Schema_exports.Array(WorkflowRun),
326
+ next: Schema_exports.optionalKey(WorkflowRunId)
327
+ });
328
+ var WorkflowReplay = Schema_exports.Struct({
329
+ key: Schema_exports.NonEmptyString,
330
+ fingerprint: Schema_exports.NonEmptyString
331
+ });
332
+ var WorkflowCommand = Schema_exports.Union([
333
+ Schema_exports.Struct({ operation: Schema_exports.Literal("workflows") }),
334
+ Schema_exports.Struct({
335
+ operation: Schema_exports.Literal("workflow-validate"),
336
+ name: WorkflowName,
337
+ input: JsonValue
338
+ }),
339
+ Schema_exports.Struct({
340
+ operation: Schema_exports.Literal("workflow-run"),
341
+ name: WorkflowName,
342
+ input: JsonValue
343
+ })
75
344
  ]);
76
- var oauthOptions = {
77
- grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
78
- tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth),
79
- /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
80
- resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
81
- };
82
- var OAuth2Config = Schema_exports.Union([
345
+ var WorkflowRpcCommand = Schema_exports.Union([
83
346
  Schema_exports.Struct({
84
- ...oauthOptions,
85
- discover: HttpUrl,
86
- authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
87
- tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
88
- scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
347
+ operation: Schema_exports.Literal("do"),
348
+ name: WorkflowName,
349
+ options: WorkflowStepOptions
89
350
  }),
90
351
  Schema_exports.Struct({
91
- ...oauthOptions,
92
- authorizationUrl: HttpUrl,
93
- tokenUrl: HttpUrl,
94
- scopes: Schema_exports.Array(Schema_exports.String),
95
- discover: Schema_exports.optionalKey(Schema_exports.Never)
352
+ operation: Schema_exports.Literal("sleep"),
353
+ name: WorkflowName,
354
+ duration: WorkflowDuration
96
355
  }),
97
356
  Schema_exports.Struct({
98
- grant: Schema_exports.Literal("client_credentials"),
99
- discover: HttpUrl,
100
- authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
101
- tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
102
- scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
103
- tokenEndpointAuthMethod: OAuthSecretClientAuth,
104
- resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
357
+ operation: Schema_exports.Literal("until"),
358
+ name: WorkflowName,
359
+ timestamp: Schema_exports.Finite
105
360
  }),
361
+ Schema_exports.Struct({ operation: Schema_exports.Literal("context") }),
106
362
  Schema_exports.Struct({
107
- grant: Schema_exports.Literal("client_credentials"),
108
- tokenUrl: HttpUrl,
109
- scopes: Schema_exports.Array(Schema_exports.String),
110
- tokenEndpointAuthMethod: OAuthSecretClientAuth,
111
- resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
112
- authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
113
- discover: Schema_exports.optionalKey(Schema_exports.Never)
363
+ operation: Schema_exports.Literal("invoke"),
364
+ kind: Schema_exports.Literals(["query", "mutation"]),
365
+ name: Schema_exports.NonEmptyString,
366
+ input: JsonValue,
367
+ stepId: Schema_exports.NonEmptyString,
368
+ timeout: Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0))
114
369
  })
115
370
  ]);
116
- var OAuth2AccessToken = Schema_exports.Struct({ access_token: Schema_exports.String });
117
- var OAuth2Method = class extends Data_exports.TaggedClass(
118
- "oauth2"
119
- ) {
120
- };
121
- var Provider = class extends Data_exports.Class {
122
- /** Declare zero or more accounts from this provider without performing I/O. */
123
- many() {
124
- return new ManyAccounts({ provider: this });
125
- }
126
- };
127
- var ManyAccounts = class extends Data_exports.TaggedClass("many") {
128
- };
129
-
130
- // src/contracts/schedules.ts
131
- var minimumIntervalMilliseconds = 6e4;
132
- var count = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
133
- var absent = Schema_exports.optionalKey(Schema_exports.Never);
134
- var Interval = Schema_exports.Union([
135
- Schema_exports.Struct({ seconds: count, minutes: absent, hours: absent }),
136
- Schema_exports.Struct({ seconds: absent, minutes: count, hours: absent }),
137
- Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count })
371
+ var WorkflowRpcResult = Schema_exports.Union([
372
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
373
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure })
138
374
  ]);
139
- var CalendarSchedule = Schema_exports.Struct({
140
- expression: Schema_exports.NonEmptyString,
141
- timezone: Schema_exports.NonEmptyString
142
- }).check(
143
- Schema_exports.makeFilter(
144
- (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
145
- )
146
- );
147
- var ScheduleTiming = Schema_exports.Union([
375
+ var WorkflowControlCommand = Schema_exports.Union([
148
376
  Schema_exports.Struct({
149
- kind: Schema_exports.Literal("interval"),
150
- milliseconds: Schema_exports.Int.check(
151
- Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds, {
152
- message: "Schedule intervals must be at least 60 seconds"
153
- }),
154
- Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
155
- )
377
+ operation: Schema_exports.Literal("start"),
378
+ workflow: WorkflowName,
379
+ input: WorkflowValue,
380
+ key: Schema_exports.optionalKey(Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)))
156
381
  }),
157
- Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
382
+ Schema_exports.Struct({ operation: Schema_exports.Literal("get"), run: WorkflowRunId }),
383
+ Schema_exports.Struct({
384
+ operation: Schema_exports.Literal("list"),
385
+ workflow: Schema_exports.optionalKey(WorkflowName),
386
+ cursor: Schema_exports.optionalKey(WorkflowRunId),
387
+ limit: Schema_exports.optionalKey(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: 100 })))
388
+ }),
389
+ Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
158
390
  ]);
159
- var OperationSchedule = Schema_exports.Struct({
160
- name: Schema_exports.NonEmptyString,
161
- timing: ScheduleTiming,
162
- input: JsonValue
163
- });
164
391
 
165
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/rpc/RpcSchema.js
392
+ // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/RpcSchema.js
166
393
  var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
167
394
  var schema = /* @__PURE__ */ declare(isStream);
168
395
  function Stream(success, error) {
@@ -173,7 +400,7 @@ function Stream(success, error) {
173
400
  });
174
401
  }
175
402
 
176
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/rpc/Rpc.js
403
+ // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/Rpc.js
177
404
  var TypeId = "~effect/rpc/Rpc";
178
405
  var Proto = {
179
406
  [TypeId]: TypeId,
@@ -291,7 +518,7 @@ var make2 = (tag2, options) => {
291
518
  });
292
519
  };
293
520
 
294
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/ai/McpSchema.js
521
+ // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/ai/McpSchema.js
295
522
  var optionalWithDefault = (schema2, defaultValue) => {
296
523
  const effect = sync(defaultValue);
297
524
  return optionalKey(schema2).pipe(decode({
@@ -561,7 +788,7 @@ var InternalError = class _InternalError extends (/* @__PURE__ */ Error2("effect
561
788
  message: "Not implemented"
562
789
  });
563
790
  };
564
- var McpError = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
791
+ var McpError2 = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
565
792
  var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
566
793
  ...ResultMeta.fields,
567
794
  /**
@@ -584,7 +811,7 @@ var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ S
584
811
  };
585
812
  var Initialize = class extends (/* @__PURE__ */ make2("initialize", {
586
813
  success: InitializeResult,
587
- error: McpError,
814
+ error: McpError2,
588
815
  payload: {
589
816
  ...RequestMeta.fields,
590
817
  /**
@@ -783,7 +1010,7 @@ var ReadResourceResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */
783
1010
  };
784
1011
  var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
785
1012
  success: ReadResourceResult,
786
- error: McpError,
1013
+ error: McpError2,
787
1014
  payload: {
788
1015
  ...RequestMeta.fields,
789
1016
  /**
@@ -796,7 +1023,7 @@ var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
796
1023
  };
797
1024
  var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
798
1025
  success: /* @__PURE__ */ Struct({}),
799
- error: McpError,
1026
+ error: McpError2,
800
1027
  payload: {
801
1028
  ...RequestMeta.fields,
802
1029
  /**
@@ -809,7 +1036,7 @@ var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
809
1036
  };
810
1037
  var Unsubscribe = class extends (/* @__PURE__ */ make2("resources/unsubscribe", {
811
1038
  success: /* @__PURE__ */ Struct({}),
812
- error: McpError,
1039
+ error: McpError2,
813
1040
  payload: {
814
1041
  ...RequestMeta.fields,
815
1042
  /**
@@ -953,7 +1180,7 @@ var GetPromptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema
953
1180
  };
954
1181
  var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
955
1182
  success: GetPromptResult,
956
- error: McpError,
1183
+ error: McpError2,
957
1184
  payload: {
958
1185
  ...RequestMeta.fields,
959
1186
  /**
@@ -968,7 +1195,7 @@ var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
968
1195
  }
969
1196
  })) {
970
1197
  };
971
- var ToolAnnotations = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1198
+ var ToolAnnotations2 = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
972
1199
  /**
973
1200
  * A human-readable title for the tool.
974
1201
  */
@@ -1037,7 +1264,7 @@ var Tool = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Tool")({
1037
1264
  /**
1038
1265
  * Optional additional tool information.
1039
1266
  */
1040
- annotations: /* @__PURE__ */ optional2(ToolAnnotations),
1267
+ annotations: /* @__PURE__ */ optional2(ToolAnnotations2),
1041
1268
  /**
1042
1269
  * Icons that clients can display for this tool.
1043
1270
  */
@@ -1073,7 +1300,7 @@ var CallToolResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/
1073
1300
  };
1074
1301
  var CallTool = class extends (/* @__PURE__ */ make2("tools/call", {
1075
1302
  success: CallToolResult,
1076
- error: McpError,
1303
+ error: McpError2,
1077
1304
  payload: {
1078
1305
  ...RequestMeta.fields,
1079
1306
  name: String,
@@ -1093,7 +1320,7 @@ var SetLevel = class extends (/* @__PURE__ */ make2("logging/setLevel", {
1093
1320
  level: LoggingLevel
1094
1321
  },
1095
1322
  success: /* @__PURE__ */ Struct({}),
1096
- error: McpError
1323
+ error: McpError2
1097
1324
  })) {
1098
1325
  };
1099
1326
  var LoggingMessageNotification = class extends (/* @__PURE__ */ make2("notifications/message", {
@@ -1239,7 +1466,7 @@ var CreateMessageResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1239
1466
  };
1240
1467
  var CreateMessage = class extends (/* @__PURE__ */ make2("sampling/createMessage", {
1241
1468
  success: CreateMessageResult,
1242
- error: McpError,
1469
+ error: McpError2,
1243
1470
  payload: {
1244
1471
  messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
1245
1472
  /**
@@ -1450,7 +1677,7 @@ var ElicitDeclineResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1450
1677
  var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
1451
1678
  var Elicit = class extends (/* @__PURE__ */ make2("elicitation/create", {
1452
1679
  success: ElicitResult,
1453
- error: McpError,
1680
+ error: McpError2,
1454
1681
  payload: ElicitRequestParams
1455
1682
  })) {
1456
1683
  };
@@ -1516,48 +1743,209 @@ ${JSON.stringify(input, null, 2)}`,
1516
1743
  requestedSchema: { type: "object", properties: {} }
1517
1744
  });
1518
1745
 
1519
- // src/contracts/workflows.ts
1520
- var WorkflowRunId = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
1521
- var WorkflowName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
1522
- var durationUnits = {
1523
- millisecond: 1,
1524
- milliseconds: 1,
1525
- second: 1e3,
1526
- seconds: 1e3,
1527
- minute: 6e4,
1528
- minutes: 6e4,
1529
- hour: 36e5,
1530
- hours: 36e5,
1531
- day: 864e5,
1532
- days: 864e5,
1533
- week: 6048e5,
1534
- weeks: 6048e5
1746
+ // src/contracts/webhook-protocol.ts
1747
+ var WebhookTransportLimits = Schema_exports.Struct({
1748
+ maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1749
+ });
1750
+ var defaultWebhookTransportLimits = WebhookTransportLimits.make({
1751
+ maxBodyBytes: 1024 * 1024
1752
+ });
1753
+ var encodedBodyChars = 4 * Math.ceil(defaultWebhookTransportLimits.maxBodyBytes / 3);
1754
+ var WebhookRequestData = Schema_exports.Struct({
1755
+ url: HttpUrl,
1756
+ method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]),
1757
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1758
+ body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1759
+ });
1760
+ var WebhookResponseData = Schema_exports.Struct({
1761
+ status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 200, maximum: 599 })),
1762
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1763
+ body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1764
+ });
1765
+ var ManualWebhookSetup = Schema_exports.Struct({
1766
+ instructions: Schema_exports.NonEmptyString,
1767
+ signingSecret: Schema_exports.Literals(["executor", "provider"])
1768
+ });
1769
+ var ManualWebhookDescriptor = Schema_exports.Struct({
1770
+ ...ManualWebhookSetup.fields,
1771
+ stateSchema: JsonObject2
1772
+ });
1773
+ var HostedWebhook = Schema_exports.Struct({
1774
+ name: Schema_exports.NonEmptyString,
1775
+ account: Schema_exports.NonEmptyString,
1776
+ configSchema: JsonObject2,
1777
+ setup: Schema_exports.optionalKey(ManualWebhookDescriptor)
1778
+ });
1779
+ var identity = {
1780
+ name: Schema_exports.NonEmptyString,
1781
+ subscriptionId: Schema_exports.NonEmptyString,
1782
+ sourceAccount: AccountId,
1783
+ callbackUrl: HttpUrl,
1784
+ secret: Schema_exports.String,
1785
+ config: JsonValue
1786
+ };
1787
+ var WebhookCommand = Schema_exports.Union([
1788
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhooks") }),
1789
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-validate"), ...identity }),
1790
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-complete"), ...identity, state: JsonValue }),
1791
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-register"), ...identity }),
1792
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-unregister"), ...identity, state: JsonValue }),
1793
+ Schema_exports.Struct({
1794
+ operation: Schema_exports.Literal("webhook-handle"),
1795
+ ...identity,
1796
+ state: JsonValue,
1797
+ request: WebhookRequestData
1798
+ })
1799
+ ]);
1800
+
1801
+ // src/contracts/provider.ts
1802
+ var SecretsMethod = class extends Data_exports.TaggedClass(
1803
+ "secrets"
1804
+ ) {
1535
1805
  };
1536
- var workflowDurationMillis = (value) => {
1537
- if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? value : void 0;
1538
- const match = /^(\d+(?:\.\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(
1539
- value
1540
- );
1541
- const unit = match?.[2] === void 0 ? void 0 : durationUnits[match[2]];
1542
- if (unit === void 0) return void 0;
1543
- const result = Number(match?.[1]) * unit;
1544
- return Number.isFinite(result) ? result : void 0;
1806
+ var OAuthClientAuth = Schema_exports.Literals([
1807
+ "none",
1808
+ "client_secret_post",
1809
+ "client_secret_basic",
1810
+ "client_secret_basic_raw"
1811
+ ]);
1812
+ var OAuthSecretClientAuth = Schema_exports.Literals([
1813
+ "client_secret_post",
1814
+ "client_secret_basic",
1815
+ "client_secret_basic_raw"
1816
+ ]);
1817
+ var reservedAuthorizationParams = /* @__PURE__ */ new Set([
1818
+ "response_type",
1819
+ "client_id",
1820
+ "redirect_uri",
1821
+ "state",
1822
+ "scope",
1823
+ "code_challenge",
1824
+ "code_challenge_method",
1825
+ "nonce",
1826
+ "resource",
1827
+ "request",
1828
+ "request_uri"
1829
+ ]);
1830
+ var OAuthAuthorizationParams = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
1831
+ Schema_exports.makeFilter(
1832
+ (params) => Object.keys(params).every((key) => !reservedAuthorizationParams.has(key)),
1833
+ {
1834
+ message: "Authorization parameters cannot replace protocol parameters such as state or scope."
1835
+ }
1836
+ )
1837
+ );
1838
+ var oauthOptions = {
1839
+ grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
1840
+ authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams),
1841
+ tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth),
1842
+ /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
1843
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1545
1844
  };
1546
- var WorkflowDuration = Schema_exports.Union([
1547
- Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0)),
1548
- Schema_exports.NonEmptyString
1549
- ]).check(Schema_exports.makeFilter((value) => workflowDurationMillis(value) !== void 0));
1550
- var WorkflowStepOptions = Schema_exports.Struct({
1551
- retries: Schema_exports.optionalKey(
1552
- Schema_exports.Struct({
1553
- limit: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)),
1554
- delay: WorkflowDuration,
1555
- backoff: Schema_exports.optionalKey(Schema_exports.Literals(["constant", "linear", "exponential"]))
1556
- })
1557
- ),
1558
- timeout: Schema_exports.optionalKey(WorkflowDuration)
1845
+ var OAuth2Config = Schema_exports.Union([
1846
+ Schema_exports.Struct({
1847
+ ...oauthOptions,
1848
+ discover: HttpUrl,
1849
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1850
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1851
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1852
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
1853
+ }),
1854
+ Schema_exports.Struct({
1855
+ ...oauthOptions,
1856
+ authorizationUrl: HttpUrl,
1857
+ tokenUrl: HttpUrl,
1858
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
1859
+ scopes: Schema_exports.Array(Schema_exports.String),
1860
+ /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
1861
+ issuer: Schema_exports.optionalKey(HttpUrl),
1862
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
1863
+ }),
1864
+ Schema_exports.Struct({
1865
+ grant: Schema_exports.Literal("client_credentials"),
1866
+ discover: HttpUrl,
1867
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1868
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1869
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1870
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
1871
+ tokenEndpointAuthMethod: OAuthSecretClientAuth,
1872
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1873
+ }),
1874
+ Schema_exports.Struct({
1875
+ grant: Schema_exports.Literal("client_credentials"),
1876
+ tokenUrl: HttpUrl,
1877
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
1878
+ scopes: Schema_exports.Array(Schema_exports.String),
1879
+ tokenEndpointAuthMethod: OAuthSecretClientAuth,
1880
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
1881
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1882
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
1883
+ })
1884
+ ]);
1885
+ var OAuth2AccessToken = Schema_exports.Struct({ access_token: Schema_exports.String });
1886
+ var OAuth2Method = class extends Data_exports.TaggedClass(
1887
+ "oauth2"
1888
+ ) {
1889
+ };
1890
+ var displayText = Schema_exports.String.check(Schema_exports.isMinLength(1), Schema_exports.isMaxLength(255));
1891
+ var AccountInfo = Schema_exports.Struct({
1892
+ externalId: Schema_exports.optionalKey(displayText),
1893
+ displayName: Schema_exports.optionalKey(displayText),
1894
+ username: Schema_exports.optionalKey(displayText),
1895
+ email: Schema_exports.optionalKey(displayText),
1896
+ avatarUrl: Schema_exports.optionalKey(HttpUrl),
1897
+ profileUrl: Schema_exports.optionalKey(HttpUrl)
1559
1898
  });
1560
- var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailure", {
1899
+ var AccountCheckResult = Schema_exports.Struct({ accountInfo: Schema_exports.optionalKey(AccountInfo) });
1900
+ var Provider = class extends Data_exports.Class {
1901
+ /** Declare zero or more accounts from this provider without performing I/O. */
1902
+ many() {
1903
+ return new ManyAccounts({ provider: this });
1904
+ }
1905
+ };
1906
+ var ManyAccounts = class extends Data_exports.TaggedClass("many") {
1907
+ };
1908
+
1909
+ // src/contracts/protocol-version.ts
1910
+ var frameworkProtocol = 5;
1911
+
1912
+ // src/contracts/schedules.ts
1913
+ var minimumIntervalMilliseconds = 6e4;
1914
+ var count = Schema_exports.Int.check(Schema_exports.isGreaterThan(0));
1915
+ var absent = Schema_exports.optionalKey(Schema_exports.Never);
1916
+ var Interval = Schema_exports.Union([
1917
+ Schema_exports.Struct({ seconds: count, minutes: absent, hours: absent }),
1918
+ Schema_exports.Struct({ seconds: absent, minutes: count, hours: absent }),
1919
+ Schema_exports.Struct({ seconds: absent, minutes: absent, hours: count })
1920
+ ]);
1921
+ var CalendarSchedule = Schema_exports.Struct({
1922
+ expression: Schema_exports.NonEmptyString,
1923
+ timezone: Schema_exports.NonEmptyString
1924
+ }).check(
1925
+ Schema_exports.makeFilter(
1926
+ (value) => value.expression.trim().split(/\s+/).length === 5 && Result_exports.isSuccess(Cron_exports.parse(value.expression, value.timezone))
1927
+ )
1928
+ );
1929
+ var ScheduleTiming = Schema_exports.Union([
1930
+ Schema_exports.Struct({
1931
+ kind: Schema_exports.Literal("interval"),
1932
+ milliseconds: Schema_exports.Int.check(
1933
+ Schema_exports.makeFilter((value) => value >= minimumIntervalMilliseconds, {
1934
+ message: "Schedule intervals must be at least 60 seconds"
1935
+ }),
1936
+ Schema_exports.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)
1937
+ )
1938
+ }),
1939
+ Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
1940
+ ]);
1941
+ var OperationSchedule = Schema_exports.Struct({
1942
+ name: Schema_exports.NonEmptyString,
1943
+ timing: ScheduleTiming,
1944
+ input: JsonValue
1945
+ });
1946
+
1947
+ // src/contracts/protocols/1.ts
1948
+ var WorkflowFailure2 = class extends Schema_exports.TaggedError()("WorkflowFailure", {
1561
1949
  reason: Schema_exports.Literals([
1562
1950
  "unavailable",
1563
1951
  "not_found",
@@ -1574,108 +1962,558 @@ var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailur
1574
1962
  retryable: Schema_exports.Boolean
1575
1963
  }) {
1576
1964
  };
1577
- var NonRetryableError = class extends Error {
1578
- name = "NonRetryableError";
1579
- };
1580
- var WorkflowValue = JsonValue.check(
1581
- Schema_exports.makeFilter(
1582
- (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 1024 * 1024
1965
+ var WorkflowRpcResult2 = Schema_exports.Union([
1966
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
1967
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure2 })
1968
+ ]);
1969
+ var DeclaredAuthMethod = Schema_exports.Union([
1970
+ Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
1971
+ Schema_exports.Struct({
1972
+ type: Schema_exports.Literal("oauth2"),
1973
+ ...OAuth2Config.members[0].fields,
1974
+ response: JsonObject2
1975
+ }),
1976
+ Schema_exports.Struct({
1977
+ type: Schema_exports.Literal("oauth2"),
1978
+ ...OAuth2Config.members[1].fields,
1979
+ response: JsonObject2
1980
+ }),
1981
+ Schema_exports.Struct({
1982
+ type: Schema_exports.Literal("oauth2"),
1983
+ ...OAuth2Config.members[2].fields,
1984
+ response: JsonObject2
1985
+ }),
1986
+ Schema_exports.Struct({
1987
+ type: Schema_exports.Literal("oauth2"),
1988
+ ...OAuth2Config.members[3].fields,
1989
+ response: JsonObject2
1990
+ })
1991
+ ]);
1992
+ var DeclaredProvider = Schema_exports.Struct({
1993
+ name: Schema_exports.NonEmptyString,
1994
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod)
1995
+ });
1996
+ var DeclaredRequirements = Schema_exports.Struct({
1997
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
1998
+ capabilities: Schema_exports.optionalKey(
1999
+ Schema_exports.Struct({
2000
+ skills: Schema_exports.Literal(true),
2001
+ /** Accepts inspect detail and tools. Earlier builds reject both as excess fields. */
2002
+ toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2003
+ /** Accepts skills sources and reports whether the catalog includes a live loader. */
2004
+ skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2005
+ /** Accepts scheduled inspection. Earlier builds reject it as an excess field. */
2006
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
2007
+ })
2008
+ ),
2009
+ database: Schema_exports.optionalKey(DatabaseSchema),
2010
+ accounts: Schema_exports.Record(
2011
+ Schema_exports.NonEmptyString,
2012
+ Schema_exports.Struct({
2013
+ definition: DeclaredProvider,
2014
+ cardinality: Schema_exports.Literals(["one", "many"])
2015
+ })
1583
2016
  )
2017
+ });
2018
+ var ResolvedAccount = Schema_exports.Struct({
2019
+ id: AccountId,
2020
+ provider: DeclaredProvider,
2021
+ method: Schema_exports.NonEmptyString,
2022
+ /**
2023
+ * Changes when the account is reconnected or its credentials replaced, not on renewal. Hosts
2024
+ * send it since credential generations; `apps@0.0.1-beta.0` and `beta.1` ignore it.
2025
+ */
2026
+ generation: Schema_exports.optionalKey(Schema_exports.Int),
2027
+ fields: JsonObject2
2028
+ });
2029
+ var ResolvedAccounts = Schema_exports.Record(
2030
+ Schema_exports.NonEmptyString,
2031
+ Schema_exports.Union([ResolvedAccount, Schema_exports.Array(ResolvedAccount)])
1584
2032
  );
1585
- var HostedWorkflow = Schema_exports.Struct({
1586
- name: WorkflowName,
1587
- description: Schema_exports.optionalKey(Schema_exports.String),
2033
+ var TrustedToolApproval = Schema_exports.Struct({ tool: Schema_exports.NonEmptyString, input: JsonValue });
2034
+ var InvocationDeadline = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
2035
+ var HostedTool = Schema_exports.Struct({
2036
+ schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
2037
+ name: Schema_exports.NonEmptyString,
2038
+ description: Schema_exports.String,
1588
2039
  inputSchema: JsonObject2,
1589
- outputSchema: Schema_exports.optionalKey(JsonObject2)
2040
+ readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2041
+ title: Schema_exports.optionalKey(Schema_exports.String),
2042
+ outputSchema: Schema_exports.optionalKey(JsonObject2),
2043
+ annotations: Schema_exports.optionalKey(ToolAnnotations),
2044
+ _meta: Schema_exports.optionalKey(JsonObject2)
1590
2045
  });
1591
- var runFields = {
1592
- profile: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
1593
- id: WorkflowRunId,
1594
- app: Schema_exports.NonEmptyString,
1595
- deployment: Schema_exports.NonEmptyString,
1596
- workflow: WorkflowName,
1597
- createdAt: Schema_exports.String
1598
- };
1599
- var WorkflowRun = Schema_exports.Union([
2046
+ var HostedToolSummary = HostedTool.mapFields(
2047
+ ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2048
+ );
2049
+ var SkillSources = Schema_exports.Struct({ skills: AppSkills, dynamic: Schema_exports.Boolean });
2050
+ var SkillCatalogResponse = Schema_exports.Union([SkillSources, AppSkills]);
2051
+ var HostRequest = Schema_exports.Union([
2052
+ WorkflowCommand,
2053
+ WebhookCommand,
2054
+ Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
1600
2055
  Schema_exports.Struct({
1601
- ...runFields,
1602
- status: Schema_exports.Literals(["queued", "running", "waiting", "paused", "waitingForPause"])
2056
+ operation: Schema_exports.Literal("inspect"),
2057
+ /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
2058
+ detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
2059
+ /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
2060
+ tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2061
+ /**
2062
+ * Describe only declared operations that have schedules, without dynamic tool discovery.
2063
+ * Only builds that declare the scheduledTools capability accept this.
2064
+ */
2065
+ scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
1603
2066
  }),
1604
- Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("complete"), output: WorkflowValue }),
1605
2067
  Schema_exports.Struct({
1606
- ...runFields,
1607
- status: Schema_exports.Literal("errored"),
1608
- error: WorkflowFailure.fields.reason
2068
+ operation: Schema_exports.Literal("skills"),
2069
+ /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
2070
+ sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
1609
2071
  }),
1610
- Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("terminated") })
1611
- ]);
1612
- var WorkflowRunPage = Schema_exports.Struct({
1613
- items: Schema_exports.Array(WorkflowRun),
1614
- next: Schema_exports.optionalKey(WorkflowRunId)
1615
- });
1616
- var WorkflowReplay = Schema_exports.Struct({
1617
- key: Schema_exports.NonEmptyString,
1618
- fingerprint: Schema_exports.NonEmptyString
1619
- });
1620
- var WorkflowCommand = Schema_exports.Union([
1621
- Schema_exports.Struct({ operation: Schema_exports.Literal("workflows") }),
1622
2072
  Schema_exports.Struct({
1623
- operation: Schema_exports.Literal("workflow-validate"),
1624
- name: WorkflowName,
2073
+ operation: Schema_exports.Literal("query"),
2074
+ name: Schema_exports.NonEmptyString,
1625
2075
  input: JsonValue
1626
2076
  }),
1627
2077
  Schema_exports.Struct({
1628
- operation: Schema_exports.Literal("workflow-run"),
1629
- name: WorkflowName,
2078
+ operation: Schema_exports.Literal("mutate"),
2079
+ name: Schema_exports.NonEmptyString,
2080
+ input: JsonValue
2081
+ }),
2082
+ Schema_exports.Struct({
2083
+ operation: Schema_exports.Literal("call"),
2084
+ tool: Schema_exports.NonEmptyString,
1630
2085
  input: JsonValue
1631
2086
  })
1632
2087
  ]);
1633
- var WorkflowRpcCommand = Schema_exports.Union([
2088
+ var HostRequestInvalid = class extends Schema_exports.TaggedError()(
2089
+ "HostRequestInvalid",
2090
+ {}
2091
+ ) {
2092
+ };
2093
+ var HostAccountsInvalid = class extends Schema_exports.TaggedError()(
2094
+ "HostAccountsInvalid",
2095
+ {}
2096
+ ) {
2097
+ };
2098
+ var HostDeclarationInvalid = class extends Schema_exports.TaggedError()(
2099
+ "HostDeclarationInvalid",
2100
+ {}
2101
+ ) {
2102
+ };
2103
+ var HostEvaluationFailed = class extends Schema_exports.TaggedError()(
2104
+ "HostEvaluationFailed",
2105
+ {}
2106
+ ) {
2107
+ };
2108
+ var HostOperationNotFound = class extends Schema_exports.TaggedError()(
2109
+ "HostOperationNotFound",
2110
+ {}
2111
+ ) {
2112
+ };
2113
+ var HostOperationFailed = class extends Schema_exports.TaggedError()(
2114
+ "HostOperationFailed",
2115
+ {}
2116
+ ) {
2117
+ };
2118
+ var HostToolNotFound = class extends Schema_exports.TaggedError()(
2119
+ "HostToolNotFound",
2120
+ {}
2121
+ ) {
2122
+ };
2123
+ var InputProblem = Schema_exports.String.check(Schema_exports.isMaxLength(512));
2124
+ var maxInputProblems = 10;
2125
+ var HostInputInvalid = class extends Schema_exports.TaggedError()("HostInputInvalid", {
2126
+ problems: Schema_exports.optionalKey(
2127
+ Schema_exports.Array(InputProblem).check(Schema_exports.isMaxLength(maxInputProblems))
2128
+ )
2129
+ }) {
2130
+ };
2131
+ var HostToolBlocked = class extends Schema_exports.TaggedError()("HostToolBlocked", {}) {
2132
+ };
2133
+ var HostToolApprovalRequired = class extends Schema_exports.TaggedError()(
2134
+ "HostToolApprovalRequired",
2135
+ { input: JsonValue, elicitation: ApprovalElicitation }
2136
+ ) {
2137
+ };
2138
+ var HostToolPolicyFailed = class extends Schema_exports.TaggedError()(
2139
+ "HostToolPolicyFailed",
2140
+ {}
2141
+ ) {
2142
+ };
2143
+ var HostOutputInvalid = class extends Schema_exports.TaggedError()(
2144
+ "HostOutputInvalid",
2145
+ {}
2146
+ ) {
2147
+ };
2148
+ var HostError = Schema_exports.Union([
2149
+ OpenapiResponseError,
2150
+ ProviderError,
2151
+ McpError,
2152
+ SkillLoadFailed,
2153
+ WorkflowFailure2,
2154
+ HostRequestInvalid,
2155
+ HostAccountsInvalid,
2156
+ HostDeclarationInvalid,
2157
+ HostEvaluationFailed,
2158
+ HostOperationNotFound,
2159
+ HostOperationFailed,
2160
+ HostToolNotFound,
2161
+ HostInputInvalid,
2162
+ HostOutputInvalid,
2163
+ HostToolBlocked,
2164
+ HostToolApprovalRequired,
2165
+ HostToolPolicyFailed,
2166
+ ElicitationFailed
2167
+ ]);
2168
+ var HostResponse = Schema_exports.Union([
1634
2169
  Schema_exports.Struct({
1635
- operation: Schema_exports.Literal("do"),
1636
- name: WorkflowName,
1637
- options: WorkflowStepOptions
2170
+ ok: Schema_exports.Literal(true),
2171
+ value: JsonValue,
2172
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
1638
2173
  }),
2174
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError })
2175
+ ]);
2176
+ var HostInvocation = Schema_exports.Struct({
2177
+ command: HostRequest,
2178
+ accounts: ResolvedAccounts,
2179
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2180
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2181
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2182
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2183
+ });
2184
+ var protocol1 = {
2185
+ version: 1,
2186
+ schemas: {
2187
+ invocation: HostInvocation,
2188
+ request: HostRequest,
2189
+ response: HostResponse,
2190
+ requirements: DeclaredRequirements,
2191
+ tools: Schema_exports.Array(HostedTool),
2192
+ toolSummaries: Schema_exports.Array(HostedToolSummary),
2193
+ skills: SkillCatalogResponse,
2194
+ elicitationRequest: FormElicitation,
2195
+ elicitationReply: ElicitationReply,
2196
+ workflowStep: WorkflowRpcCommand,
2197
+ workflowStepReply: WorkflowRpcResult2,
2198
+ workflowControl: WorkflowControlCommand,
2199
+ cacheCommand: CacheCommand,
2200
+ cacheReply: CacheReply
2201
+ }
2202
+ };
2203
+
2204
+ // src/contracts/protocols/2.ts
2205
+ var SkillSources2 = Schema_exports.Struct({
2206
+ skills: AppSkills,
2207
+ dynamic: Schema_exports.Boolean,
2208
+ cached: Schema_exports.optionalKey(Schema_exports.Boolean)
2209
+ });
2210
+ var SkillCatalogResponse2 = Schema_exports.Union([SkillSources2, AppSkills]);
2211
+ var protocol2 = {
2212
+ version: 2,
2213
+ schemas: { ...protocol1.schemas, skills: SkillCatalogResponse2 }
2214
+ };
2215
+
2216
+ // src/contracts/protocols/3.ts
2217
+ var HostDeclarationInvalid2 = class extends Schema_exports.TaggedError()(
2218
+ "HostDeclarationInvalid",
2219
+ FailureDetail
2220
+ ) {
2221
+ };
2222
+ var HostEvaluationFailed2 = class extends Schema_exports.TaggedError()(
2223
+ "HostEvaluationFailed",
2224
+ FailureDetail
2225
+ ) {
2226
+ };
2227
+ var HostOperationFailed2 = class extends Schema_exports.TaggedError()(
2228
+ "HostOperationFailed",
2229
+ FailureDetail
2230
+ ) {
2231
+ };
2232
+ var HostError2 = Schema_exports.Union([
2233
+ OpenapiResponseError,
2234
+ ProviderError,
2235
+ McpError,
2236
+ SkillLoadFailed,
2237
+ WorkflowFailure,
2238
+ HostRequestInvalid,
2239
+ HostAccountsInvalid,
2240
+ HostDeclarationInvalid2,
2241
+ HostEvaluationFailed2,
2242
+ HostOperationNotFound,
2243
+ HostOperationFailed2,
2244
+ DatabaseLimitExceeded,
2245
+ DatabaseFieldReserved,
2246
+ HostToolNotFound,
2247
+ HostInputInvalid,
2248
+ HostOutputInvalid,
2249
+ HostToolBlocked,
2250
+ HostToolApprovalRequired,
2251
+ HostToolPolicyFailed,
2252
+ ElicitationFailed
2253
+ ]);
2254
+ var HostResponse2 = Schema_exports.Union([
1639
2255
  Schema_exports.Struct({
1640
- operation: Schema_exports.Literal("sleep"),
1641
- name: WorkflowName,
1642
- duration: WorkflowDuration
2256
+ ok: Schema_exports.Literal(true),
2257
+ value: JsonValue,
2258
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
1643
2259
  }),
2260
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError2 })
2261
+ ]);
2262
+ var protocol3 = {
2263
+ version: 3,
2264
+ schemas: {
2265
+ invocation: HostInvocation,
2266
+ request: HostRequest,
2267
+ response: HostResponse2,
2268
+ requirements: DeclaredRequirements,
2269
+ tools: Schema_exports.Array(HostedTool),
2270
+ toolSummaries: Schema_exports.Array(HostedToolSummary),
2271
+ skills: SkillCatalogResponse2,
2272
+ elicitationRequest: FormElicitation,
2273
+ elicitationReply: ElicitationReply,
2274
+ workflowStep: WorkflowRpcCommand,
2275
+ workflowStepReply: WorkflowRpcResult,
2276
+ workflowControl: WorkflowControlCommand,
2277
+ cacheCommand: CacheCommand,
2278
+ cacheReply: CacheReply
2279
+ }
2280
+ };
2281
+
2282
+ // src/contracts/protocols/4.ts
2283
+ var HostedTool2 = Schema_exports.Struct({
2284
+ schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
2285
+ name: Schema_exports.NonEmptyString,
2286
+ router: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
2287
+ tags: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2288
+ description: Schema_exports.String,
2289
+ inputSchema: JsonObject2,
2290
+ readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
2291
+ title: Schema_exports.optionalKey(Schema_exports.String),
2292
+ outputSchema: Schema_exports.optionalKey(JsonObject2),
2293
+ annotations: Schema_exports.optionalKey(ToolAnnotations),
2294
+ _meta: Schema_exports.optionalKey(JsonObject2)
2295
+ });
2296
+ var HostedToolSummary2 = HostedTool2.mapFields(
2297
+ ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
2298
+ );
2299
+ var HostRouterError = Schema_exports.Union([
2300
+ ProviderError,
2301
+ McpError,
2302
+ SkillLoadFailed,
2303
+ HostDeclarationInvalid2,
2304
+ HostEvaluationFailed2
2305
+ ]);
2306
+ var HostedRouter = Schema_exports.Struct({
2307
+ path: Schema_exports.String,
2308
+ title: Schema_exports.optionalKey(Schema_exports.String),
2309
+ description: Schema_exports.optionalKey(Schema_exports.String),
2310
+ icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
2311
+ tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String)),
2312
+ skill: Schema_exports.optionalKey(AppSkillName),
2313
+ error: Schema_exports.optionalKey(HostRouterError)
2314
+ });
2315
+ var HostedCatalog = Schema_exports.Struct({
2316
+ tools: Schema_exports.Array(HostedTool2),
2317
+ routers: Schema_exports.Array(HostedRouter)
2318
+ });
2319
+ var HostedCatalogSummary = Schema_exports.Struct({
2320
+ tools: Schema_exports.Array(HostedToolSummary2),
2321
+ routers: Schema_exports.Array(HostedRouter)
2322
+ });
2323
+ var ToolKind = Schema_exports.Literals(["query", "mutation"]);
2324
+ var HostRequest2 = Schema_exports.Union([
2325
+ WorkflowCommand,
2326
+ WebhookCommand,
2327
+ Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
1644
2328
  Schema_exports.Struct({
1645
- operation: Schema_exports.Literal("until"),
1646
- name: WorkflowName,
1647
- timestamp: Schema_exports.Finite
2329
+ operation: Schema_exports.Literal("inspect"),
2330
+ /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
2331
+ detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
2332
+ /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
2333
+ tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
2334
+ /**
2335
+ * Describe only declared operations that have schedules, without dynamic tool discovery.
2336
+ * Only builds that declare the scheduledTools capability accept this.
2337
+ */
2338
+ scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
1648
2339
  }),
1649
- Schema_exports.Struct({ operation: Schema_exports.Literal("context") }),
1650
2340
  Schema_exports.Struct({
1651
- operation: Schema_exports.Literal("invoke"),
1652
- kind: Schema_exports.Literals(["query", "mutation"]),
2341
+ operation: Schema_exports.Literal("skills"),
2342
+ /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
2343
+ sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
2344
+ }),
2345
+ Schema_exports.Struct({
2346
+ operation: Schema_exports.Literal("query"),
1653
2347
  name: Schema_exports.NonEmptyString,
1654
- input: JsonValue,
1655
- stepId: Schema_exports.NonEmptyString,
1656
- timeout: Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0))
1657
- })
1658
- ]);
1659
- var WorkflowRpcResult = Schema_exports.Union([
1660
- Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
1661
- Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure })
1662
- ]);
1663
- var WorkflowControlCommand = Schema_exports.Union([
2348
+ input: JsonValue
2349
+ }),
1664
2350
  Schema_exports.Struct({
1665
- operation: Schema_exports.Literal("start"),
1666
- workflow: WorkflowName,
1667
- input: WorkflowValue,
1668
- key: Schema_exports.optionalKey(Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)))
2351
+ operation: Schema_exports.Literal("mutate"),
2352
+ name: Schema_exports.NonEmptyString,
2353
+ input: JsonValue
1669
2354
  }),
1670
- Schema_exports.Struct({ operation: Schema_exports.Literal("get"), run: WorkflowRunId }),
1671
2355
  Schema_exports.Struct({
1672
- operation: Schema_exports.Literal("list"),
1673
- workflow: Schema_exports.optionalKey(WorkflowName),
1674
- cursor: Schema_exports.optionalKey(WorkflowRunId),
1675
- limit: Schema_exports.optionalKey(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: 100 })))
2356
+ operation: Schema_exports.Literal("call"),
2357
+ tool: Schema_exports.NonEmptyString,
2358
+ /**
2359
+ * The caller's claim; the bundle rejects a call whose tool has the other kind. The host omits
2360
+ * it for a tool its catalog does not list, and then opens storage for writing.
2361
+ */
2362
+ kind: Schema_exports.optionalKey(ToolKind),
2363
+ input: JsonValue
2364
+ })
2365
+ ]);
2366
+ var HostKindMismatch = class extends Schema_exports.TaggedError()("HostKindMismatch", {
2367
+ tool: Schema_exports.NonEmptyString,
2368
+ requested: ToolKind,
2369
+ actual: ToolKind
2370
+ }) {
2371
+ };
2372
+ var HostError3 = Schema_exports.Union([...HostError2.members, HostKindMismatch]);
2373
+ var HostResponse3 = Schema_exports.Union([
2374
+ Schema_exports.Struct({
2375
+ ok: Schema_exports.Literal(true),
2376
+ value: JsonValue,
2377
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
1676
2378
  }),
1677
- Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
2379
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError3 })
2380
+ ]);
2381
+ var HostInvocation2 = Schema_exports.Struct({
2382
+ command: HostRequest2,
2383
+ accounts: ResolvedAccounts,
2384
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2385
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2386
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2387
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2388
+ });
2389
+ var protocol4 = {
2390
+ version: 4,
2391
+ schemas: {
2392
+ invocation: HostInvocation2,
2393
+ request: HostRequest2,
2394
+ response: HostResponse3,
2395
+ requirements: DeclaredRequirements,
2396
+ catalog: HostedCatalog,
2397
+ catalogSummary: HostedCatalogSummary,
2398
+ skills: SkillCatalogResponse2,
2399
+ elicitationRequest: FormElicitation,
2400
+ elicitationReply: ElicitationReply,
2401
+ workflowStep: WorkflowRpcCommand,
2402
+ workflowStepReply: WorkflowRpcResult,
2403
+ workflowControl: WorkflowControlCommand,
2404
+ cacheCommand: CacheCommand,
2405
+ cacheReply: CacheReply
2406
+ }
2407
+ };
2408
+
2409
+ // src/contracts/protocols/5.ts
2410
+ var DeclaredRequirements2 = Schema_exports.Struct({
2411
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
2412
+ capabilities: Schema_exports.optionalKey(
2413
+ Schema_exports.Struct({
2414
+ skills: Schema_exports.Literal(true),
2415
+ toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2416
+ skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
2417
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
2418
+ })
2419
+ ),
2420
+ database: Schema_exports.optionalKey(DatabaseSchema),
2421
+ accounts: Schema_exports.Record(
2422
+ Schema_exports.NonEmptyString,
2423
+ Schema_exports.Struct({
2424
+ definition: DeclaredProvider,
2425
+ cardinality: Schema_exports.Literals(["one", "many"]),
2426
+ /**
2427
+ * The slot's provider defines an account check. Kept beside the definition, not in it, so
2428
+ * adding or editing a check never changes the provider's identity.
2429
+ */
2430
+ health: Schema_exports.optionalKey(Schema_exports.Literal(true))
2431
+ })
2432
+ )
2433
+ });
2434
+ var AccountCheckCommand = Schema_exports.Struct({
2435
+ operation: Schema_exports.Literal("account-check"),
2436
+ requirement: Schema_exports.NonEmptyString
2437
+ });
2438
+ var HostRequest3 = Schema_exports.Union([
2439
+ ...protocol4.schemas.request.members,
2440
+ AccountCheckCommand
1678
2441
  ]);
2442
+ var HostInvocation3 = Schema_exports.Struct({
2443
+ command: HostRequest3,
2444
+ accounts: ResolvedAccounts,
2445
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2446
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2447
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2448
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2449
+ });
2450
+ var protocol5 = {
2451
+ version: 5,
2452
+ schemas: {
2453
+ ...protocol4.schemas,
2454
+ invocation: HostInvocation3,
2455
+ request: HostRequest3,
2456
+ requirements: DeclaredRequirements2,
2457
+ accountCheck: AccountCheckResult
2458
+ }
2459
+ };
2460
+
2461
+ // src/contracts/host.ts
2462
+ var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
2463
+ var skillCatalog = (response) => Schema_exports.is(SkillSources2)(response) ? response : { skills: response };
2464
+ var inspectCommand = (tools, scheduled) => ({
2465
+ operation: "inspect",
2466
+ ...tools === void 0 ? {} : { tools: [...tools] },
2467
+ ...scheduled === void 0 ? {} : { scheduled }
2468
+ });
2469
+ var indexCommand = { operation: "inspect", detail: "summary" };
2470
+ var selectTools = (tools) => (catalog) => tools === void 0 ? catalog : { ...catalog, tools: catalog.tools.filter((tool) => tools.includes(tool.name)) };
2471
+ var HostRequirementsError = Schema_exports.Union([
2472
+ HostRequestInvalid,
2473
+ HostDeclarationInvalid2,
2474
+ DatabaseFieldReserved
2475
+ ]);
2476
+ var HostInspectError = Schema_exports.Union([
2477
+ ProviderError,
2478
+ McpError,
2479
+ SkillLoadFailed,
2480
+ HostRequestInvalid,
2481
+ HostDeclarationInvalid2,
2482
+ HostAccountsInvalid,
2483
+ HostEvaluationFailed2
2484
+ ]);
2485
+ var HostCallError = Schema_exports.Union([
2486
+ OpenapiResponseError,
2487
+ WorkflowFailure,
2488
+ HostInspectError,
2489
+ HostToolNotFound,
2490
+ HostOperationNotFound,
2491
+ HostKindMismatch,
2492
+ HostOperationFailed2,
2493
+ DatabaseLimitExceeded,
2494
+ HostInputInvalid,
2495
+ HostOutputInvalid,
2496
+ HostToolBlocked,
2497
+ HostToolApprovalRequired,
2498
+ HostToolPolicyFailed,
2499
+ ElicitationFailed
2500
+ ]);
2501
+ var HostAccountCheckError = Schema_exports.Union([
2502
+ ProviderError,
2503
+ WorkflowFailure,
2504
+ HostRequestInvalid,
2505
+ HostDeclarationInvalid2,
2506
+ HostAccountsInvalid,
2507
+ HostOperationNotFound,
2508
+ HostOperationFailed2,
2509
+ HostOutputInvalid
2510
+ ]);
2511
+ var HostDataError = HostCallError;
2512
+ var ToolResultObservation = Context_exports.Reference(
2513
+ "apps/ToolResultObservation",
2514
+ { defaultValue: () => ({ failed: () => {
2515
+ } }) }
2516
+ );
1679
2517
 
1680
2518
  export {
1681
2519
  SecretsMethod,
@@ -1684,27 +2522,41 @@ export {
1684
2522
  OAuth2Config,
1685
2523
  OAuth2AccessToken,
1686
2524
  OAuth2Method,
2525
+ AccountInfo,
2526
+ AccountCheckResult,
1687
2527
  Provider,
1688
2528
  ManyAccounts,
1689
- minimumIntervalMilliseconds,
1690
- Interval,
1691
- CalendarSchedule,
1692
- ScheduleTiming,
1693
- OperationSchedule,
1694
- ElicitationLimits,
1695
- defaultElicitationLimits,
1696
- FormElicitation,
1697
- ElicitationResponse,
1698
- ElicitationFailed,
1699
- ElicitationReply,
1700
- ApprovalElicitation,
1701
- ApprovalResponse,
1702
- approvalElicitation,
2529
+ reservedRouterKeys,
2530
+ RouterKey,
2531
+ RouterIcon,
2532
+ RouterMeta,
2533
+ ToolAnnotations,
2534
+ McpClientLimits,
2535
+ defaultMcpClientLimits,
2536
+ mcpSdkTimerCeilingMs,
2537
+ McpToolsOptions,
2538
+ McpToolResult,
2539
+ McpToolMetadata,
2540
+ McpServerHeader,
2541
+ McpError,
2542
+ ProcessConfig,
2543
+ ApiErrorRecovery,
2544
+ ApiErrorResponse,
2545
+ OpenapiResponseError,
2546
+ defaultOpenapiErrorLimits,
2547
+ maxFailureMessageLength,
2548
+ FailureSource,
2549
+ FailureName,
2550
+ FailureCode,
2551
+ FailureMessage,
2552
+ FailureDetail,
1703
2553
  WorkflowRunId,
1704
2554
  WorkflowName,
1705
2555
  workflowDurationMillis,
1706
2556
  WorkflowDuration,
1707
2557
  WorkflowStepOptions,
2558
+ WorkflowFailureDetail,
2559
+ WorkflowRunFailure,
1708
2560
  WorkflowFailure,
1709
2561
  NonRetryableError,
1710
2562
  WorkflowValue,
@@ -1715,5 +2567,79 @@ export {
1715
2567
  WorkflowCommand,
1716
2568
  WorkflowRpcCommand,
1717
2569
  WorkflowRpcResult,
1718
- WorkflowControlCommand
2570
+ WorkflowControlCommand,
2571
+ ElicitationLimits,
2572
+ defaultElicitationLimits,
2573
+ FormElicitation,
2574
+ ElicitationResponse,
2575
+ ElicitationFailed,
2576
+ ElicitationReply,
2577
+ ApprovalElicitation,
2578
+ ApprovalResponse,
2579
+ approvalElicitation,
2580
+ WebhookTransportLimits,
2581
+ defaultWebhookTransportLimits,
2582
+ WebhookRequestData,
2583
+ WebhookResponseData,
2584
+ ManualWebhookSetup,
2585
+ ManualWebhookDescriptor,
2586
+ HostedWebhook,
2587
+ WebhookCommand,
2588
+ frameworkProtocol,
2589
+ minimumIntervalMilliseconds,
2590
+ Interval,
2591
+ CalendarSchedule,
2592
+ ScheduleTiming,
2593
+ OperationSchedule,
2594
+ DeclaredAuthMethod,
2595
+ DeclaredProvider,
2596
+ ResolvedAccount,
2597
+ ResolvedAccounts,
2598
+ TrustedToolApproval,
2599
+ InvocationDeadline,
2600
+ HostRequestInvalid,
2601
+ HostAccountsInvalid,
2602
+ HostOperationNotFound,
2603
+ HostToolNotFound,
2604
+ InputProblem,
2605
+ maxInputProblems,
2606
+ HostInputInvalid,
2607
+ HostToolBlocked,
2608
+ HostToolApprovalRequired,
2609
+ HostToolPolicyFailed,
2610
+ HostOutputInvalid,
2611
+ protocol1,
2612
+ SkillSources2 as SkillSources,
2613
+ SkillCatalogResponse2 as SkillCatalogResponse,
2614
+ protocol2,
2615
+ HostDeclarationInvalid2 as HostDeclarationInvalid,
2616
+ HostEvaluationFailed2 as HostEvaluationFailed,
2617
+ HostOperationFailed2 as HostOperationFailed,
2618
+ protocol3,
2619
+ HostedTool2 as HostedTool,
2620
+ HostedToolSummary2 as HostedToolSummary,
2621
+ HostRouterError,
2622
+ HostedRouter,
2623
+ HostedCatalog,
2624
+ HostedCatalogSummary,
2625
+ HostKindMismatch,
2626
+ HostError3 as HostError,
2627
+ HostResponse3 as HostResponse,
2628
+ protocol4,
2629
+ DeclaredRequirements2 as DeclaredRequirements,
2630
+ AccountCheckCommand,
2631
+ HostRequest3 as HostRequest,
2632
+ HostInvocation3 as HostInvocation,
2633
+ protocol5,
2634
+ skillsCommand,
2635
+ skillCatalog,
2636
+ inspectCommand,
2637
+ indexCommand,
2638
+ selectTools,
2639
+ HostRequirementsError,
2640
+ HostInspectError,
2641
+ HostCallError,
2642
+ HostAccountCheckError,
2643
+ HostDataError,
2644
+ ToolResultObservation
1719
2645
  };