arisa 4.0.12 → 4.0.16

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
@@ -162,7 +162,7 @@ Notes:
162
162
 
163
163
  - interactive bootstrap remains unchanged when no CLI overrides are provided
164
164
  - `--bootstrap` can be combined with overrides to regenerate config non-interactively
165
- - Arisa's HTTP server listens on `ARISA_HTTP_PORT` (default `91107`); bootstrap OAuth pages and tool-provided web routes use this server
165
+ - Arisa's HTTP server listens on `ARISA_HTTP_PORT` (default `11970`); bootstrap OAuth pages and tool-provided web routes use this server
166
166
  - unknown `--pi.provider` or `--pi.model` values are ignored and replaced by safe defaults
167
167
 
168
168
  Telegram bot tokens can be created with:
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "arisa",
3
- "version": "4.0.12",
3
+ "version": "4.0.16",
4
4
  "description": "Telegram + Pi Agent modular assistant",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "bin": {
8
8
  "arisa": "bin/arisa.js"
9
9
  },
10
+ "scripts": {
11
+ "start": "node src/index.js",
12
+ "bootstrap": "node src/index.js --bootstrap",
13
+ "test": "node --test"
14
+ },
10
15
  "keywords": [
11
16
  "telegram",
12
17
  "pi-agent",
@@ -36,14 +41,10 @@
36
41
  "url": "https://github.com/clasen/Arisa/issues"
37
42
  },
38
43
  "homepage": "https://github.com/clasen/Arisa#readme",
44
+ "packageManager": "pnpm@11.3.0+sha512.2c403d6594527287672b1f7056343a1f7c3634036a67ffabfcc2b3d7595d843768f8787148d1b57cf7956c90606bbd192857c363af19e96d2d0ec9ec5741d215",
39
45
  "dependencies": {
40
46
  "@earendil-works/pi-coding-agent": "^0.79.9",
41
47
  "@sinclair/typebox": "^0.34.41",
42
48
  "grammy": "^1.42.0"
43
- },
44
- "scripts": {
45
- "start": "node src/index.js",
46
- "bootstrap": "node src/index.js --bootstrap",
47
- "test": "node --test"
48
49
  }
49
- }
50
+ }
package/src/index.js CHANGED
@@ -8,6 +8,7 @@ import { createLogger } from "./runtime/logger.js";
8
8
  import { getServiceStatus, registerServiceProcess, startService, stopService, unregisterServiceProcess } from "./runtime/service-manager.js";
9
9
  import { flushArisaHome } from "./runtime/flush.js";
10
10
  import { arisaPackageDir } from "./runtime/paths.js";
11
+ import { parseProcessIds } from "./runtime/process-ids.js";
11
12
 
12
13
  process.env.ARISA_PACKAGE_DIR = arisaPackageDir;
13
14
 
@@ -23,7 +24,7 @@ const logger = createLogger({ verbose });
23
24
  let activeApp = null;
24
25
  let shuttingDown = false;
25
26
 
26
- const defaultHttpPort = 91107;
27
+ const defaultHttpPort = 11970;
27
28
  const httpPort = Number(process.env.ARISA_HTTP_PORT || defaultHttpPort);
28
29
  const shouldStartHttpServer = Boolean(httpPort && !["stop", "status", "flush"].includes(command));
29
30
  let httpRequestHandler = null;
@@ -49,11 +50,11 @@ async function runCommand(commandName, args = []) {
49
50
  async function getListeningPids(port) {
50
51
  const lsofOutput = await runCommand("lsof", ["-tiTCP", `-sTCP:LISTEN`, `-iTCP:${port}`]);
51
52
  if (lsofOutput) {
52
- return lsofOutput.split(/\s+/).map(Number).filter(Number.isFinite);
53
+ return parseProcessIds(lsofOutput);
53
54
  }
54
55
 
55
56
  const fuserOutput = await runCommand("fuser", ["-n", "tcp", String(port)]);
56
- return fuserOutput.split(/\s+/).map(Number).filter(Number.isFinite);
57
+ return parseProcessIds(fuserOutput);
57
58
  }
58
59
 
59
60
  async function getProcessCommand(pid) {
@@ -0,0 +1,9 @@
1
+ export function parseProcessIds(commandOutput) {
2
+ if (!commandOutput) return [];
3
+
4
+ return commandOutput
5
+ .split(/\s+/)
6
+ .filter((token) => /^\d+$/.test(token))
7
+ .map(Number)
8
+ .filter((pid) => Number.isInteger(pid) && pid > 0);
9
+ }
@@ -0,0 +1,14 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { parseProcessIds } from "../src/runtime/process-ids.js";
4
+
5
+ test("ignores empty PID command output", () => {
6
+ assert.deepEqual(parseProcessIds(""), []);
7
+ assert.deepEqual(parseProcessIds(" \n\t"), []);
8
+ });
9
+
10
+ test("parses only positive integer PID tokens", () => {
11
+ assert.deepEqual(parseProcessIds("123\n456"), [123, 456]);
12
+ assert.deepEqual(parseProcessIds("11970/tcp: 1234"), [1234]);
13
+ assert.deepEqual(parseProcessIds("0 nope -12 42"), [42]);
14
+ });