codewhale 0.10.1 → 0.10.2

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.
package/README.md CHANGED
@@ -84,13 +84,21 @@ versions whose matching GitHub Release publishes both assets, and remains
84
84
  preview support pending real-device QA. See the support table in
85
85
  [docs/INSTALL.md](https://github.com/codewhale-hq/CodeWhale/blob/main/docs/INSTALL.md).
86
86
 
87
- HarmonyOS PC (`openharmony`) is treated as `linux`, so it gets the Linux
88
- binaries matching your CPU architecture (x64 or arm64). Linux riscv64 prebuilts
89
- are temporarily paused while the locked `rquickjs-sys` dependency lacks
90
- `riscv64gc-unknown-linux-gnu` bindings. Other platform/architecture combinations
91
- (FreeBSD, Linux riscv64, …) aren't shipped as prebuilts. Unsupported platforms,
92
- checksum failures, and glibc compatibility problems still fail with a clear
93
- error pointing you at the full
87
+ On a HarmonyOS PC, install inside the Linux subsystem (融合开发引擎, openEuler),
88
+ where the wrapper sees `linux` and installs the Linux arm64 binaries. In a native
89
+ HarmonyOS or OpenHarmony terminal (`openharmony`), the wrapper still installs the
90
+ static Linux build matching your CPU architecture (x64 or arm64) as a best
91
+ effort. That build is untested on native HarmonyOS. If the binary cannot start,
92
+ `codewhale` prints directions to use the Linux subsystem or build
93
+ `aarch64-unknown-linux-ohos` from source. The install script also prints a
94
+ warning, which npm 7 and later show only with `--foreground-scripts`. See
95
+ [docs/HarmonyOS.md](https://github.com/codewhale-hq/CodeWhale/blob/main/docs/HarmonyOS.md).
96
+
97
+ Linux riscv64 prebuilts are temporarily paused while the locked `rquickjs-sys`
98
+ dependency lacks `riscv64gc-unknown-linux-gnu` bindings. Other
99
+ platform/architecture combinations (FreeBSD, Linux riscv64, …) aren't shipped
100
+ as prebuilts. Unsupported platforms, checksum failures, and glibc compatibility
101
+ problems still fail with a clear error pointing you at the full
94
102
  [docs/INSTALL.md](https://github.com/codewhale-hq/CodeWhale/blob/main/docs/INSTALL.md)
95
103
  guide.
96
104
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codewhale",
3
- "version": "0.10.1",
4
- "codewhaleBinaryVersion": "0.10.1",
3
+ "version": "0.10.2",
4
+ "codewhaleBinaryVersion": "0.10.2",
5
5
  "description": "Terminal coding agent for supported hosted and local models. One runtime on your machine. Rust, MIT.",
6
6
  "author": "Hmbown",
7
7
  "license": "MIT",
@@ -61,8 +61,8 @@ const ASSET_MATRIX = {
61
61
  },
62
62
  };
63
63
 
64
- // HarmonyPC (openharmony) is an x86_64 Linux-compatible environment; map it to
65
- // the linux binary family so npm install succeeds without a separate build target.
64
+ // Native HarmonyOS/OpenHarmony (openharmony) gets the static musl Linux build as
65
+ // a best effort; that build is untested on native HarmonyOS.
66
66
  const PLATFORM_ALIASES = {
67
67
  openharmony: "linux",
68
68
  };
@@ -116,6 +116,17 @@ function unsupportedBuildHint() {
116
116
  ].join("\n");
117
117
  }
118
118
 
119
+ function openHarmonyDirections() {
120
+ return [
121
+ "On a HarmonyOS PC, install Codewhale inside the Linux subsystem (融合开发引擎, openEuler):",
122
+ "",
123
+ " curl -fsSL https://codewhale.net/install.sh | sh",
124
+ "",
125
+ "Or build the native aarch64-unknown-linux-ohos binary from source by following",
126
+ "\"Cross-Compiling To OpenHarmony\" in docs/HarmonyOS.md of codewhale-hq/CodeWhale.",
127
+ ].join("\n");
128
+ }
129
+
119
130
  function unsupportedRiscvHint() {
120
131
  return [
121
132
  "Linux riscv64 prebuilt binaries are temporarily unavailable.",
@@ -294,6 +305,7 @@ module.exports = {
294
305
  hasExplicitReleaseBase,
295
306
  isCnbSupportedTarget,
296
307
  LEGACY_TUI_BRIDGE_ASSET_NAMES,
308
+ openHarmonyDirections,
297
309
  releaseAssetUrl,
298
310
  releaseAssetUrlFromBase,
299
311
  releaseBaseUrl,
@@ -34,6 +34,7 @@ const {
34
34
  explicitReleaseBase,
35
35
  firstPartyReleaseSources,
36
36
  githubReleaseBaseUrl,
37
+ openHarmonyDirections,
37
38
  releaseAssetUrl,
38
39
  releaseAssetUrlFromBase,
39
40
  releaseBinaryDirectory,
@@ -1702,6 +1703,16 @@ async function run(options = {}) {
1702
1703
  const version = resolvePackageVersion(pkg, env);
1703
1704
  const repo = resolveRepo(env);
1704
1705
  const paths = options.paths || binaryPaths();
1706
+ if (
1707
+ isInstallContext(context) &&
1708
+ (options.platform || os.platform()) === "openharmony" &&
1709
+ !isQuietInstall(env)
1710
+ ) {
1711
+ process.stderr.write(
1712
+ `codewhale: warning: installing ${paths.codewhale.asset}, the Linux build, which is untested on native HarmonyOS/OpenHarmony.\n` +
1713
+ `${openHarmonyDirections()}\n`,
1714
+ );
1715
+ }
1705
1716
  const releaseDir = options.releaseDir || releaseBinaryDirectory();
1706
1717
  await mkdir(releaseDir, { recursive: true });
1707
1718
 
package/scripts/run.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const { spawn: spawnChild } = require("child_process");
2
2
  const os = require("os");
3
3
  const { getBinaryPath, installFailureHint } = require("./install");
4
+ const { openHarmonyDirections } = require("./artifacts");
4
5
 
5
6
  const pkg = require("../package.json");
6
7
 
@@ -8,9 +9,18 @@ function isVersionFlag(args = process.argv.slice(2)) {
8
9
  return args.includes("--version") || args.includes("-V");
9
10
  }
10
11
 
12
+ const OPEN_HARMONY_EXEC_ERRORS = ["ENOEXEC", "EACCES", "EPERM"];
13
+ const OPEN_HARMONY_STARTUP_SIGNALS = ["SIGKILL", "SIGSYS", "SIGSEGV", "SIGBUS", "SIGILL", "SIGABRT"];
14
+ const OPEN_HARMONY_STARTUP_MS = 5_000;
15
+
11
16
  // Print the install hint (mirror / release-base guidance) for a failure that
12
- // looks like a download problem. Prints nothing for other failures.
17
+ // looks like a download problem, or the HarmonyOS directions when the Linux
18
+ // build cannot be executed on native HarmonyOS. Prints nothing otherwise.
13
19
  function printInstallFailureHint(error, log = console.error) {
20
+ if (os.platform() === "openharmony" && OPEN_HARMONY_EXEC_ERRORS.includes(error && error.code)) {
21
+ log(`The Linux build could not start on native HarmonyOS/OpenHarmony.\n${openHarmonyDirections()}`);
22
+ return;
23
+ }
14
24
  const hint = installFailureHint(error);
15
25
  if (hint) {
16
26
  log(hint);
@@ -134,6 +144,7 @@ async function run(binaryName, options = {}) {
134
144
  throw error;
135
145
  }
136
146
 
147
+ const startedAt = Date.now();
137
148
  const result = await runChild(spawn, binaryPath, args, proc);
138
149
  if (result.error) {
139
150
  if (versionFlag) {
@@ -142,6 +153,16 @@ async function run(binaryName, options = {}) {
142
153
  }
143
154
  throw result.error;
144
155
  }
156
+ if (
157
+ os.platform() === "openharmony" &&
158
+ OPEN_HARMONY_STARTUP_SIGNALS.includes(result.signal) &&
159
+ Date.now() - startedAt < OPEN_HARMONY_STARTUP_MS
160
+ ) {
161
+ console.error(
162
+ `${binaryName} stopped with ${result.signal} at startup; the Linux build may not run on native HarmonyOS/OpenHarmony.\n` +
163
+ openHarmonyDirections(),
164
+ );
165
+ }
145
166
  return exitLikeChild(result, exit, proc);
146
167
  }
147
168
 
@@ -64,6 +64,7 @@ test("genuinely unsupported platform throws with raw platform name", () => {
64
64
  test("known platforms are unaffected by alias map", () => {
65
65
  for (const [platform, arch, expectedCodeWhale] of [
66
66
  ["linux", "x64", "codewhale-linux-x64"],
67
+ ["linux", "arm64", "codewhale-linux-arm64"],
67
68
  ["darwin", "arm64", "codewhale-macos-arm64"],
68
69
  ["win32", "x64", "codewhale-windows-x64.exe"],
69
70
  ["win32", "arm64", "codewhale-windows-arm64.exe"],