bleam 0.0.9 → 0.0.11

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 (68) hide show
  1. package/dist/ai.cjs +608 -59
  2. package/dist/ai.d.cts +217 -89
  3. package/dist/ai.d.ts +217 -89
  4. package/dist/ai.js +601 -59
  5. package/dist/cli.cjs +142 -94
  6. package/dist/cli.d.cts +11 -27
  7. package/dist/cli.d.ts +11 -27
  8. package/dist/cli.js +143 -95
  9. package/dist/files.d.cts +1 -1
  10. package/dist/files.d.ts +1 -1
  11. package/dist/platform.cjs +1 -13
  12. package/dist/platform.d.cts +1 -26
  13. package/dist/platform.d.ts +1 -26
  14. package/dist/platform.js +1 -10
  15. package/dist/schema.d.cts +1 -1
  16. package/dist/schema.d.ts +1 -1
  17. package/dist/state.d.cts +1 -1
  18. package/dist/state.d.ts +1 -1
  19. package/dist/{ui-Bg11tvlc.d.ts → ui-CHc4xEs_.d.ts} +7 -7
  20. package/dist/ui.d.ts +1 -1
  21. package/dist/window.d.ts +1 -1
  22. package/package.json +2 -1
  23. package/templates/image-generation/app/index.tsx +3 -1
  24. package/templates/native/ios/Bleam/AI/Flux2/Configuration/ModelRegistry.swift +1 -1
  25. package/templates/native/ios/Bleam/AI/Flux2/Pipeline/FluxImageRunner.swift +7 -2
  26. package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextGenerator.swift +46 -0
  27. package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextModel.swift +107 -0
  28. package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextSnapshotValidator.swift +201 -0
  29. package/templates/native/ios/Bleam/AI/TextGeneration/Core/GenerationTypes.swift +85 -0
  30. package/templates/native/ios/Bleam/AI/TextGeneration/Core/ModelCapabilities.swift +21 -0
  31. package/templates/native/ios/Bleam/AI/TextGeneration/Core/TextKVCache.swift +23 -0
  32. package/templates/native/ios/Bleam/AI/TextGeneration/Core/TokenSampler.swift +79 -0
  33. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3CheckpointLoader.swift +161 -0
  34. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Configuration.swift +119 -0
  35. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3InferenceSession.swift +84 -0
  36. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Layers.swift +197 -0
  37. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Model.swift +130 -0
  38. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Checkpoint.swift +102 -0
  39. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Configuration.swift +140 -0
  40. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Model.swift +112 -0
  41. package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Session.swift +121 -0
  42. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridCache.swift +42 -0
  43. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridFullAttention.swift +57 -0
  44. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridLayers.swift +58 -0
  45. package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridLinearAttention.swift +111 -0
  46. package/templates/native/ios/Bleam/AppDelegate.swift +0 -97
  47. package/templates/native/ios/Bleam.xcodeproj/project.pbxproj +128 -121
  48. package/templates/native/ios/GenerationService/BonsaiTextGenerationRunner.swift +103 -0
  49. package/templates/native/ios/GenerationService/ImageGenerationRunner.swift +19 -7
  50. package/templates/native/ios/GenerationService/main.swift +174 -48
  51. package/templates/native/ios/Shared/Generation/GenerationServiceProtocol.swift +3 -0
  52. package/templates/native/ios/Shared/Generation/GenerationWorkerProtocol.swift +44 -0
  53. package/templates/native/modules/bleam-runtime/ios/AIModule.swift +225 -5
  54. package/templates/native/modules/bleam-runtime/ios/GenerationContracts.swift +47 -0
  55. package/templates/native/modules/bleam-runtime/ios/PlatformModule.swift +0 -175
  56. package/templates/text-generation/app/index.tsx +93 -0
  57. package/templates/text-generation/app.config.ts +5 -0
  58. package/templates/updates/README.md +116 -0
  59. package/templates/updates/src/index.ts +292 -0
  60. package/templates/updates/src/schema.ts +230 -0
  61. package/templates/updates/tsconfig.json +12 -0
  62. package/templates/updates/wrangler.jsonc +19 -0
  63. package/templates/native/ios/PlatformHelper/Info.plist +0 -29
  64. package/templates/native/ios/PlatformHelper/main.swift +0 -335
  65. /package/dist/{files-DwA7pzr3.d.cts → files-4ZEoAWiv.d.ts} +0 -0
  66. /package/dist/{files-VrkQlKIT.d.ts → files-Dt5mbzLq.d.cts} +0 -0
  67. /package/dist/{schema-DOOjfXvs.d.ts → schema-CYh6n8GS.d.ts} +0 -0
  68. /package/dist/{schema-ENSMX_1t.d.cts → schema-oeOrd3i1.d.cts} +0 -0
@@ -0,0 +1,111 @@
1
+ import Foundation
2
+ import MLX
3
+ import MLXNN
4
+
5
+ public final class QwenHybridLinearAttention: Module, @unchecked Sendable {
6
+ private let numValueHeads: Int
7
+ private let numKeyHeads: Int
8
+ private let keyHeadDim: Int
9
+ private let valueHeadDim: Int
10
+ private let keyDimension: Int
11
+ private let valueDimension: Int
12
+ private let convolutionDimension: Int
13
+ private let kernelSize: Int
14
+ private let keyNormWeight: MLXArray
15
+
16
+ @ModuleInfo public var in_proj_qkv: Linear
17
+ @ModuleInfo public var in_proj_z: Linear
18
+ @ModuleInfo public var in_proj_b: Linear
19
+ @ModuleInfo public var in_proj_a: Linear
20
+ @ModuleInfo public var out_proj: Linear
21
+ @ModuleInfo public var norm: QwenHybridGatedRMSNorm
22
+ @ModuleInfo public var conv1d: QwenHybridDepthwiseConv1D
23
+ @ParameterInfo public var dt_bias: MLXArray
24
+ @ParameterInfo public var A_log: MLXArray
25
+
26
+ public init(config: any QwenHybridConfiguration) {
27
+ numValueHeads = config.linearNumValueHeads
28
+ numKeyHeads = config.linearNumKeyHeads
29
+ keyHeadDim = config.linearKeyHeadDim
30
+ valueHeadDim = config.linearValueHeadDim
31
+ keyDimension = config.linearNumKeyHeads * config.linearKeyHeadDim
32
+ valueDimension = config.linearNumValueHeads * config.linearValueHeadDim
33
+ convolutionDimension = keyDimension * 2 + valueDimension
34
+ kernelSize = config.linearConvKernelDim
35
+ keyNormWeight = MLX.ones([config.linearKeyHeadDim])
36
+ _in_proj_qkv = ModuleInfo(wrappedValue: Linear(config.hiddenSize, convolutionDimension, bias: false))
37
+ _in_proj_z = ModuleInfo(wrappedValue: Linear(config.hiddenSize, valueDimension, bias: false))
38
+ _in_proj_b = ModuleInfo(wrappedValue: Linear(config.hiddenSize, numValueHeads, bias: false))
39
+ _in_proj_a = ModuleInfo(wrappedValue: Linear(config.hiddenSize, numValueHeads, bias: false))
40
+ _out_proj = ModuleInfo(wrappedValue: Linear(valueDimension, config.hiddenSize, bias: false))
41
+ _norm = ModuleInfo(wrappedValue: QwenHybridGatedRMSNorm(dimensions: valueHeadDim, epsilon: config.rmsNormEps))
42
+ _conv1d = ModuleInfo(wrappedValue: QwenHybridDepthwiseConv1D(channels: convolutionDimension, kernelSize: kernelSize))
43
+ _dt_bias = ParameterInfo(wrappedValue: MLX.ones([numValueHeads]))
44
+ _A_log = ParameterInfo(wrappedValue: MLX.zeros([numValueHeads]))
45
+ super.init()
46
+ }
47
+
48
+ public func callAsFunction(_ input: MLXArray, cache: QwenHybridLayerCache) -> MLXArray {
49
+ let batch = input.dim(0)
50
+ let length = input.dim(1)
51
+ let mixed = causalConvolution(in_proj_qkv(input), cache: cache)
52
+ let pieces = mixed.split(indices: [keyDimension, keyDimension * 2], axis: -1)
53
+ var query = pieces[0].reshaped([batch, length, numKeyHeads, keyHeadDim])
54
+ var key = pieces[1].reshaped([batch, length, numKeyHeads, keyHeadDim])
55
+ let value = pieces[2].reshaped([batch, length, numValueHeads, valueHeadDim]).asType(.float32)
56
+ query = MLXFast.rmsNorm(query.asType(.float32), weight: keyNormWeight, eps: 1e-6) / Float(keyHeadDim)
57
+ key = MLXFast.rmsNorm(key.asType(.float32), weight: keyNormWeight, eps: 1e-6) / sqrt(Float(keyHeadDim))
58
+ let gate = MLX.exp(-MLX.exp(A_log.asType(.float32)) * MLXNN.softplus(in_proj_a(input).asType(.float32) + dt_bias))
59
+ let beta = MLX.sigmoid(in_proj_b(input)).asType(.float32)
60
+ let initialState = cache.recurrentState ?? MLX.zeros([batch, numValueHeads, valueHeadDim, keyHeadDim], dtype: .float32)
61
+ let updated = QwenHybridGatedDelta.update(query: query, key: key, value: value, gate: gate, beta: beta, state: initialState)
62
+ cache.recurrentState = updated.state
63
+ let normalized = norm(
64
+ updated.output.asType(input.dtype).reshaped([-1, valueHeadDim]),
65
+ gate: in_proj_z(input).reshaped([-1, valueHeadDim])
66
+ )
67
+ return out_proj(normalized.reshaped([batch, length, valueDimension]))
68
+ }
69
+
70
+ private func causalConvolution(_ input: MLXArray, cache: QwenHybridLayerCache) -> MLXArray {
71
+ let length = input.dim(1)
72
+ if let previous = cache.convolutionState {
73
+ let combined = MLX.concatenated([previous, input], axis: 1)
74
+ cache.convolutionState = combined[0..., (combined.dim(1) - kernelSize + 1)..., 0...]
75
+ return MLXNN.silu(MLX.conv1d(combined, conv1d.weight, padding: 0, groups: convolutionDimension))
76
+ }
77
+ let result = MLXNN.silu(MLX.conv1d(input, conv1d.weight, padding: kernelSize - 1, groups: convolutionDimension))
78
+ let paddedInput = padded(input, widths: [[0, 0], [max(0, kernelSize - 1 - length), 0], [0, 0]])
79
+ cache.convolutionState = paddedInput[0..., (paddedInput.dim(1) - kernelSize + 1)..., 0...]
80
+ return result[0..., 0..<length, 0...]
81
+ }
82
+ }
83
+
84
+ public enum QwenHybridGatedDelta {
85
+ public static func update(
86
+ query: MLXArray,
87
+ key: MLXArray,
88
+ value: MLXArray,
89
+ gate: MLXArray,
90
+ beta: MLXArray,
91
+ state initialState: MLXArray
92
+ ) -> (output: MLXArray, state: MLXArray) {
93
+ let repeats = value.dim(2) / key.dim(2)
94
+ let query = repeats == 1 ? query : MLX.repeated(query, count: repeats, axis: 2)
95
+ let key = repeats == 1 ? key : MLX.repeated(key, count: repeats, axis: 2)
96
+ var state = initialState
97
+ var outputs: [MLXArray] = []
98
+ outputs.reserveCapacity(query.dim(1))
99
+ for index in 0..<query.dim(1) {
100
+ let q = query[0..., index, 0..., 0...]
101
+ let k = key[0..., index, 0..., 0...]
102
+ let v = value[0..., index, 0..., 0...]
103
+ state = state * gate[0..., index, 0...].expandedDimensions(axes: [2, 3])
104
+ let remembered = (state * k.expandedDimensions(axis: 2)).sum(axis: -1)
105
+ let delta = (v - remembered) * beta[0..., index, 0...].expandedDimensions(axis: -1)
106
+ state = state + k.expandedDimensions(axis: 2) * delta.expandedDimensions(axis: -1)
107
+ outputs.append((state * q.expandedDimensions(axis: 2)).sum(axis: -1))
108
+ }
109
+ return (MLX.stacked(outputs, axis: 1), state)
110
+ }
111
+ }
@@ -21,17 +21,6 @@ func launchArgument(_ name: String) -> String? {
21
21
 
22
22
  @main
23
23
  class AppDelegate: ExpoAppDelegate {
24
- public override func application(
25
- _ application: UIApplication,
26
- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
27
- ) -> Bool {
28
- let launched = super.application(application, didFinishLaunchingWithOptions: launchOptions)
29
- if launched {
30
- PlatformHelperInstaller.refreshIfInstalledApp()
31
- }
32
- return launched
33
- }
34
-
35
24
  public func application(
36
25
  _ application: UIApplication,
37
26
  configurationForConnecting connectingSceneSession: UISceneSession,
@@ -62,92 +51,6 @@ class AppDelegate: ExpoAppDelegate {
62
51
  }
63
52
  }
64
53
 
65
- private enum PlatformHelperInstaller {
66
- static func refreshIfInstalledApp() {
67
- #if targetEnvironment(macCatalyst)
68
- let homeDirectory = URL(fileURLWithPath: NSHomeDirectory(), isDirectory: true)
69
- let homeApplications = homeDirectory
70
- .appendingPathComponent("Applications", isDirectory: true)
71
- .standardizedFileURL.path + "/"
72
- guard Bundle.main.bundleURL.standardizedFileURL.path.hasPrefix(homeApplications) else {
73
- return
74
- }
75
- guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return }
76
-
77
- let serviceName = "PlatformHelper"
78
- let bundledService = Bundle.main.bundleURL
79
- .appendingPathComponent("Contents/XPCServices/\(serviceName).xpc", isDirectory: true)
80
- guard FileManager.default.fileExists(atPath: bundledService.path) else {
81
- NSLog("Bleam helper unavailable: bundled executable is missing")
82
- return
83
- }
84
-
85
- let label = "\(bundleIdentifier).PlatformHelper"
86
- let domain = "gui/\(getuid())"
87
- _ = runLaunchctl(["bootout", "\(domain)/\(label)"])
88
-
89
- let helperRoot = homeDirectory
90
- .appendingPathComponent("Library/Application Support/Bleam/Helpers", isDirectory: true)
91
- .appendingPathComponent(bundleIdentifier, isDirectory: true)
92
- let installedService = helperRoot.appendingPathComponent("\(serviceName).xpc", isDirectory: true)
93
- let executable = installedService
94
- .appendingPathComponent("Contents/MacOS/\(serviceName)")
95
- let launchAgents = homeDirectory
96
- .appendingPathComponent("Library/LaunchAgents", isDirectory: true)
97
- let plistURL = launchAgents.appendingPathComponent("\(label).plist")
98
- let propertyList: [String: Any] = [
99
- "Label": label,
100
- "ProgramArguments": [executable.path],
101
- "RunAtLoad": true,
102
- "KeepAlive": true,
103
- "ProcessType": "Background",
104
- "MachServices": ["\(bundleIdentifier).PlatformHelper": true],
105
- "EnvironmentVariables": ["XPC_SERVICE_NAME": "\(bundleIdentifier).PlatformHelper"],
106
- ]
107
-
108
- do {
109
- try FileManager.default.createDirectory(
110
- at: helperRoot,
111
- withIntermediateDirectories: true
112
- )
113
- try? FileManager.default.removeItem(at: installedService)
114
- try FileManager.default.copyItem(at: bundledService, to: installedService)
115
- try FileManager.default.createDirectory(
116
- at: launchAgents,
117
- withIntermediateDirectories: true
118
- )
119
- let data = try PropertyListSerialization.data(
120
- fromPropertyList: propertyList,
121
- format: .xml,
122
- options: 0
123
- )
124
- try data.write(to: plistURL, options: .atomic)
125
- } catch {
126
- NSLog("Bleam helper install failed: %@", error.localizedDescription)
127
- return
128
- }
129
-
130
- if runLaunchctl(["bootstrap", domain, plistURL.path]) != 0 {
131
- NSLog("Bleam helper registration failed")
132
- }
133
- #endif
134
- }
135
-
136
- private static func runLaunchctl(_ arguments: [String]) -> Int32 {
137
- let values = ["launchctl"] + arguments
138
- var argv = values.map { strdup($0) }
139
- argv.append(nil)
140
- defer { argv.compactMap { $0 }.forEach { free($0) } }
141
-
142
- var pid: pid_t = 0
143
- let result = posix_spawn(&pid, "/bin/launchctl", nil, nil, &argv, environ)
144
- guard result == 0 else { return Int32(result) }
145
- var status: Int32 = 0
146
- guard waitpid(pid, &status, 0) == pid else { return -1 }
147
- return status
148
- }
149
- }
150
-
151
54
  class ReactNativeDelegate: ExpoReactNativeFactoryDelegate {
152
55
  private let bundleOverrideURL: URL?
153
56
 
@@ -61,8 +61,27 @@
61
61
  D63D5719C5F6BEF2642A0627 /* GenerationWorkerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C1C083A847A6F08154A7655 /* GenerationWorkerProtocol.swift */; };
62
62
  F11748422D0307B40044C1D9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F11748412D0307B40044C1D9 /* AppDelegate.swift */; };
63
63
  F3E19B0AABF791129F5C2531 /* Flux2KVCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D1000122F00000000000012 /* Flux2KVCache.swift */; };
64
- A10000000000000000000001 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10000000000000000000005 /* main.swift */; };
65
- A10000000000000000000002 /* PlatformHelper.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = A10000000000000000000006 /* PlatformHelper.xpc */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
64
+ C30000000000000000000001 /* ModelCapabilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000001 /* ModelCapabilities.swift */; };
65
+ C30000000000000000000002 /* GenerationTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000002 /* GenerationTypes.swift */; };
66
+ C30000000000000000000003 /* TokenSampler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000003 /* TokenSampler.swift */; };
67
+ C30000000000000000000004 /* TextKVCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000004 /* TextKVCache.swift */; };
68
+ C30000000000000000000005 /* Qwen3CheckpointLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000005 /* Qwen3CheckpointLoader.swift */; };
69
+ C30000000000000000000006 /* Qwen3Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000006 /* Qwen3Configuration.swift */; };
70
+ C30000000000000000000007 /* Qwen3Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000007 /* Qwen3Model.swift */; };
71
+ C30000000000000000000008 /* Qwen3InferenceSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000008 /* Qwen3InferenceSession.swift */; };
72
+ C30000000000000000000009 /* Qwen3Layers.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000009 /* Qwen3Layers.swift */; };
73
+ C3000000000000000000000A /* QwenHybridFullAttention.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2000000000000000000000A /* QwenHybridFullAttention.swift */; };
74
+ C3000000000000000000000B /* QwenHybridLayers.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2000000000000000000000B /* QwenHybridLayers.swift */; };
75
+ C3000000000000000000000C /* QwenHybridLinearAttention.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2000000000000000000000C /* QwenHybridLinearAttention.swift */; };
76
+ C3000000000000000000000D /* QwenHybridCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2000000000000000000000D /* QwenHybridCache.swift */; };
77
+ C3000000000000000000000E /* Qwen35Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2000000000000000000000E /* Qwen35Session.swift */; };
78
+ C3000000000000000000000F /* Qwen35Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2000000000000000000000F /* Qwen35Configuration.swift */; };
79
+ C30000000000000000000010 /* Qwen35Checkpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000010 /* Qwen35Checkpoint.swift */; };
80
+ C30000000000000000000011 /* Qwen35Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000011 /* Qwen35Model.swift */; };
81
+ C30000000000000000000012 /* BonsaiTextSnapshotValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000012 /* BonsaiTextSnapshotValidator.swift */; };
82
+ C30000000000000000000013 /* BonsaiTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000013 /* BonsaiTextModel.swift */; };
83
+ C30000000000000000000014 /* BonsaiTextGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000014 /* BonsaiTextGenerator.swift */; };
84
+ C30000000000000000000015 /* BonsaiTextGenerationRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20000000000000000000015 /* BonsaiTextGenerationRunner.swift */; };
66
85
  /* End PBXBuildFile section */
67
86
 
68
87
  /* Begin PBXContainerItemProxy section */
@@ -73,13 +92,6 @@
73
92
  remoteGlobalIDString = 8F04CB76A01E93A4B73D67A5;
74
93
  remoteInfo = GenerationService;
75
94
  };
76
- A10000000000000000000003 /* PBXContainerItemProxy */ = {
77
- isa = PBXContainerItemProxy;
78
- containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
79
- proxyType = 1;
80
- remoteGlobalIDString = A1000000000000000000000A;
81
- remoteInfo = PlatformHelper;
82
- };
83
95
  /* End PBXContainerItemProxy section */
84
96
 
85
97
  /* Begin PBXCopyFilesBuildPhase section */
@@ -104,7 +116,6 @@
104
116
  dstSubfolderSpec = 16;
105
117
  files = (
106
118
  8BEA0DE1098E9F3D9607D785 /* GenerationService.xpc in Embed XPC Services */,
107
- A10000000000000000000002 /* PlatformHelper.xpc in Embed XPC Services */,
108
119
  );
109
120
  name = "Embed XPC Services";
110
121
  runOnlyForDeploymentPostprocessing = 0;
@@ -172,19 +183,30 @@
172
183
  F11748412D0307B40044C1D9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = bleam/AppDelegate.swift; sourceTree = "<group>"; };
173
184
  F11748442D0722820044C1D9 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "Bridging-Header.h"; path = "bleam/Bridging-Header.h"; sourceTree = "<group>"; };
174
185
  FB433ED9D990D1F5BEAC2C93 /* GenerationService.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; name = GenerationService.xpc; path = GenerationService.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
175
- A10000000000000000000004 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
176
- A10000000000000000000005 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
177
- A10000000000000000000006 /* PlatformHelper.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = PlatformHelper.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
186
+ C20000000000000000000001 /* ModelCapabilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelCapabilities.swift; sourceTree = "<group>"; };
187
+ C20000000000000000000002 /* GenerationTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerationTypes.swift; sourceTree = "<group>"; };
188
+ C20000000000000000000003 /* TokenSampler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenSampler.swift; sourceTree = "<group>"; };
189
+ C20000000000000000000004 /* TextKVCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextKVCache.swift; sourceTree = "<group>"; };
190
+ C20000000000000000000005 /* Qwen3CheckpointLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen3CheckpointLoader.swift; sourceTree = "<group>"; };
191
+ C20000000000000000000006 /* Qwen3Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen3Configuration.swift; sourceTree = "<group>"; };
192
+ C20000000000000000000007 /* Qwen3Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen3Model.swift; sourceTree = "<group>"; };
193
+ C20000000000000000000008 /* Qwen3InferenceSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen3InferenceSession.swift; sourceTree = "<group>"; };
194
+ C20000000000000000000009 /* Qwen3Layers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen3Layers.swift; sourceTree = "<group>"; };
195
+ C2000000000000000000000A /* QwenHybridFullAttention.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QwenHybridFullAttention.swift; sourceTree = "<group>"; };
196
+ C2000000000000000000000B /* QwenHybridLayers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QwenHybridLayers.swift; sourceTree = "<group>"; };
197
+ C2000000000000000000000C /* QwenHybridLinearAttention.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QwenHybridLinearAttention.swift; sourceTree = "<group>"; };
198
+ C2000000000000000000000D /* QwenHybridCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QwenHybridCache.swift; sourceTree = "<group>"; };
199
+ C2000000000000000000000E /* Qwen35Session.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen35Session.swift; sourceTree = "<group>"; };
200
+ C2000000000000000000000F /* Qwen35Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen35Configuration.swift; sourceTree = "<group>"; };
201
+ C20000000000000000000010 /* Qwen35Checkpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen35Checkpoint.swift; sourceTree = "<group>"; };
202
+ C20000000000000000000011 /* Qwen35Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Qwen35Model.swift; sourceTree = "<group>"; };
203
+ C20000000000000000000012 /* BonsaiTextSnapshotValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BonsaiTextSnapshotValidator.swift; sourceTree = "<group>"; };
204
+ C20000000000000000000013 /* BonsaiTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BonsaiTextModel.swift; sourceTree = "<group>"; };
205
+ C20000000000000000000014 /* BonsaiTextGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BonsaiTextGenerator.swift; sourceTree = "<group>"; };
206
+ C20000000000000000000015 /* BonsaiTextGenerationRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BonsaiTextGenerationRunner.swift; sourceTree = "<group>"; };
178
207
  /* End PBXFileReference section */
179
208
 
180
209
  /* Begin PBXFrameworksBuildPhase section */
181
- A10000000000000000000007 /* Frameworks */ = {
182
- isa = PBXFrameworksBuildPhase;
183
- buildActionMask = 2147483647;
184
- files = (
185
- );
186
- runOnlyForDeploymentPostprocessing = 0;
187
- };
188
210
  0656BC11F02F0C51B3DC5EE0 /* Frameworks */ = {
189
211
  isa = PBXFrameworksBuildPhase;
190
212
  buildActionMask = 2147483647;
@@ -216,6 +238,7 @@
216
238
  8C3E6C6922B84B0C9F49B001 /* SceneDelegate.swift */,
217
239
  8C3E6C7822B84B0C9F49B001 /* bleam.entitlements */,
218
240
  8D1001002F00000000000100 /* Flux2 */,
241
+ C40000000000000000000001 /* TextGeneration */,
219
242
  F11748442D0722820044C1D9 /* Bridging-Header.h */,
220
243
  BB2F792B24A3F905000567C9 /* Supporting */,
221
244
  13B07FB51A68108700A75B9A /* Images.xcassets */,
@@ -268,7 +291,6 @@
268
291
  C304F306F23C790312DB9DC3 /* ExpoModulesProviders */,
269
292
  B895E2E16B0B07754F5B5D83 /* Shared */,
270
293
  AB7C58FE1F91CA4ED0C60825 /* GenerationService */,
271
- A1000000000000000000000F /* PlatformHelper */,
272
294
  );
273
295
  indentWidth = 2;
274
296
  sourceTree = "<group>";
@@ -280,7 +302,6 @@
280
302
  children = (
281
303
  13B07F961A680F5B00A75B9A /* bleam.app */,
282
304
  FB433ED9D990D1F5BEAC2C93 /* GenerationService.xpc */,
283
- A10000000000000000000006 /* PlatformHelper.xpc */,
284
305
  );
285
306
  name = Products;
286
307
  sourceTree = "<group>";
@@ -330,18 +351,78 @@
330
351
  7DFD85F313B4BAB889F5FECF /* GenerationService.entitlements */,
331
352
  E72903DB5F3C7D30AA5ED70B /* main.swift */,
332
353
  A4485061CD0366330F3F5BE0 /* ImageGenerationRunner.swift */,
354
+ C20000000000000000000015 /* BonsaiTextGenerationRunner.swift */,
333
355
  );
334
356
  name = GenerationService;
335
357
  path = GenerationService;
336
358
  sourceTree = "<group>";
337
359
  };
338
- A1000000000000000000000F /* PlatformHelper */ = {
360
+ C40000000000000000000001 /* TextGeneration */ = {
361
+ isa = PBXGroup;
362
+ children = (
363
+ C40000000000000000000002 /* Core */,
364
+ C40000000000000000000003 /* Qwen3 */,
365
+ C40000000000000000000004 /* QwenHybrid */,
366
+ C40000000000000000000005 /* Qwen35 */,
367
+ C40000000000000000000006 /* Bonsai */,
368
+ );
369
+ name = TextGeneration;
370
+ path = bleam/AI/TextGeneration;
371
+ sourceTree = "<group>";
372
+ };
373
+ C40000000000000000000002 /* Core */ = {
339
374
  isa = PBXGroup;
340
375
  children = (
341
- A10000000000000000000004 /* Info.plist */,
342
- A10000000000000000000005 /* main.swift */,
376
+ C20000000000000000000001 /* ModelCapabilities.swift */,
377
+ C20000000000000000000002 /* GenerationTypes.swift */,
378
+ C20000000000000000000003 /* TokenSampler.swift */,
379
+ C20000000000000000000004 /* TextKVCache.swift */,
343
380
  );
344
- path = PlatformHelper;
381
+ path = Core;
382
+ sourceTree = "<group>";
383
+ };
384
+ C40000000000000000000003 /* Qwen3 */ = {
385
+ isa = PBXGroup;
386
+ children = (
387
+ C20000000000000000000005 /* Qwen3CheckpointLoader.swift */,
388
+ C20000000000000000000006 /* Qwen3Configuration.swift */,
389
+ C20000000000000000000007 /* Qwen3Model.swift */,
390
+ C20000000000000000000008 /* Qwen3InferenceSession.swift */,
391
+ C20000000000000000000009 /* Qwen3Layers.swift */,
392
+ );
393
+ path = Qwen3;
394
+ sourceTree = "<group>";
395
+ };
396
+ C40000000000000000000004 /* QwenHybrid */ = {
397
+ isa = PBXGroup;
398
+ children = (
399
+ C2000000000000000000000A /* QwenHybridFullAttention.swift */,
400
+ C2000000000000000000000B /* QwenHybridLayers.swift */,
401
+ C2000000000000000000000C /* QwenHybridLinearAttention.swift */,
402
+ C2000000000000000000000D /* QwenHybridCache.swift */,
403
+ );
404
+ path = QwenHybrid;
405
+ sourceTree = "<group>";
406
+ };
407
+ C40000000000000000000005 /* Qwen35 */ = {
408
+ isa = PBXGroup;
409
+ children = (
410
+ C2000000000000000000000E /* Qwen35Session.swift */,
411
+ C2000000000000000000000F /* Qwen35Configuration.swift */,
412
+ C20000000000000000000010 /* Qwen35Checkpoint.swift */,
413
+ C20000000000000000000011 /* Qwen35Model.swift */,
414
+ );
415
+ path = Qwen35;
416
+ sourceTree = "<group>";
417
+ };
418
+ C40000000000000000000006 /* Bonsai */ = {
419
+ isa = PBXGroup;
420
+ children = (
421
+ C20000000000000000000012 /* BonsaiTextSnapshotValidator.swift */,
422
+ C20000000000000000000013 /* BonsaiTextModel.swift */,
423
+ C20000000000000000000014 /* BonsaiTextGenerator.swift */,
424
+ );
425
+ path = Bonsai;
345
426
  sourceTree = "<group>";
346
427
  };
347
428
  B895E2E16B0B07754F5B5D83 /* Shared */ = {
@@ -419,7 +500,6 @@
419
500
  );
420
501
  dependencies = (
421
502
  6E20F2C4EC850BB2D3853EAD /* PBXTargetDependency */,
422
- A1000000000000000000000B /* PBXTargetDependency */,
423
503
  );
424
504
  name = bleam;
425
505
  productName = bleam;
@@ -444,23 +524,6 @@
444
524
  productReference = FB433ED9D990D1F5BEAC2C93 /* GenerationService.xpc */;
445
525
  productType = "com.apple.product-type.xpc-service";
446
526
  };
447
- A1000000000000000000000A /* PlatformHelper */ = {
448
- isa = PBXNativeTarget;
449
- buildConfigurationList = A1000000000000000000000E /* Build configuration list for PBXNativeTarget "PlatformHelper" */;
450
- buildPhases = (
451
- A10000000000000000000009 /* Sources */,
452
- A10000000000000000000007 /* Frameworks */,
453
- A10000000000000000000008 /* Resources */,
454
- );
455
- buildRules = (
456
- );
457
- dependencies = (
458
- );
459
- name = PlatformHelper;
460
- productName = PlatformHelper;
461
- productReference = A10000000000000000000006 /* PlatformHelper.xpc */;
462
- productType = "com.apple.product-type.xpc-service";
463
- };
464
527
  /* End PBXNativeTarget section */
465
528
 
466
529
  /* Begin PBXProject section */
@@ -475,9 +538,6 @@
475
538
  8F04CB76A01E93A4B73D67A5 = {
476
539
  LastSwiftMigration = 1250;
477
540
  };
478
- A1000000000000000000000A = {
479
- LastSwiftMigration = 1250;
480
- };
481
541
  };
482
542
  };
483
543
  buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Bleam" */;
@@ -495,7 +555,6 @@
495
555
  targets = (
496
556
  13B07F861A680F5B00A75B9A /* bleam */,
497
557
  8F04CB76A01E93A4B73D67A5 /* GenerationService */,
498
- A1000000000000000000000A /* PlatformHelper */,
499
558
  );
500
559
  };
501
560
  /* End PBXProject section */
@@ -519,13 +578,6 @@
519
578
  );
520
579
  runOnlyForDeploymentPostprocessing = 0;
521
580
  };
522
- A10000000000000000000008 /* Resources */ = {
523
- isa = PBXResourcesBuildPhase;
524
- buildActionMask = 2147483647;
525
- files = (
526
- );
527
- runOnlyForDeploymentPostprocessing = 0;
528
- };
529
581
  /* End PBXResourcesBuildPhase section */
530
582
 
531
583
  /* Begin PBXShellScriptBuildPhase section */
@@ -687,6 +739,27 @@
687
739
  D63D5719C5F6BEF2642A0627 /* GenerationWorkerProtocol.swift in Sources */,
688
740
  90AAAF98423C82ED52385571 /* main.swift in Sources */,
689
741
  B23B4E23A940CE8F6FD4B85A /* ImageGenerationRunner.swift in Sources */,
742
+ C30000000000000000000015 /* BonsaiTextGenerationRunner.swift in Sources */,
743
+ C30000000000000000000001 /* ModelCapabilities.swift in Sources */,
744
+ C30000000000000000000002 /* GenerationTypes.swift in Sources */,
745
+ C30000000000000000000003 /* TokenSampler.swift in Sources */,
746
+ C30000000000000000000004 /* TextKVCache.swift in Sources */,
747
+ C30000000000000000000005 /* Qwen3CheckpointLoader.swift in Sources */,
748
+ C30000000000000000000006 /* Qwen3Configuration.swift in Sources */,
749
+ C30000000000000000000007 /* Qwen3Model.swift in Sources */,
750
+ C30000000000000000000008 /* Qwen3InferenceSession.swift in Sources */,
751
+ C30000000000000000000009 /* Qwen3Layers.swift in Sources */,
752
+ C3000000000000000000000A /* QwenHybridFullAttention.swift in Sources */,
753
+ C3000000000000000000000B /* QwenHybridLayers.swift in Sources */,
754
+ C3000000000000000000000C /* QwenHybridLinearAttention.swift in Sources */,
755
+ C3000000000000000000000D /* QwenHybridCache.swift in Sources */,
756
+ C3000000000000000000000E /* Qwen35Session.swift in Sources */,
757
+ C3000000000000000000000F /* Qwen35Configuration.swift in Sources */,
758
+ C30000000000000000000010 /* Qwen35Checkpoint.swift in Sources */,
759
+ C30000000000000000000011 /* Qwen35Model.swift in Sources */,
760
+ C30000000000000000000012 /* BonsaiTextSnapshotValidator.swift in Sources */,
761
+ C30000000000000000000013 /* BonsaiTextModel.swift in Sources */,
762
+ C30000000000000000000014 /* BonsaiTextGenerator.swift in Sources */,
690
763
  5224DF2286EAF50159491DCA /* Flux2Config.swift in Sources */,
691
764
  814C5B6310C5000E9B289C59 /* MemoryConfig.swift in Sources */,
692
765
  9819B5258147130BD109E6CD /* MemoryOptimizationConfig.swift in Sources */,
@@ -721,14 +794,6 @@
721
794
  );
722
795
  runOnlyForDeploymentPostprocessing = 0;
723
796
  };
724
- A10000000000000000000009 /* Sources */ = {
725
- isa = PBXSourcesBuildPhase;
726
- buildActionMask = 2147483647;
727
- files = (
728
- A10000000000000000000001 /* main.swift in Sources */,
729
- );
730
- runOnlyForDeploymentPostprocessing = 0;
731
- };
732
797
  /* End PBXSourcesBuildPhase section */
733
798
 
734
799
  /* Begin PBXTargetDependency section */
@@ -738,12 +803,6 @@
738
803
  target = 8F04CB76A01E93A4B73D67A5 /* GenerationService */;
739
804
  targetProxy = 0B3BB0ECB863062C83BCE9B3 /* PBXContainerItemProxy */;
740
805
  };
741
- A1000000000000000000000B /* PBXTargetDependency */ = {
742
- isa = PBXTargetDependency;
743
- name = PlatformHelper;
744
- target = A1000000000000000000000A /* PlatformHelper */;
745
- targetProxy = A10000000000000000000003 /* PBXContainerItemProxy */;
746
- };
747
806
  /* End PBXTargetDependency section */
748
807
 
749
808
  /* Begin XCBuildConfiguration section */
@@ -1058,49 +1117,6 @@
1058
1117
  };
1059
1118
  name = Debug;
1060
1119
  };
1061
- A1000000000000000000000C /* Debug */ = {
1062
- isa = XCBuildConfiguration;
1063
- buildSettings = {
1064
- CODE_SIGN_STYLE = Automatic;
1065
- CURRENT_PROJECT_VERSION = 1;
1066
- DEAD_CODE_STRIPPING = YES;
1067
- DEVELOPMENT_TEAM = 5SZ3H5P69M;
1068
- ENABLE_APP_SANDBOX = NO;
1069
- ENABLE_HARDENED_RUNTIME = YES;
1070
- GENERATE_INFOPLIST_FILE = NO;
1071
- INFOPLIST_FILE = PlatformHelper/Info.plist;
1072
- MACOSX_DEPLOYMENT_TARGET = 13.4;
1073
- MARKETING_VERSION = 1.0;
1074
- PRODUCT_BUNDLE_IDENTIFIER = dev.bleam.app.PlatformHelper;
1075
- PRODUCT_NAME = "$(TARGET_NAME)";
1076
- SDKROOT = macosx;
1077
- SKIP_INSTALL = YES;
1078
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1079
- SWIFT_VERSION = 5.0;
1080
- };
1081
- name = Debug;
1082
- };
1083
- A1000000000000000000000D /* Release */ = {
1084
- isa = XCBuildConfiguration;
1085
- buildSettings = {
1086
- CODE_SIGN_STYLE = Automatic;
1087
- CURRENT_PROJECT_VERSION = 1;
1088
- DEAD_CODE_STRIPPING = YES;
1089
- DEVELOPMENT_TEAM = 5SZ3H5P69M;
1090
- ENABLE_APP_SANDBOX = NO;
1091
- ENABLE_HARDENED_RUNTIME = YES;
1092
- GENERATE_INFOPLIST_FILE = NO;
1093
- INFOPLIST_FILE = PlatformHelper/Info.plist;
1094
- MACOSX_DEPLOYMENT_TARGET = 13.4;
1095
- MARKETING_VERSION = 1.0;
1096
- PRODUCT_BUNDLE_IDENTIFIER = dev.bleam.app.PlatformHelper;
1097
- PRODUCT_NAME = "$(TARGET_NAME)";
1098
- SDKROOT = macosx;
1099
- SKIP_INSTALL = YES;
1100
- SWIFT_VERSION = 5.0;
1101
- };
1102
- name = Release;
1103
- };
1104
1120
  /* End XCBuildConfiguration section */
1105
1121
 
1106
1122
  /* Begin XCConfigurationList section */
@@ -1131,15 +1147,6 @@
1131
1147
  defaultConfigurationIsVisible = 0;
1132
1148
  defaultConfigurationName = Release;
1133
1149
  };
1134
- A1000000000000000000000E /* Build configuration list for PBXNativeTarget "PlatformHelper" */ = {
1135
- isa = XCConfigurationList;
1136
- buildConfigurations = (
1137
- A1000000000000000000000C /* Debug */,
1138
- A1000000000000000000000D /* Release */,
1139
- );
1140
- defaultConfigurationIsVisible = 0;
1141
- defaultConfigurationName = Release;
1142
- };
1143
1150
  /* End XCConfigurationList section */
1144
1151
  };
1145
1152
  rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;