proxmox-mcps 0.1.0
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/.env.example +60 -0
- package/.mcp.json.example +19 -0
- package/LICENSE +21 -0
- package/README.md +72 -0
- package/dist/cli/check-config.d.ts +3 -0
- package/dist/cli/check-config.d.ts.map +1 -0
- package/dist/cli/check-config.js +29 -0
- package/dist/cli/check-config.js.map +1 -0
- package/dist/cli/print-tools.d.ts +4 -0
- package/dist/cli/print-tools.d.ts.map +1 -0
- package/dist/cli/print-tools.js +45 -0
- package/dist/cli/print-tools.js.map +1 -0
- package/dist/config/env.d.ts +183 -0
- package/dist/config/env.d.ts.map +1 -0
- package/dist/config/env.js +149 -0
- package/dist/config/env.js.map +1 -0
- package/dist/config/index.d.ts +26 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +42 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +60 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +50 -0
- package/dist/config/types.js.map +1 -0
- package/dist/format/response.d.ts +40 -0
- package/dist/format/response.d.ts.map +1 -0
- package/dist/format/response.js +109 -0
- package/dist/format/response.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +200 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/sqlite-store.d.ts +34 -0
- package/dist/jobs/sqlite-store.d.ts.map +1 -0
- package/dist/jobs/sqlite-store.js +282 -0
- package/dist/jobs/sqlite-store.js.map +1 -0
- package/dist/jobs/store.d.ts +66 -0
- package/dist/jobs/store.d.ts.map +1 -0
- package/dist/jobs/store.js +101 -0
- package/dist/jobs/store.js.map +1 -0
- package/dist/log.d.ts +24 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +64 -0
- package/dist/log.js.map +1 -0
- package/dist/proxmox/auth.d.ts +30 -0
- package/dist/proxmox/auth.d.ts.map +1 -0
- package/dist/proxmox/auth.js +39 -0
- package/dist/proxmox/auth.js.map +1 -0
- package/dist/proxmox/client.d.ts +28 -0
- package/dist/proxmox/client.d.ts.map +1 -0
- package/dist/proxmox/client.js +192 -0
- package/dist/proxmox/client.js.map +1 -0
- package/dist/proxmox/errors.d.ts +51 -0
- package/dist/proxmox/errors.d.ts.map +1 -0
- package/dist/proxmox/errors.js +80 -0
- package/dist/proxmox/errors.js.map +1 -0
- package/dist/proxmox/paths.d.ts +126 -0
- package/dist/proxmox/paths.d.ts.map +1 -0
- package/dist/proxmox/paths.js +157 -0
- package/dist/proxmox/paths.js.map +1 -0
- package/dist/proxmox/types.d.ts +255 -0
- package/dist/proxmox/types.d.ts.map +1 -0
- package/dist/proxmox/types.js +9 -0
- package/dist/proxmox/types.js.map +1 -0
- package/dist/retry.d.ts +18 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +50 -0
- package/dist/retry.js.map +1 -0
- package/dist/safety/policy.d.ts +23 -0
- package/dist/safety/policy.d.ts.map +1 -0
- package/dist/safety/policy.js +81 -0
- package/dist/safety/policy.js.map +1 -0
- package/dist/safety/risk.d.ts +3 -0
- package/dist/safety/risk.d.ts.map +1 -0
- package/dist/safety/risk.js +234 -0
- package/dist/safety/risk.js.map +1 -0
- package/dist/security/url-guard.d.ts +22 -0
- package/dist/security/url-guard.d.ts.map +1 -0
- package/dist/security/url-guard.js +166 -0
- package/dist/security/url-guard.js.map +1 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +74 -0
- package/dist/server.js.map +1 -0
- package/dist/ssh/client.d.ts +32 -0
- package/dist/ssh/client.d.ts.map +1 -0
- package/dist/ssh/client.js +128 -0
- package/dist/ssh/client.js.map +1 -0
- package/dist/tools/backup-schedule.d.ts +10 -0
- package/dist/tools/backup-schedule.d.ts.map +1 -0
- package/dist/tools/backup-schedule.js +194 -0
- package/dist/tools/backup-schedule.js.map +1 -0
- package/dist/tools/backup.d.ts +7 -0
- package/dist/tools/backup.d.ts.map +1 -0
- package/dist/tools/backup.js +163 -0
- package/dist/tools/backup.js.map +1 -0
- package/dist/tools/cluster.d.ts +7 -0
- package/dist/tools/cluster.d.ts.map +1 -0
- package/dist/tools/cluster.js +20 -0
- package/dist/tools/cluster.js.map +1 -0
- package/dist/tools/container/config.d.ts +7 -0
- package/dist/tools/container/config.d.ts.map +1 -0
- package/dist/tools/container/config.js +97 -0
- package/dist/tools/container/config.js.map +1 -0
- package/dist/tools/container/console.d.ts +7 -0
- package/dist/tools/container/console.d.ts.map +1 -0
- package/dist/tools/container/console.js +65 -0
- package/dist/tools/container/console.js.map +1 -0
- package/dist/tools/container/crud.d.ts +7 -0
- package/dist/tools/container/crud.d.ts.map +1 -0
- package/dist/tools/container/crud.js +362 -0
- package/dist/tools/container/crud.js.map +1 -0
- package/dist/tools/container/diagnostics.d.ts +7 -0
- package/dist/tools/container/diagnostics.d.ts.map +1 -0
- package/dist/tools/container/diagnostics.js +115 -0
- package/dist/tools/container/diagnostics.js.map +1 -0
- package/dist/tools/container/migration.d.ts +7 -0
- package/dist/tools/container/migration.d.ts.map +1 -0
- package/dist/tools/container/migration.js +134 -0
- package/dist/tools/container/migration.js.map +1 -0
- package/dist/tools/context.d.ts +21 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +2 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/ha.d.ts +7 -0
- package/dist/tools/ha.d.ts.map +1 -0
- package/dist/tools/ha.js +241 -0
- package/dist/tools/ha.js.map +1 -0
- package/dist/tools/helpers.d.ts +15 -0
- package/dist/tools/helpers.d.ts.map +1 -0
- package/dist/tools/helpers.js +7 -0
- package/dist/tools/helpers.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +66 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/iso.d.ts +7 -0
- package/dist/tools/iso.d.ts.map +1 -0
- package/dist/tools/iso.js +131 -0
- package/dist/tools/iso.js.map +1 -0
- package/dist/tools/jobs.d.ts +11 -0
- package/dist/tools/jobs.d.ts.map +1 -0
- package/dist/tools/jobs.js +173 -0
- package/dist/tools/jobs.js.map +1 -0
- package/dist/tools/node-admin.d.ts +10 -0
- package/dist/tools/node-admin.d.ts.map +1 -0
- package/dist/tools/node-admin.js +361 -0
- package/dist/tools/node-admin.js.map +1 -0
- package/dist/tools/node-certs.d.ts +7 -0
- package/dist/tools/node-certs.d.ts.map +1 -0
- package/dist/tools/node-certs.js +36 -0
- package/dist/tools/node-certs.js.map +1 -0
- package/dist/tools/node-disks.d.ts +7 -0
- package/dist/tools/node-disks.d.ts.map +1 -0
- package/dist/tools/node-disks.js +100 -0
- package/dist/tools/node-disks.js.map +1 -0
- package/dist/tools/node-network.d.ts +7 -0
- package/dist/tools/node-network.d.ts.map +1 -0
- package/dist/tools/node-network.js +102 -0
- package/dist/tools/node-network.js.map +1 -0
- package/dist/tools/node-services.d.ts +7 -0
- package/dist/tools/node-services.d.ts.map +1 -0
- package/dist/tools/node-services.js +39 -0
- package/dist/tools/node-services.js.map +1 -0
- package/dist/tools/node.d.ts +7 -0
- package/dist/tools/node.d.ts.map +1 -0
- package/dist/tools/node.js +85 -0
- package/dist/tools/node.js.map +1 -0
- package/dist/tools/pools.d.ts +10 -0
- package/dist/tools/pools.d.ts.map +1 -0
- package/dist/tools/pools.js +111 -0
- package/dist/tools/pools.js.map +1 -0
- package/dist/tools/replication.d.ts +7 -0
- package/dist/tools/replication.d.ts.map +1 -0
- package/dist/tools/replication.js +116 -0
- package/dist/tools/replication.js.map +1 -0
- package/dist/tools/sdn.d.ts +7 -0
- package/dist/tools/sdn.d.ts.map +1 -0
- package/dist/tools/sdn.js +358 -0
- package/dist/tools/sdn.js.map +1 -0
- package/dist/tools/snapshot.d.ts +10 -0
- package/dist/tools/snapshot.d.ts.map +1 -0
- package/dist/tools/snapshot.js +115 -0
- package/dist/tools/snapshot.js.map +1 -0
- package/dist/tools/storage-admin.d.ts +9 -0
- package/dist/tools/storage-admin.d.ts.map +1 -0
- package/dist/tools/storage-admin.js +126 -0
- package/dist/tools/storage-admin.js.map +1 -0
- package/dist/tools/storage.d.ts +7 -0
- package/dist/tools/storage.d.ts.map +1 -0
- package/dist/tools/storage.js +20 -0
- package/dist/tools/storage.js.map +1 -0
- package/dist/tools/tasks.d.ts +11 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +85 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/vm/config.d.ts +28 -0
- package/dist/tools/vm/config.d.ts.map +1 -0
- package/dist/tools/vm/config.js +221 -0
- package/dist/tools/vm/config.js.map +1 -0
- package/dist/tools/vm/console.d.ts +9 -0
- package/dist/tools/vm/console.d.ts.map +1 -0
- package/dist/tools/vm/console.js +141 -0
- package/dist/tools/vm/console.js.map +1 -0
- package/dist/tools/vm/crud.d.ts +10 -0
- package/dist/tools/vm/crud.d.ts.map +1 -0
- package/dist/tools/vm/crud.js +333 -0
- package/dist/tools/vm/crud.js.map +1 -0
- package/dist/tools/vm/diagnostics.d.ts +10 -0
- package/dist/tools/vm/diagnostics.d.ts.map +1 -0
- package/dist/tools/vm/diagnostics.js +256 -0
- package/dist/tools/vm/diagnostics.js.map +1 -0
- package/dist/tools/vm/migration.d.ts +7 -0
- package/dist/tools/vm/migration.d.ts.map +1 -0
- package/dist/tools/vm/migration.js +131 -0
- package/dist/tools/vm/migration.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL path builders. Single source of truth for Proxmox API paths.
|
|
3
|
+
*
|
|
4
|
+
* Each function returns a string ready for the client to GET/POST/PUT/DELETE.
|
|
5
|
+
* Path parameters are typed to catch typos at compile time.
|
|
6
|
+
*/
|
|
7
|
+
// ---- Cluster & nodes -----------------------------------------------------
|
|
8
|
+
export const clusterStatus = () => "/cluster/status";
|
|
9
|
+
export const clusterResources = (type) => type ? `/cluster/resources?type=${type}` : "/cluster/resources";
|
|
10
|
+
export const nodes = () => "/nodes";
|
|
11
|
+
export const nodeStatus = (node) => `/nodes/${node}/status`;
|
|
12
|
+
export const nodeSyslog = (node, limit) => {
|
|
13
|
+
const q = limit ? `?limit=${limit}` : "";
|
|
14
|
+
return `/nodes/${node}/syslog${q}`;
|
|
15
|
+
};
|
|
16
|
+
export const nodeJournal = (node, limit) => {
|
|
17
|
+
const q = limit ? `?limit=${limit}` : "";
|
|
18
|
+
return `/nodes/${node}/journal${q}`;
|
|
19
|
+
};
|
|
20
|
+
// ---- Storage -------------------------------------------------------------
|
|
21
|
+
export const storage = () => "/storage";
|
|
22
|
+
export const nodeStorageStatus = (node, storage) => `/nodes/${node}/storage/${storage}/status`;
|
|
23
|
+
export const nodeStorageContent = (node, storage, content) => `/nodes/${node}/storage/${storage}/content?content=${content}`;
|
|
24
|
+
export const storageDownloadUrl = (node, storage) => `/nodes/${node}/storage/${storage}/download-url`;
|
|
25
|
+
export const storageContent = (node, storage, volume) => `/nodes/${node}/storage/${storage}/content/${volume}`;
|
|
26
|
+
export const pruneBackups = (storage) => `/storage/${storage}/prune-backups`;
|
|
27
|
+
// ---- VM (QEMU) -----------------------------------------------------------
|
|
28
|
+
export const qemu = (node) => `/nodes/${node}/qemu`;
|
|
29
|
+
export const qemuVm = (node, vmid) => `/nodes/${node}/qemu/${vmid}`;
|
|
30
|
+
export const qemuConfig = (node, vmid) => `/nodes/${node}/qemu/${vmid}/config`;
|
|
31
|
+
export const qemuPending = (node, vmid) => `/nodes/${node}/qemu/${vmid}/pending`;
|
|
32
|
+
export const qemuStatus = (node, vmid, action) => `/nodes/${node}/qemu/${vmid}/status/${action}`;
|
|
33
|
+
export const qemuClone = (node, vmid) => `/nodes/${node}/qemu/${vmid}/clone`;
|
|
34
|
+
export const qemuResize = (node, vmid, disk) => `/nodes/${node}/qemu/${vmid}/resize?disk=${encodeURIComponent(disk)}`;
|
|
35
|
+
export const qemuMoveDisk = (node, vmid, disk) => `/nodes/${node}/qemu/${vmid}/move-disk?disk=${encodeURIComponent(disk)}`;
|
|
36
|
+
export const qemuUnlink = (node, vmid, disk) => `/nodes/${node}/qemu/${vmid}/unlink?disk=${encodeURIComponent(disk)}`;
|
|
37
|
+
export const qemuMigrate = (node, vmid) => `/nodes/${node}/qemu/${vmid}/migrate`;
|
|
38
|
+
export const qemuTemplate = (node, vmid) => `/nodes/${node}/qemu/${vmid}/template`;
|
|
39
|
+
export const qemuRrd = (node, vmid, timeframe) => `/nodes/${node}/qemu/${vmid}/rrd?timeframe=${timeframe}`;
|
|
40
|
+
export const qemuRrdData = (node, vmid, timeframe) => `/nodes/${node}/qemu/${vmid}/rrddata?timeframe=${timeframe}`;
|
|
41
|
+
// VM console
|
|
42
|
+
export const qemuVncProxy = (node, vmid) => `/nodes/${node}/qemu/${vmid}/vncproxy`;
|
|
43
|
+
export const qemuTermProxy = (node, vmid) => `/nodes/${node}/qemu/${vmid}/termproxy`;
|
|
44
|
+
export const qemuSpiceProxy = (node, vmid) => `/nodes/${node}/qemu/${vmid}/spiceproxy`;
|
|
45
|
+
export const qemuMtunnel = (node, vmid) => `/nodes/${node}/qemu/${vmid}/mtunnel`;
|
|
46
|
+
export const qemuMtunnelWebsocket = (node, vmid) => `/nodes/${node}/qemu/${vmid}/mtunnelwebsocket`;
|
|
47
|
+
export const qemuFeature = (node, vmid) => `/nodes/${node}/qemu/${vmid}/feature`;
|
|
48
|
+
export const qemuMonitor = (node, vmid) => `/nodes/${node}/qemu/${vmid}/monitor`;
|
|
49
|
+
export const qemuSendkey = (node, vmid) => `/nodes/${node}/qemu/${vmid}/sendkey`;
|
|
50
|
+
// VM agent
|
|
51
|
+
export const qemuAgent = (node, vmid, action) => `/nodes/${node}/qemu/${vmid}/agent/${action}`;
|
|
52
|
+
export const qemuAgentExec = (node, vmid) => `/nodes/${node}/qemu/${vmid}/agent/exec`;
|
|
53
|
+
export const qemuAgentExecStatus = (node, vmid, pid) => `/nodes/${node}/qemu/${vmid}/agent/exec-status?pid=${pid}`;
|
|
54
|
+
// VM firewall
|
|
55
|
+
export const qemuFirewallRules = (node, vmid) => `/nodes/${node}/qemu/${vmid}/firewall/rules`;
|
|
56
|
+
export const qemuFirewallOptions = (node, vmid) => `/nodes/${node}/qemu/${vmid}/firewall/options`;
|
|
57
|
+
export const qemuCloudinit = (node, vmid) => `/nodes/${node}/qemu/${vmid}/cloudinit`;
|
|
58
|
+
// ---- LXC (Container) -----------------------------------------------------
|
|
59
|
+
export const lxc = (node) => `/nodes/${node}/lxc`;
|
|
60
|
+
export const lxcCt = (node, vmid) => `/nodes/${node}/lxc/${vmid}`;
|
|
61
|
+
export const lxcConfig = (node, vmid) => `/nodes/${node}/lxc/${vmid}/config`;
|
|
62
|
+
export const lxcPending = (node, vmid) => `/nodes/${node}/lxc/${vmid}/pending`;
|
|
63
|
+
export const lxcStatus = (node, vmid, action) => `/nodes/${node}/lxc/${vmid}/status/${action}`;
|
|
64
|
+
export const lxcClone = (node, vmid) => `/nodes/${node}/lxc/${vmid}/clone`;
|
|
65
|
+
export const lxcResize = (node, vmid, disk) => `/nodes/${node}/lxc/${vmid}/resize?disk=${encodeURIComponent(disk)}`;
|
|
66
|
+
export const lxcMoveDisk = (node, vmid, disk) => `/nodes/${node}/lxc/${vmid}/move-disk?disk=${encodeURIComponent(disk)}`;
|
|
67
|
+
export const lxcMoveVolume = (node, vmid, volume) => `/nodes/${node}/lxc/${vmid}/move-volume?volume=${encodeURIComponent(volume)}`;
|
|
68
|
+
export const lxcUnlink = (node, vmid, volume) => `/nodes/${node}/lxc/${vmid}/unlink?volume=${encodeURIComponent(volume)}`;
|
|
69
|
+
export const lxcMigrate = (node, vmid) => `/nodes/${node}/lxc/${vmid}/migrate`;
|
|
70
|
+
export const lxcTemplate = (node, vmid) => `/nodes/${node}/lxc/${vmid}/template`;
|
|
71
|
+
export const lxcRrd = (node, vmid, timeframe) => `/nodes/${node}/lxc/${vmid}/rrd?timeframe=${timeframe}`;
|
|
72
|
+
export const lxcRrdData = (node, vmid, timeframe) => `/nodes/${node}/lxc/${vmid}/rrddata?timeframe=${timeframe}`;
|
|
73
|
+
export const lxcInterfaces = (node, vmid) => `/nodes/${node}/lxc/${vmid}/interfaces`;
|
|
74
|
+
// LXC console
|
|
75
|
+
export const lxcVncProxy = (node, vmid) => `/nodes/${node}/lxc/${vmid}/vncproxy`;
|
|
76
|
+
export const lxcTermProxy = (node, vmid) => `/nodes/${node}/lxc/${vmid}/termproxy`;
|
|
77
|
+
export const lxcSpiceProxy = (node, vmid) => `/nodes/${node}/lxc/${vmid}/spiceproxy`;
|
|
78
|
+
// LXC firewall
|
|
79
|
+
export const lxcFirewallRules = (node, vmid) => `/nodes/${node}/lxc/${vmid}/firewall/rules`;
|
|
80
|
+
export const lxcFirewallOptions = (node, vmid) => `/nodes/${node}/lxc/${vmid}/firewall/options`;
|
|
81
|
+
// ---- Snapshots & backups --------------------------------------------------
|
|
82
|
+
export const snapshotList = (node, type, vmid) => `/nodes/${node}/${type}/${vmid}/snapshot`;
|
|
83
|
+
export const snapshotCreate = (node, type, vmid) => `/nodes/${node}/${type}/${vmid}/snapshot`;
|
|
84
|
+
export const snapshotDelete = (node, type, vmid, snapname) => `/nodes/${node}/${type}/${vmid}/snapshot/${encodeURIComponent(snapname)}`;
|
|
85
|
+
export const snapshotRollback = (node, type, vmid, snapname) => `/nodes/${node}/${type}/${vmid}/snapshot/${encodeURIComponent(snapname)}/rollback`;
|
|
86
|
+
export const vzdump = (node) => `/nodes/${node}/vzdump`;
|
|
87
|
+
// ---- Tasks (UPIDs) -------------------------------------------------------
|
|
88
|
+
export const taskStatus = (node, upid) => `/nodes/${node}/tasks/${encodeURIComponent(upid)}/status`;
|
|
89
|
+
export const taskLog = (node, upid, limit) => {
|
|
90
|
+
const q = limit ? `?limit=${limit}` : "";
|
|
91
|
+
return `/nodes/${node}/tasks/${encodeURIComponent(upid)}/log${q}`;
|
|
92
|
+
};
|
|
93
|
+
export const taskStop = (node, upid) => `/nodes/${node}/tasks/${encodeURIComponent(upid)}/status/stop`;
|
|
94
|
+
export const clusterTasks = () => "/cluster/tasks";
|
|
95
|
+
// ---- Pools ----------------------------------------------------------------
|
|
96
|
+
export const pools = () => "/pools";
|
|
97
|
+
export const pool = (poolid) => `/pools/${encodeURIComponent(poolid)}`;
|
|
98
|
+
// ---- Cluster HA -----------------------------------------------------------
|
|
99
|
+
export const haResources = () => "/cluster/ha";
|
|
100
|
+
export const haResource = (sid) => `/cluster/ha/${encodeURIComponent(sid)}`;
|
|
101
|
+
export const haResourceStatus = (sid) => `/cluster/ha/${encodeURIComponent(sid)}/status`;
|
|
102
|
+
export const haGroups = () => "/cluster/ha/groups";
|
|
103
|
+
export const haGroup = (group) => `/cluster/ha/groups/${encodeURIComponent(group)}`;
|
|
104
|
+
export const haStatus = () => "/cluster/ha/status";
|
|
105
|
+
// ---- Cluster Backup Schedule ----------------------------------------------
|
|
106
|
+
export const backupJobs = () => "/cluster/backup";
|
|
107
|
+
export const backupJob = (id) => `/cluster/backup/${encodeURIComponent(id)}`;
|
|
108
|
+
export const runBackupJob = (id) => `/cluster/backup/${encodeURIComponent(id)}/run`;
|
|
109
|
+
export const backupJobIncluded = (id) => `/cluster/backup/${encodeURIComponent(id)}/included`;
|
|
110
|
+
// ---- Cluster Replication --------------------------------------------------
|
|
111
|
+
export const replication = () => "/cluster/replication";
|
|
112
|
+
export const replicationJob = (id) => `/cluster/replication/${encodeURIComponent(id)}`;
|
|
113
|
+
export const replicationStatus = (id) => `/cluster/replication/${encodeURIComponent(id)}/status`;
|
|
114
|
+
export const nodeReplication = (node) => `/nodes/${node}/replication`;
|
|
115
|
+
// ---- Cluster SDN ----------------------------------------------------------
|
|
116
|
+
export const sdnControllers = () => "/cluster/sdn/controllers";
|
|
117
|
+
export const sdnController = (name) => `/cluster/sdn/controllers/${encodeURIComponent(name)}`;
|
|
118
|
+
export const sdnVnets = () => "/cluster/sdn/vnets";
|
|
119
|
+
export const sdnVnet = (name) => `/cluster/sdn/vnets/${encodeURIComponent(name)}`;
|
|
120
|
+
export const sdnZones = () => "/cluster/sdn/zones";
|
|
121
|
+
export const sdnZone = (name) => `/cluster/sdn/zones/${encodeURIComponent(name)}`;
|
|
122
|
+
export const sdnSubnets = (vnet) => `/cluster/sdn/vnets/${encodeURIComponent(vnet)}/subnets`;
|
|
123
|
+
export const sdnSubnet = (vnet, subnet) => `/cluster/sdn/vnets/${encodeURIComponent(vnet)}/subnets/${encodeURIComponent(subnet)}`;
|
|
124
|
+
// ---- Node admin (Phase 2C) ------------------------------------------------
|
|
125
|
+
export const nodeAptUpdate = (node) => `/nodes/${node}/apt/update`;
|
|
126
|
+
export const nodeAptRepos = (node) => `/nodes/${node}/repositories`;
|
|
127
|
+
export const nodeAptVersions = (node) => `/nodes/${node}/apt/versions`;
|
|
128
|
+
export const nodeDns = (node) => `/nodes/${node}/dns`;
|
|
129
|
+
export const nodeHosts = (node) => `/nodes/${node}/hosts`;
|
|
130
|
+
export const nodeTime = (node) => `/nodes/${node}/time`;
|
|
131
|
+
export const nodeTimezone = (node) => `/nodes/${node}/time/timezone`;
|
|
132
|
+
export const nodeConfig = (node) => `/nodes/${node}/config`;
|
|
133
|
+
export const nodeReport = (node) => `/nodes/${node}/report`;
|
|
134
|
+
export const nodeStartAll = (node) => `/nodes/${node}/startall`;
|
|
135
|
+
export const nodeStopAll = (node) => `/nodes/${node}/stopall`;
|
|
136
|
+
export const nodeMigrateAll = (node) => `/nodes/${node}/migrateall`;
|
|
137
|
+
export const nodeWakeOnLan = (node) => `/nodes/${node}/wakeonlan`;
|
|
138
|
+
export const nodeSubscription = (node) => `/nodes/${node}/subscription`;
|
|
139
|
+
// Node services
|
|
140
|
+
export const nodeServices = (node) => `/nodes/${node}/services`;
|
|
141
|
+
export const nodeService = (node, service) => `/nodes/${node}/services/${encodeURIComponent(service)}`;
|
|
142
|
+
// Node network
|
|
143
|
+
export const nodeNetwork = (node) => `/nodes/${node}/network`;
|
|
144
|
+
export const nodeIface = (node, iface) => `/nodes/${node}/network/${encodeURIComponent(iface)}`;
|
|
145
|
+
// Node disks
|
|
146
|
+
export const nodeDisks = (node) => `/nodes/${node}/disks`;
|
|
147
|
+
export const nodeDisksList = (node) => `/nodes/${node}/disks/list`;
|
|
148
|
+
export const nodeDiskInit = (node, disk) => `/nodes/${node}/disks/init?disk=${encodeURIComponent(disk)}`;
|
|
149
|
+
export const nodeDiskWipe = (node, disk) => `/nodes/${node}/disks/wipedisk?disk=${encodeURIComponent(disk)}`;
|
|
150
|
+
export const nodeDiskZfs = (node) => `/nodes/${node}/disks/zfs`;
|
|
151
|
+
export const nodeDiskZfsCreate = (node) => `/nodes/${node}/disks/zfs`;
|
|
152
|
+
// Node certificates
|
|
153
|
+
export const nodeCert = (node) => `/nodes/${node}/certificates`;
|
|
154
|
+
// Storage admin (Phase 2D)
|
|
155
|
+
export const storageCreate = () => "/storage";
|
|
156
|
+
export const storageUpdate = (storage) => `/storage/${encodeURIComponent(storage)}`;
|
|
157
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/proxmox/paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6EAA6E;AAE7E,MAAM,CAAC,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,iBAAiB,CAAC;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAgC,EAAU,EAAE,CAC3E,IAAI,CAAC,CAAC,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC;AAClE,MAAM,CAAC,MAAM,KAAK,GAAG,GAAW,EAAE,CAAC,QAAQ,CAAC;AAC5C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,UAAU,IAAI,SAAS,CAAC;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,KAAc,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AAI,eAAe,CAAC;AAEhF,2BAA2B;AAC3B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,UAAU,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,YAAY,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response shapes returned by Proxmox API.
|
|
3
|
+
*
|
|
4
|
+
* Proxmox wraps every successful response in `{ data: ... }`. The actual
|
|
5
|
+
* content varies wildly per endpoint, so we keep these types loose (`unknown`
|
|
6
|
+
* for the body) and let tools narrow as needed.
|
|
7
|
+
*/
|
|
8
|
+
/** Standard Proxmox API envelope. */
|
|
9
|
+
export interface ProxmoxResponse<T = unknown> {
|
|
10
|
+
data: T;
|
|
11
|
+
}
|
|
12
|
+
/** Error envelope: errors keyed by form field. */
|
|
13
|
+
export interface ProxmoxErrorResponse {
|
|
14
|
+
errors?: Record<string, string>;
|
|
15
|
+
data?: unknown;
|
|
16
|
+
message?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ClusterNodeInfo {
|
|
19
|
+
type: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
ip?: string;
|
|
23
|
+
level?: string;
|
|
24
|
+
local?: boolean;
|
|
25
|
+
nodeid?: number;
|
|
26
|
+
online?: boolean;
|
|
27
|
+
quorate?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ClusterStatus {
|
|
30
|
+
name?: string;
|
|
31
|
+
quorate?: number;
|
|
32
|
+
id?: string;
|
|
33
|
+
version?: number;
|
|
34
|
+
nodes?: ClusterNodeInfo[];
|
|
35
|
+
}
|
|
36
|
+
export interface NodeStatus {
|
|
37
|
+
node: string;
|
|
38
|
+
status: "online" | "offline" | "unknown";
|
|
39
|
+
cpu?: number;
|
|
40
|
+
level?: string;
|
|
41
|
+
maxcpu?: number;
|
|
42
|
+
mem?: number;
|
|
43
|
+
maxmem?: number;
|
|
44
|
+
uptime?: number;
|
|
45
|
+
id?: string;
|
|
46
|
+
ip?: string;
|
|
47
|
+
storage?: number;
|
|
48
|
+
maxstorage?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ResourceListItem {
|
|
51
|
+
id: string;
|
|
52
|
+
type: "vm" | "node" | "storage" | "pool" | "sdn";
|
|
53
|
+
node?: string;
|
|
54
|
+
vmid?: number;
|
|
55
|
+
name?: string;
|
|
56
|
+
status?: string;
|
|
57
|
+
template?: number;
|
|
58
|
+
cpu?: number;
|
|
59
|
+
cpus?: number;
|
|
60
|
+
mem?: number;
|
|
61
|
+
maxmem?: number;
|
|
62
|
+
disk?: number;
|
|
63
|
+
maxdisk?: number;
|
|
64
|
+
uptime?: number;
|
|
65
|
+
pool?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface VmConfig {
|
|
68
|
+
name?: string;
|
|
69
|
+
cores?: number;
|
|
70
|
+
sockets?: number;
|
|
71
|
+
memory?: number;
|
|
72
|
+
ostype?: string;
|
|
73
|
+
scsi0?: string;
|
|
74
|
+
scsihw?: string;
|
|
75
|
+
net0?: string;
|
|
76
|
+
boot?: string;
|
|
77
|
+
cpu?: string;
|
|
78
|
+
bios?: string;
|
|
79
|
+
machine?: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
template?: number;
|
|
82
|
+
agent?: string;
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
export interface VmStatus {
|
|
86
|
+
status: "running" | "stopped" | "paused";
|
|
87
|
+
vmid: number;
|
|
88
|
+
name?: string;
|
|
89
|
+
cpu?: number;
|
|
90
|
+
cpus?: number;
|
|
91
|
+
mem?: number;
|
|
92
|
+
maxmem?: number;
|
|
93
|
+
disk?: number;
|
|
94
|
+
maxdisk?: number;
|
|
95
|
+
uptime?: number;
|
|
96
|
+
template?: number;
|
|
97
|
+
pid?: number;
|
|
98
|
+
qmpstatus?: string;
|
|
99
|
+
running_machine?: string;
|
|
100
|
+
running_qemu?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface VmAgentExecResult {
|
|
103
|
+
pid: number;
|
|
104
|
+
exited?: number;
|
|
105
|
+
exitcode?: number;
|
|
106
|
+
signal?: number;
|
|
107
|
+
outData?: string;
|
|
108
|
+
errData?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface VmRrdPoint {
|
|
111
|
+
time: number;
|
|
112
|
+
cpu?: number;
|
|
113
|
+
mem?: number;
|
|
114
|
+
netin?: number;
|
|
115
|
+
netout?: number;
|
|
116
|
+
diskread?: number;
|
|
117
|
+
diskwrite?: number;
|
|
118
|
+
[key: string]: number | undefined;
|
|
119
|
+
}
|
|
120
|
+
export interface VncTicket {
|
|
121
|
+
port: number;
|
|
122
|
+
ticket: string;
|
|
123
|
+
cert?: string;
|
|
124
|
+
upid?: string;
|
|
125
|
+
}
|
|
126
|
+
export interface SpiceTicket extends VncTicket {
|
|
127
|
+
type: "spice";
|
|
128
|
+
}
|
|
129
|
+
export interface LxcConfig {
|
|
130
|
+
hostname?: string;
|
|
131
|
+
cores?: number;
|
|
132
|
+
memory?: number;
|
|
133
|
+
swap?: number;
|
|
134
|
+
rootfs?: string;
|
|
135
|
+
net0?: string;
|
|
136
|
+
ostype?: string;
|
|
137
|
+
arch?: string;
|
|
138
|
+
features?: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
template?: number;
|
|
141
|
+
onboot?: number;
|
|
142
|
+
unprivileged?: number;
|
|
143
|
+
[key: string]: unknown;
|
|
144
|
+
}
|
|
145
|
+
export interface LxcStatus {
|
|
146
|
+
status: "running" | "stopped";
|
|
147
|
+
vmid: number;
|
|
148
|
+
name?: string;
|
|
149
|
+
cpu?: number;
|
|
150
|
+
cpus?: number;
|
|
151
|
+
mem?: number;
|
|
152
|
+
maxmem?: number;
|
|
153
|
+
swap?: number;
|
|
154
|
+
maxswap?: number;
|
|
155
|
+
disk?: number;
|
|
156
|
+
maxdisk?: number;
|
|
157
|
+
uptime?: number;
|
|
158
|
+
template?: number;
|
|
159
|
+
pid?: number;
|
|
160
|
+
}
|
|
161
|
+
export interface LxcInterface {
|
|
162
|
+
name: string;
|
|
163
|
+
ip_addresses?: Array<{
|
|
164
|
+
ip_address: string;
|
|
165
|
+
prefix: number;
|
|
166
|
+
family: string;
|
|
167
|
+
}>;
|
|
168
|
+
mac_address?: string;
|
|
169
|
+
stats?: Record<string, number>;
|
|
170
|
+
}
|
|
171
|
+
export interface SnapshotInfo {
|
|
172
|
+
name: string;
|
|
173
|
+
description?: string;
|
|
174
|
+
snaptime?: number;
|
|
175
|
+
parent?: string;
|
|
176
|
+
vmstate?: number;
|
|
177
|
+
[key: string]: unknown;
|
|
178
|
+
}
|
|
179
|
+
export interface BackupEntry {
|
|
180
|
+
volid: string;
|
|
181
|
+
format: string;
|
|
182
|
+
size: number;
|
|
183
|
+
ctime: number;
|
|
184
|
+
vmid?: number;
|
|
185
|
+
notes?: string;
|
|
186
|
+
protected?: boolean;
|
|
187
|
+
[key: string]: unknown;
|
|
188
|
+
}
|
|
189
|
+
export interface IsoEntry {
|
|
190
|
+
volid: string;
|
|
191
|
+
format: string;
|
|
192
|
+
size: number;
|
|
193
|
+
ctime: number;
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
196
|
+
export interface TemplateEntry {
|
|
197
|
+
volid: string;
|
|
198
|
+
format: string;
|
|
199
|
+
size: number;
|
|
200
|
+
ctime: number;
|
|
201
|
+
[key: string]: unknown;
|
|
202
|
+
}
|
|
203
|
+
export interface TaskStatus {
|
|
204
|
+
upid: string;
|
|
205
|
+
node: string;
|
|
206
|
+
pid: number;
|
|
207
|
+
pstart: number;
|
|
208
|
+
starttime: number;
|
|
209
|
+
type: string;
|
|
210
|
+
user: string;
|
|
211
|
+
status: "running" | "stopped" | "OK" | "WARNINGS" | "ERROR" | "unknown";
|
|
212
|
+
exitstatus?: string;
|
|
213
|
+
endtime?: number;
|
|
214
|
+
}
|
|
215
|
+
export interface TaskLogLine {
|
|
216
|
+
n: number;
|
|
217
|
+
t: string;
|
|
218
|
+
}
|
|
219
|
+
export interface StorageInfo {
|
|
220
|
+
storage: string;
|
|
221
|
+
type: string;
|
|
222
|
+
content?: string;
|
|
223
|
+
path?: string;
|
|
224
|
+
shared?: number;
|
|
225
|
+
total?: number;
|
|
226
|
+
used?: number;
|
|
227
|
+
available?: number;
|
|
228
|
+
active?: number;
|
|
229
|
+
enabled?: number;
|
|
230
|
+
}
|
|
231
|
+
export interface FirewallRule {
|
|
232
|
+
pos: number;
|
|
233
|
+
type: "in" | "out" | "group";
|
|
234
|
+
action: "ACCEPT" | "DROP" | "REJECT";
|
|
235
|
+
enable?: number;
|
|
236
|
+
source?: string;
|
|
237
|
+
dest?: string;
|
|
238
|
+
proto?: string;
|
|
239
|
+
dport?: string;
|
|
240
|
+
sport?: string;
|
|
241
|
+
comment?: string;
|
|
242
|
+
[key: string]: unknown;
|
|
243
|
+
}
|
|
244
|
+
export interface FirewallOptions {
|
|
245
|
+
enable?: number;
|
|
246
|
+
dhcp?: number;
|
|
247
|
+
ndp?: number;
|
|
248
|
+
macfilter?: number;
|
|
249
|
+
ipfilter?: number;
|
|
250
|
+
radv?: number;
|
|
251
|
+
log_level_in?: string;
|
|
252
|
+
log_level_out?: string;
|
|
253
|
+
[key: string]: unknown;
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/proxmox/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qCAAqC;AACrC,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,IAAI,EAAE,CAAC,CAAC;CACT;AAED,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;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AAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response shapes returned by Proxmox API.
|
|
3
|
+
*
|
|
4
|
+
* Proxmox wraps every successful response in `{ data: ... }`. The actual
|
|
5
|
+
* content varies wildly per endpoint, so we keep these types loose (`unknown`
|
|
6
|
+
* for the body) and let tools narrow as needed.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/proxmox/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/dist/retry.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface RetryConfig {
|
|
2
|
+
max: number;
|
|
3
|
+
baseMs: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const DEFAULT_RETRY: RetryConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Predicate: should this error be retried?
|
|
8
|
+
*
|
|
9
|
+
* Default: only network errors and HTTP 5xx/429 are retried. 4xx (other than
|
|
10
|
+
* 429) is treated as a permanent failure (bad request, not found, etc.).
|
|
11
|
+
*/
|
|
12
|
+
export type ShouldRetry = (err: unknown) => boolean;
|
|
13
|
+
export declare function defaultShouldRetry(err: unknown): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Run `fn` with retry. Honors Retry-After hint on 429/503 when available.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withRetry<T>(fn: () => Promise<T>, cfg?: RetryConfig, shouldRetry?: ShouldRetry, onFailedAttempt?: (err: unknown, attempt: number) => void): Promise<T>;
|
|
18
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,WAAqC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;AAEpD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAexD;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,GAAG,GAAE,WAA2B,EAChC,WAAW,GAAE,WAAgC,EAC7C,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GACxD,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
|
package/dist/retry.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry wrapper using p-retry with exponential backoff + jitter.
|
|
3
|
+
*
|
|
4
|
+
* Only retries on transient errors (network, 5xx, 429). 4xx errors bubble up
|
|
5
|
+
* immediately so the caller gets a fast-fail for bad requests.
|
|
6
|
+
*/
|
|
7
|
+
import pRetry from "p-retry";
|
|
8
|
+
export const DEFAULT_RETRY = { max: 3, baseMs: 200 };
|
|
9
|
+
export function defaultShouldRetry(err) {
|
|
10
|
+
// Network / DNS / socket-level errors usually surface as plain Error with no
|
|
11
|
+
// .status; let p-retry treat those as transient.
|
|
12
|
+
if (err instanceof Error) {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
const status = err.status;
|
|
15
|
+
if (typeof status === "number") {
|
|
16
|
+
if (status === 429)
|
|
17
|
+
return true;
|
|
18
|
+
if (status >= 500 && status < 600)
|
|
19
|
+
return true;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// No status => likely a network error
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Run `fn` with retry. Honors Retry-After hint on 429/503 when available.
|
|
29
|
+
*/
|
|
30
|
+
export async function withRetry(fn, cfg = DEFAULT_RETRY, shouldRetry = defaultShouldRetry, onFailedAttempt) {
|
|
31
|
+
const opts = {
|
|
32
|
+
retries: cfg.max,
|
|
33
|
+
minTimeout: cfg.baseMs,
|
|
34
|
+
maxTimeout: cfg.baseMs * 32, // exponential ceiling
|
|
35
|
+
factor: 2,
|
|
36
|
+
randomize: true,
|
|
37
|
+
shouldRetry: (err) => shouldRetry(err),
|
|
38
|
+
};
|
|
39
|
+
return pRetry(async (attempt) => {
|
|
40
|
+
try {
|
|
41
|
+
return await fn();
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
if (onFailedAttempt)
|
|
45
|
+
onFailedAttempt(err, attempt);
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}, opts);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,MAAyC,MAAM,SAAS,CAAC;AAOhE,MAAM,CAAC,MAAM,aAAa,GAAgB,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAUlE,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,6EAA6E;IAC7E,iDAAiD;IACjD,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,8DAA8D;QAC9D,MAAM,MAAM,GAAI,GAAW,CAAC,MAA4B,CAAC;QACzD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,IAAI,MAAM,KAAK,GAAG;gBAAE,OAAO,IAAI,CAAC;YAChC,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;gBAAE,OAAO,IAAI,CAAC;YAC/C,OAAO,KAAK,CAAC;QACf,CAAC;QACD,sCAAsC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,EAAoB,EACpB,MAAmB,aAAa,EAChC,cAA2B,kBAAkB,EAC7C,eAAyD;IAEzD,MAAM,IAAI,GAAkB;QAC1B,OAAO,EAAE,GAAG,CAAC,GAAG;QAChB,UAAU,EAAE,GAAG,CAAC,MAAM;QACtB,UAAU,EAAE,GAAG,CAAC,MAAM,GAAG,EAAE,EAAE,sBAAsB;QACnD,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC;KACvC,CAAC;IAEF,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,eAAe;gBAAE,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SafetyConfig } from "../config/types.js";
|
|
2
|
+
import type { Logger } from "../log.js";
|
|
3
|
+
export type Risk = "low" | "medium" | "high" | "destructive";
|
|
4
|
+
export interface PolicyGateOptions {
|
|
5
|
+
safety: SafetyConfig;
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}
|
|
8
|
+
export declare function registerRisk(toolName: string, risk: Risk): void;
|
|
9
|
+
export declare function getRisk(toolName: string): Risk;
|
|
10
|
+
export declare function listRiskRegistry(): Record<string, Risk>;
|
|
11
|
+
export declare class PolicyGate {
|
|
12
|
+
private readonly safety;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
constructor(opts: PolicyGateOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Decide whether a tool call should proceed. Throws ApprovalRequiredError
|
|
17
|
+
* if the tool is high/destructive risk and neither token nor flag is set.
|
|
18
|
+
*
|
|
19
|
+
* @returns true if the call should proceed
|
|
20
|
+
*/
|
|
21
|
+
assertAllowed(toolName: string, args: Record<string, unknown>): boolean;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/safety/policy.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAKD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAE/D;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAEvD;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;gBAEhC,IAAI,EAAE,iBAAiB;IAKnC;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;CA4BxE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PolicyGate — safety gate for tool invocations.
|
|
3
|
+
*
|
|
4
|
+
* Classifies tools by risk (low/medium/high/destructive) and enforces
|
|
5
|
+
* approval-token + dangerously_allow_destructive policy.
|
|
6
|
+
*
|
|
7
|
+
* Full tool registry lives in `risk.ts`. Phase 1A provides only the gate
|
|
8
|
+
* skeleton; tool registrations add entries to the registry in 1B–1D.
|
|
9
|
+
*/
|
|
10
|
+
import { timingSafeEqual } from "node:crypto";
|
|
11
|
+
import { ApprovalRequiredError } from "../proxmox/errors.js";
|
|
12
|
+
/** Mutable risk registry keyed by tool name. */
|
|
13
|
+
const RISK_REGISTRY = new Map();
|
|
14
|
+
export function registerRisk(toolName, risk) {
|
|
15
|
+
RISK_REGISTRY.set(toolName, risk);
|
|
16
|
+
}
|
|
17
|
+
export function getRisk(toolName) {
|
|
18
|
+
return RISK_REGISTRY.get(toolName) ?? "low";
|
|
19
|
+
}
|
|
20
|
+
export function listRiskRegistry() {
|
|
21
|
+
return Object.fromEntries(RISK_REGISTRY);
|
|
22
|
+
}
|
|
23
|
+
export class PolicyGate {
|
|
24
|
+
safety;
|
|
25
|
+
logger;
|
|
26
|
+
constructor(opts) {
|
|
27
|
+
this.safety = opts.safety;
|
|
28
|
+
this.logger = opts.logger;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Decide whether a tool call should proceed. Throws ApprovalRequiredError
|
|
32
|
+
* if the tool is high/destructive risk and neither token nor flag is set.
|
|
33
|
+
*
|
|
34
|
+
* @returns true if the call should proceed
|
|
35
|
+
*/
|
|
36
|
+
assertAllowed(toolName, args) {
|
|
37
|
+
const risk = getRisk(toolName);
|
|
38
|
+
if (risk === "low")
|
|
39
|
+
return true;
|
|
40
|
+
if (risk === "medium") {
|
|
41
|
+
if (this.safety.auditOnly) {
|
|
42
|
+
this.logger?.info({ tool: toolName, risk, args: scrubArgs(args) }, "policy.audit");
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
// risk === "high" || risk === "destructive"
|
|
47
|
+
if (this.safety.dangerouslyAllowDestructive) {
|
|
48
|
+
this.logger?.warn({ tool: toolName, risk, args: scrubArgs(args), bypass: "dangerously_allow_destructive" }, "policy.bypass");
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
const providedToken = typeof args.approval_token === "string" ? args.approval_token : null;
|
|
52
|
+
if (providedToken && this.safety.approvalToken && tokensMatch(providedToken, this.safety.approvalToken)) {
|
|
53
|
+
this.logger?.warn({ tool: toolName, risk, args: scrubArgs(args) }, "policy.approved");
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
throw new ApprovalRequiredError(toolName, risk);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function tokensMatch(provided, expected) {
|
|
60
|
+
if (provided.length !== expected.length)
|
|
61
|
+
return false;
|
|
62
|
+
try {
|
|
63
|
+
return timingSafeEqual(Buffer.from(provided), Buffer.from(expected));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function scrubArgs(args) {
|
|
70
|
+
const out = {};
|
|
71
|
+
for (const [k, v] of Object.entries(args)) {
|
|
72
|
+
if (k === "approval_token" || k === "password" || k === "new_password" || k === "cipassword") {
|
|
73
|
+
out[k] = "[REDACTED]";
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
out[k] = v;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=policy.js.map
|