apps 0.0.1-beta.2 → 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.
Files changed (119) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
  4. package/js/{chunk-WFSQXYUT.js → chunk-4QQ62BVS.js} +37 -3
  5. package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
  6. package/js/{chunk-RN2MXB4R.js → chunk-7H44SOSX.js} +28 -9
  7. package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
  8. package/js/chunk-F2IASQK2.js +507 -0
  9. package/js/{chunk-Z5NMEGJN.js → chunk-HQY4UTYX.js} +21 -9
  10. package/js/{chunk-OHRT55C4.js → chunk-IJX4CYZO.js} +3 -6
  11. package/js/{chunk-FDNTX5QJ.js → chunk-IPI4MFSN.js} +2 -2
  12. package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
  13. package/js/chunk-KUMBKVJD.js +39 -0
  14. package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
  15. package/js/{chunk-HDTGZWP2.js → chunk-MAF4BRQF.js} +8 -8
  16. package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
  17. package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
  18. package/js/{chunk-D47C7KG5.js → chunk-NKLWZJLE.js} +2 -2
  19. package/js/chunk-NMKHTJOQ.js +254 -0
  20. package/js/chunk-OD3KFKZD.js +1617 -0
  21. package/js/{chunk-ZCAMUXSG.js → chunk-ODEIDRGW.js} +3 -4
  22. package/js/{chunk-5MQZEB6Y.js → chunk-OZ4UK3CD.js} +37 -12
  23. package/js/{chunk-M6ZRRIBI.js → chunk-PJJ24GU7.js} +1 -1
  24. package/js/{chunk-FZJOYIZO.js → chunk-PZB6T6KU.js} +1 -1
  25. package/js/{chunk-LGIYBDWA.js → chunk-R3EV5FTO.js} +13 -1
  26. package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
  27. package/js/{chunk-4LPG6RCH.js → chunk-VFZKSM3T.js} +5 -25
  28. package/js/{chunk-MYYEW3RA.js → chunk-VXWY44LE.js} +780 -55
  29. package/js/{chunk-JN55AYQH.js → chunk-XNCYIB4D.js} +61 -32
  30. package/js/{chunk-J7O55ZV7.js → chunk-ZKISLYWM.js} +309 -176
  31. package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
  32. package/js/client.js +10 -26
  33. package/js/contracts.js +74 -16
  34. package/js/effect.js +19 -20
  35. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  36. package/js/graphql.js +47 -49
  37. package/js/host.js +19 -20
  38. package/js/index.js +232 -201
  39. package/js/mcp/effect.js +21 -22
  40. package/js/mcp/stdio.js +25 -26
  41. package/js/mcp.js +74 -56
  42. package/js/openapi.js +3428 -1276
  43. package/js/react.js +3 -3
  44. package/js/skills/effect.js +3 -3
  45. package/js/skills.js +12 -13
  46. package/js/storage/facet.js +4 -4
  47. package/js/ui/auth/contracts.js +8 -9
  48. package/js/ui/auth.js +16 -14
  49. package/js/ui/contracts.js +4 -4
  50. package/js/ui/serving.js +71 -218
  51. package/package.json +1 -1
  52. package/runtime.json +1 -1
  53. package/types/app-data/src/contracts/database.d.ts +33 -6
  54. package/types/app-data/src/implementation/schema.d.ts +2 -17
  55. package/types/apps/src/contracts/app.d.ts +7 -6
  56. package/types/apps/src/contracts/failure.d.ts +25 -0
  57. package/types/apps/src/contracts/host.d.ts +31 -10
  58. package/types/apps/src/contracts/mcp.d.ts +16 -0
  59. package/types/apps/src/contracts/openapi.d.ts +5 -1
  60. package/types/apps/src/contracts/operations.d.ts +0 -5
  61. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  62. package/types/apps/src/contracts/protocols/1.d.ts +235 -67
  63. package/types/apps/src/contracts/protocols/2.d.ts +710 -0
  64. package/types/apps/src/contracts/protocols/3.d.ts +718 -0
  65. package/types/apps/src/contracts/protocols/4.d.ts +1299 -0
  66. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  67. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  68. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  69. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  70. package/types/apps/src/contracts/provider.d.ts +109 -10
  71. package/types/apps/src/contracts/router.d.ts +59 -0
  72. package/types/apps/src/contracts/storage.d.ts +3 -3
  73. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  74. package/types/apps/src/contracts/ui.d.ts +18 -0
  75. package/types/apps/src/contracts/workflows.d.ts +34 -3
  76. package/types/apps/src/graphql.d.ts +1 -3
  77. package/types/apps/src/implementation/account-router.d.ts +12 -0
  78. package/types/apps/src/implementation/app.d.ts +5 -4
  79. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  80. package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
  81. package/types/apps/src/implementation/elicitation.d.ts +2 -2
  82. package/types/apps/src/implementation/failure-detail.d.ts +25 -0
  83. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  84. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  85. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  86. package/types/apps/src/implementation/mcp.d.ts +35 -19
  87. package/types/apps/src/implementation/openapi-compile.d.ts +9 -5
  88. package/types/apps/src/implementation/openapi-document.d.ts +15 -2
  89. package/types/apps/src/implementation/openapi-request.d.ts +8 -1
  90. package/types/apps/src/implementation/openapi-source.d.ts +2 -6
  91. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  92. package/types/apps/src/implementation/operations.d.ts +36 -3
  93. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  94. package/types/apps/src/implementation/provider.d.ts +19 -5
  95. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  96. package/types/apps/src/implementation/router.d.ts +68 -0
  97. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  98. package/types/apps/src/implementation/schema.d.ts +44 -1
  99. package/types/apps/src/implementation/storage.d.ts +5 -3
  100. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  101. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  102. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  103. package/types/apps/src/implementation/ui-serving.d.ts +10 -4
  104. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  105. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  106. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  107. package/types/apps/src/index.d.ts +28 -11
  108. package/types/apps/src/mcp-stdio.d.ts +2 -5
  109. package/types/apps/src/mcp.d.ts +5 -4
  110. package/types/apps/src/openapi.d.ts +6 -6
  111. package/types/apps/src/ui-auth.d.ts +2 -2
  112. package/types/telemetry/src/browser-operations.d.ts +5 -2
  113. package/js/chunk-PYUYJRSK.js +0 -93
  114. package/js/chunk-SWPD52J7.js +0 -35
  115. package/js/chunk-TE4KO4HI.js +0 -47
  116. package/js/chunk-W7D7WVSY.js +0 -18
  117. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  118. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  119. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -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/schema.ts
6
6
  var JsonValue = Schema_exports.Json;
@@ -1,6 +1,7 @@
1
1
  import {
2
+ JsonObject,
2
3
  ValidationError
3
- } from "./chunk-SATWJKN6.js";
4
+ } from "./chunk-27F7W2LG.js";
4
5
  import {
5
6
  Cause_exports,
6
7
  Effect_exports,
@@ -9,7 +10,7 @@ import {
9
10
  SchemaIssue_exports,
10
11
  SchemaParser_exports,
11
12
  Schema_exports
12
- } from "./chunk-FW5HBOIK.js";
13
+ } from "./chunk-CDL5PM2Q.js";
13
14
 
14
15
  // ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
15
16
  function deepCompareStrict(a, b) {
@@ -1144,6 +1145,25 @@ function object(fields) {
1144
1145
  ) : Schema_exports.Struct(Object.fromEntries(entries));
1145
1146
  return { ...wrap(decoder, false), fields: Object.freeze({ ...fields }) };
1146
1147
  }
1148
+ var Exposure = /* @__PURE__ */ Symbol("apps.FieldExposure");
1149
+ var exposureOf = (schema) => Exposure in schema && (schema[Exposure] === "plain" || schema[Exposure] === "raw") ? schema[Exposure] : void 0;
1150
+ var expose = (schema, exposure) => (
1151
+ // SAFETY: the copy keeps every member of S, and `optional` and `default` keep the marking.
1152
+ {
1153
+ ...schema,
1154
+ [Exposure]: exposure,
1155
+ optional: () => expose(schema.optional(), exposure),
1156
+ default: (value) => expose(schema.default(value), exposure)
1157
+ }
1158
+ );
1159
+ var plain = (schema) => expose(schema, "plain");
1160
+ var raw = (schema) => expose(schema, "raw");
1161
+ var fieldExposure = (fields) => Object.fromEntries(
1162
+ Object.entries(fields).flatMap(([name, field]) => {
1163
+ const exposure = exposureOf(field);
1164
+ return exposure === void 0 ? [] : [[name, exposure]];
1165
+ })
1166
+ );
1147
1167
  var ImportedJsonSchema = /* @__PURE__ */ Symbol("apps.JsonSchemaDocument");
1148
1168
  var importedJsonSchema = (decoder) => ImportedJsonSchema in decoder ? decoder[ImportedJsonSchema] : void 0;
1149
1169
  var withJsonSchemaDocument = (decoder, document) => Object.assign(decoder, { [ImportedJsonSchema]: document });
@@ -1387,6 +1407,16 @@ var jsonSchema = (input) => {
1387
1407
  var storageFieldOf = (schema) => schema[StorageField];
1388
1408
  var id = (table) => wrap(Schema_exports.NonEmptyString, false, { kind: "id", references: table });
1389
1409
  var userId = () => wrap(Schema_exports.NonEmptyString, false, { kind: "userId" });
1410
+ var jsonSchemaDocument = (decoder) => {
1411
+ const imported = importedJsonSchema(decoder);
1412
+ if (imported !== void 0) return Schema_exports.decodeUnknownEffect(JsonObject)(imported);
1413
+ const document = Schema_exports.toJsonSchemaDocument(decoder);
1414
+ return Schema_exports.decodeUnknownEffect(JsonObject)({
1415
+ ...document.schema,
1416
+ $defs: document.definitions,
1417
+ $schema: "https://json-schema.org/draft/2020-12/schema"
1418
+ });
1419
+ };
1390
1420
 
1391
1421
  export {
1392
1422
  decoderOf,
@@ -1401,6 +1431,9 @@ export {
1401
1431
  literal,
1402
1432
  array,
1403
1433
  object,
1434
+ plain,
1435
+ raw,
1436
+ fieldExposure,
1404
1437
  importedJsonSchema,
1405
1438
  once,
1406
1439
  withLazyJsonSchemaDocument,
@@ -1411,5 +1444,6 @@ export {
1411
1444
  jsonSchema,
1412
1445
  storageFieldOf,
1413
1446
  id,
1414
- userId
1447
+ userId,
1448
+ jsonSchemaDocument
1415
1449
  };
@@ -4,7 +4,7 @@ import {
4
4
  fromWeb,
5
5
  layerMergedContext,
6
6
  make2 as make
7
- } from "./chunk-QKHR7BMF.js";
7
+ } from "./chunk-UK573G7W.js";
8
8
  import {
9
9
  Reference,
10
10
  Service,
@@ -17,7 +17,7 @@ import {
17
17
  succeed4 as succeed,
18
18
  toReadableStreamEffect,
19
19
  tryPromise
20
- } from "./chunk-FW5HBOIK.js";
20
+ } from "./chunk-CDL5PM2Q.js";
21
21
  import {
22
22
  __export
23
23
  } from "./chunk-CZ7CSFO4.js";
@@ -1,26 +1,28 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-J7O55ZV7.js";
3
+ } from "./chunk-ZKISLYWM.js";
4
4
  import {
5
5
  fromPromise
6
- } from "./chunk-PYUYJRSK.js";
6
+ } from "./chunk-NMKHTJOQ.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-MYYEW3RA.js";
18
+ } from "./chunk-VXWY44LE.js";
17
19
  import {
18
20
  compileJsonSchemaDecoder,
19
21
  jsonSchemaDecoder
20
- } from "./chunk-WFSQXYUT.js";
22
+ } from "./chunk-4QQ62BVS.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(