@ai-matrx/summon 0.1.7 → 0.1.9

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 (50) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/dist/gate-CfjdNWP6.d.cts +397 -0
  3. package/dist/gate-CfjdNWP6.d.ts +397 -0
  4. package/dist/handles.cjs +1 -0
  5. package/dist/handles.cjs.map +1 -1
  6. package/dist/handles.d.cts +3 -61
  7. package/dist/handles.d.ts +3 -61
  8. package/dist/handles.js +1 -0
  9. package/dist/handles.js.map +1 -1
  10. package/dist/helpers-2NY1ha0V.d.cts +63 -0
  11. package/dist/helpers-2NY1ha0V.d.ts +63 -0
  12. package/dist/index.cjs +194 -159
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +12 -350
  15. package/dist/index.d.ts +12 -350
  16. package/dist/index.js +200 -165
  17. package/dist/index.js.map +1 -1
  18. package/dist/instanceBody-CgZAFnic.d.cts +23 -0
  19. package/dist/instanceBody-CgZAFnic.d.ts +23 -0
  20. package/dist/open.cjs +408 -0
  21. package/dist/open.cjs.map +1 -0
  22. package/dist/open.d.cts +23 -0
  23. package/dist/open.d.ts +23 -0
  24. package/dist/open.js +375 -0
  25. package/dist/open.js.map +1 -0
  26. package/dist/react.cjs +249 -352
  27. package/dist/react.cjs.map +1 -1
  28. package/dist/react.d.cts +11 -151
  29. package/dist/react.d.ts +11 -151
  30. package/dist/react.js +210 -306
  31. package/dist/react.js.map +1 -1
  32. package/dist/root.cjs +277 -0
  33. package/dist/root.cjs.map +1 -0
  34. package/dist/root.d.cts +175 -0
  35. package/dist/root.d.ts +175 -0
  36. package/dist/root.js +254 -0
  37. package/dist/root.js.map +1 -0
  38. package/dist/window-host.cjs +11 -2
  39. package/dist/window-host.cjs.map +1 -1
  40. package/dist/window-host.d.cts +1 -0
  41. package/dist/window-host.d.ts +1 -0
  42. package/dist/window-host.js +11 -2
  43. package/dist/window-host.js.map +1 -1
  44. package/dist/window.cjs +2 -1
  45. package/dist/window.cjs.map +1 -1
  46. package/dist/window.d.cts +3 -2
  47. package/dist/window.d.ts +3 -2
  48. package/dist/window.js +2 -1
  49. package/dist/window.js.map +1 -1
  50. package/package.json +28 -5
package/dist/open.js ADDED
@@ -0,0 +1,375 @@
1
+ // src/core/types.ts
2
+ var DEFAULT_INSTANCE_ID = "default";
3
+ function instanceKey(overlayId, instanceId = DEFAULT_INSTANCE_ID) {
4
+ return `${overlayId}:${instanceId}`;
5
+ }
6
+ function parseInstanceKey(key) {
7
+ const at = key.indexOf(":");
8
+ if (at <= 0 || at === key.length - 1) return null;
9
+ return { overlayId: key.slice(0, at), instanceId: key.slice(at + 1) };
10
+ }
11
+ function defaultWindowIdFor(meta) {
12
+ return meta.window?.windowId ?? meta.id;
13
+ }
14
+
15
+ // src/core/ports.ts
16
+ var noop = () => {
17
+ };
18
+ var anonymousIdentity = {
19
+ current: () => ({ key: "anonymous", ready: true }),
20
+ subscribe: () => noop
21
+ };
22
+ var locationRouter = {
23
+ pathname: () => typeof window === "undefined" ? "/" : window.location.pathname,
24
+ search: () => typeof window === "undefined" ? "" : window.location.search,
25
+ replaceSearch: (nextSearch) => {
26
+ if (typeof window === "undefined") return;
27
+ const query = nextSearch && !nextSearch.startsWith("?") ? `?${nextSearch}` : nextSearch;
28
+ const url = `${window.location.pathname}${query}${window.location.hash}`;
29
+ window.history.replaceState(window.history.state, "", url);
30
+ },
31
+ subscribe: (listener) => {
32
+ if (typeof window === "undefined") return noop;
33
+ window.addEventListener("popstate", listener);
34
+ return () => window.removeEventListener("popstate", listener);
35
+ }
36
+ };
37
+ var consoleNotify = {
38
+ info: (message) => console.info(`[summon] ${message}`),
39
+ warn: (message) => console.warn(`[summon] ${message}`),
40
+ error: (message) => console.error(`[summon] ${message}`)
41
+ };
42
+ var consoleErrorSink = {
43
+ capture: (error, context) => console.error("[summon]", error, context)
44
+ };
45
+ var debugOff = { enabled: () => false };
46
+ var DEFAULT_PORTS = {
47
+ identity: anonymousIdentity,
48
+ router: locationRouter,
49
+ notify: consoleNotify,
50
+ errors: consoleErrorSink,
51
+ debug: debugOff,
52
+ persistence: null
53
+ };
54
+ function resolvePorts(overrides) {
55
+ return { ...DEFAULT_PORTS, ...overrides };
56
+ }
57
+
58
+ // src/core/registry.ts
59
+ import { globalSlot } from "@ai-matrx/kit/global-slot";
60
+ var state = () => globalSlot("ai-matrx.summon.registry", () => ({
61
+ byId: /* @__PURE__ */ new Map(),
62
+ byLinkKey: /* @__PURE__ */ new Map(),
63
+ listeners: /* @__PURE__ */ new Set()
64
+ }));
65
+ function registerOverlayMeta(definitions) {
66
+ const s = state();
67
+ for (const def of definitions) {
68
+ s.byId.set(def.id, def);
69
+ const keys = def.link ? [def.link.key, ...def.link.aliases ?? []] : [];
70
+ for (const key of keys) {
71
+ const holder = s.byLinkKey.get(key);
72
+ if (holder && holder.id !== def.id) {
73
+ throw new Error(`[summon] link key "${key}" is claimed by both "${holder.id}" and "${def.id}"`);
74
+ }
75
+ s.byLinkKey.set(key, def);
76
+ }
77
+ }
78
+ for (const listener of s.listeners) listener();
79
+ }
80
+ function getOverlayMeta(overlayId) {
81
+ return state().byId.get(overlayId);
82
+ }
83
+ function getOverlayMetaByLinkKey(linkKey) {
84
+ return state().byLinkKey.get(linkKey);
85
+ }
86
+ function allOverlayMeta() {
87
+ return [...state().byId.values()];
88
+ }
89
+ function isRegisteredOverlay(overlayId) {
90
+ return state().byId.has(overlayId);
91
+ }
92
+ function subscribeToOverlayRegistry(listener) {
93
+ const s = state();
94
+ s.listeners.add(listener);
95
+ return () => s.listeners.delete(listener);
96
+ }
97
+ function resetOverlayRegistry() {
98
+ const s = state();
99
+ s.byId.clear();
100
+ s.byLinkKey.clear();
101
+ }
102
+
103
+ // src/open/actions.ts
104
+ function creator(type, build) {
105
+ const create = (...args) => ({ type, payload: build(...args) });
106
+ return Object.assign(create, {
107
+ type,
108
+ toString: () => type,
109
+ match: (action) => typeof action === "object" && action !== null && action.type === type
110
+ });
111
+ }
112
+ function isPlainRecord(value) {
113
+ return typeof value === "object" && value !== null && !Array.isArray(value);
114
+ }
115
+ function stripFunctions(overlayId, data) {
116
+ if (!isPlainRecord(data)) return data;
117
+ const offenders = Object.keys(data).filter((key) => typeof data[key] === "function");
118
+ if (offenders.length === 0) return data;
119
+ console.error(
120
+ `[summon] BUG: function value(s) in openOverlay data for "${overlayId}" (keys: ${offenders.join(", ")}). Functions cannot travel through Redux \u2014 the handler would NEVER fire. Register a handle (@ai-matrx/summon/handles) and pass its id string instead. The offending key(s) were stripped from state.`
121
+ );
122
+ const cleaned = { ...data };
123
+ for (const key of offenders) delete cleaned[key];
124
+ return cleaned;
125
+ }
126
+ function rawOpen(payload) {
127
+ const raw = { overlayId: payload.overlayId };
128
+ if (payload.instanceId !== void 0) raw.instanceId = payload.instanceId;
129
+ if (payload.data !== void 0) raw.data = stripFunctions(payload.overlayId, payload.data);
130
+ const defaults = getOverlayMeta(payload.overlayId)?.defaults;
131
+ if (isPlainRecord(defaults)) raw.defaults = stripFunctions(payload.overlayId, defaults);
132
+ return raw;
133
+ }
134
+ var O = "overlays/";
135
+ var openOverlay = creator(O + "openOverlay", (payload) => rawOpen(payload));
136
+ var closeOverlay = creator(
137
+ O + "closeOverlay",
138
+ (payload) => payload.instanceId === void 0 ? { overlayId: payload.overlayId } : { overlayId: payload.overlayId, instanceId: payload.instanceId }
139
+ );
140
+ var toggleOverlay = creator(O + "toggleOverlay", (payload) => rawOpen(payload));
141
+ var closeAllInstancesOfOverlay = creator(
142
+ O + "closeAllInstancesOfOverlay",
143
+ (payload) => ({ overlayId: payload.overlayId })
144
+ );
145
+ function overlayIdsBoundToPage() {
146
+ return allOverlayMeta().filter((meta) => meta.closesOnNavigation === true).map((meta) => meta.id);
147
+ }
148
+ var closeOverlaysBoundToPage = creator(
149
+ O + "closeOverlaysBoundToPage",
150
+ (payload) => ({
151
+ overlayIds: [...payload?.overlayIds ?? overlayIdsBoundToPage()]
152
+ })
153
+ );
154
+ var closeAllOverlays = creator(O + "closeAllOverlays", () => void 0);
155
+ var pruneStaleInstances = creator(O + "pruneStaleInstances", (payload) => payload);
156
+ var W = "windowManager/";
157
+ var pass = () => (payload) => payload;
158
+ var focusWindow = creator(W + "focusWindow", pass());
159
+ var restoreWindow = creator(W + "restoreWindow", pass());
160
+ var toggleWindowsHidden = creator(W + "toggleWindowsHidden", () => void 0);
161
+ var restoreAll = creator(W + "restoreAll", () => void 0);
162
+ var minimizeAll = creator(W + "minimizeAll", pass());
163
+ var SUMMON_SLICE_KEYS = ["overlays", "windowManager", "urlSync", "overlayState"];
164
+ function isSummonAction(action) {
165
+ if (typeof action !== "object" || action === null) return false;
166
+ const type = action.type;
167
+ if (typeof type !== "string") return false;
168
+ const slash = type.indexOf("/");
169
+ return slash > 0 && SUMMON_SLICE_KEYS.includes(type.slice(0, slash));
170
+ }
171
+
172
+ // src/open/selectors.ts
173
+ import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
174
+ var CLOSED = Object.freeze({ isOpen: false, data: null });
175
+ var EMPTY = Object.freeze([]);
176
+ var selectOverlay = (state2, overlayId, instanceId = DEFAULT_INSTANCE_ID) => state2.overlays?.overlays[overlayId]?.[instanceId] ?? CLOSED;
177
+ var selectIsOverlayOpen = (state2, overlayId, instanceId = DEFAULT_INSTANCE_ID) => selectOverlay(state2, overlayId, instanceId).isOpen;
178
+ var selectOverlayData = (state2, overlayId, instanceId = DEFAULT_INSTANCE_ID) => selectOverlay(state2, overlayId, instanceId).data;
179
+ var openCache = () => globalSlot2("ai-matrx.summon.openInstances", () => /* @__PURE__ */ new Map());
180
+ var selectOpenInstances = (state2, overlayId) => {
181
+ const bucket = state2.overlays?.overlays[overlayId];
182
+ const cache = openCache();
183
+ const hit = cache.get(overlayId);
184
+ if (hit && hit.bucket === bucket) return hit.result;
185
+ let result = EMPTY;
186
+ if (bucket) {
187
+ const open = [];
188
+ for (const [instanceId, inst] of Object.entries(bucket)) if (inst.isOpen) open.push({ instanceId, data: inst.data });
189
+ if (open.length > 0) result = open;
190
+ }
191
+ cache.set(overlayId, { bucket, result });
192
+ return result;
193
+ };
194
+ function listOpenInstanceKeys(state2) {
195
+ const keys = [];
196
+ for (const [overlayId, bucket] of Object.entries(state2.overlays?.overlays ?? {})) {
197
+ for (const [instanceId, inst] of Object.entries(bucket)) if (inst.isOpen) keys.push(`${overlayId}:${instanceId}`);
198
+ }
199
+ return keys;
200
+ }
201
+ function selectAnyOverlayTouched(state2) {
202
+ for (const _ in state2.overlays?.overlays ?? {}) return true;
203
+ return false;
204
+ }
205
+ var selectWindowsHidden = (state2) => state2.windowManager?.windowsHidden ?? false;
206
+
207
+ // src/open/gate.ts
208
+ import { globalSlot as globalSlot3 } from "@ai-matrx/kit/global-slot";
209
+ var SUMMON_INSTALLED_ACTION = "@@summon/installed";
210
+ var slot = () => globalSlot3("ai-matrx.summon.gate", () => ({ core: null, loading: null, gates: /* @__PURE__ */ new Set(), listeners: /* @__PURE__ */ new Set() }));
211
+ function installSummonCore(core) {
212
+ const s = slot();
213
+ if (s.core) return;
214
+ s.core = core;
215
+ const gates = [...s.gates];
216
+ s.gates.clear();
217
+ for (const gate of gates) gate.install(core);
218
+ for (const listener of [...s.listeners]) listener();
219
+ }
220
+ function isSummonInstalled() {
221
+ return slot().core !== null;
222
+ }
223
+ function subscribeSummonInstalled(listener) {
224
+ const s = slot();
225
+ s.listeners.add(listener);
226
+ return () => s.listeners.delete(listener);
227
+ }
228
+ function ensureSummonRuntime() {
229
+ const s = slot();
230
+ if (s.core) return Promise.resolve();
231
+ s.loading ??= import("@ai-matrx/summon").then(
232
+ (core) => installSummonCore(core.summonCore),
233
+ (error) => {
234
+ s.loading = null;
235
+ throw error;
236
+ }
237
+ );
238
+ return s.loading;
239
+ }
240
+ function prefetchSummonRuntime() {
241
+ ensureSummonRuntime().catch(() => void 0);
242
+ }
243
+ function createSummonGate(options = {}) {
244
+ let inject = null;
245
+ let injected = false;
246
+ let api = null;
247
+ let next = null;
248
+ let chain = null;
249
+ const queue = [];
250
+ const settle = (core2, live) => {
251
+ if (inject && !injected) {
252
+ inject(core2.reducers);
253
+ injected = true;
254
+ }
255
+ if (!api || !next || chain) return;
256
+ const store = api;
257
+ let composed = next;
258
+ for (const middleware2 of [...core2.createMiddleware(options.ports)].reverse()) {
259
+ composed = middleware2(store)(composed);
260
+ }
261
+ chain = composed;
262
+ const flush = () => {
263
+ if (live) store.dispatch({ type: SUMMON_INSTALLED_ACTION });
264
+ for (const action of queue.splice(0)) store.dispatch(action);
265
+ };
266
+ if (live) flush();
267
+ else if (queue.length > 0) queueMicrotask(flush);
268
+ };
269
+ const internals = { install: (core2) => settle(core2, true) };
270
+ const core = () => slot().core;
271
+ const middleware = (storeApi) => {
272
+ api = storeApi;
273
+ return (nextDispatch) => {
274
+ next = nextDispatch;
275
+ const loaded = core();
276
+ if (loaded) settle(loaded, false);
277
+ else slot().gates.add(internals);
278
+ return (action) => {
279
+ if (chain) return chain(action);
280
+ if (!isSummonAction(action)) return nextDispatch(action);
281
+ queue.push(action);
282
+ void ensureSummonRuntime().catch((error) => {
283
+ console.error("[summon] the overlay runtime failed to load; queued requests are kept for the next try", error);
284
+ });
285
+ return action;
286
+ };
287
+ };
288
+ };
289
+ return {
290
+ middleware,
291
+ attachReducer(fn) {
292
+ inject = fn;
293
+ const loaded = core();
294
+ if (loaded) {
295
+ inject(loaded.reducers);
296
+ injected = true;
297
+ }
298
+ }
299
+ };
300
+ }
301
+
302
+ // src/open/channels.ts
303
+ import { globalSlot as globalSlot4 } from "@ai-matrx/kit/global-slot";
304
+ var pending = () => globalSlot4("ai-matrx.summon.pendingChannels", () => /* @__PURE__ */ new Map());
305
+ function materializePendingChannels(createEventChannel) {
306
+ const map = pending();
307
+ for (const [id, entry] of [...map]) {
308
+ map.delete(id);
309
+ const channel = createEventChannel({ owner: entry.owner, id });
310
+ channel.subscribe((message) => entry.getHandlers()?.[message.type]?.(message.payload));
311
+ }
312
+ }
313
+ function openPendingEventChannel(owner, getHandlers) {
314
+ const id = `ch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
315
+ pending().set(id, { owner, getHandlers });
316
+ void import("@ai-matrx/summon/handles").then(({ createEventChannel }) => materializePendingChannels(createEventChannel));
317
+ return id;
318
+ }
319
+ function dropPendingChannelsOf(owner) {
320
+ const map = pending();
321
+ for (const [id, entry] of [...map]) if (entry.owner === owner) map.delete(id);
322
+ }
323
+ export {
324
+ DEFAULT_INSTANCE_ID,
325
+ DEFAULT_PORTS,
326
+ SUMMON_INSTALLED_ACTION,
327
+ SUMMON_SLICE_KEYS,
328
+ allOverlayMeta,
329
+ anonymousIdentity,
330
+ closeAllInstancesOfOverlay,
331
+ closeAllOverlays,
332
+ closeOverlay,
333
+ closeOverlaysBoundToPage,
334
+ consoleErrorSink,
335
+ consoleNotify,
336
+ createSummonGate,
337
+ debugOff,
338
+ defaultWindowIdFor,
339
+ dropPendingChannelsOf,
340
+ ensureSummonRuntime,
341
+ focusWindow,
342
+ getOverlayMeta,
343
+ getOverlayMetaByLinkKey,
344
+ installSummonCore,
345
+ instanceKey,
346
+ isRegisteredOverlay,
347
+ isSummonAction,
348
+ isSummonInstalled,
349
+ listOpenInstanceKeys,
350
+ locationRouter,
351
+ materializePendingChannels,
352
+ minimizeAll,
353
+ openOverlay,
354
+ openPendingEventChannel,
355
+ overlayIdsBoundToPage,
356
+ parseInstanceKey,
357
+ prefetchSummonRuntime,
358
+ pruneStaleInstances,
359
+ registerOverlayMeta,
360
+ resetOverlayRegistry,
361
+ resolvePorts,
362
+ restoreAll,
363
+ restoreWindow,
364
+ selectAnyOverlayTouched,
365
+ selectIsOverlayOpen,
366
+ selectOpenInstances,
367
+ selectOverlay,
368
+ selectOverlayData,
369
+ selectWindowsHidden,
370
+ subscribeSummonInstalled,
371
+ subscribeToOverlayRegistry,
372
+ toggleOverlay,
373
+ toggleWindowsHidden
374
+ };
375
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/types.ts","../src/core/ports.ts","../src/core/registry.ts","../src/open/actions.ts","../src/open/selectors.ts","../src/open/gate.ts","../src/open/channels.ts"],"sourcesContent":["/**\n * The shared vocabulary of @ai-matrx/summon. Framework-free: no React, no Redux imports.\n *\n * An OVERLAY is any component rendered on top of the app by dispatch — a window, dialog, sheet,\n * light floating window, toast-like card, anything. It is identified by an `OverlayId` and opened\n * as one or more INSTANCES (`instanceId`, \"default\" for single-instance overlays).\n */\n\n/**\n * The host's overlay registry: overlay id → the data its opener accepts. Hosts extend it by\n * module augmentation so every open call is type-checked:\n *\n * declare module \"@ai-matrx/summon\" {\n * interface OverlayRegistry { notesWindow: { noteId?: string } }\n * }\n *\n * `defineOverlay` emits nothing at runtime for this; the augmentation is the host's one-line\n * declaration per overlay (the converter writes it next to each definition).\n */\n// Declared in ./augment (bundled only into the core's declarations, so `declare module\n// \"@ai-matrx/summon\"` merges into it); every section reads it through the package name.\nimport type { OverlayRegistry, OverlayHostTypes } from \"@ai-matrx/summon\";\nexport type { OverlayRegistry, OverlayHostTypes };\n\n/** Every registered overlay id; plain `string` until the host augments the registry. */\nexport type OverlayId = [keyof OverlayRegistry] extends [never]\n ? string\n : Extract<keyof OverlayRegistry, string>;\n\n/** The open-data type declared for an overlay id. */\nexport type OverlayDataOf<Id extends string> = Id extends keyof OverlayRegistry\n ? OverlayRegistry[Id]\n : Record<string, unknown>;\n\n/**\n * Data as it arrives at render time. It crossed Redux, a URL or storage, so it is NOT trusted to\n * match the opener's type: render code narrows it (or the definition supplies `parse`).\n */\nexport type OverlayRawData = Readonly<Record<string, unknown>> | null;\n\nexport const DEFAULT_INSTANCE_ID = \"default\";\n\n/** `single`: one instance (\"default\"). `multi`: any number, each with its own instanceId. */\nexport type InstanceMode = \"single\" | \"multi\";\n\n/**\n * What closing does to a mounted overlay (Arman, 2026-10-16, C38 R3):\n * none — unmount (default).\n * hidden — stay mounted but hidden; reopening shows the same live component (LRU-capped).\n * restore — unmount, but values saved with `useOverlayState` come back on reopen.\n * Minimizing a window always keeps its component mounted, whatever this says.\n */\nexport type KeepAlive = \"none\" | \"hidden\" | \"restore\";\n\n/** `overlayId:instanceId` — the one key every subsystem uses for an open instance. */\nexport type InstanceKey = `${string}:${string}`;\n\nexport function instanceKey(overlayId: string, instanceId: string = DEFAULT_INSTANCE_ID): InstanceKey {\n return `${overlayId}:${instanceId}`;\n}\n\nexport function parseInstanceKey(key: string): { overlayId: string; instanceId: string } | null {\n const at = key.indexOf(\":\");\n if (at <= 0 || at === key.length - 1) return null;\n return { overlayId: key.slice(0, at), instanceId: key.slice(at + 1) };\n}\n\n// ── Window options (consumed by the window surface; inert for other surfaces) ──────────────────\n\nexport type MobilePresentation = \"fullscreen\" | \"drawer\" | \"card\" | \"hidden\";\n\n/**\n * Default-deny allowlist of the open data a window may save and restore. A window with no\n * preservation entry restores geometry only.\n */\nexport interface WindowPreservation {\n readonly dataKeys: readonly string[];\n readonly requiredDataKeys?: readonly string[];\n readonly allowedDataValues?: Readonly<Record<string, readonly (string | number | boolean | null)[]>>;\n /** Default 32 KiB. */\n readonly maxDataBytes?: number;\n}\n\n/** One declared home for an unbidden (system-raised) window: a route prefix, or one exact page. */\nexport type UnbiddenHomeRoute = string | { readonly route: string; readonly exact: true };\n\nexport interface OverlayWindowOptions {\n readonly mobile?: MobilePresentation;\n readonly mobileSidebarAs?: \"drawer\" | \"inline\";\n /** Never saved or restored (debug panels, one-shot tools, callback-bound editors). */\n readonly ephemeral?: boolean;\n readonly preservation?: WindowPreservation;\n /**\n * Values merged under saved data when a window is RESTORED (reload, another device). Unlike the\n * definition's `defaults`, never applied to a normal open.\n */\n readonly restoreDefaults?: Readonly<Record<string, unknown>>;\n /**\n * The window-manager id the WindowPanel registers under for the default instance. Default: the\n * overlay id. The render watchdog reveals and inspects this id until the panel acks its own.\n */\n readonly windowId?: string;\n readonly deprecated?: { readonly replacement?: string; readonly reason?: string };\n /**\n * Where a window nobody opened (system-raised) may raise itself. Default deny: no home → it may\n * not raise itself anywhere (`mayRaiseUnbidden` in the window section).\n */\n readonly unbiddenHome?: readonly UnbiddenHomeRoute[];\n}\n\n// ── Host types (augmentable) ────────────────────────────────────────────────────────────────\n\n/**\n * Host-specific types the package passes through untouched. A Redux host augments `dispatch`\n * with its thunk-aware dispatch so link hydrators can dispatch its thunks without casts:\n *\n * declare module \"@ai-matrx/summon\" { interface OverlayHostTypes { dispatch: AppDispatch } }\n */\nexport type OverlayHostDispatch = OverlayHostTypes extends { dispatch: infer D } ? D : (action: unknown) => unknown;\n\n// ── Links (address-bar references) ──────────────────────────────────────────────────────────\n\nexport interface LinkHydrateContext<Data> {\n /** The id segment of the link token (`notes:<id>`). */\n readonly id: string;\n /** Decoded `k-v` arguments of the token. */\n readonly args: Readonly<Record<string, string>>;\n /** Open this overlay. */\n open(options?: { readonly instanceId?: string; readonly data?: Data }): void;\n /** The host store's dispatch, for thunks a hydrator needs (loading a record first). Typed by\n * augmenting `OverlayHostTypes` with the host's dispatch type. */\n readonly dispatch: OverlayHostDispatch;\n}\n\nexport interface OverlayLinkSpec<Data> {\n /** The token type key in `?panels=key:id`. Unique across the host. */\n readonly key: string;\n /** Older keys that still resolve to this overlay. */\n readonly aliases?: readonly string[];\n /** Turn a link token into an open overlay (and its data). `\"refused\"` keeps the token and says why. */\n hydrate(context: LinkHydrateContext<Data>): void | \"refused\" | Promise<void | \"refused\">;\n}\n\n// ── Definitions (framework-free half; the React half adds `render`) ─────────────────────────\n\nexport interface OverlayDefinitionMeta<Id extends string = string, Data = Record<string, unknown>> {\n readonly id: Id;\n /** Human label: tray, menus, diagnostics. */\n readonly label: string;\n readonly instance?: InstanceMode;\n readonly keepAlive?: KeepAlive;\n /** Close when the route changes — the overlay shows a piece of the page that opened it. */\n readonly closesOnNavigation?: boolean;\n /** Present only for overlays that render a WindowPanel. */\n readonly window?: OverlayWindowOptions;\n readonly link?: OverlayLinkSpec<Data>;\n /** Defaults merged under open data (replaces the old per-overlay schema registry). */\n readonly defaults?: Partial<Data>;\n}\n\n/** The window-manager id a singleton window overlay registers under (`window.windowId ?? id`). */\nexport function defaultWindowIdFor(meta: Pick<OverlayDefinitionMeta, \"id\" | \"window\">): string {\n return meta.window?.windowId ?? meta.id;\n}\n","/**\n * Everything the overlays system needs from its host, as ports. Every port ships a working\n * default, so a bare host gets a working system with zero wiring (package standard rule 8); a\n * host overrides only what it has: identity, navigation, notifications, error sink, debug flag,\n * persistence. Framework-free.\n */\n\nexport type Unsubscribe = () => void;\n\n/** Who the person is, for isolating saved state. `key` changes → everything saved is swapped. */\nexport interface IdentityPort {\n current(): { readonly key: string; readonly ready: boolean };\n subscribe(listener: () => void): Unsubscribe;\n}\n\n/** The address bar: route changes (close-on-navigation) and the `?panels=` link channel. */\nexport interface RouterPort {\n pathname(): string;\n search(): string;\n /** Replace the query string without navigating or remounting the page. */\n replaceSearch(nextSearch: string): void;\n subscribe(listener: () => void): Unsubscribe;\n}\n\nexport interface NotifyOptions {\n readonly id?: string;\n readonly description?: string;\n /** How long the notice stays up (ms). Hosts without timed notices ignore it. */\n readonly duration?: number;\n /** One action button (e.g. the render watchdog's \"Show it\"). Hosts without actions ignore it. */\n readonly action?: { readonly label: string; readonly onClick: () => void };\n}\n\nexport interface NotifyPort {\n info(message: string, options?: NotifyOptions): void;\n warn(message: string, options?: NotifyOptions): void;\n error(message: string, options?: NotifyOptions): void;\n /** Withdraw a notice by id (optional). */\n dismiss?(id: string): void;\n}\n\nexport interface ErrorSinkPort {\n capture(error: unknown, context: Readonly<Record<string, unknown>>): void;\n}\n\nexport interface DebugPort {\n enabled(): boolean;\n subscribe?(listener: () => void): Unsubscribe;\n}\n\n/** A stored value with its optimistic-concurrency version (0 when the store has none). */\nexport interface StoredValue<T = unknown> {\n readonly value: T;\n readonly version: number;\n}\n\n/**\n * Where saved overlay state lives when persistence is on. Keys are already scoped to the\n * identity by the caller (`<identityKey>/<key>`) for stores that are not per-person themselves.\n * Implementations: the browser-local store (`./persistence`), `@ai-matrx/data` over\n * `users.user_surface_state` (`./persistence/data`), or any host database.\n */\nexport interface OverlayPersistencePort {\n /**\n * True when the store is per-person itself (rows scoped to the signed-in person, e.g. the\n * `@ai-matrx/data` adapter): the persistence section then passes plain keys (`workspace`,\n * `state:<instanceKey>`) instead of `<identityKey>/<key>`, and defaults to `scope: \"person\"`.\n */\n readonly perPerson?: boolean;\n load<T = unknown>(key: string): Promise<StoredValue<T> | null>;\n save<T = unknown>(key: string, value: T, options?: { readonly expectedVersion?: number }): Promise<{ readonly version: number }>;\n remove(key: string): Promise<void>;\n list?(prefix: string): Promise<readonly string[]>;\n /**\n * Every saved value at once (key → value), for stores where one read is cheaper than several.\n * When present, restoring an identity costs exactly this one call: the workspace and every\n * saved component state come out of it, and `load`/`list` are not called on boot.\n */\n loadAll?(): Promise<ReadonlyMap<string, StoredValue>>;\n}\n\nexport interface SummonPorts {\n readonly identity: IdentityPort;\n readonly router: RouterPort;\n readonly notify: NotifyPort;\n readonly errors: ErrorSinkPort;\n readonly debug: DebugPort;\n /** `null` = persistence off (R6). */\n readonly persistence: OverlayPersistencePort | null;\n}\n\nconst noop = (): void => {};\n\nexport const anonymousIdentity: IdentityPort = {\n current: () => ({ key: \"anonymous\", ready: true }),\n subscribe: () => noop,\n};\n\n/** `window.location` + `history.replaceState`; inert on the server. */\nexport const locationRouter: RouterPort = {\n pathname: () => (typeof window === \"undefined\" ? \"/\" : window.location.pathname),\n search: () => (typeof window === \"undefined\" ? \"\" : window.location.search),\n replaceSearch: (nextSearch) => {\n if (typeof window === \"undefined\") return;\n const query = nextSearch && !nextSearch.startsWith(\"?\") ? `?${nextSearch}` : nextSearch;\n const url = `${window.location.pathname}${query}${window.location.hash}`;\n window.history.replaceState(window.history.state, \"\", url);\n },\n subscribe: (listener) => {\n if (typeof window === \"undefined\") return noop;\n window.addEventListener(\"popstate\", listener);\n return () => window.removeEventListener(\"popstate\", listener);\n },\n};\n\n/* eslint-disable no-console */\nexport const consoleNotify: NotifyPort = {\n info: (message) => console.info(`[summon] ${message}`),\n warn: (message) => console.warn(`[summon] ${message}`),\n error: (message) => console.error(`[summon] ${message}`),\n};\n\nexport const consoleErrorSink: ErrorSinkPort = {\n capture: (error, context) => console.error(\"[summon]\", error, context),\n};\n/* eslint-enable no-console */\n\nexport const debugOff: DebugPort = { enabled: () => false };\n\nexport const DEFAULT_PORTS: SummonPorts = {\n identity: anonymousIdentity,\n router: locationRouter,\n notify: consoleNotify,\n errors: consoleErrorSink,\n debug: debugOff,\n persistence: null,\n};\n\nexport function resolvePorts(overrides: Partial<SummonPorts> | undefined): SummonPorts {\n return { ...DEFAULT_PORTS, ...overrides };\n}\n","/**\n * The process-wide registry of overlay definition metadata (the framework-free half of each\n * definition). The host registers its definitions once (`<SummonHost definitions>` does it);\n * reducers stay pure — middleware and hooks read this registry and put what reducers need in the\n * action payload (e.g. the ids bound to the page).\n *\n * State lives in a global slot so a duplicated module graph (ESM + CJS, unsplit bundles) sees one\n * registry (kit `globalSlot`, architecture D9).\n */\nimport { globalSlot } from \"@ai-matrx/kit/global-slot\";\nimport type { OverlayDefinitionMeta } from \"./types\";\n\n/**\n * A definition's meta with its data type erased, so definitions of every data shape share one\n * registry without casts. (`never` erasure made `defaults` unassignable.)\n */\nexport interface AnyOverlayMeta extends Omit<OverlayDefinitionMeta<string, unknown>, \"defaults\"> {\n readonly defaults?: object | undefined;\n}\n\ntype AnyMeta = AnyOverlayMeta;\n\ninterface RegistryState {\n readonly byId: Map<string, AnyMeta>;\n readonly byLinkKey: Map<string, AnyMeta>;\n readonly listeners: Set<() => void>;\n}\n\nconst state = (): RegistryState =>\n globalSlot<RegistryState>(\"ai-matrx.summon.registry\", () => ({\n byId: new Map(),\n byLinkKey: new Map(),\n listeners: new Set(),\n }));\n\n/**\n * Register (or re-register) definitions. Re-registering an id replaces it (hot reload). A link\n * key claimed by two different ids is a host bug and throws, naming both.\n */\nexport function registerOverlayMeta(definitions: readonly AnyOverlayMeta[]): void {\n const s = state();\n for (const def of definitions) {\n s.byId.set(def.id, def);\n const keys = def.link ? [def.link.key, ...(def.link.aliases ?? [])] : [];\n for (const key of keys) {\n const holder = s.byLinkKey.get(key);\n if (holder && holder.id !== def.id) {\n throw new Error(`[summon] link key \"${key}\" is claimed by both \"${holder.id}\" and \"${def.id}\"`);\n }\n s.byLinkKey.set(key, def);\n }\n }\n for (const listener of s.listeners) listener();\n}\n\nexport function getOverlayMeta(overlayId: string): AnyMeta | undefined {\n return state().byId.get(overlayId);\n}\n\nexport function getOverlayMetaByLinkKey(linkKey: string): AnyMeta | undefined {\n return state().byLinkKey.get(linkKey);\n}\n\nexport function allOverlayMeta(): readonly AnyMeta[] {\n return [...state().byId.values()];\n}\n\nexport function isRegisteredOverlay(overlayId: string): boolean {\n return state().byId.has(overlayId);\n}\n\nexport function subscribeToOverlayRegistry(listener: () => void): () => void {\n const s = state();\n s.listeners.add(listener);\n return () => s.listeners.delete(listener);\n}\n\n/** Test-only. */\nexport function resetOverlayRegistry(): void {\n const s = state();\n s.byId.clear();\n s.byLinkKey.clear();\n}\n","// The public action creators, light: plain objects with the slices' own type strings, so a file\n// that only opens or closes something never loads a slice. The slices (core) handle these exact\n// types; `actions.parity.test.ts` proves every creator here equals its slice twin.\n//\n// `openOverlay`/`toggleOverlay` keep the two guarantees the slice creators had: functions are\n// stripped from open data (they can never travel through Redux — the D33 dead-button class) and\n// the definition's registered `defaults` ride the payload, so the reducer stays pure.\nimport { getOverlayMeta, allOverlayMeta } from \"../core/registry\";\nimport { DEFAULT_INSTANCE_ID, type OverlayDataOf, type OverlayId } from \"../core/types\";\n\nexport interface OpenOverlayPayload<Id extends OverlayId = OverlayId> {\n overlayId: Id;\n instanceId?: string;\n data?: OverlayDataOf<Id> | null;\n}\n\nexport interface CloseOverlayPayload<Id extends OverlayId = OverlayId> {\n overlayId: Id;\n instanceId?: string;\n}\n\nexport type ToggleOverlayPayload<Id extends OverlayId = OverlayId> = OpenOverlayPayload<Id>;\n\nexport interface CloseAllInstancesPayload<Id extends OverlayId = OverlayId> {\n overlayId: Id;\n}\n\nexport interface CloseOverlaysBoundToPagePayload {\n /** Overlay ids whose definitions say `closesOnNavigation`. */\n overlayIds: readonly string[];\n}\n\nexport interface PruneStaleInstancesPayload {\n olderThanMs: number;\n}\n\n/** Raw reducer payload: untyped ids + the registry defaults the creator resolved. */\nexport interface RawOpenPayload {\n overlayId: string;\n instanceId?: string;\n data?: unknown;\n defaults?: Readonly<Record<string, unknown>>;\n}\n\nexport interface SummonAction<P> {\n type: string;\n payload: P;\n /** Structurally a Redux `UnknownAction`. */\n [extra: string]: unknown;\n}\n\ntype Creator<Args extends unknown[], P> = ((...args: Args) => SummonAction<P>) & {\n readonly type: string;\n match(action: unknown): action is SummonAction<P>;\n};\n\nfunction creator<Args extends unknown[], P>(type: string, build: (...args: Args) => P): Creator<Args, P> {\n const create = (...args: Args): SummonAction<P> => ({ type, payload: build(...args) });\n return Object.assign(create, {\n type,\n toString: () => type,\n match: (action: unknown): action is SummonAction<P> =>\n typeof action === \"object\" && action !== null && (action as { type?: unknown }).type === type,\n });\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction stripFunctions(overlayId: string, data: unknown): unknown {\n if (!isPlainRecord(data)) return data;\n const offenders = Object.keys(data).filter((key) => typeof data[key] === \"function\");\n if (offenders.length === 0) return data;\n // eslint-disable-next-line no-console\n console.error(\n `[summon] BUG: function value(s) in openOverlay data for \"${overlayId}\" (keys: ${offenders.join(\", \")}). ` +\n `Functions cannot travel through Redux — the handler would NEVER fire. Register a handle ` +\n `(@ai-matrx/summon/handles) and pass its id string instead. The offending key(s) were stripped from state.`,\n );\n const cleaned = { ...data };\n for (const key of offenders) delete cleaned[key];\n return cleaned;\n}\n\nfunction rawOpen(payload: { overlayId: string; instanceId?: string; data?: unknown }): RawOpenPayload {\n const raw: RawOpenPayload = { overlayId: payload.overlayId };\n if (payload.instanceId !== undefined) raw.instanceId = payload.instanceId;\n if (payload.data !== undefined) raw.data = stripFunctions(payload.overlayId, payload.data);\n const defaults: unknown = getOverlayMeta(payload.overlayId)?.defaults;\n if (isPlainRecord(defaults)) raw.defaults = stripFunctions(payload.overlayId, defaults) as Record<string, unknown>;\n return raw;\n}\n\nconst O = \"overlays/\";\n\nexport const openOverlay = creator(O + \"openOverlay\", <Id extends OverlayId>(payload: OpenOverlayPayload<Id>) => rawOpen(payload));\n\nexport const closeOverlay = creator(O + \"closeOverlay\", <Id extends OverlayId>(payload: CloseOverlayPayload<Id>) =>\n payload.instanceId === undefined\n ? { overlayId: payload.overlayId as string }\n : { overlayId: payload.overlayId as string, instanceId: payload.instanceId },\n);\n\nexport const toggleOverlay = creator(O + \"toggleOverlay\", <Id extends OverlayId>(payload: ToggleOverlayPayload<Id>) => rawOpen(payload));\n\nexport const closeAllInstancesOfOverlay = creator(\n O + \"closeAllInstancesOfOverlay\",\n <Id extends OverlayId>(payload: CloseAllInstancesPayload<Id>) => ({ overlayId: payload.overlayId as string }),\n);\n\n/** Ids of every registered overlay whose definition says `closesOnNavigation`. */\nexport function overlayIdsBoundToPage(): string[] {\n return allOverlayMeta()\n .filter((meta) => meta.closesOnNavigation === true)\n .map((meta) => meta.id);\n}\n\n/** Close page-bound overlays. Omit the ids to use the registry's `closesOnNavigation` list. */\nexport const closeOverlaysBoundToPage = creator(\n O + \"closeOverlaysBoundToPage\",\n (payload?: Partial<CloseOverlaysBoundToPagePayload>): CloseOverlaysBoundToPagePayload => ({\n overlayIds: [...(payload?.overlayIds ?? overlayIdsBoundToPage())],\n }),\n);\n\nexport const closeAllOverlays = creator(O + \"closeAllOverlays\", () => undefined);\nexport const pruneStaleInstances = creator(O + \"pruneStaleInstances\", (payload: PruneStaleInstancesPayload) => payload);\n\n// ── Window manager: the ones callers outside a window dispatch (menus, shortcuts, settings) ──\n\nconst W = \"windowManager/\";\nconst pass = <P>() => (payload: P) => payload;\n\nexport const focusWindow = creator(W + \"focusWindow\", pass<string>());\nexport const restoreWindow = creator(W + \"restoreWindow\", pass<string>());\nexport const toggleWindowsHidden = creator(W + \"toggleWindowsHidden\", () => undefined);\nexport const restoreAll = creator(W + \"restoreAll\", () => undefined);\nexport const minimizeAll = creator(W + \"minimizeAll\", pass<{ viewportWidth: number; viewportHeight: number }>());\n\n/** Every slice key the summon reducers own; an action under one of them needs the runtime. */\nexport const SUMMON_SLICE_KEYS = [\"overlays\", \"windowManager\", \"urlSync\", \"overlayState\"] as const;\n\nexport function isSummonAction(action: unknown): action is { type: string } {\n if (typeof action !== \"object\" || action === null) return false;\n const type = (action as { type?: unknown }).type;\n if (typeof type !== \"string\") return false;\n const slash = type.indexOf(\"/\");\n return slash > 0 && (SUMMON_SLICE_KEYS as readonly string[]).includes(type.slice(0, slash));\n}\n\nexport { DEFAULT_INSTANCE_ID };\n","// The public overlay selectors, light and safe before the runtime: a host that loads the summon\n// slices on first use (the gate) has no `overlays` key until then, and every overlay reads closed.\nimport { DEFAULT_INSTANCE_ID } from \"../core/types\";\nimport { globalSlot } from \"@ai-matrx/kit/global-slot\";\n\nexport interface OverlayInstance {\n isOpen: boolean;\n data: unknown;\n /** Unix ms of the last open (pruneStaleInstances reads it). */\n lastUsedAt?: number;\n}\n\nexport interface OverlayState {\n overlays: Record<string, Record<string, OverlayInstance>>;\n}\n\n/** The slice of any store these selectors need (absent until the summon runtime is installed). */\nexport type StateWithOverlays = { overlays?: OverlayState };\n\nexport interface OpenInstanceView {\n instanceId: string;\n data: unknown;\n}\n\nconst CLOSED: OverlayInstance = Object.freeze({ isOpen: false, data: null });\nconst EMPTY: readonly OpenInstanceView[] = Object.freeze([]);\n\nexport const selectOverlay = (state: StateWithOverlays, overlayId: string, instanceId: string = DEFAULT_INSTANCE_ID): OverlayInstance =>\n state.overlays?.overlays[overlayId]?.[instanceId] ?? CLOSED;\n\nexport const selectIsOverlayOpen = (state: StateWithOverlays, overlayId: string, instanceId: string = DEFAULT_INSTANCE_ID): boolean =>\n selectOverlay(state, overlayId, instanceId).isOpen;\n\nexport const selectOverlayData = (state: StateWithOverlays, overlayId: string, instanceId: string = DEFAULT_INSTANCE_ID): unknown =>\n selectOverlay(state, overlayId, instanceId).data;\n\ninterface CachedOpen {\n bucket: Record<string, OverlayInstance> | undefined;\n result: readonly OpenInstanceView[];\n}\nconst openCache = (): Map<string, CachedOpen> => globalSlot(\"ai-matrx.summon.openInstances\", () => new Map<string, CachedOpen>());\n\n/** All open instances of an overlay id; the array reference is stable while the open set is unchanged. */\nexport const selectOpenInstances = (state: StateWithOverlays, overlayId: string): readonly OpenInstanceView[] => {\n const bucket = state.overlays?.overlays[overlayId];\n const cache = openCache();\n const hit = cache.get(overlayId);\n if (hit && hit.bucket === bucket) return hit.result;\n let result: readonly OpenInstanceView[] = EMPTY;\n if (bucket) {\n const open: OpenInstanceView[] = [];\n for (const [instanceId, inst] of Object.entries(bucket)) if (inst.isOpen) open.push({ instanceId, data: inst.data });\n if (open.length > 0) result = open;\n }\n cache.set(overlayId, { bucket, result });\n return result;\n};\n\n/** Every open instance key (`overlayId:instanceId`). */\nexport function listOpenInstanceKeys(state: StateWithOverlays): string[] {\n const keys: string[] = [];\n for (const [overlayId, bucket] of Object.entries(state.overlays?.overlays ?? {})) {\n for (const [instanceId, inst] of Object.entries(bucket)) if (inst.isOpen) keys.push(`${overlayId}:${instanceId}`);\n }\n return keys;\n}\n\n/** True once anything has ever been opened in this store (a key exists in the slice). */\nexport function selectAnyOverlayTouched(state: StateWithOverlays): boolean {\n for (const _ in state.overlays?.overlays ?? {}) return true;\n return false;\n}\n\n/** The global hide-all flag (false before the runtime is installed). */\nexport const selectWindowsHidden = (state: { windowManager?: { windowsHidden: boolean } }): boolean =>\n state.windowManager?.windowsHidden ?? false;\n","// The summon gate: a host store carries NONE of the summon slices or middleware until something\n// needs them. The gate is one middleware in the host chain. Before the core is loaded, every\n// summon action (open, close, a window action…) is queued and the first one starts ONE import()\n// of the core; when the core module evaluates it installs itself into every gate — the slices are\n// injected into the host's root reducer, the real middleware (close lifecycle, render watchdog)\n// joins the chain, and the queue replays in order. A host may also start the import early\n// (`prefetchSummonRuntime` on idle or pointer intent) so the first click opens at once.\n//\n// A module that needs the slices synchronously (the window section, links, persistence) imports\n// the core statically; the core installs at evaluation, so its state exists before it renders.\nimport type { Dispatch, Middleware, MiddlewareAPI, Reducer, UnknownAction } from \"@reduxjs/toolkit\";\nimport { globalSlot } from \"@ai-matrx/kit/global-slot\";\nimport type { SummonPorts } from \"../core/ports\";\nimport { isSummonAction } from \"./actions\";\n\n/** What the core hands the gate when it loads. */\nexport interface SummonCore {\n readonly reducers: Readonly<Record<string, Reducer>>;\n createMiddleware(ports?: Partial<SummonPorts>): Middleware[];\n}\n\n/** Dispatched once after the slices are injected into a live store, so they hold their initial state. */\nexport const SUMMON_INSTALLED_ACTION = \"@@summon/installed\";\n\ninterface GateInternals {\n install(core: SummonCore): void;\n}\n\ninterface GateSlot {\n core: SummonCore | null;\n loading: Promise<void> | null;\n readonly gates: Set<GateInternals>;\n readonly listeners: Set<() => void>;\n}\n\nconst slot = (): GateSlot =>\n globalSlot<GateSlot>(\"ai-matrx.summon.gate\", () => ({ core: null, loading: null, gates: new Set(), listeners: new Set() }));\n\n/** Called by the core module when it evaluates (idempotent). */\nexport function installSummonCore(core: SummonCore): void {\n const s = slot();\n if (s.core) return;\n s.core = core;\n const gates = [...s.gates];\n s.gates.clear();\n for (const gate of gates) gate.install(core);\n for (const listener of [...s.listeners]) listener();\n}\n\nexport function isSummonInstalled(): boolean {\n return slot().core !== null;\n}\n\nexport function subscribeSummonInstalled(listener: () => void): () => void {\n const s = slot();\n s.listeners.add(listener);\n return () => s.listeners.delete(listener);\n}\n\n/** Load the summon core (one import(), shared by every caller). Resolves once it is installed. */\nexport function ensureSummonRuntime(): Promise<void> {\n const s = slot();\n if (s.core) return Promise.resolve();\n s.loading ??= import(\"@ai-matrx/summon\").then(\n (core) => installSummonCore(core.summonCore),\n (error: unknown) => {\n s.loading = null; // a failed chunk may be retried by the next request\n throw error;\n },\n );\n return s.loading;\n}\n\n/** Start loading the core without waiting (idle, pointer intent). Errors surface on the next real request. */\nexport function prefetchSummonRuntime(): void {\n ensureSummonRuntime().catch(() => undefined);\n}\n\nexport interface SummonGate {\n /** Put this in the host store's middleware chain. */\n readonly middleware: Middleware;\n /**\n * Give the gate the host root reducer's inject function — before `configureStore`, so a core\n * that is already loaded (a page that imported the window section) is injected before the\n * store's first state exists.\n */\n attachReducer(inject: (reducers: Readonly<Record<string, Reducer>>) => void): void;\n}\n\nexport interface CreateSummonGateOptions {\n /** Ports for the summon middleware (render watchdog: notify, errors, debug). */\n readonly ports?: Partial<SummonPorts>;\n}\n\nexport function createSummonGate(options: CreateSummonGateOptions = {}): SummonGate {\n let inject: ((reducers: Readonly<Record<string, Reducer>>) => void) | null = null;\n let injected = false;\n let api: MiddlewareAPI<Dispatch<UnknownAction>, unknown> | null = null;\n let next: ((action: unknown) => unknown) | null = null;\n let chain: ((action: unknown) => unknown) | null = null;\n const queue: unknown[] = [];\n\n const settle = (core: SummonCore, live: boolean) => {\n if (inject && !injected) {\n inject(core.reducers);\n injected = true;\n }\n if (!api || !next || chain) return;\n const store = api;\n let composed: (action: unknown) => unknown = next;\n for (const middleware of [...core.createMiddleware(options.ports)].reverse()) {\n composed = middleware(store)(composed) as (action: unknown) => unknown;\n }\n chain = composed;\n const flush = () => {\n if (live) store.dispatch({ type: SUMMON_INSTALLED_ACTION });\n for (const action of queue.splice(0)) store.dispatch(action as UnknownAction);\n };\n // Redux forbids dispatching while the middleware chain is being built.\n if (live) flush();\n else if (queue.length > 0) queueMicrotask(flush);\n };\n\n const internals: GateInternals = { install: (core) => settle(core, true) };\n const core = () => slot().core;\n\n const middleware: Middleware = (storeApi) => {\n api = storeApi as MiddlewareAPI<Dispatch<UnknownAction>, unknown>;\n return (nextDispatch) => {\n next = nextDispatch as (action: unknown) => unknown;\n const loaded = core();\n if (loaded) settle(loaded, false);\n else slot().gates.add(internals);\n return (action) => {\n if (chain) return chain(action);\n if (!isSummonAction(action)) return nextDispatch(action);\n queue.push(action);\n void ensureSummonRuntime().catch((error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"[summon] the overlay runtime failed to load; queued requests are kept for the next try\", error);\n });\n return action;\n };\n };\n };\n\n return {\n middleware,\n attachReducer(fn) {\n inject = fn;\n const loaded = core();\n if (loaded) {\n inject(loaded.reducers);\n injected = true;\n }\n },\n };\n}\n","// Callback-aware opening without loading the handles registry up front. The opener needs a\n// channel id synchronously (it rides open data); the channel itself is created when the handles\n// section arrives — one import() started by the first such open — or at once by whoever emits\n// first (the render tree has handles statically). Closing the owner before then drops it.\nimport { globalSlot } from \"@ai-matrx/kit/global-slot\";\nimport type { EventChannel } from \"../handles/helpers\";\n\ntype Handlers = Readonly<Record<string, ((payload: unknown) => void) | undefined>> | undefined;\n\ninterface PendingChannel {\n readonly owner: string;\n readonly getHandlers: () => Handlers;\n}\n\n/** The one message shape on an overlay's channel. */\nexport interface OverlayEventMessage {\n readonly type: string;\n readonly payload: unknown;\n}\n\ntype CreateChannel = (options: { owner?: string; id?: string }) => EventChannel<OverlayEventMessage>;\n\nconst pending = (): Map<string, PendingChannel> => globalSlot(\"ai-matrx.summon.pendingChannels\", () => new Map<string, PendingChannel>());\n\n/** Create every pending channel now (idempotent per id). */\nexport function materializePendingChannels(createEventChannel: CreateChannel): void {\n const map = pending();\n for (const [id, entry] of [...map]) {\n map.delete(id);\n const channel = createEventChannel({ owner: entry.owner, id });\n channel.subscribe((message) => entry.getHandlers()?.[message.type]?.(message.payload));\n }\n}\n\n/** Reserve a channel owned by `owner` whose events go to the handlers `getHandlers` returns at emit time. */\nexport function openPendingEventChannel(owner: string, getHandlers: () => Handlers): string {\n const id = `ch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n pending().set(id, { owner, getHandlers });\n void import(\"@ai-matrx/summon/handles\").then(({ createEventChannel }) => materializePendingChannels(createEventChannel));\n return id;\n}\n\n/** The owner closed before its channel was created: forget it. */\nexport function dropPendingChannelsOf(owner: string): void {\n const map = pending();\n for (const [id, entry] of [...map]) if (entry.owner === owner) map.delete(id);\n}\n"],"mappings":";AAwCO,IAAM,sBAAsB;AAiB5B,SAAS,YAAY,WAAmB,aAAqB,qBAAkC;AACpG,SAAO,GAAG,SAAS,IAAI,UAAU;AACnC;AAEO,SAAS,iBAAiB,KAA+D;AAC9F,QAAM,KAAK,IAAI,QAAQ,GAAG;AAC1B,MAAI,MAAM,KAAK,OAAO,IAAI,SAAS,EAAG,QAAO;AAC7C,SAAO,EAAE,WAAW,IAAI,MAAM,GAAG,EAAE,GAAG,YAAY,IAAI,MAAM,KAAK,CAAC,EAAE;AACtE;AAgGO,SAAS,mBAAmB,MAA4D;AAC7F,SAAO,KAAK,QAAQ,YAAY,KAAK;AACvC;;;ACxEA,IAAM,OAAO,MAAY;AAAC;AAEnB,IAAM,oBAAkC;AAAA,EAC7C,SAAS,OAAO,EAAE,KAAK,aAAa,OAAO,KAAK;AAAA,EAChD,WAAW,MAAM;AACnB;AAGO,IAAM,iBAA6B;AAAA,EACxC,UAAU,MAAO,OAAO,WAAW,cAAc,MAAM,OAAO,SAAS;AAAA,EACvE,QAAQ,MAAO,OAAO,WAAW,cAAc,KAAK,OAAO,SAAS;AAAA,EACpE,eAAe,CAAC,eAAe;AAC7B,QAAI,OAAO,WAAW,YAAa;AACnC,UAAM,QAAQ,cAAc,CAAC,WAAW,WAAW,GAAG,IAAI,IAAI,UAAU,KAAK;AAC7E,UAAM,MAAM,GAAG,OAAO,SAAS,QAAQ,GAAG,KAAK,GAAG,OAAO,SAAS,IAAI;AACtE,WAAO,QAAQ,aAAa,OAAO,QAAQ,OAAO,IAAI,GAAG;AAAA,EAC3D;AAAA,EACA,WAAW,CAAC,aAAa;AACvB,QAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,WAAO,iBAAiB,YAAY,QAAQ;AAC5C,WAAO,MAAM,OAAO,oBAAoB,YAAY,QAAQ;A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