instabox 0.8.125 → 0.8.127

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/cli/SHA256SUMS CHANGED
@@ -1,6 +1,6 @@
1
- 0513ca560814c3d630fb9f16917cb7e16ff0d913b8f93fa7d0156c752fea65c8 instabox-darwin-amd64
2
- 27a6297ec213d590ff13cbba5eaa8e50c570230ae9d4117dbf2fe082f2d73b09 instabox-darwin-arm64
3
- a11c1b9b4e64e3be1ad3eec721ad52f16aba8ea34a978dcc0fb13386a337df2d instabox-linux-amd64
4
- 9d0881a1a06c1f0271f33d0fc85092e2a338d020289129b1ba1727471287491e instabox-linux-arm64
5
- c954d0c73176339f0e9e843536171602a4e451f31aae50896f8f03e6deee290d instabox-windows-amd64.exe
6
- 22c36c84771dc485e63f032ce07fc78a672be95ac41cf16dcc2b4c8eb10fe0f4 instabox-windows-arm64.exe
1
+ 8008a6d5ac7527aadefa0db2b86b28a5498b5a77c5b8553899f0ad4df37180d0 instabox-darwin-amd64
2
+ f2a6e25c938a3451b6036368f05c07b42df3e12d48eeba58bf5752aa6ed0fe9d instabox-darwin-arm64
3
+ 3e5c2e30705089eb31d98ac9d5d2142b630dee51ce6f83fd70b1b7ba5be7b6e8 instabox-linux-amd64
4
+ e0d8c94b983bdd6b68cce37d417e3bc099fd78767a808730878de02f69f2b98b instabox-linux-arm64
5
+ e99ddd3da00ccda7f2d2b51e477ea64d18ec9c103dc461b501bfacca0e7b56a1 instabox-windows-amd64.exe
6
+ c3e6a2530e1f79beabe06ee874667c0d382f2f63f15d05ca15cce64c8cc18bfd instabox-windows-arm64.exe
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/lib/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // The Go instabox CLI: find it, install it, hand it the command line.
2
- import { execFile, spawnSync } from 'node:child_process';
2
+ import { execFile, spawn } from 'node:child_process';
3
3
  import { createHash } from 'node:crypto';
4
4
  import {
5
5
  accessSync,
@@ -13,7 +13,7 @@ import {
13
13
  rmSync,
14
14
  statSync,
15
15
  } from 'node:fs';
16
- import { homedir } from 'node:os';
16
+ import { constants as osConstants, homedir } from 'node:os';
17
17
  import { dirname, join, sep } from 'node:path';
18
18
  import { fileURLToPath } from 'node:url';
19
19
  import { buildName, platformFor } from './platforms.mjs';
@@ -187,12 +187,62 @@ export function missingBundledCli({ platform = process.platform, arch = process.
187
187
  return 'this package carries no cli/ (a checkout?); from npm/: ../scripts/build-cli.sh --out ../out/cli && node scripts/bundle-cli.mjs --cli-dir ../out/cli';
188
188
  }
189
189
 
190
- // Hand the command line to the Go CLI and exit with its status.
191
- export function runCli(path, args) {
192
- const r = spawnSync(path, args, { stdio: 'inherit' });
193
- if (r.error) {
194
- console.error(`instabox: could not run ${path}: ${r.error.message}`);
190
+ // The signals that stop a wrapper in place of the CLI: `kill PID`, `timeout`, an agent stopping it,
191
+ // a closed terminal. Each is passed on, so stopping the wrapper stops the CLI too instead of leaving
192
+ // it running. On Windows a console Ctrl-C or close already reaches the CLI, which shares the console,
193
+ // and child.kill there terminates it outright, so nothing is passed on: the wrapper only stays to
194
+ // report the CLI's status.
195
+ export const FORWARDED_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'];
196
+
197
+ // Hand the command line to the Go CLI and exit with its status. The CLI shares this terminal
198
+ // (stdio inherited), so a TTY behaves as when it is run directly. A CLI ended by a signal ends the
199
+ // wrapper by the same signal (exit 128+n where that cannot be raised).
200
+ export function runCli(path, args, { platform = process.platform } = {}) {
201
+ const forward = platform !== 'win32';
202
+ const listeners = new Map();
203
+ let child;
204
+ const off = () => {
205
+ for (const [sig, fn] of listeners) process.removeListener(sig, fn);
206
+ listeners.clear();
207
+ };
208
+ const fail = (e) => {
209
+ off();
210
+ console.error(`instabox: could not run ${path}: ${e.message}`);
195
211
  process.exit(1);
212
+ };
213
+ for (const sig of FORWARDED_SIGNALS) {
214
+ const fn = () => {
215
+ if (!forward || !child || child.exitCode !== null || child.signalCode !== null) return;
216
+ try {
217
+ child.kill(sig);
218
+ } catch {
219
+ // The CLI is already gone; its exit event reports the status.
220
+ }
221
+ };
222
+ try {
223
+ process.on(sig, fn);
224
+ listeners.set(sig, fn);
225
+ } catch {
226
+ // A signal this platform cannot listen for.
227
+ }
196
228
  }
197
- process.exit(r.status ?? 1);
229
+ try {
230
+ child = spawn(path, args, { stdio: 'inherit' });
231
+ } catch (e) {
232
+ fail(e);
233
+ }
234
+ child.on('error', fail);
235
+ child.on('exit', (code, signal) => {
236
+ off();
237
+ if (code !== null) process.exit(code);
238
+ const n = (signal && osConstants.signals[signal]) || 0;
239
+ if (signal && forward) {
240
+ try {
241
+ process.kill(process.pid, signal);
242
+ } catch {
243
+ // Fall through to the status a shell reports for it.
244
+ }
245
+ }
246
+ process.exit(n ? 128 + n : 1);
247
+ });
198
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instabox",
3
- "version": "0.8.125",
3
+ "version": "0.8.127",
4
4
  "description": "A cloud box for your coding agent, the instabox CLI and its agent skills in one command: npx instabox@latest",
5
5
  "type": "module",
6
6
  "bin": {