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
@@ -1,13 +1,17 @@
1
1
  import {
2
- operationDeclaration
3
- } from "./chunk-PYUYJRSK.js";
2
+ fixedRouter
3
+ } from "./chunk-MNMNLXBL.js";
4
+ import {
5
+ nativeOperation,
6
+ operationDeclaration,
7
+ routerDeclaration
8
+ } from "./chunk-T7GKZBLP.js";
4
9
 
5
10
  // src/implementation/protocol-operations.ts
6
11
  var protocolOperations = (operations, kinds = {}) => {
7
- const queries = {};
8
- const mutations = {};
12
+ const declared = {};
9
13
  for (const [name, operation] of Object.entries(operations)) {
10
- const kind = Object.hasOwn(kinds, name) ? kinds[name] : operation.readOnly === true ? "query" : "mutation";
14
+ const kind = Object.hasOwn(kinds, name) ? kinds[name] ?? "mutation" : operation.readOnly === true ? "query" : "mutation";
11
15
  const native = {
12
16
  description: operation.description,
13
17
  ...operation.title === void 0 ? {} : { title: operation.title },
@@ -18,12 +22,20 @@ var protocolOperations = (operations, kinds = {}) => {
18
22
  };
19
23
  const output = Object.getOwnPropertyDescriptor(operation, "outputSchema");
20
24
  const withOutput = (target) => output === void 0 || output.get === void 0 && output.value === void 0 ? target : Object.defineProperty(target, "outputSchema", { ...output, enumerable: true });
21
- if (kind === "query") queries[name] = operationDeclaration(withOutput({ ...native, kind }));
22
- else mutations[name] = operationDeclaration(withOutput({ ...native, kind: "mutation" }));
25
+ declared[name] = operationDeclaration(withOutput({ ...native, kind }));
26
+ }
27
+ return declared;
28
+ };
29
+ var protocolRouter = (operations, kinds = {}) => {
30
+ const native = {};
31
+ for (const [name, declaration] of Object.entries(protocolOperations(operations, kinds))) {
32
+ const operation = nativeOperation(declaration);
33
+ if (operation !== void 0) native[name] = operation;
23
34
  }
24
- return { queries, mutations };
35
+ return routerDeclaration(fixedRouter(native));
25
36
  };
26
37
 
27
38
  export {
28
- protocolOperations
39
+ protocolOperations,
40
+ protocolRouter
29
41
  };
@@ -19,10 +19,10 @@ import {
19
19
  text,
20
20
  uint8Array,
21
21
  urlParams
22
- } from "./chunk-QKHR7BMF.js";
22
+ } from "./chunk-UK573G7W.js";
23
23
  import {
24
24
  JsonValue
25
- } from "./chunk-SATWJKN6.js";
25
+ } from "./chunk-27F7W2LG.js";
26
26
  import {
27
27
  Cause,
28
28
  Defect,
@@ -118,7 +118,7 @@ import {
118
118
  transformEffect,
119
119
  transformPull,
120
120
  void_2 as void_
121
- } from "./chunk-FW5HBOIK.js";
121
+ } from "./chunk-CDL5PM2Q.js";
122
122
  import {
123
123
  __export
124
124
  } from "./chunk-CZ7CSFO4.js";
@@ -5,11 +5,11 @@ import {
5
5
  SkillDefinitionInvalid,
6
6
  SkillFile,
7
7
  SkillFilePath
8
- } from "./chunk-YEJOQEII.js";
8
+ } from "./chunk-JU7VHODU.js";
9
9
  import {
10
10
  Effect_exports,
11
11
  Schema_exports
12
- } from "./chunk-FW5HBOIK.js";
12
+ } from "./chunk-CDL5PM2Q.js";
13
13
 
14
14
  // src/implementation/skill-files.ts
15
15
  var skillFromFiles = (input, source = {}) => Effect_exports.gen(function* () {
@@ -1,26 +1,28 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-6VRYO2BG.js";
3
+ } from "./chunk-SB4HEPNJ.js";
4
4
  import {
5
5
  fromPromise
6
- } from "./chunk-PYUYJRSK.js";
6
+ } from "./chunk-T7GKZBLP.js";
7
7
  import {
8
8
  ElicitationFailed,
9
9
  McpError,
10
+ McpServerHeader,
10
11
  McpToolMetadata,
11
12
  McpToolResult,
13
+ RouterIcon,
12
14
  ToolResultObservation,
13
15
  defaultElicitationLimits,
14
16
  defaultMcpClientLimits,
15
17
  mcpSdkTimerCeilingMs
16
- } from "./chunk-3M2MEDNL.js";
18
+ } from "./chunk-B3EOZTK3.js";
17
19
  import {
18
20
  compileJsonSchemaDecoder,
19
21
  jsonSchemaDecoder
20
- } from "./chunk-WFSQXYUT.js";
22
+ } from "./chunk-5T57N25Q.js";
21
23
  import {
22
24
  JsonObject
23
- } from "./chunk-SATWJKN6.js";
25
+ } from "./chunk-27F7W2LG.js";
24
26
  import {
25
27
  Clock_exports,
26
28
  Deferred_exports,
@@ -29,7 +31,7 @@ import {
29
31
  Option_exports,
30
32
  Queue_exports,
31
33
  Schema_exports
32
- } from "./chunk-FW5HBOIK.js";
34
+ } from "./chunk-CDL5PM2Q.js";
33
35
 
34
36
  // src/implementation/mcp-tools.ts
35
37
  var adaptMcpTool = (client, tool) => Effect_exports.gen(function* () {
@@ -70,7 +72,7 @@ var adaptMcpTool = (client, tool) => Effect_exports.gen(function* () {
70
72
  return adapted;
71
73
  });
72
74
  var adaptMcpTools = (client) => Effect_exports.gen(function* () {
73
- const metadata = yield* client.list;
75
+ const { tools: metadata } = yield* client.list;
74
76
  const entries = yield* Effect_exports.forEach(
75
77
  metadata,
76
78
  (tool) => adaptMcpTool(client, tool).pipe(Effect_exports.map((adapted) => [tool.name, adapted]))
@@ -233,7 +235,7 @@ function mcpClient(withClient, timeoutMs, failure) {
233
235
  do {
234
236
  const page = yield* Effect_exports.tryPromise({
235
237
  // This session only reads metadata. listTools() also eagerly compiles
236
- // every output validator; mcpOperations validates the selected tool on call.
238
+ // every output validator; mcpRouter validates the selected tool on call.
237
239
  try: (signal) => client.request(
238
240
  { method: "tools/list", params: cursor === void 0 ? {} : { cursor } },
239
241
  ListToolsResultSchema,
@@ -263,7 +265,24 @@ function mcpClient(withClient, timeoutMs, failure) {
263
265
  cursors.add(cursor);
264
266
  }
265
267
  } while (cursor !== void 0);
266
- return [...tools.values()];
268
+ const info = client.getServerVersion();
269
+ const instructions = client.getInstructions();
270
+ const icons = info?.icons?.flatMap(
271
+ (icon) => Option_exports.toArray(Schema_exports.decodeUnknownOption(RouterIcon)(icon))
272
+ );
273
+ const server = Schema_exports.decodeUnknownOption(McpServerHeader)({
274
+ ...info?.name === void 0 ? {} : { name: info.name },
275
+ ...info?.title === void 0 ? {} : { title: info.title },
276
+ ...info?.version === void 0 ? {} : { version: info.version },
277
+ ...info?.description === void 0 ? {} : { description: info.description },
278
+ ...info?.websiteUrl === void 0 ? {} : { websiteUrl: info.websiteUrl },
279
+ ...icons === void 0 ? {} : { icons },
280
+ ...instructions === void 0 ? {} : { instructions }
281
+ });
282
+ return {
283
+ tools: [...tools.values()],
284
+ server: Option_exports.getOrElse(server, () => ({}))
285
+ };
267
286
  })
268
287
  ).pipe(Effect_exports.withSpan("provider.mcp.discover"));
269
288
  const call = (name, input, context) => withClient("call", (client) => mcpCall(client, name, input, context, timeoutMs, failure)).pipe(
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Schema_exports
3
- } from "./chunk-FW5HBOIK.js";
3
+ } from "./chunk-CDL5PM2Q.js";
4
4
 
5
5
  // src/contracts/skills.ts
6
6
  var SkillFilePath = Schema_exports.NonEmptyString.check(
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  appSignInCallbackPath
3
- } from "./chunk-T2LAZCAD.js";
3
+ } from "./chunk-VFZKSM3T.js";
4
4
  import {
5
5
  HttpServerResponse_exports
6
- } from "./chunk-QKHR7BMF.js";
6
+ } from "./chunk-UK573G7W.js";
7
7
 
8
8
  // src/implementation/ui-auth.ts
9
9
  var appPrivateHeaders = {
@@ -3,7 +3,7 @@ import {
3
3
  invalidate,
4
4
  layer,
5
5
  mutation
6
- } from "./chunk-M6ZRRIBI.js";
6
+ } from "./chunk-PJJ24GU7.js";
7
7
  import {
8
8
  Boolean,
9
9
  Cause,
@@ -158,7 +158,7 @@ import {
158
158
  void_2,
159
159
  whileLoop,
160
160
  zipRight
161
- } from "./chunk-FW5HBOIK.js";
161
+ } from "./chunk-CDL5PM2Q.js";
162
162
  import {
163
163
  __export
164
164
  } from "./chunk-CZ7CSFO4.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ProviderError
3
- } from "./chunk-W7D7WVSY.js";
3
+ } from "./chunk-R3EV5FTO.js";
4
4
  import {
5
5
  AccountId
6
- } from "./chunk-SATWJKN6.js";
6
+ } from "./chunk-27F7W2LG.js";
7
7
  import {
8
8
  Option_exports,
9
9
  Schema_exports
10
- } from "./chunk-FW5HBOIK.js";
10
+ } from "./chunk-CDL5PM2Q.js";
11
11
 
12
12
  // src/implementation/provider-error.ts
13
13
  function parseProviderError(error) {