@e4779/pi-fabric 0.97.0-fork.13 → 0.100.0-fork.15

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 (189) hide show
  1. package/THIRD_PARTY_NOTICES.md +5 -4
  2. package/dist/agents/manager.d.ts.map +1 -1
  3. package/dist/agents/request.d.ts.map +1 -1
  4. package/dist/agents/types.d.ts +4 -0
  5. package/dist/agents/types.d.ts.map +1 -1
  6. package/dist/agents.js +3 -3
  7. package/dist/chunks/{chunk-JCV54SSP.js → chunk-27ORW5EK.js} +41 -22
  8. package/dist/chunks/chunk-27ORW5EK.js.map +7 -0
  9. package/dist/chunks/{chunk-EQIGYLVB.js → chunk-3RFEMOJA.js} +9 -3
  10. package/dist/chunks/chunk-3RFEMOJA.js.map +7 -0
  11. package/dist/chunks/{chunk-D5GNTBV6.js → chunk-7HQKBGTL.js} +2 -2
  12. package/dist/chunks/{chunk-LNLQ2LX3.js → chunk-ASU53MOT.js} +2 -2
  13. package/dist/chunks/{chunk-V3PIO7QL.js → chunk-BUQZBG6O.js} +3 -43
  14. package/dist/chunks/chunk-BUQZBG6O.js.map +7 -0
  15. package/dist/chunks/{chunk-6K5SRGW6.js → chunk-C2DIKAOE.js} +4 -4
  16. package/dist/chunks/{chunk-FJSHRHOR.js → chunk-CPSPZGK4.js} +6 -6
  17. package/dist/chunks/{chunk-UBPFGMDQ.js → chunk-CXQF35XB.js} +4 -4
  18. package/dist/chunks/{chunk-3SIXBW6A.js → chunk-H4YYLQTX.js} +2 -2
  19. package/dist/chunks/{chunk-CSJSHBAT.js → chunk-I5VN6D5T.js} +48 -21
  20. package/dist/chunks/chunk-I5VN6D5T.js.map +7 -0
  21. package/dist/chunks/{chunk-VRYEGVHR.js → chunk-J7ZQERKA.js} +11 -8
  22. package/dist/chunks/chunk-J7ZQERKA.js.map +7 -0
  23. package/dist/chunks/{chunk-D4B4CCTA.js → chunk-JHQDS6YP.js} +2 -2
  24. package/dist/chunks/{chunk-OINADFEF.js → chunk-JWWGWUP7.js} +5 -5
  25. package/dist/chunks/{chunk-WXSELMFV.js → chunk-KFPUVFDS.js} +5 -5
  26. package/dist/chunks/{chunk-EPAFGT2M.js → chunk-LH2PGXSZ.js} +5 -1
  27. package/dist/chunks/{chunk-EPAFGT2M.js.map → chunk-LH2PGXSZ.js.map} +2 -2
  28. package/dist/chunks/{chunk-X3IRR7CV.js → chunk-M25A5R3F.js} +2 -2
  29. package/dist/chunks/chunk-MNTJX4U7.js +760 -0
  30. package/dist/chunks/chunk-MNTJX4U7.js.map +7 -0
  31. package/dist/chunks/{chunk-754HA6KO.js → chunk-NRLDV5R3.js} +7 -2
  32. package/dist/chunks/chunk-NRLDV5R3.js.map +7 -0
  33. package/dist/chunks/chunk-O4A5UOXU.js +44 -0
  34. package/dist/chunks/chunk-O4A5UOXU.js.map +7 -0
  35. package/dist/chunks/{chunk-4F27LJTS.js → chunk-OEJ6RFDO.js} +255 -72
  36. package/dist/chunks/chunk-OEJ6RFDO.js.map +7 -0
  37. package/dist/chunks/{chunk-VQGO4P7C.js → chunk-QIW7QMFI.js} +2 -2
  38. package/dist/chunks/{chunk-B4HECUJI.js → chunk-RUEKYUNR.js} +2 -2
  39. package/dist/chunks/{chunk-A4XPJESK.js → chunk-RZHXYLOY.js} +2 -2
  40. package/dist/chunks/{chunk-QNMMQAZ7.js → chunk-SDDBEBM4.js} +3 -3
  41. package/dist/chunks/{chunk-2LBC6TTP.js → chunk-UGMLWBVF.js} +390 -228
  42. package/dist/chunks/chunk-UGMLWBVF.js.map +7 -0
  43. package/dist/chunks/{chunk-5WUW727L.js → chunk-VGQ2IE7P.js} +19 -3
  44. package/dist/chunks/chunk-VGQ2IE7P.js.map +7 -0
  45. package/dist/chunks/{chunk-KBHITFTO.js → chunk-VRAGOMN4.js} +3 -1
  46. package/dist/chunks/chunk-VRAGOMN4.js.map +7 -0
  47. package/dist/chunks/{chunk-F676L43O.js → chunk-WK25T5ST.js} +11 -11
  48. package/dist/chunks/{chunk-IPHEM6RY.js → chunk-WQB6CVES.js} +2 -2
  49. package/dist/chunks/{chunk-CZSX6UG6.js → chunk-XYFOKDFM.js} +2 -2
  50. package/dist/chunks/{chunk-G2F2RDZI.js → chunk-YAPDV6LO.js} +2 -2
  51. package/dist/chunks/{chunk-Q5BMTL6A.js → chunk-YIEK7FH2.js} +4 -4
  52. package/dist/chunks/{chunk-KS44WKJJ.js → chunk-Z45SUO4B.js} +2 -2
  53. package/dist/commands/fabric.d.ts.map +1 -1
  54. package/dist/compaction/hook.js +6 -6
  55. package/dist/components/builtin-guidance.d.ts +4 -0
  56. package/dist/components/builtin-guidance.d.ts.map +1 -0
  57. package/dist/components/configuration.js +2 -2
  58. package/dist/config.d.ts +7 -0
  59. package/dist/config.d.ts.map +1 -1
  60. package/dist/core/action-registry.js +7 -7
  61. package/dist/core/file-lock.d.ts +4 -0
  62. package/dist/core/file-lock.d.ts.map +1 -1
  63. package/dist/core/provider-operations.js +162 -51
  64. package/dist/core/provider-operations.js.map +2 -2
  65. package/dist/core/shell-timing.d.ts +11 -0
  66. package/dist/core/shell-timing.d.ts.map +1 -0
  67. package/dist/entropy/index.js +12 -10
  68. package/dist/entropy/pool-store.d.ts +3 -1
  69. package/dist/entropy/pool-store.d.ts.map +1 -1
  70. package/dist/fabric-runtime-state.d.ts.map +1 -1
  71. package/dist/fabric-runtime-state.js +138 -55
  72. package/dist/fabric-runtime-state.js.map +4 -4
  73. package/dist/fabric-state.d.ts.map +1 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +125 -58
  76. package/dist/index.js.map +3 -3
  77. package/dist/jev/observation.js +5 -5
  78. package/dist/jev.js +8 -8
  79. package/dist/lifecycle/broker.d.ts.map +1 -1
  80. package/dist/memory/digest.js +2 -2
  81. package/dist/memory/discovery.js +6 -6
  82. package/dist/memory/file-worker.js +9 -9
  83. package/dist/memory/normalize.js +5 -5
  84. package/dist/memory/search.js +7 -7
  85. package/dist/memory/worker-provider.js +10 -10
  86. package/dist/memory.js +10 -10
  87. package/dist/prewalk/messages.d.ts +1 -1
  88. package/dist/prewalk/messages.d.ts.map +1 -1
  89. package/dist/protocol.d.ts +12 -0
  90. package/dist/protocol.d.ts.map +1 -1
  91. package/dist/protocol.js +3 -1
  92. package/dist/providers/agents-actions.d.ts.map +1 -1
  93. package/dist/providers/agents-message-router.d.ts.map +1 -1
  94. package/dist/providers/agents-provider.d.ts.map +1 -1
  95. package/dist/providers/jev-provider.js +8 -8
  96. package/dist/providers/memory-provider.js +9 -9
  97. package/dist/providers/prewalk-provider.d.ts +3 -3
  98. package/dist/providers/prewalk-provider.d.ts.map +1 -1
  99. package/dist/residency/host.js +9 -9
  100. package/dist/residency/pi-entry.js +9 -9
  101. package/dist/runtime/core-override-guest-types.js +2 -2
  102. package/dist/runtime/guest-types.d.ts +1 -1
  103. package/dist/runtime/guest-types.d.ts.map +1 -1
  104. package/dist/runtime/guest-types.js +1 -1
  105. package/dist/runtime/monty-runtime.js +1 -1
  106. package/dist/runtime/typescript-kernel.js +2 -2
  107. package/dist/ui/conversation.d.ts +2 -1
  108. package/dist/ui/conversation.d.ts.map +1 -1
  109. package/dist/ui/conversation.js +41 -37
  110. package/dist/ui/conversation.js.map +2 -2
  111. package/dist/ui/dashboard.js +10 -8
  112. package/dist/ui/dashboard.js.map +1 -1
  113. package/dist/ui/fabric-model-selector.d.ts +3 -0
  114. package/dist/ui/fabric-model-selector.d.ts.map +1 -1
  115. package/dist/ui/settings.d.ts.map +1 -1
  116. package/dist/ui/settings.js +15 -2
  117. package/dist/ui/settings.js.map +2 -2
  118. package/dist/ui/shell-tasks.d.ts +2 -1
  119. package/dist/ui/shell-tasks.d.ts.map +1 -1
  120. package/dist/ui/shell-tasks.js +169 -81
  121. package/dist/ui/shell-tasks.js.map +3 -3
  122. package/dist/ui/snapshot.d.ts.map +1 -1
  123. package/dist/ui/structured.d.ts.map +1 -1
  124. package/dist/ui/widget.d.ts.map +1 -1
  125. package/dist/verified/generated/authority-kernel.js +188 -81
  126. package/dist/verified/generated/kernel.js +547 -265
  127. package/dist/verified/generated/lifecycle-kernel.d.ts +1 -1
  128. package/dist/verified/generated/lifecycle-kernel.js +172 -125
  129. package/dist/verified/generated/manifest.json +11 -11
  130. package/dist/verified/generated/provider-kernel.js +160 -52
  131. package/dist/verified/generated/storage-kernel.js +238 -69
  132. package/dist/worker/model-control.d.ts +1 -1
  133. package/dist/worker/model-control.d.ts.map +1 -1
  134. package/dist/worker/model-control.js +6 -3
  135. package/dist/worker/model-control.js.map +2 -2
  136. package/dist/worker/options.d.ts.map +1 -1
  137. package/dist/worker/options.js +15 -0
  138. package/dist/worker/options.js.map +2 -2
  139. package/dist/worker.js +3 -2
  140. package/dist/worker.js.map +2 -2
  141. package/docs/agents.md +1 -1
  142. package/docs/background-tasks.md +33 -0
  143. package/docs/configuration.md +4 -2
  144. package/docs/entropy.md +13 -0
  145. package/docs/harnesses.md +1 -1
  146. package/docs/interface.md +2 -0
  147. package/docs/jev.md +1 -1
  148. package/docs/prompt-cache.md +3 -3
  149. package/docs/provider-capabilities.md +1 -1
  150. package/docs/verified-kernels.md +10 -6
  151. package/package.json +1 -1
  152. package/proofs/lifecycle-spec.bend +4 -4
  153. package/proofs/lifecycle-types.d.ts +1 -1
  154. package/proofs/lifecycle.bend +6 -6
  155. package/scripts/test-verified-kernels.mjs +3 -3
  156. package/scripts/verified-kernels.mjs +53 -13
  157. package/skillsets/typescript/fabric-exec/references/agents.md +2 -0
  158. package/dist/chunks/chunk-2LBC6TTP.js.map +0 -7
  159. package/dist/chunks/chunk-4E63LJDD.js +0 -468
  160. package/dist/chunks/chunk-4E63LJDD.js.map +0 -7
  161. package/dist/chunks/chunk-4F27LJTS.js.map +0 -7
  162. package/dist/chunks/chunk-5WUW727L.js.map +0 -7
  163. package/dist/chunks/chunk-754HA6KO.js.map +0 -7
  164. package/dist/chunks/chunk-CSJSHBAT.js.map +0 -7
  165. package/dist/chunks/chunk-EQIGYLVB.js.map +0 -7
  166. package/dist/chunks/chunk-JCV54SSP.js.map +0 -7
  167. package/dist/chunks/chunk-KBHITFTO.js.map +0 -7
  168. package/dist/chunks/chunk-V3PIO7QL.js.map +0 -7
  169. package/dist/chunks/chunk-VRYEGVHR.js.map +0 -7
  170. /package/dist/chunks/{chunk-D5GNTBV6.js.map → chunk-7HQKBGTL.js.map} +0 -0
  171. /package/dist/chunks/{chunk-LNLQ2LX3.js.map → chunk-ASU53MOT.js.map} +0 -0
  172. /package/dist/chunks/{chunk-6K5SRGW6.js.map → chunk-C2DIKAOE.js.map} +0 -0
  173. /package/dist/chunks/{chunk-FJSHRHOR.js.map → chunk-CPSPZGK4.js.map} +0 -0
  174. /package/dist/chunks/{chunk-UBPFGMDQ.js.map → chunk-CXQF35XB.js.map} +0 -0
  175. /package/dist/chunks/{chunk-3SIXBW6A.js.map → chunk-H4YYLQTX.js.map} +0 -0
  176. /package/dist/chunks/{chunk-D4B4CCTA.js.map → chunk-JHQDS6YP.js.map} +0 -0
  177. /package/dist/chunks/{chunk-OINADFEF.js.map → chunk-JWWGWUP7.js.map} +0 -0
  178. /package/dist/chunks/{chunk-WXSELMFV.js.map → chunk-KFPUVFDS.js.map} +0 -0
  179. /package/dist/chunks/{chunk-X3IRR7CV.js.map → chunk-M25A5R3F.js.map} +0 -0
  180. /package/dist/chunks/{chunk-VQGO4P7C.js.map → chunk-QIW7QMFI.js.map} +0 -0
  181. /package/dist/chunks/{chunk-B4HECUJI.js.map → chunk-RUEKYUNR.js.map} +0 -0
  182. /package/dist/chunks/{chunk-A4XPJESK.js.map → chunk-RZHXYLOY.js.map} +0 -0
  183. /package/dist/chunks/{chunk-QNMMQAZ7.js.map → chunk-SDDBEBM4.js.map} +0 -0
  184. /package/dist/chunks/{chunk-F676L43O.js.map → chunk-WK25T5ST.js.map} +0 -0
  185. /package/dist/chunks/{chunk-IPHEM6RY.js.map → chunk-WQB6CVES.js.map} +0 -0
  186. /package/dist/chunks/{chunk-CZSX6UG6.js.map → chunk-XYFOKDFM.js.map} +0 -0
  187. /package/dist/chunks/{chunk-G2F2RDZI.js.map → chunk-YAPDV6LO.js.map} +0 -0
  188. /package/dist/chunks/{chunk-Q5BMTL6A.js.map → chunk-YIEK7FH2.js.map} +0 -0
  189. /package/dist/chunks/{chunk-KS44WKJJ.js.map → chunk-Z45SUO4B.js.map} +0 -0
@@ -12,7 +12,7 @@ import {
12
12
  repairCatalogInput,
13
13
  validateCatalogArgs,
14
14
  validationMessage
15
- } from "./chunk-G2F2RDZI.js";
15
+ } from "./chunk-YAPDV6LO.js";
16
16
  import {
17
17
  runAbortable,
18
18
  settleWithin,
@@ -26,139 +26,252 @@ import {
26
26
  getActiveRepairCompiler,
27
27
  isActiveQuarantine,
28
28
  normalizeActiveArguments
29
- } from "./chunk-KS44WKJJ.js";
29
+ } from "./chunk-Z45SUO4B.js";
30
30
  import {
31
31
  FABRIC_NESTED_TOOL_CALL_ID_PREFIX
32
- } from "./chunk-KBHITFTO.js";
32
+ } from "./chunk-VRAGOMN4.js";
33
33
  import {
34
34
  FabricResolutionError,
35
35
  FabricTraceSafeError,
36
36
  executionOutcomeFromError
37
- } from "./chunk-X3IRR7CV.js";
37
+ } from "./chunk-M25A5R3F.js";
38
38
  import {
39
39
  BEND_NAT_MAX,
40
- Ge,
41
- Re,
40
+ Je,
41
+ Ut,
42
+ _t,
42
43
  boundedEffectResources,
43
44
  encodeResourceEffects,
44
- ke,
45
- qe
46
- } from "./chunk-4E63LJDD.js";
45
+ gt
46
+ } from "./chunk-MNTJX4U7.js";
47
47
  import {
48
48
  stableJsonHash
49
49
  } from "./chunk-3YZUQESG.js";
50
50
 
51
51
  // src/verified/generated/authority-kernel.js
52
- function d(t, e) {
52
+ function A(t, e) {
53
53
  return { $: t < e ? "LT" : t === e ? "EQ" : "GT" };
54
54
  }
55
- function n(t, e) {
56
- return { $: "$JMP", f: t, x: e };
55
+ function N(t) {
56
+ return (typeof t == "bigint" || Number.isInteger(t)) && t >= 0 && t <= 2 ** 53 ? Number(t) : { [Symbol.toPrimitive]() {
57
+ throw "bend: a Nat past the largest immediate 2^48-1";
58
+ } };
57
59
  }
58
- function $(t) {
60
+ function f(t) {
59
61
  for (; t !== null && typeof t == "object" && t.$ === "$JMP"; )
60
62
  t = t.f(...t.x);
61
63
  return t;
62
64
  }
63
- function o(t, e) {
64
- return (...r) => r.length < e ? o((...u2) => t(...r, ...u2), e - r.length) : $(t(...r));
65
- }
66
- function v(t) {
67
- return n(m, [t]);
68
- }
69
- function y(t) {
70
- return n(p, [t]);
65
+ function c(t, e) {
66
+ return (...r) => r.length < e ? c((...a2) => t(...r, ...a2), e - r.length) : t(...r);
71
67
  }
72
- function g(t, e) {
73
- return n(b, [t, e]);
68
+ function R(t, e, r) {
69
+ for (; ; ) {
70
+ let a2 = t, i = e, n = r;
71
+ if (a2.$ === "Nil")
72
+ return i.$ === "Nil" ? n : false;
73
+ {
74
+ let o = a2.head, u2 = a2.tail;
75
+ if (i.$ === "Nil")
76
+ return false;
77
+ {
78
+ let $2 = i.head, k2 = i.tail;
79
+ t = u2, e = k2, r = m(n, B(o, $2));
80
+ continue;
81
+ }
82
+ }
83
+ }
74
84
  }
75
- function R(t, e) {
76
- return n(w, [t, e]);
85
+ function _(t, e, r) {
86
+ for (; ; ) {
87
+ let a2 = t, i = e, n = r;
88
+ if (a2.$ === "Nil")
89
+ return n;
90
+ {
91
+ let o = a2.head, u2 = a2.tail, $2 = R(i, o, true);
92
+ t = u2, e = i, r = n || $2;
93
+ continue;
94
+ }
95
+ }
77
96
  }
78
- function N(t) {
79
- return n(A, [t]);
97
+ function E(t, e, r) {
98
+ for (; ; ) {
99
+ let a2 = t, i = e, n = r;
100
+ if (a2.$ === "Nil")
101
+ return n;
102
+ {
103
+ let o = a2.head;
104
+ t = a2.tail, e = i, r = m(n, _(i, o, false));
105
+ continue;
106
+ }
107
+ }
80
108
  }
81
- function m(t) {
82
- return { $: "Active", grants: t };
109
+ function x(t) {
110
+ return { $: "authority-state.Active", grants: t };
83
111
  }
84
- function p(t) {
85
- if (t.$ === "Released")
86
- return false;
87
- {
88
- let e = t.grants;
89
- return true;
90
- }
112
+ function C(t) {
113
+ return t.$ !== "authority-state.Released";
91
114
  }
92
- function b(t, e) {
93
- if (t.$ === "Released")
115
+ function L(t, e) {
116
+ if (t.$ === "authority-state.Released")
94
117
  return false;
95
118
  {
96
119
  let r = t.grants;
97
- return n(l, [r, e, false]);
120
+ return _(r, e, false);
98
121
  }
99
122
  }
100
- function w(t, e) {
101
- if (t.$ === "Released")
102
- return { $: "Released" };
123
+ function Q(t, e) {
124
+ return t ? { $: "authority-state.Active", grants: e } : { $: "authority-state.Released" };
125
+ }
126
+ function I(t, e) {
127
+ if (t.$ === "authority-state.Released")
128
+ return { $: "authority-state.Released" };
103
129
  {
104
130
  let r = t.grants;
105
- return n(L, [$(f(e, r, true)), e]);
131
+ return Q(E(e, r, true), e);
106
132
  }
107
133
  }
108
- function A(t) {
109
- return { $: "Released" };
134
+ function q(t) {
135
+ return { $: "authority-state.Released" };
110
136
  }
111
- function l(t, e, r) {
112
- if (t.$ === "Nil")
113
- return r;
114
- {
115
- let u2 = t.head, i2 = t.tail, a2 = $(s(e, u2, true));
116
- return n(l, [i2, e, r || a2]);
117
- }
137
+ function U(t) {
138
+ return x(t);
118
139
  }
119
- function L(t, e) {
120
- return t ? { $: "Active", grants: e } : { $: "Released" };
140
+ function j(t) {
141
+ return C(t);
121
142
  }
122
- function f(t, e, r) {
123
- if (t.$ === "Nil")
124
- return r;
125
- {
126
- let u2 = t.head, i2 = t.tail;
127
- return n(f, [i2, e, $(c(r, $(l(e, u2, false))))]);
128
- }
143
+ function D(t, e) {
144
+ return L(t, e);
129
145
  }
130
- function s(t, e, r) {
131
- if (t.$ === "Nil") {
132
- if (e.$ === "Nil")
133
- return r;
134
- {
135
- let u2 = e.head, i2 = e.tail;
136
- return false;
137
- }
138
- } else {
139
- let u2 = t.head, i2 = t.tail;
140
- if (e.$ === "Nil")
141
- return false;
142
- {
143
- let a2 = e.head, h2 = e.tail;
144
- return n(s, [i2, h2, $(c(r, $(E(u2, a2))))]);
145
- }
146
- }
146
+ function M(t, e) {
147
+ return I(t, e);
147
148
  }
148
- function c(t, e) {
149
+ function T(t) {
150
+ return q(t);
151
+ }
152
+ function m(t, e) {
149
153
  return t ? e : false;
150
154
  }
151
- function E(t, e) {
152
- return n(T, [d(t, e)]);
155
+ function B(t, e) {
156
+ return P(A(t, e));
153
157
  }
154
- function T(t) {
158
+ function P(t) {
155
159
  return t.$ === "LT" ? false : t.$ === "EQ";
156
160
  }
157
- var j = /* @__PURE__ */ o(v, 1);
158
- var q = /* @__PURE__ */ o(y, 1);
159
- var D = /* @__PURE__ */ o(g, 2);
160
- var I = /* @__PURE__ */ o(R, 2);
161
- var J = /* @__PURE__ */ o(N, 1);
161
+ function b(t) {
162
+ let e = [t];
163
+ for (let r = e, a2 = 0; ; )
164
+ switch (t.$) {
165
+ case "Nil":
166
+ return r[a2] = t, e[0];
167
+ case "Con":
168
+ r = r[a2] = { ...t, head: N(t.head) }, a2 = "tail", t = t[a2];
169
+ continue;
170
+ default:
171
+ throw "bend: List has no tag " + t?.$ + " (its tags: Nil, Con); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
172
+ }
173
+ }
174
+ function p(t) {
175
+ let e = [t];
176
+ for (let r = e, a2 = 0; ; )
177
+ switch (t.$) {
178
+ case "Nil":
179
+ return r[a2] = t, e[0];
180
+ case "Con":
181
+ r = r[a2] = { ...t, head: BigInt(t.head) }, a2 = "tail", t = t[a2];
182
+ continue;
183
+ default:
184
+ throw "bend: List has no tag " + t?.$ + " (its tags: Nil, Con); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
185
+ }
186
+ }
187
+ function g(t) {
188
+ let e = [t];
189
+ for (let r = e, a2 = 0; ; )
190
+ switch (t.$) {
191
+ case "Nil":
192
+ return r[a2] = t, e[0];
193
+ case "Con":
194
+ r = r[a2] = { ...t, head: b(t.head) }, a2 = "tail", t = t[a2];
195
+ continue;
196
+ default:
197
+ throw "bend: List has no tag " + t?.$ + " (its tags: Nil, Con); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
198
+ }
199
+ }
200
+ function w(t) {
201
+ let e = [t];
202
+ for (let r = e, a2 = 0; ; )
203
+ switch (t.$) {
204
+ case "Nil":
205
+ return r[a2] = t, e[0];
206
+ case "Con":
207
+ r = r[a2] = { ...t, head: p(t.head) }, a2 = "tail", t = t[a2];
208
+ continue;
209
+ default:
210
+ throw "bend: List has no tag " + t?.$ + " (its tags: Nil, Con); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
211
+ }
212
+ }
213
+ function l(t) {
214
+ let e = [t];
215
+ for (let r = e, a2 = 0; ; )
216
+ switch (t.$) {
217
+ case "authority-state.Released":
218
+ return r[a2] = t, e[0];
219
+ case "authority-state.Active":
220
+ return r = r[a2] = { ...t, grants: w(t.grants) }, e[0];
221
+ default:
222
+ throw "bend: authority-state.Authority has no tag " + t?.$ + " (its tags: authority-state.Released, authority-state.Active); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
223
+ }
224
+ }
225
+ function d(t) {
226
+ let e = [t];
227
+ for (let r = e, a2 = 0; ; )
228
+ switch (t.$) {
229
+ case "authority-state.Released":
230
+ return r[a2] = t, e[0];
231
+ case "authority-state.Active":
232
+ return r = r[a2] = { ...t, grants: g(t.grants) }, e[0];
233
+ default:
234
+ throw "bend: authority-state.Authority has no tag " + t?.$ + " (its tags: authority-state.Released, authority-state.Active); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
235
+ }
236
+ }
237
+ var h = /* @__PURE__ */ new Map([["Unknown", "resources.Unknown"], ["Exact", "resources.Exact"], ["Quiet", "resources.Quiet"], ["Active", "authority-state.Active"], ["Released", "authority-state.Released"], ["Effect", "resources.Effect"]]);
238
+ var y = /* @__PURE__ */ new Map([["resources.Unknown", "Unknown"], ["resources.Exact", "Exact"], ["resources.Quiet", "Quiet"], ["authority-state.Active", "Active"], ["authority-state.Released", "Released"], ["resources.Effect", "Effect"]]);
239
+ function s(t, e) {
240
+ let r = [t];
241
+ for (let a2 = [[r, 0]]; a2.length > 0; ) {
242
+ let [i, n] = a2.pop(), o = i[n];
243
+ if (o === null || typeof o != "object") continue;
244
+ let u2 = Array.isArray(o) ? [...o] : { ...o };
245
+ typeof u2.$ == "string" && (u2.$ = e.get(u2.$) ?? u2.$), i[n] = u2;
246
+ for (let $2 of Object.keys(u2)) a2.push([u2, $2]);
247
+ }
248
+ return r[0];
249
+ }
250
+ var G = /* @__PURE__ */ c((t) => {
251
+ let e = l(f(U(g(t))));
252
+ return w(t), e;
253
+ }, 1);
254
+ var J = (t) => s(G(s(t, h)), y);
255
+ var O = /* @__PURE__ */ c((t) => {
256
+ let e = f(j(d(t)));
257
+ return l(t), e;
258
+ }, 1);
259
+ var S = (t) => s(O(s(t, h)), y);
260
+ var z = /* @__PURE__ */ c((t, e) => {
261
+ let r = f(D(d(t), b(e)));
262
+ return l(t), p(e), r;
263
+ }, 2);
264
+ var F = (t, e) => s(z(s(t, h), s(e, h)), y);
265
+ var H = /* @__PURE__ */ c((t, e) => {
266
+ let r = l(f(M(d(t), g(e))));
267
+ return l(t), w(e), r;
268
+ }, 2);
269
+ var K = (t, e) => s(H(s(t, h), s(e, h)), y);
270
+ var V = /* @__PURE__ */ c((t) => {
271
+ let e = l(f(T(d(t))));
272
+ return l(t), e;
273
+ }, 1);
274
+ var W = (t) => s(V(s(t, h)), y);
162
275
 
163
276
  // src/verified/authority.ts
164
277
  var encodeGrant = (grant) => {
@@ -170,15 +283,15 @@ var encodeGrant = (grant) => {
170
283
  grant.descriptorHash
171
284
  ]);
172
285
  let encoded = { $: "Nil" };
173
- for (let i2 = text.length - 1; i2 >= 0; i2--) {
174
- encoded = { $: "Con", head: BigInt(text.charCodeAt(i2)), tail: encoded };
286
+ for (let i = text.length - 1; i >= 0; i--) {
287
+ encoded = { $: "Con", head: BigInt(text.charCodeAt(i)), tail: encoded };
175
288
  }
176
289
  return encoded;
177
290
  };
178
291
  var encodeGrants = (grants) => {
179
292
  let encoded = { $: "Nil" };
180
- for (let i2 = grants.length - 1; i2 >= 0; i2--) {
181
- encoded = { $: "Con", head: encodeGrant(grants[i2]), tail: encoded };
293
+ for (let i = grants.length - 1; i >= 0; i--) {
294
+ encoded = { $: "Con", head: encodeGrant(grants[i]), tail: encoded };
182
295
  }
183
296
  return encoded;
184
297
  };
@@ -189,7 +302,7 @@ var CapabilityAuthority = class _CapabilityAuthority {
189
302
  const canonical = grants.map((grant) => Object.freeze({ ...grant }));
190
303
  this.#grants = new Map(canonical.map((grant) => [grant.ref, grant]));
191
304
  const encoded = encodeGrants(canonical);
192
- this.#state = parent ? I(parent.#state, encoded) : j(encoded);
305
+ this.#state = parent ? K(parent.#state, encoded) : J(encoded);
193
306
  }
194
307
  static issue(grants) {
195
308
  return new _CapabilityAuthority(grants);
@@ -198,14 +311,14 @@ var CapabilityAuthority = class _CapabilityAuthority {
198
311
  return new _CapabilityAuthority(grants, this);
199
312
  }
200
313
  get active() {
201
- return q(this.#state);
314
+ return S(this.#state);
202
315
  }
203
316
  release() {
204
- this.#state = J(this.#state);
317
+ this.#state = W(this.#state);
205
318
  }
206
319
  resolve(ref) {
207
320
  const grant = this.#grants.get(ref);
208
- return grant && D(this.#state, encodeGrant(grant)) ? { ...grant } : void 0;
321
+ return grant && F(this.#state, encodeGrant(grant)) ? { ...grant } : void 0;
209
322
  }
210
323
  bindings() {
211
324
  return this.active ? [...this.#grants.values()].map((grant) => ({ ...grant })) : [];
@@ -275,9 +388,9 @@ var summarizeEffects = (effects) => {
275
388
  };
276
389
  };
277
390
  var effectConflictsBetween = (left, right) => {
278
- if (!Re(left.declarations, right.declarations)) return [];
391
+ if (!Ut(left.declarations, right.declarations)) return [];
279
392
  const conflicts = [];
280
- if (ke(
393
+ if (Je(
281
394
  left.hasUnknown,
282
395
  left.hasUnknownNoncommutative,
283
396
  left.hasNoncommutative,
@@ -288,7 +401,7 @@ var effectConflictsBetween = (left, right) => {
288
401
  conflicts.push({ resources: ["*"], reason: "unknown_resource" });
289
402
  }
290
403
  const overlap = [...left.resourceNoncommutative.keys()].filter(
291
- (resource) => Ge(
404
+ (resource) => _t(
292
405
  right.resourceNoncommutative.has(resource),
293
406
  left.resourceNoncommutative.get(resource) ?? false,
294
407
  right.resourceNoncommutative.get(resource) ?? false
@@ -354,13 +467,13 @@ var levenshtein = (left, right) => {
354
467
  let previous = new Array(right.length + 1);
355
468
  let current = new Array(right.length + 1);
356
469
  for (let j2 = 0; j2 <= right.length; j2++) previous[j2] = j2;
357
- for (let i2 = 1; i2 <= left.length; i2++) {
358
- current[0] = i2;
470
+ for (let i = 1; i <= left.length; i++) {
471
+ current[0] = i;
359
472
  for (let j2 = 1; j2 <= right.length; j2++) {
360
473
  current[j2] = Math.min(
361
474
  previous[j2] + 1,
362
475
  current[j2 - 1] + 1,
363
- previous[j2 - 1] + (left[i2 - 1] === right[j2 - 1] ? 0 : 1)
476
+ previous[j2 - 1] + (left[i - 1] === right[j2 - 1] ? 0 : 1)
364
477
  );
365
478
  }
366
479
  const swap = previous;
@@ -455,155 +568,204 @@ var formatUnknownActionMessage = (ref, suggestions) => suggestions.length > 0 ?
455
568
  import { randomUUID } from "node:crypto";
456
569
 
457
570
  // src/verified/generated/lifecycle-kernel.js
458
- function h(o2) {
459
- if (o2 > 281474976710655n)
571
+ function d2(l2) {
572
+ if (l2 > 281474976710655)
573
+ throw "bend: a Nat past the largest immediate 2^48-1";
574
+ return l2;
575
+ }
576
+ function y2(l2) {
577
+ return (typeof l2 == "bigint" || Number.isInteger(l2)) && l2 >= 0 && l2 <= 2 ** 53 ? Number(l2) : { [Symbol.toPrimitive]() {
460
578
  throw "bend: a Nat past the largest immediate 2^48-1";
461
- return o2;
579
+ } };
462
580
  }
463
- function c2(o2, e) {
464
- return { $: "$JMP", f: o2, x: e };
581
+ function p2(l2) {
582
+ for (; l2 !== null && typeof l2 == "object" && l2.$ === "$JMP"; )
583
+ l2 = l2.f(...l2.x);
584
+ return l2;
465
585
  }
466
- function a(o2) {
467
- for (; o2 !== null && typeof o2 == "object" && o2.$ === "$JMP"; )
468
- o2 = o2.f(...o2.x);
469
- return o2;
586
+ function f2(l2, e) {
587
+ return (...c2) => c2.length < e ? f2((...o) => l2(...c2, ...o), e - c2.length) : l2(...c2);
470
588
  }
471
- function u(o2, e) {
472
- return (...s2) => s2.length < e ? u((...n2) => o2(...s2, ...n2), e - s2.length) : a(o2(...s2));
589
+ function s2(l2, e, c2) {
590
+ if (l2.$ === "lifecycle.Closing" || l2.$ === "lifecycle.Closed")
591
+ return false;
592
+ if (l2.$ === "lifecycle.Failed")
593
+ return c2;
594
+ {
595
+ let o = R2(e);
596
+ return c2 || o;
597
+ }
598
+ }
599
+ function $(l2) {
600
+ return l2.$ === "lifecycle.Staged" ? { $: "lifecycle.Retiring" } : l2.$ === "lifecycle.Active" ? { $: "lifecycle.Retiring" } : l2;
601
+ }
602
+ function k(l2, e) {
603
+ if (l2) {
604
+ let c2 = e.phase, o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
605
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: n, calls: d2(r + 1), revoked: t }, command: { $: "lifecycle.Granted" } };
606
+ } else
607
+ return { $: "lifecycle.Outcome", next: e, command: { $: "lifecycle.Denied" } };
473
608
  }
474
- function k(o2, e) {
475
- return c2(v2, [o2, e]);
609
+ function w2(l2, e) {
610
+ if (l2) {
611
+ let c2 = e.phase, o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
612
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: d2(n + 1), calls: r, revoked: t }, command: { $: "lifecycle.Granted" } };
613
+ } else
614
+ return { $: "lifecycle.Outcome", next: e, command: { $: "lifecycle.Denied" } };
476
615
  }
477
- function v2(o2, e) {
478
- return c2(w2, [e, o2]);
616
+ function v(l2, e) {
617
+ return l2 ? { $: "lifecycle.Outcome", next: e, command: { $: "lifecycle.Granted" } } : { $: "lifecycle.Outcome", next: e, command: { $: "lifecycle.Denied" } };
479
618
  }
480
- function w2(o2, e) {
481
- if (o2.$ === "Inspect") {
482
- let s2 = e.phase, n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
483
- return c2(p2, [a($2(s2, d2, false)), { $: "Life", phase: s2, owner: n2, holds: l2, calls: r, revoked: d2 }]);
484
- } else if (o2.$ === "Activate") {
485
- let s2 = e.phase;
486
- if (s2.$ === "Staged") {
487
- let n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
488
- return { $: "Outcome", next: { $: "Life", phase: { $: "Active" }, owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Granted" } };
489
- } else if (s2.$ === "Active") {
490
- let n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
491
- return { $: "Outcome", next: { $: "Life", phase: { $: "Active" }, owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Granted" } };
619
+ function g2(l2, e) {
620
+ if (l2.$ === "lifecycle.Inspect") {
621
+ let c2 = e.phase, o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
622
+ return v(s2(c2, t, false), { $: "lifecycle.Life", phase: c2, owner: o, holds: n, calls: r, revoked: t });
623
+ } else if (l2.$ === "lifecycle.Activate") {
624
+ let c2 = e.phase;
625
+ if (c2.$ === "lifecycle.Staged") {
626
+ let o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
627
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Active" }, owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Granted" } };
628
+ } else if (c2.$ === "lifecycle.Active") {
629
+ let o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
630
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Active" }, owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Granted" } };
492
631
  } else {
493
- let n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
494
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Denied" } };
495
- }
496
- } else if (o2.$ === "Retire") {
497
- let s2 = e.phase, n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
498
- return { $: "Outcome", next: { $: "Life", phase: a(m2(s2)), owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Granted" } };
499
- } else if (o2.$ === "DropOwner") {
500
- let s2 = e.phase, n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
501
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: false, holds: l2, calls: r, revoked: d2 }, command: { $: "Granted" } };
502
- } else if (o2.$ === "Revoke") {
503
- let s2 = e.phase, n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
504
- return { $: "Outcome", next: { $: "Life", phase: a(m2(s2)), owner: false, holds: l2, calls: r, revoked: true }, command: { $: "Granted" } };
505
- } else if (o2.$ === "Retain") {
506
- let s2 = o2.cleanup, n2 = e.phase, l2 = e.owner, r = e.holds, d2 = e.calls, t = e.revoked;
507
- return c2(x, [a($2(n2, t, s2)), { $: "Life", phase: n2, owner: l2, holds: r, calls: d2, revoked: t }]);
508
- } else if (o2.$ === "Release") {
509
- let s2 = e.phase, n2 = e.owner, l2 = e.holds;
510
- if (l2 === 0n) {
511
- let r = e.calls, d2 = e.revoked;
512
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: 0n, calls: r, revoked: d2 }, command: { $: "Denied" } };
632
+ let o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
633
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Denied" } };
634
+ }
635
+ } else if (l2.$ === "lifecycle.Retire") {
636
+ let c2 = e.phase, o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
637
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: $(c2), owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Granted" } };
638
+ } else if (l2.$ === "lifecycle.DropOwner") {
639
+ let c2 = e.phase, o = e.holds, n = e.calls, r = e.revoked;
640
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: false, holds: o, calls: n, revoked: r }, command: { $: "lifecycle.Granted" } };
641
+ } else if (l2.$ === "lifecycle.Revoke") {
642
+ let c2 = e.phase, o = e.holds, n = e.calls;
643
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: $(c2), owner: false, holds: o, calls: n, revoked: true }, command: { $: "lifecycle.Granted" } };
644
+ } else if (l2.$ === "lifecycle.Retain") {
645
+ let c2 = l2.cleanup, o = e.phase, n = e.owner, r = e.holds, t = e.calls, i = e.revoked;
646
+ return w2(s2(o, i, c2), { $: "lifecycle.Life", phase: o, owner: n, holds: r, calls: t, revoked: i });
647
+ } else if (l2.$ === "lifecycle.Release") {
648
+ let c2 = e.phase, o = e.owner, n = e.holds;
649
+ if (n === 0) {
650
+ let r = e.calls, t = e.revoked;
651
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: 0, calls: r, revoked: t }, command: { $: "lifecycle.Denied" } };
513
652
  } else {
514
- let r = l2 - 1n, d2 = e.calls, t = e.revoked;
515
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: r, calls: d2, revoked: t }, command: { $: "Granted" } };
516
- }
517
- } else if (o2.$ === "Begin") {
518
- let s2 = o2.cleanup, n2 = e.phase, l2 = e.owner, r = e.holds, d2 = e.calls, t = e.revoked;
519
- return c2(O, [a($2(n2, t, s2)), { $: "Life", phase: n2, owner: l2, holds: r, calls: d2, revoked: t }]);
520
- } else if (o2.$ === "End") {
521
- let s2 = e.phase, n2 = e.owner, l2 = e.holds, r = e.calls;
522
- if (r === 0n) {
523
- let d2 = e.revoked;
524
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: l2, calls: 0n, revoked: d2 }, command: { $: "Denied" } };
653
+ let r = n - 1, t = e.calls, i = e.revoked;
654
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: r, calls: t, revoked: i }, command: { $: "lifecycle.Granted" } };
655
+ }
656
+ } else if (l2.$ === "lifecycle.Begin") {
657
+ let c2 = l2.cleanup, o = e.phase, n = e.owner, r = e.holds, t = e.calls, i = e.revoked;
658
+ return k(s2(o, i, c2), { $: "lifecycle.Life", phase: o, owner: n, holds: r, calls: t, revoked: i });
659
+ } else if (l2.$ === "lifecycle.End") {
660
+ let c2 = e.phase, o = e.owner, n = e.holds, r = e.calls;
661
+ if (r === 0) {
662
+ let t = e.revoked;
663
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: n, calls: 0, revoked: t }, command: { $: "lifecycle.Denied" } };
525
664
  } else {
526
- let d2 = r - 1n, t = e.revoked;
527
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: l2, calls: d2, revoked: t }, command: { $: "Granted" } };
528
- }
529
- } else if (o2.$ === "Close") {
530
- let s2 = e.phase;
531
- if (s2.$ === "Retiring") {
532
- let n2 = e.owner;
533
- if (n2) {
534
- let l2 = e.holds, r = e.calls, d2 = e.revoked;
535
- return { $: "Outcome", next: { $: "Life", phase: { $: "Retiring" }, owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Denied" } };
665
+ let t = r - 1, i = e.revoked;
666
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: n, calls: t, revoked: i }, command: { $: "lifecycle.Granted" } };
667
+ }
668
+ } else if (l2.$ === "lifecycle.Shut") {
669
+ let c2 = e.phase;
670
+ if (c2.$ === "lifecycle.Retiring") {
671
+ let o = e.owner;
672
+ if (o) {
673
+ let n = e.holds, r = e.calls, t = e.revoked;
674
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Retiring" }, owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Denied" } };
536
675
  } else {
537
- let l2 = e.holds;
538
- if (l2 === 0n) {
676
+ let n = e.holds;
677
+ if (n === 0) {
539
678
  let r = e.calls;
540
- if (r === 0n) {
541
- let d2 = e.revoked;
542
- return { $: "Outcome", next: { $: "Life", phase: { $: "Closing" }, owner: false, holds: 0n, calls: 0n, revoked: d2 }, command: { $: "StartClose" } };
679
+ if (r === 0) {
680
+ let t = e.revoked;
681
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Closing" }, owner: false, holds: 0, calls: 0, revoked: t }, command: { $: "lifecycle.StartClose" } };
543
682
  } else {
544
- let d2 = r - 0n, t = e.revoked;
545
- return { $: "Outcome", next: { $: "Life", phase: { $: "Retiring" }, owner: false, holds: 0n, calls: d2, revoked: t }, command: { $: "Denied" } };
683
+ let t = r - 0, i = e.revoked;
684
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Retiring" }, owner: false, holds: 0, calls: t, revoked: i }, command: { $: "lifecycle.Denied" } };
546
685
  }
547
686
  } else {
548
- let r = l2 - 0n, d2 = e.calls, t = e.revoked;
549
- return { $: "Outcome", next: { $: "Life", phase: { $: "Retiring" }, owner: false, holds: r, calls: d2, revoked: t }, command: { $: "Denied" } };
687
+ let r = n - 0, t = e.calls, i = e.revoked;
688
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Retiring" }, owner: false, holds: r, calls: t, revoked: i }, command: { $: "lifecycle.Denied" } };
550
689
  }
551
690
  }
552
691
  } else {
553
- let n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
554
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Denied" } };
555
- }
556
- } else if (o2.$ === "Complete") {
557
- let s2 = e.phase;
558
- if (s2.$ === "Closing") {
559
- let n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
560
- return { $: "Outcome", next: { $: "Life", phase: { $: "Closed" }, owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Granted" } };
692
+ let o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
693
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Denied" } };
694
+ }
695
+ } else if (l2.$ === "lifecycle.Complete") {
696
+ let c2 = e.phase;
697
+ if (c2.$ === "lifecycle.Closing") {
698
+ let o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
699
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Closed" }, owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Granted" } };
561
700
  } else {
562
- let n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
563
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: l2, calls: r, revoked: d2 }, command: { $: "Denied" } };
701
+ let o = e.owner, n = e.holds, r = e.calls, t = e.revoked;
702
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: c2, owner: o, holds: n, calls: r, revoked: t }, command: { $: "lifecycle.Denied" } };
564
703
  }
565
- } else if (e.phase.$ === "Closed") {
566
- let s2 = e.owner, n2 = e.holds, l2 = e.calls, r = e.revoked;
567
- return { $: "Outcome", next: { $: "Life", phase: { $: "Closed" }, owner: s2, holds: n2, calls: l2, revoked: r }, command: { $: "Denied" } };
704
+ } else if (e.phase.$ === "lifecycle.Closed") {
705
+ let c2 = e.owner, o = e.holds, n = e.calls, r = e.revoked;
706
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Closed" }, owner: c2, holds: o, calls: n, revoked: r }, command: { $: "lifecycle.Denied" } };
568
707
  } else {
569
- let s2 = e.owner, n2 = e.holds, l2 = e.calls, r = e.revoked;
570
- return { $: "Outcome", next: { $: "Life", phase: { $: "Failed" }, owner: false, holds: n2, calls: l2, revoked: true }, command: { $: "Granted" } };
708
+ let c2 = e.holds, o = e.calls;
709
+ return { $: "lifecycle.Outcome", next: { $: "lifecycle.Life", phase: { $: "lifecycle.Failed" }, owner: false, holds: c2, calls: o, revoked: true }, command: { $: "lifecycle.Granted" } };
571
710
  }
572
711
  }
573
- function p2(o2, e) {
574
- return o2 ? { $: "Outcome", next: e, command: { $: "Granted" } } : { $: "Outcome", next: e, command: { $: "Denied" } };
712
+ function O2(l2, e) {
713
+ return g2(e, l2);
575
714
  }
576
- function $2(o2, e, s2) {
577
- if (o2.$ === "Closing" || o2.$ === "Closed")
578
- return false;
579
- if (o2.$ === "Failed")
580
- return s2;
581
- {
582
- let n2 = a(L2(e));
583
- return s2 || n2;
584
- }
715
+ function L2(l2, e) {
716
+ return O2(l2, e);
585
717
  }
586
- function m2(o2) {
587
- return o2.$ === "Staged" ? { $: "Retiring" } : o2.$ === "Active" ? { $: "Retiring" } : o2;
718
+ function R2(l2) {
719
+ return !l2;
588
720
  }
589
- function x(o2, e) {
590
- if (o2) {
591
- let s2 = e.phase, n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
592
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: h(l2 + 1n), calls: r, revoked: d2 }, command: { $: "Granted" } };
593
- } else
594
- return { $: "Outcome", next: e, command: { $: "Denied" } };
721
+ function x2(l2) {
722
+ let e = [l2];
723
+ for (let c2 = e, o = 0; ; )
724
+ switch (l2.$) {
725
+ case "lifecycle.Life":
726
+ return c2 = c2[o] = { ...l2, holds: y2(l2.holds), calls: y2(l2.calls) }, e[0];
727
+ default:
728
+ throw "bend: lifecycle.Life has no tag " + l2?.$ + " (its tags: lifecycle.Life); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
729
+ }
595
730
  }
596
- function O(o2, e) {
597
- if (o2) {
598
- let s2 = e.phase, n2 = e.owner, l2 = e.holds, r = e.calls, d2 = e.revoked;
599
- return { $: "Outcome", next: { $: "Life", phase: s2, owner: n2, holds: l2, calls: h(r + 1n), revoked: d2 }, command: { $: "Granted" } };
600
- } else
601
- return { $: "Outcome", next: e, command: { $: "Denied" } };
731
+ function h2(l2) {
732
+ let e = [l2];
733
+ for (let c2 = e, o = 0; ; )
734
+ switch (l2.$) {
735
+ case "lifecycle.Life":
736
+ return c2 = c2[o] = { ...l2, holds: BigInt(l2.holds), calls: BigInt(l2.calls) }, e[0];
737
+ default:
738
+ throw "bend: lifecycle.Life has no tag " + l2?.$ + " (its tags: lifecycle.Life); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
739
+ }
740
+ }
741
+ function C2(l2) {
742
+ let e = [l2];
743
+ for (let c2 = e, o = 0; ; )
744
+ switch (l2.$) {
745
+ case "lifecycle.Outcome":
746
+ return c2 = c2[o] = { ...l2, next: h2(l2.next) }, e[0];
747
+ default:
748
+ throw "bend: lifecycle.Outcome has no tag " + l2?.$ + " (its tags: lifecycle.Outcome); a tag names its constructor as the loading file sees it, which a later version will make the same everywhere (#1105)";
749
+ }
602
750
  }
603
- function L2(o2) {
604
- return !o2;
751
+ var u = /* @__PURE__ */ new Map([["Closing", "lifecycle.Closing"], ["Closed", "lifecycle.Closed"], ["Failed", "lifecycle.Failed"], ["Staged", "lifecycle.Staged"], ["Retiring", "lifecycle.Retiring"], ["Active", "lifecycle.Active"], ["Outcome", "lifecycle.Outcome"], ["Denied", "lifecycle.Denied"], ["Life", "lifecycle.Life"], ["Granted", "lifecycle.Granted"], ["Inspect", "lifecycle.Inspect"], ["Activate", "lifecycle.Activate"], ["Retire", "lifecycle.Retire"], ["DropOwner", "lifecycle.DropOwner"], ["Revoke", "lifecycle.Revoke"], ["Retain", "lifecycle.Retain"], ["Release", "lifecycle.Release"], ["Begin", "lifecycle.Begin"], ["End", "lifecycle.End"], ["Shut", "lifecycle.Shut"], ["StartClose", "lifecycle.StartClose"], ["Complete", "lifecycle.Complete"]]);
752
+ var D2 = /* @__PURE__ */ new Map([["lifecycle.Closing", "Closing"], ["lifecycle.Closed", "Closed"], ["lifecycle.Failed", "Failed"], ["lifecycle.Staged", "Staged"], ["lifecycle.Retiring", "Retiring"], ["lifecycle.Active", "Active"], ["lifecycle.Outcome", "Outcome"], ["lifecycle.Denied", "Denied"], ["lifecycle.Life", "Life"], ["lifecycle.Granted", "Granted"], ["lifecycle.Inspect", "Inspect"], ["lifecycle.Activate", "Activate"], ["lifecycle.Retire", "Retire"], ["lifecycle.DropOwner", "DropOwner"], ["lifecycle.Revoke", "Revoke"], ["lifecycle.Retain", "Retain"], ["lifecycle.Release", "Release"], ["lifecycle.Begin", "Begin"], ["lifecycle.End", "End"], ["lifecycle.Shut", "Shut"], ["lifecycle.StartClose", "StartClose"], ["lifecycle.Complete", "Complete"]]);
753
+ function a(l2, e) {
754
+ let c2 = [l2];
755
+ for (let o = [[c2, 0]]; o.length > 0; ) {
756
+ let [n, r] = o.pop(), t = n[r];
757
+ if (t === null || typeof t != "object") continue;
758
+ let i = Array.isArray(t) ? [...t] : { ...t };
759
+ typeof i.$ == "string" && (i.$ = e.get(i.$) ?? i.$), n[r] = i;
760
+ for (let m2 of Object.keys(i)) o.push([i, m2]);
761
+ }
762
+ return c2[0];
605
763
  }
606
- var i = /* @__PURE__ */ u(k, 2);
764
+ var S2 = /* @__PURE__ */ f2((l2, e) => {
765
+ let c2 = C2(p2(L2(x2(l2), e)));
766
+ return h2(l2), c2;
767
+ }, 2);
768
+ var b2 = (l2, e) => a(S2(a(l2, u), a(e, u)), D2);
607
769
 
608
770
  // src/core/provider-bindings.ts
609
771
  var snapshot = (binding) => ({
@@ -613,7 +775,7 @@ var snapshot = (binding) => ({
613
775
  var useOnce = () => {
614
776
  let active = true;
615
777
  return () => {
616
- const next = qe(active);
778
+ const next = gt(active);
617
779
  active = next.snd;
618
780
  return next.fst;
619
781
  };
@@ -638,7 +800,7 @@ var FabricProviderBindings = class {
638
800
  binding(id) {
639
801
  const binding = this.#all.get(id);
640
802
  const life = this.#lifecycles.get(id);
641
- return binding && life && i(life, { $: "Inspect" }).command.$ === "Granted" ? binding : void 0;
803
+ return binding && life && b2(life, { $: "Inspect" }).command.$ === "Granted" ? binding : void 0;
642
804
  }
643
805
  has(name) {
644
806
  return this.#current.has(name);
@@ -804,7 +966,7 @@ var FabricProviderBindings = class {
804
966
  const binding = this.#all.get(id);
805
967
  if (!binding) return;
806
968
  binding.closeError = error instanceof Error ? error.message : String(error);
807
- this.#step(binding, { $: "Fail" });
969
+ this.#step(binding, { $: "Abort" });
808
970
  this.revoke(id);
809
971
  }
810
972
  /** Hold the real operation, not the caller's cancellation race. */
@@ -871,7 +1033,7 @@ var FabricProviderBindings = class {
871
1033
  }
872
1034
  async #maybeClose(binding) {
873
1035
  if (binding.closeTask) return binding.closeTask;
874
- if (this.#step(binding, { $: "Close" }) !== "StartClose") return;
1036
+ if (this.#step(binding, { $: "Shut" }) !== "StartClose") return;
875
1037
  binding.closeTask = Promise.resolve().then(async () => {
876
1038
  try {
877
1039
  const unsubscribe = binding.unsubscribeCatalog;
@@ -896,7 +1058,7 @@ var FabricProviderBindings = class {
896
1058
  }
897
1059
  #canBegin(id, cleanup) {
898
1060
  const life = this.#lifecycles.get(id);
899
- return !!life && life.calls < BigInt(BEND_NAT_MAX) && i(life, { $: "Begin", cleanup }).command.$ === "Granted";
1061
+ return !!life && life.calls < BigInt(BEND_NAT_MAX) && b2(life, { $: "Begin", cleanup }).command.$ === "Granted";
900
1062
  }
901
1063
  #step(binding, event) {
902
1064
  const life = this.#lifecycles.get(binding.id);
@@ -904,7 +1066,7 @@ var FabricProviderBindings = class {
904
1066
  if (event.$ === "Begin" && life.calls >= BigInt(BEND_NAT_MAX) || event.$ === "Retain" && life.holds >= BigInt(BEND_NAT_MAX)) {
905
1067
  throw new Error("Provider lifecycle accounting overflow");
906
1068
  }
907
- const outcome = i(life, event);
1069
+ const outcome = b2(life, event);
908
1070
  if (outcome.next.holds > BigInt(BEND_NAT_MAX) || outcome.next.calls > BigInt(BEND_NAT_MAX)) {
909
1071
  throw new Error("Provider lifecycle accounting overflow");
910
1072
  }
@@ -2101,4 +2263,4 @@ export {
2101
2263
  scoreActionSearch,
2102
2264
  ActionRegistry
2103
2265
  };
2104
- //# sourceMappingURL=chunk-2LBC6TTP.js.map
2266
+ //# sourceMappingURL=chunk-UGMLWBVF.js.map