@hasna/machines 0.0.16 → 0.0.18
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 +17 -5
- package/dist/cli/index.js +400 -227
- package/dist/commands/ssh.d.ts +6 -3
- package/dist/commands/ssh.d.ts.map +1 -1
- package/dist/compatibility.d.ts +4 -0
- package/dist/compatibility.d.ts.map +1 -1
- package/dist/consumer.d.ts +10 -0
- package/dist/consumer.d.ts.map +1 -0
- package/dist/consumer.js +4986 -0
- package/dist/index.js +235 -73
- package/dist/mcp/index.js +383 -227
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/remote.d.ts.map +1 -1
- package/dist/topology.d.ts +45 -1
- package/dist/topology.d.ts.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -50,13 +50,15 @@ machines self-test
|
|
|
50
50
|
## Topology SDK
|
|
51
51
|
|
|
52
52
|
`@hasna/machines` exposes a compact topology SDK for other open-core packages
|
|
53
|
-
that need machine identity without importing CLI internals
|
|
53
|
+
that need machine identity without importing CLI internals. Consumers that only
|
|
54
|
+
need the stable app-to-app contract should import `@hasna/machines/consumer`:
|
|
54
55
|
|
|
55
56
|
```ts
|
|
56
|
-
import { discoverMachineTopology, getLocalMachineTopology } from "@hasna/machines";
|
|
57
|
+
import { discoverMachineTopology, getLocalMachineTopology, resolveMachineRoute } from "@hasna/machines/consumer";
|
|
57
58
|
|
|
58
59
|
const topology = discoverMachineTopology();
|
|
59
60
|
const local = getLocalMachineTopology();
|
|
61
|
+
const route = resolveMachineRoute("spark01");
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
The SDK merges manifest entries, local heartbeats, SSH route hints, and
|
|
@@ -65,11 +67,16 @@ The SDK merges manifest entries, local heartbeats, SSH route hints, and
|
|
|
65
67
|
when present, and fall back to local probes or app-local machine registries when
|
|
66
68
|
it is absent.
|
|
67
69
|
|
|
70
|
+
Topology, route, and compatibility JSON include `schema_version`, package
|
|
71
|
+
version metadata, and capability flags. The current consumer contract version is
|
|
72
|
+
`1`.
|
|
73
|
+
|
|
68
74
|
CLI and MCP expose the same topology view:
|
|
69
75
|
|
|
70
76
|
```bash
|
|
71
77
|
machines topology --json
|
|
72
78
|
machines topology --no-tailscale --json
|
|
79
|
+
machines route --machine spark01 --json
|
|
73
80
|
```
|
|
74
81
|
|
|
75
82
|
## Compatibility SDK
|
|
@@ -78,13 +85,18 @@ Open-core consumers can use `@hasna/machines` to preflight a peer before
|
|
|
78
85
|
attempting app-level sync:
|
|
79
86
|
|
|
80
87
|
```ts
|
|
81
|
-
import { checkMachineCompatibility } from "@hasna/machines";
|
|
88
|
+
import { checkMachineCompatibility } from "@hasna/machines/consumer";
|
|
82
89
|
|
|
83
90
|
const report = checkMachineCompatibility({
|
|
84
91
|
machineId: "spark01",
|
|
85
92
|
commands: [{ command: "bun" }],
|
|
86
93
|
packages: [{ name: "@hasna/knowledge", command: "knowledge", expectedVersion: "0.2.29" }],
|
|
87
|
-
workspaces: [{
|
|
94
|
+
workspaces: [{
|
|
95
|
+
label: "open-knowledge",
|
|
96
|
+
path: "/home/hasna/workspace/hasna/opensource/open-knowledge",
|
|
97
|
+
expectedPackageName: "@hasna/knowledge",
|
|
98
|
+
expectedVersion: "0.2.29",
|
|
99
|
+
}],
|
|
88
100
|
});
|
|
89
101
|
```
|
|
90
102
|
|
|
@@ -99,7 +111,7 @@ CLI and MCP expose the same shape:
|
|
|
99
111
|
machines compatibility --machine spark01 \
|
|
100
112
|
--command bun \
|
|
101
113
|
--package @hasna/knowledge:knowledge:0.2.29 \
|
|
102
|
-
--workspace open-knowledge=/home/hasna/workspace/hasna/opensource/open-knowledge \
|
|
114
|
+
--workspace open-knowledge=/home/hasna/workspace/hasna/opensource/open-knowledge:@hasna/knowledge:0.2.29 \
|
|
103
115
|
--json
|
|
104
116
|
```
|
|
105
117
|
|