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,284 @@
|
|
|
1
|
+
import {
|
|
2
|
+
prepareElicitation
|
|
3
|
+
} from "./chunk-Q2FD5IBM.js";
|
|
4
|
+
import {
|
|
5
|
+
fromPromise
|
|
6
|
+
} from "./chunk-X3YBZCJW.js";
|
|
7
|
+
import {
|
|
8
|
+
McpError,
|
|
9
|
+
McpToolMetadata,
|
|
10
|
+
McpToolResult,
|
|
11
|
+
ToolResultObservation,
|
|
12
|
+
defaultMcpClientLimits,
|
|
13
|
+
mcpSdkTimerCeilingMs
|
|
14
|
+
} from "./chunk-22WRQZT7.js";
|
|
15
|
+
import {
|
|
16
|
+
ElicitationFailed,
|
|
17
|
+
defaultElicitationLimits
|
|
18
|
+
} from "./chunk-HP7E42X6.js";
|
|
19
|
+
import {
|
|
20
|
+
compileJsonSchemaDecoder,
|
|
21
|
+
jsonSchemaDecoder
|
|
22
|
+
} from "./chunk-BPEFS4YF.js";
|
|
23
|
+
import {
|
|
24
|
+
JsonObject
|
|
25
|
+
} from "./chunk-36DNRFZQ.js";
|
|
26
|
+
import {
|
|
27
|
+
Clock_exports,
|
|
28
|
+
Deferred_exports,
|
|
29
|
+
Effect_exports,
|
|
30
|
+
Exit_exports,
|
|
31
|
+
Option_exports,
|
|
32
|
+
Queue_exports,
|
|
33
|
+
Schema_exports
|
|
34
|
+
} from "./chunk-2OTCEKL2.js";
|
|
35
|
+
|
|
36
|
+
// src/implementation/mcp-tools.ts
|
|
37
|
+
var adaptMcpTools = (client) => Effect_exports.gen(function* () {
|
|
38
|
+
const metadata = yield* client.list;
|
|
39
|
+
const entries = yield* Effect_exports.forEach(
|
|
40
|
+
metadata,
|
|
41
|
+
(tool) => Effect_exports.gen(function* () {
|
|
42
|
+
const decoder = yield* jsonSchemaDecoder(tool.inputSchema).pipe(
|
|
43
|
+
Effect_exports.mapError(() => new McpError({ phase: "schema", reason: "invalid_response" }))
|
|
44
|
+
);
|
|
45
|
+
const output = tool.outputSchema === void 0 ? void 0 : yield* Effect_exports.cached(
|
|
46
|
+
compileJsonSchemaDecoder(tool.outputSchema).pipe(
|
|
47
|
+
Effect_exports.mapError(
|
|
48
|
+
() => new McpError({ phase: "schema", reason: "invalid_response" })
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
const adapted = {
|
|
53
|
+
...tool,
|
|
54
|
+
description: tool.description ?? tool.title ?? tool.name,
|
|
55
|
+
input: decoder,
|
|
56
|
+
...tool.annotations?.readOnlyHint === void 0 ? {} : { readOnly: tool.annotations.readOnlyHint },
|
|
57
|
+
run: (context, input) => Effect_exports.gen(function* () {
|
|
58
|
+
const arguments_ = yield* Schema_exports.decodeUnknownEffect(decoder)(input).pipe(
|
|
59
|
+
Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(JsonObject)),
|
|
60
|
+
Effect_exports.mapError(() => new McpError({ phase: "call", reason: "invalid_input" }))
|
|
61
|
+
);
|
|
62
|
+
const outputDecoder = output === void 0 ? void 0 : yield* output;
|
|
63
|
+
const result = yield* client.call(tool.name, arguments_, context);
|
|
64
|
+
if (result.isError === true) {
|
|
65
|
+
(yield* ToolResultObservation).failed();
|
|
66
|
+
yield* Effect_exports.annotateCurrentSpan({
|
|
67
|
+
"executor.outcome": "failed",
|
|
68
|
+
"error.type": "McpToolError"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (outputDecoder !== void 0 && !result.isError)
|
|
72
|
+
yield* Schema_exports.decodeUnknownEffect(outputDecoder)(result.structuredContent).pipe(
|
|
73
|
+
Effect_exports.mapError(
|
|
74
|
+
() => new McpError({ phase: "call", reason: "invalid_response" })
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
return result;
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
return [tool.name, adapted];
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
return Object.fromEntries(entries);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// src/implementation/mcp-client.ts
|
|
87
|
+
import { ListToolsResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
88
|
+
|
|
89
|
+
// src/implementation/mcp-call.ts
|
|
90
|
+
import {
|
|
91
|
+
ElicitRequestSchema,
|
|
92
|
+
ElicitResultSchema,
|
|
93
|
+
ErrorCode,
|
|
94
|
+
McpError as ProtocolError
|
|
95
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
96
|
+
function callBudget(timeoutMs) {
|
|
97
|
+
return Effect_exports.gen(function* () {
|
|
98
|
+
const clock = yield* Clock_exports.Clock;
|
|
99
|
+
const changes = yield* Queue_exports.unbounded();
|
|
100
|
+
let remaining = timeoutMs, updated = clock.currentTimeMillisUnsafe(), waiting = 0;
|
|
101
|
+
const account = () => {
|
|
102
|
+
const now = clock.currentTimeMillisUnsafe();
|
|
103
|
+
if (waiting === 0) remaining -= Math.max(0, now - updated);
|
|
104
|
+
updated = now;
|
|
105
|
+
return remaining;
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
waitForInput: (input) => Effect_exports.acquireUseRelease(
|
|
109
|
+
Effect_exports.sync(() => {
|
|
110
|
+
account();
|
|
111
|
+
waiting++;
|
|
112
|
+
}).pipe(Effect_exports.andThen(Queue_exports.offer(changes, void 0))),
|
|
113
|
+
() => input,
|
|
114
|
+
() => Effect_exports.sync(() => {
|
|
115
|
+
account();
|
|
116
|
+
waiting--;
|
|
117
|
+
}).pipe(Effect_exports.andThen(Queue_exports.offer(changes, void 0)))
|
|
118
|
+
),
|
|
119
|
+
expired: Effect_exports.gen(function* () {
|
|
120
|
+
while (true) {
|
|
121
|
+
const left = account();
|
|
122
|
+
if (waiting === 0 && left <= 0)
|
|
123
|
+
return yield* new McpError({ phase: "call", reason: "timeout" });
|
|
124
|
+
if (waiting > 0) yield* Queue_exports.take(changes);
|
|
125
|
+
else yield* Queue_exports.take(changes).pipe(Effect_exports.raceFirst(Effect_exports.sleep(Math.max(1, left))));
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
var mcpCall = (client, name, input, context, timeoutMs, failure) => Effect_exports.scoped(
|
|
132
|
+
Effect_exports.gen(function* () {
|
|
133
|
+
const budget = yield* callBudget(timeoutMs);
|
|
134
|
+
const failed = yield* Deferred_exports.make();
|
|
135
|
+
const runtime = yield* Effect_exports.context();
|
|
136
|
+
const callbacks = /* @__PURE__ */ new Set();
|
|
137
|
+
const lifetime = yield* Effect_exports.acquireRelease(
|
|
138
|
+
Effect_exports.sync(() => new AbortController()),
|
|
139
|
+
(controller) => Effect_exports.promise(async () => {
|
|
140
|
+
controller.abort();
|
|
141
|
+
client.removeRequestHandler("elicitation/create");
|
|
142
|
+
await Promise.allSettled(callbacks);
|
|
143
|
+
})
|
|
144
|
+
);
|
|
145
|
+
client.setRequestHandler(ElicitRequestSchema, (request, extra) => {
|
|
146
|
+
const signal = AbortSignal.any([lifetime.signal, extra.signal]);
|
|
147
|
+
const interaction = Effect_exports.gen(function* () {
|
|
148
|
+
const form = yield* prepareElicitation({
|
|
149
|
+
...request.params,
|
|
150
|
+
mode: request.params.mode ?? "form"
|
|
151
|
+
});
|
|
152
|
+
const deliver = context.elicit;
|
|
153
|
+
if (deliver === void 0) return yield* new ElicitationFailed({ reason: "unavailable" });
|
|
154
|
+
const answer = yield* budget.waitForInput(
|
|
155
|
+
fromPromise(deliver)(form.request).pipe(
|
|
156
|
+
Effect_exports.mapError(
|
|
157
|
+
(error) => Option_exports.getOrElse(
|
|
158
|
+
Schema_exports.decodeUnknownOption(ElicitationFailed)(error),
|
|
159
|
+
() => new ElicitationFailed({ reason: "transport" })
|
|
160
|
+
)
|
|
161
|
+
),
|
|
162
|
+
Effect_exports.timeoutOrElse({
|
|
163
|
+
duration: defaultElicitationLimits.timeoutMs,
|
|
164
|
+
orElse: () => Effect_exports.fail(new ElicitationFailed({ reason: "expired" }))
|
|
165
|
+
})
|
|
166
|
+
)
|
|
167
|
+
).pipe(Effect_exports.withSpan("provider.mcp.elicitation"));
|
|
168
|
+
return yield* form.respond(answer).pipe(
|
|
169
|
+
Effect_exports.flatMap(
|
|
170
|
+
(response) => Effect_exports.try({
|
|
171
|
+
try: () => ElicitResultSchema.parse(response),
|
|
172
|
+
catch: () => new ElicitationFailed({ reason: "invalid-response" })
|
|
173
|
+
})
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
}).pipe(Effect_exports.tapError((error) => Deferred_exports.fail(failed, error)));
|
|
177
|
+
const callback = Effect_exports.runPromiseWith(runtime)(interaction, { signal }).catch(() => {
|
|
178
|
+
if (!lifetime.signal.aborted)
|
|
179
|
+
Effect_exports.runSync(Deferred_exports.fail(failed, new ElicitationFailed({ reason: "transport" })));
|
|
180
|
+
throw new ProtocolError(ErrorCode.InternalError, "User input could not be delivered");
|
|
181
|
+
});
|
|
182
|
+
callbacks.add(callback);
|
|
183
|
+
return callback.finally(() => callbacks.delete(callback));
|
|
184
|
+
});
|
|
185
|
+
return yield* Effect_exports.tryPromise({
|
|
186
|
+
try: (signal) => client.callTool({ name, arguments: input }, void 0, {
|
|
187
|
+
signal: AbortSignal.any([signal, lifetime.signal]),
|
|
188
|
+
timeout: mcpSdkTimerCeilingMs
|
|
189
|
+
}),
|
|
190
|
+
catch: (error) => failure("call", error)
|
|
191
|
+
}).pipe(
|
|
192
|
+
Effect_exports.raceFirst(Deferred_exports.await(failed)),
|
|
193
|
+
Effect_exports.raceFirst(budget.expired),
|
|
194
|
+
Effect_exports.flatMap(
|
|
195
|
+
(result) => Schema_exports.decodeUnknownEffect(McpToolResult)(result).pipe(
|
|
196
|
+
Effect_exports.mapError(() => new McpError({ phase: "call", reason: "invalid_response" }))
|
|
197
|
+
)
|
|
198
|
+
),
|
|
199
|
+
Effect_exports.tap(
|
|
200
|
+
(result) => Effect_exports.annotateCurrentSpan("mcp.tool.is_error", result.isError === true)
|
|
201
|
+
)
|
|
202
|
+
);
|
|
203
|
+
})
|
|
204
|
+
).pipe(
|
|
205
|
+
Effect_exports.withSpan("provider.mcp.request", {
|
|
206
|
+
kind: "client",
|
|
207
|
+
attributes: {
|
|
208
|
+
"rpc.system.name": "jsonrpc",
|
|
209
|
+
"rpc.method": "tools/call",
|
|
210
|
+
"mcp.tool.name": name
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
// src/implementation/mcp-client.ts
|
|
216
|
+
var mcpJsonSchemaValidator = {
|
|
217
|
+
getValidator(document) {
|
|
218
|
+
const decoder = Effect_exports.runSync(jsonSchemaDecoder(document));
|
|
219
|
+
return (input) => {
|
|
220
|
+
const result = Effect_exports.runSyncExit(Schema_exports.decodeUnknownEffect(decoder)(input));
|
|
221
|
+
if (Exit_exports.isFailure(result))
|
|
222
|
+
return {
|
|
223
|
+
valid: false,
|
|
224
|
+
data: void 0,
|
|
225
|
+
errorMessage: "Value does not match the supported JSON Schema"
|
|
226
|
+
};
|
|
227
|
+
return { valid: true, data: result.value, errorMessage: void 0 };
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function mcpClient(withClient, timeoutMs, failure) {
|
|
232
|
+
const list = withClient(
|
|
233
|
+
"discover",
|
|
234
|
+
(client) => Effect_exports.gen(function* () {
|
|
235
|
+
const tools = /* @__PURE__ */ new Map();
|
|
236
|
+
const cursors = /* @__PURE__ */ new Set();
|
|
237
|
+
let cursor;
|
|
238
|
+
do {
|
|
239
|
+
const page = yield* Effect_exports.tryPromise({
|
|
240
|
+
// This session only reads metadata. listTools() also eagerly compiles
|
|
241
|
+
// every output validator; mcpOperations validates the selected tool on call.
|
|
242
|
+
try: (signal) => client.request(
|
|
243
|
+
{ method: "tools/list", params: cursor === void 0 ? {} : { cursor } },
|
|
244
|
+
ListToolsResultSchema,
|
|
245
|
+
{ signal, timeout: timeoutMs }
|
|
246
|
+
),
|
|
247
|
+
catch: (error) => failure("discover", error)
|
|
248
|
+
}).pipe(
|
|
249
|
+
Effect_exports.withSpan("provider.mcp.request", {
|
|
250
|
+
kind: "client",
|
|
251
|
+
attributes: { "rpc.system.name": "jsonrpc", "rpc.method": "tools/list" }
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
const metadata = yield* Schema_exports.decodeUnknownEffect(Schema_exports.Array(McpToolMetadata))(
|
|
255
|
+
page.tools
|
|
256
|
+
).pipe(
|
|
257
|
+
Effect_exports.mapError(() => new McpError({ phase: "discover", reason: "invalid_response" }))
|
|
258
|
+
);
|
|
259
|
+
for (const tool of metadata) {
|
|
260
|
+
if (!tool.name || tools.has(tool.name) || tools.size >= defaultMcpClientLimits.maxTools)
|
|
261
|
+
return yield* new McpError({ phase: "discover", reason: "invalid_response" });
|
|
262
|
+
tools.set(tool.name, tool);
|
|
263
|
+
}
|
|
264
|
+
cursor = page.nextCursor;
|
|
265
|
+
if (cursor !== void 0) {
|
|
266
|
+
if (cursors.has(cursor) || cursors.size >= defaultMcpClientLimits.maxPaginationCursors)
|
|
267
|
+
return yield* new McpError({ phase: "discover", reason: "invalid_response" });
|
|
268
|
+
cursors.add(cursor);
|
|
269
|
+
}
|
|
270
|
+
} while (cursor !== void 0);
|
|
271
|
+
return [...tools.values()];
|
|
272
|
+
})
|
|
273
|
+
).pipe(Effect_exports.withSpan("provider.mcp.discover"));
|
|
274
|
+
const call = (name, input, context) => withClient("call", (client) => mcpCall(client, name, input, context, timeoutMs, failure)).pipe(
|
|
275
|
+
Effect_exports.withSpan("provider.mcp.call", { attributes: { "mcp.tool.name": name } })
|
|
276
|
+
);
|
|
277
|
+
return { list, call };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export {
|
|
281
|
+
adaptMcpTools,
|
|
282
|
+
mcpJsonSchemaValidator,
|
|
283
|
+
mcpClient
|
|
284
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
operationDeclaration
|
|
3
|
+
} from "./chunk-C24KEZXR.js";
|
|
4
|
+
|
|
5
|
+
// src/implementation/protocol-operations.ts
|
|
6
|
+
var protocolOperations = (operations, kinds = {}) => {
|
|
7
|
+
const queries = {};
|
|
8
|
+
const mutations = {};
|
|
9
|
+
for (const [name, operation] of Object.entries(operations)) {
|
|
10
|
+
const kind = Object.hasOwn(kinds, name) ? kinds[name] : operation.readOnly === true ? "query" : "mutation";
|
|
11
|
+
const native = {
|
|
12
|
+
description: operation.description,
|
|
13
|
+
...operation.title === void 0 ? {} : { title: operation.title },
|
|
14
|
+
...operation.annotations === void 0 ? {} : { annotations: operation.annotations },
|
|
15
|
+
...operation._meta === void 0 ? {} : { _meta: operation._meta },
|
|
16
|
+
input: operation.input,
|
|
17
|
+
...operation.outputSchema === void 0 ? {} : { outputSchema: operation.outputSchema },
|
|
18
|
+
run: operation.run
|
|
19
|
+
};
|
|
20
|
+
if (kind === "query") queries[name] = operationDeclaration({ ...native, kind });
|
|
21
|
+
else mutations[name] = operationDeclaration({ ...native, kind: "mutation" });
|
|
22
|
+
}
|
|
23
|
+
return { queries, mutations };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
protocolOperations
|
|
28
|
+
};
|