feat: bootstrap OpenChamber native Android client
Add a Go client for OpenChamber built with Asuka's native widgets. - internal/ocapi: health, password-to-device-token auth, session and message paging, prompt/interrupt/model/agent, permissions, SSE events, HTTP/SOCKS5 proxies and certificate pinning - internal/storage: connection settings plus a device token in the platform keystore, with a per-install id for server-side dedupe - internal/appui: connect, session list and chat screens with streaming Markdown, reasoning/tool folding, permission cards and session actions - netcfg: native module that enables cleartext HTTP in release builds - cmd/ocprobe: terminal probe for the API - headless UI tests (uitest) and the research/plan document
This commit is contained in:
commit
254d08b1bd
35 files changed
+4922
No files matched your search
@@ -0,0 +1,58 @@
|
||||
// Code generated by asuka native. DO NOT EDIT.
|
||||
// asuka:native f84252246ecd432c
|
||||
|
||||
// What the package's Go declares (package netcfg), as its Swift implements
|
||||
// it. The Swift writes the functions that make each:
|
||||
//
|
||||
// func makeNetcfg() throws -> any Netcfg
|
||||
|
||||
import Foundation
|
||||
import Asuka
|
||||
|
||||
/// Netcfg greets in each platform's own code.
|
||||
public protocol Netcfg: AnyObject {
|
||||
/// Hello greets name.
|
||||
func hello(name: String) throws -> String
|
||||
}
|
||||
|
||||
/// The package's native code as the host finds it (by its Objective-C
|
||||
/// name): what makes, calls and shows what the package declares.
|
||||
@objc(AsukaModule_github_com_openchamber_openchamber_native_netcfg) public final class AsukaModule_github_com_openchamber_openchamber_native_netcfg: NSObject, AsukaModuleProvider {
|
||||
public static func make(_ iface: UInt32) throws -> AnyObject {
|
||||
switch iface {
|
||||
case 0: return try makeNetcfg()
|
||||
default: throw AsukaNativeError.unsupported("no interface \(iface)")
|
||||
}
|
||||
}
|
||||
|
||||
public static func call(_ object: AnyObject, _ iface: UInt32, _ method: UInt32, _ r: inout AsukaNativeReader, _ w: inout AsukaNativeWriter) throws {
|
||||
switch (iface, method) {
|
||||
case (0, 1): // Netcfg.Hello
|
||||
let o = object as! any Netcfg
|
||||
let name = r.string()
|
||||
try r.check()
|
||||
let v = try o.hello(name: name)
|
||||
w.string(v)
|
||||
default: throw AsukaNativeError.unsupported("no method \(iface).\(method)")
|
||||
}
|
||||
}
|
||||
|
||||
public static func start(_ object: AnyObject, _ iface: UInt32, _ method: UInt32, _ input: AsukaNativeReader, _ done: @escaping (Result<AsukaNativeWriter, Error>) -> Void) -> Task<Void, Never>? {
|
||||
var r = input
|
||||
switch (iface, method) {
|
||||
default:
|
||||
done(.failure(AsukaNativeError.unsupported("no method \(iface).\(method)")))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor public static func makeView(_ name: String, _ ctx: AsukaNativeContext) -> AsukaNativeView? {
|
||||
switch name {
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The package's values on the wire (package native's format).
|
||||
fileprivate enum Wire {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// The netcfg package's Swift: what its Go declares, implemented on iOS
|
||||
// and macOS (Netcfg.asuka.swift, beside it, is what asuka native generates).
|
||||
import Asuka
|
||||
import Foundation
|
||||
|
||||
final class SwiftNetcfg: Netcfg {
|
||||
func hello(name: String) throws -> String { "Hello, \(name), from Swift" }
|
||||
}
|
||||
|
||||
func makeNetcfg() throws -> any Netcfg { SwiftNetcfg() }
|
||||
Reference in new issue
Block a user