apps 0.0.1-beta.8 → 0.0.1-beta.81

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 (180) hide show
  1. package/README.md +25 -22
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-72JNVHPK.js → chunk-4NFSABEA.js} +4 -3
  4. package/js/chunk-5FHWNLCI.js +88 -0
  5. package/js/chunk-5WGONRKQ.js +426 -0
  6. package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
  7. package/js/chunk-CDXQDN7W.js +92 -0
  8. package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
  9. package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
  10. package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
  11. package/js/{chunk-FL2QR3XW.js → chunk-HJG4RBYM.js} +333 -69
  12. package/js/chunk-I6Q7ZPKJ.js +49 -0
  13. package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
  14. package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
  15. package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
  16. package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
  17. package/js/{chunk-WLE7WX2U.js → chunk-NG56RPCA.js} +2348 -472
  18. package/js/chunk-OD3KFKZD.js +1617 -0
  19. package/js/{chunk-Z5M2LQOZ.js → chunk-OY47QPQY.js} +67 -55
  20. package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
  21. package/js/chunk-PL5KOEZD.js +334 -0
  22. package/js/chunk-Q4IZAUIF.js +285 -0
  23. package/js/{chunk-RJDDBDSN.js → chunk-QWQM3CLH.js} +795 -177
  24. package/js/{chunk-RFVIONFX.js → chunk-TE25A7D6.js} +123 -44
  25. package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
  26. package/js/chunk-W6XCQAXP.js +171 -0
  27. package/js/chunk-WCGAO3X5.js +348 -0
  28. package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
  29. package/js/{chunk-CMYUWAX7.js → chunk-YQUG4CES.js} +126 -31
  30. package/js/{chunk-UESPOTUI.js → chunk-Z2SWTZCF.js} +861 -231
  31. package/js/client.js +142 -94
  32. package/js/contracts.js +127 -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 +4071 -1357
  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 +8604 -223
  50. package/package.json +3 -4
  51. package/runtime.json +1 -1
  52. package/types/app-cache/src/contracts/cache.d.ts +18 -0
  53. package/types/app-cache/src/index.d.ts +34 -2
  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 +23 -7
  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 +649 -17
  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 +3843 -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 +37 -3
  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 +28 -1
  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 +18 -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 +28 -9
  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/apps/src/ui-serving.d.ts +1 -1
  147. package/types/telemetry/src/app-records.d.ts +42 -0
  148. package/types/telemetry/src/browser-operations.d.ts +2 -2
  149. package/types/telemetry/src/browser.d.ts +8 -3
  150. package/types/telemetry/src/config.d.ts +2 -2
  151. package/types/telemetry/src/index.d.ts +2 -1
  152. package/types/telemetry/src/layer.d.ts +10 -4
  153. package/types/telemetry/src/measurements.d.ts +1 -1
  154. package/types/telemetry/src/ownership.d.ts +60 -0
  155. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  156. package/types/telemetry/src/relay.d.ts +16 -6
  157. package/types/telemetry/src/span-attributes.d.ts +17 -1
  158. package/types/telemetry/src/transport.d.ts +8 -1
  159. package/types/utils/src/api-error.d.ts +55 -0
  160. package/types/utils/src/connection-failure.d.ts +33 -0
  161. package/types/utils/src/recorded-message.d.ts +18 -0
  162. package/types/utils/src/user-facing-error.d.ts +83 -0
  163. package/js/chunk-MKWZPDR6.js +0 -63
  164. package/js/chunk-N7YDVXYJ.js +0 -186
  165. package/js/chunk-NKLWZJLE.js +0 -172
  166. package/js/chunk-OCYUEU47.js +0 -224
  167. package/js/chunk-PJJ24GU7.js +0 -877
  168. package/js/chunk-PZB6T6KU.js +0 -19
  169. package/js/chunk-R3EV5FTO.js +0 -97
  170. package/js/chunk-YXQHV65J.js +0 -242
  171. package/js/chunk-ZQINWV4W.js +0 -630
  172. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  173. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  174. package/types/app-data/src/implementation/promise.d.ts +0 -68
  175. package/types/app-data/src/implementation/range.d.ts +0 -8
  176. package/types/app-data/src/implementation/schema.d.ts +0 -18
  177. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  178. package/types/app-data/src/index.d.ts +0 -4
  179. package/types/apps/src/contracts/storage.d.ts +0 -68
  180. 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-QWQM3CLH.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,62 @@ import {
91
114
  WorkflowStepOptions,
92
115
  WorkflowValue,
93
116
  approvalElicitation,
117
+ current,
94
118
  defaultElicitationLimits,
119
+ defaultEventLimits,
95
120
  defaultMcpClientLimits,
96
121
  defaultWebhookTransportLimits,
122
+ exactApprovalElicitation,
97
123
  frameworkProtocol,
98
124
  indexCommand,
99
125
  inspectCommand,
100
- maxFailureMessageLength,
126
+ isPlacementField,
127
+ maxApiErrorInstructionsLength,
128
+ maxApiErrorMessageLength,
101
129
  maxInputProblems,
102
130
  minimumIntervalMilliseconds,
131
+ normalizePlacements,
132
+ placementFields,
133
+ placementKey,
103
134
  protocol1,
135
+ protocol10,
104
136
  protocol2,
105
137
  protocol3,
106
138
  protocol4,
107
139
  protocol5,
140
+ protocol6,
141
+ protocol7,
142
+ protocol8,
143
+ protocol9,
144
+ renderPlacement,
108
145
  selectTools,
109
146
  skillCatalog,
110
147
  skillsCommand,
111
148
  workflowDurationMillis
112
- } from "./chunk-WLE7WX2U.js";
149
+ } from "./chunk-NG56RPCA.js";
113
150
  import {
114
- DatabaseFieldReserved,
115
- DatabaseLimitExceeded
116
- } from "./chunk-N7YDVXYJ.js";
117
- import {
118
- ProviderError
119
- } from "./chunk-R3EV5FTO.js";
151
+ FailureCode,
152
+ FailureDetail,
153
+ FailureFieldName,
154
+ FailureFieldValue,
155
+ FailureFields,
156
+ FailureMessage,
157
+ FailureName,
158
+ FailurePhase,
159
+ FailureSource,
160
+ FetchOptionUnsupported,
161
+ NetworkRefusal,
162
+ NetworkRefused,
163
+ ProviderError,
164
+ UpstreamError,
165
+ maxFailureFieldLength,
166
+ maxFailureFields,
167
+ maxFailureMessageLength,
168
+ maxUpstreamMessageLength,
169
+ networkRefusalHeader,
170
+ networkRefusalResponse,
171
+ networkRefusalStatus
172
+ } from "./chunk-Q4IZAUIF.js";
120
173
  import {
121
174
  AppSkillMetadata,
122
175
  AppSkillName,
@@ -125,21 +178,18 @@ import {
125
178
  SkillDefinitionInvalid,
126
179
  SkillFile,
127
180
  SkillFilePath,
128
- SkillLoadFailed,
129
181
  SkillServiceName,
130
182
  skillFormatLimits,
131
183
  skillLoadLimits
132
- } from "./chunk-JU7VHODU.js";
133
- import {
134
- AppStorageError,
135
- AppStorageUnavailable,
136
- StorageName
137
- } from "./chunk-PZB6T6KU.js";
184
+ } from "./chunk-H72MEDMN.js";
185
+ import "./chunk-5FHWNLCI.js";
138
186
  import {
139
187
  AccountId,
140
188
  HttpUrl
141
- } from "./chunk-27F7W2LG.js";
142
- import "./chunk-CDL5PM2Q.js";
189
+ } from "./chunk-H2CJWXA3.js";
190
+ import "./chunk-TUMGL2OC.js";
191
+ import "./chunk-EOPQ727L.js";
192
+ import "./chunk-IFJU5SYQ.js";
143
193
  import "./chunk-CZ7CSFO4.js";
144
194
  export {
145
195
  AccountCheckCommand,
@@ -151,27 +201,40 @@ export {
151
201
  AppSkillName,
152
202
  AppSkillSource,
153
203
  AppSkills,
154
- AppStorageError,
155
- AppStorageUnavailable,
156
204
  ApprovalElicitation,
157
205
  ApprovalResponse,
158
206
  CalendarSchedule,
207
+ CredentialHost,
159
208
  DatabaseFieldReserved,
160
209
  DatabaseLimitExceeded,
161
210
  DeclaredAuthMethod,
211
+ DeclaredEvent,
212
+ DeclaredEvents,
162
213
  DeclaredProvider,
163
214
  DeclaredRequirements,
164
215
  ElicitationFailed,
165
216
  ElicitationLimits,
166
217
  ElicitationReply,
167
218
  ElicitationResponse,
219
+ EmittedEvent,
220
+ EmittedEvents,
221
+ EventFilterValue,
222
+ EventLimits,
223
+ EventName,
168
224
  FailureCode,
169
225
  FailureDetail,
226
+ FailureFieldName,
227
+ FailureFieldValue,
228
+ FailureFields,
170
229
  FailureMessage,
171
230
  FailureName,
231
+ FailurePhase,
172
232
  FailureSource,
233
+ FetchOptionUnsupported,
173
234
  FormElicitation,
235
+ HostAccount,
174
236
  HostAccountCheckError,
237
+ HostAccounts,
175
238
  HostAccountsInvalid,
176
239
  HostCallError,
177
240
  HostDataError,
@@ -205,15 +268,32 @@ export {
205
268
  InputProblem,
206
269
  Interval,
207
270
  InvocationDeadline,
271
+ InvocationTiming,
272
+ InvocationTimingSink,
208
273
  ManualWebhookDescriptor,
209
274
  ManualWebhookSetup,
210
275
  McpClientLimits,
211
276
  McpError,
277
+ MigrateCommand,
278
+ MigrateResult,
279
+ NetworkRefusal,
280
+ NetworkRefused,
212
281
  NonRetryableError,
282
+ OAuthAuthorizationParams,
213
283
  OAuthClientAuth,
214
284
  OAuthSecretClientAuth,
285
+ OAuthTokenRequestFormat,
286
+ OAuthTokenResponse,
215
287
  OpenapiResponseError,
216
288
  OperationSchedule,
289
+ Placement,
290
+ PlacementBase64,
291
+ PlacementField,
292
+ PlacementFieldMissing,
293
+ PlacementHeaderName,
294
+ PlacementPart,
295
+ PlacementText,
296
+ Placements,
217
297
  ProviderError,
218
298
  ResolvedAccount,
219
299
  ResolvedAccounts,
@@ -228,9 +308,9 @@ export {
228
308
  SkillLoadFailed,
229
309
  SkillServiceName,
230
310
  SkillSources,
231
- StorageName,
232
311
  ToolResultObservation,
233
312
  TrustedToolApproval,
313
+ UpstreamError,
234
314
  WebhookCommand,
235
315
  WebhookRequestData,
236
316
  WebhookResponseData,
@@ -252,19 +332,40 @@ export {
252
332
  WorkflowValue,
253
333
  approvalElicitation,
254
334
  defaultElicitationLimits,
335
+ defaultEventLimits,
255
336
  defaultMcpClientLimits,
256
337
  defaultWebhookTransportLimits,
338
+ exactApprovalElicitation,
257
339
  frameworkProtocol,
258
340
  indexCommand,
259
341
  inspectCommand,
342
+ isPlacementField,
343
+ maxApiErrorInstructionsLength,
344
+ maxApiErrorMessageLength,
345
+ maxFailureFieldLength,
346
+ maxFailureFields,
260
347
  maxFailureMessageLength,
261
348
  maxInputProblems,
349
+ maxUpstreamMessageLength,
262
350
  minimumIntervalMilliseconds,
351
+ networkRefusalHeader,
352
+ networkRefusalResponse,
353
+ networkRefusalStatus,
354
+ normalizePlacements,
355
+ placementFields,
356
+ placementKey,
263
357
  protocol1,
358
+ protocol10,
359
+ current as protocol11,
264
360
  protocol2,
265
361
  protocol3,
266
362
  protocol4,
267
363
  protocol5,
364
+ protocol6,
365
+ protocol7,
366
+ protocol8,
367
+ protocol9,
368
+ renderPlacement,
268
369
  selectTools,
269
370
  skillCatalog,
270
371
  skillFormatLimits,