apps 0.0.1-beta.4 → 0.0.1-beta.6

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 (96) hide show
  1. package/README.md +65 -43
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
  4. package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
  5. package/js/{chunk-WFSQXYUT.js → chunk-5T57N25Q.js} +15 -3
  6. package/js/{chunk-EQB7JMAL.js → chunk-6BSSI67S.js} +8 -8
  7. package/js/{chunk-3M2MEDNL.js → chunk-B3EOZTK3.js} +351 -33
  8. package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
  9. package/js/{chunk-Z5NMEGJN.js → chunk-ECQFRCH4.js} +21 -9
  10. package/js/{chunk-G7ZIRKMK.js → chunk-IJX4CYZO.js} +3 -3
  11. package/js/{chunk-FDNTX5QJ.js → chunk-IPI4MFSN.js} +2 -2
  12. package/js/{chunk-2VPJHFOU.js → chunk-ITM77QPO.js} +28 -9
  13. package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
  14. package/js/{chunk-NQ3OMCA5.js → chunk-KUMBKVJD.js} +2 -2
  15. package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
  16. package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
  17. package/js/chunk-MNMNLXBL.js +507 -0
  18. package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
  19. package/js/{chunk-D47C7KG5.js → chunk-NKLWZJLE.js} +2 -2
  20. package/js/{chunk-DHUDODG5.js → chunk-OE3QQTSB.js} +41 -32
  21. package/js/{chunk-M6ZRRIBI.js → chunk-PJJ24GU7.js} +1 -1
  22. package/js/{chunk-FZJOYIZO.js → chunk-PZB6T6KU.js} +1 -1
  23. package/js/{chunk-LGIYBDWA.js → chunk-R3EV5FTO.js} +13 -1
  24. package/js/{chunk-5MQZEB6Y.js → chunk-RFVIONFX.js} +29 -12
  25. package/js/{chunk-ZCAMUXSG.js → chunk-RJDDBDSN.js} +3 -3
  26. package/js/{chunk-6VRYO2BG.js → chunk-SB4HEPNJ.js} +191 -170
  27. package/js/chunk-T7GKZBLP.js +209 -0
  28. package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
  29. package/js/{chunk-T2LAZCAD.js → chunk-VFZKSM3T.js} +1 -1
  30. package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
  31. package/js/client.js +10 -10
  32. package/js/contracts.js +52 -16
  33. package/js/effect.js +19 -20
  34. package/js/graphql.js +34 -40
  35. package/js/host.js +19 -20
  36. package/js/index.js +189 -178
  37. package/js/mcp/effect.js +21 -22
  38. package/js/mcp/stdio.js +25 -26
  39. package/js/mcp.js +60 -45
  40. package/js/openapi.js +182 -224
  41. package/js/react.js +3 -3
  42. package/js/skills/effect.js +3 -3
  43. package/js/skills.js +12 -13
  44. package/js/storage/facet.js +4 -4
  45. package/js/ui/auth/contracts.js +2 -2
  46. package/js/ui/auth.js +5 -5
  47. package/js/ui/contracts.js +4 -4
  48. package/js/ui/serving.js +8 -8
  49. package/package.json +1 -1
  50. package/runtime.json +1 -1
  51. package/types/app-data/src/contracts/database.d.ts +33 -6
  52. package/types/app-data/src/implementation/schema.d.ts +2 -17
  53. package/types/apps/src/contracts/app.d.ts +2 -5
  54. package/types/apps/src/contracts/failure.d.ts +25 -0
  55. package/types/apps/src/contracts/host.d.ts +18 -9
  56. package/types/apps/src/contracts/mcp.d.ts +16 -0
  57. package/types/apps/src/contracts/openapi.d.ts +5 -1
  58. package/types/apps/src/contracts/operations.d.ts +0 -5
  59. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  60. package/types/apps/src/contracts/protocols/1.d.ts +15 -1
  61. package/types/apps/src/contracts/protocols/2.d.ts +2 -2
  62. package/types/apps/src/contracts/protocols/3.d.ts +676 -0
  63. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  64. package/types/apps/src/contracts/router.d.ts +59 -0
  65. package/types/apps/src/contracts/storage.d.ts +3 -3
  66. package/types/apps/src/contracts/workflows.d.ts +34 -3
  67. package/types/apps/src/graphql.d.ts +1 -3
  68. package/types/apps/src/implementation/account-router.d.ts +12 -0
  69. package/types/apps/src/implementation/app.d.ts +5 -4
  70. package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
  71. package/types/apps/src/implementation/elicitation.d.ts +1 -1
  72. package/types/apps/src/implementation/failure-detail.d.ts +25 -0
  73. package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
  74. package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
  75. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  76. package/types/apps/src/implementation/mcp.d.ts +35 -19
  77. package/types/apps/src/implementation/openapi-compile.d.ts +2 -1
  78. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  79. package/types/apps/src/implementation/operations.d.ts +26 -3
  80. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  81. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  82. package/types/apps/src/implementation/router.d.ts +59 -0
  83. package/types/apps/src/implementation/schema.d.ts +5 -1
  84. package/types/apps/src/implementation/storage.d.ts +5 -3
  85. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  86. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  87. package/types/apps/src/index.d.ts +3 -2
  88. package/types/apps/src/mcp-stdio.d.ts +2 -5
  89. package/types/apps/src/mcp.d.ts +5 -4
  90. package/types/apps/src/openapi.d.ts +6 -6
  91. package/js/chunk-PYUYJRSK.js +0 -93
  92. package/js/chunk-SWPD52J7.js +0 -35
  93. package/js/chunk-W7D7WVSY.js +0 -18
  94. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  95. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  96. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
package/js/mcp.js CHANGED
@@ -1,47 +1,48 @@
1
1
  import {
2
2
  mcpClientEffect
3
- } from "./chunk-EQB7JMAL.js";
3
+ } from "./chunk-6BSSI67S.js";
4
4
  import {
5
5
  catalogCache
6
- } from "./chunk-5MQZEB6Y.js";
6
+ } from "./chunk-RFVIONFX.js";
7
7
  import {
8
8
  adaptMcpTool
9
- } from "./chunk-2VPJHFOU.js";
9
+ } from "./chunk-ITM77QPO.js";
10
10
  import {
11
11
  protocolOperations
12
- } from "./chunk-Z5NMEGJN.js";
12
+ } from "./chunk-ECQFRCH4.js";
13
13
  import "./chunk-BCSNKUAC.js";
14
- import "./chunk-6VRYO2BG.js";
14
+ import "./chunk-SB4HEPNJ.js";
15
15
  import {
16
16
  cacheKey
17
- } from "./chunk-D47C7KG5.js";
18
- import "./chunk-FDNTX5QJ.js";
19
- import "./chunk-DHUDODG5.js";
20
- import "./chunk-PLCMJREA.js";
17
+ } from "./chunk-NKLWZJLE.js";
18
+ import "./chunk-MNMNLXBL.js";
19
+ import "./chunk-IPI4MFSN.js";
20
+ import "./chunk-OE3QQTSB.js";
21
+ import "./chunk-ZQINWV4W.js";
21
22
  import {
22
- nativeOperation
23
- } from "./chunk-PYUYJRSK.js";
24
- import "./chunk-ZJWDMTE3.js";
23
+ nativeOperation,
24
+ routerDeclaration
25
+ } from "./chunk-T7GKZBLP.js";
26
+ import "./chunk-MKWZPDR6.js";
25
27
  import {
26
28
  McpError,
29
+ McpServerHeader,
27
30
  McpToolMetadata,
28
31
  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";
32
+ } from "./chunk-B3EOZTK3.js";
33
+ import "./chunk-N7YDVXYJ.js";
34
+ import "./chunk-R3EV5FTO.js";
35
+ import "./chunk-JU7VHODU.js";
36
+ import "./chunk-RJDDBDSN.js";
37
+ import "./chunk-57RKNWL2.js";
38
+ import "./chunk-UK573G7W.js";
39
+ import "./chunk-5T57N25Q.js";
40
+ import "./chunk-PZB6T6KU.js";
41
+ import "./chunk-27F7W2LG.js";
41
42
  import {
42
43
  Effect_exports,
43
44
  Schema_exports
44
- } from "./chunk-FW5HBOIK.js";
45
+ } from "./chunk-CDL5PM2Q.js";
45
46
  import "./chunk-CZ7CSFO4.js";
46
47
 
47
48
  // src/implementation/mcp-catalog.ts
@@ -49,6 +50,15 @@ var McpToolSummary = McpToolMetadata.mapFields(
49
50
  ({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
50
51
  );
51
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
+ };
52
62
  var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
53
63
  const parsed = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)(options).pipe(
54
64
  Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" }))
@@ -58,27 +68,32 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
58
68
  headers[name] = value;
59
69
  });
60
70
  const id = yield* cacheKey({ url: parsed.url, headers, accountId: parsed.accountId ?? null });
61
- const key = ["mcp-catalog-v2", id, "current"];
71
+ const key = ["mcp-catalog-v3", id, "current"];
62
72
  const cache = options.cache;
63
73
  const changed = cache === void 0 ? void 0 : invoke(() => cache.invalidate(key));
64
74
  const client = yield* mcpClientEffect(options, changed);
65
75
  const catalog = yield* catalogCache({
66
76
  ...options,
67
- prefix: ["mcp-catalog-v2", id],
77
+ prefix: ["mcp-catalog-v3", id],
68
78
  schema: McpToolMetadata,
69
79
  summary: {
70
80
  schema: McpToolSummary,
71
81
  of: ({ inputSchema: _input, outputSchema: _output, _meta, ...summary }) => summary
72
82
  },
73
- load: (context) => context === void 0 ? client.list : mcpClientEffect(
83
+ load: (context) => (context === void 0 ? client.list : mcpClientEffect(
74
84
  { ...parsed, signal: context.signal },
75
85
  invoke(() => context.cache.invalidate(key))
76
- ).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
+ )
77
93
  });
78
94
  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
95
  const summarize = (tool) => ({
81
- name: qualified(tool),
96
+ name: tool.name,
82
97
  description: tool.description ?? tool.title ?? tool.name,
83
98
  readOnly: kindOf(tool) === "query",
84
99
  ...tool.title === void 0 ? {} : { title: tool.title },
@@ -90,34 +105,34 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
90
105
  ...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
91
106
  ...tool._meta === void 0 ? {} : { _meta: tool._meta }
92
107
  });
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 = {
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
+ ),
99
116
  list: () => catalog.list().pipe(Effect_exports.map((tools) => tools.map(describe))),
100
117
  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))
103
- ),
118
+ describe: (name) => catalog.resolve(name).pipe(Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))),
104
119
  resolve: (name) => Effect_exports.gen(function* () {
105
- const tool = yield* selected(name);
120
+ const tool = yield* catalog.resolve(name);
106
121
  if (tool === void 0) return void 0;
107
122
  const adapted = yield* adaptMcpTool(client, tool);
108
123
  const operations = protocolOperations({ selected: adapted }, { selected: kindOf(tool) });
109
- return nativeOperation(operations.queries.selected ?? operations.mutations.selected);
124
+ return nativeOperation(operations.selected);
110
125
  })
111
126
  };
112
- return { dynamicTools };
127
+ return routerDeclaration(router);
113
128
  });
114
129
 
115
130
  // src/mcp.ts
116
- var mcpOperations = (options, kinds = {}) => Effect_exports.runPromise(
131
+ var mcpRouter = (options, kinds = {}) => Effect_exports.runPromise(
117
132
  mcpCatalog(options, kinds),
118
133
  options.signal === void 0 ? {} : { signal: options.signal }
119
134
  );
120
135
  export {
121
136
  McpError,
122
- mcpOperations
137
+ mcpRouter
123
138
  };