diff --git a/core/src/main/java/com/simiacryptus/skyenet/OutputInterceptor.java b/core/src/main/java/com/simiacryptus/skyenet/core/OutputInterceptor.java similarity index 96% rename from core/src/main/java/com/simiacryptus/skyenet/OutputInterceptor.java rename to core/src/main/java/com/simiacryptus/skyenet/core/OutputInterceptor.java index 6fe7ef38..1dac9ad2 100644 --- a/core/src/main/java/com/simiacryptus/skyenet/OutputInterceptor.java +++ b/core/src/main/java/com/simiacryptus/skyenet/core/OutputInterceptor.java @@ -1,111 +1,111 @@ -package com.simiacryptus.skyenet; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.Map; -import java.util.WeakHashMap; -import java.util.concurrent.atomic.AtomicBoolean; - -public class OutputInterceptor { - - private OutputInterceptor() { - // Prevent instantiation of the utility class - } - - private static final PrintStream originalOut = System.out; - private static final PrintStream originalErr = System.err; - private static final AtomicBoolean isSetup = new AtomicBoolean(false); - private static final Object globalStreamLock = new Object(); - - public static void setupInterceptor() { - if (isSetup.getAndSet(true)) return; - System.setOut(new PrintStream(new OutputStreamRouter(originalOut))); - System.setErr(new PrintStream(new OutputStreamRouter(originalErr))); - } - - private static final ByteArrayOutputStream globalStream = new ByteArrayOutputStream(); - - private static final Map threadLocalBuffer = new WeakHashMap<>(); - - private static ByteArrayOutputStream getThreadOutputStream() { - Thread currentThread = Thread.currentThread(); - ByteArrayOutputStream outputStream; - synchronized (threadLocalBuffer) { - if ((outputStream = threadLocalBuffer.get(currentThread)) != null) return outputStream; - outputStream = new ByteArrayOutputStream(); - threadLocalBuffer.put(currentThread, outputStream); - } - return outputStream; - } - - public static String getThreadOutput() { - ByteArrayOutputStream outputStream = getThreadOutputStream(); - try { - outputStream.flush(); - } catch (IOException e) { - throw new RuntimeException(e); - } - return outputStream.toString(); - } - - public static void clearThreadOutput() { - getThreadOutputStream().reset(); - } - - public static String getGlobalOutput() { - synchronized (globalStreamLock) { - return globalStream.toString(); - } - } - - public static void clearGlobalOutput() { - synchronized (globalStreamLock) { - globalStream.reset(); - } - } - - private static class OutputStreamRouter extends ByteArrayOutputStream { - private final PrintStream originalStream; - int maxGlobalBuffer = 8 * 1024 * 1024; - int maxThreadBuffer = 1024 * 1024; - - public OutputStreamRouter(PrintStream originalStream) { - this.originalStream = originalStream; - } - - @Override - public void write(int b) { - originalStream.write(b); - synchronized (globalStreamLock) { - if (globalStream.size() > maxGlobalBuffer) { - globalStream.reset(); - } - globalStream.write(b); - } - ByteArrayOutputStream threadOutputStream = getThreadOutputStream(); - if (threadOutputStream.size() > maxThreadBuffer) { - threadOutputStream.reset(); - } - threadOutputStream.write(b); - } - - @Override - public void write(byte[] b, int off, int len) { - originalStream.write(b, off, len); - synchronized (globalStreamLock) { - if (globalStream.size() > maxGlobalBuffer) { - globalStream.reset(); - } - globalStream.write(b, off, len); - } - ByteArrayOutputStream threadOutputStream = getThreadOutputStream(); - if (threadOutputStream.size() > maxThreadBuffer) { - threadOutputStream.reset(); - } - threadOutputStream.write(b, off, len); - } - } -} - - +package com.simiacryptus.skyenet.core; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.Map; +import java.util.WeakHashMap; +import java.util.concurrent.atomic.AtomicBoolean; + +public class OutputInterceptor { + + private OutputInterceptor() { + // Prevent instantiation of the utility class + } + + private static final PrintStream originalOut = System.out; + private static final PrintStream originalErr = System.err; + private static final AtomicBoolean isSetup = new AtomicBoolean(false); + private static final Object globalStreamLock = new Object(); + + public static void setupInterceptor() { + if (isSetup.getAndSet(true)) return; + System.setOut(new PrintStream(new OutputStreamRouter(originalOut))); + System.setErr(new PrintStream(new OutputStreamRouter(originalErr))); + } + + private static final ByteArrayOutputStream globalStream = new ByteArrayOutputStream(); + + private static final Map threadLocalBuffer = new WeakHashMap<>(); + + private static ByteArrayOutputStream getThreadOutputStream() { + Thread currentThread = Thread.currentThread(); + ByteArrayOutputStream outputStream; + synchronized (threadLocalBuffer) { + if ((outputStream = threadLocalBuffer.get(currentThread)) != null) return outputStream; + outputStream = new ByteArrayOutputStream(); + threadLocalBuffer.put(currentThread, outputStream); + } + return outputStream; + } + + public static String getThreadOutput() { + ByteArrayOutputStream outputStream = getThreadOutputStream(); + try { + outputStream.flush(); + } catch (IOException e) { + throw new RuntimeException(e); + } + return outputStream.toString(); + } + + public static void clearThreadOutput() { + getThreadOutputStream().reset(); + } + + public static String getGlobalOutput() { + synchronized (globalStreamLock) { + return globalStream.toString(); + } + } + + public static void clearGlobalOutput() { + synchronized (globalStreamLock) { + globalStream.reset(); + } + } + + private static class OutputStreamRouter extends ByteArrayOutputStream { + private final PrintStream originalStream; + int maxGlobalBuffer = 8 * 1024 * 1024; + int maxThreadBuffer = 1024 * 1024; + + public OutputStreamRouter(PrintStream originalStream) { + this.originalStream = originalStream; + } + + @Override + public void write(int b) { + originalStream.write(b); + synchronized (globalStreamLock) { + if (globalStream.size() > maxGlobalBuffer) { + globalStream.reset(); + } + globalStream.write(b); + } + ByteArrayOutputStream threadOutputStream = getThreadOutputStream(); + if (threadOutputStream.size() > maxThreadBuffer) { + threadOutputStream.reset(); + } + threadOutputStream.write(b); + } + + @Override + public void write(byte[] b, int off, int len) { + originalStream.write(b, off, len); + synchronized (globalStreamLock) { + if (globalStream.size() > maxGlobalBuffer) { + globalStream.reset(); + } + globalStream.write(b, off, len); + } + ByteArrayOutputStream threadOutputStream = getThreadOutputStream(); + if (threadOutputStream.size() > maxThreadBuffer) { + threadOutputStream.reset(); + } + threadOutputStream.write(b, off, len); + } + } +} + + diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/Brain.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Brain.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/Brain.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/Brain.kt index 20501709..dcf10300 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/Brain.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Brain.kt @@ -1,216 +1,216 @@ -@file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") - -package com.simiacryptus.skyenet - -import com.simiacryptus.jopenai.models.ChatModels -import com.simiacryptus.jopenai.OpenAIClient -import com.simiacryptus.jopenai.ApiModel.* -import com.simiacryptus.jopenai.ClientUtil.toContentList -import com.simiacryptus.jopenai.models.OpenAITextModel -import com.simiacryptus.jopenai.util.JsonUtil.toJson -import com.simiacryptus.jopenai.describe.TypeDescriber -import com.simiacryptus.jopenai.describe.YamlDescriber -import org.intellij.lang.annotations.Language -import java.lang.reflect.Method -import java.lang.reflect.Modifier -import java.util.concurrent.atomic.AtomicInteger - -open class Brain( - val api: OpenAIClient, - val symbols: java.util.Map = java.util.HashMap() as java.util.Map, - val model: OpenAITextModel = ChatModels.GPT35Turbo, - private val verbose: Boolean = false, - val temperature: Double = 0.3, - val describer: TypeDescriber = YamlDescriber(), - val language: String = "Kotlin", - private val moderated: Boolean = true, - private val apiDescription: String = apiDescription(symbols, describer), -) { - private val totalInputLength = AtomicInteger(0) - private val totalOutputLength = AtomicInteger(0) - private val totalApiDescriptionLength: AtomicInteger = AtomicInteger(0) - - open fun implement(vararg prompt: String): String { - if (verbose) log.info("Prompt: \n\t" + prompt.joinToString("\n\t")) - return implement(*(getChatSystemMessages(apiDescription) + - prompt.map { ChatMessage(Role.user, it.toContentList()) }).toTypedArray() - ) - } - - fun implement( - vararg messages: ChatMessage - ): String { - var request = ChatRequest() - request = request.copy(messages = ArrayList(messages.toList())) - totalApiDescriptionLength.addAndGet(apiDescription.length) - return chat(request) - } - - @Language("TEXT") - open fun getChatSystemMessages(apiDescription: String): List = listOf( - ChatMessage( - Role.system, """ - |You will translate natural language instructions into - |an implementation using $language and the script context. - |Use ``` code blocks labeled with $language where appropriate. - |Defined symbols include ${symbols.keySet().joinToString(", ")}. - |The runtime context is described below: - | - |$apiDescription - |""".trimMargin().trim().toContentList() - ) - ) - - fun fixCommand( - previousCode: String, - error: Throwable, - output: String, - vararg promptMessages: ChatMessage - ): Pair>> { - val request = ChatRequest( - messages = ArrayList( - promptMessages.toList() + listOf( - ChatMessage( - Role.assistant, - """ - |```${language.lowercase()} - |${previousCode} - |``` - |""".trimMargin().trim().toContentList() - ), - ChatMessage( - Role.system, - """ - |The previous code failed with the following error: - | - |``` - |${error.message?.trim() ?: ""} - |``` - | - |Output: - |``` - |${output.trim()} - |``` - | - |Correct the code and try again. - |""".trimMargin().trim().toContentList() - ) - )) - ) - totalApiDescriptionLength.addAndGet(apiDescription.length) - val response = chat(request) - val codeBlocks = extractCodeBlocks(response) - return Pair(response, codeBlocks) - } - - private fun chat(_request: ChatRequest): String { - val request = _request.copy(model = model.modelName, temperature = temperature) - val json = toJson(request) - if (moderated) api.moderate(json) - totalInputLength.addAndGet(json.length) - val chatResponse = api.chat(request, model) - var response = chatResponse.choices.first().message?.content.orEmpty() - if (verbose) log.info(response) - totalOutputLength.addAndGet(response.length) - response = response.trim() - return response - } - - companion object { - private val log = org.slf4j.LoggerFactory.getLogger(Brain::class.java) - fun String.indent(indent: String = " ") = this.replace("\n", "\n$indent") - private fun joinYamlList(typeDescriptions: List) = typeDescriptions.joinToString("\n") { - "- " + it.indent() - } - - private fun Method.superMethod(): Method? { - val superMethod = declaringClass.superclasses.flatMap { it.methods.toList() } - .find { it.name == name && it.parameters.size == parameters.size } - return superMethod?.superMethod() ?: superMethod - } - - private val Class.superclasses: List> - get() { - val superclass = superclass - val supers = if (superclass == null) listOf() - else superclass.superclasses + listOf(superclass) - return (interfaces.toList() + supers).distinct() - } - - fun apiDescription(hands: java.util.Map, yamlDescriber: TypeDescriber): String { - val types = ArrayList>() - - val apiobjs = hands.entrySet().map { (name, utilityObj) -> - val clazz = Class.forName(utilityObj.javaClass.typeName) - val methods = clazz.methods - .filter { Modifier.isPublic(it.modifiers) } - .filter { it.declaringClass == clazz } - .filter { !it.isSynthetic } - .map { it.superMethod() ?: it } - .filter { it.declaringClass != Object::class.java } - types.addAll(methods.flatMap { (listOf(it.returnType) + it.parameters.map { it.type }).filter { it != clazz } }) - types.addAll(clazz.declaredClasses.filter { Modifier.isPublic(it.modifiers) }) - """ - |$name: - | operations: - | ${joinYamlList(methods.map { yamlDescriber.describe(it) }).indent().indent()} - |""".trimMargin().trim() - }.toTypedArray() - val typeDescriptions = types - .filter { !it.isPrimitive } - .filter { !it.isSynthetic } - .filter { !it.name.startsWith("java.") } - .filter { !setOf("void").contains(it.name) } - .distinct().map { - """ - |${it.simpleName}: - | ${yamlDescriber.describe(it).indent()} - """.trimMargin().trim() - }.toTypedArray() - return """ - |api_objects: - | ${apiobjs.joinToString("\n").indent()} - |components: - | schemas: - | ${typeDescriptions.joinToString("\n").indent().indent()} - """.trimMargin() - } - - fun extractCodeBlocks(response: String): List> { - val codeBlockRegex = Regex("(?s)```(.*?)\\n(.*?)```") - val languageRegex = Regex("([a-zA-Z0-9-_]+)") - - val result = mutableListOf>() - var startIndex = 0 - - val matches = codeBlockRegex.findAll(response) - if (matches.count() == 0) return listOf(Pair("text", response)) - for (match in matches) { - // Add non-code block before the current match as "text" - if (startIndex < match.range.first) { - result.add(Pair("text", response.substring(startIndex, match.range.first))) - } - - // Extract language and code - val languageMatch = languageRegex.find(match.groupValues[1]) - val language = languageMatch?.groupValues?.get(0) ?: "code" - val code = match.groupValues[2] - - // Add code block to the result - result.add(Pair(language, code)) - - // Update the start index - startIndex = match.range.last + 1 - } - - // Add any remaining non-code text after the last code block as "text" - if (startIndex < response.length) { - result.add(Pair("text", response.substring(startIndex))) - } - - return result - } - - } - +@file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") + +package com.simiacryptus.skyenet.core + +import com.simiacryptus.jopenai.ApiModel.* +import com.simiacryptus.jopenai.ClientUtil.toContentList +import com.simiacryptus.jopenai.OpenAIClient +import com.simiacryptus.jopenai.describe.TypeDescriber +import com.simiacryptus.jopenai.describe.YamlDescriber +import com.simiacryptus.jopenai.models.ChatModels +import com.simiacryptus.jopenai.models.OpenAITextModel +import com.simiacryptus.jopenai.util.JsonUtil.toJson +import org.intellij.lang.annotations.Language +import java.lang.reflect.Method +import java.lang.reflect.Modifier +import java.util.concurrent.atomic.AtomicInteger + +open class Brain( + val api: OpenAIClient, + val symbols: java.util.Map = java.util.HashMap() as java.util.Map, + val model: OpenAITextModel = ChatModels.GPT35Turbo, + private val verbose: Boolean = false, + val temperature: Double = 0.3, + val describer: TypeDescriber = YamlDescriber(), + val language: String = "Kotlin", + private val moderated: Boolean = true, + private val apiDescription: String = apiDescription(symbols, describer), +) { + private val totalInputLength = AtomicInteger(0) + private val totalOutputLength = AtomicInteger(0) + private val totalApiDescriptionLength: AtomicInteger = AtomicInteger(0) + + open fun implement(vararg prompt: String): String { + if (verbose) log.info("Prompt: \n\t" + prompt.joinToString("\n\t")) + return implement(*(getChatSystemMessages(apiDescription) + + prompt.map { ChatMessage(Role.user, it.toContentList()) }).toTypedArray() + ) + } + + fun implement( + vararg messages: ChatMessage + ): String { + var request = ChatRequest() + request = request.copy(messages = ArrayList(messages.toList())) + totalApiDescriptionLength.addAndGet(apiDescription.length) + return chat(request) + } + + @Language("TEXT") + open fun getChatSystemMessages(apiDescription: String): List = listOf( + ChatMessage( + Role.system, """ + |You will translate natural language instructions into + |an implementation using $language and the script context. + |Use ``` code blocks labeled with $language where appropriate. + |Defined symbols include ${symbols.keySet().joinToString(", ")}. + |The runtime context is described below: + | + |$apiDescription + |""".trimMargin().trim().toContentList() + ) + ) + + fun fixCommand( + previousCode: String, + error: Throwable, + output: String, + vararg promptMessages: ChatMessage + ): Pair>> { + val request = ChatRequest( + messages = ArrayList( + promptMessages.toList() + listOf( + ChatMessage( + Role.assistant, + """ + |```${language.lowercase()} + |${previousCode} + |``` + |""".trimMargin().trim().toContentList() + ), + ChatMessage( + Role.system, + """ + |The previous code failed with the following error: + | + |``` + |${error.message?.trim() ?: ""} + |``` + | + |Output: + |``` + |${output.trim()} + |``` + | + |Correct the code and try again. + |""".trimMargin().trim().toContentList() + ) + )) + ) + totalApiDescriptionLength.addAndGet(apiDescription.length) + val response = chat(request) + val codeBlocks = extractCodeBlocks(response) + return Pair(response, codeBlocks) + } + + private fun chat(_request: ChatRequest): String { + val request = _request.copy(model = model.modelName, temperature = temperature) + val json = toJson(request) + if (moderated) api.moderate(json) + totalInputLength.addAndGet(json.length) + val chatResponse = api.chat(request, model) + var response = chatResponse.choices.first().message?.content.orEmpty() + if (verbose) log.info(response) + totalOutputLength.addAndGet(response.length) + response = response.trim() + return response + } + + companion object { + private val log = org.slf4j.LoggerFactory.getLogger(Brain::class.java) + fun String.indent(indent: String = " ") = this.replace("\n", "\n$indent") + private fun joinYamlList(typeDescriptions: List) = typeDescriptions.joinToString("\n") { + "- " + it.indent() + } + + private fun Method.superMethod(): Method? { + val superMethod = declaringClass.superclasses.flatMap { it.methods.toList() } + .find { it.name == name && it.parameters.size == parameters.size } + return superMethod?.superMethod() ?: superMethod + } + + private val Class.superclasses: List> + get() { + val superclass = superclass + val supers = if (superclass == null) listOf() + else superclass.superclasses + listOf(superclass) + return (interfaces.toList() + supers).distinct() + } + + fun apiDescription(hands: java.util.Map, yamlDescriber: TypeDescriber): String { + val types = ArrayList>() + + val apiobjs = hands.entrySet().map { (name, utilityObj) -> + val clazz = Class.forName(utilityObj.javaClass.typeName) + val methods = clazz.methods + .filter { Modifier.isPublic(it.modifiers) } + .filter { it.declaringClass == clazz } + .filter { !it.isSynthetic } + .map { it.superMethod() ?: it } + .filter { it.declaringClass != Object::class.java } + types.addAll(methods.flatMap { (listOf(it.returnType) + it.parameters.map { it.type }).filter { it != clazz } }) + types.addAll(clazz.declaredClasses.filter { Modifier.isPublic(it.modifiers) }) + """ + |$name: + | operations: + | ${joinYamlList(methods.map { yamlDescriber.describe(it) }).indent().indent()} + |""".trimMargin().trim() + }.toTypedArray() + val typeDescriptions = types + .filter { !it.isPrimitive } + .filter { !it.isSynthetic } + .filter { !it.name.startsWith("java.") } + .filter { !setOf("void").contains(it.name) } + .distinct().map { + """ + |${it.simpleName}: + | ${yamlDescriber.describe(it).indent()} + """.trimMargin().trim() + }.toTypedArray() + return """ + |api_objects: + | ${apiobjs.joinToString("\n").indent()} + |components: + | schemas: + | ${typeDescriptions.joinToString("\n").indent().indent()} + """.trimMargin() + } + + fun extractCodeBlocks(response: String): List> { + val codeBlockRegex = Regex("(?s)```(.*?)\\n(.*?)```") + val languageRegex = Regex("([a-zA-Z0-9-_]+)") + + val result = mutableListOf>() + var startIndex = 0 + + val matches = codeBlockRegex.findAll(response) + if (matches.count() == 0) return listOf(Pair("text", response)) + for (match in matches) { + // Add non-code block before the current match as "text" + if (startIndex < match.range.first) { + result.add(Pair("text", response.substring(startIndex, match.range.first))) + } + + // Extract language and code + val languageMatch = languageRegex.find(match.groupValues[1]) + val language = languageMatch?.groupValues?.get(0) ?: "code" + val code = match.groupValues[2] + + // Add code block to the result + result.add(Pair(language, code)) + + // Update the start index + startIndex = match.range.last + 1 + } + + // Add any remaining non-code text after the last code block as "text" + if (startIndex < response.length) { + result.add(Pair("text", response.substring(startIndex))) + } + + return result + } + + } + } \ No newline at end of file diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/Ears.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Ears.kt similarity index 99% rename from core/src/main/kotlin/com/simiacryptus/skyenet/Ears.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/Ears.kt index 5dd9f096..680b455b 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/Ears.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Ears.kt @@ -1,10 +1,10 @@ -package com.simiacryptus.skyenet +package com.simiacryptus.skyenet.core import com.simiacryptus.jopenai.OpenAIClient -import com.simiacryptus.jopenai.proxy.ChatProxy import com.simiacryptus.jopenai.audio.AudioRecorder import com.simiacryptus.jopenai.audio.LookbackLoudnessWindowBuffer import com.simiacryptus.jopenai.audio.TranscriptionProcessor +import com.simiacryptus.jopenai.proxy.ChatProxy import org.slf4j.LoggerFactory import java.util.* import java.util.concurrent.ConcurrentLinkedDeque diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/Heart.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Heart.kt similarity index 94% rename from core/src/main/kotlin/com/simiacryptus/skyenet/Heart.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/Heart.kt index 21713d03..68877dc4 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/Heart.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Heart.kt @@ -1,40 +1,40 @@ -package com.simiacryptus.skyenet - -interface Heart { - - fun getLanguage(): String - fun run(code: String): Any? - fun validate(code: String): Throwable? - - fun wrapCode(code: String): String = code - fun wrapExecution(fn: java.util.function.Supplier): T? = fn.get() - - companion object { - private class TestObject { - @Suppress("unused") - fun square(x: Int): Int = x * x - } - private interface TestInterface { - fun square(x: Int): Int - } - @JvmStatic - fun test(factory: java.util.function.Function, Heart>) { - val testImpl = object : TestInterface { - override fun square(x: Int): Int = x * x - } - with(factory.apply(mapOf("message" to "hello"))) { - test("hello", run("message")) - } - with(factory.apply(mapOf("function" to TestObject()))) { - test(25, run("function.square(5)")) - } - with(factory.apply(mapOf("function" to testImpl))) { - test(25, run("function.square(5)")) - } - } - - private fun test(expected: T, actual: T?) { - require(expected == actual) { actual.toString() } - } - } +package com.simiacryptus.skyenet.core + +interface Heart { + + fun getLanguage(): String + fun run(code: String): Any? + fun validate(code: String): Throwable? + + fun wrapCode(code: String): String = code + fun wrapExecution(fn: java.util.function.Supplier): T? = fn.get() + + companion object { + private class TestObject { + @Suppress("unused") + fun square(x: Int): Int = x * x + } + private interface TestInterface { + fun square(x: Int): Int + } + @JvmStatic + fun test(factory: java.util.function.Function, Heart>) { + val testImpl = object : TestInterface { + override fun square(x: Int): Int = x * x + } + with(factory.apply(mapOf("message" to "hello"))) { + test("hello", run("message")) + } + with(factory.apply(mapOf("function" to TestObject()))) { + test(25, run("function.square(5)")) + } + with(factory.apply(mapOf("function" to testImpl))) { + test(25, run("function.square(5)")) + } + } + + private fun test(expected: T, actual: T?) { + require(expected == actual) { actual.toString() } + } + } } \ No newline at end of file diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/Mouth.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Mouth.kt similarity index 98% rename from core/src/main/kotlin/com/simiacryptus/skyenet/Mouth.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/Mouth.kt index 4218ea99..e1b9d6d9 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/Mouth.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/Mouth.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet +package com.simiacryptus.skyenet.core import com.google.auth.oauth2.GoogleCredentials import com.google.cloud.texttospeech.v1.* diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/ActorSystem.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ActorSystem.kt similarity index 65% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/ActorSystem.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ActorSystem.kt index 18de29fa..6bd1a647 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/ActorSystem.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ActorSystem.kt @@ -1,11 +1,13 @@ -package com.simiacryptus.skyenet.actors +package com.simiacryptus.skyenet.core.actors -import com.simiacryptus.skyenet.actors.record.* -import com.simiacryptus.skyenet.platform.DataStorage -import com.simiacryptus.skyenet.platform.Session -import com.simiacryptus.skyenet.platform.User -import com.simiacryptus.skyenet.util.FunctionWrapper -import com.simiacryptus.skyenet.util.JsonFunctionRecorder +import com.simiacryptus.skyenet.core.actors.record.CodingActorInterceptor +import com.simiacryptus.skyenet.core.actors.record.ParsedActorInterceptor +import com.simiacryptus.skyenet.core.actors.record.SimpleActorInterceptor +import com.simiacryptus.skyenet.core.platform.DataStorage +import com.simiacryptus.skyenet.core.platform.Session +import com.simiacryptus.skyenet.core.platform.User +import com.simiacryptus.skyenet.core.util.FunctionWrapper +import com.simiacryptus.skyenet.core.util.JsonFunctionRecorder import java.io.File open class ActorSystem>( diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/BaseActor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/BaseActor.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/BaseActor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/BaseActor.kt index cc78414b..c3785710 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/BaseActor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/BaseActor.kt @@ -1,10 +1,10 @@ -package com.simiacryptus.skyenet.actors +package com.simiacryptus.skyenet.core.actors import com.simiacryptus.jopenai.API -import com.simiacryptus.jopenai.models.OpenAIModel -import com.simiacryptus.jopenai.models.ChatModels -import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.ClientUtil.toContentList +import com.simiacryptus.jopenai.OpenAIClient +import com.simiacryptus.jopenai.models.ChatModels +import com.simiacryptus.jopenai.models.OpenAIModel import com.simiacryptus.jopenai.models.OpenAITextModel abstract class BaseActor( diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/CodingActor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/CodingActor.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/CodingActor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/CodingActor.kt index bcf43cb2..943cbff0 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/CodingActor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/CodingActor.kt @@ -1,17 +1,17 @@ -package com.simiacryptus.skyenet.actors +package com.simiacryptus.skyenet.core.actors import com.fasterxml.jackson.annotation.JsonIgnore import com.simiacryptus.jopenai.API -import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.ClientUtil.toContentList -import com.simiacryptus.jopenai.models.ChatModels -import com.simiacryptus.jopenai.models.OpenAITextModel -import com.simiacryptus.skyenet.Brain -import com.simiacryptus.skyenet.Brain.Companion.indent -import com.simiacryptus.skyenet.Heart -import com.simiacryptus.skyenet.OutputInterceptor +import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.describe.AbbrevWhitelistYamlDescriber import com.simiacryptus.jopenai.describe.TypeDescriber +import com.simiacryptus.jopenai.models.ChatModels +import com.simiacryptus.jopenai.models.OpenAITextModel +import com.simiacryptus.skyenet.core.Brain +import com.simiacryptus.skyenet.core.Brain.Companion.indent +import com.simiacryptus.skyenet.core.Heart +import com.simiacryptus.skyenet.core.OutputInterceptor import kotlin.reflect.KClass @Suppress("unused", "MemberVisibilityCanBePrivate") @@ -126,9 +126,9 @@ open class CodingActor( private fun fix( api: OpenAIClient, messages: Array, - result: CodingActor.CodeResultImpl, + result: CodeResultImpl, ex: Throwable - ): CodingActor.CodeResultImpl { + ): CodeResultImpl { val respondWithCode = brain(api, model).fixCommand(result.getCode(), ex, "", *messages) val renderedResponse = getRenderedResponse(respondWithCode.second) val codedInstruction = getCode(interpreter.getLanguage(), respondWithCode.second) diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/ParsedActor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedActor.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/ParsedActor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedActor.kt index 2f2eda40..85449fb9 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/ParsedActor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedActor.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.actors +package com.simiacryptus.skyenet.core.actors import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.OpenAIClient diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/ParsedResponse.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedResponse.kt similarity index 79% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/ParsedResponse.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedResponse.kt index fb19ebc8..a3eef2ae 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/ParsedResponse.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedResponse.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.actors +package com.simiacryptus.skyenet.core.actors abstract class ParsedResponse(val clazz: Class) { abstract fun getText(): String diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/SimpleActor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/SimpleActor.kt similarity index 94% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/SimpleActor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/SimpleActor.kt index 58397e67..cb4b786e 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/SimpleActor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/SimpleActor.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.actors +package com.simiacryptus.skyenet.core.actors import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.models.ChatModels diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/opt/ActorOptimization.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/opt/ActorOptimization.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/opt/ActorOptimization.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/opt/ActorOptimization.kt index 4a1cb1bf..da515d3b 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/opt/ActorOptimization.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/opt/ActorOptimization.kt @@ -1,12 +1,12 @@ -package com.simiacryptus.skyenet.actors.opt +package com.simiacryptus.skyenet.core.actors.opt import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.describe.Description import com.simiacryptus.jopenai.models.ChatModels import com.simiacryptus.jopenai.models.OpenAITextModel import com.simiacryptus.jopenai.proxy.ChatProxy -import com.simiacryptus.skyenet.actors.BaseActor -import com.simiacryptus.skyenet.actors.opt.ActorOptimization.GeneticApi.Prompt +import com.simiacryptus.skyenet.core.actors.BaseActor +import com.simiacryptus.skyenet.core.actors.opt.ActorOptimization.GeneticApi.Prompt import org.slf4j.LoggerFactory import kotlin.math.ceil import kotlin.math.ln diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/opt/Expectation.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/opt/Expectation.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/opt/Expectation.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/opt/Expectation.kt index 92b98ae9..655f039d 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/opt/Expectation.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/opt/Expectation.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.actors.opt +package com.simiacryptus.skyenet.core.actors.opt import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.models.EmbeddingModels diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/CodingActorInterceptor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/CodingActorInterceptor.kt similarity index 93% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/CodingActorInterceptor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/CodingActorInterceptor.kt index 9b23a7e1..975f83e2 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/CodingActorInterceptor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/CodingActorInterceptor.kt @@ -1,11 +1,11 @@ -package com.simiacryptus.skyenet.actors.record +package com.simiacryptus.skyenet.core.actors.record import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.models.OpenAIModel -import com.simiacryptus.skyenet.actors.CodeResult -import com.simiacryptus.skyenet.actors.CodingActor -import com.simiacryptus.skyenet.util.FunctionWrapper +import com.simiacryptus.skyenet.core.actors.CodeResult +import com.simiacryptus.skyenet.core.actors.CodingActor +import com.simiacryptus.skyenet.core.util.FunctionWrapper class CodingActorInterceptor( val inner: CodingActor, diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/ParsedActorInterceptor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/ParsedActorInterceptor.kt similarity index 89% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/ParsedActorInterceptor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/ParsedActorInterceptor.kt index 1c46efbf..004f223a 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/ParsedActorInterceptor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/ParsedActorInterceptor.kt @@ -1,10 +1,10 @@ -package com.simiacryptus.skyenet.actors.record +package com.simiacryptus.skyenet.core.actors.record import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.models.OpenAIModel -import com.simiacryptus.skyenet.actors.ParsedActor -import com.simiacryptus.skyenet.actors.ParsedResponse -import com.simiacryptus.skyenet.util.FunctionWrapper +import com.simiacryptus.skyenet.core.actors.ParsedActor +import com.simiacryptus.skyenet.core.actors.ParsedResponse +import com.simiacryptus.skyenet.core.util.FunctionWrapper class ParsedActorInterceptor( val inner: ParsedActor, diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/SimpleActorInterceptor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/SimpleActorInterceptor.kt similarity index 88% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/SimpleActorInterceptor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/SimpleActorInterceptor.kt index 707fca29..dca8af85 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/record/SimpleActorInterceptor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/SimpleActorInterceptor.kt @@ -1,9 +1,9 @@ -package com.simiacryptus.skyenet.actors.record +package com.simiacryptus.skyenet.core.actors.record import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.models.OpenAIModel -import com.simiacryptus.skyenet.actors.SimpleActor -import com.simiacryptus.skyenet.util.FunctionWrapper +import com.simiacryptus.skyenet.core.actors.SimpleActor +import com.simiacryptus.skyenet.core.util.FunctionWrapper class SimpleActorInterceptor( val inner: SimpleActor, diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/ActorTestBase.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/ActorTestBase.kt similarity index 89% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/ActorTestBase.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/ActorTestBase.kt index dd88b4a8..d1182000 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/ActorTestBase.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/ActorTestBase.kt @@ -1,8 +1,8 @@ -package com.simiacryptus.skyenet.actors.test +package com.simiacryptus.skyenet.core.actors.test import com.simiacryptus.jopenai.OpenAIClient -import com.simiacryptus.skyenet.actors.BaseActor -import com.simiacryptus.skyenet.actors.opt.ActorOptimization +import com.simiacryptus.skyenet.core.actors.BaseActor +import com.simiacryptus.skyenet.core.actors.opt.ActorOptimization import org.slf4j.LoggerFactory import org.slf4j.event.Level diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/CodingActorTestBase.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/CodingActorTestBase.kt similarity index 65% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/CodingActorTestBase.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/CodingActorTestBase.kt index 33392132..41c6cdba 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/CodingActorTestBase.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/CodingActorTestBase.kt @@ -1,9 +1,9 @@ -package com.simiacryptus.skyenet.actors.test +package com.simiacryptus.skyenet.core.actors.test -import com.simiacryptus.skyenet.Heart -import com.simiacryptus.skyenet.actors.BaseActor -import com.simiacryptus.skyenet.actors.CodeResult -import com.simiacryptus.skyenet.actors.CodingActor +import com.simiacryptus.skyenet.core.Heart +import com.simiacryptus.skyenet.core.actors.BaseActor +import com.simiacryptus.skyenet.core.actors.CodeResult +import com.simiacryptus.skyenet.core.actors.CodingActor import kotlin.reflect.KClass abstract class CodingActorTestBase : ActorTestBase() { diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/ParsedActorTestBase.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/ParsedActorTestBase.kt similarity index 68% rename from core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/ParsedActorTestBase.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/ParsedActorTestBase.kt index f271fd7d..a6ed1558 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/actors/test/ParsedActorTestBase.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/test/ParsedActorTestBase.kt @@ -1,8 +1,8 @@ -package com.simiacryptus.skyenet.actors.test +package com.simiacryptus.skyenet.core.actors.test -import com.simiacryptus.skyenet.actors.BaseActor -import com.simiacryptus.skyenet.actors.ParsedActor -import com.simiacryptus.skyenet.actors.ParsedResponse +import com.simiacryptus.skyenet.core.actors.BaseActor +import com.simiacryptus.skyenet.core.actors.ParsedActor +import com.simiacryptus.skyenet.core.actors.ParsedResponse import java.util.function.Function abstract class ParsedActorTestBase( diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/ApplicationServices.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/ApplicationServices.kt similarity index 96% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/ApplicationServices.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/ApplicationServices.kt index 156dffde..7fdd863d 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/ApplicationServices.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/ApplicationServices.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform import java.io.File diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/AuthenticationManager.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/AuthenticationManager.kt similarity index 86% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/AuthenticationManager.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/AuthenticationManager.kt index 7c3df51f..6ff7b109 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/AuthenticationManager.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/AuthenticationManager.kt @@ -1,6 +1,4 @@ -package com.simiacryptus.skyenet.platform - -import java.util.HashMap +package com.simiacryptus.skyenet.core.platform open class AuthenticationManager { diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/AuthorizationManager.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/AuthorizationManager.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/AuthorizationManager.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/AuthorizationManager.kt index a89723e8..0e5d8b58 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/AuthorizationManager.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/AuthorizationManager.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform import java.util.* diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/ClientManager.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/ClientManager.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/ClientManager.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/ClientManager.kt index 77b686dc..398fdb41 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/ClientManager.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/ClientManager.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform import com.simiacryptus.jopenai.ApiModel import com.simiacryptus.jopenai.ClientUtil diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/DataStorage.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/DataStorage.kt similarity index 99% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/DataStorage.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/DataStorage.kt index d8f31357..3dfe7dd1 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/DataStorage.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/DataStorage.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform import com.simiacryptus.jopenai.util.JsonUtil import java.io.File diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/Session.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/Session.kt similarity index 53% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/Session.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/Session.kt index 871f7645..ec2e1bce 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/Session.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/Session.kt @@ -1,6 +1,6 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform -import com.simiacryptus.skyenet.platform.DataStorage.Companion.validateSessionId +import com.simiacryptus.skyenet.core.platform.DataStorage.Companion.validateSessionId data class Session( internal val sessionId: String diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/UsageManager.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/UsageManager.kt similarity index 99% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/UsageManager.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/UsageManager.kt index a193c468..a51147f2 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/UsageManager.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/UsageManager.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform import com.simiacryptus.jopenai.models.* import com.simiacryptus.jopenai.util.JsonUtil diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/User.kt similarity index 93% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/User.kt index 6959a0ec..a601effe 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/User.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform import com.fasterxml.jackson.annotation.JsonProperty diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/UserSettingsManager.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/UserSettingsManager.kt similarity index 83% rename from core/src/main/kotlin/com/simiacryptus/skyenet/platform/UserSettingsManager.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/UserSettingsManager.kt index 8b8447fa..47423e07 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/UserSettingsManager.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/platform/UserSettingsManager.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.platform +package com.simiacryptus.skyenet.core.platform import com.simiacryptus.jopenai.util.JsonUtil import java.io.File @@ -15,10 +15,10 @@ open class UserSettingsManager { return userSettings.getOrPut(user) { val file = File(userConfigDirectory, "$user.json") if (file.exists()) { - Companion.log.info("Loading user settings for $user from $file") + log.info("Loading user settings for $user from $file") JsonUtil.fromJson(file.readText(), UserSettings::class.java) } else { - Companion.log.info("Creating new user settings for $user at $file") + log.info("Creating new user settings for $user at $file") UserSettings() } } diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/util/AwsUtil.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/AwsUtil.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/util/AwsUtil.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/util/AwsUtil.kt index 1e068cdc..67c5505a 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/util/AwsUtil.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/AwsUtil.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.util +package com.simiacryptus.skyenet.core.util import com.amazonaws.services.kms.AWSKMSClientBuilder import com.amazonaws.services.kms.model.DecryptRequest diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/util/FunctionWrapper.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/FunctionWrapper.kt similarity index 98% rename from core/src/main/kotlin/com/simiacryptus/skyenet/util/FunctionWrapper.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/util/FunctionWrapper.kt index 09bbb361..ba0d3c3c 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/util/FunctionWrapper.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/FunctionWrapper.kt @@ -1,6 +1,6 @@ @file:Suppress("unused") -package com.simiacryptus.skyenet.util +package com.simiacryptus.skyenet.core.util import com.simiacryptus.jopenai.util.JsonUtil import java.io.Closeable diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/util/HeartTestBase.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/HeartTestBase.kt similarity index 97% rename from core/src/main/kotlin/com/simiacryptus/skyenet/util/HeartTestBase.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/util/HeartTestBase.kt index a0a4209c..9c5cf44d 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/util/HeartTestBase.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/HeartTestBase.kt @@ -1,6 +1,6 @@ -package com.simiacryptus.skyenet.util +package com.simiacryptus.skyenet.core.util -import com.simiacryptus.skyenet.Heart +import com.simiacryptus.skyenet.core.Heart import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/util/LoggingInterceptor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/LoggingInterceptor.kt similarity index 98% rename from core/src/main/kotlin/com/simiacryptus/skyenet/util/LoggingInterceptor.kt rename to core/src/main/kotlin/com/simiacryptus/skyenet/core/util/LoggingInterceptor.kt index f7bd634e..37310c00 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/util/LoggingInterceptor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/util/LoggingInterceptor.kt @@ -1,4 +1,4 @@ -package com.simiacryptus.skyenet.util +package com.simiacryptus.skyenet.core.util import ch.qos.logback.classic.Logger import ch.qos.logback.classic.LoggerContext diff --git a/core/src/test/java/com/simiacryptus/skyenet/DataStorageTest.kt b/core/src/test/java/com/simiacryptus/skyenet/core/DataStorageTest.kt similarity index 91% rename from core/src/test/java/com/simiacryptus/skyenet/DataStorageTest.kt rename to core/src/test/java/com/simiacryptus/skyenet/core/DataStorageTest.kt index 3e663e4e..b9e2d228 100644 --- a/core/src/test/java/com/simiacryptus/skyenet/DataStorageTest.kt +++ b/core/src/test/java/com/simiacryptus/skyenet/core/DataStorageTest.kt @@ -1,6 +1,6 @@ -package com.simiacryptus.skyenet +package com.simiacryptus.skyenet.core -import com.simiacryptus.skyenet.platform.DataStorage +import com.simiacryptus.skyenet.core.platform.DataStorage import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue diff --git a/core/src/test/java/com/simiacryptus/skyenet/OutputInterceptorThreadedTest.java b/core/src/test/java/com/simiacryptus/skyenet/core/OutputInterceptorThreadedTest.java similarity index 95% rename from core/src/test/java/com/simiacryptus/skyenet/OutputInterceptorThreadedTest.java rename to core/src/test/java/com/simiacryptus/skyenet/core/OutputInterceptorThreadedTest.java index 2ae5bd5d..85e451cc 100644 --- a/core/src/test/java/com/simiacryptus/skyenet/OutputInterceptorThreadedTest.java +++ b/core/src/test/java/com/simiacryptus/skyenet/core/OutputInterceptorThreadedTest.java @@ -1,52 +1,52 @@ -package com.simiacryptus.skyenet; - -import org.junit.jupiter.api.Test; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class OutputInterceptorThreadedTest { - - @Test - public void testThreadedInterceptor() throws InterruptedException { - OutputInterceptor.setupInterceptor(); - AtomicInteger successCounter = new AtomicInteger(0); - ExecutorService executorService = Executors.newFixedThreadPool(5); - Object lock = new Object(); - Runnable task = () -> { - OutputInterceptor.clearThreadOutput(); - String threadName = Thread.currentThread().getName(); - System.out.println("Thread: " + threadName + " output"); - System.err.println("Thread: " + threadName + " error"); - try { - Thread.sleep(1); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - String expectedOutput = ("Thread: " + threadName + " output\nThread: " + threadName + " error\n").trim(); - String threadOutput = OutputInterceptor.getThreadOutput().replace("\r", "").trim(); - if (threadOutput.trim().equals(expectedOutput.trim())) { - successCounter.incrementAndGet(); - } else { - synchronized (lock) { - System.out.println("Expected:\n " + expectedOutput.replaceAll("\n", "\n ")); - System.out.println("Actual:\n " + threadOutput.replaceAll("\n", "\n ")); - System.out.flush(); - } - } - }; - - for (int i = 0; i < 10; i++) { - executorService.submit(task); - } - - executorService.shutdown(); - executorService.awaitTermination(10, TimeUnit.SECONDS); - - assertEquals(10, successCounter.get()); - } -} +package com.simiacryptus.skyenet.core; + +import org.junit.jupiter.api.Test; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class OutputInterceptorThreadedTest { + + @Test + public void testThreadedInterceptor() throws InterruptedException { + OutputInterceptor.setupInterceptor(); + AtomicInteger successCounter = new AtomicInteger(0); + ExecutorService executorService = Executors.newFixedThreadPool(5); + Object lock = new Object(); + Runnable task = () -> { + OutputInterceptor.clearThreadOutput(); + String threadName = Thread.currentThread().getName(); + System.out.println("Thread: " + threadName + " output"); + System.err.println("Thread: " + threadName + " error"); + try { + Thread.sleep(1); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + String expectedOutput = ("Thread: " + threadName + " output\nThread: " + threadName + " error\n").trim(); + String threadOutput = OutputInterceptor.getThreadOutput().replace("\r", "").trim(); + if (threadOutput.trim().equals(expectedOutput.trim())) { + successCounter.incrementAndGet(); + } else { + synchronized (lock) { + System.out.println("Expected:\n " + expectedOutput.replaceAll("\n", "\n ")); + System.out.println("Actual:\n " + threadOutput.replaceAll("\n", "\n ")); + System.out.flush(); + } + } + }; + + for (int i = 0; i < 10; i++) { + executorService.submit(task); + } + + executorService.shutdown(); + executorService.awaitTermination(10, TimeUnit.SECONDS); + + assertEquals(10, successCounter.get()); + } +} diff --git a/webui/src/test/kotlin/com/simiacryptus/skyenet/ActorOptTest.kt b/core/src/test/java/com/simiacryptus/skyenet/core/actors/ActorOptTest.kt similarity index 92% rename from webui/src/test/kotlin/com/simiacryptus/skyenet/ActorOptTest.kt rename to core/src/test/java/com/simiacryptus/skyenet/core/actors/ActorOptTest.kt index c1db7071..81dc424d 100644 --- a/webui/src/test/kotlin/com/simiacryptus/skyenet/ActorOptTest.kt +++ b/core/src/test/java/com/simiacryptus/skyenet/core/actors/ActorOptTest.kt @@ -1,9 +1,8 @@ -package com.simiacryptus.skyenet +package com.simiacryptus.skyenet.core.actors import com.simiacryptus.jopenai.OpenAIClient -import com.simiacryptus.skyenet.actors.SimpleActor -import com.simiacryptus.skyenet.actors.opt.ActorOptimization -import com.simiacryptus.skyenet.actors.opt.Expectation +import com.simiacryptus.skyenet.core.actors.opt.ActorOptimization +import com.simiacryptus.skyenet.core.actors.opt.Expectation import org.slf4j.LoggerFactory import org.slf4j.event.Level import kotlin.system.exitProcess diff --git a/groovy/src/main/kotlin/com/simiacryptus/skyenet/heart/GroovyInterpreter.kt b/groovy/src/main/kotlin/com/simiacryptus/skyenet/groovy/GroovyInterpreter.kt similarity index 89% rename from groovy/src/main/kotlin/com/simiacryptus/skyenet/heart/GroovyInterpreter.kt rename to groovy/src/main/kotlin/com/simiacryptus/skyenet/groovy/GroovyInterpreter.kt index 9e51d5f2..1b897667 100644 --- a/groovy/src/main/kotlin/com/simiacryptus/skyenet/heart/GroovyInterpreter.kt +++ b/groovy/src/main/kotlin/com/simiacryptus/skyenet/groovy/GroovyInterpreter.kt @@ -1,43 +1,43 @@ -package com.simiacryptus.skyenet.heart - -import com.simiacryptus.skyenet.Heart -import groovy.lang.GroovyShell -import groovy.lang.Script -import org.codehaus.groovy.control.CompilationFailedException -import org.codehaus.groovy.control.CompilerConfiguration - -open class GroovyInterpreter(defs: java.util.Map) : Heart { - - private val shell: GroovyShell - - init { - val compilerConfiguration = CompilerConfiguration() - shell = GroovyShell(compilerConfiguration) - defs.forEach { key, value -> - shell.setVariable(key, value) - } - } - - override fun getLanguage(): String { - return "groovy" - } - - - override fun run(code: String): Any? { - val wrapExecution = wrapExecution { - try { - val script: Script = shell.parse(wrapCode(code)) - script.run() - } catch (e: CompilationFailedException) { - throw e - } - } - return wrapExecution - } - - override fun validate(code: String): Exception? { - shell.parse(wrapCode(code)) - return null - } -} - +package com.simiacryptus.skyenet.groovy + +import com.simiacryptus.skyenet.core.Heart +import groovy.lang.GroovyShell +import groovy.lang.Script +import org.codehaus.groovy.control.CompilationFailedException +import org.codehaus.groovy.control.CompilerConfiguration + +open class GroovyInterpreter(defs: java.util.Map) : Heart { + + private val shell: GroovyShell + + init { + val compilerConfiguration = CompilerConfiguration() + shell = GroovyShell(compilerConfiguration) + defs.forEach { key, value -> + shell.setVariable(key, value) + } + } + + override fun getLanguage(): String { + return "groovy" + } + + + override fun run(code: String): Any? { + val wrapExecution = wrapExecution { + try { + val script: Script = shell.parse(wrapCode(code)) + script.run() + } catch (e: CompilationFailedException) { + throw e + } + } + return wrapExecution + } + + override fun validate(code: String): Exception? { + shell.parse(wrapCode(code)) + return null + } +} + diff --git a/groovy/src/test/kotlin/com/simiacryptus/skyenet/GroovyInterpreterTest.kt b/groovy/src/test/kotlin/com/simiacryptus/skyenet/groovy/GroovyInterpreterTest.kt similarity index 56% rename from groovy/src/test/kotlin/com/simiacryptus/skyenet/GroovyInterpreterTest.kt rename to groovy/src/test/kotlin/com/simiacryptus/skyenet/groovy/GroovyInterpreterTest.kt index e394f18f..a2e38cdc 100644 --- a/groovy/src/test/kotlin/com/simiacryptus/skyenet/GroovyInterpreterTest.kt +++ b/groovy/src/test/kotlin/com/simiacryptus/skyenet/groovy/GroovyInterpreterTest.kt @@ -1,9 +1,8 @@ @file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") -package com.simiacryptus.skyenet.heart.test +package com.simiacryptus.skyenet.groovy -import com.simiacryptus.skyenet.util.HeartTestBase -import com.simiacryptus.skyenet.heart.GroovyInterpreter +import com.simiacryptus.skyenet.core.util.HeartTestBase class GroovyInterpreterTest : HeartTestBase() { override fun newInterpreter(map: java.util.Map) = GroovyInterpreter(map) diff --git a/java/build.gradle.kts b/java/build.gradle.kts deleted file mode 100644 index 973244a3..00000000 --- a/java/build.gradle.kts +++ /dev/null @@ -1,153 +0,0 @@ -import org.gradle.api.tasks.testing.logging.TestLogEvent -import java.net.URI - -fun properties(key: String) = project.findProperty(key).toString() -group = properties("libraryGroup") -version = properties("libraryVersion") - -plugins { - java - `java-library` - id("org.jetbrains.kotlin.jvm") version "1.9.20" - `maven-publish` - id("signing") -} - -repositories { - mavenCentral { - metadataSources { - mavenPom() - artifact() - } - } -} - -kotlin { - jvmToolchain(11) -} - -val kotlin_version = "1.9.20" -dependencies { - - implementation(project(":core")) - - implementation(group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.7.3") - implementation(kotlin("stdlib-jdk8")) - - implementation(group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version = kotlin_version) - implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9") - implementation(group = "commons-io", name = "commons-io", version = "2.15.0") - - testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.10.1") - testRuntimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = "5.10.1") - testImplementation(group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version = kotlin_version) - -} - -tasks { - - compileKotlin { - kotlinOptions { - javaParameters = true - } - } - compileTestKotlin { - kotlinOptions { - javaParameters = true - } - } - test { - useJUnitPlatform() - systemProperty("surefire.useManifestOnlyJar", "false") - testLogging { - events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) - exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL - } - jvmArgs( - "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", - "--add-opens", "java.base/java.util=ALL-UNNAMED", - "--add-opens", "java.base/java.lang=ALL-UNNAMED" - ) - } -} - - - -val javadocJar by tasks.registering(Jar::class) { - archiveClassifier.set("javadoc") - from(tasks.javadoc) -} - -val sourcesJar by tasks.registering(Jar::class) { - archiveClassifier.set("sources") - from(sourceSets.main.get().allSource) -} - -publishing { - - publications { - create("mavenJava") { - artifactId = "java" - from(components["java"]) - artifact(sourcesJar.get()) - artifact(javadocJar.get()) - versionMapping { - usage("java-api") { - fromResolutionOf("runtimeClasspath") - } - usage("java-runtime") { - fromResolutionResult() - } - } - pom { - name.set("SkyeNet Java Interpreter") - description.set("A very helpful puppy") - url.set("https://github.com/SimiaCryptus/SkyeNet") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("acharneski") - name.set("Andrew Charneski") - email.set("acharneski@gmail.com") - } - } - scm { - connection.set("scm:git:git://git@github.com/SimiaCryptus/SkyeNet.git") - developerConnection.set("scm:git:ssh://git@github.com/SimiaCryptus/SkyeNet.git") - url.set("https://github.com/SimiaCryptus/SkyeNet") - } - } - } - } - repositories { - maven { - val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - val snapshotsRepoUrl = "https://oss.sonatype.org/mask/repositories/snapshots" - url = URI(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl) - credentials { - username = System.getenv("OSSRH_USERNAME") ?: System.getProperty("ossrhUsername") - ?: properties("ossrhUsername") - password = System.getenv("OSSRH_PASSWORD") ?: System.getProperty("ossrhPassword") - ?: properties("ossrhPassword") - } - } - } - if (System.getenv("GPG_PRIVATE_KEY") != null && System.getenv("GPG_PASSPHRASE") != null) afterEvaluate { - signing { - sign(publications["mavenJava"]) - } - } -} - -if (System.getenv("GPG_PRIVATE_KEY") != null && System.getenv("GPG_PASSPHRASE") != null) { - apply() - configure { - useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PASSPHRASE")) - sign(configurations.archives.get()) - } -} diff --git a/kotlin/src/main/kotlin/com/simiacryptus/skyenet/heart/KotlinInterpreter.kt b/kotlin/src/main/kotlin/com/simiacryptus/skyenet/kotlin/KotlinInterpreter.kt similarity index 99% rename from kotlin/src/main/kotlin/com/simiacryptus/skyenet/heart/KotlinInterpreter.kt rename to kotlin/src/main/kotlin/com/simiacryptus/skyenet/kotlin/KotlinInterpreter.kt index ac634bf5..edd94d26 100644 --- a/kotlin/src/main/kotlin/com/simiacryptus/skyenet/heart/KotlinInterpreter.kt +++ b/kotlin/src/main/kotlin/com/simiacryptus/skyenet/kotlin/KotlinInterpreter.kt @@ -1,8 +1,8 @@ @file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") -package com.simiacryptus.skyenet.heart +package com.simiacryptus.skyenet.kotlin -import com.simiacryptus.skyenet.Heart +import com.simiacryptus.skyenet.core.Heart import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity diff --git a/kotlin/src/test/kotlin/com/simiacryptus/skyenet/KotlinInterpreterTest.kt b/kotlin/src/test/kotlin/com/simiacryptus/skyenet/kotlin/KotlinInterpreterTest.kt similarity index 90% rename from kotlin/src/test/kotlin/com/simiacryptus/skyenet/KotlinInterpreterTest.kt rename to kotlin/src/test/kotlin/com/simiacryptus/skyenet/kotlin/KotlinInterpreterTest.kt index 4f44a3cf..8272e748 100644 --- a/kotlin/src/test/kotlin/com/simiacryptus/skyenet/KotlinInterpreterTest.kt +++ b/kotlin/src/test/kotlin/com/simiacryptus/skyenet/kotlin/KotlinInterpreterTest.kt @@ -1,8 +1,8 @@ @file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") -package com.simiacryptus.skyenet.heart +package com.simiacryptus.skyenet.kotlin -import com.simiacryptus.skyenet.util.HeartTestBase +import com.simiacryptus.skyenet.core.util.HeartTestBase import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import java.util.Map diff --git a/scala/src/main/scala/com/simiacryptus/skyenet/heart/ScalaLocalInterpreter.scala b/scala/src/main/scala/com/simiacryptus/skyenet/scala/ScalaLocalInterpreter.scala similarity index 97% rename from scala/src/main/scala/com/simiacryptus/skyenet/heart/ScalaLocalInterpreter.scala rename to scala/src/main/scala/com/simiacryptus/skyenet/scala/ScalaLocalInterpreter.scala index 2f00613c..535e47a7 100644 --- a/scala/src/main/scala/com/simiacryptus/skyenet/heart/ScalaLocalInterpreter.scala +++ b/scala/src/main/scala/com/simiacryptus/skyenet/scala/ScalaLocalInterpreter.scala @@ -1,7 +1,7 @@ -package com.simiacryptus.skyenet.heart +package com.simiacryptus.skyenet.scala -import com.simiacryptus.skyenet.Heart -import com.simiacryptus.skyenet.heart.ScalaLocalInterpreter.log +import com.simiacryptus.skyenet.core.Heart +import com.simiacryptus.skyenet.scala.ScalaLocalInterpreter.log import java.nio.file.Paths import java.util.function.Supplier diff --git a/scala/src/test/scala/com/simiacryptus/skyenet/heart/ScalaLocalInterpreterTest.scala b/scala/src/test/scala/com/simiacryptus/skyenet/scala/ScalaLocalInterpreterTest.scala similarity index 51% rename from scala/src/test/scala/com/simiacryptus/skyenet/heart/ScalaLocalInterpreterTest.scala rename to scala/src/test/scala/com/simiacryptus/skyenet/scala/ScalaLocalInterpreterTest.scala index f425c2a1..443afb6c 100644 --- a/scala/src/test/scala/com/simiacryptus/skyenet/heart/ScalaLocalInterpreterTest.scala +++ b/scala/src/test/scala/com/simiacryptus/skyenet/scala/ScalaLocalInterpreterTest.scala @@ -1,14 +1,13 @@ -package com.test - -import com.simiacryptus.skyenet.heart.ScalaLocalInterpreter -import com.simiacryptus.skyenet.Heart -import com.simiacryptus.skyenet.util.HeartTestBase - -import java.util - - -class ScalaLocalInterpreterTest extends HeartTestBase { - override def newInterpreter(map: util.Map[String, AnyRef]): Heart = { - new ScalaLocalInterpreter(map) - } -} +package com.simiacryptus.skyenet.scala + +import com.simiacryptus.skyenet.core.Heart +import com.simiacryptus.skyenet.core.util.HeartTestBase + +import java.util + + +class ScalaLocalInterpreterTest extends HeartTestBase { + override def newInterpreter(map: util.Map[String, AnyRef]): Heart = { + new ScalaLocalInterpreter(map) + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 4d15adb6..ff8d96db 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,6 @@ rootProject.name = "SkyeNet" include("core") include("groovy") -include("java") include("scala") include("kotlin") include("webui") diff --git a/skyenet.svg b/skyenet.svg index c252e0ad..52fa3b90 100644 --- a/skyenet.svg +++ b/skyenet.svg @@ -1,10 +1,10 @@ -