apps 0.0.1-beta.5 → 0.0.1-beta.55

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 (188) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/chunk-47F7VXST.js +221 -0
  4. package/js/chunk-5FHWNLCI.js +88 -0
  5. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  6. package/js/chunk-7UUHJR2Q.js +49 -0
  7. package/js/{chunk-CYYBFC2K.js → chunk-AQU56EPI.js} +9 -5
  8. package/js/chunk-BTSIG4NQ.js +1885 -0
  9. package/js/chunk-CDXQDN7W.js +92 -0
  10. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  11. package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
  12. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  13. package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
  14. package/js/{chunk-UDDE5KOR.js → chunk-JK5S2N2S.js} +148 -34
  15. package/js/{chunk-RJDDBDSN.js → chunk-JM7LOD2W.js} +628 -85
  16. package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
  17. package/js/{chunk-FWQC6I3C.js → chunk-KGCTYL2S.js} +523 -63
  18. package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  19. package/js/chunk-L4K2K22P.js +42 -0
  20. package/js/chunk-LTDHQJ2Z.js +171 -0
  21. package/js/chunk-MWKHKOTL.js +240 -0
  22. package/js/chunk-OD3KFKZD.js +1617 -0
  23. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  24. package/js/chunk-PXXZ6ABC.js +266 -0
  25. package/js/chunk-QEBRH5AP.js +729 -0
  26. package/js/chunk-TLWLJ7PD.js +4342 -0
  27. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  28. package/js/{chunk-XHO2ZX6W.js → chunk-UM62MBJQ.js} +96 -41
  29. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  30. package/js/chunk-XCSG7FT7.js +340 -0
  31. package/js/client.js +142 -94
  32. package/js/contracts.js +123 -33
  33. package/js/effect.js +19 -21
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +63 -60
  36. package/js/host.js +83 -60
  37. package/js/index.js +262 -222
  38. package/js/mcp/effect.js +23 -23
  39. package/js/mcp/stdio.js +48 -40
  40. package/js/mcp.js +109 -72
  41. package/js/openapi.js +4129 -1419
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +208 -82
  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-cache/src/index.d.ts +10 -1
  53. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  54. package/types/apps/src/contracts/app.d.ts +9 -8
  55. package/types/apps/src/contracts/cache.d.ts +20 -0
  56. package/types/apps/src/contracts/context.d.ts +19 -11
  57. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  58. package/types/apps/src/contracts/events.d.ts +93 -0
  59. package/types/apps/src/contracts/failure.d.ts +30 -1
  60. package/types/apps/src/contracts/graphql.d.ts +2 -1
  61. package/types/apps/src/contracts/host.d.ts +57 -18
  62. package/types/apps/src/contracts/live.d.ts +2 -0
  63. package/types/apps/src/contracts/mcp.d.ts +96 -10
  64. package/types/apps/src/contracts/network.d.ts +84 -0
  65. package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
  66. package/types/apps/src/contracts/openapi.d.ts +45 -9
  67. package/types/apps/src/contracts/operations.d.ts +8 -9
  68. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  69. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  70. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  71. package/types/apps/src/contracts/protocols/2.d.ts +69 -26
  72. package/types/apps/src/contracts/protocols/3.d.ts +133 -33
  73. package/types/apps/src/contracts/protocols/4.d.ts +1306 -0
  74. package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
  75. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  76. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  77. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  78. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  79. package/types/apps/src/contracts/protocols/current.d.ts +2476 -0
  80. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  81. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  82. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  83. package/types/apps/src/contracts/provider.d.ts +115 -10
  84. package/types/apps/src/contracts/router.d.ts +59 -0
  85. package/types/apps/src/contracts/skills.d.ts +50 -13
  86. package/types/apps/src/contracts/sql.d.ts +58 -0
  87. package/types/apps/src/contracts/ui.d.ts +19 -1
  88. package/types/apps/src/contracts/workflows.d.ts +6 -0
  89. package/types/apps/src/facet.d.ts +4 -5
  90. package/types/apps/src/graphql.d.ts +1 -3
  91. package/types/apps/src/host.d.ts +5 -0
  92. package/types/apps/src/implementation/account-router.d.ts +13 -0
  93. package/types/apps/src/implementation/app.d.ts +5 -4
  94. package/types/apps/src/implementation/authoring.d.ts +25 -5
  95. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  96. package/types/apps/src/implementation/cache.d.ts +4 -0
  97. package/types/apps/src/implementation/catalog-cache.d.ts +43 -5
  98. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  99. package/types/apps/src/implementation/events.d.ts +59 -0
  100. package/types/apps/src/implementation/failure-detail.d.ts +25 -3
  101. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  102. package/types/apps/src/implementation/graphql.d.ts +4 -3
  103. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  104. package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
  105. package/types/apps/src/implementation/live.d.ts +2 -2
  106. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  107. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  108. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  109. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  110. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  111. package/types/apps/src/implementation/mcp.d.ts +52 -25
  112. package/types/apps/src/implementation/network.d.ts +16 -0
  113. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  114. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  115. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  116. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  117. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  118. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  119. package/types/apps/src/implementation/operations.d.ts +43 -5
  120. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  121. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  122. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  123. package/types/apps/src/implementation/provider.d.ts +19 -5
  124. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  125. package/types/apps/src/implementation/router-catalog.d.ts +223 -0
  126. package/types/apps/src/implementation/router.d.ts +70 -0
  127. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  128. package/types/apps/src/implementation/schema.d.ts +95 -11
  129. package/types/apps/src/implementation/skills.d.ts +18 -24
  130. package/types/apps/src/implementation/sql.d.ts +71 -0
  131. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  132. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  133. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  134. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  135. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  136. package/types/apps/src/implementation/ui-serving.d.ts +11 -5
  137. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  138. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  139. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  140. package/types/apps/src/implementation/workflow-context.d.ts +1 -1
  141. package/types/apps/src/implementation/workflows.d.ts +1 -1
  142. package/types/apps/src/index.d.ts +32 -13
  143. package/types/apps/src/mcp-stdio.d.ts +2 -5
  144. package/types/apps/src/mcp.d.ts +25 -5
  145. package/types/apps/src/openapi.d.ts +6 -6
  146. package/types/apps/src/react.d.ts +1 -1
  147. package/types/apps/src/skills.d.ts +10 -8
  148. package/types/telemetry/src/app-records.d.ts +42 -0
  149. package/types/telemetry/src/browser-operations.d.ts +7 -4
  150. package/types/telemetry/src/browser.d.ts +8 -3
  151. package/types/telemetry/src/config.d.ts +2 -2
  152. package/types/telemetry/src/index.d.ts +1 -0
  153. package/types/telemetry/src/layer.d.ts +2 -2
  154. package/types/telemetry/src/ownership.d.ts +56 -0
  155. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  156. package/types/telemetry/src/relay.d.ts +2 -2
  157. package/types/telemetry/src/transport.d.ts +8 -1
  158. package/types/utils/src/api-error.d.ts +55 -0
  159. package/types/utils/src/connection-failure.d.ts +33 -0
  160. package/types/utils/src/recorded-message.d.ts +18 -0
  161. package/types/utils/src/user-facing-error.d.ts +83 -0
  162. package/js/chunk-3XKZDQLM.js +0 -93
  163. package/js/chunk-4M277YTM.js +0 -136
  164. package/js/chunk-67EVWIGJ.js +0 -224
  165. package/js/chunk-C3VAOK5B.js +0 -215
  166. package/js/chunk-DQAZTA4I.js +0 -2375
  167. package/js/chunk-G7T27IWB.js +0 -63
  168. package/js/chunk-LUVSFETN.js +0 -1347
  169. package/js/chunk-N7YDVXYJ.js +0 -186
  170. package/js/chunk-PJJ24GU7.js +0 -877
  171. package/js/chunk-PZB6T6KU.js +0 -19
  172. package/js/chunk-SB3V4YVR.js +0 -18
  173. package/js/chunk-TDNYXSIX.js +0 -29
  174. package/js/chunk-W4DMKWAB.js +0 -35
  175. package/js/chunk-YEPYT6SD.js +0 -85
  176. package/js/chunk-ZQINWV4W.js +0 -630
  177. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  178. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  179. package/types/app-data/src/implementation/promise.d.ts +0 -68
  180. package/types/app-data/src/implementation/range.d.ts +0 -8
  181. package/types/app-data/src/implementation/schema.d.ts +0 -18
  182. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  183. package/types/app-data/src/index.d.ts +0 -4
  184. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  185. package/types/apps/src/contracts/storage.d.ts +0 -68
  186. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  187. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  188. package/types/apps/src/implementation/storage.d.ts +0 -15
package/js/client.js CHANGED
@@ -1,40 +1,38 @@
1
1
  import {
2
2
  AppUiApi,
3
- HttpApiClient_exports,
4
3
  UiContext,
5
4
  UiDeploymentChanged,
6
5
  UiFailed
7
- } from "./chunk-IJX4CYZO.js";
6
+ } from "./chunk-CDXQDN7W.js";
8
7
  import {
9
8
  AsyncResult_exports,
10
9
  AtomRegistry_exports,
11
10
  Atom_exports,
12
11
  queryResult
13
- } from "./chunk-M3B3DE4K.js";
14
- import "./chunk-PJJ24GU7.js";
12
+ } from "./chunk-74YVXBKY.js";
13
+ import {
14
+ decoderOf
15
+ } from "./chunk-KGCTYL2S.js";
15
16
  import {
16
17
  OtlpExporter_exports,
17
- TraceContext,
18
18
  externalTrace,
19
19
  pendingSpan,
20
20
  telemetryLayer,
21
21
  traceLinks
22
- } from "./chunk-RJDDBDSN.js";
22
+ } from "./chunk-JM7LOD2W.js";
23
23
  import {
24
24
  FetchHttpClient_exports
25
- } from "./chunk-57RKNWL2.js";
25
+ } from "./chunk-PD6I2SDG.js";
26
+ import "./chunk-5FHWNLCI.js";
26
27
  import {
27
- HttpClientError_exports
28
- } from "./chunk-UK573G7W.js";
29
- import {
30
- decoderOf
31
- } from "./chunk-FWQC6I3C.js";
28
+ JsonValue
29
+ } from "./chunk-H2CJWXA3.js";
32
30
  import {
33
- StorageName
34
- } from "./chunk-PZB6T6KU.js";
31
+ HttpApiClient_exports
32
+ } from "./chunk-TUMGL2OC.js";
35
33
  import {
36
- JsonValue
37
- } from "./chunk-27F7W2LG.js";
34
+ HttpClientError_exports
35
+ } from "./chunk-EOPQ727L.js";
38
36
  import {
39
37
  Cause_exports,
40
38
  Clock_exports,
@@ -47,25 +45,27 @@ import {
47
45
  Logger_exports,
48
46
  ManagedRuntime_exports,
49
47
  Option_exports,
48
+ Queue_exports,
50
49
  Schedule_exports,
51
50
  Schema_exports,
52
51
  Semaphore_exports,
53
52
  Stream_exports,
54
53
  Tracer_exports
55
- } from "./chunk-CDL5PM2Q.js";
54
+ } from "./chunk-IFJU5SYQ.js";
56
55
  import "./chunk-CZ7CSFO4.js";
57
56
 
58
57
  // src/contracts/live.ts
58
+ var OperationName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
59
59
  var AppQueryFailed = class extends Schema_exports.TaggedError()("AppQueryFailed", {}) {
60
60
  };
61
61
 
62
62
  // src/implementation/live.ts
63
63
  var queryReference = (name) => ({
64
- name: Schema_exports.decodeUnknownSync(StorageName)(name),
64
+ name: Schema_exports.decodeUnknownSync(OperationName)(name),
65
65
  kind: "query"
66
66
  });
67
67
  var mutationReference = (name) => ({
68
- name: Schema_exports.decodeUnknownSync(StorageName)(name),
68
+ name: Schema_exports.decodeUnknownSync(OperationName)(name),
69
69
  kind: "mutation"
70
70
  });
71
71
  var liveQueryAtom = (reference, input, options) => Atom_exports.make(
@@ -448,21 +448,6 @@ var observeBrowserPerformance = Effect_exports.gen(function* () {
448
448
  };
449
449
  });
450
450
 
451
- // ../telemetry/src/browser-operations.ts
452
- var BrowserOperationFailure = Schema_exports.Struct({
453
- error_type: Schema_exports.Literals([
454
- "BrowserDecodeFailed",
455
- "BrowserTransportFailed",
456
- "BrowserOperationFailed"
457
- ]),
458
- trace_id: TraceContext.fields.traceId,
459
- span_id: TraceContext.fields.spanId,
460
- page_id: Schema_exports.String
461
- });
462
- var ResponseTrace = Context_exports.Reference("telemetry/ResponseTrace", {
463
- defaultValue: () => void 0
464
- });
465
-
466
451
  // ../telemetry/src/browser.ts
467
452
  var BrowserTelemetry = class extends Context_exports.Service()("executor/BrowserTelemetry") {
468
453
  };
@@ -491,6 +476,8 @@ var browserTelemetryLayer = (settings) => Layer_exports.unwrap(
491
476
  const onError = (event) => error("ui.error", event.error ?? new Error(event.message));
492
477
  const onRejection = (event) => error("ui.unhandled-rejection", event.reason);
493
478
  const onHidden = () => {
479
+ if (navigation !== void 0 && document.visibilityState === "hidden")
480
+ navigation.hidden = true;
494
481
  run(
495
482
  document.visibilityState === "hidden" ? performance.pause.pipe(Effect_exports.andThen(flush)) : performance.resume
496
483
  );
@@ -518,15 +505,27 @@ var browserTelemetryLayer = (settings) => Layer_exports.unwrap(
518
505
  return {
519
506
  flush,
520
507
  navigation: (event) => Effect_exports.sync(() => {
508
+ if (event.type === "load") return;
521
509
  if (event.type === "end") {
522
- if (navigation !== void 0) Deferred_exports.doneUnsafe(navigation, Effect_exports.void);
510
+ if (navigation !== void 0) Deferred_exports.doneUnsafe(navigation.done, Effect_exports.void);
523
511
  navigation = void 0;
524
512
  return;
525
513
  }
526
- if (navigation !== void 0) Deferred_exports.doneUnsafe(navigation, Effect_exports.interrupt);
527
- navigation = Deferred_exports.makeUnsafe();
514
+ if (navigation !== void 0)
515
+ Deferred_exports.doneUnsafe(navigation.done, Effect_exports.interrupt);
516
+ const current = {
517
+ done: Deferred_exports.makeUnsafe(),
518
+ hidden: document.visibilityState === "hidden"
519
+ };
520
+ navigation = current;
528
521
  run(
529
- Deferred_exports.await(navigation).pipe(
522
+ Deferred_exports.await(current.done).pipe(
523
+ // Record visibility however the navigation ends, including when a later one interrupts it.
524
+ Effect_exports.ensuring(
525
+ Effect_exports.suspend(
526
+ () => Effect_exports.annotateCurrentSpan("executor.navigation.hidden", current.hidden)
527
+ )
528
+ ),
530
529
  Effect_exports.withSpan("ui.navigation", {
531
530
  root: true,
532
531
  attributes: { "url.path": event.path }
@@ -536,7 +535,7 @@ var browserTelemetryLayer = (settings) => Layer_exports.unwrap(
536
535
  );
537
536
  }).pipe(
538
537
  Effect_exports.andThen(
539
- event.type === "start" ? performance.navigation(event.path) : Effect_exports.void
538
+ event.type === "end" ? Effect_exports.void : performance.navigation(event.path)
540
539
  )
541
540
  )
542
541
  };
@@ -809,6 +808,33 @@ var makeOptimisticClient = (transport) => {
809
808
  };
810
809
 
811
810
  // src/implementation/ui-client.ts
811
+ var resubscribeDelay = Schedule_exports.min([
812
+ Schedule_exports.exponential("1 second"),
813
+ Schedule_exports.spaced("1 minute")
814
+ ]).pipe(Schedule_exports.jittered);
815
+ var appFailure = (error) => Schema_exports.is(UiFailed)(error) && error.reason === "operation_failed";
816
+ var resubscribes = (error) => HttpClientError_exports.isHttpClientError(error) || Cause_exports.isTimeoutError(error) || Schema_exports.is(UiFailed)(error) && error.reason !== "account_required";
817
+ var Retrying = class {
818
+ constructor(error, previous) {
819
+ this.error = error;
820
+ this.previous = previous;
821
+ }
822
+ error;
823
+ previous;
824
+ };
825
+ var visibleResult = (result) => {
826
+ const current = AsyncResult_exports.value(result);
827
+ if (Option_exports.isNone(current) || !(current.value instanceof Retrying)) {
828
+ return result;
829
+ }
830
+ const previous = Option_exports.map(
831
+ Option_exports.fromUndefinedOr(current.value.previous),
832
+ AsyncResult_exports.success
833
+ );
834
+ return AsyncResult_exports.isSuccess(result) ? AsyncResult_exports.failureWithPrevious(Cause_exports.fail(current.value.error), { previous, waiting: true }) : AsyncResult_exports.failureWithPrevious(AsyncResult_exports.isFailure(result) ? result.cause : Cause_exports.empty, {
835
+ previous
836
+ });
837
+ };
812
838
  var createAppClient = () => {
813
839
  const { runtime, atoms } = makeBrowserTelemetry(
814
840
  browserSettings("/_executor/api/telemetry", "executor-app-web")
@@ -863,7 +889,8 @@ var createAppClient = () => {
863
889
  Stream_exports.suspend(() => {
864
890
  let previous;
865
891
  let attempts = 0;
866
- return Stream_exports.unwrap(
892
+ let latest;
893
+ const subscription = Stream_exports.unwrap(
867
894
  Effect_exports.gen(function* () {
868
895
  const attempt = attempts++;
869
896
  const first = yield* pendingSpan("ui.app.first_result", {
@@ -911,53 +938,55 @@ var createAppClient = () => {
911
938
  Stream_exports.timeout("45 seconds"),
912
939
  Stream_exports.concat(Stream_exports.fail(new UiFailed({ reason: "unavailable" }))),
913
940
  Stream_exports.filter((frame) => frame.type !== "heartbeat"),
914
- Stream_exports.mapEffect((frame) => {
915
- if (frame.type === "failure") return Effect_exports.fail(frame.error);
916
- const server = externalTrace(frame.trace);
917
- return Effect_exports.gen(function* () {
918
- const value = yield* Schema_exports.decodeUnknownEffect(decoderOf(output))(
919
- frame.value
920
- ).pipe(Effect_exports.mapError(() => new UiFailed({ reason: "operation_failed" })));
921
- const received = yield* Effect_exports.currentSpan;
922
- const receivedAt = clock.currentTimeMillisUnsafe();
923
- const currentRevision = revision++;
924
- yield* Effect_exports.annotateCurrentSpan({
925
- "executor.operation.name": name,
926
- "executor.snapshot.revision": currentRevision,
927
- "browser.query.elapsed_ms": receivedAt - started,
928
- "executor.trace.context_valid": Option_exports.isSome(server)
929
- });
930
- yield* first.finish(Exit_exports.void);
931
- let committed = false;
932
- return {
933
- value,
934
- commit: () => {
935
- if (committed) return;
936
- committed = true;
937
- const committedAt = clock.currentTimeMillisUnsafe();
938
- runtime.runFork(
939
- Effect_exports.void.pipe(
940
- Effect_exports.withSpan("ui.app.result.commit", {
941
- parent: received,
942
- attributes: {
943
- "executor.operation.name": name,
944
- "executor.snapshot.revision": currentRevision,
945
- "browser.query.elapsed_ms": committedAt - started,
946
- "browser.query.receive_to_commit_ms": committedAt - receivedAt,
947
- "browser.page.hidden": document.visibilityState === "hidden"
948
- }
949
- })
950
- )
951
- );
952
- }
953
- };
954
- }).pipe(
955
- Effect_exports.withSpan("ui.app.result.receive", {
956
- parent: Option_exports.isSome(server) ? server.value : first.span,
957
- kind: "consumer"
958
- })
959
- );
960
- }),
941
+ Stream_exports.mapEffect(
942
+ (frame) => {
943
+ if (frame.type === "failure") return Effect_exports.fail(frame.error);
944
+ const server = externalTrace(frame.trace);
945
+ return Effect_exports.gen(function* () {
946
+ const value = yield* Schema_exports.decodeUnknownEffect(decoderOf(output))(
947
+ frame.value
948
+ ).pipe(Effect_exports.mapError(() => new AppQueryFailed()));
949
+ const received = yield* Effect_exports.currentSpan;
950
+ const receivedAt = clock.currentTimeMillisUnsafe();
951
+ const currentRevision = revision++;
952
+ yield* Effect_exports.annotateCurrentSpan({
953
+ "executor.operation.name": name,
954
+ "executor.snapshot.revision": currentRevision,
955
+ "browser.query.elapsed_ms": receivedAt - started,
956
+ "executor.trace.context_valid": Option_exports.isSome(server)
957
+ });
958
+ yield* first.finish(Exit_exports.void);
959
+ let committed = false;
960
+ return {
961
+ value,
962
+ commit: () => {
963
+ if (committed) return;
964
+ committed = true;
965
+ const committedAt = clock.currentTimeMillisUnsafe();
966
+ runtime.runFork(
967
+ Effect_exports.void.pipe(
968
+ Effect_exports.withSpan("ui.app.result.commit", {
969
+ parent: received,
970
+ attributes: {
971
+ "executor.operation.name": name,
972
+ "executor.snapshot.revision": currentRevision,
973
+ "browser.query.elapsed_ms": committedAt - started,
974
+ "browser.query.receive_to_commit_ms": committedAt - receivedAt,
975
+ "browser.page.hidden": document.visibilityState === "hidden"
976
+ }
977
+ })
978
+ )
979
+ );
980
+ }
981
+ };
982
+ }).pipe(
983
+ Effect_exports.withSpan("ui.app.result.receive", {
984
+ parent: Option_exports.isSome(server) ? server.value : first.span,
985
+ kind: "consumer"
986
+ })
987
+ );
988
+ }
989
+ ),
961
990
  Stream_exports.onExit(finish),
962
991
  Stream_exports.provideService(Tracer_exports.ParentSpan, first.span)
963
992
  );
@@ -968,16 +997,35 @@ var createAppClient = () => {
968
997
  Stream_exports.catch(
969
998
  (error) => Schema_exports.is(UiDeploymentChanged)(error) ? Stream_exports.unwrap(deploymentChanged.pipe(Effect_exports.as(Stream_exports.never))) : Stream_exports.fail(error)
970
999
  ),
971
- Stream_exports.retry(
972
- Schedule_exports.spaced("1 second").pipe(
973
- Schedule_exports.while(
974
- ({ input: input2 }) => HttpClientError_exports.isHttpClientError(input2) || Cause_exports.isTimeoutError(input2) || Schema_exports.is(UiFailed)(input2)
975
- )
976
- )
1000
+ Stream_exports.tap(
1001
+ (value) => Effect_exports.sync(() => {
1002
+ latest = value;
1003
+ })
977
1004
  )
978
1005
  );
1006
+ return Stream_exports.unwrap(
1007
+ Effect_exports.gen(function* () {
1008
+ const retrying = yield* Queue_exports.unbounded();
1009
+ return Stream_exports.merge(
1010
+ subscription.pipe(
1011
+ Stream_exports.retry(
1012
+ resubscribeDelay.pipe(
1013
+ Schedule_exports.while(
1014
+ ({ input: input2 }) => !resubscribes(input2) ? false : appFailure(input2) ? Queue_exports.offer(retrying, new Retrying(input2, latest)).pipe(
1015
+ Effect_exports.as(true)
1016
+ ) : true
1017
+ )
1018
+ )
1019
+ )
1020
+ ),
1021
+ // Shown outside the retried stream, so they do not reset its delay.
1022
+ Stream_exports.fromQueue(retrying),
1023
+ { haltStrategy: "left" }
1024
+ );
1025
+ })
1026
+ );
979
1027
  })
980
- ).pipe(Atom_exports.map(queryResult));
1028
+ ).pipe(Atom_exports.map((result) => queryResult(visibleResult(result))));
981
1029
  const optimistic = makeOptimisticClient({
982
1030
  source,
983
1031
  read: (name, input, output) => request("query", name, input, output),
package/js/contracts.js CHANGED
@@ -1,20 +1,30 @@
1
1
  import {
2
+ AccountCheckCommand,
3
+ AccountCheckResult,
4
+ AccountInfo,
5
+ ApiErrorResponse,
2
6
  ApprovalElicitation,
3
7
  ApprovalResponse,
4
8
  CalendarSchedule,
9
+ CredentialHost,
10
+ DatabaseFieldReserved,
11
+ DatabaseLimitExceeded,
5
12
  DeclaredAuthMethod,
13
+ DeclaredEvent,
14
+ DeclaredEvents,
6
15
  DeclaredProvider,
7
16
  DeclaredRequirements,
8
17
  ElicitationFailed,
9
18
  ElicitationLimits,
10
19
  ElicitationReply,
11
20
  ElicitationResponse,
12
- FailureCode,
13
- FailureDetail,
14
- FailureMessage,
15
- FailureName,
16
- FailureSource,
21
+ EmittedEvent,
22
+ EmittedEvents,
23
+ EventFilterValue,
24
+ EventLimits,
25
+ EventName,
17
26
  FormElicitation,
27
+ HostAccountCheckError,
18
28
  HostAccountsInvalid,
19
29
  HostCallError,
20
30
  HostDataError,
@@ -24,6 +34,7 @@ import {
24
34
  HostInputInvalid,
25
35
  HostInspectError,
26
36
  HostInvocation,
37
+ HostKindMismatch,
27
38
  HostOperationFailed,
28
39
  HostOperationNotFound,
29
40
  HostOutputInvalid,
@@ -31,10 +42,14 @@ import {
31
42
  HostRequestInvalid,
32
43
  HostRequirementsError,
33
44
  HostResponse,
45
+ HostRouterError,
34
46
  HostToolApprovalRequired,
35
47
  HostToolBlocked,
36
48
  HostToolNotFound,
37
49
  HostToolPolicyFailed,
50
+ HostedCatalog,
51
+ HostedCatalogSummary,
52
+ HostedRouter,
38
53
  HostedTool,
39
54
  HostedToolSummary,
40
55
  HostedWebhook,
@@ -42,19 +57,29 @@ import {
42
57
  InputProblem,
43
58
  Interval,
44
59
  InvocationDeadline,
60
+ InvocationTiming,
61
+ InvocationTimingSink,
45
62
  ManualWebhookDescriptor,
46
63
  ManualWebhookSetup,
47
64
  McpClientLimits,
48
- McpError,
65
+ McpError2 as McpError,
66
+ MigrateCommand,
67
+ MigrateResult,
49
68
  NonRetryableError,
50
69
  OAuthClientAuth,
51
70
  OAuthSecretClientAuth,
71
+ OAuthTokenRequestFormat,
72
+ OAuthTokenResponse,
73
+ OpenapiResponseError,
52
74
  OperationSchedule,
53
- OperationToolPrefixes,
54
75
  ResolvedAccount,
55
76
  ResolvedAccounts,
77
+ RouterIcon,
78
+ RouterKey,
79
+ RouterMeta,
56
80
  ScheduleTiming,
57
81
  SkillCatalogResponse,
82
+ SkillLoadFailed,
58
83
  SkillSources,
59
84
  ToolResultObservation,
60
85
  TrustedToolApproval,
@@ -78,28 +103,56 @@ import {
78
103
  WorkflowStepOptions,
79
104
  WorkflowValue,
80
105
  approvalElicitation,
106
+ current,
81
107
  defaultElicitationLimits,
108
+ defaultEventLimits,
82
109
  defaultMcpClientLimits,
83
110
  defaultWebhookTransportLimits,
84
111
  frameworkProtocol,
85
112
  indexCommand,
86
113
  inspectCommand,
87
- maxFailureMessageLength,
114
+ maxApiErrorInstructionsLength,
115
+ maxApiErrorMessageLength,
88
116
  maxInputProblems,
89
117
  minimumIntervalMilliseconds,
90
118
  protocol1,
119
+ protocol10,
91
120
  protocol2,
92
121
  protocol3,
122
+ protocol4,
123
+ protocol5,
124
+ protocol6,
125
+ protocol7,
126
+ protocol8,
127
+ protocol9,
93
128
  selectTools,
94
129
  skillCatalog,
95
130
  skillsCommand,
96
131
  workflowDurationMillis
97
- } from "./chunk-DQAZTA4I.js";
132
+ } from "./chunk-TLWLJ7PD.js";
98
133
  import {
99
- DatabaseFieldReserved,
100
- DatabaseLimitExceeded
101
- } from "./chunk-N7YDVXYJ.js";
102
- import "./chunk-YEPYT6SD.js";
134
+ FailureCode,
135
+ FailureDetail,
136
+ FailureFieldName,
137
+ FailureFieldValue,
138
+ FailureFields,
139
+ FailureMessage,
140
+ FailureName,
141
+ FailurePhase,
142
+ FailureSource,
143
+ FetchOptionUnsupported,
144
+ NetworkRefusal,
145
+ NetworkRefused,
146
+ ProviderError,
147
+ UpstreamError,
148
+ maxFailureFieldLength,
149
+ maxFailureFields,
150
+ maxFailureMessageLength,
151
+ maxUpstreamMessageLength,
152
+ networkRefusalHeader,
153
+ networkRefusalResponse,
154
+ networkRefusalStatus
155
+ } from "./chunk-MWKHKOTL.js";
103
156
  import {
104
157
  AppSkillMetadata,
105
158
  AppSkillName,
@@ -108,56 +161,61 @@ import {
108
161
  SkillDefinitionInvalid,
109
162
  SkillFile,
110
163
  SkillFilePath,
111
- SkillLoadFailed,
112
164
  SkillServiceName,
113
165
  skillFormatLimits,
114
166
  skillLoadLimits
115
- } from "./chunk-JU7VHODU.js";
116
- import {
117
- ApiErrorResponse,
118
- OpenapiResponseError
119
- } from "./chunk-W4DMKWAB.js";
120
- import {
121
- ProviderError
122
- } from "./chunk-SB3V4YVR.js";
123
- import {
124
- AppStorageError,
125
- AppStorageUnavailable,
126
- StorageName
127
- } from "./chunk-PZB6T6KU.js";
167
+ } from "./chunk-H72MEDMN.js";
168
+ import "./chunk-5FHWNLCI.js";
128
169
  import {
129
170
  AccountId,
130
171
  HttpUrl
131
- } from "./chunk-27F7W2LG.js";
132
- import "./chunk-CDL5PM2Q.js";
172
+ } from "./chunk-H2CJWXA3.js";
173
+ import "./chunk-TUMGL2OC.js";
174
+ import "./chunk-EOPQ727L.js";
175
+ import "./chunk-IFJU5SYQ.js";
133
176
  import "./chunk-CZ7CSFO4.js";
134
177
  export {
178
+ AccountCheckCommand,
179
+ AccountCheckResult,
135
180
  AccountId,
181
+ AccountInfo,
136
182
  ApiErrorResponse,
137
183
  AppSkillMetadata,
138
184
  AppSkillName,
139
185
  AppSkillSource,
140
186
  AppSkills,
141
- AppStorageError,
142
- AppStorageUnavailable,
143
187
  ApprovalElicitation,
144
188
  ApprovalResponse,
145
189
  CalendarSchedule,
190
+ CredentialHost,
146
191
  DatabaseFieldReserved,
147
192
  DatabaseLimitExceeded,
148
193
  DeclaredAuthMethod,
194
+ DeclaredEvent,
195
+ DeclaredEvents,
149
196
  DeclaredProvider,
150
197
  DeclaredRequirements,
151
198
  ElicitationFailed,
152
199
  ElicitationLimits,
153
200
  ElicitationReply,
154
201
  ElicitationResponse,
202
+ EmittedEvent,
203
+ EmittedEvents,
204
+ EventFilterValue,
205
+ EventLimits,
206
+ EventName,
155
207
  FailureCode,
156
208
  FailureDetail,
209
+ FailureFieldName,
210
+ FailureFieldValue,
211
+ FailureFields,
157
212
  FailureMessage,
158
213
  FailureName,
214
+ FailurePhase,
159
215
  FailureSource,
216
+ FetchOptionUnsupported,
160
217
  FormElicitation,
218
+ HostAccountCheckError,
161
219
  HostAccountsInvalid,
162
220
  HostCallError,
163
221
  HostDataError,
@@ -167,6 +225,7 @@ export {
167
225
  HostInputInvalid,
168
226
  HostInspectError,
169
227
  HostInvocation,
228
+ HostKindMismatch,
170
229
  HostOperationFailed,
171
230
  HostOperationNotFound,
172
231
  HostOutputInvalid,
@@ -174,10 +233,14 @@ export {
174
233
  HostRequestInvalid,
175
234
  HostRequirementsError,
176
235
  HostResponse,
236
+ HostRouterError,
177
237
  HostToolApprovalRequired,
178
238
  HostToolBlocked,
179
239
  HostToolNotFound,
180
240
  HostToolPolicyFailed,
241
+ HostedCatalog,
242
+ HostedCatalogSummary,
243
+ HostedRouter,
181
244
  HostedTool,
182
245
  HostedToolSummary,
183
246
  HostedWebhook,
@@ -186,19 +249,29 @@ export {
186
249
  InputProblem,
187
250
  Interval,
188
251
  InvocationDeadline,
252
+ InvocationTiming,
253
+ InvocationTimingSink,
189
254
  ManualWebhookDescriptor,
190
255
  ManualWebhookSetup,
191
256
  McpClientLimits,
192
257
  McpError,
258
+ MigrateCommand,
259
+ MigrateResult,
260
+ NetworkRefusal,
261
+ NetworkRefused,
193
262
  NonRetryableError,
194
263
  OAuthClientAuth,
195
264
  OAuthSecretClientAuth,
265
+ OAuthTokenRequestFormat,
266
+ OAuthTokenResponse,
196
267
  OpenapiResponseError,
197
268
  OperationSchedule,
198
- OperationToolPrefixes,
199
269
  ProviderError,
200
270
  ResolvedAccount,
201
271
  ResolvedAccounts,
272
+ RouterIcon,
273
+ RouterKey,
274
+ RouterMeta,
202
275
  ScheduleTiming,
203
276
  SkillCatalogResponse,
204
277
  SkillDefinitionInvalid,
@@ -207,9 +280,9 @@ export {
207
280
  SkillLoadFailed,
208
281
  SkillServiceName,
209
282
  SkillSources,
210
- StorageName,
211
283
  ToolResultObservation,
212
284
  TrustedToolApproval,
285
+ UpstreamError,
213
286
  WebhookCommand,
214
287
  WebhookRequestData,
215
288
  WebhookResponseData,
@@ -231,17 +304,34 @@ export {
231
304
  WorkflowValue,
232
305
  approvalElicitation,
233
306
  defaultElicitationLimits,
307
+ defaultEventLimits,
234
308
  defaultMcpClientLimits,
235
309
  defaultWebhookTransportLimits,
236
310
  frameworkProtocol,
237
311
  indexCommand,
238
312
  inspectCommand,
313
+ maxApiErrorInstructionsLength,
314
+ maxApiErrorMessageLength,
315
+ maxFailureFieldLength,
316
+ maxFailureFields,
239
317
  maxFailureMessageLength,
240
318
  maxInputProblems,
319
+ maxUpstreamMessageLength,
241
320
  minimumIntervalMilliseconds,
321
+ networkRefusalHeader,
322
+ networkRefusalResponse,
323
+ networkRefusalStatus,
242
324
  protocol1,
325
+ protocol10,
326
+ current as protocol11,
243
327
  protocol2,
244
328
  protocol3,
329
+ protocol4,
330
+ protocol5,
331
+ protocol6,
332
+ protocol7,
333
+ protocol8,
334
+ protocol9,
245
335
  selectTools,
246
336
  skillCatalog,
247
337
  skillFormatLimits,