@hasna/machines 0.0.39 → 0.0.40
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/dist/agent/index.js +10 -1
- package/dist/cli/index.js +11 -2
- package/dist/consumer.js +10 -1
- package/dist/db.d.ts +1 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/mcp/index.js +11 -2
- package/dist/storage.js +9 -0
- package/package.json +1 -1
package/dist/agent/index.js
CHANGED
|
@@ -7150,6 +7150,15 @@ function listHeartbeats(machineId) {
|
|
|
7150
7150
|
FROM agent_heartbeats
|
|
7151
7151
|
ORDER BY updated_at DESC`).all();
|
|
7152
7152
|
}
|
|
7153
|
+
function latestHeartbeatByMachine(heartbeats) {
|
|
7154
|
+
const byMachine = new Map;
|
|
7155
|
+
for (const heartbeat of heartbeats) {
|
|
7156
|
+
if (!byMachine.has(heartbeat.machine_id)) {
|
|
7157
|
+
byMachine.set(heartbeat.machine_id, heartbeat);
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
return byMachine;
|
|
7161
|
+
}
|
|
7153
7162
|
|
|
7154
7163
|
// src/agent/runtime.ts
|
|
7155
7164
|
import { execFileSync } from "child_process";
|
|
@@ -11616,7 +11625,7 @@ function discoverMachineTopology(options = {}) {
|
|
|
11616
11625
|
const warnings = [];
|
|
11617
11626
|
const manifest = readManifest();
|
|
11618
11627
|
const heartbeats = listHeartbeats();
|
|
11619
|
-
const heartbeatByMachine =
|
|
11628
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
11620
11629
|
const localMachineId = getLocalMachineId();
|
|
11621
11630
|
const peers = options.includeTailscale === false ? new Map : loadTailscalePeers(runner, warnings);
|
|
11622
11631
|
const machineIds = new Set([
|
package/dist/cli/index.js
CHANGED
|
@@ -2219,6 +2219,15 @@ function listHeartbeats(machineId) {
|
|
|
2219
2219
|
FROM agent_heartbeats
|
|
2220
2220
|
ORDER BY updated_at DESC`).all();
|
|
2221
2221
|
}
|
|
2222
|
+
function latestHeartbeatByMachine(heartbeats) {
|
|
2223
|
+
const byMachine = new Map;
|
|
2224
|
+
for (const heartbeat of heartbeats) {
|
|
2225
|
+
if (!byMachine.has(heartbeat.machine_id)) {
|
|
2226
|
+
byMachine.set(heartbeat.machine_id, heartbeat);
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
return byMachine;
|
|
2230
|
+
}
|
|
2222
2231
|
function countRuns(table) {
|
|
2223
2232
|
const db = getDb();
|
|
2224
2233
|
const row = db.query(`SELECT COUNT(*) as count FROM ${table}`).get();
|
|
@@ -7755,7 +7764,7 @@ function discoverMachineTopology(options = {}) {
|
|
|
7755
7764
|
const warnings = [];
|
|
7756
7765
|
const manifest = readManifest();
|
|
7757
7766
|
const heartbeats = listHeartbeats();
|
|
7758
|
-
const heartbeatByMachine =
|
|
7767
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
7759
7768
|
const localMachineId = getLocalMachineId();
|
|
7760
7769
|
const peers = options.includeTailscale === false ? new Map : loadTailscalePeers(runner, warnings);
|
|
7761
7770
|
const machineIds = new Set([
|
|
@@ -9966,7 +9975,7 @@ function parseJsonObject(value) {
|
|
|
9966
9975
|
function getStatus() {
|
|
9967
9976
|
const manifest = readManifest();
|
|
9968
9977
|
const heartbeats = listHeartbeats();
|
|
9969
|
-
const heartbeatByMachine =
|
|
9978
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
9970
9979
|
const machineIds = new Set([
|
|
9971
9980
|
...manifest.machines.map((machine) => machine.id),
|
|
9972
9981
|
...heartbeats.map((heartbeat) => heartbeat.machine_id)
|
package/dist/consumer.js
CHANGED
|
@@ -253,6 +253,15 @@ function listHeartbeats(machineId) {
|
|
|
253
253
|
FROM agent_heartbeats
|
|
254
254
|
ORDER BY updated_at DESC`).all();
|
|
255
255
|
}
|
|
256
|
+
function latestHeartbeatByMachine(heartbeats) {
|
|
257
|
+
const byMachine = new Map;
|
|
258
|
+
for (const heartbeat of heartbeats) {
|
|
259
|
+
if (!byMachine.has(heartbeat.machine_id)) {
|
|
260
|
+
byMachine.set(heartbeat.machine_id, heartbeat);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return byMachine;
|
|
264
|
+
}
|
|
256
265
|
function countRuns(table) {
|
|
257
266
|
const db = getDb();
|
|
258
267
|
const row = db.query(`SELECT COUNT(*) as count FROM ${table}`).get();
|
|
@@ -4886,7 +4895,7 @@ function discoverMachineTopology(options = {}) {
|
|
|
4886
4895
|
const warnings = [];
|
|
4887
4896
|
const manifest = readManifest();
|
|
4888
4897
|
const heartbeats = listHeartbeats();
|
|
4889
|
-
const heartbeatByMachine =
|
|
4898
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
4890
4899
|
const localMachineId = getLocalMachineId();
|
|
4891
4900
|
const peers = options.includeTailscale === false ? new Map : loadTailscalePeers(runner, warnings);
|
|
4892
4901
|
const machineIds = new Set([
|
package/dist/db.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface StoredHeartbeat {
|
|
|
44
44
|
private_metadata: number;
|
|
45
45
|
}
|
|
46
46
|
export declare function listHeartbeats(machineId?: string): StoredHeartbeat[];
|
|
47
|
+
export declare function latestHeartbeatByMachine(heartbeats: readonly StoredHeartbeat[]): Map<string, StoredHeartbeat>;
|
|
47
48
|
export declare function countRuns(table: "setup_runs" | "sync_runs"): number;
|
|
48
49
|
export declare function setHeartbeatStatus(machineId: string, pid: number, status: "online" | "offline"): void;
|
|
49
50
|
export declare function recordSetupRun(machineId: string, status: string, details: unknown): void;
|
package/dist/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,qBAAa,aAAa;IACxB,QAAQ,CAAC,GAAG,EA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a,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAOvF"}
|
package/dist/index.js
CHANGED
|
@@ -6720,6 +6720,15 @@ function listHeartbeats(machineId) {
|
|
|
6720
6720
|
FROM agent_heartbeats
|
|
6721
6721
|
ORDER BY updated_at DESC`).all();
|
|
6722
6722
|
}
|
|
6723
|
+
function latestHeartbeatByMachine(heartbeats) {
|
|
6724
|
+
const byMachine = new Map;
|
|
6725
|
+
for (const heartbeat of heartbeats) {
|
|
6726
|
+
if (!byMachine.has(heartbeat.machine_id)) {
|
|
6727
|
+
byMachine.set(heartbeat.machine_id, heartbeat);
|
|
6728
|
+
}
|
|
6729
|
+
}
|
|
6730
|
+
return byMachine;
|
|
6731
|
+
}
|
|
6723
6732
|
function countRuns(table) {
|
|
6724
6733
|
const db = getDb();
|
|
6725
6734
|
const row = db.query(`SELECT COUNT(*) as count FROM ${table}`).get();
|
|
@@ -11726,7 +11735,7 @@ function discoverMachineTopology(options = {}) {
|
|
|
11726
11735
|
const warnings = [];
|
|
11727
11736
|
const manifest = readManifest();
|
|
11728
11737
|
const heartbeats = listHeartbeats();
|
|
11729
|
-
const heartbeatByMachine =
|
|
11738
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
11730
11739
|
const localMachineId = getLocalMachineId();
|
|
11731
11740
|
const peers = options.includeTailscale === false ? new Map : loadTailscalePeers(runner, warnings);
|
|
11732
11741
|
const machineIds = new Set([
|
|
@@ -14807,7 +14816,7 @@ function parseJsonObject2(value) {
|
|
|
14807
14816
|
function getStatus() {
|
|
14808
14817
|
const manifest = readManifest();
|
|
14809
14818
|
const heartbeats = listHeartbeats();
|
|
14810
|
-
const heartbeatByMachine =
|
|
14819
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
14811
14820
|
const machineIds = new Set([
|
|
14812
14821
|
...manifest.machines.map((machine) => machine.id),
|
|
14813
14822
|
...heartbeats.map((heartbeat) => heartbeat.machine_id)
|
|
@@ -25145,6 +25154,7 @@ export {
|
|
|
25145
25154
|
listHeartbeats,
|
|
25146
25155
|
listDomainMappings,
|
|
25147
25156
|
listApps,
|
|
25157
|
+
latestHeartbeatByMachine,
|
|
25148
25158
|
isSensitiveKey,
|
|
25149
25159
|
isPrivateOutputEnabled,
|
|
25150
25160
|
isPrivateMetadataEnabled,
|
package/dist/mcp/index.js
CHANGED
|
@@ -4582,6 +4582,15 @@ function listHeartbeats(machineId) {
|
|
|
4582
4582
|
FROM agent_heartbeats
|
|
4583
4583
|
ORDER BY updated_at DESC`).all();
|
|
4584
4584
|
}
|
|
4585
|
+
function latestHeartbeatByMachine(heartbeats) {
|
|
4586
|
+
const byMachine = new Map;
|
|
4587
|
+
for (const heartbeat of heartbeats) {
|
|
4588
|
+
if (!byMachine.has(heartbeat.machine_id)) {
|
|
4589
|
+
byMachine.set(heartbeat.machine_id, heartbeat);
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
return byMachine;
|
|
4593
|
+
}
|
|
4585
4594
|
function countRuns(table) {
|
|
4586
4595
|
const db = getDb();
|
|
4587
4596
|
const row = db.query(`SELECT COUNT(*) as count FROM ${table}`).get();
|
|
@@ -4836,7 +4845,7 @@ function discoverMachineTopology(options = {}) {
|
|
|
4836
4845
|
const warnings = [];
|
|
4837
4846
|
const manifest = readManifest();
|
|
4838
4847
|
const heartbeats = listHeartbeats();
|
|
4839
|
-
const heartbeatByMachine =
|
|
4848
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
4840
4849
|
const localMachineId = getLocalMachineId();
|
|
4841
4850
|
const peers = options.includeTailscale === false ? new Map : loadTailscalePeers(runner, warnings);
|
|
4842
4851
|
const machineIds = new Set([
|
|
@@ -7383,7 +7392,7 @@ function parseJsonObject2(value) {
|
|
|
7383
7392
|
function getStatus() {
|
|
7384
7393
|
const manifest = readManifest();
|
|
7385
7394
|
const heartbeats = listHeartbeats();
|
|
7386
|
-
const heartbeatByMachine =
|
|
7395
|
+
const heartbeatByMachine = latestHeartbeatByMachine(heartbeats);
|
|
7387
7396
|
const machineIds = new Set([
|
|
7388
7397
|
...manifest.machines.map((machine) => machine.id),
|
|
7389
7398
|
...heartbeats.map((heartbeat) => heartbeat.machine_id)
|
package/dist/storage.js
CHANGED
|
@@ -248,6 +248,15 @@ function listHeartbeats(machineId) {
|
|
|
248
248
|
FROM agent_heartbeats
|
|
249
249
|
ORDER BY updated_at DESC`).all();
|
|
250
250
|
}
|
|
251
|
+
function latestHeartbeatByMachine(heartbeats) {
|
|
252
|
+
const byMachine = new Map;
|
|
253
|
+
for (const heartbeat of heartbeats) {
|
|
254
|
+
if (!byMachine.has(heartbeat.machine_id)) {
|
|
255
|
+
byMachine.set(heartbeat.machine_id, heartbeat);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return byMachine;
|
|
259
|
+
}
|
|
251
260
|
function countRuns(table) {
|
|
252
261
|
const db = getDb();
|
|
253
262
|
const row = db.query(`SELECT COUNT(*) as count FROM ${table}`).get();
|