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.
Files changed (66) hide show
  1. package/README.md +65 -43
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-FWQC6I3C.js → chunk-5T57N25Q.js} +13 -1
  4. package/js/{chunk-TDNYXSIX.js → chunk-72JNVHPK.js} +21 -9
  5. package/js/{chunk-UDDE5KOR.js → chunk-CMYUWAX7.js} +26 -7
  6. package/js/chunk-FL2QR3XW.js +507 -0
  7. package/js/{chunk-G7T27IWB.js → chunk-MKWZPDR6.js} +1 -1
  8. package/js/{chunk-CYYBFC2K.js → chunk-NKLWZJLE.js} +1 -1
  9. package/js/{chunk-67EVWIGJ.js → chunk-OCYUEU47.js} +4 -4
  10. package/js/{chunk-YEPYT6SD.js → chunk-R3EV5FTO.js} +12 -0
  11. package/js/{chunk-XHO2ZX6W.js → chunk-RFVIONFX.js} +27 -10
  12. package/js/{chunk-LUVSFETN.js → chunk-UESPOTUI.js} +127 -231
  13. package/js/{chunk-DQAZTA4I.js → chunk-WLE7WX2U.js} +290 -20
  14. package/js/{chunk-C3VAOK5B.js → chunk-YXQHV65J.js} +53 -26
  15. package/js/chunk-Z5M2LQOZ.js +209 -0
  16. package/js/client.js +1 -1
  17. package/js/contracts.js +34 -11
  18. package/js/effect.js +9 -11
  19. package/js/graphql.js +25 -32
  20. package/js/host.js +9 -11
  21. package/js/index.js +194 -192
  22. package/js/mcp/effect.js +11 -13
  23. package/js/mcp/stdio.js +15 -17
  24. package/js/mcp.js +50 -36
  25. package/js/openapi.js +166 -108
  26. package/js/skills.js +6 -7
  27. package/package.json +1 -1
  28. package/runtime.json +1 -1
  29. package/types/apps/src/contracts/app.d.ts +2 -5
  30. package/types/apps/src/contracts/host.d.ts +19 -7
  31. package/types/apps/src/contracts/mcp.d.ts +16 -0
  32. package/types/apps/src/contracts/openapi.d.ts +4 -0
  33. package/types/apps/src/contracts/operations.d.ts +0 -5
  34. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  35. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  36. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  37. package/types/apps/src/contracts/provider.d.ts +51 -5
  38. package/types/apps/src/contracts/router.d.ts +59 -0
  39. package/types/apps/src/graphql.d.ts +1 -3
  40. package/types/apps/src/implementation/account-router.d.ts +12 -0
  41. package/types/apps/src/implementation/app.d.ts +5 -4
  42. package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
  43. package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
  44. package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
  45. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  46. package/types/apps/src/implementation/mcp.d.ts +35 -19
  47. package/types/apps/src/implementation/openapi-compile.d.ts +2 -1
  48. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  49. package/types/apps/src/implementation/operations.d.ts +26 -3
  50. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  51. package/types/apps/src/implementation/provider.d.ts +9 -4
  52. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  53. package/types/apps/src/implementation/router.d.ts +59 -0
  54. package/types/apps/src/implementation/schema.d.ts +5 -1
  55. package/types/apps/src/implementation/workflow-context.d.ts +1 -1
  56. package/types/apps/src/index.d.ts +5 -4
  57. package/types/apps/src/mcp-stdio.d.ts +2 -5
  58. package/types/apps/src/mcp.d.ts +5 -4
  59. package/types/apps/src/openapi.d.ts +6 -6
  60. package/js/chunk-3XKZDQLM.js +0 -93
  61. package/js/chunk-4M277YTM.js +0 -136
  62. package/js/chunk-SB3V4YVR.js +0 -18
  63. package/js/chunk-W4DMKWAB.js +0 -35
  64. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  65. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  66. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
package/js/mcp.js CHANGED
@@ -1,42 +1,42 @@
1
1
  import {
2
2
  mcpClientEffect
3
- } from "./chunk-67EVWIGJ.js";
3
+ } from "./chunk-OCYUEU47.js";
4
4
  import {
5
5
  catalogCache
6
- } from "./chunk-XHO2ZX6W.js";
6
+ } from "./chunk-RFVIONFX.js";
7
7
  import {
8
8
  adaptMcpTool
9
- } from "./chunk-UDDE5KOR.js";
9
+ } from "./chunk-CMYUWAX7.js";
10
10
  import {
11
11
  protocolOperations
12
- } from "./chunk-TDNYXSIX.js";
12
+ } from "./chunk-72JNVHPK.js";
13
13
  import "./chunk-BCSNKUAC.js";
14
- import "./chunk-LUVSFETN.js";
14
+ import "./chunk-UESPOTUI.js";
15
15
  import {
16
16
  cacheKey
17
- } from "./chunk-CYYBFC2K.js";
17
+ } from "./chunk-NKLWZJLE.js";
18
+ import "./chunk-FL2QR3XW.js";
18
19
  import "./chunk-IPI4MFSN.js";
19
- import "./chunk-4M277YTM.js";
20
- import "./chunk-C3VAOK5B.js";
20
+ import "./chunk-YXQHV65J.js";
21
21
  import "./chunk-ZQINWV4W.js";
22
22
  import {
23
- nativeOperation
24
- } from "./chunk-3XKZDQLM.js";
25
- import "./chunk-G7T27IWB.js";
23
+ nativeOperation,
24
+ routerDeclaration
25
+ } from "./chunk-Z5M2LQOZ.js";
26
+ import "./chunk-MKWZPDR6.js";
26
27
  import {
27
28
  McpError,
29
+ McpServerHeader,
28
30
  McpToolMetadata,
29
31
  McpToolsOptions
30
- } from "./chunk-DQAZTA4I.js";
32
+ } from "./chunk-WLE7WX2U.js";
31
33
  import "./chunk-N7YDVXYJ.js";
32
- import "./chunk-YEPYT6SD.js";
34
+ import "./chunk-R3EV5FTO.js";
33
35
  import "./chunk-JU7VHODU.js";
34
- import "./chunk-W4DMKWAB.js";
35
- import "./chunk-SB3V4YVR.js";
36
36
  import "./chunk-RJDDBDSN.js";
37
37
  import "./chunk-57RKNWL2.js";
38
38
  import "./chunk-UK573G7W.js";
39
- import "./chunk-FWQC6I3C.js";
39
+ import "./chunk-5T57N25Q.js";
40
40
  import "./chunk-PZB6T6KU.js";
41
41
  import "./chunk-27F7W2LG.js";
42
42
  import {
@@ -50,6 +50,15 @@ var McpToolSummary = McpToolMetadata.mapFields(
50
50
  ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
51
51
  );
52
52
  var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
53
+ var serverMeta = (server) => {
54
+ const title = server.title ?? server.name;
55
+ return {
56
+ ...title === void 0 ? {} : { title },
57
+ ...server.description === void 0 ? {} : { description: server.description },
58
+ ...server.instructions === void 0 ? {} : { instructions: server.instructions },
59
+ ...server.icons === void 0 ? {} : { icons: server.icons }
60
+ };
61
+ };
53
62
  var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
54
63
  const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)(options).pipe(
55
64
  Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" }))
@@ -59,27 +68,32 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
59
68
  headers[name] = value;
60
69
  });
61
70
  const id = yield* cacheKey({ url: parsed.url, headers, accountId: parsed.accountId ?? null });
62
- const key = ["mcp-catalog-v2", id, "current"];
71
+ const key = ["mcp-catalog-v3", id, "current"];
63
72
  const cache = options.cache;
64
73
  const changed = cache === void 0 ? void 0 : invoke(() => cache.invalidate(key));
65
74
  const client = yield* mcpClientEffect(options, changed);
66
75
  const catalog = yield* catalogCache({
67
76
  ...options,
68
- prefix: ["mcp-catalog-v2", id],
77
+ prefix: ["mcp-catalog-v3", id],
69
78
  schema: McpToolMetadata,
70
79
  summary: {
71
80
  schema: McpToolSummary,
72
81
  of: ({ inputSchema: _input, outputSchema: _output, _meta, ...summary }) => summary
73
82
  },
74
- load: (context) => context === void 0 ? client.list : mcpClientEffect(
83
+ load: (context) => (context === void 0 ? client.list : mcpClientEffect(
75
84
  { ...parsed, signal: context.signal },
76
85
  invoke(() => context.cache.invalidate(key))
77
- ).pipe(Effect_exports.flatMap((source) => source.list))
86
+ ).pipe(Effect_exports.flatMap((source) => source.list))).pipe(
87
+ Effect_exports.flatMap(
88
+ ({ tools, server }) => Schema_exports.encodeEffect(McpServerHeader)(server).pipe(
89
+ Effect_exports.map((header) => ({ tools, header }))
90
+ )
91
+ )
92
+ )
78
93
  });
79
94
  const kindOf = (tool) => Object.hasOwn(kinds, tool.name) ? kinds[tool.name] ?? "mutation" : tool.annotations?.readOnlyHint === true ? "query" : "mutation";
80
- const qualified = (tool) => `${kindOf(tool) === "query" ? "queries" : "mutations"}.${tool.name}`;
81
95
  const summarize = (tool) => ({
82
- name: qualified(tool),
96
+ name: tool.name,
83
97
  description: tool.description ?? tool.title ?? tool.name,
84
98
  readOnly: kindOf(tool) === "query",
85
99
  ...tool.title === void 0 ? {} : { title: tool.title },
@@ -91,34 +105,34 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
91
105
  ...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
92
106
  ...tool._meta === void 0 ? {} : { _meta: tool._meta }
93
107
  });
94
- const selected = (name) => Effect_exports.gen(function* () {
95
- if (!name.startsWith("queries.") && !name.startsWith("mutations.")) return void 0;
96
- const tool = yield* catalog.resolve(name.slice(name.indexOf(".") + 1));
97
- return tool === void 0 || qualified(tool) !== name ? void 0 : tool;
98
- });
99
- const dynamicTools = {
108
+ const router = {
109
+ kind: "dynamic",
110
+ meta: () => catalog.header().pipe(
111
+ Effect_exports.flatMap(
112
+ (header) => header === void 0 ? Effect_exports.succeed({}) : Schema_exports.decodeUnknownEffect(McpServerHeader)(header)
113
+ ),
114
+ Effect_exports.map(serverMeta)
115
+ ),
100
116
  list: () => catalog.list().pipe(Effect_exports.map((tools) => tools.map(describe))),
101
117
  summaries: () => catalog.summaries().pipe(Effect_exports.map((tools) => tools.map(summarize))),
102
- describe: (name) => selected(name).pipe(
103
- Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))
104
- ),
118
+ describe: (name) => catalog.resolve(name).pipe(Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))),
105
119
  resolve: (name) => Effect_exports.gen(function* () {
106
- const tool = yield* selected(name);
120
+ const tool = yield* catalog.resolve(name);
107
121
  if (tool === void 0) return void 0;
108
122
  const adapted = yield* adaptMcpTool(client, tool);
109
123
  const operations = protocolOperations({ selected: adapted }, { selected: kindOf(tool) });
110
- return nativeOperation(operations.queries.selected ?? operations.mutations.selected);
124
+ return nativeOperation(operations.selected);
111
125
  })
112
126
  };
113
- return { dynamicTools };
127
+ return routerDeclaration(router);
114
128
  });
115
129
 
116
130
  // src/mcp.ts
117
- var mcpOperations = (options, kinds = {}) => Effect_exports.runPromise(
131
+ var mcpRouter = (options, kinds = {}) => Effect_exports.runPromise(
118
132
  mcpCatalog(options, kinds),
119
133
  options.signal === void 0 ? {} : { signal: options.signal }
120
134
  );
121
135
  export {
122
136
  McpError,
123
- mcpOperations
137
+ mcpRouter
124
138
  };
package/js/openapi.js CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  parse
3
3
  } from "./chunk-UVL56Z6E.js";
4
4
  import {
5
- protocolOperations
6
- } from "./chunk-TDNYXSIX.js";
5
+ protocolOperations,
6
+ protocolRouter
7
+ } from "./chunk-72JNVHPK.js";
7
8
  import {
8
9
  OpenapiError,
9
10
  OpenapiErrorResponse,
@@ -16,25 +17,30 @@ import {
16
17
  isOpenapiTextMedia,
17
18
  openapiBinaryResultSchema,
18
19
  openapiMediaKind
19
- } from "./chunk-4M277YTM.js";
20
+ } from "./chunk-FL2QR3XW.js";
21
+ import "./chunk-IPI4MFSN.js";
20
22
  import {
21
23
  fromPromise,
22
24
  nativeOperation,
25
+ routerDeclaration,
23
26
  toPromise
24
- } from "./chunk-3XKZDQLM.js";
27
+ } from "./chunk-Z5M2LQOZ.js";
25
28
  import {
26
29
  accountProviderError,
27
30
  httpProviderError
28
- } from "./chunk-G7T27IWB.js";
31
+ } from "./chunk-MKWZPDR6.js";
29
32
  import {
30
33
  ApiErrorRecovery,
31
34
  ApiErrorResponse,
32
35
  OpenapiResponseError,
36
+ RouterMeta,
33
37
  defaultOpenapiErrorLimits
34
- } from "./chunk-W4DMKWAB.js";
38
+ } from "./chunk-WLE7WX2U.js";
39
+ import "./chunk-N7YDVXYJ.js";
35
40
  import {
36
41
  ProviderError
37
- } from "./chunk-SB3V4YVR.js";
42
+ } from "./chunk-R3EV5FTO.js";
43
+ import "./chunk-JU7VHODU.js";
38
44
  import {
39
45
  FetchHttpClient_exports
40
46
  } from "./chunk-57RKNWL2.js";
@@ -47,12 +53,14 @@ import {
47
53
  lazyJsonSchemaDecoder,
48
54
  once,
49
55
  wrap
50
- } from "./chunk-FWQC6I3C.js";
56
+ } from "./chunk-5T57N25Q.js";
57
+ import "./chunk-PZB6T6KU.js";
51
58
  import {
52
59
  JsonObject,
53
60
  JsonValue
54
61
  } from "./chunk-27F7W2LG.js";
55
62
  import {
63
+ Deferred_exports,
56
64
  Duration_exports,
57
65
  Effect_exports,
58
66
  Encoding_exports,
@@ -2392,8 +2400,10 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => Effect_expo
2392
2400
  if (!path.startsWith("/") || path.includes("?") || path.includes("#"))
2393
2401
  fail2("operation_path", "An operation has an invalid API path.");
2394
2402
  const operationMethods = [];
2395
- const operation = Schema_exports.decodeUnknownSync(Operation)(
2396
- document.resolve(record2(item[method.toLowerCase()]))
2403
+ const resolved2 = document.resolve(record2(item[method.toLowerCase()]));
2404
+ const operation = Schema_exports.decodeUnknownSync(Operation)(resolved2);
2405
+ const tags = Option_exports.getOrUndefined(
2406
+ Schema_exports.decodeUnknownOption(Schema_exports.Array(Schema_exports.NonEmptyString))(resolved2.tags)
2397
2407
  );
2398
2408
  const name = names[index] ?? fail2("operation_path", "An operation has no name.");
2399
2409
  if (built.some((op) => op.operation.name === name))
@@ -2539,6 +2549,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => Effect_expo
2539
2549
  methods: operationMethods,
2540
2550
  operation: {
2541
2551
  ...streaming ? { streaming: true } : {},
2552
+ ...tags === void 0 || tags.length === 0 ? {} : { tags },
2542
2553
  name,
2543
2554
  ...operation.operationId === void 0 ? {} : { operationId: operation.operationId },
2544
2555
  description: operation.summary ?? operation.description ?? name,
@@ -2648,7 +2659,43 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => Effect_expo
2648
2659
  });
2649
2660
 
2650
2661
  // src/implementation/openapi-source.ts
2651
- var Manifest = Schema_exports.Struct({ revision: Schema_exports.String, pages: Schema_exports.Number });
2662
+ var Manifest = Schema_exports.Struct({
2663
+ revision: Schema_exports.String,
2664
+ pages: Schema_exports.Number,
2665
+ meta: Schema_exports.optionalKey(RouterMeta)
2666
+ });
2667
+ var DocumentInfo = Schema_exports.Struct({
2668
+ info: Schema_exports.optionalKey(
2669
+ Schema_exports.Struct({
2670
+ title: Schema_exports.optionalKey(Schema_exports.String),
2671
+ summary: Schema_exports.optionalKey(Schema_exports.String),
2672
+ description: Schema_exports.optionalKey(Schema_exports.String)
2673
+ })
2674
+ ),
2675
+ tags: Schema_exports.optionalKey(
2676
+ Schema_exports.Array(
2677
+ Schema_exports.Struct({
2678
+ name: Schema_exports.NonEmptyString,
2679
+ description: Schema_exports.optionalKey(Schema_exports.String)
2680
+ })
2681
+ )
2682
+ )
2683
+ });
2684
+ var documentMeta = (document) => {
2685
+ const parsed = Schema_exports.decodeUnknownOption(DocumentInfo)(document);
2686
+ if (Option_exports.isNone(parsed)) return void 0;
2687
+ const { info, tags } = parsed.value;
2688
+ const description = info?.description ?? info?.summary;
2689
+ const labels = (tags ?? []).flatMap(
2690
+ (tag) => tag.description === void 0 ? [] : [[tag.name, tag.description]]
2691
+ );
2692
+ const meta = {
2693
+ ...info?.title === void 0 ? {} : { title: info.title },
2694
+ ...description === void 0 ? {} : { description },
2695
+ ...labels.length === 0 ? {} : { tags: Object.fromEntries(labels) }
2696
+ };
2697
+ return Object.keys(meta).length === 0 ? void 0 : meta;
2698
+ };
2652
2699
  var Names = Schema_exports.Array(Schema_exports.String);
2653
2700
  var StoredEntry = Schema_exports.fromJsonString(Schema_exports.Struct({ value: JsonValue }));
2654
2701
  var schema = (decoder) => wrap(decoder, false);
@@ -2763,7 +2810,7 @@ var download = (url, context) => Effect_exports.gen(function* () {
2763
2810
  catch: invalid
2764
2811
  });
2765
2812
  });
2766
- var liveOpenapiOperations = (options) => {
2813
+ var liveOpenapiRouter = (options) => {
2767
2814
  const freshFor = options.freshFor ?? "5 minutes";
2768
2815
  const staleFor = options.staleFor ?? "1 day";
2769
2816
  const retention = Duration_exports.toMillis(Duration_exports.fromInputUnsafe(freshFor)) + Duration_exports.toMillis(Duration_exports.fromInputUnsafe(staleFor)) + 3e5;
@@ -2872,17 +2919,31 @@ var liveOpenapiOperations = (options) => {
2872
2919
  }
2873
2920
  );
2874
2921
  retain(revision, retained, retainedBytes);
2875
- return { revision, pages };
2922
+ const meta = documentMeta(document);
2923
+ return { revision, pages, ...meta === void 0 ? {} : { meta } };
2876
2924
  });
2877
- const current = Effect_exports.gen(function* () {
2878
- const key = yield* pointer;
2879
- return yield* fromPromise(options.cache.get)({
2880
- key,
2881
- schema: schema(Manifest),
2882
- freshFor,
2883
- staleFor,
2884
- load: toPromise(refresh)
2885
- });
2925
+ let reading;
2926
+ const current = Effect_exports.suspend(() => {
2927
+ const shared = reading;
2928
+ if (shared !== void 0) return Deferred_exports.await(shared);
2929
+ const deferred = Deferred_exports.makeUnsafe();
2930
+ reading = deferred;
2931
+ return pointer.pipe(
2932
+ Effect_exports.flatMap(
2933
+ (key) => fromPromise(options.cache.get)({
2934
+ key,
2935
+ schema: schema(Manifest),
2936
+ freshFor,
2937
+ staleFor,
2938
+ load: toPromise(refresh)
2939
+ })
2940
+ ),
2941
+ Effect_exports.onExit(
2942
+ (exit) => Effect_exports.sync(() => {
2943
+ if (reading === deferred) reading = void 0;
2944
+ }).pipe(Effect_exports.andThen(Deferred_exports.done(deferred, exit)))
2945
+ )
2946
+ );
2886
2947
  });
2887
2948
  const read = (revision, kind, names, decoder) => {
2888
2949
  const retained = stored.get(revision);
@@ -2949,7 +3010,7 @@ var liveOpenapiOperations = (options) => {
2949
3010
  const kinds = options.kinds ?? {};
2950
3011
  return Object.hasOwn(kinds, key) ? kinds[key] ?? "mutation" : ["GET", "HEAD", "OPTIONS"].includes(op.method) ? "query" : "mutation";
2951
3012
  };
2952
- const qualified = (op) => `${kindOf(op) === "query" ? "queries" : "mutations"}.${op.name}`;
3013
+ const readOnly = (op) => kindOf(op) === "query";
2953
3014
  const operationsFor = (manifest) => Effect_exports.gen(function* () {
2954
3015
  const names = yield* namesFor(manifest);
2955
3016
  if (names === void 0) return void 0;
@@ -2970,10 +3031,12 @@ var liveOpenapiOperations = (options) => {
2970
3031
  }
2971
3032
  return all;
2972
3033
  });
2973
- const summarize = (operation) => {
2974
- const name = qualified(operation);
2975
- return { name, description: operation.description, readOnly: name.startsWith("queries.") };
2976
- };
3034
+ const summarize = (operation) => ({
3035
+ name: operation.name,
3036
+ description: operation.description,
3037
+ readOnly: readOnly(operation),
3038
+ ...operation.tags === void 0 ? {} : { tags: operation.tags }
3039
+ });
2977
3040
  const describe = (operation, bundle) => ({
2978
3041
  ...summarize(operation),
2979
3042
  inputSchema: bundle(parameterDefaultsInput(operation, options.parameterDefaults, true)),
@@ -2987,88 +3050,83 @@ var liveOpenapiOperations = (options) => {
2987
3050
  }
2988
3051
  return yield* invalid();
2989
3052
  });
2990
- return {
2991
- queries: {},
2992
- mutations: {},
2993
- dynamicTools: {
2994
- resolve: (name) => withRevision(
2995
- (manifest) => Effect_exports.gen(function* () {
2996
- const raw = name.replace(/^(queries|mutations)\./, "");
2997
- const memoKey = `${manifest.revision}/${defaultedNames}/${raw}`;
2998
- const memo = resolved.get(memoKey);
2999
- const operation = memo?.operation ?? (yield* read(manifest.revision, "operation", [raw], OpenapiOperation))[0];
3000
- if (operation === void 0) {
3001
- const names = yield* namesFor(manifest);
3002
- return names === void 0 || names.includes(raw) ? void 0 : { value: void 0 };
3003
- }
3004
- if (qualified(operation) !== name) return { value: void 0 };
3005
- const definitions = memo?.definitions ?? (yield* definitionsFor(manifest.revision, operation));
3006
- if (definitions === void 0) return void 0;
3007
- const schemas = memo?.schemas ?? (yield* prepareOpenapiOperation(operation, definitions, options.parameterDefaults));
3008
- if (memo === void 0) remember(memoKey, { operation, definitions, schemas });
3009
- const tools = yield* openapiToolsEffect(
3010
- { ...options, operations: [operation], definitions },
3011
- /* @__PURE__ */ new Map([[operation.name, schemas]])
3012
- );
3013
- const declarations = protocolOperations(tools, {
3014
- [operation.name]: kindOf(operation)
3015
- });
3016
- const declaration = declarations.queries[raw] ?? declarations.mutations[raw];
3017
- return { value: declaration === void 0 ? void 0 : nativeOperation(declaration) };
3018
- })
3019
- ),
3020
- list: () => withRevision(
3021
- (manifest) => Effect_exports.gen(function* () {
3022
- const all = yield* operationsFor(manifest);
3023
- if (all === void 0) return void 0;
3024
- const definitions = yield* definitionsFor(manifest.revision, all);
3025
- if (definitions === void 0) return void 0;
3026
- const bundle = bundler(definitions);
3027
- const request = createRequest(options);
3028
- return {
3029
- value: all.filter((op) => request.available(op, options.account)).map((operation) => describe(operation, bundle))
3030
- };
3031
- })
3032
- ),
3033
- summaries: () => withRevision(
3034
- (manifest) => Effect_exports.gen(function* () {
3035
- const all = yield* operationsFor(manifest);
3036
- if (all === void 0) return void 0;
3037
- const request = createRequest(options);
3038
- return {
3039
- value: all.filter((op) => request.available(op, options.account)).map((operation) => summarize(operation))
3040
- };
3041
- })
3042
- ),
3043
- describe: (name) => withRevision(
3044
- (manifest) => Effect_exports.gen(function* () {
3045
- const raw = name.replace(/^(queries|mutations)\./, "");
3046
- const operation = (yield* read(
3047
- manifest.revision,
3048
- "operation",
3049
- [raw],
3050
- OpenapiOperation
3051
- ))[0];
3052
- if (operation === void 0) {
3053
- const names = yield* namesFor(manifest);
3054
- return names === void 0 || names.includes(raw) ? void 0 : { value: void 0 };
3055
- }
3056
- if (qualified(operation) !== name || !createRequest(options).available(operation, options.account))
3057
- return { value: void 0 };
3058
- const definitions = yield* definitionsFor(manifest.revision, operation);
3059
- if (definitions === void 0) return void 0;
3060
- return { value: describe(operation, bundler(definitions)) };
3061
- })
3062
- )
3063
- }
3064
- };
3053
+ return routerDeclaration({
3054
+ kind: "dynamic",
3055
+ meta: () => current.pipe(Effect_exports.map((manifest) => manifest.meta ?? {})),
3056
+ resolve: (name) => withRevision(
3057
+ (manifest) => Effect_exports.gen(function* () {
3058
+ const raw = name;
3059
+ const memoKey = `${manifest.revision}/${defaultedNames}/${raw}`;
3060
+ const memo = resolved.get(memoKey);
3061
+ const operation = memo?.operation ?? (yield* read(manifest.revision, "operation", [raw], OpenapiOperation))[0];
3062
+ if (operation === void 0) {
3063
+ const names = yield* namesFor(manifest);
3064
+ return names === void 0 || names.includes(raw) ? void 0 : { value: void 0 };
3065
+ }
3066
+ const definitions = memo?.definitions ?? (yield* definitionsFor(manifest.revision, operation));
3067
+ if (definitions === void 0) return void 0;
3068
+ const schemas = memo?.schemas ?? (yield* prepareOpenapiOperation(operation, definitions, options.parameterDefaults));
3069
+ if (memo === void 0) remember(memoKey, { operation, definitions, schemas });
3070
+ const tools = yield* openapiToolsEffect(
3071
+ { ...options, operations: [operation], definitions },
3072
+ /* @__PURE__ */ new Map([[operation.name, schemas]])
3073
+ );
3074
+ const declarations = protocolOperations(tools, {
3075
+ [operation.name]: kindOf(operation)
3076
+ });
3077
+ const declaration = Object.hasOwn(declarations, raw) ? declarations[raw] : void 0;
3078
+ return { value: declaration === void 0 ? void 0 : nativeOperation(declaration) };
3079
+ })
3080
+ ),
3081
+ list: () => withRevision(
3082
+ (manifest) => Effect_exports.gen(function* () {
3083
+ const all = yield* operationsFor(manifest);
3084
+ if (all === void 0) return void 0;
3085
+ const definitions = yield* definitionsFor(manifest.revision, all);
3086
+ if (definitions === void 0) return void 0;
3087
+ const bundle = bundler(definitions);
3088
+ const request = createRequest(options);
3089
+ return {
3090
+ value: all.filter((op) => request.available(op, options.account)).map((operation) => describe(operation, bundle))
3091
+ };
3092
+ })
3093
+ ),
3094
+ summaries: () => withRevision(
3095
+ (manifest) => Effect_exports.gen(function* () {
3096
+ const all = yield* operationsFor(manifest);
3097
+ if (all === void 0) return void 0;
3098
+ const request = createRequest(options);
3099
+ return {
3100
+ value: all.filter((op) => request.available(op, options.account)).map((operation) => summarize(operation))
3101
+ };
3102
+ })
3103
+ ),
3104
+ describe: (name) => withRevision(
3105
+ (manifest) => Effect_exports.gen(function* () {
3106
+ const raw = name;
3107
+ const operation = (yield* read(
3108
+ manifest.revision,
3109
+ "operation",
3110
+ [raw],
3111
+ OpenapiOperation
3112
+ ))[0];
3113
+ if (operation === void 0) {
3114
+ const names = yield* namesFor(manifest);
3115
+ return names === void 0 || names.includes(raw) ? void 0 : { value: void 0 };
3116
+ }
3117
+ if (!createRequest(options).available(operation, options.account))
3118
+ return { value: void 0 };
3119
+ const definitions = yield* definitionsFor(manifest.revision, operation);
3120
+ if (definitions === void 0) return void 0;
3121
+ return { value: describe(operation, bundler(definitions)) };
3122
+ })
3123
+ )
3124
+ });
3065
3125
  };
3066
3126
 
3067
3127
  // src/openapi.ts
3068
- var openapiOperations = (options, kinds = {}) => Effect_exports.runPromise(
3069
- openapiToolsEffect(options).pipe(
3070
- Effect_exports.map((operations) => protocolOperations(operations, kinds))
3071
- ),
3128
+ var openapiRouter = (options, kinds = {}) => Effect_exports.runPromise(
3129
+ openapiToolsEffect(options).pipe(Effect_exports.map((operations) => protocolRouter(operations, kinds))),
3072
3130
  options.signal === void 0 ? {} : { signal: options.signal }
3073
3131
  );
3074
3132
  export {
@@ -3079,8 +3137,8 @@ export {
3079
3137
  OpenapiParameter,
3080
3138
  OpenapiRequestBody,
3081
3139
  isOpenapiTextMedia,
3082
- liveOpenapiOperations,
3140
+ liveOpenapiRouter,
3083
3141
  openapiBinaryResultSchema,
3084
3142
  openapiMediaKind,
3085
- openapiOperations
3143
+ openapiRouter
3086
3144
  };
package/js/skills.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  catalogCache
3
- } from "./chunk-XHO2ZX6W.js";
4
- import "./chunk-CYYBFC2K.js";
3
+ } from "./chunk-RFVIONFX.js";
4
+ import "./chunk-NKLWZJLE.js";
5
5
  import {
6
6
  folderSkillsEffect,
7
7
  skillFromFiles
8
8
  } from "./chunk-IPI4MFSN.js";
9
9
  import {
10
10
  httpProviderError
11
- } from "./chunk-G7T27IWB.js";
12
- import "./chunk-YEPYT6SD.js";
11
+ } from "./chunk-MKWZPDR6.js";
12
+ import "./chunk-R3EV5FTO.js";
13
13
  import {
14
14
  AppSkillMetadata,
15
15
  AppSkillSource,
@@ -20,7 +20,6 @@ import {
20
20
  SkillServiceName,
21
21
  skillLoadLimits
22
22
  } from "./chunk-JU7VHODU.js";
23
- import "./chunk-SB3V4YVR.js";
24
23
  import {
25
24
  FetchHttpClient_exports
26
25
  } from "./chunk-57RKNWL2.js";
@@ -30,7 +29,7 @@ import {
30
29
  } from "./chunk-UK573G7W.js";
31
30
  import {
32
31
  wrap
33
- } from "./chunk-FWQC6I3C.js";
32
+ } from "./chunk-5T57N25Q.js";
34
33
  import "./chunk-27F7W2LG.js";
35
34
  import {
36
35
  Effect_exports,
@@ -759,7 +758,7 @@ var cachedCatalog = (options, prefix, load) => options.cache === void 0 ? load(o
759
758
  prefix,
760
759
  schema: AppSkillSource,
761
760
  summary: { schema: AppSkillMetadata, of: ({ files: _files, ...metadata }) => metadata },
762
- load: (context) => context === void 0 ? load(options, options.cache) : load({ fetch: options.fetch, signal: context.signal }, context.cache)
761
+ load: (context) => (context === void 0 ? load(options, options.cache) : load({ fetch: options.fetch, signal: context.signal }, context.cache)).pipe(Effect_exports.map((tools) => ({ tools })))
763
762
  }).pipe(
764
763
  Effect_exports.flatMap((catalog) => catalog.list()),
765
764
  Effect_exports.mapError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.5",
3
+ "version": "0.0.1-beta.7",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,