@niscorp/moss 0.8.1 → 0.8.2

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 (39) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/DOCS.md +49 -12
  3. package/dist/{chunk-YZILOVCR.js → chunk-4M2MALV7.js} +18 -8
  4. package/dist/chunk-4M2MALV7.js.map +1 -0
  5. package/dist/{chunk-3DCTQKPQ.cjs → chunk-E6YAYR7G.cjs} +22 -5
  6. package/dist/chunk-E6YAYR7G.cjs.map +1 -0
  7. package/dist/{chunk-I4UOWER3.cjs → chunk-KLZYTSR2.cjs} +5 -5
  8. package/dist/{chunk-I4UOWER3.cjs.map → chunk-KLZYTSR2.cjs.map} +1 -1
  9. package/dist/{chunk-TMDKNZYL.cjs → chunk-QB7U2JDQ.cjs} +73 -63
  10. package/dist/chunk-QB7U2JDQ.cjs.map +1 -0
  11. package/dist/{chunk-3T422CCN.js → chunk-S4JSTWAE.js} +3 -3
  12. package/dist/{chunk-3T422CCN.js.map → chunk-S4JSTWAE.js.map} +1 -1
  13. package/dist/{chunk-6XC2MD7S.js → chunk-WTWRLOPK.js} +22 -5
  14. package/dist/chunk-WTWRLOPK.js.map +1 -0
  15. package/dist/{document-BYAY-Qle.d.ts → document-C3aS9uiW.d.ts} +2 -1
  16. package/dist/{document-DAE71J27.d.cts → document-deAs7Dre.d.cts} +2 -1
  17. package/dist/index.cjs +13 -13
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +2 -2
  21. package/dist/integrations.cjs +12 -5
  22. package/dist/integrations.cjs.map +1 -1
  23. package/dist/integrations.js +12 -5
  24. package/dist/integrations.js.map +1 -1
  25. package/dist/node.cjs +7 -7
  26. package/dist/node.d.cts +1 -1
  27. package/dist/node.d.ts +1 -1
  28. package/dist/node.js +3 -3
  29. package/dist/unverified.cjs +2 -2
  30. package/dist/unverified.js +1 -1
  31. package/dist/vite.cjs +8 -8
  32. package/dist/vite.d.cts +1 -1
  33. package/dist/vite.d.ts +1 -1
  34. package/dist/vite.js +3 -3
  35. package/package.json +9 -9
  36. package/dist/chunk-3DCTQKPQ.cjs.map +0 -1
  37. package/dist/chunk-6XC2MD7S.js.map +0 -1
  38. package/dist/chunk-TMDKNZYL.cjs.map +0 -1
  39. package/dist/chunk-YZILOVCR.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk3DCTQKPQ_cjs = require('./chunk-3DCTQKPQ.cjs');
3
+ var chunkE6YAYR7G_cjs = require('./chunk-E6YAYR7G.cjs');
4
4
  var chunkPVZMCEBX_cjs = require('./chunk-PVZMCEBX.cjs');
5
5
  var chunk3RIWTXGI_cjs = require('./chunk-3RIWTXGI.cjs');
6
6
  var zod = require('zod');
@@ -613,7 +613,7 @@ var oneAtATime = (query) => {
613
613
  };
614
614
  };
615
615
  var migrateTables = async (runtime, app, options = {}) => {
616
- const entries = chunk3DCTQKPQ_cjs.entriesOf(app);
616
+ const entries = chunkE6YAYR7G_cjs.entriesOf(app);
617
617
  const cache = runtime.cache ?? vex.createPostgresCache({ pool: runtime.pool });
618
618
  const before = await vex.createPostgresAdapter({ pool: runtime.pool }).introspect();
619
619
  const misfitsBefore = misfitsOf(entries, before);
@@ -1251,15 +1251,15 @@ var isKept = (layout) => layout !== void 0 && layout !== null && typeof layout !
1251
1251
  var shellWithStoredLayouts = (shell) => {
1252
1252
  const layouts = {};
1253
1253
  const frame = shell.layout;
1254
- if (isKept(frame)) layouts[chunk3DCTQKPQ_cjs.FRAME_LAYOUT_REF] = frame;
1254
+ if (isKept(frame)) layouts[chunkE6YAYR7G_cjs.FRAME_LAYOUT_REF] = frame;
1255
1255
  const canvases = shell.canvases.map((canvas) => {
1256
1256
  const layout = canvas.actionLayout;
1257
1257
  if (!isKept(layout)) return canvas;
1258
- const ref = chunk3DCTQKPQ_cjs.canvasLayoutRef(canvas.id);
1258
+ const ref = chunkE6YAYR7G_cjs.canvasLayoutRef(canvas.id);
1259
1259
  layouts[ref] = layout;
1260
1260
  return { ...canvas, actionLayout: ref };
1261
1261
  });
1262
- return { canvases, ...isKept(frame) ? { frame: chunk3DCTQKPQ_cjs.FRAME_LAYOUT_REF } : typeof frame === "string" ? { frame } : {}, layouts };
1262
+ return { canvases, ...isKept(frame) ? { frame: chunkE6YAYR7G_cjs.FRAME_LAYOUT_REF } : typeof frame === "string" ? { frame } : {}, layouts };
1263
1263
  };
1264
1264
  var slottedIn = /* @__PURE__ */ new WeakMap();
1265
1265
  var canvasesSlottedIn = (layout) => {
@@ -1310,7 +1310,7 @@ var createComponentNames = (read2) => {
1310
1310
  var SavedLayoutSchema = zod.z.strictObject({ ref: zod.z.string(), layout: nova.LayoutNodeSchema, use: zod.z.boolean().optional() });
1311
1311
  var upgradedLayoutBody = (upgrader, body, stamp) => reflect.isRecord(body) && body["layout"] !== void 0 ? { ...body, layout: upgrader.upgrade(body["layout"], { kind: "nisc.nova/layout", stamp }).document } : body;
1312
1312
  var actionAtRef = (actions, layouts) => (ref) => {
1313
- const id = chunk3DCTQKPQ_cjs.actionOfLayoutRef(ref);
1313
+ const id = chunkE6YAYR7G_cjs.actionOfLayoutRef(ref);
1314
1314
  const action = id !== void 0 && Object.hasOwn(actions, id) ? actions[id] : void 0;
1315
1315
  const layout = Object.hasOwn(layouts, ref) ? layouts[ref] : void 0;
1316
1316
  return action === void 0 || layout === void 0 ? void 0 : { ...action, layout };
@@ -1335,9 +1335,9 @@ var readLayout = (body, heldTo) => {
1335
1335
  const { ref, layout } = parsed.data;
1336
1336
  const target = targetAt(ref, heldTo);
1337
1337
  if (target === void 0) return { refusal: nothingKeptUnder(ref) };
1338
- const misfits = chunk3DCTQKPQ_cjs.layoutMisfits(layout, target.kit);
1338
+ const misfits = chunkE6YAYR7G_cjs.layoutMisfits(layout, target.kit);
1339
1339
  if (misfits.length > 0) return { refusal: misfits.join("; ") };
1340
- const named = chunk3DCTQKPQ_cjs.layoutNameRefusal(layout);
1340
+ const named = chunkE6YAYR7G_cjs.layoutNameRefusal(layout);
1341
1341
  if (named !== void 0) return { refusal: `it ${named}` };
1342
1342
  const { action } = target;
1343
1343
  if (action === void 0) return { layout: parsed.data };
@@ -1371,7 +1371,7 @@ var layoutsInUse = (inForce2, drawnFor) => {
1371
1371
  }
1372
1372
  return layouts;
1373
1373
  };
1374
- var generatedId = () => `${chunk3DCTQKPQ_cjs.GENERATED_ID_PREFIX}${crypto$1.randomUUID()}`;
1374
+ var generatedId = () => `${chunkE6YAYR7G_cjs.GENERATED_ID_PREFIX}${crypto$1.randomUUID()}`;
1375
1375
  var VEX_ROUTE = /^\/api\/(?:[A-Za-z0-9_-]+\/)?vex$/;
1376
1376
  var endpointRefusals = async (endpoints, heldTo) => {
1377
1377
  const refusals = [];
@@ -1408,8 +1408,8 @@ var parsedUnder = (schema, body, id, more = {}) => {
1408
1408
  return { refusal: first === void 0 ? "no reason given" : `${first.path.join(".") || "(the body)"}: ${first.message}` };
1409
1409
  };
1410
1410
  var layoutRefusals = (layout, kit) => {
1411
- const named = chunk3DCTQKPQ_cjs.layoutNameRefusal(layout);
1412
- return [...layout === void 0 || typeof layout === "string" ? [] : chunk3DCTQKPQ_cjs.layoutMisfits(layout, kit), ...named === void 0 ? [] : [`it ${named}`]];
1411
+ const named = chunkE6YAYR7G_cjs.layoutNameRefusal(layout);
1412
+ return [...layout === void 0 || typeof layout === "string" ? [] : chunkE6YAYR7G_cjs.layoutMisfits(layout, kit), ...named === void 0 ? [] : [`it ${named}`]];
1413
1413
  };
1414
1414
  var passedOrRefused = (body, refusals) => refusals.length > 0 ? { refusal: refusals.join("; ") } : { body };
1415
1415
  var readAction = async (body, id, heldTo) => {
@@ -1811,7 +1811,7 @@ var createGeneration = (pointer, ctx) => {
1811
1811
  var NO_DEFAULTS = { actions: {}, fragments: {}, reads: /* @__PURE__ */ new Map() };
1812
1812
  var drawableIn = (fragments, kit, say) => Object.fromEntries(
1813
1813
  Object.entries(fragments).filter(([id, fragment]) => {
1814
- const misfits = chunk3DCTQKPQ_cjs.layoutMisfits(fragment.layout, kit);
1814
+ const misfits = chunkE6YAYR7G_cjs.layoutMisfits(fragment.layout, kit);
1815
1815
  if (misfits.length > 0) say(`[moss] the fragment "${id}" published for everybody is left out of a shell that cannot draw it: ${misfits.join("; ")}`);
1816
1816
  return misfits.length === 0;
1817
1817
  })
@@ -1849,7 +1849,7 @@ var checkedDefaults = async (versions, heldTo, whose) => {
1849
1849
  catalog: () => [...Object.values(heldTo.built).map((action) => ({ id: action.id, input: action.input ?? {} })), ...catalogOfGenerated(versions)]
1850
1850
  };
1851
1851
  const passed = await generatedInForce(versions, checks, whose);
1852
- return { passed, reads, verified: chunk3DCTQKPQ_cjs.verifyManifest(heldTo.candidate({ ...heldTo.built, ...passed.actions }, passed.fragments)) };
1852
+ return { passed, reads, verified: chunkE6YAYR7G_cjs.verifyManifest(heldTo.candidate({ ...heldTo.built, ...passed.actions }, passed.fragments)) };
1853
1853
  };
1854
1854
  var narrowedBy = (filter, ids, installed) => {
1855
1855
  const answered = new Set(filter(ids, installed));
@@ -1862,9 +1862,9 @@ var catalogFor = (app, roles, installed, installedOnly) => {
1862
1862
  };
1863
1863
  var resolveVariantsForRoles = (app, roles) => {
1864
1864
  const variants = app.layouts ?? {};
1865
- return chunk3DCTQKPQ_cjs.variantLayouts(variants, charter.resolvePrincipal(app.charter, Object.keys(variants), roles, "layouts"));
1865
+ return chunkE6YAYR7G_cjs.variantLayouts(variants, charter.resolvePrincipal(app.charter, Object.keys(variants), roles, "layouts"));
1866
1866
  };
1867
- var definitionsFor = (actions, ids, variants) => Object.freeze(Object.fromEntries(chunk3DCTQKPQ_cjs.withVariants(actions, ids, variants)));
1867
+ var definitionsFor = (actions, ids, variants) => Object.freeze(Object.fromEntries(chunkE6YAYR7G_cjs.withVariants(actions, ids, variants)));
1868
1868
  var actionsWithStoredLayouts = (definitions) => {
1869
1869
  const actions = {};
1870
1870
  const layouts = {};
@@ -1874,7 +1874,7 @@ var actionsWithStoredLayouts = (definitions) => {
1874
1874
  actions[id] = definition;
1875
1875
  continue;
1876
1876
  }
1877
- const ref = chunk3DCTQKPQ_cjs.actionLayoutRef(id);
1877
+ const ref = chunkE6YAYR7G_cjs.actionLayoutRef(id);
1878
1878
  layouts[ref] = layout;
1879
1879
  actions[id] = { ...definition, layout: { ref } };
1880
1880
  }
@@ -1970,17 +1970,17 @@ var tell = (listener, ...told) => {
1970
1970
  };
1971
1971
  var createRunningManifest = (config) => {
1972
1972
  const { shipped } = config;
1973
- const entries = createEntriesInForce(chunk3DCTQKPQ_cjs.entriesOf(shipped));
1973
+ const entries = createEntriesInForce(chunkE6YAYR7G_cjs.entriesOf(shipped));
1974
1974
  let defaults = NO_DEFAULTS;
1975
1975
  const usage = createUsage(config.touchEveryMs ?? TOUCH_EVERY_MS);
1976
1976
  let functionIds;
1977
- const candidate = (actions, held = entries.list(), fragments = defaults.fragments) => chunk3DCTQKPQ_cjs.withFragments({ ...chunk3DCTQKPQ_cjs.candidateOf(shipped, { actions, entries: held }, config.grants), ...functionIds === void 0 ? {} : { functionIds } }, fragments);
1977
+ const candidate = (actions, held = entries.list(), fragments = defaults.fragments) => chunkE6YAYR7G_cjs.withFragments({ ...chunkE6YAYR7G_cjs.candidateOf(shipped, { actions, entries: held }, config.grants), ...functionIds === void 0 ? {} : { functionIds } }, fragments);
1978
1978
  const own = shipped.actions;
1979
1979
  const loaders = /* @__PURE__ */ new Map();
1980
1980
  const owners = createSetOwners();
1981
1981
  let sets = /* @__PURE__ */ new Map();
1982
1982
  let inForce2 = mergedActions(own, sets);
1983
- let report = chunk3DCTQKPQ_cjs.verifiedAtBoot(candidate(inForce2));
1983
+ let report = chunkE6YAYR7G_cjs.verifiedAtBoot(candidate(inForce2));
1984
1984
  const components = createComponentNames((shell) => shellComponents({ actions: inForce2, layouts: shipped.layouts }, shell));
1985
1985
  const componentsOf2 = (shells) => {
1986
1986
  const kit = /* @__PURE__ */ new Map();
@@ -2015,14 +2015,14 @@ var createRunningManifest = (config) => {
2015
2015
  const { reads: readSources } = config;
2016
2016
  const functionsWritten = (written) => {
2017
2017
  if (functionIds !== void 0) return;
2018
- const ids = chunk3DCTQKPQ_cjs.functionsIn(written).map((definition) => definition.id);
2019
- const charter = chunk3DCTQKPQ_cjs.charterOverFunctions(shipped.charter, { actions: Object.keys(inForce2), data: config.grants, layouts: Object.keys(shipped.layouts ?? {}) }, ids);
2018
+ const ids = chunkE6YAYR7G_cjs.functionsIn(written).map((definition) => definition.id);
2019
+ const charter = chunkE6YAYR7G_cjs.charterOverFunctions(shipped.charter, { actions: Object.keys(inForce2), data: config.grants, layouts: Object.keys(shipped.layouts ?? {}) }, ids);
2020
2020
  if (charter.errors.length > 0) throw new Error(`Charter is incoherent over the app\u2019s functions \u2014 refusing to serve:
2021
2021
  ${charter.errors.join("\n ")}`);
2022
2022
  functionIds = new Set(ids);
2023
2023
  const built = mergedActions(own, sets);
2024
- const verified = chunk3DCTQKPQ_cjs.verifyManifest(candidate(built, entries.list(), {}));
2025
- const refusal = chunk3DCTQKPQ_cjs.refusalOf(verified, "boot");
2024
+ const verified = chunkE6YAYR7G_cjs.verifyManifest(candidate(built, entries.list(), {}));
2025
+ const refusal = chunkE6YAYR7G_cjs.refusalOf(verified, "boot");
2026
2026
  if (refusal !== void 0) {
2027
2027
  functionIds = void 0;
2028
2028
  throw new Error(refusal);
@@ -2033,7 +2033,7 @@ var createRunningManifest = (config) => {
2033
2033
  dropMemos();
2034
2034
  memo.drop();
2035
2035
  for (const warning2 of charter.warnings) console.warn(`[moss] charter: ${warning2}`);
2036
- const warning = chunk3DCTQKPQ_cjs.functionsWarning(written);
2036
+ const warning = chunkE6YAYR7G_cjs.functionsWarning(written);
2037
2037
  if (warning !== void 0) console.warn(warning);
2038
2038
  };
2039
2039
  const grantedFunctionsOf = (roles) => (names) => charter.resolvePrincipal(shipped.charter, names, roles, "functions");
@@ -2087,7 +2087,7 @@ var createRunningManifest = (config) => {
2087
2087
  const over = sets;
2088
2088
  const { passed, reads, verified } = await checkedDefaults(versions, defaultsHeldTo(), "published for everybody");
2089
2089
  if (sets !== over) return applyPublished(versions);
2090
- const refusal = chunk3DCTQKPQ_cjs.refusalOf(verified, "boot");
2090
+ const refusal = chunkE6YAYR7G_cjs.refusalOf(verified, "boot");
2091
2091
  if (refusal !== void 0) memo.sayOnce(`[moss] what is published for everybody is left out, and the build\u2019s copies stand: ${refusal}`);
2092
2092
  const next = refusal === void 0 ? { actions: passed.actions, fragments: passed.fragments, reads } : { ...NO_DEFAULTS, reads };
2093
2093
  if (!hasDefaults(next) && !hasDefaults(defaults)) return;
@@ -2111,10 +2111,10 @@ var createRunningManifest = (config) => {
2111
2111
  const applySets = (arrived, announce) => {
2112
2112
  const next = new Map([...sets, ...arrived]);
2113
2113
  const actions = mergedActions(own, next, defaults.actions);
2114
- const verified = chunk3DCTQKPQ_cjs.verifyManifest(candidate(actions));
2115
- const refusal = chunk3DCTQKPQ_cjs.refusalOf(verified, "refresh");
2114
+ const verified = chunkE6YAYR7G_cjs.verifyManifest(candidate(actions));
2115
+ const refusal = chunkE6YAYR7G_cjs.refusalOf(verified, "refresh");
2116
2116
  if (refusal !== void 0) throw new Error(refusal);
2117
- for (const set of arrived.values()) chunk3DCTQKPQ_cjs.freezeDeep(set);
2117
+ for (const set of arrived.values()) chunkE6YAYR7G_cjs.freezeDeep(set);
2118
2118
  sets = next;
2119
2119
  inForce2 = actions;
2120
2120
  report = verified;
@@ -2130,13 +2130,13 @@ var createRunningManifest = (config) => {
2130
2130
  };
2131
2131
  const takeEntries = async (source, handed) => {
2132
2132
  owners.assertAppOwned(source);
2133
- const misfits = chunk3DCTQKPQ_cjs.entryMisfits(handed);
2133
+ const misfits = chunkE6YAYR7G_cjs.entryMisfits(handed);
2134
2134
  if (misfits.length > 0) throw new Error(["Refresh refused \u2014 entries that do not parse:", ...misfits.map((misfit) => ` ${misfit}`)].join("\n"));
2135
2135
  const compiled = await compileEntries(handed);
2136
- const verified = chunk3DCTQKPQ_cjs.verifyManifest(candidate(inForce2, entries.withSet(source, handed)));
2137
- const refusal = chunk3DCTQKPQ_cjs.refusalOf(verified, "refresh");
2136
+ const verified = chunkE6YAYR7G_cjs.verifyManifest(candidate(inForce2, entries.withSet(source, handed)));
2137
+ const refusal = chunkE6YAYR7G_cjs.refusalOf(verified, "refresh");
2138
2138
  if (refusal !== void 0) throw new Error(refusal);
2139
- chunk3DCTQKPQ_cjs.freezeDeep(handed);
2139
+ chunkE6YAYR7G_cjs.freezeDeep(handed);
2140
2140
  entries.takeSet(source, handed, compiled);
2141
2141
  report = verified;
2142
2142
  for (const listener of [...listeners]) tell(listener);
@@ -2146,7 +2146,7 @@ var createRunningManifest = (config) => {
2146
2146
  return {
2147
2147
  actions: () => inForce2,
2148
2148
  entries: entries.list,
2149
- verify: (actions) => chunk3DCTQKPQ_cjs.verifyManifest(candidate(actions)),
2149
+ verify: (actions) => chunkE6YAYR7G_cjs.verifyManifest(candidate(actions)),
2150
2150
  report: () => report,
2151
2151
  replace: (source, actions) => applySets(/* @__PURE__ */ new Map([[owners.assertAppOwned(source), actions]]), true),
2152
2152
  // In turn: a set is compiled before it is taken, and of two handed over
@@ -2207,7 +2207,7 @@ var createRunningManifest = (config) => {
2207
2207
  const drawable = theirOwn.heldTo.layouts;
2208
2208
  const theirs2 = layoutsInUse(versions, { whose, heldTo: drawable });
2209
2209
  const variants = roleMemo.variantsFor(roles);
2210
- const underVariants = { ...drawable, actionAt: (ref) => variants.has(chunk3DCTQKPQ_cjs.actionOfLayoutRef(ref) ?? "") ? void 0 : drawable.actionAt(ref) };
2210
+ const underVariants = { ...drawable, actionAt: (ref) => variants.has(chunkE6YAYR7G_cjs.actionOfLayoutRef(ref) ?? "") ? void 0 : drawable.actionAt(ref) };
2211
2211
  const everybodys = layoutsInUse(everybodysVersions, { whose: "published for everybody", heldTo: underVariants, say: memo.sayOnce });
2212
2212
  const laidOverShell = { ...drawableIn(defaults.fragments, kitOf2(shell), memo.sayOnce), ...theirOwn.fragments };
2213
2213
  const fragments = Object.keys(laidOverShell).length === 0 ? shell.fragments : { ...shell.fragments, ...laidOverShell };
@@ -2239,7 +2239,7 @@ var createRunningManifest = (config) => {
2239
2239
  verify: async (versions, inForce3) => {
2240
2240
  const kept = inForce3.filter((held) => !versions.some((version) => version.kind === held.kind && version.id === held.id));
2241
2241
  const asked = versions.map((version) => ({ ...version, save: "", createdAt: "" }));
2242
- const refusal = chunk3DCTQKPQ_cjs.refusalOf((await checkedDefaults([...kept, ...asked], defaultsHeldTo(), void 0)).verified, "publish");
2242
+ const refusal = chunkE6YAYR7G_cjs.refusalOf((await checkedDefaults([...kept, ...asked], defaultsHeldTo(), void 0)).verified, "publish");
2243
2243
  if (refusal !== void 0) throw new Error(refusal);
2244
2244
  }
2245
2245
  },
@@ -2737,13 +2737,13 @@ var seamsFor = (feature, owned, { app, runtime, server, operator, registered, id
2737
2737
  grantedActionIds: (roles, installed) => running.catalogFor(roles, installed).ids,
2738
2738
  actions: running.actions,
2739
2739
  replaceActions: owned.replace,
2740
- refusalOf: (actions) => chunk3DCTQKPQ_cjs.refusalOf(running.verify(actions), "refresh"),
2740
+ refusalOf: (actions) => chunkE6YAYR7G_cjs.refusalOf(running.verify(actions), "refresh"),
2741
2741
  setActionsLoader: owned.setLoader,
2742
2742
  addCatalogFilter: running.addCatalogFilter,
2743
2743
  charter: app.charter,
2744
2744
  components: app.shell?.components ?? {},
2745
- layoutMisfits: (layout) => chunk3DCTQKPQ_cjs.layoutMisfits(layout, kitOf(app)),
2746
- endlessChains: chunk3DCTQKPQ_cjs.endlessChains,
2745
+ layoutMisfits: (layout) => chunkE6YAYR7G_cjs.layoutMisfits(layout, kitOf(app)),
2746
+ endlessChains: chunkE6YAYR7G_cjs.endlessChains,
2747
2747
  ownEntries: (entries) => data.ownEntries(feature.name, entries),
2748
2748
  grammars: data.grammars,
2749
2749
  upgradeStore: (store) => data.upgradeStore(feature.name, store),
@@ -2810,9 +2810,9 @@ var read = (live) => {
2810
2810
  console.error("[moss/shells] the shell frame failed to render for a snapshot \u2014 serving an empty arrangement:", error);
2811
2811
  }
2812
2812
  const trees = {};
2813
- for (const canvasId of chunk3DCTQKPQ_cjs.canvasesOf(live)) {
2813
+ for (const canvasId of chunkE6YAYR7G_cjs.canvasesOf(live)) {
2814
2814
  try {
2815
- trees[canvasId] = chunk3DCTQKPQ_cjs.treeOf(live, canvasId);
2815
+ trees[canvasId] = chunkE6YAYR7G_cjs.treeOf(live, canvasId);
2816
2816
  } catch (error) {
2817
2817
  console.error(`[moss/shells] canvas "${canvasId}" failed to render for a snapshot \u2014 leaving it out:`, error);
2818
2818
  }
@@ -2829,7 +2829,7 @@ var needOf = (live, principal, kept) => {
2829
2829
  for (const instance of canvas.stack) {
2830
2830
  const definition = live.shell.getRuntime(instance.id)?.definition;
2831
2831
  if (definition === void 0) continue;
2832
- const need = shellNeedOf(chunk3DCTQKPQ_cjs.withLayoutInPlace(definition, live.shell.layoutStore), entries);
2832
+ const need = shellNeedOf(chunkE6YAYR7G_cjs.withLayoutInPlace(definition, live.shell.layoutStore), entries);
2833
2833
  for (const reason of need.why) why.push(`${definition.id}: ${reason}`);
2834
2834
  for (const read2 of need.drawnWith) drawnWith.push(read2);
2835
2835
  }
@@ -2852,7 +2852,7 @@ var sweep = (host, idleMs) => {
2852
2852
  }
2853
2853
  if (live.connections.size > 0 || live.idleSince === null) continue;
2854
2854
  if (now - live.idleSince < idleMs) continue;
2855
- chunk3DCTQKPQ_cjs.endShell(host, live);
2855
+ chunkE6YAYR7G_cjs.endShell(host, live);
2856
2856
  live.shell.dispose();
2857
2857
  durable.delete(principal);
2858
2858
  }
@@ -2874,7 +2874,7 @@ var rosterOf = (durable) => {
2874
2874
  var sameDocument = (one, other) => one === other || JSON.stringify(one) === JSON.stringify(other);
2875
2875
  var takeLayouts = (live, made) => {
2876
2876
  const taken = live.layouts;
2877
- const answered = chunk3DCTQKPQ_cjs.layoutsOf(made);
2877
+ const answered = chunkE6YAYR7G_cjs.layoutsOf(made);
2878
2878
  for (const [ref, layout] of Object.entries(answered.layoutStore)) {
2879
2879
  if (!sameDocument(taken.layoutStore[ref], layout)) live.shell.setLayout(ref, layout);
2880
2880
  }
@@ -2904,15 +2904,15 @@ var takeComposition = (live, made) => {
2904
2904
  live.entries = made.entries;
2905
2905
  takeLayouts(live, made);
2906
2906
  takeCanvases(live, made);
2907
- chunk3DCTQKPQ_cjs.holdGranted(live.functions, made.grantedFunctions);
2907
+ chunkE6YAYR7G_cjs.holdGranted(live.functions, made.grantedFunctions);
2908
2908
  };
2909
2909
  var adoptDraft = async (host, live, next) => {
2910
2910
  for (; ; ) {
2911
2911
  const cell = host.living.get(live);
2912
- if (cell === void 0 || cell.live !== live) throw new Error(chunk3DCTQKPQ_cjs.SHELL_GONE);
2912
+ if (cell === void 0 || cell.live !== live) throw new Error(chunkE6YAYR7G_cjs.SHELL_GONE);
2913
2913
  const changes = host.changes;
2914
- const made = await host.config.composition(cell.principal, chunk3DCTQKPQ_cjs.draftedIn(next));
2915
- if (live.ended || cell.live !== live) throw new Error(chunk3DCTQKPQ_cjs.SHELL_GONE);
2914
+ const made = await host.config.composition(cell.principal, chunkE6YAYR7G_cjs.draftedIn(next));
2915
+ if (live.ended || cell.live !== live) throw new Error(chunkE6YAYR7G_cjs.SHELL_GONE);
2916
2916
  if (changes < cell.changes) continue;
2917
2917
  cell.changes = changes;
2918
2918
  live.draft = next;
@@ -2926,7 +2926,7 @@ var adopt = (host, cell) => {
2926
2926
  if (asked.ended) return;
2927
2927
  const drafted = asked.draft;
2928
2928
  const changes = host.changes;
2929
- const made = await host.config.composition(cell.principal, chunk3DCTQKPQ_cjs.draftedIn(drafted));
2929
+ const made = await host.config.composition(cell.principal, chunkE6YAYR7G_cjs.draftedIn(drafted));
2930
2930
  if (asked.ended || changes <= cell.changes) return;
2931
2931
  if (asked.draft !== drafted) {
2932
2932
  adopt(host, cell);
@@ -2957,7 +2957,7 @@ var build = (host, asked, wanted = () => true) => {
2957
2957
  reject(new Error(`moss: the shell of ${asked.principal ?? "nobody"} was not built within ${limit}ms.`));
2958
2958
  }, limit);
2959
2959
  timer.unref?.();
2960
- chunk3DCTQKPQ_cjs.buildShell(host, { ...asked, wanted: () => inTime && wanted() }).then((live) => resolve2(live === void 0 ? void 0 : { live, changes }), reject).finally(() => clearTimeout(timer));
2960
+ chunkE6YAYR7G_cjs.buildShell(host, { ...asked, wanted: () => inTime && wanted() }).then((live) => resolve2(live === void 0 ? void 0 : { live, changes }), reject).finally(() => clearTimeout(timer));
2961
2961
  });
2962
2962
  };
2963
2963
  var builtOrThrow = (built) => {
@@ -2997,21 +2997,26 @@ var replaceShell = async (host, cell) => {
2997
2997
  if (built === void 0) return;
2998
2998
  const old = cell.live;
2999
2999
  if (!stands()) {
3000
- chunk3DCTQKPQ_cjs.endShell(host, built.live);
3000
+ chunkE6YAYR7G_cjs.endShell(host, built.live);
3001
3001
  built.live.shell.dispose();
3002
3002
  return;
3003
3003
  }
3004
3004
  const carried = [...old.connections].map((connection) => ({ connection, wants: old.deltaReady.has(connection) }));
3005
- chunk3DCTQKPQ_cjs.endShell(host, old);
3005
+ chunkE6YAYR7G_cjs.endShell(host, old);
3006
3006
  old.connections.clear();
3007
3007
  old.shell.dispose();
3008
3008
  cell.live = built.live;
3009
3009
  cell.changes = built.changes;
3010
3010
  registerLiving(host, cell);
3011
- for (const { connection, wants } of carried) chunk3DCTQKPQ_cjs.attach(built.live, connection, host.delta && wants);
3011
+ for (const { connection, wants } of carried) chunkE6YAYR7G_cjs.attach(built.live, connection, host.delta && wants);
3012
3012
  };
3013
3013
  var resetCell = (host, cell) => {
3014
- const turn = (cell.resetting ?? Promise.resolve()).then(() => replaceShell(host, cell));
3014
+ if (cell.hasWaitingReset === true) return;
3015
+ cell.hasWaitingReset = true;
3016
+ const turn = (cell.resetting ?? Promise.resolve()).then(() => {
3017
+ cell.hasWaitingReset = false;
3018
+ return replaceShell(host, cell);
3019
+ });
3015
3020
  cell.resetting = turn.catch((error) => console.error("[moss/shells] a reset failed to rebuild", error));
3016
3021
  };
3017
3022
  var shellsOf = (host, principal) => {
@@ -3046,7 +3051,7 @@ var snapshotOf = (host) => async (token, principal, options) => {
3046
3051
  const settled = await settle(live, waitMs);
3047
3052
  return { ...read(live), seed, settled, ...needOf(live, principal, kept) };
3048
3053
  } finally {
3049
- chunk3DCTQKPQ_cjs.endShell(host, live);
3054
+ chunkE6YAYR7G_cjs.endShell(host, live);
3050
3055
  live.shell.dispose();
3051
3056
  }
3052
3057
  };
@@ -3078,9 +3083,9 @@ var createShellHost = (config) => {
3078
3083
  const handedOut = {
3079
3084
  session: async (token, principal, options) => {
3080
3085
  if (principal === null || !host.kept) {
3081
- return chunk3DCTQKPQ_cjs.sessionOn(host, await open2(host, { token, principal, ...options !== void 0 ? { opening: options } : {} }, false), true, reset);
3086
+ return chunkE6YAYR7G_cjs.sessionOn(host, await open2(host, { token, principal, ...options !== void 0 ? { opening: options } : {} }, false), true, reset);
3082
3087
  }
3083
- return chunk3DCTQKPQ_cjs.sessionOn(host, await keptCell(host, token, principal), false, reset);
3088
+ return chunkE6YAYR7G_cjs.sessionOn(host, await keptCell(host, token, principal), false, reset);
3084
3089
  },
3085
3090
  snapshot: snapshotOf(host),
3086
3091
  deliver: deliverTo(host),
@@ -3121,7 +3126,8 @@ var hostConfig = (deps, shell, kept) => {
3121
3126
  ...app.phrases !== void 0 ? { phrases: app.phrases } : {},
3122
3127
  ...app.functions !== void 0 ? { functions: app.functions } : {},
3123
3128
  ...app.onSession !== void 0 ? { onSession: app.onSession } : {},
3124
- ...app.runs !== void 0 ? { runs: app.runs } : {}
3129
+ ...app.runs !== void 0 ? { runs: app.runs } : {},
3130
+ ...app.reconcilers !== void 0 ? { reconcilers: app.reconcilers } : {}
3125
3131
  },
3126
3132
  ...app.phraseKeys !== void 0 ? { phraseKeys: app.phraseKeys } : {},
3127
3133
  kept,
@@ -3286,14 +3292,18 @@ var operatorPrefix = (runtime) => {
3286
3292
  guardOperator(operator, { key: runtime.operatorKey ?? "", gate: runtime.operatorGate });
3287
3293
  return operator;
3288
3294
  };
3289
- var buildSignals = ({ fabric, identity, reset, adopt: adopt2, deliver }) => {
3295
+ var buildSignals = ({ fabric, identity, reset, adopt: adopt2, adoptAll: adoptAll2, deliver }) => {
3290
3296
  const origin = crypto$1.randomBytes(8).toString("hex");
3291
3297
  const applyInvalidateIdentity = (principal) => {
3292
3298
  const held = identity.invalidate(principal);
3293
3299
  reset(principal);
3294
3300
  return held;
3295
3301
  };
3296
- const applyInvalidateTag = (tag) => identity.invalidateTag(tag).length;
3302
+ const applyInvalidateTag = (tag) => {
3303
+ const forgotten = identity.invalidateTag(tag).length;
3304
+ adoptAll2();
3305
+ return forgotten;
3306
+ };
3297
3307
  const applyNudge = (principal, channel) => {
3298
3308
  deliver(principal, channel);
3299
3309
  };
@@ -3376,7 +3386,7 @@ var wireFabric = (fabric, origin, apply) => {
3376
3386
 
3377
3387
  // src/server/server.ts
3378
3388
  var createServerWith = async (app, runtime, dataOf) => {
3379
- chunk3DCTQKPQ_cjs.receiveManifest(app);
3389
+ chunkE6YAYR7G_cjs.receiveManifest(app);
3380
3390
  const session = sessionVerifierOf(runtime);
3381
3391
  const revokeSessions = sessionRevokerOf(runtime);
3382
3392
  const data = await dataOf(app, runtime);
@@ -3435,7 +3445,7 @@ var assemble = async ({ app, runtime, session, revokeSessions, data }, stops) =>
3435
3445
  mountRoutes(server, { app, session, credentials: registered.credentials, identity, running, data });
3436
3446
  const hosts = buildShellHosts({ app, runtime, identity, running, data, savedAs: saved.of, wire: createInternalWire(server), wrapWire: composeWireWraps(registered), revokeSessions });
3437
3447
  stops.push(hosts.stop);
3438
- const signals = buildSignals({ fabric: runtime.fabric, identity, reset: hosts.reset, adopt: hosts.adoptFor, deliver: hosts.deliver });
3448
+ const signals = buildSignals({ fabric: runtime.fabric, identity, reset: hosts.reset, adopt: hosts.adoptFor, adoptAll: hosts.adopt, deliver: hosts.deliver });
3439
3449
  running.onChange(() => {
3440
3450
  identity.invalidateAll();
3441
3451
  hosts.adopt();
@@ -3562,5 +3572,5 @@ exports.mintSession = mintSession;
3562
3572
  exports.renderDocument = renderDocument;
3563
3573
  exports.revokeAllFor = revokeAllFor;
3564
3574
  exports.sessionCookies = sessionCookies;
3565
- //# sourceMappingURL=chunk-TMDKNZYL.cjs.map
3566
- //# sourceMappingURL=chunk-TMDKNZYL.cjs.map
3575
+ //# sourceMappingURL=chunk-QB7U2JDQ.cjs.map
3576
+ //# sourceMappingURL=chunk-QB7U2JDQ.cjs.map