apps 0.0.1-beta.7 → 0.0.1-beta.70

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 (178) hide show
  1. package/README.md +25 -22
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-UESPOTUI.js → chunk-2YSTJMBD.js} +899 -190
  4. package/js/{chunk-RJDDBDSN.js → chunk-3CVQ3VPP.js} +762 -171
  5. package/js/chunk-3R3KFCDU.js +426 -0
  6. package/js/{chunk-FL2QR3XW.js → chunk-4NCIPADO.js} +326 -69
  7. package/js/chunk-5FHWNLCI.js +88 -0
  8. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  9. package/js/chunk-7LMU3ER3.js +274 -0
  10. package/js/chunk-CDXQDN7W.js +92 -0
  11. package/js/{chunk-RFVIONFX.js → chunk-ECCWT5GJ.js} +79 -41
  12. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  13. package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
  14. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  15. package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
  16. package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
  17. package/js/{chunk-WLE7WX2U.js → chunk-JW5LYSER.js} +2262 -474
  18. package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
  19. package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  20. package/js/chunk-M5OLYYNU.js +347 -0
  21. package/js/chunk-MHB7IFG7.js +49 -0
  22. package/js/chunk-OD3KFKZD.js +1617 -0
  23. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  24. package/js/{chunk-NKLWZJLE.js → chunk-RUP4JMKO.js} +25 -14
  25. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  26. package/js/{chunk-72JNVHPK.js → chunk-WDIVWSDG.js} +4 -3
  27. package/js/{chunk-CMYUWAX7.js → chunk-WGQP62EG.js} +126 -31
  28. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  29. package/js/{chunk-Z5M2LQOZ.js → chunk-ZEJ3IKEC.js} +67 -55
  30. package/js/chunk-ZR7QAG67.js +171 -0
  31. package/js/client.js +142 -94
  32. package/js/contracts.js +125 -26
  33. package/js/effect.js +19 -19
  34. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  35. package/js/graphql.js +50 -40
  36. package/js/host.js +83 -58
  37. package/js/index.js +131 -46
  38. package/js/mcp/effect.js +23 -21
  39. package/js/mcp/stdio.js +44 -34
  40. package/js/mcp.js +76 -53
  41. package/js/openapi.js +4063 -1359
  42. package/js/react.js +2 -3
  43. package/js/skills/effect.js +6 -3
  44. package/js/skills.js +208 -81
  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 +3 -4
  51. package/runtime.json +1 -1
  52. package/types/app-cache/src/contracts/cache.d.ts +2 -0
  53. package/types/app-cache/src/index.d.ts +10 -1
  54. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  55. package/types/apps/src/contracts/app.d.ts +7 -3
  56. package/types/apps/src/contracts/cache.d.ts +20 -0
  57. package/types/apps/src/contracts/context.d.ts +19 -11
  58. package/types/apps/src/contracts/elicitation.d.ts +6 -6
  59. package/types/apps/src/contracts/events.d.ts +93 -0
  60. package/types/apps/src/contracts/failure.d.ts +30 -1
  61. package/types/apps/src/contracts/graphql.d.ts +2 -1
  62. package/types/apps/src/contracts/host.d.ts +641 -16
  63. package/types/apps/src/contracts/live.d.ts +2 -0
  64. package/types/apps/src/contracts/mcp.d.ts +80 -10
  65. package/types/apps/src/contracts/network.d.ts +120 -0
  66. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  67. package/types/apps/src/contracts/openapi.d.ts +41 -9
  68. package/types/apps/src/contracts/operations.d.ts +8 -4
  69. package/types/apps/src/contracts/placement.d.ts +102 -0
  70. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  71. package/types/apps/src/contracts/protocols/1.d.ts +733 -81
  72. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  73. package/types/apps/src/contracts/protocols/2.d.ts +69 -26
  74. package/types/apps/src/contracts/protocols/3.d.ts +133 -33
  75. package/types/apps/src/contracts/protocols/4.d.ts +122 -45
  76. package/types/apps/src/contracts/protocols/5.d.ts +157 -47
  77. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  78. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  79. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  80. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  81. package/types/apps/src/contracts/protocols/current.d.ts +3842 -0
  82. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  83. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  84. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  85. package/types/apps/src/contracts/provider.d.ts +90 -6
  86. package/types/apps/src/contracts/skills.d.ts +50 -13
  87. package/types/apps/src/contracts/sql.d.ts +63 -0
  88. package/types/apps/src/contracts/ui.d.ts +19 -1
  89. package/types/apps/src/contracts/workflows.d.ts +6 -0
  90. package/types/apps/src/facet.d.ts +4 -5
  91. package/types/apps/src/host.d.ts +5 -0
  92. package/types/apps/src/implementation/account-router.d.ts +4 -3
  93. package/types/apps/src/implementation/authoring.d.ts +25 -5
  94. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  95. package/types/apps/src/implementation/cache.d.ts +4 -0
  96. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  97. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  98. package/types/apps/src/implementation/events.d.ts +59 -0
  99. package/types/apps/src/implementation/failure-detail.d.ts +25 -3
  100. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  101. package/types/apps/src/implementation/graphql.d.ts +4 -3
  102. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  103. package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
  104. package/types/apps/src/implementation/live.d.ts +2 -2
  105. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  106. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  107. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  108. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  109. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  110. package/types/apps/src/implementation/mcp.d.ts +20 -9
  111. package/types/apps/src/implementation/network.d.ts +16 -0
  112. package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
  113. package/types/apps/src/implementation/openapi-document.d.ts +46 -19
  114. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  115. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  116. package/types/apps/src/implementation/openapi-source.d.ts +18 -0
  117. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  118. package/types/apps/src/implementation/operations.d.ts +17 -2
  119. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  120. package/types/apps/src/implementation/placement.d.ts +60 -0
  121. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  122. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  123. package/types/apps/src/implementation/provider.d.ts +18 -3
  124. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  125. package/types/apps/src/implementation/router-catalog.d.ts +11 -13
  126. package/types/apps/src/implementation/router.d.ts +16 -5
  127. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  128. package/types/apps/src/implementation/schema.d.ts +90 -10
  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/workflows.d.ts +1 -1
  141. package/types/apps/src/index.d.ts +55 -13
  142. package/types/apps/src/mcp.d.ts +20 -1
  143. package/types/apps/src/openapi.d.ts +1 -1
  144. package/types/apps/src/react.d.ts +1 -1
  145. package/types/apps/src/skills.d.ts +10 -8
  146. package/types/telemetry/src/app-records.d.ts +42 -0
  147. package/types/telemetry/src/browser-operations.d.ts +7 -4
  148. package/types/telemetry/src/browser.d.ts +8 -3
  149. package/types/telemetry/src/config.d.ts +2 -2
  150. package/types/telemetry/src/index.d.ts +2 -1
  151. package/types/telemetry/src/layer.d.ts +2 -2
  152. package/types/telemetry/src/measurements.d.ts +1 -1
  153. package/types/telemetry/src/ownership.d.ts +56 -0
  154. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  155. package/types/telemetry/src/relay.d.ts +16 -6
  156. package/types/telemetry/src/span-attributes.d.ts +17 -1
  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-MKWZPDR6.js +0 -63
  163. package/js/chunk-N7YDVXYJ.js +0 -186
  164. package/js/chunk-OCYUEU47.js +0 -224
  165. package/js/chunk-PJJ24GU7.js +0 -877
  166. package/js/chunk-PZB6T6KU.js +0 -19
  167. package/js/chunk-R3EV5FTO.js +0 -97
  168. package/js/chunk-YXQHV65J.js +0 -242
  169. package/js/chunk-ZQINWV4W.js +0 -630
  170. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  171. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  172. package/types/app-data/src/implementation/promise.d.ts +0 -68
  173. package/types/app-data/src/implementation/range.d.ts +0 -8
  174. package/types/app-data/src/implementation/schema.d.ts +0 -18
  175. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  176. package/types/app-data/src/index.d.ts +0 -4
  177. package/types/apps/src/contracts/storage.d.ts +0 -68
  178. 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-3CVQ3VPP.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-5T57N25Q.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
@@ -6,20 +6,27 @@ import {
6
6
  ApprovalElicitation,
7
7
  ApprovalResponse,
8
8
  CalendarSchedule,
9
+ CredentialHost,
10
+ DatabaseFieldReserved,
11
+ DatabaseLimitExceeded,
9
12
  DeclaredAuthMethod,
13
+ DeclaredEvent,
14
+ DeclaredEvents,
10
15
  DeclaredProvider,
11
16
  DeclaredRequirements,
12
17
  ElicitationFailed,
13
18
  ElicitationLimits,
14
19
  ElicitationReply,
15
20
  ElicitationResponse,
16
- FailureCode,
17
- FailureDetail,
18
- FailureMessage,
19
- FailureName,
20
- FailureSource,
21
+ EmittedEvent,
22
+ EmittedEvents,
23
+ EventFilterValue,
24
+ EventLimits,
25
+ EventName,
21
26
  FormElicitation,
27
+ HostAccount,
22
28
  HostAccountCheckError,
29
+ HostAccounts,
23
30
  HostAccountsInvalid,
24
31
  HostCallError,
25
32
  HostDataError,
@@ -52,15 +59,30 @@ import {
52
59
  InputProblem,
53
60
  Interval,
54
61
  InvocationDeadline,
62
+ InvocationTiming,
63
+ InvocationTimingSink,
55
64
  ManualWebhookDescriptor,
56
65
  ManualWebhookSetup,
57
66
  McpClientLimits,
58
- McpError,
67
+ McpError2 as McpError,
68
+ MigrateCommand,
69
+ MigrateResult,
59
70
  NonRetryableError,
71
+ OAuthAuthorizationParams,
60
72
  OAuthClientAuth,
61
73
  OAuthSecretClientAuth,
74
+ OAuthTokenRequestFormat,
75
+ OAuthTokenResponse,
62
76
  OpenapiResponseError,
63
77
  OperationSchedule,
78
+ Placement,
79
+ PlacementBase64,
80
+ PlacementField,
81
+ PlacementFieldMissing,
82
+ PlacementHeaderName,
83
+ PlacementPart,
84
+ PlacementText,
85
+ Placements,
64
86
  ResolvedAccount,
65
87
  ResolvedAccounts,
66
88
  RouterIcon,
@@ -68,6 +90,7 @@ import {
68
90
  RouterMeta,
69
91
  ScheduleTiming,
70
92
  SkillCatalogResponse,
93
+ SkillLoadFailed,
71
94
  SkillSources,
72
95
  ToolResultObservation,
73
96
  TrustedToolApproval,
@@ -91,32 +114,61 @@ import {
91
114
  WorkflowStepOptions,
92
115
  WorkflowValue,
93
116
  approvalElicitation,
117
+ current,
94
118
  defaultElicitationLimits,
119
+ defaultEventLimits,
95
120
  defaultMcpClientLimits,
96
121
  defaultWebhookTransportLimits,
97
122
  frameworkProtocol,
98
123
  indexCommand,
99
124
  inspectCommand,
100
- maxFailureMessageLength,
125
+ isPlacementField,
126
+ maxApiErrorInstructionsLength,
127
+ maxApiErrorMessageLength,
101
128
  maxInputProblems,
102
129
  minimumIntervalMilliseconds,
130
+ normalizePlacements,
131
+ placementFields,
132
+ placementKey,
103
133
  protocol1,
134
+ protocol10,
104
135
  protocol2,
105
136
  protocol3,
106
137
  protocol4,
107
138
  protocol5,
139
+ protocol6,
140
+ protocol7,
141
+ protocol8,
142
+ protocol9,
143
+ renderPlacement,
108
144
  selectTools,
109
145
  skillCatalog,
110
146
  skillsCommand,
111
147
  workflowDurationMillis
112
- } from "./chunk-WLE7WX2U.js";
148
+ } from "./chunk-JW5LYSER.js";
113
149
  import {
114
- DatabaseFieldReserved,
115
- DatabaseLimitExceeded
116
- } from "./chunk-N7YDVXYJ.js";
117
- import {
118
- ProviderError
119
- } from "./chunk-R3EV5FTO.js";
150
+ FailureCode,
151
+ FailureDetail,
152
+ FailureFieldName,
153
+ FailureFieldValue,
154
+ FailureFields,
155
+ FailureMessage,
156
+ FailureName,
157
+ FailurePhase,
158
+ FailureSource,
159
+ FetchOptionUnsupported,
160
+ NetworkRefusal,
161
+ NetworkRefused,
162
+ ProviderError,
163
+ UpstreamError,
164
+ maxFailureFieldLength,
165
+ maxFailureFields,
166
+ maxFailureMessageLength,
167
+ maxUpstreamMessageLength,
168
+ networkRefusalHeader,
169
+ networkRefusalResponse,
170
+ networkRefusalStatus
171
+ } from "./chunk-7LMU3ER3.js";
120
172
  import {
121
173
  AppSkillMetadata,
122
174
  AppSkillName,
@@ -125,21 +177,18 @@ import {
125
177
  SkillDefinitionInvalid,
126
178
  SkillFile,
127
179
  SkillFilePath,
128
- SkillLoadFailed,
129
180
  SkillServiceName,
130
181
  skillFormatLimits,
131
182
  skillLoadLimits
132
- } from "./chunk-JU7VHODU.js";
133
- import {
134
- AppStorageError,
135
- AppStorageUnavailable,
136
- StorageName
137
- } from "./chunk-PZB6T6KU.js";
183
+ } from "./chunk-H72MEDMN.js";
184
+ import "./chunk-5FHWNLCI.js";
138
185
  import {
139
186
  AccountId,
140
187
  HttpUrl
141
- } from "./chunk-27F7W2LG.js";
142
- import "./chunk-CDL5PM2Q.js";
188
+ } from "./chunk-H2CJWXA3.js";
189
+ import "./chunk-TUMGL2OC.js";
190
+ import "./chunk-EOPQ727L.js";
191
+ import "./chunk-IFJU5SYQ.js";
143
192
  import "./chunk-CZ7CSFO4.js";
144
193
  export {
145
194
  AccountCheckCommand,
@@ -151,27 +200,40 @@ export {
151
200
  AppSkillName,
152
201
  AppSkillSource,
153
202
  AppSkills,
154
- AppStorageError,
155
- AppStorageUnavailable,
156
203
  ApprovalElicitation,
157
204
  ApprovalResponse,
158
205
  CalendarSchedule,
206
+ CredentialHost,
159
207
  DatabaseFieldReserved,
160
208
  DatabaseLimitExceeded,
161
209
  DeclaredAuthMethod,
210
+ DeclaredEvent,
211
+ DeclaredEvents,
162
212
  DeclaredProvider,
163
213
  DeclaredRequirements,
164
214
  ElicitationFailed,
165
215
  ElicitationLimits,
166
216
  ElicitationReply,
167
217
  ElicitationResponse,
218
+ EmittedEvent,
219
+ EmittedEvents,
220
+ EventFilterValue,
221
+ EventLimits,
222
+ EventName,
168
223
  FailureCode,
169
224
  FailureDetail,
225
+ FailureFieldName,
226
+ FailureFieldValue,
227
+ FailureFields,
170
228
  FailureMessage,
171
229
  FailureName,
230
+ FailurePhase,
172
231
  FailureSource,
232
+ FetchOptionUnsupported,
173
233
  FormElicitation,
234
+ HostAccount,
174
235
  HostAccountCheckError,
236
+ HostAccounts,
175
237
  HostAccountsInvalid,
176
238
  HostCallError,
177
239
  HostDataError,
@@ -205,15 +267,32 @@ export {
205
267
  InputProblem,
206
268
  Interval,
207
269
  InvocationDeadline,
270
+ InvocationTiming,
271
+ InvocationTimingSink,
208
272
  ManualWebhookDescriptor,
209
273
  ManualWebhookSetup,
210
274
  McpClientLimits,
211
275
  McpError,
276
+ MigrateCommand,
277
+ MigrateResult,
278
+ NetworkRefusal,
279
+ NetworkRefused,
212
280
  NonRetryableError,
281
+ OAuthAuthorizationParams,
213
282
  OAuthClientAuth,
214
283
  OAuthSecretClientAuth,
284
+ OAuthTokenRequestFormat,
285
+ OAuthTokenResponse,
215
286
  OpenapiResponseError,
216
287
  OperationSchedule,
288
+ Placement,
289
+ PlacementBase64,
290
+ PlacementField,
291
+ PlacementFieldMissing,
292
+ PlacementHeaderName,
293
+ PlacementPart,
294
+ PlacementText,
295
+ Placements,
217
296
  ProviderError,
218
297
  ResolvedAccount,
219
298
  ResolvedAccounts,
@@ -228,9 +307,9 @@ export {
228
307
  SkillLoadFailed,
229
308
  SkillServiceName,
230
309
  SkillSources,
231
- StorageName,
232
310
  ToolResultObservation,
233
311
  TrustedToolApproval,
312
+ UpstreamError,
234
313
  WebhookCommand,
235
314
  WebhookRequestData,
236
315
  WebhookResponseData,
@@ -252,19 +331,39 @@ export {
252
331
  WorkflowValue,
253
332
  approvalElicitation,
254
333
  defaultElicitationLimits,
334
+ defaultEventLimits,
255
335
  defaultMcpClientLimits,
256
336
  defaultWebhookTransportLimits,
257
337
  frameworkProtocol,
258
338
  indexCommand,
259
339
  inspectCommand,
340
+ isPlacementField,
341
+ maxApiErrorInstructionsLength,
342
+ maxApiErrorMessageLength,
343
+ maxFailureFieldLength,
344
+ maxFailureFields,
260
345
  maxFailureMessageLength,
261
346
  maxInputProblems,
347
+ maxUpstreamMessageLength,
262
348
  minimumIntervalMilliseconds,
349
+ networkRefusalHeader,
350
+ networkRefusalResponse,
351
+ networkRefusalStatus,
352
+ normalizePlacements,
353
+ placementFields,
354
+ placementKey,
263
355
  protocol1,
356
+ protocol10,
357
+ current as protocol11,
264
358
  protocol2,
265
359
  protocol3,
266
360
  protocol4,
267
361
  protocol5,
362
+ protocol6,
363
+ protocol7,
364
+ protocol8,
365
+ protocol9,
366
+ renderPlacement,
268
367
  selectTools,
269
368
  skillCatalog,
270
369
  skillFormatLimits,