🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@holoscript/core

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@holoscript/core

Core parser, AST, compiler infrastructure, trait system, and runtime for HoloScript — the open AI-spatial reality protocol for 3D/XR/IoT

latest
Source
npmnpm
Version
8.0.8
Version published
Maintainers
1
Created
Source

@holoscript/core

The semantic engine at the heart of HoloScript. Traits describe any domain entity — spatial, AI, services, IoT — and the compiler fleet translates them to platform-specific code. Read the V6 Vision →

Core parser, AST, compiler infrastructure, and trait system.

Installation

npm install @holoscript/core

Usage

// Parse HoloScript+ files (.hsplus)
import { HoloScriptPlusParser } from '@holoscript/core';

const parser = new HoloScriptPlusParser();
const result = parser.parse(source);

// Parse .holo composition files
import { HoloCompositionParser } from '@holoscript/core';

const holoParser = new HoloCompositionParser();
const composition = holoParser.parse(source);

// Compile to a specific target
import { UnityCompiler } from '@holoscript/core';

const compiler = new UnityCompiler();
const output = compiler.compile(composition.ast);

Features

  • Multi-format Parser - Supports .hs, .hsplus, and .holo files
  • Complete AST - Full abstract syntax tree representation
  • Validation - Comprehensive error checking with recovery
  • 30+ Compile Targets - Web (R3F, Babylon), Unity, Unreal, Godot, iOS, Android, Vision Pro, WebGPU, WASM, VRChat, OpenXR, URDF, DTDL, SDF
  • 3,300+ Traits - Modularized across 114 category files covering VR interactions, physics, networking, AI, scripting, automation, animation, nature, magic, sci-fi, emotions, and more
  • AI Integration - Adapters for OpenAI, Anthropic, Gemini, Ollama, and more
  • Reactive State - reactive(), computed(), effect(), bind()

Parsers

ParserFile TypesUse Case
HoloScriptPlusParser.hsplusExtended syntax with TypeScript modules
HoloCompositionParser.holoScene-centric composition files
HoloScript2DParser.hsBasic logic and protocols
HoloScriptParser.hsStandard semantic parser

Compilers (30+ implementations; verify live targets via health + ExportTarget enum)

CompilerTargetOutput
UnityCompilerUnity EngineC# + Prefab
UnrealCompilerUnreal Engine 5C++ + Blueprint
GodotCompilerGodot 4GDScript + .tscn
R3FCompilerReact Three FiberTSX + hooks
BabylonCompilerBabylon.jsTypeScript
PlayCanvasCompilerPlayCanvasJavaScript
OpenXRCompilerOpenXR StandardC++
VRChatCompilerVRChatUdonSharp C#
VisionOSCompilerApple Vision ProSwift
AndroidXRCompilerAndroid XRKotlin
IOSCompileriOS / ARKitSwift
AndroidCompilerAndroid / ARCoreKotlin
ARCompilerGeneric ARTypeScript
WASMCompilerWebAssembly.wasm + .js
WebGPUCompilerWebGPU ComputeWGSL + TypeScript
URDFCompilerRobotics (URDF).urdf XML
SDFCompilerGazebo SDF simulation XML.sdf XML
DTDLCompilerDigital TwinsJSON-LD
StateCompilerReactive StateJSON
A2AAgentCardCompilerA2A Agent CardsJSON
NIRCompilerNeuromorphic IRJSON
VRRCompilerVariable Rate RenderingTypeScript
Native2DCompiler2D HTML/CSSTSX + HTML
NodeServiceCompilerNode.js ServicesTypeScript
AIGlassesCompilerAI GlassesKotlin Compose
GLTFPipelineglTF.glb / .gltf
NFTMarketplaceCompilerNFT MarketplaceSolidity
USDPhysicsCompilerUSD Physics.usda
TSLCompilerTrait Shader LanguageWGSL + TS pipeline
SCMCompilerStructural Causal ModelJSON DAG
QuiltCompilerLooking Glass HologramMulti-view PNG
MVHEVCCompilerMV-HEVC HologramSwift + .mov
FlatSemanticCompilerSemantic 2D LayoutTSX

Trait System

VR traits are modularized into 115 category files under src/traits/constants/:

CategoryFileTraits
Core VRcore-vr-interaction.tsgrabbable, throwable, pointable, ...
Humanoidhumanoid-avatar.tsskeleton, body, face, ...
Game Mechanicsgame-mechanics.tscollectible, destructible, healable, ..
Magic & Fantasymagic-fantasy.tsenchantable, cursed, blessed, ...
Animalsanimals.tscat, dog, horse, dragon, ...
...58 more categoriesSee src/traits/constants/index.ts

Import individual categories or the combined set:

import { VR_TRAITS } from '@holoscript/core'; // All 3,300+ traits
import { AUDIO_TRAITS } from '@holoscript/core'; // Just audio traits
import { MAGIC_FANTASY_TRAITS } from '@holoscript/core'; // Just magic/fantasy

Language Features

HoloScript v4.1 adds five production-ready language features. See LANGUAGE_FEATURES.md for the full reference.

Module System (@import / @export)

@import { PhysicsSystem, Gravity } from './physics.hs'
@import * as UI from './ui-components.hs'

@export PhysicsSystem

Trait Composition

// Compose multiple traits into one named trait
@HoverVehicle = @physics + @navmesh + @propulsion
@Warrior = @combat + @inventory + @stats
import { TraitCompositionCompiler, TraitComposer } from '@holoscript/core';

// Low-level API
const compiler = new TraitCompositionCompiler();
const [hovercraft] = compiler.compile(
  [{ name: 'Hovercraft', components: ['physics', 'navmesh'], overrides: { gravity: 0.1 } }],
  (name) => registry.get(name),
  traitGraph
);

// High-level composer (with lifecycle dispatch)
const composer = new TraitComposer(graph);
const result = composer.compose('Warrior', handlers, ['combat', 'inventory', 'stats']);
// result.handler.onAttach dispatches to all in order; onDetach is reversed

Reactive State

@state {
  hp: 100,
  shield: 50,
}
import { reactive, computed, effect } from '@holoscript/core';

const state = reactive({ hp: 100 });
const isAlive = computed(() => state.hp > 0);
effect(() => console.log('HP changed:', state.hp));

LLM Agent Trait

@llm_agent {
  model: "gpt-4",
  system_prompt: "You are a game NPC",
  tools: [{ name: "move", ... }],
  bounded_autonomy: true,
  max_actions_per_turn: 3,
}

Gaussian Splat Trait

@gaussian_splat {
  source: "./assets/scene.ply",
  quality: "ultra",
  sh_degree: 3,
  sort_mode: "distance",
  streaming: true,
}

Codebase Intelligence (GraphRAG)

Built-in pipeline for semantic code analysis:

CodebaseScanner → CodebaseGraph → EmbeddingIndex → GraphRAGEngine
ClassFilePurpose
CodebaseScannersrc/codebase/CodebaseScanner.tsScan repositories, extract symbols/imports/calls
CodebaseGraphsrc/codebase/CodebaseGraph.tsGraph of nodes (symbols) + edges (dependencies), community detection
EmbeddingIndexsrc/codebase/EmbeddingIndex.tsVector index (OpenAI/BM25/Ollama), binary cache for 42x speedup
GraphRAGEnginesrc/codebase/GraphRAGEngine.tsGraph traversal + semantic search + LLM synthesis
CodebaseSceneCompilersrc/codebase/visualization/3D visualization of codebase graphs
import { CodebaseScanner, CodebaseGraph, EmbeddingIndex, GraphRAGEngine } from '@holoscript/core';

const scanner = new CodebaseScanner();
const graph = await scanner.scan('./src');
const index = new EmbeddingIndex();
await index.buildIndex(graph);
const engine = new GraphRAGEngine(graph, index);
const answer = await engine.queryWithLLM('How does the parser work?');

Runtime & ECS

ClassFilePurpose
SceneRunnersrc/runtime/SceneRunner.tsWalks AST, spawns entities, runs compositions
HeadlessRuntimesrc/runtime/profiles/HeadlessRuntime.tsNo-GUI execution for tests/CI/servers
RuntimeBridgesrc/runtime/RuntimeBridge.tsConnects SceneRunner to renderers
RuntimeRenderersrc/runtime/RuntimeRenderer.tsPBR materials, particle systems, post-FX

MCP Integration

Two MCP layers:

  • External (packages/mcp-server): Exposes holo_absorb_repo, holo_query_codebase, holo_semantic_search for AI agents
  • Internal (src/mcp/ + src/agents/spatial-comms/): MCPOrchestrator, Layer3MCPClient, SPATIAL_MCP_TOOLS for agent-to-agent spatial comm

Smart Assets

ClassFilePurpose
SmartAssetLoadersrc/assets/SmartAssetLoader.tsLoad/configure/bundle assets with load(), doLoad(), getConfig()
LoaderConfigsrc/assets/SmartAssetLoader.tsConfiguration interface for asset loading

Extension System

ClassFilePurpose
ExtensionRegistrysrc/extensions/ExtensionRegistry.tsRegister and load plugin extensions
ExtensionInterfacesrc/extensions/ExtensionInterface.tsExtension lifecycle context

Note: "Extension" has multiple meanings in the codebase — plugin extensions (ExtensionRegistry), glTF extensions (GLTFTrait), LSP file extensions (ImportResolver.EXTENSIONS), and OpenXR required extensions. See Extension System Architecture.

License

MIT

Keywords

holoscript

FAQs

Package last updated on 09 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts