apps 0.0.1-beta.1 → 0.0.1-beta.10

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 (118) hide show
  1. package/README.md +65 -43
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
  5. package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
  6. package/js/{chunk-2HHMABB6.js → chunk-5T57N25Q.js} +61 -13
  7. package/js/{chunk-6IIO4NPI.js → chunk-72JNVHPK.js} +21 -9
  8. package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
  9. package/js/{chunk-X7SFGU4Q.js → chunk-CRDWFA74.js} +28 -9
  10. package/js/{chunk-G7IE6BKC.js → chunk-EPT3ZP52.js} +8 -8
  11. package/js/chunk-FL2QR3XW.js +507 -0
  12. package/js/{chunk-OHRT55C4.js → chunk-IJX4CYZO.js} +3 -6
  13. package/js/{chunk-ZTFQHGEB.js → chunk-IPI4MFSN.js} +3 -5
  14. package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
  15. package/js/chunk-KUMBKVJD.js +39 -0
  16. package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
  17. package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
  18. package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
  19. package/js/chunk-NKLWZJLE.js +172 -0
  20. package/js/{chunk-ZCAMUXSG.js → chunk-ODEIDRGW.js} +3 -4
  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-R3EV5FTO.js +97 -0
  24. package/js/{chunk-6YBRWRK3.js → chunk-RFVIONFX.js} +43 -14
  25. package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
  26. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  27. package/js/{chunk-KOXMLKTM.js → chunk-V5KNQVCT.js} +308 -316
  28. package/js/{chunk-4LPG6RCH.js → chunk-VFZKSM3T.js} +5 -25
  29. package/js/{chunk-IHQ4ML7K.js → chunk-WLE7WX2U.js} +554 -102
  30. package/js/{chunk-RBAC33PQ.js → chunk-YXQHV65J.js} +58 -83
  31. package/js/chunk-Z5M2LQOZ.js +209 -0
  32. package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
  33. package/js/client.js +10 -26
  34. package/js/contracts.js +70 -15
  35. package/js/effect.js +19 -19
  36. package/js/es-APDZKREY.js +40968 -0
  37. package/js/graphql.js +34 -39
  38. package/js/host.js +23 -23
  39. package/js/index.js +199 -195
  40. package/js/mcp/effect.js +21 -21
  41. package/js/mcp/stdio.js +25 -25
  42. package/js/mcp.js +60 -44
  43. package/js/openapi.js +826 -41682
  44. package/js/react.js +3 -3
  45. package/js/skills/effect.js +3 -4
  46. package/js/skills.js +53 -17
  47. package/js/storage/facet.js +4 -4
  48. package/js/ui/auth/contracts.js +8 -9
  49. package/js/ui/auth.js +16 -14
  50. package/js/ui/contracts.js +4 -4
  51. package/js/ui/serving.js +9 -8
  52. package/package.json +1 -1
  53. package/runtime.json +1 -1
  54. package/types/app-cache/src/contracts/cache.d.ts +42 -2
  55. package/types/app-cache/src/index.d.ts +59 -1
  56. package/types/app-data/src/contracts/database.d.ts +33 -6
  57. package/types/app-data/src/implementation/schema.d.ts +2 -17
  58. package/types/apps/src/contracts/app.d.ts +7 -6
  59. package/types/apps/src/contracts/cache.d.ts +4 -1
  60. package/types/apps/src/contracts/failure.d.ts +25 -0
  61. package/types/apps/src/contracts/host.d.ts +34 -679
  62. package/types/apps/src/contracts/mcp.d.ts +16 -0
  63. package/types/apps/src/contracts/openapi.d.ts +11 -1
  64. package/types/apps/src/contracts/operations.d.ts +0 -5
  65. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  66. package/types/apps/src/contracts/protocols/1.d.ts +1589 -0
  67. package/types/apps/src/contracts/protocols/2.d.ts +668 -0
  68. package/types/apps/src/contracts/protocols/3.d.ts +676 -0
  69. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  70. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  71. package/types/apps/src/contracts/provider.d.ts +51 -5
  72. package/types/apps/src/contracts/router.d.ts +59 -0
  73. package/types/apps/src/contracts/skills.d.ts +17 -8
  74. package/types/apps/src/contracts/storage.d.ts +3 -3
  75. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  76. package/types/apps/src/contracts/workflows.d.ts +34 -3
  77. package/types/apps/src/graphql.d.ts +1 -3
  78. package/types/apps/src/implementation/account-router.d.ts +12 -0
  79. package/types/apps/src/implementation/app.d.ts +5 -4
  80. package/types/apps/src/implementation/cache.d.ts +3 -1
  81. package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
  82. package/types/apps/src/implementation/elicitation.d.ts +1 -1
  83. package/types/apps/src/implementation/failure-detail.d.ts +25 -0
  84. package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
  85. package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
  86. package/types/apps/src/implementation/mcp-client.d.ts +35 -19
  87. package/types/apps/src/implementation/mcp.d.ts +35 -19
  88. package/types/apps/src/implementation/openapi-compile.d.ts +3 -2
  89. package/types/apps/src/implementation/openapi-document.d.ts +0 -2
  90. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  91. package/types/apps/src/implementation/openapi-request.d.ts +0 -1
  92. package/types/apps/src/implementation/openapi-source.d.ts +7 -7
  93. package/types/apps/src/implementation/operations.d.ts +26 -3
  94. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  95. package/types/apps/src/implementation/provider.d.ts +9 -4
  96. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  97. package/types/apps/src/implementation/router.d.ts +59 -0
  98. package/types/apps/src/implementation/schema.d.ts +5 -6
  99. package/types/apps/src/implementation/storage.d.ts +5 -3
  100. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  101. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  102. package/types/apps/src/implementation/ui-serving.d.ts +4 -2
  103. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  104. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  105. package/types/apps/src/index.d.ts +5 -4
  106. package/types/apps/src/mcp-stdio.d.ts +2 -5
  107. package/types/apps/src/mcp.d.ts +5 -4
  108. package/types/apps/src/openapi.d.ts +6 -6
  109. package/types/apps/src/skills.d.ts +6 -3
  110. package/types/apps/src/ui-auth.d.ts +2 -2
  111. package/types/telemetry/src/browser-operations.d.ts +5 -2
  112. package/js/chunk-PZ36XMXW.js +0 -93
  113. package/js/chunk-SWPD52J7.js +0 -35
  114. package/js/chunk-TE4KO4HI.js +0 -47
  115. package/js/chunk-W7D7WVSY.js +0 -18
  116. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  117. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  118. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -0,0 +1,65 @@
1
+ import {
2
+ Alias,
3
+ Composer,
4
+ Document,
5
+ Lexer,
6
+ LineCounter,
7
+ Pair,
8
+ Parser,
9
+ Scalar,
10
+ Schema,
11
+ YAMLError,
12
+ YAMLMap,
13
+ YAMLParseError,
14
+ YAMLSeq,
15
+ YAMLWarning,
16
+ browser_default,
17
+ cst_exports,
18
+ isAlias,
19
+ isCollection,
20
+ isDocument,
21
+ isMap,
22
+ isNode,
23
+ isPair,
24
+ isScalar,
25
+ isSeq,
26
+ parse,
27
+ parseAllDocuments,
28
+ parseDocument,
29
+ stringify,
30
+ visit,
31
+ visitAsync
32
+ } from "./chunk-UVL56Z6E.js";
33
+ import "./chunk-CZ7CSFO4.js";
34
+ export {
35
+ Alias,
36
+ cst_exports as CST,
37
+ Composer,
38
+ Document,
39
+ Lexer,
40
+ LineCounter,
41
+ Pair,
42
+ Parser,
43
+ Scalar,
44
+ Schema,
45
+ YAMLError,
46
+ YAMLMap,
47
+ YAMLParseError,
48
+ YAMLSeq,
49
+ YAMLWarning,
50
+ browser_default as default,
51
+ isAlias,
52
+ isCollection,
53
+ isDocument,
54
+ isMap,
55
+ isNode,
56
+ isPair,
57
+ isScalar,
58
+ isSeq,
59
+ parse,
60
+ parseAllDocuments,
61
+ parseDocument,
62
+ stringify,
63
+ visit,
64
+ visitAsync
65
+ };
@@ -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;
@@ -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,13 +1,16 @@
1
1
  import {
2
+ JsonObject,
2
3
  ValidationError
3
- } from "./chunk-SATWJKN6.js";
4
+ } from "./chunk-27F7W2LG.js";
4
5
  import {
6
+ Cause_exports,
5
7
  Effect_exports,
8
+ Exit_exports,
6
9
  SchemaGetter_exports,
7
10
  SchemaIssue_exports,
8
11
  SchemaParser_exports,
9
12
  Schema_exports
10
- } from "./chunk-FW5HBOIK.js";
13
+ } from "./chunk-CDL5PM2Q.js";
11
14
 
12
15
  // ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
13
16
  function deepCompareStrict(a, b) {
@@ -1330,27 +1333,71 @@ var compileJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
1330
1333
  );
1331
1334
  return Object.assign(decoder, { [ImportedJsonSchema]: document });
1332
1335
  });
1333
- var lazyJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
1336
+ var lazyDecoder = (document) => {
1334
1337
  const read = once(document);
1335
- const compiled = yield* Effect_exports.cached(Effect_exports.suspend(() => compileJsonSchemaDecoder(read())));
1338
+ let compiled;
1339
+ const compile = Effect_exports.suspend(
1340
+ () => compiled ?? compileJsonSchemaDecoder(read()).pipe(
1341
+ // An interrupted compilation is not a result; the next decode compiles again.
1342
+ Effect_exports.onExit(
1343
+ (exit) => Effect_exports.sync(() => {
1344
+ if (Exit_exports.isSuccess(exit) || !Cause_exports.hasInterrupts(exit.cause)) compiled = exit;
1345
+ })
1346
+ )
1347
+ )
1348
+ );
1336
1349
  const decoder = Schema_exports.declareConstructor()(
1337
1350
  [],
1338
- () => (input, _ast, options) => compiled.pipe(
1339
- Effect_exports.mapError(
1340
- () => new SchemaIssue_exports.InvalidValue({ message: "Unsupported JSON Schema" })
1341
- ),
1351
+ () => (input, _ast, options) => compile.pipe(
1352
+ Effect_exports.mapError(() => new SchemaIssue_exports.InvalidValue({ message: "Unsupported JSON Schema" })),
1342
1353
  Effect_exports.flatMap((schema) => SchemaParser_exports.decodeUnknownEffect(schema)(input, options))
1343
1354
  )
1344
1355
  );
1345
1356
  return withLazyJsonSchemaDocument(decoder, read);
1357
+ };
1358
+ var lazyJsonSchemaDecoder = (document) => Effect_exports.sync(() => lazyDecoder(document));
1359
+ var isJsonValue = Schema_exports.is(Schema_exports.Json);
1360
+ var jsonDocument = (input) => {
1361
+ if (typeof input !== "object" || input === null || Array.isArray(input)) return void 0;
1362
+ const keys = Object.keys(input);
1363
+ const values = keys.map((key) => Reflect.get(input, key));
1364
+ if (!isJsonValue(values)) return void 0;
1365
+ const document = {};
1366
+ keys.forEach(
1367
+ (key, index) => Object.defineProperty(document, key, {
1368
+ value: values[index],
1369
+ enumerable: true,
1370
+ writable: true,
1371
+ configurable: true
1372
+ })
1373
+ );
1374
+ return document;
1375
+ };
1376
+ var jsonSchemaDecoder = (input) => Effect_exports.suspend(() => {
1377
+ const document = jsonDocument(input);
1378
+ return document === void 0 ? Effect_exports.fail(new ValidationError()) : lazyJsonSchemaDecoder(() => document);
1346
1379
  });
1347
- var jsonSchemaDecoder = (input) => parse(Schema_exports.Record(Schema_exports.String, Schema_exports.Json), input).pipe(
1348
- Effect_exports.flatMap((document) => lazyJsonSchemaDecoder(() => document))
1349
- );
1350
- var jsonSchema = (input) => wrap(Effect_exports.runSync(jsonSchemaDecoder(input)), false);
1380
+ var jsonSchema = (input) => {
1381
+ const document = jsonDocument(input);
1382
+ if (document === void 0) throw new ValidationError();
1383
+ return wrap(
1384
+ lazyDecoder(() => document),
1385
+ false
1386
+ );
1387
+ };
1351
1388
  var storageFieldOf = (schema) => schema[StorageField];
1352
1389
  var id = (table) => wrap(Schema_exports.NonEmptyString, false, { kind: "id", references: table });
1353
1390
  var userId = () => wrap(Schema_exports.NonEmptyString, false, { kind: "userId" });
1391
+ var jsonSchemaDocument = (decoder) => {
1392
+ const imported = importedJsonSchema(decoder);
1393
+ if (imported !== void 0) return Schema_exports.decodeUnknownEffect(JsonObject)(imported);
1394
+ const document = Schema_exports.toJsonSchemaDocument(decoder);
1395
+ return Schema_exports.decodeUnknownEffect(JsonObject)({
1396
+ ...document.schema,
1397
+ $defs: document.definitions,
1398
+ $schema: "https://json-schema.org/draft/2020-12/schema"
1399
+ });
1400
+ };
1354
1401
 
1355
1402
  export {
1356
1403
  decoderOf,
@@ -1375,5 +1422,6 @@ export {
1375
1422
  jsonSchema,
1376
1423
  storageFieldOf,
1377
1424
  id,
1378
- userId
1425
+ userId,
1426
+ jsonSchemaDocument
1379
1427
  };
@@ -1,13 +1,17 @@
1
1
  import {
2
- operationDeclaration
3
- } from "./chunk-PZ36XMXW.js";
2
+ fixedRouter
3
+ } from "./chunk-FL2QR3XW.js";
4
+ import {
5
+ nativeOperation,
6
+ operationDeclaration,
7
+ routerDeclaration
8
+ } from "./chunk-Z5M2LQOZ.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
  };