apps 0.0.1-beta.19 → 0.0.1-beta.20

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.
@@ -14,6 +14,13 @@ import {
14
14
  } from "./chunk-CDL5PM2Q.js";
15
15
 
16
16
  // src/implementation/catalog-cache.ts
17
+ var catalogScope = (options, invalid) => {
18
+ const { account, cache, headers } = options;
19
+ if (account === void 0)
20
+ return headers === void 0 ? Effect_exports.succeed(cache) : Effect_exports.fail(invalid());
21
+ if (cache === void 0) return Effect_exports.succeed(void 0);
22
+ return Effect_exports.try({ try: () => cache.forAccount(account), catch: invalid });
23
+ };
17
24
  var schema = (decoder) => wrap(decoder, false);
18
25
  var Manifest = Schema_exports.Struct({
19
26
  revision: Schema_exports.String,
@@ -185,5 +192,6 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
185
192
  });
186
193
 
187
194
  export {
195
+ catalogScope,
188
196
  catalogCache
189
197
  };
package/js/graphql.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
- catalogCache
3
- } from "./chunk-4EMWIFFJ.js";
2
+ catalogCache,
3
+ catalogScope
4
+ } from "./chunk-OZ4UK3CD.js";
4
5
  import {
5
6
  protocolOperations
6
7
  } from "./chunk-HQY4UTYX.js";
@@ -429,17 +430,20 @@ var GraphqlToolSummary = GraphqlToolDefinition.mapFields(({ name, kind, descript
429
430
  description
430
431
  }));
431
432
  var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
432
- const parsed = yield* Schema_exports.decodeUnknownEffect(GraphqlToolsOptions)(options).pipe(
433
- Effect_exports.mapError(() => new GraphqlError({ phase: "discover", reason: "invalid_input" }))
434
- );
435
- const headers = {};
436
- new Headers(parsed.headers).forEach((value, name) => {
437
- headers[name] = value;
438
- });
439
- const id = yield* cacheKey({ url: parsed.url, headers, accountId: parsed.accountId ?? null });
433
+ const invalid = () => new GraphqlError({ phase: "discover", reason: "invalid_input" });
434
+ const parsed = yield* Schema_exports.decodeUnknownEffect(GraphqlToolsOptions)({
435
+ url: options.url,
436
+ accountId: options.account?.id,
437
+ headers: options.headers,
438
+ signal: options.signal,
439
+ timeoutMs: options.timeoutMs
440
+ }).pipe(Effect_exports.mapError(invalid));
441
+ const cache = yield* catalogScope(options, invalid);
442
+ const id = yield* cacheKey({ url: parsed.url });
440
443
  const client = yield* graphqlClientEffect(parsed);
441
444
  const catalog = yield* catalogCache({
442
445
  ...options,
446
+ cache,
443
447
  prefix: ["graphql-catalog-v2", id],
444
448
  schema: GraphqlToolDefinition,
445
449
  summary: {
package/js/mcp.js CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  mcpClientEffect
3
3
  } from "./chunk-MAF4BRQF.js";
4
4
  import {
5
- catalogCache
6
- } from "./chunk-4EMWIFFJ.js";
5
+ catalogCache,
6
+ catalogScope
7
+ } from "./chunk-OZ4UK3CD.js";
7
8
  import {
8
9
  adaptMcpTool
9
10
  } from "./chunk-7H44SOSX.js";
@@ -60,20 +61,22 @@ var serverMeta = (server) => {
60
61
  };
61
62
  };
62
63
  var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
63
- const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)(options).pipe(
64
- Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" }))
65
- );
66
- const headers = {};
67
- new Headers(parsed.headers).forEach((value, name) => {
68
- headers[name] = value;
69
- });
70
- const id = yield* cacheKey({ url: parsed.url, headers, accountId: parsed.accountId ?? null });
64
+ const invalid = () => new McpError({ phase: "connect", reason: "invalid_input" });
65
+ const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)({
66
+ url: options.url,
67
+ accountId: options.account?.id,
68
+ headers: options.headers,
69
+ signal: options.signal,
70
+ timeoutMs: options.timeoutMs
71
+ }).pipe(Effect_exports.mapError(invalid));
72
+ const cache = yield* catalogScope(options, invalid);
73
+ const id = yield* cacheKey({ url: parsed.url });
71
74
  const key = ["mcp-catalog-v3", id, "current"];
72
- const cache = options.cache;
73
75
  const changed = cache === void 0 ? void 0 : invoke(() => cache.invalidate(key));
74
- const client = yield* mcpClientEffect(options, changed);
76
+ const client = yield* mcpClientEffect(parsed, changed);
75
77
  const catalog = yield* catalogCache({
76
78
  ...options,
79
+ cache,
77
80
  prefix: ["mcp-catalog-v3", id],
78
81
  schema: McpToolMetadata,
79
82
  summary: {
package/js/skills.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  catalogCache
3
- } from "./chunk-4EMWIFFJ.js";
3
+ } from "./chunk-OZ4UK3CD.js";
4
4
  import "./chunk-NKLWZJLE.js";
5
5
  import {
6
6
  folderSkillsEffect,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.19",
3
+ "version": "0.0.1-beta.20",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,