apps 0.0.1-beta.1 → 0.0.1-beta.100

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 (211) hide show
  1. package/README.md +112 -72
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/chunk-2CURR5Y7.js +264 -0
  5. package/js/chunk-2LSGC7XY.js +42 -0
  6. package/js/{chunk-YEJOQEII.js → chunk-4PIQKACY.js} +65 -10
  7. package/js/chunk-4UPC36ZL.js +5185 -0
  8. package/js/{chunk-4LPG6RCH.js → chunk-4X2UI4R2.js} +7 -27
  9. package/js/chunk-5C6RAGAS.js +335 -0
  10. package/js/chunk-62NVUKED.js +39 -0
  11. package/js/chunk-74H25C4X.js +95 -0
  12. package/js/chunk-7HG422GB.js +90 -0
  13. package/js/chunk-7STIP5CS.js +171 -0
  14. package/js/{chunk-QKHR7BMF.js → chunk-ACQXVKVQ.js} +87 -51
  15. package/js/{chunk-OHRT55C4.js → chunk-DILSCQPJ.js} +226 -265
  16. package/js/chunk-ILYCJ3HV.js +449 -0
  17. package/js/chunk-K6TSCYAO.js +712 -0
  18. package/js/{chunk-EVJUVWN2.js → chunk-KLSEU35Y.js} +463 -218
  19. package/js/chunk-OD3KFKZD.js +1617 -0
  20. package/js/chunk-OWN3DP2W.js +88 -0
  21. package/js/{chunk-ZTFQHGEB.js → chunk-PBGPES67.js} +3 -5
  22. package/js/chunk-QI66R4FP.js +786 -0
  23. package/js/chunk-RN4YB4JT.js +1922 -0
  24. package/js/{chunk-ZCAMUXSG.js → chunk-URKOTNDA.js} +795 -177
  25. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  26. package/js/{chunk-2HHMABB6.js → chunk-VAI3EVCS.js} +700 -78
  27. package/js/chunk-VCYWAA4N.js +49 -0
  28. package/js/{chunk-HDJH3RPR.js → chunk-YDW7DX3A.js} +4 -4
  29. package/js/chunk-YWVISRZD.js +268 -0
  30. package/js/{chunk-FW5HBOIK.js → chunk-ZKDXML77.js} +19272 -18299
  31. package/js/client.js +148 -100
  32. package/js/contracts.js +208 -24
  33. package/js/effect.js +18 -19
  34. package/js/es-DIULA3ZF.js +39371 -0
  35. package/js/graphql.js +62 -58
  36. package/js/host.js +83 -60
  37. package/js/index.js +381 -263
  38. package/js/mcp/effect.js +21 -21
  39. package/js/mcp.js +117 -74
  40. package/js/openapi.js +4613 -42691
  41. package/js/react.js +2 -3
  42. package/js/skills/effect.js +6 -4
  43. package/js/skills.js +233 -70
  44. package/js/storage/facet.js +1 -540
  45. package/js/ui/auth/contracts.js +8 -9
  46. package/js/ui/auth.js +16 -14
  47. package/js/ui/contracts.js +9 -8
  48. package/js/ui/serving.js +8609 -227
  49. package/package.json +3 -8
  50. package/runtime.json +1 -1
  51. package/types/app-cache/src/contracts/cache.d.ts +60 -2
  52. package/types/app-cache/src/index.d.ts +92 -2
  53. package/types/app-data/src/contracts/database.d.ts +33 -6
  54. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  55. package/types/apps/src/contracts/app.d.ts +63 -17
  56. package/types/apps/src/contracts/cache.d.ts +24 -1
  57. package/types/apps/src/contracts/context.d.ts +60 -17
  58. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  59. package/types/apps/src/contracts/events.d.ts +94 -0
  60. package/types/apps/src/contracts/failure.d.ts +54 -0
  61. package/types/apps/src/contracts/graphql.d.ts +2 -1
  62. package/types/apps/src/contracts/host.d.ts +1325 -534
  63. package/types/apps/src/contracts/icons.d.ts +28 -0
  64. package/types/apps/src/contracts/live.d.ts +2 -0
  65. package/types/apps/src/contracts/mcp.d.ts +97 -20
  66. package/types/apps/src/contracts/network.d.ts +120 -0
  67. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  68. package/types/apps/src/contracts/openapi-document.d.ts +1 -1
  69. package/types/apps/src/contracts/openapi.d.ts +51 -9
  70. package/types/apps/src/contracts/operations.d.ts +14 -12
  71. package/types/apps/src/contracts/placement.d.ts +102 -0
  72. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  73. package/types/apps/src/contracts/protocols/1.d.ts +2241 -0
  74. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  75. package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
  76. package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
  77. package/types/apps/src/contracts/protocols/2.d.ts +711 -0
  78. package/types/apps/src/contracts/protocols/3.d.ts +776 -0
  79. package/types/apps/src/contracts/protocols/4.d.ts +1306 -0
  80. package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
  81. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  82. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  83. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  84. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  85. package/types/apps/src/contracts/protocols/current.d.ts +6857 -0
  86. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  87. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  88. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  89. package/types/apps/src/contracts/provider.d.ts +140 -10
  90. package/types/apps/src/contracts/router.d.ts +59 -0
  91. package/types/apps/src/contracts/schedules.d.ts +7 -1
  92. package/types/apps/src/contracts/schema.d.ts +21 -0
  93. package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
  94. package/types/apps/src/contracts/skills.d.ts +60 -14
  95. package/types/apps/src/contracts/sql.d.ts +63 -0
  96. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  97. package/types/apps/src/contracts/ui.d.ts +70 -30
  98. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  99. package/types/apps/src/contracts/workflows.d.ts +89 -36
  100. package/types/apps/src/facet.d.ts +4 -5
  101. package/types/apps/src/graphql.d.ts +1 -3
  102. package/types/apps/src/host.d.ts +5 -0
  103. package/types/apps/src/implementation/account-router.d.ts +13 -0
  104. package/types/apps/src/implementation/app.d.ts +44 -16
  105. package/types/apps/src/implementation/authoring.d.ts +25 -5
  106. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  107. package/types/apps/src/implementation/cache.d.ts +32 -3
  108. package/types/apps/src/implementation/catalog-cache.d.ts +43 -5
  109. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  110. package/types/apps/src/implementation/events.d.ts +64 -0
  111. package/types/apps/src/implementation/failure-detail.d.ts +48 -0
  112. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  113. package/types/apps/src/implementation/graphql.d.ts +4 -3
  114. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  115. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  116. package/types/apps/src/implementation/live.d.ts +2 -2
  117. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  118. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  119. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  120. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  121. package/types/apps/src/implementation/mcp.d.ts +52 -25
  122. package/types/apps/src/implementation/network.d.ts +16 -0
  123. package/types/apps/src/implementation/openapi-compile.d.ts +30 -8
  124. package/types/apps/src/implementation/openapi-document.d.ts +46 -21
  125. package/types/apps/src/implementation/openapi-names.d.ts +23 -0
  126. package/types/apps/src/implementation/openapi-request.d.ts +10 -3
  127. package/types/apps/src/implementation/openapi-source.d.ts +30 -8
  128. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  129. package/types/apps/src/implementation/operations.d.ts +84 -10
  130. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  131. package/types/apps/src/implementation/placement.d.ts +60 -0
  132. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  133. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  134. package/types/apps/src/implementation/provider.d.ts +26 -6
  135. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  136. package/types/apps/src/implementation/router-catalog.d.ts +227 -0
  137. package/types/apps/src/implementation/router.d.ts +78 -0
  138. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  139. package/types/apps/src/implementation/schedules.d.ts +39 -8
  140. package/types/apps/src/implementation/schema.d.ts +111 -15
  141. package/types/apps/src/implementation/skills.d.ts +18 -24
  142. package/types/apps/src/implementation/sql.d.ts +71 -0
  143. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  144. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  145. package/types/apps/src/implementation/ui-auth.d.ts +12 -6
  146. package/types/apps/src/implementation/ui-client.d.ts +3 -3
  147. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  148. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  149. package/types/apps/src/implementation/ui-serving.d.ts +31 -12
  150. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  151. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  152. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  153. package/types/apps/src/implementation/workflow-context.d.ts +17 -5
  154. package/types/apps/src/implementation/workflows.d.ts +11 -4
  155. package/types/apps/src/index.d.ts +71 -21
  156. package/types/apps/src/mcp.d.ts +25 -5
  157. package/types/apps/src/openapi.d.ts +11 -6
  158. package/types/apps/src/react.d.ts +1 -1
  159. package/types/apps/src/skills.d.ts +13 -8
  160. package/types/apps/src/ui-auth.d.ts +2 -2
  161. package/types/apps/src/ui-serving.d.ts +1 -1
  162. package/types/telemetry/src/app-records.d.ts +42 -0
  163. package/types/telemetry/src/browser-operations.d.ts +7 -4
  164. package/types/telemetry/src/browser.d.ts +8 -3
  165. package/types/telemetry/src/config.d.ts +2 -2
  166. package/types/telemetry/src/index.d.ts +2 -1
  167. package/types/telemetry/src/layer.d.ts +10 -4
  168. package/types/telemetry/src/measurements.d.ts +1 -1
  169. package/types/telemetry/src/ownership.d.ts +60 -0
  170. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  171. package/types/telemetry/src/relay.d.ts +16 -6
  172. package/types/telemetry/src/span-attributes.d.ts +17 -1
  173. package/types/telemetry/src/transport.d.ts +8 -1
  174. package/types/utils/src/api-error.d.ts +55 -0
  175. package/types/utils/src/connection-failure.d.ts +33 -0
  176. package/types/utils/src/legacy-keys.d.ts +20 -0
  177. package/types/utils/src/recorded-message.d.ts +18 -0
  178. package/types/utils/src/schema-definitions.d.ts +13 -0
  179. package/types/utils/src/user-facing-error.d.ts +83 -0
  180. package/js/chunk-6IIO4NPI.js +0 -29
  181. package/js/chunk-6YBRWRK3.js +0 -160
  182. package/js/chunk-BMOIAIVR.js +0 -138
  183. package/js/chunk-FZJOYIZO.js +0 -19
  184. package/js/chunk-G7IE6BKC.js +0 -224
  185. package/js/chunk-IHQ4ML7K.js +0 -2193
  186. package/js/chunk-KOXMLKTM.js +0 -1288
  187. package/js/chunk-M6ZRRIBI.js +0 -877
  188. package/js/chunk-PLCMJREA.js +0 -590
  189. package/js/chunk-PZ36XMXW.js +0 -93
  190. package/js/chunk-RBAC33PQ.js +0 -267
  191. package/js/chunk-SATWJKN6.js +0 -34
  192. package/js/chunk-SWPD52J7.js +0 -35
  193. package/js/chunk-TE4KO4HI.js +0 -47
  194. package/js/chunk-W7D7WVSY.js +0 -18
  195. package/js/chunk-X7SFGU4Q.js +0 -280
  196. package/js/chunk-ZJWDMTE3.js +0 -63
  197. package/js/mcp/stdio.js +0 -128
  198. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  199. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  200. package/types/app-data/src/implementation/promise.d.ts +0 -68
  201. package/types/app-data/src/implementation/range.d.ts +0 -8
  202. package/types/app-data/src/implementation/schema.d.ts +0 -33
  203. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  204. package/types/app-data/src/index.d.ts +0 -4
  205. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  206. package/types/apps/src/contracts/storage.d.ts +0 -68
  207. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  208. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  209. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  210. package/types/apps/src/implementation/storage.d.ts +0 -13
  211. package/types/apps/src/mcp-stdio.d.ts +0 -8
package/js/graphql.js CHANGED
@@ -1,54 +1,60 @@
1
1
  import {
2
- catalogCache
3
- } from "./chunk-6YBRWRK3.js";
2
+ catalogCache,
3
+ catalogScope
4
+ } from "./chunk-YWVISRZD.js";
4
5
  import {
5
6
  protocolOperations
6
- } from "./chunk-6IIO4NPI.js";
7
+ } from "./chunk-2LSGC7XY.js";
7
8
  import "./chunk-BCSNKUAC.js";
9
+ import "./chunk-RN4YB4JT.js";
8
10
  import {
9
11
  cacheKey
10
- } from "./chunk-KOXMLKTM.js";
11
- import "./chunk-ZTFQHGEB.js";
12
- import "./chunk-NCYXZN2G.js";
13
- import "./chunk-RBAC33PQ.js";
14
- import "./chunk-PLCMJREA.js";
12
+ } from "./chunk-5C6RAGAS.js";
13
+ import "./chunk-QI66R4FP.js";
15
14
  import {
16
- nativeOperation
17
- } from "./chunk-PZ36XMXW.js";
15
+ failOnNetworkRefusal
16
+ } from "./chunk-VCYWAA4N.js";
17
+ import "./chunk-PBGPES67.js";
18
+ import "./chunk-ILYCJ3HV.js";
19
+ import {
20
+ nativeOperation,
21
+ routerDeclaration
22
+ } from "./chunk-2CURR5Y7.js";
18
23
  import {
19
24
  accountProviderError,
20
25
  graphqlProviderError,
21
26
  httpProviderError
22
- } from "./chunk-ZJWDMTE3.js";
23
- import "./chunk-IHQ4ML7K.js";
24
- import "./chunk-BMOIAIVR.js";
25
- import "./chunk-YEJOQEII.js";
26
- import "./chunk-SWPD52J7.js";
27
+ } from "./chunk-7STIP5CS.js";
27
28
  import {
29
+ NetworkRefused,
28
30
  ProviderError
29
- } from "./chunk-W7D7WVSY.js";
30
- import "./chunk-ZCAMUXSG.js";
31
+ } from "./chunk-4UPC36ZL.js";
32
+ import "./chunk-4PIQKACY.js";
31
33
  import {
32
- FetchHttpClient_exports
33
- } from "./chunk-HDJH3RPR.js";
34
+ jsonSchemaDecoder
35
+ } from "./chunk-VAI3EVCS.js";
34
36
  import {
35
- HttpClientRequest_exports,
36
- HttpClient_exports
37
- } from "./chunk-QKHR7BMF.js";
37
+ owned
38
+ } from "./chunk-URKOTNDA.js";
38
39
  import {
39
- jsonSchemaDecoder
40
- } from "./chunk-2HHMABB6.js";
41
- import "./chunk-FZJOYIZO.js";
40
+ FetchHttpClient_exports
41
+ } from "./chunk-YDW7DX3A.js";
42
+ import "./chunk-OWN3DP2W.js";
42
43
  import {
43
44
  AccountId,
44
45
  HttpUrl,
45
46
  JsonObject
46
- } from "./chunk-SATWJKN6.js";
47
+ } from "./chunk-7HG422GB.js";
48
+ import "./chunk-DILSCQPJ.js";
49
+ import {
50
+ HttpClientRequest_exports,
51
+ HttpClient_exports
52
+ } from "./chunk-ACQXVKVQ.js";
47
53
  import {
48
54
  Effect_exports,
49
55
  Redacted_exports,
50
56
  Schema_exports
51
- } from "./chunk-FW5HBOIK.js";
57
+ } from "./chunk-ZKDXML77.js";
52
58
  import "./chunk-CZ7CSFO4.js";
53
59
 
54
60
  // src/contracts/graphql.ts
@@ -84,7 +90,7 @@ var GraphqlError = class extends Schema_exports.TaggedError()("GraphqlError", {
84
90
  status: Schema_exports.optional(Schema_exports.Number)
85
91
  }) {
86
92
  };
87
- var Name = Schema_exports.String.check(Schema_exports.isPattern(/^[_A-Za-z][_0-9A-Za-z]*$/));
93
+ var Name = Schema_exports.String.check(Schema_exports.isPattern(/^[_A-Za-z][_0-9A-Za-z]*$/u));
88
94
  var Kind = Schema_exports.Literals([
89
95
  "SCALAR",
90
96
  "OBJECT",
@@ -267,10 +273,11 @@ var graphqlClientEffect = (input) => Effect_exports.gen(function* () {
267
273
  HttpClientRequest_exports.bodyJsonUnsafe({ query, variables })
268
274
  )
269
275
  );
276
+ yield* failOnNetworkRefusal(response);
270
277
  if (response.status < 200 || response.status >= 300)
271
278
  return yield* httpProviderError(response.status, response.headers) ?? new GraphqlError({ phase, reason: "request", status: response.status });
272
279
  const result = yield* response.json.pipe(
273
- Effect_exports.withSpan("provider.http.response.read"),
280
+ owned("upstream", "provider.http.response.read"),
274
281
  Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlResponse)),
275
282
  Effect_exports.mapError(() => new GraphqlError({ phase, reason: "invalid_response" }))
276
283
  );
@@ -281,7 +288,7 @@ var graphqlClientEffect = (input) => Effect_exports.gen(function* () {
281
288
  return result.data;
282
289
  })
283
290
  ).pipe(
284
- Effect_exports.withSpan("provider.graphql.request", {
291
+ owned("upstream", "provider.graphql.request", {
285
292
  attributes: {
286
293
  "executor.operation": phase,
287
294
  "server.address": url.hostname
@@ -295,13 +302,13 @@ var graphqlClientEffect = (input) => Effect_exports.gen(function* () {
295
302
  orElse: () => Effect_exports.fail(new GraphqlError({ phase, reason: "timeout" }))
296
303
  }),
297
304
  Effect_exports.mapError(
298
- (error) => error instanceof ProviderError && options.accountId !== void 0 ? accountProviderError(error, options.accountId) : error instanceof GraphqlError || error instanceof ProviderError ? error : new GraphqlError({ phase, reason: "request" })
305
+ (error) => error instanceof ProviderError && options.accountId !== void 0 ? accountProviderError(error, options.accountId) : error instanceof GraphqlError || error instanceof ProviderError || error instanceof NetworkRefused ? error : new GraphqlError({ phase, reason: "request" })
299
306
  )
300
307
  );
301
308
  const discover = request("discover", getIntrospectionQuery()).pipe(
302
309
  Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlIntrospection)),
303
310
  Effect_exports.mapError(
304
- (error) => error instanceof GraphqlError || error instanceof ProviderError ? error : new GraphqlError({ phase: "discover", reason: "invalid_response" })
311
+ (error) => error instanceof GraphqlError || error instanceof ProviderError || error instanceof NetworkRefused ? error : new GraphqlError({ phase: "discover", reason: "invalid_response" })
305
312
  )
306
313
  );
307
314
  return { request, discover };
@@ -410,7 +417,7 @@ var adaptGraphqlTool = (client, definition) => Effect_exports.gen(function* () {
410
417
  return yield* new GraphqlError({ phase: "call", reason: "invalid_response" });
411
418
  return value;
412
419
  }).pipe(
413
- Effect_exports.withSpan("provider.graphql.call", {
420
+ owned("upstream", "provider.graphql.call", {
414
421
  attributes: {
415
422
  "graphql.operation.type": kind,
416
423
  "executor.tool.name": name
@@ -428,17 +435,20 @@ var GraphqlToolSummary = GraphqlToolDefinition.mapFields(({ name, kind, descript
428
435
  description
429
436
  }));
430
437
  var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
431
- const parsed = yield* Schema_exports.decodeUnknownEffect(GraphqlToolsOptions)(options).pipe(
432
- Effect_exports.mapError(() => new GraphqlError({ phase: "discover", reason: "invalid_input" }))
433
- );
434
- const headers = {};
435
- new Headers(parsed.headers).forEach((value, name) => {
436
- headers[name] = value;
437
- });
438
- const id = yield* cacheKey({ url: parsed.url, headers, accountId: parsed.accountId ?? null });
438
+ const invalid = () => new GraphqlError({ phase: "discover", reason: "invalid_input" });
439
+ const parsed = yield* Schema_exports.decodeUnknownEffect(GraphqlToolsOptions)({
440
+ url: options.url,
441
+ accountId: options.account?.id,
442
+ headers: options.headers,
443
+ signal: options.signal,
444
+ timeoutMs: options.timeoutMs
445
+ }).pipe(Effect_exports.mapError(invalid));
446
+ const cache = yield* catalogScope(options, options.headers, invalid);
447
+ const id = yield* cacheKey({ url: parsed.url });
439
448
  const client = yield* graphqlClientEffect(parsed);
440
449
  const catalog = yield* catalogCache({
441
450
  ...options,
451
+ cache,
442
452
  prefix: ["graphql-catalog-v2", id],
443
453
  schema: GraphqlToolDefinition,
444
454
  summary: {
@@ -447,13 +457,13 @@ var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
447
457
  },
448
458
  load: (context) => (context === void 0 ? Effect_exports.succeed(client) : graphqlClientEffect({ ...parsed, signal: context.signal })).pipe(
449
459
  Effect_exports.flatMap((source) => source.discover),
450
- Effect_exports.flatMap(graphqlDefinitions)
460
+ Effect_exports.flatMap(graphqlDefinitions),
461
+ Effect_exports.map((tools) => ({ tools }))
451
462
  )
452
463
  });
453
464
  const kindOf = (tool) => Object.hasOwn(kinds, tool.name) ? kinds[tool.name] ?? "mutation" : tool.kind;
454
- const qualified = (tool) => `${kindOf(tool) === "query" ? "queries" : "mutations"}.${tool.name}`;
455
465
  const summarize = (tool) => ({
456
- name: qualified(tool),
466
+ name: tool.name,
457
467
  description: tool.description,
458
468
  readOnly: kindOf(tool) === "query"
459
469
  });
@@ -461,34 +471,28 @@ var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
461
471
  ...summarize(tool),
462
472
  inputSchema: tool.inputSchema
463
473
  });
464
- const selected = (name) => Effect_exports.gen(function* () {
465
- if (!name.startsWith("queries.") && !name.startsWith("mutations.")) return void 0;
466
- const tool = yield* catalog.resolve(name.slice(name.indexOf(".") + 1));
467
- return tool === void 0 || qualified(tool) !== name ? void 0 : tool;
468
- });
469
- const dynamicTools = {
474
+ const router = {
475
+ kind: "dynamic",
470
476
  list: () => catalog.list().pipe(Effect_exports.map((tools) => tools.map(describe))),
471
477
  summaries: () => catalog.summaries().pipe(Effect_exports.map((tools) => tools.map(summarize))),
472
- describe: (name) => selected(name).pipe(
473
- Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))
474
- ),
478
+ describe: (name) => catalog.resolve(name).pipe(Effect_exports.map((tool) => tool === void 0 ? void 0 : describe(tool))),
475
479
  resolve: (name) => Effect_exports.gen(function* () {
476
- const tool = yield* selected(name);
480
+ const tool = yield* catalog.resolve(name);
477
481
  if (tool === void 0) return void 0;
478
482
  const adapted = yield* adaptGraphqlTool(client, tool);
479
483
  const operations = protocolOperations({ selected: adapted }, { selected: kindOf(tool) });
480
- return nativeOperation(operations.queries.selected ?? operations.mutations.selected);
484
+ return nativeOperation(operations.selected);
481
485
  })
482
486
  };
483
- return { dynamicTools };
487
+ return routerDeclaration(router);
484
488
  });
485
489
 
486
490
  // src/graphql.ts
487
- var graphqlOperations = (options, kinds = {}) => Effect_exports.runPromise(
491
+ var graphqlRouter = (options, kinds = {}) => Effect_exports.runPromise(
488
492
  graphqlCatalog(options, kinds),
489
493
  options.signal === void 0 ? {} : { signal: options.signal }
490
494
  );
491
495
  export {
492
496
  GraphqlError,
493
- graphqlOperations
497
+ graphqlRouter
494
498
  };
package/js/host.js CHANGED
@@ -1,22 +1,23 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-KOXMLKTM.js";
4
- import "./chunk-ZTFQHGEB.js";
5
- import "./chunk-NCYXZN2G.js";
3
+ } from "./chunk-RN4YB4JT.js";
4
+ import "./chunk-5C6RAGAS.js";
5
+ import "./chunk-QI66R4FP.js";
6
+ import "./chunk-VCYWAA4N.js";
7
+ import "./chunk-PBGPES67.js";
8
+ import "./chunk-ILYCJ3HV.js";
9
+ import "./chunk-2CURR5Y7.js";
10
+ import "./chunk-7STIP5CS.js";
6
11
  import {
7
12
  CacheCommand,
8
13
  CacheError,
9
- CacheReply
10
- } from "./chunk-RBAC33PQ.js";
11
- import "./chunk-PLCMJREA.js";
12
- import "./chunk-PZ36XMXW.js";
13
- import "./chunk-ZJWDMTE3.js";
14
- import {
14
+ CacheReply,
15
15
  ElicitationFailed,
16
16
  ElicitationReply,
17
17
  HostAccountsInvalid,
18
18
  HostInputInvalid,
19
19
  HostResponse,
20
+ InvocationTimingSink,
20
21
  ResolvedAccounts,
21
22
  TrustedToolApproval,
22
23
  WorkflowFailure,
@@ -24,27 +25,26 @@ import {
24
25
  WorkflowRun,
25
26
  WorkflowRunId,
26
27
  WorkflowRunPage
27
- } from "./chunk-IHQ4ML7K.js";
28
- import "./chunk-BMOIAIVR.js";
29
- import "./chunk-YEJOQEII.js";
30
- import "./chunk-SWPD52J7.js";
31
- import "./chunk-W7D7WVSY.js";
28
+ } from "./chunk-4UPC36ZL.js";
29
+ import "./chunk-4PIQKACY.js";
30
+ import "./chunk-VAI3EVCS.js";
32
31
  import {
33
32
  collectTelemetry,
34
33
  withRemoteSpan
35
- } from "./chunk-ZCAMUXSG.js";
36
- import "./chunk-HDJH3RPR.js";
37
- import "./chunk-QKHR7BMF.js";
38
- import "./chunk-2HHMABB6.js";
39
- import "./chunk-FZJOYIZO.js";
40
- import "./chunk-SATWJKN6.js";
34
+ } from "./chunk-URKOTNDA.js";
35
+ import "./chunk-YDW7DX3A.js";
36
+ import "./chunk-OWN3DP2W.js";
37
+ import "./chunk-7HG422GB.js";
38
+ import "./chunk-DILSCQPJ.js";
39
+ import "./chunk-ACQXVKVQ.js";
41
40
  import {
42
41
  Cause_exports,
42
+ Clock_exports,
43
43
  Effect_exports,
44
44
  Redacted_exports,
45
45
  Scheduler_exports,
46
46
  Schema_exports
47
- } from "./chunk-FW5HBOIK.js";
47
+ } from "./chunk-ZKDXML77.js";
48
48
  import "./chunk-CZ7CSFO4.js";
49
49
 
50
50
  // src/implementation/cache-session.ts
@@ -52,14 +52,17 @@ var isolatedCacheSession = (callback) => {
52
52
  const controller = new AbortController();
53
53
  const pending = /* @__PURE__ */ new Set();
54
54
  const cache = {
55
- transport: (command) => Effect_exports.tryPromise({
56
- try: () => callback(Schema_exports.encodeSync(CacheCommand)(command)),
57
- catch: () => new CacheError({ reason: "storage" })
58
- }).pipe(
59
- Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(CacheReply)),
60
- Effect_exports.mapError(() => new CacheError({ reason: "storage" })),
61
- Effect_exports.flatMap(
62
- (reply) => reply.ok ? Effect_exports.succeed(reply.value) : Effect_exports.fail(reply.error)
55
+ transport: (command) => (
56
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's cache RPC
57
+ Effect_exports.tryPromise({
58
+ try: () => callback(Schema_exports.encodeSync(CacheCommand)(command)),
59
+ catch: () => new CacheError({ reason: "storage" })
60
+ }).pipe(
61
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(CacheReply)),
62
+ Effect_exports.mapError(() => new CacheError({ reason: "storage" })),
63
+ Effect_exports.flatMap(
64
+ (reply) => reply.ok ? Effect_exports.succeed(reply.value) : Effect_exports.fail(reply.error)
65
+ )
63
66
  )
64
67
  ),
65
68
  background: (task) => Effect_exports.gen(function* () {
@@ -97,14 +100,17 @@ var isolatedCacheSession = (callback) => {
97
100
  // src/implementation/workflow-rpc.ts
98
101
  var isolatedWorkflowExecution = (run, deliver, signal) => {
99
102
  const runId = Schema_exports.decodeUnknownSync(WorkflowRunId)(run);
100
- const request = (input, callback) => Effect_exports.tryPromise({
101
- try: () => deliver(input, callback),
102
- catch: () => new WorkflowFailure({ reason: "engine", retryable: true })
103
- }).pipe(
104
- Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(WorkflowRpcResult)),
105
- Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true })),
106
- Effect_exports.flatMap(
107
- (reply) => reply.ok ? Effect_exports.succeed(reply.value) : Effect_exports.fail(reply.error)
103
+ const request = (input, callback) => (
104
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's workflow RPC
105
+ Effect_exports.tryPromise({
106
+ try: () => deliver(input, callback),
107
+ catch: () => new WorkflowFailure({ reason: "engine", retryable: true })
108
+ }).pipe(
109
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(WorkflowRpcResult)),
110
+ Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true })),
111
+ Effect_exports.flatMap(
112
+ (reply) => reply.ok ? Effect_exports.succeed(reply.value) : Effect_exports.fail(reply.error)
113
+ )
108
114
  )
109
115
  );
110
116
  return {
@@ -146,14 +152,17 @@ var isolatedWorkflowExecution = (run, deliver, signal) => {
146
152
  };
147
153
  };
148
154
  var isolatedWorkflowControls = (deliver) => {
149
- const request = (input) => Effect_exports.tryPromise({
150
- try: () => deliver(input),
151
- catch: () => new WorkflowFailure({ reason: "engine", retryable: true })
152
- }).pipe(
153
- Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(WorkflowRpcResult)),
154
- Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true })),
155
- Effect_exports.flatMap(
156
- (result) => result.ok ? Effect_exports.succeed(result.value) : Effect_exports.fail(result.error)
155
+ const request = (input) => (
156
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's workflow RPC
157
+ Effect_exports.tryPromise({
158
+ try: () => deliver(input),
159
+ catch: () => new WorkflowFailure({ reason: "engine", retryable: true })
160
+ }).pipe(
161
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(WorkflowRpcResult)),
162
+ Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true })),
163
+ Effect_exports.flatMap(
164
+ (result) => result.ok ? Effect_exports.succeed(result.value) : Effect_exports.fail(result.error)
165
+ )
157
166
  )
158
167
  );
159
168
  const run = (input) => request(input).pipe(
@@ -202,17 +211,27 @@ var createAppHandler2 = (app) => {
202
211
  );
203
212
  };
204
213
  };
214
+ var isolatedClock = () => Effect_exports.runSync(Clock_exports.currentTimeNanos);
205
215
  var createIsolatedAppHandler = (app) => {
206
216
  const handler = createAppHandler(app);
207
217
  return (request, context) => Effect_exports.runPromise(
208
218
  Effect_exports.gen(function* () {
219
+ let timing;
209
220
  const { value, telemetry } = yield* collectTelemetry(
210
- handler(request, context).pipe(withRemoteSpan(request, "app.dispatch"))
221
+ handler(request, context).pipe(
222
+ withRemoteSpan(request, "app.dispatch"),
223
+ Effect_exports.provideService(InvocationTimingSink, (reported) => {
224
+ timing = reported;
225
+ })
226
+ )
211
227
  );
212
228
  const body = yield* Effect_exports.promise(() => value.json()).pipe(
213
229
  Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(HostResponse))
214
230
  );
215
- return Response.json({ ...body, telemetry }, { status: value.status });
231
+ return Response.json(
232
+ { ...body, telemetry, ...timing === void 0 ? {} : { timing } },
233
+ { status: value.status }
234
+ );
216
235
  }),
217
236
  {
218
237
  signal: request.signal,
@@ -222,20 +241,23 @@ var createIsolatedAppHandler = (app) => {
222
241
  }
223
242
  );
224
243
  };
225
- var isolatedElicitation = (deliver, lifetime) => (request) => Effect_exports.tryPromise({
226
- try: () => deliver(request),
227
- catch: () => {
228
- lifetime.abort();
229
- return new ElicitationFailed({ reason: "transport" });
230
- }
231
- }).pipe(
232
- Effect_exports.flatMap(
233
- (reply) => Schema_exports.decodeUnknownEffect(ElicitationReply)(reply).pipe(
234
- Effect_exports.mapError(() => new ElicitationFailed({ reason: "transport" }))
244
+ var isolatedElicitation = (deliver, lifetime) => (request) => (
245
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's elicitation RPC
246
+ Effect_exports.tryPromise({
247
+ try: () => deliver(request),
248
+ catch: () => {
249
+ lifetime.abort();
250
+ return new ElicitationFailed({ reason: "transport" });
251
+ }
252
+ }).pipe(
253
+ Effect_exports.flatMap(
254
+ (reply) => Schema_exports.decodeUnknownEffect(ElicitationReply)(reply).pipe(
255
+ Effect_exports.mapError(() => new ElicitationFailed({ reason: "transport" }))
256
+ )
257
+ ),
258
+ Effect_exports.flatMap(
259
+ (reply) => reply.ok ? Effect_exports.succeed(reply.response) : Effect_exports.fail(reply.error)
235
260
  )
236
- ),
237
- Effect_exports.flatMap(
238
- (reply) => reply.ok ? Effect_exports.succeed(reply.response) : Effect_exports.fail(reply.error)
239
261
  )
240
262
  );
241
263
  export {
@@ -243,6 +265,7 @@ export {
243
265
  createIsolatedAppHandler,
244
266
  hostContext,
245
267
  isolatedCacheSession,
268
+ isolatedClock,
246
269
  isolatedElicitation,
247
270
  isolatedWorkflowControls,
248
271
  isolatedWorkflowExecution