Compare commits

..
Author SHA1 Message Date
anandh8x fbfc2a07fa fix: add android platform support for Termux npm install
`npm install -g @gitlawb/zero` failed on Android/Termux with EBADPLATFORM
because `package.json` `os` array lacked `"android"`. Termux provides a
Linux userspace — the existing `linux-arm64` binary works natively.

- Add `"android"` to the `os` array in package.json.
- Map `android` platform to `linux` in postinstall.mjs resolvePlatform().

Fixes #449
2026-07-03 19:17:51 +05:30
4 changed files with 5 additions and 57 deletions

No files matched your search

+1 -9
View File
@@ -619,15 +619,7 @@ func (m model) normalizeProfileForProvider(provider providercatalog.Descriptor)
strings.TrimSpace(profile.Name) == "" ||
strings.TrimSpace(profile.CatalogID) == ""
if normalizeIdentity {
// Only canonicalize an empty or generic placeholder name — never clobber a
// real user-provided profile name. The credential store is keyed by
// profile.Name (SecureProviderProfile stores under Name), so rewriting it
// here made the later profileWithCredential lookup miss the saved key and
// rebuild a keyless provider — a 401 on every /model switch for any profile
// named differently from its catalog id (e.g. "my-openai").
if strings.TrimSpace(profile.Name) == "" || genericProviderCatalogID(profile.Name) {
profile.Name = provider.ID
}
profile.Name = provider.ID
profile.CatalogID = provider.ID
}
if strings.TrimSpace(profile.BaseURL) == "" {
-46
View File
@@ -976,49 +976,3 @@ func TestSwitchProviderModelWarmsDiscoveryForTheNewProvider(t *testing.T) {
t.Fatal("switching to ollama should warm both the generic and ollama-specific discovery commands")
}
}
func TestNormalizeProfileForProviderPreservesCustomName(t *testing.T) {
openai, ok := providercatalog.Get("openai")
if !ok {
t.Fatal("openai descriptor missing from catalog")
}
// A first-party provider set up with a custom profile name and the baseURL at
// the catalog default. normalizeIdentity is true here (baseURL matches), but
// the real name must survive: it is the credential-store key, so clobbering it
// dropped the saved key and 401'd every /model switch (issue #440).
m := model{providerProfile: config.ProviderProfile{
Name: "my-openai",
CatalogID: "openai",
BaseURL: openai.DefaultBaseURL,
APIKeyStored: true,
}}
got := m.normalizeProfileForProvider(openai)
if got.Name != "my-openai" {
t.Fatalf("Name = %q, want it preserved as %q (credential store is keyed by Name)", got.Name, "my-openai")
}
if got.CatalogID != "openai" {
t.Fatalf("CatalogID = %q, want it canonicalized to %q", got.CatalogID, "openai")
}
}
func TestNormalizeProfileForProviderCanonicalizesPlaceholderName(t *testing.T) {
openai, ok := providercatalog.Get("openai")
if !ok {
t.Fatal("openai descriptor missing from catalog")
}
// Empty and generic placeholder names still get canonicalized to the catalog
// id — those carry no meaningful credential-store key to preserve.
for _, name := range []string{"", "custom-openai-compatible"} {
m := model{providerProfile: config.ProviderProfile{
Name: name,
BaseURL: openai.DefaultBaseURL,
CatalogID: name,
}}
got := m.normalizeProfileForProvider(openai)
if got.Name != "openai" {
t.Fatalf("Name = %q for placeholder %q, want canonicalized to %q", got.Name, name, "openai")
}
}
}
+2 -1
View File
@@ -24,7 +24,8 @@
"os": [
"linux",
"darwin",
"win32"
"win32",
"android"
],
"cpu": [
"x64",
+2 -1
View File
@@ -14,7 +14,7 @@
// Env overrides (testing / mirrors / locked-down installs):
// ZERO_SKIP_DOWNLOAD=1 skip entirely, exit 0 (wrapper will guide if run)
// ZERO_INSTALL_DRY_RUN=1 print the resolved plan as JSON, no network, exit 0
// ZERO_INSTALL_PLATFORM=… override process.platform (linux|darwin|win32)
// ZERO_INSTALL_PLATFORM=… override process.platform (linux|darwin|win32|android)
// ZERO_INSTALL_ARCH=… override process.arch (x64|arm64)
// ZERO_REPO=owner/name override the GitHub repo (default Gitlawb/zero)
// ZERO_GITHUB_BASE_URL=… override the download host (default https://github.com)
@@ -65,6 +65,7 @@ function warnSkip(message) {
function resolvePlatform(p) {
switch (p) {
case 'linux':
case 'android':
return 'linux';
case 'darwin':
return 'macos';