@astrale-os/shell 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/apps.d.ts +4 -4
- package/dist/application/apps.d.ts.map +1 -1
- package/dist/application/apps.js +5 -9
- package/dist/application/namespaces.d.ts +4 -4
- package/dist/application/namespaces.d.ts.map +1 -1
- package/dist/application/namespaces.js +4 -4
- package/dist/application/session/open.d.ts +2 -2
- package/dist/application/session/open.d.ts.map +1 -1
- package/dist/application/session/open.js +1 -1
- package/dist/application/session/session.d.ts +1 -1
- package/dist/application/session/session.d.ts.map +1 -1
- package/dist/application/session/token.d.ts +1 -1
- package/dist/application/session/token.d.ts.map +1 -1
- package/dist/application/session/token.js +2 -2
- package/dist/application/spaces.d.ts +3 -3
- package/dist/application/spaces.d.ts.map +1 -1
- package/dist/application/spaces.js +3 -6
- package/dist/application/user.d.ts +4 -4
- package/dist/application/user.d.ts.map +1 -1
- package/dist/application/user.js +6 -6
- package/dist/application/view.d.ts +8 -4
- package/dist/application/view.d.ts.map +1 -1
- package/dist/application/view.js +3 -3
- package/dist/channel/children.d.ts +3 -3
- package/dist/channel/children.d.ts.map +1 -1
- package/dist/channel/listeners.d.ts +1 -1
- package/dist/channel/listeners.d.ts.map +1 -1
- package/dist/channel/message-port.d.ts +1 -1
- package/dist/channel/message-port.d.ts.map +1 -1
- package/dist/channel/observer.d.ts +1 -1
- package/dist/channel/observer.d.ts.map +1 -1
- package/dist/channel/parent.d.ts +3 -3
- package/dist/channel/parent.d.ts.map +1 -1
- package/dist/channel/parent.js +1 -1
- package/dist/channel/transport.d.ts +1 -1
- package/dist/channel/transport.d.ts.map +1 -1
- package/dist/index.d.ts +56 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -20
- package/dist/intent/middleware/capabilities.d.ts +3 -3
- package/dist/intent/middleware/capabilities.d.ts.map +1 -1
- package/dist/intent/middleware/logging.d.ts +1 -1
- package/dist/intent/middleware/logging.d.ts.map +1 -1
- package/dist/intent/middleware/rate-limit.d.ts +2 -2
- package/dist/intent/middleware/rate-limit.d.ts.map +1 -1
- package/dist/intent/pipeline.d.ts +1 -1
- package/dist/intent/pipeline.d.ts.map +1 -1
- package/dist/intent/policy.d.ts +2 -2
- package/dist/intent/policy.d.ts.map +1 -1
- package/dist/intent/request.d.ts +3 -3
- package/dist/intent/request.d.ts.map +1 -1
- package/dist/intent/router.d.ts +6 -6
- package/dist/intent/router.d.ts.map +1 -1
- package/dist/intent/router.js +1 -1
- package/dist/kernel/credential.d.ts +2 -2
- package/dist/kernel/credential.d.ts.map +1 -1
- package/dist/kernel/delegated.d.ts +3 -3
- package/dist/kernel/delegated.d.ts.map +1 -1
- package/dist/kernel/delegated.js +1 -1
- package/dist/kernel/delegation/refresh.d.ts +1 -1
- package/dist/kernel/delegation/refresh.d.ts.map +1 -1
- package/dist/kernel/delegation/refresh.js +1 -1
- package/dist/message/message.d.ts +3 -3
- package/dist/message/message.d.ts.map +1 -1
- package/dist/shell/access.d.ts +2 -2
- package/dist/shell/access.d.ts.map +1 -1
- package/dist/shell/access.js +1 -1
- package/dist/shell/build.d.ts +11 -11
- package/dist/shell/build.d.ts.map +1 -1
- package/dist/shell/build.js +1 -1
- package/dist/shell/config.d.ts +1 -1
- package/dist/shell/config.d.ts.map +1 -1
- package/dist/shell/create.d.ts +2 -2
- package/dist/shell/create.d.ts.map +1 -1
- package/dist/shell/create.js +2 -2
- package/dist/shell/sandboxed/boot.d.ts +4 -4
- package/dist/shell/sandboxed/boot.d.ts.map +1 -1
- package/dist/shell/sandboxed/boot.js +5 -5
- package/dist/shell/sandboxed/guarded.d.ts +2 -2
- package/dist/shell/sandboxed/guarded.d.ts.map +1 -1
- package/dist/shell/sandboxed/pending.d.ts +2 -2
- package/dist/shell/sandboxed/pending.d.ts.map +1 -1
- package/dist/shell/sandboxed/sandboxed.d.ts +2 -2
- package/dist/shell/sandboxed/sandboxed.d.ts.map +1 -1
- package/dist/shell/sandboxed/sandboxed.js +10 -10
- package/dist/shell/shell.d.ts +12 -12
- package/dist/shell/shell.d.ts.map +1 -1
- package/dist/shell/standalone.d.ts +2 -2
- package/dist/shell/standalone.d.ts.map +1 -1
- package/dist/shell/standalone.js +9 -9
- package/dist/window/capabilities.d.ts +1 -1
- package/dist/window/capabilities.d.ts.map +1 -1
- package/dist/window/embed/adapter.d.ts +1 -1
- package/dist/window/embed/adapter.d.ts.map +1 -1
- package/dist/window/embed/iframe.d.ts +1 -1
- package/dist/window/embed/iframe.d.ts.map +1 -1
- package/dist/window/lifecycle/states.d.ts +2 -2
- package/dist/window/lifecycle/states.d.ts.map +1 -1
- package/dist/window/lifecycle/states.js +1 -1
- package/dist/window/lifecycle/transition.d.ts +1 -1
- package/dist/window/lifecycle/transition.d.ts.map +1 -1
- package/dist/window/mount/close.d.ts +6 -6
- package/dist/window/mount/close.d.ts.map +1 -1
- package/dist/window/mount/credential.d.ts +5 -5
- package/dist/window/mount/credential.d.ts.map +1 -1
- package/dist/window/mount/credential.js +1 -1
- package/dist/window/mount/handshake.js +1 -1
- package/dist/window/mount/mount.d.ts +6 -6
- package/dist/window/mount/mount.d.ts.map +1 -1
- package/dist/window/mount/mount.js +5 -5
- package/dist/window/mount/params.d.ts +2 -2
- package/dist/window/mount/params.d.ts.map +1 -1
- package/dist/window/mount/plain.d.ts +5 -5
- package/dist/window/mount/plain.d.ts.map +1 -1
- package/dist/window/mount/plain.js +1 -1
- package/dist/window/window.d.ts +1 -1
- package/dist/window/window.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/application/apps.ts +9 -13
- package/src/application/namespaces.ts +8 -8
- package/src/application/session/open.ts +4 -4
- package/src/application/session/session.ts +1 -1
- package/src/application/session/token.ts +3 -3
- package/src/application/spaces.ts +6 -11
- package/src/application/user.ts +10 -10
- package/src/application/view.ts +11 -7
- package/src/channel/children.ts +3 -3
- package/src/channel/listeners.ts +1 -1
- package/src/channel/message-port.ts +2 -2
- package/src/channel/observer.ts +1 -1
- package/src/channel/parent.ts +4 -4
- package/src/channel/transport.ts +1 -1
- package/src/index.ts +56 -56
- package/src/intent/middleware/capabilities.ts +3 -3
- package/src/intent/middleware/logging.ts +2 -2
- package/src/intent/middleware/rate-limit.ts +2 -2
- package/src/intent/pipeline.ts +1 -1
- package/src/intent/policy.ts +2 -2
- package/src/intent/request.ts +3 -3
- package/src/intent/router.ts +7 -7
- package/src/kernel/credential.ts +2 -2
- package/src/kernel/delegated.ts +4 -4
- package/src/kernel/delegation/refresh.ts +2 -2
- package/src/message/message.ts +3 -3
- package/src/shell/access.ts +3 -3
- package/src/shell/build.ts +13 -13
- package/src/shell/config.ts +1 -1
- package/src/shell/create.ts +4 -4
- package/src/shell/sandboxed/boot.ts +9 -9
- package/src/shell/sandboxed/guarded.ts +2 -2
- package/src/shell/sandboxed/pending.ts +2 -2
- package/src/shell/sandboxed/sandboxed.ts +18 -18
- package/src/shell/shell.ts +12 -12
- package/src/shell/standalone.ts +13 -13
- package/src/window/capabilities.ts +1 -1
- package/src/window/embed/adapter.ts +1 -1
- package/src/window/embed/iframe.ts +2 -2
- package/src/window/lifecycle/states.ts +2 -2
- package/src/window/lifecycle/transition.ts +1 -1
- package/src/window/mount/close.ts +6 -6
- package/src/window/mount/credential.ts +5 -5
- package/src/window/mount/handshake.ts +3 -3
- package/src/window/mount/mount.ts +13 -13
- package/src/window/mount/params.ts +2 -2
- package/src/window/mount/plain.ts +6 -6
- package/src/window/window.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/window/embed/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/window/embed/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAAA;IACjD,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,wFAAwF;AACxF,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAA;CAC3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../../src/window/embed/iframe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../../src/window/embed/iframe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,cAAc,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA;AAUD,wBAAgB,wBAAwB,CAAC,MAAM,GAAE,wBAA6B,GAAG,YAAY,CAsC5F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WindowState } from '../window';
|
|
2
|
-
import { type LifecycleEvent } from './transition';
|
|
1
|
+
import type { WindowState } from '../window.js';
|
|
2
|
+
import { type LifecycleEvent } from './transition.js';
|
|
3
3
|
/** Live per-window lifecycle states, advanced only through the transition machine. */
|
|
4
4
|
export interface LifecycleController {
|
|
5
5
|
register(windowId: string, initial?: WindowState): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../../../src/window/lifecycle/states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../../../src/window/lifecycle/states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEjE,sFAAsF;AACtF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IACvD,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,WAAW,GAAG,IAAI,CAAA;IAClE,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CA4B/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/window/lifecycle/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/window/lifecycle/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAA;AAE1B,MAAM,MAAM,gBAAgB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9F;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,GAAG,gBAAgB,CAsBtF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ChildrenChannelController } from '../../channel/children';
|
|
2
|
-
import type { TokenRefresher } from '../../kernel/delegation/refresh';
|
|
3
|
-
import type { WindowHandle } from '../embed/adapter';
|
|
4
|
-
import type { LifecycleController } from '../lifecycle/states';
|
|
5
|
-
import type { Window } from '../window';
|
|
6
|
-
import type { CloseResult } from './params';
|
|
1
|
+
import type { ChildrenChannelController } from '../../channel/children.js';
|
|
2
|
+
import type { TokenRefresher } from '../../kernel/delegation/refresh.js';
|
|
3
|
+
import type { WindowHandle } from '../embed/adapter.js';
|
|
4
|
+
import type { LifecycleController } from '../lifecycle/states.js';
|
|
5
|
+
import type { Window } from '../window.js';
|
|
6
|
+
import type { CloseResult } from './params.js';
|
|
7
7
|
/** A mounted window's runtime entry — everything `close()` must tear down. */
|
|
8
8
|
export type MountEntry = {
|
|
9
9
|
readonly handle: WindowHandle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/window/mount/close.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/window/mount/close.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAM9C,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAA;IAClC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAChC,QAAQ,EAAE,yBAAyB,CAAA;IACnC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,CACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,KAC3C,OAAO,CAAC,WAAW,CAAC,CAAA;AAEzB,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAmCpD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ChildrenChannelController } from '../../channel/children';
|
|
2
|
-
import type { KernelClient } from '../../kernel/client';
|
|
3
|
-
import type { Window } from '../window';
|
|
4
|
-
import type { MountCredential } from './params';
|
|
5
|
-
import { type TokenRefresher } from '../../kernel/delegation/refresh';
|
|
1
|
+
import type { ChildrenChannelController } from '../../channel/children.js';
|
|
2
|
+
import type { KernelClient } from '../../kernel/client.js';
|
|
3
|
+
import type { Window } from '../window.js';
|
|
4
|
+
import type { MountCredential } from './params.js';
|
|
5
|
+
import { type TokenRefresher } from '../../kernel/delegation/refresh.js';
|
|
6
6
|
export type AcquiredCredential = {
|
|
7
7
|
credential: string;
|
|
8
8
|
expiresAt: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential.d.ts","sourceRoot":"","sources":["../../../src/window/mount/credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"credential.d.ts","sourceRoot":"","sources":["../../../src/window/mount/credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAE9F,MAAM,MAAM,kBAAkB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1E,mGAAmG;AACnG,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B,GAAG;IACF,OAAO,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAC1C,WAAW,EAAE,CAAC,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAA;CACxD,CAkBA;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,kBAAkB,CAAA;IAC3B,WAAW,EAAE,CAAC,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAA;IACvD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,QAAQ,EAAE,yBAAyB,CAAA;IACnC,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,GAAG,cAAc,CAqCjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTokenRefresher } from '../../kernel/delegation/refresh';
|
|
1
|
+
import { createTokenRefresher } from '../../kernel/delegation/refresh.js';
|
|
2
2
|
/** No-op refresher for windows with no token to refresh (plain mounts, no-refresh credentials). */
|
|
3
3
|
export const NOOP_REFRESHER = {
|
|
4
4
|
start: () => { },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INIT_RESPONSE_TYPE, isInitRequest } from '../../message/init';
|
|
1
|
+
import { INIT_RESPONSE_TYPE, isInitRequest } from '../../message/init.js';
|
|
2
2
|
/** Parent-side handshake: wait for INIT_REQUEST, transfer a MessagePort, complete ctrl:handshake. */
|
|
3
3
|
export function runParentHandshake(params) {
|
|
4
4
|
const { iframe, expectedOrigin, timeoutMs } = params;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ChildrenChannelController } from '../../channel/children';
|
|
2
|
-
import type { KernelClient } from '../../kernel/client';
|
|
3
|
-
import type { ShellAdapter } from '../embed/adapter';
|
|
4
|
-
import type { LifecycleController } from '../lifecycle/states';
|
|
5
|
-
import type { Window } from '../window';
|
|
6
|
-
import type { CloseResult, MountedWindow, MountParams } from './params';
|
|
1
|
+
import type { ChildrenChannelController } from '../../channel/children.js';
|
|
2
|
+
import type { KernelClient } from '../../kernel/client.js';
|
|
3
|
+
import type { ShellAdapter } from '../embed/adapter.js';
|
|
4
|
+
import type { LifecycleController } from '../lifecycle/states.js';
|
|
5
|
+
import type { Window } from '../window.js';
|
|
6
|
+
import type { CloseResult, MountedWindow, MountParams } from './params.js';
|
|
7
7
|
export type MountControllerConfig = {
|
|
8
8
|
adapter: ShellAdapter;
|
|
9
9
|
kernel: KernelClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/window/mount/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/window/mount/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAW1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,YAAY,CAAA;IACrB,MAAM,EAAE,YAAY,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,yBAAyB,CAAA;IAC1C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;CAC/B,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAClD,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAC7F,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAuJpF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createMessagePortTransport } from '../../channel/message-port';
|
|
2
|
-
import { createCloser } from './close';
|
|
3
|
-
import { credentialSource, wireTokenRefresher } from './credential';
|
|
4
|
-
import { runParentHandshake } from './handshake';
|
|
5
|
-
import { mountPlain } from './plain';
|
|
1
|
+
import { createMessagePortTransport } from '../../channel/message-port.js';
|
|
2
|
+
import { createCloser } from './close.js';
|
|
3
|
+
import { credentialSource, wireTokenRefresher } from './credential.js';
|
|
4
|
+
import { runParentHandshake } from './handshake.js';
|
|
5
|
+
import { mountPlain } from './plain.js';
|
|
6
6
|
const DEFAULT_HANDSHAKE_TIMEOUT = 5_000;
|
|
7
7
|
const DEFAULT_DELEGATION_TTL = 3_600;
|
|
8
8
|
export function createMountController(config) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SandboxProfile, WindowCapabilities } from '../capabilities';
|
|
2
|
-
import type { Window } from '../window';
|
|
1
|
+
import type { SandboxProfile, WindowCapabilities } from '../capabilities.js';
|
|
2
|
+
import type { Window } from '../window.js';
|
|
3
3
|
/**
|
|
4
4
|
* A PRE-MINTED credential to hand the mounted iframe instead of the shell's
|
|
5
5
|
* own delegation mint — the app-principal path. The caller composes it from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../../src/window/mount/params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../../src/window/mount/params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvE,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAA;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IACtC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAA;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpB,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAAA;KAAE,CAAA;IAC7D,KAAK,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAC5E,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ShellAdapter } from '../embed/adapter';
|
|
2
|
-
import type { LifecycleController } from '../lifecycle/states';
|
|
3
|
-
import type { Window } from '../window';
|
|
4
|
-
import type { Closer, MountEntry } from './close';
|
|
5
|
-
import type { MountedWindow, MountParams } from './params';
|
|
1
|
+
import type { ShellAdapter } from '../embed/adapter.js';
|
|
2
|
+
import type { LifecycleController } from '../lifecycle/states.js';
|
|
3
|
+
import type { Window } from '../window.js';
|
|
4
|
+
import type { Closer, MountEntry } from './close.js';
|
|
5
|
+
import type { MountedWindow, MountParams } from './params.js';
|
|
6
6
|
export type PlainMountDeps = {
|
|
7
7
|
adapter: ShellAdapter;
|
|
8
8
|
windows: Map<string, Window>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plain.d.ts","sourceRoot":"","sources":["../../../src/window/mount/plain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"plain.d.ts","sourceRoot":"","sources":["../../../src/window/mount/plain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAI7D,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,YAAY,CAAA;IACrB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;IAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAChC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,aAAa,CAAC,CAyCxB"}
|
package/dist/window/window.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/window/window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/window/window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;AAEpE,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,QAAQ,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAA;CAC1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/shell",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Astrale Shell SDK — parent/child/kernel communication",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@astrale-domains/shell-schema": ">=0.3.
|
|
29
|
-
"@astrale-os/kernel-client": ">=0.4.
|
|
30
|
-
"@astrale-os/kernel-core": ">=0.7.
|
|
31
|
-
"@astrale-os/kernel-dsl": ">=0.1.
|
|
28
|
+
"@astrale-domains/shell-schema": ">=0.3.2 <1.0.0",
|
|
29
|
+
"@astrale-os/kernel-client": ">=0.4.5 <1.0.0",
|
|
30
|
+
"@astrale-os/kernel-core": ">=0.7.4 <1.0.0",
|
|
31
|
+
"@astrale-os/kernel-dsl": ">=0.1.4 <1.0.0",
|
|
32
32
|
"jose": "^6.2.3",
|
|
33
33
|
"zod": "^4.3.6"
|
|
34
34
|
},
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"typecheck": "tsgo --noEmit && tsgo --noEmit -p tsconfig.test.json",
|
|
45
45
|
"test": "vitest run",
|
|
46
46
|
"test:watch": "vitest",
|
|
47
|
-
"preinstall": "node
|
|
47
|
+
"preinstall": "node -e \"try{require('./.check-workspace.cjs')}catch{}\""
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/application/apps.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { BoundNode, DefOf, NodeRefInput } from '@astrale-os/kernel-client'
|
|
|
3
3
|
import { D } from '@astrale-domains/shell-schema'
|
|
4
4
|
import { normalizeRef } from '@astrale-os/kernel-client'
|
|
5
5
|
|
|
6
|
-
import type { KernelClient } from '../kernel/client'
|
|
7
|
-
import type { AppSession } from './session/session'
|
|
8
|
-
import type {
|
|
6
|
+
import type { KernelClient } from '../kernel/client.js'
|
|
7
|
+
import type { AppSession } from './session/session.js'
|
|
8
|
+
import type { ShellView, ShellSchema } from './view.js'
|
|
9
9
|
|
|
10
|
-
import { openAppSession } from './session/open'
|
|
10
|
+
import { openAppSession } from './session/open.js'
|
|
11
11
|
|
|
12
12
|
/** An installed `Application` node. */
|
|
13
13
|
export type ApplicationNode = BoundNode<DefOf<ShellSchema, 'Application'>, ShellSchema>
|
|
@@ -26,18 +26,14 @@ const INSTALLED_IN_EDGE = D.installed_in.path.class.raw
|
|
|
26
26
|
|
|
27
27
|
export function createAppsNamespace(
|
|
28
28
|
kernel: KernelClient,
|
|
29
|
-
v:
|
|
29
|
+
v: ShellView,
|
|
30
30
|
deps?: { readonly now?: () => number },
|
|
31
31
|
): AppsNamespace {
|
|
32
32
|
return {
|
|
33
33
|
async install(target, space) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
target,
|
|
38
|
-
space: normalizeRef(space),
|
|
39
|
-
})) as { id: string }
|
|
40
|
-
const app = await v.view().node('Application', `@${created.id}`)
|
|
34
|
+
const Application = v.get().classes.Application
|
|
35
|
+
const created = await Application.install({ target, space: normalizeRef(space) })
|
|
36
|
+
const app = await Application.get(`@${created.id}`)
|
|
41
37
|
if (!app) throw new Error(`Application.install: app @${created.id} is not readable`)
|
|
42
38
|
return app
|
|
43
39
|
},
|
|
@@ -52,7 +48,7 @@ export function createAppsNamespace(
|
|
|
52
48
|
},
|
|
53
49
|
|
|
54
50
|
async open(app) {
|
|
55
|
-
const node = await v.
|
|
51
|
+
const node = await v.get().classes.Application.get(app)
|
|
56
52
|
if (!node) throw new Error(`apps.open: application ${normalizeRef(app)} is not readable`)
|
|
57
53
|
return openAppSession({ kernel, ...(deps?.now ? { now: deps.now } : {}) }, node.id)
|
|
58
54
|
},
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* exactly these. Pure closures over a lazy typed view — constructing this
|
|
5
5
|
* touches no kernel (safe before a sandboxed shell's `init()`).
|
|
6
6
|
*/
|
|
7
|
-
import type { KernelClient } from '../kernel/client'
|
|
8
|
-
import type { AppsNamespace } from './apps'
|
|
9
|
-
import type { SpacesNamespace } from './spaces'
|
|
10
|
-
import type { UserNamespace } from './user'
|
|
7
|
+
import type { KernelClient } from '../kernel/client.js'
|
|
8
|
+
import type { AppsNamespace } from './apps.js'
|
|
9
|
+
import type { SpacesNamespace } from './spaces.js'
|
|
10
|
+
import type { UserNamespace } from './user.js'
|
|
11
11
|
|
|
12
|
-
import { createAppsNamespace } from './apps'
|
|
13
|
-
import { createSpacesNamespace } from './spaces'
|
|
14
|
-
import { createUserNamespace } from './user'
|
|
15
|
-
import { createShellDomainView } from './view'
|
|
12
|
+
import { createAppsNamespace } from './apps.js'
|
|
13
|
+
import { createSpacesNamespace } from './spaces.js'
|
|
14
|
+
import { createUserNamespace } from './user.js'
|
|
15
|
+
import { createShellDomainView } from './view.js'
|
|
16
16
|
|
|
17
17
|
export interface OsNamespaces {
|
|
18
18
|
readonly user: UserNamespace
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { UnresolvedIdentityExpr } from '@astrale-os/kernel-core'
|
|
2
2
|
|
|
3
|
-
import type { KernelClient } from '../../kernel/client'
|
|
4
|
-
import type { MountCredential } from '../../window/mount/params'
|
|
5
|
-
import type { AppSession, AppView } from './session'
|
|
3
|
+
import type { KernelClient } from '../../kernel/client.js'
|
|
4
|
+
import type { MountCredential } from '../../window/mount/params.js'
|
|
5
|
+
import type { AppSession, AppView } from './session.js'
|
|
6
6
|
|
|
7
|
-
import { createTokenCycle } from './token'
|
|
7
|
+
import { createTokenCycle } from './token.js'
|
|
8
8
|
|
|
9
9
|
/** The wire shape of `app::open`. */
|
|
10
10
|
interface OpenResult {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* server contract lives in the shell domain's `Application` methods
|
|
5
5
|
* (`runtime/application/{open,get-access-token}`).
|
|
6
6
|
*/
|
|
7
|
-
import type { MountCredential } from '../../window/mount/params'
|
|
7
|
+
import type { MountCredential } from '../../window/mount/params.js'
|
|
8
8
|
|
|
9
9
|
/** The entry view returned by `app::open`, described for mounting. */
|
|
10
10
|
export interface AppView {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { UnresolvedIdentityExpr } from '@astrale-os/kernel-core'
|
|
2
2
|
|
|
3
|
-
import type { KernelClient } from '../../kernel/client'
|
|
3
|
+
import type { KernelClient } from '../../kernel/client.js'
|
|
4
4
|
|
|
5
|
-
import { REFRESH_WINDOW_MS } from '../../kernel/delegation/token'
|
|
6
|
-
import { AppSessionRefreshError } from './session'
|
|
5
|
+
import { REFRESH_WINDOW_MS } from '../../kernel/delegation/token.js'
|
|
6
|
+
import { AppSessionRefreshError } from './session.js'
|
|
7
7
|
|
|
8
8
|
/** The wire shape of `app::getAccessToken`. */
|
|
9
9
|
interface AccessTokenResult {
|
|
@@ -2,8 +2,8 @@ import type { BoundNode, DefOf, NodeRefInput } from '@astrale-os/kernel-client'
|
|
|
2
2
|
|
|
3
3
|
import { normalizeRef } from '@astrale-os/kernel-client'
|
|
4
4
|
|
|
5
|
-
import type { KernelClient } from '../kernel/client'
|
|
6
|
-
import type {
|
|
5
|
+
import type { KernelClient } from '../kernel/client.js'
|
|
6
|
+
import type { ShellView, ShellSchema } from './view.js'
|
|
7
7
|
|
|
8
8
|
/** A workspace `Space` node. */
|
|
9
9
|
export type SpaceNode = BoundNode<DefOf<ShellSchema, 'Space'>, ShellSchema>
|
|
@@ -20,7 +20,7 @@ export interface SpacesNamespace {
|
|
|
20
20
|
/** The spaces directory (mirrors the shell domain's `SPACES_DIR`). */
|
|
21
21
|
const SPACES_DIR = '/spaces'
|
|
22
22
|
|
|
23
|
-
export function createSpacesNamespace(kernel: KernelClient, v:
|
|
23
|
+
export function createSpacesNamespace(kernel: KernelClient, v: ShellView): SpacesNamespace {
|
|
24
24
|
return {
|
|
25
25
|
async list() {
|
|
26
26
|
const page = await kernel.children(SPACES_DIR)
|
|
@@ -37,14 +37,9 @@ export function createSpacesNamespace(kernel: KernelClient, v: ShellDomainView):
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
async create(opts) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const create = v.view()('Space').create as (params?: {
|
|
44
|
-
name?: string
|
|
45
|
-
}) => Promise<{ id: string }>
|
|
46
|
-
const created = await create(opts?.name !== undefined ? { name: opts.name } : undefined)
|
|
47
|
-
const space = await v.view().node('Space', `@${created.id}`)
|
|
40
|
+
const Space = v.get().classes.Space
|
|
41
|
+
const created = await Space.create(opts?.name !== undefined ? { name: opts.name } : undefined)
|
|
42
|
+
const space = await Space.get(`@${created.id}`)
|
|
48
43
|
if (!space) throw new Error(`Space.create: created space @${created.id} is not readable`)
|
|
49
44
|
return space
|
|
50
45
|
},
|
package/src/application/user.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { BoundNode, DefOf, NodeRefInput } from '@astrale-os/kernel-client'
|
|
|
2
2
|
|
|
3
3
|
import { normalizeRef } from '@astrale-os/kernel-client'
|
|
4
4
|
|
|
5
|
-
import type { KernelClient } from '../kernel/client'
|
|
6
|
-
import type { SpaceNode } from './spaces'
|
|
7
|
-
import type {
|
|
5
|
+
import type { KernelClient } from '../kernel/client.js'
|
|
6
|
+
import type { SpaceNode } from './spaces.js'
|
|
7
|
+
import type { ShellView, ShellSchema } from './view.js'
|
|
8
8
|
|
|
9
|
-
import { asArray } from './view'
|
|
9
|
+
import { asArray } from './view.js'
|
|
10
10
|
|
|
11
11
|
/** Self as the shell-domain `User` — typed `firstName`/`lastName`/`email`. */
|
|
12
12
|
export type UserNode = BoundNode<DefOf<ShellSchema, 'User'>, ShellSchema>
|
|
@@ -24,9 +24,9 @@ export interface UserNamespace {
|
|
|
24
24
|
roles(): Promise<RoleNode[]>
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function createUserNamespace(kernel: KernelClient, v:
|
|
27
|
+
export function createUserNamespace(kernel: KernelClient, v: ShellView): UserNamespace {
|
|
28
28
|
async function me(): Promise<UserNode> {
|
|
29
|
-
return v.
|
|
29
|
+
return v.get().bind('User', await kernel.auth.whoami())
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return {
|
|
@@ -34,19 +34,19 @@ export function createUserNamespace(kernel: KernelClient, v: ShellDomainView): U
|
|
|
34
34
|
|
|
35
35
|
async currentSpace() {
|
|
36
36
|
const self = await me()
|
|
37
|
-
const first = asArray(await self.out('selected_space'))[0]
|
|
37
|
+
const first = asArray(await self.links.out('selected_space'))[0]
|
|
38
38
|
return first ? v.bindAs('Space', first.raw) : null
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
async switchSpace(ref) {
|
|
42
42
|
const self = await me()
|
|
43
|
-
await self.
|
|
43
|
+
await self.switchSpace({ space: normalizeRef(ref) })
|
|
44
44
|
},
|
|
45
45
|
|
|
46
46
|
async roles() {
|
|
47
47
|
const self = await me()
|
|
48
|
-
return asArray(await self.out('has_role')).flatMap((
|
|
49
|
-
const role = v.bindAs('Role',
|
|
48
|
+
return asArray(await self.links.out('has_role')).flatMap((node) => {
|
|
49
|
+
const role = v.bindAs('Role', node.raw)
|
|
50
50
|
return role ? [role] : []
|
|
51
51
|
})
|
|
52
52
|
},
|
package/src/application/view.ts
CHANGED
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
* shell domain (`@astrale-domains/shell-schema`). The bound view is built LAZILY
|
|
4
4
|
* (first call) so the sandboxed shell's "init() first" kernel guard applies
|
|
5
5
|
* uniformly — constructing namespaces touches no kernel.
|
|
6
|
+
*
|
|
7
|
+
* Typed access uses `.classes`: `get().classes.Space(ref)` dispatches without
|
|
8
|
+
* a read and `get().classes.Space.get(ref)` returns a bound node.
|
|
6
9
|
*/
|
|
7
10
|
import type { BoundNode, DefOf, SchemaBoundView } from '@astrale-os/kernel-client'
|
|
8
11
|
import type { Node } from '@astrale-os/kernel-core'
|
|
9
12
|
|
|
10
13
|
import { schema } from '@astrale-domains/shell-schema'
|
|
11
14
|
|
|
12
|
-
import type { KernelClient } from '../kernel/client'
|
|
15
|
+
import type { KernelClient } from '../kernel/client.js'
|
|
13
16
|
|
|
14
17
|
export type ShellSchema = typeof schema
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
/** Lazily-created schema-bound Shell client. */
|
|
20
|
+
export interface ShellView {
|
|
21
|
+
get(): SchemaBoundView<ShellSchema>
|
|
18
22
|
/** Bind `node` as `type` when its concrete class satisfies it, else `null`. */
|
|
19
23
|
bindAs<T extends 'User' | 'Space' | 'Application' | 'Role'>(
|
|
20
24
|
type: T,
|
|
@@ -22,14 +26,14 @@ export interface ShellDomainView {
|
|
|
22
26
|
): BoundNode<DefOf<ShellSchema, T>, ShellSchema> | null
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
export function createShellDomainView(kernel: KernelClient):
|
|
29
|
+
export function createShellDomainView(kernel: KernelClient): ShellView {
|
|
26
30
|
let bound: SchemaBoundView<ShellSchema> | null = null
|
|
27
|
-
const
|
|
31
|
+
const get = (): SchemaBoundView<ShellSchema> => (bound ??= kernel.withSchema(schema))
|
|
28
32
|
|
|
29
33
|
return {
|
|
30
|
-
|
|
34
|
+
get,
|
|
31
35
|
bindAs(type, node) {
|
|
32
|
-
const v =
|
|
36
|
+
const v = get()
|
|
33
37
|
return v.bindAny(node).is(type) ? v.bind(type, node) : null
|
|
34
38
|
},
|
|
35
39
|
}
|
package/src/channel/children.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { MessageOf, MessageType, ShellMessage } from '../message/message'
|
|
2
|
-
import type { MessageObserver } from './observer'
|
|
3
|
-
import type { Transport } from './transport'
|
|
1
|
+
import type { MessageOf, MessageType, ShellMessage } from '../message/message.js'
|
|
2
|
+
import type { MessageObserver } from './observer.js'
|
|
3
|
+
import type { Transport } from './transport.js'
|
|
4
4
|
|
|
5
5
|
/** Multiplexed channels down to child windows, keyed by windowId. */
|
|
6
6
|
export interface ChildrenChannel {
|
package/src/channel/listeners.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageHandler, MessageOf, MessageType, ShellMessage } from '../message/message'
|
|
1
|
+
import type { MessageHandler, MessageOf, MessageType, ShellMessage } from '../message/message.js'
|
|
2
2
|
|
|
3
3
|
/** Per-message-type listener registry — the fan-out primitive channels share. */
|
|
4
4
|
export interface MessageListeners {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ShellMessage } from '../message/message'
|
|
2
|
-
import type { Transport } from './transport'
|
|
1
|
+
import type { ShellMessage } from '../message/message.js'
|
|
2
|
+
import type { Transport } from './transport.js'
|
|
3
3
|
|
|
4
4
|
export type MessagePortTransportConfig = {
|
|
5
5
|
port: MessagePort
|
package/src/channel/observer.ts
CHANGED
package/src/channel/parent.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { MessageHandler, MessageOf, MessageType, ShellMessage } from '../message/message'
|
|
2
|
-
import type { MessageObserver } from './observer'
|
|
3
|
-
import type { Transport } from './transport'
|
|
1
|
+
import type { MessageHandler, MessageOf, MessageType, ShellMessage } from '../message/message.js'
|
|
2
|
+
import type { MessageObserver } from './observer.js'
|
|
3
|
+
import type { Transport } from './transport.js'
|
|
4
4
|
|
|
5
|
-
import { createMessageListeners } from './listeners'
|
|
5
|
+
import { createMessageListeners } from './listeners.js'
|
|
6
6
|
|
|
7
7
|
/** The child's single channel up to its parent shell. */
|
|
8
8
|
export interface ParentChannel {
|
package/src/channel/transport.ts
CHANGED