apps 0.0.1-beta.0 → 0.0.1-beta.2
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 +97 -4
- package/framework-reference.json +1 -1
- package/js/browser-XIPJGLH2.js +65 -0
- package/js/{chunk-SBKHUC5L.js → chunk-4LPG6RCH.js} +2 -2
- package/js/chunk-5MQZEB6Y.js +172 -0
- package/js/{chunk-7JXHF5IF.js → chunk-BMOIAIVR.js} +1 -1
- package/js/chunk-CZ7CSFO4.js +39 -0
- package/js/chunk-D47C7KG5.js +172 -0
- package/js/{chunk-YDR4CPJA.js → chunk-EVJUVWN2.js} +8 -8
- package/js/chunk-FDNTX5QJ.js +78 -0
- package/js/{chunk-2OTCEKL2.js → chunk-FW5HBOIK.js} +2352 -1493
- package/js/{chunk-EP6AEUZO.js → chunk-FZJOYIZO.js} +1 -1
- package/js/{chunk-VFUZI3NY.js → chunk-HDJH3RPR.js} +4 -4
- package/js/{chunk-WIDTG42X.js → chunk-HDTGZWP2.js} +79 -26
- package/js/{chunk-Q2FD5IBM.js → chunk-J7O55ZV7.js} +298 -37
- package/js/{chunk-X3YBZCJW.js → chunk-JN55AYQH.js} +8 -41
- package/js/chunk-LGIYBDWA.js +85 -0
- package/js/{chunk-D6BKYP2L.js → chunk-M6ZRRIBI.js} +4 -4
- package/js/{chunk-HP7E42X6.js → chunk-MYYEW3RA.js} +767 -249
- package/js/{chunk-3ANFZFCV.js → chunk-OHRT55C4.js} +15 -15
- package/js/{chunk-R6JMJSVT.js → chunk-PLCMJREA.js} +2 -2
- package/js/{chunk-C24KEZXR.js → chunk-PYUYJRSK.js} +36 -2
- package/js/{chunk-W7Q5EOTS.js → chunk-QKHR7BMF.js} +32 -32
- package/js/{chunk-KWTCHVLT.js → chunk-RN2MXB4R.js} +47 -51
- package/js/{chunk-36DNRFZQ.js → chunk-SATWJKN6.js} +1 -1
- package/js/chunk-SWPD52J7.js +35 -0
- package/js/{chunk-BKVL7XAJ.js → chunk-TE4KO4HI.js} +1 -1
- package/js/chunk-UVL56Z6E.js +6641 -0
- package/js/chunk-W7D7WVSY.js +18 -0
- package/js/{chunk-BPEFS4YF.js → chunk-WFSQXYUT.js} +109 -17
- package/js/chunk-YEJOQEII.js +104 -0
- package/js/{chunk-LOKGDT6B.js → chunk-Z5NMEGJN.js} +5 -4
- package/js/{chunk-OWD2YICM.js → chunk-ZCAMUXSG.js} +116 -87
- package/js/chunk-ZJWDMTE3.js +63 -0
- package/js/client.js +11 -11
- package/js/contracts.js +88 -25
- package/js/effect.js +21 -15
- package/js/es-APDZKREY.js +40968 -0
- package/js/graphql.js +224 -121
- package/js/host.js +76 -19
- package/js/index.js +193 -51
- package/js/mcp/effect.js +25 -17
- package/js/mcp/stdio.js +23 -17
- package/js/mcp.js +110 -24
- package/js/openapi.js +3045 -105
- package/js/operations/approval.js +1 -1
- package/js/react.js +4 -4
- package/js/skills/effect.js +11 -0
- package/js/skills.js +894 -0
- package/js/storage/facet.js +7 -7
- package/js/ui/auth/contracts.js +6 -6
- package/js/ui/auth.js +8 -8
- package/js/ui/contracts.js +5 -5
- package/js/ui/serving.js +12 -12
- package/package.json +9 -1
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +119 -0
- package/types/app-cache/src/index.d.ts +93 -0
- package/types/apps/src/contracts/api-response-error.d.ts +43 -0
- package/types/apps/src/contracts/app.d.ts +11 -0
- package/types/apps/src/contracts/cache.d.ts +44 -0
- package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
- package/types/apps/src/contracts/dynamic-tools.d.ts +13 -0
- package/types/apps/src/contracts/graphql.d.ts +18 -1
- package/types/apps/src/contracts/host.d.ts +54 -525
- package/types/apps/src/contracts/mcp.d.ts +3 -1
- package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
- package/types/apps/src/contracts/openapi-document.d.ts +53 -0
- package/types/apps/src/contracts/openapi.d.ts +156 -30
- package/types/apps/src/contracts/protocol-version.d.ts +6 -0
- package/types/apps/src/contracts/protocols/1.d.ts +1575 -0
- package/types/apps/src/contracts/provider-error.d.ts +15 -0
- package/types/apps/src/contracts/provider.d.ts +18 -1
- package/types/apps/src/contracts/skills.d.ts +122 -0
- package/types/apps/src/contracts/swagger-client.d.ts +29 -0
- package/types/apps/src/graphql.d.ts +6 -6
- package/types/apps/src/host.d.ts +1 -0
- package/types/apps/src/implementation/account-operations.d.ts +122 -3
- package/types/apps/src/implementation/app.d.ts +1 -1
- package/types/apps/src/implementation/cache-session.d.ts +7 -0
- package/types/apps/src/implementation/cache.d.ts +8 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +29 -0
- package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
- package/types/apps/src/implementation/dynamic-tools.d.ts +8 -0
- package/types/apps/src/implementation/elicitation.d.ts +12 -12
- package/types/apps/src/implementation/git.d.ts +25 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +10 -0
- package/types/apps/src/implementation/graphql.d.ts +81 -3
- package/types/apps/src/implementation/inflate.d.ts +16 -0
- package/types/apps/src/implementation/input-problems.d.ts +3 -0
- package/types/apps/src/implementation/mcp-call.d.ts +3 -2
- package/types/apps/src/implementation/mcp-catalog.d.ts +12 -0
- package/types/apps/src/implementation/mcp-client.d.ts +9 -8
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
- package/types/apps/src/implementation/mcp.d.ts +39 -2
- package/types/apps/src/implementation/openapi-compile.d.ts +119 -0
- package/types/apps/src/implementation/openapi-document.d.ts +51 -0
- package/types/apps/src/implementation/openapi-names.d.ts +18 -0
- package/types/apps/src/implementation/openapi-request.d.ts +10 -4
- package/types/apps/src/implementation/openapi-source.d.ts +40 -0
- package/types/apps/src/implementation/openapi.d.ts +39 -3
- package/types/apps/src/implementation/provider-error.d.ts +10 -0
- package/types/apps/src/implementation/schema.d.ts +6 -5
- package/types/apps/src/implementation/skill-files.d.ts +10 -0
- package/types/apps/src/implementation/skills.d.ts +43 -0
- package/types/apps/src/implementation/swagger-client.d.ts +28 -0
- package/types/apps/src/index.d.ts +7 -0
- package/types/apps/src/mcp.d.ts +5 -5
- package/types/apps/src/openapi.d.ts +3 -1
- package/types/apps/src/skills.d.ts +75 -0
- package/types/telemetry/src/config.d.ts +2 -0
- package/js/chunk-22WRQZT7.js +0 -389
- package/js/chunk-MLKGABMK.js +0 -9
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
fromWeb,
|
|
5
5
|
layerMergedContext,
|
|
6
6
|
make2 as make
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QKHR7BMF.js";
|
|
8
8
|
import {
|
|
9
9
|
Reference,
|
|
10
10
|
Service,
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
succeed4 as succeed,
|
|
18
18
|
toReadableStreamEffect,
|
|
19
19
|
tryPromise
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-FW5HBOIK.js";
|
|
21
21
|
import {
|
|
22
22
|
__export
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-CZ7CSFO4.js";
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@
|
|
25
|
+
// ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/http/FetchHttpClient.js
|
|
26
26
|
var FetchHttpClient_exports = {};
|
|
27
27
|
__export(FetchHttpClient_exports, {
|
|
28
28
|
Fetch: () => Fetch,
|
|
@@ -2,54 +2,71 @@ import {
|
|
|
2
2
|
adaptMcpTools,
|
|
3
3
|
mcpClient,
|
|
4
4
|
mcpJsonSchemaValidator
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RN2MXB4R.js";
|
|
6
|
+
import {
|
|
7
|
+
accountProviderError,
|
|
8
|
+
httpProviderError
|
|
9
|
+
} from "./chunk-ZJWDMTE3.js";
|
|
6
10
|
import {
|
|
7
11
|
McpError,
|
|
8
12
|
McpToolsOptions,
|
|
9
13
|
defaultMcpClientLimits
|
|
10
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MYYEW3RA.js";
|
|
15
|
+
import {
|
|
16
|
+
ProviderError
|
|
17
|
+
} from "./chunk-W7D7WVSY.js";
|
|
11
18
|
import {
|
|
12
19
|
captureTelemetry
|
|
13
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZCAMUXSG.js";
|
|
14
21
|
import {
|
|
15
22
|
FetchHttpClient_exports
|
|
16
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-HDJH3RPR.js";
|
|
17
24
|
import {
|
|
18
25
|
HttpClientRequest_exports,
|
|
19
26
|
HttpClient_exports
|
|
20
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-QKHR7BMF.js";
|
|
21
28
|
import {
|
|
29
|
+
Deferred_exports,
|
|
22
30
|
Effect_exports,
|
|
23
31
|
Redacted_exports,
|
|
24
32
|
Schema_exports,
|
|
25
33
|
Stream_exports
|
|
26
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-FW5HBOIK.js";
|
|
27
35
|
|
|
28
36
|
// src/implementation/mcp.ts
|
|
29
37
|
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
30
38
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
31
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
ErrorCode,
|
|
41
|
+
McpError as ProtocolError,
|
|
42
|
+
ToolListChangedNotificationSchema
|
|
43
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
32
44
|
import { SSEClientTransport, SseError } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
33
45
|
import {
|
|
34
46
|
StreamableHTTPClientTransport,
|
|
35
47
|
StreamableHTTPError
|
|
36
48
|
} from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
37
49
|
var failure = (phase, error) => {
|
|
50
|
+
if (Schema_exports.is(ProviderError)(error) || Schema_exports.is(McpError)(error)) return error;
|
|
38
51
|
const status = error instanceof UnauthorizedError ? 401 : error instanceof StreamableHTTPError || error instanceof SseError ? error.code : void 0;
|
|
52
|
+
const provider = status === void 0 ? void 0 : httpProviderError(status);
|
|
53
|
+
if (provider !== void 0) return provider;
|
|
39
54
|
return new McpError({
|
|
40
55
|
phase,
|
|
41
|
-
reason: error instanceof ProtocolError && error.code === ErrorCode.RequestTimeout ? "timeout" :
|
|
56
|
+
reason: error instanceof ProtocolError && error.code === ErrorCode.RequestTimeout ? "timeout" : "request",
|
|
42
57
|
...status === void 0 ? {} : { status }
|
|
43
58
|
});
|
|
44
59
|
};
|
|
45
|
-
var transportFetch = (connection, telemetry) => (url, init) => Effect_exports.runPromiseWith(telemetry.context)(
|
|
60
|
+
var transportFetch = (connection, telemetry, rejected) => (url, init) => Effect_exports.runPromiseWith(telemetry.context)(
|
|
46
61
|
Effect_exports.gen(function* () {
|
|
47
62
|
const target = yield* Effect_exports.try({
|
|
48
63
|
try: () => new URL(url),
|
|
49
|
-
catch: () =>
|
|
64
|
+
catch: () => new McpError({ phase: "transport", reason: "invalid_response" })
|
|
50
65
|
});
|
|
66
|
+
if (connection.url.username || connection.url.password)
|
|
67
|
+
return yield* new McpError({ phase: "transport", reason: "invalid_input" });
|
|
51
68
|
if (target.origin !== connection.url.origin || target.username || target.password)
|
|
52
|
-
return yield*
|
|
69
|
+
return yield* new McpError({ phase: "transport", reason: "invalid_response" });
|
|
53
70
|
const headers = new Headers(Redacted_exports.value(connection.headers));
|
|
54
71
|
new Headers(init?.headers).forEach((value, name) => headers.set(name, value));
|
|
55
72
|
const request = yield* Effect_exports.try({
|
|
@@ -58,6 +75,11 @@ var transportFetch = (connection, telemetry) => (url, init) => Effect_exports.ru
|
|
|
58
75
|
});
|
|
59
76
|
const client = yield* HttpClient_exports.HttpClient;
|
|
60
77
|
const response = yield* client.execute(request);
|
|
78
|
+
const provider = httpProviderError(response.status, response.headers);
|
|
79
|
+
if (provider !== void 0) {
|
|
80
|
+
yield* Deferred_exports.fail(rejected, provider);
|
|
81
|
+
return yield* provider;
|
|
82
|
+
}
|
|
61
83
|
return new Response(
|
|
62
84
|
[204, 205, 304].includes(response.status) ? null : Stream_exports.toReadableStream(response.stream),
|
|
63
85
|
{
|
|
@@ -78,25 +100,40 @@ var transportFetch = (connection, telemetry) => (url, init) => Effect_exports.ru
|
|
|
78
100
|
])
|
|
79
101
|
})
|
|
80
102
|
),
|
|
81
|
-
Effect_exports.mapError(() => failure("transport",
|
|
103
|
+
Effect_exports.mapError((error) => failure("transport", error))
|
|
82
104
|
),
|
|
83
105
|
init?.signal ? { signal: init.signal } : {}
|
|
84
106
|
);
|
|
85
|
-
function withClient(connection, mode, use) {
|
|
107
|
+
function withClient(connection, mode, use, changed) {
|
|
86
108
|
const attempt = (kind) => Effect_exports.scoped(
|
|
87
109
|
Effect_exports.gen(function* () {
|
|
88
110
|
const telemetry = yield* captureTelemetry;
|
|
111
|
+
const rejected = yield* Deferred_exports.make();
|
|
112
|
+
const pending = /* @__PURE__ */ new Set();
|
|
89
113
|
const { client, transport } = yield* Effect_exports.acquireRelease(
|
|
90
114
|
Effect_exports.sync(() => {
|
|
91
|
-
const fetch = transportFetch(connection, telemetry);
|
|
115
|
+
const fetch = transportFetch(connection, telemetry, rejected);
|
|
116
|
+
const client2 = new Client(
|
|
117
|
+
{ name: "executor-apps", version: "0.1.0" },
|
|
118
|
+
{
|
|
119
|
+
jsonSchemaValidator: mcpJsonSchemaValidator,
|
|
120
|
+
capabilities: mode === "call" ? { elicitation: { form: {} } } : {}
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
if (changed !== void 0) {
|
|
124
|
+
client2.setNotificationHandler(ToolListChangedNotificationSchema, () => {
|
|
125
|
+
const task = Effect_exports.runPromiseWith(telemetry.context)(
|
|
126
|
+
changed.pipe(
|
|
127
|
+
Effect_exports.timeout("5 seconds"),
|
|
128
|
+
Effect_exports.catchCause(() => Effect_exports.logWarning("MCP catalog invalidation failed"))
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
pending.add(task);
|
|
132
|
+
return task.finally(() => pending.delete(task));
|
|
133
|
+
});
|
|
134
|
+
}
|
|
92
135
|
return {
|
|
93
|
-
client:
|
|
94
|
-
{ name: "executor-apps", version: "0.1.0" },
|
|
95
|
-
{
|
|
96
|
-
jsonSchemaValidator: mcpJsonSchemaValidator,
|
|
97
|
-
capabilities: mode === "call" ? { elicitation: { form: {} } } : {}
|
|
98
|
-
}
|
|
99
|
-
),
|
|
136
|
+
client: client2,
|
|
100
137
|
transport: kind === "http" ? new StreamableHTTPClientTransport(connection.url, {
|
|
101
138
|
fetch,
|
|
102
139
|
reconnectionOptions: {
|
|
@@ -109,6 +146,10 @@ function withClient(connection, mode, use) {
|
|
|
109
146
|
};
|
|
110
147
|
}),
|
|
111
148
|
({ client: client2, transport: transport2 }) => Effect_exports.gen(function* () {
|
|
149
|
+
client2.removeNotificationHandler("notifications/tools/list_changed");
|
|
150
|
+
yield* Effect_exports.promise(async () => {
|
|
151
|
+
await Promise.allSettled(pending);
|
|
152
|
+
});
|
|
112
153
|
if (transport2 instanceof StreamableHTTPClientTransport && transport2.sessionId !== void 0) {
|
|
113
154
|
yield* Effect_exports.tryPromise(() => transport2.terminateSession()).pipe(
|
|
114
155
|
Effect_exports.timeout(defaultMcpClientLimits.cleanupTimeoutMs),
|
|
@@ -125,8 +166,12 @@ function withClient(connection, mode, use) {
|
|
|
125
166
|
yield* Effect_exports.tryPromise({
|
|
126
167
|
try: (signal) => client.connect(wire, { signal, timeout: connection.timeoutMs }),
|
|
127
168
|
catch: (error) => failure("connect", error)
|
|
128
|
-
}).pipe(
|
|
129
|
-
|
|
169
|
+
}).pipe(
|
|
170
|
+
Effect_exports.raceFirst(Deferred_exports.await(rejected)),
|
|
171
|
+
Effect_exports.timeout(connection.timeoutMs),
|
|
172
|
+
Effect_exports.withSpan("provider.mcp.connect")
|
|
173
|
+
);
|
|
174
|
+
return yield* use(client).pipe(Effect_exports.raceFirst(Deferred_exports.await(rejected)));
|
|
130
175
|
})
|
|
131
176
|
).pipe(
|
|
132
177
|
Effect_exports.withSpan("provider.mcp.session", {
|
|
@@ -149,7 +194,7 @@ function withClient(connection, mode, use) {
|
|
|
149
194
|
)
|
|
150
195
|
);
|
|
151
196
|
}
|
|
152
|
-
var
|
|
197
|
+
var mcpClientEffect = (input, changed) => Effect_exports.gen(function* () {
|
|
153
198
|
const options = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)(input).pipe(
|
|
154
199
|
Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" }))
|
|
155
200
|
);
|
|
@@ -161,11 +206,19 @@ var mcpToolsEffect = (input) => Effect_exports.gen(function* () {
|
|
|
161
206
|
headers: Redacted_exports.make({ ...options.headers }),
|
|
162
207
|
timeoutMs: options.timeoutMs ?? defaultMcpClientLimits.timeoutMs
|
|
163
208
|
};
|
|
164
|
-
return
|
|
165
|
-
|
|
209
|
+
return mcpClient(
|
|
210
|
+
(mode, use) => withClient(connection, mode, use, changed).pipe(
|
|
211
|
+
Effect_exports.mapError(
|
|
212
|
+
(error) => options.accountId === void 0 ? error : accountProviderError(error, options.accountId)
|
|
213
|
+
)
|
|
214
|
+
),
|
|
215
|
+
connection.timeoutMs,
|
|
216
|
+
failure
|
|
166
217
|
);
|
|
167
218
|
});
|
|
219
|
+
var mcpToolsEffect = (input) => mcpClientEffect(input).pipe(Effect_exports.flatMap(adaptMcpTools));
|
|
168
220
|
|
|
169
221
|
export {
|
|
222
|
+
mcpClientEffect,
|
|
170
223
|
mcpToolsEffect
|
|
171
224
|
};
|