@adea-ai/spatial 0.112.0 → 0.113.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/dist/engine.d.ts DELETED
@@ -1,69 +0,0 @@
1
- /**
2
- * Entitlement gate and loading contract for the Agent Sim engine.
3
- *
4
- * The engine (models, textures, audio, runtime code) lives in the private
5
- * agent-sim repo and never ships in this public one. The shell may only
6
- * resolve the engine remote when the deployment is entitled to it:
7
- *
8
- * - Web: the site is served from an official Adea domain (adea.dev /
9
- * adea.io / octy.ink, including subdomains). Forked deployments on other
10
- * origins are refused before any engine fetch happens.
11
- * - Desktop / any build: an official build packs the engine into its own
12
- * assets at build time (see scripts/pack-agent-sim.mjs, wired into the
13
- * release lanes). The pack writes a manifest at a well-known same-origin
14
- * URL; plain checkouts and fork builds simply do not have it.
15
- *
16
- * Both signals are checked; the engine is fetched only when both pass, so
17
- * copying engine assets into a forked website still fails the host gate.
18
- */
19
- export declare const OFFICIAL_AGENT_SIM_WEB_HOSTS: readonly ['adea.dev', 'adea.io', 'octy.ink'];
20
- export type AgentSimWebPlatform = 'web' | 'desktop';
21
- /**
22
- * Designer surfaces the pack may expose as separate cold entries alongside
23
- * the HQ entry. Each surface mounts through the same entitlement gate as
24
- * the standard virtual view; a pack without the surface simply reports it
25
- * unavailable and the host renders its offline fallback.
26
- */
27
- export type AgentSimEngineSurface = 'character-designer' | 'room-designer';
28
- export type AgentSimEngineManifest = {
29
- /**
30
- * Same-origin ES module URL of the engine entry. The entry must register
31
- * the `window.__adeaAgentSim` mount API documented in the package README
32
- * before its load event resolves.
33
- */
34
- entryUrl: string;
35
- /** Engine pack version (agent-sim repo release). Diagnostics only. */
36
- version: string;
37
- /**
38
- * Same-origin cold-entry URLs for the designer surfaces (agent-sim
39
- * v0.13.2+ packs). A designer entry registers its mount under
40
- * `window.adeaAgentSimSurfaces[surface]`. Absent on older packs — the
41
- * host then renders the surface's offline fallback.
42
- */
43
- surfaces?: Partial<Record<AgentSimEngineSurface, string>>;
44
- };
45
- /** Well-known same-origin URL the official pack lane writes the manifest to. */
46
- export declare function agentSimEngineManifestUrl(origin: string): string;
47
- /**
48
- * Parse and validate an engine manifest fetched from a trusted origin.
49
- * Rejects payloads that would point the loader off the deployment's own
50
- * origin — the engine ships with the site, never from third parties.
51
- */
52
- export declare function parseAgentSimEngineManifest(value: unknown, origin: string): {
53
- ok: true;
54
- manifest: AgentSimEngineManifest;
55
- } | {
56
- ok: false;
57
- };
58
- /**
59
- * Whether a web origin is an official Adea deployment allowed to resolve the
60
- * Agent Sim engine remote. Desktop builds skip this check: they are gated by
61
- * the packed engine manifest instead.
62
- */
63
- export declare function isOfficialAgentSimWebOrigin(origin: string): boolean;
64
- /**
65
- * Hosts where a developer runs the shell locally. Local development is
66
- * entitled only when the engine was explicitly packed into the local build
67
- * (engine manifest present); the host check alone never entitles it.
68
- */
69
- export declare function isLocalDevHost(hostname: string): boolean;
package/dist/engine.js DELETED
@@ -1,105 +0,0 @@
1
- /**
2
- * Entitlement gate and loading contract for the Agent Sim engine.
3
- *
4
- * The engine (models, textures, audio, runtime code) lives in the private
5
- * agent-sim repo and never ships in this public one. The shell may only
6
- * resolve the engine remote when the deployment is entitled to it:
7
- *
8
- * - Web: the site is served from an official Adea domain (adea.dev /
9
- * adea.io / octy.ink, including subdomains). Forked deployments on other
10
- * origins are refused before any engine fetch happens.
11
- * - Desktop / any build: an official build packs the engine into its own
12
- * assets at build time (see scripts/pack-agent-sim.mjs, wired into the
13
- * release lanes). The pack writes a manifest at a well-known same-origin
14
- * URL; plain checkouts and fork builds simply do not have it.
15
- *
16
- * Both signals are checked; the engine is fetched only when both pass, so
17
- * copying engine assets into a forked website still fails the host gate.
18
- */
19
- export const OFFICIAL_AGENT_SIM_WEB_HOSTS = ['adea.dev', 'adea.io', 'octy.ink'];
20
- /** Known-public hostname suffixes never treated as official even if they embed an official host. */
21
- const NON_OFFICIAL_SUFFIXES = ['.local', '.localhost', '.internal'];
22
- const OFFICIAL_LOCAL_HOSTS = ['localhost', '127.0.0.1', '[::1]'];
23
- /** Well-known same-origin URL the official pack lane writes the manifest to. */
24
- export function agentSimEngineManifestUrl(origin) {
25
- return new URL('/assets/agent-sim/engine.json', origin).toString();
26
- }
27
- /**
28
- * Parse and validate an engine manifest fetched from a trusted origin.
29
- * Rejects payloads that would point the loader off the deployment's own
30
- * origin — the engine ships with the site, never from third parties.
31
- */
32
- export function parseAgentSimEngineManifest(value, origin) {
33
- if (typeof value !== 'object' || value === null)
34
- return { ok: false };
35
- const entryUrl = value.engine?.entryUrl;
36
- const version = value.engine?.version;
37
- if (typeof entryUrl !== 'string' || entryUrl.length === 0)
38
- return { ok: false };
39
- if (typeof version !== 'string' || version.length === 0)
40
- return { ok: false };
41
- let resolved;
42
- try {
43
- resolved = new URL(entryUrl, origin);
44
- }
45
- catch {
46
- return { ok: false };
47
- }
48
- if (resolved.origin !== new URL(origin).origin)
49
- return { ok: false };
50
- if (!resolved.pathname.endsWith('.js'))
51
- return { ok: false };
52
- // Surfaces are optional and individually validated: anything that is not a
53
- // same-origin .js URL is dropped rather than failing the whole manifest, so
54
- // a partially-written pack degrades to the fallback instead of breaking HQ.
55
- const rawSurfaces = value.engine?.surfaces;
56
- let surfaces;
57
- if (typeof rawSurfaces === 'object' && rawSurfaces !== null) {
58
- for (const [name, url] of Object.entries(rawSurfaces)) {
59
- if (typeof url !== 'string' || url.length === 0)
60
- continue;
61
- try {
62
- const surfaceUrl = new URL(url, origin);
63
- if (surfaceUrl.origin !== new URL(origin).origin)
64
- continue;
65
- if (!surfaceUrl.pathname.endsWith('.js'))
66
- continue;
67
- surfaces ??= {};
68
- surfaces[name] = surfaceUrl.toString();
69
- }
70
- catch {
71
- continue;
72
- }
73
- }
74
- }
75
- return { ok: true, manifest: { entryUrl: resolved.toString(), version, surfaces } };
76
- }
77
- /**
78
- * Whether a web origin is an official Adea deployment allowed to resolve the
79
- * Agent Sim engine remote. Desktop builds skip this check: they are gated by
80
- * the packed engine manifest instead.
81
- */
82
- export function isOfficialAgentSimWebOrigin(origin) {
83
- let url;
84
- try {
85
- url = new URL(origin);
86
- }
87
- catch {
88
- return false;
89
- }
90
- if (url.protocol !== 'https:')
91
- return false;
92
- const host = url.hostname.toLowerCase();
93
- if (NON_OFFICIAL_SUFFIXES.some((suffix) => host.endsWith(suffix)))
94
- return false;
95
- return OFFICIAL_AGENT_SIM_WEB_HOSTS.some((official) => host === official || host.endsWith(`.${official}`));
96
- }
97
- /**
98
- * Hosts where a developer runs the shell locally. Local development is
99
- * entitled only when the engine was explicitly packed into the local build
100
- * (engine manifest present); the host check alone never entitles it.
101
- */
102
- export function isLocalDevHost(hostname) {
103
- const host = hostname.toLowerCase();
104
- return OFFICIAL_LOCAL_HOSTS.includes(host) || host.endsWith('.localhost');
105
- }
package/src/engine.ts DELETED
@@ -1,133 +0,0 @@
1
- /**
2
- * Entitlement gate and loading contract for the Agent Sim engine.
3
- *
4
- * The engine (models, textures, audio, runtime code) lives in the private
5
- * agent-sim repo and never ships in this public one. The shell may only
6
- * resolve the engine remote when the deployment is entitled to it:
7
- *
8
- * - Web: the site is served from an official Adea domain (adea.dev /
9
- * adea.io / octy.ink, including subdomains). Forked deployments on other
10
- * origins are refused before any engine fetch happens.
11
- * - Desktop / any build: an official build packs the engine into its own
12
- * assets at build time (see scripts/pack-agent-sim.mjs, wired into the
13
- * release lanes). The pack writes a manifest at a well-known same-origin
14
- * URL; plain checkouts and fork builds simply do not have it.
15
- *
16
- * Both signals are checked; the engine is fetched only when both pass, so
17
- * copying engine assets into a forked website still fails the host gate.
18
- */
19
-
20
- export const OFFICIAL_AGENT_SIM_WEB_HOSTS = ['adea.dev', 'adea.io', 'octy.ink'] as const
21
-
22
- /** Known-public hostname suffixes never treated as official even if they embed an official host. */
23
- const NON_OFFICIAL_SUFFIXES = ['.local', '.localhost', '.internal']
24
- const OFFICIAL_LOCAL_HOSTS = ['localhost', '127.0.0.1', '[::1]']
25
-
26
- export type AgentSimWebPlatform = 'web' | 'desktop'
27
-
28
- /**
29
- * Designer surfaces the pack may expose as separate cold entries alongside
30
- * the HQ entry. Each surface mounts through the same entitlement gate as
31
- * the standard virtual view; a pack without the surface simply reports it
32
- * unavailable and the host renders its offline fallback.
33
- */
34
- export type AgentSimEngineSurface = 'character-designer' | 'room-designer'
35
-
36
- export type AgentSimEngineManifest = {
37
- /**
38
- * Same-origin ES module URL of the engine entry. The entry must register
39
- * the `window.__adeaAgentSim` mount API documented in the package README
40
- * before its load event resolves.
41
- */
42
- entryUrl: string
43
- /** Engine pack version (agent-sim repo release). Diagnostics only. */
44
- version: string
45
- /**
46
- * Same-origin cold-entry URLs for the designer surfaces (agent-sim
47
- * v0.13.2+ packs). A designer entry registers its mount under
48
- * `window.adeaAgentSimSurfaces[surface]`. Absent on older packs — the
49
- * host then renders the surface's offline fallback.
50
- */
51
- surfaces?: Partial<Record<AgentSimEngineSurface, string>>
52
- }
53
-
54
- /** Well-known same-origin URL the official pack lane writes the manifest to. */
55
- export function agentSimEngineManifestUrl(origin: string): string {
56
- return new URL('/assets/agent-sim/engine.json', origin).toString()
57
- }
58
-
59
- /**
60
- * Parse and validate an engine manifest fetched from a trusted origin.
61
- * Rejects payloads that would point the loader off the deployment's own
62
- * origin — the engine ships with the site, never from third parties.
63
- */
64
- export function parseAgentSimEngineManifest(
65
- value: unknown,
66
- origin: string
67
- ): { ok: true; manifest: AgentSimEngineManifest } | { ok: false } {
68
- if (typeof value !== 'object' || value === null) return { ok: false }
69
- const entryUrl = (value as { engine?: { entryUrl?: unknown } }).engine?.entryUrl
70
- const version = (value as { engine?: { version?: unknown } }).engine?.version
71
- if (typeof entryUrl !== 'string' || entryUrl.length === 0) return { ok: false }
72
- if (typeof version !== 'string' || version.length === 0) return { ok: false }
73
- let resolved: URL
74
- try {
75
- resolved = new URL(entryUrl, origin)
76
- } catch {
77
- return { ok: false }
78
- }
79
- if (resolved.origin !== new URL(origin).origin) return { ok: false }
80
- if (!resolved.pathname.endsWith('.js')) return { ok: false }
81
-
82
- // Surfaces are optional and individually validated: anything that is not a
83
- // same-origin .js URL is dropped rather than failing the whole manifest, so
84
- // a partially-written pack degrades to the fallback instead of breaking HQ.
85
- const rawSurfaces = (value as { engine?: { surfaces?: unknown } }).engine?.surfaces
86
- let surfaces: AgentSimEngineManifest['surfaces']
87
- if (typeof rawSurfaces === 'object' && rawSurfaces !== null) {
88
- for (const [name, url] of Object.entries(rawSurfaces as Record<string, unknown>)) {
89
- if (typeof url !== 'string' || url.length === 0) continue
90
- try {
91
- const surfaceUrl = new URL(url, origin)
92
- if (surfaceUrl.origin !== new URL(origin).origin) continue
93
- if (!surfaceUrl.pathname.endsWith('.js')) continue
94
- surfaces ??= {}
95
- surfaces[name as keyof NonNullable<typeof surfaces>] = surfaceUrl.toString()
96
- } catch {
97
- continue
98
- }
99
- }
100
- }
101
-
102
- return { ok: true, manifest: { entryUrl: resolved.toString(), version, surfaces } }
103
- }
104
-
105
- /**
106
- * Whether a web origin is an official Adea deployment allowed to resolve the
107
- * Agent Sim engine remote. Desktop builds skip this check: they are gated by
108
- * the packed engine manifest instead.
109
- */
110
- export function isOfficialAgentSimWebOrigin(origin: string): boolean {
111
- let url: URL
112
- try {
113
- url = new URL(origin)
114
- } catch {
115
- return false
116
- }
117
- if (url.protocol !== 'https:') return false
118
- const host = url.hostname.toLowerCase()
119
- if (NON_OFFICIAL_SUFFIXES.some((suffix) => host.endsWith(suffix))) return false
120
- return OFFICIAL_AGENT_SIM_WEB_HOSTS.some(
121
- (official) => host === official || host.endsWith(`.${official}`)
122
- )
123
- }
124
-
125
- /**
126
- * Hosts where a developer runs the shell locally. Local development is
127
- * entitled only when the engine was explicitly packed into the local build
128
- * (engine manifest present); the host check alone never entitles it.
129
- */
130
- export function isLocalDevHost(hostname: string): boolean {
131
- const host = hostname.toLowerCase()
132
- return OFFICIAL_LOCAL_HOSTS.includes(host) || host.endsWith('.localhost')
133
- }