apps 0.0.1-beta.0
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.
- package/README.md +191 -0
- package/check-publish.mjs +10 -0
- package/framework-reference.json +1 -0
- package/js/chunk-22WRQZT7.js +389 -0
- package/js/chunk-2OTCEKL2.js +29480 -0
- package/js/chunk-36DNRFZQ.js +34 -0
- package/js/chunk-3ANFZFCV.js +1799 -0
- package/js/chunk-7JXHF5IF.js +138 -0
- package/js/chunk-BCSNKUAC.js +0 -0
- package/js/chunk-BKVL7XAJ.js +47 -0
- package/js/chunk-BPEFS4YF.js +1323 -0
- package/js/chunk-C24KEZXR.js +59 -0
- package/js/chunk-D6BKYP2L.js +877 -0
- package/js/chunk-EP6AEUZO.js +19 -0
- package/js/chunk-HP7E42X6.js +1719 -0
- package/js/chunk-KWTCHVLT.js +284 -0
- package/js/chunk-LOKGDT6B.js +28 -0
- package/js/chunk-MLKGABMK.js +9 -0
- package/js/chunk-OWD2YICM.js +2486 -0
- package/js/chunk-Q2FD5IBM.js +899 -0
- package/js/chunk-R6JMJSVT.js +590 -0
- package/js/chunk-SBKHUC5L.js +56 -0
- package/js/chunk-VFUZI3NY.js +75 -0
- package/js/chunk-W7Q5EOTS.js +4375 -0
- package/js/chunk-WIDTG42X.js +171 -0
- package/js/chunk-X3YBZCJW.js +246 -0
- package/js/chunk-YDR4CPJA.js +2357 -0
- package/js/client.js +1023 -0
- package/js/contracts.js +163 -0
- package/js/effect.js +44 -0
- package/js/graphql.js +392 -0
- package/js/host.js +193 -0
- package/js/index.js +284 -0
- package/js/mcp/effect.js +23 -0
- package/js/mcp/stdio.js +123 -0
- package/js/mcp.js +37 -0
- package/js/openapi.js +246 -0
- package/js/operations/approval.js +9 -0
- package/js/react.js +37 -0
- package/js/storage/facet.js +546 -0
- package/js/ui/auth/contracts.js +19 -0
- package/js/ui/auth.js +28 -0
- package/js/ui/contracts.js +24 -0
- package/js/ui/serving.js +286 -0
- package/package.json +116 -0
- package/runtime.json +1 -0
- package/types/app-data/src/contracts/database.d.ts +193 -0
- package/types/app-data/src/implementation/cursor.d.ts +10 -0
- package/types/app-data/src/implementation/index-key.d.ts +7 -0
- package/types/app-data/src/implementation/promise.d.ts +68 -0
- package/types/app-data/src/implementation/range.d.ts +8 -0
- package/types/app-data/src/implementation/schema.d.ts +33 -0
- package/types/app-data/src/implementation/sqlite.d.ts +11 -0
- package/types/app-data/src/index.d.ts +4 -0
- package/types/apps/src/approval.d.ts +10 -0
- package/types/apps/src/client.d.ts +5 -0
- package/types/apps/src/contracts/app.d.ts +58 -0
- package/types/apps/src/contracts/approval.d.ts +14 -0
- package/types/apps/src/contracts/context.d.ts +25 -0
- package/types/apps/src/contracts/elicitation.d.ts +86 -0
- package/types/apps/src/contracts/graphql.d.ts +102 -0
- package/types/apps/src/contracts/host.d.ts +568 -0
- package/types/apps/src/contracts/http.d.ts +20 -0
- package/types/apps/src/contracts/live.d.ts +26 -0
- package/types/apps/src/contracts/mcp.d.ts +93 -0
- package/types/apps/src/contracts/openapi.d.ts +105 -0
- package/types/apps/src/contracts/operations.d.ts +30 -0
- package/types/apps/src/contracts/optimistic.d.ts +22 -0
- package/types/apps/src/contracts/provider.d.ts +96 -0
- package/types/apps/src/contracts/schedules.d.ts +51 -0
- package/types/apps/src/contracts/schema.d.ts +20 -0
- package/types/apps/src/contracts/storage.d.ts +68 -0
- package/types/apps/src/contracts/tools.d.ts +11 -0
- package/types/apps/src/contracts/ui-auth.d.ts +28 -0
- package/types/apps/src/contracts/ui.d.ts +90 -0
- package/types/apps/src/contracts/webhook-protocol.d.ts +102 -0
- package/types/apps/src/contracts/webhooks.d.ts +53 -0
- package/types/apps/src/contracts/workflows.d.ts +277 -0
- package/types/apps/src/effect.d.ts +10 -0
- package/types/apps/src/facet.d.ts +5 -0
- package/types/apps/src/graphql.d.ts +10 -0
- package/types/apps/src/host.d.ts +16 -0
- package/types/apps/src/implementation/account-operations.d.ts +32 -0
- package/types/apps/src/implementation/app.d.ts +40 -0
- package/types/apps/src/implementation/authoring.d.ts +12 -0
- package/types/apps/src/implementation/elicitation.d.ts +103 -0
- package/types/apps/src/implementation/graphql.d.ts +5 -0
- package/types/apps/src/implementation/host.d.ts +3 -0
- package/types/apps/src/implementation/http.d.ts +5 -0
- package/types/apps/src/implementation/live.d.ts +18 -0
- package/types/apps/src/implementation/mcp-call.d.ts +19 -0
- package/types/apps/src/implementation/mcp-client.d.ts +50 -0
- package/types/apps/src/implementation/mcp-stdio.d.ts +4 -0
- package/types/apps/src/implementation/mcp-tools.d.ts +6 -0
- package/types/apps/src/implementation/mcp.d.ts +4 -0
- package/types/apps/src/implementation/openapi-request.d.ts +11 -0
- package/types/apps/src/implementation/openapi.d.ts +5 -0
- package/types/apps/src/implementation/operations.d.ts +65 -0
- package/types/apps/src/implementation/optimistic.d.ts +30 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +24 -0
- package/types/apps/src/implementation/provider.d.ts +16 -0
- package/types/apps/src/implementation/query-commit.d.ts +10 -0
- package/types/apps/src/implementation/schedules.d.ts +16 -0
- package/types/apps/src/implementation/schema.d.ts +93 -0
- package/types/apps/src/implementation/storage.d.ts +13 -0
- package/types/apps/src/implementation/ui-auth.d.ts +13 -0
- package/types/apps/src/implementation/ui-client.d.ts +16 -0
- package/types/apps/src/implementation/ui-errors.d.ts +2 -0
- package/types/apps/src/implementation/ui-serving.d.ts +16 -0
- package/types/apps/src/implementation/ui-watch.d.ts +2 -0
- package/types/apps/src/implementation/webhooks.d.ts +29 -0
- package/types/apps/src/implementation/workflow-context.d.ts +8 -0
- package/types/apps/src/implementation/workflow-rpc.d.ts +5 -0
- package/types/apps/src/implementation/workflows.d.ts +27 -0
- package/types/apps/src/index.d.ts +58 -0
- package/types/apps/src/mcp-stdio.d.ts +8 -0
- package/types/apps/src/mcp.d.ts +10 -0
- package/types/apps/src/openapi.d.ts +10 -0
- package/types/apps/src/react.d.ts +7 -0
- package/types/apps/src/ui-auth.d.ts +3 -0
- package/types/apps/src/ui-serving.d.ts +3 -0
- package/types/telemetry/src/browser-operations.d.ts +16 -0
- package/types/telemetry/src/browser-performance.d.ts +11 -0
- package/types/telemetry/src/browser-request-timing.d.ts +2 -0
- package/types/telemetry/src/browser.d.ts +27 -0
- package/types/telemetry/src/config.d.ts +83 -0
- package/types/telemetry/src/context.d.ts +14 -0
- package/types/telemetry/src/index.d.ts +9 -0
- package/types/telemetry/src/layer.d.ts +7 -0
- package/types/telemetry/src/measurements.d.ts +8 -0
- package/types/telemetry/src/pending-span.d.ts +7 -0
- package/types/telemetry/src/relay.d.ts +28 -0
- package/types/telemetry/src/span-attributes.d.ts +29 -0
- package/types/telemetry/src/trace-context.d.ts +20 -0
- package/types/telemetry/src/transport.d.ts +6 -0
|
@@ -0,0 +1,1719 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HttpUrl,
|
|
3
|
+
JsonObject as JsonObject2,
|
|
4
|
+
JsonValue
|
|
5
|
+
} from "./chunk-36DNRFZQ.js";
|
|
6
|
+
import {
|
|
7
|
+
Any,
|
|
8
|
+
ArraySchema,
|
|
9
|
+
Boolean,
|
|
10
|
+
Class2 as Class,
|
|
11
|
+
Cron_exports,
|
|
12
|
+
Data_exports,
|
|
13
|
+
Defect,
|
|
14
|
+
Error2,
|
|
15
|
+
Finite,
|
|
16
|
+
Int,
|
|
17
|
+
Json,
|
|
18
|
+
JsonObject,
|
|
19
|
+
Literal,
|
|
20
|
+
Literals,
|
|
21
|
+
Never,
|
|
22
|
+
Opaque,
|
|
23
|
+
Record,
|
|
24
|
+
Result_exports,
|
|
25
|
+
Schema_exports,
|
|
26
|
+
String,
|
|
27
|
+
Struct,
|
|
28
|
+
StructWithRest,
|
|
29
|
+
TemplateLiteral,
|
|
30
|
+
Uint8ArrayFromBase64,
|
|
31
|
+
Union,
|
|
32
|
+
Unknown,
|
|
33
|
+
Void,
|
|
34
|
+
add,
|
|
35
|
+
constFalse,
|
|
36
|
+
constTrue,
|
|
37
|
+
declare,
|
|
38
|
+
decode,
|
|
39
|
+
decodeTo,
|
|
40
|
+
empty2 as empty,
|
|
41
|
+
flatMap,
|
|
42
|
+
fromUndefinedOr,
|
|
43
|
+
isBetween,
|
|
44
|
+
isSchema,
|
|
45
|
+
isStream,
|
|
46
|
+
make6 as make,
|
|
47
|
+
merge,
|
|
48
|
+
optional,
|
|
49
|
+
optionalKey,
|
|
50
|
+
passthrough2 as passthrough,
|
|
51
|
+
pipeArguments,
|
|
52
|
+
symbol3 as symbol,
|
|
53
|
+
sync2 as sync,
|
|
54
|
+
tag,
|
|
55
|
+
transformOptional,
|
|
56
|
+
withConstructorDefault,
|
|
57
|
+
withDefault
|
|
58
|
+
} from "./chunk-2OTCEKL2.js";
|
|
59
|
+
|
|
60
|
+
// src/contracts/provider.ts
|
|
61
|
+
var SecretsMethod = class extends Data_exports.TaggedClass(
|
|
62
|
+
"secrets"
|
|
63
|
+
) {
|
|
64
|
+
};
|
|
65
|
+
var OAuthClientAuth = Schema_exports.Literals([
|
|
66
|
+
"none",
|
|
67
|
+
"client_secret_post",
|
|
68
|
+
"client_secret_basic",
|
|
69
|
+
"client_secret_basic_raw"
|
|
70
|
+
]);
|
|
71
|
+
var OAuthSecretClientAuth = Schema_exports.Literals([
|
|
72
|
+
"client_secret_post",
|
|
73
|
+
"client_secret_basic",
|
|
74
|
+
"client_secret_basic_raw"
|
|
75
|
+
]);
|
|
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([
|
|
83
|
+
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))
|
|
89
|
+
}),
|
|
90
|
+
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)
|
|
96
|
+
}),
|
|
97
|
+
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))
|
|
105
|
+
}),
|
|
106
|
+
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)
|
|
114
|
+
})
|
|
115
|
+
]);
|
|
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 })
|
|
138
|
+
]);
|
|
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([
|
|
148
|
+
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
|
+
)
|
|
156
|
+
}),
|
|
157
|
+
Schema_exports.Struct({ kind: Schema_exports.Literal("cron"), calendar: CalendarSchedule })
|
|
158
|
+
]);
|
|
159
|
+
var OperationSchedule = Schema_exports.Struct({
|
|
160
|
+
name: Schema_exports.NonEmptyString,
|
|
161
|
+
timing: ScheduleTiming,
|
|
162
|
+
input: JsonValue
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/rpc/RpcSchema.js
|
|
166
|
+
var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
|
|
167
|
+
var schema = /* @__PURE__ */ declare(isStream);
|
|
168
|
+
function Stream(success, error) {
|
|
169
|
+
return make(schema.ast, {
|
|
170
|
+
[StreamSchemaTypeId]: StreamSchemaTypeId,
|
|
171
|
+
success,
|
|
172
|
+
error
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/rpc/Rpc.js
|
|
177
|
+
var TypeId = "~effect/rpc/Rpc";
|
|
178
|
+
var Proto = {
|
|
179
|
+
[TypeId]: TypeId,
|
|
180
|
+
pipe() {
|
|
181
|
+
return pipeArguments(this, arguments);
|
|
182
|
+
},
|
|
183
|
+
setSuccess(successSchema) {
|
|
184
|
+
return makeProto({
|
|
185
|
+
_tag: this._tag,
|
|
186
|
+
payloadSchema: this.payloadSchema,
|
|
187
|
+
successSchema,
|
|
188
|
+
errorSchema: this.errorSchema,
|
|
189
|
+
defectSchema: this.defectSchema,
|
|
190
|
+
annotations: this.annotations,
|
|
191
|
+
middlewares: this.middlewares
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
setError(errorSchema) {
|
|
195
|
+
return makeProto({
|
|
196
|
+
_tag: this._tag,
|
|
197
|
+
payloadSchema: this.payloadSchema,
|
|
198
|
+
successSchema: this.successSchema,
|
|
199
|
+
errorSchema,
|
|
200
|
+
defectSchema: this.defectSchema,
|
|
201
|
+
annotations: this.annotations,
|
|
202
|
+
middlewares: this.middlewares
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
setPayload(payloadSchema) {
|
|
206
|
+
return makeProto({
|
|
207
|
+
_tag: this._tag,
|
|
208
|
+
payloadSchema: isSchema(payloadSchema) ? payloadSchema : Struct(payloadSchema),
|
|
209
|
+
successSchema: this.successSchema,
|
|
210
|
+
errorSchema: this.errorSchema,
|
|
211
|
+
defectSchema: this.defectSchema,
|
|
212
|
+
annotations: this.annotations,
|
|
213
|
+
middlewares: this.middlewares
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
middleware(middleware) {
|
|
217
|
+
return makeProto({
|
|
218
|
+
_tag: this._tag,
|
|
219
|
+
payloadSchema: this.payloadSchema,
|
|
220
|
+
successSchema: this.successSchema,
|
|
221
|
+
errorSchema: this.errorSchema,
|
|
222
|
+
defectSchema: this.defectSchema,
|
|
223
|
+
annotations: this.annotations,
|
|
224
|
+
middlewares: /* @__PURE__ */ new Set([...this.middlewares, middleware])
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
prefix(prefix) {
|
|
228
|
+
return makeProto({
|
|
229
|
+
_tag: `${prefix}${this._tag}`,
|
|
230
|
+
payloadSchema: this.payloadSchema,
|
|
231
|
+
successSchema: this.successSchema,
|
|
232
|
+
errorSchema: this.errorSchema,
|
|
233
|
+
defectSchema: this.defectSchema,
|
|
234
|
+
annotations: this.annotations,
|
|
235
|
+
middlewares: this.middlewares
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
annotate(tag2, value) {
|
|
239
|
+
return makeProto({
|
|
240
|
+
_tag: this._tag,
|
|
241
|
+
payloadSchema: this.payloadSchema,
|
|
242
|
+
successSchema: this.successSchema,
|
|
243
|
+
errorSchema: this.errorSchema,
|
|
244
|
+
defectSchema: this.defectSchema,
|
|
245
|
+
middlewares: this.middlewares,
|
|
246
|
+
annotations: add(this.annotations, tag2, value)
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
annotateMerge(context) {
|
|
250
|
+
return makeProto({
|
|
251
|
+
_tag: this._tag,
|
|
252
|
+
payloadSchema: this.payloadSchema,
|
|
253
|
+
successSchema: this.successSchema,
|
|
254
|
+
errorSchema: this.errorSchema,
|
|
255
|
+
defectSchema: this.defectSchema,
|
|
256
|
+
middlewares: this.middlewares,
|
|
257
|
+
annotations: merge(this.annotations, context)
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var makeProto = (options) => {
|
|
262
|
+
function Rpc() {
|
|
263
|
+
}
|
|
264
|
+
Object.setPrototypeOf(Rpc, Proto);
|
|
265
|
+
Object.assign(Rpc, options);
|
|
266
|
+
Rpc.key = `effect/rpc/Rpc/${options._tag}`;
|
|
267
|
+
return Rpc;
|
|
268
|
+
};
|
|
269
|
+
var make2 = (tag2, options) => {
|
|
270
|
+
const successSchema = options?.success ?? Void;
|
|
271
|
+
const errorSchema = options?.error ?? Never;
|
|
272
|
+
const defectSchema = options?.defect ?? Defect();
|
|
273
|
+
let payloadSchema;
|
|
274
|
+
if (options?.primaryKey) {
|
|
275
|
+
payloadSchema = class Payload extends Class(`effect/rpc/Rpc/${tag2}`)(options.payload) {
|
|
276
|
+
[symbol]() {
|
|
277
|
+
return options.primaryKey(this);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
} else {
|
|
281
|
+
payloadSchema = isSchema(options?.payload) ? options?.payload : options?.payload ? Struct(options?.payload) : Void;
|
|
282
|
+
}
|
|
283
|
+
return makeProto({
|
|
284
|
+
_tag: tag2,
|
|
285
|
+
payloadSchema,
|
|
286
|
+
successSchema: options?.stream ? Stream(successSchema, errorSchema) : successSchema,
|
|
287
|
+
errorSchema: options?.stream ? Never : errorSchema,
|
|
288
|
+
defectSchema,
|
|
289
|
+
annotations: empty(),
|
|
290
|
+
middlewares: /* @__PURE__ */ new Set()
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/ai/McpSchema.js
|
|
295
|
+
var optionalWithDefault = (schema2, defaultValue) => {
|
|
296
|
+
const effect = sync(defaultValue);
|
|
297
|
+
return optionalKey(schema2).pipe(decode({
|
|
298
|
+
decode: withDefault(effect),
|
|
299
|
+
encode: passthrough()
|
|
300
|
+
}), withConstructorDefault(effect));
|
|
301
|
+
};
|
|
302
|
+
var optional2 = (schema2) => optionalKey(schema2).pipe(decodeTo(optional(schema2), {
|
|
303
|
+
decode: passthrough(),
|
|
304
|
+
encode: transformOptional(flatMap(fromUndefinedOr))
|
|
305
|
+
}));
|
|
306
|
+
var RequestId = /* @__PURE__ */ Union([String, Finite]);
|
|
307
|
+
var ProgressToken = /* @__PURE__ */ Union([String, Finite]);
|
|
308
|
+
var RequestMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
309
|
+
_meta: /* @__PURE__ */ optional2(/* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
|
|
310
|
+
/**
|
|
311
|
+
* If specified, the caller is requesting out-of-band progress notifications
|
|
312
|
+
* for this request (as represented by notifications/progress). The value of
|
|
313
|
+
* this parameter is an opaque token that will be attached to any subsequent
|
|
314
|
+
* notifications. The receiver is not obligated to provide these
|
|
315
|
+
* notifications.
|
|
316
|
+
*/
|
|
317
|
+
progressToken: /* @__PURE__ */ optional2(ProgressToken)
|
|
318
|
+
}), [JsonObject]))
|
|
319
|
+
}))) {
|
|
320
|
+
};
|
|
321
|
+
var ResultMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
322
|
+
/**
|
|
323
|
+
* This result property is reserved by the protocol to allow clients and
|
|
324
|
+
* servers to attach additional metadata to their responses.
|
|
325
|
+
*/
|
|
326
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
327
|
+
}))) {
|
|
328
|
+
};
|
|
329
|
+
var NotificationMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
330
|
+
/**
|
|
331
|
+
* This parameter name is reserved by MCP to allow clients and servers to
|
|
332
|
+
* attach additional metadata to their notifications.
|
|
333
|
+
*/
|
|
334
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
335
|
+
}))) {
|
|
336
|
+
};
|
|
337
|
+
var Cursor = String;
|
|
338
|
+
var PaginatedRequestMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
339
|
+
...RequestMeta.fields,
|
|
340
|
+
/**
|
|
341
|
+
* An opaque token representing the current pagination position.
|
|
342
|
+
* If provided, the server should return results starting after this cursor.
|
|
343
|
+
*/
|
|
344
|
+
cursor: /* @__PURE__ */ optional2(Cursor)
|
|
345
|
+
}))) {
|
|
346
|
+
};
|
|
347
|
+
var PaginatedResultMeta = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
348
|
+
...ResultMeta.fields,
|
|
349
|
+
/**
|
|
350
|
+
* An opaque token representing the pagination position after the last returned result.
|
|
351
|
+
* If present, there may be more results available.
|
|
352
|
+
*/
|
|
353
|
+
nextCursor: /* @__PURE__ */ optional2(Cursor)
|
|
354
|
+
}))) {
|
|
355
|
+
};
|
|
356
|
+
var Role = /* @__PURE__ */ Literals(["user", "assistant"]);
|
|
357
|
+
var Annotations = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
358
|
+
/**
|
|
359
|
+
* Describes who the intended customer of this object or data is.
|
|
360
|
+
*
|
|
361
|
+
* It can include multiple entries to indicate content useful for multiple
|
|
362
|
+
* audiences (e.g., `["user", "assistant"]`).
|
|
363
|
+
*/
|
|
364
|
+
audience: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Role)),
|
|
365
|
+
/**
|
|
366
|
+
* Describes how important this data is for operating the server.
|
|
367
|
+
*
|
|
368
|
+
* A value of 1 means "most important," and indicates that the data is
|
|
369
|
+
* effectively required, while 0 means "least important," and indicates that
|
|
370
|
+
* the data is entirely optional.
|
|
371
|
+
*/
|
|
372
|
+
priority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
|
|
373
|
+
minimum: 0,
|
|
374
|
+
maximum: 1
|
|
375
|
+
}))),
|
|
376
|
+
/**
|
|
377
|
+
* The last time the annotated object was modified, formatted as an ISO 8601
|
|
378
|
+
* timestamp.
|
|
379
|
+
*/
|
|
380
|
+
lastModified: /* @__PURE__ */ optional2(String)
|
|
381
|
+
}))) {
|
|
382
|
+
};
|
|
383
|
+
var Icon = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Icon")({
|
|
384
|
+
/**
|
|
385
|
+
* URI containing the icon image.
|
|
386
|
+
*/
|
|
387
|
+
src: String,
|
|
388
|
+
/**
|
|
389
|
+
* MIME type of the icon, when known.
|
|
390
|
+
*/
|
|
391
|
+
mimeType: /* @__PURE__ */ optional2(String),
|
|
392
|
+
/**
|
|
393
|
+
* Sizes supported by the icon, such as `"48x48"` or `"any"`.
|
|
394
|
+
*/
|
|
395
|
+
sizes: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String)),
|
|
396
|
+
/**
|
|
397
|
+
* Color theme for which the icon was designed.
|
|
398
|
+
*/
|
|
399
|
+
theme: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["light", "dark"]))
|
|
400
|
+
})) {
|
|
401
|
+
};
|
|
402
|
+
var Implementation = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
403
|
+
name: String,
|
|
404
|
+
title: /* @__PURE__ */ optional2(String),
|
|
405
|
+
version: String,
|
|
406
|
+
icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
|
|
407
|
+
description: /* @__PURE__ */ optional2(String),
|
|
408
|
+
websiteUrl: /* @__PURE__ */ optional2(String)
|
|
409
|
+
}))) {
|
|
410
|
+
};
|
|
411
|
+
var ClientCapabilities = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ClientCapabilities")({
|
|
412
|
+
/**
|
|
413
|
+
* Experimental, non-standard capabilities that the client supports.
|
|
414
|
+
*/
|
|
415
|
+
experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, /* @__PURE__ */ Struct({}))),
|
|
416
|
+
/**
|
|
417
|
+
* Optional extensions capabilities advertised by the client.
|
|
418
|
+
* Keys are extension identifiers following <vendor-prefix>/<extension-name> (e.g. "io.modelcontextprotocol/ui").
|
|
419
|
+
*/
|
|
420
|
+
extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String, "/", String]), Json)),
|
|
421
|
+
/**
|
|
422
|
+
* Present if the client supports listing roots.
|
|
423
|
+
*/
|
|
424
|
+
roots: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
|
|
425
|
+
/**
|
|
426
|
+
* Whether the client supports notifications for changes to the roots list.
|
|
427
|
+
*/
|
|
428
|
+
listChanged: /* @__PURE__ */ optional2(Boolean)
|
|
429
|
+
})),
|
|
430
|
+
/**
|
|
431
|
+
* Present if the client supports sampling from an LLM.
|
|
432
|
+
*/
|
|
433
|
+
sampling: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
|
|
434
|
+
/**
|
|
435
|
+
* Present if the client supports context inclusion during sampling.
|
|
436
|
+
*/
|
|
437
|
+
context: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
|
|
438
|
+
/**
|
|
439
|
+
* Present if the client supports tool use during sampling.
|
|
440
|
+
*/
|
|
441
|
+
tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
|
|
442
|
+
})),
|
|
443
|
+
/**
|
|
444
|
+
* Present if the client supports elicitation from the server.
|
|
445
|
+
*/
|
|
446
|
+
elicitation: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
|
|
447
|
+
/**
|
|
448
|
+
* Present if the client supports form-mode elicitation.
|
|
449
|
+
*/
|
|
450
|
+
form: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
|
|
451
|
+
/**
|
|
452
|
+
* Present if the client supports URL-mode elicitation.
|
|
453
|
+
*/
|
|
454
|
+
url: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
|
|
455
|
+
}))
|
|
456
|
+
})) {
|
|
457
|
+
};
|
|
458
|
+
var ServerCapabilities = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
459
|
+
/**
|
|
460
|
+
* Experimental, non-standard capabilities that the server supports.
|
|
461
|
+
*/
|
|
462
|
+
experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, /* @__PURE__ */ Struct({}))),
|
|
463
|
+
/**
|
|
464
|
+
* Optional extensions capabilities advertised by the server.
|
|
465
|
+
* Keys are extension identifiers following <vendor-prefix>/<extension-name> (e.g. "io.modelcontextprotocol/ui").
|
|
466
|
+
*/
|
|
467
|
+
extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String, "/", String]), Json)),
|
|
468
|
+
/**
|
|
469
|
+
* Present if the server supports sending log messages to the client.
|
|
470
|
+
*/
|
|
471
|
+
logging: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
|
|
472
|
+
/**
|
|
473
|
+
* Present if the server supports argument autocompletion suggestions.
|
|
474
|
+
*/
|
|
475
|
+
completions: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
|
|
476
|
+
/**
|
|
477
|
+
* Present if the server offers any prompt templates.
|
|
478
|
+
*/
|
|
479
|
+
prompts: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
|
|
480
|
+
/**
|
|
481
|
+
* Whether this server supports notifications for changes to the prompt list.
|
|
482
|
+
*/
|
|
483
|
+
listChanged: /* @__PURE__ */ optional2(Boolean)
|
|
484
|
+
})),
|
|
485
|
+
/**
|
|
486
|
+
* Present if the server offers any resources to read.
|
|
487
|
+
*/
|
|
488
|
+
resources: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
|
|
489
|
+
/**
|
|
490
|
+
* Whether this server supports subscribing to resource updates.
|
|
491
|
+
*/
|
|
492
|
+
subscribe: /* @__PURE__ */ optional2(Boolean),
|
|
493
|
+
/**
|
|
494
|
+
* Whether this server supports notifications for changes to the resource list.
|
|
495
|
+
*/
|
|
496
|
+
listChanged: /* @__PURE__ */ optional2(Boolean)
|
|
497
|
+
})),
|
|
498
|
+
/**
|
|
499
|
+
* Present if the server offers any tools to call.
|
|
500
|
+
*/
|
|
501
|
+
tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
|
|
502
|
+
/**
|
|
503
|
+
* Whether this server supports notifications for changes to the tool list.
|
|
504
|
+
*/
|
|
505
|
+
listChanged: /* @__PURE__ */ optional2(Boolean)
|
|
506
|
+
}))
|
|
507
|
+
}))) {
|
|
508
|
+
};
|
|
509
|
+
var McpErrorBase = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/McpErrorBase")({
|
|
510
|
+
/**
|
|
511
|
+
* The error type that occurred.
|
|
512
|
+
*/
|
|
513
|
+
code: Int,
|
|
514
|
+
/**
|
|
515
|
+
* A short description of the error. The message SHOULD be limited to a
|
|
516
|
+
* concise single sentence.
|
|
517
|
+
*/
|
|
518
|
+
message: String,
|
|
519
|
+
/**
|
|
520
|
+
* Additional information about the error. The value of this member is
|
|
521
|
+
* defined by the sender (e.g. detailed error information, nested errors etc.).
|
|
522
|
+
*/
|
|
523
|
+
data: /* @__PURE__ */ optional2(Any)
|
|
524
|
+
})) {
|
|
525
|
+
};
|
|
526
|
+
var INVALID_REQUEST_ERROR_CODE = -32600;
|
|
527
|
+
var METHOD_NOT_FOUND_ERROR_CODE = -32601;
|
|
528
|
+
var INVALID_PARAMS_ERROR_CODE = -32602;
|
|
529
|
+
var INTERNAL_ERROR_CODE = -32603;
|
|
530
|
+
var PARSE_ERROR_CODE = -32700;
|
|
531
|
+
var ParseError = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/ParseError")({
|
|
532
|
+
...McpErrorBase.fields,
|
|
533
|
+
_tag: /* @__PURE__ */ tag("ParseError"),
|
|
534
|
+
code: /* @__PURE__ */ tag(PARSE_ERROR_CODE)
|
|
535
|
+
})) {
|
|
536
|
+
};
|
|
537
|
+
var InvalidRequest = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InvalidRequest")({
|
|
538
|
+
...McpErrorBase.fields,
|
|
539
|
+
_tag: /* @__PURE__ */ tag("InvalidRequest"),
|
|
540
|
+
code: /* @__PURE__ */ tag(INVALID_REQUEST_ERROR_CODE)
|
|
541
|
+
})) {
|
|
542
|
+
};
|
|
543
|
+
var MethodNotFound = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/MethodNotFound")({
|
|
544
|
+
...McpErrorBase.fields,
|
|
545
|
+
_tag: /* @__PURE__ */ tag("MethodNotFound"),
|
|
546
|
+
code: /* @__PURE__ */ tag(METHOD_NOT_FOUND_ERROR_CODE)
|
|
547
|
+
})) {
|
|
548
|
+
};
|
|
549
|
+
var InvalidParams = class extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InvalidParams")({
|
|
550
|
+
...McpErrorBase.fields,
|
|
551
|
+
_tag: /* @__PURE__ */ tag("InvalidParams"),
|
|
552
|
+
code: /* @__PURE__ */ tag(INVALID_PARAMS_ERROR_CODE)
|
|
553
|
+
})) {
|
|
554
|
+
};
|
|
555
|
+
var InternalError = class _InternalError extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InternalError")({
|
|
556
|
+
...McpErrorBase.fields,
|
|
557
|
+
_tag: /* @__PURE__ */ tag("InternalError"),
|
|
558
|
+
code: /* @__PURE__ */ tag(INTERNAL_ERROR_CODE)
|
|
559
|
+
})) {
|
|
560
|
+
static notImplemented = /* @__PURE__ */ new _InternalError({
|
|
561
|
+
message: "Not implemented"
|
|
562
|
+
});
|
|
563
|
+
};
|
|
564
|
+
var McpError = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
|
|
565
|
+
var InitializeResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
566
|
+
...ResultMeta.fields,
|
|
567
|
+
/**
|
|
568
|
+
* The version of the Model Context Protocol that the server wants to use.
|
|
569
|
+
* This may not match the version that the client requested. If the client
|
|
570
|
+
* cannot support this version, it MUST disconnect.
|
|
571
|
+
*/
|
|
572
|
+
protocolVersion: String,
|
|
573
|
+
capabilities: ServerCapabilities,
|
|
574
|
+
serverInfo: Implementation,
|
|
575
|
+
/**
|
|
576
|
+
* Instructions describing how to use the server and its features.
|
|
577
|
+
*
|
|
578
|
+
* This can be used by clients to improve the LLM's understanding of available
|
|
579
|
+
* tools, resources, etc. It can be thought of like a "hint" to the model.
|
|
580
|
+
* For example, this information MAY be added to the system prompt.
|
|
581
|
+
*/
|
|
582
|
+
instructions: /* @__PURE__ */ optional2(String)
|
|
583
|
+
}))) {
|
|
584
|
+
};
|
|
585
|
+
var Initialize = class extends (/* @__PURE__ */ make2("initialize", {
|
|
586
|
+
success: InitializeResult,
|
|
587
|
+
error: McpError,
|
|
588
|
+
payload: {
|
|
589
|
+
...RequestMeta.fields,
|
|
590
|
+
/**
|
|
591
|
+
* The latest version of the Model Context Protocol that the client
|
|
592
|
+
* supports. The client MAY decide to support older versions as well.
|
|
593
|
+
*/
|
|
594
|
+
protocolVersion: String,
|
|
595
|
+
/**
|
|
596
|
+
* Capabilities a client may support. Known capabilities are defined here,
|
|
597
|
+
* in this schema, but this is not a closed set: any client can define its
|
|
598
|
+
* own, additional capabilities.
|
|
599
|
+
*/
|
|
600
|
+
capabilities: ClientCapabilities,
|
|
601
|
+
/**
|
|
602
|
+
* Describes the name and version of an MCP implementation.
|
|
603
|
+
*/
|
|
604
|
+
clientInfo: Implementation
|
|
605
|
+
}
|
|
606
|
+
})) {
|
|
607
|
+
};
|
|
608
|
+
var CancelledNotification = class extends (/* @__PURE__ */ make2("notifications/cancelled", {
|
|
609
|
+
payload: {
|
|
610
|
+
...NotificationMeta.fields,
|
|
611
|
+
/**
|
|
612
|
+
* The ID of the request to cancel.
|
|
613
|
+
*
|
|
614
|
+
* This MUST correspond to the ID of a request previously issued in the
|
|
615
|
+
* same direction.
|
|
616
|
+
*/
|
|
617
|
+
requestId: RequestId,
|
|
618
|
+
/**
|
|
619
|
+
* An optional string describing the reason for the cancellation. This MAY
|
|
620
|
+
* be logged or presented to the user.
|
|
621
|
+
*/
|
|
622
|
+
reason: /* @__PURE__ */ optional2(String)
|
|
623
|
+
}
|
|
624
|
+
})) {
|
|
625
|
+
};
|
|
626
|
+
var ProgressNotification = class extends (/* @__PURE__ */ make2("notifications/progress", {
|
|
627
|
+
payload: {
|
|
628
|
+
...NotificationMeta.fields,
|
|
629
|
+
/**
|
|
630
|
+
* The progress token which was given in the initial request, used to
|
|
631
|
+
* associate this notification with the request that is proceeding.
|
|
632
|
+
*/
|
|
633
|
+
progressToken: ProgressToken,
|
|
634
|
+
/**
|
|
635
|
+
* The progress thus far. This should increase every time progress is made,
|
|
636
|
+
* even if the total is unknown.
|
|
637
|
+
*/
|
|
638
|
+
progress: Finite,
|
|
639
|
+
/**
|
|
640
|
+
* Total number of items to process (or total progress required), if known.
|
|
641
|
+
*/
|
|
642
|
+
total: /* @__PURE__ */ optional2(Finite),
|
|
643
|
+
/**
|
|
644
|
+
* An optional message describing the current progress.
|
|
645
|
+
*/
|
|
646
|
+
message: /* @__PURE__ */ optional2(String)
|
|
647
|
+
}
|
|
648
|
+
})) {
|
|
649
|
+
};
|
|
650
|
+
var Resource = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Resource")({
|
|
651
|
+
/**
|
|
652
|
+
* The URI of this resource.
|
|
653
|
+
*/
|
|
654
|
+
uri: String,
|
|
655
|
+
/**
|
|
656
|
+
* A human-readable name for this resource.
|
|
657
|
+
*
|
|
658
|
+
* This can be used by clients to populate UI elements.
|
|
659
|
+
*/
|
|
660
|
+
name: String,
|
|
661
|
+
title: /* @__PURE__ */ optional2(String),
|
|
662
|
+
/**
|
|
663
|
+
* A description of what this resource represents.
|
|
664
|
+
*
|
|
665
|
+
* This can be used by clients to improve the LLM's understanding of available
|
|
666
|
+
* resources. It can be thought of like a "hint" to the model.
|
|
667
|
+
*/
|
|
668
|
+
description: /* @__PURE__ */ optional2(String),
|
|
669
|
+
/**
|
|
670
|
+
* The MIME type of this resource, if known.
|
|
671
|
+
*/
|
|
672
|
+
mimeType: /* @__PURE__ */ optional2(String),
|
|
673
|
+
/**
|
|
674
|
+
* Optional annotations for the client.
|
|
675
|
+
*/
|
|
676
|
+
annotations: /* @__PURE__ */ optional2(Annotations),
|
|
677
|
+
/**
|
|
678
|
+
* Icons that clients can display for this resource.
|
|
679
|
+
*/
|
|
680
|
+
icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
|
|
681
|
+
/**
|
|
682
|
+
* The size of the raw resource content, in bytes (i.e., before base64
|
|
683
|
+
* encoding or any tokenization), if known.
|
|
684
|
+
*
|
|
685
|
+
* This can be used by Hosts to display file sizes and estimate context
|
|
686
|
+
* window usage.
|
|
687
|
+
*/
|
|
688
|
+
size: /* @__PURE__ */ optional2(Int),
|
|
689
|
+
/**
|
|
690
|
+
* Optional additional metadata for the client.
|
|
691
|
+
*
|
|
692
|
+
* This parameter name is reserved by MCP to allow clients and servers to
|
|
693
|
+
* attach additional metadata to resources.
|
|
694
|
+
*/
|
|
695
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
696
|
+
})) {
|
|
697
|
+
};
|
|
698
|
+
var ResourceTemplate = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ResourceTemplate")({
|
|
699
|
+
/**
|
|
700
|
+
* A URI template (according to RFC 6570) that can be used to construct
|
|
701
|
+
* resource URIs.
|
|
702
|
+
*/
|
|
703
|
+
uriTemplate: String,
|
|
704
|
+
/**
|
|
705
|
+
* A human-readable name for the type of resource this template refers to.
|
|
706
|
+
*
|
|
707
|
+
* This can be used by clients to populate UI elements.
|
|
708
|
+
*/
|
|
709
|
+
name: String,
|
|
710
|
+
title: /* @__PURE__ */ optional2(String),
|
|
711
|
+
/**
|
|
712
|
+
* A description of what this template is for.
|
|
713
|
+
*
|
|
714
|
+
* This can be used by clients to improve the LLM's understanding of available
|
|
715
|
+
* resources. It can be thought of like a "hint" to the model.
|
|
716
|
+
*/
|
|
717
|
+
description: /* @__PURE__ */ optional2(String),
|
|
718
|
+
/**
|
|
719
|
+
* The MIME type for all resources that match this template. This should only
|
|
720
|
+
* be included if all resources matching this template have the same type.
|
|
721
|
+
*/
|
|
722
|
+
mimeType: /* @__PURE__ */ optional2(String),
|
|
723
|
+
/**
|
|
724
|
+
* Optional annotations for the client.
|
|
725
|
+
*/
|
|
726
|
+
annotations: /* @__PURE__ */ optional2(Annotations),
|
|
727
|
+
/**
|
|
728
|
+
* Icons that clients can display for this resource template.
|
|
729
|
+
*/
|
|
730
|
+
icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
|
|
731
|
+
/**
|
|
732
|
+
* Optional additional metadata for the client.
|
|
733
|
+
*/
|
|
734
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
735
|
+
})) {
|
|
736
|
+
};
|
|
737
|
+
var ResourceContents = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
738
|
+
/**
|
|
739
|
+
* The URI of this resource.
|
|
740
|
+
*/
|
|
741
|
+
uri: String,
|
|
742
|
+
/**
|
|
743
|
+
* The MIME type of this resource, if known.
|
|
744
|
+
*/
|
|
745
|
+
mimeType: /* @__PURE__ */ optional2(String),
|
|
746
|
+
/**
|
|
747
|
+
* Optional additional metadata for the client.
|
|
748
|
+
*/
|
|
749
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
750
|
+
}))) {
|
|
751
|
+
};
|
|
752
|
+
var TextResourceContents = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
753
|
+
...ResourceContents.fields,
|
|
754
|
+
/**
|
|
755
|
+
* The text of the item. This must only be set if the item can actually be
|
|
756
|
+
* represented as text (not binary data).
|
|
757
|
+
*/
|
|
758
|
+
text: String
|
|
759
|
+
}))) {
|
|
760
|
+
};
|
|
761
|
+
var BlobResourceContents = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
762
|
+
...ResourceContents.fields,
|
|
763
|
+
/**
|
|
764
|
+
* The binary data of the item decoded from a base64-encoded string.
|
|
765
|
+
*/
|
|
766
|
+
blob: Uint8ArrayFromBase64
|
|
767
|
+
}))) {
|
|
768
|
+
};
|
|
769
|
+
var ListResourcesResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListResourcesResult")({
|
|
770
|
+
...PaginatedResultMeta.fields,
|
|
771
|
+
resources: /* @__PURE__ */ ArraySchema(Resource)
|
|
772
|
+
})) {
|
|
773
|
+
};
|
|
774
|
+
var ListResourceTemplatesResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListResourceTemplatesResult")({
|
|
775
|
+
...PaginatedResultMeta.fields,
|
|
776
|
+
resourceTemplates: /* @__PURE__ */ ArraySchema(ResourceTemplate)
|
|
777
|
+
})) {
|
|
778
|
+
};
|
|
779
|
+
var ReadResourceResult = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
780
|
+
...ResultMeta.fields,
|
|
781
|
+
contents: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]))
|
|
782
|
+
}))) {
|
|
783
|
+
};
|
|
784
|
+
var ReadResource = class extends (/* @__PURE__ */ make2("resources/read", {
|
|
785
|
+
success: ReadResourceResult,
|
|
786
|
+
error: McpError,
|
|
787
|
+
payload: {
|
|
788
|
+
...RequestMeta.fields,
|
|
789
|
+
/**
|
|
790
|
+
* The URI of the resource to read. The URI can use any protocol; it is up
|
|
791
|
+
* to the server how to interpret it.
|
|
792
|
+
*/
|
|
793
|
+
uri: String
|
|
794
|
+
}
|
|
795
|
+
})) {
|
|
796
|
+
};
|
|
797
|
+
var Subscribe = class extends (/* @__PURE__ */ make2("resources/subscribe", {
|
|
798
|
+
success: /* @__PURE__ */ Struct({}),
|
|
799
|
+
error: McpError,
|
|
800
|
+
payload: {
|
|
801
|
+
...RequestMeta.fields,
|
|
802
|
+
/**
|
|
803
|
+
* The URI of the resource to subscribe to. The URI can use any protocol;
|
|
804
|
+
* it is up to the server how to interpret it.
|
|
805
|
+
*/
|
|
806
|
+
uri: String
|
|
807
|
+
}
|
|
808
|
+
})) {
|
|
809
|
+
};
|
|
810
|
+
var Unsubscribe = class extends (/* @__PURE__ */ make2("resources/unsubscribe", {
|
|
811
|
+
success: /* @__PURE__ */ Struct({}),
|
|
812
|
+
error: McpError,
|
|
813
|
+
payload: {
|
|
814
|
+
...RequestMeta.fields,
|
|
815
|
+
/**
|
|
816
|
+
* The URI of the resource to subscribe to. The URI can use any protocol;
|
|
817
|
+
* it is up to the server how to interpret it.
|
|
818
|
+
*/
|
|
819
|
+
uri: String
|
|
820
|
+
}
|
|
821
|
+
})) {
|
|
822
|
+
};
|
|
823
|
+
var ResourceUpdatedNotification = class extends (/* @__PURE__ */ make2("notifications/resources/updated", {
|
|
824
|
+
payload: {
|
|
825
|
+
...NotificationMeta.fields,
|
|
826
|
+
/**
|
|
827
|
+
* The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
|
|
828
|
+
*/
|
|
829
|
+
uri: String
|
|
830
|
+
}
|
|
831
|
+
})) {
|
|
832
|
+
};
|
|
833
|
+
var PromptArgument = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
834
|
+
/**
|
|
835
|
+
* The name of the argument.
|
|
836
|
+
*/
|
|
837
|
+
name: String,
|
|
838
|
+
title: /* @__PURE__ */ optional2(String),
|
|
839
|
+
/**
|
|
840
|
+
* A human-readable description of the argument.
|
|
841
|
+
*/
|
|
842
|
+
description: /* @__PURE__ */ optional2(String),
|
|
843
|
+
/**
|
|
844
|
+
* Whether this argument must be provided.
|
|
845
|
+
*/
|
|
846
|
+
required: /* @__PURE__ */ optional2(Boolean)
|
|
847
|
+
}))) {
|
|
848
|
+
};
|
|
849
|
+
var Prompt = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Prompt")({
|
|
850
|
+
/**
|
|
851
|
+
* The name of the prompt or prompt template.
|
|
852
|
+
*/
|
|
853
|
+
name: String,
|
|
854
|
+
title: /* @__PURE__ */ optional2(String),
|
|
855
|
+
/**
|
|
856
|
+
* An optional description of what this prompt provides
|
|
857
|
+
*/
|
|
858
|
+
description: /* @__PURE__ */ optional2(String),
|
|
859
|
+
/**
|
|
860
|
+
* A list of arguments to use for templating the prompt.
|
|
861
|
+
*/
|
|
862
|
+
arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(PromptArgument)),
|
|
863
|
+
/**
|
|
864
|
+
* Icons that clients can display for this prompt.
|
|
865
|
+
*/
|
|
866
|
+
icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
|
|
867
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
868
|
+
})) {
|
|
869
|
+
};
|
|
870
|
+
var TextContent = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
871
|
+
type: /* @__PURE__ */ tag("text"),
|
|
872
|
+
/**
|
|
873
|
+
* The text content of the message.
|
|
874
|
+
*/
|
|
875
|
+
text: String,
|
|
876
|
+
/**
|
|
877
|
+
* Optional annotations for the client.
|
|
878
|
+
*/
|
|
879
|
+
annotations: /* @__PURE__ */ optional2(Annotations),
|
|
880
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
881
|
+
}))) {
|
|
882
|
+
};
|
|
883
|
+
var ImageContent = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
884
|
+
type: /* @__PURE__ */ tag("image"),
|
|
885
|
+
/**
|
|
886
|
+
* The image data.
|
|
887
|
+
*/
|
|
888
|
+
data: Uint8ArrayFromBase64,
|
|
889
|
+
/**
|
|
890
|
+
* The MIME type of the image. Different providers may support different
|
|
891
|
+
* image types.
|
|
892
|
+
*/
|
|
893
|
+
mimeType: String,
|
|
894
|
+
/**
|
|
895
|
+
* Optional annotations for the client.
|
|
896
|
+
*/
|
|
897
|
+
annotations: /* @__PURE__ */ optional2(Annotations),
|
|
898
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
899
|
+
}))) {
|
|
900
|
+
};
|
|
901
|
+
var AudioContent = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
902
|
+
type: /* @__PURE__ */ tag("audio"),
|
|
903
|
+
/**
|
|
904
|
+
* The audio data.
|
|
905
|
+
*/
|
|
906
|
+
data: Uint8ArrayFromBase64,
|
|
907
|
+
/**
|
|
908
|
+
* The MIME type of the audio. Different providers may support different
|
|
909
|
+
* audio types.
|
|
910
|
+
*/
|
|
911
|
+
mimeType: String,
|
|
912
|
+
/**
|
|
913
|
+
* Optional annotations for the client.
|
|
914
|
+
*/
|
|
915
|
+
annotations: /* @__PURE__ */ optional2(Annotations),
|
|
916
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
917
|
+
}))) {
|
|
918
|
+
};
|
|
919
|
+
var EmbeddedResource = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
920
|
+
type: /* @__PURE__ */ tag("resource"),
|
|
921
|
+
resource: /* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]),
|
|
922
|
+
/**
|
|
923
|
+
* Optional annotations for the client.
|
|
924
|
+
*/
|
|
925
|
+
annotations: /* @__PURE__ */ optional2(Annotations),
|
|
926
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
927
|
+
}))) {
|
|
928
|
+
};
|
|
929
|
+
var ResourceLink = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
930
|
+
...Resource.fields,
|
|
931
|
+
type: /* @__PURE__ */ tag("resource_link")
|
|
932
|
+
}))) {
|
|
933
|
+
};
|
|
934
|
+
var ContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, EmbeddedResource, ResourceLink]);
|
|
935
|
+
var PromptMessage = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
936
|
+
role: Role,
|
|
937
|
+
content: ContentBlock
|
|
938
|
+
}))) {
|
|
939
|
+
};
|
|
940
|
+
var ListPromptsResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListPromptsResult")({
|
|
941
|
+
...PaginatedResultMeta.fields,
|
|
942
|
+
prompts: /* @__PURE__ */ ArraySchema(Prompt)
|
|
943
|
+
})) {
|
|
944
|
+
};
|
|
945
|
+
var GetPromptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/GetPromptResult")({
|
|
946
|
+
...ResultMeta.fields,
|
|
947
|
+
messages: /* @__PURE__ */ ArraySchema(PromptMessage),
|
|
948
|
+
/**
|
|
949
|
+
* An optional description for the prompt.
|
|
950
|
+
*/
|
|
951
|
+
description: /* @__PURE__ */ optional2(String)
|
|
952
|
+
})) {
|
|
953
|
+
};
|
|
954
|
+
var GetPrompt = class extends (/* @__PURE__ */ make2("prompts/get", {
|
|
955
|
+
success: GetPromptResult,
|
|
956
|
+
error: McpError,
|
|
957
|
+
payload: {
|
|
958
|
+
...RequestMeta.fields,
|
|
959
|
+
/**
|
|
960
|
+
* The name of the prompt or prompt template.
|
|
961
|
+
*/
|
|
962
|
+
name: String,
|
|
963
|
+
title: /* @__PURE__ */ optional2(String),
|
|
964
|
+
/**
|
|
965
|
+
* Arguments to use for templating the prompt.
|
|
966
|
+
*/
|
|
967
|
+
arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, String))
|
|
968
|
+
}
|
|
969
|
+
})) {
|
|
970
|
+
};
|
|
971
|
+
var ToolAnnotations = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
972
|
+
/**
|
|
973
|
+
* A human-readable title for the tool.
|
|
974
|
+
*/
|
|
975
|
+
title: /* @__PURE__ */ optional2(String),
|
|
976
|
+
/**
|
|
977
|
+
* If true, the tool does not modify its environment.
|
|
978
|
+
*
|
|
979
|
+
* Default: `false`
|
|
980
|
+
*/
|
|
981
|
+
readOnlyHint: /* @__PURE__ */ optionalWithDefault(Boolean, constFalse),
|
|
982
|
+
/**
|
|
983
|
+
* If true, the tool may perform destructive updates to its environment.
|
|
984
|
+
* If false, the tool performs only additive updates.
|
|
985
|
+
*
|
|
986
|
+
* (This property is meaningful only when `readOnlyHint == false`)
|
|
987
|
+
*
|
|
988
|
+
* Default: `true`
|
|
989
|
+
*/
|
|
990
|
+
destructiveHint: /* @__PURE__ */ optionalWithDefault(Boolean, constTrue),
|
|
991
|
+
/**
|
|
992
|
+
* If true, calling the tool repeatedly with the same arguments
|
|
993
|
+
* will have no additional effect on the its environment.
|
|
994
|
+
*
|
|
995
|
+
* (This property is meaningful only when `readOnlyHint == false`)
|
|
996
|
+
*
|
|
997
|
+
* Default: `false`
|
|
998
|
+
*/
|
|
999
|
+
idempotentHint: /* @__PURE__ */ optionalWithDefault(Boolean, constFalse),
|
|
1000
|
+
/**
|
|
1001
|
+
* If true, this tool may interact with an "open world" of external
|
|
1002
|
+
* entities. If false, the tool's domain of interaction is closed.
|
|
1003
|
+
* For example, the world of a web search tool is open, whereas that
|
|
1004
|
+
* of a memory tool is not.
|
|
1005
|
+
*
|
|
1006
|
+
* Default: `true`
|
|
1007
|
+
*/
|
|
1008
|
+
openWorldHint: /* @__PURE__ */ optionalWithDefault(Boolean, constTrue)
|
|
1009
|
+
}))) {
|
|
1010
|
+
};
|
|
1011
|
+
var ToolJson = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
|
|
1012
|
+
type: /* @__PURE__ */ Literal("object"),
|
|
1013
|
+
properties: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, JsonObject)),
|
|
1014
|
+
required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
|
|
1015
|
+
}), [JsonObject]);
|
|
1016
|
+
var ToolOutputJson = JsonObject;
|
|
1017
|
+
var Tool = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/Tool")({
|
|
1018
|
+
/**
|
|
1019
|
+
* The name of the tool.
|
|
1020
|
+
*/
|
|
1021
|
+
name: String,
|
|
1022
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1023
|
+
/**
|
|
1024
|
+
* A human-readable description of the tool.
|
|
1025
|
+
*
|
|
1026
|
+
* This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model.
|
|
1027
|
+
*/
|
|
1028
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1029
|
+
/**
|
|
1030
|
+
* A JSON Schema object defining the expected parameters for the tool.
|
|
1031
|
+
*/
|
|
1032
|
+
inputSchema: ToolJson,
|
|
1033
|
+
/**
|
|
1034
|
+
* An optional JSON Schema object defining the structure of the tool output.
|
|
1035
|
+
*/
|
|
1036
|
+
outputSchema: /* @__PURE__ */ optional2(ToolOutputJson),
|
|
1037
|
+
/**
|
|
1038
|
+
* Optional additional tool information.
|
|
1039
|
+
*/
|
|
1040
|
+
annotations: /* @__PURE__ */ optional2(ToolAnnotations),
|
|
1041
|
+
/**
|
|
1042
|
+
* Icons that clients can display for this tool.
|
|
1043
|
+
*/
|
|
1044
|
+
icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
|
|
1045
|
+
/**
|
|
1046
|
+
* Optional additional metadata for the client.
|
|
1047
|
+
*
|
|
1048
|
+
* This parameter name is reserved by MCP to allow clients and servers to
|
|
1049
|
+
* attach additional metadata to resources.
|
|
1050
|
+
*/
|
|
1051
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
1052
|
+
})) {
|
|
1053
|
+
};
|
|
1054
|
+
var ListToolsResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ListToolsResult")({
|
|
1055
|
+
...PaginatedResultMeta.fields,
|
|
1056
|
+
tools: /* @__PURE__ */ ArraySchema(Tool)
|
|
1057
|
+
})) {
|
|
1058
|
+
};
|
|
1059
|
+
var CallToolResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/CallToolResult")({
|
|
1060
|
+
...ResultMeta.fields,
|
|
1061
|
+
content: /* @__PURE__ */ ArraySchema(ContentBlock),
|
|
1062
|
+
/**
|
|
1063
|
+
* An optional JSON value containing the structured result of the tool call.
|
|
1064
|
+
*/
|
|
1065
|
+
structuredContent: /* @__PURE__ */ optional2(Json),
|
|
1066
|
+
/**
|
|
1067
|
+
* Whether the tool call ended in an error.
|
|
1068
|
+
*
|
|
1069
|
+
* If not set, this is assumed to be false (the call was successful).
|
|
1070
|
+
*/
|
|
1071
|
+
isError: /* @__PURE__ */ optional2(Boolean)
|
|
1072
|
+
})) {
|
|
1073
|
+
};
|
|
1074
|
+
var CallTool = class extends (/* @__PURE__ */ make2("tools/call", {
|
|
1075
|
+
success: CallToolResult,
|
|
1076
|
+
error: McpError,
|
|
1077
|
+
payload: {
|
|
1078
|
+
...RequestMeta.fields,
|
|
1079
|
+
name: String,
|
|
1080
|
+
arguments: /* @__PURE__ */ optionalWithDefault(/* @__PURE__ */ Record(String, Any), () => ({}))
|
|
1081
|
+
}
|
|
1082
|
+
})) {
|
|
1083
|
+
};
|
|
1084
|
+
var LoggingLevel = /* @__PURE__ */ Literals(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
|
|
1085
|
+
var SetLevel = class extends (/* @__PURE__ */ make2("logging/setLevel", {
|
|
1086
|
+
payload: {
|
|
1087
|
+
...RequestMeta.fields,
|
|
1088
|
+
/**
|
|
1089
|
+
* The level of logging that the client wants to receive from the server.
|
|
1090
|
+
* The server should send all logs at this level and higher (i.e., more
|
|
1091
|
+
* severe) to the client as notifications/message.
|
|
1092
|
+
*/
|
|
1093
|
+
level: LoggingLevel
|
|
1094
|
+
},
|
|
1095
|
+
success: /* @__PURE__ */ Struct({}),
|
|
1096
|
+
error: McpError
|
|
1097
|
+
})) {
|
|
1098
|
+
};
|
|
1099
|
+
var LoggingMessageNotification = class extends (/* @__PURE__ */ make2("notifications/message", {
|
|
1100
|
+
payload: /* @__PURE__ */ Struct({
|
|
1101
|
+
...NotificationMeta.fields,
|
|
1102
|
+
/**
|
|
1103
|
+
* The severity of this log message.
|
|
1104
|
+
*/
|
|
1105
|
+
level: LoggingLevel,
|
|
1106
|
+
/**
|
|
1107
|
+
* An optional name of the logger issuing this message.
|
|
1108
|
+
*/
|
|
1109
|
+
logger: /* @__PURE__ */ optional2(String),
|
|
1110
|
+
/**
|
|
1111
|
+
* The data to be logged, such as a string message or an object. Any JSON
|
|
1112
|
+
* serializable type is allowed here.
|
|
1113
|
+
*/
|
|
1114
|
+
data: Any
|
|
1115
|
+
})
|
|
1116
|
+
})) {
|
|
1117
|
+
};
|
|
1118
|
+
var ToolUseContent = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ToolUseContent")({
|
|
1119
|
+
type: /* @__PURE__ */ tag("tool_use"),
|
|
1120
|
+
/**
|
|
1121
|
+
* Identifier used to associate a later tool result with this request.
|
|
1122
|
+
*/
|
|
1123
|
+
id: String,
|
|
1124
|
+
/**
|
|
1125
|
+
* Name of the tool to invoke.
|
|
1126
|
+
*/
|
|
1127
|
+
name: String,
|
|
1128
|
+
/**
|
|
1129
|
+
* Arguments supplied to the tool.
|
|
1130
|
+
*/
|
|
1131
|
+
input: /* @__PURE__ */ Record(String, Unknown),
|
|
1132
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
1133
|
+
})) {
|
|
1134
|
+
};
|
|
1135
|
+
var ToolResultContent = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ToolResultContent")({
|
|
1136
|
+
type: /* @__PURE__ */ tag("tool_result"),
|
|
1137
|
+
/**
|
|
1138
|
+
* Identifier of the tool-use request that produced this result.
|
|
1139
|
+
*/
|
|
1140
|
+
toolUseId: String,
|
|
1141
|
+
/**
|
|
1142
|
+
* Content returned by the tool.
|
|
1143
|
+
*/
|
|
1144
|
+
content: /* @__PURE__ */ ArraySchema(ContentBlock),
|
|
1145
|
+
/**
|
|
1146
|
+
* Optional structured result returned by the tool.
|
|
1147
|
+
*/
|
|
1148
|
+
structuredContent: /* @__PURE__ */ optional2(Json),
|
|
1149
|
+
/**
|
|
1150
|
+
* Whether tool execution ended in an error.
|
|
1151
|
+
*/
|
|
1152
|
+
isError: /* @__PURE__ */ optional2(Boolean),
|
|
1153
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
1154
|
+
})) {
|
|
1155
|
+
};
|
|
1156
|
+
var SamplingMessageContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, ToolUseContent, ToolResultContent]);
|
|
1157
|
+
var SamplingMessage = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
1158
|
+
role: Role,
|
|
1159
|
+
content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
|
|
1160
|
+
_meta: /* @__PURE__ */ optional2(JsonObject)
|
|
1161
|
+
}))) {
|
|
1162
|
+
};
|
|
1163
|
+
var ToolChoice = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ToolChoice")({
|
|
1164
|
+
/**
|
|
1165
|
+
* Tool-selection mode requested from the client.
|
|
1166
|
+
*/
|
|
1167
|
+
mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["auto", "required", "none"]))
|
|
1168
|
+
})) {
|
|
1169
|
+
};
|
|
1170
|
+
var ModelHint = class extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
1171
|
+
/**
|
|
1172
|
+
* A hint for a model name.
|
|
1173
|
+
*
|
|
1174
|
+
* The client SHOULD treat this as a substring of a model name; for example:
|
|
1175
|
+
* - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`
|
|
1176
|
+
* - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.
|
|
1177
|
+
* - `claude` should match any Claude model
|
|
1178
|
+
*
|
|
1179
|
+
* The client MAY also map the string to a different provider's model name or
|
|
1180
|
+
* a different model family, as long as it fills a similar niche; for example:
|
|
1181
|
+
* - `gemini-1.5-flash` could match `claude-3-haiku-20240307`
|
|
1182
|
+
*/
|
|
1183
|
+
name: /* @__PURE__ */ optional2(String)
|
|
1184
|
+
}))) {
|
|
1185
|
+
};
|
|
1186
|
+
var ModelPreferences = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ModelPreferences")({
|
|
1187
|
+
/**
|
|
1188
|
+
* Optional hints to use for model selection.
|
|
1189
|
+
*
|
|
1190
|
+
* If multiple hints are specified, the client MUST evaluate them in order
|
|
1191
|
+
* (such that the first match is taken).
|
|
1192
|
+
*
|
|
1193
|
+
* The client SHOULD prioritize these hints over the numeric priorities, but
|
|
1194
|
+
* MAY still use the priorities to select from ambiguous matches.
|
|
1195
|
+
*/
|
|
1196
|
+
hints: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(ModelHint)),
|
|
1197
|
+
/**
|
|
1198
|
+
* How much to prioritize cost when selecting a model. A value of 0 means cost
|
|
1199
|
+
* is not important, while a value of 1 means cost is the most important
|
|
1200
|
+
* factor.
|
|
1201
|
+
*/
|
|
1202
|
+
costPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
|
|
1203
|
+
minimum: 0,
|
|
1204
|
+
maximum: 1
|
|
1205
|
+
}))),
|
|
1206
|
+
/**
|
|
1207
|
+
* How much to prioritize sampling speed (latency) when selecting a model. A
|
|
1208
|
+
* value of 0 means speed is not important, while a value of 1 means speed is
|
|
1209
|
+
* the most important factor.
|
|
1210
|
+
*/
|
|
1211
|
+
speedPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
|
|
1212
|
+
minimum: 0,
|
|
1213
|
+
maximum: 1
|
|
1214
|
+
}))),
|
|
1215
|
+
/**
|
|
1216
|
+
* How much to prioritize intelligence and capabilities when selecting a
|
|
1217
|
+
* model. A value of 0 means intelligence is not important, while a value of 1
|
|
1218
|
+
* means intelligence is the most important factor.
|
|
1219
|
+
*/
|
|
1220
|
+
intelligencePriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
|
|
1221
|
+
minimum: 0,
|
|
1222
|
+
maximum: 1
|
|
1223
|
+
})))
|
|
1224
|
+
})) {
|
|
1225
|
+
};
|
|
1226
|
+
var CreateMessageResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/CreateMessageResult")({
|
|
1227
|
+
role: Role,
|
|
1228
|
+
content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
|
|
1229
|
+
_meta: /* @__PURE__ */ optional2(JsonObject),
|
|
1230
|
+
/**
|
|
1231
|
+
* The name of the model that generated the message.
|
|
1232
|
+
*/
|
|
1233
|
+
model: String,
|
|
1234
|
+
/**
|
|
1235
|
+
* The reason why sampling stopped, if known.
|
|
1236
|
+
*/
|
|
1237
|
+
stopReason: /* @__PURE__ */ optional2(String)
|
|
1238
|
+
})) {
|
|
1239
|
+
};
|
|
1240
|
+
var CreateMessage = class extends (/* @__PURE__ */ make2("sampling/createMessage", {
|
|
1241
|
+
success: CreateMessageResult,
|
|
1242
|
+
error: McpError,
|
|
1243
|
+
payload: {
|
|
1244
|
+
messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
|
|
1245
|
+
/**
|
|
1246
|
+
* The server's preferences for which model to select. The client MAY ignore
|
|
1247
|
+
* these preferences.
|
|
1248
|
+
*/
|
|
1249
|
+
modelPreferences: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ModelPreferences.fields)),
|
|
1250
|
+
/**
|
|
1251
|
+
* An optional system prompt the server wants to use for sampling. The
|
|
1252
|
+
* client MAY modify or omit this prompt.
|
|
1253
|
+
*/
|
|
1254
|
+
systemPrompt: /* @__PURE__ */ optional2(String),
|
|
1255
|
+
/**
|
|
1256
|
+
* A request to include context from one or more MCP servers (including the
|
|
1257
|
+
* caller), to be attached to the prompt. The client MAY ignore this request.
|
|
1258
|
+
*/
|
|
1259
|
+
includeContext: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["none", "thisServer", "allServers"])),
|
|
1260
|
+
temperature: /* @__PURE__ */ optional2(Finite),
|
|
1261
|
+
/**
|
|
1262
|
+
* The maximum number of tokens to sample, as requested by the server. The
|
|
1263
|
+
* client MAY choose to sample fewer tokens than requested.
|
|
1264
|
+
*/
|
|
1265
|
+
maxTokens: Int,
|
|
1266
|
+
stopSequences: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String)),
|
|
1267
|
+
/**
|
|
1268
|
+
* Optional metadata to pass through to the LLM provider. The format of
|
|
1269
|
+
* this metadata is provider-specific.
|
|
1270
|
+
*/
|
|
1271
|
+
metadata: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, Unknown)),
|
|
1272
|
+
/**
|
|
1273
|
+
* Tools that the model may call while producing the response.
|
|
1274
|
+
*/
|
|
1275
|
+
tools: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct(Tool.fields))),
|
|
1276
|
+
/**
|
|
1277
|
+
* Controls whether the model may or must call a tool.
|
|
1278
|
+
*/
|
|
1279
|
+
toolChoice: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ToolChoice.fields))
|
|
1280
|
+
}
|
|
1281
|
+
})) {
|
|
1282
|
+
};
|
|
1283
|
+
var CompleteResult = class _CompleteResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
|
|
1284
|
+
...ResultMeta.fields,
|
|
1285
|
+
completion: /* @__PURE__ */ Struct({
|
|
1286
|
+
/**
|
|
1287
|
+
* An array of completion values. Must not exceed 100 items.
|
|
1288
|
+
*/
|
|
1289
|
+
values: /* @__PURE__ */ ArraySchema(String),
|
|
1290
|
+
/**
|
|
1291
|
+
* The total number of completion options available. This can exceed the
|
|
1292
|
+
* number of values actually sent in the response.
|
|
1293
|
+
*/
|
|
1294
|
+
total: /* @__PURE__ */ optional2(Int),
|
|
1295
|
+
/**
|
|
1296
|
+
* Indicates whether there are additional completion options beyond those
|
|
1297
|
+
* provided in the current response, even if the exact total is unknown.
|
|
1298
|
+
*/
|
|
1299
|
+
hasMore: /* @__PURE__ */ optional2(Boolean)
|
|
1300
|
+
})
|
|
1301
|
+
}))) {
|
|
1302
|
+
/**
|
|
1303
|
+
* Empty completion result used when a completion request has no values.
|
|
1304
|
+
*
|
|
1305
|
+
* @since 4.0.0
|
|
1306
|
+
*/
|
|
1307
|
+
static empty = /* @__PURE__ */ _CompleteResult.make({
|
|
1308
|
+
completion: {
|
|
1309
|
+
values: [],
|
|
1310
|
+
total: 0,
|
|
1311
|
+
hasMore: false
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
};
|
|
1315
|
+
var ElicitationString = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitationString")({
|
|
1316
|
+
type: /* @__PURE__ */ tag("string"),
|
|
1317
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1318
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1319
|
+
minLength: /* @__PURE__ */ optional2(Int),
|
|
1320
|
+
maxLength: /* @__PURE__ */ optional2(Int),
|
|
1321
|
+
format: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["email", "uri", "date", "date-time"])),
|
|
1322
|
+
default: /* @__PURE__ */ optional2(String)
|
|
1323
|
+
})) {
|
|
1324
|
+
};
|
|
1325
|
+
var ElicitationNumber = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitationNumber")({
|
|
1326
|
+
type: /* @__PURE__ */ Literals(["number", "integer"]),
|
|
1327
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1328
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1329
|
+
minimum: /* @__PURE__ */ optional2(Finite),
|
|
1330
|
+
maximum: /* @__PURE__ */ optional2(Finite),
|
|
1331
|
+
default: /* @__PURE__ */ optional2(Finite)
|
|
1332
|
+
})) {
|
|
1333
|
+
};
|
|
1334
|
+
var ElicitationBoolean = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitationBoolean")({
|
|
1335
|
+
type: /* @__PURE__ */ tag("boolean"),
|
|
1336
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1337
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1338
|
+
default: /* @__PURE__ */ optional2(Boolean)
|
|
1339
|
+
})) {
|
|
1340
|
+
};
|
|
1341
|
+
var UntitledSingleSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/UntitledSingleSelectEnum")({
|
|
1342
|
+
type: /* @__PURE__ */ tag("string"),
|
|
1343
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1344
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1345
|
+
enum: /* @__PURE__ */ ArraySchema(String),
|
|
1346
|
+
default: /* @__PURE__ */ optional2(String)
|
|
1347
|
+
})) {
|
|
1348
|
+
};
|
|
1349
|
+
var TitledSingleSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/TitledSingleSelectEnum")({
|
|
1350
|
+
type: /* @__PURE__ */ tag("string"),
|
|
1351
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1352
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1353
|
+
oneOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
|
|
1354
|
+
const: String,
|
|
1355
|
+
title: String
|
|
1356
|
+
})),
|
|
1357
|
+
default: /* @__PURE__ */ optional2(String)
|
|
1358
|
+
})) {
|
|
1359
|
+
};
|
|
1360
|
+
var SingleSelectEnum = /* @__PURE__ */ Union([UntitledSingleSelectEnum, TitledSingleSelectEnum]);
|
|
1361
|
+
var UntitledMultiSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/UntitledMultiSelectEnum")({
|
|
1362
|
+
type: /* @__PURE__ */ tag("array"),
|
|
1363
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1364
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1365
|
+
minItems: /* @__PURE__ */ optional2(Int),
|
|
1366
|
+
maxItems: /* @__PURE__ */ optional2(Int),
|
|
1367
|
+
items: /* @__PURE__ */ Struct({
|
|
1368
|
+
type: /* @__PURE__ */ tag("string"),
|
|
1369
|
+
enum: /* @__PURE__ */ ArraySchema(String)
|
|
1370
|
+
}),
|
|
1371
|
+
default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
|
|
1372
|
+
})) {
|
|
1373
|
+
};
|
|
1374
|
+
var TitledMultiSelectEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/TitledMultiSelectEnum")({
|
|
1375
|
+
type: /* @__PURE__ */ tag("array"),
|
|
1376
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1377
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1378
|
+
minItems: /* @__PURE__ */ optional2(Int),
|
|
1379
|
+
maxItems: /* @__PURE__ */ optional2(Int),
|
|
1380
|
+
items: /* @__PURE__ */ Struct({
|
|
1381
|
+
anyOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
|
|
1382
|
+
const: String,
|
|
1383
|
+
title: String
|
|
1384
|
+
}))
|
|
1385
|
+
}),
|
|
1386
|
+
default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
|
|
1387
|
+
})) {
|
|
1388
|
+
};
|
|
1389
|
+
var MultiSelectEnum = /* @__PURE__ */ Union([UntitledMultiSelectEnum, TitledMultiSelectEnum]);
|
|
1390
|
+
var LegacyTitledEnum = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/LegacyTitledEnum")({
|
|
1391
|
+
type: /* @__PURE__ */ tag("string"),
|
|
1392
|
+
title: /* @__PURE__ */ optional2(String),
|
|
1393
|
+
description: /* @__PURE__ */ optional2(String),
|
|
1394
|
+
enum: /* @__PURE__ */ ArraySchema(String),
|
|
1395
|
+
enumNames: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String)),
|
|
1396
|
+
default: /* @__PURE__ */ optional2(String)
|
|
1397
|
+
})) {
|
|
1398
|
+
};
|
|
1399
|
+
var ElicitationEnum = /* @__PURE__ */ Union([LegacyTitledEnum, SingleSelectEnum, MultiSelectEnum]);
|
|
1400
|
+
var PrimitiveSchemaDefinition = /* @__PURE__ */ Union([ElicitationEnum, ElicitationString, ElicitationNumber, ElicitationBoolean]);
|
|
1401
|
+
var ElicitationForm = /* @__PURE__ */ Struct({
|
|
1402
|
+
$schema: /* @__PURE__ */ optional2(String),
|
|
1403
|
+
type: /* @__PURE__ */ tag("object"),
|
|
1404
|
+
properties: /* @__PURE__ */ Record(String, PrimitiveSchemaDefinition),
|
|
1405
|
+
required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String))
|
|
1406
|
+
});
|
|
1407
|
+
var ElicitRequestFormParams = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitRequestFormParams")({
|
|
1408
|
+
...RequestMeta.fields,
|
|
1409
|
+
mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literal("form")),
|
|
1410
|
+
message: String,
|
|
1411
|
+
requestedSchema: ElicitationForm
|
|
1412
|
+
})) {
|
|
1413
|
+
};
|
|
1414
|
+
var ElicitRequestURLParams = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitRequestURLParams")({
|
|
1415
|
+
...RequestMeta.fields,
|
|
1416
|
+
mode: /* @__PURE__ */ Literal("url"),
|
|
1417
|
+
message: String,
|
|
1418
|
+
elicitationId: String,
|
|
1419
|
+
url: String
|
|
1420
|
+
})) {
|
|
1421
|
+
};
|
|
1422
|
+
var ElicitRequestParams = /* @__PURE__ */ Union([ElicitRequestFormParams, ElicitRequestURLParams]);
|
|
1423
|
+
var ElicitAcceptResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitAcceptResult")({
|
|
1424
|
+
...ResultMeta.fields,
|
|
1425
|
+
/**
|
|
1426
|
+
* The user action in response to the elicitation.
|
|
1427
|
+
* - "accept": User submitted the form/confirmed the action
|
|
1428
|
+
* - "decline": User explicitly declined the action
|
|
1429
|
+
* - "cancel": User dismissed without making an explicit choice
|
|
1430
|
+
*/
|
|
1431
|
+
action: /* @__PURE__ */ Literal("accept"),
|
|
1432
|
+
/**
|
|
1433
|
+
* The submitted form data, only present when action is "accept".
|
|
1434
|
+
* Contains values matching the requested schema.
|
|
1435
|
+
*/
|
|
1436
|
+
content: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String, /* @__PURE__ */ Union([String, Finite, Boolean, /* @__PURE__ */ ArraySchema(String)])))
|
|
1437
|
+
})) {
|
|
1438
|
+
};
|
|
1439
|
+
var ElicitDeclineResult = class extends (/* @__PURE__ */ Class("@effect/ai/McpSchema/ElicitDeclineResult")({
|
|
1440
|
+
...ResultMeta.fields,
|
|
1441
|
+
/**
|
|
1442
|
+
* The user action in response to the elicitation.
|
|
1443
|
+
* - "accept": User submitted the form/confirmed the action
|
|
1444
|
+
* - "decline": User explicitly declined the action
|
|
1445
|
+
* - "cancel": User dismissed without making an explicit choice
|
|
1446
|
+
*/
|
|
1447
|
+
action: /* @__PURE__ */ Literals(["cancel", "decline"])
|
|
1448
|
+
})) {
|
|
1449
|
+
};
|
|
1450
|
+
var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
|
|
1451
|
+
var Elicit = class extends (/* @__PURE__ */ make2("elicitation/create", {
|
|
1452
|
+
success: ElicitResult,
|
|
1453
|
+
error: McpError,
|
|
1454
|
+
payload: ElicitRequestParams
|
|
1455
|
+
})) {
|
|
1456
|
+
};
|
|
1457
|
+
var ElicitationDeclined = class extends (/* @__PURE__ */ Error2("@effect/ai/McpSchema/ElicitationDeclined")({
|
|
1458
|
+
_tag: /* @__PURE__ */ tag("ElicitationDeclined"),
|
|
1459
|
+
request: Elicit.payloadSchema,
|
|
1460
|
+
cause: /* @__PURE__ */ optional2(/* @__PURE__ */ Defect())
|
|
1461
|
+
})) {
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
// src/contracts/elicitation.ts
|
|
1465
|
+
var ElicitationLimits = Schema_exports.Struct({
|
|
1466
|
+
timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
1467
|
+
});
|
|
1468
|
+
var defaultElicitationLimits = ElicitationLimits.make({ timeoutMs: 15 * 60 * 1e3 });
|
|
1469
|
+
var FormElicitation = Schema_exports.Struct({
|
|
1470
|
+
...ElicitRequestFormParams.fields,
|
|
1471
|
+
mode: Schema_exports.Literal("form"),
|
|
1472
|
+
requestedSchema: Schema_exports.toEncoded(ElicitRequestFormParams.fields.requestedSchema),
|
|
1473
|
+
_meta: Schema_exports.optional(JsonObject2)
|
|
1474
|
+
});
|
|
1475
|
+
var ElicitationResponse = Schema_exports.Union([
|
|
1476
|
+
Schema_exports.Struct({ ...ElicitAcceptResult.fields, _meta: Schema_exports.optional(JsonObject2) }),
|
|
1477
|
+
Schema_exports.Struct({ ...ElicitDeclineResult.fields, _meta: Schema_exports.optional(JsonObject2) })
|
|
1478
|
+
]);
|
|
1479
|
+
var ElicitationFailed = class extends Schema_exports.TaggedError()(
|
|
1480
|
+
"ElicitationFailed",
|
|
1481
|
+
{
|
|
1482
|
+
reason: Schema_exports.Literals([
|
|
1483
|
+
"unavailable",
|
|
1484
|
+
"transaction",
|
|
1485
|
+
"invalid-request",
|
|
1486
|
+
"invalid-response",
|
|
1487
|
+
"transport",
|
|
1488
|
+
"expired",
|
|
1489
|
+
"forbidden"
|
|
1490
|
+
])
|
|
1491
|
+
}
|
|
1492
|
+
) {
|
|
1493
|
+
};
|
|
1494
|
+
var ElicitationReply = Schema_exports.Union([
|
|
1495
|
+
Schema_exports.Struct({ ok: Schema_exports.Literal(true), response: ElicitationResponse }),
|
|
1496
|
+
Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: ElicitationFailed })
|
|
1497
|
+
]);
|
|
1498
|
+
var ApprovalElicitation = Schema_exports.Struct({
|
|
1499
|
+
...FormElicitation.fields,
|
|
1500
|
+
requestedSchema: Schema_exports.Struct({
|
|
1501
|
+
type: Schema_exports.Literal("object"),
|
|
1502
|
+
properties: Schema_exports.Record(Schema_exports.String, Schema_exports.Never)
|
|
1503
|
+
})
|
|
1504
|
+
});
|
|
1505
|
+
var ApprovalResponse = ElicitationResponse.check(
|
|
1506
|
+
Schema_exports.makeFilter(
|
|
1507
|
+
(response) => response.action !== "accept" || response.content === void 0 || Object.keys(response.content).length === 0
|
|
1508
|
+
)
|
|
1509
|
+
);
|
|
1510
|
+
var approvalElicitation = (toolName, input) => ({
|
|
1511
|
+
mode: "form",
|
|
1512
|
+
message: `Approve ${toolName}?
|
|
1513
|
+
|
|
1514
|
+
Arguments:
|
|
1515
|
+
${JSON.stringify(input, null, 2)}`,
|
|
1516
|
+
requestedSchema: { type: "object", properties: {} }
|
|
1517
|
+
});
|
|
1518
|
+
|
|
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)
|
|
1559
|
+
});
|
|
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";
|
|
1579
|
+
};
|
|
1580
|
+
var WorkflowValue = JsonValue.check(
|
|
1581
|
+
Schema_exports.makeFilter(
|
|
1582
|
+
(value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 1024 * 1024
|
|
1583
|
+
)
|
|
1584
|
+
);
|
|
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
|
|
1598
|
+
};
|
|
1599
|
+
var WorkflowRun = Schema_exports.Union([
|
|
1600
|
+
Schema_exports.Struct({
|
|
1601
|
+
...runFields,
|
|
1602
|
+
status: Schema_exports.Literals(["queued", "running", "waiting", "paused", "waitingForPause"])
|
|
1603
|
+
}),
|
|
1604
|
+
Schema_exports.Struct({ ...runFields, status: Schema_exports.Literal("complete"), output: WorkflowValue }),
|
|
1605
|
+
Schema_exports.Struct({
|
|
1606
|
+
...runFields,
|
|
1607
|
+
status: Schema_exports.Literal("errored"),
|
|
1608
|
+
error: WorkflowFailure.fields.reason
|
|
1609
|
+
}),
|
|
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
|
+
Schema_exports.Struct({
|
|
1623
|
+
operation: Schema_exports.Literal("workflow-validate"),
|
|
1624
|
+
name: WorkflowName,
|
|
1625
|
+
input: JsonValue
|
|
1626
|
+
}),
|
|
1627
|
+
Schema_exports.Struct({
|
|
1628
|
+
operation: Schema_exports.Literal("workflow-run"),
|
|
1629
|
+
name: WorkflowName,
|
|
1630
|
+
input: JsonValue
|
|
1631
|
+
})
|
|
1632
|
+
]);
|
|
1633
|
+
var WorkflowRpcCommand = Schema_exports.Union([
|
|
1634
|
+
Schema_exports.Struct({
|
|
1635
|
+
operation: Schema_exports.Literal("do"),
|
|
1636
|
+
name: WorkflowName,
|
|
1637
|
+
options: WorkflowStepOptions
|
|
1638
|
+
}),
|
|
1639
|
+
Schema_exports.Struct({
|
|
1640
|
+
operation: Schema_exports.Literal("sleep"),
|
|
1641
|
+
name: WorkflowName,
|
|
1642
|
+
duration: WorkflowDuration
|
|
1643
|
+
}),
|
|
1644
|
+
Schema_exports.Struct({
|
|
1645
|
+
operation: Schema_exports.Literal("until"),
|
|
1646
|
+
name: WorkflowName,
|
|
1647
|
+
timestamp: Schema_exports.Finite
|
|
1648
|
+
}),
|
|
1649
|
+
Schema_exports.Struct({ operation: Schema_exports.Literal("context") }),
|
|
1650
|
+
Schema_exports.Struct({
|
|
1651
|
+
operation: Schema_exports.Literal("invoke"),
|
|
1652
|
+
kind: Schema_exports.Literals(["query", "mutation"]),
|
|
1653
|
+
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([
|
|
1664
|
+
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)))
|
|
1669
|
+
}),
|
|
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 })
|
|
1678
|
+
]);
|
|
1679
|
+
|
|
1680
|
+
export {
|
|
1681
|
+
SecretsMethod,
|
|
1682
|
+
OAuthClientAuth,
|
|
1683
|
+
OAuthSecretClientAuth,
|
|
1684
|
+
OAuth2Config,
|
|
1685
|
+
OAuth2AccessToken,
|
|
1686
|
+
OAuth2Method,
|
|
1687
|
+
Provider,
|
|
1688
|
+
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,
|
|
1703
|
+
WorkflowRunId,
|
|
1704
|
+
WorkflowName,
|
|
1705
|
+
workflowDurationMillis,
|
|
1706
|
+
WorkflowDuration,
|
|
1707
|
+
WorkflowStepOptions,
|
|
1708
|
+
WorkflowFailure,
|
|
1709
|
+
NonRetryableError,
|
|
1710
|
+
WorkflowValue,
|
|
1711
|
+
HostedWorkflow,
|
|
1712
|
+
WorkflowRun,
|
|
1713
|
+
WorkflowRunPage,
|
|
1714
|
+
WorkflowReplay,
|
|
1715
|
+
WorkflowCommand,
|
|
1716
|
+
WorkflowRpcCommand,
|
|
1717
|
+
WorkflowRpcResult,
|
|
1718
|
+
WorkflowControlCommand
|
|
1719
|
+
};
|