@alwaysai/device-agent 1.4.0 → 1.5.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 (139) hide show
  1. package/lib/application-control/config.js +2 -2
  2. package/lib/application-control/config.js.map +1 -1
  3. package/lib/application-control/install.d.ts.map +1 -1
  4. package/lib/application-control/install.js +1 -0
  5. package/lib/application-control/install.js.map +1 -1
  6. package/lib/application-control/models.d.ts +5 -0
  7. package/lib/application-control/models.d.ts.map +1 -1
  8. package/lib/application-control/models.js +24 -12
  9. package/lib/application-control/models.js.map +1 -1
  10. package/lib/application-control/status.d.ts.map +1 -1
  11. package/lib/application-control/status.js +10 -12
  12. package/lib/application-control/status.js.map +1 -1
  13. package/lib/application-control/utils.js +2 -2
  14. package/lib/application-control/utils.js.map +1 -1
  15. package/lib/cloud-connection/device-agent-cloud-connection.d.ts +2 -2
  16. package/lib/cloud-connection/device-agent-cloud-connection.d.ts.map +1 -1
  17. package/lib/cloud-connection/device-agent-cloud-connection.js +35 -15
  18. package/lib/cloud-connection/device-agent-cloud-connection.js.map +1 -1
  19. package/lib/cloud-connection/live-updates-handler.d.ts +3 -2
  20. package/lib/cloud-connection/live-updates-handler.d.ts.map +1 -1
  21. package/lib/cloud-connection/live-updates-handler.js +24 -21
  22. package/lib/cloud-connection/live-updates-handler.js.map +1 -1
  23. package/lib/cloud-connection/live-updates-handler.test.js +132 -16
  24. package/lib/cloud-connection/live-updates-handler.test.js.map +1 -1
  25. package/lib/cloud-connection/passthrough-handler.d.ts +5 -3
  26. package/lib/cloud-connection/passthrough-handler.d.ts.map +1 -1
  27. package/lib/cloud-connection/passthrough-handler.js +76 -62
  28. package/lib/cloud-connection/passthrough-handler.js.map +1 -1
  29. package/lib/cloud-connection/shadow-handler.d.ts +2 -0
  30. package/lib/cloud-connection/shadow-handler.d.ts.map +1 -1
  31. package/lib/cloud-connection/shadow-handler.js +5 -5
  32. package/lib/cloud-connection/shadow-handler.js.map +1 -1
  33. package/lib/cloud-connection/transaction-manager.d.ts +3 -0
  34. package/lib/cloud-connection/transaction-manager.d.ts.map +1 -1
  35. package/lib/cloud-connection/transaction-manager.js +11 -0
  36. package/lib/cloud-connection/transaction-manager.js.map +1 -1
  37. package/lib/cloud-connection/transaction-manager.test.js +102 -0
  38. package/lib/cloud-connection/transaction-manager.test.js.map +1 -1
  39. package/lib/device-control/device-control.d.ts +10 -2
  40. package/lib/device-control/device-control.d.ts.map +1 -1
  41. package/lib/device-control/device-control.js +86 -10
  42. package/lib/device-control/device-control.js.map +1 -1
  43. package/lib/docker/docker-compose.d.ts +14 -0
  44. package/lib/docker/docker-compose.d.ts.map +1 -0
  45. package/lib/docker/docker-compose.js +56 -0
  46. package/lib/docker/docker-compose.js.map +1 -0
  47. package/lib/index.js +2 -5
  48. package/lib/index.js.map +1 -1
  49. package/lib/infrastructure/agent-config.d.ts +45 -14
  50. package/lib/infrastructure/agent-config.d.ts.map +1 -1
  51. package/lib/infrastructure/agent-config.js +30 -15
  52. package/lib/infrastructure/agent-config.js.map +1 -1
  53. package/lib/infrastructure/agent-config.test.js +3 -0
  54. package/lib/infrastructure/agent-config.test.js.map +1 -1
  55. package/lib/local-connection/rabbitmq-connection.js +11 -11
  56. package/lib/local-connection/rabbitmq-connection.js.map +1 -1
  57. package/lib/secure-tunneling/secure-tunneling.d.ts +14 -22
  58. package/lib/secure-tunneling/secure-tunneling.d.ts.map +1 -1
  59. package/lib/secure-tunneling/secure-tunneling.js +34 -34
  60. package/lib/secure-tunneling/secure-tunneling.js.map +1 -1
  61. package/lib/secure-tunneling/secure-tunneling.test.js +18 -18
  62. package/lib/secure-tunneling/secure-tunneling.test.js.map +1 -1
  63. package/lib/subcommands/device/clean.js +5 -5
  64. package/lib/subcommands/device/clean.js.map +1 -1
  65. package/lib/subcommands/device/get-info.d.ts +2 -0
  66. package/lib/subcommands/device/get-info.d.ts.map +1 -0
  67. package/lib/subcommands/device/get-info.js +36 -0
  68. package/lib/subcommands/device/get-info.js.map +1 -0
  69. package/lib/subcommands/device/index.d.ts.map +1 -1
  70. package/lib/subcommands/device/index.js +11 -2
  71. package/lib/subcommands/device/index.js.map +1 -1
  72. package/lib/subcommands/device/init.d.ts +5 -0
  73. package/lib/subcommands/device/init.d.ts.map +1 -0
  74. package/lib/subcommands/device/{device.js → init.js} +2 -41
  75. package/lib/subcommands/device/init.js.map +1 -0
  76. package/lib/subcommands/device/refresh.d.ts +2 -0
  77. package/lib/subcommands/device/refresh.d.ts.map +1 -0
  78. package/lib/subcommands/device/refresh.js +24 -0
  79. package/lib/subcommands/device/refresh.js.map +1 -0
  80. package/lib/subcommands/device/restart.d.ts +2 -0
  81. package/lib/subcommands/device/restart.d.ts.map +1 -0
  82. package/lib/subcommands/device/restart.js +14 -0
  83. package/lib/subcommands/device/restart.js.map +1 -0
  84. package/lib/util/check-for-updates.d.ts +3 -0
  85. package/lib/util/check-for-updates.d.ts.map +1 -0
  86. package/lib/util/check-for-updates.js +69 -0
  87. package/lib/util/check-for-updates.js.map +1 -0
  88. package/lib/util/file.d.ts +7 -0
  89. package/lib/util/file.d.ts.map +1 -0
  90. package/lib/util/file.js +66 -0
  91. package/lib/util/file.js.map +1 -0
  92. package/lib/util/file.test.d.ts +2 -0
  93. package/lib/util/file.test.d.ts.map +1 -0
  94. package/lib/util/file.test.js +87 -0
  95. package/lib/util/file.test.js.map +1 -0
  96. package/package.json +8 -7
  97. package/readme.md +3 -3
  98. package/src/application-control/config.ts +1 -1
  99. package/src/application-control/install.ts +1 -0
  100. package/src/application-control/models.ts +36 -13
  101. package/src/application-control/status.ts +9 -7
  102. package/src/application-control/utils.ts +1 -1
  103. package/src/cloud-connection/device-agent-cloud-connection.ts +54 -30
  104. package/src/cloud-connection/live-updates-handler.test.ts +161 -20
  105. package/src/cloud-connection/live-updates-handler.ts +30 -26
  106. package/src/cloud-connection/passthrough-handler.ts +98 -76
  107. package/src/cloud-connection/shadow-handler.ts +19 -7
  108. package/src/cloud-connection/transaction-manager.test.ts +124 -0
  109. package/src/cloud-connection/transaction-manager.ts +15 -0
  110. package/src/device-control/device-control.ts +86 -11
  111. package/src/docker/docker-compose.ts +60 -0
  112. package/src/index.ts +2 -6
  113. package/src/infrastructure/agent-config.test.ts +3 -0
  114. package/src/infrastructure/agent-config.ts +38 -40
  115. package/src/local-connection/rabbitmq-connection.ts +8 -8
  116. package/src/secure-tunneling/secure-tunneling.test.ts +26 -26
  117. package/src/secure-tunneling/secure-tunneling.ts +48 -55
  118. package/src/subcommands/device/clean.ts +1 -1
  119. package/src/subcommands/device/get-info.ts +49 -0
  120. package/src/subcommands/device/index.ts +11 -2
  121. package/src/subcommands/device/{device.ts → init.ts} +0 -58
  122. package/src/subcommands/device/refresh.ts +22 -0
  123. package/src/subcommands/device/restart.ts +11 -0
  124. package/src/util/check-for-updates.ts +69 -0
  125. package/src/util/file.test.ts +90 -0
  126. package/src/util/file.ts +76 -0
  127. package/lib/docker/docker-compose-cmd.d.ts +0 -5
  128. package/lib/docker/docker-compose-cmd.d.ts.map +0 -1
  129. package/lib/docker/docker-compose-cmd.js +0 -16
  130. package/lib/docker/docker-compose-cmd.js.map +0 -1
  131. package/lib/subcommands/device/device.d.ts +0 -7
  132. package/lib/subcommands/device/device.d.ts.map +0 -1
  133. package/lib/subcommands/device/device.js.map +0 -1
  134. package/lib/util/safe-rimraf.d.ts +0 -2
  135. package/lib/util/safe-rimraf.d.ts.map +0 -1
  136. package/lib/util/safe-rimraf.js +0 -16
  137. package/lib/util/safe-rimraf.js.map +0 -1
  138. package/src/docker/docker-compose-cmd.ts +0 -15
  139. package/src/util/safe-rimraf.ts +0 -14
@@ -11,13 +11,6 @@ import {
11
11
  } from '../../util/directories';
12
12
 
13
13
  import { JsSpawner } from 'alwaysai/lib/util';
14
- import {
15
- getCpuDetails,
16
- getDiskDetails,
17
- getMemDetails,
18
- getSystemInformation,
19
- reboot
20
- } from '../../device-control/device-control';
21
14
  import { writeTokenAndDeviceCfg } from '../../infrastructure/tokens-and-device-cfg';
22
15
  import { logger } from '../../util/logger';
23
16
  import { DeviceConfigFile } from 'alwaysai/lib/core/device';
@@ -106,54 +99,3 @@ export const initCliLeaf = CliLeaf({
106
99
  logger.info(`Initialized device ${name}: UUID=${response.deviceUuid}`);
107
100
  }
108
101
  });
109
-
110
- export const getInfoCliLeaf = CliLeaf({
111
- name: 'get-info',
112
- description: 'Get device info',
113
- namedInputs: {},
114
- async action(_, opts) {
115
- const cpuDetails = await getCpuDetails();
116
- const diskDetails = await getDiskDetails();
117
- const memDetails = await getMemDetails();
118
- const out = {
119
- 'CPU Utilization': `${
120
- cpuDetails?.usedPerc && cpuDetails.temperature
121
- ? `Used ${cpuDetails?.usedPerc?.toFixed(2)}%, Temperature ${
122
- cpuDetails?.temperature
123
- } °C`
124
- : 'Unavailable'
125
- }`,
126
- 'Disk Utilization': `${
127
- diskDetails?.usedGb && diskDetails.freeGb
128
- ? `${diskDetails?.usedGb} GB / ${
129
- diskDetails?.usedGb + diskDetails?.freeGb
130
- } GB`
131
- : 'Unavailable'
132
- }`,
133
- 'Memory Utilization': `${
134
- memDetails?.usedMb && memDetails.freeMb
135
- ? `${memDetails.usedMb} MB / ${
136
- memDetails.usedMb + memDetails.freeMb
137
- } MB`
138
- : 'Unavailable'
139
- }`
140
- };
141
- console.table(out);
142
- const systemInfo = await getSystemInformation();
143
- console.table(systemInfo.os);
144
- console.table(systemInfo.cpu);
145
- console.table(systemInfo.disk?.drives);
146
- console.table(systemInfo.device);
147
- console.table(systemInfo.network);
148
- console.table(systemInfo.versions);
149
- }
150
- });
151
-
152
- export const restartCliLeaf = CliLeaf({
153
- name: 'restart',
154
- description: 'Restart the device',
155
- namedInputs: {},
156
- async action(_, opts) {
157
- await reboot();
158
- }
159
- });
@@ -0,0 +1,22 @@
1
+ import { CliLeaf, CliTerseError } from '@alwaysai/alwayscli';
2
+ import { writeTokenAndDeviceCfg } from '../../infrastructure/tokens-and-device-cfg';
3
+ import { logger } from '../../util/logger';
4
+ import { DeviceConfigFile } from 'alwaysai/lib/core/device';
5
+
6
+ export const refreshCliLeaf = CliLeaf({
7
+ name: 'refresh',
8
+ description: 'Refresh the device tokens',
9
+ namedInputs: {},
10
+ async action(_, opts) {
11
+ logger.info(`Refreshing device tokens`);
12
+ const cfg = DeviceConfigFile().readIfExists();
13
+ if (cfg === undefined) {
14
+ throw new CliTerseError('Configuration not found on current device!');
15
+ }
16
+ const deviceUuid = cfg.deviceUuid;
17
+
18
+ await writeTokenAndDeviceCfg({
19
+ deviceUuid
20
+ });
21
+ }
22
+ });
@@ -0,0 +1,11 @@
1
+ import { CliLeaf } from '@alwaysai/alwayscli';
2
+ import { reboot } from '../../device-control/device-control';
3
+
4
+ export const restartCliLeaf = CliLeaf({
5
+ name: 'restart',
6
+ description: 'Restart the device',
7
+ namedInputs: {},
8
+ async action(_, opts) {
9
+ await reboot();
10
+ }
11
+ });
@@ -0,0 +1,69 @@
1
+ import { logger } from '../util/logger';
2
+ import { JsSpawner } from 'alwaysai/lib/util';
3
+ import * as path from 'path';
4
+ import { get } from 'https';
5
+
6
+ const appPrompt =
7
+ 'Please restart the Device Agent or reboot the device to update. ';
8
+ const updatePrompt = `A new version of the Device Agent is available! \n\n`;
9
+
10
+ function getLatestVersion(packageName: string): Promise<string> {
11
+ return new Promise<string>((resolve, reject) => {
12
+ const url = `https://registry.npmjs.org/${packageName}/latest`;
13
+
14
+ get(url, (res) => {
15
+ let data = '';
16
+ res.on('data', (chunk) => {
17
+ data += chunk;
18
+ });
19
+ res.on('end', () => {
20
+ try {
21
+ const latestPackage = JSON.parse(data);
22
+ resolve(latestPackage.version);
23
+ } catch (error) {
24
+ reject(error);
25
+ }
26
+ });
27
+ }).on('error', (error) => {
28
+ reject(error);
29
+ });
30
+ });
31
+ }
32
+
33
+ export async function getDeviceAgentVersion(): Promise<string> {
34
+ let daVersion = '';
35
+ try {
36
+ const packagePath = path.join(__dirname, '../../');
37
+ const spawner = JsSpawner({ path: packagePath });
38
+ const output = await spawner.readFile('package.json');
39
+ const parsed = JSON.parse(output);
40
+ daVersion = parsed.version;
41
+ } catch (e) {
42
+ logger.error(`Could not retrieve the Device Agent version: $ {e}`);
43
+ }
44
+ return daVersion;
45
+ }
46
+
47
+ function constructPrompt(props: { currentVer: string; latestVer: string }) {
48
+ const { currentVer, latestVer } = props;
49
+ const prompt = `${updatePrompt}${appPrompt}\nYour version: ${currentVer}. Newest version: ${latestVer}`;
50
+ return prompt;
51
+ }
52
+
53
+ export async function checkForUpdatesAndPrompt() {
54
+ try {
55
+ logger.debug('Checking for updates...');
56
+ const latestVersion = await getLatestVersion('@alwaysai/device-agent');
57
+ const version = await getDeviceAgentVersion();
58
+ if (version !== latestVersion) {
59
+ logger.warn(
60
+ constructPrompt({
61
+ currentVer: version,
62
+ latestVer: latestVersion
63
+ })
64
+ );
65
+ }
66
+ } catch (error) {
67
+ logger.error(`Could not check for updates: ${error}`);
68
+ }
69
+ }
@@ -0,0 +1,90 @@
1
+ import { pruneDir } from '../../src/util/file';
2
+ import { readdir, stat, rmdir, unlink } from 'fs/promises';
3
+
4
+ jest.mock('fs/promises');
5
+
6
+ describe('pruneDir function', () => {
7
+ afterEach(() => {
8
+ jest.clearAllMocks();
9
+ });
10
+
11
+ it('should return true if directory is successfully pruned', async () => {
12
+ const path = '/path/to/directory';
13
+ const files = ['file1.txt', 'file2.txt'];
14
+ (readdir as jest.Mock).mockResolvedValue(files);
15
+ (stat as jest.Mock).mockResolvedValue({ isDirectory: () => false });
16
+
17
+ const result = await pruneDir({ path });
18
+
19
+ expect(result).toBe(true);
20
+ expect(readdir).toHaveBeenCalledWith(path);
21
+ expect(stat).toHaveBeenCalledTimes(2); // Called for each file
22
+ expect(unlink).toHaveBeenCalledTimes(2); // Called for each file
23
+ });
24
+
25
+ it('should exclude specified files from pruning', async () => {
26
+ const path = '/path/to/directory';
27
+ const files = ['file1.txt', 'file2.txt'];
28
+ const exclude = ['file1.txt']; // Exclude file1.txt
29
+ (readdir as jest.Mock).mockResolvedValue(files);
30
+ (stat as jest.Mock).mockResolvedValue({ isDirectory: () => false });
31
+
32
+ const result = await pruneDir({ path, exclude });
33
+
34
+ expect(result).toBe(false);
35
+ expect(readdir).toHaveBeenCalledWith(path);
36
+ expect(stat).toHaveBeenCalledTimes(1); // Called only for file2.txt
37
+ expect(unlink).toHaveBeenCalledTimes(1); // Called only for file2.txt
38
+ });
39
+
40
+ it('should recursively prune directories if recurse option is true', async () => {
41
+ const rootPath = '/path/to/directory';
42
+ const subDirPath = '/path/to/directory/subdir';
43
+ const files = ['file1.txt', 'subdir'];
44
+ const subDirFiles = ['file2.txt'];
45
+ (readdir as jest.Mock).mockImplementation((path) => {
46
+ if (path === rootPath) return files;
47
+ if (path === subDirPath) return subDirFiles;
48
+ });
49
+ (stat as jest.Mock).mockImplementation((path) => {
50
+ if (path === `${rootPath}/file1.txt`) return { isDirectory: () => false };
51
+ if (path === subDirPath) return { isDirectory: () => true };
52
+ if (path === `${subDirPath}/file2.txt`)
53
+ return { isDirectory: () => false };
54
+ });
55
+
56
+ const result = await pruneDir({ path: rootPath, recurse: true });
57
+
58
+ expect(result).toBe(true);
59
+ expect(readdir).toHaveBeenCalledWith(rootPath);
60
+ expect(readdir).toHaveBeenCalledWith(subDirPath);
61
+ expect(stat).toHaveBeenCalledTimes(3); // Called for file1.txt, subdir, and file2.txt
62
+ expect(unlink).toHaveBeenCalledWith(`${rootPath}/file1.txt`);
63
+ expect(unlink).toHaveBeenCalledWith(`${subDirPath}/file2.txt`);
64
+ expect(rmdir).toHaveBeenCalledWith(subDirPath);
65
+ });
66
+
67
+ it('should not recurse into directories if recurse option is false', async () => {
68
+ const rootPath = '/path/to/directory';
69
+ const subDirPath = '/path/to/directory/subdir';
70
+ const files = ['file1.txt', 'subdir'];
71
+ const subDirFiles = ['file2.txt'];
72
+ (readdir as jest.Mock).mockImplementation((path) => {
73
+ if (path === rootPath) return files;
74
+ if (path === subDirPath) return subDirFiles;
75
+ });
76
+ (stat as jest.Mock).mockImplementation((path) => {
77
+ if (path === `${rootPath}/file1.txt`) return { isDirectory: () => false };
78
+ if (path === subDirPath) return { isDirectory: () => true };
79
+ });
80
+
81
+ const result = await pruneDir({ path: rootPath, recurse: false });
82
+
83
+ expect(result).toBe(true);
84
+ expect(readdir).toHaveBeenCalledWith(rootPath);
85
+ expect(stat).toHaveBeenCalledTimes(2); // Called for file1.txt and subdir
86
+ expect(unlink).toHaveBeenCalledWith(`${rootPath}/file1.txt`);
87
+ expect(unlink).not.toHaveBeenCalledWith(`${subDirPath}/file2.txt`);
88
+ expect(rmdir).not.toHaveBeenCalled();
89
+ });
90
+ });
@@ -0,0 +1,76 @@
1
+ import { rimraf } from 'rimraf';
2
+ import { logger } from '../util/logger';
3
+ import { readdir, stat, unlink, rmdir } from 'fs/promises';
4
+ import { join } from 'path';
5
+
6
+ export async function safeRimraf(path: string) {
7
+ logger.debug(`Removing ${path}`);
8
+ try {
9
+ await rimraf(path);
10
+ } catch (e) {
11
+ logger.error(
12
+ `Failed to remove ${path}. Please manually delete the file or directory.`
13
+ );
14
+ logger.debug(`Error removing ${path}: ${e}`);
15
+ }
16
+ }
17
+
18
+ export async function pruneDir({
19
+ path,
20
+ exclude,
21
+ recurse
22
+ }: {
23
+ path: string;
24
+ exclude?: string[];
25
+ recurse?: boolean;
26
+ }) {
27
+ /**
28
+ * Deletes all files and directories in a given directory path, excluding specific paths.
29
+ * Will not delete top-level directory
30
+ * @param {string} path path of directory to prune.
31
+ * @param {string[]} exclude list of paths to exclude when pruning
32
+ * @param {boolean} recurse flag to prune recursively into directories
33
+ */
34
+ try {
35
+ const files = await readdir(path);
36
+
37
+ let canPruneParent = true;
38
+
39
+ for (const file of files) {
40
+ const filePath = join(path, file);
41
+
42
+ const isExcluded = exclude?.some((excludePath) =>
43
+ filePath.endsWith(excludePath)
44
+ );
45
+
46
+ if (isExcluded) {
47
+ logger.debug(`Excluding file ${filePath} during pruning.`);
48
+ canPruneParent = false;
49
+ continue;
50
+ }
51
+
52
+ const fileStats = await stat(filePath);
53
+ if (fileStats.isDirectory()) {
54
+ if (recurse) {
55
+ const dirIsEmpty = await pruneDir({
56
+ path: filePath,
57
+ exclude,
58
+ recurse
59
+ });
60
+
61
+ if (dirIsEmpty) {
62
+ await rmdir(filePath);
63
+ } else {
64
+ canPruneParent = false;
65
+ }
66
+ }
67
+ } else {
68
+ await unlink(filePath);
69
+ }
70
+ }
71
+ return canPruneParent;
72
+ } catch (error) {
73
+ logger.error(`Error pruning directory ${path}: ${JSON.stringify(error)}`);
74
+ return false;
75
+ }
76
+ }
@@ -1,5 +0,0 @@
1
- export declare function runDockerComposeCmd(props: {
2
- args: string[];
3
- dir: string;
4
- }): Promise<string>;
5
- //# sourceMappingURL=docker-compose-cmd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docker-compose-cmd.d.ts","sourceRoot":"","sources":["../../src/docker/docker-compose-cmd.ts"],"names":[],"mappings":"AAEA,wBAAsB,mBAAmB,CAAC,KAAK,EAAE;IAC/C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,mBASA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runDockerComposeCmd = void 0;
4
- const util_1 = require("alwaysai/lib/util");
5
- async function runDockerComposeCmd(props) {
6
- const { args, dir } = props;
7
- const spawner = (0, util_1.JsSpawner)();
8
- const output = await spawner.run({
9
- exe: 'docker-compose',
10
- args,
11
- cwd: dir
12
- });
13
- return output;
14
- }
15
- exports.runDockerComposeCmd = runDockerComposeCmd;
16
- //# sourceMappingURL=docker-compose-cmd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docker-compose-cmd.js","sourceRoot":"","sources":["../../src/docker/docker-compose-cmd.ts"],"names":[],"mappings":";;;AAAA,4CAA8C;AAEvC,KAAK,UAAU,mBAAmB,CAAC,KAGzC;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAA,gBAAS,GAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/B,GAAG,EAAE,gBAAgB;QACrB,IAAI;QACJ,GAAG,EAAE,GAAG;KACT,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,kDAYC"}
@@ -1,7 +0,0 @@
1
- export declare const initCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, {
2
- name: import("@alwaysai/alwayscli").CliInput<string | undefined, false>;
3
- description: import("@alwaysai/alwayscli").CliInput<string | undefined, false>;
4
- }, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
5
- export declare const getInfoCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, {}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
6
- export declare const restartCliLeaf: import("@alwaysai/alwayscli/lib/types").CliLeaf<import("@alwaysai/alwayscli").CliInput<undefined, false>, {}, import("@alwaysai/alwayscli").CliInput<undefined, false>>;
7
- //# sourceMappingURL=device.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../src/subcommands/device/device.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,WAAW;;;4DAiFtB,CAAC;AAEH,eAAO,MAAM,cAAc,yKAwCzB,CAAC;AAEH,eAAO,MAAM,cAAc,yKAOzB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"device.js","sourceRoot":"","sources":["../../../src/subcommands/device/device.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAC9D,+CAA8D;AAC9D,+BAAoC;AACpC,gEAAsE;AACtE,2BAAgC;AAChC,wDAA4E;AAC5E,wDAIgC;AAEhC,4CAA8C;AAC9C,wEAM6C;AAC7C,sFAAoF;AACpF,8CAA2C;AAC3C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AAC,EAAE,CAAC,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,MAAA,UAAU,CAAC,IAAI,0CAAE,MAAM,CAAC,CAAC;QACvC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,IAAA,mBAAO,EAAC;IACpC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,EAAE;IACf,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI;QAClB,MAAM,IAAA,uBAAM,GAAE,CAAC;IACjB,CAAC;CACF,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export default function safeRimraf(path: string): Promise<void>;
2
- //# sourceMappingURL=safe-rimraf.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"safe-rimraf.d.ts","sourceRoot":"","sources":["../../src/util/safe-rimraf.ts"],"names":[],"mappings":"AAGA,wBAA8B,UAAU,CAAC,IAAI,EAAE,MAAM,iBAUpD"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const rimraf_1 = require("rimraf");
4
- const logger_1 = require("../util/logger");
5
- async function safeRimraf(path) {
6
- logger_1.logger.debug(`Removing ${path}`);
7
- try {
8
- await (0, rimraf_1.rimraf)(path);
9
- }
10
- catch (e) {
11
- logger_1.logger.error(`Failed to remove ${path}. Please manually delete the file or directory.`);
12
- logger_1.logger.debug(`Error removing ${path}: ${e}`);
13
- }
14
- }
15
- exports.default = safeRimraf;
16
- //# sourceMappingURL=safe-rimraf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"safe-rimraf.js","sourceRoot":"","sources":["../../src/util/safe-rimraf.ts"],"names":[],"mappings":";;AAAA,mCAAgC;AAChC,2CAAwC;AAEzB,KAAK,UAAU,UAAU,CAAC,IAAY;IACnD,eAAM,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IACjC,IAAI;QACF,MAAM,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC;KACpB;IAAC,OAAO,CAAC,EAAE;QACV,eAAM,CAAC,KAAK,CACV,oBAAoB,IAAI,iDAAiD,CAC1E,CAAC;QACF,eAAM,CAAC,KAAK,CAAC,kBAAkB,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;KAC9C;AACH,CAAC;AAVD,6BAUC"}
@@ -1,15 +0,0 @@
1
- import { JsSpawner } from 'alwaysai/lib/util';
2
-
3
- export async function runDockerComposeCmd(props: {
4
- args: string[];
5
- dir: string;
6
- }) {
7
- const { args, dir } = props;
8
- const spawner = JsSpawner();
9
- const output = await spawner.run({
10
- exe: 'docker-compose',
11
- args,
12
- cwd: dir
13
- });
14
- return output;
15
- }
@@ -1,14 +0,0 @@
1
- import { rimraf } from 'rimraf';
2
- import { logger } from '../util/logger';
3
-
4
- export default async function safeRimraf(path: string) {
5
- logger.debug(`Removing ${path}`);
6
- try {
7
- await rimraf(path);
8
- } catch (e) {
9
- logger.error(
10
- `Failed to remove ${path}. Please manually delete the file or directory.`
11
- );
12
- logger.debug(`Error removing ${path}: ${e}`);
13
- }
14
- }