apps 0.0.1-beta.5 → 0.0.1-beta.6
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 +65 -43
- package/framework-reference.json +1 -1
- package/js/{chunk-FWQC6I3C.js → chunk-5T57N25Q.js} +13 -1
- package/js/{chunk-67EVWIGJ.js → chunk-6BSSI67S.js} +4 -4
- package/js/{chunk-DQAZTA4I.js → chunk-B3EOZTK3.js} +212 -19
- package/js/{chunk-TDNYXSIX.js → chunk-ECQFRCH4.js} +21 -9
- package/js/{chunk-UDDE5KOR.js → chunk-ITM77QPO.js} +26 -7
- package/js/{chunk-G7T27IWB.js → chunk-MKWZPDR6.js} +1 -1
- package/js/chunk-MNMNLXBL.js +507 -0
- package/js/{chunk-CYYBFC2K.js → chunk-NKLWZJLE.js} +1 -1
- package/js/{chunk-C3VAOK5B.js → chunk-OE3QQTSB.js} +33 -26
- package/js/{chunk-YEPYT6SD.js → chunk-R3EV5FTO.js} +12 -0
- package/js/{chunk-XHO2ZX6W.js → chunk-RFVIONFX.js} +27 -10
- package/js/{chunk-LUVSFETN.js → chunk-SB4HEPNJ.js} +72 -228
- package/js/chunk-T7GKZBLP.js +209 -0
- package/js/client.js +1 -1
- package/js/contracts.js +24 -11
- package/js/effect.js +9 -11
- package/js/graphql.js +25 -32
- package/js/host.js +9 -11
- package/js/index.js +184 -173
- package/js/mcp/effect.js +11 -13
- package/js/mcp/stdio.js +15 -17
- package/js/mcp.js +50 -36
- package/js/openapi.js +166 -108
- package/js/skills.js +6 -7
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/app.d.ts +2 -5
- package/types/apps/src/contracts/host.d.ts +11 -7
- package/types/apps/src/contracts/mcp.d.ts +16 -0
- package/types/apps/src/contracts/openapi.d.ts +4 -0
- package/types/apps/src/contracts/operations.d.ts +0 -5
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/graphql.d.ts +1 -3
- package/types/apps/src/implementation/account-router.d.ts +12 -0
- package/types/apps/src/implementation/app.d.ts +5 -4
- package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
- package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
- package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
- package/types/apps/src/implementation/mcp-client.d.ts +35 -19
- package/types/apps/src/implementation/mcp.d.ts +35 -19
- package/types/apps/src/implementation/openapi-compile.d.ts +2 -1
- package/types/apps/src/implementation/openapi-source.d.ts +2 -6
- package/types/apps/src/implementation/operations.d.ts +26 -3
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
- package/types/apps/src/implementation/router-catalog.d.ts +225 -0
- package/types/apps/src/implementation/router.d.ts +59 -0
- package/types/apps/src/implementation/schema.d.ts +5 -1
- package/types/apps/src/implementation/workflow-context.d.ts +1 -1
- package/types/apps/src/index.d.ts +3 -2
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +5 -4
- package/types/apps/src/openapi.d.ts +6 -6
- package/js/chunk-3XKZDQLM.js +0 -93
- package/js/chunk-4M277YTM.js +0 -136
- package/js/chunk-SB3V4YVR.js +0 -18
- package/js/chunk-W4DMKWAB.js +0 -35
- package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
JsonObject,
|
|
2
3
|
ValidationError
|
|
3
4
|
} from "./chunk-27F7W2LG.js";
|
|
4
5
|
import {
|
|
@@ -1387,6 +1388,16 @@ var jsonSchema = (input) => {
|
|
|
1387
1388
|
var storageFieldOf = (schema) => schema[StorageField];
|
|
1388
1389
|
var id = (table) => wrap(Schema_exports.NonEmptyString, false, { kind: "id", references: table });
|
|
1389
1390
|
var userId = () => wrap(Schema_exports.NonEmptyString, false, { kind: "userId" });
|
|
1391
|
+
var jsonSchemaDocument = (decoder) => {
|
|
1392
|
+
const imported = importedJsonSchema(decoder);
|
|
1393
|
+
if (imported !== void 0) return Schema_exports.decodeUnknownEffect(JsonObject)(imported);
|
|
1394
|
+
const document = Schema_exports.toJsonSchemaDocument(decoder);
|
|
1395
|
+
return Schema_exports.decodeUnknownEffect(JsonObject)({
|
|
1396
|
+
...document.schema,
|
|
1397
|
+
$defs: document.definitions,
|
|
1398
|
+
$schema: "https://json-schema.org/draft/2020-12/schema"
|
|
1399
|
+
});
|
|
1400
|
+
};
|
|
1390
1401
|
|
|
1391
1402
|
export {
|
|
1392
1403
|
decoderOf,
|
|
@@ -1411,5 +1422,6 @@ export {
|
|
|
1411
1422
|
jsonSchema,
|
|
1412
1423
|
storageFieldOf,
|
|
1413
1424
|
id,
|
|
1414
|
-
userId
|
|
1425
|
+
userId,
|
|
1426
|
+
jsonSchemaDocument
|
|
1415
1427
|
};
|
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
adaptMcpTools,
|
|
3
3
|
mcpClient,
|
|
4
4
|
mcpJsonSchemaValidator
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ITM77QPO.js";
|
|
6
6
|
import {
|
|
7
7
|
accountProviderError,
|
|
8
8
|
httpProviderError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MKWZPDR6.js";
|
|
10
10
|
import {
|
|
11
11
|
McpError,
|
|
12
12
|
McpToolsOptions,
|
|
13
13
|
defaultMcpClientLimits
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-B3EOZTK3.js";
|
|
15
15
|
import {
|
|
16
16
|
ProviderError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-R3EV5FTO.js";
|
|
18
18
|
import {
|
|
19
19
|
captureTelemetry
|
|
20
20
|
} from "./chunk-RJDDBDSN.js";
|
|
@@ -5,18 +5,14 @@ import {
|
|
|
5
5
|
} from "./chunk-N7YDVXYJ.js";
|
|
6
6
|
import {
|
|
7
7
|
CacheCommand,
|
|
8
|
-
CacheReply
|
|
9
|
-
|
|
8
|
+
CacheReply,
|
|
9
|
+
ProviderError
|
|
10
|
+
} from "./chunk-R3EV5FTO.js";
|
|
10
11
|
import {
|
|
12
|
+
AppSkillName,
|
|
11
13
|
AppSkills,
|
|
12
14
|
SkillLoadFailed
|
|
13
15
|
} from "./chunk-JU7VHODU.js";
|
|
14
|
-
import {
|
|
15
|
-
OpenapiResponseError
|
|
16
|
-
} from "./chunk-W4DMKWAB.js";
|
|
17
|
-
import {
|
|
18
|
-
ProviderError
|
|
19
|
-
} from "./chunk-SB3V4YVR.js";
|
|
20
16
|
import {
|
|
21
17
|
AccountId,
|
|
22
18
|
HttpUrl,
|
|
@@ -78,6 +74,30 @@ import {
|
|
|
78
74
|
withDefault
|
|
79
75
|
} from "./chunk-CDL5PM2Q.js";
|
|
80
76
|
|
|
77
|
+
// src/contracts/router.ts
|
|
78
|
+
var reservedRouterKeys = /* @__PURE__ */ new Set([
|
|
79
|
+
"__proto__",
|
|
80
|
+
"constructor",
|
|
81
|
+
"prototype"
|
|
82
|
+
]);
|
|
83
|
+
var RouterKey = Schema_exports.String.check(
|
|
84
|
+
Schema_exports.isPattern(/^[A-Za-z_][A-Za-z0-9_-]{0,99}$/),
|
|
85
|
+
Schema_exports.makeFilter((key) => !reservedRouterKeys.has(key))
|
|
86
|
+
);
|
|
87
|
+
var RouterIcon = Schema_exports.Struct({
|
|
88
|
+
src: Schema_exports.NonEmptyString,
|
|
89
|
+
mimeType: Schema_exports.optionalKey(Schema_exports.String),
|
|
90
|
+
sizes: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.String)),
|
|
91
|
+
theme: Schema_exports.optionalKey(Schema_exports.Literals(["light", "dark"]))
|
|
92
|
+
});
|
|
93
|
+
var RouterMeta = Schema_exports.Struct({
|
|
94
|
+
title: Schema_exports.optionalKey(Schema_exports.String),
|
|
95
|
+
description: Schema_exports.optionalKey(Schema_exports.String),
|
|
96
|
+
instructions: Schema_exports.optionalKey(Schema_exports.String),
|
|
97
|
+
icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
|
|
98
|
+
tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String))
|
|
99
|
+
});
|
|
100
|
+
|
|
81
101
|
// src/contracts/tools.ts
|
|
82
102
|
var ToolAnnotations = Schema_exports.Struct({
|
|
83
103
|
title: Schema_exports.optionalKey(Schema_exports.String),
|
|
@@ -130,6 +150,15 @@ var McpToolMetadata = Schema_exports.Struct({
|
|
|
130
150
|
annotations: Schema_exports.optional(ToolAnnotations),
|
|
131
151
|
_meta: Schema_exports.optional(JsonObject2)
|
|
132
152
|
});
|
|
153
|
+
var McpServerHeader = Schema_exports.Struct({
|
|
154
|
+
name: Schema_exports.optionalKey(Schema_exports.String),
|
|
155
|
+
title: Schema_exports.optionalKey(Schema_exports.String),
|
|
156
|
+
version: Schema_exports.optionalKey(Schema_exports.String),
|
|
157
|
+
description: Schema_exports.optionalKey(Schema_exports.String),
|
|
158
|
+
websiteUrl: Schema_exports.optionalKey(Schema_exports.String),
|
|
159
|
+
icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
|
|
160
|
+
instructions: Schema_exports.optionalKey(Schema_exports.String)
|
|
161
|
+
});
|
|
133
162
|
var McpError = class extends Schema_exports.TaggedError()("McpError", {
|
|
134
163
|
phase: Schema_exports.Literals(["connect", "discover", "call", "schema", "transport"]),
|
|
135
164
|
reason: Schema_exports.Literals([
|
|
@@ -152,6 +181,31 @@ var ProcessConfig = Schema_exports.Struct({
|
|
|
152
181
|
)
|
|
153
182
|
});
|
|
154
183
|
|
|
184
|
+
// src/contracts/api-response-error.ts
|
|
185
|
+
var ApiErrorRecovery = Schema_exports.Struct({
|
|
186
|
+
action: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(1024)),
|
|
187
|
+
instructions: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096))
|
|
188
|
+
});
|
|
189
|
+
var ApiErrorResponse = Schema_exports.Struct({
|
|
190
|
+
code: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(128)),
|
|
191
|
+
status: Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 400, maximum: 599 })),
|
|
192
|
+
message: Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(4096)),
|
|
193
|
+
recovery: Schema_exports.optionalKey(ApiErrorRecovery)
|
|
194
|
+
});
|
|
195
|
+
var OpenapiResponseError = class extends Schema_exports.TaggedError()(
|
|
196
|
+
"OpenapiResponseError",
|
|
197
|
+
ApiErrorResponse.fields
|
|
198
|
+
) {
|
|
199
|
+
};
|
|
200
|
+
var OpenapiErrorLimits = Schema_exports.Struct({
|
|
201
|
+
maxBodyBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
202
|
+
readTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
203
|
+
});
|
|
204
|
+
var defaultOpenapiErrorLimits = OpenapiErrorLimits.make({
|
|
205
|
+
maxBodyBytes: 65536,
|
|
206
|
+
readTimeoutMs: 2e3
|
|
207
|
+
});
|
|
208
|
+
|
|
155
209
|
// src/contracts/failure.ts
|
|
156
210
|
var maxFailureMessageLength = 2048;
|
|
157
211
|
var FailureSource = Schema_exports.Literals(["app", "storage", "service"]);
|
|
@@ -1843,7 +1897,7 @@ var ManyAccounts = class extends Data_exports.TaggedClass("many") {
|
|
|
1843
1897
|
};
|
|
1844
1898
|
|
|
1845
1899
|
// src/contracts/protocol-version.ts
|
|
1846
|
-
var frameworkProtocol =
|
|
1900
|
+
var frameworkProtocol = 4;
|
|
1847
1901
|
|
|
1848
1902
|
// src/contracts/schedules.ts
|
|
1849
1903
|
var minimumIntervalMilliseconds = 6e4;
|
|
@@ -2215,8 +2269,132 @@ var protocol3 = {
|
|
|
2215
2269
|
}
|
|
2216
2270
|
};
|
|
2217
2271
|
|
|
2218
|
-
// src/contracts/
|
|
2219
|
-
var
|
|
2272
|
+
// src/contracts/protocols/4.ts
|
|
2273
|
+
var HostedTool2 = Schema_exports.Struct({
|
|
2274
|
+
schedules: Schema_exports.optionalKey(Schema_exports.Array(OperationSchedule)),
|
|
2275
|
+
name: Schema_exports.NonEmptyString,
|
|
2276
|
+
router: Schema_exports.optionalKey(Schema_exports.NonEmptyString),
|
|
2277
|
+
tags: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
|
|
2278
|
+
description: Schema_exports.String,
|
|
2279
|
+
inputSchema: JsonObject2,
|
|
2280
|
+
readOnly: Schema_exports.optionalKey(Schema_exports.Boolean),
|
|
2281
|
+
title: Schema_exports.optionalKey(Schema_exports.String),
|
|
2282
|
+
outputSchema: Schema_exports.optionalKey(JsonObject2),
|
|
2283
|
+
annotations: Schema_exports.optionalKey(ToolAnnotations),
|
|
2284
|
+
_meta: Schema_exports.optionalKey(JsonObject2)
|
|
2285
|
+
});
|
|
2286
|
+
var HostedToolSummary2 = HostedTool2.mapFields(
|
|
2287
|
+
({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
|
|
2288
|
+
);
|
|
2289
|
+
var HostRouterError = Schema_exports.Union([
|
|
2290
|
+
ProviderError,
|
|
2291
|
+
McpError,
|
|
2292
|
+
SkillLoadFailed,
|
|
2293
|
+
HostDeclarationInvalid2,
|
|
2294
|
+
HostEvaluationFailed2
|
|
2295
|
+
]);
|
|
2296
|
+
var HostedRouter = Schema_exports.Struct({
|
|
2297
|
+
path: Schema_exports.String,
|
|
2298
|
+
title: Schema_exports.optionalKey(Schema_exports.String),
|
|
2299
|
+
description: Schema_exports.optionalKey(Schema_exports.String),
|
|
2300
|
+
icons: Schema_exports.optionalKey(Schema_exports.Array(RouterIcon)),
|
|
2301
|
+
tags: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.NonEmptyString, Schema_exports.String)),
|
|
2302
|
+
skill: Schema_exports.optionalKey(AppSkillName),
|
|
2303
|
+
error: Schema_exports.optionalKey(HostRouterError)
|
|
2304
|
+
});
|
|
2305
|
+
var HostedCatalog = Schema_exports.Struct({
|
|
2306
|
+
tools: Schema_exports.Array(HostedTool2),
|
|
2307
|
+
routers: Schema_exports.Array(HostedRouter)
|
|
2308
|
+
});
|
|
2309
|
+
var HostedCatalogSummary = Schema_exports.Struct({
|
|
2310
|
+
tools: Schema_exports.Array(HostedToolSummary2),
|
|
2311
|
+
routers: Schema_exports.Array(HostedRouter)
|
|
2312
|
+
});
|
|
2313
|
+
var ToolKind = Schema_exports.Literals(["query", "mutation"]);
|
|
2314
|
+
var HostRequest2 = Schema_exports.Union([
|
|
2315
|
+
WorkflowCommand,
|
|
2316
|
+
WebhookCommand,
|
|
2317
|
+
Schema_exports.Struct({ operation: Schema_exports.Literal("requirements") }),
|
|
2318
|
+
Schema_exports.Struct({
|
|
2319
|
+
operation: Schema_exports.Literal("inspect"),
|
|
2320
|
+
/** Omit schemas. Only builds that declare the toolIndex capability accept this. */
|
|
2321
|
+
detail: Schema_exports.optionalKey(Schema_exports.Literal("summary")),
|
|
2322
|
+
/** Describe only these tools. Only builds that declare the toolIndex capability accept this. */
|
|
2323
|
+
tools: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.NonEmptyString)),
|
|
2324
|
+
/**
|
|
2325
|
+
* Describe only declared operations that have schedules, without dynamic tool discovery.
|
|
2326
|
+
* Only builds that declare the scheduledTools capability accept this.
|
|
2327
|
+
*/
|
|
2328
|
+
scheduled: Schema_exports.optionalKey(Schema_exports.Literal(true))
|
|
2329
|
+
}),
|
|
2330
|
+
Schema_exports.Struct({
|
|
2331
|
+
operation: Schema_exports.Literal("skills"),
|
|
2332
|
+
/** Answer with SkillSources. Only builds that declare the skillSources capability accept this. */
|
|
2333
|
+
sources: Schema_exports.optionalKey(Schema_exports.Literal(true))
|
|
2334
|
+
}),
|
|
2335
|
+
Schema_exports.Struct({
|
|
2336
|
+
operation: Schema_exports.Literal("query"),
|
|
2337
|
+
name: Schema_exports.NonEmptyString,
|
|
2338
|
+
input: JsonValue
|
|
2339
|
+
}),
|
|
2340
|
+
Schema_exports.Struct({
|
|
2341
|
+
operation: Schema_exports.Literal("mutate"),
|
|
2342
|
+
name: Schema_exports.NonEmptyString,
|
|
2343
|
+
input: JsonValue
|
|
2344
|
+
}),
|
|
2345
|
+
Schema_exports.Struct({
|
|
2346
|
+
operation: Schema_exports.Literal("call"),
|
|
2347
|
+
tool: Schema_exports.NonEmptyString,
|
|
2348
|
+
/**
|
|
2349
|
+
* The caller's claim; the bundle rejects a call whose tool has the other kind. The host omits
|
|
2350
|
+
* it for a tool its catalog does not list, and then opens storage for writing.
|
|
2351
|
+
*/
|
|
2352
|
+
kind: Schema_exports.optionalKey(ToolKind),
|
|
2353
|
+
input: JsonValue
|
|
2354
|
+
})
|
|
2355
|
+
]);
|
|
2356
|
+
var HostKindMismatch = class extends Schema_exports.TaggedError()("HostKindMismatch", {
|
|
2357
|
+
tool: Schema_exports.NonEmptyString,
|
|
2358
|
+
requested: ToolKind,
|
|
2359
|
+
actual: ToolKind
|
|
2360
|
+
}) {
|
|
2361
|
+
};
|
|
2362
|
+
var HostError3 = Schema_exports.Union([...HostError2.members, HostKindMismatch]);
|
|
2363
|
+
var HostResponse3 = Schema_exports.Union([
|
|
2364
|
+
Schema_exports.Struct({
|
|
2365
|
+
ok: Schema_exports.Literal(true),
|
|
2366
|
+
value: JsonValue,
|
|
2367
|
+
toolError: Schema_exports.optionalKey(Schema_exports.Literal(true))
|
|
2368
|
+
}),
|
|
2369
|
+
Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: HostError3 })
|
|
2370
|
+
]);
|
|
2371
|
+
var HostInvocation2 = Schema_exports.Struct({
|
|
2372
|
+
command: HostRequest2,
|
|
2373
|
+
accounts: ResolvedAccounts,
|
|
2374
|
+
approval: Schema_exports.optionalKey(TrustedToolApproval),
|
|
2375
|
+
replay: Schema_exports.optionalKey(WorkflowReplay),
|
|
2376
|
+
deadline: Schema_exports.optionalKey(InvocationDeadline),
|
|
2377
|
+
workflowRun: Schema_exports.optionalKey(WorkflowRunId)
|
|
2378
|
+
});
|
|
2379
|
+
var protocol4 = {
|
|
2380
|
+
version: 4,
|
|
2381
|
+
schemas: {
|
|
2382
|
+
invocation: HostInvocation2,
|
|
2383
|
+
request: HostRequest2,
|
|
2384
|
+
response: HostResponse3,
|
|
2385
|
+
requirements: DeclaredRequirements,
|
|
2386
|
+
catalog: HostedCatalog,
|
|
2387
|
+
catalogSummary: HostedCatalogSummary,
|
|
2388
|
+
skills: SkillCatalogResponse2,
|
|
2389
|
+
elicitationRequest: FormElicitation,
|
|
2390
|
+
elicitationReply: ElicitationReply,
|
|
2391
|
+
workflowStep: WorkflowRpcCommand,
|
|
2392
|
+
workflowStepReply: WorkflowRpcResult,
|
|
2393
|
+
workflowControl: WorkflowControlCommand,
|
|
2394
|
+
cacheCommand: CacheCommand,
|
|
2395
|
+
cacheReply: CacheReply
|
|
2396
|
+
}
|
|
2397
|
+
};
|
|
2220
2398
|
|
|
2221
2399
|
// src/contracts/host.ts
|
|
2222
2400
|
var skillsCommand = (sources) => sources ? { operation: "skills", sources: true } : { operation: "skills" };
|
|
@@ -2227,7 +2405,7 @@ var inspectCommand = (tools, scheduled) => ({
|
|
|
2227
2405
|
...scheduled === void 0 ? {} : { scheduled }
|
|
2228
2406
|
});
|
|
2229
2407
|
var indexCommand = { operation: "inspect", detail: "summary" };
|
|
2230
|
-
var selectTools = (tools) => (
|
|
2408
|
+
var selectTools = (tools) => (catalog) => tools === void 0 ? catalog : { ...catalog, tools: catalog.tools.filter((tool) => tools.includes(tool.name)) };
|
|
2231
2409
|
var HostRequirementsError = Schema_exports.Union([
|
|
2232
2410
|
HostRequestInvalid,
|
|
2233
2411
|
HostDeclarationInvalid2,
|
|
@@ -2248,6 +2426,7 @@ var HostCallError = Schema_exports.Union([
|
|
|
2248
2426
|
HostInspectError,
|
|
2249
2427
|
HostToolNotFound,
|
|
2250
2428
|
HostOperationNotFound,
|
|
2429
|
+
HostKindMismatch,
|
|
2251
2430
|
HostOperationFailed2,
|
|
2252
2431
|
DatabaseLimitExceeded,
|
|
2253
2432
|
HostInputInvalid,
|
|
@@ -2273,6 +2452,10 @@ export {
|
|
|
2273
2452
|
OAuth2Method,
|
|
2274
2453
|
Provider,
|
|
2275
2454
|
ManyAccounts,
|
|
2455
|
+
reservedRouterKeys,
|
|
2456
|
+
RouterKey,
|
|
2457
|
+
RouterIcon,
|
|
2458
|
+
RouterMeta,
|
|
2276
2459
|
ToolAnnotations,
|
|
2277
2460
|
McpClientLimits,
|
|
2278
2461
|
defaultMcpClientLimits,
|
|
@@ -2280,8 +2463,13 @@ export {
|
|
|
2280
2463
|
McpToolsOptions,
|
|
2281
2464
|
McpToolResult,
|
|
2282
2465
|
McpToolMetadata,
|
|
2466
|
+
McpServerHeader,
|
|
2283
2467
|
McpError,
|
|
2284
2468
|
ProcessConfig,
|
|
2469
|
+
ApiErrorRecovery,
|
|
2470
|
+
ApiErrorResponse,
|
|
2471
|
+
OpenapiResponseError,
|
|
2472
|
+
defaultOpenapiErrorLimits,
|
|
2285
2473
|
maxFailureMessageLength,
|
|
2286
2474
|
FailureSource,
|
|
2287
2475
|
FailureName,
|
|
@@ -2336,9 +2524,6 @@ export {
|
|
|
2336
2524
|
ResolvedAccounts,
|
|
2337
2525
|
TrustedToolApproval,
|
|
2338
2526
|
InvocationDeadline,
|
|
2339
|
-
HostedTool,
|
|
2340
|
-
HostedToolSummary,
|
|
2341
|
-
HostRequest,
|
|
2342
2527
|
HostRequestInvalid,
|
|
2343
2528
|
HostAccountsInvalid,
|
|
2344
2529
|
HostOperationNotFound,
|
|
@@ -2350,7 +2535,6 @@ export {
|
|
|
2350
2535
|
HostToolApprovalRequired,
|
|
2351
2536
|
HostToolPolicyFailed,
|
|
2352
2537
|
HostOutputInvalid,
|
|
2353
|
-
HostInvocation,
|
|
2354
2538
|
protocol1,
|
|
2355
2539
|
SkillSources2 as SkillSources,
|
|
2356
2540
|
SkillCatalogResponse2 as SkillCatalogResponse,
|
|
@@ -2358,10 +2542,19 @@ export {
|
|
|
2358
2542
|
HostDeclarationInvalid2 as HostDeclarationInvalid,
|
|
2359
2543
|
HostEvaluationFailed2 as HostEvaluationFailed,
|
|
2360
2544
|
HostOperationFailed2 as HostOperationFailed,
|
|
2361
|
-
HostError2 as HostError,
|
|
2362
|
-
HostResponse2 as HostResponse,
|
|
2363
2545
|
protocol3,
|
|
2364
|
-
|
|
2546
|
+
HostedTool2 as HostedTool,
|
|
2547
|
+
HostedToolSummary2 as HostedToolSummary,
|
|
2548
|
+
HostRouterError,
|
|
2549
|
+
HostedRouter,
|
|
2550
|
+
HostedCatalog,
|
|
2551
|
+
HostedCatalogSummary,
|
|
2552
|
+
HostRequest2 as HostRequest,
|
|
2553
|
+
HostKindMismatch,
|
|
2554
|
+
HostError3 as HostError,
|
|
2555
|
+
HostResponse3 as HostResponse,
|
|
2556
|
+
HostInvocation2 as HostInvocation,
|
|
2557
|
+
protocol4,
|
|
2365
2558
|
skillsCommand,
|
|
2366
2559
|
skillCatalog,
|
|
2367
2560
|
inspectCommand,
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
fixedRouter
|
|
3
|
+
} from "./chunk-MNMNLXBL.js";
|
|
4
|
+
import {
|
|
5
|
+
nativeOperation,
|
|
6
|
+
operationDeclaration,
|
|
7
|
+
routerDeclaration
|
|
8
|
+
} from "./chunk-T7GKZBLP.js";
|
|
4
9
|
|
|
5
10
|
// src/implementation/protocol-operations.ts
|
|
6
11
|
var protocolOperations = (operations, kinds = {}) => {
|
|
7
|
-
const
|
|
8
|
-
const mutations = {};
|
|
12
|
+
const declared = {};
|
|
9
13
|
for (const [name, operation] of Object.entries(operations)) {
|
|
10
|
-
const kind = Object.hasOwn(kinds, name) ? kinds[name] : operation.readOnly === true ? "query" : "mutation";
|
|
14
|
+
const kind = Object.hasOwn(kinds, name) ? kinds[name] ?? "mutation" : operation.readOnly === true ? "query" : "mutation";
|
|
11
15
|
const native = {
|
|
12
16
|
description: operation.description,
|
|
13
17
|
...operation.title === void 0 ? {} : { title: operation.title },
|
|
@@ -18,12 +22,20 @@ var protocolOperations = (operations, kinds = {}) => {
|
|
|
18
22
|
};
|
|
19
23
|
const output = Object.getOwnPropertyDescriptor(operation, "outputSchema");
|
|
20
24
|
const withOutput = (target) => output === void 0 || output.get === void 0 && output.value === void 0 ? target : Object.defineProperty(target, "outputSchema", { ...output, enumerable: true });
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
declared[name] = operationDeclaration(withOutput({ ...native, kind }));
|
|
26
|
+
}
|
|
27
|
+
return declared;
|
|
28
|
+
};
|
|
29
|
+
var protocolRouter = (operations, kinds = {}) => {
|
|
30
|
+
const native = {};
|
|
31
|
+
for (const [name, declaration] of Object.entries(protocolOperations(operations, kinds))) {
|
|
32
|
+
const operation = nativeOperation(declaration);
|
|
33
|
+
if (operation !== void 0) native[name] = operation;
|
|
23
34
|
}
|
|
24
|
-
return
|
|
35
|
+
return routerDeclaration(fixedRouter(native));
|
|
25
36
|
};
|
|
26
37
|
|
|
27
38
|
export {
|
|
28
|
-
protocolOperations
|
|
39
|
+
protocolOperations,
|
|
40
|
+
protocolRouter
|
|
29
41
|
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prepareElicitation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SB4HEPNJ.js";
|
|
4
4
|
import {
|
|
5
5
|
fromPromise
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T7GKZBLP.js";
|
|
7
7
|
import {
|
|
8
8
|
ElicitationFailed,
|
|
9
9
|
McpError,
|
|
10
|
+
McpServerHeader,
|
|
10
11
|
McpToolMetadata,
|
|
11
12
|
McpToolResult,
|
|
13
|
+
RouterIcon,
|
|
12
14
|
ToolResultObservation,
|
|
13
15
|
defaultElicitationLimits,
|
|
14
16
|
defaultMcpClientLimits,
|
|
15
17
|
mcpSdkTimerCeilingMs
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-B3EOZTK3.js";
|
|
17
19
|
import {
|
|
18
20
|
compileJsonSchemaDecoder,
|
|
19
21
|
jsonSchemaDecoder
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5T57N25Q.js";
|
|
21
23
|
import {
|
|
22
24
|
JsonObject
|
|
23
25
|
} from "./chunk-27F7W2LG.js";
|
|
@@ -70,7 +72,7 @@ var adaptMcpTool = (client, tool) => Effect_exports.gen(function* () {
|
|
|
70
72
|
return adapted;
|
|
71
73
|
});
|
|
72
74
|
var adaptMcpTools = (client) => Effect_exports.gen(function* () {
|
|
73
|
-
const metadata = yield* client.list;
|
|
75
|
+
const { tools: metadata } = yield* client.list;
|
|
74
76
|
const entries = yield* Effect_exports.forEach(
|
|
75
77
|
metadata,
|
|
76
78
|
(tool) => adaptMcpTool(client, tool).pipe(Effect_exports.map((adapted) => [tool.name, adapted]))
|
|
@@ -233,7 +235,7 @@ function mcpClient(withClient, timeoutMs, failure) {
|
|
|
233
235
|
do {
|
|
234
236
|
const page = yield* Effect_exports.tryPromise({
|
|
235
237
|
// This session only reads metadata. listTools() also eagerly compiles
|
|
236
|
-
// every output validator;
|
|
238
|
+
// every output validator; mcpRouter validates the selected tool on call.
|
|
237
239
|
try: (signal) => client.request(
|
|
238
240
|
{ method: "tools/list", params: cursor === void 0 ? {} : { cursor } },
|
|
239
241
|
ListToolsResultSchema,
|
|
@@ -263,7 +265,24 @@ function mcpClient(withClient, timeoutMs, failure) {
|
|
|
263
265
|
cursors.add(cursor);
|
|
264
266
|
}
|
|
265
267
|
} while (cursor !== void 0);
|
|
266
|
-
|
|
268
|
+
const info = client.getServerVersion();
|
|
269
|
+
const instructions = client.getInstructions();
|
|
270
|
+
const icons = info?.icons?.flatMap(
|
|
271
|
+
(icon) => Option_exports.toArray(Schema_exports.decodeUnknownOption(RouterIcon)(icon))
|
|
272
|
+
);
|
|
273
|
+
const server = Schema_exports.decodeUnknownOption(McpServerHeader)({
|
|
274
|
+
...info?.name === void 0 ? {} : { name: info.name },
|
|
275
|
+
...info?.title === void 0 ? {} : { title: info.title },
|
|
276
|
+
...info?.version === void 0 ? {} : { version: info.version },
|
|
277
|
+
...info?.description === void 0 ? {} : { description: info.description },
|
|
278
|
+
...info?.websiteUrl === void 0 ? {} : { websiteUrl: info.websiteUrl },
|
|
279
|
+
...icons === void 0 ? {} : { icons },
|
|
280
|
+
...instructions === void 0 ? {} : { instructions }
|
|
281
|
+
});
|
|
282
|
+
return {
|
|
283
|
+
tools: [...tools.values()],
|
|
284
|
+
server: Option_exports.getOrElse(server, () => ({}))
|
|
285
|
+
};
|
|
267
286
|
})
|
|
268
287
|
).pipe(Effect_exports.withSpan("provider.mcp.discover"));
|
|
269
288
|
const call = (name, input, context) => withClient("call", (client) => mcpCall(client, name, input, context, timeoutMs, failure)).pipe(
|