apps 0.0.1-beta.43 → 0.0.1-beta.46

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 (54) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-XSD3RZFX.js → chunk-3B2JAOSE.js} +23 -12
  3. package/js/{chunk-KTPKTBKZ.js → chunk-3UGDI2UI.js} +5 -5
  4. package/js/chunk-5FHWNLCI.js +88 -0
  5. package/js/{chunk-MSDGZ7FA.js → chunk-6QXPBJ5T.js} +14 -13
  6. package/js/{chunk-Z3S2IVI3.js → chunk-7LGRK7TP.js} +2 -2
  7. package/js/{chunk-T65AFHU3.js → chunk-7UUHJR2Q.js} +1 -1
  8. package/js/{chunk-4ZTVLEN6.js → chunk-CDXQDN7W.js} +1 -1
  9. package/js/{chunk-OBXHQNWC.js → chunk-CVAJ4F6O.js} +16 -3
  10. package/js/{chunk-KBIKBWSS.js → chunk-H72MEDMN.js} +4 -3
  11. package/js/{chunk-VU6GQ2SH.js → chunk-JM7LOD2W.js} +212 -22
  12. package/js/{chunk-EJUK2NK5.js → chunk-KLYSEHUD.js} +1 -1
  13. package/js/{chunk-ILYK7BQG.js → chunk-LHCGND3R.js} +12 -46
  14. package/js/{chunk-EMHFXFTJ.js → chunk-LTDHQJ2Z.js} +53 -0
  15. package/js/{chunk-47BLLMRQ.js → chunk-OJ47HQVJ.js} +143 -65
  16. package/js/{chunk-MZH4J2PO.js → chunk-PD6I2SDG.js} +1 -1
  17. package/js/{chunk-KSGYJV46.js → chunk-TUMGL2OC.js} +1 -1
  18. package/js/{chunk-5GLC42LK.js → chunk-UM62MBJQ.js} +42 -24
  19. package/js/{chunk-IN2WIN7I.js → chunk-XBG7HHXC.js} +1 -1
  20. package/js/{chunk-RIKH5H2X.js → chunk-XK5I2XOI.js} +39 -29
  21. package/js/client.js +9 -9
  22. package/js/contracts.js +9 -5
  23. package/js/effect.js +14 -14
  24. package/js/graphql.js +23 -21
  25. package/js/host.js +79 -54
  26. package/js/index.js +23 -18
  27. package/js/mcp/effect.js +16 -16
  28. package/js/mcp/stdio.js +30 -25
  29. package/js/mcp.js +23 -21
  30. package/js/openapi.js +106 -80
  31. package/js/skills/effect.js +5 -5
  32. package/js/skills.js +53 -36
  33. package/js/ui/auth.js +3 -3
  34. package/js/ui/contracts.js +3 -3
  35. package/js/ui/serving.js +7 -7
  36. package/package.json +1 -1
  37. package/runtime.json +1 -1
  38. package/types/apps/src/contracts/host.d.ts +15 -0
  39. package/types/apps/src/host.d.ts +5 -0
  40. package/types/apps/src/implementation/authoring.d.ts +25 -5
  41. package/types/apps/src/implementation/cache.d.ts +4 -0
  42. package/types/apps/src/implementation/elicitation.d.ts +6 -3
  43. package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
  44. package/types/apps/src/implementation/operations.d.ts +2 -2
  45. package/types/apps/src/implementation/router-catalog.d.ts +4 -4
  46. package/types/apps/src/implementation/workflows.d.ts +1 -1
  47. package/types/telemetry/src/index.d.ts +1 -0
  48. package/types/telemetry/src/ownership.d.ts +56 -0
  49. package/types/telemetry/src/recorded-failure.d.ts +20 -11
  50. package/types/utils/src/api-error.d.ts +4 -2
  51. package/types/utils/src/recorded-message.d.ts +7 -4
  52. package/types/utils/src/user-facing-error.d.ts +4 -2
  53. package/js/chunk-EG72MSVK.js +0 -16
  54. package/js/{chunk-LNSVJS2Q.js → chunk-EOPQ727L.js} +2 -2
@@ -1,12 +1,10 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-47BLLMRQ.js";
3
+ } from "./chunk-OJ47HQVJ.js";
4
4
  import {
5
+ bodyUpstreamError,
5
6
  fromPromise
6
- } from "./chunk-ILYK7BQG.js";
7
- import {
8
- bodyUpstreamError
9
- } from "./chunk-EMHFXFTJ.js";
7
+ } from "./chunk-LTDHQJ2Z.js";
10
8
  import {
11
9
  ElicitationFailed,
12
10
  McpError,
@@ -18,12 +16,15 @@ import {
18
16
  defaultElicitationLimits,
19
17
  defaultMcpClientLimits,
20
18
  mcpSdkTimerCeilingMs
21
- } from "./chunk-OBXHQNWC.js";
19
+ } from "./chunk-CVAJ4F6O.js";
22
20
  import {
23
21
  jsonSchemaDecoder,
24
22
  nestJsonSchema,
25
23
  preparedJsonSchemaDecoder
26
24
  } from "./chunk-KGCTYL2S.js";
25
+ import {
26
+ owned
27
+ } from "./chunk-JM7LOD2W.js";
27
28
  import {
28
29
  JsonObject
29
30
  } from "./chunk-H2CJWXA3.js";
@@ -187,11 +188,14 @@ var mcpCall = (client, name, input, context, timeoutMs, failure) => Effect_expor
187
188
  const callbacks = /* @__PURE__ */ new Set();
188
189
  const lifetime = yield* Effect_exports.acquireRelease(
189
190
  Effect_exports.sync(() => new AbortController()),
190
- (controller) => Effect_exports.promise(async () => {
191
- controller.abort();
192
- client.removeRequestHandler("elicitation/create");
193
- await Promise.allSettled(callbacks);
194
- })
191
+ (controller) => (
192
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the MCP SDK's elicitation callbacks
193
+ Effect_exports.promise(async () => {
194
+ controller.abort();
195
+ client.removeRequestHandler("elicitation/create");
196
+ await Promise.allSettled(callbacks);
197
+ })
198
+ )
195
199
  );
196
200
  client.setRequestHandler(ElicitRequestSchema, (request, extra) => {
197
201
  const signal = AbortSignal.any([lifetime.signal, extra.signal]);
@@ -203,7 +207,10 @@ var mcpCall = (client, name, input, context, timeoutMs, failure) => Effect_expor
203
207
  const deliver = context.elicit;
204
208
  if (deliver === void 0) return yield* new ElicitationFailed({ reason: "unavailable" });
205
209
  const answer = yield* budget.waitForInput(
206
- fromPromise(deliver)(form.request).pipe(
210
+ fromPromise(
211
+ deliver,
212
+ "elicitation"
213
+ )(form.request).pipe(
207
214
  Effect_exports.mapError(
208
215
  (error) => Option_exports.getOrElse(
209
216
  Schema_exports.decodeUnknownOption(ElicitationFailed)(error),
@@ -253,7 +260,7 @@ var mcpCall = (client, name, input, context, timeoutMs, failure) => Effect_expor
253
260
  );
254
261
  })
255
262
  ).pipe(
256
- Effect_exports.withSpan("provider.mcp.request", {
263
+ owned("upstream", "provider.mcp.request", {
257
264
  kind: "client",
258
265
  attributes: {
259
266
  "rpc.system.name": "jsonrpc",
@@ -311,7 +318,7 @@ function mcpClient(withClient, timeoutMs, failure) {
311
318
  ),
312
319
  catch: (error) => failure("discover", error)
313
320
  }).pipe(
314
- Effect_exports.withSpan("provider.mcp.request", {
321
+ owned("upstream", "provider.mcp.request", {
315
322
  kind: "client",
316
323
  attributes: { "rpc.system.name": "jsonrpc", "rpc.method": "tools/list" }
317
324
  })
@@ -352,25 +359,28 @@ function mcpClient(withClient, timeoutMs, failure) {
352
359
  server: Option_exports.getOrElse(server, () => ({}))
353
360
  };
354
361
  })
355
- ).pipe(Effect_exports.withSpan("provider.mcp.discover"));
362
+ ).pipe(owned("upstream", "provider.mcp.discover"));
356
363
  const check = withClient(
357
364
  "discover",
358
- (client) => Effect_exports.tryPromise({
359
- try: (signal) => client.request({ method: "tools/list", params: {} }, ListToolsResultSchema, {
360
- signal,
361
- timeout: timeoutMs
362
- }),
363
- catch: (error) => failure("discover", error)
364
- }).pipe(
365
- Effect_exports.asVoid,
366
- Effect_exports.withSpan("provider.mcp.request", {
367
- kind: "client",
368
- attributes: { "rpc.system.name": "jsonrpc", "rpc.method": "tools/list" }
369
- })
365
+ (client) => (
366
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- MCP SDK
367
+ Effect_exports.tryPromise({
368
+ try: (signal) => client.request({ method: "tools/list", params: {} }, ListToolsResultSchema, {
369
+ signal,
370
+ timeout: timeoutMs
371
+ }),
372
+ catch: (error) => failure("discover", error)
373
+ }).pipe(
374
+ Effect_exports.asVoid,
375
+ owned("upstream", "provider.mcp.request", {
376
+ kind: "client",
377
+ attributes: { "rpc.system.name": "jsonrpc", "rpc.method": "tools/list" }
378
+ })
379
+ )
370
380
  )
371
- ).pipe(Effect_exports.withSpan("provider.mcp.check"));
381
+ ).pipe(owned("upstream", "provider.mcp.check"));
372
382
  const call = (name, input, context) => withClient("call", (client) => mcpCall(client, name, input, context, timeoutMs, failure)).pipe(
373
- Effect_exports.withSpan("provider.mcp.call", { attributes: { "mcp.tool.name": name } })
383
+ owned("upstream", "provider.mcp.call", { attributes: { "mcp.tool.name": name } })
374
384
  );
375
385
  return { list, check, call };
376
386
  }
package/js/client.js CHANGED
@@ -3,36 +3,36 @@ import {
3
3
  UiContext,
4
4
  UiDeploymentChanged,
5
5
  UiFailed
6
- } from "./chunk-4ZTVLEN6.js";
6
+ } from "./chunk-CDXQDN7W.js";
7
7
  import {
8
8
  AsyncResult_exports,
9
9
  AtomRegistry_exports,
10
10
  Atom_exports,
11
11
  queryResult
12
12
  } from "./chunk-74YVXBKY.js";
13
+ import {
14
+ decoderOf
15
+ } from "./chunk-KGCTYL2S.js";
13
16
  import {
14
17
  OtlpExporter_exports,
15
18
  externalTrace,
16
19
  pendingSpan,
17
20
  telemetryLayer,
18
21
  traceLinks
19
- } from "./chunk-VU6GQ2SH.js";
22
+ } from "./chunk-JM7LOD2W.js";
20
23
  import {
21
24
  FetchHttpClient_exports
22
- } from "./chunk-MZH4J2PO.js";
23
- import {
24
- decoderOf
25
- } from "./chunk-KGCTYL2S.js";
26
- import "./chunk-EG72MSVK.js";
25
+ } from "./chunk-PD6I2SDG.js";
26
+ import "./chunk-5FHWNLCI.js";
27
27
  import {
28
28
  JsonValue
29
29
  } from "./chunk-H2CJWXA3.js";
30
30
  import {
31
31
  HttpApiClient_exports
32
- } from "./chunk-KSGYJV46.js";
32
+ } from "./chunk-TUMGL2OC.js";
33
33
  import {
34
34
  HttpClientError_exports
35
- } from "./chunk-LNSVJS2Q.js";
35
+ } from "./chunk-EOPQ727L.js";
36
36
  import {
37
37
  Cause_exports,
38
38
  Clock_exports,
package/js/contracts.js CHANGED
@@ -50,6 +50,8 @@ import {
50
50
  InputProblem,
51
51
  Interval,
52
52
  InvocationDeadline,
53
+ InvocationTiming,
54
+ InvocationTimingSink,
53
55
  ManualWebhookDescriptor,
54
56
  ManualWebhookSetup,
55
57
  McpClientLimits,
@@ -118,7 +120,7 @@ import {
118
120
  skillCatalog,
119
121
  skillsCommand,
120
122
  workflowDurationMillis
121
- } from "./chunk-OBXHQNWC.js";
123
+ } from "./chunk-CVAJ4F6O.js";
122
124
  import {
123
125
  FailureCode,
124
126
  FailureDetail,
@@ -153,14 +155,14 @@ import {
153
155
  SkillServiceName,
154
156
  skillFormatLimits,
155
157
  skillLoadLimits
156
- } from "./chunk-KBIKBWSS.js";
157
- import "./chunk-EG72MSVK.js";
158
+ } from "./chunk-H72MEDMN.js";
159
+ import "./chunk-5FHWNLCI.js";
158
160
  import {
159
161
  AccountId,
160
162
  HttpUrl
161
163
  } from "./chunk-H2CJWXA3.js";
162
- import "./chunk-KSGYJV46.js";
163
- import "./chunk-LNSVJS2Q.js";
164
+ import "./chunk-TUMGL2OC.js";
165
+ import "./chunk-EOPQ727L.js";
164
166
  import "./chunk-IFJU5SYQ.js";
165
167
  import "./chunk-CZ7CSFO4.js";
166
168
  export {
@@ -231,6 +233,8 @@ export {
231
233
  InputProblem,
232
234
  Interval,
233
235
  InvocationDeadline,
236
+ InvocationTiming,
237
+ InvocationTimingSink,
234
238
  ManualWebhookDescriptor,
235
239
  ManualWebhookSetup,
236
240
  McpClientLimits,
package/js/effect.js CHANGED
@@ -3,35 +3,35 @@ import {
3
3
  ApprovalDecision,
4
4
  createAppHandler,
5
5
  prepareElicitation
6
- } from "./chunk-47BLLMRQ.js";
6
+ } from "./chunk-OJ47HQVJ.js";
7
7
  import "./chunk-AQU56EPI.js";
8
- import "./chunk-KTPKTBKZ.js";
9
- import "./chunk-T65AFHU3.js";
10
- import "./chunk-IN2WIN7I.js";
11
- import "./chunk-XSD3RZFX.js";
12
- import "./chunk-ILYK7BQG.js";
13
- import "./chunk-EMHFXFTJ.js";
8
+ import "./chunk-3UGDI2UI.js";
9
+ import "./chunk-7UUHJR2Q.js";
10
+ import "./chunk-XBG7HHXC.js";
11
+ import "./chunk-3B2JAOSE.js";
12
+ import "./chunk-LHCGND3R.js";
13
+ import "./chunk-LTDHQJ2Z.js";
14
14
  import {
15
15
  ToolAnnotations
16
- } from "./chunk-OBXHQNWC.js";
16
+ } from "./chunk-CVAJ4F6O.js";
17
17
  import "./chunk-MWKHKOTL.js";
18
- import "./chunk-KBIKBWSS.js";
19
- import "./chunk-VU6GQ2SH.js";
20
- import "./chunk-MZH4J2PO.js";
18
+ import "./chunk-H72MEDMN.js";
21
19
  import {
22
20
  compileJsonSchemaDecoder,
23
21
  decoderOf,
24
22
  jsonSchemaDecoder,
25
23
  wrap
26
24
  } from "./chunk-KGCTYL2S.js";
27
- import "./chunk-EG72MSVK.js";
25
+ import "./chunk-JM7LOD2W.js";
26
+ import "./chunk-PD6I2SDG.js";
27
+ import "./chunk-5FHWNLCI.js";
28
28
  import {
29
29
  HttpUrl,
30
30
  JsonObject,
31
31
  ValidationError
32
32
  } from "./chunk-H2CJWXA3.js";
33
- import "./chunk-KSGYJV46.js";
34
- import "./chunk-LNSVJS2Q.js";
33
+ import "./chunk-TUMGL2OC.js";
34
+ import "./chunk-EOPQ727L.js";
35
35
  import "./chunk-IFJU5SYQ.js";
36
36
  import "./chunk-CZ7CSFO4.js";
37
37
  export {
package/js/graphql.js CHANGED
@@ -1,54 +1,56 @@
1
1
  import {
2
2
  catalogCache,
3
3
  catalogScope
4
- } from "./chunk-5GLC42LK.js";
4
+ } from "./chunk-UM62MBJQ.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-Z3S2IVI3.js";
7
+ } from "./chunk-7LGRK7TP.js";
8
8
  import "./chunk-BCSNKUAC.js";
9
- import "./chunk-47BLLMRQ.js";
9
+ import "./chunk-OJ47HQVJ.js";
10
10
  import {
11
11
  cacheKey
12
12
  } from "./chunk-AQU56EPI.js";
13
- import "./chunk-KTPKTBKZ.js";
13
+ import "./chunk-3UGDI2UI.js";
14
14
  import {
15
15
  failOnNetworkRefusal
16
- } from "./chunk-T65AFHU3.js";
17
- import "./chunk-IN2WIN7I.js";
18
- import "./chunk-XSD3RZFX.js";
16
+ } from "./chunk-7UUHJR2Q.js";
17
+ import "./chunk-XBG7HHXC.js";
18
+ import "./chunk-3B2JAOSE.js";
19
19
  import {
20
20
  nativeOperation,
21
21
  routerDeclaration
22
- } from "./chunk-ILYK7BQG.js";
22
+ } from "./chunk-LHCGND3R.js";
23
23
  import {
24
24
  accountProviderError,
25
25
  graphqlProviderError,
26
26
  httpProviderError
27
- } from "./chunk-EMHFXFTJ.js";
28
- import "./chunk-OBXHQNWC.js";
27
+ } from "./chunk-LTDHQJ2Z.js";
28
+ import "./chunk-CVAJ4F6O.js";
29
29
  import {
30
30
  NetworkRefused,
31
31
  ProviderError
32
32
  } from "./chunk-MWKHKOTL.js";
33
- import "./chunk-KBIKBWSS.js";
34
- import "./chunk-VU6GQ2SH.js";
35
- import {
36
- FetchHttpClient_exports
37
- } from "./chunk-MZH4J2PO.js";
33
+ import "./chunk-H72MEDMN.js";
38
34
  import {
39
35
  jsonSchemaDecoder
40
36
  } from "./chunk-KGCTYL2S.js";
41
- import "./chunk-EG72MSVK.js";
37
+ import {
38
+ owned
39
+ } from "./chunk-JM7LOD2W.js";
40
+ import {
41
+ FetchHttpClient_exports
42
+ } from "./chunk-PD6I2SDG.js";
43
+ import "./chunk-5FHWNLCI.js";
42
44
  import {
43
45
  AccountId,
44
46
  HttpUrl,
45
47
  JsonObject
46
48
  } from "./chunk-H2CJWXA3.js";
47
- import "./chunk-KSGYJV46.js";
49
+ import "./chunk-TUMGL2OC.js";
48
50
  import {
49
51
  HttpClientRequest_exports,
50
52
  HttpClient_exports
51
- } from "./chunk-LNSVJS2Q.js";
53
+ } from "./chunk-EOPQ727L.js";
52
54
  import {
53
55
  Effect_exports,
54
56
  Redacted_exports,
@@ -276,7 +278,7 @@ var graphqlClientEffect = (input) => Effect_exports.gen(function* () {
276
278
  if (response.status < 200 || response.status >= 300)
277
279
  return yield* httpProviderError(response.status, response.headers) ?? new GraphqlError({ phase, reason: "request", status: response.status });
278
280
  const result = yield* response.json.pipe(
279
- Effect_exports.withSpan("provider.http.response.read"),
281
+ owned("upstream", "provider.http.response.read"),
280
282
  Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlResponse)),
281
283
  Effect_exports.mapError(() => new GraphqlError({ phase, reason: "invalid_response" }))
282
284
  );
@@ -287,7 +289,7 @@ var graphqlClientEffect = (input) => Effect_exports.gen(function* () {
287
289
  return result.data;
288
290
  })
289
291
  ).pipe(
290
- Effect_exports.withSpan("provider.graphql.request", {
292
+ owned("upstream", "provider.graphql.request", {
291
293
  attributes: {
292
294
  "executor.operation": phase,
293
295
  "server.address": url.hostname
@@ -416,7 +418,7 @@ var adaptGraphqlTool = (client, definition) => Effect_exports.gen(function* () {
416
418
  return yield* new GraphqlError({ phase: "call", reason: "invalid_response" });
417
419
  return value;
418
420
  }).pipe(
419
- Effect_exports.withSpan("provider.graphql.call", {
421
+ owned("upstream", "provider.graphql.call", {
420
422
  attributes: {
421
423
  "graphql.operation.type": kind,
422
424
  "executor.tool.name": name
package/js/host.js CHANGED
@@ -1,19 +1,20 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-47BLLMRQ.js";
3
+ } from "./chunk-OJ47HQVJ.js";
4
4
  import "./chunk-AQU56EPI.js";
5
- import "./chunk-KTPKTBKZ.js";
6
- import "./chunk-T65AFHU3.js";
7
- import "./chunk-IN2WIN7I.js";
8
- import "./chunk-XSD3RZFX.js";
9
- import "./chunk-ILYK7BQG.js";
10
- import "./chunk-EMHFXFTJ.js";
5
+ import "./chunk-3UGDI2UI.js";
6
+ import "./chunk-7UUHJR2Q.js";
7
+ import "./chunk-XBG7HHXC.js";
8
+ import "./chunk-3B2JAOSE.js";
9
+ import "./chunk-LHCGND3R.js";
10
+ import "./chunk-LTDHQJ2Z.js";
11
11
  import {
12
12
  ElicitationFailed,
13
13
  ElicitationReply,
14
14
  HostAccountsInvalid,
15
15
  HostInputInvalid,
16
16
  HostResponse,
17
+ InvocationTimingSink,
17
18
  ResolvedAccounts,
18
19
  TrustedToolApproval,
19
20
  WorkflowFailure,
@@ -21,25 +22,26 @@ import {
21
22
  WorkflowRun,
22
23
  WorkflowRunId,
23
24
  WorkflowRunPage
24
- } from "./chunk-OBXHQNWC.js";
25
+ } from "./chunk-CVAJ4F6O.js";
25
26
  import {
26
27
  CacheCommand,
27
28
  CacheError,
28
29
  CacheReply
29
30
  } from "./chunk-MWKHKOTL.js";
30
- import "./chunk-KBIKBWSS.js";
31
+ import "./chunk-H72MEDMN.js";
32
+ import "./chunk-KGCTYL2S.js";
31
33
  import {
32
34
  collectTelemetry,
33
35
  withRemoteSpan
34
- } from "./chunk-VU6GQ2SH.js";
35
- import "./chunk-MZH4J2PO.js";
36
- import "./chunk-KGCTYL2S.js";
37
- import "./chunk-EG72MSVK.js";
36
+ } from "./chunk-JM7LOD2W.js";
37
+ import "./chunk-PD6I2SDG.js";
38
+ import "./chunk-5FHWNLCI.js";
38
39
  import "./chunk-H2CJWXA3.js";
39
- import "./chunk-KSGYJV46.js";
40
- import "./chunk-LNSVJS2Q.js";
40
+ import "./chunk-TUMGL2OC.js";
41
+ import "./chunk-EOPQ727L.js";
41
42
  import {
42
43
  Cause_exports,
44
+ Clock_exports,
43
45
  Effect_exports,
44
46
  Redacted_exports,
45
47
  Scheduler_exports,
@@ -52,14 +54,17 @@ var isolatedCacheSession = (callback) => {
52
54
  const controller = new AbortController();
53
55
  const pending = /* @__PURE__ */ new Set();
54
56
  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)
57
+ transport: (command) => (
58
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's cache RPC
59
+ Effect_exports.tryPromise({
60
+ try: () => callback(Schema_exports.encodeSync(CacheCommand)(command)),
61
+ catch: () => new CacheError({ reason: "storage" })
62
+ }).pipe(
63
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(CacheReply)),
64
+ Effect_exports.mapError(() => new CacheError({ reason: "storage" })),
65
+ Effect_exports.flatMap(
66
+ (reply) => reply.ok ? Effect_exports.succeed(reply.value) : Effect_exports.fail(reply.error)
67
+ )
63
68
  )
64
69
  ),
65
70
  background: (task) => Effect_exports.gen(function* () {
@@ -97,14 +102,17 @@ var isolatedCacheSession = (callback) => {
97
102
  // src/implementation/workflow-rpc.ts
98
103
  var isolatedWorkflowExecution = (run, deliver, signal) => {
99
104
  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)
105
+ const request = (input, callback) => (
106
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's workflow RPC
107
+ Effect_exports.tryPromise({
108
+ try: () => deliver(input, callback),
109
+ catch: () => new WorkflowFailure({ reason: "engine", retryable: true })
110
+ }).pipe(
111
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(WorkflowRpcResult)),
112
+ Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true })),
113
+ Effect_exports.flatMap(
114
+ (reply) => reply.ok ? Effect_exports.succeed(reply.value) : Effect_exports.fail(reply.error)
115
+ )
108
116
  )
109
117
  );
110
118
  return {
@@ -146,14 +154,17 @@ var isolatedWorkflowExecution = (run, deliver, signal) => {
146
154
  };
147
155
  };
148
156
  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)
157
+ const request = (input) => (
158
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's workflow RPC
159
+ Effect_exports.tryPromise({
160
+ try: () => deliver(input),
161
+ catch: () => new WorkflowFailure({ reason: "engine", retryable: true })
162
+ }).pipe(
163
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(WorkflowRpcResult)),
164
+ Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true })),
165
+ Effect_exports.flatMap(
166
+ (result) => result.ok ? Effect_exports.succeed(result.value) : Effect_exports.fail(result.error)
167
+ )
157
168
  )
158
169
  );
159
170
  const run = (input) => request(input).pipe(
@@ -202,17 +213,27 @@ var createAppHandler2 = (app) => {
202
213
  );
203
214
  };
204
215
  };
216
+ var isolatedClock = () => Effect_exports.runSync(Clock_exports.currentTimeNanos);
205
217
  var createIsolatedAppHandler = (app) => {
206
218
  const handler = createAppHandler(app);
207
219
  return (request, context) => Effect_exports.runPromise(
208
220
  Effect_exports.gen(function* () {
221
+ let timing;
209
222
  const { value, telemetry } = yield* collectTelemetry(
210
- handler(request, context).pipe(withRemoteSpan(request, "app.dispatch"))
223
+ handler(request, context).pipe(
224
+ withRemoteSpan(request, "app.dispatch"),
225
+ Effect_exports.provideService(InvocationTimingSink, (reported) => {
226
+ timing = reported;
227
+ })
228
+ )
211
229
  );
212
230
  const body = yield* Effect_exports.promise(() => value.json()).pipe(
213
231
  Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(HostResponse))
214
232
  );
215
- return Response.json({ ...body, telemetry }, { status: value.status });
233
+ return Response.json(
234
+ { ...body, telemetry, ...timing === void 0 ? {} : { timing } },
235
+ { status: value.status }
236
+ );
216
237
  }),
217
238
  {
218
239
  signal: request.signal,
@@ -222,20 +243,23 @@ var createIsolatedAppHandler = (app) => {
222
243
  }
223
244
  );
224
245
  };
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" }))
246
+ var isolatedElicitation = (deliver, lifetime) => (request) => (
247
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the host's elicitation RPC
248
+ Effect_exports.tryPromise({
249
+ try: () => deliver(request),
250
+ catch: () => {
251
+ lifetime.abort();
252
+ return new ElicitationFailed({ reason: "transport" });
253
+ }
254
+ }).pipe(
255
+ Effect_exports.flatMap(
256
+ (reply) => Schema_exports.decodeUnknownEffect(ElicitationReply)(reply).pipe(
257
+ Effect_exports.mapError(() => new ElicitationFailed({ reason: "transport" }))
258
+ )
259
+ ),
260
+ Effect_exports.flatMap(
261
+ (reply) => reply.ok ? Effect_exports.succeed(reply.response) : Effect_exports.fail(reply.error)
235
262
  )
236
- ),
237
- Effect_exports.flatMap(
238
- (reply) => reply.ok ? Effect_exports.succeed(reply.response) : Effect_exports.fail(reply.error)
239
263
  )
240
264
  );
241
265
  export {
@@ -243,6 +267,7 @@ export {
243
267
  createIsolatedAppHandler,
244
268
  hostContext,
245
269
  isolatedCacheSession,
270
+ isolatedClock,
246
271
  isolatedElicitation,
247
272
  isolatedWorkflowControls,
248
273
  isolatedWorkflowExecution