ai.muna.muna 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/Editor/Build/AndroidBuildHandler.cs +96 -0
  2. package/Editor/Build/AndroidBuildHandler.cs.meta +11 -0
  3. package/Editor/Build/BuildHandler.cs +128 -0
  4. package/Editor/Build/BuildHandler.cs.meta +11 -0
  5. package/Editor/Build/LinuxBuildHandler.cs +26 -0
  6. package/Editor/Build/LinuxBuildHandler.cs.meta +11 -0
  7. package/Editor/Build/WebGLBuildHandler.cs +69 -0
  8. package/Editor/Build/WebGLBuildHandler.cs.meta +11 -0
  9. package/Editor/Build/WindowsBuildHandler.cs +24 -0
  10. package/Editor/Build/WindowsBuildHandler.cs.meta +11 -0
  11. package/Editor/Build/iOSBuildHandler.cs +119 -0
  12. package/Editor/Build/iOSBuildHandler.cs.meta +11 -0
  13. package/Editor/Build/macOSBuildHandler.cs +133 -0
  14. package/Editor/Build/macOSBuildHandler.cs.meta +11 -0
  15. package/Editor/Build.meta +8 -0
  16. package/Editor/Muna.Editor.asmdef +18 -0
  17. package/Editor/Muna.Editor.asmdef.meta +7 -0
  18. package/Editor/MunaMenu.cs +32 -0
  19. package/Editor/MunaMenu.cs.meta +11 -0
  20. package/Editor/MunaProjectSettings.cs +43 -0
  21. package/Editor/MunaProjectSettings.cs.meta +11 -0
  22. package/Editor/MunaSettingsProvider.cs +27 -0
  23. package/Editor/MunaSettingsProvider.cs.meta +11 -0
  24. package/Editor.meta +8 -0
  25. package/LICENSE +201 -0
  26. package/LICENSE.meta +7 -0
  27. package/Plugins/Android/Function.aar +0 -0
  28. package/Plugins/Android/Function.aar.meta +32 -0
  29. package/Plugins/Android.meta +8 -0
  30. package/Plugins/Linux/arm64/libFunction.so +0 -0
  31. package/Plugins/Linux/arm64/libFunction.so.meta +62 -0
  32. package/Plugins/Linux/arm64.meta +8 -0
  33. package/Plugins/Linux/x86_64/libFunction.so +0 -0
  34. package/Plugins/Linux/x86_64/libFunction.so.meta +82 -0
  35. package/Plugins/Linux/x86_64.meta +8 -0
  36. package/Plugins/Linux.meta +8 -0
  37. package/Plugins/Web/libFunction.a +0 -0
  38. package/Plugins/Web/libFunction.a.meta +87 -0
  39. package/Plugins/Web.meta +8 -0
  40. package/Plugins/Windows/arm64/Function.dll +0 -0
  41. package/Plugins/Windows/arm64/Function.dll.meta +58 -0
  42. package/Plugins/Windows/arm64.meta +8 -0
  43. package/Plugins/Windows/x86_64/Function.dll +0 -0
  44. package/Plugins/Windows/x86_64/Function.dll.meta +82 -0
  45. package/Plugins/Windows/x86_64.meta +8 -0
  46. package/Plugins/Windows.meta +8 -0
  47. package/Plugins/iOS/Function.xcframework/Info.plist +75 -0
  48. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Function +0 -0
  49. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNConfiguration.h +313 -0
  50. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNPrediction.h +165 -0
  51. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNPredictionStream.h +63 -0
  52. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNPredictor.h +108 -0
  53. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNStatus.h +42 -0
  54. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNValue.h +395 -0
  55. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNValueMap.h +148 -0
  56. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNVersion.h +26 -0
  57. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/Function.h +18 -0
  58. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Info.plist +0 -0
  59. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Modules/module.modulemap +6 -0
  60. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/PrivacyInfo.xcprivacy +36 -0
  61. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/_CodeSignature/CodeResources +223 -0
  62. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Function +0 -0
  63. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNConfiguration.h +313 -0
  64. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNPrediction.h +165 -0
  65. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictionStream.h +63 -0
  66. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictor.h +108 -0
  67. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNStatus.h +42 -0
  68. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNValue.h +395 -0
  69. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNValueMap.h +148 -0
  70. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNVersion.h +26 -0
  71. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/Function.h +18 -0
  72. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Info.plist +0 -0
  73. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Modules/module.modulemap +6 -0
  74. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/PrivacyInfo.xcprivacy +36 -0
  75. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/_CodeSignature/CodeResources +223 -0
  76. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Function +0 -0
  77. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNConfiguration.h +313 -0
  78. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNPrediction.h +165 -0
  79. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNPredictionStream.h +63 -0
  80. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNPredictor.h +108 -0
  81. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNStatus.h +42 -0
  82. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNValue.h +395 -0
  83. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNValueMap.h +148 -0
  84. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNVersion.h +26 -0
  85. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/Function.h +18 -0
  86. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Info.plist +0 -0
  87. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Modules/module.modulemap +6 -0
  88. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/PrivacyInfo.xcprivacy +36 -0
  89. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/_CodeSignature/CodeResources +223 -0
  90. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Function +0 -0
  91. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNConfiguration.h +313 -0
  92. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNPrediction.h +165 -0
  93. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictionStream.h +63 -0
  94. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictor.h +108 -0
  95. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNStatus.h +42 -0
  96. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNValue.h +395 -0
  97. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNValueMap.h +148 -0
  98. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNVersion.h +26 -0
  99. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/Function.h +18 -0
  100. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Info.plist +0 -0
  101. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Modules/module.modulemap +6 -0
  102. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/PrivacyInfo.xcprivacy +36 -0
  103. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/_CodeSignature/CodeResources +223 -0
  104. package/Plugins/iOS/Function.xcframework.meta +83 -0
  105. package/Plugins/iOS.meta +8 -0
  106. package/Plugins/macOS/Function.dylib +0 -0
  107. package/Plugins/macOS/Function.dylib.meta +82 -0
  108. package/Plugins/macOS.meta +8 -0
  109. package/Plugins.meta +8 -0
  110. package/README.md +79 -0
  111. package/README.md.meta +7 -0
  112. package/Runtime/API/DotNetClient.cs +106 -0
  113. package/Runtime/API/DotNetClient.cs.meta +11 -0
  114. package/Runtime/API/MunaClient.cs +96 -0
  115. package/Runtime/API/MunaClient.cs.meta +11 -0
  116. package/Runtime/API.meta +8 -0
  117. package/Runtime/Beta/BetaClient.cs +33 -0
  118. package/Runtime/Beta/BetaClient.cs.meta +11 -0
  119. package/Runtime/Beta/PredictionService.cs +32 -0
  120. package/Runtime/Beta/PredictionService.cs.meta +11 -0
  121. package/Runtime/Beta/RemoteAcceleration.cs +38 -0
  122. package/Runtime/Beta/RemoteAcceleration.cs.meta +11 -0
  123. package/Runtime/Beta/RemotePredictionService.cs +187 -0
  124. package/Runtime/Beta/RemotePredictionService.cs.meta +11 -0
  125. package/Runtime/Beta/Value.cs +92 -0
  126. package/Runtime/Beta/Value.cs.meta +11 -0
  127. package/Runtime/Beta.meta +8 -0
  128. package/Runtime/C/Configuration.cs +139 -0
  129. package/Runtime/C/Configuration.cs.meta +11 -0
  130. package/Runtime/C/Function.cs +294 -0
  131. package/Runtime/C/Function.cs.meta +11 -0
  132. package/Runtime/C/Prediction.cs +70 -0
  133. package/Runtime/C/Prediction.cs.meta +11 -0
  134. package/Runtime/C/PredictionStream.cs +36 -0
  135. package/Runtime/C/PredictionStream.cs.meta +11 -0
  136. package/Runtime/C/Predictor.cs +42 -0
  137. package/Runtime/C/Predictor.cs.meta +11 -0
  138. package/Runtime/C/Value.cs +194 -0
  139. package/Runtime/C/Value.cs.meta +11 -0
  140. package/Runtime/C/ValueMap.cs +50 -0
  141. package/Runtime/C/ValueMap.cs.meta +11 -0
  142. package/Runtime/C.meta +8 -0
  143. package/Runtime/Muna.Runtime.asmdef +27 -0
  144. package/Runtime/Muna.Runtime.asmdef.meta +7 -0
  145. package/Runtime/Muna.cs +109 -0
  146. package/Runtime/Muna.cs.meta +11 -0
  147. package/Runtime/Services/Prediction.cs +247 -0
  148. package/Runtime/Services/Prediction.cs.meta +11 -0
  149. package/Runtime/Services/Predictor.cs +44 -0
  150. package/Runtime/Services/Predictor.cs.meta +11 -0
  151. package/Runtime/Services/User.cs +43 -0
  152. package/Runtime/Services/User.cs.meta +11 -0
  153. package/Runtime/Services.meta +8 -0
  154. package/Runtime/Types/Dtype.cs +118 -0
  155. package/Runtime/Types/Dtype.cs.meta +11 -0
  156. package/Runtime/Types/Image.cs +93 -0
  157. package/Runtime/Types/Image.cs.meta +11 -0
  158. package/Runtime/Types/Prediction.cs +113 -0
  159. package/Runtime/Types/Prediction.cs.meta +11 -0
  160. package/Runtime/Types/Predictor.cs +193 -0
  161. package/Runtime/Types/Predictor.cs.meta +11 -0
  162. package/Runtime/Types/Tensor.cs +58 -0
  163. package/Runtime/Types/Tensor.cs.meta +11 -0
  164. package/Runtime/Types/User.cs +54 -0
  165. package/Runtime/Types/User.cs.meta +11 -0
  166. package/Runtime/Types.meta +8 -0
  167. package/Runtime.meta +8 -0
  168. package/Unity/API/PredictionCacheClient.cs +144 -0
  169. package/Unity/API/PredictionCacheClient.cs.meta +11 -0
  170. package/Unity/API/UnityClient.cs +147 -0
  171. package/Unity/API/UnityClient.cs.meta +11 -0
  172. package/Unity/API.meta +8 -0
  173. package/Unity/Internal/MunaSettings.cs +59 -0
  174. package/Unity/Internal/MunaSettings.cs.meta +11 -0
  175. package/Unity/Internal.meta +8 -0
  176. package/Unity/Muna.Unity.asmdef +29 -0
  177. package/Unity/Muna.Unity.asmdef.meta +7 -0
  178. package/Unity/MunaUnity.cs +130 -0
  179. package/Unity/MunaUnity.cs.meta +11 -0
  180. package/Unity/Types/CachedPrediction.cs +36 -0
  181. package/Unity/Types/CachedPrediction.cs.meta +11 -0
  182. package/Unity/Types.meta +8 -0
  183. package/Unity.meta +8 -0
  184. package/package.json +38 -0
  185. package/package.json.meta +7 -0
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 6852a672162f54054a88ab4494208360
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Muna
3
+ * Copyright © 2025 NatML Inc. All rights reserved.
4
+ */
5
+
6
+ #nullable enable
7
+
8
+ namespace Muna.C {
9
+
10
+ using System;
11
+ using static Muna;
12
+
13
+ public sealed class Predictor : IDisposable {
14
+
15
+ #region --Client API--
16
+
17
+ public Predictor(Configuration configuration) {
18
+ CreatePredictor(configuration, out var predictor).Throw();
19
+ this.predictor = predictor;
20
+ }
21
+
22
+ public Prediction CreatePrediction(ValueMap inputs) {
23
+ predictor.CreatePrediction(inputs, out var prediction).Throw();
24
+ return new Prediction(prediction);
25
+ }
26
+
27
+ public PredictionStream StreamPrediction(ValueMap inputs) {
28
+ predictor.StreamPrediction(inputs, out var stream).Throw();
29
+ return new PredictionStream(stream);
30
+ }
31
+
32
+ public void Dispose() => predictor.ReleasePredictor();
33
+ #endregion
34
+
35
+
36
+ #region --Operations--
37
+ private readonly IntPtr predictor;
38
+
39
+ public static implicit operator IntPtr(Predictor predictor) => predictor.predictor;
40
+ #endregion
41
+ }
42
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 766df7ef0c0b24c54ae150f83a1666e9
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,194 @@
1
+ /*
2
+ * Muna
3
+ * Copyright © 2025 NatML Inc. All rights reserved.
4
+ */
5
+
6
+ #nullable enable
7
+
8
+ namespace Muna.C {
9
+
10
+ using System;
11
+ using System.Collections;
12
+ using System.IO;
13
+ using System.Linq;
14
+ using System.Runtime.InteropServices;
15
+ using Newtonsoft.Json;
16
+ using Newtonsoft.Json.Linq;
17
+ using static Muna;
18
+
19
+ public unsafe sealed class Value : IDisposable {
20
+
21
+ #region --Enumerations--
22
+ [Flags]
23
+ public enum Flags : int {
24
+ None = 0,
25
+ CopyData = 1,
26
+ }
27
+ #endregion
28
+
29
+
30
+ #region --Client API--
31
+
32
+ public void* data {
33
+ get {
34
+ value.GetValueData(out var data).Throw();
35
+ return (void*)data;
36
+ }
37
+ }
38
+
39
+ public Dtype type {
40
+ get {
41
+ value.GetValueType(out var type).Throw();
42
+ return type;
43
+ }
44
+ }
45
+
46
+ public int[] shape {
47
+ get {
48
+ value.GetValueDimensions(out var dims).Throw();
49
+ var shape = new int[dims];
50
+ value.GetValueShape(shape, dims).Throw();
51
+ return shape;
52
+ }
53
+ }
54
+
55
+ public object? ToObject() => type switch {
56
+ Dtype.Null => null,
57
+ Dtype.Float32 => ToObject((float*)data, shape),
58
+ Dtype.Float64 => ToObject((double*)data, shape),
59
+ Dtype.Int8 => ToObject((sbyte*)data, shape),
60
+ Dtype.Int16 => ToObject((short*)data, shape),
61
+ Dtype.Int32 => ToObject((int*)data, shape),
62
+ Dtype.Int64 => ToObject((long*)data, shape),
63
+ Dtype.Uint8 => ToObject((byte*)data, shape),
64
+ Dtype.Uint16 => ToObject((ushort*)data, shape),
65
+ Dtype.Uint32 => ToObject((uint*)data, shape),
66
+ Dtype.Uint64 => ToObject((ulong*)data, shape),
67
+ Dtype.Bool => ToObject((bool*)data, shape),
68
+ Dtype.String => Marshal.PtrToStringUTF8((IntPtr)data),
69
+ Dtype.List => JsonConvert.DeserializeObject<JArray>(Marshal.PtrToStringUTF8((IntPtr)data)),
70
+ Dtype.Dict => JsonConvert.DeserializeObject<JObject>(Marshal.PtrToStringUTF8((IntPtr)data)),
71
+ Dtype.Image => new Image(ToArray((byte*)data, shape), shape[1], shape[0], shape[2]),
72
+ Dtype.Binary => new MemoryStream(ToArray((byte*)data, shape)),
73
+ _ => throw new InvalidOperationException($"Cannot convert Muna value to object because value type is unsupported: {type}"),
74
+ };
75
+
76
+ public void Dispose() => value.ReleaseValue();
77
+
78
+ public static Value CreateArray<T>(T scalar) where T : unmanaged => CreateArray(
79
+ new Tensor<T>(new [] { scalar }, new int[0]),
80
+ Flags.CopyData
81
+ );
82
+
83
+ public static Value CreateArray<T>(T[] vector) where T : unmanaged => CreateArray(
84
+ new Tensor<T>(vector, new [] { vector.Length }),
85
+ Flags.CopyData
86
+ );
87
+
88
+ public static Value CreateArray<T>(
89
+ in Tensor<T> tensor,
90
+ Flags flags = Flags.None
91
+ ) where T : unmanaged {
92
+ IntPtr value = default;
93
+ fixed (T* data = tensor)
94
+ CreateArrayValue(
95
+ data,
96
+ tensor.shape,
97
+ tensor.shape.Length,
98
+ ToDtype<T>(),
99
+ flags,
100
+ out value
101
+ ).Throw();
102
+ return new Value(value);
103
+ }
104
+
105
+ public static Value CreateString(string input) {
106
+ CreateStringValue(input, out var value).Throw();
107
+ return new Value(value);
108
+ }
109
+
110
+ public static Value CreateList(IList list) {
111
+ var json = JsonConvert.SerializeObject(list);
112
+ CreateListValue(json, out var value).Throw();
113
+ return new Value(value);
114
+ }
115
+
116
+ public static Value CreateDict(IDictionary dict) {
117
+ var json = JsonConvert.SerializeObject(dict);
118
+ CreateDictValue(json, out var value).Throw();
119
+ return new Value(value);
120
+ }
121
+
122
+ public static Value CreateImage(in Image image) {
123
+ IntPtr value = default;
124
+ fixed (byte* data = image)
125
+ CreateImageValue(
126
+ data,
127
+ image.width,
128
+ image.height,
129
+ image.channels,
130
+ image.data != null ? Flags.CopyData : Flags.None,
131
+ out value
132
+ ).Throw();
133
+ return new Value(value);
134
+ }
135
+
136
+ public static Value CreateBinary(Stream stream) {
137
+ byte[] data;
138
+ if (stream is MemoryStream memoryStream)
139
+ data = memoryStream.ToArray();
140
+ else {
141
+ using var dstStream = new MemoryStream();
142
+ stream.CopyTo(dstStream);
143
+ data = dstStream.ToArray();
144
+ }
145
+ CreateBinaryValue(data, data.Length, Flags.CopyData, out var value).Throw();
146
+ return new Value(value);
147
+ }
148
+
149
+ public static Value CreateNull() {
150
+ CreateNullValue(out var value).Throw();
151
+ return new Value(value);
152
+ }
153
+ #endregion
154
+
155
+
156
+ #region --Operations--
157
+ private readonly IntPtr value;
158
+
159
+ internal Value(IntPtr value) => this.value = value;
160
+
161
+ public static implicit operator IntPtr(Value value) => value.value;
162
+
163
+ private static unsafe object ToObject<T>(T* data, int[] shape) where T : unmanaged {
164
+ if (shape.Length == 0)
165
+ return *(T*)data;
166
+ var array = ToArray(data, shape);
167
+ return new Tensor<T>(array, shape);
168
+ }
169
+
170
+ private static unsafe T[] ToArray<T>(T* data, int[] shape) where T : unmanaged {
171
+ var count = shape.Aggregate(1, (a, b) => a * b);
172
+ var result = new T[count];
173
+ fixed (void* dst = result)
174
+ Buffer.MemoryCopy(data, dst, count * sizeof(T), count * sizeof(T));
175
+ return result;
176
+ }
177
+
178
+ private static Dtype ToDtype<T>() where T : unmanaged => default(T) switch { // don't use this for reference types
179
+ float _ => Dtype.Float32,
180
+ double _ => Dtype.Float64,
181
+ sbyte _ => Dtype.Int8,
182
+ short _ => Dtype.Int16,
183
+ int _ => Dtype.Int32,
184
+ long _ => Dtype.Int64,
185
+ byte _ => Dtype.Uint8,
186
+ ushort _ => Dtype.Uint16,
187
+ uint _ => Dtype.Uint32,
188
+ ulong _ => Dtype.Uint64,
189
+ bool _ => Dtype.Bool,
190
+ _ => Dtype.Null,
191
+ };
192
+ #endregion
193
+ }
194
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 23fb5eaa3b1ae4d71b008fa55e226c86
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Muna
3
+ * Copyright © 2025 NatML Inc. All rights reserved.
4
+ */
5
+
6
+ #nullable enable
7
+
8
+ namespace Muna.C {
9
+
10
+ using System;
11
+ using System.Text;
12
+ using static Muna;
13
+
14
+ public sealed class ValueMap : IDisposable {
15
+
16
+ #region --Client API--
17
+
18
+ public Value this[string key] {
19
+ get => GetValue(key);
20
+ set => map.SetValueMapValue(key, value).Throw();
21
+ }
22
+
23
+ public int size => map.GetValueMapSize(out var size).Throw() == Status.Ok ? size : default;
24
+
25
+ public ValueMap() : this(CreateValueMap(out var map).Throw() == Status.Ok ? map : default) { }
26
+
27
+ public string GetKey(int index) {
28
+ var key = new StringBuilder(2048);
29
+ map.GetValueMapKey(index, key, key.Capacity).Throw();
30
+ return key.ToString();
31
+ }
32
+
33
+ public Value GetValue(string key) {
34
+ map.GetValueMapValue(key, out var value).Throw();
35
+ return new Value(value);
36
+ }
37
+
38
+ public void Dispose () => map.ReleaseValueMap();
39
+ #endregion
40
+
41
+
42
+ #region --Operations--
43
+ private readonly IntPtr map;
44
+
45
+ internal ValueMap(IntPtr map) => this.map = map;
46
+
47
+ public static implicit operator IntPtr(ValueMap map) => map.map;
48
+ #endregion
49
+ }
50
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: f72fcf41caeed44c7a51c072bf154505
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/Runtime/C.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 45fcd552a65214164bd5b3573fa1ada3
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "Muna.Runtime",
3
+ "rootNamespace": "",
4
+ "references": [],
5
+ "includePlatforms": [
6
+ "Android",
7
+ "Editor",
8
+ "EmbeddedLinux",
9
+ "iOS",
10
+ "LinuxStandalone64",
11
+ "CloudRendering",
12
+ "macOSStandalone",
13
+ "VisionOS",
14
+ "WebGL",
15
+ "WindowsStandalone64"
16
+ ],
17
+ "excludePlatforms": [],
18
+ "allowUnsafeCode": true,
19
+ "overrideReferences": true,
20
+ "precompiledReferences": [
21
+ "Newtonsoft.Json.dll"
22
+ ],
23
+ "autoReferenced": true,
24
+ "defineConstraints": [],
25
+ "versionDefines": [],
26
+ "noEngineReferences": true
27
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 37bdf37a8cd194eec97725698ffe0640
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Muna
3
+ * Copyright © 2025 NatML Inc. All rights reserved.
4
+ */
5
+
6
+ #nullable enable
7
+
8
+ using System.Reflection;
9
+ using System.Runtime.CompilerServices;
10
+
11
+ [assembly: AssemblyCompany(@"NatML Inc.")]
12
+ [assembly: AssemblyTitle(@"Muna.Runtime")]
13
+ [assembly: AssemblyVersion(Muna.Muna.Version)]
14
+ [assembly: AssemblyCopyright(@"Copyright © 2025 NatML Inc. All Rights Reserved.")]
15
+ [assembly: InternalsVisibleTo(@"Muna.Unity")]
16
+ [assembly: InternalsVisibleTo(@"Muna.Editor")]
17
+ [assembly: InternalsVisibleTo(@"Muna.Tests.Editor")]
18
+ [assembly: InternalsVisibleTo(@"Muna.Tests.Runtime")]
19
+
20
+ namespace Muna {
21
+
22
+ using System;
23
+ using API;
24
+ using Beta;
25
+ using Services;
26
+
27
+ /// <summary>
28
+ /// Muna client.
29
+ /// </summary>
30
+ public sealed class Muna {
31
+
32
+ #region --Attributes--
33
+ /// <summary>
34
+ /// Embed predictors at build time to avoid errors due to sandboxing restrictions.
35
+ /// NOTE: This is required to use edge predictors on Android and iOS.
36
+ /// </summary>
37
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
38
+ public sealed class EmbedAttribute : Attribute {
39
+
40
+ internal readonly string[] tags;
41
+
42
+ /// <summary>
43
+ /// Embed predictors at build time.
44
+ /// </summary>
45
+ public EmbedAttribute(params string[] tags) => this.tags = tags;
46
+ }
47
+ #endregion
48
+
49
+
50
+ #region --Client API--
51
+ /// <summary>
52
+ /// Manage users.
53
+ /// </summary>
54
+ public readonly UserService Users;
55
+
56
+ /// <summary>
57
+ /// Manage predictors.
58
+ /// </summary>
59
+ public readonly PredictorService Predictors;
60
+
61
+ /// <summary>
62
+ /// Make predictions.
63
+ /// </summary>
64
+ public readonly PredictionService Predictions;
65
+
66
+ /// <summary>
67
+ /// Beta client for incubating features.
68
+ /// </summary>
69
+ public readonly BetaClient Beta;
70
+
71
+ /// <summary>
72
+ /// Create a Muna client.
73
+ /// </summary>
74
+ /// <param name="accessKey">Muna access key.</param>
75
+ /// <param name="url">Muna API URL.</param>
76
+ public Muna(
77
+ string? accessKey = null,
78
+ string? url = null
79
+ ) : this(new DotNetClient(url ?? URL, accessKey: accessKey)) { }
80
+
81
+ /// <summary>
82
+ /// Create a Muna client.
83
+ /// </summary>
84
+ /// <param name="client">Muna API client.</param>
85
+ public Muna(MunaClient client) {
86
+ this.client = client;
87
+ this.Users = new UserService(client);
88
+ this.Predictors = new PredictorService(client);
89
+ this.Predictions = new PredictionService(client);
90
+ this.Beta = new BetaClient(client);
91
+ }
92
+ #endregion
93
+
94
+
95
+ #region --Operations--
96
+ public readonly MunaClient client;
97
+ public const string Version = @"0.0.42";
98
+ internal const string URL = @"https://api.muna.ai/v1";
99
+ #endregion
100
+ }
101
+
102
+ [AttributeUsage(AttributeTargets.All, Inherited = true, AllowMultiple = false)]
103
+ internal sealed class PreserveAttribute : Attribute { }
104
+
105
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
106
+ internal sealed class MonoPInvokeCallbackAttribute : Attribute {
107
+ public MonoPInvokeCallbackAttribute(Type type) {}
108
+ }
109
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a4015fc30044345d38bab107a2e44c6f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: