chore: initial commit (Phase 3 scaffold)
Some checks are pending
ci / validate (push) Waiting to run

This commit is contained in:
CxAI Ops 2026-05-16 10:52:05 -05:00
commit 79b884586b
38 changed files with 2063 additions and 0 deletions

15
.editorconfig Normal file
View File

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.{yml,yaml,json,md}]
indent_size = 2
[Makefile]
indent_style = tab

36
.gitea/workflows/ci.yml Normal file
View File

@ -0,0 +1,36 @@
name: ci
on:
push:
branches: [main, master]
pull_request: {}
workflow_dispatch: {}
# We run a Linux runner; macOS xcodebuild is not available here.
# This workflow validates structure (yaml, file presence) and basic Swift.
jobs:
validate:
runs-on: cxai-hostinger
container: debian:bookworm
steps:
- name: Install deps
run: |
apt-get update -qq
apt-get install -y --no-install-recommends git ca-certificates curl python3-yaml >/dev/null
- uses: actions/checkout@v4
- name: Lint workflow YAML
run: |
python3 - <<'PY'
import sys, yaml, glob
for f in glob.glob('.gitea/workflows/*.yml') + glob.glob('.github/workflows/*.yml'):
try:
yaml.safe_load(open(f))
except Exception as e:
print(f'YAML ERROR {f}: {e}'); sys.exit(1)
print('workflows ok')
PY
- name: Project sanity
run: |
test -f README.md || (echo "missing README" && exit 1)
test -f Makefile || (echo "missing Makefile" && exit 1)
ls *.xcodeproj >/dev/null 2>&1 && echo "xcodeproj: $(ls -d *.xcodeproj)" || true
[ -f Package.swift ] && echo "Package.swift present" || true

27
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14]
steps:
- uses: actions/checkout@v4
- name: Show toolchain
run: |
xcodebuild -version || true
swift --version || true
- name: Build
run: make build
- name: Test
run: make test
- name: Lint
run: make lint

54
.gitignore vendored Normal file
View File

@ -0,0 +1,54 @@
# macOS
.DS_Store
.AppleDouble
.LSOverride
Icon?
# Xcode
build/
DerivedData/
*.xcworkspace/xcuserdata/
*.xcodeproj/xcuserdata/
*.xcodeproj/project.xcworkspace/xcuserdata/
*.xcuserstate
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
# SwiftPM
.build/
.swiftpm/xcode/
.swiftpm/configuration/
Package.resolved
# CocoaPods / Carthage
Pods/
Carthage/Build/
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output/
# Coverage
*.gcno
*.gcda
*.profdata
*.profraw
coverage/
# Editors
.vscode/
.idea/
*.swp
# Local
*.local
secrets.env

16
CHANGELOG.md Normal file
View File

@ -0,0 +1,16 @@
# Changelog
All notable changes to this project will be documented here.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased]
### Added
- Repository scaffolding: README, LICENSE (MIT), .gitignore, Makefile,
CONTRIBUTING, SECURITY, CODEOWNERS, .editorconfig, CI workflow.
## [0.1.0] - 2026-04-22
### Added
- Initial app-vision scaffold for CxLLM-SPA-RNDR.

6
CODEOWNERS Normal file
View File

@ -0,0 +1,6 @@
# Default owners for everything in this repo.
* @CxAI-LLM/maintainers
# Build & CI
/.github/ @CxAI-LLM/devops
/Makefile @CxAI-LLM/devops

23
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,23 @@
# Contributing to CxLLM-SPA-RNDR
Thanks for taking the time to contribute!
## Workflow
1. Open an issue describing the change before sending a PR for non-trivial work.
2. Fork / branch off `main`. Use a descriptive branch name (`feat/...`, `fix/...`).
3. Keep commits scoped and use **Conventional Commits** (`feat:`, `fix:`,
`docs:`, `refactor:`, `test:`, `chore:`).
4. Run `make lint` and `make test` before pushing.
5. Open a PR — CI must pass before review.
## Coding style
- Swift: `swiftformat` defaults + `swiftlint` rules from the umbrella repo.
- Objective-C / C / C++: clang-format `-style=Google`.
- No tabs in Swift; 4-space indent in C/C++.
## Code of conduct
By contributing you agree to abide by the project's Code of Conduct
(see the umbrella `cxllm-code` repo).

View File

@ -0,0 +1,580 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 77;
objects = {
/* Begin PBXContainerItemProxy section */
20F2B1482F9976B900E7D2D9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 20F2B1322F9976B800E7D2D9 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 20F2B1392F9976B800E7D2D9;
remoteInfo = "CxLLM-SPA-RNDR";
};
20F2B1522F9976B900E7D2D9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 20F2B1322F9976B800E7D2D9 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 20F2B1392F9976B800E7D2D9;
remoteInfo = "CxLLM-SPA-RNDR";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
20F2B13A2F9976B800E7D2D9 /* CxLLM-SPA-RNDR.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "CxLLM-SPA-RNDR.app"; sourceTree = BUILT_PRODUCTS_DIR; };
20F2B1472F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "CxLLM-SPA-RNDRTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
20F2B1512F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "CxLLM-SPA-RNDRUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
20F2B13C2F9976B800E7D2D9 /* CxLLM-SPA-RNDR */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = "CxLLM-SPA-RNDR";
sourceTree = "<group>";
};
20F2B14A2F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = "CxLLM-SPA-RNDRTests";
sourceTree = "<group>";
};
20F2B1542F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = "CxLLM-SPA-RNDRUITests";
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
20F2B1372F9976B800E7D2D9 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
20F2B1442F9976B900E7D2D9 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
20F2B14E2F9976B900E7D2D9 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
20F2B1312F9976B800E7D2D9 = {
isa = PBXGroup;
children = (
20F2B13C2F9976B800E7D2D9 /* CxLLM-SPA-RNDR */,
20F2B14A2F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests */,
20F2B1542F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests */,
20F2B13B2F9976B800E7D2D9 /* Products */,
);
sourceTree = "<group>";
};
20F2B13B2F9976B800E7D2D9 /* Products */ = {
isa = PBXGroup;
children = (
20F2B13A2F9976B800E7D2D9 /* CxLLM-SPA-RNDR.app */,
20F2B1472F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests.xctest */,
20F2B1512F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
20F2B1392F9976B800E7D2D9 /* CxLLM-SPA-RNDR */ = {
isa = PBXNativeTarget;
buildConfigurationList = 20F2B15B2F9976BA00E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-SPA-RNDR" */;
buildPhases = (
20F2B1362F9976B800E7D2D9 /* Sources */,
20F2B1372F9976B800E7D2D9 /* Frameworks */,
20F2B1382F9976B800E7D2D9 /* Resources */,
);
buildRules = (
);
dependencies = (
);
fileSystemSynchronizedGroups = (
20F2B13C2F9976B800E7D2D9 /* CxLLM-SPA-RNDR */,
);
name = "CxLLM-SPA-RNDR";
packageProductDependencies = (
);
productName = "CxLLM-SPA-RNDR";
productReference = 20F2B13A2F9976B800E7D2D9 /* CxLLM-SPA-RNDR.app */;
productType = "com.apple.product-type.application";
};
20F2B1462F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 20F2B15E2F9976BA00E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-SPA-RNDRTests" */;
buildPhases = (
20F2B1432F9976B900E7D2D9 /* Sources */,
20F2B1442F9976B900E7D2D9 /* Frameworks */,
20F2B1452F9976B900E7D2D9 /* Resources */,
);
buildRules = (
);
dependencies = (
20F2B1492F9976B900E7D2D9 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
20F2B14A2F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests */,
);
name = "CxLLM-SPA-RNDRTests";
packageProductDependencies = (
);
productName = "CxLLM-SPA-RNDRTests";
productReference = 20F2B1472F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
20F2B1502F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 20F2B1612F9976BA00E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-SPA-RNDRUITests" */;
buildPhases = (
20F2B14D2F9976B900E7D2D9 /* Sources */,
20F2B14E2F9976B900E7D2D9 /* Frameworks */,
20F2B14F2F9976B900E7D2D9 /* Resources */,
);
buildRules = (
);
dependencies = (
20F2B1532F9976B900E7D2D9 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
20F2B1542F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests */,
);
name = "CxLLM-SPA-RNDRUITests";
packageProductDependencies = (
);
productName = "CxLLM-SPA-RNDRUITests";
productReference = 20F2B1512F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
20F2B1322F9976B800E7D2D9 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 2630;
LastUpgradeCheck = 2630;
TargetAttributes = {
20F2B1392F9976B800E7D2D9 = {
CreatedOnToolsVersion = 26.3;
};
20F2B1462F9976B900E7D2D9 = {
CreatedOnToolsVersion = 26.3;
TestTargetID = 20F2B1392F9976B800E7D2D9;
};
20F2B1502F9976B900E7D2D9 = {
CreatedOnToolsVersion = 26.3;
TestTargetID = 20F2B1392F9976B800E7D2D9;
};
};
};
buildConfigurationList = 20F2B1352F9976B800E7D2D9 /* Build configuration list for PBXProject "CxLLM-SPA-RNDR" */;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 20F2B1312F9976B800E7D2D9;
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
productRefGroup = 20F2B13B2F9976B800E7D2D9 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
20F2B1392F9976B800E7D2D9 /* CxLLM-SPA-RNDR */,
20F2B1462F9976B900E7D2D9 /* CxLLM-SPA-RNDRTests */,
20F2B1502F9976B900E7D2D9 /* CxLLM-SPA-RNDRUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
20F2B1382F9976B800E7D2D9 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
20F2B1452F9976B900E7D2D9 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
20F2B14F2F9976B900E7D2D9 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
20F2B1362F9976B800E7D2D9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
20F2B1432F9976B900E7D2D9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
20F2B14D2F9976B900E7D2D9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
20F2B1492F9976B900E7D2D9 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 20F2B1392F9976B800E7D2D9 /* CxLLM-SPA-RNDR */;
targetProxy = 20F2B1482F9976B900E7D2D9 /* PBXContainerItemProxy */;
};
20F2B1532F9976B900E7D2D9 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 20F2B1392F9976B800E7D2D9 /* CxLLM-SPA-RNDR */;
targetProxy = 20F2B1522F9976B900E7D2D9 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
20F2B1592F9976BA00E7D2D9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = DKWVC9FQJY;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 26.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
20F2B15A2F9976BA00E7D2D9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = DKWVC9FQJY;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 26.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
};
name = Release;
};
20F2B15C2F9976BA00E7D2D9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DKWVC9FQJY;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 26.2;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-SPA-RNDR";
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(TARGET_NAME)/ShaderTypes.h";
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
20F2B15D2F9976BA00E7D2D9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DKWVC9FQJY;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 26.2;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-SPA-RNDR";
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(TARGET_NAME)/ShaderTypes.h";
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
20F2B15F2F9976BA00E7D2D9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DKWVC9FQJY;
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 26.2;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-SPA-RNDRTests";
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = NO;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CxLLM-SPA-RNDR.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/CxLLM-SPA-RNDR";
};
name = Debug;
};
20F2B1602F9976BA00E7D2D9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DKWVC9FQJY;
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 26.2;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-SPA-RNDRTests";
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = NO;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CxLLM-SPA-RNDR.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/CxLLM-SPA-RNDR";
};
name = Release;
};
20F2B1622F9976BA00E7D2D9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DKWVC9FQJY;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-SPA-RNDRUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = NO;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = "CxLLM-SPA-RNDR";
};
name = Debug;
};
20F2B1632F9976BA00E7D2D9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DKWVC9FQJY;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-SPA-RNDRUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = NO;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = "CxLLM-SPA-RNDR";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
20F2B1352F9976B800E7D2D9 /* Build configuration list for PBXProject "CxLLM-SPA-RNDR" */ = {
isa = XCConfigurationList;
buildConfigurations = (
20F2B1592F9976BA00E7D2D9 /* Debug */,
20F2B15A2F9976BA00E7D2D9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
20F2B15B2F9976BA00E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-SPA-RNDR" */ = {
isa = XCConfigurationList;
buildConfigurations = (
20F2B15C2F9976BA00E7D2D9 /* Debug */,
20F2B15D2F9976BA00E7D2D9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
20F2B15E2F9976BA00E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-SPA-RNDRTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
20F2B15F2F9976BA00E7D2D9 /* Debug */,
20F2B1602F9976BA00E7D2D9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
20F2B1612F9976BA00E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-SPA-RNDRUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
20F2B1622F9976BA00E7D2D9 /* Debug */,
20F2B1632F9976BA00E7D2D9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 20F2B1322F9976B800E7D2D9 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,21 @@
//
// AppModel.swift
// CxLLM-SPA-RNDR
//
// Created by Stephen Carter on 4/22/26.
//
import SwiftUI
/// Maintains app-wide state
@MainActor
@Observable
class AppModel {
let immersiveSpaceID = "ImmersiveSpace"
enum ImmersiveSpaceState {
case closed
case inTransition
case open
}
var immersiveSpaceState = ImmersiveSpaceState.closed
}

View File

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "vision",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,17 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"layers" : [
{
"filename" : "Front.solidimagestacklayer"
},
{
"filename" : "Middle.solidimagestacklayer"
},
{
"filename" : "Back.solidimagestacklayer"
}
]
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "vision",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "vision",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,17 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"origin" : "bottom-left",
"interpretation" : "non-premultiplied-colors"
},
"textures" : [
{
"idiom" : "universal",
"filename" : "Universal.mipmapset"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -0,0 +1,12 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"levels" : [
{
"filename" : "ColorMap.png",
"mipmap-level" : "base"
}
]
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,25 @@
//
// ContentView.swift
// CxLLM-SPA-RNDR
//
// Created by Stephen Carter on 4/22/26.
//
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Text("Hello, world!")
ToggleImmersiveSpaceButton()
}
.padding()
}
}
#Preview {
ContentView()
.environment(AppModel())
}

View File

@ -0,0 +1,53 @@
//
// CxLLM_SPA_RNDRApp.swift
// CxLLM-SPA-RNDR
//
// Created by Stephen Carter on 4/22/26.
//
import ARKit
import CompositorServices
import SwiftUI
struct ImmersiveSpaceContent: CompositorContent {
@Environment(\.remoteDeviceIdentifier) private var remoteDeviceIdentifier
var appModel: AppModel
var body: some CompositorContent {
CompositorLayer(configuration: self) { @MainActor layerRenderer in
Renderer.startRenderLoop(layerRenderer, appModel: appModel, arSession: .init(device: remoteDeviceIdentifier!))
}
}
}
extension ImmersiveSpaceContent: CompositorLayerConfiguration {
func makeConfiguration(capabilities: LayerRenderer.Capabilities, configuration: inout LayerRenderer.Configuration) {
let foveationEnabled = capabilities.supportsFoveation
configuration.isFoveationEnabled = foveationEnabled
let options: LayerRenderer.Capabilities.SupportedLayoutsOptions = foveationEnabled ? [.foveationEnabled] : []
let supportedLayouts = capabilities.supportedLayouts(options: options)
configuration.layout = supportedLayouts.contains(.layered) ? .layered : .dedicated
}
}
@main
struct CxLLM_SPA_RNDRApp: App {
@State private var appModel = AppModel()
var body: some Scene {
WindowGroup {
ContentView()
.environment(appModel)
}
RemoteImmersiveSpace(id: appModel.immersiveSpaceID) {
ImmersiveSpaceContent(appModel: appModel)
}
.immersionStyle(selection: .constant(.full), in: .full)
}
}

View File

@ -0,0 +1,595 @@
//
// Renderer.swift
// CxLLM-SPA-RNDR
//
// Created by Stephen Carter on 4/22/26.
//
import CompositorServices
import Metal
import MetalKit
import simd
// The 256 byte aligned size of our uniform structure
nonisolated let alignedUniformsSize = (MemoryLayout<Uniforms>.size + 0xFF) & -0x100
nonisolated let alignedViewProjectionArraySize = (MemoryLayout<ViewProjectionArray>.size + 0xFF) & -0x100
nonisolated let maxBuffersInFlight = 3
enum RendererError: Error {
case badVertexDescriptor
}
extension MTLDevice {
nonisolated var supportsMSAA: Bool {
supports32BitMSAA && supportsTextureSampleCount(4)
}
nonisolated var rasterSampleCount: Int {
supportsMSAA ? 4 : 1
}
}
extension LayerRenderer.Clock.Instant {
nonisolated var timeInterval: TimeInterval {
let components = LayerRenderer.Clock.Instant.epoch.duration(to: self).components
let nanoseconds = TimeInterval(components.attoseconds / 1_000_000_000)
return TimeInterval(components.seconds) + (nanoseconds / TimeInterval(NSEC_PER_SEC))
}
}
final class RendererTaskExecutor: TaskExecutor {
private let queue = DispatchQueue(label: "RenderThreadQueue", qos: .userInteractive)
func enqueue(_ job: UnownedJob) {
queue.async {
job.runSynchronously(on: self.asUnownedSerialExecutor())
}
}
nonisolated func asUnownedSerialExecutor() -> UnownedTaskExecutor {
return UnownedTaskExecutor(ordinary: self)
}
static var shared: RendererTaskExecutor = RendererTaskExecutor()
}
actor Renderer {
let device: MTLDevice
let commandQueue: MTLCommandQueue
#if !targetEnvironment(simulator)
let residencySets: [MTLResidencySet]
let commandQueueResidencySet: MTLResidencySet
#endif
let dynamicUniformBuffer: MTLBuffer
let pipelineState: MTLRenderPipelineState
let depthState: MTLDepthStencilState
let colorMap: MTLTexture
let endFrameEvent: MTLSharedEvent
var committedFrameIndex: UInt64 = 0
var uniformBufferOffset = 0
var uniformBufferIndex = 0
var uniforms: UnsafeMutablePointer<Uniforms>
var perDrawableTarget = [LayerRenderer.Drawable.Target: DrawableTarget]()
var rotation: Float = 0
var mesh: MTKMesh
let worldTracking: WorldTrackingProvider
let layerRenderer: LayerRenderer
let appModel: AppModel
init(_ layerRenderer: LayerRenderer, appModel: AppModel) {
self.layerRenderer = layerRenderer
self.device = layerRenderer.device
self.appModel = appModel
let device = self.device
self.commandQueue = self.device.makeCommandQueue()!
#if !targetEnvironment(simulator)
let residencySetDesc = MTLResidencySetDescriptor()
residencySetDesc.initialCapacity = 3 // color + depth + view projection buffer
self.residencySets = (0...maxBuffersInFlight).map { _ in try! device.makeResidencySet(descriptor: residencySetDesc) }
#endif
self.endFrameEvent = device.makeSharedEvent()!
// Start the signal value + committed frames index at
// max buffers in flight to avoid negative values
self.endFrameEvent.signaledValue = UInt64(maxBuffersInFlight)
committedFrameIndex = UInt64(maxBuffersInFlight)
let uniformBufferSize = alignedUniformsSize * maxBuffersInFlight
self.dynamicUniformBuffer = self.device.makeBuffer(length: uniformBufferSize,
options: [MTLResourceOptions.storageModeShared])!
self.dynamicUniformBuffer.label = "UniformBuffer"
uniforms = UnsafeMutableRawPointer(dynamicUniformBuffer.contents()).bindMemory(to: Uniforms.self, capacity: 1)
let mtlVertexDescriptor = Self.buildMetalVertexDescriptor()
do {
pipelineState = try Self.buildRenderPipeline(device: device,
layerRenderer: layerRenderer,
mtlVertexDescriptor: mtlVertexDescriptor)
} catch {
fatalError("Unable to compile render pipeline state. Error info: \(error)")
}
self.depthState = Self.buildDepthStencilState(device: device)
do {
mesh = try Self.buildMesh(device: device, mtlVertexDescriptor: mtlVertexDescriptor)
} catch {
fatalError("Unable to build MetalKit Mesh. Error info: \(error)")
}
do {
colorMap = try Self.loadTexture(device: device, textureName: "ColorMap")
} catch {
fatalError("Unable to load texture. Error info: \(error)")
}
#if !targetEnvironment(simulator)
// Add all persistent resources to the command queue residency set,
// must be done after loading all resources.
residencySetDesc.initialCapacity = mesh.vertexBuffers.count + mesh.submeshes.count + 2 // color map + uniforms buffer
let residencySet = try! self.device.makeResidencySet(descriptor: residencySetDesc)
residencySet.addAllocations(mesh.vertexBuffers.map { $0.buffer })
residencySet.addAllocations(mesh.submeshes.map { $0.indexBuffer.buffer })
residencySet.addAllocations([colorMap, dynamicUniformBuffer])
residencySet.commit()
commandQueueResidencySet = residencySet
commandQueue.addResidencySet(residencySet)
#endif
worldTracking = WorldTrackingProvider()
}
private func startARSession(_ arSession: ARKitSession) async {
do {
try await arSession.run([worldTracking])
} catch {
fatalError("Failed to initialize ARSession")
}
}
@MainActor
static func startRenderLoop(_ layerRenderer: LayerRenderer, appModel: AppModel, arSession: ARKitSession) {
Task(executorPreference: RendererTaskExecutor.shared) {
let renderer = Renderer(layerRenderer, appModel: appModel)
await renderer.startARSession(arSession)
await renderer.renderLoop()
}
}
static func buildMetalVertexDescriptor() -> MTLVertexDescriptor {
// Create a Metal vertex descriptor specifying how vertices will by laid out for input into our render
// pipeline and how we'll layout our Model IO vertices
let mtlVertexDescriptor = MTLVertexDescriptor()
mtlVertexDescriptor.attributes[VertexAttribute.position.rawValue].format = MTLVertexFormat.float3
mtlVertexDescriptor.attributes[VertexAttribute.position.rawValue].offset = 0
mtlVertexDescriptor.attributes[VertexAttribute.position.rawValue].bufferIndex = BufferIndex.meshPositions.rawValue
mtlVertexDescriptor.attributes[VertexAttribute.texcoord.rawValue].format = MTLVertexFormat.float2
mtlVertexDescriptor.attributes[VertexAttribute.texcoord.rawValue].offset = 0
mtlVertexDescriptor.attributes[VertexAttribute.texcoord.rawValue].bufferIndex = BufferIndex.meshGenerics.rawValue
mtlVertexDescriptor.layouts[BufferIndex.meshPositions.rawValue].stride = 12
mtlVertexDescriptor.layouts[BufferIndex.meshPositions.rawValue].stepRate = 1
mtlVertexDescriptor.layouts[BufferIndex.meshPositions.rawValue].stepFunction = MTLVertexStepFunction.perVertex
mtlVertexDescriptor.layouts[BufferIndex.meshGenerics.rawValue].stride = 8
mtlVertexDescriptor.layouts[BufferIndex.meshGenerics.rawValue].stepRate = 1
mtlVertexDescriptor.layouts[BufferIndex.meshGenerics.rawValue].stepFunction = MTLVertexStepFunction.perVertex
return mtlVertexDescriptor
}
static func buildRenderPipeline(device: MTLDevice,
layerRenderer: LayerRenderer,
mtlVertexDescriptor: MTLVertexDescriptor) throws -> MTLRenderPipelineState {
/// Build a render state pipeline object
let library = device.makeDefaultLibrary()
let vertexFunction = library?.makeFunction(name: "vertexShader")
let fragmentFunction = library?.makeFunction(name: "fragmentShader")
let pipelineDescriptor = MTLRenderPipelineDescriptor()
pipelineDescriptor.label = "RenderPipeline"
pipelineDescriptor.vertexFunction = vertexFunction
pipelineDescriptor.fragmentFunction = fragmentFunction
pipelineDescriptor.vertexDescriptor = mtlVertexDescriptor
pipelineDescriptor.rasterSampleCount = device.rasterSampleCount
pipelineDescriptor.colorAttachments[0].pixelFormat = layerRenderer.configuration.colorFormat
pipelineDescriptor.depthAttachmentPixelFormat = layerRenderer.configuration.depthFormat
pipelineDescriptor.maxVertexAmplificationCount = layerRenderer.properties.viewCount
return try device.makeRenderPipelineState(descriptor: pipelineDescriptor)
}
static func buildDepthStencilState(device: MTLDevice) -> MTLDepthStencilState {
let depthStateDescriptor = MTLDepthStencilDescriptor()
depthStateDescriptor.depthCompareFunction = MTLCompareFunction.greater
depthStateDescriptor.isDepthWriteEnabled = true
return device.makeDepthStencilState(descriptor: depthStateDescriptor)!
}
static func buildMesh(device: MTLDevice,
mtlVertexDescriptor: MTLVertexDescriptor) throws -> MTKMesh {
/// Create and condition mesh data to feed into a pipeline using the given vertex descriptor
let metalAllocator = MTKMeshBufferAllocator(device: device)
let mdlMesh = MDLMesh.newBox(withDimensions: SIMD3<Float>(4, 4, 4),
segments: SIMD3<UInt32>(2, 2, 2),
geometryType: MDLGeometryType.triangles,
inwardNormals: false,
allocator: metalAllocator)
let mdlVertexDescriptor = MTKModelIOVertexDescriptorFromMetal(mtlVertexDescriptor)
guard let attributes = mdlVertexDescriptor.attributes as? [MDLVertexAttribute] else {
throw RendererError.badVertexDescriptor
}
attributes[VertexAttribute.position.rawValue].name = MDLVertexAttributePosition
attributes[VertexAttribute.texcoord.rawValue].name = MDLVertexAttributeTextureCoordinate
mdlMesh.vertexDescriptor = mdlVertexDescriptor
return try MTKMesh(mesh: mdlMesh, device: device)
}
static func loadTexture(device: MTLDevice,
textureName: String) throws -> MTLTexture {
/// Load texture data with optimal parameters for sampling
let textureLoader = MTKTextureLoader(device: device)
let textureLoaderOptions = [
MTKTextureLoader.Option.textureUsage: NSNumber(value: MTLTextureUsage.shaderRead.rawValue),
MTKTextureLoader.Option.textureStorageMode: NSNumber(value: MTLStorageMode.`private`.rawValue)
]
return try textureLoader.newTexture(name: textureName,
scaleFactor: 1.0,
bundle: nil,
options: textureLoaderOptions)
}
private func updateDynamicBufferState(frameIndex: UInt64) {
/// Update the state of our uniform buffers before rendering
uniformBufferIndex = (uniformBufferIndex + 1) % maxBuffersInFlight
uniformBufferOffset = alignedUniformsSize * uniformBufferIndex
uniforms = UnsafeMutableRawPointer(dynamicUniformBuffer.contents() + uniformBufferOffset).bindMemory(to: Uniforms.self, capacity: 1)
/// Reset resources used in previous frame
#if !targetEnvironment(simulator)
residencySets[uniformBufferIndex].removeAllAllocations()
residencySets[uniformBufferIndex].commit()
#endif
/// Remove all per drawable target resources that are older than 90 frames
perDrawableTarget = perDrawableTarget.filter { $0.value.lastUsedFrameIndex + 90 > frameIndex }
}
private func updateGameState() {
/// Update any game state before rendering
let rotationAxis = SIMD3<Float>(1, 1, 0)
let modelRotationMatrix = matrix4x4_rotation(radians: rotation, axis: rotationAxis)
let modelTranslationMatrix = matrix4x4_translation(0.0, 0.0, -8.0)
let modelMatrix = modelTranslationMatrix * modelRotationMatrix
self.uniforms[0].modelMatrix = modelMatrix
rotation += 0.01
}
func renderFrame() {
/// Per frame updates hare
guard let frame = layerRenderer.queryNextFrame() else { return }
guard self.endFrameEvent.wait(untilSignaledValue: committedFrameIndex - UInt64(maxBuffersInFlight), timeoutMS: 10000) else {
return
}
frame.startUpdate()
// Perform frame independent work
self.updateDynamicBufferState(frameIndex: frame.frameIndex)
self.updateGameState()
frame.endUpdate()
guard let timing = frame.predictTiming() else { return }
LayerRenderer.Clock().wait(until: timing.optimalInputTime)
guard let commandBuffer = commandQueue.makeCommandBuffer() else {
fatalError("Failed to create command buffer")
}
#if !targetEnvironment(simulator)
commandBuffer.useResidencySet(self.residencySets[uniformBufferIndex])
#endif
let drawables = frame.queryDrawables()
guard !drawables.isEmpty else { return }
frame.startSubmission()
for drawable in drawables {
render(drawable: drawable, commandBuffer: commandBuffer, frameIndex: frame.frameIndex)
}
committedFrameIndex += 1
commandBuffer.encodeSignalEvent(self.endFrameEvent, value: committedFrameIndex)
commandBuffer.commit()
frame.endSubmission()
}
func render(drawable: LayerRenderer.Drawable, commandBuffer: MTLCommandBuffer, frameIndex: UInt64) {
let time = drawable.frameTiming.presentationTime.timeInterval
let deviceAnchor = worldTracking.queryDeviceAnchor(atTimestamp: time)
drawable.deviceAnchor = deviceAnchor
if perDrawableTarget[drawable.target] == nil {
perDrawableTarget[drawable.target] = .init(drawable: drawable)
}
let drawableTarget = perDrawableTarget[drawable.target]!
drawableTarget.updateBufferState(uniformBufferIndex: uniformBufferIndex, frameIndex: frameIndex)
drawableTarget.updateViewProjectionArray(drawable: drawable)
let renderPassDescriptor = MTLRenderPassDescriptor()
if device.supportsMSAA {
let renderTargets = drawableTarget.memorylessTargets[uniformBufferIndex]
assert(renderTargets.color.width == drawable.colorTextures[0].width)
assert(renderTargets.color.height == drawable.colorTextures[0].height)
renderPassDescriptor.colorAttachments[0].resolveTexture = drawable.colorTextures[0]
renderPassDescriptor.colorAttachments[0].texture = renderTargets.color
renderPassDescriptor.depthAttachment.resolveTexture = drawable.depthTextures[0]
renderPassDescriptor.depthAttachment.texture = renderTargets.depth
renderPassDescriptor.colorAttachments[0].storeAction = .multisampleResolve
renderPassDescriptor.depthAttachment.storeAction = .multisampleResolve
} else {
renderPassDescriptor.colorAttachments[0].texture = drawable.colorTextures[0]
renderPassDescriptor.depthAttachment.texture = drawable.depthTextures[0]
renderPassDescriptor.colorAttachments[0].storeAction = .store
renderPassDescriptor.depthAttachment.storeAction = .store
}
renderPassDescriptor.colorAttachments[0].loadAction = .clear
renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)
renderPassDescriptor.depthAttachment.loadAction = .clear
renderPassDescriptor.depthAttachment.clearDepth = 0.0
renderPassDescriptor.rasterizationRateMap = drawable.rasterizationRateMaps.first
if layerRenderer.configuration.layout == .layered {
renderPassDescriptor.renderTargetArrayLength = drawable.views.count
}
#if !targetEnvironment(simulator)
let residencySet = self.residencySets[uniformBufferIndex]
residencySet.addAllocations([
drawable.colorTextures[0],
drawable.depthTextures[0],
drawableTarget.viewProjectionBuffer
])
residencySet.commit()
#endif
/// Final pass rendering code here
guard let renderEncoder = commandBuffer.makeRenderCommandEncoder(descriptor: renderPassDescriptor) else {
fatalError("Failed to create render encoder")
}
renderEncoder.label = "Primary Render Encoder"
renderEncoder.pushDebugGroup("Draw Box")
renderEncoder.setCullMode(.back)
renderEncoder.setFrontFacing(.counterClockwise)
renderEncoder.setRenderPipelineState(pipelineState)
renderEncoder.setDepthStencilState(depthState)
let viewports = drawable.views.map { $0.textureMap.viewport }
renderEncoder.setViewports(viewports)
if drawable.views.count > 1 {
var viewMappings = (0..<drawable.views.count).map {
MTLVertexAmplificationViewMapping(viewportArrayIndexOffset: UInt32($0),
renderTargetArrayIndexOffset: UInt32($0))
}
renderEncoder.setVertexAmplificationCount(viewports.count, viewMappings: &viewMappings)
}
renderEncoder.setVertexBuffer(dynamicUniformBuffer, offset: uniformBufferOffset, index: BufferIndex.uniforms.rawValue)
renderEncoder.setVertexBuffer(drawableTarget.viewProjectionBuffer, offset: drawableTarget.viewProjectionBufferOffset, index: BufferIndex.viewProjection.rawValue)
for (index, element) in mesh.vertexDescriptor.layouts.enumerated() {
guard let layout = element as? MDLVertexBufferLayout else {
return
}
if layout.stride != 0 {
let buffer = mesh.vertexBuffers[index]
renderEncoder.setVertexBuffer(buffer.buffer, offset: buffer.offset, index: index)
}
}
renderEncoder.setFragmentTexture(colorMap, index: TextureIndex.color.rawValue)
for submesh in mesh.submeshes {
renderEncoder.drawIndexedPrimitives(type: submesh.primitiveType,
indexCount: submesh.indexCount,
indexType: submesh.indexType,
indexBuffer: submesh.indexBuffer.buffer,
indexBufferOffset: submesh.indexBuffer.offset)
}
renderEncoder.popDebugGroup()
renderEncoder.endEncoding()
drawable.encodePresent(commandBuffer: commandBuffer)
}
func renderLoop() {
while true {
if layerRenderer.state == .invalidated {
print("Layer is invalidated")
Task { @MainActor in
appModel.immersiveSpaceState = .closed
}
return
} else if layerRenderer.state == .paused {
Task { @MainActor in
appModel.immersiveSpaceState = .inTransition
}
layerRenderer.waitUntilRunning()
continue
} else {
Task { @MainActor in
if appModel.immersiveSpaceState != .open {
appModel.immersiveSpaceState = .open
}
}
autoreleasepool {
self.renderFrame()
}
}
}
}
}
extension Renderer {
class DrawableTarget {
var lastUsedFrameIndex: UInt64
let memorylessTargets: [(color: MTLTexture, depth: MTLTexture)]
let viewProjectionBuffer: MTLBuffer
var viewProjectionBufferOffset = 0
var viewProjectionArray: UnsafeMutablePointer<ViewProjectionArray>
nonisolated init(drawable: LayerRenderer.Drawable) {
lastUsedFrameIndex = 0
let device = drawable.colorTextures[0].device
nonisolated func renderTarget(resolveTexture: MTLTexture) -> MTLTexture {
assert(device.supportsMSAA)
let descriptor = MTLTextureDescriptor.texture2DDescriptor(pixelFormat: resolveTexture.pixelFormat,
width: resolveTexture.width,
height: resolveTexture.height,
mipmapped: false)
descriptor.usage = .renderTarget
descriptor.textureType = .type2DMultisampleArray
descriptor.sampleCount = device.rasterSampleCount
descriptor.storageMode = .memoryless
descriptor.arrayLength = resolveTexture.arrayLength
return device.makeTexture(descriptor: descriptor)!
}
if device.supportsMSAA {
memorylessTargets = .init(repeating: (renderTarget(resolveTexture: drawable.colorTextures[0]),
renderTarget(resolveTexture: drawable.depthTextures[0])),
count: maxBuffersInFlight)
} else {
memorylessTargets = []
}
let bufferSize = alignedViewProjectionArraySize * maxBuffersInFlight
viewProjectionBuffer = device.makeBuffer(length: bufferSize,
options: [MTLResourceOptions.storageModeShared])!
viewProjectionArray = UnsafeMutableRawPointer(viewProjectionBuffer.contents() + viewProjectionBufferOffset).bindMemory(to: ViewProjectionArray.self, capacity: 1)
}
}
}
extension Renderer.DrawableTarget {
nonisolated func updateBufferState(uniformBufferIndex: Int, frameIndex: UInt64) {
viewProjectionBufferOffset = alignedViewProjectionArraySize * uniformBufferIndex
viewProjectionArray = UnsafeMutableRawPointer(viewProjectionBuffer.contents() + viewProjectionBufferOffset).bindMemory(to: ViewProjectionArray.self, capacity: 1)
lastUsedFrameIndex = frameIndex
}
nonisolated func updateViewProjectionArray(drawable: LayerRenderer.Drawable) {
let simdDeviceAnchor = drawable.deviceAnchor?.originFromAnchorTransform ?? matrix_identity_float4x4
nonisolated func viewProjection(forViewIndex viewIndex: Int) -> float4x4 {
let view = drawable.views[viewIndex]
let viewMatrix = (simdDeviceAnchor * view.transform).inverse
let projectionMatrix = drawable.computeProjection(viewIndex: viewIndex)
return projectionMatrix * viewMatrix
}
viewProjectionArray[0].viewProjectionMatrix.0 = viewProjection(forViewIndex: 0)
if drawable.views.count > 1 {
viewProjectionArray[0].viewProjectionMatrix.1 = viewProjection(forViewIndex: 1)
}
}
}
// Generic matrix math utility functions
nonisolated func matrix4x4_rotation(radians: Float, axis: SIMD3<Float>) -> matrix_float4x4 {
let unitAxis = normalize(axis)
let ct = cosf(radians)
let st = sinf(radians)
let ci = 1 - ct
let x = unitAxis.x, y = unitAxis.y, z = unitAxis.z
return .init(columns: (vector_float4( ct + x * x * ci, y * x * ci + z * st, z * x * ci - y * st, 0),
vector_float4(x * y * ci - z * st, ct + y * y * ci, z * y * ci + x * st, 0),
vector_float4(x * z * ci + y * st, y * z * ci - x * st, ct + z * z * ci, 0),
vector_float4( 0, 0, 0, 1)))
}
nonisolated func matrix4x4_translation(_ translationX: Float, _ translationY: Float, _ translationZ: Float) -> matrix_float4x4 {
return .init(columns: (vector_float4(1, 0, 0, 0),
vector_float4(0, 1, 0, 0),
vector_float4(0, 0, 1, 0),
vector_float4(translationX, translationY, translationZ, 1)))
}

View File

@ -0,0 +1,54 @@
//
// ShaderTypes.h
// CxLLM-SPA-RNDR
//
// Created by Stephen Carter on 4/22/26.
//
//
// Header containing types and enum constants shared between Metal shaders and Swift/ObjC source
//
#ifndef ShaderTypes_h
#define ShaderTypes_h
#ifdef __METAL_VERSION__
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
typedef metal::int32_t EnumBackingType;
#else
#import <Foundation/Foundation.h>
typedef NSInteger EnumBackingType;
#endif
#include <simd/simd.h>
typedef NS_ENUM(EnumBackingType, BufferIndex)
{
BufferIndexMeshPositions = 0,
BufferIndexMeshGenerics = 1,
BufferIndexUniforms = 2,
BufferIndexViewProjection = 3,
};
typedef NS_ENUM(EnumBackingType, VertexAttribute)
{
VertexAttributePosition = 0,
VertexAttributeTexcoord = 1,
};
typedef NS_ENUM(EnumBackingType, TextureIndex)
{
TextureIndexColor = 0,
};
typedef struct
{
matrix_float4x4 viewProjectionMatrix[2];
} ViewProjectionArray;
typedef struct
{
matrix_float4x4 modelMatrix;
} Uniforms;
#endif /* ShaderTypes_h */

View File

@ -0,0 +1,54 @@
//
// Shaders.metal
// CxLLM-SPA-RNDR
//
// Created by Stephen Carter on 4/22/26.
//
// File for Metal kernel and shader functions
#include <metal_stdlib>
#include <simd/simd.h>
// Including header shared between this Metal shader code and Swift/C code executing Metal API commands
#import "ShaderTypes.h"
using namespace metal;
typedef struct
{
float3 position [[attribute(VertexAttributePosition)]];
float2 texCoord [[attribute(VertexAttributeTexcoord)]];
} Vertex;
typedef struct
{
float4 position [[position]];
float2 texCoord;
} ColorInOut;
vertex ColorInOut vertexShader(Vertex in [[stage_in]],
ushort amp_id [[amplification_id]],
constant Uniforms & uniforms [[ buffer(BufferIndexUniforms) ]],
constant ViewProjectionArray & viewProjectionArray [[ buffer(BufferIndexViewProjection) ]])
{
ColorInOut out;
float4 position = float4(in.position, 1.0);
out.position = viewProjectionArray.viewProjectionMatrix[amp_id] * uniforms.modelMatrix * position;
out.texCoord = in.texCoord;
return out;
}
fragment float4 fragmentShader(ColorInOut in [[stage_in]],
texture2d<half> colorMap [[ texture(TextureIndexColor) ]])
{
constexpr sampler colorSampler(mip_filter::linear,
mag_filter::linear,
min_filter::linear);
half4 colorSample = colorMap.sample(colorSampler, in.texCoord.xy);
return float4(colorSample);
}

View File

@ -0,0 +1,58 @@
//
// ToggleImmersiveSpaceButton.swift
// CxLLM-SPA-RNDR
//
// Created by Stephen Carter on 4/22/26.
//
import SwiftUI
struct ToggleImmersiveSpaceButton: View {
@Environment(AppModel.self) private var appModel
@Environment(\.dismissImmersiveSpace) private var dismissImmersiveSpace
@Environment(\.openImmersiveSpace) private var openImmersiveSpace
var body: some View {
Button {
Task { @MainActor in
switch appModel.immersiveSpaceState {
case .open:
appModel.immersiveSpaceState = .inTransition
await dismissImmersiveSpace()
// Don't set immersiveSpaceState to .closed because there
// are multiple paths to ImmersiveView.onDisappear().
// Only set .closed in ImmersiveView.onDisappear().
case .closed:
appModel.immersiveSpaceState = .inTransition
switch await openImmersiveSpace(id: appModel.immersiveSpaceID) {
case .opened:
// Don't set immersiveSpaceState to .open because there
// may be multiple paths to ImmersiveView.onAppear().
// Only set .open in ImmersiveView.onAppear().
break
case .userCancelled, .error:
// On error, we need to mark the immersive space
// as closed because it failed to open.
fallthrough
@unknown default:
// On unknown response, assume space did not open.
appModel.immersiveSpaceState = .closed
}
case .inTransition:
// This case should not ever happen because button is disabled for this case.
break
}
}
} label: {
Text(appModel.immersiveSpaceState == .open ? "Hide Immersive Space" : "Show Immersive Space")
}
.disabled(appModel.immersiveSpaceState == .inTransition)
.animation(.none, value: 0)
.fontWeight(.semibold)
}
}

View File

@ -0,0 +1,17 @@
//
// CxLLM_SPA_RNDRTests.swift
// CxLLM-SPA-RNDRTests
//
// Created by Stephen Carter on 4/22/26.
//
import Testing
@testable import CxLLM_SPA_RNDR
struct CxLLM_SPA_RNDRTests {
@Test func example() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
}
}

View File

@ -0,0 +1,41 @@
//
// CxLLM_SPA_RNDRUITests.swift
// CxLLM-SPA-RNDRUITests
//
// Created by Stephen Carter on 4/22/26.
//
import XCTest
final class CxLLM_SPA_RNDRUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
@MainActor
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
@MainActor
func testLaunchPerformance() throws {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}

View File

@ -0,0 +1,33 @@
//
// CxLLM_SPA_RNDRUITestsLaunchTests.swift
// CxLLM-SPA-RNDRUITests
//
// Created by Stephen Carter on 4/22/26.
//
import XCTest
final class CxLLM_SPA_RNDRUITestsLaunchTests: XCTestCase {
override class var runsForEachTargetApplicationUIConfiguration: Bool {
true
}
override func setUpWithError() throws {
continueAfterFailure = false
}
@MainActor
func testLaunch() throws {
let app = XCUIApplication()
app.launch()
// Insert steps here to perform after app launch but before taking a screenshot,
// such as logging into a test account or navigating somewhere in the app
let attachment = XCTAttachment(screenshot: app.screenshot())
attachment.name = "Launch Screen"
attachment.lifetime = .keepAlways
add(attachment)
}
}

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 CxAI-LLM
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

43
Makefile Normal file
View File

@ -0,0 +1,43 @@
# Makefile — common entry points for CxLLM-SPA-RNDR
SHELL := /bin/bash
.DEFAULT_GOAL := help
PROJECT := CxLLM-SPA-RNDR
SCHEME ?= $(PROJECT)
CONFIG ?= Debug
DERIVED ?= build
.PHONY: help build test lint clean fmt info
help: ## show this help
@grep -E '^[a-zA-Z_-]+:.*## ' $(MAKEFILE_LIST) | awk -F':.*## ' '{printf " %-12s %s\n", $$1, $$2}'
info: ## show project info
@echo "project : $(PROJECT)"
@echo "scheme : $(SCHEME)"
@echo "config : $(CONFIG)"
@echo "derived : $(DERIVED)"
build: ## xcodebuild build (skip if no .xcodeproj)
@if ls *.xcodeproj 1>/dev/null 2>&1; then \
xcodebuild -project "$(PROJECT).xcodeproj" -scheme "$(SCHEME)" -configuration "$(CONFIG)" -derivedDataPath "$(DERIVED)" build | xcbeautify || true ; \
elif [ -f Package.swift ]; then \
swift build -c $(shell echo "$(CONFIG)" | tr '[:upper:]' '[:lower:]') ; \
else echo "no buildable target" ; fi
test: ## xcodebuild test
@if ls *.xcodeproj 1>/dev/null 2>&1; then \
xcodebuild -project "$(PROJECT).xcodeproj" -scheme "$(SCHEME)" -configuration "$(CONFIG)" -derivedDataPath "$(DERIVED)" test | xcbeautify || true ; \
elif [ -f Package.swift ]; then \
swift test ; \
else echo "no testable target" ; fi
lint: ## swiftlint + swiftformat (no-op if missing)
@command -v swiftlint >/dev/null && swiftlint --quiet || echo "swiftlint not installed"
@command -v swiftformat >/dev/null && swiftformat --lint . || echo "swiftformat not installed"
fmt: ## swiftformat in-place
@command -v swiftformat >/dev/null && swiftformat . || echo "swiftformat not installed"
clean: ## remove build artifacts
rm -rf "$(DERIVED)" .build DerivedData

53
README.md Normal file
View File

@ -0,0 +1,53 @@
# CxLLM-SPA-RNDR
> CxLLM Spatial Renderer
visionOS Metal/RealityKit immersive renderer that visualizes CxLLM activations as a spatial volumetric scene.
[![ci](https://git.cxllm-studio.com/CxAI-LLM/CxLLM-SPA-RNDR/actions/workflows/ci.yml/badge.svg)](https://git.cxllm-studio.com/CxAI-LLM/CxLLM-SPA-RNDR/actions)
[![license](https://img.shields.io/badge/license-MIT-7C3AED)](LICENSE)
[![category](https://img.shields.io/badge/category-app-vision-1F6FEB)](#)
## Overview
`CxLLM-SPA-RNDR` is part of the **CxLLM** product family — a layered runtime that
spans Apple kernel extensions, user-space frameworks, host applications, and
spatial / web surfaces. This module focuses on **app-vision** concerns and is
intentionally narrow so that the CxLLM monorepo can compose targets without
pulling in unrelated dependencies.
## Repository layout
- `CxLLM-SPA-RNDR/` — primary source folder (matches the Xcode group / SwiftPM root).
- `CxLLM-SPA-RNDR.xcodeproj` — Xcode project (where applicable).
- `Makefile` — common entry points (`build`, `test`, `lint`, `clean`).
- `.github/workflows/ci.yml` — CI pipeline (Xcode build + lint).
- `docs/` — architecture notes and ADRs.
## Quick start
```bash
# Build (defaults to Debug for the host platform):
make build
# Run the full test suite (unit + UI where applicable):
make test
# Static analysis + format check:
make lint
```
## Versioning
This module follows [Semantic Versioning 2.0](https://semver.org/) and is
released in lock-step with the umbrella **CxLLM** product line. See
[`CHANGELOG.md`](CHANGELOG.md) for the user-facing change log.
## Security
Please report security issues per [`SECURITY.md`](SECURITY.md). Do **not**
open public issues for vulnerabilities.
## License
Released under the [MIT License](LICENSE) © 2026 CxAI-LLM.

19
SECURITY.md Normal file
View File

@ -0,0 +1,19 @@
# Security policy for CxLLM-SPA-RNDR
## Reporting a vulnerability
Please email **security@cxllm-studio.com** with:
- A description of the vulnerability and its impact.
- Steps to reproduce, ideally with a minimal proof-of-concept.
- The affected version(s) / commit SHAs.
We aim to acknowledge within **2 business days** and to publish a fix or
mitigation within **30 days** for high-severity issues.
Do **not** open a public Gitea / GitHub issue for vulnerabilities.
## Supported versions
Only the `main` branch and the most recent tagged release receive security
updates.

24
docs/ARCHITECTURE.md Normal file
View File

@ -0,0 +1,24 @@
# Architecture — CxLLM-SPA-RNDR
> CxLLM Spatial Renderer
## Goals
- Provide a focused, well-tested app-vision surface for the CxLLM family.
- Stay deployable on its own (no monorepo coupling).
- Keep the public ABI small and explicitly versioned.
## Boundaries
```text
+----------------------+
client --> | CxLLM-SPA-RNDR |
+----------+-----------+
|
v
CxLLM runtime / kernel
```
## Decisions
- See `docs/adr/` for Architecture Decision Records.

View File

@ -0,0 +1,13 @@
# 1. Record architecture decisions
## Status
Accepted
## Context
We need a lightweight, append-only log of architectural choices.
## Decision
Use Markdown ADRs in `docs/adr/`, numbered sequentially.
## Consequences
Future maintainers can read the chain of decisions without spelunking PR history.