@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.
- package/LICENSE +202 -0
- package/dist/application/apps.d.ts +18 -0
- package/dist/application/apps.d.ts.map +1 -0
- package/dist/application/apps.js +35 -0
- package/dist/application/namespaces.d.ts +21 -0
- package/dist/application/namespaces.d.ts.map +1 -0
- package/dist/application/namespaces.js +12 -0
- package/dist/application/session/open.d.ts +19 -0
- package/dist/application/session/open.d.ts.map +1 -0
- package/dist/application/session/open.js +46 -0
- package/dist/application/session/session.d.ts +41 -0
- package/dist/application/session/session.d.ts.map +1 -0
- package/dist/application/session/session.js +9 -0
- package/dist/application/session/token.d.ts +24 -0
- package/dist/application/session/token.d.ts.map +1 -0
- package/dist/application/session/token.js +51 -0
- package/dist/application/spaces.d.ts +17 -0
- package/dist/application/spaces.d.ts.map +1 -0
- package/dist/application/spaces.js +30 -0
- package/dist/application/user.d.ts +20 -0
- package/dist/application/user.d.ts.map +1 -0
- package/dist/application/user.js +26 -0
- package/dist/application/view.d.ts +20 -0
- package/dist/application/view.d.ts.map +1 -0
- package/dist/application/view.js +18 -0
- package/dist/{application/channels/children-channel.d.ts → channel/children.d.ts} +4 -4
- package/dist/channel/children.d.ts.map +1 -0
- package/dist/channel/listeners.d.ts +8 -0
- package/dist/channel/listeners.d.ts.map +1 -0
- package/dist/{adapters/message-port.transport.d.ts → channel/message-port.d.ts} +2 -2
- package/dist/channel/message-port.d.ts.map +1 -0
- package/dist/{application/channels → channel}/observer.d.ts +2 -1
- package/dist/channel/observer.d.ts.map +1 -0
- package/dist/{application/channels/parent-channel.d.ts → channel/parent.d.ts} +4 -4
- package/dist/channel/parent.d.ts.map +1 -0
- package/dist/{application/channels/parent-channel.js → channel/parent.js} +1 -1
- package/dist/channel/transport.d.ts +8 -0
- package/dist/channel/transport.d.ts.map +1 -0
- package/dist/index.d.ts +56 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -20
- package/dist/{domain/intent → intent}/middleware/capabilities.d.ts +2 -2
- package/dist/intent/middleware/capabilities.d.ts.map +1 -0
- package/dist/intent/middleware/logging.d.ts.map +1 -0
- package/dist/{domain/intent → intent}/middleware/rate-limit.d.ts +1 -1
- package/dist/intent/middleware/rate-limit.d.ts.map +1 -0
- package/dist/{application/intent/pipeline-runner.d.ts → intent/pipeline.d.ts} +3 -3
- package/dist/intent/pipeline.d.ts.map +1 -0
- package/dist/intent/policy.d.ts +40 -0
- package/dist/intent/policy.d.ts.map +1 -0
- package/dist/intent/policy.js +15 -0
- package/dist/{application/intent → intent}/request.d.ts +5 -14
- package/dist/intent/request.d.ts.map +1 -0
- package/dist/{application/intent → intent}/request.js +6 -20
- package/dist/intent/router.d.ts +31 -0
- package/dist/intent/router.d.ts.map +1 -0
- package/dist/{application/intent → intent}/router.js +1 -15
- package/dist/kernel/client.d.ts +33 -0
- package/dist/kernel/client.d.ts.map +1 -0
- package/dist/kernel/credential.d.ts +35 -0
- package/dist/kernel/credential.d.ts.map +1 -0
- package/dist/kernel/credential.js +43 -0
- package/dist/kernel/delegated.d.ts +17 -0
- package/dist/kernel/delegated.d.ts.map +1 -0
- package/dist/kernel/delegated.js +29 -0
- package/dist/{application/windowing/token-refresh.d.ts → kernel/delegation/refresh.d.ts} +2 -2
- package/dist/kernel/delegation/refresh.d.ts.map +1 -0
- package/dist/{application/windowing/token-refresh.js → kernel/delegation/refresh.js} +1 -1
- package/dist/{domain/identity/delegation.d.ts → kernel/delegation/token.d.ts} +1 -1
- package/dist/kernel/delegation/token.d.ts.map +1 -0
- package/dist/{adapters/kernel-client.adapter.d.ts → kernel/session.d.ts} +15 -12
- package/dist/kernel/session.d.ts.map +1 -0
- package/dist/{adapters/kernel-client.adapter.js → kernel/session.js} +10 -15
- package/dist/message/ctrl.d.ts +34 -0
- package/dist/message/ctrl.d.ts.map +1 -0
- package/dist/message/error.d.ts +9 -0
- package/dist/message/error.d.ts.map +1 -0
- package/dist/{application/windowing/protocol.d.ts → message/init.d.ts} +1 -1
- package/dist/message/init.d.ts.map +1 -0
- package/dist/{domain/message/registries.d.ts → message/intent.d.ts} +45 -37
- package/dist/message/intent.d.ts.map +1 -0
- package/dist/message/message.d.ts +10 -0
- package/dist/message/message.d.ts.map +1 -0
- package/dist/shell/access.d.ts +10 -0
- package/dist/shell/access.d.ts.map +1 -0
- package/dist/shell/access.js +19 -0
- package/dist/shell/build.d.ts +28 -0
- package/dist/shell/build.d.ts.map +1 -0
- package/dist/shell/build.js +58 -0
- package/dist/shell/config.d.ts +29 -0
- package/dist/shell/config.d.ts.map +1 -0
- package/dist/shell/create.d.ts +4 -0
- package/dist/shell/create.d.ts.map +1 -0
- package/dist/shell/create.js +5 -0
- package/dist/{application/windowing/child-init.d.ts → shell/sandboxed/boot.d.ts} +5 -5
- package/dist/shell/sandboxed/boot.d.ts.map +1 -0
- package/dist/{application/windowing/child-init.js → shell/sandboxed/boot.js} +5 -6
- package/dist/shell/sandboxed/guarded.d.ts +13 -0
- package/dist/shell/sandboxed/guarded.d.ts.map +1 -0
- package/dist/shell/sandboxed/guarded.js +28 -0
- package/dist/shell/sandboxed/pending.d.ts +14 -0
- package/dist/shell/sandboxed/pending.d.ts.map +1 -0
- package/dist/shell/sandboxed/pending.js +30 -0
- package/dist/shell/sandboxed/sandboxed.d.ts +4 -0
- package/dist/shell/sandboxed/sandboxed.d.ts.map +1 -0
- package/dist/shell/sandboxed/sandboxed.js +100 -0
- package/dist/shell/shell.d.ts +36 -0
- package/dist/shell/shell.d.ts.map +1 -0
- package/dist/shell/standalone.d.ts +4 -0
- package/dist/shell/standalone.d.ts.map +1 -0
- package/dist/shell/standalone.js +85 -0
- package/dist/{domain/window/config.d.ts → window/capabilities.d.ts} +3 -3
- package/dist/window/capabilities.d.ts.map +1 -0
- package/dist/{ports/shell-adapter.d.ts → window/embed/adapter.d.ts} +3 -2
- package/dist/window/embed/adapter.d.ts.map +1 -0
- package/dist/{adapters/iframe.shell-adapter.d.ts → window/embed/iframe.d.ts} +2 -2
- package/dist/window/embed/iframe.d.ts.map +1 -0
- package/dist/{application/windowing/lifecycle-controller.d.ts → window/lifecycle/states.d.ts} +4 -3
- package/dist/window/lifecycle/states.d.ts.map +1 -0
- package/dist/{application/windowing/lifecycle-controller.js → window/lifecycle/states.js} +1 -1
- package/dist/{domain/window/lifecycle.d.ts → window/lifecycle/transition.d.ts} +3 -3
- package/dist/window/lifecycle/transition.d.ts.map +1 -0
- package/dist/{domain/window/lifecycle.js → window/lifecycle/transition.js} +1 -1
- package/dist/window/mount/close.d.ts +27 -0
- package/dist/window/mount/close.d.ts.map +1 -0
- package/dist/window/mount/close.js +74 -0
- package/dist/window/mount/credential.d.ts +41 -0
- package/dist/window/mount/credential.d.ts.map +1 -0
- package/dist/window/mount/credential.js +74 -0
- package/dist/window/mount/handshake.d.ts.map +1 -0
- package/dist/{application/windowing → window/mount}/handshake.js +1 -1
- package/dist/{application/windowing/mount-controller.d.ts → window/mount/mount.d.ts} +7 -7
- package/dist/window/mount/mount.d.ts.map +1 -0
- package/dist/window/mount/mount.js +143 -0
- package/dist/window/mount/params.d.ts +73 -0
- package/dist/window/mount/params.d.ts.map +1 -0
- package/dist/window/mount/params.js +1 -0
- package/dist/window/mount/plain.d.ts +20 -0
- package/dist/window/mount/plain.d.ts.map +1 -0
- package/dist/window/mount/plain.js +46 -0
- package/dist/{domain/window → window}/window.d.ts +1 -1
- package/dist/window/window.d.ts.map +1 -0
- package/dist/window/window.js +1 -0
- package/package.json +11 -6
- package/src/application/apps.ts +60 -0
- package/src/application/namespaces.ts +38 -0
- package/src/application/session/open.ts +73 -0
- package/src/application/session/session.ts +46 -0
- package/src/application/session/token.ts +87 -0
- package/src/application/spaces.ts +52 -0
- package/src/application/user.ts +54 -0
- package/src/application/view.ts +42 -0
- package/src/{application/channels/children-channel.ts → channel/children.ts} +3 -3
- package/src/{application/channels/types.ts → channel/listeners.ts} +2 -7
- package/src/{adapters/message-port.transport.ts → channel/message-port.ts} +2 -2
- package/src/{application/channels → channel}/observer.ts +2 -1
- package/src/{application/channels/parent-channel.ts → channel/parent.ts} +4 -4
- package/src/{ports → channel}/transport.ts +2 -1
- package/src/index.ts +80 -88
- package/src/{domain/intent → intent}/middleware/capabilities.ts +2 -3
- package/src/{domain/intent → intent}/middleware/logging.ts +1 -1
- package/src/{domain/intent → intent}/middleware/rate-limit.ts +1 -1
- package/src/{application/intent/pipeline-runner.ts → intent/pipeline.ts} +3 -2
- package/src/intent/policy.ts +46 -0
- package/src/{application/intent → intent}/request.ts +14 -34
- package/src/{application/intent → intent}/router.ts +12 -49
- package/src/kernel/client.ts +33 -0
- package/src/kernel/credential.ts +78 -0
- package/src/kernel/delegated.ts +49 -0
- package/src/{application/windowing/token-refresh.ts → kernel/delegation/refresh.ts} +2 -2
- package/src/{adapters/kernel-client.adapter.ts → kernel/session.ts} +26 -33
- package/src/message/ctrl.ts +25 -0
- package/src/{domain/message/errors.ts → message/error.ts} +8 -0
- package/src/message/intent.ts +98 -0
- package/src/message/message.ts +11 -0
- package/src/shell/access.ts +26 -0
- package/src/shell/build.ts +95 -0
- package/src/shell/config.ts +32 -0
- package/src/shell/create.ts +9 -0
- package/src/{application/windowing/child-init.ts → shell/sandboxed/boot.ts} +10 -11
- package/src/shell/sandboxed/guarded.ts +32 -0
- package/src/shell/sandboxed/pending.ts +52 -0
- package/src/shell/sandboxed/sandboxed.ts +131 -0
- package/src/shell/shell.ts +37 -0
- package/src/shell/standalone.ts +97 -0
- package/src/{domain/window/config.ts → window/capabilities.ts} +2 -2
- package/src/{ports/shell-adapter.ts → window/embed/adapter.ts} +2 -1
- package/src/{adapters/iframe.shell-adapter.ts → window/embed/iframe.ts} +2 -2
- package/src/{application/windowing/lifecycle-controller.ts → window/lifecycle/states.ts} +3 -2
- package/src/{domain/window/lifecycle.ts → window/lifecycle/transition.ts} +2 -2
- package/src/window/mount/close.ts +111 -0
- package/src/window/mount/credential.ts +101 -0
- package/src/{application/windowing → window/mount}/handshake.ts +3 -2
- package/src/window/mount/mount.ts +185 -0
- package/src/window/mount/params.ts +64 -0
- package/src/window/mount/plain.ts +68 -0
- package/src/{domain/window → window}/window.ts +1 -1
- package/dist/adapters/iframe.shell-adapter.d.ts.map +0 -1
- package/dist/adapters/kernel-client.adapter.d.ts.map +0 -1
- package/dist/adapters/message-port.transport.d.ts.map +0 -1
- package/dist/application/channels/children-channel.d.ts.map +0 -1
- package/dist/application/channels/observer.d.ts.map +0 -1
- package/dist/application/channels/parent-channel.d.ts.map +0 -1
- package/dist/application/channels/types.d.ts +0 -12
- package/dist/application/channels/types.d.ts.map +0 -1
- package/dist/application/intent/pipeline-runner.d.ts.map +0 -1
- package/dist/application/intent/request.d.ts.map +0 -1
- package/dist/application/intent/router.d.ts +0 -56
- package/dist/application/intent/router.d.ts.map +0 -1
- package/dist/application/kernel-facade.d.ts +0 -33
- package/dist/application/kernel-facade.d.ts.map +0 -1
- package/dist/application/kernel-facade.js +0 -77
- package/dist/application/shell.d.ts +0 -100
- package/dist/application/shell.d.ts.map +0 -1
- package/dist/application/shell.js +0 -256
- package/dist/application/windowing/child-init.d.ts.map +0 -1
- package/dist/application/windowing/handshake.d.ts.map +0 -1
- package/dist/application/windowing/lifecycle-controller.d.ts.map +0 -1
- package/dist/application/windowing/mount-controller.d.ts.map +0 -1
- package/dist/application/windowing/mount-controller.js +0 -277
- package/dist/application/windowing/protocol.d.ts.map +0 -1
- package/dist/application/windowing/token-refresh.d.ts.map +0 -1
- package/dist/domain/identity/delegation.d.ts.map +0 -1
- package/dist/domain/identity/path.d.ts +0 -11
- package/dist/domain/identity/path.d.ts.map +0 -1
- package/dist/domain/identity/path.js +0 -13
- package/dist/domain/identity/resolve-self.d.ts +0 -21
- package/dist/domain/identity/resolve-self.d.ts.map +0 -1
- package/dist/domain/identity/resolve-self.js +0 -36
- package/dist/domain/intent/middleware/capabilities.d.ts.map +0 -1
- package/dist/domain/intent/middleware/logging.d.ts.map +0 -1
- package/dist/domain/intent/middleware/rate-limit.d.ts.map +0 -1
- package/dist/domain/intent/pipeline.d.ts +0 -3
- package/dist/domain/intent/pipeline.d.ts.map +0 -1
- package/dist/domain/intent/router.d.ts +0 -6
- package/dist/domain/intent/router.d.ts.map +0 -1
- package/dist/domain/message/errors.d.ts +0 -2
- package/dist/domain/message/errors.d.ts.map +0 -1
- package/dist/domain/message/registries.d.ts.map +0 -1
- package/dist/domain/message/types.d.ts +0 -30
- package/dist/domain/message/types.d.ts.map +0 -1
- package/dist/domain/window/config.d.ts.map +0 -1
- package/dist/domain/window/lifecycle.d.ts.map +0 -1
- package/dist/domain/window/window.d.ts.map +0 -1
- package/dist/ports/kernel-client.d.ts +0 -33
- package/dist/ports/kernel-client.d.ts.map +0 -1
- package/dist/ports/shell-adapter.d.ts.map +0 -1
- package/dist/ports/transport.d.ts +0 -7
- package/dist/ports/transport.d.ts.map +0 -1
- package/src/application/kernel-facade.ts +0 -143
- package/src/application/shell.ts +0 -433
- package/src/application/windowing/mount-controller.ts +0 -335
- package/src/domain/identity/path.ts +0 -14
- package/src/domain/identity/resolve-self.ts +0 -38
- package/src/domain/intent/pipeline.ts +0 -3
- package/src/domain/intent/router.ts +0 -6
- package/src/domain/message/registries.ts +0 -76
- package/src/domain/message/types.ts +0 -32
- package/src/ports/kernel-client.ts +0 -32
- /package/dist/{application/channels/children-channel.js → channel/children.js} +0 -0
- /package/dist/{application/channels/types.js → channel/listeners.js} +0 -0
- /package/dist/{adapters/message-port.transport.js → channel/message-port.js} +0 -0
- /package/dist/{application/channels → channel}/observer.js +0 -0
- /package/dist/{ports → channel}/transport.js +0 -0
- /package/dist/{domain/intent → intent}/middleware/capabilities.js +0 -0
- /package/dist/{domain/intent → intent}/middleware/logging.d.ts +0 -0
- /package/dist/{domain/intent → intent}/middleware/logging.js +0 -0
- /package/dist/{domain/intent → intent}/middleware/rate-limit.js +0 -0
- /package/dist/{application/intent/pipeline-runner.js → intent/pipeline.js} +0 -0
- /package/dist/{domain/intent/pipeline.js → kernel/client.js} +0 -0
- /package/dist/{domain/identity/delegation.js → kernel/delegation/token.js} +0 -0
- /package/dist/{domain/intent/router.js → message/ctrl.js} +0 -0
- /package/dist/{domain/message/errors.js → message/error.js} +0 -0
- /package/dist/{application/windowing/protocol.js → message/init.js} +0 -0
- /package/dist/{domain/message/registries.js → message/intent.js} +0 -0
- /package/dist/{domain/message/types.js → message/message.js} +0 -0
- /package/dist/{domain/window → shell}/config.js +0 -0
- /package/dist/{domain/window/window.js → shell/shell.js} +0 -0
- /package/dist/{ports/kernel-client.js → window/capabilities.js} +0 -0
- /package/dist/{ports/shell-adapter.js → window/embed/adapter.js} +0 -0
- /package/dist/{adapters/iframe.shell-adapter.js → window/embed/iframe.js} +0 -0
- /package/dist/{application/windowing → window/mount}/handshake.d.ts +0 -0
- /package/src/{domain/identity/delegation.ts → kernel/delegation/token.ts} +0 -0
- /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 '
|
|
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 {
|
|
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
|
|
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 '
|
|
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.
|
|
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 '
|
|
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 '
|
|
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 {
|
|
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
|
|
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"}
|
|
@@ -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 {
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
8
|
-
export
|
|
9
|
-
export type {
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
12
|
-
export {
|
|
13
|
-
export type {
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
16
|
-
export type {
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
19
|
-
export type {
|
|
20
|
-
export type {
|
|
21
|
-
export {
|
|
22
|
-
export
|
|
23
|
-
export {
|
|
24
|
-
export type {
|
|
25
|
-
export { createIframeShellAdapter } from './
|
|
26
|
-
export type { IframeShellAdapterConfig } from './
|
|
27
|
-
export type {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export
|
|
31
|
-
export {
|
|
32
|
-
export type {
|
|
33
|
-
export {
|
|
34
|
-
export type {
|
|
35
|
-
export {
|
|
36
|
-
export
|
|
37
|
-
export {
|
|
38
|
-
export
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export type {
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
|
|
20
|
-
|
|
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/
|
|
2
|
-
import type { WindowCapabilities } from '../../window/
|
|
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/
|
|
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 {
|
|
2
|
-
|
|
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
|
|
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 {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAkB,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAI1E,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACnF;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,cAAc,GAAG,MAAM,cAAc,IAAI,CACtF,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,KACtB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAEzB,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,aAAa,CACX,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,aAAa,EACtB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IACrC,OAAO,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAA;CAC7F;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,cAAc,CAAA;IACxB,MAAM,EAAE,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
|