@hasna/machines 0.0.13 → 0.0.15
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/README.md +72 -0
- package/dist/agent/index.js +84 -9579
- package/dist/cli/index.js +1235 -9784
- package/dist/compatibility.d.ts +55 -0
- package/dist/compatibility.d.ts.map +1 -0
- package/dist/db.d.ts +7 -2
- 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 +2486 -11147
- package/dist/mcp/index.js +971 -9713
- package/dist/mcp/server.d.ts +1 -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/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/package.json +8 -3
package/README.md
CHANGED
|
@@ -47,6 +47,78 @@ machines doctor --machine spark01
|
|
|
47
47
|
machines self-test
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
## Topology SDK
|
|
51
|
+
|
|
52
|
+
`@hasna/machines` exposes a compact topology SDK for other open-core packages
|
|
53
|
+
that need machine identity without importing CLI internals:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { discoverMachineTopology, getLocalMachineTopology } from "@hasna/machines";
|
|
57
|
+
|
|
58
|
+
const topology = discoverMachineTopology();
|
|
59
|
+
const local = getLocalMachineTopology();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The SDK merges manifest entries, local heartbeats, SSH route hints, and
|
|
63
|
+
`tailscale status --json` peers when Tailscale is available. Consumers such as
|
|
64
|
+
`@hasna/knowledge` should treat this package as optional: dynamically import it
|
|
65
|
+
when present, and fall back to local probes or app-local machine registries when
|
|
66
|
+
it is absent.
|
|
67
|
+
|
|
68
|
+
CLI and MCP expose the same topology view:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
machines topology --json
|
|
72
|
+
machines topology --no-tailscale --json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Compatibility SDK
|
|
76
|
+
|
|
77
|
+
Open-core consumers can use `@hasna/machines` to preflight a peer before
|
|
78
|
+
attempting app-level sync:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { checkMachineCompatibility } from "@hasna/machines";
|
|
82
|
+
|
|
83
|
+
const report = checkMachineCompatibility({
|
|
84
|
+
machineId: "spark01",
|
|
85
|
+
commands: [{ command: "bun" }],
|
|
86
|
+
packages: [{ name: "@hasna/knowledge", command: "knowledge", expectedVersion: "0.2.29" }],
|
|
87
|
+
workspaces: [{ label: "open-knowledge", path: "/home/hasna/workspace/hasna/opensource/open-knowledge" }],
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The compatibility report checks command availability, package-backed CLI
|
|
92
|
+
versions, workspace paths, and package metadata without printing secrets.
|
|
93
|
+
`knowledge` uses this as an optional preflight before machine sync, and falls
|
|
94
|
+
back to its own local checks if `@hasna/machines` is not installed.
|
|
95
|
+
|
|
96
|
+
CLI and MCP expose the same shape:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
machines compatibility --machine spark01 \
|
|
100
|
+
--command bun \
|
|
101
|
+
--package @hasna/knowledge:knowledge:0.2.29 \
|
|
102
|
+
--workspace open-knowledge=/home/hasna/workspace/hasna/opensource/open-knowledge \
|
|
103
|
+
--json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Storage
|
|
107
|
+
|
|
108
|
+
Machines stores runtime data locally in SQLite under the Hasna data directory and includes repo-owned PostgreSQL migrations for remote storage deployments.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
machines storage status --json
|
|
112
|
+
HASNA_MACHINES_DATABASE_URL=postgres://... machines storage push --tables agent_heartbeats --json
|
|
113
|
+
machines storage pull --json
|
|
114
|
+
machines storage sync --json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Configure database storage with `HASNA_MACHINES_DATABASE_URL` or fallback
|
|
118
|
+
`MACHINES_DATABASE_URL`. Optional storage mode env vars are
|
|
119
|
+
`HASNA_MACHINES_STORAGE_MODE` or `MACHINES_STORAGE_MODE` with `local`,
|
|
120
|
+
`hybrid`, or `remote`.
|
|
121
|
+
|
|
50
122
|
## Applications and tooling
|
|
51
123
|
|
|
52
124
|
```bash
|