@deslop/deploy 0.1.1326 → 0.1.1328

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/server.js +108 -63
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -8,6 +8,6 @@ deploy service install --domain mp281x.xyz --workers desktop,macbook-pro
8
8
  ```
9
9
 
10
10
  - **`--workers`** lists Tailscale machine names. Deploy derives each HTTPS URL from the tailnet's MagicDNS suffix and its package port. Auth identifies peers by their tailnet owner; local commands require an admin.
11
- - **Platforms.** Linux x64 and macOS arm64. Public exposure runs the bundled Caddy, a Linux x64 build, so a Mac exposes ports to the tailnet only; its apps are its `deslop-*` launch agents, measured without per-app history.
11
+ - **Platforms.** Linux x64 and macOS arm64. Public exposure runs the bundled Caddy, a Linux x64 build, so a Mac exposes ports to the tailnet only. Its apps are running regular (Dock) GUI applications and running user launch agents other than `com.apple.*` and Deslop `-update` agents, with process trees and listeners but no per-app history.
12
12
 
13
13
  Common flags and service commands: [Deslop app runtime](https://github.com/MP281X/deslop/blob/main/packages/runtime/README.md).
package/dist/server.js CHANGED
@@ -109349,19 +109349,42 @@ function unitFailures(text) {
109349
109349
  }));
109350
109350
  }
109351
109351
  // src/services/inventory/lib/launchd.ts
109352
- const launchAgents = fnUntraced(function* (text) {
109353
- return yield* forEach$1(getSomes(map$10(pipe(trim(text), split$1("\n"), drop$1(1)), (line) => {
109354
- const [pid, status, label] = split$1(line, " ");
109355
- return pipe(label ?? "", liftPredicate((name) => startsWith("deslop-")(name) && !endsWith("-update")(name)), map$13((name) => ({
109356
- label: decodeSync(UnitId)(name),
109357
- pid: flatMap$8(parse$2(pid), decodeOption(ProcessId)),
109358
- status: status ?? ""
109359
- })));
109360
- })), (agent) => map$7(decodeEffect(FiniteFromString.check(isInt()))(agent.status), (status) => ({
109361
- ...agent,
109362
- status
109363
- })), { concurrency: "unbounded" });
109364
- });
109352
+ function launchAgents(text) {
109353
+ return getSomes(pipe(text, split$1("\n"), map$10((line) => {
109354
+ const [pid, status = "", label = ""] = split$1(trim(line), " ");
109355
+ if (!isNonEmpty$1(label) || startsWith("com.apple.")(label) || startsWith("application.")(label) || startsWith("deslop-")(label) && endsWith("-update")(label)) return none();
109356
+ const processId = filter$7(decodeOption(ProcessIdFromString)(pid), (value) => value > 0);
109357
+ if (isNone(processId) && pid !== "-") return none();
109358
+ return some$1({
109359
+ detail: "user · launch agent",
109360
+ label: UnitId.make(label),
109361
+ pid: processId,
109362
+ status: parse$2(status)
109363
+ });
109364
+ })));
109365
+ }
109366
+ function dockApplications(text) {
109367
+ return getSomes(pipe(text, split$1(/\n(?=\s*[0-9]+\))/u), map$10((block) => {
109368
+ const name = pipe(match$2(/^\s*[0-9]+\) "(.+)" ASN:/u)(block), map$13((match) => match[1] ?? ""), filter$7(isNonEmpty$1));
109369
+ const pid = pipe(match$2(/^\s+pid = ([0-9]+) .*\btype="Foreground"(?:\s|$)/mu)(block), flatMap$8((match) => decodeOption(ProcessIdFromString)(match[1] ?? "")), filter$7((value) => value > 0));
109370
+ return map$13(all$4({
109371
+ name,
109372
+ pid
109373
+ }), (app) => ({
109374
+ detail: "user · application",
109375
+ label: UnitId.make(app.name),
109376
+ pid: app.pid
109377
+ }));
109378
+ })));
109379
+ }
109380
+ function macApplications(agents, applications) {
109381
+ const running = getSomes(map$10(agents, (agent) => map$13(agent.pid, (pid) => ({
109382
+ detail: agent.detail,
109383
+ label: agent.label,
109384
+ pid
109385
+ }))));
109386
+ return dedupeWith([...applications, ...running], (left, right) => left.pid === right.pid);
109387
+ }
109365
109388
  // src/services/inventory/lib/command.ts
109366
109389
  const WRAPPERS = [
109367
109390
  "env",
@@ -109994,8 +110017,10 @@ function launchdProcesses(text, agents) {
109994
110017
  start: match[5] ?? ""
109995
110018
  }))))));
109996
110019
  const parents = fromIterable$5(map$10(rows, (row) => [row.pid, row.parent]));
109997
- function agent(pid) {
109998
- return pipe(agents, get$8(pid), orElse$3(() => flatMap$8(pipe(parents, get$8(pid), filter$7((parent) => parent !== pid)), agent)));
110020
+ function agent(pid, visited = empty$5()) {
110021
+ if (has(visited, pid)) return none();
110022
+ add$1(visited, pid);
110023
+ return pipe(agents, get$8(pid), orElse$3(() => pipe(parents, get$8(pid), flatMap$8((parent) => agent(parent, visited)))));
109999
110024
  }
110000
110025
  return getSomes(map$10(rows, (row) => flatMap$8(agent(row.pid), (unit) => map$13(all$4({
110001
110026
  start: make$76(row.start),
@@ -110357,7 +110382,8 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
110357
110382
  });
110358
110383
  const darwin = gen(function* () {
110359
110384
  const launchd = yield* all$1({
110360
- agents: result$1(flatMap$3(command("launchctl", ["list"]), launchAgents)),
110385
+ agents: result$1(map$7(command("launchctl", ["list"]), launchAgents)),
110386
+ applications: result$1(map$7(command("/usr/bin/lsappinfo", ["list"]), dockApplications)),
110361
110387
  table: result$1(command("env", [
110362
110388
  "LC_ALL=C",
110363
110389
  "ps",
@@ -110368,8 +110394,23 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
110368
110394
  }, { concurrency: "unbounded" });
110369
110395
  const time = yield* now;
110370
110396
  const total = millis(sumAll(flatMap$6(cpus(), (cpu) => values(cpu.times))));
110397
+ const apps = macApplications(getOrElse(launchd.agents, () => []), getOrElse(launchd.applications, () => []));
110398
+ function appItems(found) {
110399
+ return map$10(found, (app) => InventoryItem.make({
110400
+ active: true,
110401
+ detail: app.detail,
110402
+ id: ItemId.make(`${worker}:user:${app.label}`),
110403
+ kind: "service",
110404
+ name: app.label,
110405
+ running: true,
110406
+ scope: some$1("user"),
110407
+ state: "running",
110408
+ url: none(),
110409
+ worker
110410
+ }));
110411
+ }
110371
110412
  const records = map$12(launchd.table, (text) => {
110372
- const agents = fromIterable$5(getSomes(pipe(launchd.agents, getOrElse(() => []), map$10((agent) => map$13(agent.pid, (processId) => [processId, agent.label])))));
110413
+ const agents = fromIterable$5(map$10(apps, (app) => [app.pid, app.label]));
110373
110414
  return filter$5(launchdProcesses(text, agents), (record) => record.process.pid === selfProcess || !pipe(agents, get$8(selfProcess), contains$2(record.unit)));
110374
110415
  });
110375
110416
  const owned = getOrElse(records, empty$15);
@@ -110379,53 +110420,57 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
110379
110420
  time,
110380
110421
  total
110381
110422
  })),
110382
- sources: [collect("Launch agents", map$7(fromResult(launchd.agents), (agents) => map$10(agents, (agent) => InventoryItem.make({
110383
- active: isSome(agent.pid),
110384
- detail: "user · launch agent",
110385
- failure: pipe(agent.status, liftPredicate((status) => isNone(agent.pid) && status !== 0), map$13((status) => ({
110386
- at: none(),
110387
- reason: exitFailure(status)
110388
- }))),
110389
- health: match(isNone(agent.pid) && agent.status !== 0, {
110390
- onFalse: constant("quiet"),
110391
- onTrue: constant("error")
110392
- }),
110393
- id: ItemId.make(`${worker}:user:${agent.label}`),
110394
- kind: "service",
110395
- name: agent.label,
110396
- running: isSome(agent.pid),
110397
- scope: some$1("user"),
110398
- state: match$8(agent.pid, {
110399
- onNone: () => match(agent.status === 0, {
110400
- onFalse: constant("failed · failed"),
110401
- onTrue: constant("inactive · dead")
110423
+ sources: [
110424
+ collect("Launch agents", map$7(fromResult(launchd.agents), (agents) => pipe(agents, filter$5((agent) => match$8(agent.pid, {
110425
+ onNone: () => exists(agent.status, (status) => status !== 0),
110426
+ onSome: (id) => some(apps, (app) => app.pid === id && app.label === agent.label)
110427
+ })), map$10((agent) => InventoryItem.make({
110428
+ active: isSome(agent.pid),
110429
+ detail: agent.detail,
110430
+ failure: pipe(agent.status, filter$7((status) => isNone(agent.pid) && status !== 0), map$13((status) => ({
110431
+ at: none(),
110432
+ reason: exitFailure(status)
110433
+ }))),
110434
+ health: match(isNone(agent.pid), {
110435
+ onFalse: constant("quiet"),
110436
+ onTrue: constant("error")
110402
110437
  }),
110403
- onSome: constant("running")
110404
- }),
110405
- url: none(),
110406
- worker
110407
- })))), collect("Listening ports", flatMap$3(command("lsof", [
110408
- "-nP",
110409
- "+c0",
110410
- "-iTCP",
110411
- "-sTCP:LISTEN",
110412
- "-iUDP",
110413
- "-F",
110414
- "pctPnT"
110415
- ]), (text) => portItems(lsofSockets(text), worker, http, {
110416
- cwd: fnUntraced(function* (processId) {
110417
- return pipe(yield* option$1(command("lsof", [
110418
- "-nP",
110419
- "-a",
110420
- "-p",
110421
- `${processId}`,
110422
- "-d",
110423
- "cwd",
110424
- "-Fn"
110425
- ])), getOrElse$1(constant("")), split$1("\n"), findFirst(startsWith("n")), map$13(slice(1)));
110426
- }),
110427
- unit: (processId) => succeed$5(pipe(owned, findFirst((record) => record.process.pid === processId), map$13((record) => record.unit)))
110428
- })))]
110438
+ id: ItemId.make(`${worker}:user:${agent.label}`),
110439
+ kind: "service",
110440
+ name: agent.label,
110441
+ running: isSome(agent.pid),
110442
+ scope: some$1("user"),
110443
+ state: match$8(agent.pid, {
110444
+ onNone: constant("failed · failed"),
110445
+ onSome: constant("running")
110446
+ }),
110447
+ url: none(),
110448
+ worker
110449
+ }))))),
110450
+ collect("Applications", map$7(fromResult(launchd.applications), appItems)),
110451
+ collect("Listening ports", flatMap$3(command("lsof", [
110452
+ "-nP",
110453
+ "+c0",
110454
+ "-iTCP",
110455
+ "-sTCP:LISTEN",
110456
+ "-iUDP",
110457
+ "-F",
110458
+ "pctPnT"
110459
+ ]), (text) => portItems(lsofSockets(text), worker, http, {
110460
+ cwd: fnUntraced(function* (processId) {
110461
+ return pipe(yield* option$1(command("lsof", [
110462
+ "-nP",
110463
+ "-a",
110464
+ "-p",
110465
+ `${processId}`,
110466
+ "-d",
110467
+ "cwd",
110468
+ "-Fn"
110469
+ ])), getOrElse$1(constant("")), split$1("\n"), findFirst(startsWith("n")), map$13(slice(1)));
110470
+ }),
110471
+ unit: (processId) => succeed$5(pipe(owned, findFirst((record) => record.process.pid === processId), map$13((record) => record.unit)))
110472
+ })))
110473
+ ]
110429
110474
  };
110430
110475
  });
110431
110476
  const start = fnUntraced(function* (input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/deploy",
3
- "version": "0.1.1326",
3
+ "version": "0.1.1328",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/MP281X/deslop.git",
@@ -40,5 +40,5 @@
40
40
  "engines": {
41
41
  "node": ">=26"
42
42
  },
43
- "fingerprint": "6f273bc8fcb28eb4667d85b9581a4c9932b1db3246612b824c6b9406d23d189b"
43
+ "fingerprint": "3beb663bbbd5c2028d97ef47ee5abf674ed851c26fc098ae4286a90d9400f35b"
44
44
  }