@hivemagnus/magnus 3.3.5 → 3.4.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.
@@ -12,9 +12,10 @@ export declare const SERVER_RESTORE_SINCE = "1.1.3";
12
12
  /** Bytes the database occupies (an upper bound for its dump), or null when it cannot be asked. */
13
13
  export declare function databaseBytes(io: Io, project: Project): Promise<number | null>;
14
14
  /**
15
- * Keep the newest `keep` dumps in backups/; older ones go, except the newest
16
- * dump of each label (the one a rollback of that step restores) and any file
17
- * in `protect`.
15
+ * Keep the newest `keep` dumps in backups/ and any file in `protect` (the dump
16
+ * the current upgrade's rollback restores); older ones go. Upgrade labels are
17
+ * unique per step (`pre-upgrade-A-to-B`), so a per-label exemption would keep
18
+ * every dump forever.
18
19
  */
19
20
  export declare function pruneBackups(dir: string, keep: number, protect?: readonly string[]): string[];
20
21
  /**
package/dist/database.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /** Pre-migration dumps and restores for both database kinds a project can use. */
2
2
  import { closeSync, chmodSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
3
- import { basename, dirname, join } from 'node:path';
3
+ import { dirname, join } from 'node:path';
4
4
  import { compareVersions, restoreAsideSchema, restoreFinishSql, restoreRevertSql, restoreSwapSql } from '@hivemagnus/magnus-contracts';
5
5
  import { readEnvFile } from './env-file.js';
6
6
  import { mustRun } from './io.js';
@@ -44,9 +44,10 @@ export async function databaseBytes(io, project) {
44
44
  return Number.isFinite(bytes) && bytes > 0 ? bytes : null;
45
45
  }
46
46
  /**
47
- * Keep the newest `keep` dumps in backups/; older ones go, except the newest
48
- * dump of each label (the one a rollback of that step restores) and any file
49
- * in `protect`.
47
+ * Keep the newest `keep` dumps in backups/ and any file in `protect` (the dump
48
+ * the current upgrade's rollback restores); older ones go. Upgrade labels are
49
+ * unique per step (`pre-upgrade-A-to-B`), so a per-label exemption would keep
50
+ * every dump forever.
50
51
  */
51
52
  export function pruneBackups(dir, keep, protect = []) {
52
53
  if (!existsSync(dir) || keep < 1)
@@ -58,14 +59,11 @@ export function pruneBackups(dir, keep, protect = []) {
58
59
  meta = JSON.parse(readFileSync(`${file}.json`, 'utf8'));
59
60
  }
60
61
  catch { /* no metadata */ }
61
- return { file, label: meta.label ?? basename(file), at: Date.parse(meta.createdAt ?? '') || statSync(file).mtimeMs };
62
+ return { file, at: Date.parse(meta.createdAt ?? '') || statSync(file).mtimeMs };
62
63
  }).sort((a, b) => b.at - a.at);
63
- const seen = new Set();
64
64
  const removed = [];
65
65
  dumps.forEach((dump, index) => {
66
- const newest = !seen.has(dump.label);
67
- seen.add(dump.label);
68
- if (index < keep || newest || protect.includes(dump.file))
66
+ if (index < keep || protect.includes(dump.file))
69
67
  return;
70
68
  rmSync(dump.file, { force: true });
71
69
  rmSync(`${dump.file}.json`, { force: true });
package/dist/project.d.ts CHANGED
@@ -52,7 +52,7 @@ export interface ProjectState {
52
52
  current: string | null;
53
53
  previous: string | null;
54
54
  keepVersions: number;
55
- /** Dumps kept in backups/ (default 5); the newest of each label always stays. */
55
+ /** Dumps kept in backups/ (default 5), plus the dump the current upgrade's rollback restores. */
56
56
  keepBackups?: number;
57
57
  /** Node.js the units run (and the upgrade uses for npm and the server CLI); default: the units' ExecStart. */
58
58
  nodePath?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hivemagnus/magnus",
3
- "version": "3.3.5",
3
+ "version": "3.4.0",
4
4
  "description": "Install, upgrade and roll back a Magnus server and console with one command: `npx @hivemagnus/magnus init`, then `magnus upgrade`. Pins exact, tested component versions, backs up PostgreSQL before every migration and reverts automatically when the new version fails its health check.",
5
5
  "keywords": [
6
6
  "magnus",
@@ -47,38 +47,114 @@
47
47
  "clean": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});fs.rmSync('tsconfig.tsbuildinfo',{force:true})\""
48
48
  },
49
49
  "dependencies": {
50
- "@hivemagnus/magnus-contracts": "3.3.5"
50
+ "@hivemagnus/magnus-contracts": "3.4.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^24.19.2",
54
54
  "typescript": "^6.0.3",
55
- "vitest": "^5.1.0"
55
+ "vitest": "^5.1.1"
56
56
  },
57
57
  "magnusRelease": {
58
58
  "schema": 1,
59
- "version": "3.3.5",
59
+ "version": "3.4.0",
60
60
  "engines": {
61
61
  "node": "^24.22.3 || ^26.13.1"
62
62
  },
63
63
  "components": {
64
- "@hivemagnus/magnus-server": "3.3.5",
65
- "@hivemagnus/magnus-ui": "3.3.5",
66
- "@hivemagnus/magnus-contracts": "3.3.5",
67
- "@hivemagnus/magnus-agent": "3.3.5"
64
+ "@hivemagnus/magnus-server": "3.4.0",
65
+ "@hivemagnus/magnus-ui": "3.4.0",
66
+ "@hivemagnus/magnus-contracts": "3.4.0",
67
+ "@hivemagnus/magnus-agent": "3.4.0"
68
68
  },
69
69
  "breaking": false,
70
70
  "minUpgradeFrom": "2.10.2",
71
71
  "engineProtocol": 2,
72
72
  "newRequiredEnv": [],
73
- "newOptionalEnv": [],
74
- "removedEnv": [],
75
- "migrations": [],
73
+ "newOptionalEnv": [
74
+ {
75
+ "name": "MAGNUS_HISTORY_RETENTION_DAYS",
76
+ "component": "server",
77
+ "secret": false,
78
+ "description": "Days (at least 7) of finished command, webhook, alert, cron, anomaly and AI conversation history to keep; unset keeps everything."
79
+ },
80
+ {
81
+ "name": "MAGNUS_AI_SCHEDULER_ENABLED",
82
+ "component": "server",
83
+ "secret": false,
84
+ "description": "Run due AI scheduled operations every minute from the server (default false). Each occurrence is claimed first, so it runs once; tools that need approval pause as in a chat."
85
+ },
86
+ {
87
+ "name": "MAGNUS_API_SECRET_BYPASS",
88
+ "component": "server",
89
+ "secret": false,
90
+ "description": "Where the x-api-secret ADMIN bypass is honoured: on (default, from any peer), loopback (only from a loopback socket peer) or off (ignored; callers need a bearer token)."
91
+ },
92
+ {
93
+ "name": "MAGNUS_AGENT_BODY_LIMIT_BYTES",
94
+ "component": "agent",
95
+ "secret": false,
96
+ "description": "Largest request body the agent API accepts (1024 to 268435456 bytes, default 16777216), enforced before the request signature is verified. Larger bodies get 413 PAYLOAD_TOO_LARGE."
97
+ },
98
+ {
99
+ "name": "HERMES_INSTALL_COMMIT",
100
+ "component": "agent",
101
+ "secret": false,
102
+ "description": "Override the Hermes Agent commit that POST /hermes/install bootstraps (40 hex). Set together with HERMES_INSTALL_SCRIPT_SHA256; unset uses the pin shipped with this agent."
103
+ },
104
+ {
105
+ "name": "HERMES_INSTALL_SCRIPT_SHA256",
106
+ "component": "agent",
107
+ "secret": false,
108
+ "description": "SHA-256 (64 hex) of scripts/install.sh at HERMES_INSTALL_COMMIT. The installer runs only when the download matches."
109
+ },
110
+ {
111
+ "name": "MAGNUS_AGENT_FILE_ROOTS",
112
+ "component": "agent",
113
+ "secret": false,
114
+ "description": "Comma-separated absolute directories the file API may reach, as written and after resolving symlinks. Unset: every path except the denylist. An invalid value disables the file API and fails magnus-agent check."
115
+ },
116
+ {
117
+ "name": "DASHBOARD_TRUSTED_PROXIES",
118
+ "component": "ui",
119
+ "secret": false,
120
+ "description": "Comma-separated reverse-proxy addresses or CIDR ranges whose X-Forwarded-For names the client for console login throttling and audit. Unset: the socket peer."
121
+ }
122
+ ],
123
+ "removedEnv": [
124
+ {
125
+ "name": "ALLOW_LEGACY_SESSION_SECRET",
126
+ "component": "ui",
127
+ "note": "the JWT_SECRET session fallback expired on 2026-10-01 and is removed; set SESSION_SECRET (now declared required)"
128
+ },
129
+ {
130
+ "name": "DASHBOARD_LOGIN_USERNAME",
131
+ "component": "ui",
132
+ "note": "the legacy console login expired on 2026-10-01 and is removed; use the DASHBOARD_ADMIN_* credential"
133
+ },
134
+ {
135
+ "name": "DASHBOARD_LOGIN_PASSWORD",
136
+ "component": "ui",
137
+ "note": "the legacy console login expired on 2026-10-01 and is removed; use the DASHBOARD_ADMIN_* credential"
138
+ }
139
+ ],
140
+ "migrations": [
141
+ {
142
+ "name": "20261126120000_remote_command_status_index",
143
+ "impact": "fast",
144
+ "note": "Builds one index on remote_commands (seconds for a few million rows); command inserts wait while it builds."
145
+ },
146
+ {
147
+ "name": "20261126120100_remediation_execution_restrict",
148
+ "impact": "fast",
149
+ "note": "Replaces one foreign key (remediation executions now restrict rule deletion); no row changes."
150
+ }
151
+ ],
76
152
  "agent": {
77
153
  "selfUpgradeProtocol": 1,
78
154
  "minLauncher": 1
79
155
  },
80
- "summary": "Ardent 3.2.1: the node agent and New Agent stage @hivemagnus/ardent 3.2.1, whose only change is the ardent-client viaMagnus apiBase option for reaching Magnus through a Hive console; the runtime, its management API and dependencies are unchanged from 3.2.0. Includes 3.3.4. No migrations and no settings change.",
81
- "notesUrl": "https://github.com/ChefTaco/magnus/releases/tag/v3.3.5",
156
+ "summary": "Security and hardening release with Ardent 3.5.1 (Ardent 3.4.0 management operations through node agent studio level 5: task pages and filters, metrics, peer credential reload, management token rotation). AI tools that need approval pause on every chat path and the policy fails closed; IAM_CORE_URL must be HTTPS off loopback and Hive IAM tokens need an expiry of at most 24 hours; agent file writes are atomic, symlink-safe and directory-bound, with system paths for ADMIN only (upgrade node agents before the control server); literal agent command arguments; a pinned Hermes installer; node-signed log ingest; console Origin checks, CSP and trusted proxies, with the expired JWT_SECRET session and DASHBOARD_LOGIN_* fallbacks removed; read-only, digest-pinned Compose services; backup pruning that deletes. Opt-in history retention, server-side AI scheduler and API-secret bypass scope. Two fast migrations: an index on remote_commands(status, createdAt) and a restrict on deleting a remediation rule that has executions.",
157
+ "notesUrl": "https://github.com/ChefTaco/magnus/releases/tag/v3.4.0",
82
158
  "allowScripts": {
83
159
  "@prisma/engines": true,
84
160
  "argon2": true,