@zincapp/znvault-cli 2.22.5 → 2.23.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.
Files changed (101) hide show
  1. package/dist/commands/agent/direct/index.d.ts +8 -0
  2. package/dist/commands/agent/direct/index.d.ts.map +1 -0
  3. package/dist/commands/agent/direct/index.js +16 -0
  4. package/dist/commands/agent/direct/index.js.map +1 -0
  5. package/dist/commands/agent/direct/ping.d.ts +6 -0
  6. package/dist/commands/agent/direct/ping.d.ts.map +1 -0
  7. package/dist/commands/agent/direct/ping.js +52 -0
  8. package/dist/commands/agent/direct/ping.js.map +1 -0
  9. package/dist/commands/agent/direct/plugins.d.ts +6 -0
  10. package/dist/commands/agent/direct/plugins.d.ts.map +1 -0
  11. package/dist/commands/agent/direct/plugins.js +56 -0
  12. package/dist/commands/agent/direct/plugins.js.map +1 -0
  13. package/dist/commands/agent/direct/update-all.d.ts +6 -0
  14. package/dist/commands/agent/direct/update-all.d.ts.map +1 -0
  15. package/dist/commands/agent/direct/update-all.js +233 -0
  16. package/dist/commands/agent/direct/update-all.js.map +1 -0
  17. package/dist/commands/agent/direct/update-plugins.d.ts +6 -0
  18. package/dist/commands/agent/direct/update-plugins.d.ts.map +1 -0
  19. package/dist/commands/agent/direct/update-plugins.js +91 -0
  20. package/dist/commands/agent/direct/update-plugins.js.map +1 -0
  21. package/dist/commands/agent/direct/update.d.ts +6 -0
  22. package/dist/commands/agent/direct/update.d.ts.map +1 -0
  23. package/dist/commands/agent/direct/update.js +90 -0
  24. package/dist/commands/agent/direct/update.js.map +1 -0
  25. package/dist/commands/agent/direct/version.d.ts +6 -0
  26. package/dist/commands/agent/direct/version.d.ts.map +1 -0
  27. package/dist/commands/agent/direct/version.js +47 -0
  28. package/dist/commands/agent/direct/version.js.map +1 -0
  29. package/dist/commands/agent/helpers.d.ts +72 -0
  30. package/dist/commands/agent/helpers.d.ts.map +1 -0
  31. package/dist/commands/agent/helpers.js +331 -0
  32. package/dist/commands/agent/helpers.js.map +1 -0
  33. package/dist/commands/agent/index.d.ts +45 -0
  34. package/dist/commands/agent/index.d.ts.map +1 -0
  35. package/dist/commands/agent/index.js +30 -0
  36. package/dist/commands/agent/index.js.map +1 -0
  37. package/dist/commands/agent/remote/alerts.d.ts +6 -0
  38. package/dist/commands/agent/remote/alerts.d.ts.map +1 -0
  39. package/dist/commands/agent/remote/alerts.js +42 -0
  40. package/dist/commands/agent/remote/alerts.js.map +1 -0
  41. package/dist/commands/agent/remote/connections.d.ts +6 -0
  42. package/dist/commands/agent/remote/connections.d.ts.map +1 -0
  43. package/dist/commands/agent/remote/connections.js +46 -0
  44. package/dist/commands/agent/remote/connections.js.map +1 -0
  45. package/dist/commands/agent/remote/delete.d.ts +6 -0
  46. package/dist/commands/agent/remote/delete.d.ts.map +1 -0
  47. package/dist/commands/agent/remote/delete.js +34 -0
  48. package/dist/commands/agent/remote/delete.js.map +1 -0
  49. package/dist/commands/agent/remote/index.d.ts +20 -0
  50. package/dist/commands/agent/remote/index.d.ts.map +1 -0
  51. package/dist/commands/agent/remote/index.js +84 -0
  52. package/dist/commands/agent/remote/index.js.map +1 -0
  53. package/dist/commands/agent/remote/list.d.ts +6 -0
  54. package/dist/commands/agent/remote/list.d.ts.map +1 -0
  55. package/dist/commands/agent/remote/list.js +57 -0
  56. package/dist/commands/agent/remote/list.js.map +1 -0
  57. package/dist/commands/agent/remote/reprovision/cancel.d.ts +6 -0
  58. package/dist/commands/agent/remote/reprovision/cancel.d.ts.map +1 -0
  59. package/dist/commands/agent/remote/reprovision/cancel.js +35 -0
  60. package/dist/commands/agent/remote/reprovision/cancel.js.map +1 -0
  61. package/dist/commands/agent/remote/reprovision/create.d.ts +6 -0
  62. package/dist/commands/agent/remote/reprovision/create.d.ts.map +1 -0
  63. package/dist/commands/agent/remote/reprovision/create.js +54 -0
  64. package/dist/commands/agent/remote/reprovision/create.js.map +1 -0
  65. package/dist/commands/agent/remote/reprovision/index.d.ts +12 -0
  66. package/dist/commands/agent/remote/reprovision/index.d.ts.map +1 -0
  67. package/dist/commands/agent/remote/reprovision/index.js +21 -0
  68. package/dist/commands/agent/remote/reprovision/index.js.map +1 -0
  69. package/dist/commands/agent/remote/reprovision/status.d.ts +6 -0
  70. package/dist/commands/agent/remote/reprovision/status.d.ts.map +1 -0
  71. package/dist/commands/agent/remote/reprovision/status.js +60 -0
  72. package/dist/commands/agent/remote/reprovision/status.js.map +1 -0
  73. package/dist/commands/agent/remote/status.d.ts +6 -0
  74. package/dist/commands/agent/remote/status.d.ts.map +1 -0
  75. package/dist/commands/agent/remote/status.js +126 -0
  76. package/dist/commands/agent/remote/status.js.map +1 -0
  77. package/dist/commands/agent/token/create.d.ts +6 -0
  78. package/dist/commands/agent/token/create.d.ts.map +1 -0
  79. package/dist/commands/agent/token/create.js +67 -0
  80. package/dist/commands/agent/token/create.js.map +1 -0
  81. package/dist/commands/agent/token/index.d.ts +8 -0
  82. package/dist/commands/agent/token/index.d.ts.map +1 -0
  83. package/dist/commands/agent/token/index.js +13 -0
  84. package/dist/commands/agent/token/index.js.map +1 -0
  85. package/dist/commands/agent/token/list.d.ts +6 -0
  86. package/dist/commands/agent/token/list.d.ts.map +1 -0
  87. package/dist/commands/agent/token/list.js +63 -0
  88. package/dist/commands/agent/token/list.js.map +1 -0
  89. package/dist/commands/agent/token/revoke.d.ts +6 -0
  90. package/dist/commands/agent/token/revoke.d.ts.map +1 -0
  91. package/dist/commands/agent/token/revoke.js +37 -0
  92. package/dist/commands/agent/token/revoke.js.map +1 -0
  93. package/dist/commands/agent/types.d.ts +237 -0
  94. package/dist/commands/agent/types.d.ts.map +1 -0
  95. package/dist/commands/agent/types.js +3 -0
  96. package/dist/commands/agent/types.js.map +1 -0
  97. package/dist/commands/agent.d.ts +9 -2
  98. package/dist/commands/agent.d.ts.map +1 -1
  99. package/dist/commands/agent.js +8 -1201
  100. package/dist/commands/agent.js.map +1 -1
  101. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Direct agent communication commands registration
3
+ *
4
+ * These commands communicate directly with agents via HTTP, not through the vault.
5
+ */
6
+ import type { Command } from 'commander';
7
+ export declare function registerDirectCommands(parentCmd: Command): void;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/agent/direct/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAO/D"}
@@ -0,0 +1,16 @@
1
+ // Path: src/commands/agent/direct/index.ts
2
+ import { registerPingCommand } from './ping.js';
3
+ import { registerPluginsCommand } from './plugins.js';
4
+ import { registerUpdatePluginsCommand } from './update-plugins.js';
5
+ import { registerVersionCommand } from './version.js';
6
+ import { registerUpdateCommand } from './update.js';
7
+ import { registerUpdateAllCommand } from './update-all.js';
8
+ export function registerDirectCommands(parentCmd) {
9
+ registerPingCommand(parentCmd);
10
+ registerPluginsCommand(parentCmd);
11
+ registerUpdatePluginsCommand(parentCmd);
12
+ registerVersionCommand(parentCmd);
13
+ registerUpdateCommand(parentCmd);
14
+ registerUpdateAllCommand(parentCmd);
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/agent/direct/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAS3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,UAAU,sBAAsB,CAAC,SAAkB;IACvD,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC/B,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAClC,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACxC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAClC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACjC,wBAAwB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Agent ping command - check agent health directly via HTTP
3
+ */
4
+ import type { Command } from 'commander';
5
+ export declare function registerPingCommand(parentCmd: Command): void;
6
+ //# sourceMappingURL=ping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.d.ts","sourceRoot":"","sources":["../../../../src/commands/agent/direct/ping.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAmD5D"}
@@ -0,0 +1,52 @@
1
+ // Path: src/commands/agent/direct/ping.ts
2
+ import ora from 'ora';
3
+ import * as output from '../../../lib/output.js';
4
+ import { resolveHostPort, fetchAgentHealth, formatUptime } from '../helpers.js';
5
+ export function registerPingCommand(parentCmd) {
6
+ parentCmd
7
+ .command('ping [hostPort]')
8
+ .description('Check agent health directly via HTTP (format: host:port or host, or select from list)')
9
+ .option('--json', 'Output as JSON')
10
+ .action(async (hostPort, options) => {
11
+ const resolved = await resolveHostPort(hostPort);
12
+ if (!resolved) {
13
+ process.exit(1);
14
+ }
15
+ const { host, port } = resolved;
16
+ const spinner = ora(`Checking agent at ${host}:${port}...`).start();
17
+ try {
18
+ const health = await fetchAgentHealth(host, port);
19
+ spinner.stop();
20
+ if (options.json) {
21
+ output.json(health);
22
+ return;
23
+ }
24
+ const statusColor = health.status === 'healthy' ? '\x1b[32m' :
25
+ health.status === 'degraded' ? '\x1b[33m' : '\x1b[31m';
26
+ const reset = '\x1b[0m';
27
+ const statusIcon = health.status === 'healthy' ? '●' :
28
+ health.status === 'degraded' ? '◐' : '○';
29
+ console.log();
30
+ console.log(`Agent: ${host}:${port}`);
31
+ console.log('═'.repeat(40));
32
+ console.log(` Status: ${statusColor}${statusIcon} ${health.status}${reset}`);
33
+ console.log(` Version: v${health.version}`);
34
+ console.log(` Uptime: ${formatUptime(health.uptime)}`);
35
+ if (health.plugins && health.plugins.length > 0) {
36
+ console.log();
37
+ console.log('Plugins:');
38
+ for (const plugin of health.plugins) {
39
+ const pluginIcon = plugin.healthy ? '\x1b[32m●\x1b[0m' : '\x1b[31m○\x1b[0m';
40
+ console.log(` ${pluginIcon} ${plugin.name} v${plugin.version}`);
41
+ }
42
+ }
43
+ console.log();
44
+ }
45
+ catch (err) {
46
+ spinner.fail(`Failed to reach agent at ${host}:${port}`);
47
+ output.error(err instanceof Error ? err.message : String(err));
48
+ process.exit(1);
49
+ }
50
+ });
51
+ }
52
+ //# sourceMappingURL=ping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.js","sourceRoot":"","sources":["../../../../src/commands/agent/direct/ping.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAO1C,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,UAAU,mBAAmB,CAAC,SAAkB;IACpD,SAAS;SACN,OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CAAC,uFAAuF,CAAC;SACpG,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,QAA4B,EAAE,OAA6B,EAAE,EAAE;QAC5E,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,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,CAAC,eAAe,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,cAAc,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAEzD,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChD,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBACxB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;oBACpC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC;oBAC5E,OAAO,CAAC,GAAG,CAAC,KAAK,UAAU,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;YAED,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,4BAA4B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;YACzD,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Agent plugins command - check plugin versions on an agent
3
+ */
4
+ import type { Command } from 'commander';
5
+ export declare function registerPluginsCommand(parentCmd: Command): void;
6
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../../src/commands/agent/direct/plugins.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAoD/D"}
@@ -0,0 +1,56 @@
1
+ // Path: src/commands/agent/direct/plugins.ts
2
+ import ora from 'ora';
3
+ import * as output from '../../../lib/output.js';
4
+ import { resolveHostPort, fetchPluginVersions } from '../helpers.js';
5
+ export function registerPluginsCommand(parentCmd) {
6
+ parentCmd
7
+ .command('plugins [hostPort]')
8
+ .description('Check plugin versions on an agent (format: host:port or host, or select from list)')
9
+ .option('--json', 'Output as JSON')
10
+ .action(async (hostPort, options) => {
11
+ const resolved = await resolveHostPort(hostPort);
12
+ if (!resolved) {
13
+ process.exit(1);
14
+ }
15
+ const { host, port } = resolved;
16
+ const spinner = ora(`Checking plugins at ${host}:${port}...`).start();
17
+ try {
18
+ const response = await fetchPluginVersions(host, port);
19
+ spinner.stop();
20
+ if (options.json) {
21
+ output.json(response);
22
+ return;
23
+ }
24
+ console.log();
25
+ console.log(`Plugin Versions: ${host}:${port}`);
26
+ console.log('═'.repeat(50));
27
+ if (response.versions.length === 0) {
28
+ console.log(' No plugins installed');
29
+ }
30
+ else {
31
+ for (const plugin of response.versions) {
32
+ const updateIcon = plugin.updateAvailable ? '\x1b[33m↑\x1b[0m' : ' ';
33
+ const versionStr = plugin.updateAvailable
34
+ ? `${plugin.current} → \x1b[32m${plugin.latest}\x1b[0m`
35
+ : plugin.current;
36
+ console.log(` ${updateIcon} ${plugin.package}: ${versionStr}`);
37
+ }
38
+ }
39
+ console.log();
40
+ if (response.hasUpdates) {
41
+ console.log(`\x1b[33m${response.versions.filter(v => v.updateAvailable).length} update(s) available\x1b[0m`);
42
+ console.log(`Run: znvault agent update-plugins ${host}:${port}`);
43
+ }
44
+ else {
45
+ console.log('\x1b[32m✓\x1b[0m All plugins up to date');
46
+ }
47
+ console.log();
48
+ }
49
+ catch (err) {
50
+ spinner.fail(`Failed to check plugins at ${host}:${port}`);
51
+ output.error(err instanceof Error ? err.message : String(err));
52
+ process.exit(1);
53
+ }
54
+ });
55
+ }
56
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../../src/commands/agent/direct/plugins.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAO7C,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAErE,MAAM,UAAU,sBAAsB,CAAC,SAAkB;IACvD,SAAS;SACN,OAAO,CAAC,oBAAoB,CAAC;SAC7B,WAAW,CAAC,oFAAoF,CAAC;SACjG,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,QAA4B,EAAE,OAA6B,EAAE,EAAE;QAC5E,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,uBAAuB,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;QAEtE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACvD,OAAO,CAAC,IAAI,EAAE,CAAC;YAEf,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACjB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OA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,CAAC,8BAA8B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Agent update-all command - batch update all online agents
3
+ */
4
+ import type { Command } from 'commander';
5
+ export declare function registerUpdateAllCommand(parentCmd: Command): void;
6
+ //# sourceMappingURL=update-all.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-all.d.ts","sourceRoot":"","sources":["../../../../src/commands/agent/direct/update-all.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBzC,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA2OjE"}
@@ -0,0 +1,233 @@
1
+ // Path: src/commands/agent/direct/update-all.ts
2
+ import ora from 'ora';
3
+ import * as mode from '../../../lib/mode.js';
4
+ import * as output from '../../../lib/output.js';
5
+ import { confirmAction, fetchAgentVersion, fetchPluginVersions, triggerAgentUpdate, triggerPluginUpdate, } from '../helpers.js';
6
+ export function registerUpdateAllCommand(parentCmd) {
7
+ parentCmd
8
+ .command('update-all')
9
+ .description('Update all online agents')
10
+ .option('--plugins', 'Update plugins instead of agent')
11
+ .option('-t, --tenant <id>', 'Filter by tenant (superadmin only)')
12
+ .option('--dry-run', 'Show what would be updated without making changes')
13
+ .option('-y, --yes', 'Skip confirmation')
14
+ .option('--json', 'Output as JSON')
15
+ .action(async (options) => {
16
+ const spinner = ora('Fetching online agents...').start();
17
+ try {
18
+ // Build query params
19
+ const params = new URLSearchParams();
20
+ params.set('status', 'online');
21
+ params.set('pageSize', '100');
22
+ if (options.tenant)
23
+ params.set('tenantId', options.tenant);
24
+ const response = await mode.apiGet(`/v1/agents?${params.toString()}`);
25
+ spinner.stop();
26
+ if (response.agents.length === 0) {
27
+ if (options.json) {
28
+ output.json({ updated: 0, message: 'No online agents found' });
29
+ }
30
+ else {
31
+ console.log('No online agents found');
32
+ }
33
+ return;
34
+ }
35
+ // Filter to agents with IP addresses
36
+ const reachableAgents = response.agents.filter(a => a.lastIpAddress);
37
+ if (reachableAgents.length === 0) {
38
+ if (options.json) {
39
+ output.json({ updated: 0, message: 'No agents with reachable IP addresses' });
40
+ }
41
+ else {
42
+ console.log('No agents with reachable IP addresses');
43
+ }
44
+ return;
45
+ }
46
+ // Check versions for all agents
47
+ const checkSpinner = ora(`Checking ${reachableAgents.length} agent(s)...`).start();
48
+ const agentInfo = [];
49
+ for (const agent of reachableAgents) {
50
+ const ip = agent.lastIpAddress.replace(/^::ffff:/i, '');
51
+ try {
52
+ if (options.plugins) {
53
+ // Check plugin versions
54
+ const pluginInfo = await fetchPluginVersions(ip, 9100);
55
+ const updatesNeeded = pluginInfo.versions.filter(v => v.updateAvailable).length;
56
+ agentInfo.push({
57
+ agent,
58
+ ip,
59
+ currentVersion: agent.version || 'unknown',
60
+ latestVersion: agent.version || 'unknown',
61
+ updateAvailable: updatesNeeded > 0,
62
+ pluginUpdates: updatesNeeded,
63
+ });
64
+ }
65
+ else {
66
+ // Check agent version
67
+ const versionInfo = await fetchAgentVersion(ip, 9100);
68
+ agentInfo.push({
69
+ agent,
70
+ ip,
71
+ currentVersion: versionInfo.current,
72
+ latestVersion: versionInfo.latest,
73
+ updateAvailable: versionInfo.updateAvailable,
74
+ autoUpdateEnabled: versionInfo.autoUpdateEnabled,
75
+ });
76
+ }
77
+ }
78
+ catch {
79
+ // Skip unreachable agents
80
+ agentInfo.push({
81
+ agent,
82
+ ip,
83
+ currentVersion: agent.version || 'unknown',
84
+ latestVersion: 'unreachable',
85
+ updateAvailable: false,
86
+ });
87
+ }
88
+ }
89
+ checkSpinner.stop();
90
+ // Filter to agents that need updates
91
+ const needsUpdate = agentInfo.filter(a => a.updateAvailable);
92
+ if (needsUpdate.length === 0) {
93
+ if (options.json) {
94
+ output.json({
95
+ updated: 0,
96
+ checked: agentInfo.length,
97
+ message: options.plugins ? 'All plugin versions up to date' : 'All agents up to date',
98
+ });
99
+ }
100
+ else {
101
+ console.log();
102
+ console.log(`Checked ${agentInfo.length} agent(s)`);
103
+ console.log(`\x1b[32m✓\x1b[0m ${options.plugins ? 'All plugin versions' : 'All agents'} up to date`);
104
+ }
105
+ return;
106
+ }
107
+ // Show summary
108
+ if (!options.json) {
109
+ console.log();
110
+ console.log(`${needsUpdate.length} of ${agentInfo.length} agent(s) need updates:`);
111
+ console.log();
112
+ for (const info of needsUpdate) {
113
+ if (options.plugins) {
114
+ console.log(` ${info.agent.hostname} (${info.ip}): ${info.pluginUpdates} plugin update(s)`);
115
+ }
116
+ else {
117
+ const autoUpdate = info.autoUpdateEnabled ? '' : ' (auto-update disabled)';
118
+ console.log(` ${info.agent.hostname} (${info.ip}): ${info.currentVersion} → ${info.latestVersion}${autoUpdate}`);
119
+ }
120
+ }
121
+ console.log();
122
+ }
123
+ // Dry run - just show what would be updated
124
+ if (options.dryRun) {
125
+ if (options.json) {
126
+ output.json({
127
+ dryRun: true,
128
+ wouldUpdate: needsUpdate.map(a => ({
129
+ hostname: a.agent.hostname,
130
+ ip: a.ip,
131
+ currentVersion: a.currentVersion,
132
+ latestVersion: a.latestVersion,
133
+ pluginUpdates: a.pluginUpdates,
134
+ })),
135
+ });
136
+ }
137
+ else {
138
+ console.log('Dry run - no changes made');
139
+ }
140
+ return;
141
+ }
142
+ // Filter out agents with auto-update disabled (for agent updates only)
143
+ const canUpdate = options.plugins
144
+ ? needsUpdate
145
+ : needsUpdate.filter(a => a.autoUpdateEnabled !== false);
146
+ if (canUpdate.length === 0) {
147
+ if (options.json) {
148
+ output.json({ updated: 0, message: 'No agents eligible for update (auto-update disabled)' });
149
+ }
150
+ else {
151
+ console.log('No agents eligible for update (auto-update disabled on all)');
152
+ }
153
+ return;
154
+ }
155
+ // Confirm
156
+ if (!options.yes && !options.json) {
157
+ const confirmed = await confirmAction(`Update ${canUpdate.length} agent(s)? Each will restart.`);
158
+ if (!confirmed) {
159
+ console.log('Cancelled');
160
+ return;
161
+ }
162
+ }
163
+ // Update agents sequentially
164
+ const results = [];
165
+ for (const info of canUpdate) {
166
+ if (!options.json) {
167
+ process.stdout.write(`Updating ${info.agent.hostname}... `);
168
+ }
169
+ try {
170
+ if (options.plugins) {
171
+ const response = await triggerPluginUpdate(info.ip, 9100);
172
+ results.push({
173
+ hostname: info.agent.hostname,
174
+ success: response.updated > 0,
175
+ message: `Updated ${response.updated} plugin(s)`,
176
+ });
177
+ if (!options.json) {
178
+ console.log(`\x1b[32m✓\x1b[0m Updated ${response.updated} plugin(s)`);
179
+ }
180
+ }
181
+ else {
182
+ const response = await triggerAgentUpdate(info.ip, 9100);
183
+ results.push({
184
+ hostname: info.agent.hostname,
185
+ success: response.success,
186
+ message: response.message,
187
+ });
188
+ if (!options.json) {
189
+ console.log(`\x1b[32m✓\x1b[0m ${response.previousVersion} → ${response.newVersion}`);
190
+ }
191
+ }
192
+ // Brief pause between updates
193
+ await new Promise(r => setTimeout(r, 2000));
194
+ }
195
+ catch (err) {
196
+ results.push({
197
+ hostname: info.agent.hostname,
198
+ success: false,
199
+ message: err instanceof Error ? err.message : String(err),
200
+ });
201
+ if (!options.json) {
202
+ console.log(`\x1b[31m✗\x1b[0m ${err instanceof Error ? err.message : String(err)}`);
203
+ }
204
+ }
205
+ }
206
+ // Summary
207
+ const successCount = results.filter(r => r.success).length;
208
+ if (options.json) {
209
+ output.json({
210
+ updated: successCount,
211
+ failed: results.length - successCount,
212
+ results,
213
+ });
214
+ }
215
+ else {
216
+ console.log();
217
+ console.log(`Updated ${successCount} of ${results.length} agent(s)`);
218
+ if (successCount > 0) {
219
+ console.log('\x1b[33mNote: Agents are restarting. Allow 30-60 seconds for them to come back online.\x1b[0m');
220
+ }
221
+ }
222
+ }
223
+ catch (err) {
224
+ spinner.fail('Failed to fetch agents');
225
+ output.error(err instanceof Error ? err.message : String(err));
226
+ process.exit(1);
227
+ }
228
+ finally {
229
+ await mode.closeLocalClient();
230
+ }
231
+ });
232
+ }
233
+ //# sourceMappingURL=update-all.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-all.js","sourceRoot":"","sources":["../../../../src/commands/agent/direct/update-all.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAOhD,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,eAAe,CAAC;AAYvB,MAAM,UAAU,wBAAwB,CAAC,SAAkB;IACzD,SAAS;SACN,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,0BAA0B,CAAC;SACvC,MAAM,CAAC,WAAW,EAAE,iCAAiC,CAAC;SACtD,MAAM,CAAC,mBAAmB,EAAE,oCAAoC,CAAC;SACjE,MAAM,CAAC,WAAW,EAAE,mDAAmD,CAAC;SACxE,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAAC;SACxC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,OAAyB,EAAE,EAAE;QAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,2BAA2B,CAAC,CAAC,KAAK,EAAE,CAAC;QAEzD,IAAI,CAAC;YACH,qBAAqB;YACrB,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;YACrC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC/B,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,KAA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AAM,CAAC;YAE3D,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACjB,MAAM,CAAC,IAAI,CAAC;oBACV,OAAO,EAAE,YAAY;oBACrB,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,YAAY;oBACrC,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,WAAW,YAAY,OAAO,OAAO,CAAC,MAAM,WAAW,CAAC,CAAC;gBACrE,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;oBACrB,OAAO,CAAC,GAAG,CAAC,+FAA+F,CAAC,CAAC;gBAC/G,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YACvC,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Agent update-plugins command - trigger plugin updates on an agent
3
+ */
4
+ import type { Command } from 'commander';
5
+ export declare function registerUpdatePluginsCommand(parentCmd: Command): void;
6
+ //# sourceMappingURL=update-plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-plugins.d.ts","sourceRoot":"","sources":["../../../../src/commands/agent/direct/update-plugins.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA4FrE"}
@@ -0,0 +1,91 @@
1
+ // Path: src/commands/agent/direct/update-plugins.ts
2
+ import ora from 'ora';
3
+ import * as output from '../../../lib/output.js';
4
+ import { resolveHostPort, fetchPluginVersions, triggerPluginUpdate, confirmAction, waitForAgentRestart, } from '../helpers.js';
5
+ export function registerUpdatePluginsCommand(parentCmd) {
6
+ parentCmd
7
+ .command('update-plugins [hostPort]')
8
+ .description('Trigger plugin updates on an agent (format: host:port or host, or select from list)')
9
+ .option('-y, --yes', 'Skip confirmation prompt')
10
+ .option('--json', 'Output as JSON')
11
+ .action(async (hostPort, options) => {
12
+ const resolved = await resolveHostPort(hostPort);
13
+ if (!resolved) {
14
+ process.exit(1);
15
+ }
16
+ const { host, port } = resolved;
17
+ // First check what needs updating
18
+ const checkSpinner = ora(`Checking plugins at ${host}:${port}...`).start();
19
+ let versions;
20
+ try {
21
+ versions = await fetchPluginVersions(host, port);
22
+ checkSpinner.stop();
23
+ }
24
+ catch (err) {
25
+ checkSpinner.fail(`Failed to check plugins at ${host}:${port}`);
26
+ output.error(err instanceof Error ? err.message : String(err));
27
+ process.exit(1);
28
+ }
29
+ if (!versions.hasUpdates) {
30
+ if (options.json) {
31
+ output.json({ updated: 0, message: 'All plugins up to date' });
32
+ }
33
+ else {
34
+ console.log('\x1b[32m✓\x1b[0m All plugins are up to date');
35
+ }
36
+ return;
37
+ }
38
+ // Show what will be updated
39
+ if (!options.json) {
40
+ console.log();
41
+ console.log('Updates available:');
42
+ for (const plugin of versions.versions) {
43
+ if (plugin.updateAvailable) {
44
+ console.log(` ${plugin.package}: ${plugin.current} → \x1b[32m${plugin.latest}\x1b[0m`);
45
+ }
46
+ }
47
+ console.log();
48
+ }
49
+ // Confirm
50
+ if (!options.yes && !options.json) {
51
+ const confirmed = await confirmAction('Proceed with update? Agent will restart.');
52
+ if (!confirmed) {
53
+ console.log('Cancelled');
54
+ return;
55
+ }
56
+ }
57
+ // Trigger update
58
+ const updateSpinner = ora('Updating plugins...').start();
59
+ try {
60
+ const response = await triggerPluginUpdate(host, port);
61
+ updateSpinner.stop();
62
+ if (options.json) {
63
+ output.json(response);
64
+ return;
65
+ }
66
+ if (response.updated === 0) {
67
+ console.log('No updates were applied');
68
+ return;
69
+ }
70
+ console.log(`\x1b[32m✓\x1b[0m Updated ${response.updated} plugin(s)`);
71
+ for (const result of response.results) {
72
+ if (result.success) {
73
+ console.log(` ${result.package}: ${result.previousVersion} → ${result.newVersion}`);
74
+ }
75
+ else {
76
+ console.log(` \x1b[31m✗\x1b[0m ${result.package}: ${result.error}`);
77
+ }
78
+ }
79
+ if (response.willRestart) {
80
+ console.log();
81
+ await waitForAgentRestart(host, port);
82
+ }
83
+ }
84
+ catch (err) {
85
+ updateSpinner.fail('Failed to update plugins');
86
+ output.error(err instanceof Error ? err.message : String(err));
87
+ process.exit(1);
88
+ }
89
+ });
90
+ }
91
+ //# sourceMappingURL=update-plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-plugins.js","sourceRoot":"","sources":["../../../../src/commands/agent/direct/update-plugins.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAOpD,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,4BAA4B,CAAC,SAAkB;IAC7D,SAAS;SACN,OAAO,CAAC,2BAA2B,CAAC;SACpC,WAAW,CAAC,qFAAqF,CAAC;SAClG,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC;SAC/C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,QAA4B,EAAE,OAA6B,EAAE,EAAE;QAC5E,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,C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MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;gBACvF,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,GAAG,CAAC,sBAAsB,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;gBACvE,CAAC;YACH,CAAC;YAED,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;gBACzB,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,aAAa,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAC/C,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Agent update command - trigger agent self-update
3
+ */
4
+ import type { Command } from 'commander';
5
+ export declare function registerUpdateCommand(parentCmd: Command): void;
6
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/commands/agent/direct/update.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CA4F9D"}