@hasna/machines 0.0.14 → 0.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/LICENSE +2 -1
- package/README.md +87 -0
- package/dist/cli/index.js +1726 -179
- package/dist/commands/heal-daemon.d.ts +36 -0
- package/dist/commands/heal-daemon.d.ts.map +1 -0
- package/dist/commands/heal.d.ts +122 -0
- package/dist/commands/heal.d.ts.map +1 -0
- package/dist/compatibility.d.ts +55 -0
- package/dist/compatibility.d.ts.map +1 -0
- package/dist/db.d.ts +1 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1040 -185
- package/dist/mcp/http.d.ts +12 -0
- package/dist/mcp/http.d.ts.map +1 -0
- package/dist/mcp/index.js +954 -75
- package/dist/mcp/server.d.ts +2 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/pg-migrations.d.ts +7 -0
- package/dist/pg-migrations.d.ts.map +1 -0
- package/dist/remote-storage.d.ts +10 -0
- package/dist/remote-storage.d.ts.map +1 -0
- package/dist/remote.d.ts +5 -1
- package/dist/remote.d.ts.map +1 -1
- package/dist/storage-sync.d.ts +58 -0
- package/dist/storage-sync.d.ts.map +1 -0
- package/dist/storage.d.ts +5 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +557 -0
- package/dist/topology.d.ts +55 -0
- package/dist/topology.d.ts.map +1 -0
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -2
package/dist/mcp/server.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
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"];
|
|
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_topology", "machines_compatibility", "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", "storage_status", "storage_push", "storage_pull", "storage_sync"];
|
|
3
|
+
export declare function buildServer(version?: string): McpServer;
|
|
3
4
|
export declare function createMcpServer(version: string): McpServer;
|
|
4
5
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA+BpE,eAAO,MAAM,sBAAsB,6qCAgDzB,CAAC;AAEX,wBAAgB,WAAW,CAAC,OAAO,GAAE,MAA4B,GAAG,SAAS,CAE5E;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CA6V1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pg-migrations.d.ts","sourceRoot":"","sources":["../src/pg-migrations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,EA4BjC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class PgAdapterAsync {
|
|
2
|
+
private readonly pool;
|
|
3
|
+
constructor(connectionString: string);
|
|
4
|
+
run(sql: string, ...params: unknown[]): Promise<{
|
|
5
|
+
changes: number;
|
|
6
|
+
}>;
|
|
7
|
+
all(sql: string, ...params: unknown[]): Promise<unknown[]>;
|
|
8
|
+
close(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=remote-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-storage.d.ts","sourceRoot":"","sources":["../src/remote-storage.ts"],"names":[],"mappings":"AAmBA,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;gBAEhB,gBAAgB,EAAE,MAAM;IAI9B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAKpE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAK1D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/remote.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export interface MachineCommandResult {
|
|
2
2
|
machineId: string;
|
|
3
|
-
source: "local" | "lan" | "tailscale";
|
|
3
|
+
source: "local" | "lan" | "tailscale" | "ssh";
|
|
4
4
|
stdout: string;
|
|
5
5
|
stderr: string;
|
|
6
6
|
exitCode: number;
|
|
7
7
|
}
|
|
8
|
+
export declare function resolveMachineCommand(machineId: string, command: string, localMachineId?: string): {
|
|
9
|
+
source: MachineCommandResult["source"];
|
|
10
|
+
shellCommand: string;
|
|
11
|
+
};
|
|
8
12
|
export declare function runMachineCommand(machineId: string, command: string): MachineCommandResult;
|
|
9
13
|
//# sourceMappingURL=remote.d.ts.map
|
package/dist/remote.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAaD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,SAAsB,GAAG;IAAE,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAgBhL;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,oBAAoB,CAc1F"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PgAdapterAsync } from "./remote-storage.js";
|
|
2
|
+
export declare const STORAGE_TABLES: readonly ["agent_heartbeats", "setup_runs", "sync_runs"];
|
|
3
|
+
export declare const MACHINES_STORAGE_TABLES: readonly ["agent_heartbeats", "setup_runs", "sync_runs"];
|
|
4
|
+
type StorageTable = (typeof STORAGE_TABLES)[number];
|
|
5
|
+
export type StorageMode = "local" | "hybrid" | "remote";
|
|
6
|
+
export interface StorageEnv {
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SyncResult {
|
|
10
|
+
table: string;
|
|
11
|
+
rowsRead: number;
|
|
12
|
+
rowsWritten: number;
|
|
13
|
+
errors: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface SyncMeta {
|
|
16
|
+
table_name: string;
|
|
17
|
+
last_synced_at: string | null;
|
|
18
|
+
direction: "push" | "pull";
|
|
19
|
+
}
|
|
20
|
+
export declare const MACHINES_STORAGE_ENV = "HASNA_MACHINES_DATABASE_URL";
|
|
21
|
+
export declare const MACHINES_STORAGE_FALLBACK_ENV = "MACHINES_DATABASE_URL";
|
|
22
|
+
export declare const MACHINES_STORAGE_MODE_ENV = "HASNA_MACHINES_STORAGE_MODE";
|
|
23
|
+
export declare const MACHINES_STORAGE_MODE_FALLBACK_ENV = "MACHINES_STORAGE_MODE";
|
|
24
|
+
export declare const STORAGE_DATABASE_ENV: readonly ["HASNA_MACHINES_DATABASE_URL", "MACHINES_DATABASE_URL"];
|
|
25
|
+
export declare const STORAGE_MODE_ENV: readonly ["HASNA_MACHINES_STORAGE_MODE", "MACHINES_STORAGE_MODE"];
|
|
26
|
+
export interface StorageStatus {
|
|
27
|
+
configured: boolean;
|
|
28
|
+
mode: StorageMode;
|
|
29
|
+
env: typeof STORAGE_DATABASE_ENV;
|
|
30
|
+
activeEnv: string | null;
|
|
31
|
+
service: "machines";
|
|
32
|
+
tables: typeof STORAGE_TABLES;
|
|
33
|
+
sync: SyncMeta[];
|
|
34
|
+
}
|
|
35
|
+
export declare function getStorageDatabaseEnvName(): (typeof STORAGE_DATABASE_ENV)[number] | null;
|
|
36
|
+
export declare function getStorageDatabaseEnv(): StorageEnv | null;
|
|
37
|
+
export declare function getStorageDatabaseUrl(): string | null;
|
|
38
|
+
export declare function getStorageMode(): StorageMode;
|
|
39
|
+
export declare function getStoragePg(): Promise<PgAdapterAsync>;
|
|
40
|
+
export declare function runStorageMigrations(remote: PgAdapterAsync): Promise<void>;
|
|
41
|
+
export declare function storagePush(options?: {
|
|
42
|
+
tables?: string[];
|
|
43
|
+
}): Promise<SyncResult[]>;
|
|
44
|
+
export declare function storagePull(options?: {
|
|
45
|
+
tables?: string[];
|
|
46
|
+
}): Promise<SyncResult[]>;
|
|
47
|
+
export declare function storageSync(options?: {
|
|
48
|
+
tables?: string[];
|
|
49
|
+
}): Promise<{
|
|
50
|
+
pull: SyncResult[];
|
|
51
|
+
push: SyncResult[];
|
|
52
|
+
}>;
|
|
53
|
+
export declare function getSyncMetaAll(): SyncMeta[];
|
|
54
|
+
export declare function getStorageStatus(): StorageStatus;
|
|
55
|
+
export declare function resolveTables(tables?: string[]): StorageTable[];
|
|
56
|
+
export declare function parseStorageTables(value?: string | string[] | null): StorageTable[] | undefined;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=storage-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-sync.d.ts","sourceRoot":"","sources":["../src/storage-sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,cAAc,0DAIjB,CAAC;AAEX,eAAO,MAAM,uBAAuB,0DAAiB,CAAC;AAEtD,KAAK,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAGpD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,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,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAcxF;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAcxF;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAAC,IAAI,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC,CAItH;AAED,wBAAgB,cAAc,IAAI,QAAQ,EAAE,CAI3C;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAWhD;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,CAO/D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,YAAY,EAAE,GAAG,SAAS,CAG/F"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MACHINES_STORAGE_ENV, MACHINES_STORAGE_FALLBACK_ENV, MACHINES_STORAGE_MODE_ENV, MACHINES_STORAGE_MODE_FALLBACK_ENV, MACHINES_STORAGE_TABLES, STORAGE_DATABASE_ENV, STORAGE_MODE_ENV, STORAGE_TABLES, getStorageDatabaseEnv, getStorageDatabaseEnvName, getStorageDatabaseUrl, getStorageMode, getStoragePg, getStorageStatus, getSyncMetaAll, parseStorageTables, resolveTables, runStorageMigrations, storagePull, storagePush, storageSync, } from "./storage-sync.js";
|
|
2
|
+
export type { StorageEnv, StorageMode, StorageStatus, SyncMeta, SyncResult } from "./storage-sync.js";
|
|
3
|
+
export { PG_MIGRATIONS } from "./pg-migrations.js";
|
|
4
|
+
export { PgAdapterAsync } from "./remote-storage.js";
|
|
5
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,yBAAyB,EACzB,kCAAkC,EAClC,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|