apps 0.0.1-beta.4 → 0.0.1-beta.40

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-4TLZGG4B.js +729 -0
  5. package/js/chunk-6KABJTDO.js +255 -0
  6. package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
  7. package/js/{chunk-EQB7JMAL.js → chunk-DHX2OI2X.js} +146 -31
  8. package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
  9. package/js/chunk-EM4UL26F.js +118 -0
  10. package/js/{chunk-WFSQXYUT.js → chunk-GHXRRFZA.js} +418 -52
  11. package/js/{chunk-5MQZEB6Y.js → chunk-KANDIVIH.js} +40 -12
  12. package/js/chunk-KAQD3DTI.js +16 -0
  13. package/js/chunk-KIM5HXNK.js +49 -0
  14. package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
  15. package/js/{chunk-2VPJHFOU.js → chunk-MYF7KWUB.js} +128 -24
  16. package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
  17. package/js/chunk-OD3KFKZD.js +1617 -0
  18. package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
  19. package/js/chunk-P7MGDPFD.js +240 -0
  20. package/js/chunk-PDS2E2OZ.js +42 -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-6VRYO2BG.js → chunk-SALJXSS3.js} +779 -251
  24. package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
  25. package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
  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-XDGUGB2A.js +156 -0
  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 +9 -9
  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 +4 -1
  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 +86 -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
@@ -1,24 +1,35 @@
1
1
  import {
2
2
  CacheError
3
- } from "./chunk-LGIYBDWA.js";
3
+ } from "./chunk-P7MGDPFD.js";
4
4
  import {
5
5
  wrap
6
- } from "./chunk-WFSQXYUT.js";
6
+ } from "./chunk-GHXRRFZA.js";
7
7
  import {
8
8
  JsonObject
9
- } from "./chunk-SATWJKN6.js";
9
+ } from "./chunk-YQ35E7KS.js";
10
10
  import {
11
11
  Duration_exports,
12
12
  Effect_exports,
13
13
  Schema_exports
14
- } from "./chunk-FW5HBOIK.js";
14
+ } from "./chunk-MXDKXAY4.js";
15
15
 
16
16
  // src/implementation/catalog-cache.ts
17
+ var catalogScope = (options, credential, invalid) => {
18
+ const { account, cache } = options;
19
+ if (account === void 0)
20
+ return credential === void 0 ? Effect_exports.succeed(cache) : Effect_exports.fail(invalid("missing-account"));
21
+ if (cache === void 0) return Effect_exports.succeed(void 0);
22
+ return Effect_exports.try({
23
+ try: () => cache.forAccount(account),
24
+ catch: () => invalid("unselected-account")
25
+ });
26
+ };
17
27
  var schema = (decoder) => wrap(decoder, false);
18
28
  var Manifest = Schema_exports.Struct({
19
29
  revision: Schema_exports.String,
20
30
  pages: Schema_exports.Int,
21
- summaries: Schema_exports.Int
31
+ summaries: Schema_exports.Int,
32
+ header: Schema_exports.optionalKey(JsonObject)
22
33
  });
23
34
  var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
24
35
  var catalogCache = (options) => Effect_exports.gen(function* () {
@@ -35,9 +46,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
35
46
  const retention = Duration_exports.toMillis(Duration_exports.fromInputUnsafe(freshFor)) + Duration_exports.toMillis(Duration_exports.fromInputUnsafe(staleFor)) + 3e5;
36
47
  const local = yield* Effect_exports.cached(options.load());
37
48
  const refresh = (context) => Effect_exports.gen(function* () {
38
- const tools = yield* options.load(context);
49
+ const { tools, header } = yield* options.load(context);
39
50
  const digest = yield* invoke(
40
- () => crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(tools)))
51
+ () => crypto.subtle.digest(
52
+ "SHA-256",
53
+ new TextEncoder().encode(JSON.stringify({ tools, header: header ?? null }))
54
+ )
41
55
  );
42
56
  const revision = Array.from(
43
57
  new Uint8Array(digest),
@@ -104,7 +118,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
104
118
  yield* pageOut();
105
119
  yield* summaryOut();
106
120
  yield* flush();
107
- return { revision, pages: pages2, summaries };
121
+ return {
122
+ revision,
123
+ pages: pages2,
124
+ summaries,
125
+ ...header === void 0 ? {} : { header: yield* json(header) }
126
+ };
108
127
  });
109
128
  const getOptions = {
110
129
  key,
@@ -113,7 +132,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
113
132
  staleFor,
114
133
  load: (context) => Effect_exports.runPromise(refresh(context), { signal: context.signal })
115
134
  };
116
- const current = () => cache === void 0 ? Effect_exports.fail(new CacheError({ reason: "unavailable" })) : invoke(() => cache.get(getOptions));
135
+ let reading;
136
+ const current = () => cache === void 0 ? Effect_exports.fail(new CacheError({ reason: "unavailable" })) : invoke(
137
+ () => reading ??= cache.get(getOptions).finally(() => {
138
+ reading = void 0;
139
+ })
140
+ );
117
141
  if (options.revalidate) {
118
142
  if (cache === void 0) yield* local;
119
143
  else yield* invoke(() => cache.revalidate(getOptions));
@@ -140,14 +164,17 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
140
164
  return values;
141
165
  });
142
166
  const metadata = () => Effect_exports.gen(function* () {
143
- if (cache === void 0) return yield* local;
167
+ if (cache === void 0) return (yield* local).tools;
144
168
  const manifest = yield* current();
145
169
  return yield* pages(cache, manifest.revision, "page", manifest.pages, options.schema);
146
170
  });
147
171
  return {
148
172
  list: metadata,
173
+ /** The record stored with the current revision, if the source supplied one. */
174
+ header: () => cache === void 0 ? local.pipe(Effect_exports.map(({ header }) => header)) : current().pipe(Effect_exports.map((manifest) => manifest.header)),
149
175
  summaries: () => Effect_exports.gen(function* () {
150
- if (cache === void 0) return (yield* local).map((tool) => options.summary.of(tool));
176
+ if (cache === void 0)
177
+ return (yield* local).tools.map((tool) => options.summary.of(tool));
151
178
  const manifest = yield* current();
152
179
  return yield* pages(
153
180
  cache,
@@ -157,7 +184,7 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
157
184
  options.summary.schema
158
185
  );
159
186
  }),
160
- resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map((tools) => tools.find((tool) => tool.name === name))) : current().pipe(
187
+ resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map(({ tools }) => tools.find((tool) => tool.name === name))) : current().pipe(
161
188
  Effect_exports.flatMap(
162
189
  (manifest) => invoke(
163
190
  () => cache.read(part(manifest.revision, "tool", name), schema(options.schema))
@@ -168,5 +195,6 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
168
195
  });
169
196
 
170
197
  export {
198
+ catalogScope,
171
199
  catalogCache
172
200
  };
@@ -0,0 +1,16 @@
1
+ import {
2
+ Predicate_exports
3
+ } from "./chunk-MXDKXAY4.js";
4
+
5
+ // ../utils/src/recorded-message.ts
6
+ var RecordedMessage = /* @__PURE__ */ Symbol.for("@executor-js/utils/RecordedMessage");
7
+ var recordedMessage = (error) => {
8
+ if (!Predicate_exports.hasProperty(error, RecordedMessage)) return void 0;
9
+ const message = error[RecordedMessage];
10
+ return typeof message === "string" ? message : void 0;
11
+ };
12
+
13
+ export {
14
+ RecordedMessage,
15
+ recordedMessage
16
+ };
@@ -0,0 +1,49 @@
1
+ import {
2
+ FetchOptionUnsupported,
3
+ NetworkRefusedHeader,
4
+ RestrictedFetchOption,
5
+ networkRefusalHeader,
6
+ networkRefusalStatus,
7
+ supportedFetchOptions
8
+ } from "./chunk-P7MGDPFD.js";
9
+ import {
10
+ invocationFetch
11
+ } from "./chunk-PNVCCB4L.js";
12
+ import {
13
+ Effect_exports,
14
+ Schema_exports
15
+ } from "./chunk-MXDKXAY4.js";
16
+
17
+ // src/implementation/network.ts
18
+ var refusalHeader = (status, header) => status === networkRefusalStatus && header !== null && header !== void 0 ? header : void 0;
19
+ var failOnNetworkRefusal = (response) => {
20
+ const header = refusalHeader(response.status, response.headers[networkRefusalHeader]);
21
+ return header === void 0 ? Effect_exports.void : Schema_exports.decodeUnknownEffect(NetworkRefusedHeader)(header).pipe(
22
+ Effect_exports.orDie,
23
+ Effect_exports.flatMap(Effect_exports.fail)
24
+ );
25
+ };
26
+ var unsupportedOption = (init) => {
27
+ for (const option of RestrictedFetchOption.literals) {
28
+ const value = init?.[option];
29
+ const supported = supportedFetchOptions[option];
30
+ if (value !== void 0 && !supported.includes(value))
31
+ return new FetchOptionUnsupported({ option, value: String(value), supported });
32
+ }
33
+ return void 0;
34
+ };
35
+ var appFetch = (fetch) => async (input, init) => {
36
+ const unsupported = unsupportedOption(init);
37
+ if (unsupported !== void 0) throw unsupported;
38
+ const response = await fetch(input, init);
39
+ const header = refusalHeader(response.status, response.headers.get(networkRefusalHeader));
40
+ if (header === void 0) return response;
41
+ await response.body?.cancel();
42
+ throw Schema_exports.decodeUnknownSync(NetworkRefusedHeader)(header);
43
+ };
44
+ var appInvocationFetch = (signal) => invocationFetch(signal).pipe(Effect_exports.map(appFetch));
45
+
46
+ export {
47
+ failOnNetworkRefusal,
48
+ appInvocationFetch
49
+ };