@bpinhosilva/agent-orchestrator 1.2.0 → 1.3.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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [1.3.0](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.2.0...v1.3.0) (2026-06-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update version and dependencies in package.json and package-lock.json ([aa1c0c1](https://github.com/bpinhosilva/agent-orchestrator/commit/aa1c0c1ac6b41d89ecaa0dccd423122287b0b988))
7
+
8
+
9
+ ### Features
10
+
11
+ * force the version after creating backup feature ([790356c](https://github.com/bpinhosilva/agent-orchestrator/commit/790356c85fac8ac0d850f6ce7998904eea1c7226))
12
+
1
13
  # [1.2.0](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.1.3...v1.2.0) (2026-05-17)
2
14
 
3
15
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Agent Orchestrator
1
+ # Agent Orchestrator
2
2
 
3
3
  <p align="center">
4
4
  <img src="https://raw.githubusercontent.com/bpinhosilva/agent-orchestrator/main/docs/assets/lupy-mascot.webp" alt="Lupy, the Agent Orchestrator mascot" width="500" />
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.registerBackupCommand = registerBackupCommand;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const zlib_1 = require("zlib");
40
+ const typeorm_1 = require("../../config/typeorm");
41
+ const constants_1 = require("../constants");
42
+ const utils_1 = require("../utils");
43
+ const DEFAULT_BACKUP_DESTINATION = path.join(constants_1.PID_DIR, 'backups');
44
+ function quoteIdentifier(identifier) {
45
+ return `"${identifier.replace(/"/g, '""')}"`;
46
+ }
47
+ function buildTimestamp(now = new Date()) {
48
+ const y = now.getFullYear();
49
+ const mm = String(now.getMonth() + 1).padStart(2, '0');
50
+ const dd = String(now.getDate()).padStart(2, '0');
51
+ const hh = String(now.getHours()).padStart(2, '0');
52
+ const mi = String(now.getMinutes()).padStart(2, '0');
53
+ const ss = String(now.getSeconds()).padStart(2, '0');
54
+ const ms = String(now.getMilliseconds()).padStart(3, '0');
55
+ return `${y}${mm}${dd}-${hh}${mi}${ss}-${ms}`;
56
+ }
57
+ function detectDbType(type) {
58
+ if ((0, typeorm_1.isSqliteDriver)(type)) {
59
+ return 'sqlite';
60
+ }
61
+ if (type === 'postgres') {
62
+ return 'postgres';
63
+ }
64
+ throw new Error(`Unsupported database type "${String(type)}". Backup currently supports sqlite and postgres.`);
65
+ }
66
+ async function listTables(dbType, query) {
67
+ if (dbType === 'sqlite') {
68
+ const rows = (await query("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' ORDER BY name"));
69
+ return rows.map((row) => ({ name: row.name }));
70
+ }
71
+ const rows = (await query("SELECT table_schema, table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('pg_catalog', 'information_schema') ORDER BY table_schema, table_name"));
72
+ return rows.map((row) => ({
73
+ name: row.table_name,
74
+ schema: row.table_schema,
75
+ }));
76
+ }
77
+ function tableSelectSql(dbType, table) {
78
+ if (dbType === 'sqlite') {
79
+ return `SELECT * FROM ${quoteIdentifier(table.name)}`;
80
+ }
81
+ const schema = table.schema ?? 'public';
82
+ return `SELECT * FROM ${quoteIdentifier(schema)}.${quoteIdentifier(table.name)}`;
83
+ }
84
+ async function fetchTableRows(query, sql) {
85
+ const result = await query(sql);
86
+ if (!Array.isArray(result)) {
87
+ return [];
88
+ }
89
+ return result;
90
+ }
91
+ function registerBackupCommand(program) {
92
+ program
93
+ .command('backup <target>')
94
+ .description('Create runtime backups (currently supports database only)')
95
+ .option('-d, --destination <path>', 'Destination folder for backup files', DEFAULT_BACKUP_DESTINATION)
96
+ .action(async (target, ...args) => {
97
+ const opts = (0, utils_1.resolveActionOptions)(args);
98
+ if (target !== 'db') {
99
+ console.error(`Unsupported backup target "${target}". Only "db" is currently supported.`);
100
+ process.exitCode = 1;
101
+ return;
102
+ }
103
+ const destination = opts.destination ?? DEFAULT_BACKUP_DESTINATION;
104
+ const timestamp = buildTimestamp();
105
+ const filename = `agent-orchestrator-backup-${target}-${timestamp}.json.gz`;
106
+ const outputPath = path.join(destination, filename);
107
+ fs.mkdirSync(destination, { recursive: true });
108
+ const dataSource = (0, typeorm_1.createDataSource)();
109
+ try {
110
+ await dataSource.initialize();
111
+ const dbType = detectDbType(dataSource.options.type);
112
+ const tables = await listTables(dbType, (sql) => dataSource.query(sql));
113
+ const tableData = await Promise.all(tables.map(async (table) => {
114
+ const rows = await fetchTableRows((sql) => dataSource.query(sql), tableSelectSql(dbType, table));
115
+ return {
116
+ name: table.name,
117
+ ...(table.schema ? { schema: table.schema } : {}),
118
+ rows,
119
+ };
120
+ }));
121
+ const backupPayload = {
122
+ target: target,
123
+ dbType,
124
+ createdAt: new Date().toISOString(),
125
+ tableCount: tableData.length,
126
+ tables: tableData,
127
+ };
128
+ const compressed = (0, zlib_1.gzipSync)(Buffer.from(JSON.stringify(backupPayload)));
129
+ fs.writeFileSync(outputPath, compressed);
130
+ console.log(`Backup created: ${outputPath}`);
131
+ }
132
+ catch (err) {
133
+ const errorMessage = err instanceof Error ? err.message : String(err);
134
+ console.error(`Backup failed: ${errorMessage}`);
135
+ process.exitCode = 1;
136
+ }
137
+ finally {
138
+ if (dataSource.isInitialized) {
139
+ await dataSource.destroy();
140
+ }
141
+ }
142
+ });
143
+ }
@@ -13,6 +13,7 @@ const config_command_1 = require("./config.command");
13
13
  const reset_password_command_1 = require("./reset-password.command");
14
14
  const rotate_secrets_command_1 = require("./rotate-secrets.command");
15
15
  const seed_admin_command_1 = require("./seed-admin.command");
16
+ const backup_command_1 = require("./backup.command");
16
17
  function registerAllCommands(program) {
17
18
  (0, setup_command_1.registerSetupCommand)(program);
18
19
  (0, run_command_1.registerRunCommand)(program);
@@ -26,4 +27,5 @@ function registerAllCommands(program) {
26
27
  (0, reset_password_command_1.registerResetPasswordCommand)(program);
27
28
  (0, rotate_secrets_command_1.registerRotateSecretsCommand)(program);
28
29
  (0, seed_admin_command_1.registerSeedAdminCommand)(program);
30
+ (0, backup_command_1.registerBackupCommand)(program);
29
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpinhosilva/agent-orchestrator",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "An open-source AI agent orchestrator platform built with NestJS.",
5
5
  "author": "bpinhosilva",
6
6
  "license": "MIT",
@@ -92,7 +92,7 @@
92
92
  "class-transformer": "^0.5.1",
93
93
  "class-validator": "^0.14.1",
94
94
  "commander": "^14.0.3",
95
- "concurrently": "^9.2.1",
95
+ "concurrently": "^10.0.3",
96
96
  "cookie-parser": "^1.4.7",
97
97
  "enquirer": "^2.4.1",
98
98
  "helmet": "^8.1.0",