@bash0816/copilot-termux 1.0.65 → 1.0.68

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/lib/setup.js CHANGED
@@ -98,6 +98,8 @@ async function setup() {
98
98
  fs.renameSync(tmp, currentLink);
99
99
 
100
100
  await setupGlibcWrap();
101
+ await setupGlibcRuntime(versionDir, version);
102
+ await setupGlibcNode();
101
103
  console.log(`✓ copilot ${version} ready`);
102
104
  }
103
105
 
@@ -140,4 +142,76 @@ async function setupGlibcWrap() {
140
142
  console.log('✓ glibc wrap for lxc-exec ready');
141
143
  }
142
144
 
145
+ async function setupGlibcRuntime(versionDir, version) {
146
+ const linux64Dir = path.join(versionDir, 'prebuilds', 'linux-arm64');
147
+ if (fs.existsSync(path.join(linux64Dir, 'runtime.node'))) {
148
+ return;
149
+ }
150
+
151
+ const glibcPkg = '@github/copilot-linux-arm64';
152
+ console.log(`Fetching ${glibcPkg}@${version} metadata...`);
153
+ const metaBuf = await httpsGet(`${REGISTRY}/${glibcPkg}/${version}`, { Accept: 'application/json' });
154
+ const meta = JSON.parse(metaBuf.toString());
155
+ const tarballUrl = meta.dist.tarball;
156
+ const integrity = meta.dist.integrity;
157
+
158
+ console.log(`Downloading ${glibcPkg}@${version} (glibc runtime)...`);
159
+ const tarball = await fetchWithIntegrity(tarballUrl, integrity);
160
+
161
+ const tarballPath = path.join(CACHE_DIR, `copilot-glibc-${version}.tgz`);
162
+ try {
163
+ fs.writeFileSync(tarballPath, tarball);
164
+ fs.mkdirSync(linux64Dir, { recursive: true });
165
+
166
+ console.log('Extracting glibc runtime.node...');
167
+ execFileSync('tar', [
168
+ '-xzf', tarballPath,
169
+ '-C', path.join(versionDir, 'prebuilds'),
170
+ '--strip-components=2',
171
+ 'package/prebuilds/linux-arm64/runtime.node',
172
+ 'package/prebuilds/linux-arm64/cli-native.node',
173
+ ]);
174
+ } finally {
175
+ fs.rmSync(tarballPath, { force: true });
176
+ }
177
+ console.log('✓ glibc runtime.node ready');
178
+ }
179
+
180
+ async function setupGlibcNode() {
181
+ const nodeDir = path.join(CACHE_DIR, 'glibc-node');
182
+ const nodeBin = path.join(nodeDir, 'node');
183
+ if (fs.existsSync(nodeBin)) {
184
+ return;
185
+ }
186
+
187
+ const { version, sha256: expectedSha256 } = manifest.glibcNode;
188
+ const tarballUrl = `https://nodejs.org/dist/v${version}/node-v${version}-linux-arm64.tar.gz`;
189
+
190
+ console.log(`Downloading Node.js v${version} (glibc)...`);
191
+ const tarball = await httpsGet(tarballUrl);
192
+
193
+ const actualSha256 = crypto.createHash('sha256').update(tarball).digest('hex');
194
+ if (actualSha256 !== expectedSha256) {
195
+ throw new Error(`Node.js integrity check failed: expected ${expectedSha256}, got ${actualSha256}`);
196
+ }
197
+
198
+ const tarballPath = path.join(CACHE_DIR, `node-glibc-${version}.tgz`);
199
+ try {
200
+ fs.writeFileSync(tarballPath, tarball);
201
+ fs.mkdirSync(nodeDir, { recursive: true });
202
+
203
+ console.log('Extracting node binary...');
204
+ execFileSync('tar', [
205
+ '-xzf', tarballPath,
206
+ '-C', nodeDir,
207
+ '--strip-components=2',
208
+ `node-v${version}-linux-arm64/bin/node`,
209
+ ]);
210
+ fs.chmodSync(nodeBin, 0o755);
211
+ } finally {
212
+ fs.rmSync(tarballPath, { force: true });
213
+ }
214
+ console.log('✓ glibc node ready');
215
+ }
216
+
143
217
  module.exports = { setup };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash0816/copilot-termux",
3
- "version": "1.0.65",
3
+ "version": "1.0.68",
4
4
  "description": "GitHub Copilot CLI for Termux (Android aarch64)",
5
5
  "license": "GPL-3.0-only",
6
6
  "readme": "README.md",
@@ -25,6 +25,7 @@
25
25
  "bin",
26
26
  "lib/platform-patch.js",
27
27
  "lib/setup.js",
28
+ "lib/check-updates.js",
28
29
  "lib/bionic-compat.so",
29
30
  "lib/native/pty.node",
30
31
  "scripts/bionic-compat.c",