korveniq 1.0.6 → 1.0.8

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.
@@ -66,11 +66,17 @@ function networkHint(command, { background = false } = {}) {
66
66
  return m ? `it looks like it needs the network (“${m[0].replace(/\s+/g, ' ').slice(0, 40)}”), which autonomous mode keeps off unless you allow it` : null;
67
67
  }
68
68
 
69
+ /** Commands that probably open or reach a local server (macOS: a person is asked to allow local networking). A hint only. */
70
+ const LOCAL_HINT_RE = /\blocalhost\b|127\.0\.0\.1|::1\b|\b(?:npm|pnpm|yarn)\s+(?:start|test|t\b|run\b)|\bnode\s+(?!--check\b|-v\b|--version\b|-p\b)\S+|\b(?:jest|vitest|mocha|ava|pytest|nodemon|uvicorn|gunicorn|hypercorn|flask|http\.server|vite|next\s+(?:dev|start)|serve|manage\.py)\b/;
71
+
72
+ const wantsLocalNetwork = (command, { background = false } = {}) => background || LOCAL_HINT_RE.test(String(command));
73
+
69
74
  /** One line for the screen: what the sandbox will allow this command. */
70
75
  function describe(sb) {
71
76
  const e = sb.effective;
72
- const parts = [`workspace ${e.writeWorkspace ? (e.unlink ? 'writable' : 'writable, no deletes') : 'read-only'}`, e.network ? 'network on' : 'network off', 'credentials hidden', 'nothing outside the project changes'];
77
+ const network = e.network ? 'network on' : e.local ? (sb.backend === 'bubblewrap' ? 'external network off, localhost inside the sandbox' : 'external network off, this computer allowed') : 'network off';
78
+ const parts = [`workspace ${e.writeWorkspace ? (e.unlink ? 'writable' : 'writable, no deletes') : 'read-only'}`, network, 'credentials hidden', 'nothing outside the project changes'];
73
79
  return `sandbox (${sb.backend}): ${parts.join(' · ')}`;
74
80
  }
75
81
 
76
- module.exports = { NETWORK_HINT_RE, grantsFor, modeOf, networkHint, describe, shellNetworkEnabled };
82
+ module.exports = { NETWORK_HINT_RE, LOCAL_HINT_RE, grantsFor, modeOf, networkHint, wantsLocalNetwork, describe, shellNetworkEnabled };
package/lib/headless.js CHANGED
@@ -43,7 +43,7 @@ const EXIT_CODES = Object.freeze({
43
43
  });
44
44
 
45
45
  // 'unsandboxed-shell' is the explicit, separate unrestricted mode: shell commands then run WITHOUT the OS sandbox (see docs/security.md).
46
- const ALLOW_CATEGORIES = Object.freeze(['edit', 'shell', 'network', 'delete', 'unsandboxed-shell']);
46
+ const ALLOW_CATEGORIES = Object.freeze(['edit', 'shell', 'network', 'localhost', 'delete', 'unsandboxed-shell']);
47
47
  const BUDGET_STOPS = Object.freeze(['rounds', 'time', 'repeated-failure', 'no-progress', 'malformed']);
48
48
  const DEFAULT_TIMEOUT_SECONDS = 900;
49
49
  const MAX_ANSWER_CHARS = 100_000;
@@ -0,0 +1,121 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * lib/mac-notify.js: show one macOS notification. Run by lib/notifier.js as its own short process:
5
+ *
6
+ * node lib/mac-notify.js <title> <body>
7
+ *
8
+ * `osascript -e 'display notification …'` posts as Script Editor. On a Mac that never allowed Script Editor to notify,
9
+ * macOS cannot ask for that permission on its behalf: the notification is accepted (exit 0) and never shown. So the
10
+ * notification is posted by a small applet of our own, "Korveniq AI", which macOS can ask about once and lists in
11
+ * System Settings > Notifications. It is built on this Mac with the system's own tools (osacompile, plutil, codesign),
12
+ * in the Korveniq settings folder, without sudo or downloads, with the Korveniq orb as its icon. If it cannot be built
13
+ * or opened, osascript is used.
14
+ *
15
+ * Title and body are only ever arguments, never script text.
16
+ */
17
+
18
+ const fs = require('fs');
19
+ const path = require('path');
20
+ const cp = require('child_process');
21
+
22
+ const BUNDLE_ID = 'com.korveniq.cli.notifier';
23
+ const APP_FILE = 'Korveniq AI.app';
24
+ /** Raise when the applet changes: it is then built again. (A rebuilt applet may have to be allowed again.) */
25
+ const APPLET_VERSION = '2';
26
+ const MARK = '--korveniq-notify';
27
+ const ORB_ICON = path.join(__dirname, '..', 'assets', 'korveniq-orb.png');
28
+ const LSREGISTER = '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister';
29
+
30
+ // (opened any other way, for example by clicking a notification, it has no mark and does nothing)
31
+ const APPLET = `ObjC.import('Foundation');
32
+ function run() {
33
+ const args = ObjC.deepUnwrap($.NSProcessInfo.processInfo.arguments);
34
+ const at = args.indexOf('${MARK}');
35
+ if (at === -1) return;
36
+ const app = Application.currentApplication();
37
+ app.includeStandardAdditions = true;
38
+ app.displayNotification(args[at + 2], { withTitle: args[at + 1] });
39
+ delay(1);
40
+ }
41
+ `;
42
+
43
+ const exec = (command, args) => cp.execFileSync(command, args, { stdio: 'ignore', timeout: 4000 });
44
+
45
+ const versionFile = (app) => path.join(app, 'Contents', 'Resources', 'korveniq-version');
46
+
47
+ function installed(app) {
48
+ try {
49
+ return fs.readFileSync(versionFile(app), 'utf8') === APPLET_VERSION;
50
+ } catch {
51
+ return false;
52
+ }
53
+ }
54
+
55
+ /** Give the applet the Korveniq orb. Without it the notifications still work, so a failure here is ignored. */
56
+ function setIcon(app, run) {
57
+ try {
58
+ run('/usr/bin/sips', ['-s', 'format', 'icns', ORB_ICON, '--out', path.join(app, 'Contents', 'Resources', 'applet.icns')]);
59
+ } catch {
60
+ return;
61
+ }
62
+ // (newer macOS versions of osacompile add an asset catalogue, which would be preferred over the .icns file)
63
+ try {
64
+ run('/usr/bin/plutil', ['-remove', 'CFBundleIconName', path.join(app, 'Contents', 'Info.plist')]);
65
+ fs.rmSync(path.join(app, 'Contents', 'Resources', 'Assets.car'), { force: true });
66
+ } catch {
67
+ /* there is none */
68
+ }
69
+ }
70
+
71
+ /** The applet in `dir`, built first if it is missing or old. Throws when it cannot be built. */
72
+ function ensureApplet(dir, run = exec) {
73
+ const app = path.join(dir, APP_FILE);
74
+ if (installed(app)) return app;
75
+ fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
76
+ const stage = fs.mkdtempSync(path.join(dir, '.build-'));
77
+ try {
78
+ const source = path.join(stage, 'notify.js');
79
+ const built = path.join(stage, APP_FILE);
80
+ fs.writeFileSync(source, APPLET);
81
+ run('/usr/bin/osacompile', ['-l', 'JavaScript', '-o', built, source]);
82
+ const plist = path.join(built, 'Contents', 'Info.plist');
83
+ run('/usr/bin/plutil', ['-replace', 'CFBundleIdentifier', '-string', BUNDLE_ID, plist]);
84
+ run('/usr/bin/plutil', ['-replace', 'LSUIElement', '-bool', 'true', plist]); // no Dock icon
85
+ setIcon(built, run);
86
+ fs.writeFileSync(versionFile(built), APPLET_VERSION);
87
+ run('/usr/bin/codesign', ['--force', '--sign', '-', built]); // (the changes above broke the signature)
88
+ fs.rmSync(app, { recursive: true, force: true });
89
+ try {
90
+ fs.renameSync(built, app);
91
+ } catch (err) {
92
+ if (!installed(app)) throw err; // (another process built it first)
93
+ }
94
+ run(LSREGISTER, ['-f', app]);
95
+ return app;
96
+ } finally {
97
+ fs.rmSync(stage, { recursive: true, force: true });
98
+ }
99
+ }
100
+
101
+ /** @returns {'applet'|'osascript'} how it was posted. Throws when neither way works. */
102
+ function deliver(title, body, { dir = path.join(require('./config').CONFIG_DIR, 'notifier'), run = exec } = {}) {
103
+ try {
104
+ run('/usr/bin/open', ['-n', '-g', ensureApplet(dir, run), '--args', MARK, title, body]);
105
+ return 'applet';
106
+ } catch (err) {
107
+ if (err.code === 'ETIMEDOUT') throw err; // it may still appear: posting it a second way could show it twice
108
+ run('/usr/bin/osascript', ['-e', 'on run argv', '-e', 'display notification (item 2 of argv) with title (item 1 of argv)', '-e', 'end run', title, body]);
109
+ return 'osascript';
110
+ }
111
+ }
112
+
113
+ module.exports = { deliver, ensureApplet, BUNDLE_ID, APPLET };
114
+
115
+ if (require.main === module) {
116
+ try {
117
+ deliver(process.argv[2] || '', process.argv[3] || '');
118
+ } catch {
119
+ process.exitCode = 1; // the notifier then switches itself off for this session
120
+ }
121
+ }
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * lib/net-forward.js: Linux only. Runs inside the private network namespace of one package installation and passes
5
+ * connections made to 127.0.0.1:<port> there to the CLI's registry proxy (a unix socket). It forwards bytes only; the
6
+ * proxy decides what is allowed. Usage: node net-forward.js <socket path> <port>
7
+ */
8
+
9
+ const net = require('net');
10
+
11
+ function forward(socketPath, port) {
12
+ net
13
+ .createServer((client) => {
14
+ const upstream = net.connect(socketPath);
15
+ client.on('error', () => upstream.destroy());
16
+ upstream.on('error', () => client.destroy());
17
+ client.pipe(upstream);
18
+ upstream.pipe(client);
19
+ })
20
+ .listen(port, '127.0.0.1', () => process.stdout.write('ready\n'));
21
+ // ends with the CLI: its input closes
22
+ process.stdin.on('end', () => process.exit(0));
23
+ process.stdin.resume();
24
+ }
25
+
26
+ if (require.main === module) forward(process.argv[2], Number(process.argv[3]));
27
+ else module.exports = { forward };
@@ -0,0 +1,165 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * lib/net-proxy.js
5
+ * -----------------------------------------------------------------------------
6
+ * The only way to the internet an approved package installation gets: an HTTPS tunnel (CONNECT) through the CLI, to a
7
+ * fixed list of package registry hosts. It exists only while that installation runs.
8
+ *
9
+ * - CONNECT to <allowed host>:443 only; every other method, host or port is refused. A redirect to another host
10
+ * needs a new CONNECT, so it is checked the same way.
11
+ * - The CLI resolves the name itself, refuses the answer if any address is private, loopback, link-local or otherwise
12
+ * special, and connects to the address it checked (no second lookup an attacker could answer differently).
13
+ * - The TLS handshake must name the same host (SNI), so the tunnel cannot be pointed at another site on a shared
14
+ * server. TLS itself is end to end: the CLI sees no content and cannot see requests or paths inside it.
15
+ * - Callers must present a random password that only the installation's environment holds.
16
+ */
17
+
18
+ const net = require('net');
19
+ const dns = require('dns');
20
+ const http = require('http');
21
+ const crypto = require('crypto');
22
+
23
+ const IDLE_MS = 60_000;
24
+ const MAX_TUNNELS = 64;
25
+
26
+ /** Addresses an installation must never reach, whatever a name resolves to. */
27
+ const SPECIAL = (() => {
28
+ const list = new net.BlockList();
29
+ for (const [address, bits] of [['0.0.0.0', 8], ['10.0.0.0', 8], ['100.64.0.0', 10], ['127.0.0.0', 8], ['169.254.0.0', 16], ['172.16.0.0', 12], ['192.0.0.0', 24], ['192.0.2.0', 24], ['192.168.0.0', 16], ['198.18.0.0', 15], ['198.51.100.0', 24], ['203.0.113.0', 24], ['224.0.0.0', 4], ['240.0.0.0', 4]]) list.addSubnet(address, bits, 'ipv4');
30
+ // IPv6: only global unicast (2000::/3) is accepted at all; these parts of it are special as well.
31
+ for (const [address, bits] of [['2001:db8::', 32], ['2001::', 23], ['2002::', 16]]) list.addSubnet(address, bits, 'ipv6');
32
+ return list;
33
+ })();
34
+ const GLOBAL_V6 = (() => {
35
+ const list = new net.BlockList();
36
+ list.addSubnet('2000::', 3, 'ipv6');
37
+ return list;
38
+ })();
39
+
40
+ function isPublicAddress(address) {
41
+ const family = net.isIP(address);
42
+ if (family === 4) return !SPECIAL.check(address, 'ipv4');
43
+ if (family === 6) return GLOBAL_V6.check(address, 'ipv6') && !SPECIAL.check(address, 'ipv6');
44
+ return false;
45
+ }
46
+
47
+ /** The server name in a TLS ClientHello. null: not a ClientHello, or none. undefined: more bytes are needed. */
48
+ function sniOf(buf) {
49
+ if (buf.length < 5) return undefined;
50
+ if (buf[0] !== 22) return null;
51
+ const length = buf.readUInt16BE(3);
52
+ if (buf.length < 5 + length) return length > 16 * 1024 ? null : undefined;
53
+ try {
54
+ let p = 5;
55
+ if (buf[p] !== 1) return null;
56
+ p += 4 + 2 + 32;
57
+ p += 1 + buf[p];
58
+ p += 2 + buf.readUInt16BE(p);
59
+ p += 1 + buf[p];
60
+ const end = p + 2 + buf.readUInt16BE(p);
61
+ for (p += 2; p + 4 <= end; ) {
62
+ const type = buf.readUInt16BE(p);
63
+ const size = buf.readUInt16BE(p + 2);
64
+ if (type === 0) {
65
+ const nameLength = buf.readUInt16BE(p + 7);
66
+ return buf.toString('ascii', p + 9, p + 9 + nameLength).toLowerCase();
67
+ }
68
+ p += 4 + size;
69
+ }
70
+ } catch {
71
+ /* truncated or damaged */
72
+ }
73
+ return null;
74
+ }
75
+
76
+ /**
77
+ * @param {object} opts
78
+ * @param {string[]} opts.hosts the allowed host names
79
+ * @param {string} [opts.socketPath] listen on this unix socket instead of a loopback port
80
+ * @param {Function} [opts.lookup] dns.lookup (tests)
81
+ * @param {Function} [opts.connect] net.connect (tests)
82
+ */
83
+ async function startProxy({ hosts, socketPath = null, lookup = dns.lookup, connect = net.connect }) {
84
+ const allowed = new Set(hosts.map((h) => h.toLowerCase()));
85
+ const password = crypto.randomBytes(24).toString('hex');
86
+ const expected = Buffer.from(`Basic ${Buffer.from(`kq:${password}`).toString('base64')}`);
87
+ const sockets = new Set();
88
+ const log = { allowed: new Set(), refused: [] };
89
+ const track = (s) => {
90
+ sockets.add(s);
91
+ s.on('close', () => sockets.delete(s));
92
+ s.on('error', () => s.destroy());
93
+ s.setTimeout(IDLE_MS, () => s.destroy());
94
+ };
95
+
96
+ const server = http.createServer((req, res) => {
97
+ log.refused.push(`${req.method} ${String(req.url).slice(0, 80)} (only HTTPS tunnels)`);
98
+ res.writeHead(403, { Connection: 'close' }).end();
99
+ });
100
+ server.on('connection', track);
101
+ server.on('connect', (req, client, head) => {
102
+ const refuse = (status, why) => {
103
+ if (why) log.refused.push(`${String(req.url).slice(0, 80)} (${why})`);
104
+ client.end(`HTTP/1.1 ${status}\r\nConnection: close\r\n${status.startsWith('407') ? 'Proxy-Authenticate: Basic realm="korveniq"\r\n' : ''}\r\n`);
105
+ };
106
+ const auth = Buffer.from(String(req.headers['proxy-authorization'] || ''));
107
+ if (auth.length !== expected.length || !crypto.timingSafeEqual(auth, expected)) return refuse('407 Proxy Authentication Required');
108
+ const m = /^([A-Za-z0-9.-]{1,253}):(\d{1,5})$/.exec(String(req.url));
109
+ const host = m && m[1].toLowerCase();
110
+ if (!m || Number(m[2]) !== 443 || !allowed.has(host)) return refuse('403 Forbidden', 'not an allowed registry');
111
+ if (sockets.size > MAX_TUNNELS * 2) return refuse('503 Service Unavailable', 'too many connections');
112
+ lookup(host, { all: true, verbatim: true }, (err, addresses) => {
113
+ if (client.destroyed) return;
114
+ if (err || !addresses || !addresses.length) return refuse('502 Bad Gateway', 'the name cannot be resolved');
115
+ if (!addresses.every((a) => isPublicAddress(a.address))) return refuse('403 Forbidden', 'the name resolves to a private or special address');
116
+ // The client speaks first (TLS): check the name it asks for before anything reaches the server.
117
+ client.write('HTTP/1.1 200 Connection Established\r\n\r\n');
118
+ let hello = head && head.length ? head : Buffer.alloc(0);
119
+ const onData = (chunk) => {
120
+ if (chunk) hello = Buffer.concat([hello, chunk]);
121
+ const sni = sniOf(hello);
122
+ if (sni === undefined && hello.length <= 20 * 1024) return;
123
+ client.removeListener('data', onData);
124
+ if (sni !== host) {
125
+ log.refused.push(`${host}:443 (the TLS handshake names ${sni ? `"${sni.slice(0, 80)}"` : 'no server'})`);
126
+ return client.destroy();
127
+ }
128
+ client.pause();
129
+ const upstream = connect({ host: addresses[0].address, port: 443 });
130
+ track(upstream);
131
+ upstream.once('connect', () => {
132
+ log.allowed.add(host);
133
+ upstream.write(hello);
134
+ client.pipe(upstream);
135
+ upstream.pipe(client);
136
+ client.resume();
137
+ });
138
+ upstream.on('close', () => client.destroy());
139
+ client.on('close', () => upstream.destroy());
140
+ };
141
+ client.on('data', onData);
142
+ if (hello.length) onData(null);
143
+ });
144
+ });
145
+
146
+ await new Promise((resolve, reject) => {
147
+ server.once('error', reject);
148
+ if (socketPath) server.listen(socketPath, resolve);
149
+ else server.listen(0, '127.0.0.1', resolve);
150
+ });
151
+ server.unref();
152
+ return {
153
+ port: socketPath ? null : server.address().port,
154
+ /** The proxy address with its password, for a client that reaches it on `port`. */
155
+ url: (port) => `http://kq:${password}@127.0.0.1:${port}`,
156
+ log,
157
+ close: () =>
158
+ new Promise((resolve) => {
159
+ for (const s of sockets) s.destroy();
160
+ server.close(() => resolve());
161
+ }),
162
+ };
163
+ }
164
+
165
+ module.exports = { startProxy, isPublicAddress, sniOf };
package/lib/notifier.js CHANGED
@@ -9,8 +9,9 @@
9
9
  * org.freedesktop.Notifications.Notify on the session bus.
10
10
  * Needs a desktop session (DBUS_SESSION_BUS_ADDRESS, DISPLAY or
11
11
  * WAYLAND_DISPLAY); over plain SSH there is none.
12
- * macOS osascript "display notification"
13
- * Windows PowerShell + Windows.UI.Notifications toast
12
+ * macOS our own "Korveniq AI" applet (lib/mac-notify.js), else osascript "display notification"
13
+ * Windows PowerShell + Windows.UI.Notifications toast, as "Korveniq AI" with the orb (registered for this user
14
+ * under HKCU, no administrator rights; as PowerShell if that cannot be written)
14
15
  *
15
16
  * Safety:
16
17
  * - The backend is found by scanning PATH (no process is started for that).
@@ -32,11 +33,13 @@ const { spawn } = require('child_process');
32
33
  const { HIDDEN_CHARS_RE } = require('./sanitize');
33
34
 
34
35
  const NOTIFY_TIMEOUT_MS = 5000;
36
+ const MAC_TIMEOUT_MS = 15_000; // the first notification also builds the applet
35
37
  // The Korveniq orb (from the web app), shipped in the package. A theme icon
36
38
  // name is the fallback if the file is missing.
37
39
  const ORB_ICON = path.join(__dirname, '..', 'assets', 'korveniq-orb.png');
38
40
  const icon = () => (fs.existsSync(ORB_ICON) ? ORB_ICON : 'dialog-information');
39
41
  const APP_NAME = 'Korveniq AI';
42
+ const WINDOWS_APP_ID = 'Korveniq.CLI';
40
43
  const MAX_TITLE = 80;
41
44
  const MAX_BODY = 240;
42
45
 
@@ -90,17 +93,12 @@ function detectBackend(platform = process.platform, env = process.env) {
90
93
  if (env.KORVENIQ_NOTIFY_BACKEND === 'none') return null;
91
94
 
92
95
  if (platform === 'darwin') {
93
- const osa = which('osascript');
94
- if (!osa) return null;
96
+ if (!which('osascript')) return null;
95
97
  return {
96
- name: 'osascript',
97
- command: osa,
98
- args: (title, body) => [
99
- '-e', 'on run argv',
100
- '-e', 'display notification (item 2 of argv) with title (item 1 of argv)',
101
- '-e', 'end run',
102
- title, body,
103
- ],
98
+ name: 'macos',
99
+ command: process.execPath,
100
+ timeoutMs: MAC_TIMEOUT_MS,
101
+ args: (title, body) => [path.join(__dirname, 'mac-notify.js'), title, body],
104
102
  };
105
103
  }
106
104
 
@@ -115,16 +113,20 @@ function detectBackend(platform = process.platform, env = process.env) {
115
113
  '[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null',
116
114
  '$t = [Security.SecurityElement]::Escape($env:KQ_NOTIFY_TITLE)',
117
115
  '$b = [Security.SecurityElement]::Escape($env:KQ_NOTIFY_BODY)',
116
+ '$i = ""',
117
+ 'if ($env:KQ_NOTIFY_ICON) { $i = "<image placement=`"appLogoOverride`" src=`"" + [Security.SecurityElement]::Escape($env:KQ_NOTIFY_ICON) + "`"/>" }',
118
118
  '$xml = New-Object Windows.Data.Xml.Dom.XmlDocument',
119
- '$xml.LoadXml("<toast><visual><binding template=`"ToastGeneric`"><text>$t</text><text>$b</text></binding></visual></toast>")',
120
- '$app = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe"',
119
+ '$xml.LoadXml("<toast><visual><binding template=`"ToastGeneric`"><text>$t</text><text>$b</text>$i</binding></visual></toast>")',
120
+ // The name and icon shown above a toast belong to its application id: ours, registered for this user only.
121
+ `$app = "${WINDOWS_APP_ID}"`,
122
+ `try { $k = "HKCU:\\Software\\Classes\\AppUserModelId\\${WINDOWS_APP_ID}"; if (-not (Test-Path $k)) { New-Item -Path $k -Force | Out-Null }; New-ItemProperty -Path $k -Name DisplayName -Value "${APP_NAME}" -PropertyType String -Force | Out-Null; if ($env:KQ_NOTIFY_ICON) { New-ItemProperty -Path $k -Name IconUri -Value $env:KQ_NOTIFY_ICON -PropertyType String -Force | Out-Null } } catch { $app = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe" }`,
121
123
  '[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($app).Show([Windows.UI.Notifications.ToastNotification]::new($xml))',
122
124
  ].join('; ');
123
125
  return {
124
126
  name: 'powershell',
125
127
  command: ps,
126
128
  args: () => ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', script],
127
- env: (title, body) => ({ KQ_NOTIFY_TITLE: title, KQ_NOTIFY_BODY: body }),
129
+ env: (title, body) => ({ KQ_NOTIFY_TITLE: title, KQ_NOTIFY_BODY: body, KQ_NOTIFY_ICON: fs.existsSync(ORB_ICON) ? ORB_ICON : '' }),
128
130
  };
129
131
  }
130
132
 
@@ -217,7 +219,7 @@ class Notifier {
217
219
  } catch {
218
220
  /* gone */
219
221
  }
220
- }, NOTIFY_TIMEOUT_MS);
222
+ }, this.backend.timeoutMs || NOTIFY_TIMEOUT_MS);
221
223
  timer.unref();
222
224
  child.on('error', (err) => this.fail(err.message));
223
225
  child.on('exit', (code) => {