@astrale-os/shell-react 0.2.9 → 0.2.10-beta.3

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 (335) hide show
  1. package/dist/application/apps/app-host.d.ts +4 -15
  2. package/dist/application/apps/app-host.d.ts.map +1 -1
  3. package/dist/application/apps/app-host.js +1 -1
  4. package/dist/application/apps/apps.hook.d.ts +7 -4
  5. package/dist/application/apps/apps.hook.d.ts.map +1 -1
  6. package/dist/application/apps/apps.hook.js +10 -2
  7. package/dist/application/apps/domains.hook.d.ts +1 -1
  8. package/dist/application/apps/domains.hook.d.ts.map +1 -1
  9. package/dist/application/apps/domains.hook.js +1 -1
  10. package/dist/application/apps/open-app.hook.d.ts +2 -3
  11. package/dist/application/apps/open-app.hook.d.ts.map +1 -1
  12. package/dist/application/index.d.ts +2 -4
  13. package/dist/application/index.d.ts.map +1 -1
  14. package/dist/application/index.js +2 -3
  15. package/dist/application/spaces/space.hook.d.ts +2 -2
  16. package/dist/application/spaces/space.hook.d.ts.map +1 -1
  17. package/dist/application/spaces/space.hook.js +2 -2
  18. package/dist/application/spaces/spaces.hook.d.ts +2 -3
  19. package/dist/application/spaces/spaces.hook.d.ts.map +1 -1
  20. package/dist/application/spaces/spaces.hook.js +10 -3
  21. package/dist/auth/act-as.context.d.ts +15 -32
  22. package/dist/auth/act-as.context.d.ts.map +1 -1
  23. package/dist/auth/act-as.context.js +22 -66
  24. package/dist/auth/auth.hook.d.ts +1 -0
  25. package/dist/auth/auth.hook.d.ts.map +1 -1
  26. package/dist/auth/auth.hook.js +2 -22
  27. package/dist/auth/can.hook.d.ts +10 -38
  28. package/dist/auth/can.hook.d.ts.map +1 -1
  29. package/dist/auth/can.hook.js +35 -110
  30. package/dist/auth/index.d.ts +1 -0
  31. package/dist/auth/index.d.ts.map +1 -1
  32. package/dist/auth/self.hook.d.ts +2 -2
  33. package/dist/auth/self.hook.d.ts.map +1 -1
  34. package/dist/auth/self.hook.js +0 -7
  35. package/dist/auth/session-kernel.d.ts +2 -3
  36. package/dist/auth/session-kernel.d.ts.map +1 -1
  37. package/dist/auth/session-kernel.js +4 -13
  38. package/dist/components/astrale.d.ts +14 -0
  39. package/dist/components/astrale.d.ts.map +1 -0
  40. package/dist/components/astrale.js +12 -0
  41. package/dist/components/boundaries.d.ts +47 -0
  42. package/dist/components/boundaries.d.ts.map +1 -0
  43. package/dist/components/boundaries.js +55 -0
  44. package/dist/components/can.d.ts +11 -0
  45. package/dist/components/can.d.ts.map +1 -0
  46. package/dist/components/can.js +5 -0
  47. package/dist/components/index.d.ts +6 -0
  48. package/dist/components/index.d.ts.map +1 -0
  49. package/dist/components/index.js +3 -0
  50. package/dist/graph/call/call.hook.d.ts +8 -18
  51. package/dist/graph/call/call.hook.d.ts.map +1 -1
  52. package/dist/graph/call/call.hook.js +7 -13
  53. package/dist/graph/call/stream.hook.d.ts +12 -20
  54. package/dist/graph/call/stream.hook.d.ts.map +1 -1
  55. package/dist/graph/call/stream.hook.js +55 -111
  56. package/dist/graph/graph.context.d.ts +4 -3
  57. package/dist/graph/graph.context.d.ts.map +1 -1
  58. package/dist/graph/graph.context.js +2 -8
  59. package/dist/graph/guards.error.d.ts +7 -8
  60. package/dist/graph/guards.error.d.ts.map +1 -1
  61. package/dist/graph/guards.error.js +11 -7
  62. package/dist/graph/index.d.ts +8 -16
  63. package/dist/graph/index.d.ts.map +1 -1
  64. package/dist/graph/index.js +3 -7
  65. package/dist/graph/memory/read/envelope.d.ts +22 -54
  66. package/dist/graph/memory/read/envelope.d.ts.map +1 -1
  67. package/dist/graph/memory/read/envelope.js +26 -20
  68. package/dist/graph/memory/read/idle.d.ts +1 -15
  69. package/dist/graph/memory/read/idle.d.ts.map +1 -1
  70. package/dist/graph/memory/read/idle.js +4 -13
  71. package/dist/graph/query-definition.hook.d.ts +11 -0
  72. package/dist/graph/query-definition.hook.d.ts.map +1 -0
  73. package/dist/graph/query-definition.hook.js +205 -0
  74. package/dist/graph/resource.d.ts +34 -0
  75. package/dist/graph/resource.d.ts.map +1 -0
  76. package/dist/graph/resource.js +244 -0
  77. package/dist/graph/store.d.ts +25 -0
  78. package/dist/graph/store.d.ts.map +1 -0
  79. package/dist/graph/store.js +69 -0
  80. package/dist/host/actions.hook.d.ts +34 -0
  81. package/dist/host/actions.hook.d.ts.map +1 -0
  82. package/dist/host/actions.hook.js +125 -0
  83. package/dist/host/components.d.ts +15 -0
  84. package/dist/host/components.d.ts.map +1 -0
  85. package/dist/host/components.js +14 -0
  86. package/dist/host/index.d.ts +5 -0
  87. package/dist/host/index.d.ts.map +1 -0
  88. package/dist/host/index.js +3 -0
  89. package/dist/index.d.ts +26 -37
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +20 -31
  92. package/dist/intents/envelope.d.ts +7 -19
  93. package/dist/intents/envelope.d.ts.map +1 -1
  94. package/dist/intents/envelope.js +2 -3
  95. package/dist/intents/send-intent.hook.d.ts +5 -7
  96. package/dist/intents/send-intent.hook.d.ts.map +1 -1
  97. package/dist/intents/send-intent.hook.js +17 -75
  98. package/dist/navigation/adapters/adapter.d.ts +5 -0
  99. package/dist/navigation/adapters/adapter.d.ts.map +1 -1
  100. package/dist/navigation/adapters/memory.adapter.d.ts.map +1 -1
  101. package/dist/navigation/adapters/memory.adapter.js +4 -0
  102. package/dist/navigation/adapters/url.adapter.d.ts.map +1 -1
  103. package/dist/navigation/adapters/url.adapter.js +57 -10
  104. package/dist/navigation/codec.d.ts +60 -0
  105. package/dist/navigation/codec.d.ts.map +1 -0
  106. package/dist/navigation/codec.js +121 -0
  107. package/dist/navigation/history.d.ts +11 -9
  108. package/dist/navigation/history.d.ts.map +1 -1
  109. package/dist/navigation/history.js +6 -8
  110. package/dist/navigation/hooks/ancestors.hook.d.ts +5 -7
  111. package/dist/navigation/hooks/ancestors.hook.d.ts.map +1 -1
  112. package/dist/navigation/hooks/ancestors.hook.js +7 -51
  113. package/dist/navigation/hooks/location.hook.d.ts.map +1 -1
  114. package/dist/navigation/hooks/location.hook.js +4 -6
  115. package/dist/navigation/hooks/scope.hook.d.ts.map +1 -1
  116. package/dist/navigation/hooks/scope.hook.js +4 -6
  117. package/dist/navigation/index.d.ts +4 -2
  118. package/dist/navigation/index.d.ts.map +1 -1
  119. package/dist/navigation/index.js +2 -1
  120. package/dist/navigation/link.d.ts +12 -0
  121. package/dist/navigation/link.d.ts.map +1 -1
  122. package/dist/navigation/link.js +13 -2
  123. package/dist/navigation/location.d.ts +13 -40
  124. package/dist/navigation/location.d.ts.map +1 -1
  125. package/dist/navigation/location.js +14 -76
  126. package/dist/navigation/scope.context.d.ts +17 -26
  127. package/dist/navigation/scope.context.d.ts.map +1 -1
  128. package/dist/navigation/scope.context.js +140 -108
  129. package/dist/navigation/snapshot.d.ts +14 -19
  130. package/dist/navigation/snapshot.d.ts.map +1 -1
  131. package/dist/navigation/snapshot.js +48 -44
  132. package/dist/schema/action.hook.d.ts +44 -0
  133. package/dist/schema/action.hook.d.ts.map +1 -0
  134. package/dist/schema/action.hook.js +72 -0
  135. package/dist/schema/domain.hook.d.ts +12 -7
  136. package/dist/schema/domain.hook.d.ts.map +1 -1
  137. package/dist/schema/domain.hook.js +101 -4
  138. package/dist/schema/index.d.ts +9 -8
  139. package/dist/schema/index.d.ts.map +1 -1
  140. package/dist/schema/index.js +5 -7
  141. package/dist/schema/kernel.hook.d.ts +4 -9
  142. package/dist/schema/kernel.hook.d.ts.map +1 -1
  143. package/dist/schema/kernel.hook.js +4 -6
  144. package/dist/schema/mutation.hook.d.ts +9 -0
  145. package/dist/schema/mutation.hook.d.ts.map +1 -0
  146. package/dist/schema/mutation.hook.js +41 -0
  147. package/dist/schema/object.hook.d.ts +16 -0
  148. package/dist/schema/object.hook.d.ts.map +1 -0
  149. package/dist/schema/object.hook.js +46 -0
  150. package/dist/schema/relation.hook.d.ts +46 -0
  151. package/dist/schema/relation.hook.d.ts.map +1 -0
  152. package/dist/schema/relation.hook.js +136 -0
  153. package/dist/selection/live.d.ts +9 -17
  154. package/dist/selection/live.d.ts.map +1 -1
  155. package/dist/selection/live.js +65 -112
  156. package/dist/selection/scope.context.js +5 -4
  157. package/dist/session/boot/boot.d.ts +1 -13
  158. package/dist/session/boot/boot.d.ts.map +1 -1
  159. package/dist/session/boot/boot.js +9 -27
  160. package/dist/session/index.d.ts +1 -0
  161. package/dist/session/index.d.ts.map +1 -1
  162. package/dist/session/kernel-instance.hook.d.ts +1 -4
  163. package/dist/session/kernel-instance.hook.d.ts.map +1 -1
  164. package/dist/session/kernel-instance.hook.js +1 -5
  165. package/dist/session/provider.d.ts +9 -23
  166. package/dist/session/provider.d.ts.map +1 -1
  167. package/dist/session/provider.js +29 -75
  168. package/dist/session/session.context.d.ts +5 -0
  169. package/dist/session/session.context.d.ts.map +1 -1
  170. package/dist/window/adopt.d.ts +0 -1
  171. package/dist/window/adopt.d.ts.map +1 -1
  172. package/dist/window/hooks/target-node.hook.d.ts +10 -6
  173. package/dist/window/hooks/target-node.hook.d.ts.map +1 -1
  174. package/dist/window/hooks/target-node.hook.js +14 -72
  175. package/dist/window/hooks/views-for.hook.d.ts +4 -3
  176. package/dist/window/hooks/views-for.hook.d.ts.map +1 -1
  177. package/dist/window/hooks/views-for.hook.js +6 -22
  178. package/dist/window/hooks/windows.hook.d.ts.map +1 -1
  179. package/dist/window/hooks/windows.hook.js +3 -4
  180. package/dist/window/host.d.ts +9 -11
  181. package/dist/window/host.d.ts.map +1 -1
  182. package/dist/window/host.js +26 -62
  183. package/dist/window/hub.d.ts +2 -0
  184. package/dist/window/hub.d.ts.map +1 -1
  185. package/dist/window/hub.js +33 -0
  186. package/dist/window/index.d.ts +2 -2
  187. package/dist/window/index.d.ts.map +1 -1
  188. package/dist/window/index.js +2 -2
  189. package/dist/window/lifecycle/mount.d.ts +5 -44
  190. package/dist/window/lifecycle/mount.d.ts.map +1 -1
  191. package/dist/window/lifecycle/mount.js +14 -120
  192. package/dist/window/lifecycle/states.d.ts +0 -5
  193. package/dist/window/lifecycle/states.d.ts.map +1 -1
  194. package/package.json +20 -8
  195. package/src/application/apps/app-host.tsx +11 -15
  196. package/src/application/apps/apps.hook.ts +13 -6
  197. package/src/application/apps/domains.hook.ts +1 -1
  198. package/src/application/apps/open-app.hook.ts +3 -4
  199. package/src/application/index.ts +4 -6
  200. package/src/application/spaces/space.hook.ts +5 -6
  201. package/src/application/spaces/spaces.hook.ts +14 -9
  202. package/src/auth/act-as.context.tsx +37 -91
  203. package/src/auth/auth.hook.ts +2 -30
  204. package/src/auth/can.hook.ts +44 -135
  205. package/src/auth/index.ts +1 -0
  206. package/src/auth/self.hook.ts +2 -9
  207. package/src/auth/session-kernel.ts +6 -16
  208. package/src/components/astrale.tsx +40 -0
  209. package/src/components/boundaries.tsx +113 -0
  210. package/src/components/can.tsx +16 -0
  211. package/src/components/index.ts +13 -0
  212. package/src/graph/call/call.hook.ts +22 -27
  213. package/src/graph/call/stream.hook.ts +66 -143
  214. package/src/graph/graph.context.ts +6 -11
  215. package/src/graph/guards.error.ts +17 -55
  216. package/src/graph/index.ts +23 -17
  217. package/src/graph/memory/read/envelope.ts +40 -65
  218. package/src/graph/memory/read/idle.ts +5 -18
  219. package/src/graph/query-definition.hook.ts +270 -0
  220. package/src/graph/resource.ts +358 -0
  221. package/src/graph/store.ts +97 -0
  222. package/src/host/actions.hook.ts +165 -0
  223. package/src/host/components.tsx +29 -0
  224. package/src/host/index.ts +17 -0
  225. package/src/index.ts +131 -124
  226. package/src/intents/envelope.ts +7 -23
  227. package/src/intents/send-intent.hook.ts +24 -79
  228. package/src/navigation/adapters/adapter.ts +3 -0
  229. package/src/navigation/adapters/memory.adapter.ts +4 -0
  230. package/src/navigation/adapters/url.adapter.ts +48 -8
  231. package/src/navigation/codec.ts +190 -0
  232. package/src/navigation/history.ts +20 -11
  233. package/src/navigation/hooks/ancestors.hook.ts +10 -60
  234. package/src/navigation/hooks/location.hook.ts +4 -6
  235. package/src/navigation/hooks/scope.hook.ts +4 -6
  236. package/src/navigation/index.ts +18 -2
  237. package/src/navigation/link.tsx +27 -2
  238. package/src/navigation/location.ts +26 -93
  239. package/src/navigation/scope.context.tsx +151 -136
  240. package/src/navigation/snapshot.ts +69 -50
  241. package/src/schema/action.hook.ts +146 -0
  242. package/src/schema/domain.hook.ts +127 -11
  243. package/src/schema/index.ts +9 -30
  244. package/src/schema/kernel.hook.ts +6 -13
  245. package/src/schema/mutation.hook.ts +63 -0
  246. package/src/schema/object.hook.ts +85 -0
  247. package/src/schema/relation.hook.ts +253 -0
  248. package/src/selection/live.ts +75 -125
  249. package/src/selection/scope.context.tsx +4 -4
  250. package/src/session/boot/boot.ts +8 -33
  251. package/src/session/index.ts +1 -0
  252. package/src/session/kernel-instance.hook.ts +2 -11
  253. package/src/session/provider.tsx +34 -103
  254. package/src/session/session.context.ts +6 -0
  255. package/src/window/adopt.ts +0 -1
  256. package/src/window/hooks/target-node.hook.ts +20 -85
  257. package/src/window/hooks/views-for.hook.ts +12 -25
  258. package/src/window/hooks/windows.hook.ts +3 -4
  259. package/src/window/host.tsx +35 -77
  260. package/src/window/hub.ts +33 -0
  261. package/src/window/index.ts +3 -3
  262. package/src/window/lifecycle/mount.ts +15 -160
  263. package/src/window/lifecycle/states.ts +1 -5
  264. package/dist/application/roles.hook.d.ts +0 -7
  265. package/dist/application/roles.hook.d.ts.map +0 -1
  266. package/dist/application/roles.hook.js +0 -23
  267. package/dist/graph/memory/base.d.ts +0 -21
  268. package/dist/graph/memory/base.d.ts.map +0 -1
  269. package/dist/graph/memory/base.js +0 -33
  270. package/dist/graph/memory/read/read.d.ts +0 -9
  271. package/dist/graph/memory/read/read.d.ts.map +0 -1
  272. package/dist/graph/memory/read/read.js +0 -87
  273. package/dist/graph/memory/scope.d.ts +0 -7
  274. package/dist/graph/memory/scope.d.ts.map +0 -1
  275. package/dist/graph/memory/scope.js +0 -25
  276. package/dist/graph/mutate/move.hook.d.ts +0 -7
  277. package/dist/graph/mutate/move.hook.d.ts.map +0 -1
  278. package/dist/graph/mutate/move.hook.js +0 -49
  279. package/dist/graph/mutate/mutate.hook.d.ts +0 -17
  280. package/dist/graph/mutate/mutate.hook.d.ts.map +0 -1
  281. package/dist/graph/mutate/mutate.hook.js +0 -45
  282. package/dist/graph/query/children.hook.d.ts +0 -29
  283. package/dist/graph/query/children.hook.d.ts.map +0 -1
  284. package/dist/graph/query/children.hook.js +0 -64
  285. package/dist/graph/query/graph.hook.d.ts +0 -9
  286. package/dist/graph/query/graph.hook.d.ts.map +0 -1
  287. package/dist/graph/query/graph.hook.js +0 -5
  288. package/dist/graph/query/neighbors.hook.d.ts +0 -7
  289. package/dist/graph/query/neighbors.hook.d.ts.map +0 -1
  290. package/dist/graph/query/neighbors.hook.js +0 -104
  291. package/dist/graph/query/node.hook.d.ts +0 -14
  292. package/dist/graph/query/node.hook.d.ts.map +0 -1
  293. package/dist/graph/query/node.hook.js +0 -43
  294. package/dist/graph/query/query.hook.d.ts +0 -14
  295. package/dist/graph/query/query.hook.d.ts.map +0 -1
  296. package/dist/graph/query/query.hook.js +0 -23
  297. package/dist/schema/bind-read.d.ts +0 -37
  298. package/dist/schema/bind-read.d.ts.map +0 -1
  299. package/dist/schema/bind-read.js +0 -205
  300. package/dist/schema/binding.d.ts +0 -21
  301. package/dist/schema/binding.d.ts.map +0 -1
  302. package/dist/schema/binding.js +0 -99
  303. package/dist/schema/function.hook.d.ts +0 -9
  304. package/dist/schema/function.hook.d.ts.map +0 -1
  305. package/dist/schema/function.hook.js +0 -40
  306. package/dist/schema/method.hook.d.ts +0 -14
  307. package/dist/schema/method.hook.d.ts.map +0 -1
  308. package/dist/schema/method.hook.js +0 -49
  309. package/dist/schema/tag.d.ts +0 -11
  310. package/dist/schema/tag.d.ts.map +0 -1
  311. package/dist/schema/tag.js +0 -11
  312. package/dist/schema/types.d.ts +0 -73
  313. package/dist/schema/types.d.ts.map +0 -1
  314. package/dist/schema/types.js +0 -1
  315. package/dist/schema/write.d.ts +0 -16
  316. package/dist/schema/write.d.ts.map +0 -1
  317. package/dist/schema/write.js +0 -56
  318. package/src/application/roles.hook.ts +0 -41
  319. package/src/graph/memory/base.ts +0 -50
  320. package/src/graph/memory/read/read.ts +0 -103
  321. package/src/graph/memory/scope.ts +0 -29
  322. package/src/graph/mutate/move.hook.ts +0 -70
  323. package/src/graph/mutate/mutate.hook.ts +0 -69
  324. package/src/graph/query/children.hook.ts +0 -136
  325. package/src/graph/query/graph.hook.ts +0 -13
  326. package/src/graph/query/neighbors.hook.ts +0 -159
  327. package/src/graph/query/node.hook.ts +0 -83
  328. package/src/graph/query/query.hook.ts +0 -42
  329. package/src/schema/bind-read.ts +0 -319
  330. package/src/schema/binding.ts +0 -146
  331. package/src/schema/function.hook.ts +0 -68
  332. package/src/schema/method.hook.ts +0 -103
  333. package/src/schema/tag.ts +0 -19
  334. package/src/schema/types.ts +0 -150
  335. package/src/schema/write.ts +0 -96
@@ -1,38 +1,15 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createShell } from '@astrale-os/shell';
3
- /**
4
- * ShellProvider — the composition root (API §2, SPEC §5): owns the shell boot
5
- * state machine (a config OR a prebuilt Shell; `createShell → init → whoami →
6
- * ready`), seats `ShellContext` and `GraphContext`, and registers its boot-retry
7
- * into the per-shell connection store. One live shell per mounted provider,
8
- * StrictMode/HMR-safe (deferred teardown), keyed on config identity. Children
9
- * render only at `ready`, so useShell/useSelf are synchronous below.
10
- */
11
- import { useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react';
3
+ import { useCallback, useEffect, useReducer, useRef, useState } from 'react';
12
4
  import { primeUser } from '../application/user/user.store.js';
13
5
  import { GraphContext } from '../graph/graph.context.js';
14
- import { baseMemoryFor, setMemoryErrorSink } from '../graph/memory/base.js';
6
+ import { resolveGraphStoreScope, retainStore, storeFor } from '../graph/store.js';
15
7
  import { configIdentity, isShellConfig, resolveSelf } from './boot/boot.js';
16
8
  import { cancelTeardown, disposeShell, scheduleTeardown } from './boot/ownership.js';
17
9
  import { bootReducer, INITIAL_BOOT } from './boot/status.js';
18
10
  import { connectionStore } from './connection/connection.store.js';
19
11
  import { ShellContext } from './session.context.js';
20
- /**
21
- * Map a memory event to the documented `ShellError` union (API §2). `refresh`
22
- * (warm-read revalidation failure) and `mutation` (rolled-back write) are the
23
- * two the channel promises; `divergence`/`invariant` are Tier-0/dev tripwires
24
- * outside the union and are not bridged here.
25
- */
26
- function toShellError(event) {
27
- switch (event.kind) {
28
- case 'refresh':
29
- return { kind: 'refresh', shape: event.shape, error: event.error };
30
- case 'mutation':
31
- return { kind: 'mutation', mutationId: event.mutationId, error: event.error };
32
- default:
33
- return null;
34
- }
35
- }
12
+ /** Own and initialize exactly one Shell for a React subtree. */
36
13
  export function ShellProvider(props) {
37
14
  const { config, fallback, errorFallback, onError, children } = props;
38
15
  const [state, dispatch] = useReducer(bootReducer, INITIAL_BOOT);
@@ -47,13 +24,13 @@ export function ShellProvider(props) {
47
24
  const generation = (ref.generation += 1);
48
25
  dispatch({ type: 'connecting' });
49
26
  let shell;
50
- const current = configRef.current;
51
27
  try {
28
+ const current = configRef.current;
52
29
  shell = isShellConfig(current) ? createShell(current) : current;
53
30
  }
54
- catch (err) {
55
- dispatch({ type: 'error', error: err });
56
- onErrorRef.current?.({ kind: 'connection', error: err });
31
+ catch (error) {
32
+ dispatch({ type: 'error', error });
33
+ onErrorRef.current?.({ kind: 'connection', error });
57
34
  return;
58
35
  }
59
36
  ref.shell = shell;
@@ -65,35 +42,33 @@ export function ShellProvider(props) {
65
42
  const self = await resolveSelf(shell);
66
43
  if (generation !== ref.generation)
67
44
  return;
68
- // Pre-resolve the OS-plane user binding (API §2/§12.2) — NON-FATAL: a
69
- // missing OS plane marks it unavailable without failing boot (whoami above
70
- // stays the fatal gate). Seeds the user store so `useUser` is synchronous.
71
45
  await primeUser(shell);
72
46
  if (generation !== ref.generation)
73
47
  return;
74
- dispatch({ type: 'ready', runtime: { shell, self } });
48
+ const storeScope = await resolveGraphStoreScope(shell, self);
49
+ if (generation !== ref.generation)
50
+ return;
51
+ const graph = storeFor(shell, storeScope);
52
+ dispatch({
53
+ type: 'ready',
54
+ runtime: { shell, self, storeScope, store: graph.store, ownsStore: graph.owned },
55
+ });
75
56
  }
76
- catch (err) {
57
+ catch (error) {
77
58
  if (generation !== ref.generation)
78
59
  return;
79
- dispatch({ type: 'error', error: err });
80
- onErrorRef.current?.({ kind: 'connection', error: err });
60
+ dispatch({ type: 'error', error });
61
+ onErrorRef.current?.({ kind: 'connection', error });
81
62
  }
82
63
  })();
83
64
  }, []);
84
65
  useEffect(() => {
85
66
  const ref = bootRef.current;
86
- // The shell this provider will run with once the effect settles: a prebuilt
87
- // Shell is the config object itself; a config-built one is whatever this
88
- // instance already booted (adopted on a StrictMode/HMR re-setup). Cancel any
89
- // pending deferred teardown for it before deciding — this also cancels a
90
- // teardown another provider scheduled for the SAME prebuilt Shell.
91
67
  const current = configRef.current;
92
68
  const adopting = isShellConfig(current) ? ref.shell : current;
93
69
  if (adopting !== null)
94
70
  cancelTeardown(adopting);
95
71
  if (ref.key !== configKey) {
96
- // First boot, config change, or a retry that cleared the key: reboot fresh.
97
72
  if (ref.shell !== null) {
98
73
  cancelTeardown(ref.shell);
99
74
  disposeShell(ref.shell);
@@ -102,11 +77,7 @@ export function ShellProvider(props) {
102
77
  ref.shell = null;
103
78
  startBoot(ref);
104
79
  }
105
- // Same key already booting/booted → adopt (StrictMode's second setup).
106
80
  return () => {
107
- // Defer teardown one macrotask; a synchronous re-setup (StrictMode/HMR or a
108
- // different provider adopting the same prebuilt Shell) cancels it first and
109
- // keeps the same live shell.
110
81
  if (ref.shell !== null)
111
82
  scheduleTeardown(ref.shell, ref);
112
83
  else
@@ -122,44 +93,27 @@ export function ShellProvider(props) {
122
93
  }
123
94
  ref.key = null;
124
95
  dispatch({ type: 'connecting' });
125
- setAttempt((a) => a + 1);
96
+ setAttempt((value) => value + 1);
126
97
  }, []);
127
- // The base (default-scope) memory for the booted Shell — the SAME instance
128
- // the graph/schema/nav hooks read through `graph/memory/scope.ts`. Seated in
129
- // `GraphContext` so selection's liveness has a source; null until ready.
130
98
  const shell = state.runtime?.shell ?? null;
131
- const memory = useMemo(() => (shell === null ? null : baseMemoryFor(shell)), [shell]);
132
- // Bridge the memory's event channel onto the provider `onError` (API §2/§8):
133
- // warm-refresh failures and rolled-back mutations surface here rather than being
134
- // swallowed. Registered while the booted shell is live; cleared on teardown.
135
99
  useEffect(() => {
136
- if (shell === null)
137
- return;
138
- setMemoryErrorSink(shell, (event) => {
139
- const mapped = toShellError(event);
140
- if (mapped !== null)
141
- onErrorRef.current?.(mapped);
142
- });
143
- return () => setMemoryErrorSink(shell, null);
144
- }, [shell]);
145
- // Register this provider's boot-retry into the shell's connection store (rule 3),
146
- // so `useConnection().retry` re-runs boot. Status/seq stay a stub ('ready'/0)
147
- // until the transport-status + result-`seq` feed lands, with no surface change.
100
+ if (shell !== null)
101
+ connectionStore(shell).setRetry(retry);
102
+ }, [shell, retry]);
103
+ const store = state.runtime?.store ?? null;
104
+ const storeScope = state.runtime?.storeScope ?? null;
148
105
  useEffect(() => {
149
- if (shell === null)
106
+ if (shell === null || store === null || storeScope === null)
150
107
  return;
151
- connectionStore(shell).setRetry(retry);
152
- }, [shell, retry]);
108
+ return retainStore(storeFor(shell, storeScope));
109
+ }, [shell, store, storeScope]);
153
110
  if (state.status === 'error') {
154
- // Wrapped in a fragment so the component's declared return type stays
155
- // `ReactElement | null` — valid JSX under @types/react 18 AND 19 (the react
156
- // peer range is >=18), even though `errorFallback`/`fallback` yield ReactNode.
157
111
  if (errorFallback !== undefined)
158
112
  return _jsx(_Fragment, { children: errorFallback(state.error, retry) });
159
113
  throw state.error;
160
114
  }
161
115
  if (state.status !== 'ready' || state.runtime === null) {
162
- return fallback !== undefined ? _jsx(_Fragment, { children: fallback }) : null;
116
+ return fallback === undefined ? null : _jsx(_Fragment, { children: fallback });
163
117
  }
164
- return (_jsx(ShellContext.Provider, { value: state.runtime, children: _jsx(GraphContext.Provider, { value: memory, children: children }) }));
118
+ return (_jsx(ShellContext.Provider, { value: state.runtime, children: _jsx(GraphContext.Provider, { value: state.runtime.store, children: children }) }));
165
119
  }
@@ -1,4 +1,6 @@
1
+ import type { GraphStore } from '@astrale-os/kernel-client/store';
1
2
  import type { KernelClient, Shell } from '@astrale-os/shell';
3
+ import type { GraphStoreScope } from '../graph/store.js';
2
4
  /**
3
5
  * whoami's node type, derived from the auth surface so shell-react needs no
4
6
  * direct `@astrale-os/kernel-core` dependency (`Node` is not yet re-exported by
@@ -13,6 +15,9 @@ export interface ShellRuntime {
13
15
  * bound kernel exposes no auth surface (a bare prebuilt Shell in tests).
14
16
  */
15
17
  readonly self: SelfNode | null;
18
+ readonly storeScope: GraphStoreScope;
19
+ readonly store: GraphStore;
20
+ readonly ownsStore: boolean;
16
21
  }
17
22
  export declare const ShellContext: import("react").Context<ShellRuntime | null>;
18
23
  //# sourceMappingURL=session.context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.context.d.ts","sourceRoot":"","sources":["../../src/session/session.context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAS5D;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1E,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC/B;AACD,eAAO,MAAM,YAAY,8CAA2C,CAAA"}
1
+ {"version":3,"file":"session.context.d.ts","sourceRoot":"","sources":["../../src/session/session.context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAS5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1E,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;IACpC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AACD,eAAO,MAAM,YAAY,8CAA2C,CAAA"}
@@ -12,7 +12,6 @@ export interface AdoptRecord {
12
12
  readonly window: Window;
13
13
  readonly slot: StageSlot;
14
14
  readonly state: WindowState;
15
- readonly targetId: string | undefined;
16
15
  /** Close the window, release its slot, drop it from the registry (fired if unadopted). */
17
16
  dispose(): void;
18
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/window/adopt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,0FAA0F;IAC1F,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,yFAAyF;IACzF,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7C,yFAAyF;IACzF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAA;CACtC;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,IAAI,UAAU,CA2B7C"}
1
+ {"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/window/adopt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,0FAA0F;IAC1F,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,yFAAyF;IACzF,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7C,yFAAyF;IACzF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAA;CACtC;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,IAAI,UAAU,CA2B7C"}
@@ -1,7 +1,11 @@
1
- import type { ReadState } from '../../graph/memory/read/envelope.js';
2
- import type { Node } from '../lifecycle/mount.js';
3
- export interface NodeResult extends ReadState {
4
- readonly node: Node | null;
5
- }
6
- export declare function useTargetNode(): NodeResult;
1
+ import type { Node } from '@astrale-os/sdk/graph/node';
2
+ import { Path } from '@astrale-os/sdk/graph/path';
3
+ import type { GraphResource } from '../../graph/resource.js';
4
+ /**
5
+ * Read the canonical target admitted by the parent handshake and subsequent
6
+ * parent-owned hot swaps without remounting this View document.
7
+ */
8
+ export declare function useTargetNode(): GraphResource<Node | null>;
9
+ /** Reactive canonical target Path; null represents an explicit parent clear. */
10
+ export declare function useTargetPath(): Path | null;
7
11
  //# sourceMappingURL=target-node.hook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"target-node.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/target-node.hook.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAKjD,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAC3B;AAeD,wBAAgB,aAAa,IAAI,UAAU,CAe1C"}
1
+ {"version":3,"file":"target-node.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/target-node.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAGjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAK5D;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,CAE1D;AAED,gFAAgF;AAChF,wBAAgB,aAAa,IAAI,IAAI,GAAG,IAAI,CAS3C"}
@@ -1,77 +1,19 @@
1
+ import { Path } from '@astrale-os/sdk/graph/path';
2
+ import { useCallback, useMemo, useSyncExternalStore } from 'react';
3
+ import { useDynamicObject } from '../../schema/object.hook.js';
4
+ import { useShell } from '../../session/shell.hook.js';
1
5
  /**
2
- * useTargetNode (API §10) — inside a sandboxed view, the node it was opened on.
3
- * The id starts from `shell.targetNodeId` (handshake) and a host `setTarget`
4
- * intent retargets it; the id resolves to a live `Node` through the shell kernel.
5
- *
6
- * Honest subset (flagged): the read is a one-shot `kernel.get` re-run on id
7
- * change, not a memory watch, so `live` is false. Once composed with `useNode(id)`
8
- * it becomes real stale-while-revalidate liveness with no consumer change.
6
+ * Read the canonical target admitted by the parent handshake and subsequent
7
+ * parent-owned hot swaps without remounting this View document.
9
8
  */
10
- import { useCallback, useEffect, useRef, useState } from 'react';
11
- import { idleReadState } from '../../graph/memory/read/idle.js';
12
- import { useShell } from '../../session/shell.hook.js';
13
- /** Address a bare node id by graph id (`@<id>`); pass paths/anchors through. */
14
- function toRef(id) {
15
- return id.startsWith('/') || id.startsWith('@') ? id : `@${id}`;
16
- }
17
- const IDLE_READ = { node: null, pending: false, error: undefined };
18
9
  export function useTargetNode() {
19
- const shell = useShell();
20
- const [id, setId] = useState(() => shell.targetNodeId ?? null);
21
- useEffect(() => {
22
- const parent = shell.parent;
23
- if (parent === null)
24
- return;
25
- return parent.on('intent', (message) => {
26
- if (message.envelope.name !== 'setTarget')
27
- return;
28
- const nodeId = message.envelope.payload.nodeId;
29
- if (typeof nodeId === 'string')
30
- setId(nodeId);
31
- });
32
- }, [shell]);
33
- return useNodeRead(shell.kernel, id);
10
+ return useDynamicObject(useTargetPath());
34
11
  }
35
- /** One-shot get + refetch, in the read envelope. The graph-module seam. */
36
- function useNodeRead(kernel, id) {
37
- const [snap, setSnap] = useState(IDLE_READ);
38
- const aliveRef = useRef(true);
39
- useEffect(() => {
40
- aliveRef.current = true;
41
- return () => {
42
- aliveRef.current = false;
43
- };
44
- }, []);
45
- const load = useCallback(async () => {
46
- if (id === null) {
47
- if (aliveRef.current)
48
- setSnap(IDLE_READ);
49
- return;
50
- }
51
- if (aliveRef.current)
52
- setSnap((s) => ({ node: s.node, pending: true, error: undefined }));
53
- try {
54
- const node = await kernel.get(toRef(id));
55
- if (aliveRef.current)
56
- setSnap({ node: node ?? null, pending: false, error: undefined });
57
- }
58
- catch (error) {
59
- if (aliveRef.current)
60
- setSnap((s) => ({ node: s.node, pending: false, error }));
61
- }
62
- }, [kernel, id]);
63
- useEffect(() => {
64
- void load();
65
- }, [load]);
66
- if (id === null) {
67
- return { ...idleReadState(), node: null };
68
- }
69
- return {
70
- node: snap.node,
71
- pending: snap.pending,
72
- error: snap.error,
73
- live: false,
74
- seq: 0,
75
- refetch: load,
76
- };
12
+ /** Reactive canonical target Path; null represents an explicit parent clear. */
13
+ export function useTargetPath() {
14
+ const shell = useShell();
15
+ const subscribe = useCallback((listener) => shell.onTargetChange(() => listener()), [shell]);
16
+ const snapshot = useCallback(() => shell.targetNodeId, [shell]);
17
+ const target = useSyncExternalStore(subscribe, snapshot, snapshot);
18
+ return useMemo(() => (target === undefined ? null : Path.parse(target)), [target]);
77
19
  }
@@ -1,8 +1,9 @@
1
- import type { PathLike } from '@astrale-os/kernel-client/graph';
1
+ import type { Node } from '@astrale-os/sdk/graph/node';
2
+ import type { PathLike } from '@astrale-os/sdk/graph/path';
3
+ import type { ResolvedView } from '@astrale-os/shell';
2
4
  import type { ReadState } from '../../graph/memory/read/envelope.js';
3
- import type { Node, ViewDescriptor } from '../lifecycle/mount.js';
4
5
  export interface ViewsForResult extends ReadState {
5
- readonly views: readonly ViewDescriptor[];
6
+ readonly views: readonly ResolvedView[];
6
7
  }
7
8
  export declare function useViewsFor(node: Node | PathLike | null | undefined): ViewsForResult;
8
9
  //# sourceMappingURL=views-for.hook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"views-for.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/views-for.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAW/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAKjE,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAA;CAC1C;AAID,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,cAAc,CAqBpF"}
1
+ {"version":3,"file":"views-for.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/views-for.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAWrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AAKpE,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAA;CACxC;AAID,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,cAAc,CAqBpF"}
@@ -1,3 +1,4 @@
1
+ import { Path } from '@astrale-os/sdk/graph/path';
1
2
  /**
2
3
  * useViewsFor (API §10) — "what Views can render this node", as mountable
3
4
  * `ViewDescriptor`s for the open-with menu. Backed one-shot (`live:false`) by the
@@ -11,7 +12,7 @@ const NO_VIEWS = Object.freeze([]);
11
12
  export function useViewsFor(node) {
12
13
  const shell = useShell();
13
14
  const target = resolvePath(node);
14
- const res = useAsyncResource(target === null ? null : () => resolveViews(shell, target), NO_VIEWS, [shell, target]);
15
+ const res = useAsyncResource(target === null ? null : () => shell.views.resolve(target), NO_VIEWS, [shell, target]);
15
16
  return useMemo(() => ({
16
17
  views: res.data,
17
18
  pending: res.pending,
@@ -21,28 +22,11 @@ export function useViewsFor(node) {
21
22
  refetch: res.refetch,
22
23
  }), [res.data, res.pending, res.error, res.refetch]);
23
24
  }
24
- /** Dispatch `View.resolve` and project its rows to mountable `ViewDescriptor`s. */
25
- async function resolveViews(shell, node) {
26
- const rows = await shell.views.resolve(node);
27
- if (rows.length === 0)
28
- return NO_VIEWS;
29
- return rows.map((r) => ({ id: r.id, path: r.path, url: r.url, handshake: r.handshake }));
30
- }
31
- /** A path/`@id` the kernel read surface accepts, or `null` for an idle subject. */
25
+ /** One canonical target, or `null` for an idle subject. */
32
26
  function resolvePath(node) {
33
27
  if (node === null || node === undefined)
34
28
  return null;
35
- if (typeof node === 'string') {
36
- if (node.length === 0)
37
- return null;
38
- return node.startsWith('/') || node.startsWith('@') ? node : `@${node}`;
39
- }
40
- const obj = node;
41
- if (typeof obj.path?.raw === 'string')
42
- return obj.path.raw;
43
- if (typeof obj.id === 'string')
44
- return `@${obj.id}`;
45
- if (typeof obj.raw === 'string')
46
- return obj.raw;
47
- return null;
29
+ if ('id' in node)
30
+ return Path.id(node.id).raw;
31
+ return Path.from(node).raw;
48
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"windows.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/windows.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAc/C,mFAAmF;AACnF,wBAAgB,UAAU,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxD;AAED,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,SAAS,eAAe,EAAE,CAG1D"}
1
+ {"version":3,"file":"windows.hook.d.ts","sourceRoot":"","sources":["../../../src/window/hooks/windows.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAa/C,mFAAmF;AACnF,wBAAgB,UAAU,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxD;AAED,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,SAAS,eAAe,EAAE,CAG1D"}
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * useWindows / useWindowList (API §10) — reactive views over the windows a
3
- * `ViewHost`/`AppHost` mounts through the per-shell hub. The shell exposes no
4
- * window-change feed, so the hub registry (fed by the hosts) is the reactive
5
- * source; windows mounted imperatively via `shell.mount` outside React are not
6
- * tracked here — flagged in the module report as a shell foundation gap.
3
+ * `ViewHost`/`AppHost` or the framework-neutral Shell mounts. The hub mirrors
4
+ * Shell's immutable window-change feed, so credential, location, lifecycle,
5
+ * and imperative mounts remain reactive through one snapshot authority.
7
6
  */
8
7
  import { useMemo, useSyncExternalStore } from 'react';
9
8
  import { useShell } from '../../session/shell.hook.js';
@@ -1,7 +1,5 @@
1
- import type { NodeRefInput } from '@astrale-os/kernel-client';
2
- import type { CloseResult, IntentRegistry, MountCredential, SandboxProfile } from '@astrale-os/shell';
1
+ import type { CloseResult, HostCapabilities, MountCredential, ResolvedView, SandboxProfile } from '@astrale-os/shell';
3
2
  import type { CSSProperties, ReactNode } from 'react';
4
- import type { ResolvedSource, ViewSource } from './lifecycle/mount.js';
5
3
  import type { WindowState } from './lifecycle/states.js';
6
4
  /** Imperative handle on a mounted `ViewHost` (API §10). */
7
5
  export interface ViewHostHandle {
@@ -14,20 +12,20 @@ export interface ViewHostHandle {
14
12
  refresh(): void;
15
13
  }
16
14
  /** Static iframe sandbox flags, an explicit opt-out, or a policy over the resolved mount. */
17
- export type SandboxPolicy = SandboxProfile | null | ((source: ResolvedSource) => SandboxProfile | null);
18
- export type ViewHostProps = ViewSource & {
19
- /** Node this view opens on — delivered as `targetNodeId`; a change retargets. */
20
- node?: NodeRefInput;
21
- capabilities?: {
22
- intents: readonly (keyof IntentRegistry)[];
23
- };
15
+ export type SandboxPolicy = SandboxProfile | null | ((view: ResolvedView) => SandboxProfile | null);
16
+ export interface ViewHostProps {
17
+ /** One canonical target paired with one untouched View route. */
18
+ view: ResolvedView;
19
+ capabilities?: HostCapabilities;
24
20
  sandbox?: SandboxPolicy;
25
21
  credential?: MountCredential;
22
+ handshakeTimeoutMs?: number;
23
+ delegationTtlSeconds?: number;
26
24
  /** Rendered inside the anchor while the frame is not `ready`. */
27
25
  fallback?: (state: WindowState) => ReactNode;
28
26
  onStateChange?: (state: WindowState) => void;
29
27
  className?: string;
30
28
  style?: CSSProperties;
31
- };
29
+ }
32
30
  export declare const ViewHost: import("react").ForwardRefExoticComponent<ViewHostProps & import("react").RefAttributes<ViewHostHandle>>;
33
31
  //# sourceMappingURL=host.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/window/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,eAAe,EAEf,cAAc,EAEf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAqBnE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAcxD,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,KAAK,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3E,gCAAgC;IAChC,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,6FAA6F;AAC7F,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,IAAI,GACJ,CAAC,CAAC,MAAM,EAAE,cAAc,KAAK,cAAc,GAAG,IAAI,CAAC,CAAA;AAEvD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG;IACvC,iFAAiF;IACjF,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,YAAY,CAAC,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC,MAAM,cAAc,CAAC,EAAE,CAAA;KAAE,CAAA;IAC7D,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,SAAS,CAAA;IAC5C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAA;AAYD,eAAO,MAAM,QAAQ,0GA4RpB,CAAA"}
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/window/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,EAEf,YAAY,EACZ,cAAc,EAEf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAsBnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAQxD,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,KAAK,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3E,gCAAgC;IAChC,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,6FAA6F;AAC7F,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,cAAc,GAAG,IAAI,CAAC,CAAA;AAEnG,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,IAAI,EAAE,YAAY,CAAA;IAClB,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,SAAS,CAAA;IAC5C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAWD,eAAO,MAAM,QAAQ,0GA+PpB,CAAA"}