@reservoirai/rsvr-provider 0.1.0 → 0.1.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
@@ -8,12 +8,6 @@ and serves work for reservoir.
8
8
  This package holds only a small launcher. The program itself is in the one
9
9
  platform package npm installs for your machine
10
10
  (`@reservoirai/rsvr-provider-<os>-<cpu>`). If optional dependencies are turned
11
- off, or your platform has no build, install without npm:
12
-
13
- curl -fsSL https://reservoirai.ai/install.sh | sh
14
-
15
- On Windows, in PowerShell:
16
-
17
- irm https://reservoirai.ai/install.ps1 | iex
11
+ off, reinstall with `npm install -g @reservoirai/rsvr-provider --include=optional`.
18
12
 
19
13
  Run `rsvr-provider --help` for the commands.
@@ -25,8 +25,6 @@ const NAME = 'rsvr-provider';
25
25
  // these, and the launcher's test says so.
26
26
  const SUPPORTED = ['linux-x64', 'linux-arm64', 'darwin-arm64', 'darwin-x64', 'win32-x64'];
27
27
 
28
- const INSTALL_SH = 'curl -fsSL https://reservoirai.ai/install.sh | sh';
29
- const INSTALL_PS1 = 'irm https://reservoirai.ai/install.ps1 | iex';
30
28
 
31
29
  /** The platform package for a machine, or null where no build exists. */
32
30
  function packageFor(platform, arch) {
@@ -49,18 +47,13 @@ function missingMessage(platform, arch) {
49
47
  lines.push(NAME + ': the package ' + pkg + ' is not installed, and it holds the program for this machine.');
50
48
  lines.push('npm installs it as an optional dependency, so it is missing when optional dependencies are turned off.');
51
49
  }
52
- // The hub says which ways it serves the program (FORWARDX_PROVIDER_CLI_INSTALL:
53
- // npm, s3 or both), and this launcher reads nothing at run time, so both
54
- // are named and the seller uses the one their hub offers.
50
+ // Only npm serves the program for now (decision C51: no install script).
55
51
  if (pkg !== null) {
56
52
  lines.push('Reinstall with npm, with optional dependencies on:');
57
53
  lines.push(' npm install -g ' + SCOPE + '/' + NAME + ' --include=optional');
58
- }
59
- lines.push('Or, where the hub serves the install script, without npm:');
60
- lines.push(' ' + INSTALL_SH);
61
- if (platform === 'win32') {
62
- lines.push('or, in PowerShell:');
63
- lines.push(' ' + INSTALL_PS1);
54
+ lines.push('or run it again with npx:');
55
+ lines.push(' npx ' + SCOPE + '/' + NAME);
56
+ lines.push('With npx, a brand-new release can take a few minutes to reach the npm download servers: try again shortly.');
64
57
  }
65
58
  return lines.join('\n') + '\n';
66
59
  }
@@ -82,6 +75,21 @@ function findBinary(platform, arch, resolve) {
82
75
  return binaryPath(packageJson, platform);
83
76
  }
84
77
 
78
+ /**
79
+ * Whether the launcher sends `signal` on to the program. SIGINT is NOT sent on
80
+ * Windows, nor where stdin is a terminal: there Ctrl-C reaches the program
81
+ * itself (every process on a Windows console, the whole foreground group
82
+ * elsewhere), and a second SIGINT reads to `run` as "Ctrl-C again: stop now"
83
+ * and ends it at once with 130 where one drains and exits 0 (GUIDE.md §8.5).
84
+ * On Windows Node's kill() is also TerminateProcess, which ends the program
85
+ * with exit code 1. With no terminal (a harness signalling the launcher alone)
86
+ * SIGINT goes on, as every other signal does.
87
+ */
88
+ function forwards(signal, platform, interactive) {
89
+ if (signal === 'SIGINT') return !(interactive || platform === 'win32');
90
+ return true;
91
+ }
92
+
85
93
  function launch() {
86
94
  const platform = process.platform;
87
95
  const bin = findBinary(platform, process.arch, require.resolve);
@@ -106,15 +114,13 @@ function launch() {
106
114
 
107
115
  const child = childProcess.spawn(bin, process.argv.slice(2), { stdio: 'inherit' });
108
116
 
109
- // Signals go on to the program. On a terminal, Ctrl-C already reached the
110
- // program with the launcher (one process group), and a second SIGINT would
111
- // read to `run` as "Ctrl-C again: stop now" (GUIDE.md §8.5), so on a
112
- // terminal the launcher stays alive for SIGINT and sends nothing.
117
+ // Signals go on to the program as `forwards` says, and the launcher returns
118
+ // the program's own exit code.
113
119
  const interactive = tty.isatty(0);
114
120
  const handlers = {};
115
121
  for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
116
122
  handlers[signal] = () => {
117
- if (signal === 'SIGINT' && interactive) return;
123
+ if (!forwards(signal, platform, interactive)) return;
118
124
  try {
119
125
  child.kill(signal);
120
126
  } catch (_) {
@@ -147,6 +153,6 @@ function launch() {
147
153
  });
148
154
  }
149
155
 
150
- module.exports = { SUPPORTED, INSTALL_SH, INSTALL_PS1, packageFor, binaryPath, missingMessage, findBinary };
156
+ module.exports = { forwards, SUPPORTED, packageFor, binaryPath, missingMessage, findBinary };
151
157
 
152
158
  if (require.main === module) launch();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reservoirai/rsvr-provider",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "The reservoir provider command line: sign in, find your model server, and serve work for reservoir.",
5
5
  "homepage": "https://reservoirai.ai",
6
6
  "license": "UNLICENSED",
@@ -18,10 +18,10 @@
18
18
  "access": "public"
19
19
  },
20
20
  "optionalDependencies": {
21
- "@reservoirai/rsvr-provider-linux-x64": "0.1.0",
22
- "@reservoirai/rsvr-provider-linux-arm64": "0.1.0",
23
- "@reservoirai/rsvr-provider-darwin-arm64": "0.1.0",
24
- "@reservoirai/rsvr-provider-darwin-x64": "0.1.0",
25
- "@reservoirai/rsvr-provider-win32-x64": "0.1.0"
21
+ "@reservoirai/rsvr-provider-linux-x64": "0.1.2",
22
+ "@reservoirai/rsvr-provider-linux-arm64": "0.1.2",
23
+ "@reservoirai/rsvr-provider-darwin-arm64": "0.1.2",
24
+ "@reservoirai/rsvr-provider-darwin-x64": "0.1.2",
25
+ "@reservoirai/rsvr-provider-win32-x64": "0.1.2"
26
26
  }
27
27
  }