@alwaysai/device-agent 0.0.9 → 0.0.11-internal
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/lib/application-control/backup.d.ts.map +1 -1
- package/lib/application-control/backup.js +4 -3
- package/lib/application-control/backup.js.map +1 -1
- package/lib/application-control/install.d.ts.map +1 -1
- package/lib/application-control/install.js +6 -5
- package/lib/application-control/install.js.map +1 -1
- package/lib/application-control/models.d.ts.map +1 -1
- package/lib/application-control/models.js +3 -2
- package/lib/application-control/models.js.map +1 -1
- package/lib/application-control/status.d.ts.map +1 -1
- package/lib/application-control/status.js +6 -5
- package/lib/application-control/status.js.map +1 -1
- package/lib/application-control/utils.d.ts.map +1 -1
- package/lib/application-control/utils.js +3 -2
- package/lib/application-control/utils.js.map +1 -1
- package/lib/cloud-connection/device-agent-cloud-connection.d.ts +0 -1
- package/lib/cloud-connection/device-agent-cloud-connection.d.ts.map +1 -1
- package/lib/cloud-connection/device-agent-cloud-connection.js +20 -21
- package/lib/cloud-connection/device-agent-cloud-connection.js.map +1 -1
- package/lib/environment.d.ts +1 -0
- package/lib/environment.d.ts.map +1 -1
- package/lib/environment.js +2 -1
- package/lib/environment.js.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/infrastructure/certificates-and-tokens.d.ts.map +1 -1
- package/lib/infrastructure/certificates-and-tokens.js +3 -2
- package/lib/infrastructure/certificates-and-tokens.js.map +1 -1
- package/lib/subcommands/app/app.d.ts.map +1 -1
- package/lib/subcommands/app/app.js +6 -5
- package/lib/subcommands/app/app.js.map +1 -1
- package/lib/subcommands/device/device.d.ts.map +1 -1
- package/lib/subcommands/device/device.js +3 -2
- package/lib/subcommands/device/device.js.map +1 -1
- package/lib/subcommands/get-model-package.d.ts.map +1 -1
- package/lib/subcommands/get-model-package.js +2 -1
- package/lib/subcommands/get-model-package.js.map +1 -1
- package/lib/util/logger.d.ts +4 -0
- package/lib/util/logger.d.ts.map +1 -0
- package/lib/util/logger.js +25 -0
- package/lib/util/logger.js.map +1 -0
- package/package.json +3 -2
- package/src/application-control/backup.ts +4 -3
- package/src/application-control/install.ts +6 -5
- package/src/application-control/models.ts +4 -3
- package/src/application-control/status.ts +6 -5
- package/src/application-control/utils.ts +3 -2
- package/src/cloud-connection/device-agent-cloud-connection.ts +15 -12
- package/src/environment.ts +1 -0
- package/src/index.ts +2 -1
- package/src/infrastructure/certificates-and-tokens.ts +3 -2
- package/src/subcommands/app/app.ts +6 -5
- package/src/subcommands/device/device.ts +3 -2
- package/src/subcommands/get-model-package.ts +2 -1
- package/src/util/logger.ts +28 -0
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
updateModels,
|
|
25
25
|
} from '../../application-control';
|
|
26
26
|
import { AgentConfigFile } from '../../infrastructure/agent-config';
|
|
27
|
+
import { logger } from '../../util/logger';
|
|
27
28
|
|
|
28
29
|
export const listAppsCliLeaf = CliLeaf({
|
|
29
30
|
name: 'list',
|
|
@@ -47,7 +48,7 @@ export const listAppReleasesCliLeaf = CliLeaf({
|
|
|
47
48
|
async action(_, opts) {
|
|
48
49
|
const { project } = opts;
|
|
49
50
|
const releaseHistory = await listAppReleases({ projectId: project });
|
|
50
|
-
|
|
51
|
+
logger.info(releaseHistory);
|
|
51
52
|
},
|
|
52
53
|
});
|
|
53
54
|
|
|
@@ -66,7 +67,7 @@ export const listAppLatestReleaseCliLeaf = CliLeaf({
|
|
|
66
67
|
if (latestReleaseHash === undefined) {
|
|
67
68
|
throw new CliTerseError('This application has not been published yet');
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
logger.info(latestReleaseHash);
|
|
70
71
|
},
|
|
71
72
|
});
|
|
72
73
|
|
|
@@ -107,7 +108,7 @@ export const getAppStatusCliLeaf = CliLeaf({
|
|
|
107
108
|
async action(_, opts) {
|
|
108
109
|
const { project } = opts;
|
|
109
110
|
const appStatus = await getAppStatus({ projectId: project });
|
|
110
|
-
|
|
111
|
+
logger.info(appStatus);
|
|
111
112
|
},
|
|
112
113
|
});
|
|
113
114
|
|
|
@@ -143,7 +144,7 @@ export const getAppLogsCliLeaf = CliLeaf({
|
|
|
143
144
|
const readable = await getAppLogs({ projectId: project });
|
|
144
145
|
readable.setEncoding('utf8');
|
|
145
146
|
for await (const chunk of readable) {
|
|
146
|
-
|
|
147
|
+
logger.info(chunk);
|
|
147
148
|
}
|
|
148
149
|
},
|
|
149
150
|
});
|
|
@@ -307,7 +308,7 @@ export const getAllEnvsCLiLeaf = CliLeaf({
|
|
|
307
308
|
},
|
|
308
309
|
async action(_, opts) {
|
|
309
310
|
const { project } = opts;
|
|
310
|
-
|
|
311
|
+
logger.info(await getAllEnvs({ projectId: project }));
|
|
311
312
|
},
|
|
312
313
|
});
|
|
313
314
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
getTargetHardwareUuid,
|
|
9
9
|
writeCertificateAndToken,
|
|
10
10
|
} from '../../infrastructure/certificates-and-tokens';
|
|
11
|
+
import { logger } from '../../util/logger';
|
|
11
12
|
|
|
12
13
|
export const initCliLeaf = CliLeaf({
|
|
13
14
|
name: 'init',
|
|
@@ -24,7 +25,7 @@ export const initCliLeaf = CliLeaf({
|
|
|
24
25
|
},
|
|
25
26
|
async action(_, opts) {
|
|
26
27
|
const { name, description } = opts;
|
|
27
|
-
|
|
28
|
+
logger.info('Initializing device');
|
|
28
29
|
await checkUserIsLoggedInComponent({ yes: true });
|
|
29
30
|
if (!(await checkPaidPlan())) {
|
|
30
31
|
throw new Error(`This action only supported for Enterprise alwaysAI accounts!`);
|
|
@@ -44,7 +45,7 @@ export const initCliLeaf = CliLeaf({
|
|
|
44
45
|
};
|
|
45
46
|
const response = await addDevice(deviceToAdd, 'production');
|
|
46
47
|
await writeCertificateAndToken({ deviceUuid: response.deviceUUID });
|
|
47
|
-
|
|
48
|
+
logger.info(`Initialized device as ${response.deviceUUID}`);
|
|
48
49
|
},
|
|
49
50
|
});
|
|
50
51
|
|
|
@@ -2,6 +2,7 @@ import { CliLeaf, CliNumberInput, CliStringInput } from '@alwaysai/alwayscli';
|
|
|
2
2
|
import { appInstallModel } from 'alwaysai/lib/core/app';
|
|
3
3
|
import { CliRpcClient } from 'alwaysai/lib/infrastructure';
|
|
4
4
|
import { JsSpawner } from 'alwaysai/lib/util';
|
|
5
|
+
import { logger } from '../util/logger';
|
|
5
6
|
|
|
6
7
|
export const getModelPackageCliLeaf = CliLeaf({
|
|
7
8
|
name: 'get-model-package',
|
|
@@ -27,6 +28,6 @@ export const getModelPackageCliLeaf = CliLeaf({
|
|
|
27
28
|
const version =
|
|
28
29
|
opts.version || (await CliRpcClient().getModelVersion({ id })).version;
|
|
29
30
|
await appInstallModel(spawner, id, version);
|
|
30
|
-
|
|
31
|
+
logger.info(`Completed downloading ${id} to ${path}`);
|
|
31
32
|
},
|
|
32
33
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as winston from 'winston';
|
|
2
|
+
import 'winston-daily-rotate-file';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import { AAI_DIR } from 'alwaysai/lib/constants';
|
|
5
|
+
import { ALWAYSAI_LOG_LEVEL, ALWAYSAI_LOG_TO_CONSOLE } from '../environment';
|
|
6
|
+
|
|
7
|
+
const LOG_LEVEL = ALWAYSAI_LOG_LEVEL || 'info';
|
|
8
|
+
const transports = ALWAYSAI_LOG_TO_CONSOLE
|
|
9
|
+
? [new winston.transports.Console({ level: LOG_LEVEL })]
|
|
10
|
+
: [
|
|
11
|
+
new winston.transports.DailyRotateFile({
|
|
12
|
+
filename: path.join(AAI_DIR, 'agent-logs', 'agent-logs.txt'),
|
|
13
|
+
maxSize: '5m',
|
|
14
|
+
maxFiles: '2d',
|
|
15
|
+
}),
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export const logger = winston.createLogger({
|
|
19
|
+
level: LOG_LEVEL,
|
|
20
|
+
format: winston.format.combine(
|
|
21
|
+
winston.format.errors({ stack: true }),
|
|
22
|
+
winston.format.splat(),
|
|
23
|
+
winston.format.simple(),
|
|
24
|
+
),
|
|
25
|
+
transports,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
logger.info(`Initialized logger with log level: ${LOG_LEVEL}`);
|