@hasna/machines 0.0.13 → 0.0.14

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.
@@ -1,5 +1,4 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  export declare const MACHINE_MCP_TOOL_NAMES: readonly ["machines_status", "machines_doctor", "machines_self_test", "machines_apps_list", "machines_apps_status", "machines_apps_diff", "machines_apps_plan", "machines_apps_apply", "machines_manifest", "machines_manifest_validate", "machines_manifest_bootstrap", "machines_manifest_get", "machines_manifest_remove", "machines_agent_status", "machines_setup_preview", "machines_setup_apply", "machines_sync_preview", "machines_sync_apply", "machines_diff", "machines_install_tailscale_preview", "machines_install_tailscale_apply", "machines_install_claude_status", "machines_install_claude_diff", "machines_install_claude_preview", "machines_install_claude_apply", "machines_ssh_resolve", "machines_ports", "machines_backup_preview", "machines_backup_apply", "machines_cert_preview", "machines_cert_apply", "machines_dns_add", "machines_dns_list", "machines_dns_render", "machines_notifications_add", "machines_notifications_list", "machines_notifications_test", "machines_notifications_dispatch", "machines_notifications_remove", "machines_serve_info", "machines_serve_dashboard"];
3
- export declare function buildServer(version?: string): McpServer;
4
3
  export declare function createMcpServer(version: string): McpServer;
5
4
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4BpE,eAAO,MAAM,sBAAsB,4jCA0CzB,CAAC;AAEX,wBAAgB,WAAW,CAAC,OAAO,GAAE,MAA4B,GAAG,SAAS,CAE5E;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CA6R1D"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2BpE,eAAO,MAAM,sBAAsB,4jCA0CzB,CAAC;AAEX,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CA6R1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/machines",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Machine fleet management CLI + MCP for developers",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -56,7 +56,6 @@
56
56
  "bun": ">=1.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@hasna/cloud": "^0.1.13",
60
59
  "@modelcontextprotocol/sdk": "^1.26.0",
61
60
  "chalk": "^5.6.2",
62
61
  "commander": "^13.1.0",
@@ -1,36 +0,0 @@
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
@@ -1 +0,0 @@
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;AAoBD,yEAAyE;AACzE,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CA0B7C;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"}
@@ -1,122 +0,0 @@
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
@@ -1 +0,0 @@
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,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,cAAc,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,kCAAkC;IAClC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kDAAkD;IAClD,uBAAuB,EAAE,MAAM,CAAC;IAChC,mDAAmD;IACnD,uBAAuB,EAAE,MAAM,CAAC;IAChC,sFAAsF;IACtF,gBAAgB,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,uBAAuB,EAAE,MAAM,CAAC;IAChC,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,WAAW,EAAE,OAAO,CAAC;IACrB,wCAAwC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AAI,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"}
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
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"}