Repository Public
1// swift-tools-version: 6.22// =============================================================================3// SP BOUCHER | SOFTWARE & RESEARCH4// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5// =============================================================================6//7// PROJECT METADATA8// -----------------------------------------------------------------------------9// Project : ORIX Docs10// File : Packages/ORIXDocsAI/Package.swift11// Description : AI package of ORIX Docs. The provider, local-inference and12// agent-runtime modules are the ORIX Astra modules, vendored13// unchanged under Vendor/ at the revision recorded in14// Vendor/ASTRA_REVISION (Scripts/sync-astra.sh refreshes15// them). DocAgent, written for ORIX Docs, connects them to16// the document command engine. Kept apart from ORIXDocsKit17// so the engines never link an inference runtime.18// Module : Packages19// Repository : https://git.spboucher.ai/orix-docs20// Created : 2026-11-2221// Last Modified : 2026-11-2222//23// =============================================================================24// AUTHOR & PROFESSIONAL AFFILIATION25// =============================================================================26//27// Author : Simon-Pierre Boucher28// Position : Professor of Finance29// Institution : Université du Québec en Outaouais (UQO)30// Department : Département des sciences administratives31// Organization : SP Boucher32//33// Website : https://spboucher.ai34// Git : https://git.spboucher.ai35//36// =============================================================================37// OFFICIAL CONTACT DIRECTORY38// =============================================================================39//40// General : info@spboucher.ai41// Professional : contact@spboucher.ai42// Direct : simon@spboucher.ai43// Research : research@spboucher.ai44// Development : dev@spboucher.ai45// Support : support@spboucher.ai46// Security/Admin : admin@spboucher.ai47// Notifications : notifications@spboucher.ai48//49// Preferred Contact: support@spboucher.ai50//51// =============================================================================52// COPYRIGHT & INTELLECTUAL PROPERTY53// =============================================================================54//55// Copyright (c) 202656// Simon-Pierre Boucher57//58// All rights reserved where applicable.59//60// This file is governed by the applicable project license,61// copyright notices, institutional agreements and relevant law.62//63// Unless expressly authorized by the applicable license or64// rights holder, copying, redistribution, sublicensing,65// publication and commercial exploitation are not permitted.66//67// Existing third-party rights and notices remain unaffected.68//69// =============================================================================70// CONFIDENTIALITY & SECURITY71// =============================================================================72//73// Classification : Public74// Distribution : Public repository; use is governed by the project license75// Security Contact : admin@spboucher.ai76//77// Access to this source does not independently grant permission78// to redistribute or disclose confidential materials.79//80// Do not embed credentials, private keys, access tokens,81// certificates or confidential personal information.82//83// =============================================================================84// LICENSE & MAINTENANCE85// =============================================================================86//87// License : None specified (no license file in this repository)88// Maintainer : Simon-Pierre Boucher89// Technical Contact: dev@spboucher.ai90//91// =============================================================================92// END OF SP BOUCHER SOURCE HEADER93// =============================================================================9495import PackageDescription9697// ORIXAI_NO_MLX=1 leaves out the module that links MLX: the pure-Swift modules then build and test in seconds.98let light = Context.environment["ORIXAI_NO_MLX"] == "1"99100let mlx: [Target.Dependency] = [101 .product(name: "MLXLLM", package: "mlx-swift-lm"),102 .product(name: "MLXVLM", package: "mlx-swift-lm"),103 .product(name: "MLXLMCommon", package: "mlx-swift-lm"),104 .product(name: "MLX", package: "mlx-swift"),105 .product(name: "Tokenizers", package: "swift-transformers"),106 .product(name: "Jinja", package: "swift-jinja"),107]108109func vendored(_ name: String, _ deps: [Target.Dependency] = []) -> Target {110 .target(name: name, dependencies: deps, path: "Vendor/Packages/\(name)/Sources", swiftSettings: [.swiftLanguageMode(.v6)])111}112func vendoredTests(_ name: String, _ deps: [Target.Dependency], resources: [Resource]? = nil) -> Target {113 .testTarget(name: name, dependencies: deps, path: "Vendor/Tests/\(name)", resources: resources, swiftSettings: [.swiftLanguageMode(.v6)])114}115116let docs: [Target.Dependency] = [.product(name: "ORIXDocsKit", package: "ORIXDocsKit")]117let heavy: Set<String> = ["AstraLocal", "AstraLocalTests", "DocLocalModels", "DocLocalModelsTests"]118119let allTargets: [Target] = [120 vendored("AstraCore"),121 vendored("AstraProviders", ["AstraCore"]),122 vendored("AstraAgents", ["AstraCore"]),123 vendored("AstraLocal", ["AstraCore"] + mlx),124 // AI infrastructure of ORIX Docs: credentials, provider hub, usage ledger, model router. Pure Swift, no inference runtime.125 .target(name: "DocAI", dependencies: ["AstraCore", "AstraProviders"], swiftSettings: [.swiftLanguageMode(.v6)]),126 // On-device models: library over AstraLocal (catalogue, downloads, load, generation), editor-aware memory governor, Apple Intelligence.127 .target(name: "DocLocalModels", dependencies: ["DocAI", "AstraCore", "AstraLocal"], resources: [.copy("Resources/catalog.json")],128 swiftSettings: [.swiftLanguageMode(.v6)]),129 .target(name: "DocAgent", dependencies: ["AstraCore", "AstraProviders", "AstraAgents"] + docs, swiftSettings: [.swiftLanguageMode(.v6)]),130 vendoredTests("AstraCoreTests", ["AstraCore"]),131 vendoredTests("AstraProvidersTests", ["AstraCore", "AstraProviders"], resources: [.copy("Fixtures")]),132 vendoredTests("AstraAgentsTests", ["AstraCore", "AstraAgents"]),133 vendoredTests("AstraLocalTests", ["AstraCore", "AstraLocal"]),134 .testTarget(name: "DocAITests", dependencies: ["DocAI", "AstraCore", "AstraProviders"], swiftSettings: [.swiftLanguageMode(.v6)]),135 .testTarget(name: "DocLocalModelsTests", dependencies: ["DocLocalModels", "DocAI", "AstraCore", "AstraLocal"], swiftSettings: [.swiftLanguageMode(.v6)]),136 .testTarget(name: "DocAgentTests", dependencies: ["DocAgent", "AstraCore", "AstraProviders", "AstraAgents"] + docs, swiftSettings: [.swiftLanguageMode(.v6)]),137]138let targets = allTargets.filter { !light || !heavy.contains($0.name) }139140let package = Package(141 name: "ORIXDocsAI",142 defaultLocalization: "en",143 platforms: [.macOS(.v15)],144 products: [.library(name: "ORIXDocsAI", targets: targets.filter { $0.type == .regular }.map(\.name))],145 dependencies: [.package(path: "../ORIXDocsKit")] + (light ? [] : [146 .package(url: "https://github.com/ml-explore/mlx-swift-lm", exact: "3.33.0"),147 .package(url: "https://github.com/ml-explore/mlx-swift", .upToNextMinor(from: "0.33.0")),148 .package(url: "https://github.com/huggingface/swift-transformers", exact: "1.4.0"),149 .package(url: "https://github.com/huggingface/swift-jinja.git", "2.4.2"..<"4.0.0"),150 ]),151 targets: targets152)153