@astrale-os/shell 0.1.0 → 0.2.0

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 (284) hide show
  1. package/LICENSE +202 -0
  2. package/dist/application/apps.d.ts +18 -0
  3. package/dist/application/apps.d.ts.map +1 -0
  4. package/dist/application/apps.js +35 -0
  5. package/dist/application/namespaces.d.ts +21 -0
  6. package/dist/application/namespaces.d.ts.map +1 -0
  7. package/dist/application/namespaces.js +12 -0
  8. package/dist/application/session/open.d.ts +19 -0
  9. package/dist/application/session/open.d.ts.map +1 -0
  10. package/dist/application/session/open.js +46 -0
  11. package/dist/application/session/session.d.ts +41 -0
  12. package/dist/application/session/session.d.ts.map +1 -0
  13. package/dist/application/session/session.js +9 -0
  14. package/dist/application/session/token.d.ts +24 -0
  15. package/dist/application/session/token.d.ts.map +1 -0
  16. package/dist/application/session/token.js +51 -0
  17. package/dist/application/spaces.d.ts +17 -0
  18. package/dist/application/spaces.d.ts.map +1 -0
  19. package/dist/application/spaces.js +30 -0
  20. package/dist/application/user.d.ts +20 -0
  21. package/dist/application/user.d.ts.map +1 -0
  22. package/dist/application/user.js +26 -0
  23. package/dist/application/view.d.ts +20 -0
  24. package/dist/application/view.d.ts.map +1 -0
  25. package/dist/application/view.js +18 -0
  26. package/dist/{application/channels/children-channel.d.ts → channel/children.d.ts} +4 -4
  27. package/dist/channel/children.d.ts.map +1 -0
  28. package/dist/channel/listeners.d.ts +8 -0
  29. package/dist/channel/listeners.d.ts.map +1 -0
  30. package/dist/{adapters/message-port.transport.d.ts → channel/message-port.d.ts} +2 -2
  31. package/dist/channel/message-port.d.ts.map +1 -0
  32. package/dist/{application/channels → channel}/observer.d.ts +2 -1
  33. package/dist/channel/observer.d.ts.map +1 -0
  34. package/dist/{application/channels/parent-channel.d.ts → channel/parent.d.ts} +4 -4
  35. package/dist/channel/parent.d.ts.map +1 -0
  36. package/dist/{application/channels/parent-channel.js → channel/parent.js} +1 -1
  37. package/dist/channel/transport.d.ts +8 -0
  38. package/dist/channel/transport.d.ts.map +1 -0
  39. package/dist/index.d.ts +56 -41
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +23 -20
  42. package/dist/{domain/intent → intent}/middleware/capabilities.d.ts +2 -2
  43. package/dist/intent/middleware/capabilities.d.ts.map +1 -0
  44. package/dist/intent/middleware/logging.d.ts.map +1 -0
  45. package/dist/{domain/intent → intent}/middleware/rate-limit.d.ts +1 -1
  46. package/dist/intent/middleware/rate-limit.d.ts.map +1 -0
  47. package/dist/{application/intent/pipeline-runner.d.ts → intent/pipeline.d.ts} +3 -3
  48. package/dist/intent/pipeline.d.ts.map +1 -0
  49. package/dist/intent/policy.d.ts +40 -0
  50. package/dist/intent/policy.d.ts.map +1 -0
  51. package/dist/intent/policy.js +15 -0
  52. package/dist/{application/intent → intent}/request.d.ts +5 -14
  53. package/dist/intent/request.d.ts.map +1 -0
  54. package/dist/{application/intent → intent}/request.js +6 -20
  55. package/dist/intent/router.d.ts +31 -0
  56. package/dist/intent/router.d.ts.map +1 -0
  57. package/dist/{application/intent → intent}/router.js +1 -15
  58. package/dist/kernel/client.d.ts +33 -0
  59. package/dist/kernel/client.d.ts.map +1 -0
  60. package/dist/kernel/credential.d.ts +35 -0
  61. package/dist/kernel/credential.d.ts.map +1 -0
  62. package/dist/kernel/credential.js +43 -0
  63. package/dist/kernel/delegated.d.ts +17 -0
  64. package/dist/kernel/delegated.d.ts.map +1 -0
  65. package/dist/kernel/delegated.js +29 -0
  66. package/dist/{application/windowing/token-refresh.d.ts → kernel/delegation/refresh.d.ts} +2 -2
  67. package/dist/kernel/delegation/refresh.d.ts.map +1 -0
  68. package/dist/{application/windowing/token-refresh.js → kernel/delegation/refresh.js} +1 -1
  69. package/dist/{domain/identity/delegation.d.ts → kernel/delegation/token.d.ts} +1 -1
  70. package/dist/kernel/delegation/token.d.ts.map +1 -0
  71. package/dist/{adapters/kernel-client.adapter.d.ts → kernel/session.d.ts} +15 -12
  72. package/dist/kernel/session.d.ts.map +1 -0
  73. package/dist/{adapters/kernel-client.adapter.js → kernel/session.js} +10 -15
  74. package/dist/message/ctrl.d.ts +34 -0
  75. package/dist/message/ctrl.d.ts.map +1 -0
  76. package/dist/message/error.d.ts +9 -0
  77. package/dist/message/error.d.ts.map +1 -0
  78. package/dist/{application/windowing/protocol.d.ts → message/init.d.ts} +1 -1
  79. package/dist/message/init.d.ts.map +1 -0
  80. package/dist/{domain/message/registries.d.ts → message/intent.d.ts} +45 -37
  81. package/dist/message/intent.d.ts.map +1 -0
  82. package/dist/message/message.d.ts +10 -0
  83. package/dist/message/message.d.ts.map +1 -0
  84. package/dist/shell/access.d.ts +10 -0
  85. package/dist/shell/access.d.ts.map +1 -0
  86. package/dist/shell/access.js +19 -0
  87. package/dist/shell/build.d.ts +28 -0
  88. package/dist/shell/build.d.ts.map +1 -0
  89. package/dist/shell/build.js +58 -0
  90. package/dist/shell/config.d.ts +29 -0
  91. package/dist/shell/config.d.ts.map +1 -0
  92. package/dist/shell/create.d.ts +4 -0
  93. package/dist/shell/create.d.ts.map +1 -0
  94. package/dist/shell/create.js +5 -0
  95. package/dist/{application/windowing/child-init.d.ts → shell/sandboxed/boot.d.ts} +5 -5
  96. package/dist/shell/sandboxed/boot.d.ts.map +1 -0
  97. package/dist/{application/windowing/child-init.js → shell/sandboxed/boot.js} +5 -6
  98. package/dist/shell/sandboxed/guarded.d.ts +13 -0
  99. package/dist/shell/sandboxed/guarded.d.ts.map +1 -0
  100. package/dist/shell/sandboxed/guarded.js +28 -0
  101. package/dist/shell/sandboxed/pending.d.ts +14 -0
  102. package/dist/shell/sandboxed/pending.d.ts.map +1 -0
  103. package/dist/shell/sandboxed/pending.js +30 -0
  104. package/dist/shell/sandboxed/sandboxed.d.ts +4 -0
  105. package/dist/shell/sandboxed/sandboxed.d.ts.map +1 -0
  106. package/dist/shell/sandboxed/sandboxed.js +100 -0
  107. package/dist/shell/shell.d.ts +36 -0
  108. package/dist/shell/shell.d.ts.map +1 -0
  109. package/dist/shell/standalone.d.ts +4 -0
  110. package/dist/shell/standalone.d.ts.map +1 -0
  111. package/dist/shell/standalone.js +85 -0
  112. package/dist/{domain/window/config.d.ts → window/capabilities.d.ts} +3 -3
  113. package/dist/window/capabilities.d.ts.map +1 -0
  114. package/dist/{ports/shell-adapter.d.ts → window/embed/adapter.d.ts} +3 -2
  115. package/dist/window/embed/adapter.d.ts.map +1 -0
  116. package/dist/{adapters/iframe.shell-adapter.d.ts → window/embed/iframe.d.ts} +2 -2
  117. package/dist/window/embed/iframe.d.ts.map +1 -0
  118. package/dist/{application/windowing/lifecycle-controller.d.ts → window/lifecycle/states.d.ts} +4 -3
  119. package/dist/window/lifecycle/states.d.ts.map +1 -0
  120. package/dist/{application/windowing/lifecycle-controller.js → window/lifecycle/states.js} +1 -1
  121. package/dist/{domain/window/lifecycle.d.ts → window/lifecycle/transition.d.ts} +3 -3
  122. package/dist/window/lifecycle/transition.d.ts.map +1 -0
  123. package/dist/{domain/window/lifecycle.js → window/lifecycle/transition.js} +1 -1
  124. package/dist/window/mount/close.d.ts +27 -0
  125. package/dist/window/mount/close.d.ts.map +1 -0
  126. package/dist/window/mount/close.js +74 -0
  127. package/dist/window/mount/credential.d.ts +41 -0
  128. package/dist/window/mount/credential.d.ts.map +1 -0
  129. package/dist/window/mount/credential.js +74 -0
  130. package/dist/window/mount/handshake.d.ts.map +1 -0
  131. package/dist/{application/windowing → window/mount}/handshake.js +1 -1
  132. package/dist/{application/windowing/mount-controller.d.ts → window/mount/mount.d.ts} +7 -7
  133. package/dist/window/mount/mount.d.ts.map +1 -0
  134. package/dist/window/mount/mount.js +143 -0
  135. package/dist/window/mount/params.d.ts +73 -0
  136. package/dist/window/mount/params.d.ts.map +1 -0
  137. package/dist/window/mount/params.js +1 -0
  138. package/dist/window/mount/plain.d.ts +20 -0
  139. package/dist/window/mount/plain.d.ts.map +1 -0
  140. package/dist/window/mount/plain.js +46 -0
  141. package/dist/{domain/window → window}/window.d.ts +1 -1
  142. package/dist/window/window.d.ts.map +1 -0
  143. package/dist/window/window.js +1 -0
  144. package/package.json +11 -6
  145. package/src/application/apps.ts +60 -0
  146. package/src/application/namespaces.ts +38 -0
  147. package/src/application/session/open.ts +73 -0
  148. package/src/application/session/session.ts +46 -0
  149. package/src/application/session/token.ts +87 -0
  150. package/src/application/spaces.ts +52 -0
  151. package/src/application/user.ts +54 -0
  152. package/src/application/view.ts +42 -0
  153. package/src/{application/channels/children-channel.ts → channel/children.ts} +3 -3
  154. package/src/{application/channels/types.ts → channel/listeners.ts} +2 -7
  155. package/src/{adapters/message-port.transport.ts → channel/message-port.ts} +2 -2
  156. package/src/{application/channels → channel}/observer.ts +2 -1
  157. package/src/{application/channels/parent-channel.ts → channel/parent.ts} +4 -4
  158. package/src/{ports → channel}/transport.ts +2 -1
  159. package/src/index.ts +80 -88
  160. package/src/{domain/intent → intent}/middleware/capabilities.ts +2 -3
  161. package/src/{domain/intent → intent}/middleware/logging.ts +1 -1
  162. package/src/{domain/intent → intent}/middleware/rate-limit.ts +1 -1
  163. package/src/{application/intent/pipeline-runner.ts → intent/pipeline.ts} +3 -2
  164. package/src/intent/policy.ts +46 -0
  165. package/src/{application/intent → intent}/request.ts +14 -34
  166. package/src/{application/intent → intent}/router.ts +12 -49
  167. package/src/kernel/client.ts +33 -0
  168. package/src/kernel/credential.ts +78 -0
  169. package/src/kernel/delegated.ts +49 -0
  170. package/src/{application/windowing/token-refresh.ts → kernel/delegation/refresh.ts} +2 -2
  171. package/src/{adapters/kernel-client.adapter.ts → kernel/session.ts} +26 -33
  172. package/src/message/ctrl.ts +25 -0
  173. package/src/{domain/message/errors.ts → message/error.ts} +8 -0
  174. package/src/message/intent.ts +98 -0
  175. package/src/message/message.ts +11 -0
  176. package/src/shell/access.ts +26 -0
  177. package/src/shell/build.ts +95 -0
  178. package/src/shell/config.ts +32 -0
  179. package/src/shell/create.ts +9 -0
  180. package/src/{application/windowing/child-init.ts → shell/sandboxed/boot.ts} +10 -11
  181. package/src/shell/sandboxed/guarded.ts +32 -0
  182. package/src/shell/sandboxed/pending.ts +52 -0
  183. package/src/shell/sandboxed/sandboxed.ts +131 -0
  184. package/src/shell/shell.ts +37 -0
  185. package/src/shell/standalone.ts +97 -0
  186. package/src/{domain/window/config.ts → window/capabilities.ts} +2 -2
  187. package/src/{ports/shell-adapter.ts → window/embed/adapter.ts} +2 -1
  188. package/src/{adapters/iframe.shell-adapter.ts → window/embed/iframe.ts} +2 -2
  189. package/src/{application/windowing/lifecycle-controller.ts → window/lifecycle/states.ts} +3 -2
  190. package/src/{domain/window/lifecycle.ts → window/lifecycle/transition.ts} +2 -2
  191. package/src/window/mount/close.ts +111 -0
  192. package/src/window/mount/credential.ts +101 -0
  193. package/src/{application/windowing → window/mount}/handshake.ts +3 -2
  194. package/src/window/mount/mount.ts +185 -0
  195. package/src/window/mount/params.ts +64 -0
  196. package/src/window/mount/plain.ts +68 -0
  197. package/src/{domain/window → window}/window.ts +1 -1
  198. package/dist/adapters/iframe.shell-adapter.d.ts.map +0 -1
  199. package/dist/adapters/kernel-client.adapter.d.ts.map +0 -1
  200. package/dist/adapters/message-port.transport.d.ts.map +0 -1
  201. package/dist/application/channels/children-channel.d.ts.map +0 -1
  202. package/dist/application/channels/observer.d.ts.map +0 -1
  203. package/dist/application/channels/parent-channel.d.ts.map +0 -1
  204. package/dist/application/channels/types.d.ts +0 -12
  205. package/dist/application/channels/types.d.ts.map +0 -1
  206. package/dist/application/intent/pipeline-runner.d.ts.map +0 -1
  207. package/dist/application/intent/request.d.ts.map +0 -1
  208. package/dist/application/intent/router.d.ts +0 -56
  209. package/dist/application/intent/router.d.ts.map +0 -1
  210. package/dist/application/kernel-facade.d.ts +0 -33
  211. package/dist/application/kernel-facade.d.ts.map +0 -1
  212. package/dist/application/kernel-facade.js +0 -77
  213. package/dist/application/shell.d.ts +0 -100
  214. package/dist/application/shell.d.ts.map +0 -1
  215. package/dist/application/shell.js +0 -256
  216. package/dist/application/windowing/child-init.d.ts.map +0 -1
  217. package/dist/application/windowing/handshake.d.ts.map +0 -1
  218. package/dist/application/windowing/lifecycle-controller.d.ts.map +0 -1
  219. package/dist/application/windowing/mount-controller.d.ts.map +0 -1
  220. package/dist/application/windowing/mount-controller.js +0 -277
  221. package/dist/application/windowing/protocol.d.ts.map +0 -1
  222. package/dist/application/windowing/token-refresh.d.ts.map +0 -1
  223. package/dist/domain/identity/delegation.d.ts.map +0 -1
  224. package/dist/domain/identity/path.d.ts +0 -11
  225. package/dist/domain/identity/path.d.ts.map +0 -1
  226. package/dist/domain/identity/path.js +0 -13
  227. package/dist/domain/identity/resolve-self.d.ts +0 -21
  228. package/dist/domain/identity/resolve-self.d.ts.map +0 -1
  229. package/dist/domain/identity/resolve-self.js +0 -36
  230. package/dist/domain/intent/middleware/capabilities.d.ts.map +0 -1
  231. package/dist/domain/intent/middleware/logging.d.ts.map +0 -1
  232. package/dist/domain/intent/middleware/rate-limit.d.ts.map +0 -1
  233. package/dist/domain/intent/pipeline.d.ts +0 -3
  234. package/dist/domain/intent/pipeline.d.ts.map +0 -1
  235. package/dist/domain/intent/router.d.ts +0 -6
  236. package/dist/domain/intent/router.d.ts.map +0 -1
  237. package/dist/domain/message/errors.d.ts +0 -2
  238. package/dist/domain/message/errors.d.ts.map +0 -1
  239. package/dist/domain/message/registries.d.ts.map +0 -1
  240. package/dist/domain/message/types.d.ts +0 -30
  241. package/dist/domain/message/types.d.ts.map +0 -1
  242. package/dist/domain/window/config.d.ts.map +0 -1
  243. package/dist/domain/window/lifecycle.d.ts.map +0 -1
  244. package/dist/domain/window/window.d.ts.map +0 -1
  245. package/dist/ports/kernel-client.d.ts +0 -33
  246. package/dist/ports/kernel-client.d.ts.map +0 -1
  247. package/dist/ports/shell-adapter.d.ts.map +0 -1
  248. package/dist/ports/transport.d.ts +0 -7
  249. package/dist/ports/transport.d.ts.map +0 -1
  250. package/src/application/kernel-facade.ts +0 -143
  251. package/src/application/shell.ts +0 -433
  252. package/src/application/windowing/mount-controller.ts +0 -335
  253. package/src/domain/identity/path.ts +0 -14
  254. package/src/domain/identity/resolve-self.ts +0 -38
  255. package/src/domain/intent/pipeline.ts +0 -3
  256. package/src/domain/intent/router.ts +0 -6
  257. package/src/domain/message/registries.ts +0 -76
  258. package/src/domain/message/types.ts +0 -32
  259. package/src/ports/kernel-client.ts +0 -32
  260. /package/dist/{application/channels/children-channel.js → channel/children.js} +0 -0
  261. /package/dist/{application/channels/types.js → channel/listeners.js} +0 -0
  262. /package/dist/{adapters/message-port.transport.js → channel/message-port.js} +0 -0
  263. /package/dist/{application/channels → channel}/observer.js +0 -0
  264. /package/dist/{ports → channel}/transport.js +0 -0
  265. /package/dist/{domain/intent → intent}/middleware/capabilities.js +0 -0
  266. /package/dist/{domain/intent → intent}/middleware/logging.d.ts +0 -0
  267. /package/dist/{domain/intent → intent}/middleware/logging.js +0 -0
  268. /package/dist/{domain/intent → intent}/middleware/rate-limit.js +0 -0
  269. /package/dist/{application/intent/pipeline-runner.js → intent/pipeline.js} +0 -0
  270. /package/dist/{domain/intent/pipeline.js → kernel/client.js} +0 -0
  271. /package/dist/{domain/identity/delegation.js → kernel/delegation/token.js} +0 -0
  272. /package/dist/{domain/intent/router.js → message/ctrl.js} +0 -0
  273. /package/dist/{domain/message/errors.js → message/error.js} +0 -0
  274. /package/dist/{application/windowing/protocol.js → message/init.js} +0 -0
  275. /package/dist/{domain/message/registries.js → message/intent.js} +0 -0
  276. /package/dist/{domain/message/types.js → message/message.js} +0 -0
  277. /package/dist/{domain/window → shell}/config.js +0 -0
  278. /package/dist/{domain/window/window.js → shell/shell.js} +0 -0
  279. /package/dist/{ports/kernel-client.js → window/capabilities.js} +0 -0
  280. /package/dist/{ports/shell-adapter.js → window/embed/adapter.js} +0 -0
  281. /package/dist/{adapters/iframe.shell-adapter.js → window/embed/iframe.js} +0 -0
  282. /package/dist/{application/windowing → window/mount}/handshake.d.ts +0 -0
  283. /package/src/{domain/identity/delegation.ts → kernel/delegation/token.ts} +0 -0
  284. /package/src/{application/windowing/protocol.ts → message/init.ts} +0 -0
@@ -0,0 +1,18 @@
1
+ import { schema } from '@astrale-domains/workspace-schema';
2
+ export function createShellDomainView(kernel) {
3
+ let bound = null;
4
+ const view = () => (bound ??= kernel.withSchema(schema));
5
+ return {
6
+ view,
7
+ bindAs(type, node) {
8
+ const v = view();
9
+ return v.bindAny(node).is(type) ? v.bind(type, node) : null;
10
+ },
11
+ };
12
+ }
13
+ /** Normalize a typed traversal result (single | array | null) to an array. */
14
+ export function asArray(result) {
15
+ if (result === null)
16
+ return [];
17
+ return Array.isArray(result) ? [...result] : [result];
18
+ }
@@ -1,7 +1,7 @@
1
- import type { ShellMessage } from '../../domain/message/types';
2
- import type { Transport } from '../../ports/transport';
1
+ import type { MessageOf, MessageType, ShellMessage } from '../message/message';
3
2
  import type { MessageObserver } from './observer';
4
- import type { MessageOf, MessageType } from './types';
3
+ import type { Transport } from './transport';
4
+ /** Multiplexed channels down to child windows, keyed by windowId. */
5
5
  export interface ChildrenChannel {
6
6
  send(windowId: string, message: ShellMessage): void;
7
7
  on<T extends MessageType>(type: T, handler: (windowId: string, message: MessageOf<T>) => void): () => void;
@@ -18,4 +18,4 @@ export type ChildrenChannelConfig = {
18
18
  onDeliveryFailed?: (windowId: string, message: ShellMessage) => void;
19
19
  };
20
20
  export declare function createChildrenChannel(config: ChildrenChannelConfig): ChildrenChannelController;
21
- //# sourceMappingURL=children-channel.d.ts.map
21
+ //# sourceMappingURL=children.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../src/channel/children.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IACnD,EAAE,CAAC,CAAC,SAAS,WAAW,EACtB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,GACzD,MAAM,IAAI,CAAA;IACb,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;IAC9B,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CACzD;AAED,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;IACpD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,eAAe,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;CACrE,CAAA;AAID,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,GAAG,yBAAyB,CAmF9F"}
@@ -0,0 +1,8 @@
1
+ import type { MessageHandler, MessageOf, MessageType, ShellMessage } from '../message/message';
2
+ /** Per-message-type listener registry — the fan-out primitive channels share. */
3
+ export interface MessageListeners {
4
+ on<T extends MessageType>(type: T, handler: MessageHandler<MessageOf<T>>): () => void;
5
+ dispatch(message: ShellMessage): void;
6
+ }
7
+ export declare function createMessageListeners(): MessageListeners;
8
+ //# sourceMappingURL=listeners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listeners.d.ts","sourceRoot":"","sources":["../../src/channel/listeners.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE9F,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAA;IACrF,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;CACtC;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CA2BzD"}
@@ -1,7 +1,7 @@
1
- import type { Transport } from '../ports/transport';
1
+ import type { Transport } from './transport';
2
2
  export type MessagePortTransportConfig = {
3
3
  port: MessagePort;
4
4
  onClose?: () => void;
5
5
  };
6
6
  export declare function createMessagePortTransport(config: MessagePortTransportConfig): Transport;
7
- //# sourceMappingURL=message-port.transport.d.ts.map
7
+ //# sourceMappingURL=message-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-port.d.ts","sourceRoot":"","sources":["../../src/channel/message-port.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,0BAA0B,GAAG,SAAS,CAyCxF"}
@@ -1,6 +1,7 @@
1
- import type { ShellMessage } from '../../domain/message/types';
1
+ import type { ShellMessage } from '../message/message';
2
2
  export type MessageDirection = 'inbound' | 'outbound';
3
3
  export type ObserverHandler = (message: ShellMessage, direction: MessageDirection) => void;
4
+ /** Tap on every message crossing this shell, in both directions (`shell.onMessage`). */
4
5
  export interface MessageObserver {
5
6
  notify(direction: MessageDirection, message: ShellMessage): void;
6
7
  subscribe(handler: ObserverHandler): () => void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../src/channel/observer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,CAAA;AAErD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,KAAK,IAAI,CAAA;AAE1F,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IAChE,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,IAAI,CAAA;CAChD;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAqBvD"}
@@ -1,7 +1,7 @@
1
- import type { ShellMessage } from '../../domain/message/types';
2
- import type { Transport } from '../../ports/transport';
1
+ import type { MessageHandler, MessageOf, MessageType, ShellMessage } from '../message/message';
3
2
  import type { MessageObserver } from './observer';
4
- import type { MessageHandler, MessageOf, MessageType } from './types';
3
+ import type { Transport } from './transport';
4
+ /** The child's single channel up to its parent shell. */
5
5
  export interface ParentChannel {
6
6
  send(message: ShellMessage): void;
7
7
  on<T extends MessageType>(type: T, handler: MessageHandler<MessageOf<T>>): () => void;
@@ -14,4 +14,4 @@ export type ParentChannelConfig = {
14
14
  observer: MessageObserver;
15
15
  };
16
16
  export declare function createParentChannel(config: ParentChannelConfig): ParentChannelController;
17
- //# sourceMappingURL=parent-channel.d.ts.map
17
+ //# sourceMappingURL=parent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parent.d.ts","sourceRoot":"","sources":["../../src/channel/parent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAI5C,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAA;CACtF;AAED,MAAM,WAAW,uBAAwB,SAAQ,aAAa;IAC5D,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,SAAS,CAAA;IACpB,QAAQ,EAAE,eAAe,CAAA;CAC1B,CAAA;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,uBAAuB,CAqBxF"}
@@ -1,4 +1,4 @@
1
- import { createMessageListeners } from './types';
1
+ import { createMessageListeners } from './listeners';
2
2
  export function createParentChannel(config) {
3
3
  const { transport, observer } = config;
4
4
  const listeners = createMessageListeners();
@@ -0,0 +1,8 @@
1
+ import type { ShellMessage } from '../message/message';
2
+ /** The pipe a channel rides: one peer, ordered delivery, no reply semantics. */
3
+ export interface Transport {
4
+ send(message: ShellMessage): void;
5
+ onMessage(handler: (message: ShellMessage) => void): void;
6
+ close(): void;
7
+ }
8
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/channel/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAA;IACzD,KAAK,IAAI,IAAI,CAAA;CACd"}
package/dist/index.d.ts CHANGED
@@ -1,42 +1,57 @@
1
- export type { ErrorCode } from './domain/message/errors';
2
- export type { IntentRegistry, CtrlRegistry, ViewRef } from './domain/message/registries';
3
- export type { ShellMessage, IntentMessage, IntentEnvelope, CtrlMessage, ErrorMessage, } from './domain/message/types';
4
- export type { WindowConfig, WindowCapabilities, SandboxProfile } from './domain/window/config';
5
- export type { Window, WindowState } from './domain/window/window';
6
- export { transition as lifecycleTransition } from './domain/window/lifecycle';
7
- export type { LifecycleEvent, TransitionResult } from './domain/window/lifecycle';
8
- export type { IntentMiddleware } from './domain/intent/pipeline';
9
- export type { IntentRouter } from './domain/intent/router';
10
- export { loggingMiddleware } from './domain/intent/middleware/logging';
11
- export type { LoggingConfig, LoggingEntry, LoggingSink } from './domain/intent/middleware/logging';
12
- export { capabilitiesMiddleware } from './domain/intent/middleware/capabilities';
13
- export type { CapabilitiesConfig, CapabilityLookup, CapabilityViolation, } from './domain/intent/middleware/capabilities';
14
- export { rateLimitMiddleware } from './domain/intent/middleware/rate-limit';
15
- export type { RateLimitConfig, RateLimitViolation } from './domain/intent/middleware/rate-limit';
16
- export type { DelegationScope, DelegationToken, TokenState } from './domain/identity/delegation';
17
- export { stateOf, isExpired } from './domain/identity/delegation';
18
- export type { Transport } from './ports/transport';
19
- export type { ShellAdapter, WindowHandle } from './ports/shell-adapter';
20
- export type { KernelClient } from './ports/kernel-client';
21
- export { createKernelClientAdapter } from './adapters/kernel-client.adapter';
22
- export type { KernelClientAdapter, CreateKernelClientAdapterOpts, } from './adapters/kernel-client.adapter';
23
- export { createMessagePortTransport } from './adapters/message-port.transport';
24
- export type { MessagePortTransportConfig } from './adapters/message-port.transport';
25
- export { createIframeShellAdapter } from './adapters/iframe.shell-adapter';
26
- export type { IframeShellAdapterConfig } from './adapters/iframe.shell-adapter';
27
- export type { Shell, ShellConfig, StandaloneConfig, SandboxedConfig, MountParams, MountedWindow, CloseResult, ParentChannel, ChildrenChannel, MessageDirection, MessageHandler, ObserverHandler, } from './application/shell';
28
- export { createShell } from './application/shell';
29
- export { runParentHandshake } from './application/windowing/handshake';
30
- export type { HandshakeParams, HandshakeError, HandshakeResult, } from './application/windowing/handshake';
31
- export { performChildInit } from './application/windowing/child-init';
32
- export type { ChildInitParams, ChildInitResult } from './application/windowing/child-init';
33
- export { createTokenRefresher } from './application/windowing/token-refresh';
34
- export type { TokenRefreshConfig, TokenRefresher } from './application/windowing/token-refresh';
35
- export { createIntentPipeline } from './application/intent/pipeline-runner';
36
- export type { IntentPipeline } from './application/intent/pipeline-runner';
37
- export { createIntentRouter } from './application/intent/router';
38
- export type { IntentRouterController, IntentRouterConfig, IntentDecision, IntentOrigin, IntentPolicy, IntentContext, LocalIntentHandler, } from './application/intent/router';
39
- export { requestIntent, replyToIntent, requestAccess } from './application/intent/request';
40
- export { INIT_REQUEST_TYPE, INIT_RESPONSE_TYPE, isInitRequest, isInitResponse, } from './application/windowing/protocol';
41
- export type { InitRequestMessage, InitResponseMessage } from './application/windowing/protocol';
1
+ export type { IntentRegistry, ViewRef, PayloadOf, ReplyOf, IntentEnvelope, IntentMessage, } from './message/intent';
2
+ export type { CtrlRegistry, CtrlMessage } from './message/ctrl';
3
+ export type { ErrorCode, ErrorMessage } from './message/error';
4
+ export type { ShellMessage, MessageHandler } from './message/message';
5
+ export { INIT_REQUEST_TYPE, INIT_RESPONSE_TYPE, isInitRequest, isInitResponse, } from './message/init';
6
+ export type { InitRequestMessage, InitResponseMessage } from './message/init';
7
+ export type { KernelClient } from './kernel/client';
8
+ export { createKernelClientAdapter } from './kernel/session';
9
+ export type { KernelClientAdapter, CreateKernelClientAdapterOpts } from './kernel/session';
10
+ export type { DelegationScope, DelegationToken, TokenState } from './kernel/delegation/token';
11
+ export { stateOf, isExpired } from './kernel/delegation/token';
12
+ export { createTokenRefresher } from './kernel/delegation/refresh';
13
+ export type { TokenRefreshConfig, TokenRefresher } from './kernel/delegation/refresh';
14
+ export type { Transport } from './channel/transport';
15
+ export { createMessagePortTransport } from './channel/message-port';
16
+ export type { MessagePortTransportConfig } from './channel/message-port';
17
+ export type { ParentChannel } from './channel/parent';
18
+ export type { ChildrenChannel } from './channel/children';
19
+ export type { MessageDirection, ObserverHandler } from './channel/observer';
20
+ export type { Window, WindowState } from './window/window';
21
+ export type { WindowConfig, WindowCapabilities, SandboxProfile } from './window/capabilities';
22
+ export { transition as lifecycleTransition } from './window/lifecycle/transition';
23
+ export type { LifecycleEvent, TransitionResult } from './window/lifecycle/transition';
24
+ export type { ShellAdapter, WindowHandle } from './window/embed/adapter';
25
+ export { createIframeShellAdapter } from './window/embed/iframe';
26
+ export type { IframeShellAdapterConfig } from './window/embed/iframe';
27
+ export type { MountParams, MountCredential, MountedWindow, CloseResult, } from './window/mount/params';
28
+ export { runParentHandshake } from './window/mount/handshake';
29
+ export type { HandshakeParams, HandshakeError, HandshakeResult } from './window/mount/handshake';
30
+ export { createIntentPipeline } from './intent/pipeline';
31
+ export type { IntentMiddleware, IntentPipeline } from './intent/pipeline';
32
+ export type { IntentDecision, IntentOrigin, IntentPolicy, IntentContext } from './intent/policy';
33
+ export { createIntentRouter } from './intent/router';
34
+ export type { IntentRouter, IntentRouterController, IntentRouterConfig, LocalIntentHandler, } from './intent/router';
35
+ export { requestIntent, replyToIntent } from './intent/request';
36
+ export { loggingMiddleware } from './intent/middleware/logging';
37
+ export type { LoggingConfig, LoggingEntry, LoggingSink } from './intent/middleware/logging';
38
+ export { capabilitiesMiddleware } from './intent/middleware/capabilities';
39
+ export type { CapabilitiesConfig, CapabilityLookup, CapabilityViolation, } from './intent/middleware/capabilities';
40
+ export { rateLimitMiddleware } from './intent/middleware/rate-limit';
41
+ export type { RateLimitConfig, RateLimitViolation } from './intent/middleware/rate-limit';
42
+ export { createOsNamespaces } from './application/namespaces';
43
+ export type { OsNamespaces, CreateOsNamespacesDeps } from './application/namespaces';
44
+ export type { UserNamespace, UserNode, RoleNode } from './application/user';
45
+ export type { SpacesNamespace, SpaceNode } from './application/spaces';
46
+ export type { AppsNamespace, ApplicationNode } from './application/apps';
47
+ export { openAppSession } from './application/session/open';
48
+ export type { OpenAppSessionDeps } from './application/session/open';
49
+ export { AppSessionRefreshError } from './application/session/session';
50
+ export type { AppSession, AppView, RefreshStep } from './application/session/session';
51
+ export { createShell } from './shell/create';
52
+ export type { Shell } from './shell/shell';
53
+ export type { ShellConfig, StandaloneConfig, SandboxedConfig } from './shell/config';
54
+ export { requestAccess } from './shell/access';
55
+ export { performChildInit } from './shell/sandboxed/boot';
56
+ export type { ChildInitParams, ChildInitResult } from './shell/sandboxed/boot';
42
57
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACxF,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,wBAAwB,CAAA;AAG/B,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC9F,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC7E,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAGjF,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,YAAY,EAAE,aAA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,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC3E,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACtE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAGrF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA"}
package/dist/index.js CHANGED
@@ -1,20 +1,23 @@
1
- export { transition as lifecycleTransition } from './domain/window/lifecycle';
2
- export { loggingMiddleware } from './domain/intent/middleware/logging';
3
- export { capabilitiesMiddleware } from './domain/intent/middleware/capabilities';
4
- export { rateLimitMiddleware } from './domain/intent/middleware/rate-limit';
5
- export { stateOf, isExpired } from './domain/identity/delegation';
6
- // ─── adapters ───────────────────────────────────────────────────────────────
7
- export { createKernelClientAdapter } from './adapters/kernel-client.adapter';
8
- export { createMessagePortTransport } from './adapters/message-port.transport';
9
- export { createIframeShellAdapter } from './adapters/iframe.shell-adapter';
10
- export { createShell } from './application/shell';
11
- // ─── application/windowing (advanced / testing) ─────────────────────────────
12
- export { runParentHandshake } from './application/windowing/handshake';
13
- export { performChildInit } from './application/windowing/child-init';
14
- export { createTokenRefresher } from './application/windowing/token-refresh';
15
- // ─── application/intent (advanced / testing) ────────────────────────────────
16
- export { createIntentPipeline } from './application/intent/pipeline-runner';
17
- export { createIntentRouter } from './application/intent/router';
18
- export { requestIntent, replyToIntent, requestAccess } from './application/intent/request';
19
- // ─── Init-request protocol (shared with host pages) ─────────────────────────
20
- export { INIT_REQUEST_TYPE, INIT_RESPONSE_TYPE, isInitRequest, isInitResponse, } from './application/windowing/protocol';
1
+ export { INIT_REQUEST_TYPE, INIT_RESPONSE_TYPE, isInitRequest, isInitResponse, } from './message/init';
2
+ export { createKernelClientAdapter } from './kernel/session';
3
+ export { stateOf, isExpired } from './kernel/delegation/token';
4
+ export { createTokenRefresher } from './kernel/delegation/refresh';
5
+ export { createMessagePortTransport } from './channel/message-port';
6
+ export { transition as lifecycleTransition } from './window/lifecycle/transition';
7
+ export { createIframeShellAdapter } from './window/embed/iframe';
8
+ export { runParentHandshake } from './window/mount/handshake';
9
+ // ─── intent ─────────────────────────────────────────────────────────────────
10
+ export { createIntentPipeline } from './intent/pipeline';
11
+ export { createIntentRouter } from './intent/router';
12
+ export { requestIntent, replyToIntent } from './intent/request';
13
+ export { loggingMiddleware } from './intent/middleware/logging';
14
+ export { capabilitiesMiddleware } from './intent/middleware/capabilities';
15
+ export { rateLimitMiddleware } from './intent/middleware/rate-limit';
16
+ // ─── application (OS plane: shell.user / .spaces / .apps) ───────────────────
17
+ export { createOsNamespaces } from './application/namespaces';
18
+ export { openAppSession } from './application/session/open';
19
+ export { AppSessionRefreshError } from './application/session/session';
20
+ // ─── shell ──────────────────────────────────────────────────────────────────
21
+ export { createShell } from './shell/create';
22
+ export { requestAccess } from './shell/access';
23
+ export { performChildInit } from './shell/sandboxed/boot';
@@ -1,5 +1,5 @@
1
- import type { IntentRegistry } from '../../message/registries';
2
- import type { WindowCapabilities } from '../../window/config';
1
+ import type { IntentRegistry } from '../../message/intent';
2
+ import type { WindowCapabilities } from '../../window/capabilities';
3
3
  import type { IntentMiddleware } from '../pipeline';
4
4
  export type CapabilityLookup = (sender: string) => WindowCapabilities | undefined;
5
5
  export type CapabilityViolation = {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/intent/middleware/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAA;AAEjF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,cAAc,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IAEjC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAE/D;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAE5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAC/B,CAAA;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAkBnF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/intent/middleware/logging.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,IAAI,GAAG,KAAK,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC5B,CAAA;AAED,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,aAAkB,GAAG,gBAAgB,CAQ9E"}
@@ -1,4 +1,4 @@
1
- import type { IntentMessage } from '../../message/types';
1
+ import type { IntentMessage } from '../../message/intent';
2
2
  import type { IntentMiddleware } from '../pipeline';
3
3
  export type RateLimitKey = (message: IntentMessage) => string;
4
4
  export type RateLimitViolation = {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../../src/intent/middleware/rate-limit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,aAAa,KAAK,MAAM,CAAA;AAE7D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,CAAC,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAA;CAC/D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,CA+B7E"}
@@ -1,5 +1,5 @@
1
- import type { IntentMiddleware } from '../../domain/intent/pipeline';
2
- import type { IntentMessage } from '../../domain/message/types';
1
+ import type { IntentMessage } from '../message/intent';
2
+ export type IntentMiddleware = (message: IntentMessage, next: () => Promise<void>) => Promise<void>;
3
3
  export interface IntentPipeline {
4
4
  use(middleware: IntentMiddleware): void;
5
5
  run(message: IntentMessage, terminate: () => Promise<void>): Promise<void>;
@@ -9,4 +9,4 @@ export interface IntentPipeline {
9
9
  * or wrap the call to `next`. `terminate` is the innermost handler (router).
10
10
  */
11
11
  export declare function createIntentPipeline(): IntentPipeline;
12
- //# sourceMappingURL=pipeline-runner.d.ts.map
12
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/intent/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAEnG,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACvC,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAuBrD"}
@@ -0,0 +1,40 @@
1
+ import type { IntentMessage, IntentRegistry } from '../message/intent';
2
+ import type { Window } from '../window/window';
3
+ /**
4
+ * Decision produced by a routing policy: where an inbound intent should go.
5
+ *
6
+ * - `local`: the shell (entry point or sandboxed parent) handles it itself.
7
+ * - `parent`: forward upstream (only valid for sandboxed children).
8
+ * - `child`: forward to a specific child window.
9
+ * - `drop`: discard silently (e.g., handled fully by a middleware).
10
+ */
11
+ export type IntentDecision<K extends keyof IntentRegistry = keyof IntentRegistry> = {
12
+ kind: 'local';
13
+ message: IntentMessage<K>;
14
+ } | {
15
+ kind: 'parent';
16
+ message: IntentMessage<K>;
17
+ } | {
18
+ kind: 'child';
19
+ windowId: string;
20
+ message: IntentMessage<K>;
21
+ } | {
22
+ kind: 'drop';
23
+ };
24
+ export type IntentOrigin = 'parent' | 'child' | 'self';
25
+ export type IntentPolicy = (message: IntentMessage, ctx: IntentContext) => IntentDecision | Promise<IntentDecision>;
26
+ export interface IntentContext {
27
+ readonly selfWindowId: string;
28
+ readonly origin: IntentOrigin;
29
+ readonly windows: ReadonlyMap<string, Window>;
30
+ readonly hasParent: boolean;
31
+ }
32
+ /**
33
+ * Default policy:
34
+ * - intent arrives from a child → handle locally
35
+ * - intent arrives from the parent → handle locally
36
+ * - intent initiated locally (self) → send up to parent if we have one,
37
+ * otherwise keep it local
38
+ */
39
+ export declare function defaultPolicy(): IntentPolicy;
40
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/intent/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,cAAc,GAAG,MAAM,cAAc,IAC5E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpB,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAEtD,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,aAAa,KACf,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AAE7C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,YAAY,CAO5C"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Default policy:
3
+ * - intent arrives from a child → handle locally
4
+ * - intent arrives from the parent → handle locally
5
+ * - intent initiated locally (self) → send up to parent if we have one,
6
+ * otherwise keep it local
7
+ */
8
+ export function defaultPolicy() {
9
+ return (message, ctx) => {
10
+ if (ctx.origin === 'self') {
11
+ return ctx.hasParent ? { kind: 'parent', message } : { kind: 'local', message };
12
+ }
13
+ return { kind: 'local', message };
14
+ };
15
+ }
@@ -1,8 +1,6 @@
1
- import type { IntentRegistry } from '../../domain/message/registries';
2
- import type { IntentMessage } from '../../domain/message/types';
3
- import type { ChildrenChannel } from '../channels/children-channel';
4
- import type { ParentChannel } from '../channels/parent-channel';
5
- import type { Shell } from '../shell';
1
+ import type { ChildrenChannel } from '../channel/children';
2
+ import type { ParentChannel } from '../channel/parent';
3
+ import type { IntentMessage, IntentRegistry, PayloadOf, ReplyOf } from '../message/intent';
6
4
  /**
7
5
  * Request/reply over the otherwise fire-and-forget intent transport.
8
6
  *
@@ -16,19 +14,12 @@ import type { Shell } from '../shell';
16
14
  * the parent always replies on every path. A dead parent means the view is
17
15
  * gone too, so a never-resolving promise cannot strand a live view.
18
16
  */
19
- export declare function requestIntent<K extends keyof IntentRegistry>(parent: ParentChannel, name: K, payload: IntentRegistry[K]['payload']): Promise<IntentRegistry[K]['response']>;
17
+ export declare function requestIntent<K extends keyof IntentRegistry>(parent: ParentChannel, name: K, payload: PayloadOf<K>): Promise<ReplyOf<K>>;
20
18
  /**
21
19
  * Parent-side counterpart to `requestIntent`: deliver `result` back to the
22
20
  * originating child window, keyed by the request's `correlationId`. No-op for
23
21
  * a request that carried no `correlationId` (a fire-and-forget intent), or if
24
22
  * the child window has since detached (best-effort, drops silently).
25
23
  */
26
- export declare function replyToIntent<K extends keyof IntentRegistry>(children: ChildrenChannel, windowId: string, request: IntentMessage<K>, result: IntentRegistry[K]['response']): void;
27
- /**
28
- * View SDK convenience: ask the user (via the root shell) to grant `perms` on
29
- * `node` to `identity`. Resolves with the bitmask actually granted (0 if the
30
- * user declined or there was no parent to ask). The view typically passes its
31
- * own identity (from `whoami`) as `identity`.
32
- */
33
- export declare function requestAccess(shell: Shell, opts: IntentRegistry['requestAccess']['payload']): Promise<IntentRegistry['requestAccess']['response']>;
24
+ export declare function replyToIntent<K extends keyof IntentRegistry>(children: ChildrenChannel, windowId: string, request: IntentMessage<K>, result: ReplyOf<K>): void;
34
25
  //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/intent/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE1F;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,cAAc,EAC1D,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAoBrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,cAAc,EAC1D,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EACzB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GACjB,IAAI,CAYN"}
@@ -1,4 +1,3 @@
1
- import { NO_PERMS } from '@astrale-os/kernel-core/permissions';
2
1
  /**
3
2
  * Request/reply over the otherwise fire-and-forget intent transport.
4
3
  *
@@ -24,11 +23,15 @@ export function requestIntent(parent, name, payload) {
24
23
  off();
25
24
  resolve(reply.result);
26
25
  });
27
- parent.send({
26
+ // `PayloadOf<K>` is a deferred conditional TS can't reconcile with the
27
+ // `ShellMessage` union across a generic `K`; the payload is exact, so assert
28
+ // the concrete message shape.
29
+ const message = {
28
30
  type: 'intent',
29
31
  version: 1,
30
32
  envelope: { name, payload, sender: { windowId: 'self' }, correlationId },
31
- });
33
+ };
34
+ parent.send(message);
32
35
  });
33
36
  }
34
37
  /**
@@ -51,20 +54,3 @@ export function replyToIntent(children, windowId, request, result) {
51
54
  },
52
55
  });
53
56
  }
54
- /**
55
- * View SDK convenience: ask the user (via the root shell) to grant `perms` on
56
- * `node` to `identity`. Resolves with the bitmask actually granted (0 if the
57
- * user declined or there was no parent to ask). The view typically passes its
58
- * own identity (from `whoami`) as `identity`.
59
- */
60
- export function requestAccess(shell, opts) {
61
- if (!shell.parent)
62
- return Promise.resolve({ granted: false, perms: NO_PERMS });
63
- // A sandboxed shell's `parent` is a proxy that throws until `init()` resolves;
64
- // honour the documented "no parent to ask" fallback instead of surfacing that
65
- // opaque rejection to the caller.
66
- return requestIntent(shell.parent, 'requestAccess', opts).catch(() => ({
67
- granted: false,
68
- perms: NO_PERMS,
69
- }));
70
- }
@@ -0,0 +1,31 @@
1
+ import type { ChildrenChannelController } from '../channel/children';
2
+ import type { ParentChannel } from '../channel/parent';
3
+ import type { IntentMessage, IntentRegistry } from '../message/intent';
4
+ import type { Window } from '../window/window';
5
+ import type { IntentPipeline } from './pipeline';
6
+ import type { IntentOrigin, IntentPolicy } from './policy';
7
+ /** Minimal dispatch-only router surface (no current in-package implementer). */
8
+ export interface IntentRouter {
9
+ dispatch<K extends keyof IntentRegistry>(message: IntentMessage<K>): Promise<void>;
10
+ }
11
+ export type LocalIntentHandler<K extends keyof IntentRegistry = keyof IntentRegistry> = (message: IntentMessage<K>) => void | Promise<void>;
12
+ export interface IntentRouterController {
13
+ /**
14
+ * Route an inbound intent. `senderWindowId`, when provided, is the trusted
15
+ * windowId the channel authenticated; it overrides the (forgeable)
16
+ * `envelope.sender.windowId` before the pipeline runs.
17
+ */
18
+ handleInbound(origin: IntentOrigin, message: IntentMessage, senderWindowId?: string): Promise<void>;
19
+ dispatchLocal(message: IntentMessage): Promise<void>;
20
+ setPolicy(policy: IntentPolicy): void;
21
+ onLocal<K extends keyof IntentRegistry>(name: K, handler: LocalIntentHandler<K>): () => void;
22
+ }
23
+ export type IntentRouterConfig = {
24
+ selfWindowId: string;
25
+ pipeline: IntentPipeline;
26
+ parent: ParentChannel | null;
27
+ children: ChildrenChannelController;
28
+ windows: ReadonlyMap<string, Window>;
29
+ };
30
+ export declare function createIntentRouter(config: IntentRouterConfig): IntentRouterController;
31
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/intent/router.ts"],"names":[],"mappings":"AAAA,OAAO,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AAE,aAAa,GAAG,IAAI,CAAA;IAC5B,QAAQ,EAAE,yBAAyB,CAAA;IACnC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC,CAAA;AAOD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,sBAAsB,CA4ErF"}
@@ -1,18 +1,4 @@
1
- /**
2
- * Default policy:
3
- * - intent arrives from a child → handle locally
4
- * - intent arrives from the parent → handle locally
5
- * - intent initiated locally (self) → send up to parent if we have one,
6
- * otherwise keep it local
7
- */
8
- function defaultPolicy() {
9
- return (message, ctx) => {
10
- if (ctx.origin === 'self') {
11
- return ctx.hasParent ? { kind: 'parent', message } : { kind: 'local', message };
12
- }
13
- return { kind: 'local', message };
14
- };
15
- }
1
+ import { defaultPolicy } from './policy';
16
2
  /** Return a copy of `message` with a trusted `sender.windowId`. */
17
3
  function withSender(message, windowId) {
18
4
  return { ...message, envelope: { ...message.envelope, sender: { windowId } } };
@@ -0,0 +1,33 @@
1
+ import type { FnMap } from '@astrale-os/kernel-client';
2
+ import type { BoundClientSessionView } from '@astrale-os/kernel-client/session';
3
+ /**
4
+ * The shell's kernel handle — the kernel-client `BoundClientSessionView` bound
5
+ * to this shell's credential. The bound view IS the surface: the graph sugar
6
+ * (`.get/.node/.children/.query/.mutate/…` over the two kernel doors), dispatch
7
+ * (`.call/.stream/.as/…`) and the `auth` control plane
8
+ * (`.auth.mint/.credential/.whoami/…`). The extras below are the deprecated
9
+ * iframe ABI, kept working until Views adopt `.auth.*`.
10
+ */
11
+ export type KernelClient = BoundClientSessionView<FnMap> & {
12
+ /**
13
+ * @deprecated iframe ABI — use `shell.kernel.auth.mint()`. Despite the name,
14
+ * mints an *identity* credential for the current principal (v1 misnomer).
15
+ */
16
+ mintDelegation(): Promise<string>;
17
+ /**
18
+ * @deprecated iframe ABI — use `shell.kernel.auth.credential()`. The current
19
+ * JWT for a raw `fetch()`; auto-refreshed, so read fresh per request.
20
+ */
21
+ authToken(): string;
22
+ /**
23
+ * Kernel envelope endpoint this shell talks to. In same-origin GUI shells this
24
+ * may be the resolved `/api/` route; direct instance/dev shells usually pass a
25
+ * full instance endpoint such as `https://example.eu.astrale.ai/api/`.
26
+ *
27
+ * Worker REST routes are different audiences. Do not assume `url` is the right
28
+ * target for a raw stream just because the source credential came from the
29
+ * kernel.
30
+ */
31
+ readonly url: string;
32
+ };
33
+ //# sourceMappingURL=client.d.ts.map