apps 0.0.1-beta.36 → 0.0.1-beta.38

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 (85) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-KOOJUMLR.js → chunk-3MMG2H6M.js} +2 -2
  3. package/js/{chunk-XEXUHXC3.js → chunk-3V575NIW.js} +226 -18
  4. package/js/{chunk-KZFV3WCJ.js → chunk-5P2WQRRM.js} +385 -56
  5. package/js/{chunk-4U2VUDET.js → chunk-5TJA7364.js} +2 -2
  6. package/js/{chunk-BKJDZYK7.js → chunk-7CSHVXVR.js} +3 -3
  7. package/js/{chunk-ZQWDOHEO.js → chunk-BO4US6DZ.js} +9 -49
  8. package/js/{chunk-A4O72Z3A.js → chunk-DKUEYTYD.js} +167 -30
  9. package/js/{chunk-UBAKWXAJ.js → chunk-DWMEIU2L.js} +411 -94
  10. package/js/{chunk-ENJCQWVF.js → chunk-E4BWL7KQ.js} +3 -3
  11. package/js/{chunk-CZLCA2O4.js → chunk-F3TBO2U3.js} +7 -94
  12. package/js/{chunk-POOIHRPF.js → chunk-GHXRRFZA.js} +11 -34
  13. package/js/{chunk-RSNZDT4L.js → chunk-JTMDWPCH.js} +2 -2
  14. package/js/{chunk-YW333DH3.js → chunk-KANDIVIH.js} +4 -4
  15. package/js/chunk-KAQD3DTI.js +16 -0
  16. package/js/{chunk-556EWA6P.js → chunk-MLHNVYHT.js} +17 -4
  17. package/js/{chunk-IJQ5LE74.js → chunk-MXDKXAY4.js} +363 -401
  18. package/js/{chunk-A2NN45C7.js → chunk-NROBHRTG.js} +7 -7
  19. package/js/{chunk-BI6R577B.js → chunk-P7MGDPFD.js} +2 -2
  20. package/js/{chunk-SRB2WDU7.js → chunk-Q4QZDB2F.js} +3 -3
  21. package/js/{chunk-JU7F4PRK.js → chunk-RIXVGVA6.js} +2 -2
  22. package/js/{chunk-WAGGHNWH.js → chunk-RJCWJNCH.js} +9 -9
  23. package/js/{chunk-WMVTBHGK.js → chunk-U5PFZDVB.js} +2 -2
  24. package/js/{chunk-PHO7HXTC.js → chunk-VIU2XXA7.js} +294 -47
  25. package/js/{chunk-TADLIUEU.js → chunk-VJQXXOQ3.js} +2 -2
  26. package/js/{chunk-NHCFIWN5.js → chunk-W2NV54JD.js} +1 -1
  27. package/js/{chunk-BI45HZWM.js → chunk-YQ35E7KS.js} +1 -1
  28. package/js/{chunk-WDBUOIWV.js → chunk-ZUKBIHMK.js} +3 -3
  29. package/js/client.js +13 -16
  30. package/js/contracts.js +16 -20
  31. package/js/effect.js +19 -23
  32. package/js/graphql.js +21 -25
  33. package/js/host.js +19 -23
  34. package/js/index.js +13 -25
  35. package/js/mcp/effect.js +21 -25
  36. package/js/mcp/stdio.js +21 -25
  37. package/js/mcp.js +23 -27
  38. package/js/openapi.js +17 -20
  39. package/js/react.js +2 -3
  40. package/js/skills/effect.js +6 -6
  41. package/js/skills.js +15 -16
  42. package/js/storage/facet.js +1 -214
  43. package/js/ui/auth/contracts.js +2 -2
  44. package/js/ui/auth.js +5 -5
  45. package/js/ui/contracts.js +5 -6
  46. package/js/ui/serving.js +10 -10
  47. package/package.json +1 -2
  48. package/runtime.json +1 -1
  49. package/types/apps/src/contracts/app.d.ts +0 -2
  50. package/types/apps/src/contracts/context.d.ts +12 -11
  51. package/types/apps/src/contracts/host.d.ts +10 -8
  52. package/types/apps/src/contracts/live.d.ts +2 -0
  53. package/types/apps/src/contracts/operations.d.ts +3 -3
  54. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  55. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  56. package/types/apps/src/contracts/protocols/4.d.ts +3 -3
  57. package/types/apps/src/contracts/protocols/5.d.ts +1 -1
  58. package/types/apps/src/contracts/protocols/6.d.ts +1 -1
  59. package/types/apps/src/contracts/protocols/7.d.ts +1 -1
  60. package/types/apps/src/contracts/sql.d.ts +58 -0
  61. package/types/apps/src/contracts/workflows.d.ts +6 -0
  62. package/types/apps/src/facet.d.ts +4 -5
  63. package/types/apps/src/implementation/openapi-compile.d.ts +2 -2
  64. package/types/apps/src/implementation/schema.d.ts +1 -10
  65. package/types/apps/src/implementation/sql.d.ts +66 -0
  66. package/types/apps/src/index.d.ts +1 -2
  67. package/types/telemetry/src/app-records.d.ts +42 -0
  68. package/types/telemetry/src/recorded-failure.d.ts +20 -0
  69. package/types/utils/src/api-error.d.ts +5 -0
  70. package/types/utils/src/recorded-message.d.ts +15 -0
  71. package/js/chunk-73AV3JVU.js +0 -186
  72. package/js/chunk-HDAQBRT5.js +0 -1254
  73. package/js/chunk-IU7CCCUC.js +0 -630
  74. package/js/chunk-NHUHTWAF.js +0 -0
  75. package/js/chunk-V5DWGYRK.js +0 -268
  76. package/js/chunk-Y3XN4X4Q.js +0 -19
  77. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  78. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  79. package/types/app-data/src/implementation/promise.d.ts +0 -68
  80. package/types/app-data/src/implementation/range.d.ts +0 -8
  81. package/types/app-data/src/implementation/schema.d.ts +0 -18
  82. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  83. package/types/app-data/src/index.d.ts +0 -4
  84. package/types/apps/src/contracts/storage.d.ts +0 -68
  85. package/types/apps/src/implementation/storage.d.ts +0 -15
@@ -5,11 +5,11 @@ import {
5
5
  SkillDefinitionInvalid,
6
6
  SkillFile,
7
7
  SkillFilePath
8
- } from "./chunk-556EWA6P.js";
8
+ } from "./chunk-MLHNVYHT.js";
9
9
  import {
10
10
  Effect_exports,
11
11
  Schema_exports
12
- } from "./chunk-IJQ5LE74.js";
12
+ } from "./chunk-MXDKXAY4.js";
13
13
 
14
14
  // src/implementation/skill-files.ts
15
15
  var skillFromFiles = (input, source = {}) => Effect_exports.gen(function* () {
@@ -3,15 +3,15 @@ import {
3
3
  RouterKey,
4
4
  RouterMeta,
5
5
  reservedRouterKeys
6
- } from "./chunk-XEXUHXC3.js";
6
+ } from "./chunk-3V575NIW.js";
7
7
  import {
8
8
  decoderOf,
9
9
  schemaArgument
10
- } from "./chunk-POOIHRPF.js";
10
+ } from "./chunk-GHXRRFZA.js";
11
11
  import {
12
12
  Effect_exports,
13
13
  Schema_exports
14
- } from "./chunk-IJQ5LE74.js";
14
+ } from "./chunk-MXDKXAY4.js";
15
15
 
16
16
  // src/implementation/authoring.ts
17
17
  var NativeCallback = /* @__PURE__ */ Symbol("apps.NativeCallback");
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  skillFromFiles
3
- } from "./chunk-4U2VUDET.js";
3
+ } from "./chunk-5TJA7364.js";
4
4
  import {
5
5
  joinPath,
6
6
  mergeMeta
7
- } from "./chunk-BKJDZYK7.js";
7
+ } from "./chunk-7CSHVXVR.js";
8
8
  import {
9
9
  isShortenedUpstream,
10
10
  parseProviderError,
11
11
  providerError
12
- } from "./chunk-ENJCQWVF.js";
12
+ } from "./chunk-E4BWL7KQ.js";
13
13
  import {
14
14
  ApiErrorResponse,
15
15
  HostDeclarationInvalid,
@@ -21,10 +21,7 @@ import {
21
21
  McpError,
22
22
  McpError2,
23
23
  SkillLoadFailed as SkillLoadFailed2
24
- } from "./chunk-XEXUHXC3.js";
25
- import {
26
- AppDatabaseError
27
- } from "./chunk-73AV3JVU.js";
24
+ } from "./chunk-3V575NIW.js";
28
25
  import {
29
26
  CacheError,
30
27
  FailureCode,
@@ -35,23 +32,19 @@ import {
35
32
  maxFailureFields,
36
33
  maxFailureMessageLength,
37
34
  maxUpstreamMessageLength
38
- } from "./chunk-BI6R577B.js";
35
+ } from "./chunk-P7MGDPFD.js";
39
36
  import {
40
37
  SkillLoadFailed,
41
38
  skillFormatLimits
42
- } from "./chunk-556EWA6P.js";
39
+ } from "./chunk-MLHNVYHT.js";
43
40
  import {
44
41
  jsonSchemaDocument
45
- } from "./chunk-POOIHRPF.js";
46
- import {
47
- AppStorageError,
48
- AppStorageUnavailable
49
- } from "./chunk-Y3XN4X4Q.js";
42
+ } from "./chunk-GHXRRFZA.js";
50
43
  import {
51
44
  AccountId,
52
45
  HttpUrl,
53
46
  JsonObject
54
- } from "./chunk-BI45HZWM.js";
47
+ } from "./chunk-YQ35E7KS.js";
55
48
  import {
56
49
  Cause_exports,
57
50
  Effect_exports,
@@ -61,7 +54,7 @@ import {
61
54
  Redacted_exports,
62
55
  Result_exports,
63
56
  Schema_exports
64
- } from "./chunk-IJQ5LE74.js";
57
+ } from "./chunk-MXDKXAY4.js";
65
58
 
66
59
  // src/contracts/openapi.ts
67
60
  var OpenapiErrorResponse = Schema_exports.Struct({
@@ -270,20 +263,6 @@ var OpenapiCompileError = class extends Schema_exports.TaggedError()(
270
263
  };
271
264
 
272
265
  // src/implementation/failure-detail.ts
273
- var storageMessages = {
274
- schema: "The app's database schema is invalid.",
275
- schema_changed: "The app's database schema changed during this operation. Retry it.",
276
- table: "The operation used a table the app's database schema does not declare.",
277
- index: "The operation used an index the table does not declare, or used it incorrectly.",
278
- range: "The index range is invalid for the declared index.",
279
- value: "A value does not match the table's declared field schema.",
280
- readonly: "Queries cannot write. Move writes into a mutation.",
281
- cursor: "The pagination cursor is invalid or belongs to a different query.",
282
- limit: "The operation exceeded a per-invocation app data limit.",
283
- closed: "The database session closed before this operation finished.",
284
- storage: "App storage failed to complete the operation.",
285
- replay: "A workflow step replayed with different input than its first run."
286
- };
287
266
  var cacheMessages = {
288
267
  capacity: "A cache key, value or batch exceeded the app cache's size limits.",
289
268
  invalid: "The app made a cache request the app cache could not accept.",
@@ -429,25 +408,6 @@ var failureDetail = (error, secrets) => {
429
408
  code: error.reason,
430
409
  message: cacheMessages[error.reason]
431
410
  };
432
- if (Schema_exports.is(AppDatabaseError)(error))
433
- return {
434
- source: "storage",
435
- errorName: "AppDatabaseError",
436
- code: error.reason,
437
- message: boundFailureMessage(ownMessage(error) ?? storageMessages[error.reason], secrets)
438
- };
439
- if (Schema_exports.is(AppStorageUnavailable)(error))
440
- return {
441
- source: "storage",
442
- errorName: "AppStorageUnavailable",
443
- message: "App storage is not available on this host."
444
- };
445
- if (Schema_exports.is(AppStorageError)(error))
446
- return {
447
- source: "storage",
448
- errorName: "AppStorageError",
449
- message: "App storage failed to complete the operation."
450
- };
451
411
  if (Schema_exports.is(OpenapiError)(error))
452
412
  return {
453
413
  source: "service",
@@ -1,9 +1,3 @@
1
- import {
2
- Reactivity,
3
- invalidate,
4
- layer,
5
- mutation
6
- } from "./chunk-HDAQBRT5.js";
7
1
  import {
8
2
  Boolean,
9
3
  Cause,
@@ -43,6 +37,7 @@ import {
43
37
  constTrue,
44
38
  constVoid,
45
39
  constant,
40
+ context,
46
41
  contextWith,
47
42
  declareConstructor,
48
43
  decodeEffect,
@@ -65,6 +60,7 @@ import {
65
60
  fail4 as fail3,
66
61
  failCause,
67
62
  failCause2,
63
+ failCauseUnsafe,
68
64
  filter,
69
65
  filter2,
70
66
  filterInterruptors,
@@ -75,9 +71,11 @@ import {
75
71
  flatMap2,
76
72
  flatMapEager,
77
73
  flatMapNullishOr,
74
+ flow,
78
75
  forkDetach,
79
76
  fromInputUnsafe,
80
77
  fromJsonString,
78
+ fromQueue,
81
79
  gen,
82
80
  get,
83
81
  get3 as get2,
@@ -87,6 +85,7 @@ import {
87
85
  getOrNull,
88
86
  getOrThrowWith,
89
87
  getOrUndefined,
88
+ getOrUndefined2,
90
89
  getStackTraceLimit,
91
90
  getSuccess,
92
91
  getUnsafe,
@@ -109,6 +108,7 @@ import {
109
108
  joinAll,
110
109
  lastNonEmpty,
111
110
  link,
111
+ make3 as make,
112
112
  makeCompositeAtKey,
113
113
  makeMemoMapUnsafe,
114
114
  makeUnsafe2 as makeUnsafe,
@@ -124,14 +124,17 @@ import {
124
124
  never,
125
125
  none,
126
126
  offerUnsafe,
127
+ onExit,
127
128
  pipe,
128
129
  pipeArguments,
129
130
  provide2 as provide,
130
131
  provideMerge,
132
+ provideService,
131
133
  remove3 as remove,
132
134
  runCallbackWith,
133
135
  runForEachArray,
134
136
  runForkWith,
137
+ runIn,
135
138
  runSync,
136
139
  runSyncWith,
137
140
  scope,
@@ -148,6 +151,7 @@ import {
148
151
  symbol,
149
152
  symbol2,
150
153
  sync2 as sync,
154
+ tap,
151
155
  toCodecJson,
152
156
  toMillis,
153
157
  toPull,
@@ -158,7 +162,7 @@ import {
158
162
  void_2,
159
163
  whileLoop,
160
164
  zipRight
161
- } from "./chunk-IJQ5LE74.js";
165
+ } from "./chunk-MXDKXAY4.js";
162
166
  import {
163
167
  __export
164
168
  } from "./chunk-CZ7CSFO4.js";
@@ -610,27 +614,27 @@ __export(AtomRegistry_exports, {
610
614
  batchState: () => batchState,
611
615
  getResult: () => getResult,
612
616
  isAtomRegistry: () => isAtomRegistry,
613
- layer: () => layer2,
617
+ layer: () => layer,
614
618
  layerOptions: () => layerOptions,
615
- make: () => make,
619
+ make: () => make2,
616
620
  mount: () => mount,
617
621
  toStream: () => toStream,
618
622
  toStreamResult: () => toStreamResult
619
623
  });
620
624
  var TypeId2 = "~effect/reactivity/AtomRegistry";
621
625
  var isAtomRegistry = (u) => hasProperty(u, TypeId2);
622
- var make = (options) => new RegistryImpl(options?.initialValues, options?.scheduleTask, options?.timeoutResolution, options?.defaultIdleTTL);
626
+ var make2 = (options) => new RegistryImpl(options?.initialValues, options?.scheduleTask, options?.timeoutResolution, options?.defaultIdleTTL);
623
627
  var AtomRegistry = /* @__PURE__ */ Service(TypeId2);
624
628
  var layerOptions = (options) => effect(AtomRegistry, gen(function* () {
625
629
  const scope2 = yield* scope;
626
- const registry = make({
630
+ const registry = make2({
627
631
  ...options,
628
632
  scheduleTask: options?.scheduleTask
629
633
  });
630
634
  yield* addFinalizer(scope2, sync(() => registry.dispose()));
631
635
  return registry;
632
636
  }));
633
- var layer2 = /* @__PURE__ */ layerOptions();
637
+ var layer = /* @__PURE__ */ layerOptions();
634
638
  var toStream = /* @__PURE__ */ dual(2, (self, atom) => callback2((queue) => suspend(() => {
635
639
  const fiber = getCurrent();
636
640
  const scope2 = getUnsafe(fiber.context, Scope);
@@ -1442,11 +1446,11 @@ __export(Atom_exports, {
1442
1446
  Reset: () => Reset,
1443
1447
  SerializableTypeId: () => SerializableTypeId2,
1444
1448
  ServerValueTypeId: () => ServerValueTypeId,
1445
- TypeId: () => TypeId3,
1449
+ TypeId: () => TypeId4,
1446
1450
  WritableTypeId: () => WritableTypeId,
1447
1451
  autoDispose: () => autoDispose,
1448
1452
  batch: () => batch2,
1449
- context: () => context,
1453
+ context: () => context2,
1450
1454
  debounce: () => debounce,
1451
1455
  family: () => family,
1452
1456
  fn: () => fn,
@@ -1460,7 +1464,7 @@ __export(Atom_exports, {
1460
1464
  isWritable: () => isWritable,
1461
1465
  keepAlive: () => keepAlive,
1462
1466
  kvs: () => kvs,
1463
- make: () => make2,
1467
+ make: () => make4,
1464
1468
  makeRefreshOnSignal: () => makeRefreshOnSignal,
1465
1469
  map: () => map5,
1466
1470
  mapResult: () => mapResult,
@@ -1495,6 +1499,139 @@ __export(Atom_exports, {
1495
1499
  writable: () => writable
1496
1500
  });
1497
1501
 
1502
+ // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Reactivity.js
1503
+ var TypeId3 = "~effect/reactivity/Reactivity";
1504
+ var Reactivity = /* @__PURE__ */ Service("effect/reactivity/Reactivity");
1505
+ var make3 = /* @__PURE__ */ sync(() => {
1506
+ const handlers = /* @__PURE__ */ new Map();
1507
+ 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
+ });
1513
+ };
1514
+ const invalidate2 = (keys) => contextWith((services) => {
1515
+ const pending = getOrUndefined2(services, PendingInvalidation);
1516
+ if (pending) {
1517
+ keysToHashes(keys, (hash2) => {
1518
+ pending.add(hash2);
1519
+ });
1520
+ } else {
1521
+ invalidateUnsafe(keys);
1522
+ }
1523
+ return void_2;
1524
+ });
1525
+ const mutation2 = (keys, effect3) => tap(effect3, invalidate2(keys));
1526
+ const registerUnsafe = (keys, handler) => {
1527
+ const resolvedKeys = [];
1528
+ keysToHashes(keys, (hash2) => {
1529
+ resolvedKeys.push(hash2);
1530
+ let set4 = handlers.get(hash2);
1531
+ if (set4 === void 0) {
1532
+ set4 = /* @__PURE__ */ new Set();
1533
+ handlers.set(hash2, set4);
1534
+ }
1535
+ set4.add(handler);
1536
+ });
1537
+ return () => {
1538
+ for (let i = 0; i < resolvedKeys.length; i++) {
1539
+ const set4 = handlers.get(resolvedKeys[i]);
1540
+ if (set4 === void 0) continue;
1541
+ set4.delete(handler);
1542
+ if (set4.size === 0) {
1543
+ handlers.delete(resolvedKeys[i]);
1544
+ }
1545
+ }
1546
+ };
1547
+ };
1548
+ const query = (keys, effect3) => gen(function* () {
1549
+ const services = yield* context();
1550
+ const scope2 = get(services, Scope);
1551
+ const results = yield* make();
1552
+ const runFork = flow(runForkWith(services), runIn(scope2));
1553
+ let running = false;
1554
+ let pending = false;
1555
+ const handleExit = (exit) => {
1556
+ if (exit._tag === "Failure") {
1557
+ failCauseUnsafe(results, exit.cause);
1558
+ } else {
1559
+ offerUnsafe(results, exit.value);
1560
+ }
1561
+ if (pending) {
1562
+ pending = false;
1563
+ runFork(effect3).addObserver(handleExit);
1564
+ } else {
1565
+ running = false;
1566
+ }
1567
+ };
1568
+ function run() {
1569
+ if (running) {
1570
+ pending = true;
1571
+ return;
1572
+ }
1573
+ running = true;
1574
+ runFork(effect3).addObserver(handleExit);
1575
+ }
1576
+ const cancel = registerUnsafe(keys, run);
1577
+ yield* addFinalizer(scope2, sync(cancel));
1578
+ run();
1579
+ return results;
1580
+ });
1581
+ const stream2 = (tables, effect3) => query(tables, effect3).pipe(map2(fromQueue), unwrap);
1582
+ const withBatch = (effect3) => suspend(() => {
1583
+ 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
+ })));
1591
+ });
1592
+ return Reactivity.of({
1593
+ [TypeId3]: TypeId3,
1594
+ mutation: mutation2,
1595
+ query,
1596
+ stream: stream2,
1597
+ invalidateUnsafe,
1598
+ invalidate: invalidate2,
1599
+ registerUnsafe,
1600
+ withBatch
1601
+ });
1602
+ });
1603
+ var PendingInvalidation = class extends (/* @__PURE__ */ Service()("effect/reactivity/Reactivity/PendingInvalidation")) {
1604
+ };
1605
+ var mutation = /* @__PURE__ */ dual(2, (effect3, keys) => Reactivity.use((_) => _.mutation(keys, effect3)));
1606
+ var invalidate = (keys) => Reactivity.use((r) => r.invalidate(keys));
1607
+ var layer2 = /* @__PURE__ */ effect(Reactivity)(make3);
1608
+ function stringOrHash(u) {
1609
+ switch (typeof u) {
1610
+ case "string":
1611
+ case "number":
1612
+ case "bigint":
1613
+ case "boolean":
1614
+ return String(u);
1615
+ default:
1616
+ return hash(u);
1617
+ }
1618
+ }
1619
+ var keysToHashes = (keys, f) => {
1620
+ if (Array.isArray(keys)) {
1621
+ for (let i = 0; i < keys.length; i++) {
1622
+ f(stringOrHash(keys[i]));
1623
+ }
1624
+ return;
1625
+ }
1626
+ for (const key in keys) {
1627
+ f(key);
1628
+ const ids = keys[key];
1629
+ for (let i = 0; i < ids.length; i++) {
1630
+ f(`${key}:${stringOrHash(ids[i])}`);
1631
+ }
1632
+ }
1633
+ };
1634
+
1498
1635
  // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/persistence/KeyValueStore.js
1499
1636
  var ErrorTypeId = "~effect/persistence/KeyValueStore/KeyValueStoreError";
1500
1637
  var KeyValueStoreError = class extends (/* @__PURE__ */ TaggedError("KeyValueStoreError")) {
@@ -1539,8 +1676,8 @@ var toSchemaStore = (self, schema) => {
1539
1676
  };
1540
1677
 
1541
1678
  // ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Atom.js
1542
- var TypeId3 = "~effect/reactivity/Atom";
1543
- var isAtom = (u) => hasProperty(u, TypeId3);
1679
+ var TypeId4 = "~effect/reactivity/Atom";
1680
+ var isAtom = (u) => hasProperty(u, TypeId4);
1544
1681
  var WritableTypeId = "~effect/reactivity/Atom/Writable";
1545
1682
  var setIdleTTL = /* @__PURE__ */ dual(2, (self, durationInput) => {
1546
1683
  const duration = fromInputUnsafe(durationInput);
@@ -1553,7 +1690,7 @@ var setIdleTTL = /* @__PURE__ */ dual(2, (self, durationInput) => {
1553
1690
  });
1554
1691
  var removeTtl = /* @__PURE__ */ setIdleTTL(0);
1555
1692
  var AtomProto = {
1556
- [TypeId3]: TypeId3,
1693
+ [TypeId4]: TypeId4,
1557
1694
  equals: Object.is,
1558
1695
  ...PipeInspectableProto,
1559
1696
  toJSON() {
@@ -1651,9 +1788,9 @@ var writable = (read, write, refresh2) => {
1651
1788
  function constSetSelf(ctx, value2) {
1652
1789
  ctx.setSelf(value2);
1653
1790
  }
1654
- var make2 = (arg, options) => {
1791
+ var make4 = (arg, options) => {
1655
1792
  const readOrAtom = makeRead(arg, options);
1656
- if (TypeId3 in readOrAtom) {
1793
+ if (TypeId4 in readOrAtom) {
1657
1794
  return readOrAtom;
1658
1795
  }
1659
1796
  return readable(readOrAtom);
@@ -1723,9 +1860,9 @@ function makeEffect(ctx, effect3, initialValue2, services = empty(), uninterrupt
1723
1860
  }
1724
1861
  return waiting(initialValue2);
1725
1862
  }
1726
- function runCallbackSync(services, effect3, onExit, uninterruptible = false) {
1863
+ function runCallbackSync(services, effect3, onExit2, uninterruptible = false) {
1727
1864
  if (isExit(effect3)) {
1728
- onExit(effect3);
1865
+ onExit2(effect3);
1729
1866
  return void 0;
1730
1867
  }
1731
1868
  const runFork = runForkWith(services);
@@ -1733,10 +1870,10 @@ function runCallbackSync(services, effect3, onExit, uninterruptible = false) {
1733
1870
  fiber.currentDispatcher?.flush();
1734
1871
  const result = fiber.pollUnsafe();
1735
1872
  if (result) {
1736
- onExit(result);
1873
+ onExit2(result);
1737
1874
  return void 0;
1738
1875
  }
1739
- const remove2 = fiber.addObserver(onExit);
1876
+ const remove2 = fiber.addObserver(onExit2);
1740
1877
  function cancel() {
1741
1878
  remove2();
1742
1879
  if (!uninterruptible) {
@@ -1745,10 +1882,10 @@ function runCallbackSync(services, effect3, onExit, uninterruptible = false) {
1745
1882
  }
1746
1883
  return cancel;
1747
1884
  }
1748
- function context(options) {
1749
- const memoMap = options?.memoMap ?? removeTtl(make2(() => makeMemoMapUnsafe()));
1885
+ function context2(options) {
1886
+ const memoMap = options?.memoMap ?? removeTtl(make4(() => makeMemoMapUnsafe()));
1750
1887
  const resolveMemoMap = (get5) => isAtom(memoMap) ? get5(memoMap) : memoMap;
1751
- let globalLayer = layer;
1888
+ let globalLayer = layer2;
1752
1889
  function factory(create) {
1753
1890
  const self = Object.create(RuntimeProto);
1754
1891
  self.keepAlive = false;
@@ -1768,9 +1905,9 @@ function context(options) {
1768
1905
  }
1769
1906
  factory.memoMap = memoMap;
1770
1907
  factory.addGlobalLayer = (layer3) => {
1771
- globalLayer = provideMerge(globalLayer, provide(layer3, layer));
1908
+ globalLayer = provideMerge(globalLayer, provide(layer3, layer2));
1772
1909
  };
1773
- const reactivityAtom = removeTtl(make2((get5) => contextWith((services) => buildWithMemoMap(layer, resolveMemoMap(get5), get(services, Scope))).pipe(map2(get(Reactivity)))));
1910
+ const reactivityAtom = removeTtl(make4((get5) => contextWith((services) => buildWithMemoMap(layer2, resolveMemoMap(get5), get(services, Scope))).pipe(map2(get(Reactivity)))));
1774
1911
  factory.withReactivity = (keys) => (atom) => transform2(atom, (get5) => {
1775
1912
  const reactivity = getOrThrow(get5(reactivityAtom));
1776
1913
  get5.addFinalizer(reactivity.registerUnsafe(keys, () => {
@@ -1783,7 +1920,7 @@ function context(options) {
1783
1920
  });
1784
1921
  return factory;
1785
1922
  }
1786
- var runtime = /* @__PURE__ */ context();
1923
+ var runtime = /* @__PURE__ */ context2();
1787
1924
  var withReactivity = runtime.withReactivity;
1788
1925
  var stream = (get5, stream2, options, services) => {
1789
1926
  const initialValue2 = options?.initialValue !== void 0 ? success(options.initialValue) : initial();