@hasna/machines 0.0.9 → 0.0.11

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.
@@ -0,0 +1,6 @@
1
+ export declare function stopClipboardDaemon(): {
2
+ stopped: boolean;
3
+ pid: number | null;
4
+ };
5
+ export declare function startClipboardDaemon(port?: number): void;
6
+ //# sourceMappingURL=clipboard-daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-daemon.ts"],"names":[],"mappings":"AA2HA,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAO9E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CA6DxD"}
@@ -9,6 +9,8 @@ export interface ClipboardServerHandle {
9
9
  port: number;
10
10
  close: () => Promise<void>;
11
11
  }
12
+ export declare function getCurrentContentHash(): string | null;
13
+ export declare function setCurrentContentHash(hash: string): void;
12
14
  export declare function startClipboardServer(options?: ClipboardServerOptions): ClipboardServerHandle;
13
15
  export declare function pushClipboardToPeer(host: string, port: number, token: string): Promise<{
14
16
  sent: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-server.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AAKpF,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,aAAa,CAAC;AAuFnE,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAID,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CA6ChG;AA6DD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA4ChI"}
1
+ {"version":3,"file":"clipboard-server.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AAKpF,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,aAAa,CAAC;AAuFnE,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAID,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAA+B;AACrF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAA+B;AAExF,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CA6ChG;AA6DD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA4ChI"}
@@ -0,0 +1,36 @@
1
+ import { type HealConfig } from "./heal.js";
2
+ export interface HealTickResult {
3
+ healthy: boolean;
4
+ action: string;
5
+ suppressedReason?: string;
6
+ reasons: string[];
7
+ remoteScore: number;
8
+ failCount: number;
9
+ executed: string;
10
+ }
11
+ /** Run a single health/decision tick. With dryRun=true, never executes side effects. */
12
+ export declare function runHealOnce(config: HealConfig, opts?: {
13
+ dryRun?: boolean;
14
+ }): HealTickResult;
15
+ export declare function stopHealDaemon(): {
16
+ stopped: boolean;
17
+ pid: number | null;
18
+ };
19
+ export declare function startHealDaemon(): void;
20
+ /**
21
+ * SSID determinism: pin the preferred profile (autoconnect + high priority, power
22
+ * save off) and disable autoconnect on every other Wi-Fi profile so the node
23
+ * cannot silently roam onto an isolated network.
24
+ */
25
+ export declare function applyDeterminism(config: HealConfig): string[];
26
+ /** Enable the systemd hardware watchdog for true freezes (idempotent). */
27
+ export declare function enableHardwareWatchdog(): string[];
28
+ /** Install + enable the systemd service that runs the daemon as root. */
29
+ export declare function installHealService(): string[];
30
+ export declare function uninstallHealService(): string[];
31
+ export declare function healServiceStatus(): {
32
+ installed: boolean;
33
+ active: boolean;
34
+ enabled: boolean;
35
+ };
36
+ //# sourceMappingURL=heal-daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heal-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/heal-daemon.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAMnB,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAMD,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,cAAc,CAsC/F;AAwBD,wBAAgB,cAAc,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAOzE;AAED,wBAAgB,eAAe,IAAI,IAAI,CAiBtC;AAOD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CAyB7D;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAejD;AAQD,yEAAyE;AACzE,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAwB7C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAW/C;AAED,wBAAgB,iBAAiB,IAAI;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAM7F"}
@@ -0,0 +1,122 @@
1
+ export interface HealThresholds {
2
+ /** consecutive failed checks before reconnecting Wi-Fi */
3
+ reconnect: number;
4
+ /** before restarting NetworkManager */
5
+ nmRestart: number;
6
+ /** before trying the degraded fallback SSID */
7
+ fallback: number;
8
+ /** before rebooting (last resort) */
9
+ reboot: number;
10
+ }
11
+ export interface HealConfig {
12
+ version: number;
13
+ enabled: boolean;
14
+ /** Wi-Fi interface (empty = auto-detect) */
15
+ wifiInterface: string;
16
+ /** the SSID this node must stay on */
17
+ preferredSsid: string;
18
+ /** one-shot degraded fallback SSID, restored to preferred after fallbackWindowSec */
19
+ fallbackSsid: string;
20
+ /** HTTPS URL used as the internet anchor */
21
+ internetUrl: string;
22
+ /** Tailscale hostnames used as peer anchors (empty = auto-discover online peers) */
23
+ tailscaleAnchors: string[];
24
+ /** how many of {anchors..., internet} must be reachable to count as healthy */
25
+ quorumRequired: number;
26
+ /** seconds between checks (daemon loop / timer) */
27
+ intervalSec: number;
28
+ thresholds: HealThresholds;
29
+ /** min seconds between reboots */
30
+ rebootMinIntervalSec: number;
31
+ /** min seconds between NetworkManager restarts */
32
+ nmRestartMinIntervalSec: number;
33
+ /** min seconds between Wi-Fi reconnect attempts */
34
+ reconnectMinIntervalSec: number;
35
+ /** continuous healthy seconds after boot before a watchdog reboot is allowed again */
36
+ healthyWindowSec: number;
37
+ /** after this many reboots that never reached a healthy window, stop rebooting */
38
+ maxFailedBootRecoveries: number;
39
+ /** how long to suppress reboots once a reboot loop is detected */
40
+ bootBackoffSec: number;
41
+ /** how long to stay on the fallback SSID before restoring preferred */
42
+ fallbackWindowSec: number;
43
+ /** skip reboot while a GPU compute job is running (alert instead) */
44
+ gpuJobGuard: boolean;
45
+ /** master switch for the reboot tier */
46
+ allowReboot: boolean;
47
+ }
48
+ export interface HealState {
49
+ failCount: number;
50
+ bootId: string;
51
+ bootHealthySince: number | null;
52
+ lastRebootAttempt: number;
53
+ lastNmRestart: number;
54
+ lastReconnect: number;
55
+ lastFallback: number;
56
+ degradedUntil: number;
57
+ pendingRebootRecovery: boolean;
58
+ failedBootRecoveries: number;
59
+ rebootSuppressUntil: number;
60
+ }
61
+ export interface HealthProbe {
62
+ associatedSsid: string | null;
63
+ gatewayReachable: boolean;
64
+ /** anchor hostname -> reachable via tailscale ping */
65
+ anchorsReachable: Record<string, boolean>;
66
+ internetReachable: boolean;
67
+ }
68
+ export interface HealthResult {
69
+ healthy: boolean;
70
+ remoteScore: number;
71
+ reasons: string[];
72
+ }
73
+ export type HealAction = "none" | "reconnect_wifi" | "restart_nm" | "fallback_ssid" | "restore_preferred" | "reboot";
74
+ export type SuppressedReason = "disabled" | "gpu" | "rate" | "loop";
75
+ export interface HealDecision {
76
+ action: HealAction;
77
+ /** set when a reboot was wanted but withheld */
78
+ suppressedReason?: SuppressedReason;
79
+ state: HealState;
80
+ }
81
+ export declare const DEFAULT_THRESHOLDS: HealThresholds;
82
+ export declare const DEFAULT_HEAL_CONFIG: HealConfig;
83
+ export declare function defaultHealState(): HealState;
84
+ export declare function getHealConfigPath(): string;
85
+ export declare function getHealStatePath(): string;
86
+ export declare function readHealConfig(path?: string): HealConfig;
87
+ export declare function writeHealConfig(config: HealConfig, path?: string): void;
88
+ export declare function readHealState(path?: string): HealState;
89
+ export declare function writeHealState(state: HealState, path?: string): void;
90
+ /**
91
+ * Pure health evaluation. Healthy requires the local invariants (associated to an
92
+ * acceptable SSID + gateway reachable) AND a remote quorum of reachable anchors,
93
+ * so a node that is locally fine but isolated from its peers is correctly unhealthy.
94
+ */
95
+ export declare function evaluateHealth(probe: HealthProbe, config: HealConfig, state: HealState): HealthResult;
96
+ /**
97
+ * Pure escalation state machine. Given the current persisted state, whether this
98
+ * tick is healthy, the clock, GPU activity, and config, decide the single action
99
+ * to take and return the updated state. No side effects.
100
+ */
101
+ export declare function decideAction(input: {
102
+ state: HealState;
103
+ healthy: boolean;
104
+ now: number;
105
+ gpuBusy: boolean;
106
+ config: HealConfig;
107
+ currentBootId: string;
108
+ }): HealDecision;
109
+ export declare function getCurrentBootId(): string;
110
+ export declare function detectWifiInterface(): string;
111
+ export declare function detectGateway(): string;
112
+ export declare function getAssociatedSsid(): string | null;
113
+ export declare function pingHost(host: string): boolean;
114
+ export declare function internetReachable(url: string): boolean;
115
+ export declare function tailscalePing(host: string): boolean;
116
+ export declare function gpuBusy(): boolean;
117
+ /** Auto-discover online tailscale peers (excluding self) as anchors. */
118
+ export declare function discoverAnchors(): string[];
119
+ export declare function probeHealth(config: HealConfig): HealthProbe;
120
+ /** Apply the action's side effects. Returns a human-readable description. */
121
+ export declare function executeAction(action: HealAction, config: HealConfig): string;
122
+ //# sourceMappingURL=heal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heal.d.ts","sourceRoot":"","sources":["../../src/commands/heal.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,+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AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAIpE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY,CAuBrG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,YAAY,CAwFf;AAWD,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAG5C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAGtC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAGjD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG9C;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,OAAO,IAAI,OAAO,CAGjC;AAED,wEAAwE;AACxE,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAc1C;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,CAW3D;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAsB5E"}
package/dist/index.js CHANGED
@@ -4,43 +4,25 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- function __accessProp(key) {
8
- return this[key];
9
- }
10
- var __toESMCache_node;
11
- var __toESMCache_esm;
12
7
  var __toESM = (mod, isNodeMode, target) => {
13
- var canCache = mod != null && typeof mod === "object";
14
- if (canCache) {
15
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
- var cached = cache.get(mod);
17
- if (cached)
18
- return cached;
19
- }
20
8
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
9
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
10
  for (let key of __getOwnPropNames(mod))
23
11
  if (!__hasOwnProp.call(to, key))
24
12
  __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
13
+ get: () => mod[key],
26
14
  enumerable: true
27
15
  });
28
- if (canCache)
29
- cache.set(mod, to);
30
16
  return to;
31
17
  };
32
18
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
- var __returnValue = (v) => v;
34
- function __exportSetter(name, newValue) {
35
- this[name] = __returnValue.bind(null, newValue);
36
- }
37
19
  var __export = (target, all) => {
38
20
  for (var name in all)
39
21
  __defProp(target, name, {
40
22
  get: all[name],
41
23
  enumerable: true,
42
24
  configurable: true,
43
- set: __exportSetter.bind(all, name)
25
+ set: (newValue) => all[name] = () => newValue
44
26
  });
45
27
  };
46
28
 
@@ -6583,15 +6565,15 @@ var __getProtoOf2 = Object.getPrototypeOf;
6583
6565
  var __defProp2 = Object.defineProperty;
6584
6566
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
6585
6567
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
6586
- function __accessProp2(key) {
6568
+ function __accessProp(key) {
6587
6569
  return this[key];
6588
6570
  }
6589
- var __toESMCache_node2;
6590
- var __toESMCache_esm2;
6571
+ var __toESMCache_node;
6572
+ var __toESMCache_esm;
6591
6573
  var __toESM2 = (mod, isNodeMode, target) => {
6592
6574
  var canCache = mod != null && typeof mod === "object";
6593
6575
  if (canCache) {
6594
- var cache = isNodeMode ? __toESMCache_node2 ??= new WeakMap : __toESMCache_esm2 ??= new WeakMap;
6576
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
6595
6577
  var cached = cache.get(mod);
6596
6578
  if (cached)
6597
6579
  return cached;
@@ -6601,7 +6583,7 @@ var __toESM2 = (mod, isNodeMode, target) => {
6601
6583
  for (let key of __getOwnPropNames2(mod))
6602
6584
  if (!__hasOwnProp2.call(to, key))
6603
6585
  __defProp2(to, key, {
6604
- get: __accessProp2.bind(mod, key),
6586
+ get: __accessProp.bind(mod, key),
6605
6587
  enumerable: true
6606
6588
  });
6607
6589
  if (canCache)
@@ -6609,9 +6591,9 @@ var __toESM2 = (mod, isNodeMode, target) => {
6609
6591
  return to;
6610
6592
  };
6611
6593
  var __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
6612
- var __returnValue2 = (v) => v;
6613
- function __exportSetter2(name, newValue) {
6614
- this[name] = __returnValue2.bind(null, newValue);
6594
+ var __returnValue = (v) => v;
6595
+ function __exportSetter(name, newValue) {
6596
+ this[name] = __returnValue.bind(null, newValue);
6615
6597
  }
6616
6598
  var __export2 = (target, all) => {
6617
6599
  for (var name in all)
@@ -6619,7 +6601,7 @@ var __export2 = (target, all) => {
6619
6601
  get: all[name],
6620
6602
  enumerable: true,
6621
6603
  configurable: true,
6622
- set: __exportSetter2.bind(all, name)
6604
+ set: __exportSetter.bind(all, name)
6623
6605
  });
6624
6606
  };
6625
6607
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -30811,6 +30793,9 @@ var MACHINE_MCP_TOOL_NAMES = [
30811
30793
  "machines_serve_info",
30812
30794
  "machines_serve_dashboard"
30813
30795
  ];
30796
+ function buildServer(version2 = getPackageVersion()) {
30797
+ return createMcpServer(version2);
30798
+ }
30814
30799
  function createMcpServer(version2) {
30815
30800
  const server = new McpServer({ name: "machines", version: version2 });
30816
30801
  server.tool("machines_status", "Return local machine fleet status paths and machine identity.", {}, async () => ({
@@ -30979,6 +30964,7 @@ export {
30979
30964
  buildSyncPlan,
30980
30965
  buildSshCommand,
30981
30966
  buildSetupPlan,
30967
+ buildServer,
30982
30968
  buildClaudeInstallPlan,
30983
30969
  buildCertPlan,
30984
30970
  buildBackupPlan,
@@ -0,0 +1,12 @@
1
+ import { type Server } from "node:http";
2
+ export declare const DEFAULT_HTTP_PORT = 8821;
3
+ export declare const HTTP_NAME = "machines";
4
+ export interface StartHttpServerOptions {
5
+ port?: number;
6
+ host?: string;
7
+ name?: string;
8
+ }
9
+ export declare function isHttpMode(args?: string[]): boolean;
10
+ export declare function resolveHttpPort(args?: string[]): number;
11
+ export declare function startHttpServer(options?: StartHttpServerOptions): Server;
12
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/mcp/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAC;AAIjG,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,SAAS,aAAa,CAAC;AAEpC,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAE1E;AAED,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,MAAM,CAiB9E;AAmDD,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CA8B5E"}