apps 0.0.1-beta.0 → 0.0.1-beta.2

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 (114) hide show
  1. package/README.md +97 -4
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-SBKHUC5L.js → chunk-4LPG6RCH.js} +2 -2
  5. package/js/chunk-5MQZEB6Y.js +172 -0
  6. package/js/{chunk-7JXHF5IF.js → chunk-BMOIAIVR.js} +1 -1
  7. package/js/chunk-CZ7CSFO4.js +39 -0
  8. package/js/chunk-D47C7KG5.js +172 -0
  9. package/js/{chunk-YDR4CPJA.js → chunk-EVJUVWN2.js} +8 -8
  10. package/js/chunk-FDNTX5QJ.js +78 -0
  11. package/js/{chunk-2OTCEKL2.js → chunk-FW5HBOIK.js} +2352 -1493
  12. package/js/{chunk-EP6AEUZO.js → chunk-FZJOYIZO.js} +1 -1
  13. package/js/{chunk-VFUZI3NY.js → chunk-HDJH3RPR.js} +4 -4
  14. package/js/{chunk-WIDTG42X.js → chunk-HDTGZWP2.js} +79 -26
  15. package/js/{chunk-Q2FD5IBM.js → chunk-J7O55ZV7.js} +298 -37
  16. package/js/{chunk-X3YBZCJW.js → chunk-JN55AYQH.js} +8 -41
  17. package/js/chunk-LGIYBDWA.js +85 -0
  18. package/js/{chunk-D6BKYP2L.js → chunk-M6ZRRIBI.js} +4 -4
  19. package/js/{chunk-HP7E42X6.js → chunk-MYYEW3RA.js} +767 -249
  20. package/js/{chunk-3ANFZFCV.js → chunk-OHRT55C4.js} +15 -15
  21. package/js/{chunk-R6JMJSVT.js → chunk-PLCMJREA.js} +2 -2
  22. package/js/{chunk-C24KEZXR.js → chunk-PYUYJRSK.js} +36 -2
  23. package/js/{chunk-W7Q5EOTS.js → chunk-QKHR7BMF.js} +32 -32
  24. package/js/{chunk-KWTCHVLT.js → chunk-RN2MXB4R.js} +47 -51
  25. package/js/{chunk-36DNRFZQ.js → chunk-SATWJKN6.js} +1 -1
  26. package/js/chunk-SWPD52J7.js +35 -0
  27. package/js/{chunk-BKVL7XAJ.js → chunk-TE4KO4HI.js} +1 -1
  28. package/js/chunk-UVL56Z6E.js +6641 -0
  29. package/js/chunk-W7D7WVSY.js +18 -0
  30. package/js/{chunk-BPEFS4YF.js → chunk-WFSQXYUT.js} +109 -17
  31. package/js/chunk-YEJOQEII.js +104 -0
  32. package/js/{chunk-LOKGDT6B.js → chunk-Z5NMEGJN.js} +5 -4
  33. package/js/{chunk-OWD2YICM.js → chunk-ZCAMUXSG.js} +116 -87
  34. package/js/chunk-ZJWDMTE3.js +63 -0
  35. package/js/client.js +11 -11
  36. package/js/contracts.js +88 -25
  37. package/js/effect.js +21 -15
  38. package/js/es-APDZKREY.js +40968 -0
  39. package/js/graphql.js +224 -121
  40. package/js/host.js +76 -19
  41. package/js/index.js +193 -51
  42. package/js/mcp/effect.js +25 -17
  43. package/js/mcp/stdio.js +23 -17
  44. package/js/mcp.js +110 -24
  45. package/js/openapi.js +3045 -105
  46. package/js/operations/approval.js +1 -1
  47. package/js/react.js +4 -4
  48. package/js/skills/effect.js +11 -0
  49. package/js/skills.js +894 -0
  50. package/js/storage/facet.js +7 -7
  51. package/js/ui/auth/contracts.js +6 -6
  52. package/js/ui/auth.js +8 -8
  53. package/js/ui/contracts.js +5 -5
  54. package/js/ui/serving.js +12 -12
  55. package/package.json +9 -1
  56. package/runtime.json +1 -1
  57. package/types/app-cache/src/contracts/cache.d.ts +119 -0
  58. package/types/app-cache/src/index.d.ts +93 -0
  59. package/types/apps/src/contracts/api-response-error.d.ts +43 -0
  60. package/types/apps/src/contracts/app.d.ts +11 -0
  61. package/types/apps/src/contracts/cache.d.ts +44 -0
  62. package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
  63. package/types/apps/src/contracts/dynamic-tools.d.ts +13 -0
  64. package/types/apps/src/contracts/graphql.d.ts +18 -1
  65. package/types/apps/src/contracts/host.d.ts +54 -525
  66. package/types/apps/src/contracts/mcp.d.ts +3 -1
  67. package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
  68. package/types/apps/src/contracts/openapi-document.d.ts +53 -0
  69. package/types/apps/src/contracts/openapi.d.ts +156 -30
  70. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  71. package/types/apps/src/contracts/protocols/1.d.ts +1575 -0
  72. package/types/apps/src/contracts/provider-error.d.ts +15 -0
  73. package/types/apps/src/contracts/provider.d.ts +18 -1
  74. package/types/apps/src/contracts/skills.d.ts +122 -0
  75. package/types/apps/src/contracts/swagger-client.d.ts +29 -0
  76. package/types/apps/src/graphql.d.ts +6 -6
  77. package/types/apps/src/host.d.ts +1 -0
  78. package/types/apps/src/implementation/account-operations.d.ts +122 -3
  79. package/types/apps/src/implementation/app.d.ts +1 -1
  80. package/types/apps/src/implementation/cache-session.d.ts +7 -0
  81. package/types/apps/src/implementation/cache.d.ts +8 -0
  82. package/types/apps/src/implementation/catalog-cache.d.ts +29 -0
  83. package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
  84. package/types/apps/src/implementation/dynamic-tools.d.ts +8 -0
  85. package/types/apps/src/implementation/elicitation.d.ts +12 -12
  86. package/types/apps/src/implementation/git.d.ts +25 -0
  87. package/types/apps/src/implementation/graphql-catalog.d.ts +10 -0
  88. package/types/apps/src/implementation/graphql.d.ts +81 -3
  89. package/types/apps/src/implementation/inflate.d.ts +16 -0
  90. package/types/apps/src/implementation/input-problems.d.ts +3 -0
  91. package/types/apps/src/implementation/mcp-call.d.ts +3 -2
  92. package/types/apps/src/implementation/mcp-catalog.d.ts +12 -0
  93. package/types/apps/src/implementation/mcp-client.d.ts +9 -8
  94. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  95. package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
  96. package/types/apps/src/implementation/mcp.d.ts +39 -2
  97. package/types/apps/src/implementation/openapi-compile.d.ts +119 -0
  98. package/types/apps/src/implementation/openapi-document.d.ts +51 -0
  99. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  100. package/types/apps/src/implementation/openapi-request.d.ts +10 -4
  101. package/types/apps/src/implementation/openapi-source.d.ts +40 -0
  102. package/types/apps/src/implementation/openapi.d.ts +39 -3
  103. package/types/apps/src/implementation/provider-error.d.ts +10 -0
  104. package/types/apps/src/implementation/schema.d.ts +6 -5
  105. package/types/apps/src/implementation/skill-files.d.ts +10 -0
  106. package/types/apps/src/implementation/skills.d.ts +43 -0
  107. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  108. package/types/apps/src/index.d.ts +7 -0
  109. package/types/apps/src/mcp.d.ts +5 -5
  110. package/types/apps/src/openapi.d.ts +3 -1
  111. package/types/apps/src/skills.d.ts +75 -0
  112. package/types/telemetry/src/config.d.ts +2 -0
  113. package/js/chunk-22WRQZT7.js +0 -389
  114. package/js/chunk-MLKGABMK.js +0 -9
@@ -1,13 +1,32 @@
1
1
  import {
2
+ DatabaseSchema
3
+ } from "./chunk-BMOIAIVR.js";
4
+ import {
5
+ CacheCommand,
6
+ CacheReply
7
+ } from "./chunk-LGIYBDWA.js";
8
+ import {
9
+ AppSkills,
10
+ SkillLoadFailed
11
+ } from "./chunk-YEJOQEII.js";
12
+ import {
13
+ OpenapiResponseError
14
+ } from "./chunk-SWPD52J7.js";
15
+ import {
16
+ ProviderError
17
+ } from "./chunk-W7D7WVSY.js";
18
+ import {
19
+ AccountId,
2
20
  HttpUrl,
3
21
  JsonObject as JsonObject2,
4
22
  JsonValue
5
- } from "./chunk-36DNRFZQ.js";
23
+ } from "./chunk-SATWJKN6.js";
6
24
  import {
7
25
  Any,
8
26
  ArraySchema,
9
27
  Boolean,
10
28
  Class2 as Class,
29
+ Context_exports,
11
30
  Cron_exports,
12
31
  Data_exports,
13
32
  Defect,
@@ -55,114 +74,244 @@ import {
55
74
  transformOptional,
56
75
  withConstructorDefault,
57
76
  withDefault
58
- } from "./chunk-2OTCEKL2.js";
77
+ } from "./chunk-FW5HBOIK.js";
59
78
 
60
- // src/contracts/provider.ts
61
- var SecretsMethod = class extends Data_exports.TaggedClass(
62
- "secrets"
63
- ) {
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
+ });
87
+
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)
121
+ });
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)
130
+ });
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
+ }) {
64
142
  };
65
- var OAuthClientAuth = Schema_exports.Literals([
66
- "none",
67
- "client_secret_post",
68
- "client_secret_basic",
69
- "client_secret_basic_raw"
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
+ )
151
+ });
152
+
153
+ // src/contracts/workflows.ts
154
+ var WorkflowRunId = Schema_exports.NonEmptyString.pipe(Schema_exports.brand("wfr"));
155
+ var WorkflowName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
156
+ var durationUnits = {
157
+ millisecond: 1,
158
+ milliseconds: 1,
159
+ second: 1e3,
160
+ seconds: 1e3,
161
+ minute: 6e4,
162
+ minutes: 6e4,
163
+ hour: 36e5,
164
+ hours: 36e5,
165
+ day: 864e5,
166
+ days: 864e5,
167
+ week: 6048e5,
168
+ weeks: 6048e5
169
+ };
170
+ var workflowDurationMillis = (value) => {
171
+ if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? value : void 0;
172
+ const match = /^(\d+(?:\.\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(
173
+ value
174
+ );
175
+ const unit = match?.[2] === void 0 ? void 0 : durationUnits[match[2]];
176
+ if (unit === void 0) return void 0;
177
+ const result = Number(match?.[1]) * unit;
178
+ return Number.isFinite(result) ? result : void 0;
179
+ };
180
+ var WorkflowDuration = Schema_exports.Union([
181
+ Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0)),
182
+ Schema_exports.NonEmptyString
183
+ ]).check(Schema_exports.makeFilter((value) => workflowDurationMillis(value) !== void 0));
184
+ var WorkflowStepOptions = Schema_exports.Struct({
185
+ retries: Schema_exports.optionalKey(
186
+ Schema_exports.Struct({
187
+ limit: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0)),
188
+ delay: WorkflowDuration,
189
+ backoff: Schema_exports.optionalKey(Schema_exports.Literals(["constant", "linear", "exponential"]))
190
+ })
191
+ ),
192
+ timeout: Schema_exports.optionalKey(WorkflowDuration)
193
+ });
194
+ var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailure", {
195
+ reason: Schema_exports.Literals([
196
+ "unavailable",
197
+ "not_found",
198
+ "input",
199
+ "output",
200
+ "operation",
201
+ "approval",
202
+ "credentials",
203
+ "terminated",
204
+ "execution",
205
+ "conflict",
206
+ "engine"
207
+ ]),
208
+ retryable: Schema_exports.Boolean
209
+ }) {
210
+ };
211
+ var NonRetryableError = class extends Error {
212
+ name = "NonRetryableError";
213
+ };
214
+ var WorkflowValue = JsonValue.check(
215
+ Schema_exports.makeFilter(
216
+ (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 1024 * 1024
217
+ )
218
+ );
219
+ var HostedWorkflow = Schema_exports.Struct({
220
+ name: WorkflowName,
221
+ description: Schema_exports.optionalKey(Schema_exports.String),
222
+ inputSchema: JsonObject2,
223
+ outputSchema: Schema_exports.optionalKey(JsonObject2)
224
+ });
225
+ var runFields = {
226
+ profile: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
227
+ id: WorkflowRunId,
228
+ app: Schema_exports.NonEmptyString,
229
+ deployment: Schema_exports.NonEmptyString,
230
+ workflow: WorkflowName,
231
+ createdAt: Schema_exports.String
232
+ };
233
+ var WorkflowRun = Schema_exports.Union([
234
+ Schema_exports.Struct({
235
+ ...runFields,
236
+ status: Schema_exports.Literals(["queued", "running", "waiting", "paused", "waitingForPause"])
237
+ }),
238
+ Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("complete"), output: WorkflowValue }),
239
+ Schema_exports.Struct({
240
+ ...runFields,
241
+ status: Schema_exports.Literal("errored"),
242
+ error: WorkflowFailure.fields.reason
243
+ }),
244
+ Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("terminated") })
70
245
  ]);
71
- var OAuthSecretClientAuth = Schema_exports.Literals([
72
- "client_secret_post",
73
- "client_secret_basic",
74
- "client_secret_basic_raw"
246
+ var WorkflowRunPage = Schema_exports.Struct({
247
+ items: Schema_exports.Array(WorkflowRun),
248
+ next: Schema_exports.optionalKey(WorkflowRunId)
249
+ });
250
+ var WorkflowReplay = Schema_exports.Struct({
251
+ key: Schema_exports.NonEmptyString,
252
+ fingerprint: Schema_exports.NonEmptyString
253
+ });
254
+ var WorkflowCommand = Schema_exports.Union([
255
+ Schema_exports.Struct({ operation: Schema_exports.Literal("workflows") }),
256
+ Schema_exports.Struct({
257
+ operation: Schema_exports.Literal("workflow-validate"),
258
+ name: WorkflowName,
259
+ input: JsonValue
260
+ }),
261
+ Schema_exports.Struct({
262
+ operation: Schema_exports.Literal("workflow-run"),
263
+ name: WorkflowName,
264
+ input: JsonValue
265
+ })
75
266
  ]);
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([
267
+ var WorkflowRpcCommand = Schema_exports.Union([
83
268
  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))
269
+ operation: Schema_exports.Literal("do"),
270
+ name: WorkflowName,
271
+ options: WorkflowStepOptions
89
272
  }),
90
273
  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)
274
+ operation: Schema_exports.Literal("sleep"),
275
+ name: WorkflowName,
276
+ duration: WorkflowDuration
96
277
  }),
97
278
  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))
279
+ operation: Schema_exports.Literal("until"),
280
+ name: WorkflowName,
281
+ timestamp: Schema_exports.Finite
105
282
  }),
283
+ Schema_exports.Struct({ operation: Schema_exports.Literal("context") }),
106
284
  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)
285
+ operation: Schema_exports.Literal("invoke"),
286
+ kind: Schema_exports.Literals(["query", "mutation"]),
287
+ name: Schema_exports.NonEmptyString,
288
+ input: JsonValue,
289
+ stepId: Schema_exports.NonEmptyString,
290
+ timeout: Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0))
114
291
  })
115
292
  ]);
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 })
293
+ var WorkflowRpcResult = Schema_exports.Union([
294
+ Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: JsonValue }),
295
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: WorkflowFailure })
138
296
  ]);
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([
297
+ var WorkflowControlCommand = Schema_exports.Union([
148
298
  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
- )
299
+ operation: Schema_exports.Literal("start"),
300
+ workflow: WorkflowName,
301
+ input: WorkflowValue,
302
+ key: Schema_exports.optionalKey(Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)))
156
303
  }),
157
- Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
304
+ Schema_exports.Struct({ operation: Schema_exports.Literal("get"), run: WorkflowRunId }),
305
+ Schema_exports.Struct({
306
+ operation: Schema_exports.Literal("list"),
307
+ workflow: Schema_exports.optionalKey(WorkflowName),
308
+ cursor: Schema_exports.optionalKey(WorkflowRunId),
309
+ limit: Schema_exports.optionalKey(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 1, maximum: 100 })))
310
+ }),
311
+ Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
158
312
  ]);
159
- var OperationSchedule = Schema_exports.Struct({
160
- name: Schema_exports.NonEmptyString,
161
- timing: ScheduleTiming,
162
- input: JsonValue
163
- });
164
313
 
165
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/rpc/RpcSchema.js
314
+ // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/RpcSchema.js
166
315
  var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
167
316
  var schema = /* @__PURE__ */ declare(isStream);
168
317
  function Stream(success, error) {
@@ -173,7 +322,7 @@ function Stream(success, error) {
173
322
  });
174
323
  }
175
324
 
176
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/rpc/Rpc.js
325
+ // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/rpc/Rpc.js
177
326
  var TypeId = "~effect/rpc/Rpc";
178
327
  var Proto = {
179
328
  [TypeId]: TypeId,
@@ -291,7 +440,7 @@ var make2 = (tag2, options) => {
291
440
  });
292
441
  };
293
442
 
294
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/ai/McpSchema.js
443
+ // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/ai/McpSchema.js
295
444
  var optionalWithDefault = (schema2, defaultValue) => {
296
445
  const effect = sync(defaultValue);
297
446
  return optionalKey(schema2).pipe(decode({
@@ -561,7 +710,7 @@ var InternalError = class _InternalError extends (/* @__PURE__ */ Error2("effect
561
710
  message: "Not implemented"
562
711
  });
563
712
  };
564
- var McpError = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
713
+ var McpError2 = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
565
714
  var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
566
715
  ...ResultMeta.fields,
567
716
  /**
@@ -584,7 +733,7 @@ var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ S
584
733
  };
585
734
  var Initialize = class extends (/* @__PURE__ */ make2("initialize", {
586
735
  success: InitializeResult,
587
- error: McpError,
736
+ error: McpError2,
588
737
  payload: {
589
738
  ...RequestMeta.fields,
590
739
  /**
@@ -783,7 +932,7 @@ var ReadResourceResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */
783
932
  };
784
933
  var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
785
934
  success: ReadResourceResult,
786
- error: McpError,
935
+ error: McpError2,
787
936
  payload: {
788
937
  ...RequestMeta.fields,
789
938
  /**
@@ -796,7 +945,7 @@ var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
796
945
  };
797
946
  var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
798
947
  success: /* @__PURE__ */ Struct({}),
799
- error: McpError,
948
+ error: McpError2,
800
949
  payload: {
801
950
  ...RequestMeta.fields,
802
951
  /**
@@ -809,7 +958,7 @@ var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
809
958
  };
810
959
  var Unsubscribe = class extends (/* @__PURE__ */ make2("resources/unsubscribe", {
811
960
  success: /* @__PURE__ */ Struct({}),
812
- error: McpError,
961
+ error: McpError2,
813
962
  payload: {
814
963
  ...RequestMeta.fields,
815
964
  /**
@@ -953,7 +1102,7 @@ var GetPromptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema
953
1102
  };
954
1103
  var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
955
1104
  success: GetPromptResult,
956
- error: McpError,
1105
+ error: McpError2,
957
1106
  payload: {
958
1107
  ...RequestMeta.fields,
959
1108
  /**
@@ -968,7 +1117,7 @@ var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
968
1117
  }
969
1118
  })) {
970
1119
  };
971
- var ToolAnnotations = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1120
+ var ToolAnnotations2 = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
972
1121
  /**
973
1122
  * A human-readable title for the tool.
974
1123
  */
@@ -1037,7 +1186,7 @@ var Tool = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Tool")({
1037
1186
  /**
1038
1187
  * Optional additional tool information.
1039
1188
  */
1040
- annotations: /* @__PURE__ */ optional2(ToolAnnotations),
1189
+ annotations: /* @__PURE__ */ optional2(ToolAnnotations2),
1041
1190
  /**
1042
1191
  * Icons that clients can display for this tool.
1043
1192
  */
@@ -1073,7 +1222,7 @@ var CallToolResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/
1073
1222
  };
1074
1223
  var CallTool = class extends (/* @__PURE__ */ make2("tools/call", {
1075
1224
  success: CallToolResult,
1076
- error: McpError,
1225
+ error: McpError2,
1077
1226
  payload: {
1078
1227
  ...RequestMeta.fields,
1079
1228
  name: String,
@@ -1093,7 +1242,7 @@ var SetLevel = class extends (/* @__PURE__ */ make2("logging/setLevel", {
1093
1242
  level: LoggingLevel
1094
1243
  },
1095
1244
  success: /* @__PURE__ */ Struct({}),
1096
- error: McpError
1245
+ error: McpError2
1097
1246
  })) {
1098
1247
  };
1099
1248
  var LoggingMessageNotification = class extends (/* @__PURE__ */ make2("notifications/message", {
@@ -1239,7 +1388,7 @@ var CreateMessageResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1239
1388
  };
1240
1389
  var CreateMessage = class extends (/* @__PURE__ */ make2("sampling/createMessage", {
1241
1390
  success: CreateMessageResult,
1242
- error: McpError,
1391
+ error: McpError2,
1243
1392
  payload: {
1244
1393
  messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
1245
1394
  /**
@@ -1450,7 +1599,7 @@ var ElicitDeclineResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSc
1450
1599
  var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
1451
1600
  var Elicit = class extends (/* @__PURE__ */ make2("elicitation/create", {
1452
1601
  success: ElicitResult,
1453
- error: McpError,
1602
+ error: McpError2,
1454
1603
  payload: ElicitRequestParams
1455
1604
  })) {
1456
1605
  };
@@ -1516,166 +1665,476 @@ ${JSON.stringify(input, null, 2)}`,
1516
1665
  requestedSchema: { type: "object", properties: {} }
1517
1666
  });
1518
1667
 
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
1535
- };
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;
1545
- };
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)
1668
+ // src/contracts/webhook-protocol.ts
1669
+ var WebhookTransportLimits = Schema_exports.Struct({
1670
+ maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
1559
1671
  });
1560
- var WorkflowFailure = class extends Schema_exports.TaggedError()("WorkflowFailure", {
1561
- reason: Schema_exports.Literals([
1562
- "unavailable",
1563
- "not_found",
1564
- "input",
1565
- "output",
1566
- "operation",
1567
- "approval",
1568
- "credentials",
1569
- "terminated",
1570
- "execution",
1571
- "conflict",
1572
- "engine"
1573
- ]),
1574
- retryable: Schema_exports.Boolean
1575
- }) {
1576
- };
1577
- var NonRetryableError = class extends Error {
1578
- name = "NonRetryableError";
1672
+ var defaultWebhookTransportLimits = WebhookTransportLimits.make({
1673
+ maxBodyBytes: 1024 * 1024
1674
+ });
1675
+ var encodedBodyChars = 4 * Math.ceil(defaultWebhookTransportLimits.maxBodyBytes / 3);
1676
+ var WebhookRequestData = Schema_exports.Struct({
1677
+ url: HttpUrl,
1678
+ method: Schema_exports.Literals(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]),
1679
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1680
+ body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1681
+ });
1682
+ var WebhookResponseData = Schema_exports.Struct({
1683
+ status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 200, maximum: 599 })),
1684
+ headers: Schema_exports.Record(Schema_exports.String, Schema_exports.String),
1685
+ body: Schema_exports.String.check(Schema_exports.isMaxLength(encodedBodyChars))
1686
+ });
1687
+ var ManualWebhookSetup = Schema_exports.Struct({
1688
+ instructions: Schema_exports.NonEmptyString,
1689
+ signingSecret: Schema_exports.Literals(["executor", "provider"])
1690
+ });
1691
+ var ManualWebhookDescriptor = Schema_exports.Struct({
1692
+ ...ManualWebhookSetup.fields,
1693
+ stateSchema: JsonObject2
1694
+ });
1695
+ var HostedWebhook = Schema_exports.Struct({
1696
+ name: Schema_exports.NonEmptyString,
1697
+ account: Schema_exports.NonEmptyString,
1698
+ configSchema: JsonObject2,
1699
+ setup: Schema_exports.optionalKey(ManualWebhookDescriptor)
1700
+ });
1701
+ var identity = {
1702
+ name: Schema_exports.NonEmptyString,
1703
+ subscriptionId: Schema_exports.NonEmptyString,
1704
+ sourceAccount: AccountId,
1705
+ callbackUrl: HttpUrl,
1706
+ secret: Schema_exports.String,
1707
+ config: JsonValue
1708
+ };
1709
+ var WebhookCommand = Schema_exports.Union([
1710
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhooks") }),
1711
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-validate"), ...identity }),
1712
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-complete"), ...identity, state: JsonValue }),
1713
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-register"), ...identity }),
1714
+ Schema_exports.Struct({ operation: Schema_exports.Literal("webhook-unregister"), ...identity, state: JsonValue }),
1715
+ Schema_exports.Struct({
1716
+ operation: Schema_exports.Literal("webhook-handle"),
1717
+ ...identity,
1718
+ state: JsonValue,
1719
+ request: WebhookRequestData
1720
+ })
1721
+ ]);
1722
+
1723
+ // src/contracts/provider.ts
1724
+ var SecretsMethod = class extends Data_exports.TaggedClass(
1725
+ "secrets"
1726
+ ) {
1579
1727
  };
1580
- var WorkflowValue = JsonValue.check(
1728
+ var OAuthClientAuth = Schema_exports.Literals([
1729
+ "none",
1730
+ "client_secret_post",
1731
+ "client_secret_basic",
1732
+ "client_secret_basic_raw"
1733
+ ]);
1734
+ var OAuthSecretClientAuth = Schema_exports.Literals([
1735
+ "client_secret_post",
1736
+ "client_secret_basic",
1737
+ "client_secret_basic_raw"
1738
+ ]);
1739
+ var reservedAuthorizationParams = /* @__PURE__ */ new Set([
1740
+ "response_type",
1741
+ "client_id",
1742
+ "redirect_uri",
1743
+ "state",
1744
+ "scope",
1745
+ "code_challenge",
1746
+ "code_challenge_method",
1747
+ "nonce",
1748
+ "resource",
1749
+ "request",
1750
+ "request_uri"
1751
+ ]);
1752
+ var OAuthAuthorizationParams = Schema_exports.Record(Schema_exports.String, Schema_exports.String).check(
1581
1753
  Schema_exports.makeFilter(
1582
- (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 1024 * 1024
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
+ }
1583
1758
  )
1584
1759
  );
1585
- var HostedWorkflow = Schema_exports.Struct({
1586
- name: WorkflowName,
1587
- description: Schema_exports.optionalKey(Schema_exports.String),
1588
- inputSchema: JsonObject2,
1589
- outputSchema: Schema_exports.optionalKey(JsonObject2)
1590
- });
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
1760
+ var oauthOptions = {
1761
+ grant: Schema_exports.optionalKey(Schema_exports.Literal("authorization_code")),
1762
+ authorizationParams: Schema_exports.optionalKey(OAuthAuthorizationParams),
1763
+ tokenEndpointAuthMethod: Schema_exports.optionalKey(OAuthClientAuth),
1764
+ /** Omitted uses discovery; null explicitly suppresses the resource parameter. */
1765
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1598
1766
  };
1599
- var WorkflowRun = Schema_exports.Union([
1767
+ var OAuth2Config = Schema_exports.Union([
1600
1768
  Schema_exports.Struct({
1601
- ...runFields,
1602
- status: Schema_exports.Literals(["queued", "running", "waiting", "paused", "waitingForPause"])
1769
+ ...oauthOptions,
1770
+ discover: HttpUrl,
1771
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1772
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1773
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1774
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String))
1603
1775
  }),
1604
- Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("complete"), output: WorkflowValue }),
1605
1776
  Schema_exports.Struct({
1606
- ...runFields,
1607
- status: Schema_exports.Literal("errored"),
1608
- error: WorkflowFailure.fields.reason
1777
+ ...oauthOptions,
1778
+ authorizationUrl: HttpUrl,
1779
+ tokenUrl: HttpUrl,
1780
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
1781
+ scopes: Schema_exports.Array(Schema_exports.String),
1782
+ /** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
1783
+ issuer: Schema_exports.optionalKey(HttpUrl),
1784
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
1609
1785
  }),
1610
- Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("terminated") })
1786
+ Schema_exports.Struct({
1787
+ grant: Schema_exports.Literal("client_credentials"),
1788
+ discover: HttpUrl,
1789
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1790
+ tokenUrl: Schema_exports.optionalKey(Schema_exports.Never),
1791
+ revocationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1792
+ scopes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
1793
+ tokenEndpointAuthMethod: OAuthSecretClientAuth,
1794
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl))
1795
+ }),
1796
+ Schema_exports.Struct({
1797
+ grant: Schema_exports.Literal("client_credentials"),
1798
+ tokenUrl: HttpUrl,
1799
+ revocationUrl: Schema_exports.optionalKey(HttpUrl),
1800
+ scopes: Schema_exports.Array(Schema_exports.String),
1801
+ tokenEndpointAuthMethod: OAuthSecretClientAuth,
1802
+ resource: Schema_exports.optionalKey(Schema_exports.NullOr(HttpUrl)),
1803
+ authorizationUrl: Schema_exports.optionalKey(Schema_exports.Never),
1804
+ discover: Schema_exports.optionalKey(Schema_exports.Never)
1805
+ })
1611
1806
  ]);
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
1807
+ var OAuth2AccessToken = Schema_exports.Struct({ access_token: Schema_exports.String });
1808
+ var OAuth2Method = class extends Data_exports.TaggedClass(
1809
+ "oauth2"
1810
+ ) {
1811
+ };
1812
+ var Provider = class extends Data_exports.Class {
1813
+ /** Declare zero or more accounts from this provider without performing I/O. */
1814
+ many() {
1815
+ return new ManyAccounts({ provider: this });
1816
+ }
1817
+ };
1818
+ var ManyAccounts = class extends Data_exports.TaggedClass("many") {
1819
+ };
1820
+
1821
+ // src/contracts/protocol-version.ts
1822
+ var frameworkProtocol = 1;
1823
+
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 })
1832
+ ]);
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 })
1852
+ ]);
1853
+ var OperationSchedule = Schema_exports.Struct({
1854
+ name: Schema_exports.NonEmptyString,
1855
+ timing: ScheduleTiming,
1856
+ input: JsonValue
1619
1857
  });
1620
- var WorkflowCommand = Schema_exports.Union([
1621
- Schema_exports.Struct({ operation: Schema_exports.Literal("workflows") }),
1858
+
1859
+ // src/contracts/protocols/1.ts
1860
+ var DeclaredAuthMethod = Schema_exports.Union([
1861
+ Schema_exports.Struct({ type: Schema_exports.Literal("secrets"), label: Schema_exports.String, fields: JsonObject2 }),
1622
1862
  Schema_exports.Struct({
1623
- operation: Schema_exports.Literal("workflow-validate"),
1624
- name: WorkflowName,
1625
- input: JsonValue
1863
+ type: Schema_exports.Literal("oauth2"),
1864
+ ...OAuth2Config.members[0].fields,
1865
+ response: JsonObject2
1626
1866
  }),
1627
1867
  Schema_exports.Struct({
1628
- operation: Schema_exports.Literal("workflow-run"),
1629
- name: WorkflowName,
1630
- input: JsonValue
1868
+ type: Schema_exports.Literal("oauth2"),
1869
+ ...OAuth2Config.members[1].fields,
1870
+ response: JsonObject2
1871
+ }),
1872
+ Schema_exports.Struct({
1873
+ type: Schema_exports.Literal("oauth2"),
1874
+ ...OAuth2Config.members[2].fields,
1875
+ response: JsonObject2
1876
+ }),
1877
+ Schema_exports.Struct({
1878
+ type: Schema_exports.Literal("oauth2"),
1879
+ ...OAuth2Config.members[3].fields,
1880
+ response: JsonObject2
1631
1881
  })
1632
1882
  ]);
1633
- var WorkflowRpcCommand = Schema_exports.Union([
1883
+ var DeclaredProvider = Schema_exports.Struct({
1884
+ name: Schema_exports.NonEmptyString,
1885
+ auth: Schema_exports.Record(Schema_exports.NonEmptyString, DeclaredAuthMethod)
1886
+ });
1887
+ var DeclaredRequirements = Schema_exports.Struct({
1888
+ /** Protocol support of this retained framework build, not an author-declared requirement. */
1889
+ capabilities: Schema_exports.optionalKey(
1890
+ Schema_exports.Struct({
1891
+ skills: Schema_exports.Literal(true),
1892
+ /** Accepts inspect detail and tools. Earlier builds reject both as excess fields. */
1893
+ toolIndex: Schema_exports.optionalKey(Schema_exports.Literal(true)),
1894
+ /** Accepts skills sources and reports whether the catalog includes a live loader. */
1895
+ skillSources: Schema_exports.optionalKey(Schema_exports.Literal(true)),
1896
+ /** Accepts scheduled inspection. Earlier builds reject it as an excess field. */
1897
+ scheduledTools: Schema_exports.optionalKey(Schema_exports.Literal(true))
1898
+ })
1899
+ ),
1900
+ database: Schema_exports.optionalKey(DatabaseSchema),
1901
+ accounts: Schema_exports.Record(
1902
+ Schema_exports.NonEmptyString,
1903
+ Schema_exports.Struct({
1904
+ definition: DeclaredProvider,
1905
+ cardinality: Schema_exports.Literals(["one", "many"])
1906
+ })
1907
+ )
1908
+ });
1909
+ var ResolvedAccount = Schema_exports.Struct({
1910
+ id: AccountId,
1911
+ provider: DeclaredProvider,
1912
+ method: Schema_exports.NonEmptyString,
1913
+ /**
1914
+ * Changes when the account is reconnected or its credentials replaced, not on renewal. Hosts
1915
+ * send it since credential generations; `apps@0.0.1-beta.0` and `beta.1` ignore it.
1916
+ */
1917
+ generation: Schema_exports.optionalKey(Schema_exports.Int),
1918
+ fields: JsonObject2
1919
+ });
1920
+ var ResolvedAccounts = Schema_exports.Record(
1921
+ Schema_exports.NonEmptyString,
1922
+ Schema_exports.Union([ResolvedAccount, Schema_exports.Array(ResolvedAccount)])
1923
+ );
1924
+ var TrustedToolApproval = Schema_exports.Struct({ tool: Schema_exports.NonEmptyString, input: JsonValue });
1925
+ var InvocationDeadline = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
1926
+ var HostedTool = Schema_exports.Struct({
1927
+ schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
1928
+ name: Schema_exports.NonEmptyString,
1929
+ description: Schema_exports.String,
1930
+ inputSchema: JsonObject2,
1931
+ readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
1932
+ title: Schema_exports.optionalKey(Schema_exports.String),
1933
+ outputSchema: Schema_exports.optionalKey(JsonObject2),
1934
+ annotations: Schema_exports.optionalKey(ToolAnnotations),
1935
+ _meta: Schema_exports.optionalKey(JsonObject2)
1936
+ });
1937
+ var HostedToolSummary = HostedTool.mapFields(
1938
+ ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
1939
+ );
1940
+ var SkillSources = Schema_exports.Struct({ skills: AppSkills, dynamic: Schema_exports.Boolean });
1941
+ var SkillCatalogResponse = Schema_exports.Union([SkillSources, AppSkills]);
1942
+ var HostRequest = Schema_exports.Union([
1943
+ WorkflowCommand,
1944
+ WebhookCommand,
1945
+ Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
1634
1946
  Schema_exports.Struct({
1635
- operation: Schema_exports.Literal("do"),
1636
- name: WorkflowName,
1637
- options: WorkflowStepOptions
1947
+ operation: Schema_exports.Literal("inspect"),
1948
+ /** Omit schemas. Only builds that declare the toolIndex capability accept this. */
1949
+ detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
1950
+ /** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
1951
+ tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
1952
+ /**
1953
+ * Describe only declared operations that have schedules, without dynamic tool discovery.
1954
+ * Only builds that declare the scheduledTools capability accept this.
1955
+ */
1956
+ scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
1638
1957
  }),
1639
1958
  Schema_exports.Struct({
1640
- operation: Schema_exports.Literal("sleep"),
1641
- name: WorkflowName,
1642
- duration: WorkflowDuration
1959
+ operation: Schema_exports.Literal("skills"),
1960
+ /** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
1961
+ sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
1643
1962
  }),
1644
1963
  Schema_exports.Struct({
1645
- operation: Schema_exports.Literal("until"),
1646
- name: WorkflowName,
1647
- timestamp: Schema_exports.Finite
1964
+ operation: Schema_exports.Literal("query"),
1965
+ name: Schema_exports.NonEmptyString,
1966
+ input: JsonValue
1648
1967
  }),
1649
- Schema_exports.Struct({ operation: Schema_exports.Literal("context") }),
1650
1968
  Schema_exports.Struct({
1651
- operation: Schema_exports.Literal("invoke"),
1652
- kind: Schema_exports.Literals(["query", "mutation"]),
1969
+ operation: Schema_exports.Literal("mutate"),
1653
1970
  name: Schema_exports.NonEmptyString,
1654
- input: JsonValue,
1655
- stepId: Schema_exports.NonEmptyString,
1656
- timeout: Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0))
1971
+ input: JsonValue
1972
+ }),
1973
+ Schema_exports.Struct({
1974
+ operation: Schema_exports.Literal("call"),
1975
+ tool: Schema_exports.NonEmptyString,
1976
+ input: JsonValue
1657
1977
  })
1658
1978
  ]);
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 })
1979
+ var HostRequestInvalid = class extends Schema_exports.TaggedError()(
1980
+ "HostRequestInvalid",
1981
+ {}
1982
+ ) {
1983
+ };
1984
+ var HostAccountsInvalid = class extends Schema_exports.TaggedError()(
1985
+ "HostAccountsInvalid",
1986
+ {}
1987
+ ) {
1988
+ };
1989
+ var HostDeclarationInvalid = class extends Schema_exports.TaggedError()(
1990
+ "HostDeclarationInvalid",
1991
+ {}
1992
+ ) {
1993
+ };
1994
+ var HostEvaluationFailed = class extends Schema_exports.TaggedError()(
1995
+ "HostEvaluationFailed",
1996
+ {}
1997
+ ) {
1998
+ };
1999
+ var HostOperationNotFound = class extends Schema_exports.TaggedError()(
2000
+ "HostOperationNotFound",
2001
+ {}
2002
+ ) {
2003
+ };
2004
+ var HostOperationFailed = class extends Schema_exports.TaggedError()(
2005
+ "HostOperationFailed",
2006
+ {}
2007
+ ) {
2008
+ };
2009
+ var HostToolNotFound = class extends Schema_exports.TaggedError()(
2010
+ "HostToolNotFound",
2011
+ {}
2012
+ ) {
2013
+ };
2014
+ var InputProblem = Schema_exports.String.check(Schema_exports.isMaxLength(512));
2015
+ var maxInputProblems = 10;
2016
+ var HostInputInvalid = class extends Schema_exports.TaggedError()("HostInputInvalid", {
2017
+ problems: Schema_exports.optionalKey(
2018
+ Schema_exports.Array(InputProblem).check(Schema_exports.isMaxLength(maxInputProblems))
2019
+ )
2020
+ }) {
2021
+ };
2022
+ var HostToolBlocked = class extends Schema_exports.TaggedError()("HostToolBlocked", {}) {
2023
+ };
2024
+ var HostToolApprovalRequired = class extends Schema_exports.TaggedError()(
2025
+ "HostToolApprovalRequired",
2026
+ { input: JsonValue, elicitation: ApprovalElicitation }
2027
+ ) {
2028
+ };
2029
+ var HostToolPolicyFailed = class extends Schema_exports.TaggedError()(
2030
+ "HostToolPolicyFailed",
2031
+ {}
2032
+ ) {
2033
+ };
2034
+ var HostOutputInvalid = class extends Schema_exports.TaggedError()(
2035
+ "HostOutputInvalid",
2036
+ {}
2037
+ ) {
2038
+ };
2039
+ var HostError = Schema_exports.Union([
2040
+ OpenapiResponseError,
2041
+ ProviderError,
2042
+ McpError,
2043
+ SkillLoadFailed,
2044
+ WorkflowFailure,
2045
+ HostRequestInvalid,
2046
+ HostAccountsInvalid,
2047
+ HostDeclarationInvalid,
2048
+ HostEvaluationFailed,
2049
+ HostOperationNotFound,
2050
+ HostOperationFailed,
2051
+ HostToolNotFound,
2052
+ HostInputInvalid,
2053
+ HostOutputInvalid,
2054
+ HostToolBlocked,
2055
+ HostToolApprovalRequired,
2056
+ HostToolPolicyFailed,
2057
+ ElicitationFailed
1662
2058
  ]);
1663
- var WorkflowControlCommand = Schema_exports.Union([
2059
+ var HostResponse = Schema_exports.Union([
1664
2060
  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)))
2061
+ ok: Schema_exports.Literal(true),
2062
+ value: JsonValue,
2063
+ toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
1669
2064
  }),
1670
- Schema_exports.Struct({ operation: Schema_exports.Literal("get"), run: WorkflowRunId }),
1671
- 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 })))
1676
- }),
1677
- Schema_exports.Struct({ operation: Schema_exports.Literal("terminate"), run: WorkflowRunId })
2065
+ Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError })
1678
2066
  ]);
2067
+ var HostInvocation = Schema_exports.Struct({
2068
+ command: HostRequest,
2069
+ accounts: ResolvedAccounts,
2070
+ approval: Schema_exports.optionalKey(TrustedToolApproval),
2071
+ replay: Schema_exports.optionalKey(WorkflowReplay),
2072
+ deadline: Schema_exports.optionalKey(InvocationDeadline),
2073
+ workflowRun: Schema_exports.optionalKey(WorkflowRunId)
2074
+ });
2075
+ var protocol1 = {
2076
+ version: 1,
2077
+ schemas: {
2078
+ invocation: HostInvocation,
2079
+ request: HostRequest,
2080
+ response: HostResponse,
2081
+ requirements: DeclaredRequirements,
2082
+ tools: Schema_exports.Array(HostedTool),
2083
+ toolSummaries: Schema_exports.Array(HostedToolSummary),
2084
+ skills: SkillCatalogResponse,
2085
+ elicitationRequest: FormElicitation,
2086
+ elicitationReply: ElicitationReply,
2087
+ workflowStep: WorkflowRpcCommand,
2088
+ workflowStepReply: WorkflowRpcResult,
2089
+ workflowControl: WorkflowControlCommand,
2090
+ cacheCommand: CacheCommand,
2091
+ cacheReply: CacheReply
2092
+ }
2093
+ };
2094
+
2095
+ // src/contracts/operations.ts
2096
+ var OperationToolPrefixes = { query: "queries.", mutate: "mutations." };
2097
+
2098
+ // src/contracts/host.ts
2099
+ var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
2100
+ var skillCatalog = (response) => Schema_exports.is(SkillSources)(response) ? response : { skills: response };
2101
+ var inspectCommand = (tools, scheduled) => ({
2102
+ operation: "inspect",
2103
+ ...tools === void 0 ? {} : { tools: [...tools] },
2104
+ ...scheduled === void 0 ? {} : { scheduled }
2105
+ });
2106
+ var indexCommand = { operation: "inspect", detail: "summary" };
2107
+ var selectTools = (tools) => (all) => tools === void 0 ? all : all.filter((tool) => tools.includes(tool.name));
2108
+ var HostRequirementsError = Schema_exports.Union([HostRequestInvalid, HostDeclarationInvalid]);
2109
+ var HostInspectError = Schema_exports.Union([
2110
+ ProviderError,
2111
+ McpError,
2112
+ SkillLoadFailed,
2113
+ HostRequestInvalid,
2114
+ HostDeclarationInvalid,
2115
+ HostAccountsInvalid,
2116
+ HostEvaluationFailed
2117
+ ]);
2118
+ var HostCallError = Schema_exports.Union([
2119
+ OpenapiResponseError,
2120
+ WorkflowFailure,
2121
+ HostInspectError,
2122
+ HostToolNotFound,
2123
+ HostOperationNotFound,
2124
+ HostOperationFailed,
2125
+ HostInputInvalid,
2126
+ HostOutputInvalid,
2127
+ HostToolBlocked,
2128
+ HostToolApprovalRequired,
2129
+ HostToolPolicyFailed,
2130
+ ElicitationFailed
2131
+ ]);
2132
+ var HostDataError = HostCallError;
2133
+ var ToolResultObservation = Context_exports.Reference(
2134
+ "apps/ToolResultObservation",
2135
+ { defaultValue: () => ({ failed: () => {
2136
+ } }) }
2137
+ );
1679
2138
 
1680
2139
  export {
1681
2140
  SecretsMethod,
@@ -1686,20 +2145,15 @@ export {
1686
2145
  OAuth2Method,
1687
2146
  Provider,
1688
2147
  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,
2148
+ ToolAnnotations,
2149
+ McpClientLimits,
2150
+ defaultMcpClientLimits,
2151
+ mcpSdkTimerCeilingMs,
2152
+ McpToolsOptions,
2153
+ McpToolResult,
2154
+ McpToolMetadata,
2155
+ McpError,
2156
+ ProcessConfig,
1703
2157
  WorkflowRunId,
1704
2158
  WorkflowName,
1705
2159
  workflowDurationMillis,
@@ -1715,5 +2169,69 @@ export {
1715
2169
  WorkflowCommand,
1716
2170
  WorkflowRpcCommand,
1717
2171
  WorkflowRpcResult,
1718
- WorkflowControlCommand
2172
+ WorkflowControlCommand,
2173
+ ElicitationLimits,
2174
+ defaultElicitationLimits,
2175
+ FormElicitation,
2176
+ ElicitationResponse,
2177
+ ElicitationFailed,
2178
+ ElicitationReply,
2179
+ ApprovalElicitation,
2180
+ ApprovalResponse,
2181
+ approvalElicitation,
2182
+ WebhookTransportLimits,
2183
+ defaultWebhookTransportLimits,
2184
+ WebhookRequestData,
2185
+ WebhookResponseData,
2186
+ ManualWebhookSetup,
2187
+ ManualWebhookDescriptor,
2188
+ HostedWebhook,
2189
+ WebhookCommand,
2190
+ frameworkProtocol,
2191
+ minimumIntervalMilliseconds,
2192
+ Interval,
2193
+ CalendarSchedule,
2194
+ ScheduleTiming,
2195
+ OperationSchedule,
2196
+ DeclaredAuthMethod,
2197
+ DeclaredProvider,
2198
+ DeclaredRequirements,
2199
+ ResolvedAccount,
2200
+ ResolvedAccounts,
2201
+ TrustedToolApproval,
2202
+ InvocationDeadline,
2203
+ HostedTool,
2204
+ HostedToolSummary,
2205
+ SkillSources,
2206
+ SkillCatalogResponse,
2207
+ HostRequest,
2208
+ HostRequestInvalid,
2209
+ HostAccountsInvalid,
2210
+ HostDeclarationInvalid,
2211
+ HostEvaluationFailed,
2212
+ HostOperationNotFound,
2213
+ HostOperationFailed,
2214
+ HostToolNotFound,
2215
+ InputProblem,
2216
+ maxInputProblems,
2217
+ HostInputInvalid,
2218
+ HostToolBlocked,
2219
+ HostToolApprovalRequired,
2220
+ HostToolPolicyFailed,
2221
+ HostOutputInvalid,
2222
+ HostError,
2223
+ HostResponse,
2224
+ HostInvocation,
2225
+ protocol1,
2226
+ OperationToolPrefixes,
2227
+ skillsCommand,
2228
+ skillCatalog,
2229
+ inspectCommand,
2230
+ indexCommand,
2231
+ selectTools,
2232
+ HostRequirementsError,
2233
+ HostInspectError,
2234
+ HostCallError,
2235
+ HostDataError,
2236
+ ToolResultObservation
1719
2237
  };