@hasna/machines 0.0.14 → 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/LICENSE +2 -1
- package/README.md +87 -0
- package/dist/cli/index.js +1697 -170
- 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 +1020 -185
- package/dist/mcp/http.d.ts +12 -0
- package/dist/mcp/http.d.ts.map +1 -0
- package/dist/mcp/index.js +925 -66
- 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/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 -2
package/LICENSE
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
Apache License
|
|
2
3
|
Version 2.0, January 2004
|
|
3
4
|
http://www.apache.org/licenses/
|
|
@@ -175,7 +176,7 @@
|
|
|
175
176
|
|
|
176
177
|
END OF TERMS AND CONDITIONS
|
|
177
178
|
|
|
178
|
-
Copyright 2026
|
|
179
|
+
Copyright 2026 Hasna, Inc.
|
|
179
180
|
|
|
180
181
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
182
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -8,6 +8,21 @@ Machine fleet management for developers — provision, sync, inspect, and operat
|
|
|
8
8
|
- `machines-mcp`: MCP server exposing fleet tools to AI agents
|
|
9
9
|
- `machines-agent`: lightweight local daemon for heartbeats and runtime reporting
|
|
10
10
|
|
|
11
|
+
## HTTP mode
|
|
12
|
+
|
|
13
|
+
Long-lived Streamable HTTP transport for shared agent connections (stdio remains the default):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
machines-mcp --http
|
|
17
|
+
# or: MCP_HTTP=1 machines-mcp
|
|
18
|
+
# default port: 8821 (override with --port or MCP_HTTP_PORT)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Endpoints on `127.0.0.1` only:
|
|
22
|
+
|
|
23
|
+
- `GET /health` → `{"status":"ok","name":"machines"}`
|
|
24
|
+
- `POST /mcp` → MCP Streamable HTTP
|
|
25
|
+
|
|
11
26
|
## Manifest
|
|
12
27
|
|
|
13
28
|
`machines.json` is the desired fleet declaration.
|
|
@@ -32,6 +47,78 @@ machines doctor --machine spark01
|
|
|
32
47
|
machines self-test
|
|
33
48
|
```
|
|
34
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
|
+
|
|
35
122
|
## Applications and tooling
|
|
36
123
|
|
|
37
124
|
```bash
|