@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
package/src/index.ts CHANGED
@@ -1,82 +1,90 @@
1
- /**
2
- * @astrale-os/shell-react — the React face of the shell (SHELL_REACT_API.md §0).
3
- * One package, one import surface (SPEC §4.2); the bounded-context directories are
4
- * the module structure, not subpaths. This public barrel composes the context
5
- * barrels. Settled naming (§0): useKernelClient = the raw handle (session);
6
- * useKernel() = the TYPED kernel (schema, no arg); useDomain(schema) = a typed
7
- * domain binding. `useNode`/`useChildren` are single overloaded symbols (untyped
8
- * floor + typed overloads) exported from the graph plane.
9
- */
1
+ /** @astrale-os/shell-react — curated React runtime over Shell and Kernel Client Store. */
10
2
 
11
- // ─── session (§2 provider + §3) ──────────────────────────────────────────────
12
- export { ShellProvider } from './session/index.js'
13
- export type { ShellError, ShellProviderProps } from './session/index.js'
14
- export { useConnection, useKernelClient, useKernelInstance, useShell } from './session/index.js'
15
- export type { KernelInstance } from './session/index.js'
16
-
17
- // ─── auth (§4) ───────────────────────────────────────────────────────────────
3
+ // Root/provider and authenticated caller.
4
+ export {
5
+ ShellProvider,
6
+ useConnection,
7
+ useKernelClient,
8
+ useKernelInstance,
9
+ useShell,
10
+ } from './session/index.js'
11
+ export type { KernelInstance, ShellError, ShellProviderProps } from './session/index.js'
18
12
  export { ActAs, useAuth, useCan, useSelf } from './auth/index.js'
19
- export type { ActAsProps } from './auth/index.js'
13
+ export type { ActAsProps, PolicyObject } from './auth/index.js'
20
14
 
21
- // ─── graph — the untyped floor + writes + dispatch (§5, §7) ──────────────────
22
- // `useNode`/`useChildren` are single symbols merging the untyped floor + typed
23
- // overloads.
15
+ // One Store path and named SDK definitions. Raw Query/Mutation builders are intentionally absent.
24
16
  export {
17
+ ClientError,
18
+ NodeUnavailableError,
19
+ ProtocolError,
20
+ ResponseError,
21
+ StaleRouteError,
22
+ TransportError,
23
+ isClientError,
24
+ isNodeUnavailableError,
25
25
  useCall,
26
- useChildren,
27
- useGraph,
28
- useMove,
29
- useMutate,
30
- useNode,
26
+ useGraphStore,
31
27
  useQuery,
32
28
  useStream,
33
29
  } from './graph/index.js'
34
30
  export type {
35
- ChildrenOptions,
36
- ChildrenResult,
37
- GraphMemory,
38
- MoveAction,
39
- Node,
40
- NodeResult,
41
- QueryResult,
42
- ShapeInput,
43
- UseMutateOptions,
31
+ CallOptions,
32
+ GraphResource,
33
+ GraphResourceState,
34
+ GraphStore,
35
+ QueryResourceOptions,
36
+ StreamHandle,
37
+ StreamOptions,
44
38
  } from './graph/index.js'
45
- export type { CallOptions, StreamHandle, StreamOptions } from './graph/index.js'
46
39
 
47
- // ─── schema — the typed substrate (§6) ───────────────────────────────────────
48
- export { useDomain, useFunction, useIn, useKernel, useMethod, useOut } from './schema/index.js'
49
- export type { FunctionOptions } from './schema/index.js'
50
- export type { MethodOptions } from './schema/index.js'
40
+ // Rich exact Domain bindings.
41
+ export {
42
+ RelationUnavailableError,
43
+ queryRefresh,
44
+ useAction,
45
+ useDomain,
46
+ useDomains,
47
+ useDynamicDomain,
48
+ useDynamicObject,
49
+ useKernel,
50
+ useMutation,
51
+ useObject,
52
+ useRelation,
53
+ } from './schema/index.js'
51
54
  export type {
52
- AutoMethodAction,
53
- BoundMethodAction,
54
- EndpointResult,
55
- FunctionNames,
56
- FunctionParams,
57
- FunctionResult,
58
- MethodIsStatic,
59
- MethodNames,
60
- MethodParams,
61
- MethodResult,
62
- TargetedMethodAction,
63
- TypedChildrenResult,
64
- TypedNodeResult,
55
+ ActionOptions,
56
+ ActionRefresh,
57
+ DomainAction,
58
+ MutationOptions,
59
+ QueryRefresh,
60
+ RelationOptions,
61
+ RelationResource,
62
+ RelationUnavailable,
63
+ RichReadOptions,
65
64
  } from './schema/index.js'
66
65
 
67
- // ─── navigation (§8) ─────────────────────────────────────────────────────────
66
+ // Typed navigation and selection.
68
67
  export {
69
68
  Link,
69
+ NavigationScope,
70
70
  NavScope,
71
+ NodeLink,
72
+ pathParam,
73
+ ViewLink,
74
+ defineNavigation,
75
+ enumParam,
76
+ location,
71
77
  memoryAdapter,
72
78
  urlAdapter,
73
79
  useAncestors,
74
80
  useLocation,
75
- useNavScope,
76
81
  useNavigate,
82
+ useNavigation,
83
+ useNavScope,
77
84
  } from './navigation/index.js'
78
85
  export type {
79
86
  LinkProps,
87
+ LocationDefinition,
80
88
  MissingPolicy,
81
89
  NavAdapter,
82
90
  NavLocation,
@@ -84,41 +92,63 @@ export type {
84
92
  NavScopeProps,
85
93
  NavSnapshot,
86
94
  NavTarget,
95
+ NavigationDefinition,
96
+ NavigationParam,
97
+ NavigationParams,
98
+ NavigationRoutes,
99
+ NavigationTarget,
100
+ NodeLinkProps,
87
101
  Navigate,
88
102
  SerializedLocation,
103
+ ViewLinkProps,
89
104
  } from './navigation/index.js'
90
-
91
- // ─── selection (§9) ──────────────────────────────────────────────────────────
92
105
  export { SelectionScope, useSelection } from './selection/index.js'
93
106
  export type { Selection, SelectionScopeProps } from './selection/index.js'
94
107
 
95
- // ─── window (§10) ────────────────────────────────────────────────────────────
108
+ // View/window lifecycle and host effects.
96
109
  export {
110
+ ViewHost,
111
+ ViewStage,
97
112
  useCloseGuard,
98
113
  useTargetNode,
114
+ useTargetPath,
99
115
  useViewsFor,
100
116
  useWindow,
101
117
  useWindowList,
102
118
  useWindows,
103
- ViewHost,
104
- ViewStage,
105
119
  } from './window/index.js'
106
120
  export type {
107
121
  CloseGuard,
108
122
  CloseVerdict,
109
- ResolvedSource,
123
+ ResolvedView,
110
124
  SandboxPolicy,
111
- ViewDescriptor,
112
- ViewHostProps,
113
- ViewSource,
114
125
  ViewHostHandle,
126
+ ViewHostProps,
115
127
  ViewsForResult,
116
128
  WindowListEntry,
117
129
  WindowState,
118
130
  WindowView,
119
131
  } from './window/index.js'
120
-
121
- // ─── intents (§11) ───────────────────────────────────────────────────────────
132
+ export {
133
+ HostDialog,
134
+ NestedView,
135
+ Notify,
136
+ RequestAccess,
137
+ useExternalOpen,
138
+ useHostCapabilities,
139
+ useHostDialog,
140
+ useNotify,
141
+ useOpenView,
142
+ useRequestAccess,
143
+ } from './host/index.js'
144
+ export type {
145
+ ExternalOpenApi,
146
+ HostDialogApi,
147
+ NotifyApi,
148
+ OpenViewApi,
149
+ RequestAccessApi,
150
+ } from './host/index.js'
151
+ export { HostCapabilityUnavailableError } from './host/index.js'
122
152
  export { useEmitIntent, useIntent, useSendIntent } from './intents/index.js'
123
153
  export type {
124
154
  EmitIntent,
@@ -128,15 +158,28 @@ export type {
128
158
  SendIntent,
129
159
  } from './intents/index.js'
130
160
 
131
- // ─── application — the OS plane (§12) ────────────────────────────────────────
161
+ // Headless composition kit.
162
+ export {
163
+ Can,
164
+ ConnectionBoundary,
165
+ CredentialBoundary,
166
+ defaultViewError,
167
+ defaultViewLoading,
168
+ GraphBoundary,
169
+ Astrale,
170
+ ViewBoundary,
171
+ ViewErrorBoundary,
172
+ } from './components/index.js'
173
+ export type { AstraleProps, ViewErrorBoundaryProps } from './components/index.js'
174
+
175
+ // Shell application conveniences.
132
176
  export {
133
177
  AppHost,
134
178
  AppLogo,
135
179
  useApps,
136
180
  useCurrentSpace,
181
+ useInstalledDomains,
137
182
  useOpenApp,
138
- useRoles,
139
- useDomains,
140
183
  useSpace,
141
184
  useSpaces,
142
185
  useUser,
@@ -147,73 +190,37 @@ export type {
147
190
  AppLogoProps,
148
191
  AppsResult,
149
192
  CurrentSpaceResult,
150
- RolesResult,
151
193
  DomainsResult,
152
194
  SpaceResult,
153
195
  SpacesResult,
154
196
  } from './application/index.js'
155
- // OS node/session types (from the shell package, single import surface).
156
- export type {
157
- ApplicationNode,
158
- AppSession,
159
- DomainSearchResult,
160
- RoleNode,
161
- SpaceNode,
162
- UserNode,
163
- } from '@astrale-os/shell'
164
-
165
- // ─── shared envelopes (§1) ───────────────────────────────────────────────────
166
- export type { Action, ReadState, ReadOptions, Windowed } from './graph/index.js'
167
197
 
168
- // ─── error taxonomy (§1.4) — guards + classes, re-exported from kernel-client ─
169
- export * from './graph/guards.error.js'
198
+ // Canonical identity carriers used by View props and rich hooks.
199
+ export { NodeId } from '@astrale-os/sdk/graph/node'
200
+ export { NodePath, Path } from '@astrale-os/sdk/graph/path'
201
+ export type { Node } from '@astrale-os/sdk/graph/node'
202
+ export type { PathLike } from '@astrale-os/sdk/graph/path'
203
+ export type { AuthApi, Identity, PolicyDecisionInput } from '@astrale-os/kernel-client/auth'
204
+ export type { DomainBinding, DomainInvokeOptions } from '@astrale-os/shell'
170
205
 
171
- // ─── re-exported kernel-client types (one import surface, §0 preamble) ───────
172
- export {
173
- DESCRIPTION_KEY,
174
- NAME_KEY,
175
- STATUS_KEY,
176
- descriptionOf,
177
- nameOf,
178
- normalizeRef,
179
- statusOf,
180
- } from '@astrale-os/kernel-client'
181
- export type {
182
- AnyBoundNode,
183
- BoundNode,
184
- CreatableClassNames,
185
- CreateProps,
186
- CredentialInput,
187
- DefOf,
188
- EdgeNames,
189
- EndpointsOf,
190
- FnMap,
191
- NamedNodeLike,
192
- NodeRefInput,
193
- SchemaBoundView,
194
- TypeNames,
195
- } from '@astrale-os/kernel-client'
196
- export type {
197
- EdgeIdentity,
198
- GatherBuilder,
199
- OrderInput,
200
- PatchBuilder,
201
- PatchInput,
202
- PathLike,
203
- Properties,
204
- QueryASTInput,
205
- QuerySource,
206
- } from '@astrale-os/kernel-client/graph'
207
- export type { AuthApi, Perms } from '@astrale-os/kernel-client/auth'
208
- export type { Schema } from '@astrale-os/kernel-dsl'
209
-
210
- // ─── re-exported shell types (one import surface, SPEC §4.2) ──────────────────
206
+ // Shell contracts retained at the package root for custom full-app composition.
211
207
  export type {
208
+ ApplicationNode,
209
+ AppSession,
212
210
  CloseResult,
211
+ CredentialSnapshot,
212
+ DomainSearchResult,
213
+ HostCapabilities,
214
+ IntentRegistry,
213
215
  KernelClient,
214
216
  MountCredential,
217
+ NodeTarget,
215
218
  Shell,
216
219
  ShellConfig,
220
+ SpaceNode,
221
+ UserNode,
222
+ ViewLocation,
223
+ ViewPresentation,
224
+ ViewPresentationRequest,
217
225
  Window,
218
226
  } from '@astrale-os/shell'
219
- export type { IntentRegistry } from '@astrale-os/shell'
@@ -3,28 +3,13 @@
3
3
  * a registry entry, the wire constants, and `intentMessage` — the single builder
4
4
  * both directions (send + reply) share.
5
5
  */
6
- import type { IntentMessage, IntentRegistry } from '@astrale-os/shell'
6
+ import type { IntentMessage, IntentRegistry, PayloadOf, ReplyOf } from '@astrale-os/shell'
7
7
 
8
- /**
9
- * Payload of a registry entry: the `{ payload }` field for the wrapped shape,
10
- * else the whole entry (a legacy bare-payload augmentation). Robust to both, so
11
- * bare augmentations keep compiling unchanged.
12
- */
13
- export type IntentPayload<K extends keyof IntentRegistry> = IntentRegistry[K] extends {
14
- payload: infer P
15
- }
16
- ? P
17
- : IntentRegistry[K]
8
+ /** Payload declared by the canonical Shell intent registry entry. */
9
+ export type IntentPayload<K extends keyof IntentRegistry> = PayloadOf<K>
18
10
 
19
- /**
20
- * Reply of a registry entry: the `{ reply }` field when declared, else `void`
21
- * (bare-payload and today's reply-less entries — forward-compatible with G4).
22
- */
23
- export type IntentReply<K extends keyof IntentRegistry> = IntentRegistry[K] extends {
24
- reply: infer R
25
- }
26
- ? R
27
- : void
11
+ /** Reply declared by the canonical Shell intent registry entry. */
12
+ export type IntentReply<K extends keyof IntentRegistry> = ReplyOf<K>
28
13
 
29
14
  /** Sentinel `ctx.sender` carries for a parent-delivered intent (the shell stamps it). */
30
15
  export const PARENT_SENDER = '<parent>'
@@ -35,9 +20,8 @@ export const INTENT_REPLY = 'intentReply'
35
20
  export const NOOP = (): void => {}
36
21
 
37
22
  /**
38
- * Build an intent wire message. Bare-vs-wrapped payload variance (§11 pin) is
39
- * erased on the wire — the receiver reads `envelope.payload` verbatim; the cast
40
- * bridges the correlated name↔payload the union type cannot express.
23
+ * Build an intent wire message. The cast bridges the correlated name↔payload
24
+ * relation that the generic union type cannot express.
41
25
  */
42
26
  export function intentMessage(
43
27
  name: string,
@@ -1,108 +1,53 @@
1
- import type { IntentMessage, IntentRegistry } from '@astrale-os/shell'
1
+ import type { IntentRegistry, RequestIntentOptions } from '@astrale-os/shell'
2
2
 
3
- /**
4
- * useSendIntent (API §11) — a stable typed sender. Each call attaches a
5
- * `correlationId`, subscribes for the matching `intentReply` on the origin channel
6
- * BEFORE sending, then resolves with the reply's result. The promise also resolves
7
- * (`void`) if the target window closes or this hook unmounts — a pending reply
8
- * never strands.
9
- */
3
+ import { requestChildIntent, requestIntent } from '@astrale-os/shell'
10
4
  import { useCallback, useEffect, useRef } from 'react'
11
5
 
12
6
  import type { IntentPayload, IntentReply } from './envelope.js'
13
7
 
14
8
  import { useShell } from '../session/shell.hook.js'
15
- import { INTENT_REPLY, NOOP, intentMessage } from './envelope.js'
16
9
  import { resolveIntentTarget } from './resolve-intent-target.js'
17
10
 
18
- /** The typed sender returned by {@link useSendIntent}. */
11
+ /** Typed request sender backed exclusively by Shell's core correlation implementation. */
19
12
  export interface SendIntent {
20
13
  <K extends keyof IntentRegistry>(
21
14
  name: K,
22
15
  payload: IntentPayload<K>,
23
- /** `to`: `'parent'` (reserved) or a child windowId. Default: the parent, if any. */
24
- opts?: { to?: 'parent' | string },
25
- ): Promise<IntentReply<K> | void>
16
+ options?: RequestIntentOptions & { readonly to?: 'parent' | string },
17
+ ): Promise<IntentReply<K>>
26
18
  }
27
19
 
28
20
  export function useSendIntent(): SendIntent {
29
21
  const shell = useShell()
30
- // Unmount settlers for in-flight sends, so a pending reply resolves on teardown.
31
- const pendingRef = useRef<Set<() => void>>(new Set())
22
+ const lifetime = useRef(new AbortController())
23
+
32
24
  useEffect(() => {
33
- const pending = pendingRef.current
34
- return () => {
35
- for (const settle of pending) settle()
36
- pending.clear()
37
- }
25
+ const controller = lifetime.current.signal.aborted ? new AbortController() : lifetime.current
26
+ lifetime.current = controller
27
+ return () => controller.abort(new Error('Intent requester unmounted'))
38
28
  }, [])
39
29
 
40
30
  return useCallback(
41
31
  <K extends keyof IntentRegistry>(
42
32
  name: K,
43
33
  payload: IntentPayload<K>,
44
- opts?: { to?: 'parent' | string },
45
- ): Promise<IntentReply<K> | void> => {
46
- const target = resolveIntentTarget(shell, opts?.to)
34
+ options?: RequestIntentOptions & { readonly to?: 'parent' | string },
35
+ ): Promise<IntentReply<K>> => {
36
+ const target = resolveIntentTarget(shell, options?.to)
47
37
  if (target.kind === 'invalid') {
48
38
  return Promise.reject(new Error(`useSendIntent: ${target.reason}`))
49
39
  }
50
- const correlationId = crypto.randomUUID()
51
- const message = intentMessage(name, payload, correlationId)
52
- const pending = pendingRef.current
53
-
54
- return new Promise<IntentReply<K> | void>((resolve, reject) => {
55
- let done = false
56
- let offReply = NOOP
57
- let offClose = NOOP
58
- const onUnmount = (): void => settle(undefined)
59
- function settle(value: IntentReply<K> | void): void {
60
- if (done) return
61
- done = true
62
- offReply()
63
- offClose()
64
- pending.delete(onUnmount)
65
- resolve(value)
66
- }
67
- function fail(error: Error): void {
68
- if (done) return
69
- done = true
70
- offReply()
71
- offClose()
72
- pending.delete(onUnmount)
73
- reject(error)
74
- }
75
- const onReply = (m: IntentMessage): void => {
76
- if (m.envelope.name !== INTENT_REPLY) return
77
- const reply = m.envelope.payload as {
78
- correlationId: string
79
- result?: unknown
80
- error?: { message: string }
81
- }
82
- if (reply.correlationId !== correlationId) return
83
- if (reply.error) {
84
- fail(new Error(reply.error.message))
85
- return
86
- }
87
- settle(reply.result as IntentReply<K>)
88
- }
89
-
90
- pending.add(onUnmount)
91
- if (target.kind === 'parent') {
92
- const parent = shell.parent!
93
- offReply = parent.on('intent', onReply)
94
- parent.send(message)
95
- } else {
96
- const { windowId } = target
97
- offReply = shell.children.on('intent', (wid, m) => {
98
- if (wid === windowId) onReply(m)
99
- })
100
- offClose = shell.children.onClose((wid) => {
101
- if (wid === windowId) settle(undefined)
102
- })
103
- shell.children.send(windowId, message)
104
- }
105
- })
40
+ const signal =
41
+ options?.signal === undefined
42
+ ? lifetime.current.signal
43
+ : AbortSignal.any([lifetime.current.signal, options.signal])
44
+ const requestOptions: RequestIntentOptions = {
45
+ signal,
46
+ ...(options?.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
47
+ }
48
+ return target.kind === 'parent'
49
+ ? requestIntent(shell.parent!, name, payload, requestOptions)
50
+ : requestChildIntent(shell.children, target.windowId, name, payload, requestOptions)
106
51
  },
107
52
  [shell],
108
53
  )
@@ -6,8 +6,11 @@
6
6
  import type { SerializedLocation } from '../history.js'
7
7
 
8
8
  export interface NavAdapter {
9
+ readonly kind: 'memory' | 'browser'
9
10
  read(): SerializedLocation | null
10
11
  write(loc: SerializedLocation, opts: { replace: boolean }): void
12
+ /** Remove only this adapter's owned projection when no history entry survives. */
13
+ clear(opts: { replace: boolean }): void
11
14
  subscribe(onExternalChange: () => void): () => void
12
15
  href?(loc: SerializedLocation): string
13
16
  }
@@ -10,10 +10,14 @@ export function memoryAdapter(initial?: SerializedLocation): NavAdapter {
10
10
  let current: SerializedLocation | null = initial ?? null
11
11
  const listeners = new Set<() => void>()
12
12
  return {
13
+ kind: 'memory',
13
14
  read: () => current,
14
15
  write: (loc) => {
15
16
  current = loc
16
17
  },
18
+ clear: () => {
19
+ current = null
20
+ },
17
21
  subscribe: (cb) => {
18
22
  listeners.add(cb)
19
23
  return () => listeners.delete(cb)
@@ -1,3 +1,6 @@
1
+ import { NodePath } from '@astrale-os/sdk/graph/path'
2
+ import { Key } from '@astrale-os/sdk/schema'
3
+
1
4
  /**
2
5
  * urlAdapter (API §8.1) — the History-API adapter: mirrors the location into the
3
6
  * query string (URL form → `<a href>`), owning the nav query keys (`param`,
@@ -6,35 +9,62 @@
6
9
  import type { SerializedLocation } from '../history.js'
7
10
  import type { NavAdapter } from './adapter.js'
8
11
 
9
- const VIEW_KEY = 'view'
12
+ const VIEW_KEY = 'astrale.view'
13
+ const PARAM_PREFIX = 'astrale.param.'
10
14
 
11
15
  /** History-API adapter — the location lives in the query string. */
12
16
  export function urlAdapter(opts?: { param?: string }): NavAdapter {
13
- const param = opts?.param ?? 'node'
17
+ const param = opts?.param ?? 'astrale.node'
14
18
  const hasWindow = (): boolean => typeof window !== 'undefined'
15
19
 
16
20
  const build = (loc: SerializedLocation): string => {
17
21
  const url = new URL(window.location.href)
18
- const sp = new URLSearchParams()
22
+ const sp = url.searchParams
19
23
  sp.set(param, loc.node)
20
24
  if (loc.view !== undefined) sp.set(VIEW_KEY, loc.view)
25
+ else sp.delete(VIEW_KEY)
26
+ for (const key of sp.keys()) if (key.startsWith(PARAM_PREFIX)) sp.delete(key)
21
27
  for (const [k, v] of Object.entries(loc.params ?? {})) {
22
- if (k !== param && k !== VIEW_KEY) sp.set(k, v)
28
+ if (isSensitive(k)) throw new TypeError(`Navigation param '${k}' is sensitive.`)
29
+ sp.set(`${PARAM_PREFIX}${k}`, v)
23
30
  }
24
31
  url.search = sp.toString()
25
32
  return `${url.pathname}${url.search}${url.hash}`
26
33
  }
27
34
 
35
+ const clear = (): string => {
36
+ const url = new URL(window.location.href)
37
+ const sp = url.searchParams
38
+ sp.delete(param)
39
+ sp.delete(VIEW_KEY)
40
+ for (const key of sp.keys()) if (key.startsWith(PARAM_PREFIX)) sp.delete(key)
41
+ url.search = sp.toString()
42
+ return `${url.pathname}${url.search}${url.hash}`
43
+ }
44
+
28
45
  return {
46
+ kind: 'browser',
29
47
  read() {
30
48
  if (!hasWindow()) return null
31
49
  const sp = new URL(window.location.href).searchParams
32
- const node = sp.get(param)
33
- if (node === null) return null
34
- const view = sp.get(VIEW_KEY) ?? undefined
50
+ const rawNode = sp.get(param)
51
+ if (rawNode === null) return null
52
+ let node
53
+ let view
54
+ try {
55
+ node = NodePath(rawNode)
56
+ const rawView = sp.get(VIEW_KEY)
57
+ if (rawView !== null) {
58
+ const admitted = Key(rawView)
59
+ if (!Key.ref(admitted).startsWith('view.')) throw new TypeError('Invalid View key.')
60
+ view = admitted as Key.View
61
+ }
62
+ } catch {
63
+ return null
64
+ }
35
65
  const params: Record<string, string> = {}
36
66
  for (const [k, v] of sp) {
37
- if (k !== param && k !== VIEW_KEY) params[k] = v
67
+ if (k.startsWith(PARAM_PREFIX)) params[k.slice(PARAM_PREFIX.length)] = v
38
68
  }
39
69
  return {
40
70
  node,
@@ -48,6 +78,12 @@ export function urlAdapter(opts?: { param?: string }): NavAdapter {
48
78
  if (replace) window.history.replaceState(null, '', href)
49
79
  else window.history.pushState(null, '', href)
50
80
  },
81
+ clear({ replace }) {
82
+ if (!hasWindow()) return
83
+ const href = clear()
84
+ if (replace) window.history.replaceState(null, '', href)
85
+ else window.history.pushState(null, '', href)
86
+ },
51
87
  subscribe(cb) {
52
88
  if (!hasWindow()) return () => undefined
53
89
  const handler = (): void => cb()
@@ -59,3 +95,7 @@ export function urlAdapter(opts?: { param?: string }): NavAdapter {
59
95
  },
60
96
  }
61
97
  }
98
+
99
+ function isSensitive(key: string): boolean {
100
+ return /token|credential|authorization|secret/i.test(key)
101
+ }