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
51 lines
1.6 KiB
Go
51 lines
1.6 KiB
Go
// Code generated by asuka native. DO NOT EDIT.
|
|
// asuka:native f84252246ecd432c
|
|
|
|
package netcfg
|
|
|
|
import (
|
|
"github.com/egoist/asuka/native"
|
|
)
|
|
|
|
// nativeModule is the package's native code, as the hosts find it.
|
|
var nativeModule = &native.Module{ID: "github.com/openchamber/openchamber-native/netcfg", Swift: "AsukaModule_github_com_openchamber_openchamber_native_netcfg", Kotlin: "com.github.openchamber.openchamber_native.netcfg.AsukaModule", Errors: []error{}}
|
|
|
|
// NewNetcfg makes the platform's Netcfg: Go's, where the package implements it
|
|
// in Go (implementNetcfg), else its native code's (Swift on iOS and macOS,
|
|
// Kotlin on Android, JavaScript on the web). Without one, it returns an
|
|
// error that is errors.ErrUnsupported.
|
|
func NewNetcfg() (Netcfg, error) {
|
|
if nativeImplNetcfg != nil {
|
|
return nativeImplNetcfg()
|
|
}
|
|
o, err := nativeModule.New(0, "Netcfg")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &nativeNetcfg{o}, nil
|
|
}
|
|
|
|
var nativeImplNetcfg func() (Netcfg, error)
|
|
|
|
// implementNetcfg makes NewNetcfg return Go's implementation: call it from an
|
|
// init function of a file built for the platforms where the package's
|
|
// native code is Go (Windows, Linux).
|
|
func implementNetcfg(make func() (Netcfg, error)) { nativeImplNetcfg = make }
|
|
|
|
// nativeNetcfg is a Netcfg on the platform's side.
|
|
type nativeNetcfg struct{ o *native.Object }
|
|
|
|
func (x *nativeNetcfg) Hello(name string) (string, error) {
|
|
w := native.NewWriter()
|
|
w.String(name)
|
|
r, err := x.o.Call(1, w)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
v := r.String()
|
|
if err := r.Done(); err != nil {
|
|
return "", err
|
|
}
|
|
return v, nil
|
|
}
|