From f0c0a4d2b715b19690fd5ee312077e3a0b1c1b47 Mon Sep 17 00:00:00 2001 From: CxAI Ops Date: Sat, 16 May 2026 10:52:05 -0500 Subject: [PATCH] chore: initial commit (Phase 3 scaffold) --- .editorconfig | 15 + .gitea/workflows/ci.yml | 36 ++ .github/workflows/ci.yml | 27 ++ .gitignore | 54 +++ CHANGELOG.md | 16 + CODEOWNERS | 6 + CONTRIBUTING.md | 23 ++ CxLLM-XPC.xcodeproj/project.pbxproj | 327 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + CxLLM-XPC/CxLLM_XPC.h | 13 + CxLLM-XPC/CxLLM_XPC.m | 18 + CxLLM-XPC/CxLLM_XPCProtocol.h | 34 ++ CxLLM-XPC/Info.plist | 11 + CxLLM-XPC/main.m | 48 +++ LICENSE | 21 ++ Makefile | 43 +++ README.md | 53 +++ SECURITY.md | 19 + docs/ARCHITECTURE.md | 24 ++ .../adr/0001-record-architecture-decisions.md | 13 + 20 files changed, 808 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitea/workflows/ci.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 CODEOWNERS create mode 100644 CONTRIBUTING.md create mode 100644 CxLLM-XPC.xcodeproj/project.pbxproj create mode 100644 CxLLM-XPC.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 CxLLM-XPC/CxLLM_XPC.h create mode 100644 CxLLM-XPC/CxLLM_XPC.m create mode 100644 CxLLM-XPC/CxLLM_XPCProtocol.h create mode 100644 CxLLM-XPC/Info.plist create mode 100644 CxLLM-XPC/main.m create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 SECURITY.md create mode 100644 docs/ARCHITECTURE.md create mode 100644 docs/adr/0001-record-architecture-decisions.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5ef197b --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..2a804da --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..39d201f --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4ca831 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..237147b --- /dev/null +++ b/CHANGELOG.md @@ -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 xpc-service scaffold for CxLLM-XPC. diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..7e6dfca --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,6 @@ +# Default owners for everything in this repo. +* @CxAI-LLM/maintainers + +# Build & CI +/.github/ @CxAI-LLM/devops +/Makefile @CxAI-LLM/devops diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bb5056e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,23 @@ +# Contributing to CxLLM-XPC + +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). diff --git a/CxLLM-XPC.xcodeproj/project.pbxproj b/CxLLM-XPC.xcodeproj/project.pbxproj new file mode 100644 index 0000000..934e3f4 --- /dev/null +++ b/CxLLM-XPC.xcodeproj/project.pbxproj @@ -0,0 +1,327 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXFileReference section */ + 20F2B00C2F99722400E7D2D9 /* CxLLM-XPC.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = "CxLLM-XPC.xpc"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 20F2B0162F99722400E7D2D9 /* Exceptions for "CxLLM-XPC" folder in "CxLLM-XPC" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = 20F2B00B2F99722400E7D2D9 /* CxLLM-XPC */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 20F2B00E2F99722400E7D2D9 /* CxLLM-XPC */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 20F2B0162F99722400E7D2D9 /* Exceptions for "CxLLM-XPC" folder in "CxLLM-XPC" target */, + ); + path = "CxLLM-XPC"; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 20F2B0092F99722400E7D2D9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 20F2B0032F99722400E7D2D9 = { + isa = PBXGroup; + children = ( + 20F2B00E2F99722400E7D2D9 /* CxLLM-XPC */, + 20F2B00D2F99722400E7D2D9 /* Products */, + ); + sourceTree = ""; + }; + 20F2B00D2F99722400E7D2D9 /* Products */ = { + isa = PBXGroup; + children = ( + 20F2B00C2F99722400E7D2D9 /* CxLLM-XPC.xpc */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 20F2B00B2F99722400E7D2D9 /* CxLLM-XPC */ = { + isa = PBXNativeTarget; + buildConfigurationList = 20F2B0172F99722400E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-XPC" */; + buildPhases = ( + 20F2B0082F99722400E7D2D9 /* Sources */, + 20F2B0092F99722400E7D2D9 /* Frameworks */, + 20F2B00A2F99722400E7D2D9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 20F2B00E2F99722400E7D2D9 /* CxLLM-XPC */, + ); + name = "CxLLM-XPC"; + packageProductDependencies = ( + ); + productName = "CxLLM-XPC"; + productReference = 20F2B00C2F99722400E7D2D9 /* CxLLM-XPC.xpc */; + productType = "com.apple.product-type.xpc-service"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 20F2B0042F99722400E7D2D9 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 2630; + TargetAttributes = { + 20F2B00B2F99722400E7D2D9 = { + CreatedOnToolsVersion = 26.3; + }; + }; + }; + buildConfigurationList = 20F2B0072F99722400E7D2D9 /* Build configuration list for PBXProject "CxLLM-XPC" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 20F2B0032F99722400E7D2D9; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 20F2B00D2F99722400E7D2D9 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 20F2B00B2F99722400E7D2D9 /* CxLLM-XPC */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 20F2B00A2F99722400E7D2D9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 20F2B0082F99722400E7D2D9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 20F2B0182F99722400E7D2D9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = DKWVC9FQJY; + ENABLE_APP_SANDBOX = YES; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "CxLLM-XPC/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "CxLLM-XPC"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-XPC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + REGISTER_APP_GROUPS = YES; + SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + }; + name = Debug; + }; + 20F2B0192F99722400E7D2D9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = DKWVC9FQJY; + ENABLE_APP_SANDBOX = YES; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "CxLLM-XPC/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "CxLLM-XPC"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "cxai-studio.CxLLM-XPC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + REGISTER_APP_GROUPS = YES; + SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + }; + name = Release; + }; + 20F2B01A2F99722400E7D2D9 /* 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; + }; + name = Debug; + }; + 20F2B01B2F99722400E7D2D9 /* 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; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 20F2B0072F99722400E7D2D9 /* Build configuration list for PBXProject "CxLLM-XPC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20F2B01A2F99722400E7D2D9 /* Debug */, + 20F2B01B2F99722400E7D2D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 20F2B0172F99722400E7D2D9 /* Build configuration list for PBXNativeTarget "CxLLM-XPC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20F2B0182F99722400E7D2D9 /* Debug */, + 20F2B0192F99722400E7D2D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 20F2B0042F99722400E7D2D9 /* Project object */; +} diff --git a/CxLLM-XPC.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CxLLM-XPC.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/CxLLM-XPC.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CxLLM-XPC/CxLLM_XPC.h b/CxLLM-XPC/CxLLM_XPC.h new file mode 100644 index 0000000..1142bee --- /dev/null +++ b/CxLLM-XPC/CxLLM_XPC.h @@ -0,0 +1,13 @@ +// +// CxLLM_XPC.h +// CxLLM-XPC +// +// Created by Stephen Carter on 4/22/26. +// + +#import +#import "CxLLM_XPCProtocol.h" + +// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. +@interface CxLLM_XPC : NSObject +@end diff --git a/CxLLM-XPC/CxLLM_XPC.m b/CxLLM-XPC/CxLLM_XPC.m new file mode 100644 index 0000000..64fd475 --- /dev/null +++ b/CxLLM-XPC/CxLLM_XPC.m @@ -0,0 +1,18 @@ +// +// CxLLM_XPC.m +// CxLLM-XPC +// +// Created by Stephen Carter on 4/22/26. +// + +#import "CxLLM_XPC.h" + +@implementation CxLLM_XPC + +// This implements the example protocol. Replace the body of this class with the implementation of this service's protocol. +- (void)performCalculationWithNumber:(NSNumber *)firstNumber andNumber:(NSNumber *)secondNumber withReply:(void (^)(NSNumber *))reply { + NSInteger result = firstNumber.integerValue + secondNumber.integerValue; + reply(@(result)); +} + +@end diff --git a/CxLLM-XPC/CxLLM_XPCProtocol.h b/CxLLM-XPC/CxLLM_XPCProtocol.h new file mode 100644 index 0000000..1f2d9fe --- /dev/null +++ b/CxLLM-XPC/CxLLM_XPCProtocol.h @@ -0,0 +1,34 @@ +// +// CxLLM_XPCProtocol.h +// CxLLM-XPC +// +// Created by Stephen Carter on 4/22/26. +// + +#import + +// The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service. +@protocol CxLLM_XPCProtocol + +// Replace the API of this protocol with an API appropriate to the service you are vending. +- (void)performCalculationWithNumber:(NSNumber *)firstNumber andNumber:(NSNumber *)secondNumber withReply:(void (^)(NSNumber *))reply; +@end + +/* + To use the service from an application or other process, use NSXPCConnection to establish a connection to the service by doing something like this: + + _connectionToService = [[NSXPCConnection alloc] initWithServiceName:@"cxai-studio.CxLLM-XPC"]; + _connectionToService.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(CxLLM_XPCProtocol)]; + [_connectionToService resume]; + +Once you have a connection to the service, you can use it like this: + + [[_connectionToService remoteObjectProxy] performCalculationWithNumber:@23 andNumber:@19 withReply:^(NSNumber *reply) { + // We have received a response. + NSLog(@"Result from calculation is: %@", reply); + }]; + + And, when you are finished with the service, clean up the connection like this: + + [_connectionToService invalidate]; +*/ diff --git a/CxLLM-XPC/Info.plist b/CxLLM-XPC/Info.plist new file mode 100644 index 0000000..c123a5d --- /dev/null +++ b/CxLLM-XPC/Info.plist @@ -0,0 +1,11 @@ + + + + + XPCService + + ServiceType + Application + + + diff --git a/CxLLM-XPC/main.m b/CxLLM-XPC/main.m new file mode 100644 index 0000000..cdabc5a --- /dev/null +++ b/CxLLM-XPC/main.m @@ -0,0 +1,48 @@ +// +// main.m +// CxLLM-XPC +// +// Created by Stephen Carter on 4/22/26. +// + +#import +#import "CxLLM_XPC.h" + +@interface ServiceDelegate : NSObject +@end + +@implementation ServiceDelegate + +- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { + // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. + + // Configure the connection. + // First, set the interface that the exported object implements. + newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(CxLLM_XPCProtocol)]; + + // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. + CxLLM_XPC *exportedObject = [CxLLM_XPC new]; + newConnection.exportedObject = exportedObject; + + // Resuming the connection allows the system to deliver more incoming messages. + [newConnection resume]; + + // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. + return YES; +} + +@end + +int main(int argc, const char *argv[]) +{ + // Create the delegate for the service. + ServiceDelegate *delegate = [ServiceDelegate new]; + + // Set up the one NSXPCListener for this service. It will handle all incoming connections. + NSXPCListener *listener = [NSXPCListener serviceListener]; + listener.delegate = delegate; + + // Resuming the serviceListener starts this service. This method does not return. + [listener resume]; + return 0; +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..114f83a --- /dev/null +++ b/LICENSE @@ -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. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..57c649a --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +# Makefile — common entry points for CxLLM-XPC +SHELL := /bin/bash +.DEFAULT_GOAL := help + +PROJECT := CxLLM-XPC +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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2999800 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# CxLLM-XPC + +> CxLLM XPC service + +Objective-C XPC service that brokers privileged operations between the CxLLM host application and the kernel surface. + +[![ci](https://git.cxllm-studio.com/CxAI-LLM/CxLLM-XPC/actions/workflows/ci.yml/badge.svg)](https://git.cxllm-studio.com/CxAI-LLM/CxLLM-XPC/actions) +[![license](https://img.shields.io/badge/license-MIT-7C3AED)](LICENSE) +[![category](https://img.shields.io/badge/category-xpc-service-1F6FEB)](#) + +## Overview + +`CxLLM-XPC` 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 **xpc-service** concerns and is +intentionally narrow so that the CxLLM monorepo can compose targets without +pulling in unrelated dependencies. + +## Repository layout + +- `CxLLM-XPC/` — primary source folder (matches the Xcode group / SwiftPM root). +- `CxLLM-XPC.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. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..377cb34 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,19 @@ +# Security policy for CxLLM-XPC + +## 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. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..cc2576d --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,24 @@ +# Architecture — CxLLM-XPC + +> CxLLM XPC service + +## Goals + +- Provide a focused, well-tested xpc-service 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-XPC | + +----------+-----------+ + | + v + CxLLM runtime / kernel +``` + +## Decisions + +- See `docs/adr/` for Architecture Decision Records. diff --git a/docs/adr/0001-record-architecture-decisions.md b/docs/adr/0001-record-architecture-decisions.md new file mode 100644 index 0000000..4fc033a --- /dev/null +++ b/docs/adr/0001-record-architecture-decisions.md @@ -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.