apps 0.0.1-beta.126 → 0.0.1-beta.127

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 (46) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-7TDDMSZI.js → chunk-2XVGONUX.js} +6 -6
  3. package/js/{chunk-V3HWVVFZ.js → chunk-3CDTMIVU.js} +3 -3
  4. package/js/{chunk-7ASLJHSD.js → chunk-3II7MIAQ.js} +6 -6
  5. package/js/{chunk-3KNB4HRA.js → chunk-53GRY7ZE.js} +3 -3
  6. package/js/{chunk-7ZYZWLXS.js → chunk-5CMAHXQD.js} +60 -61
  7. package/js/{chunk-VXBCDIWD.js → chunk-5H5IO2NZ.js} +778 -213
  8. package/js/{chunk-2AI3RZXP.js → chunk-5WCWPY23.js} +10 -10
  9. package/js/{chunk-MJUHAHDG.js → chunk-67DM7ASO.js} +2 -2
  10. package/js/{chunk-QUFLMMTG.js → chunk-DJNOADLI.js} +182 -61
  11. package/js/{chunk-KJW5IPM4.js → chunk-FXJUHTFE.js} +1 -1
  12. package/js/{chunk-VEQDEM6J.js → chunk-J3CZECVS.js} +13 -13
  13. package/js/{chunk-SO33LZ7J.js → chunk-KKKUQPWD.js} +2 -2
  14. package/js/{chunk-CCJUTN55.js → chunk-LC6YCEVL.js} +1 -1
  15. package/js/chunk-N7HXZNBD.js +161 -0
  16. package/js/{chunk-5TYZML5C.js → chunk-NGL6EJL6.js} +1775 -626
  17. package/js/{chunk-2EEUUSL7.js → chunk-NMSQJSBM.js} +308 -331
  18. package/js/{chunk-TTMRK64V.js → chunk-O46YT2VS.js} +2 -2
  19. package/js/{chunk-5LGG5YSE.js → chunk-PZBT2QO5.js} +2 -2
  20. package/js/{chunk-U2GHFWX2.js → chunk-QYHUNAWH.js} +7415 -3500
  21. package/js/{chunk-EPZ3P7IX.js → chunk-SA7FJGUX.js} +2 -2
  22. package/js/{chunk-LOHZM4RK.js → chunk-UJWZMRV6.js} +5 -5
  23. package/js/{chunk-MVAS3VFK.js → chunk-V2TAC4IJ.js} +8 -8
  24. package/js/{chunk-NCOPALJZ.js → chunk-WE4FZOSH.js} +1 -1
  25. package/js/{chunk-GWAA3COO.js → chunk-ZU2ECYYF.js} +4 -4
  26. package/js/{chunk-55QLA7T7.js → chunk-ZU77L7HU.js} +6 -6
  27. package/js/client.js +10 -10
  28. package/js/contracts.js +7 -7
  29. package/js/effect.js +18 -18
  30. package/js/graphql.js +20 -20
  31. package/js/host.js +18 -18
  32. package/js/index.js +13 -13
  33. package/js/mcp/effect.js +19 -19
  34. package/js/mcp.js +21 -21
  35. package/js/openapi.js +16 -16
  36. package/js/react.js +2 -2
  37. package/js/skills/effect.js +6 -6
  38. package/js/skills.js +15 -15
  39. package/js/ui/auth/contracts.js +2 -2
  40. package/js/ui/auth.js +5 -5
  41. package/js/ui/contracts.js +5 -5
  42. package/js/ui/serving.js +10 -10
  43. package/package.json +2 -2
  44. package/runtime.json +1 -1
  45. package/types/telemetry/src/layer.d.ts +1 -1
  46. package/js/chunk-EAPSQBFN.js +0 -75
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-VEQDEM6J.js";
3
+ } from "./chunk-J3CZECVS.js";
4
4
  import {
5
5
  failOnNetworkRefusal
6
- } from "./chunk-V3HWVVFZ.js";
6
+ } from "./chunk-3CDTMIVU.js";
7
7
  import {
8
8
  accountProviderError,
9
9
  bodyUpstreamError,
10
10
  fromPromise,
11
11
  httpProviderError,
12
12
  providerErrorDetail
13
- } from "./chunk-GWAA3COO.js";
13
+ } from "./chunk-ZU2ECYYF.js";
14
14
  import {
15
15
  ElicitationFailed,
16
16
  McpCredentialsUnverified,
@@ -28,26 +28,26 @@ import {
28
28
  defaultMcpClientLimits,
29
29
  mcpHealthReserveMs,
30
30
  mcpSdkTimerCeilingMs
31
- } from "./chunk-7ZYZWLXS.js";
31
+ } from "./chunk-5CMAHXQD.js";
32
32
  import {
33
33
  jsonSchemaDecoder,
34
34
  nestJsonSchema,
35
35
  preparedJsonSchemaDecoder
36
- } from "./chunk-5LGG5YSE.js";
36
+ } from "./chunk-PZBT2QO5.js";
37
37
  import {
38
38
  captureTelemetry,
39
39
  owned
40
- } from "./chunk-2EEUUSL7.js";
40
+ } from "./chunk-NMSQJSBM.js";
41
41
  import {
42
42
  FetchHttpClient_exports
43
- } from "./chunk-EAPSQBFN.js";
43
+ } from "./chunk-N7HXZNBD.js";
44
44
  import {
45
45
  JsonObject
46
- } from "./chunk-NCOPALJZ.js";
46
+ } from "./chunk-WE4FZOSH.js";
47
47
  import {
48
48
  HttpClientRequest_exports,
49
49
  HttpClient_exports
50
- } from "./chunk-5TYZML5C.js";
50
+ } from "./chunk-NGL6EJL6.js";
51
51
  import {
52
52
  Clock_exports,
53
53
  Deferred_exports,
@@ -61,7 +61,7 @@ import {
61
61
  Ref_exports,
62
62
  Schema_exports,
63
63
  Stream_exports
64
- } from "./chunk-U2GHFWX2.js";
64
+ } from "./chunk-QYHUNAWH.js";
65
65
 
66
66
  // src/implementation/mcp.ts
67
67
  import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  appSignInCallbackPath
3
- } from "./chunk-KJW5IPM4.js";
3
+ } from "./chunk-FXJUHTFE.js";
4
4
  import {
5
5
  HttpServerResponse_exports
6
- } from "./chunk-5TYZML5C.js";
6
+ } from "./chunk-NGL6EJL6.js";
7
7
 
8
8
  // src/implementation/ui-auth.ts
9
9
  var appPrivateHeaders = {
@@ -6,7 +6,7 @@ import {
6
6
  Int,
7
7
  InvalidType,
8
8
  MixedScheduler,
9
- Never,
9
+ Never2 as Never,
10
10
  NoSuchElementError,
11
11
  Option,
12
12
  Option_exports,
@@ -17,7 +17,7 @@ import {
17
17
  Service,
18
18
  TaggedError,
19
19
  TaggedStruct,
20
- Union,
20
+ Union2 as Union,
21
21
  acquireRelease,
22
22
  add,
23
23
  addFinalizer,
@@ -48,12 +48,11 @@ import {
48
48
  effect,
49
49
  empty,
50
50
  empty2,
51
- empty6 as empty3,
51
+ empty3,
52
52
  empty7 as empty4,
53
53
  encodeEffect,
54
54
  encodeExit,
55
55
  encodeSync,
56
- ensuring2 as ensuring,
57
56
  equals,
58
57
  fail2 as fail,
59
58
  fail3 as fail2,
@@ -78,7 +77,7 @@ import {
78
77
  fromQueue,
79
78
  gen,
80
79
  get,
81
- get3 as get2,
80
+ get2,
82
81
  get5 as get3,
83
82
  getCurrent,
84
83
  getOrElse,
@@ -93,6 +92,7 @@ import {
93
92
  hasProperty,
94
93
  hash,
95
94
  identity,
95
+ ignoreCause,
96
96
  interrupt,
97
97
  isDoneCause,
98
98
  isEffect,
@@ -102,18 +102,19 @@ import {
102
102
  isIterable,
103
103
  isNone,
104
104
  isReadonlyArrayNonEmpty,
105
+ isSchemaError,
105
106
  isSome,
106
107
  isStream,
107
108
  isSubscriptionRef,
108
109
  joinAll,
109
110
  lastNonEmpty,
110
111
  link,
111
- make3 as make,
112
+ make2 as make,
112
113
  makeCompositeAtKey,
113
114
  makeMemoMapUnsafe,
114
115
  makeUnsafe2 as makeUnsafe,
115
116
  map,
116
- map3 as map2,
117
+ map4 as map2,
117
118
  mapBothEager,
118
119
  mapEager,
119
120
  mapEffect,
@@ -124,13 +125,14 @@ import {
124
125
  never,
125
126
  none,
126
127
  offerUnsafe,
128
+ onEnd,
127
129
  onExit,
128
130
  pipe,
129
131
  pipeArguments,
130
132
  provide2 as provide,
131
133
  provideMerge,
132
134
  provideService,
133
- remove3 as remove,
135
+ remove,
134
136
  runCallbackWith,
135
137
  runForEachArray,
136
138
  runForkWith,
@@ -139,7 +141,7 @@ import {
139
141
  runSyncWith,
140
142
  scope,
141
143
  scopedWith,
142
- set4 as set,
144
+ set,
143
145
  set5 as set2,
144
146
  some,
145
147
  squash,
@@ -157,17 +159,17 @@ import {
157
159
  toPull,
158
160
  toPullScoped,
159
161
  transform,
160
- unwrap3 as unwrap,
162
+ unwrap4 as unwrap,
161
163
  void_,
162
164
  void_2,
163
165
  whileLoop,
164
166
  zipRight
165
- } from "./chunk-U2GHFWX2.js";
167
+ } from "./chunk-QYHUNAWH.js";
166
168
  import {
167
169
  __export
168
170
  } from "./chunk-CZ7CSFO4.js";
169
171
 
170
- // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/AsyncResult.js
172
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/reactivity/AsyncResult.js
171
173
  var AsyncResult_exports = {};
172
174
  __export(AsyncResult_exports, {
173
175
  Schema: () => Schema,
@@ -216,7 +218,7 @@ var ResultProto = {
216
218
  return pipeArguments(this, arguments);
217
219
  },
218
220
  [symbol2](that) {
219
- if (this._tag !== that._tag || this.waiting !== that.waiting) {
221
+ if (!isAsyncResult(that) || this._tag !== that._tag || this.waiting !== that.waiting) {
220
222
  return false;
221
223
  }
222
224
  switch (this._tag) {
@@ -416,6 +418,11 @@ var all = (results) => {
416
418
  if (!isAsyncResult(result)) {
417
419
  assignProperty(successes, key, result);
418
420
  continue;
421
+ } else if (isFailure2(result)) {
422
+ return failure(result.cause, {
423
+ previousSuccess: combinedPreviousSuccess(entries, isIter),
424
+ waiting: result.waiting
425
+ });
419
426
  } else if (!isSuccess(result)) {
420
427
  return result;
421
428
  }
@@ -428,6 +435,22 @@ var all = (results) => {
428
435
  waiting: waiting2
429
436
  });
430
437
  };
438
+ var combinedPreviousSuccess = (entries, isIter) => {
439
+ const values = isIter ? [] : {};
440
+ for (let i = 0; i < entries.length; i++) {
441
+ const [key, entry] = entries[i];
442
+ if (!isAsyncResult(entry)) {
443
+ assignProperty(values, key, entry);
444
+ continue;
445
+ }
446
+ const entryValue = value(entry);
447
+ if (isNone(entryValue)) {
448
+ return none();
449
+ }
450
+ assignProperty(values, key, entryValue.value);
451
+ }
452
+ return some(success(values));
453
+ };
431
454
  var builder = (self) => new BuilderImpl(self);
432
455
  var BuilderImpl = class {
433
456
  constructor(result) {
@@ -604,7 +627,7 @@ var Schema = (options) => {
604
627
  });
605
628
  };
606
629
 
607
- // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/AtomRegistry.js
630
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/reactivity/AtomRegistry.js
608
631
  var AtomRegistry_exports = {};
609
632
  __export(AtomRegistry_exports, {
610
633
  AtomRegistry: () => AtomRegistry,
@@ -612,6 +635,7 @@ __export(AtomRegistry_exports, {
612
635
  TypeId: () => TypeId2,
613
636
  batch: () => batch,
614
637
  batchState: () => batchState,
638
+ consumeSkipInitialRun: () => consumeSkipInitialRun,
615
639
  getResult: () => getResult,
616
640
  isAtomRegistry: () => isAtomRegistry,
617
641
  layer: () => layer,
@@ -621,6 +645,22 @@ __export(AtomRegistry_exports, {
621
645
  toStream: () => toStream,
622
646
  toStreamResult: () => toStreamResult
623
647
  });
648
+
649
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/internal/hydration.js
650
+ var shouldHydrate = (current, incoming) => {
651
+ if (!isAsyncResult(current) || !isAsyncResult(incoming)) {
652
+ return true;
653
+ }
654
+ if (isInitial(incoming)) {
655
+ return isInitial(current);
656
+ }
657
+ if (isSuccess(current) && isSuccess(incoming)) {
658
+ return incoming.timestamp >= current.timestamp;
659
+ }
660
+ return true;
661
+ };
662
+
663
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/reactivity/AtomRegistry.js
624
664
  var TypeId2 = "~effect/reactivity/AtomRegistry";
625
665
  var isAtomRegistry = (u) => hasProperty(u, TypeId2);
626
666
  var make2 = (options) => new RegistryImpl(options?.initialValues, options?.scheduleTask, options?.timeoutResolution, options?.defaultIdleTTL);
@@ -702,12 +742,12 @@ var RegistryImpl = class {
702
742
  this.timeoutResolution = timeoutResolution ?? 1e3;
703
743
  }
704
744
  if (initialValues !== void 0) {
705
- for (const [atom, value2] of initialValues) {
745
+ for (const [atom, value2, options] of initialValues) {
706
746
  let target = atom;
707
747
  while (target.initialValueTarget) {
708
748
  target = target.initialValueTarget;
709
749
  }
710
- this.ensureNode(target).setInitialValue(value2);
750
+ this.ensureNode(target).setInitialValue(value2, options?.skipInitialRun);
711
751
  }
712
752
  }
713
753
  }
@@ -749,8 +789,12 @@ var RegistryImpl = class {
749
789
  const node = this.ensureNode(atom);
750
790
  if (options?.immediate) {
751
791
  f(node.value());
752
- } else if (node.state === NodeState.stale) {
753
- node.value();
792
+ } else {
793
+ try {
794
+ node.value();
795
+ } catch (error2) {
796
+ if ((node.state & NodeFlags.waitingForValue) === 0) throw error2;
797
+ }
754
798
  }
755
799
  const remove2 = node.subscribe(function() {
756
800
  f(node._value);
@@ -781,15 +825,21 @@ var RegistryImpl = class {
781
825
  if (typeof key === "string" && this.preloadedSerializable.has(key)) {
782
826
  const encoded = this.preloadedSerializable.get(key);
783
827
  this.preloadedSerializable.delete(key);
784
- const decoded = atom[SerializableTypeId].decode(encoded);
828
+ const serializable2 = atom[SerializableTypeId];
829
+ let decoded;
830
+ try {
831
+ decoded = serializable2.decode(encoded);
832
+ } catch (error2) {
833
+ if (isSchemaError(error2)) return node;
834
+ throw error2;
835
+ }
785
836
  let target = atom;
786
837
  while (target.initialValueTarget) {
787
838
  target = target.initialValueTarget;
788
839
  }
789
- if (target === atom) {
790
- node.setValue(decoded);
791
- } else {
792
- this.ensureNode(target).setInitialValue(decoded);
840
+ const targetNode = target === atom ? node : this.ensureNode(target);
841
+ if (shouldHydrate(targetNode._value, decoded)) {
842
+ targetNode.setInitialValue(decoded, serializable2.skipInitialRun);
793
843
  }
794
844
  }
795
845
  return node;
@@ -804,7 +854,9 @@ var RegistryImpl = class {
804
854
  return new NodeImpl(this, atom);
805
855
  }
806
856
  invalidateAtom = (atom) => {
807
- this.ensureNode(atom).invalidate();
857
+ const node = this.ensureNode(atom);
858
+ node.skipInitialRun = false;
859
+ node.invalidate();
808
860
  };
809
861
  scheduleAtomRemoval(atom) {
810
862
  this.dispatcher.scheduleTask(() => {
@@ -931,6 +983,10 @@ var NodeImpl = class {
931
983
  lifetime;
932
984
  writeContext;
933
985
  preserveInitialValueOnBuild = false;
986
+ skipInitialRun = false;
987
+ // the parents, and their lifetimes, of a build that kept the seed without
988
+ // reaching the effect, such as one waiting for a runtime
989
+ keptParents;
934
990
  invalidatedDuringBuild = false;
935
991
  failed = false;
936
992
  // Every parent that holds this node as a child. A stale node keeps the
@@ -984,9 +1040,13 @@ var NodeImpl = class {
984
1040
  return this._value;
985
1041
  }
986
1042
  build() {
987
- this.disposeLifetime();
988
- this.invalidatedDuringBuild = false;
989
1043
  const lifetime = makeLifetime(this);
1044
+ try {
1045
+ this.disposeLifetime();
1046
+ } catch (error2) {
1047
+ lifetime.failure = error2;
1048
+ }
1049
+ this.invalidatedDuringBuild = false;
990
1050
  this.lifetime = lifetime;
991
1051
  let value2;
992
1052
  let read = false;
@@ -1004,6 +1064,9 @@ var NodeImpl = class {
1004
1064
  if (this.lifetime === lifetime && (this.state & NodeFlags.waitingForValue) !== 0) {
1005
1065
  if (this.preserveInitialValueOnBuild) {
1006
1066
  this.preserveInitialValueOnBuild = false;
1067
+ if (this.skipInitialRun) {
1068
+ this.keptParents = Array.from(this.parents, (parent) => [parent, parent.lifetime]);
1069
+ }
1007
1070
  this.failed = false;
1008
1071
  this.state = NodeState.valid;
1009
1072
  } else {
@@ -1064,9 +1127,10 @@ var NodeImpl = class {
1064
1127
  }
1065
1128
  return some(this._value);
1066
1129
  }
1067
- setInitialValue(value2) {
1130
+ setInitialValue(value2, skipInitialRun = false) {
1068
1131
  if ((this.state & NodeFlags.initialized) === 0) {
1069
1132
  this.preserveInitialValueOnBuild = true;
1133
+ this.skipInitialRun = skipInitialRun;
1070
1134
  this.state = NodeState.stale;
1071
1135
  this._value = value2;
1072
1136
  if (this.listeners.size > 0) {
@@ -1088,7 +1152,7 @@ var NodeImpl = class {
1088
1152
  this._value = value2;
1089
1153
  let failure2 = noFailure;
1090
1154
  try {
1091
- this.invalidateChildren();
1155
+ if (initialized || recovered) this.invalidateChildren();
1092
1156
  } catch (error2) {
1093
1157
  failure2 = error2;
1094
1158
  }
@@ -1206,6 +1270,15 @@ var NodeImpl = class {
1206
1270
  };
1207
1271
  }
1208
1272
  };
1273
+ var consumeSkipInitialRun = (ctx) => {
1274
+ const lifetime = ctx;
1275
+ const node = lifetime.node;
1276
+ if (!node.skipInitialRun) return false;
1277
+ const keptParents = node.keptParents;
1278
+ node.skipInitialRun = false;
1279
+ node.keptParents = void 0;
1280
+ return !lifetime.isFn && !isInitial(node._value) && (keptParents === void 0 || keptParents.every(([parent, lifetime2]) => parent.lifetime === lifetime2));
1281
+ };
1209
1282
  var LifetimeProto = {
1210
1283
  get registry() {
1211
1284
  return this.node.registry;
@@ -1439,7 +1512,7 @@ function batchRebuildNode(node) {
1439
1512
  node.value();
1440
1513
  }
1441
1514
 
1442
- // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Atom.js
1515
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/reactivity/Atom.js
1443
1516
  var Atom_exports = {};
1444
1517
  __export(Atom_exports, {
1445
1518
  Interrupt: () => Interrupt,
@@ -1499,17 +1572,25 @@ __export(Atom_exports, {
1499
1572
  writable: () => writable
1500
1573
  });
1501
1574
 
1502
- // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Reactivity.js
1575
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/reactivity/Reactivity.js
1503
1576
  var TypeId3 = "~effect/reactivity/Reactivity";
1504
1577
  var Reactivity = /* @__PURE__ */ Service("effect/reactivity/Reactivity");
1505
1578
  var make3 = /* @__PURE__ */ sync(() => {
1506
1579
  const handlers = /* @__PURE__ */ new Map();
1580
+ const runHandlers = (hashes) => {
1581
+ const ran = /* @__PURE__ */ new Set();
1582
+ for (const hash2 of hashes) {
1583
+ handlers.get(hash2)?.forEach((run) => {
1584
+ if (ran.has(run)) return;
1585
+ ran.add(run);
1586
+ run();
1587
+ });
1588
+ }
1589
+ };
1507
1590
  const invalidateUnsafe = (keys) => {
1508
- keysToHashes(keys, (hash2) => {
1509
- const set4 = handlers.get(hash2);
1510
- if (set4 === void 0) return;
1511
- set4.forEach((run) => run());
1512
- });
1591
+ const hashes = /* @__PURE__ */ new Set();
1592
+ keysToHashes(keys, (hash2) => hashes.add(hash2));
1593
+ runHandlers(hashes);
1513
1594
  };
1514
1595
  const invalidate2 = (keys) => contextWith((services) => {
1515
1596
  const pending = getOrUndefined2(services, PendingInvalidation);
@@ -1552,9 +1633,15 @@ var make3 = /* @__PURE__ */ sync(() => {
1552
1633
  const runFork = flow(runForkWith(services), runIn(scope2));
1553
1634
  let running = false;
1554
1635
  let pending = false;
1636
+ let stopped = false;
1555
1637
  const handleExit = (exit) => {
1556
1638
  if (exit._tag === "Failure") {
1639
+ stopped = true;
1640
+ pending = false;
1641
+ running = false;
1642
+ cancel();
1557
1643
  failCauseUnsafe(results, exit.cause);
1644
+ return;
1558
1645
  } else {
1559
1646
  offerUnsafe(results, exit.value);
1560
1647
  }
@@ -1566,6 +1653,7 @@ var make3 = /* @__PURE__ */ sync(() => {
1566
1653
  }
1567
1654
  };
1568
1655
  function run() {
1656
+ if (stopped) return;
1569
1657
  if (running) {
1570
1658
  pending = true;
1571
1659
  return;
@@ -1581,13 +1669,7 @@ var make3 = /* @__PURE__ */ sync(() => {
1581
1669
  const stream2 = (tables, effect3) => query(tables, effect3).pipe(map2(fromQueue), unwrap);
1582
1670
  const withBatch = (effect3) => suspend(() => {
1583
1671
  const pending = /* @__PURE__ */ new Set();
1584
- return effect3.pipe(provideService(PendingInvalidation, pending), onExit((_) => sync(() => {
1585
- pending.forEach((hash2) => {
1586
- const set4 = handlers.get(hash2);
1587
- if (set4 === void 0) return;
1588
- set4.forEach((run) => run());
1589
- });
1590
- })));
1672
+ return effect3.pipe(provideService(PendingInvalidation, pending), onExit((_) => sync(() => runHandlers(pending))));
1591
1673
  });
1592
1674
  return Reactivity.of({
1593
1675
  [TypeId3]: TypeId3,
@@ -1632,7 +1714,7 @@ var keysToHashes = (keys, f) => {
1632
1714
  }
1633
1715
  };
1634
1716
 
1635
- // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/persistence/KeyValueStore.js
1717
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/persistence/KeyValueStore.js
1636
1718
  var ErrorTypeId = "~effect/persistence/KeyValueStore/KeyValueStoreError";
1637
1719
  var KeyValueStoreError = class extends (/* @__PURE__ */ TaggedError("KeyValueStoreError")) {
1638
1720
  /**
@@ -1670,12 +1752,13 @@ var toSchemaStore = (self, schema) => {
1670
1752
  remove: self.remove,
1671
1753
  clear: self.clear,
1672
1754
  size: self.size,
1755
+ keys: self.keys,
1673
1756
  has: self.has,
1674
1757
  isEmpty: self.isEmpty
1675
1758
  };
1676
1759
  };
1677
1760
 
1678
- // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Atom.js
1761
+ // ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/reactivity/Atom.js
1679
1762
  var TypeId4 = "~effect/reactivity/Atom";
1680
1763
  var isAtom = (u) => hasProperty(u, TypeId4);
1681
1764
  var WritableTypeId = "~effect/reactivity/Atom/Writable";
@@ -1698,7 +1781,7 @@ var AtomProto = {
1698
1781
  _id: "Atom",
1699
1782
  keepAlive: this.keepAlive,
1700
1783
  lazy: this.lazy,
1701
- label: this.label
1784
+ label: this.label && [this.label[0], this.label[1]]
1702
1785
  };
1703
1786
  }
1704
1787
  };
@@ -1751,7 +1834,7 @@ var RuntimeProto = {
1751
1834
  var makeFnRuntime = (self, arg, options) => {
1752
1835
  const [read, write, argAtom] = makeResultFn(options?.reactivityKeys ? (a, get5) => {
1753
1836
  const effect3 = arg(a, get5);
1754
- return isEffect(effect3) ? mutation(effect3, options.reactivityKeys) : ensuring(effect3, invalidate(options.reactivityKeys));
1837
+ return isEffect(effect3) ? mutation(effect3, options.reactivityKeys) : onEnd(effect3, invalidate(options.reactivityKeys));
1755
1838
  } : arg, options);
1756
1839
  return writable((get5) => {
1757
1840
  get5.get(argAtom);
@@ -1837,16 +1920,21 @@ var effect2 = (get5, effect3, options, services) => {
1837
1920
  };
1838
1921
  function makeEffect(ctx, effect3, initialValue2, services = empty(), uninterruptible = false) {
1839
1922
  const previous = ctx.self();
1923
+ if (previous._tag === "Some" && consumeSkipInitialRun(ctx)) {
1924
+ return previous.value;
1925
+ }
1926
+ const getServices = typeof services === "function" ? services : constant(services);
1840
1927
  const scope2 = makeUnsafe();
1841
1928
  ctx.addFinalizer(() => {
1842
- runForkWith(services)(close(scope2, void_));
1929
+ runForkWith(getServices())(closeScope(scope2));
1843
1930
  });
1844
1931
  let syncResult;
1845
1932
  let isAsync = false;
1846
- const cancel = runCallbackSync(services.pipe(add(Scope, scope2), add(AtomRegistry, ctx.registry), add(Scheduler, ctx.registry.scheduler)), effect3, function(exit) {
1847
- syncResult = fromExitWithPrevious(exit, previous);
1933
+ const cancel = runCallbackSync(getServices().pipe(add(Scope, scope2), add(AtomRegistry, ctx.registry), add(Scheduler, ctx.registry.scheduler)), effect3, function(exit) {
1848
1934
  if (isAsync) {
1849
- ctx.setSelf(syncResult);
1935
+ ctx.setSelf(fromExitWithPrevious(exit, ctx.self()));
1936
+ } else {
1937
+ syncResult = fromExitWithPrevious(exit, previous);
1850
1938
  }
1851
1939
  }, uninterruptible);
1852
1940
  isAsync = true;
@@ -1860,6 +1948,10 @@ function makeEffect(ctx, effect3, initialValue2, services = empty(), uninterrupt
1860
1948
  }
1861
1949
  return waiting(initialValue2);
1862
1950
  }
1951
+ var closeScope = (scope2) => catchCause(close(scope2, void_), (cause2) => hasInterruptsOnly(cause2) ? void_2 : ignoreCause(failCause2(cause2), {
1952
+ log: "Unhandled",
1953
+ message: "Unhandled error in atom finalizer"
1954
+ }));
1863
1955
  function runCallbackSync(services, effect3, onExit2, uninterruptible = false) {
1864
1956
  if (isExit(effect3)) {
1865
1957
  onExit2(effect3);
@@ -1892,14 +1984,16 @@ function context2(options) {
1892
1984
  self.lazy = true;
1893
1985
  self.refresh = void 0;
1894
1986
  self.factory = factory;
1895
- const layerAtom = keepAlive(typeof create === "function" ? readable((get5) => provideMerge(create(get5), globalLayer)) : readable(() => provideMerge(create, globalLayer)));
1987
+ const layerAtom = keepAlive(typeof create === "function" ? readable(create) : readable(() => create));
1896
1988
  self.layer = layerAtom;
1897
1989
  self.read = function read(get5) {
1898
- const layer3 = get5(layerAtom);
1899
- const build = flatMap2(scope, (scope2) => buildWithMemoMap(layer3, resolveMemoMap(get5), scope2));
1900
- return effect2(get5, build, {
1901
- uninterruptible: true
1902
- });
1990
+ const layer3 = provideMerge(get5(layerAtom), globalLayer);
1991
+ let services = empty();
1992
+ const build = flatMap2(scope, (scope2) => map2(buildWithMemoMap(layer3, resolveMemoMap(get5), scope2), (context3) => {
1993
+ services = context3;
1994
+ return context3;
1995
+ }));
1996
+ return makeEffect(get5, build, initial(), () => services, true);
1903
1997
  };
1904
1998
  return self;
1905
1999
  }
@@ -1928,6 +2022,9 @@ var stream = (get5, stream2, options, services) => {
1928
2022
  };
1929
2023
  function makeStream(ctx, stream2, initialValue2, services = empty()) {
1930
2024
  const previous = ctx.self();
2025
+ if (previous._tag === "Some" && consumeSkipInitialRun(ctx)) {
2026
+ return previous.value;
2027
+ }
1931
2028
  services = add(services, AtomRegistry, ctx.registry);
1932
2029
  const run = scopedWith((scope2) => flatMap2(toPullScoped(stream2.channel, scope2), (pull2) => whileLoop({
1933
2030
  while: constTrue,
@@ -2207,9 +2304,28 @@ var withEquality = /* @__PURE__ */ dual(2, (self, equals2) => Object.assign(Obje
2207
2304
  }));
2208
2305
  var withLabel = /* @__PURE__ */ dual(2, (self, name) => Object.assign(Object.create(Object.getPrototypeOf(self)), {
2209
2306
  ...self,
2210
- label: [name, getStackTraceLimit() === 0 ? "" : new Error().stack?.split("\n")[5] ?? ""]
2307
+ label: makeLabel(name, getStackTraceLimit() === 0 ? void 0 : new Error())
2211
2308
  }));
2212
- var initialValue = /* @__PURE__ */ dual(2, (self, initialValue2) => [self, initialValue2]);
2309
+ function makeLabel(name, error2) {
2310
+ const label = [name, ""];
2311
+ if (error2 === void 0) {
2312
+ return label;
2313
+ }
2314
+ let location = "";
2315
+ Object.defineProperty(label, 1, {
2316
+ configurable: true,
2317
+ enumerable: true,
2318
+ get: () => {
2319
+ if (error2 !== void 0) {
2320
+ location = error2.stack?.split("\n")[5] ?? "";
2321
+ error2 = void 0;
2322
+ }
2323
+ return location;
2324
+ }
2325
+ });
2326
+ return label;
2327
+ }
2328
+ var initialValue = /* @__PURE__ */ dual((args) => args.length >= 2, (self, initialValue2, options) => options === void 0 ? [self, initialValue2] : [self, initialValue2, options]);
2213
2329
  var transform2 = /* @__PURE__ */ dual((args) => isAtom(args[0]), (self, f, options) => {
2214
2330
  const atom = removeTtl(isWritable(self) ? writable((get5) => f(get5, self), function(ctx, value2) {
2215
2331
  ctx.set(self, value2);
@@ -2432,6 +2548,9 @@ var optimisticFn = /* @__PURE__ */ dual(2, (self, options) => {
2432
2548
  });
2433
2549
  var batch2 = batch;
2434
2550
  var windowFocusSignal = /* @__PURE__ */ readable((get5) => {
2551
+ if (typeof window === "undefined") {
2552
+ return 0;
2553
+ }
2435
2554
  let count = 0;
2436
2555
  function update2() {
2437
2556
  if (document.visibilityState === "visible") {
@@ -2546,7 +2665,8 @@ function updateSearchParams() {
2546
2665
  }
2547
2666
  }
2548
2667
  searchParamState.updates.clear();
2549
- const newUrl = `${window.location.pathname}?${searchParams.toString()}`;
2668
+ const search = searchParams.toString();
2669
+ const newUrl = `${window.location.pathname}${search.length > 0 ? `?${search}` : ""}${window.location.hash}`;
2550
2670
  window.history.pushState({}, "", newUrl);
2551
2671
  searchParamState.updating = false;
2552
2672
  }
@@ -2565,11 +2685,12 @@ var serializable = /* @__PURE__ */ dual(2, (self, options) => {
2565
2685
  const codecJson = toCodecJson(options.schema);
2566
2686
  return Object.assign(Object.create(Object.getPrototypeOf(self)), {
2567
2687
  ...self,
2568
- label: self.label ?? [options.key, getStackTraceLimit() === 0 ? "" : new Error().stack?.split("\n")[5] ?? ""],
2688
+ label: self.label ?? makeLabel(options.key, getStackTraceLimit() === 0 ? void 0 : new Error()),
2569
2689
  [SerializableTypeId2]: {
2570
2690
  key: options.key,
2571
2691
  encode: encodeSync(codecJson),
2572
- decode: decodeSync(codecJson)
2692
+ decode: decodeSync(codecJson),
2693
+ skipInitialRun: options.skipInitialRun
2573
2694
  }
2574
2695
  });
2575
2696
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Schema_exports
3
- } from "./chunk-U2GHFWX2.js";
3
+ } from "./chunk-QYHUNAWH.js";
4
4
 
5
5
  // src/contracts/ui-auth.ts
6
6
  var AppSignInId = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{64}$/u)).pipe(