apps 0.0.1-beta.5 → 0.0.1-beta.7
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-TDNYXSIX.js → chunk-72JNVHPK.js} +21 -9
- package/js/{chunk-UDDE5KOR.js → chunk-CMYUWAX7.js} +26 -7
- package/js/chunk-FL2QR3XW.js +507 -0
- package/js/{chunk-G7T27IWB.js → chunk-MKWZPDR6.js} +1 -1
- package/js/{chunk-CYYBFC2K.js → chunk-NKLWZJLE.js} +1 -1
- package/js/{chunk-67EVWIGJ.js → chunk-OCYUEU47.js} +4 -4
- 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-UESPOTUI.js} +127 -231
- package/js/{chunk-DQAZTA4I.js → chunk-WLE7WX2U.js} +290 -20
- package/js/{chunk-C3VAOK5B.js → chunk-YXQHV65J.js} +53 -26
- package/js/chunk-Z5M2LQOZ.js +209 -0
- package/js/client.js +1 -1
- package/js/contracts.js +34 -11
- package/js/effect.js +9 -11
- package/js/graphql.js +25 -32
- package/js/host.js +9 -11
- package/js/index.js +194 -192
- 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 +19 -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/protocols/5.d.ts +1090 -0
- package/types/apps/src/contracts/provider.d.ts +51 -5
- 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/provider.d.ts +9 -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 +5 -4
- 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
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
adaptMcpTools,
|
|
3
3
|
mcpClient,
|
|
4
4
|
mcpJsonSchemaValidator
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CMYUWAX7.js";
|
|
6
6
|
import {
|
|
7
7
|
accountProviderError,
|
|
8
8
|
httpProviderError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MKWZPDR6.js";
|
|
10
10
|
import {
|
|
11
11
|
McpError,
|
|
12
12
|
McpToolsOptions,
|
|
13
13
|
defaultMcpClientLimits
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WLE7WX2U.js";
|
|
15
15
|
import {
|
|
16
16
|
ProviderError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-R3EV5FTO.js";
|
|
18
18
|
import {
|
|
19
19
|
captureTelemetry
|
|
20
20
|
} from "./chunk-RJDDBDSN.js";
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountId
|
|
3
|
+
} from "./chunk-27F7W2LG.js";
|
|
1
4
|
import {
|
|
2
5
|
Schema_exports
|
|
3
6
|
} from "./chunk-CDL5PM2Q.js";
|
|
4
7
|
|
|
8
|
+
// src/contracts/provider-error.ts
|
|
9
|
+
var ProviderError = class extends Schema_exports.TaggedError()("ProviderError", {
|
|
10
|
+
reason: Schema_exports.Literals(["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]),
|
|
11
|
+
status: Schema_exports.optional(Schema_exports.Int.check(Schema_exports.isBetween({ minimum: 100, maximum: 599 }))),
|
|
12
|
+
accountId: Schema_exports.optional(AccountId)
|
|
13
|
+
}) {
|
|
14
|
+
};
|
|
15
|
+
|
|
5
16
|
// ../app-cache/src/contracts/cache.ts
|
|
6
17
|
var CacheError = class extends Schema_exports.TaggedError()("CacheError", {
|
|
7
18
|
reason: Schema_exports.Literals(["unavailable", "storage", "invalid", "capacity", "timeout"])
|
|
@@ -76,6 +87,7 @@ var CacheReply = Schema_exports.Union([
|
|
|
76
87
|
]);
|
|
77
88
|
|
|
78
89
|
export {
|
|
90
|
+
ProviderError,
|
|
79
91
|
CacheError,
|
|
80
92
|
cacheLimits,
|
|
81
93
|
CacheEntry,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CacheError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R3EV5FTO.js";
|
|
4
4
|
import {
|
|
5
5
|
wrap
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5T57N25Q.js";
|
|
7
7
|
import {
|
|
8
8
|
JsonObject
|
|
9
9
|
} from "./chunk-27F7W2LG.js";
|
|
@@ -18,7 +18,8 @@ var schema = (decoder) => wrap(decoder, false);
|
|
|
18
18
|
var Manifest = Schema_exports.Struct({
|
|
19
19
|
revision: Schema_exports.String,
|
|
20
20
|
pages: Schema_exports.Int,
|
|
21
|
-
summaries: Schema_exports.Int
|
|
21
|
+
summaries: Schema_exports.Int,
|
|
22
|
+
header: Schema_exports.optionalKey(JsonObject)
|
|
22
23
|
});
|
|
23
24
|
var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
|
|
24
25
|
var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
@@ -35,9 +36,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
35
36
|
const retention = Duration_exports.toMillis(Duration_exports.fromInputUnsafe(freshFor)) + Duration_exports.toMillis(Duration_exports.fromInputUnsafe(staleFor)) + 3e5;
|
|
36
37
|
const local = yield* Effect_exports.cached(options.load());
|
|
37
38
|
const refresh = (context) => Effect_exports.gen(function* () {
|
|
38
|
-
const tools = yield* options.load(context);
|
|
39
|
+
const { tools, header } = yield* options.load(context);
|
|
39
40
|
const digest = yield* invoke(
|
|
40
|
-
() => crypto.subtle.digest(
|
|
41
|
+
() => crypto.subtle.digest(
|
|
42
|
+
"SHA-256",
|
|
43
|
+
new TextEncoder().encode(JSON.stringify({ tools, header: header ?? null }))
|
|
44
|
+
)
|
|
41
45
|
);
|
|
42
46
|
const revision = Array.from(
|
|
43
47
|
new Uint8Array(digest),
|
|
@@ -104,7 +108,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
104
108
|
yield* pageOut();
|
|
105
109
|
yield* summaryOut();
|
|
106
110
|
yield* flush();
|
|
107
|
-
return {
|
|
111
|
+
return {
|
|
112
|
+
revision,
|
|
113
|
+
pages: pages2,
|
|
114
|
+
summaries,
|
|
115
|
+
...header === void 0 ? {} : { header: yield* json(header) }
|
|
116
|
+
};
|
|
108
117
|
});
|
|
109
118
|
const getOptions = {
|
|
110
119
|
key,
|
|
@@ -113,7 +122,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
113
122
|
staleFor,
|
|
114
123
|
load: (context) => Effect_exports.runPromise(refresh(context), { signal: context.signal })
|
|
115
124
|
};
|
|
116
|
-
|
|
125
|
+
let reading;
|
|
126
|
+
const current = () => cache === void 0 ? Effect_exports.fail(new CacheError({ reason: "unavailable" })) : invoke(
|
|
127
|
+
() => reading ??= cache.get(getOptions).finally(() => {
|
|
128
|
+
reading = void 0;
|
|
129
|
+
})
|
|
130
|
+
);
|
|
117
131
|
if (options.revalidate) {
|
|
118
132
|
if (cache === void 0) yield* local;
|
|
119
133
|
else yield* invoke(() => cache.revalidate(getOptions));
|
|
@@ -140,14 +154,17 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
140
154
|
return values;
|
|
141
155
|
});
|
|
142
156
|
const metadata = () => Effect_exports.gen(function* () {
|
|
143
|
-
if (cache === void 0) return yield* local;
|
|
157
|
+
if (cache === void 0) return (yield* local).tools;
|
|
144
158
|
const manifest = yield* current();
|
|
145
159
|
return yield* pages(cache, manifest.revision, "page", manifest.pages, options.schema);
|
|
146
160
|
});
|
|
147
161
|
return {
|
|
148
162
|
list: metadata,
|
|
163
|
+
/** The record stored with the current revision, if the source supplied one. */
|
|
164
|
+
header: () => cache === void 0 ? local.pipe(Effect_exports.map(({ header }) => header)) : current().pipe(Effect_exports.map((manifest) => manifest.header)),
|
|
149
165
|
summaries: () => Effect_exports.gen(function* () {
|
|
150
|
-
if (cache === void 0)
|
|
166
|
+
if (cache === void 0)
|
|
167
|
+
return (yield* local).tools.map((tool) => options.summary.of(tool));
|
|
151
168
|
const manifest = yield* current();
|
|
152
169
|
return yield* pages(
|
|
153
170
|
cache,
|
|
@@ -157,7 +174,7 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
157
174
|
options.summary.schema
|
|
158
175
|
);
|
|
159
176
|
}),
|
|
160
|
-
resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map((tools) => tools.find((tool) => tool.name === name))) : current().pipe(
|
|
177
|
+
resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map(({ tools }) => tools.find((tool) => tool.name === name))) : current().pipe(
|
|
161
178
|
Effect_exports.flatMap(
|
|
162
179
|
(manifest) => invoke(
|
|
163
180
|
() => cache.read(part(manifest.revision, "tool", name), schema(options.schema))
|