apps 0.0.1-beta.4 → 0.0.1-beta.41

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 (171) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
  4. package/js/{chunk-EQB7JMAL.js → chunk-6XGB4BAL.js} +146 -31
  5. package/js/chunk-ADD6H64X.js +729 -0
  6. package/js/{chunk-6VRYO2BG.js → chunk-AHGGO2VY.js} +837 -254
  7. package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
  8. package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
  9. package/js/chunk-EM4UL26F.js +118 -0
  10. package/js/{chunk-2VPJHFOU.js → chunk-FXWRE655.js} +128 -24
  11. package/js/{chunk-5MQZEB6Y.js → chunk-JI3EP2GL.js} +40 -12
  12. package/js/chunk-JJSLEJ6T.js +156 -0
  13. package/js/chunk-KAQD3DTI.js +16 -0
  14. package/js/chunk-KIM5HXNK.js +49 -0
  15. package/js/chunk-MJZYV7IO.js +255 -0
  16. package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
  17. package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
  18. package/js/chunk-OD3KFKZD.js +1617 -0
  19. package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
  20. package/js/chunk-P7MGDPFD.js +240 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
  22. package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
  23. package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
  24. package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
  25. package/js/chunk-UTJIGUSS.js +42 -0
  26. package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
  27. package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
  28. package/js/{chunk-WFSQXYUT.js → chunk-WPBR4AWB.js} +523 -63
  29. package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
  30. package/js/chunk-ZUKBIHMK.js +92 -0
  31. package/js/client.js +122 -88
  32. package/js/contracts.js +116 -25
  33. package/js/effect.js +19 -20
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +57 -55
  36. package/js/host.js +19 -20
  37. package/js/index.js +245 -212
  38. package/js/mcp/effect.js +23 -22
  39. package/js/mcp/stdio.js +34 -30
  40. package/js/mcp.js +104 -68
  41. package/js/openapi.js +4087 -1503
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +147 -65
  45. package/js/storage/facet.js +1 -540
  46. package/js/ui/auth/contracts.js +2 -2
  47. package/js/ui/auth.js +5 -5
  48. package/js/ui/contracts.js +5 -4
  49. package/js/ui/serving.js +8517 -214
  50. package/package.json +2 -3
  51. package/runtime.json +1 -1
  52. package/types/app-data/src/contracts/database.d.ts +33 -6
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +7 -8
  55. package/types/apps/src/contracts/cache.d.ts +14 -0
  56. package/types/apps/src/contracts/context.d.ts +12 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +44 -17
  61. package/types/apps/src/contracts/live.d.ts +2 -0
  62. package/types/apps/src/contracts/mcp.d.ts +96 -10
  63. package/types/apps/src/contracts/network.d.ts +84 -0
  64. package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
  65. package/types/apps/src/contracts/openapi.d.ts +45 -9
  66. package/types/apps/src/contracts/operations.d.ts +8 -9
  67. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  68. package/types/apps/src/contracts/protocols/1.d.ts +263 -74
  69. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  70. package/types/apps/src/contracts/protocols/2.d.ts +66 -24
  71. package/types/apps/src/contracts/protocols/3.d.ts +715 -0
  72. package/types/apps/src/contracts/protocols/4.d.ts +1297 -0
  73. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  74. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  75. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  76. package/types/apps/src/contracts/protocols/8.d.ts +1130 -0
  77. package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
  78. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  79. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  80. package/types/apps/src/contracts/provider.d.ts +115 -10
  81. package/types/apps/src/contracts/router.d.ts +59 -0
  82. package/types/apps/src/contracts/skills.d.ts +39 -9
  83. package/types/apps/src/contracts/sql.d.ts +58 -0
  84. package/types/apps/src/contracts/ui.d.ts +19 -1
  85. package/types/apps/src/contracts/workflows.d.ts +40 -3
  86. package/types/apps/src/facet.d.ts +4 -5
  87. package/types/apps/src/graphql.d.ts +1 -3
  88. package/types/apps/src/implementation/account-router.d.ts +12 -0
  89. package/types/apps/src/implementation/app.d.ts +5 -4
  90. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  91. package/types/apps/src/implementation/catalog-cache.d.ts +32 -5
  92. package/types/apps/src/implementation/elicitation.d.ts +12 -12
  93. package/types/apps/src/implementation/failure-detail.d.ts +47 -0
  94. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  95. package/types/apps/src/implementation/graphql.d.ts +4 -3
  96. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  97. package/types/apps/src/implementation/live.d.ts +2 -2
  98. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  99. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  100. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  101. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  102. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  103. package/types/apps/src/implementation/mcp.d.ts +52 -25
  104. package/types/apps/src/implementation/network.d.ts +16 -0
  105. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  106. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  107. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  108. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  109. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  110. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  111. package/types/apps/src/implementation/operations.d.ts +36 -3
  112. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  113. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  114. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  115. package/types/apps/src/implementation/provider.d.ts +19 -5
  116. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  117. package/types/apps/src/implementation/router-catalog.d.ts +223 -0
  118. package/types/apps/src/implementation/router.d.ts +68 -0
  119. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  120. package/types/apps/src/implementation/schema.d.ts +95 -11
  121. package/types/apps/src/implementation/skills.d.ts +18 -24
  122. package/types/apps/src/implementation/sql.d.ts +66 -0
  123. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  125. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  126. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  127. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  128. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  129. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  130. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  131. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  132. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  133. package/types/apps/src/index.d.ts +30 -13
  134. package/types/apps/src/mcp-stdio.d.ts +2 -5
  135. package/types/apps/src/mcp.d.ts +25 -5
  136. package/types/apps/src/openapi.d.ts +6 -6
  137. package/types/apps/src/react.d.ts +1 -1
  138. package/types/apps/src/skills.d.ts +10 -8
  139. package/types/telemetry/src/app-records.d.ts +42 -0
  140. package/types/telemetry/src/browser-operations.d.ts +6 -3
  141. package/types/telemetry/src/browser.d.ts +2 -2
  142. package/types/telemetry/src/config.d.ts +2 -2
  143. package/types/telemetry/src/layer.d.ts +2 -2
  144. package/types/telemetry/src/recorded-failure.d.ts +20 -0
  145. package/types/telemetry/src/relay.d.ts +2 -2
  146. package/types/telemetry/src/transport.d.ts +8 -1
  147. package/types/utils/src/api-error.d.ts +53 -0
  148. package/types/utils/src/recorded-message.d.ts +15 -0
  149. package/js/chunk-BMOIAIVR.js +0 -138
  150. package/js/chunk-DHUDODG5.js +0 -213
  151. package/js/chunk-FZJOYIZO.js +0 -19
  152. package/js/chunk-LGIYBDWA.js +0 -85
  153. package/js/chunk-M6ZRRIBI.js +0 -877
  154. package/js/chunk-PLCMJREA.js +0 -590
  155. package/js/chunk-PYUYJRSK.js +0 -93
  156. package/js/chunk-SWPD52J7.js +0 -35
  157. package/js/chunk-W7D7WVSY.js +0 -18
  158. package/js/chunk-Z5NMEGJN.js +0 -29
  159. package/js/chunk-ZJWDMTE3.js +0 -63
  160. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  161. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  162. package/types/app-data/src/implementation/promise.d.ts +0 -68
  163. package/types/app-data/src/implementation/range.d.ts +0 -8
  164. package/types/app-data/src/implementation/schema.d.ts +0 -33
  165. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  166. package/types/app-data/src/index.d.ts +0 -4
  167. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  168. package/types/apps/src/contracts/storage.d.ts +0 -68
  169. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  170. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  171. package/types/apps/src/implementation/storage.d.ts +0 -13
package/js/mcp/stdio.js CHANGED
@@ -1,38 +1,38 @@
1
1
  import {
2
2
  adaptMcpTools,
3
+ answeredError,
3
4
  mcpClient,
4
5
  mcpJsonSchemaValidator
5
- } from "../chunk-2VPJHFOU.js";
6
+ } from "../chunk-FXWRE655.js";
6
7
  import {
7
- protocolOperations
8
- } from "../chunk-Z5NMEGJN.js";
8
+ protocolRouter
9
+ } from "../chunk-UTJIGUSS.js";
9
10
  import "../chunk-BCSNKUAC.js";
10
- import "../chunk-6VRYO2BG.js";
11
- import "../chunk-D47C7KG5.js";
12
- import "../chunk-FDNTX5QJ.js";
13
- import "../chunk-DHUDODG5.js";
14
- import "../chunk-PLCMJREA.js";
15
- import "../chunk-PYUYJRSK.js";
16
- import "../chunk-ZJWDMTE3.js";
11
+ import "../chunk-AHGGO2VY.js";
12
+ import "../chunk-RIXVGVA6.js";
13
+ import "../chunk-ADD6H64X.js";
14
+ import "../chunk-KIM5HXNK.js";
15
+ import "../chunk-CQD3WSYH.js";
16
+ import "../chunk-JJSLEJ6T.js";
17
+ import "../chunk-MJZYV7IO.js";
18
+ import "../chunk-EM4UL26F.js";
17
19
  import {
18
20
  McpError,
19
21
  ProcessConfig
20
- } from "../chunk-3M2MEDNL.js";
21
- import "../chunk-BMOIAIVR.js";
22
- import "../chunk-LGIYBDWA.js";
23
- import "../chunk-YEJOQEII.js";
24
- import "../chunk-SWPD52J7.js";
25
- import "../chunk-W7D7WVSY.js";
26
- import "../chunk-ZCAMUXSG.js";
27
- import "../chunk-HDJH3RPR.js";
28
- import "../chunk-QKHR7BMF.js";
29
- import "../chunk-WFSQXYUT.js";
30
- import "../chunk-FZJOYIZO.js";
31
- import "../chunk-SATWJKN6.js";
22
+ } from "../chunk-OTCLXFLL.js";
23
+ import "../chunk-P7MGDPFD.js";
24
+ import "../chunk-UOZMSUJ2.js";
25
+ import "../chunk-PNVCCB4L.js";
26
+ import "../chunk-VJQXXOQ3.js";
27
+ import "../chunk-WPBR4AWB.js";
28
+ import "../chunk-KAQD3DTI.js";
29
+ import "../chunk-YQ35E7KS.js";
30
+ import "../chunk-VIU2XXA7.js";
31
+ import "../chunk-3MMG2H6M.js";
32
32
  import {
33
33
  Effect_exports,
34
34
  Schema_exports
35
- } from "../chunk-FW5HBOIK.js";
35
+ } from "../chunk-MXDKXAY4.js";
36
36
  import "../chunk-CZ7CSFO4.js";
37
37
 
38
38
  // src/implementation/mcp-stdio.ts
@@ -60,10 +60,14 @@ var OwnedTransport = class extends StdioClientTransport {
60
60
  })();
61
61
  }
62
62
  };
63
- var failure = (phase, error) => new McpError({
64
- phase,
65
- reason: error instanceof ProtocolError && error.code === ErrorCode.RequestTimeout ? "timeout" : "request"
66
- });
63
+ var failure = (phase, error) => {
64
+ const upstream = answeredError(error);
65
+ return new McpError({
66
+ phase,
67
+ reason: error instanceof ProtocolError && error.code === ErrorCode.RequestTimeout ? "timeout" : "request",
68
+ ...upstream === void 0 ? {} : { upstream }
69
+ });
70
+ };
67
71
  function withClient(config, mode, use) {
68
72
  return Effect_exports.scoped(
69
73
  Effect_exports.gen(function* () {
@@ -119,11 +123,11 @@ var stdioToolsEffect = (input) => Effect_exports.gen(function* () {
119
123
  });
120
124
 
121
125
  // src/mcp-stdio.ts
122
- var stdioOperations = (config, signal, kinds = {}) => Effect_exports.runPromise(
123
- stdioToolsEffect(config).pipe(Effect_exports.map((tools) => protocolOperations(tools, kinds))),
126
+ var stdioRouter = (config, signal, kinds = {}) => Effect_exports.runPromise(
127
+ stdioToolsEffect(config).pipe(Effect_exports.map((tools) => protocolRouter(tools, kinds))),
124
128
  signal === void 0 ? {} : { signal }
125
129
  );
126
130
  export {
127
131
  McpError,
128
- stdioOperations
132
+ stdioRouter
129
133
  };
package/js/mcp.js CHANGED
@@ -1,47 +1,53 @@
1
1
  import {
2
- mcpClientEffect
3
- } from "./chunk-EQB7JMAL.js";
2
+ mcpClientEffect,
3
+ mcpHealthEffect
4
+ } from "./chunk-6XGB4BAL.js";
4
5
  import {
5
- catalogCache
6
- } from "./chunk-5MQZEB6Y.js";
6
+ catalogCache,
7
+ catalogScope
8
+ } from "./chunk-JI3EP2GL.js";
7
9
  import {
8
10
  adaptMcpTool
9
- } from "./chunk-2VPJHFOU.js";
11
+ } from "./chunk-FXWRE655.js";
10
12
  import {
11
13
  protocolOperations
12
- } from "./chunk-Z5NMEGJN.js";
14
+ } from "./chunk-UTJIGUSS.js";
13
15
  import "./chunk-BCSNKUAC.js";
14
- import "./chunk-6VRYO2BG.js";
16
+ import "./chunk-AHGGO2VY.js";
15
17
  import {
16
18
  cacheKey
17
- } from "./chunk-D47C7KG5.js";
18
- import "./chunk-FDNTX5QJ.js";
19
- import "./chunk-DHUDODG5.js";
20
- import "./chunk-PLCMJREA.js";
19
+ } from "./chunk-RIXVGVA6.js";
21
20
  import {
22
- nativeOperation
23
- } from "./chunk-PYUYJRSK.js";
24
- import "./chunk-ZJWDMTE3.js";
21
+ operationDescription
22
+ } from "./chunk-ADD6H64X.js";
23
+ import "./chunk-KIM5HXNK.js";
24
+ import "./chunk-CQD3WSYH.js";
25
+ import "./chunk-JJSLEJ6T.js";
25
26
  import {
27
+ nativeOperation,
28
+ routerDeclaration
29
+ } from "./chunk-MJZYV7IO.js";
30
+ import "./chunk-EM4UL26F.js";
31
+ import {
32
+ McpCredentialsUnverified,
26
33
  McpError,
34
+ McpServerHeader,
27
35
  McpToolMetadata,
28
36
  McpToolsOptions
29
- } from "./chunk-3M2MEDNL.js";
30
- import "./chunk-BMOIAIVR.js";
31
- import "./chunk-LGIYBDWA.js";
32
- import "./chunk-YEJOQEII.js";
33
- import "./chunk-SWPD52J7.js";
34
- import "./chunk-W7D7WVSY.js";
35
- import "./chunk-ZCAMUXSG.js";
36
- import "./chunk-HDJH3RPR.js";
37
- import "./chunk-QKHR7BMF.js";
38
- import "./chunk-WFSQXYUT.js";
39
- import "./chunk-FZJOYIZO.js";
40
- import "./chunk-SATWJKN6.js";
37
+ } from "./chunk-OTCLXFLL.js";
38
+ import "./chunk-P7MGDPFD.js";
39
+ import "./chunk-UOZMSUJ2.js";
40
+ import "./chunk-PNVCCB4L.js";
41
+ import "./chunk-VJQXXOQ3.js";
42
+ import "./chunk-WPBR4AWB.js";
43
+ import "./chunk-KAQD3DTI.js";
44
+ import "./chunk-YQ35E7KS.js";
45
+ import "./chunk-VIU2XXA7.js";
46
+ import "./chunk-3MMG2H6M.js";
41
47
  import {
42
48
  Effect_exports,
43
49
  Schema_exports
44
- } from "./chunk-FW5HBOIK.js";
50
+ } from "./chunk-MXDKXAY4.js";
45
51
  import "./chunk-CZ7CSFO4.js";
46
52
 
47
53
  // src/implementation/mcp-catalog.ts
@@ -49,75 +55,105 @@ var McpToolSummary = McpToolMetadata.mapFields(
49
55
  ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
50
56
  );
51
57
  var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
58
+ var serverMeta = (server) => {
59
+ const title = server.title ?? server.name;
60
+ return {
61
+ ...title === void 0 ? {} : { title },
62
+ ...server.description === void 0 ? {} : { description: server.description },
63
+ ...server.instructions === void 0 ? {} : { instructions: server.instructions },
64
+ ...server.icons === void 0 ? {} : { icons: server.icons }
65
+ };
66
+ };
52
67
  var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
53
- const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)(options).pipe(
54
- Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" }))
55
- );
56
- const headers = {};
57
- new Headers(parsed.headers).forEach((value, name) => {
58
- headers[name] = value;
59
- });
60
- const id = yield* cacheKey({ url: parsed.url, headers, accountId: parsed.accountId ?? null });
61
- const key = ["mcp-catalog-v2", id, "current"];
62
- const cache = options.cache;
68
+ const invalid = () => new McpError({ phase: "connect", reason: "invalid_input" });
69
+ const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)({
70
+ url: options.url,
71
+ accountId: options.account?.id,
72
+ headers: options.headers,
73
+ signal: options.signal,
74
+ timeoutMs: options.timeoutMs
75
+ }).pipe(Effect_exports.mapError(invalid));
76
+ const cache = yield* catalogScope(options, options.headers, invalid);
77
+ const id = yield* cacheKey({ url: parsed.url });
78
+ const key = ["mcp-catalog-v3", id, "current"];
63
79
  const changed = cache === void 0 ? void 0 : invoke(() => cache.invalidate(key));
64
- const client = yield* mcpClientEffect(options, changed);
80
+ const client = yield* mcpClientEffect(parsed, changed);
65
81
  const catalog = yield* catalogCache({
66
82
  ...options,
67
- prefix: ["mcp-catalog-v2", id],
83
+ cache,
84
+ prefix: ["mcp-catalog-v3", id],
68
85
  schema: McpToolMetadata,
69
86
  summary: {
70
87
  schema: McpToolSummary,
71
88
  of: ({ inputSchema: _input, outputSchema: _output, _meta, ...summary }) => summary
72
89
  },
73
- load: (context) => context === void 0 ? client.list : mcpClientEffect(
90
+ load: (context) => (context === void 0 ? client.list : mcpClientEffect(
74
91
  { ...parsed, signal: context.signal },
75
92
  invoke(() => context.cache.invalidate(key))
76
- ).pipe(Effect_exports.flatMap((source) => source.list))
93
+ ).pipe(Effect_exports.flatMap((source) => source.list))).pipe(
94
+ Effect_exports.flatMap(
95
+ ({ tools, server }) => Schema_exports.encodeEffect(McpServerHeader)(server).pipe(
96
+ Effect_exports.map((header) => ({ tools, header }))
97
+ )
98
+ )
99
+ )
77
100
  });
78
101
  const kindOf = (tool) => Object.hasOwn(kinds, tool.name) ? kinds[tool.name] ?? "mutation" : tool.annotations?.readOnlyHint === true ? "query" : "mutation";
79
- const qualified = (tool) => `${kindOf(tool) === "query" ? "queries" : "mutations"}.${tool.name}`;
80
102
  const summarize = (tool) => ({
81
- name: qualified(tool),
103
+ name: tool.name,
82
104
  description: tool.description ?? tool.title ?? tool.name,
83
105
  readOnly: kindOf(tool) === "query",
84
106
  ...tool.title === void 0 ? {} : { title: tool.title },
85
107
  annotations: { ...tool.annotations, readOnlyHint: kindOf(tool) === "query" }
86
108
  });
87
- const describe = (tool) => ({
88
- ...summarize(tool),
89
- inputSchema: tool.inputSchema,
90
- ...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
91
- ...tool._meta === void 0 ? {} : { _meta: tool._meta }
92
- });
93
- const selected = (name) => Effect_exports.gen(function* () {
94
- if (!name.startsWith("queries.") && !name.startsWith("mutations.")) return void 0;
95
- const tool = yield* catalog.resolve(name.slice(name.indexOf(".") + 1));
96
- return tool === void 0 || qualified(tool) !== name ? void 0 : tool;
97
- });
98
- const dynamicTools = {
99
- list: () => catalog.list().pipe(Effect_exports.map((tools) => tools.map(describe))),
109
+ const operation = (tool) => adaptMcpTool(client, tool).pipe(
110
+ Effect_exports.map(
111
+ (adapted) => nativeOperation(
112
+ protocolOperations({ selected: adapted }, { selected: kindOf(tool) }).selected
113
+ )
114
+ )
115
+ );
116
+ const describe = (tool) => operation(tool).pipe(
117
+ Effect_exports.flatMap(
118
+ (selected) => selected === void 0 ? Effect_exports.succeed(void 0) : operationDescription(tool.name, "", selected)
119
+ )
120
+ );
121
+ const router = {
122
+ kind: "dynamic",
123
+ meta: () => catalog.header().pipe(
124
+ Effect_exports.flatMap(
125
+ (header) => header === void 0 ? Effect_exports.succeed({}) : Schema_exports.decodeUnknownEffect(McpServerHeader)(header)
126
+ ),
127
+ Effect_exports.map(serverMeta)
128
+ ),
129
+ list: () => catalog.list().pipe(
130
+ Effect_exports.flatMap((tools) => Effect_exports.forEach(tools, describe)),
131
+ Effect_exports.map((tools) => tools.filter((tool) => tool !== void 0))
132
+ ),
100
133
  summaries: () => catalog.summaries().pipe(Effect_exports.map((tools) => tools.map(summarize))),
101
- describe: (name) => selected(name).pipe(
102
- Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))
134
+ describe: (name) => catalog.resolve(name).pipe(
135
+ Effect_exports.flatMap(
136
+ (tool) => tool === void 0 ? Effect_exports.succeed(void 0) : describe(tool)
137
+ )
103
138
  ),
104
- resolve: (name) => Effect_exports.gen(function* () {
105
- const tool = yield* selected(name);
106
- if (tool === void 0) return void 0;
107
- const adapted = yield* adaptMcpTool(client, tool);
108
- const operations = protocolOperations({ selected: adapted }, { selected: kindOf(tool) });
109
- return nativeOperation(operations.queries.selected ?? operations.mutations.selected);
110
- })
139
+ resolve: (name) => catalog.resolve(name).pipe(
140
+ Effect_exports.flatMap(
141
+ (tool) => tool === void 0 ? Effect_exports.succeed(void 0) : operation(tool)
142
+ )
143
+ )
111
144
  };
112
- return { dynamicTools };
145
+ return routerDeclaration(router);
113
146
  });
114
147
 
115
148
  // src/mcp.ts
116
- var mcpOperations = (options, kinds = {}) => Effect_exports.runPromise(
149
+ var mcpRouter = (options, kinds = {}) => Effect_exports.runPromise(
117
150
  mcpCatalog(options, kinds),
118
151
  options.signal === void 0 ? {} : { signal: options.signal }
119
152
  );
153
+ var mcpHealth = (check, options) => Effect_exports.runPromise(mcpHealthEffect(check, options), { signal: check.signal });
120
154
  export {
155
+ McpCredentialsUnverified,
121
156
  McpError,
122
- mcpOperations
157
+ mcpHealth,
158
+ mcpRouter
123
159
  };