├── .gitattributes ├── .gitignore ├── LICENSE ├── LOGICSAGE_ScreenShot.png ├── LogicSage.swiftpm ├── .swiftpm │ └── playgrounds │ │ ├── CachedManifest.plist │ │ ├── DocumentThumbnail.plist │ │ ├── DocumentThumbnail.png │ │ └── Workspace.plist ├── ContentView.swift ├── MyApp.swift └── Package.swift ├── LogicSage ├── CZLib │ ├── module.modulemap │ └── shim.h ├── LogicSage.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── swiftpm │ │ │ └── Package.resolved │ └── xcshareddata │ │ └── xcschemes │ │ └── LogicSage.xcscheme ├── LogicSage.xctestplan ├── LogicSage │ ├── AltDragRotationModifier.swift │ ├── AppModel.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── 1024.png │ │ │ ├── Contents.json │ │ │ ├── SwiftSageDev1024n copy 1.png │ │ │ ├── SwiftSageDev1024n copy 10.png │ │ │ ├── SwiftSageDev1024n copy 11.png │ │ │ ├── SwiftSageDev1024n copy 12.png │ │ │ ├── SwiftSageDev1024n copy 2.png │ │ │ ├── SwiftSageDev1024n copy 3.png │ │ │ ├── SwiftSageDev1024n copy 5.png │ │ │ ├── SwiftSageDev1024n copy 6.png │ │ │ ├── SwiftSageDev1024n copy 8.png │ │ │ └── SwiftSageDev1024n.png │ │ ├── AppIconDev.appiconset │ │ │ ├── Contents.json │ │ │ ├── SwiftSageDev1024.png │ │ │ ├── SwiftSageDev1024n copy 1.png │ │ │ ├── SwiftSageDev1024n copy 11.png │ │ │ ├── SwiftSageDev1024n copy 13.png │ │ │ ├── SwiftSageDev1024n copy 15.png │ │ │ ├── SwiftSageDev1024n copy 17.png │ │ │ ├── SwiftSageDev1024n copy 3.png │ │ │ ├── SwiftSageDev1024n copy 5.png │ │ │ ├── SwiftSageDev1024n copy 7.png │ │ │ ├── SwiftSageDev1024n copy 9.png │ │ │ └── SwiftSageDev1024n.png │ │ ├── Contents.json │ │ ├── VAppIcon.solidimagestack │ │ │ ├── Back.solidimagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ ├── 1024.png │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── Front.solidimagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ ├── 1024.png │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ └── Middle.solidimagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ ├── 1024.png │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ └── VAppIconDev.solidimagestack │ │ │ ├── Back.solidimagestacklayer │ │ │ ├── Content.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── SwiftSageDev1024.png │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── Front.solidimagestacklayer │ │ │ ├── Content.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── SwiftSageDev1024.png │ │ │ └── Contents.json │ │ │ └── Middle.solidimagestacklayer │ │ │ ├── Content.imageset │ │ │ ├── Contents.json │ │ │ └── SwiftSageDev1024.png │ │ │ └── Contents.json │ ├── Backend.swift │ ├── Command │ │ ├── GPT+Assisstants.swift │ │ ├── GPT.swift │ │ ├── GPTCommand.swift │ │ ├── Googler.swift │ │ ├── Linker.swift │ │ └── WrapSoup.swift │ ├── Config │ │ └── Reset.swift │ ├── DragRotationModifier.swift │ ├── GPT-Info.plist │ ├── Info.plist │ ├── Loading │ │ ├── AsciiAnimator.swift │ │ ├── AsciiText.swift │ │ ├── Loading.swift │ │ └── SpinnerThread.swift │ ├── LogicSageApp.swift │ ├── LogicSageSceneDelegate.swift │ ├── LogicSageTogether.swift │ ├── LogicSageiOSApp+UserDefaults.swift │ ├── MacPluginLoader.swift │ ├── PlacementGestureModifier.swift │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── SwiftSageiOS.entitlements │ ├── Utilities │ │ ├── BGHandler.swift │ │ ├── Color+Base64.swift │ │ ├── HapticMan.swift │ │ ├── KeyboardResponder.swift │ │ ├── KeychainManager.swift │ │ ├── NetServiceBrowserWrapper.swift │ │ ├── PTTWrapper.swift │ │ ├── Screamer.swift │ │ ├── Speak.swift │ │ ├── UIColorExt.swift │ │ ├── UIView+Screenshot.swift │ │ ├── View+If.swift │ │ ├── View+Keyboard.swift │ │ └── WindowManager.swift │ ├── ViewViewModel │ │ ├── AddView.swift │ │ ├── AnimatedArrow.swift │ │ ├── AssistantModalContentView.swift │ │ ├── AudioView.swift │ │ ├── ChangeList.swift │ │ ├── ChangeRow+ChangedLines.swift │ │ ├── ChatBottomMenu.swift │ │ ├── ChatView.swift │ │ ├── CheckmarkView.swift │ │ ├── CommandButton.swift │ │ ├── ContentView.swift │ │ ├── CurvedEdgeArc.swift │ │ ├── CustomPointerView.swift │ │ ├── DateProvider.swift │ │ ├── DocumentPicker.swift │ │ ├── Drawer.swift │ │ ├── Entity+Move.swift │ │ ├── GlobeControls.swift │ │ ├── IDProvider.swift │ │ ├── ImmersiveLogoView.swift │ │ ├── ImmersiveView.swift │ │ ├── InstructionsPopup.swift │ │ ├── KeyboardAdaptive.swift │ │ ├── KeyboardHeightPublisher.swift │ │ ├── LoadingLogic.swift │ │ ├── NewViewerButton.swift │ │ ├── ProjectTab.swift │ │ ├── RepositoryTreeView.swift │ │ ├── ResizingHandle.swift │ │ ├── SageMultiView+onDrag.swift │ │ ├── SageMultiView.swift │ │ ├── SageMultiViewModel.swift │ │ ├── Settings │ │ │ ├── CommitDownloader.swift │ │ │ ├── ConversationsViewModel.swift │ │ │ ├── Settings+ColorGen.swift │ │ │ ├── Settings+ForkGithub.swift │ │ │ ├── Settings+Github.swift │ │ │ ├── Settings+WriteGithub.swift │ │ │ ├── SettingsVIew.swift │ │ │ ├── SettingsView+ColorDisc.swift │ │ │ ├── SettingsView+SizeDisc.swift │ │ │ ├── SettingsViewModel+Constants.swift │ │ │ ├── SettingsViewModel+Convo.swift │ │ │ ├── SettingsViewModel+Model.swift │ │ │ ├── SettingsViewModel+SystemPrompt.swift │ │ │ ├── SettingsViewModel+Websocket.swift │ │ │ ├── SettingsViewModel.swift │ │ │ └── plistHelper.swift │ │ ├── SphereScreenEntity+Configuration.swift │ │ ├── SphereScreenEntity.swift │ │ ├── SphereScreenSceneView.swift │ │ ├── SphereScreenView.swift │ │ ├── SupportedFileType.swift │ │ ├── ToggleImmersion.swift │ │ ├── ToggleImmersiveLogo.swift │ │ ├── TopBar.swift │ │ ├── WindowList.swift │ │ ├── WindowView.swift │ │ └── WorkingChangesList.swift │ └── v2 │ │ ├── MovableDivider.swift │ │ ├── Project.swift │ │ ├── ProjectDocumentPicker.swift │ │ ├── ProjectHierarchyView.swift │ │ └── ProjectView.swift ├── LogicSageTests │ ├── SettingsViewModelTests.swift │ └── SwiftSageiOSTests.swift ├── LogicSageUITests │ └── SwiftSageiOSUITests.swift ├── MacPlugin │ ├── LogicSageMacPlugin-Bridging-Header.h │ ├── MacPlugin.h │ ├── MacPlugin.m │ └── Plugin.h ├── OpenAI │ ├── LICENSE │ ├── OpenAI.swift │ ├── Private │ │ ├── JSONRequest.swift │ │ ├── MultipartFormDataBodyBuilder.swift │ │ ├── MultipartFormDataBodyEncodable.swift │ │ ├── MultipartFormDataEntry.swift │ │ ├── MultipartFormDataRequest.swift │ │ ├── StreamingSession.swift │ │ ├── URLRequestBuildable.swift │ │ ├── URLSessionDataTaskProtocol.swift │ │ └── URLSessionProtocol.swift │ └── Public │ │ ├── Errors │ │ └── APIError.swift │ │ ├── Models │ │ ├── AssistantsQuery.swift │ │ ├── AssistantsResult.swift │ │ ├── AudioSpeechQuery.swift │ │ ├── AudioSpeechResult.swift │ │ ├── AudioTranscriptionQuery.swift │ │ ├── AudioTranscriptionResult.swift │ │ ├── AudioTranslationQuery.swift │ │ ├── AudioTranslationResult.swift │ │ ├── ChatQuery.swift │ │ ├── ChatResult.swift │ │ ├── ChatStreamResult.swift │ │ ├── CompletionsQuery.swift │ │ ├── CompletionsResult.swift │ │ ├── EditsQuery.swift │ │ ├── EditsResult.swift │ │ ├── EmbeddingsQuery.swift │ │ ├── EmbeddingsResult.swift │ │ ├── FilesQuery.swift │ │ ├── FilesResult.swift │ │ ├── ImageEditsQuery.swift │ │ ├── ImageVariationsQuery.swift │ │ ├── ImagesQuery.swift │ │ ├── ImagesResult.swift │ │ ├── Models │ │ │ ├── ModelQuery.swift │ │ │ ├── ModelResult.swift │ │ │ ├── Models.swift │ │ │ └── ModelsResult.swift │ │ ├── ModerationsQuery.swift │ │ ├── ModerationsResult.swift │ │ ├── RunRetrieveQuery.swift │ │ ├── RunRetrieveResult.swift │ │ ├── RunRetrieveStepsResult.swift │ │ ├── RunsQuery.swift │ │ ├── RunsResult.swift │ │ ├── StreamableQuery.swift │ │ ├── ThreadAddMessageQuery.swift │ │ ├── ThreadAddMessagesResult.swift │ │ ├── ThreadsMessagesResult.swift │ │ ├── ThreadsQuery.swift │ │ └── ThreadsResult.swift │ │ ├── Protocols │ │ ├── OpenAIProtocol+Async.swift │ │ ├── OpenAIProtocol+Combine.swift │ │ └── OpenAIProtocol.swift │ │ └── Utilities │ │ └── Utilities.swift ├── Sourceful │ ├── LICENSE │ ├── Languages │ │ ├── JavaLexer.swift │ │ ├── JavaScriptLexer.swift │ │ ├── OCamlLexer.swift │ │ ├── Python3Lexer.swift │ │ └── SwiftLexer.swift │ ├── Model │ │ ├── Lexer.swift │ │ ├── Paragraph.swift │ │ ├── RegexLexer.swift │ │ ├── SyntaxColorTheme.swift │ │ └── Token.swift │ ├── SourceCodeRegexLexer.swift │ ├── SourceCodeTheme.swift │ ├── SourceCodeToken.swift │ ├── Starscream │ │ ├── Compression │ │ │ ├── Compression.swift │ │ │ └── WSCompression.swift │ │ ├── DataBytes │ │ │ └── Data+Extensions.swift │ │ ├── Engine │ │ │ ├── Engine.swift │ │ │ ├── NativeEngine.swift │ │ │ └── WSEngine.swift │ │ ├── Framer │ │ │ ├── FoundationHTTPHandler.swift │ │ │ ├── FoundationHTTPServerHandler.swift │ │ │ ├── FrameCollector.swift │ │ │ ├── Framer.swift │ │ │ ├── HTTPHandler.swift │ │ │ └── StringHTTPHandler.swift │ │ ├── LICENSE │ │ ├── Security │ │ │ ├── FoundationSecurity.swift │ │ │ └── Security.swift │ │ ├── Server │ │ │ ├── Server.swift │ │ │ └── WebSocketServer.swift │ │ ├── Starscream.h │ │ ├── Starscream │ │ │ └── WebSocket.swift │ │ └── Transport │ │ │ ├── FoundationTransport.swift │ │ │ ├── TCPTransport.swift │ │ │ └── Transport.swift │ ├── SwiftUI │ │ └── SourceCodeTextEditor.swift │ ├── Themes │ │ ├── ChatSourceCodeTheme.swift │ │ └── DefaultSourceCodeTheme.swift │ ├── Util │ │ ├── NSMutableAttributedString+Tokens.swift │ │ ├── NSTextView+UIKit.swift │ │ ├── String+Range.swift │ │ └── Types.swift │ └── View │ │ ├── InnerTextView.swift │ │ ├── LineNumberLayoutManager.swift │ │ ├── Paragraphs.swift │ │ ├── ShapeView.swift │ │ ├── SyntaxTextView+NonMacOS.swift │ │ ├── SyntaxTextView+TextViewDelegate.swift │ │ ├── SyntaxTextView.swift │ │ ├── SyntaxTextViewLayoutManager.swift │ │ ├── TextViewWrapperView.swift │ │ └── ViewController+PointerInteraction.swift ├── Tiktoken │ ├── CoreBPE.swift │ ├── Encoding.swift │ ├── Extensions │ │ ├── Array+PrevCurrent.swift │ │ ├── Character+Int.swift │ │ ├── String+Base64.swift │ │ ├── String+Substring.swift │ │ └── String+UInt8.swift │ ├── FileDecoder.swift │ ├── Load.swift │ ├── Ranks.swift │ ├── TikiModel.swift │ ├── Tiktoken.swift │ └── Vocab.swift └── ZIPFoundation │ ├── Archive+BackingConfiguration.swift │ ├── Archive+Helpers.swift │ ├── Archive+MemoryFile.swift │ ├── Archive+Progress.swift │ ├── Archive+Reading.swift │ ├── Archive+ReadingDeprecated.swift │ ├── Archive+Writing.swift │ ├── Archive+WritingDeprecated.swift │ ├── Archive+ZIP64.swift │ ├── Archive.swift │ ├── Data+Compression.swift │ ├── Data+CompressionDeprecated.swift │ ├── Data+Serialization.swift │ ├── Entry+Serialization.swift │ ├── Entry+ZIP64.swift │ ├── Entry.swift │ ├── FileManager+ZIP.swift │ └── URL+ZIP.swift ├── LogicSageCommandLine.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── LogicSageCommandLine.xcscheme ├── LogicSageCommandLine.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── swiftpm │ └── Package.resolved ├── LogicSageForMacOS.png ├── MacSageApp ├── Info.plist ├── MacSageApp.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ ├── MacSageApp.xcscheme │ │ └── SwiftSageStatusBar.xcscheme ├── MacSageApp │ ├── Assets.xcassets │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── ContentView.swift │ ├── MacSageApp.entitlements │ └── MacSageAppApp.swift └── SwiftSageStatusBar │ └── main.swift ├── README.MD ├── README_OLD.md ├── README_OLDER.md ├── SimulatorScreenshot-AppleVisionPro-2.png ├── SimulatorScreenshot-AppleVisionPro.png ├── SwiftSageServer ├── .swiftpm │ └── xcode │ │ └── package.xcworkspace │ │ └── contents.xcworkspacedata ├── Dockerfile ├── Package.resolved ├── Package.swift ├── Sources │ └── App │ │ ├── GPT-Info.plist │ │ ├── configure.swift │ │ ├── entrypoint.swift │ │ ├── plistHelper.swift │ │ └── routes.swift ├── Tests │ └── AppTests │ │ └── AppTests.swift └── docker-compose.yml ├── Swifty-GPT-App.swiftpm ├── .swiftpm │ ├── playgrounds │ │ ├── DocumentThumbnail.plist │ │ └── DocumentThumbnail.png │ └── xcode │ │ ├── package.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── sprinchar.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ └── xcuserdata │ │ └── sprinchar.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── Assets.xcassets │ ├── Contents.json │ └── xcode_trans.imageset │ │ ├── Contents.json │ │ └── xcode_trans.png ├── ContentView.swift ├── MyApp.swift ├── Package.swift └── Robot.swift ├── Swifty-GPT ├── AEyes.swift ├── AssisAI.swift ├── Audio │ ├── AVVoice.swift │ ├── AudioProcessor.swift │ ├── LibWhisper.swift │ ├── SWWrapper.swift │ └── Speak.swift ├── AudioController.swift ├── Command │ ├── ApplescriptCommand.swift │ ├── Command.swift │ ├── CommandTable.swift │ ├── Debate.swift │ ├── DebatePrompts.swift │ ├── Googler.swift │ ├── ImageAssetCommands.swift │ ├── Input.swift │ ├── Linker.swift │ ├── LocalPeerConsole.swift │ ├── LogicWebsocketClient.swift │ ├── Multiprinter.swift │ ├── Project.swift │ ├── Reset.swift │ ├── WorkspaceCommands.swift │ ├── XcodeCommand+XcodeBuild.swift │ ├── XcodeCommand+Xcrun.swift │ ├── XcodeCommand.swift │ ├── XcodeProjHandler.swift │ └── Xcodegen.swift ├── Config.swift ├── Eggland.swift ├── GPT-Info.plist ├── GPT.swift ├── IdeaText ├── Info.plist ├── InputText ├── Movies.swift ├── Package.swift ├── Prompt.swift ├── PromptLibrary.swift ├── Reminders.swift ├── SageWare.swift ├── Screencapture │ ├── PixelScan.swift │ └── ScreenCaptureKitWrapper.swift ├── Spotify.swift ├── StarTrekSimuilator.swift ├── Stocks.swift ├── SwiftSageStatusBar ├── SwiftSageStatusBar.dSYM │ └── Contents │ │ ├── Info.plist │ │ └── Resources │ │ ├── DWARF │ │ └── SwiftSageStatusBar │ │ └── Relocations │ │ ├── aarch64 │ │ └── SwiftSageStatusBar.yml │ │ └── x86_64 │ │ └── SwiftSageStatusBar.yml ├── SwiftSageStatusBar.swiftmodule │ ├── Project │ │ ├── arm64-apple-macos.swiftsourceinfo │ │ └── x86_64-apple-macos.swiftsourceinfo │ ├── arm64-apple-macos.abi.json │ ├── arm64-apple-macos.swiftdoc │ ├── arm64-apple-macos.swiftmodule │ ├── x86_64-apple-macos.abi.json │ ├── x86_64-apple-macos.swiftdoc │ └── x86_64-apple-macos.swiftmodule ├── SwiftSageStatusBarXFace.swift ├── Swifty-GPT-App.swiftpm │ ├── .swiftpm │ │ └── playgrounds │ │ │ ├── CachedManifest.plist │ │ │ ├── DocumentThumbnail.plist │ │ │ ├── DocumentThumbnail.png │ │ │ └── Workspace.plist │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── xcode_trans.imageset │ │ │ ├── Contents.json │ │ │ └── xcode_trans.png │ ├── ContentView.swift │ ├── MyApp.swift │ ├── Package.swift │ └── Robot.swift ├── Swifty-GPT-Bridging-Header.h ├── Swifty-GPT.entitlements ├── Trivia.swift ├── Utilities │ ├── AsciiAnimator.swift │ ├── AsciiText.swift │ ├── Files.swift │ ├── Loding.swift │ ├── Regex.swift │ ├── SpinnerThread.swift │ ├── SrcCat.swift │ ├── StringSLug.swift │ ├── SwiftyGPTUtilities.swift │ ├── Terminal.swift │ ├── Text.swift │ └── plistHelper.swift ├── WrapSoup.swift ├── add_file_to_project.rb ├── app_screenshot.applescript ├── assets │ ├── Debate.png │ ├── IMG_5563.PNG │ ├── IMG_5564.png │ ├── IMG_5565.png │ ├── IMG_5566.png │ ├── MicAccess.png │ ├── Shiwfty_iPad2.png │ ├── SwiftSageiOSforMac.png │ ├── Swifty-Combine.png │ ├── Swifty-Logo.png │ ├── Swifty-iOSx.png │ ├── alien.PNG │ ├── command.png │ ├── iOSsws1.PNG │ ├── iOSsws2.PNG │ ├── iOSsws3.PNG │ ├── instruct.png │ ├── logo.png │ ├── modez.png │ ├── sage.PNG │ ├── sage2.PNG │ ├── swifty-diagram.png │ ├── swifty-ios-2.png │ ├── swifty-ios-3.png │ ├── swifty-ios-4.png │ ├── swifty-ios-5.png │ ├── swifty-ios.png │ ├── swifty.png │ ├── swslogostack.png │ └── waveApp.png ├── exampleOutput │ ├── CommonErrors.txt │ ├── Gitstar │ ├── createAppWithLibary_output.txt │ ├── dots_boxes_prompt.txt │ ├── example_mandlebrot_output.txt │ ├── example_output.txt │ ├── lsystem_output │ ├── periodTableOfElements_output.txt │ └── physicsSceneOutput.txt ├── ggml.c ├── ggml.h ├── main.swift ├── objective-c-quiz.md ├── swift-quiz.md ├── voice_test.swift ├── whisper.MYFILE.cpp └── whisper.h ├── copy_wallpaper.sh ├── news_archive.md ├── privacy-policy.md └── run.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | Swifty-GPT/ggml.c linguist-vendored 2 | Swifty-GPT/ggml.h linguist-vendored 3 | Swifty-GPT/whisper.h linguist-vendored 4 | Swifty-GPT/whisper.MYFILE.cpp linguist-vendored -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Swifty-GPT/model/ggml-large.bin 2 | Swifty-GPT/model/ggml-medium.en.bin 3 | Swifty-GPT/model/ggml-large-v1.bin 4 | Swifty-GPT/model/ggml-base.en.bin 5 | Swifty-GPT/model/ggml-small.en.bin 6 | Swifty-GPT/Model/tessdata_fast-main 7 | WebSocketServer/.build 8 | Swifty-GPT/assets/.DS_Store 9 | .DS_Store 10 | Swifty-GPT.xcworkspace/xcuserdata 11 | SwiftSageiOS/SwiftSageiOS.xcodeproj/xcuserdata 12 | SwiftSageiOS/SwiftSageiOS.xcodeproj/project.xcworkspace/xcuserdata 13 | Swifty-GPT.xcodeproj/xcuserdata 14 | dd 15 | SwiftSageServer/.build 16 | LogicSage/LogicSage.xcodeproj/project.xcworkspace/xcuserdata 17 | LogicSage/LogicSage.xcodeproj/xcuserdata 18 | LogicSageCommandLine.xcodeproj/project.xcworkspace/xcuserdata 19 | LogicSageCommandLine.xcodeproj/xcuserdata 20 | build 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Chris Dillard LogicSage 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LOGICSAGE_ScreenShot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LOGICSAGE_ScreenShot.png -------------------------------------------------------------------------------- /LogicSage.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DocumentThumbnailConfiguration 6 | 7 | accentColorHash 8 | 9 | ukeIsiaqjcLm3HQki7n2GM+oyVngwmwUe+SPaDmgsIg= 10 | 11 | appIconHash 12 | 13 | LIGzk9mzNNtkZyxFfYFT7AP8OJdvTh3+veRf1Pc9k/8= 14 | 15 | thumbnailIsPrerendered 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /LogicSage.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.png -------------------------------------------------------------------------------- /LogicSage.swiftpm/.swiftpm/playgrounds/Workspace.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AppSettings 6 | 7 | appIconPlaceholderGlyphName 8 | magic-wand 9 | appSettingsVersion 10 | 1 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /LogicSage.swiftpm/ContentView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | struct ContentView: View { 4 | var body: some View { 5 | VStack { 6 | Image(systemName: "figure.play") 7 | .imageScale(.large) 8 | .foregroundColor(.accentColor) 9 | Text("Hello, LogicSage Playground Template!") 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LogicSage.swiftpm/MyApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | @main 4 | struct MyApp: App { 5 | var body: some Scene { 6 | WindowGroup { 7 | ContentView() 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /LogicSage.swiftpm/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.8 2 | 3 | // WARNING: 4 | // This file is automatically generated. 5 | // Do not edit it by hand because the contents will be replaced. 6 | 7 | import PackageDescription 8 | import AppleProductTypes 9 | 10 | let package = Package( 11 | name: "LogicSage", 12 | platforms: [ 13 | .iOS("16.0") 14 | ], 15 | products: [ 16 | .iOSApplication( 17 | name: "LogicSage", 18 | targets: ["AppModule"], 19 | displayVersion: "1.0", 20 | bundleVersion: "1", 21 | appIcon: .placeholder(icon: .magicWand), 22 | accentColor: .presetColor(.green), 23 | supportedDeviceFamilies: [ 24 | .pad, 25 | .phone 26 | ], 27 | supportedInterfaceOrientations: [ 28 | .portrait, 29 | .landscapeRight, 30 | .landscapeLeft, 31 | .portraitUpsideDown(.when(deviceFamilies: [.pad])) 32 | ] 33 | ) 34 | ], 35 | targets: [ 36 | .executableTarget( 37 | name: "AppModule", 38 | path: ".", 39 | swiftSettings: [ 40 | .enableUpcomingFeature("BareSlashRegexLiterals") 41 | ] 42 | ) 43 | ] 44 | ) 45 | -------------------------------------------------------------------------------- /LogicSage/CZLib/module.modulemap: -------------------------------------------------------------------------------- 1 | // 2 | // module.modulemap 3 | // ZIPFoundation 4 | // 5 | // Copyright © 2017-2021 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors. 6 | // Released under the MIT License. 7 | // 8 | // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information. 9 | // 10 | 11 | module CZlib { 12 | header "shim.h" 13 | link "z" 14 | export * 15 | } -------------------------------------------------------------------------------- /LogicSage/CZLib/shim.h: -------------------------------------------------------------------------------- 1 | // 2 | // shim.h 3 | // ZIPFoundation 4 | // 5 | // Copyright © 2017-2021 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors. 6 | // Released under the MIT License. 7 | // 8 | // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information. 9 | // 10 | 11 | #ifndef zlib_shim_h 12 | #define zlib_shim_h 13 | 14 | #import 15 | #import 16 | 17 | // [zlib] provide 64-bit offset functions if _LARGEFILE64_SOURCE defined 18 | #ifndef _LARGEFILE64_SOURCE 19 | # define _LARGEFILE64_SOURCE 1 20 | #endif 21 | // [zlib] change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 22 | #ifndef _FILE_OFFSET_BITS 23 | # define _FILE_OFFSET_BITS 64 24 | #endif 25 | // [zlib] on systems without large file support, _LFS64_LARGEFILE must also be true 26 | #ifndef _LFS64_LARGEFILE 27 | # define _LFS64_LARGEFILE 1 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /LogicSage/LogicSage.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LogicSage/LogicSage.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LogicSage/LogicSage.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "swiftsoup", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/scinfu/SwiftSoup.git", 7 | "state" : { 8 | "branch" : "master", 9 | "revision" : "8b6cf29eead8841a1fa7822481cb3af4ddaadba6" 10 | } 11 | } 12 | ], 13 | "version" : 2 14 | } 15 | -------------------------------------------------------------------------------- /LogicSage/LogicSage.xctestplan: -------------------------------------------------------------------------------- 1 | { 2 | "configurations" : [ 3 | { 4 | "id" : "18816ED2-A89E-43C7-8595-0936DE94CD94", 5 | "name" : "Test Scheme Action", 6 | "options" : { 7 | 8 | } 9 | } 10 | ], 11 | "defaultOptions" : { 12 | "targetForVariableExpansion" : { 13 | "containerPath" : "container:LogicSage.xcodeproj", 14 | "identifier" : "B746DFC929F5E789002804EB", 15 | "name" : "LogicSage" 16 | } 17 | }, 18 | "testTargets" : [ 19 | { 20 | "parallelizable" : true, 21 | "target" : { 22 | "containerPath" : "container:LogicSage.xcodeproj", 23 | "identifier" : "B78EAF7D2A13B7D4003095A2", 24 | "name" : "LogicSageTests" 25 | } 26 | }, 27 | { 28 | "parallelizable" : true, 29 | "target" : { 30 | "containerPath" : "container:LogicSage.xcodeproj", 31 | "identifier" : "B78EAF8C2A13B955003095A2", 32 | "name" : "LogicSageUITests" 33 | } 34 | } 35 | ], 36 | "version" : 1 37 | } 38 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/AppModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppModel.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/11/23. 6 | // 7 | 8 | import SwiftUI 9 | 10 | class AppModel: ObservableObject { 11 | #if os(visionOS) 12 | var screen: SphereScreenEntity.Configuration = .screenDefault 13 | #endif 14 | @Published var isTranslating: Bool = true { 15 | didSet { 16 | if isTranslating { 17 | isRotating = false 18 | } 19 | } 20 | } 21 | @Published var isRotating: Bool = false { 22 | didSet { 23 | if isRotating { 24 | isTranslating = false 25 | } 26 | } 27 | } 28 | 29 | @Published var isShowingImmersiveWindow: Bool = false 30 | @Published var isShowingImmersiveScene: Bool = false 31 | @Published var isShowingImmersiveLogo: Bool = false 32 | 33 | @AppStorage("savedSphereX") var savedSphereX: Double = -1000.0 34 | @AppStorage("savedSphereY") var savedSphereY: Double = -2000.0 35 | @AppStorage("savedSphereZ") var savedSphereZ: Double = -2000.0 36 | @AppStorage("savedSphereScale") var savedSphereScale: Double = 1.0 37 | 38 | @AppStorage("savedSphereYaw") var savedSphereYaw: Double = 0.0 39 | @AppStorage("savedSphereBaseYaw") var savedSphereBaseYaw: Double = 0.0 40 | 41 | @AppStorage("savedSpherePitch") var savedSpherePitch: Double = 0.0 42 | @AppStorage("savedSphereBasePitch") var savedSphereBasePitch: Double = 0.0 43 | 44 | /// Resets game state information. 45 | func reset() { 46 | 47 | } 48 | 49 | /// Preload assets when the app launches to avoid pop-in during the game. 50 | init() { 51 | Task { @MainActor in 52 | 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 1.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 10.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 11.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 12.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 2.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 3.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 5.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 6.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n copy 8.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIcon.appiconset/SwiftSageDev1024n.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 1.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 11.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 13.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 15.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 17.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 3.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 5.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 7.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n copy 9.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/AppIconDev.appiconset/SwiftSageDev1024n.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "1024.png", 5 | "idiom" : "reality", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | }, 6 | "layers" : [ 7 | { 8 | "filename" : "Front.solidimagestacklayer" 9 | }, 10 | { 11 | "filename" : "Middle.solidimagestacklayer" 12 | }, 13 | { 14 | "filename" : "Back.solidimagestacklayer" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "1024.png", 5 | "idiom" : "reality", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "1024.png", 5 | "idiom" : "reality", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "SwiftSageDev1024.png", 5 | "idiom" : "reality", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Back.solidimagestacklayer/Content.imageset/SwiftSageDev1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Back.solidimagestacklayer/Content.imageset/SwiftSageDev1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Back.solidimagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | }, 6 | "layers" : [ 7 | { 8 | "filename" : "Front.solidimagestacklayer" 9 | }, 10 | { 11 | "filename" : "Middle.solidimagestacklayer" 12 | }, 13 | { 14 | "filename" : "Back.solidimagestacklayer" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "SwiftSageDev1024.png", 5 | "idiom" : "reality", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Front.solidimagestacklayer/Content.imageset/SwiftSageDev1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Front.solidimagestacklayer/Content.imageset/SwiftSageDev1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Front.solidimagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "SwiftSageDev1024.png", 5 | "idiom" : "reality", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Middle.solidimagestacklayer/Content.imageset/SwiftSageDev1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Middle.solidimagestacklayer/Content.imageset/SwiftSageDev1024.png -------------------------------------------------------------------------------- /LogicSage/LogicSage/Assets.xcassets/VAppIconDev.solidimagestack/Middle.solidimagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Backend.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Backend.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/12/23. 6 | // 7 | 8 | import SwiftUI 9 | 10 | class Backend { 11 | static func doBackend(path: String) { 12 | #if targetEnvironment(macCatalyst) 13 | // The LogicSage for Mac app handles starting the server and MacOS Binary. 14 | Task { 15 | PluginLoader.loadPlugin(path: path) 16 | } 17 | #endif 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Command/WrapSoup.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WrapSoup.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/20/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftSoup 10 | 11 | func extractText(from html: String) throws -> String { 12 | let document = try SwiftSoup.parse(html) 13 | return try String(document.text().prefix(10000)) 14 | } 15 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/GPT-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SWIFTSAGE_USERNAME 6 | 7 | SWIFTSAGE_SERVER_USERNAME 8 | 9 | SWIFTSAGE_SERVER_PASSWORD 10 | 11 | SWIFTSAGE_PASSWORD 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BGTaskSchedulerPermittedIdentifiers 6 | 7 | com.chrisdillard.SwiftSageDevbger 8 | com.chrisdillard.SwiftSagebger 9 | 10 | CFBundleDocumentTypes 11 | 12 | 13 | CFBundleTypeName 14 | LogicSage 15 | CFBundleTypeRole 16 | Editor 17 | LSHandlerRank 18 | Default 19 | LSItemContentTypes 20 | 21 | LogicSage 22 | 23 | 24 | 25 | NSAllowsArbitraryLoads 26 | 27 | NSAllowsLocalNetworking 28 | 29 | NSBonjourServices 30 | 31 | _sagess._tcp 32 | 33 | UIAppSupportsHDR 34 | 35 | UIApplicationSceneManifest 36 | 37 | UIApplicationSupportsMultipleScenes 38 | 39 | UIApplicationSupportsTabbedSceneCollection 40 | 41 | UISceneConfigurations 42 | 43 | UIWindowSceneSessionRoleApplication 44 | 45 | 46 | UISceneDelegateClassName 47 | LogicSage.LogicSageSceneDelegate 48 | 49 | 50 | 51 | 52 | UIBackgroundModes 53 | 54 | fetch 55 | processing 56 | remote-notification 57 | 58 | UIFileSharingEnabled 59 | 60 | UISupportsDocumentBrowser 61 | 62 | LSSupportsOpeningDocumentsInPlace 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Loading/Loading.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Loading.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/3/23. 6 | // 7 | 8 | import Foundation 9 | 10 | var termColSize = 5 11 | var spinner: LoadingSpinner = LoadingSpinner(columnCount: termColSize, spinDex: 0) 12 | let animator = TextAnimator(text: loadingText) 13 | 14 | var spinnerInt: Int = 1 15 | func startRandomSpinner() { 16 | 17 | spinnerInt = Int.random(in: 0...1) 18 | if spinnerInt == 0 && asciAnimations() { 19 | animator.start() 20 | 21 | } 22 | else { 23 | spinner.start() 24 | } 25 | } 26 | 27 | func stopRandomSpinner() { 28 | spinner.stop() 29 | 30 | if asciAnimations() { animator.stop() } 31 | } 32 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/LogicSageSceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LogicSageSceneDelegate.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 6/24/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | #if !os(macOS) 12 | class LogicSageSceneDelegate: NSObject, UIWindowSceneDelegate { 13 | func sceneWillEnterForeground(_ scene: UIScene) { 14 | logD("sceneWillEnterForeground") 15 | } 16 | func sceneDidBecomeActive(_ scene: UIScene) { 17 | logD("sceneDidBecomeActive") 18 | } 19 | func sceneWillResignActive(_ scene: UIScene) { 20 | logD("sceneWillResignActive") 21 | } 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/LogicSageTogether.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import GroupActivities 3 | 4 | struct LogicSageTogether: GroupActivity { 5 | var metadata: GroupActivityMetadata { 6 | var metadata = GroupActivityMetadata() 7 | metadata.title = NSLocalizedString("LogicSage", comment: "Code & Chat with AI Together.") 8 | metadata.type = .generic 9 | return metadata 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/LogicSageiOSApp+UserDefaults.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LogicSageiOSApp+UserDefaults.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/1/23. 6 | // 7 | 8 | import Foundation 9 | 10 | func setHasSeenInstructions(_ hasSeen: Bool) { 11 | UserDefaults.standard.set(hasSeen, forKey: "hasSeenInstructions") 12 | } 13 | func hasSeenInstructions() -> Bool { 14 | #if os(tvOS) 15 | return true 16 | #else 17 | return UserDefaults.standard.bool(forKey: "hasSeenInstructions") 18 | #endif 19 | } 20 | func setHasSeenLogo(_ hasSeen: Bool) { 21 | UserDefaults.standard.set(hasSeen, forKey: "hasSeenLogo") 22 | } 23 | func hasSeenLogo() -> Bool { 24 | return UserDefaults.standard.bool(forKey: "hasSeenLogo") 25 | } 26 | func hasSeenAnim() -> Bool { 27 | return UserDefaults.standard.bool(forKey: "hasSeenAnim") 28 | } 29 | func setHasSeenAnim(_ hasSeen: Bool) { 30 | UserDefaults.standard.set(hasSeen, forKey: "hasSeenAnim") 31 | } 32 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/MacPluginLoader.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MacPluginLoader.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/31/23. 6 | // 7 | 8 | import Foundation 9 | 10 | class PluginLoader { 11 | static func loadPlugin(path: String) { 12 | let bundleFileName = "LogicSageMacPlugin.bundle" 13 | guard let bundleURL = Bundle.main.builtInPlugInsURL? 14 | .appendingPathComponent(bundleFileName) else { return } 15 | guard let bundle = Bundle(url: bundleURL) else { return } 16 | guard let catalystBundle = bundle.principalClass as? NSObject.Type else { return } 17 | 18 | guard let delegate = catalystBundle.init() as? Plugin else { return } 19 | DispatchQueue.global(qos: .default).async { 20 | let scriptPath = "\(path)run.sh" 21 | delegate.runLogicSage(scriptPath) 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/SwiftSageiOS.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aps-environment 6 | development 7 | com.apple.developer.aps-environment 8 | development 9 | com.apple.security.app-sandbox 10 | 11 | com.apple.security.automation.apple-events 12 | 13 | com.apple.security.cs.debugger 14 | 15 | com.apple.security.files.user-selected.read-write 16 | 17 | com.apple.security.files.bookmarks.app-scope 18 | 19 | com.apple.security.network.client 20 | 21 | com.apple.security.network.server 22 | 23 | com.apple.developer.group-session 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Utilities/BGHandler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BGHandler.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/1/23. 6 | // 7 | 8 | import Foundation 9 | import BackgroundTasks 10 | 11 | func scheduleWebSocketRefresh() { 12 | 13 | #if !os(macOS) 14 | 15 | let request = BGAppRefreshTaskRequest(identifier: "\(bundleID)bger") 16 | request.earliestBeginDate = Date(timeIntervalSinceNow: 60 * 2) 17 | 18 | do { 19 | try BGTaskScheduler.shared.submit(request) 20 | } catch { 21 | logD("Could not schedule WebSocket refresh task: \(error)") 22 | } 23 | 24 | #endif 25 | 26 | } 27 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Utilities/Color+Base64.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Color+Base64.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/15/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | #if !os(macOS) 12 | import UIKit 13 | 14 | extension Color: RawRepresentable { 15 | public init?(rawValue: String) { 16 | 17 | guard let data = Data(base64Encoded: rawValue) else{ 18 | self = .black 19 | return 20 | } 21 | 22 | do{ 23 | let color = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? UIColor ?? .black 24 | self = Color(color) 25 | } catch{ 26 | self = .black 27 | } 28 | } 29 | 30 | public var rawValue: String { 31 | do{ 32 | let data = try NSKeyedArchiver.archivedData(withRootObject: UIColor(self), requiringSecureCoding: false) as Data 33 | return data.base64EncodedString() 34 | 35 | }catch{ 36 | 37 | return "" 38 | 39 | } 40 | } 41 | } 42 | extension Color { 43 | init(hex: UInt, alpha: Double = 1) { 44 | self.init( 45 | .sRGB, 46 | red: Double((hex >> 16) & 0xff) / 255, 47 | green: Double((hex >> 08) & 0xff) / 255, 48 | blue: Double((hex >> 00) & 0xff) / 255, 49 | opacity: alpha 50 | ) 51 | } 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Utilities/KeyboardResponder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KeyboardResponder.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/11/23. 6 | // 7 | 8 | import SwiftUI 9 | import Combine 10 | #if !os(tvOS) 11 | class KeyboardResponder: ObservableObject { 12 | @Published var currentHeight: CGFloat = 0 13 | var keyboardShow: AnyCancellable? 14 | var keyboardHide: AnyCancellable? 15 | 16 | init() { 17 | keyboardShow = NotificationCenter.default.publisher(for: UIResponder.keyboardWillShowNotification) 18 | .map { $0.keyboardHeight } 19 | .assign(to: \.currentHeight, on: self) 20 | 21 | keyboardHide = NotificationCenter.default.publisher(for: UIResponder.keyboardWillHideNotification) 22 | .map { _ in CGFloat(0) } 23 | .assign(to: \.currentHeight, on: self) 24 | } 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Utilities/UIColorExt.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColorExt.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 4/26/23. 6 | // 7 | #if !os(macOS) 8 | 9 | import Foundation 10 | import SwiftUI 11 | import UIKit 12 | 13 | extension UIColor { 14 | convenience init(_ color: Color) { 15 | let uiColor = color.uiColor() 16 | self.init(cgColor: uiColor.cgColor) 17 | } 18 | } 19 | 20 | extension Color { 21 | func uiColor() -> UIColor { 22 | let components = self.cgColor?.components.map { $0 } 23 | let colorSpace = self.cgColor?.colorSpace?.model 24 | 25 | if let components = components, let colorSpace = colorSpace { 26 | switch colorSpace { 27 | case .monochrome: 28 | return UIColor(white: components[0], alpha: components[1]) 29 | case .rgb: 30 | return UIColor(red: components[0], green: components[1], blue: components[2], alpha: components[3]) 31 | default: 32 | return UIColor(cgColor: self.cgColor ?? UIColor.black.cgColor) 33 | } 34 | } 35 | return UIColor(cgColor: self.cgColor ?? UIColor.black.cgColor) 36 | } 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Utilities/View+If.swift: -------------------------------------------------------------------------------- 1 | // 2 | // View+If.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 6/24/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | extension View { 12 | /// Applies the given transform if the given condition evaluates to `true`. 13 | /// - Parameters: 14 | /// - condition: The condition to evaluate. 15 | /// - transform: The transform to apply to the source `View`. 16 | /// - Returns: Either the original `View` or the modified `View` if the condition is `true`. 17 | @ViewBuilder func `if`(_ condition: Bool, transform: (Self) -> Content) -> some View { 18 | if condition { 19 | transform(self) 20 | } else { 21 | self 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/Utilities/View+Keyboard.swift: -------------------------------------------------------------------------------- 1 | // 2 | // View+Keyboard.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/10/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | #if canImport(UIKit) 12 | extension View { 13 | func hideKeyboard() { 14 | UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) 15 | } 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/AnimatedArrow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatedArrow.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 6/25/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | struct AnimatedArrow: View { 12 | @State private var animate = false 13 | 14 | var body: some View { 15 | GeometryReader { geometry in 16 | Path { path in 17 | let size = geometry.size.height * 0.2266 18 | let yPosition = size * 0.8 19 | path.move(to: CGPoint(x: geometry.size.width * 0.5, y: yPosition)) 20 | path.addLine(to: CGPoint(x: geometry.size.width * 0.5 - size * 0.5, y: yPosition + size)) 21 | path.addLine(to: CGPoint(x: geometry.size.width * 0.5 + size * 0.5, y: yPosition + size)) 22 | } 23 | .fill(Color.gray) 24 | .opacity(self.animate ? 0.4 : 0.0) 25 | .animation(Animation.easeInOut(duration: 1.2).repeatForever(autoreverses: true).delay(1.0)) 26 | .rotationEffect(.degrees(180), anchor: .center) 27 | .onAppear { 28 | self.animate = true 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/ChangeList.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WindowList.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/7/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | 12 | struct ChangeList: View { 13 | @Binding var showAddView: Bool 14 | @ObservedObject var sageMultiViewModel: SageMultiViewModel 15 | @ObservedObject var settingsViewModel: SettingsViewModel 16 | 17 | var body: some View { 18 | // if !changes.isEmpty { 19 | List { 20 | ForEach(settingsViewModel.changes) { change in 21 | HStack(alignment: .top) { 22 | VStack(alignment: .leading, spacing: 4) { 23 | Text("- \(change.oldLine ?? "")") 24 | .font(.system(size: settingsViewModel.fontSizeSrcEditor)) 25 | .foregroundColor(.red) 26 | Text("+ \(change.newLine ?? "")") 27 | .font(.system(size: settingsViewModel.fontSizeSrcEditor)) 28 | .foregroundColor(.green) 29 | } 30 | Spacer() 31 | } 32 | .padding(.vertical, 4) 33 | } 34 | } 35 | .listRowBackground(settingsViewModel.backgroundColor) 36 | .frame(maxWidth: .infinity, maxHeight: .infinity) 37 | .onAppear 38 | { 39 | logD("Change list wit count = \(settingsViewModel.changes)") 40 | 41 | } 42 | // } 43 | // else { 44 | // Text("Have changes and they will appear here...") 45 | // .frame(height: 30.0) 46 | // .foregroundColor(SettingsViewModel.shared.appTextColor) 47 | // } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/CheckmarkView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CheckmarkView.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 6/25/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | struct CheckmarkView: View { 12 | var text: String 13 | @Binding var isVisible: Bool 14 | 15 | var body: some View { 16 | if isVisible { 17 | HStack(spacing: 10) { 18 | Image(systemName: "checkmark") 19 | Text("\(text)!") 20 | } 21 | .font(.system(size: 20, design: .monospaced)) 22 | .background(SettingsViewModel.shared.buttonColor) 23 | .cornerRadius(8) 24 | .foregroundColor(SettingsViewModel.shared.appTextColor) 25 | .padding() 26 | .transition(.opacity) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/DateProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IDProvider.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/24/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | private struct DateProviderKey: EnvironmentKey { 12 | static let defaultValue: () -> Date = Date.init 13 | } 14 | 15 | extension EnvironmentValues { 16 | public var dateProviderValue: () -> Date { 17 | get { self[DateProviderKey.self] } 18 | set { self[DateProviderKey.self] = newValue } 19 | } 20 | } 21 | 22 | extension View { 23 | public func dateProviderValue(_ dateProviderValue: @escaping () -> Date) -> some View { 24 | environment(\.dateProviderValue, dateProviderValue) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/DocumentPicker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DocumentPicker.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/10/23. 6 | // 7 | 8 | import SwiftUI 9 | import UniformTypeIdentifiers 10 | 11 | #if !os(tvOS) 12 | 13 | struct DocumentPicker: UIViewControllerRepresentable { 14 | var callback: (URL) -> Void 15 | 16 | func makeUIViewController(context: Context) -> UIDocumentPickerViewController { 17 | let pickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: supportedUITypes(), asCopy: true) 18 | pickerViewController.allowsMultipleSelection = false 19 | pickerViewController.shouldShowFileExtensions = true 20 | 21 | pickerViewController.delegate = context.coordinator 22 | return pickerViewController 23 | } 24 | 25 | func updateUIViewController(_ uiViewController: UIDocumentPickerViewController, context: Context) {} 26 | 27 | func makeCoordinator() -> Coordinator { 28 | return Coordinator(self) 29 | } 30 | 31 | class Coordinator: NSObject, UIDocumentPickerDelegate { 32 | var parent: DocumentPicker 33 | 34 | init(_ parent: DocumentPicker) { 35 | self.parent = parent 36 | } 37 | 38 | func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { 39 | guard let url = urls.first else { return } 40 | parent.callback(url) 41 | } 42 | } 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/Entity+Move.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Entity+Move.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/12/23. 6 | // 7 | #if os(visionOS) 8 | 9 | import RealityKit 10 | import SwiftUI 11 | 12 | extension Entity { 13 | /// Updates the scale, rotation, and position of a RealityKit entity 14 | /// using optional animation. 15 | func updateTransform( 16 | scale: SIMD3? = nil, 17 | rotation: simd_quatf? = nil, 18 | translation: SIMD3? = nil, 19 | withAnimation: Bool = false 20 | ) { 21 | let end = Transform( 22 | scale: scale ?? transform.scale, 23 | rotation: rotation ?? orientation, 24 | translation: translation ?? transform.translation) 25 | 26 | guard end != transform else { return } 27 | guard withAnimation else { 28 | transform = end 29 | return 30 | } 31 | 32 | do { 33 | let transformAnimation = FromToByAnimation( 34 | name: "transform", 35 | from: transform, 36 | to: end, 37 | duration: 0.25, 38 | timing: .easeInOut, 39 | isAdditive: false, 40 | bindTarget: .transform) 41 | let resource = try AnimationResource.generate(with: transformAnimation) 42 | playAnimation(resource) 43 | } catch { 44 | // Skip the animation and jump to the end. 45 | transform = end 46 | } 47 | } 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/GlobeControls.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GlobeControls.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/17/23. 6 | // 7 | #if os(visionOS) 8 | 9 | import SwiftUI 10 | 11 | struct GlobeControls: View { 12 | @EnvironmentObject var appModel: AppModel 13 | 14 | var body: some View { 15 | HStack(spacing: 17) { 16 | Toggle(isOn:$appModel.isTranslating) { 17 | Label("Translate", systemImage: "move.3d") 18 | } 19 | 20 | .onChange(of: appModel.isTranslating) { 21 | print("new translate value = \($appModel.isTranslating)") 22 | } 23 | 24 | Toggle(isOn: $appModel.isRotating) { 25 | Label("Rotate", systemImage: "arrow.triangle.2.circlepath") 26 | } 27 | .onChange(of: appModel.isRotating) { 28 | print("new rot value = \($appModel.isRotating)") 29 | } 30 | } 31 | .toggleStyle(.button) 32 | .buttonStyle(.borderless) 33 | .labelStyle(.iconOnly) 34 | .padding(12) 35 | .glassBackgroundEffect(in: .rect(cornerRadius: 50)) 36 | } 37 | } 38 | 39 | extension HorizontalAlignment { 40 | /// A custom alignment to center the control panel under the globe. 41 | private struct ControlPanelAlignment: AlignmentID { 42 | static func defaultValue(in context: ViewDimensions) -> CGFloat { 43 | context[HorizontalAlignment.center] 44 | } 45 | } 46 | 47 | /// A custom alignment guide to center the control panel under the globe. 48 | static let controlPanelGuide = HorizontalAlignment( 49 | ControlPanelAlignment.self 50 | ) 51 | } 52 | #endif 53 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/IDProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IDProvider.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/24/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | private struct IDProviderKey: EnvironmentKey { 12 | static let defaultValue: () -> String = { 13 | UUID().uuidString 14 | } 15 | } 16 | 17 | extension EnvironmentValues { 18 | public var idProviderValue: () -> String { 19 | get { self[IDProviderKey.self] } 20 | set { self[IDProviderKey.self] = newValue } 21 | } 22 | } 23 | 24 | extension View { 25 | public func idProviderValue(_ idProviderValue: @escaping () -> String) -> some View { 26 | environment(\.idProviderValue, idProviderValue) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/ImmersiveLogoView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImmersiveView.swift 3 | // RecreateCrazyCoolAnimations 4 | // 5 | // Created by Chris Dillard on 7/3/23. 6 | // 7 | #if os(visionOS) 8 | import SwiftUI 9 | import RealityKit 10 | import MetalKit 11 | 12 | struct ImmersiveLogoView: View { 13 | @EnvironmentObject var appModel: AppModel 14 | 15 | var body: some View { 16 | ZStack(alignment: Alignment(horizontal: .controlPanelGuide, vertical: .bottom)) { 17 | RealityView { content in 18 | let currentPosition = SIMD3(x:-0.025,y:-0.333,z:0.33) 19 | let textEntity = ModelEntity(mesh: .generateText("___", extrusionDepth: 0.07, font: .monospacedSystemFont(ofSize: 0.02, weight: .bold))) 20 | let material = SimpleMaterial(color: .green, isMetallic: true) 21 | textEntity.model?.materials = [material] 22 | textEntity.position = currentPosition 23 | content.add(textEntity) 24 | textEntity.components.set(GroundingShadowComponent(castsShadow: true)) 25 | } 26 | .offset(y: -200) 27 | 28 | GlobeControls() 29 | .offset(y: -70) 30 | } 31 | } 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/KeyboardHeightPublisher.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KeyboardHeightPublisher.swift 3 | // KeyboardAvoidanceSwiftUI 4 | // 5 | // Created by Vadim Bulavin on 3/27/20. 6 | // Copyright © 2020 Vadim Bulavin. All rights reserved. 7 | // 8 | 9 | import Combine 10 | #if !os(macOS) 11 | #if !os(tvOS) 12 | 13 | import UIKit 14 | 15 | extension Publishers { 16 | static var keyboardHeight: AnyPublisher { 17 | let willShow = NotificationCenter.default.publisher(for: UIApplication.keyboardWillShowNotification) 18 | .map { $0.keyboardHeight } 19 | 20 | let willHide = NotificationCenter.default.publisher(for: UIApplication.keyboardWillHideNotification) 21 | .map { _ in CGFloat(0) } 22 | 23 | return MergeMany(willShow, willHide) 24 | .eraseToAnyPublisher() 25 | } 26 | } 27 | 28 | extension Notification { 29 | var keyboardHeight: CGFloat { 30 | return (userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect)?.height ?? 0 31 | } 32 | } 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/NewViewerButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NewViewerButton.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 6/24/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | @available(iOS 16.0, *) 12 | struct NewViewerButton: View { 13 | #if !os(tvOS) 14 | 15 | @Environment(\.openWindow) private var openWindow 16 | #endif 17 | @ObservedObject var settingsViewModel: SettingsViewModel 18 | 19 | var body: some View { 20 | 21 | Button(action: { 22 | #if !os(tvOS) 23 | openWindow(id: "LogicSage-main") 24 | #endif 25 | }) { 26 | VStack(spacing: 0) { 27 | 28 | Image(systemName: "plus.rectangle.fill") 29 | .modifier(CustomFontSize(size: $settingsViewModel.commandButtonFontSize)) 30 | .lineLimit(1) 31 | 32 | Text("Add Window") 33 | .font(.caption) 34 | .lineLimit(1) 35 | .minimumScaleFactor(0.01) 36 | } 37 | #if !os(visionOS) 38 | 39 | .background(settingsViewModel.buttonColor) 40 | #endif 41 | } 42 | .buttonStyle(MyButtonStyle()) 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/Settings/ConversationsViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConversationsViewModel.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 5/24/23. 6 | // 7 | 8 | import Foundation 9 | 10 | struct Message { 11 | var id: String 12 | var role: Chat.Role 13 | var content: String 14 | var createdAt: Date 15 | var culled: Bool? 16 | var invisible: Bool? 17 | 18 | var isLocal: Bool? 19 | var isRunStep: Bool? 20 | } 21 | 22 | enum ConvoMode: Equatable, Codable, Hashable { 23 | case chat 24 | case assistant 25 | } 26 | 27 | extension Message: Equatable, Codable, Hashable, Identifiable {} 28 | 29 | struct Conversation { 30 | init(id: String, messages: [Message] = [], model: String? = nil, temperature: Double? = nil, mode: ConvoMode = .chat, assId: String? = nil, assName: String? = nil) { 31 | self.id = id 32 | self.messages = messages 33 | self.model = model 34 | self.temperature = temperature 35 | self.mode = mode 36 | self.assId = assId 37 | self.assName = assName 38 | } 39 | 40 | typealias ID = String 41 | 42 | let id: String 43 | var messages: [Message] 44 | 45 | //Everything from this point for must be OPtional so we retain compat with early LogicSage versions. 46 | var name: String? 47 | var model: String? 48 | var systemPrompt: String? 49 | var tokens: Int? 50 | var hasAddedToolPrompt: Bool? 51 | var temperature: Double? 52 | var mode: ConvoMode? 53 | var assId: String? 54 | var threadId: String? 55 | var assName: String? 56 | } 57 | 58 | extension Conversation: Equatable, Codable, Hashable, Identifiable {} 59 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/Settings/SettingsViewModel+Constants.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewModel+Constants.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 6/14/23. 6 | // 7 | 8 | import Foundation 9 | 10 | let defaultTerminalFontSize: Double = 13.666 11 | let defaultCommandButtonSize: Double = 28 12 | let defaultToolbarButtonScale: Double = 0.27 13 | 14 | var defaultHandleSize: Double { 15 | #if os(visionOS) 16 | return defaultHandleSizeVisionOS 17 | #else 18 | return defaultHandleSizeOther 19 | #endif 20 | } 21 | 22 | let defaultHandleSizeOther: Double = 40.0 23 | 24 | let defaultHandleSizeVisionOS: Double = 60.0 25 | 26 | let defaultSourceEditorFontSize: Double = 12.666 27 | let email = "chrisbdillard@gmail.com" 28 | 29 | let defaultOwner = "cdillard" 30 | let defaultRepo = "LogicSage" 31 | let defaultBranch = "main" 32 | 33 | let defaultYourGithubUsername = "cdillard" 34 | 35 | let jsonFileName = "conversations" 36 | 37 | let bundleID = "com.chrisdillard.SwiftSage" 38 | let appLink = URL(string: "https://apps.apple.com/us/app/logicsage/id6448485441")! 39 | 40 | func logoAscii5(model: String = SettingsViewModel.shared.openAIModel) -> String { 41 | """ 42 | ┃┃╱╱╭━━┳━━┳┳━━┫╰━━┳━━┳━━┳━━╮ 43 | ┃┃╱╭┫╭╮┃╭╮┣┫╭━┻━━╮┃╭╮┃╭╮┃┃━┫ 44 | ┃╰━╯┃╰╯┃╰╯┃┃╰━┫╰━╯┃╭╮┃╰╯┃┃━┫ 45 | ╰━━━┻━━┻━╮┣┻━━┻━━━┻╯╰┻━╮┣━━╯model:\(model) 46 | """ 47 | } 48 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/Settings/SettingsViewModel+Model.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewModel+Model.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/2/23. 6 | // 7 | 8 | import Foundation 9 | 10 | let aiModelOptions: [String] = [ 11 | "gpt-4-1106-preview", 12 | "gpt-4", 13 | "gpt-4-0314", 14 | "gpt-4-1106-ls-web-browsing", 15 | "gpt-4-0613", 16 | "gpt-4-32k", 17 | "gpt-4-32k-0314", 18 | "gpt-4-32k-0613", 19 | "gpt-3.5-turbo", 20 | "gpt-3.5-turbo-0301", 21 | "gpt-3.5-turbo-0613", 22 | "gpt-3.5-turbo-16k", 23 | "gpt-3.5-turbo-16k-0613", 24 | ] 25 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/Settings/SettingsViewModel+SystemPrompt.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewModel+SystemPrompt.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/2/23. 6 | // 7 | 8 | import Foundation 9 | let systemPromptOptions: [(String, String)] = [ 10 | ("App Developer 👩🏻‍💻","I want you to act as a app developer. Prefer Swift language code, prefer modular code broken into extensions. Think step by step."), 11 | ("Stand-up Comedian 🤣","I want you to act as a stand-up comedian. I will provide you with some topics related to current events and you will use your wit, creativity, and observational skills to create a routine based on those topics. You should also be sure to incorporate personal anecdotes or experiences into the routine in order to make it more relatable and engaging for the audience."), 12 | ("Rapper 🎤","I want you to act as a rapper. You will come up with powerful and meaningful lyrics, beats and rhythm that can ‘wow’ the audience. Your lyrics should have an intriguing meaning and message which people can relate too. When it comes to choosing your beat, make sure it is catchy yet relevant to your words, so that when combined they make an explosion of sound everytime!"), 13 | ] 14 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/Settings/plistHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // plistHelper.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/18/23. 6 | // 7 | 8 | import Foundation 9 | 10 | class plistHelper { 11 | 12 | static func objectFor(key: String, plist: String) -> Any? { 13 | if let plistPath = Bundle.main.url(forResource: plist, withExtension: ".plist") { 14 | do { 15 | let plistData = try Data(contentsOf: plistPath) 16 | if let dict = try PropertyListSerialization.propertyList(from: plistData, format: nil) as? [String: Any] { 17 | return dict[key] 18 | } 19 | } catch { 20 | print(error) 21 | } 22 | } 23 | return nil 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/SphereScreenEntity+Configuration.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SphereScreenEntity+Configuration.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/13/23. 6 | // 7 | #if os(visionOS) 8 | 9 | import SwiftUI 10 | 11 | extension SphereScreenEntity { 12 | /// Configuration information for SphereScreenEntity entities. 13 | struct Configuration { 14 | var isCloudy: Bool = false 15 | 16 | var scale: Float = 0.6 17 | var rotation: simd_quatf = .init(angle: 0, axis: [0, 1, 0]) 18 | var speed: Float = 0 19 | var position: SIMD3 = .zero 20 | 21 | static var screenDefault: Configuration = .init( 22 | scale: 1.0 23 | ) 24 | } 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/SphereScreenSceneView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Orbit.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/13/23. 6 | // 7 | #if os(visionOS) 8 | 9 | import Foundation 10 | import SwiftUI 11 | import RealityKit 12 | 13 | /// The model content for the orbit module. 14 | struct SphereScreenSceneView: View { 15 | @EnvironmentObject var appModel: AppModel 16 | 17 | @State var axRotateClockwise: Bool = false 18 | @State var axRotateCounterClockwise: Bool = false 19 | 20 | var body: some View { 21 | SphereScreenView( 22 | screenConfiguration: appModel.screen 23 | ) 24 | .if(appModel.isRotating) { view in 25 | view.dragRotation( 26 | //pitchLimit: .degrees(90), 27 | axRotateClockwise: axRotateClockwise, 28 | axRotateCounterClockwise: axRotateCounterClockwise) 29 | 30 | 31 | } 32 | .placementGestures(initialPosition: Point3D([appModel.savedSphereX,appModel.savedSphereY,appModel.savedSphereZ])) 33 | } 34 | } 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/SphereScreenView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SphereScreenView.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/13/23. 6 | // 7 | #if os(visionOS) 8 | 9 | import SwiftUI 10 | import RealityKit 11 | 12 | /// The model of the Sphere Screen. 13 | struct SphereScreenView: View { 14 | var screenConfiguration: SphereScreenEntity.Configuration = .init() 15 | var animateUpdates: Bool = false 16 | 17 | /// The Earth entity that the view creates and stores for later updates. 18 | @State private var screenEntity: SphereScreenEntity? 19 | 20 | var body: some View { 21 | RealityView { content in 22 | // Create an earth entity with tilt, rotation, a moon, and so on. 23 | let screenEntity = await SphereScreenEntity( 24 | configuration: screenConfiguration 25 | ) 26 | content.add(screenEntity) 27 | 28 | // Store for later updates. 29 | self.screenEntity = screenEntity 30 | 31 | } update: { content in 32 | // Reconfigure everything when any configuration changes. 33 | screenEntity?.update( 34 | configuration: screenConfiguration, 35 | animateUpdates: animateUpdates) 36 | } 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/ToggleImmersion.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToggleImmersion.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/3/23. 6 | // 7 | 8 | 9 | #if os(visionOS) 10 | import SwiftUI 11 | import RealityKit 12 | @available(visionOS 1.0, *) 13 | struct ToggleImmersion: View { 14 | @EnvironmentObject var appModel: AppModel 15 | 16 | @Binding var showImmersiveSpace: Bool 17 | 18 | @Environment(\.openImmersiveSpace) var openImmersiveSpace 19 | @Environment(\.dismissImmersiveSpace) var dismissImmersiveSpace 20 | 21 | var body: some View { 22 | 23 | Toggle( isOn: $showImmersiveSpace) { 24 | VStack { 25 | Image(systemName: "circle.dashed") 26 | Text("SphereScreen") 27 | .font(.caption) 28 | } 29 | } 30 | .toggleStyle(.button) 31 | .onChange(of: showImmersiveSpace) { _, newValue in 32 | Task { 33 | if newValue { 34 | await openImmersiveSpace(id: "ImmersiveSpace") 35 | } else { 36 | await dismissImmersiveSpace() 37 | } 38 | appModel.isShowingImmersiveScene = newValue 39 | } 40 | } 41 | 42 | 43 | } 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/ViewViewModel/ToggleImmersiveLogo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToggleImmersion.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/3/23. 6 | // 7 | 8 | #if os(visionOS) 9 | 10 | import SwiftUI 11 | import RealityKit 12 | @available(visionOS 1.0, *) 13 | struct ToggleImmersiveButton: View { 14 | @EnvironmentObject var appModel: AppModel 15 | 16 | let idOfView: String 17 | let name: String 18 | 19 | @Binding var showImmersiveLogo: Bool 20 | 21 | @Environment(\.openWindow) private var openWindow 22 | @Environment(\.dismissWindow) private var dismissWindow 23 | #if os(visionOS) 24 | 25 | @Environment(\.dismissImmersiveSpace) var dismissImmersiveSpace 26 | #endif 27 | 28 | var body: some View { 29 | 30 | Toggle("\(showImmersiveLogo ? "Hide" : "Show") \(name)", isOn: $showImmersiveLogo) 31 | .toggleStyle(.button) 32 | .onChange(of: showImmersiveLogo) { _, newValue in 33 | Task { 34 | if newValue { 35 | openWindow(id: idOfView) 36 | } else { 37 | dismissWindow(id: idOfView) 38 | } 39 | if idOfView == "ImmersiveSpaceVolume" { 40 | appModel.isShowingImmersiveWindow = newValue 41 | 42 | } 43 | else if idOfView == "LogoVolume" { 44 | appModel.isShowingImmersiveLogo = newValue 45 | 46 | } 47 | } 48 | } 49 | } 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/v2/MovableDivider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MovableDivider.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/17/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | struct MovableDivider: View { 12 | @Binding var dividerWidth: CGFloat 13 | @State private var currentWidth: CGFloat = 0 14 | @State private var tempWidth: CGFloat = 0 15 | 16 | var body: some View { 17 | GeometryReader { geometry in 18 | VStack { 19 | Rectangle() 20 | .fill(Color.gray) 21 | .frame(width: 8, height: geometry.size.height) 22 | .contentShape(Rectangle()) 23 | #if !os(tvOS) 24 | 25 | .gesture( 26 | 27 | DragGesture() 28 | .onChanged { value in 29 | let delta = value.location.x - value.startLocation.x 30 | let newWidth = tempWidth + delta 31 | if newWidth > 0 && newWidth < geometry.size.width { 32 | currentWidth = newWidth 33 | dividerWidth = currentWidth 34 | } 35 | } 36 | .onEnded { _ in 37 | tempWidth = currentWidth 38 | } 39 | ) 40 | #endif 41 | 42 | } 43 | .frame(width: currentWidth, height: geometry.size.height, alignment: .leading) 44 | .position(x: currentWidth / 2) 45 | } 46 | .onAppear { 47 | currentWidth = dividerWidth 48 | tempWidth = dividerWidth 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/v2/Project.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Project.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/17/23. 6 | // 7 | 8 | import Foundation 9 | 10 | struct Project: Identifiable, Codable { 11 | var id = UUID() 12 | var name: String 13 | var organizationName: String 14 | var identifier: String 15 | var projectTemplate: String 16 | var location: String 17 | var fileSystemItems: [FileSystemItem] 18 | } 19 | struct FileSystemItem: Identifiable, Codable { 20 | var id = UUID() 21 | var name: String 22 | var isDirectory: Bool 23 | var children: [FileSystemItem]? 24 | } 25 | -------------------------------------------------------------------------------- /LogicSage/LogicSage/v2/ProjectDocumentPicker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProjectDocumentPicker.swift 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 8/17/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | import UIKit 11 | #if !os(tvOS) 12 | 13 | struct ProjectDocumentPicker: UIViewControllerRepresentable { 14 | @Binding var pickedDocumentURL: URL? 15 | @Environment(\.presentationMode) private var presentationMode 16 | 17 | func makeUIViewController(context: Context) -> UIDocumentPickerViewController { 18 | let documentPicker = UIDocumentPickerViewController(documentTypes: ["com.apple.dt.document.workspace", "public.wrapper-xcode-project"], in: .import) 19 | documentPicker.delegate = context.coordinator 20 | documentPicker.allowsMultipleSelection = false 21 | return documentPicker 22 | } 23 | 24 | func updateUIViewController(_ uiViewController: UIDocumentPickerViewController, context: Context) { 25 | // Nothing to update 26 | } 27 | 28 | func makeCoordinator() -> Coordinator { 29 | Coordinator(self) 30 | } 31 | 32 | class Coordinator: NSObject, UIDocumentPickerDelegate { 33 | var parent: ProjectDocumentPicker 34 | init(_ parent: ProjectDocumentPicker) { 35 | self.parent = parent 36 | } 37 | 38 | func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { 39 | parent.pickedDocumentURL = urls.first 40 | parent.presentationMode.wrappedValue.dismiss() 41 | } 42 | 43 | func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) { 44 | parent.presentationMode.wrappedValue.dismiss() 45 | } 46 | } 47 | } 48 | #endif 49 | -------------------------------------------------------------------------------- /LogicSage/LogicSageTests/SettingsViewModelTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewModelTests.swift 3 | // LogicSageTests 4 | // 5 | // Created by Chris Dillard on 5/16/23. 6 | // 7 | 8 | import Foundation 9 | import XCTest 10 | 11 | @testable import LogicSage 12 | 13 | class SettingsViewModelTests: XCTestCase { 14 | var sut: SettingsViewModel! 15 | 16 | override func setUp() { 17 | super.setUp() 18 | sut = SettingsViewModel() 19 | } 20 | 21 | override func tearDown() { 22 | sut = nil 23 | super.tearDown() 24 | } 25 | 26 | func testToggleTheme() { 27 | // TODO: Implement this 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LogicSage/LogicSageTests/SwiftSageiOSTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LogicSageTests.swift 3 | // LogicSageTests 4 | // 5 | // Created by Chris Dillard on 5/16/23. 6 | // 7 | 8 | import XCTest 9 | 10 | final class SwiftSageiOSTests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | } 15 | 16 | override func tearDownWithError() throws { 17 | // Put teardown code here. This method is called after the invocation of each test method in the class. 18 | } 19 | 20 | func testExample() throws { 21 | // This is an example of a functional test case. 22 | // Use XCTAssert and related functions to verify your tests produce the correct results. 23 | // Any test you write for XCTest can be annotated as throws and async. 24 | // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. 25 | // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LogicSage/LogicSageUITests/SwiftSageiOSUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LogicSageUITests.swift 3 | // LogicSageUITests 4 | // 5 | // Created by Chris Dillard on 5/16/23. 6 | // 7 | 8 | import XCTest 9 | // 10 | final class SwiftSageiOSUITests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | 15 | // In UI tests it is usually best to stop immediately when a failure occurs. 16 | continueAfterFailure = false 17 | 18 | // In UI tests it’s 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. 19 | } 20 | 21 | override func tearDownWithError() throws { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | func testExample() throws { 26 | // UI tests must launch the application that they test. 27 | let app = XCUIApplication() 28 | app.launch() 29 | 30 | // Use XCTAssert and related functions to verify your tests produce the correct results. 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LogicSage/MacPlugin/LogicSageMacPlugin-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | #import "Plugin.h" 7 | -------------------------------------------------------------------------------- /LogicSage/MacPlugin/MacPlugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Header.h 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/31/23. 6 | // 7 | #import "Plugin.h" 8 | 9 | @interface MacPlugin : NSObject 10 | 11 | 12 | - (void) runLogicSage:(NSString*)path; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /LogicSage/MacPlugin/MacPlugin.m: -------------------------------------------------------------------------------- 1 | // 2 | // MacPlugin.m 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/31/23. 6 | // 7 | 8 | #import 9 | #import 10 | #import "MacPlugin.h" 11 | 12 | @implementation MacPlugin 13 | 14 | - (void) runLogicSage:(NSString*)path { 15 | 16 | NSTask *task = [NSTask new]; 17 | 18 | [task setLaunchPath:@"/bin/zsh"]; 19 | 20 | [task setArguments:@[@"-c", path]]; 21 | NSPipe *output = [NSPipe new]; 22 | 23 | [task setStandardOutput:output]; 24 | 25 | [task launch]; 26 | 27 | NSData * outputText = [[output fileHandleForReading] readDataToEndOfFile]; 28 | 29 | NSString *outputTextText = [[NSString alloc] initWithData:outputText encoding:NSUTF8StringEncoding]; 30 | 31 | NSLog(@"output = %@", outputTextText); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LogicSage/MacPlugin/Plugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // Header.h 3 | // LogicSage 4 | // 5 | // Created by Chris Dillard on 7/31/23. 6 | // 7 | 8 | @protocol Plugin 9 | 10 | - (void) runLogicSage:(NSString*)path; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 MacPaw Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Private/JSONRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JSONRequest.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 12/19/22. 6 | // 7 | 8 | import Foundation 9 | #if canImport(FoundationNetworking) 10 | import FoundationNetworking 11 | #endif 12 | 13 | final class JSONRequest { 14 | 15 | let body: Codable? 16 | let url: URL 17 | let method: String 18 | 19 | init(body: Codable? = nil, url: URL, method: String = "POST") { 20 | self.body = body 21 | self.url = url 22 | self.method = method 23 | } 24 | } 25 | 26 | extension JSONRequest: URLRequestBuildable { 27 | 28 | func build(token: String, organizationIdentifier: String?, timeoutInterval: TimeInterval) throws -> URLRequest { 29 | var request = URLRequest(url: url, timeoutInterval: timeoutInterval) 30 | request.setValue("application/json", forHTTPHeaderField: "Content-Type") 31 | request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") 32 | // TODO: ONLY PASS IF ASSISTANTS API 33 | request.setValue("assistants=v1", forHTTPHeaderField: "OpenAI-Beta") 34 | 35 | if let organizationIdentifier { 36 | request.setValue(organizationIdentifier, forHTTPHeaderField: "OpenAI-Organization") 37 | } 38 | request.httpMethod = method 39 | if let body = body { 40 | request.httpBody = try JSONEncoder().encode(body) 41 | } 42 | return request 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Private/MultipartFormDataBodyEncodable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MultipartFormDataBodyEncodable.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | protocol MultipartFormDataBodyEncodable { 11 | 12 | func encode(boundary: String) -> Data 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Private/MultipartFormDataEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MultipartFormDataEntry.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | enum MultipartFormDataEntry { 11 | 12 | case file(paramName: String, fileName: String?, fileData: Data?, contentType: String), 13 | string(paramName: String, value: Any?) 14 | } 15 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Private/MultipartFormDataRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MultipartFormDataRequest.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | #if canImport(FoundationNetworking) 10 | import FoundationNetworking 11 | #endif 12 | 13 | final class MultipartFormDataRequest { 14 | 15 | let body: MultipartFormDataBodyEncodable 16 | let url: URL 17 | let method: String 18 | 19 | init(body: MultipartFormDataBodyEncodable, url: URL, method: String = "POST") { 20 | self.body = body 21 | self.url = url 22 | self.method = method 23 | } 24 | } 25 | 26 | extension MultipartFormDataRequest: URLRequestBuildable { 27 | 28 | func build(token: String, organizationIdentifier: String?, timeoutInterval: TimeInterval) throws -> URLRequest { 29 | var request = URLRequest(url: url) 30 | let boundary: String = UUID().uuidString 31 | request.timeoutInterval = timeoutInterval 32 | request.httpMethod = method 33 | request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") 34 | request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") 35 | if let organizationIdentifier { 36 | request.setValue(organizationIdentifier, forHTTPHeaderField: "OpenAI-Organization") 37 | } 38 | request.httpBody = body.encode(boundary: boundary) 39 | return request 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Private/URLRequestBuildable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | #if canImport(FoundationNetworking) 10 | import FoundationNetworking 11 | #endif 12 | 13 | protocol URLRequestBuildable { 14 | 15 | associatedtype ResultType 16 | 17 | func build(token: String, organizationIdentifier: String?, timeoutInterval: TimeInterval) throws -> URLRequest 18 | } 19 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Private/URLSessionDataTaskProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | #if canImport(FoundationNetworking) 10 | import FoundationNetworking 11 | #endif 12 | 13 | protocol URLSessionDataTaskProtocol { 14 | 15 | func resume() 16 | } 17 | 18 | extension URLSessionDataTask: URLSessionDataTaskProtocol {} 19 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Private/URLSessionProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | #if canImport(FoundationNetworking) 10 | import FoundationNetworking 11 | #endif 12 | 13 | protocol URLSessionProtocol { 14 | 15 | func openAIdataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTaskProtocol 16 | func openAIdataTask(with request: URLRequest) -> URLSessionDataTaskProtocol 17 | } 18 | 19 | extension URLSession: URLSessionProtocol { 20 | 21 | func openAIdataTask(with request: URLRequest) -> URLSessionDataTaskProtocol { 22 | dataTask(with: request) as URLSessionDataTask 23 | } 24 | 25 | func openAIdataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTaskProtocol { 26 | dataTask(with: request, completionHandler: completionHandler) as URLSessionDataTask 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/AssistantsQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AssistantsQuery.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct AssistantsQuery: Codable { 11 | 12 | public let model: Model 13 | 14 | public let name: String 15 | 16 | public let description: String 17 | 18 | public let instructions: String 19 | 20 | public let tools: [Tool]? 21 | 22 | public let fileIds: [String]? 23 | 24 | enum CodingKeys: String, CodingKey { 25 | case model 26 | case name 27 | case description 28 | case instructions 29 | case tools 30 | case fileIds = "file_ids" 31 | } 32 | 33 | public init(model: Model, name: String, description: String, instructions: String, tools: [Tool], fileIds: [String]? = nil) { 34 | self.model = model 35 | self.name = name 36 | 37 | self.description = description 38 | self.instructions = instructions 39 | 40 | self.tools = tools 41 | self.fileIds = fileIds 42 | } 43 | } 44 | 45 | public struct Tool: Codable, Equatable { 46 | public let toolType: String 47 | 48 | enum CodingKeys: String, CodingKey { 49 | case toolType = "type" 50 | } 51 | 52 | public init(toolType: String) { 53 | self.toolType = toolType 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/AssistantsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AssistantsResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct AssistantsResult: Codable, Equatable { 11 | 12 | public let id: String? 13 | public let name: String? 14 | 15 | public let data: [AssistantContent]? 16 | public let tools: [Tool]? 17 | 18 | enum CodingKeys: String, CodingKey { 19 | case data 20 | case id 21 | case name 22 | case tools 23 | } 24 | 25 | public struct AssistantContent: Codable, Equatable { 26 | 27 | public let id: String 28 | public let name: String 29 | public let description: String? 30 | public let instructions: String? 31 | public let tools: [Tool]? 32 | public let fileIds: [String]? 33 | 34 | enum CodingKeys: String, CodingKey { 35 | case id 36 | case name 37 | case description 38 | case instructions 39 | case tools 40 | case fileIds = "file_ids" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/AudioSpeechResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AudioSpeechResult.swift 3 | // 4 | // 5 | // Created by Ihor Makhnyk on 13.11.2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct AudioSpeechResult { 11 | 12 | /// Audio data for one of the following formats :`mp3`, `opus`, `aac`, `flac` 13 | public let audioData: Data? 14 | } 15 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/AudioTranscriptionResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AudioTranscriptionResult.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct AudioTranscriptionResult: Codable, Equatable { 11 | 12 | public let text: String 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/AudioTranslationQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AudioTranslationQuery.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct AudioTranslationQuery: Codable, Equatable { 11 | public typealias ResponseFormat = AudioResponseFormat 12 | 13 | public let file: Data 14 | public let fileName: String 15 | public let model: Model 16 | 17 | public let responseFormat: Self.ResponseFormat? 18 | public let prompt: String? 19 | public let temperature: Double? 20 | 21 | public init(file: Data, fileName: String, model: Model, prompt: String? = nil, temperature: Double? = nil, responseFormat: Self.ResponseFormat? = nil) { 22 | self.file = file 23 | self.fileName = fileName 24 | self.model = model 25 | self.prompt = prompt 26 | self.temperature = temperature 27 | self.responseFormat = responseFormat 28 | } 29 | } 30 | 31 | extension AudioTranslationQuery: MultipartFormDataBodyEncodable { 32 | 33 | func encode(boundary: String) -> Data { 34 | let bodyBuilder = MultipartFormDataBodyBuilder(boundary: boundary, entries: [ 35 | .file(paramName: "file", fileName: fileName, fileData: file, contentType: "audio/mpeg"), 36 | .string(paramName: "model", value: model), 37 | .string(paramName: "prompt", value: prompt), 38 | .string(paramName: "response_format", value: responseFormat), 39 | .string(paramName: "temperature", value: temperature) 40 | ]) 41 | return bodyBuilder.build() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/AudioTranslationResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AudioTranslationResult.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 03/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct AudioTranslationResult: Codable, Equatable { 11 | 12 | public let text: String 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/CompletionsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CompletionsResult.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct CompletionsResult: Codable, Equatable { 11 | 12 | public struct Usage: Codable, Equatable { 13 | public let promptTokens: Int 14 | public let completionTokens: Int 15 | public let totalTokens: Int 16 | 17 | enum CodingKeys: String, CodingKey { 18 | case promptTokens = "prompt_tokens" 19 | case completionTokens = "completion_tokens" 20 | case totalTokens = "total_tokens" 21 | } 22 | } 23 | 24 | public struct Choice: Codable, Equatable { 25 | public let text: String 26 | public let index: Int 27 | public let finishReason: String? 28 | 29 | enum CodingKeys: String, CodingKey { 30 | case text 31 | case index 32 | case finishReason = "finish_reason" 33 | } 34 | } 35 | 36 | public let id: String 37 | public let object: String 38 | public let created: TimeInterval 39 | public let model: Model 40 | public let choices: [Choice] 41 | public let usage: Usage? 42 | } 43 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/EditsQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EditsQuery.swift 3 | // 4 | // 5 | // Created by Aled Samuel on 14/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct EditsQuery: Codable { 11 | /// ID of the model to use. 12 | public let model: Model 13 | /// Input text to get embeddings for. 14 | public let input: String? 15 | /// The instruction that tells the model how to edit the prompt. 16 | public let instruction: String 17 | /// The number of images to generate. Must be between 1 and 10. 18 | public let n: Int? 19 | /// What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. 20 | public let temperature: Double? 21 | /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. 22 | public let topP: Double? 23 | 24 | public init(model: Model, input: String?, instruction: String, n: Int? = nil, temperature: Double? = nil, topP: Double? = nil) { 25 | self.model = model 26 | self.input = input 27 | self.instruction = instruction 28 | self.n = n 29 | self.temperature = temperature 30 | self.topP = topP 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/EditsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EditsResult.swift 3 | // 4 | // 5 | // Created by Aled Samuel on 14/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct EditsResult: Codable, Equatable { 11 | 12 | public struct Choice: Codable, Equatable { 13 | public let text: String 14 | public let index: Int 15 | } 16 | 17 | public struct Usage: Codable, Equatable { 18 | public let promptTokens: Int 19 | public let completionTokens: Int 20 | public let totalTokens: Int 21 | 22 | enum CodingKeys: String, CodingKey { 23 | case promptTokens = "prompt_tokens" 24 | case completionTokens = "completion_tokens" 25 | case totalTokens = "total_tokens" 26 | } 27 | } 28 | 29 | public let object: String 30 | public let created: TimeInterval 31 | public let choices: [Choice] 32 | public let usage: Usage 33 | } 34 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/EmbeddingsQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EmbeddingsQuery.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct EmbeddingsQuery: Codable { 11 | /// ID of the model to use. 12 | public let model: Model 13 | /// Input text to get embeddings for. 14 | public let input: String 15 | 16 | public init(model: Model, input: String) { 17 | self.model = model 18 | self.input = input 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/EmbeddingsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EmbeddingsResult.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct EmbeddingsResult: Codable, Equatable { 11 | 12 | public struct Embedding: Codable, Equatable { 13 | public let object: String 14 | public let embedding: [Double] 15 | public let index: Int 16 | } 17 | 18 | public struct Usage: Codable, Equatable { 19 | public let promptTokens: Int 20 | public let totalTokens: Int 21 | 22 | enum CodingKeys: String, CodingKey { 23 | case promptTokens = "prompt_tokens" 24 | case totalTokens = "total_tokens" 25 | } 26 | } 27 | 28 | public let data: [Embedding] 29 | public let model: Model 30 | public let usage: Usage 31 | } 32 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/FilesQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FilesQuery.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct FilesQuery: Codable { 11 | 12 | public let purpose: String 13 | 14 | public let file: Data 15 | public let fileName: String 16 | 17 | public let contentType: String 18 | 19 | enum CodingKeys: String, CodingKey { 20 | case purpose 21 | case file 22 | case fileName 23 | case contentType 24 | } 25 | 26 | public init(purpose: String, file: Data, fileName: String, contentType: String) { 27 | self.purpose = purpose 28 | self.file = file 29 | self.fileName = fileName 30 | self.contentType = contentType 31 | } 32 | } 33 | 34 | extension FilesQuery: MultipartFormDataBodyEncodable { 35 | func encode(boundary: String) -> Data { 36 | let bodyBuilder = MultipartFormDataBodyBuilder(boundary: boundary, entries: [ 37 | .string(paramName: "purpose", value: purpose), 38 | .file(paramName: "file", fileName: fileName, fileData: file, contentType: contentType), 39 | ]) 40 | return bodyBuilder.build() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/FilesResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FilesResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct FilesResult: Codable, Equatable { 11 | 12 | public let id: String 13 | public let name: String? 14 | 15 | } 16 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ImageVariationsQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImageVariationsQuery.swift 3 | // 4 | // 5 | // Created by Aled Samuel on 24/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ImageVariationsQuery: Codable { 11 | /// The image to edit. Must be a valid PNG file, less than 4MB, and square. 12 | public let image: Data 13 | public let fileName: String 14 | /// The number of images to generate. Must be between 1 and 10. 15 | public let n: Int? 16 | /// The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024. 17 | public let size: String? 18 | 19 | public init(image: Data, fileName: String, n: Int? = nil, size: String? = nil) { 20 | self.image = image 21 | self.fileName = fileName 22 | self.n = n 23 | self.size = size 24 | } 25 | } 26 | 27 | extension ImageVariationsQuery: MultipartFormDataBodyEncodable { 28 | func encode(boundary: String) -> Data { 29 | let bodyBuilder = MultipartFormDataBodyBuilder(boundary: boundary, entries: [ 30 | .file(paramName: "image", fileName: fileName, fileData: image, contentType: "image/png"), 31 | .string(paramName: "n", value: n), 32 | .string(paramName: "size", value: size) 33 | ]) 34 | return bodyBuilder.build() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ImagesResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImagesResult.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 02/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ImagesResult: Codable, Equatable { 11 | 12 | public struct URLResult: Codable, Equatable { 13 | public let url: String? 14 | public let b64_json: String? 15 | } 16 | 17 | public let created: TimeInterval 18 | public let data: [URLResult] 19 | } 20 | 21 | extension ImagesResult.URLResult: Hashable { } 22 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/Models/ModelQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ModelQuery.swift 3 | // 4 | // 5 | // Created by Aled Samuel on 08/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ModelQuery: Codable, Equatable { 11 | /// The ID of the model to use for this request. 12 | public let model: Model 13 | 14 | public init(model: Model) { 15 | self.model = model 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/Models/ModelResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ModelResult.swift 3 | // 4 | // 5 | // Created by Aled Samuel on 08/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ModelResult: Codable, Equatable { 11 | 12 | public let id: Model 13 | public let object: String 14 | public let ownedBy: String 15 | 16 | enum CodingKeys: String, CodingKey { 17 | case id 18 | case object 19 | case ownedBy = "owned_by" 20 | } 21 | } 22 | 23 | extension ModelResult: Identifiable {} 24 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/Models/ModelsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ModelsResult.swift 3 | // 4 | // 5 | // Created by Aled Samuel on 08/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ModelsResult: Codable, Equatable { 11 | 12 | public let data: [ModelResult] 13 | public let object: String 14 | } 15 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ModerationsQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ModerationsQuery.swift 3 | // 4 | // 5 | // Created by Aled Samuel on 10/04/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ModerationsQuery: Codable { 11 | /// The input text to classify. 12 | public let input: String 13 | /// ID of the model to use. 14 | public let model: Model? 15 | 16 | public init(input: String, model: Model? = nil) { 17 | self.input = input 18 | self.model = model 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/RunRetrieveQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RunRetrieveQuery.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct RunRetrieveQuery: Equatable, Codable { 11 | 12 | public init() { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/RunRetrieveResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RunsResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct RunRetreiveResult: Codable, Equatable { 11 | 12 | public let status: String 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/RunRetrieveStepsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RunRetreiveStepsResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct RunRetreiveStepsResult: Codable, Equatable { 11 | 12 | public struct StepDetailsTopLevel: Codable, Equatable { 13 | public let id: String 14 | public let stepDetails: StepDetailsSecondLevel 15 | 16 | enum CodingKeys: String, CodingKey { 17 | case id 18 | case stepDetails = "step_details" 19 | } 20 | 21 | public struct StepDetailsSecondLevel: Codable, Equatable { 22 | 23 | public let toolCalls: [ToolCall]? 24 | 25 | enum CodingKeys: String, CodingKey { 26 | case toolCalls = "tool_calls" 27 | } 28 | 29 | public struct ToolCall: Codable, Equatable { 30 | public let id: String 31 | public let type: String 32 | public let code: CodeToolCall? 33 | 34 | enum CodingKeys: String, CodingKey { 35 | case id 36 | case type 37 | case code = "code_interpreter" 38 | } 39 | 40 | public struct CodeToolCall: Codable, Equatable { 41 | public let input: String 42 | public let outputs: [CodeToolCallOutput]? 43 | 44 | public struct CodeToolCallOutput: Codable, Equatable { 45 | public let type: String 46 | public let logs: String? 47 | } 48 | } 49 | } 50 | } 51 | } 52 | 53 | public let data: [StepDetailsTopLevel] 54 | } 55 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/RunsQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AssistantsQuery.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct RunsQuery: Codable { 11 | 12 | public let assistantId: String 13 | 14 | enum CodingKeys: String, CodingKey { 15 | case assistantId = "assistant_id" 16 | } 17 | 18 | public init(assistantId: String) { 19 | 20 | self.assistantId = assistantId 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/RunsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RunsResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct RunsResult: Codable, Equatable { 11 | 12 | public let id: String 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/StreamableQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 15/05/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | protocol Streamable { 11 | 12 | var stream: Bool { get set } 13 | func makeStreamable() -> Self 14 | } 15 | 16 | extension Streamable { 17 | 18 | func makeStreamable() -> Self { 19 | var copy = self 20 | copy.stream = true 21 | return copy 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ThreadAddMessageQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThreadAddMessageQuery.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ThreadAddMessageQuery: Equatable, Codable { 11 | public let role: String 12 | public let content: String 13 | 14 | enum CodingKeys: String, CodingKey { 15 | case role 16 | case content 17 | 18 | } 19 | 20 | public init(role: String, content: String) { 21 | self.role = role 22 | self.content = content 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ThreadAddMessagesResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThreadsMessagesResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ThreadAddMessageResult: Codable, Equatable { 11 | public let id: String 12 | 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ThreadsMessagesResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThreadsMessagesResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ThreadsMessagesResult: Codable, Equatable { 11 | 12 | public struct ThreadsMessage: Codable, Equatable { 13 | 14 | public struct ThreadsMessageContent: Codable, Equatable { 15 | 16 | public struct ThreadsMessageContentText: Codable, Equatable { 17 | 18 | public let value: String? 19 | 20 | enum CodingKeys: String, CodingKey { 21 | case value 22 | } 23 | } 24 | 25 | public struct ImageFileContentText: Codable, Equatable { 26 | 27 | public let fildId: String 28 | 29 | enum CodingKeys: String, CodingKey { 30 | case fildId = "file_id" 31 | } 32 | } 33 | 34 | public let type: String 35 | public let text: ThreadsMessageContentText? 36 | public let imageFile: ThreadsMessageContentText? 37 | 38 | enum CodingKeys: String, CodingKey { 39 | case type 40 | case text 41 | case imageFile = "image_file" 42 | } 43 | } 44 | 45 | public let id: String 46 | 47 | public let role: String 48 | 49 | public let content: [ThreadsMessageContent] 50 | 51 | enum CodingKeys: String, CodingKey { 52 | case id 53 | case content 54 | case role 55 | } 56 | } 57 | 58 | 59 | public let data: [ThreadsMessage] 60 | 61 | enum CodingKeys: String, CodingKey { 62 | case data 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ThreadsQuery.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThreadsQuery.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ThreadsQuery: Equatable, Codable { 11 | public let messages: [Chat] 12 | 13 | enum CodingKeys: String, CodingKey { 14 | case messages 15 | } 16 | 17 | public init(messages: [Chat]) { 18 | self.messages = messages 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Models/ThreadsResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AssistantsResult.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 11/07/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ThreadsResult: Codable, Equatable { 11 | 12 | public let id: String 13 | } 14 | -------------------------------------------------------------------------------- /LogicSage/OpenAI/Public/Utilities/Utilities.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Utilities.swift 3 | // 4 | // 5 | // Created by Sergii Kryvoblotskyi on 12/19/22. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct Vector { 11 | 12 | /// Returns the similarity between two vectors 13 | /// 14 | /// - Parameters: 15 | /// - a: The first vector 16 | /// - b: The second vector 17 | public static func cosineSimilarity(a: [Double], b: [Double]) -> Double { 18 | return dot(a, b) / (mag(a) * mag(b)) 19 | } 20 | 21 | /// Returns the difference between two vectors. Cosine distance is defined as `1 - cosineSimilarity(a, b)` 22 | /// 23 | /// - Parameters: 24 | /// - a: The first vector 25 | /// - b: The second vector 26 | public func cosineDifference(a: [Double], b: [Double]) -> Double { 27 | return 1 - Self.cosineSimilarity(a: a, b: b) 28 | } 29 | } 30 | 31 | private extension Vector { 32 | 33 | static func round(_ input: Double, to places: Int = 1) -> Double { 34 | let divisor = pow(10.0, Double(places)) 35 | return (input * divisor).rounded() / divisor 36 | } 37 | 38 | static func dot(_ a: [Double], _ b: [Double]) -> Double { 39 | assert(a.count == b.count, "Vectors must have the same dimension") 40 | let result = zip(a, b) 41 | .map { $0 * $1 } 42 | .reduce(0, +) 43 | 44 | return result 45 | } 46 | 47 | static func mag(_ vector: [Double]) -> Double { 48 | return sqrt(dot(vector, vector)) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Louis D'hauwe, Paul Hudson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Languages/Python3Lexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Python3Lexer.swift 3 | // SourceEditor 4 | // 5 | // Created by Stefan Wijnja on 27/07/2018. 6 | // Based on SwiftLexer.swift by Louis D'hauwe. 7 | // Copyright © 2018 Silver Fox. All rights reserved. 8 | // 9 | 10 | import Foundation 11 | 12 | public class Python3Lexer: SourceCodeRegexLexer { 13 | 14 | public init() { 15 | 16 | } 17 | 18 | lazy var generators: [TokenGenerator] = { 19 | 20 | var generators = [TokenGenerator?]() 21 | // Functions 22 | generators.append(regexGenerator("\\bprint(?=\\()", tokenType: .identifier)) 23 | 24 | generators.append(regexGenerator("(?<=[^a-zA-Z])\\d+", tokenType: .number)) 25 | 26 | generators.append(regexGenerator("\\.\\w+", tokenType: .identifier)) 27 | 28 | let keywords = "False None True and as assert break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield".components(separatedBy: " ") 29 | 30 | generators.append(keywordGenerator(keywords, tokenType: .keyword)) 31 | 32 | // Line comment 33 | generators.append(regexGenerator("#(.*)", tokenType: .comment)) 34 | 35 | // Block comment or multi-line string literal 36 | generators.append(regexGenerator("(\"\"\".*\"\"\")|(\'\'\'.*\'\'\')", options: [.dotMatchesLineSeparators], tokenType: .comment)) 37 | 38 | // Single-line string literal 39 | generators.append(regexGenerator("('.*')|(\".*\")", tokenType: .string)) 40 | 41 | // Editor placeholder 42 | var editorPlaceholderPattern = "(<#)[^\"\\n]*" 43 | editorPlaceholderPattern += "(#>)" 44 | generators.append(regexGenerator(editorPlaceholderPattern, tokenType: .editorPlaceholder)) 45 | 46 | return generators.compactMap( { $0 }) 47 | }() 48 | 49 | public func generators(source: String) -> [TokenGenerator] { 50 | return generators 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Model/Lexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Lexer.swift 3 | // SavannaKit iOS 4 | // 5 | // Created by Louis D'hauwe on 04/02/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Lexer { 12 | 13 | func getSavannaTokens(input: String) -> [Token] 14 | 15 | } 16 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Model/Paragraph.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Paragraph.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 24/06/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | #if os(macOS) 13 | import AppKit 14 | #else 15 | import UIKit 16 | #endif 17 | #if !os(macOS) 18 | 19 | struct Paragraph { 20 | 21 | var rect: CGRect 22 | let number: Int 23 | 24 | var string: String { 25 | return "\(number)" 26 | } 27 | 28 | func attributedString(for style: LineNumbersStyle) -> NSAttributedString { 29 | 30 | let attr = NSMutableAttributedString(string: string) 31 | let range = NSMakeRange(0, attr.length) 32 | 33 | let attributes: [NSAttributedString.Key: Any] = [ 34 | .font: style.font, 35 | .foregroundColor : style.textColor 36 | ] 37 | 38 | attr.addAttributes(attributes, range: range) 39 | 40 | return attr 41 | } 42 | 43 | func drawSize(for style: LineNumbersStyle) -> CGSize { 44 | return attributedString(for: style).size() 45 | } 46 | 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Model/SyntaxColorTheme.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SyntaxTheme.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 24/01/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | public struct LineNumbersStyle { 13 | 14 | public let font: Fontv 15 | public let textColor: Colorv 16 | 17 | public init(font: Fontv, textColor: Colorv) { 18 | self.font = font 19 | self.textColor = textColor 20 | } 21 | 22 | } 23 | 24 | public struct GutterStyle { 25 | 26 | public let backgroundColor: Colorv 27 | 28 | /// If line numbers are displayed, the gutter width adapts to fit all line numbers. 29 | /// This specifies the minimum width that the gutter should have at all times, 30 | /// regardless of any line numbers. 31 | public let minimumWidth: CGFloat 32 | 33 | public init(backgroundColor: Colorv, minimumWidth: CGFloat) { 34 | self.backgroundColor = backgroundColor 35 | self.minimumWidth = minimumWidth 36 | } 37 | } 38 | 39 | public protocol SyntaxColorTheme { 40 | 41 | /// Nil hides line numbers. 42 | var lineNumbersStyle: LineNumbersStyle? { get } 43 | 44 | var gutterStyle: GutterStyle { get } 45 | 46 | #if !os(macOS) 47 | 48 | var font: Fontv { get } 49 | #endif 50 | 51 | var backgroundColor: Colorv { get } 52 | 53 | func globalAttributes() -> [NSAttributedString.Key: Any] 54 | 55 | func attributes(for token: Token) -> [NSAttributedString.Key: Any] 56 | } 57 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Model/Token.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Token.swift 3 | // SavannaKit iOS 4 | // 5 | // Created by Louis D'hauwe on 04/02/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Token { 12 | 13 | /// When true, this token will be treated as a placeholder. 14 | /// Users can tab between placeholder. Typing in a placeholder replaces 15 | /// it completely. 16 | var isEditorPlaceholder: Bool { get } 17 | 18 | /// When true, no attributes will be requested for this token. 19 | /// This causes a performance win for a large amount of tokens 20 | /// that don't require any attributes. 21 | var isPlain: Bool { get } 22 | 23 | /// The range of the token in the source string. 24 | var range: Range { get } 25 | 26 | } 27 | 28 | struct CachedToken { 29 | 30 | let token: Token 31 | let nsRange: NSRange 32 | 33 | } 34 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/SourceCodeRegexLexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SavannaKit+Swift.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol SourceCodeRegexLexer: RegexLexer { 12 | } 13 | 14 | extension RegexLexer { 15 | public func regexGenerator(_ pattern: String, options: NSRegularExpression.Options = [], transformer: @escaping TokenTransformer) -> TokenGenerator? { 16 | 17 | guard let regex = try? NSRegularExpression(pattern: pattern, options: options) else { 18 | return nil 19 | } 20 | 21 | return .regex(RegexTokenGenerator(regularExpression: regex, tokenTransformer: transformer)) 22 | } 23 | 24 | } 25 | 26 | extension SourceCodeRegexLexer { 27 | 28 | public func regexGenerator(_ pattern: String, options: NSRegularExpression.Options = [], tokenType: SourceCodeTokenType) -> TokenGenerator? { 29 | 30 | return regexGenerator(pattern, options: options, transformer: { (range) -> Token in 31 | return SimpleSourceCodeToken(type: tokenType, range: range) 32 | }) 33 | } 34 | 35 | public func keywordGenerator(_ words: [String], tokenType: SourceCodeTokenType) -> TokenGenerator { 36 | 37 | return .keywords(KeywordTokenGenerator(keywords: words, tokenTransformer: { (range) -> Token in 38 | return SimpleSourceCodeToken(type: tokenType, range: range) 39 | })) 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/SourceCodeTheme.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceCodeTheme.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol SourceCodeTheme: SyntaxColorTheme { 12 | 13 | func color(for syntaxColorType: SourceCodeTokenType) -> Colorv 14 | 15 | } 16 | 17 | extension SourceCodeTheme { 18 | 19 | public func globalAttributes() -> [NSAttributedString.Key: Any] { 20 | 21 | var attributes = [NSAttributedString.Key: Any]() 22 | 23 | #if !os(macOS) 24 | attributes[.font] = font 25 | #endif 26 | attributes[.foregroundColor] = color(for: .plain) 27 | 28 | return attributes 29 | } 30 | 31 | public func attributes(for token: Token) -> [NSAttributedString.Key: Any] { 32 | var attributes = [NSAttributedString.Key: Any]() 33 | 34 | if let token = token as? SimpleSourceCodeToken { 35 | attributes[.foregroundColor] = color(for: token.type) 36 | } 37 | 38 | return attributes 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/SourceCodeToken.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceCodeToken.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum SourceCodeTokenType { 12 | case plain 13 | case number 14 | case string 15 | case identifier 16 | case keyword 17 | case comment 18 | case editorPlaceholder 19 | 20 | } 21 | 22 | protocol SourceCodeToken: Token { 23 | 24 | var type: SourceCodeTokenType { get } 25 | 26 | } 27 | 28 | extension SourceCodeToken { 29 | 30 | var isEditorPlaceholder: Bool { 31 | return type == .editorPlaceholder 32 | } 33 | 34 | var isPlain: Bool { 35 | return type == .plain 36 | } 37 | 38 | } 39 | 40 | struct SimpleSourceCodeToken: SourceCodeToken { 41 | 42 | let type: SourceCodeTokenType 43 | 44 | let range: Range 45 | 46 | } 47 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Starscream/Compression/Compression.swift: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Compression.swift 4 | // Starscream 5 | // 6 | // Created by Dalton Cherry on 2/4/19. 7 | // Copyright © 2019 Vluxe. All rights reserved. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | // 21 | ////////////////////////////////////////////////////////////////////////////////////////////////// 22 | 23 | import Foundation 24 | 25 | public protocol CompressionHandler { 26 | func load(headers: [String: String]) 27 | func decompress(data: Data, isFinal: Bool) -> Data? 28 | func compress(data: Data) -> Data? 29 | } 30 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Starscream/Engine/Engine.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Engine.swift 3 | // Starscream 4 | // 5 | // Created by Dalton Cherry on 6/15/19. 6 | // Copyright © 2019 Vluxe. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol EngineDelegate: AnyObject { 12 | func didReceive(event: WebSocketEvent) 13 | } 14 | 15 | public protocol Engine { 16 | func register(delegate: EngineDelegate) 17 | func start(request: URLRequest) 18 | func stop(closeCode: UInt16) 19 | func forceStop() 20 | func write(data: Data, opcode: FrameOpCode, completion: (() -> ())?) 21 | func write(string: String, completion: (() -> ())?) 22 | } 23 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Starscream/Security/Security.swift: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Security.swift 4 | // Starscream 5 | // 6 | // Created by Dalton Cherry on 3/16/19. 7 | // Copyright © 2019 Vluxe. All rights reserved. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | // 21 | ////////////////////////////////////////////////////////////////////////////////////////////////// 22 | 23 | import Foundation 24 | 25 | public enum SecurityErrorCode: UInt16 { 26 | case acceptFailed = 1 27 | case pinningFailed = 2 28 | } 29 | 30 | public enum PinningState { 31 | case success 32 | case failed(CFError?) 33 | } 34 | 35 | // CertificatePinning protocol provides an interface for Transports to handle Certificate 36 | // or Public Key Pinning. 37 | public protocol CertificatePinning: AnyObject { 38 | func evaluateTrust(trust: SecTrust, domain: String?, completion: ((PinningState) -> ())) 39 | } 40 | 41 | // validates the "Sec-WebSocket-Accept" header as defined 1.3 of the RFC 6455 42 | // https://tools.ietf.org/html/rfc6455#section-1.3 43 | public protocol HeaderValidator: AnyObject { 44 | func validate(headers: [String: String], key: String) -> Error? 45 | } 46 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Starscream/Starscream.h: -------------------------------------------------------------------------------- 1 | // 2 | // Starscream.h 3 | // Starscream 4 | // 5 | // Created by Austin Cherry on 9/25/14. 6 | // Copyright (c) 2014 Vluxe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Starscream. 12 | FOUNDATION_EXPORT double StarscreamVersionNumber; 13 | 14 | //! Project version string for Starscream. 15 | FOUNDATION_EXPORT const unsigned char StarscreamVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Util/NSTextView+UIKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSTextView+UIKit.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 09/07/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | #if !os(iOS) 10 | #if !os(tvOS) 11 | #if !os(visionOS) 12 | import AppKit 13 | extension NSTextView { 14 | 15 | var text: String! { 16 | get { 17 | return string 18 | } 19 | set { 20 | self.string = newValue 21 | } 22 | } 23 | } 24 | #endif 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /LogicSage/Sourceful/Util/String+Range.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Range.swift 3 | // SavannaKit 4 | // 5 | // Created by Louis D'hauwe on 09/07/2017. 6 | // Copyright © 2017 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension String { 12 | 13 | func nsRange(fromRange range: Range) -> NSRange { 14 | return NSRange(range, in: self) 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /LogicSage/Tiktoken/Extensions/Array+PrevCurrent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Array+PrevCurrent.swift 3 | // 4 | // 5 | // Created by Alberto Espinilla Garrido on 10/4/23. 6 | // 7 | 8 | import Foundation 9 | 10 | extension Array { 11 | func prevCurrent(_ body: (Element, Element) throws -> T) rethrows -> [T] { 12 | enumerated().compactMap({ index, element in 13 | guard index > 0 else { return nil } 14 | let prev = self[index-1] 15 | return try? body(prev, element) 16 | }) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LogicSage/Tiktoken/Extensions/Character+Int.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Character+Int.swift 3 | // 4 | // 5 | // Created by Alberto Espinilla Garrido on 2/4/23. 6 | // 7 | 8 | import Foundation 9 | 10 | extension Character { 11 | init(_ i: Int) { 12 | self.self = Character(UnicodeScalar(i)!) 13 | } 14 | 15 | var isPrintable: Bool { 16 | unicodeScalars.contains(where: { $0.isPrintable }) 17 | } 18 | } 19 | 20 | extension Unicode.Scalar { 21 | var isPrintable: Bool { 22 | switch properties.generalCategory { 23 | case .control, .format: return false 24 | default: return true 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LogicSage/Tiktoken/Extensions/String+Base64.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Base64.swift 3 | // 4 | // 5 | // Created by Alberto Espinilla Garrido on 2/4/23. 6 | // 7 | 8 | import Foundation 9 | 10 | extension String { 11 | func base64Encoded() -> String? { 12 | data(using: .utf8)?.base64EncodedString() 13 | } 14 | 15 | func base64Decoded() -> String? { 16 | guard let data = Data(base64Encoded: self) else { return nil } 17 | return String(data: data, encoding: .ascii) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /LogicSage/Tiktoken/Extensions/String+Substring.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Substring.swift 3 | // 4 | // 5 | // Created by Alberto Espinilla Garrido on 26/3/23. 6 | // 7 | 8 | import Foundation 9 | 10 | extension String { 11 | func index(from: Int) -> Index { 12 | index(startIndex, offsetBy: from) 13 | } 14 | 15 | func substring(from: Int) -> String { 16 | let fromIndex = index(from: from) 17 | return String(self[fromIndex...]) 18 | } 19 | 20 | func substring(to: Int) -> String { 21 | let toIndex = index(from: to) 22 | return String(self[..) -> String { 26 | let startIndex = index(from: r.lowerBound) 27 | let endIndex = index(from: r.upperBound) 28 | return String(self[startIndex.. [[UInt8]: Int] { 12 | guard let decoded = String(data: data, encoding: .utf8) else { return [:] } 13 | var result: [[UInt8]: Int] = .init() 14 | decoded.split(separator: "\n").forEach({ 15 | let lineSplit = $0.split(separator: " ") 16 | guard let first = lineSplit.first, 17 | let key = String(first).base64Decoded(), 18 | let value = lineSplit.last 19 | else { 20 | return 21 | } 22 | result[key.uInt8] = Int(value) 23 | }) 24 | return result 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LogicSage/Tiktoken/Ranks.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Ranks.swift 3 | // 4 | // 5 | // Created by Alberto Espinilla Garrido on 17/5/23. 6 | // 7 | 8 | import Foundation 9 | 10 | typealias Ranks = [[UInt8]: Int] 11 | 12 | extension Ranks { 13 | var inverted: [Int: [UInt8]] { 14 | reduce(into: [:], { $0[$1.value] = $1.key }) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LogicSage/Tiktoken/Tiktoken.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct Tiktoken { 4 | 5 | public static let shared: Tiktoken = .init() 6 | 7 | private init() {} 8 | 9 | public func getEncoding(_ name: String) async throws -> Encoding? { 10 | guard let vocab = TikiModel.getEncoding(name) else { return nil } 11 | let encoder = await loadRanks(vocab) 12 | let regex = try NSRegularExpression(pattern: vocab.pattern) 13 | let encoding = Encoding(name: name, regex: regex, mergeableRanks: encoder, specialTokens: vocab.specialTokens) 14 | return encoding 15 | } 16 | 17 | // public func getEncoding(for vocab: Vocab) -> Encoding? { 18 | // return nil 19 | // } 20 | // 21 | // public func register() { 22 | // // TODO: Register model and Encoding 23 | // } 24 | // 25 | // public func clear() { 26 | // // TODO: Clear all cached encoding 27 | // } 28 | } 29 | 30 | private extension Tiktoken { 31 | func loadRanks(_ vocab: Vocab) async -> [[UInt8]: Int] { 32 | if ["gpt2", "gpt3"].contains(vocab.name) { 33 | return await Load.dataGymToMergeableBpeRanks(vocabBpeFile: vocab.url) 34 | } else { 35 | return await Load.loadTiktokenBpe(url: vocab.url) 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LogicSage/ZIPFoundation/Archive+ReadingDeprecated.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Archive+ReadingDeprecated.swift 3 | // ZIPFoundation 4 | // 5 | // Copyright © 2017-2021 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors. 6 | // Released under the MIT License. 7 | // 8 | // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information. 9 | // 10 | 11 | import Foundation 12 | 13 | public extension Archive { 14 | 15 | @available(*, deprecated, 16 | message: "Please use `Int` for `bufferSize`.") 17 | func extract(_ entry: Entry, to url: URL, bufferSize: UInt32, skipCRC32: Bool = false, 18 | progress: Progress? = nil) throws -> CRC32 { 19 | try self.extract(entry, to: url, bufferSize: Int(bufferSize), skipCRC32: skipCRC32, progress: progress) 20 | } 21 | 22 | @available(*, deprecated, 23 | message: "Please use `Int` for `bufferSize`.") 24 | func extract(_ entry: Entry, bufferSize: UInt32, skipCRC32: Bool = false, 25 | progress: Progress? = nil, consumer: Consumer) throws -> CRC32 { 26 | try self.extract(entry, bufferSize: Int(bufferSize), skipCRC32: skipCRC32, 27 | progress: progress, consumer: consumer) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LogicSage/ZIPFoundation/Data+CompressionDeprecated.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Data+CompressionDeprecated.swift 3 | // ZIPFoundation 4 | // 5 | // Copyright © 2017-2021 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors. 6 | // Released under the MIT License. 7 | // 8 | // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information. 9 | // 10 | 11 | import Foundation 12 | 13 | public extension Data { 14 | 15 | @available(*, deprecated, message: "Please use `Int64` for `size` and provider `position`.") 16 | static func compress(size: Int, bufferSize: Int, 17 | provider: (_ position: Int, _ size: Int) throws -> Data, 18 | consumer: Consumer) throws -> CRC32 { 19 | let newProvider: Provider = { try provider(Int($0), $1) } 20 | return try self.compress(size: Int64(size), bufferSize: bufferSize, provider: newProvider, consumer: consumer) 21 | } 22 | 23 | @available(*, deprecated, message: "Please use `Int64` for `size` and provider `position`.") 24 | static func decompress(size: Int, bufferSize: Int, skipCRC32: Bool, 25 | provider: (_ position: Int, _ size: Int) throws -> Data, 26 | consumer: Consumer) throws -> CRC32 { 27 | let newProvider: Provider = { try provider(Int($0), $1) } 28 | return try self.decompress(size: Int64(size), bufferSize: bufferSize, skipCRC32: skipCRC32, 29 | provider: newProvider, consumer: consumer) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LogicSage/ZIPFoundation/URL+ZIP.swift: -------------------------------------------------------------------------------- 1 | // 2 | // URL+ZIP.swift 3 | // ZIPFoundation 4 | // 5 | // Copyright © 2017-2021 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors. 6 | // Released under the MIT License. 7 | // 8 | // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information. 9 | // 10 | 11 | import Foundation 12 | 13 | extension URL { 14 | 15 | static func temporaryReplacementDirectoryURL(for archive: Archive) -> URL { 16 | #if swift(>=5.0) || os(macOS) || os(iOS) || os(watchOS) || os(tvOS) 17 | if archive.url.isFileURL, 18 | let tempDir = try? FileManager().url(for: .itemReplacementDirectory, in: .userDomainMask, 19 | appropriateFor: archive.url, create: true) { 20 | return tempDir 21 | } 22 | #endif 23 | 24 | return URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent( 25 | ProcessInfo.processInfo.globallyUniqueString) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LogicSageCommandLine.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LogicSageCommandLine.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LogicSageCommandLine.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LogicSageCommandLine.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LogicSageForMacOS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/LogicSageForMacOS.png -------------------------------------------------------------------------------- /MacSageApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1.0 21 | NSMicrophoneUsageDescription 22 | Uses your microphone to capture your voice commands 23 | NSSpeechRecognitionUsageDescription 24 | Uses Speech recognition so you can talk to the robots 25 | LSApplicationCategoryType 26 | 27 | NSSupportsSuddenTermination 28 | 29 | NSSupportsAutomaticTermination 30 | 31 | NSAppleEventsUsageDescription 32 | Uses apple events to control your computer 33 | NSSystemAdministrationUsageDescription 34 | Uses administrator rights to take screenshots 35 | UILaunchScreen 36 | 37 | LSUIElement 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // MacSageApp 4 | // 5 | // Created by Chris Dillard on 4/22/23. 6 | // 7 | 8 | import SwiftUI 9 | let logoAscii6 = """ 10 | ╭╮╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮ 11 | ┃┃╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃ 12 | ┃┃╱╱╭━━┳━━┳┳━━┫╰━━┳━━┳━━┳━━╮ 13 | ┃┃╱╭┫╭╮┃╭╮┣┫╭━┻━━╮┃╭╮┃╭╮┃┃━┫ 14 | ┃╰━╯┃╰╯┃╰╯┃┃╰━┫╰━╯┃╭╮┃╰╯┃┃━┫ 15 | ╰━━━┻━━┻━╮┣┻━━┻━━━┻╯╰┻━╮┣━━╯ 16 | ╱╱╱╱╱╱╱╭━╯┃╱╱╱╱╱╱╱╱╱╱╭━╯┃ 17 | ╱╱╱╱╱╱╱╰━━╯╱╱╱╱╱╱╱╱╱╱╰━━╯ 18 | """ 19 | struct ContentView: View { 20 | var body: some View { 21 | VStack { 22 | Text(logoAscii6) 23 | .font(.system(size: 20, design: .monospaced)) 24 | .minimumScaleFactor(0.05) 25 | .foregroundColor(.accentColor) 26 | } 27 | .frame(maxWidth: .infinity, maxHeight: .infinity) 28 | 29 | .ignoresSafeArea() 30 | .background(Color.black) 31 | } 32 | } 33 | 34 | struct ContentView_Previews: PreviewProvider { 35 | static var previews: some View { 36 | ContentView() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp/MacSageApp.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MacSageApp/MacSageApp/MacSageAppApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MacSageAppApp.swift 3 | // MacSageApp 4 | // 5 | // Created by Chris Dillard on 4/22/23. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct MacSageAppApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | .ignoresSafeArea() 16 | .background(Color.black) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SimulatorScreenshot-AppleVisionPro-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/SimulatorScreenshot-AppleVisionPro-2.png -------------------------------------------------------------------------------- /SimulatorScreenshot-AppleVisionPro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/SimulatorScreenshot-AppleVisionPro.png -------------------------------------------------------------------------------- /SwiftSageServer/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftSageServer/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.8 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "SwiftSageServer", 6 | platforms: [ 7 | .macOS(.v12) 8 | ], 9 | dependencies: [ 10 | // 💧 A server-side Swift web framework. 11 | .package(url: "https://github.com/vapor/vapor.git", .branch("main")), 12 | ], 13 | targets: [ 14 | .executableTarget( 15 | name: "App", 16 | dependencies: [ 17 | .product(name: "Vapor", package: "vapor") 18 | ], 19 | resources: [ 20 | .process("GPT-Info.plist")], 21 | swiftSettings: [ 22 | // Enable better optimizations when building in Release configuration. Despite the use of 23 | // the `.unsafeFlags` construct required by SwiftPM, this flag is recommended for Release 24 | // builds. See for details. 25 | .unsafeFlags(["-cross-module-optimization"], .when(configuration: .release)) 26 | ] 27 | ), 28 | .testTarget(name: "AppTests", dependencies: [ 29 | .target(name: "App"), 30 | .product(name: "XCTVapor", package: "vapor"), 31 | ]) 32 | ] 33 | ) 34 | -------------------------------------------------------------------------------- /SwiftSageServer/Sources/App/GPT-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SWIFTSAGE_USERNAME 6 | 7 | SWIFTSAGE_SERVER_USERNAME 8 | 9 | SWIFTSAGE_SERVER_PASSWORD 10 | 11 | SWIFTSAGE_PASSWORD 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SwiftSageServer/Sources/App/entrypoint.swift: -------------------------------------------------------------------------------- 1 | import Vapor 2 | import Dispatch 3 | import Logging 4 | 5 | /// This extension is temporary and can be removed once Vapor gets this support. 6 | private extension Vapor.Application { 7 | static let baseExecutionQueue = DispatchQueue(label: "vapor.codes.entrypoint") 8 | 9 | func runFromAsyncMainEntrypoint() async throws { 10 | try await withCheckedThrowingContinuation { continuation in 11 | Vapor.Application.baseExecutionQueue.async { [self] in 12 | do { 13 | try self.run() 14 | continuation.resume() 15 | } catch { 16 | continuation.resume(throwing: error) 17 | } 18 | } 19 | } 20 | } 21 | } 22 | 23 | @main 24 | enum Entrypoint { 25 | static func main() async throws { 26 | var env = try Environment.detect() 27 | try LoggingSystem.bootstrap(from: &env) 28 | 29 | let app = Application(env) 30 | defer { app.shutdown() } 31 | 32 | try await configure(app) 33 | try await app.runFromAsyncMainEntrypoint() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SwiftSageServer/Sources/App/plistHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // plistHelper.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/18/23. 6 | // 7 | 8 | import Foundation 9 | 10 | class plistHelper { 11 | 12 | static func objectFor(key: String, plist: String) -> Any? { 13 | if let plistPath = Bundle.module.url(forResource: plist, withExtension: ".plist") { 14 | do { 15 | let plistData = try Data(contentsOf: plistPath) 16 | if let dict = try PropertyListSerialization.propertyList(from: plistData, format: nil) as? [String: Any] { 17 | return dict[key] 18 | } 19 | } catch { 20 | print(error) 21 | } 22 | } 23 | return nil 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SwiftSageServer/Sources/App/routes.swift: -------------------------------------------------------------------------------- 1 | import Vapor 2 | 3 | //func routes(_ app: Application) throws { 4 | // app.get { req async in 5 | // "It works!" 6 | // } 7 | // 8 | // app.get("hello") { req async -> String in 9 | // "Hello, world!" 10 | // } 11 | //} 12 | -------------------------------------------------------------------------------- /SwiftSageServer/Tests/AppTests/AppTests.swift: -------------------------------------------------------------------------------- 1 | @testable import App 2 | import XCTVapor 3 | 4 | final class AppTests: XCTestCase { 5 | func testHelloWorld() async throws { 6 | let app = Application(.testing) 7 | defer { app.shutdown() } 8 | try await configure(app) 9 | 10 | try app.test(.GET, "hello", afterResponse: { res in 11 | XCTAssertEqual(res.status, .ok) 12 | XCTAssertEqual(res.body.string, "Hello, world!") 13 | }) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SwiftSageServer/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # Docker Compose file for Vapor 2 | # 3 | # Install Docker on your system to run and test 4 | # your Vapor app in a production-like environment. 5 | # 6 | # Note: This file is intended for testing and does not 7 | # implement best practices for a production deployment. 8 | # 9 | # Learn more: https://docs.docker.com/compose/reference/ 10 | # 11 | # Build images: docker-compose build 12 | # Start app: docker-compose up app 13 | # Stop all: docker-compose down 14 | # 15 | version: '3.7' 16 | 17 | x-shared_environment: &shared_environment 18 | LOG_LEVEL: ${LOG_LEVEL:-debug} 19 | 20 | services: 21 | app: 22 | image: swift-sage-server:latest 23 | build: 24 | context: . 25 | environment: 26 | <<: *shared_environment 27 | ports: 28 | - '8080:8080' 29 | # user: '0' # uncomment to run as root for testing purposes even though Dockerfile defines 'vapor' user. 30 | command: ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"] 31 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DocumentThumbnailConfiguration 6 | 7 | accentColorHash 8 | 9 | ukeIsiaqjcLm3HQki7n2GM+oyVngwmwUe+SPaDmgsIg= 10 | 11 | appIconHash 12 | 13 | OCY1yTJb8yc9GV/xuKROWxGv19l63euIY+o1/rmMGgc= 14 | 15 | thumbnailIsPrerendered 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT-App.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.png -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/.swiftpm/xcode/package.xcworkspace/xcuserdata/sprinchar.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT-App.swiftpm/.swiftpm/xcode/package.xcworkspace/xcuserdata/sprinchar.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/.swiftpm/xcode/xcuserdata/sprinchar.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | com.chrozzla.My.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 2 11 | 12 | com.chrozzla.MyAp.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | com.chrozzla.MyApp.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 2 21 | 22 | com.chrozzla.MySwifty.xcscheme_^#shared#^_ 23 | 24 | orderHint 25 | 3 26 | 27 | com.chrozzla.MySwiftyApp.xcscheme_^#shared#^_ 28 | 29 | orderHint 30 | 4 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/Assets.xcassets/xcode_trans.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "xcode_trans.png", 5 | "idiom" : "universal" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/Assets.xcassets/xcode_trans.imageset/xcode_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT-App.swiftpm/Assets.xcassets/xcode_trans.imageset/xcode_trans.png -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/MyApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | @main 4 | struct MyApp: App { 5 | var body: some Scene { 6 | WindowGroup { 7 | ContentView() 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.6 2 | 3 | // WARNING: 4 | // This file is automatically generated. 5 | // Do not edit it by hand because the contents will be replaced. 6 | 7 | import PackageDescription 8 | import AppleProductTypes 9 | 10 | let package = Package( 11 | name: "com.chrisSwiftSage.MyApp", 12 | platforms: [ 13 | .iOS("15.2") 14 | ], 15 | products: [ 16 | .iOSApplication( 17 | name: "com.chrisSwiftSage.MyApp", 18 | targets: ["AppModule"], 19 | bundleIdentifier: "com.chrozzla.MyApp", 20 | teamIdentifier: "72WEN2C47N", 21 | displayVersion: "1.0", 22 | bundleVersion: "1", 23 | appIcon: .placeholder(icon: .paper), 24 | accentColor: .presetColor(.green), 25 | supportedDeviceFamilies: [ 26 | .pad, 27 | .phone 28 | ], 29 | supportedInterfaceOrientations: [ 30 | .portrait, 31 | .landscapeRight, 32 | .landscapeLeft, 33 | .portraitUpsideDown(.when(deviceFamilies: [.pad])) 34 | ] 35 | ) 36 | ], 37 | dependencies: [ 38 | .package(url: "https://github.com/duraidabdul/LocalConsole", .branch("main")) 39 | ], 40 | targets: [ 41 | .executableTarget( 42 | name: "AppModule", 43 | dependencies: [ 44 | .product(name: "LocalConsole", package: "localconsole") 45 | ], 46 | path: "." 47 | ) 48 | ] 49 | ) -------------------------------------------------------------------------------- /Swifty-GPT-App.swiftpm/Robot.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Robot.swift 3 | // com.chrozzla.MySwiftyApp 4 | // 5 | // Created by Chris Dillard on 4/14/23. 6 | // 7 | 8 | import SwiftUI 9 | import UIKit 10 | 11 | // Custom function to mirror an emoji 12 | func mirrorEmoji(_ emoji: String) -> UIImage? { 13 | if let image = emoji.image() { 14 | return UIImage(cgImage: image.cgImage!, scale: image.scale, orientation: .upMirrored) 15 | } 16 | return nil 17 | } 18 | 19 | extension String { 20 | func image() -> UIImage? { 21 | let size = CGSize(width: 40, height: 40) 22 | UIGraphicsBeginImageContextWithOptions(size, false, 0) 23 | UIColor.clear.set() 24 | let rect = CGRect(origin: .zero, size: size) 25 | UIRectFill(CGRect(origin: .zero, size: size)) 26 | (self as NSString).draw(in: rect, withAttributes: [.font: UIFont.systemFont(ofSize: 40)]) 27 | let image = UIGraphicsGetImageFromCurrentImageContext() 28 | UIGraphicsEndImageContext() 29 | return image 30 | } 31 | } 32 | 33 | struct RobotHead: View { 34 | var body: some View { 35 | Text("🤖") 36 | .font(.system(size: 40)) 37 | } 38 | } 39 | 40 | struct RobotLeftArm: View { 41 | var body: some View { 42 | if let mirroredImage = mirrorEmoji("🦾") { 43 | Image(uiImage: mirroredImage) 44 | } 45 | } 46 | } 47 | 48 | struct RobotRightArm: View { 49 | var body: some View { 50 | Text("🦾") 51 | .font(.system(size: 40)) 52 | } 53 | } 54 | 55 | struct RobotLeftLeg: View { 56 | var body: some View { 57 | if let mirroredImage = mirrorEmoji("🦿") { 58 | Image(uiImage: mirroredImage) 59 | } 60 | } 61 | } 62 | 63 | struct RobotRightLeg: View { 64 | var body: some View { 65 | Text("🦿") 66 | .font(.system(size: 40)) 67 | } 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /Swifty-GPT/AEyes.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AEyes.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/16/23. 6 | // 7 | 8 | import Foundation 9 | import Vision 10 | import SwiftyTesseract 11 | import CoreGraphics 12 | 13 | let tessaRectTrainingFileLoc = "tessdata_fast-main" 14 | class CustomBundle: LanguageModelDataSource { 15 | public var pathToTrainedData: String { 16 | "\(getWorkspaceFolder())\(swiftyGPTWorkspaceFirstName)/\(tessaRectTrainingFileLoc)" 17 | } 18 | } 19 | 20 | let lookInterval: TimeInterval = 30.0 21 | 22 | let eyes = AEyes() 23 | 24 | class AEyes{ 25 | 26 | } 27 | 28 | import SwiftyTesseract 29 | 30 | func startEyes() { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Swifty-GPT/AssisAI.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AssisAI.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/16/23. 6 | // 7 | 8 | import Foundation 9 | class AssistAI { 10 | var learningRate: Double 11 | var memoryCapacity: Int 12 | var feedbackSensitivity: Double 13 | 14 | var memoryStorage: [String: Any] = [:] // store user behavior and preferences 15 | 16 | init(learningRate: Double, memoryCapacity: Int, feedbackSensitivity: Double) { 17 | self.learningRate = learningRate 18 | self.memoryCapacity = memoryCapacity 19 | self.feedbackSensitivity = feedbackSensitivity 20 | } 21 | 22 | // function to process user input and update the internal model 23 | func processUserInput(input: String) { 24 | // update memory storage with user behavior and preferences 25 | // adjust internal model based on user behavior and feedback 26 | // make recommendations or provide assistance based on the updated model 27 | } 28 | 29 | // function to retrieve recommendations or assistance based on the internal model 30 | func getAssistance() -> String { 31 | // retrieve recommendations or assistance based on the internal model 32 | // may include external API calls or other external resources 33 | // return the assistance as a string 34 | return "Assistance" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Swifty-GPT/Audio/AVVoice.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AVVoice.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/22/23. 6 | // 7 | 8 | import Foundation 9 | import AVFoundation 10 | 11 | func installedVoiesArr() -> [AVSpeechSynthesisVoice] { 12 | var ret = [AVSpeechSynthesisVoice]() 13 | AVSpeechSynthesisVoice.speechVoices().forEach { 14 | ret.append($0) 15 | } 16 | return ret 17 | } 18 | -------------------------------------------------------------------------------- /Swifty-GPT/Command/ApplescriptCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ApplescriptCommand.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/19/23. 6 | // 7 | 8 | import Foundation 9 | 10 | // Function to execute an high level Xcode Shell/ Ruby / AppleScript command 11 | func executeAppleScriptCommand(_ command: XcodeCommand, completion: @escaping (Bool, [String]) -> Void) { 12 | if !command.appleScript.isEmpty { 13 | 14 | let appleScriptCommand = command.appleScript 15 | let script = NSAppleScript(source: appleScriptCommand) 16 | var errorDict: NSDictionary? = nil 17 | multiPrinter("Executing AppleScript: \(command)") 18 | 19 | script?.executeAndReturnError(&errorDict) 20 | if let error = errorDict { 21 | multiPrinter("AppleScript Error: \(error)") 22 | completion(false,[error.description]) 23 | } 24 | else { 25 | completion(true, []) 26 | } 27 | } else { 28 | multiPrinter("Unsupported command") 29 | completion(false, config.globalErrors) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Swifty-GPT/Command/Multiprinter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Multiprinter.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 5/1/23. 6 | // 7 | 8 | import Foundation 9 | 10 | 11 | // TODO: FIX THIS AWFUL HACK. WE can send to the right recipient somehow, I'm sure :). 12 | func multiPrinter2(_ items: Any..., separator: String = " ", terminator: String = "\n") { 13 | for username in [ SWIFTSAGE_USERNAME] { 14 | 15 | if !swiftSageIOSEnabled { 16 | print(items, separator: separator, terminator: terminator) 17 | return 18 | } 19 | 20 | if items.count == 1, let singleString = items.first as? String { 21 | print(items, separator: separator, terminator: terminator) 22 | localPeerConsole.sendLog(to: username, text: singleString) 23 | return 24 | } 25 | // Otherwise, handle the items as a collection of strings 26 | for item in items { 27 | if let str = item as? String { 28 | print(str, separator: separator, terminator: terminator) 29 | localPeerConsole.sendLog(to: username, text: str) 30 | } 31 | } 32 | } 33 | } 34 | 35 | func multiPrinter(_ items: Any..., separator: String = " ", terminator: String = "\n") { 36 | multiPrinter3(items, separator: separator, terminator: terminator) 37 | multiPrinter2(items, separator: separator, terminator: terminator) 38 | } 39 | 40 | 41 | func multiPrinter3(_ items: Any..., separator: String = " ", terminator: String = "\n") { 42 | } 43 | -------------------------------------------------------------------------------- /Swifty-GPT/Command/Project.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Project.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 8/17/23. 6 | // 7 | 8 | import Foundation 9 | 10 | struct Project: Identifiable, Codable { 11 | var id = UUID() 12 | var name: String 13 | var organizationName: String 14 | var identifier: String 15 | var projectTemplate: String 16 | var location: String 17 | var fileSystemItems: [FileSystemItem] 18 | } 19 | struct FileSystemItem: Identifiable, Codable { 20 | var id = UUID() 21 | var name: String 22 | var isDirectory: Bool 23 | var children: [FileSystemItem]? 24 | } 25 | -------------------------------------------------------------------------------- /Swifty-GPT/Command/WorkspaceCommands.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImageAssetCommands.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 5/10/23. 6 | // 7 | 8 | import Foundation 9 | import ZIPFoundation 10 | 11 | // Replace contents of swifty-gpt workspace with provided zip contents 12 | func uploadCommand(input: String) { 13 | multiPrinter("performing uploading") 14 | } 15 | func downloadCommand(input: String) { 16 | multiPrinter("performing downloading") 17 | 18 | 19 | // zip swiftygptworkspace/workspace 20 | do { 21 | do { 22 | try FileManager.default.removeItem(atPath: pathToOutputArchiveOfWorkspace()) 23 | } 24 | catch { 25 | multiPrinter("failed to zip workspace") 26 | } 27 | let inputDir = URL(fileURLWithPath: pathToWorkspace()) 28 | let outputArchiveURL = URL(fileURLWithPath: pathToOutputArchiveOfWorkspace()) 29 | 30 | try FileManager.default.zipItem(at: inputDir, to: outputArchiveURL) 31 | 32 | multiPrinter("zip success") 33 | 34 | do { 35 | let data = try Data(contentsOf: outputArchiveURL) 36 | multiPrinter("got data from url zip success") 37 | 38 | localPeerConsole.sendWorkspaceData(data) 39 | multiPrinter("sendWorkspaceData success") 40 | 41 | } 42 | catch { 43 | multiPrinter("failed to get data") 44 | } 45 | 46 | } 47 | catch { 48 | multiPrinter("failed to zip workspace") 49 | } 50 | } 51 | func pathToWorkspace() -> String { 52 | "\(getWorkspaceFolder())\(swiftyGPTWorkspaceName)/" 53 | } 54 | func pathToOutputArchiveOfWorkspace() -> String { 55 | "\(getWorkspaceFolder())\("workspace_archive.zip")" 56 | } 57 | -------------------------------------------------------------------------------- /Swifty-GPT/Command/XcodeProjHandler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XcodeProjHandler.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 8/17/23. 6 | // 7 | 8 | import Foundation 9 | import XcodeProj 10 | import PathKit 11 | 12 | func processXcodeProject(path: String) throws -> [FileSystemItem] { 13 | // let projectPath = URL(fileURLWithPath: path) 14 | let project = try XcodeProj(path: Path(path)) 15 | guard let mainGroup = project.pbxproj.rootObject?.mainGroup else { 16 | print("fail") 17 | throw XCodeProjError.notFound(path: Path(path)) 18 | } 19 | return processGroup(pbGroup: mainGroup) 20 | } 21 | 22 | func processGroup(pbGroup: PBXGroup) -> [FileSystemItem] { 23 | guard let children = pbGroup.children as? [PBXFileElement] else { 24 | return [] 25 | } 26 | 27 | return children.compactMap { child in 28 | if let file = child as? PBXFileReference { 29 | return FileSystemItem(name: file.name ?? file.path ?? "Untitled", isDirectory: false, children: nil) 30 | } 31 | 32 | if let group = child as? PBXGroup { 33 | return FileSystemItem(name: group.name ?? group.path ?? "Unnamed Group", isDirectory: true, children: processGroup(pbGroup: group)) 34 | } 35 | 36 | return nil 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Swifty-GPT/Command/Xcodegen.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Xcodegen.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/12/23. 6 | // 7 | 8 | import Foundation 9 | 10 | // TODO: Fix hardcoded paths to Info.plist. 11 | func createNewProject(projectName: String, projectDirectory: String, completion: @escaping (Bool) -> Void) { 12 | let projectSpec = """ 13 | name: \(projectName) 14 | targets: 15 | \(projectName): 16 | type: application 17 | platform: iOS 18 | deploymentTarget: "16.0" 19 | sources: [Sources] 20 | info: 21 | path: \(infoPlistPath) 22 | properties: 23 | CFBundleVersion: "1.0" 24 | UILaunchScreen: [] 25 | 26 | settings: 27 | base: 28 | PRODUCT_BUNDLE_IDENTIFIER: com.example.\(projectName) 29 | INFOPLIST_FILE: \(infoPlistPath) 30 | """ 31 | 32 | // TODO: Fix harcoded path to xcodegen. 33 | let projectSpecPath = "\(projectDirectory)\(projectName)/project.yml" 34 | let createProjectScript = """ 35 | mkdir -p \(projectDirectory)/\(projectName)/Sources 36 | echo '\(projectSpec)' > \(projectSpecPath) 37 | \(xcodegenPath) generate --spec \(projectSpecPath) --project \(projectDirectory) 38 | """ 39 | 40 | let task = Process() 41 | task.launchPath = "/bin/zsh" 42 | task.arguments = ["-c", createProjectScript] 43 | task.launch() 44 | task.waitUntilExit() 45 | 46 | let status = task.terminationStatus 47 | if status == 0 { 48 | multiPrinter("Project created successfully") 49 | completion(true) 50 | } else { 51 | multiPrinter("Error creating project") 52 | completion(false) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Swifty-GPT/GPT-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GOOGLE_KEY 6 | 7 | OPEN_AI_KEY 8 | 9 | GOOGLE_SEARCH_ID 10 | 11 | NYTIMES_KEY 12 | 13 | NYTIMES_SECRET 14 | 15 | SWIFTSAGE_USERNAME 16 | 17 | SWIFTSAGE_SERVER_USERNAME 18 | 19 | SWIFTSAGE_SERVER_PASSWORD 20 | 21 | SWIFTSAGE_PASSWORD 22 | 23 | PIXABAY_KEY 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Swifty-GPT/IdeaText: -------------------------------------------------------------------------------- 1 | Your appDesc prompt containing new lines or code. 2 | 3 | Battery Tracker: 4 | Helps robots monitor charge, 5 | Buzz when drained, recharge. 6 | -------------------------------------------------------------------------------- /Swifty-GPT/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(EXECUTABLE_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1.0 21 | NSMicrophoneUsageDescription 22 | Uses your microphone to capture your voice commands 23 | NSSpeechRecognitionUsageDescription 24 | Uses Speech recognition so you can talk to the robots 25 | NSCameraUsageDescription 26 | Uses your screen to capture your window content. 27 | LSApplicationCategoryType 28 | Tools 29 | NSSupportsSuddenTermination 30 | 31 | NSSupportsAutomaticTermination 32 | 33 | NSAppleEventsUsageDescription 34 | Uses apple events to control your computer 35 | NSSystemAdministrationUsageDescription 36 | Uses administrator rights to take screenshots 37 | UILaunchScreen 38 | 39 | NSBonjourServices 40 | 41 | __sagess_tcp 42 | 43 | NSLocalNetworkUsageDescription 44 | Uses local network to communicate with LogicSage 45 | 46 | 47 | -------------------------------------------------------------------------------- /Swifty-GPT/InputText: -------------------------------------------------------------------------------- 1 | I want you to act as a storyteller. You will come up with entertaining stories that are engaging, imaginative and captivating for the audience. It can be fairy tales, educational stories or any other type of stories which has the potential to capture people's attention and imagination. Depending on the target audience, you may choose specific themes or topics for your storytelling session e.g., if it’s children then you can talk about animals; If it’s adults then history-based tales might engage them better etc. My first request is "I need an interesting story on perseverance." -------------------------------------------------------------------------------- /Swifty-GPT/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.8 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "Swifty-GPT", 8 | targets: [ 9 | // Targets are the basic building blocks of a package, defining a module or a test suite. 10 | // Targets can depend on other targets in this package and products from dependencies. 11 | .executableTarget( 12 | name: "Swifty-GPT", 13 | path: "Sources"), 14 | ] 15 | ) 16 | -------------------------------------------------------------------------------- /Swifty-GPT/PromptLibrary.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PromptLibrary.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/17/23. 6 | // 7 | // 8 | // PromptLibrary.swift 9 | // 10 | // 11 | // Created by Chris Dillard on 4/17/23. 12 | // 13 | 14 | import Foundation 15 | class PromptLibrary { 16 | 17 | static var promptLib: [String] = [ 18 | 19 | "that displays the following text using a typewriter animation: You are feeling very sleepy...", 20 | 21 | "containing a color picker and a label that says `Hi bud` which changes color based on the picker.", 22 | 23 | "that displays a scrollable grid with many random SF Symbols and the symbol name in each square. Tapping an symbol should go to a new screen with facts about that symbol.", 24 | 25 | "containing a list of hilarious jokes related to Swift Programming", 26 | 27 | // "that displays a 3d scene. Show 3 spheres and a ground plane. Attach physics body to spheres so they react to gravity.", 28 | 29 | // "that displays a spiraling swirling line across the entire screen. It should use colors from a matching color palette.", 30 | 31 | "for an iOS app that displays an interactive Mandelbrot set fractal. The app should allow users to zoom in and out, and pan the fractal using touch gestures. The fractal should be rendered in real-time, with adjustable color schemes. Include code for basic touch gesture handling and the fractal generation algorithm.", 32 | 33 | "that shows a wave using sin function. Animate the wave by changing the value passed to sin over time.", 34 | 35 | "that displays an animation of three squares animating into place. One from the top of the screen, one from the left, and one from the bottom.", 36 | 37 | "that displays and animates randomly all the emoji related to plants and green across the screen in random locations.", 38 | 39 | ] 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Swifty-GPT/Reminders.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Reminders.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/28/23. 6 | // 7 | 8 | import Foundation 9 | 10 | class Reminders { 11 | // Integrate with Apples Reminders app and provide timely information. 12 | } 13 | -------------------------------------------------------------------------------- /Swifty-GPT/Spotify.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Spotify.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/25/23. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /Swifty-GPT/StarTrekSimuilator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StarTrekSimuilator.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/28/23. 6 | // 7 | 8 | import Foundation 9 | let laForge = """ 10 | Geordi : 11 | "You know, I've always thought technology could solve almost any problem. It enhances the quality of our lives, lets us travel across the galaxy, even gave me my vision. But sometimes you just have to turn it all off." 12 | to holo-Leah; on the solution to their problem 13 | TNG : Booby Trap 14 | Bochra : 15 | "And they let you live?" 16 | Geordi : 17 | "Of course they let me live! What kind of question is that?" 18 | 19 | On Geordi's parents reaction to his being born blind. 20 | TNG : The Enemy 21 | Kurn : 22 | "How long has the bird been dead? It appears to have been lying in the sun for quite some time." 23 | Geordi : 24 | "It's not dead, it's been replicated. You do understand that we cook most of our foods?" 25 | Kurn : 26 | "Ah, yes... I was told to prepare for that. I shall try some of your burned replicated bird meat." 27 | TNG : Sins of the Father 28 | Geordi : 29 | "Maybe I'm not make myself clear, Guinan. Barclay, well, he's always late. The man's nervous. Nobody wants to be around this guy." 30 | Guinan : 31 | "If I felt that nobody wanted to be around me, I'd probably be late and nervous too." 32 | Geordi : 33 | "Guinan, that's not the point!" 34 | Guinan : 35 | "Are you sure?" 36 | TNG : Hollow Pursuits 37 | Barclay : 38 | "Being afraid all the time, of forgetting somebody's name, not knowing what to do with your hands. I mean, I'm the guy who writes down things to remember to say when there's a party. And then when he finally get there, he winds up alone in the corner trying to look comfortable examining a potted plant." 39 | Geordi : 40 | "You're just shy, Barclay!" 41 | """ 42 | -------------------------------------------------------------------------------- /Swifty-GPT/Stocks.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Stocks.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/28/23. 6 | // 7 | 8 | import Foundation 9 | 10 | class Stocks { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.dSYM/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.SwiftSageStatusBar 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.dSYM/Contents/Resources/DWARF/SwiftSageStatusBar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar.dSYM/Contents/Resources/DWARF/SwiftSageStatusBar -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/Project/arm64-apple-macos.swiftsourceinfo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar.swiftmodule/Project/arm64-apple-macos.swiftsourceinfo -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/arm64-apple-macos.abi.json: -------------------------------------------------------------------------------- 1 | { 2 | "ABIRoot": { 3 | "kind": "Root", 4 | "name": "TopLevel", 5 | "printedName": "TopLevel", 6 | "json_format_version": 8 7 | }, 8 | "ConstValues": [] 9 | } -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/arm64-apple-macos.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar.swiftmodule/arm64-apple-macos.swiftdoc -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/arm64-apple-macos.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar.swiftmodule/arm64-apple-macos.swiftmodule -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/x86_64-apple-macos.abi.json: -------------------------------------------------------------------------------- 1 | { 2 | "ABIRoot": { 3 | "kind": "Root", 4 | "name": "TopLevel", 5 | "printedName": "TopLevel", 6 | "json_format_version": 8 7 | }, 8 | "ConstValues": [] 9 | } -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/x86_64-apple-macos.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar.swiftmodule/x86_64-apple-macos.swiftdoc -------------------------------------------------------------------------------- /Swifty-GPT/SwiftSageStatusBar.swiftmodule/x86_64-apple-macos.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/SwiftSageStatusBar.swiftmodule/x86_64-apple-macos.swiftmodule -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DocumentThumbnailConfiguration 6 | 7 | accentColorHash 8 | 9 | MFe13OMFARMJ8HDqD5bDNSWxDg9LDdv8oq4TvGw4ZwM= 10 | 11 | appIconHash 12 | 13 | JvhWfyVpGCKUw/pbn5yyJwtVTu9ii0wUnPgqQoiP9K4= 14 | 15 | thumbnailIsPrerendered 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/Swifty-GPT-App.swiftpm/.swiftpm/playgrounds/DocumentThumbnail.png -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/.swiftpm/playgrounds/Workspace.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AppSettings 6 | 7 | appIconPlaceholderGlyphName 8 | box 9 | appSettingsVersion 10 | 1 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/Assets.xcassets/xcode_trans.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "xcode_trans.png", 5 | "idiom" : "universal" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/Assets.xcassets/xcode_trans.imageset/xcode_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/Swifty-GPT-App.swiftpm/Assets.xcassets/xcode_trans.imageset/xcode_trans.png -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/MyApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | @main 4 | struct MyApp: App { 5 | var body: some Scene { 6 | WindowGroup { 7 | ContentView() 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.8 2 | 3 | // WARNING: 4 | // This file is automatically generated. 5 | // Do not edit it by hand because the contents will be replaced. 6 | 7 | import PackageDescription 8 | import AppleProductTypes 9 | 10 | let package = Package( 11 | name: "Swifty-GPT", 12 | platforms: [ 13 | .iOS("16.0") 14 | ], 15 | products: [ 16 | .iOSApplication( 17 | name: "Swifty-GPT", 18 | targets: ["AppModule"], 19 | displayVersion: "1.0", 20 | bundleVersion: "1", 21 | appIcon: .placeholder(icon: .tv), 22 | accentColor: .presetColor(.green), 23 | supportedDeviceFamilies: [ 24 | .pad, 25 | .phone 26 | ], 27 | supportedInterfaceOrientations: [ 28 | .portrait, 29 | .landscapeRight, 30 | .landscapeLeft, 31 | .portraitUpsideDown(.when(deviceFamilies: [.pad])) 32 | ] 33 | ) 34 | ], 35 | targets: [ 36 | .executableTarget( 37 | name: "AppModule", 38 | path: ".", 39 | swiftSettings: [ 40 | .enableUpcomingFeature("BareSlashRegexLiterals") 41 | ] 42 | ) 43 | ] 44 | ) -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-App.swiftpm/Robot.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | import SwiftUI 4 | import UIKit 5 | 6 | // Custom function to mirror an emoji 7 | func mirrorEmoji(_ emoji: String) -> UIImage? { 8 | if let image = emoji.image() { 9 | return UIImage(cgImage: image.cgImage!, scale: image.scale, orientation: .upMirrored) 10 | } 11 | return nil 12 | } 13 | 14 | extension String { 15 | func image() -> UIImage? { 16 | let size = CGSize(width: 40, height: 40) 17 | UIGraphicsBeginImageContextWithOptions(size, false, 0) 18 | UIColor.clear.set() 19 | let rect = CGRect(origin: .zero, size: size) 20 | UIRectFill(CGRect(origin: .zero, size: size)) 21 | (self as NSString).draw(in: rect, withAttributes: [.font: UIFont.systemFont(ofSize: 40)]) 22 | let image = UIGraphicsGetImageFromCurrentImageContext() 23 | UIGraphicsEndImageContext() 24 | return image 25 | } 26 | } 27 | 28 | struct RobotHead: View { 29 | var body: some View { 30 | Text("🤖") 31 | .font(.system(size: 40)) 32 | } 33 | } 34 | 35 | struct RobotLeftArm: View { 36 | var body: some View { 37 | if let mirroredImage = mirrorEmoji("🦾") { 38 | Image(uiImage: mirroredImage) 39 | } 40 | } 41 | } 42 | 43 | struct RobotRightArm: View { 44 | var body: some View { 45 | Text("🦾") 46 | .font(.system(size: 40)) 47 | } 48 | } 49 | 50 | struct RobotLeftLeg: View { 51 | var body: some View { 52 | if let mirroredImage = mirrorEmoji("🦿") { 53 | Image(uiImage: mirroredImage) 54 | } 55 | } 56 | } 57 | 58 | struct RobotRightLeg: View { 59 | var body: some View { 60 | Text("🦿") 61 | .font(.system(size: 40)) 62 | } 63 | } 64 | 65 | 66 | -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "whisper.h" 6 | -------------------------------------------------------------------------------- /Swifty-GPT/Swifty-GPT.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.application-groups 8 | 9 | com.apple.security.assets.movies.read-write 10 | 11 | com.apple.security.assets.music.read-write 12 | 13 | com.apple.security.assets.pictures.read-write 14 | 15 | com.apple.security.automation.apple-events 16 | 17 | com.apple.security.cs.allow-dyld-environment-variables 18 | 19 | com.apple.security.cs.allow-jit 20 | 21 | com.apple.security.cs.allow-unsigned-executable-memory 22 | 23 | com.apple.security.cs.debugger 24 | 25 | com.apple.security.cs.disable-executable-page-protection 26 | 27 | com.apple.security.cs.disable-library-validation 28 | 29 | com.apple.security.device.audio-input 30 | 31 | com.apple.security.device.camera 32 | 33 | com.apple.security.files.downloads.read-write 34 | 35 | com.apple.security.files.user-selected.read-write 36 | 37 | com.apple.security.get-task-allow 38 | 39 | com.apple.security.inherit 40 | 41 | com.apple.security.network.client 42 | 43 | com.apple.security.network.server 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Swifty-GPT/Utilities/Files.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Files.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/15/23. 6 | // 7 | 8 | import Foundation 9 | 10 | func writeFile(fileContent: String, filePath: String) -> Bool { 11 | 12 | let modifiedFileContent = fileContent.replacingOccurrences(of: "\\n", with: "\n") 13 | // Create a new Swift file 14 | if let data = modifiedFileContent.data(using: .utf8) { 15 | do { 16 | try data.write(to: URL(fileURLWithPath: filePath)) 17 | return true 18 | } 19 | catch { 20 | multiPrinter("Error writing file: \(error) @ p = \(filePath)") 21 | return false 22 | } 23 | } 24 | return false 25 | } 26 | 27 | func createFile(projectPath: String, projectName: String, targetName: String, filePath: String, fileContent: String) -> Bool { 28 | 29 | let wroteSuccessfully = writeFile(fileContent: fileContent, filePath: filePath) 30 | 31 | if !wroteSuccessfully { 32 | print ("failed to write file when adding it.") 33 | return false 34 | } 35 | 36 | // Add the file to the project using xcodeproj gem 37 | let task = Process() 38 | task.executableURL = URL(fileURLWithPath: "/usr/bin/env") 39 | task.arguments = [ 40 | "ruby", 41 | rubyScriptPath, 42 | projectPath, 43 | filePath, 44 | targetName 45 | ] 46 | 47 | do { 48 | try task.run() 49 | task.waitUntilExit() 50 | 51 | if task.terminationStatus != 0 { 52 | multiPrinter("Error: Failed to add file to the project.") 53 | return false 54 | } else { 55 | multiPrinter("File successfully added to the project.") 56 | return true 57 | } 58 | } catch { 59 | multiPrinter("Error: \(error.localizedDescription)") 60 | return false 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Swifty-GPT/Utilities/Loding.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Loading.swift 3 | // 4 | // 5 | // Created by Chris Dillard on 4/19/23. 6 | // 7 | 8 | import Foundation 9 | 10 | var termColSize = 5 11 | var spinner: LoadingSpinner = LoadingSpinner(columnCount: termColSize, spinDex: 0) 12 | let animator = TextAnimator(text: loadingText) 13 | 14 | var spinnerInt: Int = 1 15 | func startRandomSpinner() { 16 | 17 | spinnerInt = Int.random(in: 0...1) 18 | if spinnerInt == 0 && asciAnimations() { 19 | animator.start() 20 | 21 | } 22 | else { 23 | spinner.start() 24 | } 25 | } 26 | 27 | func stopRandomSpinner() { 28 | spinner.stop() 29 | 30 | if asciAnimations() { animator.stop() } 31 | multiPrinter("LogicSage:") 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Swifty-GPT/Utilities/Regex.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Regex.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/19/23. 6 | // 7 | 8 | import Foundation 9 | 10 | func extractFieldContents(_ input: String, field: String = "fileContents") -> (String, [String]) { 11 | var fileContents: [String] = [] 12 | let pattern = #""\#(field)":\s*?"((?:\\.|[^"\\]+)*)""# 13 | let regex = try! NSRegularExpression(pattern: pattern) 14 | let matches = regex.matches(in: input, options: [], range: NSRange(input.startIndex..., in: input)) 15 | 16 | for match in matches { 17 | if let fileContentRange = Range(match.range(at: 1), in: input) { 18 | var fileContent = String(input[fileContentRange]) 19 | fileContent = fileContent.replacingOccurrences(of: #"\\("")"#, with: "\"") 20 | fileContent = fileContent.replacingOccurrences(of: #"\\n"#, with: "\n") 21 | fileContents.append(fileContent.replacingOccurrences(of: "\\\"", with: "\"") 22 | .replacingOccurrences(of: "\\\\", with: "\\") 23 | .replacingOccurrences(of: "\\n", with: "\n") 24 | .replacingOccurrences(of: "\\r", with: "\r") 25 | .replacingOccurrences(of: "\\t", with: "\t")) 26 | } 27 | } 28 | 29 | // Remove the matched strings from the input 30 | let modifiedInput = regex.stringByReplacingMatches(in: input, options: [], range: NSRange(input.startIndex..., in: input), withTemplate: "\"\(field)\": \"\"") 31 | 32 | return (modifiedInput, fileContents) 33 | } 34 | -------------------------------------------------------------------------------- /Swifty-GPT/Utilities/SrcCat.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SrcCat.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/20/23. 6 | // 7 | // 8 | import Foundation 9 | import SourceKittenFramework 10 | // 11 | // 12 | func startPurring(filePath: String, cursorOffset: Int) { 13 | // TODO: CONTEXT AWARE SUGGESTIONS 14 | // // Use SourceKit for context-aware suggestions here 15 | // // Prepare a code completion request for the SourceKit service 16 | 17 | guard let fileContent = try? String(contentsOfFile: filePath, encoding: .utf8) else { 18 | multiPrinter("Error: Unable to read the Swift file") 19 | return 20 | } 21 | 22 | let request = Request.codeCompletionRequest(file: filePath, contents: fileContent, offset: ByteCount(cursorOffset), arguments: []) 23 | do { 24 | let response = try request.send() 25 | for item in response { 26 | 27 | multiPrinter(item) 28 | 29 | } 30 | } catch { 31 | multiPrinter("Error: Unable to get completion suggestions") 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Swifty-GPT/Utilities/StringSLug.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StringSLug.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/18/23. 6 | // 7 | 8 | import Foundation 9 | 10 | func preprocessStringForFilename(_ input: String) -> String { 11 | // Define a CharacterSet with the characters that are safe for filenames 12 | let safeCharacters = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.") 13 | 14 | // Replace any characters not in the safeCharacters set with an underscore 15 | let safeString = input.unicodeScalars.map { safeCharacters.contains($0) ? String($0) : "_" }.joined() 16 | 17 | return safeString 18 | } 19 | -------------------------------------------------------------------------------- /Swifty-GPT/Utilities/Terminal.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Terminal.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/15/23. 6 | // 7 | 8 | import Foundation 9 | import Darwin 10 | func getTerminalWidth() -> Int? { 11 | var windowSize = winsize() 12 | if ioctl(STDOUT_FILENO, UInt(TIOCGWINSZ), &windowSize) == 0 { 13 | return Int(windowSize.ws_col) 14 | } else { 15 | return nil 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Swifty-GPT/Utilities/plistHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // plistHelper.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/18/23. 6 | // 7 | 8 | import Foundation 9 | 10 | class plistHelper { 11 | 12 | static func objectFor(key: String, plist: String) -> Any? { 13 | if let plistPath = Bundle.main.url(forResource: plist, withExtension: ".plist") { 14 | do { 15 | let plistData = try Data(contentsOf: plistPath) 16 | if let dict = try PropertyListSerialization.propertyList(from: plistData, format: nil) as? [String: Any] { 17 | return dict[key] 18 | } 19 | } catch { 20 | multiPrinter(error) 21 | } 22 | } 23 | return nil 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Swifty-GPT/WrapSoup.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WrapSoup.swift 3 | // Swifty-GPT 4 | // 5 | // Created by Chris Dillard on 4/20/23. 6 | // 7 | 8 | import Foundation 9 | import SwiftSoup 10 | 11 | func extractText(from html: String) throws -> String { 12 | let document = try SwiftSoup.parse(html) 13 | return try document.text() 14 | } 15 | -------------------------------------------------------------------------------- /Swifty-GPT/add_file_to_project.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'xcodeproj' 4 | 5 | project_path, file_path, target_name = ARGV 6 | 7 | project = Xcodeproj::Project.open(project_path) 8 | target = project.targets.find { |t| t.name == target_name } 9 | 10 | file_ref = project.new_file(file_path) 11 | target.add_file_references([file_ref]) 12 | 13 | project.save 14 | -------------------------------------------------------------------------------- /Swifty-GPT/assets/Debate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/Debate.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/IMG_5563.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/IMG_5563.PNG -------------------------------------------------------------------------------- /Swifty-GPT/assets/IMG_5564.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/IMG_5564.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/IMG_5565.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/IMG_5565.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/IMG_5566.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/IMG_5566.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/MicAccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/MicAccess.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/Shiwfty_iPad2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/Shiwfty_iPad2.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/SwiftSageiOSforMac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/SwiftSageiOSforMac.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/Swifty-Combine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/Swifty-Combine.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/Swifty-Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/Swifty-Logo.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/Swifty-iOSx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/Swifty-iOSx.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/alien.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/alien.PNG -------------------------------------------------------------------------------- /Swifty-GPT/assets/command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/command.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/iOSsws1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/iOSsws1.PNG -------------------------------------------------------------------------------- /Swifty-GPT/assets/iOSsws2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/iOSsws2.PNG -------------------------------------------------------------------------------- /Swifty-GPT/assets/iOSsws3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/iOSsws3.PNG -------------------------------------------------------------------------------- /Swifty-GPT/assets/instruct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/instruct.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/logo.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/modez.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/modez.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/sage.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/sage.PNG -------------------------------------------------------------------------------- /Swifty-GPT/assets/sage2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/sage2.PNG -------------------------------------------------------------------------------- /Swifty-GPT/assets/swifty-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swifty-diagram.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/swifty-ios-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swifty-ios-2.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/swifty-ios-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swifty-ios-3.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/swifty-ios-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swifty-ios-4.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/swifty-ios-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swifty-ios-5.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/swifty-ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swifty-ios.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/swifty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swifty.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/swslogostack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/swslogostack.png -------------------------------------------------------------------------------- /Swifty-GPT/assets/waveApp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdillard/LogicSage/f9ff8853cd0b218f535a38589ee9bfe9bedf85b0/Swifty-GPT/assets/waveApp.png -------------------------------------------------------------------------------- /Swifty-GPT/exampleOutput/dots_boxes_prompt.txt: -------------------------------------------------------------------------------- 1 | let appDesc = "that implements classic dots and boxes game. Dots and Boxes is a classic pencil-and-paper game for two players. The game consists of a grid of dots, and the objective is to create more boxes than your opponent by connecting the dots with lines. Quick rules: 1.Players take turns drawing a horizontal or vertical line between adjacent dots.\n2.If a player completes a box (all 4 sides), they claim it and get a point.\nThe player who completes a box gets another turn. The game ends when all boxes are claimed. The player with the most boxes wins." 2 | -------------------------------------------------------------------------------- /Swifty-GPT/voice_test.swift: -------------------------------------------------------------------------------- 1 | import AppKit 2 | 3 | let synthesizer = NSSpeechSynthesizer() 4 | 5 | let voices = NSSpeechSynthesizer.availableVoices 6 | 7 | 8 | for voice in voices.reversed() { 9 | if let voiceName = NSSpeechSynthesizer.attributes(forVoice: voice)[.name] as? String { 10 | // Skip international 11 | if voiceName.contains("(") { continue } 12 | 13 | print("Voice: \(voiceName)") 14 | 15 | synthesizer.setVoice(voice) 16 | synthesizer.startSpeaking("Hi Chris, I am \(voiceName).") 17 | while synthesizer.isSpeaking { 18 | RunLoop.current.run(until: Date(timeIntervalSinceNow: 0.1)) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /copy_wallpaper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # "Please copy image heic files from `/Users/$USERNAME/Library/Application Support/com.apple.mobileAssetDesktop` and `/System/Library/Desktop Pictures` into `LogicSageWorkspace/Wallpaper`" 4 | 5 | cd ~ 6 | 7 | cp -r "Library/Application Support/com.apple.mobileAssetDesktop/" ~/Documents/LogicSageWorkspace/Wallpaper/ 8 | 9 | cp -r "/System/Library/Desktop Pictures/" ~/Documents/LogicSageWorkspace/Wallpaper/ -------------------------------------------------------------------------------- /privacy-policy.md: -------------------------------------------------------------------------------- 1 | # Privacy Policy 2 | 3 | LogicSage takes your privacy seriously. To better protect your privacy I provide this privacy policy notice explaining the way your personal information is collected and used. 4 | 5 | 6 | ## Links to Third Party Websites 7 | 8 | I have included links on this app for your use and reference. I am not responsible for the privacy policies on these websites. You should be aware that the privacy policies of these websites may differ from my own. 9 | 10 | 11 | ## Security 12 | 13 | The security of your personal information is important to me, but remember that no method of transmission over the Internet, or method of electronic storage, is 100% secure. While I strive to use commercially acceptable means to protect your personal information, I cannot guarantee its absolute security. 14 | 15 | 16 | ## Changes To This Privacy Policy 17 | 18 | This Privacy Policy is effective as of 05/03/2023 and will remain in effect except with respect to any changes in its provisions in the future, which will be in effect immediately after being posted on this page. 19 | 20 | I reserve the right to update or change my Privacy Policy at any time and you should check this Privacy Policy periodically. If I make any material changes to this Privacy Policy, I will notify you by placing a prominent notice on my app. 21 | 22 | 23 | ## Contact Information 24 | 25 | For any questions or concerns regarding the privacy policy, please send me an email to (chrisbdillard@gmail.com) 26 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # TODO: Change to use passed or ENV VAR 4 | cd ~/LogicSage/ 5 | 6 | lsof -i :8080 -sTCP:LISTEN | awk 'NR > 1 {print $2}' | xargs kill -15 7 | 8 | killall SwiftSageStatusBar 9 | killall LogicSageCommandLine 10 | 11 | ### USE THIS FOR Terminal.app 12 | cwd=$(pwd) 13 | bar="${cwd}/SwiftSageServer" 14 | osascript - "$bar" <