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
package/js/index.js
CHANGED
|
@@ -3,19 +3,23 @@ import {
|
|
|
3
3
|
defineDatabase,
|
|
4
4
|
table,
|
|
5
5
|
workflow
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OE3QQTSB.js";
|
|
7
7
|
import "./chunk-ZQINWV4W.js";
|
|
8
8
|
import {
|
|
9
|
+
dynamicRouter,
|
|
9
10
|
fromPromise,
|
|
10
11
|
mutation,
|
|
11
12
|
nativeOperation,
|
|
13
|
+
nativeRouter,
|
|
12
14
|
operationDeclaration,
|
|
13
15
|
query,
|
|
16
|
+
router,
|
|
17
|
+
routerDeclaration,
|
|
14
18
|
withApproval
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-T7GKZBLP.js";
|
|
16
20
|
import {
|
|
17
21
|
accountProviderError
|
|
18
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MKWZPDR6.js";
|
|
19
23
|
import {
|
|
20
24
|
CalendarSchedule,
|
|
21
25
|
ElicitationFailed,
|
|
@@ -30,16 +34,13 @@ import {
|
|
|
30
34
|
ScheduleTiming,
|
|
31
35
|
SecretsMethod,
|
|
32
36
|
WorkflowFailure
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-B3EOZTK3.js";
|
|
34
38
|
import "./chunk-N7YDVXYJ.js";
|
|
35
39
|
import {
|
|
36
|
-
CacheError
|
|
37
|
-
} from "./chunk-YEPYT6SD.js";
|
|
38
|
-
import "./chunk-JU7VHODU.js";
|
|
39
|
-
import "./chunk-W4DMKWAB.js";
|
|
40
|
-
import {
|
|
40
|
+
CacheError,
|
|
41
41
|
ProviderError
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-R3EV5FTO.js";
|
|
43
|
+
import "./chunk-JU7VHODU.js";
|
|
43
44
|
import {
|
|
44
45
|
array,
|
|
45
46
|
boolean,
|
|
@@ -59,7 +60,7 @@ import {
|
|
|
59
60
|
userId,
|
|
60
61
|
withLazyJsonSchemaDocument,
|
|
61
62
|
wrap
|
|
62
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-5T57N25Q.js";
|
|
63
64
|
import "./chunk-PZB6T6KU.js";
|
|
64
65
|
import {
|
|
65
66
|
JsonObject,
|
|
@@ -104,7 +105,7 @@ var secrets = (options) => new SecretsMethod(options);
|
|
|
104
105
|
var oauth2 = (config, response) => parse(OAuth2Config, config).pipe(Effect_exports.map((config2) => new OAuth2Method({ config: config2, response })));
|
|
105
106
|
var defineProvider = (options) => new Provider(options);
|
|
106
107
|
|
|
107
|
-
// src/implementation/account-
|
|
108
|
+
// src/implementation/account-router.ts
|
|
108
109
|
var inputDocument = (operation) => {
|
|
109
110
|
const imported = importedJsonSchema(operation.input);
|
|
110
111
|
if (imported !== void 0) return Schema_exports.decodeUnknownSync(JsonObject)(imported);
|
|
@@ -115,72 +116,70 @@ var declaresOutput = (operation) => {
|
|
|
115
116
|
const property = Object.getOwnPropertyDescriptor(operation, "outputSchema");
|
|
116
117
|
return property !== void 0 && (property.get !== void 0 || property.value !== void 0);
|
|
117
118
|
};
|
|
118
|
-
var
|
|
119
|
-
[...
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
[
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
119
|
+
var combineOperation = (accounts) => {
|
|
120
|
+
const variants = [...accounts.values()];
|
|
121
|
+
const first = variants[0];
|
|
122
|
+
if (first === void 0) throw new Error("An account operation must have at least one account");
|
|
123
|
+
const kind = variants.every((operation) => operation.kind === "query") ? "query" : "mutation";
|
|
124
|
+
const select = (input2) => {
|
|
125
|
+
const operation = accounts.get(input2.accountId);
|
|
126
|
+
if (operation === void 0)
|
|
127
|
+
throw new Error("Account selection must be decoded before execution");
|
|
128
|
+
return operation;
|
|
129
|
+
};
|
|
130
|
+
const input = Schema_exports.Union(
|
|
131
|
+
[...accounts].map(
|
|
132
|
+
([accountId, operation]) => Schema_exports.Struct({ accountId: Schema_exports.Literal(accountId), input: operation.input })
|
|
133
|
+
)
|
|
134
|
+
);
|
|
135
|
+
const inputSchema = () => ({
|
|
136
|
+
type: "object",
|
|
137
|
+
anyOf: [...accounts].map(([accountId, operation], index) => ({
|
|
136
138
|
type: "object",
|
|
137
|
-
|
|
138
|
-
type: "
|
|
139
|
-
|
|
140
|
-
accountId: { type: "string", const: accountId },
|
|
141
|
-
input: nestJsonSchema(inputDocument(operation), `#/anyOf/${index}/properties/input`)
|
|
142
|
-
},
|
|
143
|
-
required: ["accountId", "input"]
|
|
144
|
-
}))
|
|
145
|
-
});
|
|
146
|
-
const declaration2 = operationDeclaration({
|
|
147
|
-
kind,
|
|
148
|
-
...first.description === void 0 ? {} : { description: first.description },
|
|
149
|
-
...first.title === void 0 ? {} : { title: first.title },
|
|
150
|
-
...first.annotations === void 0 || !variants.every(
|
|
151
|
-
(operation) => JSON.stringify(operation.annotations) === JSON.stringify(first.annotations)
|
|
152
|
-
) ? {} : { annotations: first.annotations },
|
|
153
|
-
...first._meta === void 0 || !variants.every(
|
|
154
|
-
(operation) => JSON.stringify(operation._meta) === JSON.stringify(first._meta)
|
|
155
|
-
) ? {} : { _meta: first._meta },
|
|
156
|
-
input: withLazyJsonSchemaDocument(input, inputSchema),
|
|
157
|
-
approval: (context) => {
|
|
158
|
-
const operation = select(context.toolInput);
|
|
159
|
-
return operation.approval === void 0 ? Effect_exports.succeed("approved") : operation.approval({ ...context, toolInput: context.toolInput.input });
|
|
139
|
+
properties: {
|
|
140
|
+
accountId: { type: "string", const: accountId },
|
|
141
|
+
input: nestJsonSchema(inputDocument(operation), `#/anyOf/${index}/properties/input`)
|
|
160
142
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
143
|
+
required: ["accountId", "input"]
|
|
144
|
+
}))
|
|
145
|
+
});
|
|
146
|
+
const declaration2 = operationDeclaration({
|
|
147
|
+
kind,
|
|
148
|
+
...first.description === void 0 ? {} : { description: first.description },
|
|
149
|
+
...first.title === void 0 ? {} : { title: first.title },
|
|
150
|
+
...first.annotations === void 0 || !variants.every(
|
|
151
|
+
(operation) => JSON.stringify(operation.annotations) === JSON.stringify(first.annotations)
|
|
152
|
+
) ? {} : { annotations: first.annotations },
|
|
153
|
+
...first._meta === void 0 || !variants.every((operation) => JSON.stringify(operation._meta) === JSON.stringify(first._meta)) ? {} : { _meta: first._meta },
|
|
154
|
+
input: withLazyJsonSchemaDocument(input, inputSchema),
|
|
155
|
+
approval: (context) => {
|
|
156
|
+
const operation = select(context.toolInput);
|
|
157
|
+
return operation.approval === void 0 ? Effect_exports.succeed("approved") : operation.approval({ ...context, toolInput: context.toolInput.input });
|
|
158
|
+
},
|
|
159
|
+
run: (context, input2) => {
|
|
160
|
+
const operation = select(input2);
|
|
161
|
+
return operation.run(context, input2.input).pipe(
|
|
162
|
+
Effect_exports.mapError((error) => accountProviderError(error, input2.accountId)),
|
|
163
|
+
Effect_exports.flatMap(
|
|
164
|
+
(output) => operation.output === void 0 ? Effect_exports.succeed(output) : Schema_exports.decodeUnknownEffect(operation.output)(output)
|
|
165
|
+
)
|
|
166
|
+
);
|
|
180
167
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
)
|
|
168
|
+
});
|
|
169
|
+
if (variants.every(declaresOutput)) {
|
|
170
|
+
const outputSchema = once(() => ({
|
|
171
|
+
anyOf: variants.flatMap(
|
|
172
|
+
(operation) => operation.outputSchema === void 0 ? [] : [operation.outputSchema]
|
|
173
|
+
).map((output, index) => nestJsonSchema(output, `#/anyOf/${index}`))
|
|
174
|
+
}));
|
|
175
|
+
const native2 = nativeOperation(declaration2);
|
|
176
|
+
if (native2 !== void 0)
|
|
177
|
+
Object.defineProperty(native2, "outputSchema", { enumerable: true, get: outputSchema });
|
|
178
|
+
}
|
|
179
|
+
const native = nativeOperation(declaration2);
|
|
180
|
+
if (native === void 0) throw new Error("Expected a combined operation");
|
|
181
|
+
return native;
|
|
182
|
+
};
|
|
184
183
|
var sameAcross = (key, variants) => {
|
|
185
184
|
const first = variants[0]?.[1][key];
|
|
186
185
|
return first !== void 0 && variants.every(([, tool]) => JSON.stringify(tool[key]) === JSON.stringify(first)) ? { [key]: first } : {};
|
|
@@ -192,7 +191,7 @@ var mergeSummary = (name, variants) => {
|
|
|
192
191
|
name,
|
|
193
192
|
description: first.description,
|
|
194
193
|
...first.title === void 0 ? {} : { title: first.title },
|
|
195
|
-
readOnly:
|
|
194
|
+
readOnly: variants.every(([, tool]) => tool.readOnly === true),
|
|
196
195
|
...sameAcross("annotations", variants)
|
|
197
196
|
});
|
|
198
197
|
};
|
|
@@ -218,112 +217,123 @@ var merge = (name, variants) => Schema_exports.decodeUnknownSync(HostedTool)({
|
|
|
218
217
|
} : {},
|
|
219
218
|
...sameAcross("_meta", variants)
|
|
220
219
|
});
|
|
221
|
-
var
|
|
220
|
+
var combineDynamic = (sources) => {
|
|
221
|
+
const first = [...sources.values()][0];
|
|
222
|
+
const grouped = (read) => Effect_exports.gen(function* () {
|
|
223
|
+
const groups = /* @__PURE__ */ new Map();
|
|
224
|
+
for (const [accountId, source] of sources) {
|
|
225
|
+
const tools = yield* read(source).pipe(
|
|
226
|
+
Effect_exports.mapError((error) => accountProviderError(error, accountId))
|
|
227
|
+
);
|
|
228
|
+
for (const tool of tools) {
|
|
229
|
+
const variants = groups.get(tool.name) ?? [];
|
|
230
|
+
if (variants.some(([id2]) => id2 === accountId))
|
|
231
|
+
return yield* Effect_exports.die(new Error("Duplicate source operation"));
|
|
232
|
+
variants.push([accountId, tool]);
|
|
233
|
+
groups.set(tool.name, variants);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return groups;
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
kind: "dynamic",
|
|
240
|
+
// Accounts share one source, so the first account describes the router.
|
|
241
|
+
...first?.meta === void 0 ? {} : { meta: first.meta },
|
|
242
|
+
...first?.overrides === void 0 ? {} : { overrides: first.overrides },
|
|
243
|
+
list: () => grouped((source) => source.list()).pipe(
|
|
244
|
+
Effect_exports.map((groups) => [...groups].map(([name, variants]) => merge(name, variants)))
|
|
245
|
+
),
|
|
246
|
+
summaries: () => grouped(
|
|
247
|
+
(source) => source.summaries === void 0 ? source.list() : source.summaries()
|
|
248
|
+
).pipe(
|
|
249
|
+
Effect_exports.map((groups) => [...groups].map(([name, variants]) => mergeSummary(name, variants)))
|
|
250
|
+
),
|
|
251
|
+
describe: (name) => Effect_exports.gen(function* () {
|
|
252
|
+
const variants = [];
|
|
253
|
+
for (const [accountId, source] of sources) {
|
|
254
|
+
const tool = yield* (source.describe === void 0 ? source.list().pipe(Effect_exports.map((tools) => tools.find((tool2) => tool2.name === name))) : source.describe(name)).pipe(Effect_exports.mapError((error) => accountProviderError(error, accountId)));
|
|
255
|
+
if (tool !== void 0) variants.push([accountId, tool]);
|
|
256
|
+
}
|
|
257
|
+
return variants.length === 0 ? void 0 : merge(name, variants);
|
|
258
|
+
}),
|
|
259
|
+
resolve: (name) => Effect_exports.gen(function* () {
|
|
260
|
+
const operations = /* @__PURE__ */ new Map();
|
|
261
|
+
for (const [accountId, source] of sources) {
|
|
262
|
+
const operation = yield* source.resolve(name).pipe(Effect_exports.mapError((error) => accountProviderError(error, accountId)));
|
|
263
|
+
if (operation !== void 0) operations.set(accountId, operation);
|
|
264
|
+
}
|
|
265
|
+
return operations.size === 0 ? void 0 : combineOperation(operations);
|
|
266
|
+
})
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
var combineNode = (variants) => {
|
|
270
|
+
const nodes = [...variants.values()];
|
|
271
|
+
const first = nodes[0];
|
|
272
|
+
if (first === void 0) throw new Error("An account operation must have at least one account");
|
|
273
|
+
switch (first.kind) {
|
|
274
|
+
case "query":
|
|
275
|
+
case "mutation":
|
|
276
|
+
return combineOperation(
|
|
277
|
+
narrow(
|
|
278
|
+
variants,
|
|
279
|
+
(node) => node.kind === "query" || node.kind === "mutation"
|
|
280
|
+
)
|
|
281
|
+
);
|
|
282
|
+
case "dynamic":
|
|
283
|
+
return combineDynamic(
|
|
284
|
+
narrow(variants, (node) => node.kind === "dynamic")
|
|
285
|
+
);
|
|
286
|
+
case "router": {
|
|
287
|
+
const routers = narrow(variants, (node) => node.kind === "router");
|
|
288
|
+
const keys = new Set([...routers.values()].flatMap((router2) => Object.keys(router2.children)));
|
|
289
|
+
return {
|
|
290
|
+
kind: "router",
|
|
291
|
+
...first.meta === void 0 ? {} : { meta: first.meta },
|
|
292
|
+
children: Object.fromEntries(
|
|
293
|
+
[...keys].map((key) => {
|
|
294
|
+
const children = /* @__PURE__ */ new Map();
|
|
295
|
+
for (const [accountId, router2] of routers) {
|
|
296
|
+
const child = Object.hasOwn(router2.children, key) ? router2.children[key] : void 0;
|
|
297
|
+
if (child !== void 0) children.set(accountId, child);
|
|
298
|
+
}
|
|
299
|
+
return [key, combineNode(children)];
|
|
300
|
+
})
|
|
301
|
+
)
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
var narrow = (variants, is) => {
|
|
307
|
+
const narrowed = /* @__PURE__ */ new Map();
|
|
308
|
+
for (const [accountId, node] of variants) {
|
|
309
|
+
if (!is(node)) throw new Error("Each account's router must have the same shape");
|
|
310
|
+
narrowed.set(accountId, node);
|
|
311
|
+
}
|
|
312
|
+
return narrowed;
|
|
313
|
+
};
|
|
314
|
+
var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
|
|
222
315
|
Effect_exports.gen(function* () {
|
|
223
|
-
const
|
|
224
|
-
const mutations = /* @__PURE__ */ new Map();
|
|
225
|
-
const sources = /* @__PURE__ */ new Map();
|
|
316
|
+
const routers = /* @__PURE__ */ new Map();
|
|
226
317
|
for (const account of accounts) {
|
|
227
|
-
const
|
|
318
|
+
const declaration2 = yield* Effect_exports.tryPromise({
|
|
228
319
|
try: () => discover(account),
|
|
229
320
|
catch: (error) => accountProviderError(error, account.id)
|
|
230
321
|
});
|
|
231
|
-
if (
|
|
322
|
+
if (routers.has(account.id))
|
|
232
323
|
return yield* Effect_exports.die(new Error("Account selections must be unique"));
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
[operations.mutations, mutations]
|
|
237
|
-
]) {
|
|
238
|
-
for (const [name, declaration2] of Object.entries(source ?? {})) {
|
|
239
|
-
const operation = nativeOperation(declaration2);
|
|
240
|
-
if (operation === void 0)
|
|
241
|
-
return yield* Effect_exports.die(new Error("Expected a protocol operation"));
|
|
242
|
-
const group = target.get(name) ?? /* @__PURE__ */ new Map();
|
|
243
|
-
if (group.has(account.id))
|
|
244
|
-
return yield* Effect_exports.die(new Error("Account selections must be unique"));
|
|
245
|
-
group.set(account.id, operation);
|
|
246
|
-
target.set(name, group);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
324
|
+
const router2 = nativeRouter(declaration2);
|
|
325
|
+
if (router2 === void 0) return yield* Effect_exports.die(new Error("Expected a protocol router"));
|
|
326
|
+
routers.set(account.id, router2);
|
|
249
327
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const grouped = (read) => Effect_exports.gen(function* () {
|
|
256
|
-
const groups = /* @__PURE__ */ new Map();
|
|
257
|
-
for (const [accountId, source] of sources) {
|
|
258
|
-
const tools = yield* read(source).pipe(
|
|
259
|
-
Effect_exports.mapError((error) => accountProviderError(error, accountId))
|
|
260
|
-
);
|
|
261
|
-
for (const tool of tools) {
|
|
262
|
-
const variants = groups.get(tool.name) ?? [];
|
|
263
|
-
if (variants.some(([id2]) => id2 === accountId))
|
|
264
|
-
return yield* Effect_exports.die(new Error("Duplicate source operation"));
|
|
265
|
-
variants.push([accountId, tool]);
|
|
266
|
-
groups.set(tool.name, variants);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return groups;
|
|
270
|
-
});
|
|
271
|
-
return {
|
|
272
|
-
...declared,
|
|
273
|
-
dynamicTools: {
|
|
274
|
-
list: () => grouped((source) => source.list()).pipe(
|
|
275
|
-
Effect_exports.map((groups) => [...groups].map(([name, variants]) => merge(name, variants)))
|
|
276
|
-
),
|
|
277
|
-
summaries: () => grouped(
|
|
278
|
-
(source) => source.summaries === void 0 ? source.list() : source.summaries()
|
|
279
|
-
).pipe(
|
|
280
|
-
Effect_exports.map(
|
|
281
|
-
(groups) => [...groups].map(([name, variants]) => mergeSummary(name, variants))
|
|
282
|
-
)
|
|
283
|
-
),
|
|
284
|
-
describe: (name) => Effect_exports.gen(function* () {
|
|
285
|
-
const variants = [];
|
|
286
|
-
for (const [accountId, source] of sources) {
|
|
287
|
-
const tool = yield* (source.describe === void 0 ? source.list().pipe(Effect_exports.map((tools) => tools.find((tool2) => tool2.name === name))) : source.describe(name)).pipe(Effect_exports.mapError((error) => accountProviderError(error, accountId)));
|
|
288
|
-
if (tool !== void 0) variants.push([accountId, tool]);
|
|
289
|
-
}
|
|
290
|
-
return variants.length === 0 ? void 0 : merge(name, variants);
|
|
291
|
-
}),
|
|
292
|
-
resolve: (name) => Effect_exports.gen(function* () {
|
|
293
|
-
const kind = name.startsWith("queries.") ? "query" : "mutation";
|
|
294
|
-
const operations = /* @__PURE__ */ new Map();
|
|
295
|
-
for (const [accountId, source] of sources) {
|
|
296
|
-
const operation = yield* source.resolve(name).pipe(Effect_exports.mapError((error) => accountProviderError(error, accountId)));
|
|
297
|
-
if (operation !== void 0) {
|
|
298
|
-
if (operation.kind !== kind)
|
|
299
|
-
return yield* Effect_exports.die(new Error("Operation kind changed"));
|
|
300
|
-
operations.set(accountId, operation);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
if (operations.size === 0) return void 0;
|
|
304
|
-
return nativeOperation(combine(kind, /* @__PURE__ */ new Map([[name, operations]]))[name]);
|
|
305
|
-
})
|
|
306
|
-
}
|
|
307
|
-
};
|
|
328
|
+
if (routers.size === 0) return routerDeclaration({ kind: "router", children: {} });
|
|
329
|
+
const combined = combineNode(routers);
|
|
330
|
+
if (combined.kind !== "router" && combined.kind !== "dynamic")
|
|
331
|
+
return yield* Effect_exports.die(new Error("Expected a protocol router"));
|
|
332
|
+
return routerDeclaration(combined);
|
|
308
333
|
}),
|
|
309
334
|
options
|
|
310
335
|
);
|
|
311
336
|
|
|
312
|
-
// src/implementation/dynamic-tools.ts
|
|
313
|
-
var dynamicTools = (source) => ({
|
|
314
|
-
list: () => fromPromise(source.list)().pipe(
|
|
315
|
-
Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(Schema_exports.Array(HostedTool)))
|
|
316
|
-
),
|
|
317
|
-
resolve: (name) => fromPromise(source.resolve)(name).pipe(
|
|
318
|
-
Effect_exports.map((value) => {
|
|
319
|
-
if (value === void 0) return void 0;
|
|
320
|
-
const operation = nativeOperation(value);
|
|
321
|
-
if (operation === void 0) throw new Error("Expected an operation declaration");
|
|
322
|
-
return operation;
|
|
323
|
-
})
|
|
324
|
-
)
|
|
325
|
-
});
|
|
326
|
-
|
|
327
337
|
// src/implementation/dynamic-skills.ts
|
|
328
338
|
var dynamicSkills = (source) => ({
|
|
329
339
|
list: fromPromise(async () => source.list())
|
|
@@ -396,7 +406,7 @@ export {
|
|
|
396
406
|
ResponseStatusError,
|
|
397
407
|
ValidationError,
|
|
398
408
|
WorkflowFailure,
|
|
399
|
-
|
|
409
|
+
accountRouter,
|
|
400
410
|
array,
|
|
401
411
|
boolean,
|
|
402
412
|
cron,
|
|
@@ -404,8 +414,8 @@ export {
|
|
|
404
414
|
defineApp,
|
|
405
415
|
defineDatabase,
|
|
406
416
|
defineProvider,
|
|
417
|
+
dynamicRouter,
|
|
407
418
|
dynamicSkills,
|
|
408
|
-
dynamicTools,
|
|
409
419
|
id,
|
|
410
420
|
interval,
|
|
411
421
|
json,
|
|
@@ -417,6 +427,7 @@ export {
|
|
|
417
427
|
object,
|
|
418
428
|
query,
|
|
419
429
|
record,
|
|
430
|
+
router,
|
|
420
431
|
secrets2 as secrets,
|
|
421
432
|
string,
|
|
422
433
|
table,
|
package/js/mcp/effect.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mcpClientEffect,
|
|
3
3
|
mcpToolsEffect
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-6BSSI67S.js";
|
|
5
|
+
import "../chunk-ITM77QPO.js";
|
|
6
6
|
import "../chunk-BCSNKUAC.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-SB4HEPNJ.js";
|
|
8
|
+
import "../chunk-NKLWZJLE.js";
|
|
9
|
+
import "../chunk-MNMNLXBL.js";
|
|
9
10
|
import "../chunk-IPI4MFSN.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-C3VAOK5B.js";
|
|
11
|
+
import "../chunk-OE3QQTSB.js";
|
|
12
12
|
import "../chunk-ZQINWV4W.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-T7GKZBLP.js";
|
|
14
|
+
import "../chunk-MKWZPDR6.js";
|
|
15
|
+
import "../chunk-B3EOZTK3.js";
|
|
16
16
|
import "../chunk-N7YDVXYJ.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-R3EV5FTO.js";
|
|
18
18
|
import "../chunk-JU7VHODU.js";
|
|
19
|
-
import "../chunk-W4DMKWAB.js";
|
|
20
|
-
import "../chunk-SB3V4YVR.js";
|
|
21
19
|
import "../chunk-RJDDBDSN.js";
|
|
22
20
|
import "../chunk-57RKNWL2.js";
|
|
23
21
|
import "../chunk-UK573G7W.js";
|
|
24
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-5T57N25Q.js";
|
|
25
23
|
import "../chunk-PZB6T6KU.js";
|
|
26
24
|
import "../chunk-27F7W2LG.js";
|
|
27
25
|
import "../chunk-CDL5PM2Q.js";
|
package/js/mcp/stdio.js
CHANGED
|
@@ -2,32 +2,30 @@ import {
|
|
|
2
2
|
adaptMcpTools,
|
|
3
3
|
mcpClient,
|
|
4
4
|
mcpJsonSchemaValidator
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-ITM77QPO.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
} from "../chunk-
|
|
7
|
+
protocolRouter
|
|
8
|
+
} from "../chunk-ECQFRCH4.js";
|
|
9
9
|
import "../chunk-BCSNKUAC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-SB4HEPNJ.js";
|
|
11
|
+
import "../chunk-NKLWZJLE.js";
|
|
12
|
+
import "../chunk-MNMNLXBL.js";
|
|
12
13
|
import "../chunk-IPI4MFSN.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-C3VAOK5B.js";
|
|
14
|
+
import "../chunk-OE3QQTSB.js";
|
|
15
15
|
import "../chunk-ZQINWV4W.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-T7GKZBLP.js";
|
|
17
|
+
import "../chunk-MKWZPDR6.js";
|
|
18
18
|
import {
|
|
19
19
|
McpError,
|
|
20
20
|
ProcessConfig
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-B3EOZTK3.js";
|
|
22
22
|
import "../chunk-N7YDVXYJ.js";
|
|
23
|
-
import "../chunk-
|
|
23
|
+
import "../chunk-R3EV5FTO.js";
|
|
24
24
|
import "../chunk-JU7VHODU.js";
|
|
25
|
-
import "../chunk-W4DMKWAB.js";
|
|
26
|
-
import "../chunk-SB3V4YVR.js";
|
|
27
25
|
import "../chunk-RJDDBDSN.js";
|
|
28
26
|
import "../chunk-57RKNWL2.js";
|
|
29
27
|
import "../chunk-UK573G7W.js";
|
|
30
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-5T57N25Q.js";
|
|
31
29
|
import "../chunk-PZB6T6KU.js";
|
|
32
30
|
import "../chunk-27F7W2LG.js";
|
|
33
31
|
import {
|
|
@@ -120,11 +118,11 @@ var stdioToolsEffect = (input) => Effect_exports.gen(function* () {
|
|
|
120
118
|
});
|
|
121
119
|
|
|
122
120
|
// src/mcp-stdio.ts
|
|
123
|
-
var
|
|
124
|
-
stdioToolsEffect(config).pipe(Effect_exports.map((tools) =>
|
|
121
|
+
var stdioRouter = (config, signal, kinds = {}) => Effect_exports.runPromise(
|
|
122
|
+
stdioToolsEffect(config).pipe(Effect_exports.map((tools) => protocolRouter(tools, kinds))),
|
|
125
123
|
signal === void 0 ? {} : { signal }
|
|
126
124
|
);
|
|
127
125
|
export {
|
|
128
126
|
McpError,
|
|
129
|
-
|
|
127
|
+
stdioRouter
|
|
130
128
|
};
|