apps 0.0.1-beta.6 → 0.0.1-beta.60
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 +24 -21
- package/framework-reference.json +1 -1
- package/js/{chunk-ECQFRCH4.js → chunk-2ARGIHVD.js} +4 -3
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/{chunk-NKLWZJLE.js → chunk-AQU56EPI.js} +9 -5
- package/js/chunk-CDXQDN7W.js +92 -0
- package/js/{chunk-ITM77QPO.js → chunk-CWW7QWP4.js} +126 -31
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/chunk-ERJ5JGCB.js +266 -0
- package/js/{chunk-RJDDBDSN.js → chunk-FFSO3J76.js} +633 -89
- package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-RFVIONFX.js → chunk-IJ6Y2KFQ.js} +79 -41
- package/js/{chunk-T7GKZBLP.js → chunk-JIU25DIL.js} +67 -55
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/chunk-MRV45IXB.js +340 -0
- package/js/chunk-MWKHKOTL.js +240 -0
- package/js/{chunk-SB4HEPNJ.js → chunk-MZNCLCGJ.js} +883 -189
- package/js/chunk-NS3DEHVA.js +49 -0
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/chunk-T53665H5.js +171 -0
- package/js/{chunk-B3EOZTK3.js → chunk-TLWLJ7PD.js} +2227 -453
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/{chunk-MNMNLXBL.js → chunk-ZYTA5MK4.js} +316 -69
- package/js/client.js +142 -94
- package/js/contracts.js +103 -26
- package/js/effect.js +19 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +50 -40
- package/js/host.js +83 -58
- package/js/index.js +90 -61
- package/js/mcp/effect.js +23 -21
- package/js/mcp/stdio.js +44 -34
- package/js/mcp.js +76 -53
- package/js/openapi.js +4050 -1354
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8517 -214
- package/package.json +2 -3
- package/runtime.json +1 -1
- package/types/app-cache/src/index.d.ts +10 -1
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -3
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +19 -11
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/events.d.ts +93 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +48 -13
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +80 -10
- package/types/apps/src/contracts/network.d.ts +84 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +8 -4
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +2476 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +115 -10
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +58 -0
- package/types/apps/src/contracts/ui.d.ts +19 -1
- package/types/apps/src/contracts/workflows.d.ts +6 -0
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +4 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +59 -0
- package/types/apps/src/implementation/failure-detail.d.ts +25 -3
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +18 -0
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +17 -2
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -5
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +11 -13
- package/types/apps/src/implementation/router.d.ts +16 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +90 -10
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +11 -5
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/apps/src/index.d.ts +30 -12
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +7 -4
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +1 -0
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/ownership.d.ts +56 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +11 -3
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-6BSSI67S.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-OE3QQTSB.js +0 -222
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-ZQINWV4W.js +0 -630
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/storage.d.ts +0 -15
package/js/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ResponseDecodeError,
|
|
3
|
+
ResponseStatusError,
|
|
2
4
|
defineApp,
|
|
3
|
-
|
|
4
|
-
table,
|
|
5
|
+
event,
|
|
5
6
|
workflow
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-ZQINWV4W.js";
|
|
7
|
+
} from "./chunk-ERJ5JGCB.js";
|
|
8
8
|
import {
|
|
9
9
|
dynamicRouter,
|
|
10
|
-
fromPromise,
|
|
11
10
|
mutation,
|
|
12
11
|
nativeOperation,
|
|
13
12
|
nativeRouter,
|
|
@@ -15,11 +14,14 @@ import {
|
|
|
15
14
|
query,
|
|
16
15
|
router,
|
|
17
16
|
routerDeclaration,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
toolAnnotations,
|
|
18
|
+
withApproval,
|
|
19
|
+
withApprovals
|
|
20
|
+
} from "./chunk-JIU25DIL.js";
|
|
20
21
|
import {
|
|
21
|
-
accountProviderError
|
|
22
|
-
|
|
22
|
+
accountProviderError,
|
|
23
|
+
fromPromise
|
|
24
|
+
} from "./chunk-T53665H5.js";
|
|
23
25
|
import {
|
|
24
26
|
CalendarSchedule,
|
|
25
27
|
ElicitationFailed,
|
|
@@ -34,19 +36,21 @@ import {
|
|
|
34
36
|
ScheduleTiming,
|
|
35
37
|
SecretsMethod,
|
|
36
38
|
WorkflowFailure
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-N7YDVXYJ.js";
|
|
39
|
+
} from "./chunk-TLWLJ7PD.js";
|
|
39
40
|
import {
|
|
40
41
|
CacheError,
|
|
42
|
+
FetchOptionUnsupported,
|
|
43
|
+
NetworkRefused,
|
|
41
44
|
ProviderError
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
45
|
+
} from "./chunk-MWKHKOTL.js";
|
|
46
|
+
import "./chunk-H72MEDMN.js";
|
|
44
47
|
import {
|
|
45
48
|
array,
|
|
46
49
|
boolean,
|
|
47
50
|
decoderOf,
|
|
48
|
-
|
|
51
|
+
fieldExposure,
|
|
49
52
|
importedJsonSchema,
|
|
53
|
+
isSchema,
|
|
50
54
|
json,
|
|
51
55
|
jsonSchema,
|
|
52
56
|
literal,
|
|
@@ -55,42 +59,29 @@ import {
|
|
|
55
59
|
object,
|
|
56
60
|
once,
|
|
57
61
|
parse,
|
|
62
|
+
plain,
|
|
63
|
+
raw,
|
|
58
64
|
record,
|
|
59
65
|
string,
|
|
60
|
-
userId,
|
|
61
66
|
withLazyJsonSchemaDocument,
|
|
62
67
|
wrap
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import "./chunk-
|
|
68
|
+
} from "./chunk-KGCTYL2S.js";
|
|
69
|
+
import "./chunk-FFSO3J76.js";
|
|
70
|
+
import "./chunk-PD6I2SDG.js";
|
|
71
|
+
import "./chunk-5FHWNLCI.js";
|
|
65
72
|
import {
|
|
66
73
|
JsonObject,
|
|
67
74
|
JsonValue,
|
|
68
75
|
ValidationError
|
|
69
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-H2CJWXA3.js";
|
|
77
|
+
import "./chunk-TUMGL2OC.js";
|
|
78
|
+
import "./chunk-EOPQ727L.js";
|
|
70
79
|
import {
|
|
71
80
|
Effect_exports,
|
|
72
81
|
Schema_exports
|
|
73
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
74
83
|
import "./chunk-CZ7CSFO4.js";
|
|
75
84
|
|
|
76
|
-
// src/contracts/http.ts
|
|
77
|
-
var ResponseStatusError = class extends Schema_exports.TaggedError()(
|
|
78
|
-
"ResponseStatusError",
|
|
79
|
-
{ status: Schema_exports.Number }
|
|
80
|
-
) {
|
|
81
|
-
get message() {
|
|
82
|
-
return `Request failed with status ${this.status}`;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
var ResponseDecodeError = class extends Schema_exports.TaggedError()(
|
|
86
|
-
"ResponseDecodeError",
|
|
87
|
-
{}
|
|
88
|
-
) {
|
|
89
|
-
get message() {
|
|
90
|
-
return "Response body did not match the expected schema";
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
85
|
// src/implementation/http.ts
|
|
95
86
|
var decodeJson = (response, schema) => Effect_exports.gen(function* () {
|
|
96
87
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -102,20 +93,33 @@ var decodeJson = (response, schema) => Effect_exports.gen(function* () {
|
|
|
102
93
|
|
|
103
94
|
// src/implementation/provider.ts
|
|
104
95
|
var secrets = (options) => new SecretsMethod(options);
|
|
105
|
-
var oauth2 = (config, response) => parse(OAuth2Config, config).pipe(
|
|
106
|
-
|
|
96
|
+
var oauth2 = (config, response, exposure) => parse(OAuth2Config, config).pipe(
|
|
97
|
+
Effect_exports.map(
|
|
98
|
+
(config2) => new OAuth2Method({ config: config2, response, ...exposure === void 0 ? {} : { exposure } })
|
|
99
|
+
)
|
|
100
|
+
);
|
|
101
|
+
var defineProvider = ({
|
|
102
|
+
health,
|
|
103
|
+
...options
|
|
104
|
+
}) => {
|
|
105
|
+
if (health === void 0) return new Provider(options);
|
|
106
|
+
const run = fromPromise(health, "check");
|
|
107
|
+
return new Provider({ ...options, health: { run } });
|
|
108
|
+
};
|
|
107
109
|
|
|
108
110
|
// src/implementation/account-router.ts
|
|
109
|
-
var
|
|
110
|
-
const imported = importedJsonSchema(
|
|
111
|
+
var decoderDocument = (decoder) => {
|
|
112
|
+
const imported = importedJsonSchema(decoder);
|
|
111
113
|
if (imported !== void 0) return Schema_exports.decodeUnknownSync(JsonObject)(imported);
|
|
112
|
-
const document = Schema_exports.toJsonSchemaDocument(
|
|
114
|
+
const document = Schema_exports.toJsonSchemaDocument(decoder);
|
|
113
115
|
return Schema_exports.decodeUnknownSync(JsonObject)({ ...document.schema, $defs: document.definitions });
|
|
114
116
|
};
|
|
115
117
|
var declaresOutput = (operation) => {
|
|
118
|
+
if (operation.output !== void 0) return true;
|
|
116
119
|
const property = Object.getOwnPropertyDescriptor(operation, "outputSchema");
|
|
117
120
|
return property !== void 0 && (property.get !== void 0 || property.value !== void 0);
|
|
118
121
|
};
|
|
122
|
+
var outputDocument = (operation) => operation.output === void 0 ? operation.outputSchema : decoderDocument(operation.output);
|
|
119
123
|
var combineOperation = (accounts) => {
|
|
120
124
|
const variants = [...accounts.values()];
|
|
121
125
|
const first = variants[0];
|
|
@@ -138,7 +142,10 @@ var combineOperation = (accounts) => {
|
|
|
138
142
|
type: "object",
|
|
139
143
|
properties: {
|
|
140
144
|
accountId: { type: "string", const: accountId },
|
|
141
|
-
input: nestJsonSchema(
|
|
145
|
+
input: nestJsonSchema(
|
|
146
|
+
decoderDocument(operation.input),
|
|
147
|
+
`#/anyOf/${index}/properties/input`
|
|
148
|
+
)
|
|
142
149
|
},
|
|
143
150
|
required: ["accountId", "input"]
|
|
144
151
|
}))
|
|
@@ -168,9 +175,10 @@ var combineOperation = (accounts) => {
|
|
|
168
175
|
});
|
|
169
176
|
if (variants.every(declaresOutput)) {
|
|
170
177
|
const outputSchema = once(() => ({
|
|
171
|
-
anyOf: variants.flatMap(
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
anyOf: variants.flatMap((operation) => {
|
|
179
|
+
const output = outputDocument(operation);
|
|
180
|
+
return output === void 0 ? [] : [output];
|
|
181
|
+
}).map((output, index) => nestJsonSchema(output, `#/anyOf/${index}`))
|
|
174
182
|
}));
|
|
175
183
|
const native2 = nativeOperation(declaration2);
|
|
176
184
|
if (native2 !== void 0)
|
|
@@ -227,7 +235,7 @@ var combineDynamic = (sources) => {
|
|
|
227
235
|
);
|
|
228
236
|
for (const tool of tools) {
|
|
229
237
|
const variants = groups.get(tool.name) ?? [];
|
|
230
|
-
if (variants.some(([
|
|
238
|
+
if (variants.some(([id]) => id === accountId))
|
|
231
239
|
return yield* Effect_exports.die(new Error("Duplicate source operation"));
|
|
232
240
|
variants.push([accountId, tool]);
|
|
233
241
|
groups.set(tool.name, variants);
|
|
@@ -316,7 +324,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
|
|
|
316
324
|
const routers = /* @__PURE__ */ new Map();
|
|
317
325
|
for (const account of accounts) {
|
|
318
326
|
const declaration2 = yield* Effect_exports.tryPromise({
|
|
319
|
-
try: () => discover(account),
|
|
327
|
+
try: async () => discover(account),
|
|
320
328
|
catch: (error) => accountProviderError(error, account.id)
|
|
321
329
|
});
|
|
322
330
|
if (routers.has(account.id))
|
|
@@ -336,7 +344,7 @@ var accountRouter = (accounts, discover, options) => Effect_exports.runPromise(
|
|
|
336
344
|
|
|
337
345
|
// src/implementation/dynamic-skills.ts
|
|
338
346
|
var dynamicSkills = (source) => ({
|
|
339
|
-
list: fromPromise(async () => source.list())
|
|
347
|
+
list: fromPromise(async () => source.list(), "skills")
|
|
340
348
|
});
|
|
341
349
|
|
|
342
350
|
// src/contracts/app.ts
|
|
@@ -375,21 +383,39 @@ var cron = (calendar, operation, input) => declaration(
|
|
|
375
383
|
);
|
|
376
384
|
|
|
377
385
|
// src/index.ts
|
|
386
|
+
var isFields = (value) => typeof value === "object" && value !== null && Object.values(value).every(isSchema);
|
|
387
|
+
var accountDecoder = (schema) => (
|
|
388
|
+
// SAFETY: the brand exists only in types; secret values are strings at runtime.
|
|
389
|
+
decoderOf(schema)
|
|
390
|
+
);
|
|
391
|
+
var exposureOf = (schema) => {
|
|
392
|
+
const marked = "fields" in schema && isFields(schema.fields) ? fieldExposure(schema.fields) : {};
|
|
393
|
+
return Object.keys(marked).length === 0 ? {} : { exposure: marked };
|
|
394
|
+
};
|
|
378
395
|
var OAuth2AccessToken2 = wrap(OAuth2AccessToken, false);
|
|
379
|
-
var secrets2 = (options) => secrets({
|
|
396
|
+
var secrets2 = (options) => secrets({
|
|
397
|
+
label: options.label,
|
|
398
|
+
fields: accountDecoder(options.fields),
|
|
399
|
+
...exposureOf(options.fields)
|
|
400
|
+
});
|
|
380
401
|
function oauth22(options) {
|
|
381
402
|
const { response = OAuth2AccessToken2, ...config } = options;
|
|
382
|
-
return Effect_exports.runSync(
|
|
403
|
+
return Effect_exports.runSync(
|
|
404
|
+
oauth2(config, accountDecoder(response), exposureOf(response).exposure)
|
|
405
|
+
);
|
|
383
406
|
}
|
|
384
407
|
var decodeJson2 = (response, schema) => {
|
|
385
408
|
const native = {
|
|
386
409
|
status: response.status,
|
|
387
|
-
json: () =>
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
410
|
+
json: () => (
|
|
411
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- a Response the app passes from its own code
|
|
412
|
+
Effect_exports.tryPromise({
|
|
413
|
+
try: () => response.json(),
|
|
414
|
+
catch: (error) => error
|
|
415
|
+
}).pipe(
|
|
416
|
+
Effect_exports.catch(
|
|
417
|
+
(error) => error instanceof SyntaxError ? Effect_exports.fail(new ResponseDecodeError()) : Effect_exports.die(error)
|
|
418
|
+
)
|
|
393
419
|
)
|
|
394
420
|
)
|
|
395
421
|
};
|
|
@@ -398,6 +424,8 @@ var decodeJson2 = (response, schema) => {
|
|
|
398
424
|
export {
|
|
399
425
|
CacheError,
|
|
400
426
|
ElicitationFailed,
|
|
427
|
+
FetchOptionUnsupported,
|
|
428
|
+
NetworkRefused,
|
|
401
429
|
NonRetryableError,
|
|
402
430
|
NotImplemented,
|
|
403
431
|
OAuth2AccessToken2 as OAuth2AccessToken,
|
|
@@ -412,11 +440,10 @@ export {
|
|
|
412
440
|
cron,
|
|
413
441
|
decodeJson2 as decodeJson,
|
|
414
442
|
defineApp,
|
|
415
|
-
defineDatabase,
|
|
416
443
|
defineProvider,
|
|
417
444
|
dynamicRouter,
|
|
418
445
|
dynamicSkills,
|
|
419
|
-
|
|
446
|
+
event,
|
|
420
447
|
interval,
|
|
421
448
|
json,
|
|
422
449
|
jsonSchema,
|
|
@@ -425,13 +452,15 @@ export {
|
|
|
425
452
|
number,
|
|
426
453
|
oauth22 as oauth2,
|
|
427
454
|
object,
|
|
455
|
+
plain,
|
|
428
456
|
query,
|
|
457
|
+
raw,
|
|
429
458
|
record,
|
|
430
459
|
router,
|
|
431
460
|
secrets2 as secrets,
|
|
432
461
|
string,
|
|
433
|
-
|
|
434
|
-
userId,
|
|
462
|
+
toolAnnotations,
|
|
435
463
|
withApproval,
|
|
464
|
+
withApprovals,
|
|
436
465
|
workflow
|
|
437
466
|
};
|
package/js/mcp/effect.js
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mcpClientEffect,
|
|
3
|
+
mcpHealthEffect,
|
|
3
4
|
mcpToolsEffect
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-MRV45IXB.js";
|
|
6
|
+
import "../chunk-CWW7QWP4.js";
|
|
6
7
|
import "../chunk-BCSNKUAC.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-MZNCLCGJ.js";
|
|
9
|
+
import "../chunk-AQU56EPI.js";
|
|
10
|
+
import "../chunk-ZYTA5MK4.js";
|
|
11
|
+
import "../chunk-NS3DEHVA.js";
|
|
12
|
+
import "../chunk-XBG7HHXC.js";
|
|
13
|
+
import "../chunk-ERJ5JGCB.js";
|
|
14
|
+
import "../chunk-JIU25DIL.js";
|
|
15
|
+
import "../chunk-T53665H5.js";
|
|
16
|
+
import "../chunk-TLWLJ7PD.js";
|
|
17
|
+
import "../chunk-MWKHKOTL.js";
|
|
18
|
+
import "../chunk-H72MEDMN.js";
|
|
19
|
+
import "../chunk-KGCTYL2S.js";
|
|
20
|
+
import "../chunk-FFSO3J76.js";
|
|
21
|
+
import "../chunk-PD6I2SDG.js";
|
|
22
|
+
import "../chunk-5FHWNLCI.js";
|
|
23
|
+
import "../chunk-H2CJWXA3.js";
|
|
24
|
+
import "../chunk-TUMGL2OC.js";
|
|
25
|
+
import "../chunk-EOPQ727L.js";
|
|
26
|
+
import "../chunk-IFJU5SYQ.js";
|
|
26
27
|
import "../chunk-CZ7CSFO4.js";
|
|
27
28
|
export {
|
|
28
29
|
mcpClientEffect,
|
|
30
|
+
mcpHealthEffect,
|
|
29
31
|
mcpToolsEffect
|
|
30
32
|
};
|
package/js/mcp/stdio.js
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
2
|
adaptMcpTools,
|
|
3
|
+
answeredError,
|
|
3
4
|
mcpClient,
|
|
4
5
|
mcpJsonSchemaValidator
|
|
5
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-CWW7QWP4.js";
|
|
6
7
|
import {
|
|
7
8
|
protocolRouter
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-2ARGIHVD.js";
|
|
9
10
|
import "../chunk-BCSNKUAC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-MZNCLCGJ.js";
|
|
12
|
+
import "../chunk-AQU56EPI.js";
|
|
13
|
+
import "../chunk-ZYTA5MK4.js";
|
|
14
|
+
import "../chunk-NS3DEHVA.js";
|
|
15
|
+
import "../chunk-XBG7HHXC.js";
|
|
16
|
+
import "../chunk-ERJ5JGCB.js";
|
|
17
|
+
import "../chunk-JIU25DIL.js";
|
|
18
|
+
import "../chunk-T53665H5.js";
|
|
18
19
|
import {
|
|
19
20
|
McpError,
|
|
20
21
|
ProcessConfig
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-TLWLJ7PD.js";
|
|
23
|
+
import "../chunk-MWKHKOTL.js";
|
|
24
|
+
import "../chunk-H72MEDMN.js";
|
|
25
|
+
import "../chunk-KGCTYL2S.js";
|
|
26
|
+
import {
|
|
27
|
+
owned
|
|
28
|
+
} from "../chunk-FFSO3J76.js";
|
|
29
|
+
import "../chunk-PD6I2SDG.js";
|
|
30
|
+
import "../chunk-5FHWNLCI.js";
|
|
31
|
+
import "../chunk-H2CJWXA3.js";
|
|
32
|
+
import "../chunk-TUMGL2OC.js";
|
|
33
|
+
import "../chunk-EOPQ727L.js";
|
|
31
34
|
import {
|
|
32
35
|
Effect_exports,
|
|
33
36
|
Schema_exports
|
|
34
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-IFJU5SYQ.js";
|
|
35
38
|
import "../chunk-CZ7CSFO4.js";
|
|
36
39
|
|
|
37
40
|
// src/implementation/mcp-stdio.ts
|
|
@@ -59,10 +62,14 @@ var OwnedTransport = class extends StdioClientTransport {
|
|
|
59
62
|
})();
|
|
60
63
|
}
|
|
61
64
|
};
|
|
62
|
-
var failure = (phase, error) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
var failure = (phase, error) => {
|
|
66
|
+
const upstream = answeredError(error);
|
|
67
|
+
return new McpError({
|
|
68
|
+
phase,
|
|
69
|
+
reason: error instanceof ProtocolError && error.code === ErrorCode.RequestTimeout ? "timeout" : "request",
|
|
70
|
+
...upstream === void 0 ? {} : { upstream }
|
|
71
|
+
});
|
|
72
|
+
};
|
|
66
73
|
function withClient(config, mode, use) {
|
|
67
74
|
return Effect_exports.scoped(
|
|
68
75
|
Effect_exports.gen(function* () {
|
|
@@ -83,22 +90,25 @@ function withClient(config, mode, use) {
|
|
|
83
90
|
stderr: "ignore"
|
|
84
91
|
})
|
|
85
92
|
})),
|
|
86
|
-
({ client: client2, transport: transport2 }) =>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
({ client: client2, transport: transport2 }) => (
|
|
94
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- MCP SDK
|
|
95
|
+
Effect_exports.tryPromise(async () => {
|
|
96
|
+
try {
|
|
97
|
+
await client2.close();
|
|
98
|
+
} finally {
|
|
99
|
+
await transport2.close();
|
|
100
|
+
}
|
|
101
|
+
}).pipe(owned("upstream", "provider.mcp.close"), Effect_exports.orDie)
|
|
102
|
+
)
|
|
93
103
|
);
|
|
94
104
|
yield* Effect_exports.tryPromise({
|
|
95
105
|
try: (signal) => client.connect(transport, { signal, timeout: config.timeoutMs }),
|
|
96
106
|
catch: (error) => failure("connect", error)
|
|
97
|
-
}).pipe(Effect_exports.timeout(config.timeoutMs),
|
|
107
|
+
}).pipe(Effect_exports.timeout(config.timeoutMs), owned("upstream", "provider.mcp.connect"));
|
|
98
108
|
return yield* use(client);
|
|
99
109
|
})
|
|
100
110
|
).pipe(
|
|
101
|
-
|
|
111
|
+
owned("upstream", "provider.mcp.session", {
|
|
102
112
|
attributes: { "mcp.transport": "stdio", "mcp.operation": mode }
|
|
103
113
|
}),
|
|
104
114
|
(operation) => mode === "discover" ? operation.pipe(Effect_exports.timeout(config.timeoutMs)) : operation,
|
package/js/mcp.js
CHANGED
|
@@ -1,55 +1,62 @@
|
|
|
1
1
|
import {
|
|
2
|
-
mcpClientEffect
|
|
3
|
-
|
|
2
|
+
mcpClientEffect,
|
|
3
|
+
mcpHealthEffect
|
|
4
|
+
} from "./chunk-MRV45IXB.js";
|
|
4
5
|
import {
|
|
5
|
-
catalogCache
|
|
6
|
-
|
|
6
|
+
catalogCache,
|
|
7
|
+
catalogScope
|
|
8
|
+
} from "./chunk-IJ6Y2KFQ.js";
|
|
7
9
|
import {
|
|
8
10
|
adaptMcpTool
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CWW7QWP4.js";
|
|
10
12
|
import {
|
|
11
13
|
protocolOperations
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2ARGIHVD.js";
|
|
13
15
|
import "./chunk-BCSNKUAC.js";
|
|
14
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-MZNCLCGJ.js";
|
|
15
17
|
import {
|
|
16
18
|
cacheKey
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-AQU56EPI.js";
|
|
20
|
+
import {
|
|
21
|
+
operationDescription
|
|
22
|
+
} from "./chunk-ZYTA5MK4.js";
|
|
23
|
+
import "./chunk-NS3DEHVA.js";
|
|
24
|
+
import "./chunk-XBG7HHXC.js";
|
|
25
|
+
import "./chunk-ERJ5JGCB.js";
|
|
22
26
|
import {
|
|
23
27
|
nativeOperation,
|
|
24
28
|
routerDeclaration
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import
|
|
29
|
+
} from "./chunk-JIU25DIL.js";
|
|
30
|
+
import {
|
|
31
|
+
fromPromise,
|
|
32
|
+
method
|
|
33
|
+
} from "./chunk-T53665H5.js";
|
|
27
34
|
import {
|
|
35
|
+
McpCredentialsUnverified,
|
|
28
36
|
McpError,
|
|
29
37
|
McpServerHeader,
|
|
30
38
|
McpToolMetadata,
|
|
31
39
|
McpToolsOptions
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-TLWLJ7PD.js";
|
|
41
|
+
import "./chunk-MWKHKOTL.js";
|
|
42
|
+
import "./chunk-H72MEDMN.js";
|
|
43
|
+
import "./chunk-KGCTYL2S.js";
|
|
44
|
+
import "./chunk-FFSO3J76.js";
|
|
45
|
+
import "./chunk-PD6I2SDG.js";
|
|
46
|
+
import "./chunk-5FHWNLCI.js";
|
|
47
|
+
import "./chunk-H2CJWXA3.js";
|
|
48
|
+
import "./chunk-TUMGL2OC.js";
|
|
49
|
+
import "./chunk-EOPQ727L.js";
|
|
42
50
|
import {
|
|
43
51
|
Effect_exports,
|
|
44
52
|
Schema_exports
|
|
45
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
46
54
|
import "./chunk-CZ7CSFO4.js";
|
|
47
55
|
|
|
48
56
|
// src/implementation/mcp-catalog.ts
|
|
49
57
|
var McpToolSummary = McpToolMetadata.mapFields(
|
|
50
58
|
({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
|
|
51
59
|
);
|
|
52
|
-
var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
|
|
53
60
|
var serverMeta = (server) => {
|
|
54
61
|
const title = server.title ?? server.name;
|
|
55
62
|
return {
|
|
@@ -60,20 +67,22 @@ var serverMeta = (server) => {
|
|
|
60
67
|
};
|
|
61
68
|
};
|
|
62
69
|
var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
const invalid = () => new McpError({ phase: "connect", reason: "invalid_input" });
|
|
71
|
+
const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)({
|
|
72
|
+
url: options.url,
|
|
73
|
+
accountId: options.account?.id,
|
|
74
|
+
headers: options.headers,
|
|
75
|
+
signal: options.signal,
|
|
76
|
+
timeoutMs: options.timeoutMs
|
|
77
|
+
}).pipe(Effect_exports.mapError(invalid));
|
|
78
|
+
const cache = yield* catalogScope(options, options.headers, invalid);
|
|
79
|
+
const id = yield* cacheKey({ url: parsed.url });
|
|
71
80
|
const key = ["mcp-catalog-v3", id, "current"];
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const client = yield* mcpClientEffect(options, changed);
|
|
81
|
+
const changed = cache === void 0 ? void 0 : fromPromise(method(cache, "invalidate"), "cache")(key);
|
|
82
|
+
const client = yield* mcpClientEffect(parsed, changed);
|
|
75
83
|
const catalog = yield* catalogCache({
|
|
76
84
|
...options,
|
|
85
|
+
cache,
|
|
77
86
|
prefix: ["mcp-catalog-v3", id],
|
|
78
87
|
schema: McpToolMetadata,
|
|
79
88
|
summary: {
|
|
@@ -82,7 +91,7 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
82
91
|
},
|
|
83
92
|
load: (context) => (context === void 0 ? client.list : mcpClientEffect(
|
|
84
93
|
{ ...parsed, signal: context.signal },
|
|
85
|
-
|
|
94
|
+
fromPromise(method(context.cache, "invalidate"), "cache")(key)
|
|
86
95
|
).pipe(Effect_exports.flatMap((source) => source.list))).pipe(
|
|
87
96
|
Effect_exports.flatMap(
|
|
88
97
|
({ tools, server }) => Schema_exports.encodeEffect(McpServerHeader)(server).pipe(
|
|
@@ -99,12 +108,18 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
99
108
|
...tool.title === void 0 ? {} : { title: tool.title },
|
|
100
109
|
annotations: { ...tool.annotations, readOnlyHint: kindOf(tool) === "query" }
|
|
101
110
|
});
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
const operation = (tool) => adaptMcpTool(client, tool).pipe(
|
|
112
|
+
Effect_exports.map(
|
|
113
|
+
(adapted) => nativeOperation(
|
|
114
|
+
protocolOperations({ selected: adapted }, { selected: kindOf(tool) }).selected
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
const describe = (tool) => operation(tool).pipe(
|
|
119
|
+
Effect_exports.flatMap(
|
|
120
|
+
(selected) => selected === void 0 ? Effect_exports.succeed(void 0) : operationDescription(tool.name, "", selected)
|
|
121
|
+
)
|
|
122
|
+
);
|
|
108
123
|
const router = {
|
|
109
124
|
kind: "dynamic",
|
|
110
125
|
meta: () => catalog.header().pipe(
|
|
@@ -113,16 +128,21 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
113
128
|
),
|
|
114
129
|
Effect_exports.map(serverMeta)
|
|
115
130
|
),
|
|
116
|
-
list: () => catalog.list().pipe(
|
|
131
|
+
list: () => catalog.list().pipe(
|
|
132
|
+
Effect_exports.flatMap((tools) => Effect_exports.forEach(tools, describe)),
|
|
133
|
+
Effect_exports.map((tools) => tools.filter((tool) => tool !== void 0))
|
|
134
|
+
),
|
|
117
135
|
summaries: () => catalog.summaries().pipe(Effect_exports.map((tools) => tools.map(summarize))),
|
|
118
|
-
describe: (name) => catalog.resolve(name).pipe(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
describe: (name) => catalog.resolve(name).pipe(
|
|
137
|
+
Effect_exports.flatMap(
|
|
138
|
+
(tool) => tool === void 0 ? Effect_exports.succeed(void 0) : describe(tool)
|
|
139
|
+
)
|
|
140
|
+
),
|
|
141
|
+
resolve: (name) => catalog.resolve(name).pipe(
|
|
142
|
+
Effect_exports.flatMap(
|
|
143
|
+
(tool) => tool === void 0 ? Effect_exports.succeed(void 0) : operation(tool)
|
|
144
|
+
)
|
|
145
|
+
)
|
|
126
146
|
};
|
|
127
147
|
return routerDeclaration(router);
|
|
128
148
|
});
|
|
@@ -132,7 +152,10 @@ var mcpRouter = (options, kinds = {}) => Effect_exports.runPromise(
|
|
|
132
152
|
mcpCatalog(options, kinds),
|
|
133
153
|
options.signal === void 0 ? {} : { signal: options.signal }
|
|
134
154
|
);
|
|
155
|
+
var mcpHealth = (check, options) => Effect_exports.runPromise(mcpHealthEffect(check, options), { signal: check.signal });
|
|
135
156
|
export {
|
|
157
|
+
McpCredentialsUnverified,
|
|
136
158
|
McpError,
|
|
159
|
+
mcpHealth,
|
|
137
160
|
mcpRouter
|
|
138
161
|
};
|