@aistrike-dev/ui-shell-dev 1.1.0 → 2.0.1
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/README.md +3 -1
- package/dist/args.d.ts +2 -0
- package/dist/args.js +6 -1
- package/dist/devfile.js +9 -10
- package/dist/token.d.ts +2 -0
- package/dist/token.js +1 -0
- package/package.json +3 -3
- package/platform/assistant/mock.js +775 -141
- package/platform/assistant/ui/chunks/preload-helper-CYtfOYgs.js +1 -0
- package/platform/assistant/ui/chunks/ui-_Jh-Ap4I.js +180 -0
- package/platform/assistant/ui/entry.js +2 -1
- package/platform/assistant/ui/manifest.json +0 -1
- package/platform/home/ui/chunks/{ui-DbUUEocb.js → ui-BtxPDjyo.js} +1 -1
- package/platform/home/ui/entry.js +1 -1
- package/platform/home/ui/manifest.json +0 -1
- package/platform/settings/ui/chunks/ui-DYWCqUY2.js +269 -0
- package/platform/settings/ui/entry.js +2 -2
- package/platform/settings/ui/manifest.json +0 -1
- package/shell/assets/LabHost-92aUGeG-.js +2 -0
- package/shell/assets/index-ocy7db1a.js +182 -0
- package/shell/index.html +1 -1
- package/platform/assistant/ui/chunks/ui-Dbr1LDha.js +0 -179
- package/platform/settings/ui/chunks/ui-Qa6HkYev.js +0 -269
- package/shell/assets/LabHost-D52IQ8W-.js +0 -2
- package/shell/assets/index-Cp9nZ0g0.js +0 -182
package/README.md
CHANGED
|
@@ -45,12 +45,14 @@ Read from the Vite root when present (or from the plugin's `devFile` option).
|
|
|
45
45
|
{
|
|
46
46
|
"profile": "local",
|
|
47
47
|
"overrides": { "other": "http://127.0.0.1:5102" },
|
|
48
|
-
"domains": [{ "id": "other", "
|
|
48
|
+
"domains": [{ "id": "other", "nav": { "label": "Other" }, "devPort": 5102 }],
|
|
49
49
|
"idleTimeoutMs": 0,
|
|
50
50
|
"claims": { "permissions": ["hello:read"] }
|
|
51
51
|
}
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
A domain's route prefix is always `/<id>`, so a domain has no `route` key: a leftover one stops the dev server with a message to delete it. The ids `shell`, `preferences`, `commands`, `api`, `assets` and `ui` are reserved.
|
|
55
|
+
|
|
54
56
|
`profile` defaults to `local`, `overrides` point other domains at their own dev servers (bare origins, no path; your
|
|
55
57
|
own domain is overridden automatically), `idleTimeoutMs` defaults to `0` (idle timeout off), and `claims` is merged
|
|
56
58
|
over the default dev claims. The plugin's `claims`, `ttlMs` and `noToken` options win over the file. `"lab": true`
|
package/dist/args.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const USAGE = "Usage: aistrike-shell token [options]\n\nMint a dev token for local back ends.\n --claims <path> JSON claims for the token\n --ttl <30d|12h|45m|90s> token lifetime (default 30d)\n --out <path> also write the token to a file (mode 0600)\n --json print { token, session } instead of the bare token\n\nThe shell itself is served by shellDevHost() from @aistrike-dev/ui-shell-dev/vite:\nadd it to your MFE's vite.config.ts after mfe(), and \"vite\" serves the shell at /.\nShell settings (profile, overrides, domains, claims) live in shell.dev.json.\n";
|
|
2
2
|
export declare const DOMAIN_ID: RegExp;
|
|
3
|
+
export declare const RESERVED_DOMAIN_IDS: ReadonlySet<string>;
|
|
4
|
+
export declare function isValidDomainId(id: string): boolean;
|
|
3
5
|
export declare function parseTtl(text: string): number;
|
|
4
6
|
/** `id=origin`. The origin must be a bare origin: scheme, host, optional port, nothing else (spec 4.5). */
|
|
5
7
|
export declare function parseOverride(text: string): [string, string];
|
package/dist/args.js
CHANGED
|
@@ -14,6 +14,11 @@ const TTL = /^(\d+)([dhms])$/;
|
|
|
14
14
|
const UNIT_MS = { d: 86_400_000, h: 3_600_000, m: 60_000, s: 1000 };
|
|
15
15
|
// Mirrors the contract's DNS-label rule for domain ids. Duplicated (not imported) so the dev host has no runtime dependencies.
|
|
16
16
|
export const DOMAIN_ID = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
17
|
+
// Mirrors the SDK's RESERVED_DOMAIN_IDS, duplicated for the same reason as DOMAIN_ID.
|
|
18
|
+
export const RESERVED_DOMAIN_IDS = new Set(['shell', 'preferences', 'commands', 'api', 'assets', 'ui']);
|
|
19
|
+
export function isValidDomainId(id) {
|
|
20
|
+
return DOMAIN_ID.test(id) && !RESERVED_DOMAIN_IDS.has(id);
|
|
21
|
+
}
|
|
17
22
|
const SCHEME = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
18
23
|
export function parseTtl(text) {
|
|
19
24
|
const match = TTL.exec(text);
|
|
@@ -31,7 +36,7 @@ export function parseOverride(text) {
|
|
|
31
36
|
}
|
|
32
37
|
const id = text.slice(0, eq);
|
|
33
38
|
const raw = text.slice(eq + 1).replace(/\/+$/, '');
|
|
34
|
-
if (!
|
|
39
|
+
if (!isValidDomainId(id)) {
|
|
35
40
|
throw new Error(`invalid override id "${id}": must be a DNS label`);
|
|
36
41
|
}
|
|
37
42
|
if (!SCHEME.test(raw)) {
|
package/dist/devfile.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import {
|
|
4
|
+
import { isValidDomainId, parseOverride } from './args.js';
|
|
5
5
|
export const DEV_FILE = 'shell.dev.json';
|
|
6
|
-
const CLAIM_STRINGS = ['sub', 'name', 'defaultTenant'];
|
|
6
|
+
const CLAIM_STRINGS = ['sub', 'name', 'defaultTenant', 'orgId'];
|
|
7
7
|
const CLAIM_LISTS = ['permissions', 'modules', 'tenants'];
|
|
8
8
|
/** Dev claims must be a plain object of known keys; `iss`/`exp`/`iat` and friends cannot be smuggled into the token. */
|
|
9
9
|
export function assertClaimsInput(value, source) {
|
|
@@ -42,9 +42,8 @@ function normalizeOverrides(overrides) {
|
|
|
42
42
|
return result;
|
|
43
43
|
}
|
|
44
44
|
const FILE_KEYS = ['profile', 'overrides', 'domains', 'idleTimeoutMs', 'landing', 'lab', 'claims'];
|
|
45
|
-
const DOMAIN_KEYS = ['id', '
|
|
45
|
+
const DOMAIN_KEYS = ['id', 'nav', 'devPort'];
|
|
46
46
|
const NAV_KEYS = ['label', 'icon'];
|
|
47
|
-
const ROUTE = /^\/[a-z0-9-]+$/;
|
|
48
47
|
function isPlainObject(value) {
|
|
49
48
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
50
49
|
}
|
|
@@ -79,19 +78,19 @@ function validateDomain(value, path) {
|
|
|
79
78
|
if (!isPlainObject(value)) {
|
|
80
79
|
throw new Error(`${path} must be an object`);
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (typeof id !== 'string' || !DOMAIN_ID.test(id)) {
|
|
81
|
+
const { id, nav, devPort } = value;
|
|
82
|
+
if (typeof id !== 'string' || !isValidDomainId(id)) {
|
|
85
83
|
throw new Error(`${path}.id must be a DNS label`);
|
|
86
84
|
}
|
|
87
|
-
if (
|
|
88
|
-
throw new Error(`${path}.route
|
|
85
|
+
if ('route' in value) {
|
|
86
|
+
throw new Error(`${path}.route is no longer read; delete it: a domain's prefix is its id (/${id})`);
|
|
89
87
|
}
|
|
88
|
+
rejectUnknownKeys(value, DOMAIN_KEYS, path);
|
|
90
89
|
const validNav = validateNav(nav, `${path}.nav`);
|
|
91
90
|
if (!isPort(devPort)) {
|
|
92
91
|
throw new Error(`${path}.devPort must be an integer from 1 to 65535`);
|
|
93
92
|
}
|
|
94
|
-
return { id,
|
|
93
|
+
return { id, nav: validNav, devPort };
|
|
95
94
|
}
|
|
96
95
|
function validateDomains(value) {
|
|
97
96
|
if (!Array.isArray(value)) {
|
package/dist/token.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface DevClaimsInput {
|
|
|
14
14
|
modules?: string[];
|
|
15
15
|
tenants?: string[];
|
|
16
16
|
defaultTenant?: string;
|
|
17
|
+
orgId?: string;
|
|
17
18
|
}
|
|
18
19
|
export declare const DEFAULT_CLAIMS: {
|
|
19
20
|
sub: string;
|
|
@@ -22,6 +23,7 @@ export declare const DEFAULT_CLAIMS: {
|
|
|
22
23
|
modules: string[];
|
|
23
24
|
tenants: string[];
|
|
24
25
|
defaultTenant: string;
|
|
26
|
+
orgId: string;
|
|
25
27
|
};
|
|
26
28
|
export declare function configDir(env?: NodeJS.ProcessEnv): string;
|
|
27
29
|
/** One ES256 key per machine. No deployed environment trusts it; it exists so local back ends can verify if they want to. */
|
package/dist/token.js
CHANGED
|
@@ -14,6 +14,7 @@ export const DEFAULT_CLAIMS = {
|
|
|
14
14
|
modules: ['settings'],
|
|
15
15
|
tenants: ['acme', 'halcyon'],
|
|
16
16
|
defaultTenant: 'acme',
|
|
17
|
+
orgId: 'org_dev',
|
|
17
18
|
};
|
|
18
19
|
export function configDir(env = process.env) {
|
|
19
20
|
const base = env.XDG_CONFIG_HOME ?? join(env.HOME ?? homedir(), '.config');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aistrike-dev/ui-shell-dev",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A Vite plugin that serves the AiStrike UI shell from your micro front-end's dev server, plus a dev-token CLI.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"e2e": "node scripts/check-pack.mjs && playwright test"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@aistrike-dev/ui": ">=6.0.0-alpha.
|
|
49
|
+
"@aistrike-dev/ui": ">=6.0.0-alpha.12",
|
|
50
50
|
"vite": "^8.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@aistrike-dev/ui": "6.0.0-alpha.
|
|
61
|
+
"@aistrike-dev/ui": "6.0.0-alpha.12",
|
|
62
62
|
"@aistrike-dev/ui-shell-sdk": "workspace:*",
|
|
63
63
|
"@playwright/test": "^1.63.0",
|
|
64
64
|
"@types/node": "^24.0.0",
|