edge-impulse-linux 1.25.3 → 1.26.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/README.md +53 -0
- package/build/cli/linux/agent-runner-metadata.d.ts +19 -0
- package/build/cli/linux/agent-runner-metadata.js +59 -0
- package/build/cli/linux/agent-runner-metadata.js.map +1 -0
- package/build/cli/linux/audio-utils.d.ts +10 -0
- package/build/cli/linux/audio-utils.js +29 -0
- package/build/cli/linux/audio-utils.js.map +1 -0
- package/build/cli/linux/linux-device.d.ts +0 -1
- package/build/cli/linux/linux-device.js +2 -31
- package/build/cli/linux/linux-device.js.map +1 -1
- package/build/cli/linux/runner-utils.d.ts +3 -1
- package/build/cli/linux/runner-utils.js +34 -3
- package/build/cli/linux/runner-utils.js.map +1 -1
- package/build/cli/linux/runner.js +198 -29
- package/build/cli/linux/runner.js.map +1 -1
- package/build/cli-common/model-monitor.d.ts +13 -0
- package/build/cli-common/model-monitor.js +68 -8
- package/build/cli-common/model-monitor.js.map +1 -1
- package/build/cli-common/remote-mgmt-service.d.ts +1 -0
- package/build/cli-common/remote-mgmt-service.js +31 -16
- package/build/cli-common/remote-mgmt-service.js.map +1 -1
- package/build/library/moving-average-filter.d.ts +1 -1
- package/build/library/sensors/sensors-helper.d.ts +12 -0
- package/build/library/sensors/sensors-helper.js +28 -3
- package/build/library/sensors/sensors-helper.js.map +1 -1
- package/build/sdk/studio/sdk/api/devicesApi.d.ts +92 -1
- package/build/sdk/studio/sdk/api/devicesApi.js +414 -0
- package/build/sdk/studio/sdk/api/devicesApi.js.map +1 -1
- package/build/sdk/studio/sdk/api/learnApi.d.ts +2 -0
- package/build/sdk/studio/sdk/api/learnApi.js +11 -0
- package/build/sdk/studio/sdk/api/learnApi.js.map +1 -1
- package/build/sdk/studio/sdk/model/datasetRatioDataRatio.d.ts +1 -1
- package/build/sdk/studio/sdk/model/datasetSplitOptions.d.ts +1 -1
- package/build/sdk/studio/sdk/model/deployPretrainedModelModelClassification.d.ts +1 -0
- package/build/sdk/studio/sdk/model/deployPretrainedModelModelClassification.js.map +1 -1
- package/build/sdk/studio/sdk/model/deploymentHistory.d.ts +5 -0
- package/build/sdk/studio/sdk/model/deviceDeploymentEvent.d.ts +39 -0
- package/build/sdk/studio/sdk/model/deviceDeploymentEvent.js +7 -0
- package/build/sdk/studio/sdk/model/deviceDeploymentEvent.js.map +1 -0
- package/build/sdk/studio/sdk/model/deviceModelDeploymentRequest.d.ts +6 -0
- package/build/sdk/studio/sdk/model/deviceModelDeploymentRequest.js +4 -0
- package/build/sdk/studio/sdk/model/deviceModelDeploymentRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/deviceTelemetryInterval.d.ts +21 -0
- package/build/sdk/studio/sdk/model/deviceTelemetryInterval.js +4 -0
- package/build/sdk/studio/sdk/model/deviceTelemetryInterval.js.map +1 -0
- package/build/sdk/studio/sdk/model/impulseLearnBlock.d.ts +2 -2
- package/build/sdk/studio/sdk/model/impulseSpecificGpuTrainingProcessor.d.ts +5 -0
- package/build/sdk/studio/sdk/model/impulseSpecificGpuTrainingProcessor.js +6 -0
- package/build/sdk/studio/sdk/model/impulseSpecificGpuTrainingProcessor.js.map +1 -0
- package/build/sdk/studio/sdk/model/impulseType.d.ts +4 -2
- package/build/sdk/studio/sdk/model/impulseType.js +1 -1
- package/build/sdk/studio/sdk/model/impulseType.js.map +1 -1
- package/build/sdk/studio/sdk/model/learnBlock.d.ts +2 -1
- package/build/sdk/studio/sdk/model/learnBlockType.d.ts +2 -3
- package/build/sdk/studio/sdk/model/learnBlockType.js +1 -1
- package/build/sdk/studio/sdk/model/learnBlockType.js.map +1 -1
- package/build/sdk/studio/sdk/model/listDeviceDeploymentHistoryResponse.d.ts +19 -0
- package/build/sdk/studio/sdk/model/listDeviceDeploymentHistoryResponse.js +4 -0
- package/build/sdk/studio/sdk/model/listDeviceDeploymentHistoryResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/listDeviceTelemetryResponse.d.ts +16 -0
- package/build/sdk/studio/sdk/model/listDeviceTelemetryResponse.js +4 -0
- package/build/sdk/studio/sdk/model/listDeviceTelemetryResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/listLatestDeviceTelemetryResponse.d.ts +12 -0
- package/build/sdk/studio/sdk/model/listLatestDeviceTelemetryResponse.js +4 -0
- package/build/sdk/studio/sdk/model/listLatestDeviceTelemetryResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/models.d.ts +7 -1
- package/build/sdk/studio/sdk/model/models.js +7 -1
- package/build/sdk/studio/sdk/model/models.js.map +1 -1
- package/build/sdk/studio/sdk/model/monitoringEventEvaluationConfig.d.ts +4 -2
- package/build/sdk/studio/sdk/model/monitoringEventEvaluationConfig.js +1 -1
- package/build/sdk/studio/sdk/model/monitoringEventEvaluationConfig.js.map +1 -1
- package/build/sdk/studio/sdk/model/organizationCreateProjectRequest.d.ts +1 -2
- package/build/sdk/studio/sdk/model/organizationCreateProjectRequest.js.map +1 -1
- package/build/sdk/studio/sdk/model/organizationPipelineStep.d.ts +1 -2
- package/build/sdk/studio/sdk/model/organizationPipelineStep.js.map +1 -1
- package/build/sdk/studio/sdk/model/organizationTransferLearningOperatesOn.d.ts +1 -1
- package/build/sdk/studio/sdk/model/organizationTransferLearningOperatesOn.js +1 -1
- package/build/sdk/studio/sdk/model/organizationTransferLearningOperatesOn.js.map +1 -1
- package/build/sdk/studio/sdk/model/setKerasParameterRequest.d.ts +2 -2
- package/build/sdk/studio/sdk/model/uploadPretrainedModelRequest.d.ts +8 -0
- package/build/sdk/studio/sdk/model/uploadPretrainedModelRequest.js.map +1 -1
- package/build/shared/MgmtInterfaceTypes.d.ts +1 -290
- package/package.json +4 -1
- package/test/agent-client.test.ts +853 -0
- package/test/agent-runner-metadata.test.ts +31 -0
- package/test/audio-utils.test.ts +26 -0
- package/test/model-monitor.test.ts +121 -0
- package/test/monitoring-policy-protocol.test.ts +62 -0
- package/test/sensor-selection.test.ts +26 -0
- package/build/sdk/studio/sdk/model/experimentalImpulseSpecificGpuTrainingProcessor.d.ts +0 -6
- package/build/sdk/studio/sdk/model/experimentalImpulseSpecificGpuTrainingProcessor.js +0 -6
- package/build/sdk/studio/sdk/model/experimentalImpulseSpecificGpuTrainingProcessor.js.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies that agent registration uses stable workload API metadata before and after the runner
|
|
3
|
+
* has loaded a model, including safe handling of inferencing engines newer than this CLI.
|
|
4
|
+
*/
|
|
5
|
+
import assert from 'node:assert';
|
|
6
|
+
import { ModelInformation, RunnerHelloInferencingEngine } from '../library/classifier/linux-impulse-runner';
|
|
7
|
+
import { agentEngineName, agentRunnerMode } from '../cli/linux/agent-runner-metadata';
|
|
8
|
+
|
|
9
|
+
describe('agent runner metadata', () => {
|
|
10
|
+
// Ensures the initial registration identifies an explicitly configured mode before model loading.
|
|
11
|
+
it('reports modes from explicit configuration before a model is loaded', () => {
|
|
12
|
+
assert.strictEqual(agentRunnerMode(1337, undefined, undefined, undefined), 'http');
|
|
13
|
+
assert.strictEqual(agentRunnerMode(undefined, '/dev/video0', undefined, undefined), 'camera');
|
|
14
|
+
assert.strictEqual(agentRunnerMode(undefined, undefined, 'default', undefined), 'microphone');
|
|
15
|
+
assert.strictEqual(agentRunnerMode(undefined, undefined, undefined, undefined), undefined);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Falls back to `.eim` metadata when startup arguments could not identify the streaming sensor.
|
|
19
|
+
it('reports the mode from a loaded model when no input was selected explicitly', () => {
|
|
20
|
+
const model = <ModelInformation>{ modelParameters: { sensorType: 'camera' } };
|
|
21
|
+
assert.strictEqual(agentRunnerMode(undefined, undefined, undefined, model), 'camera');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Keeps workload metadata stable across enum names and prevents a newer engine from crashing startup.
|
|
25
|
+
it('uses stable engine names and accepts future engine values', () => {
|
|
26
|
+
assert.strictEqual(agentEngineName(RunnerHelloInferencingEngine.Tflite), 'tflite');
|
|
27
|
+
assert.strictEqual(agentEngineName(RunnerHelloInferencingEngine.TfliteFull), 'tflite');
|
|
28
|
+
assert.strictEqual(agentEngineName(RunnerHelloInferencingEngine.TensorRT), 'tensorrt');
|
|
29
|
+
assert.strictEqual(agentEngineName(18), 'unknown');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies the shared WAV builder used for both agent inference inputs and remotely captured audio,
|
|
3
|
+
* including the binary header fields that audio consumers rely on to interpret the PCM payload.
|
|
4
|
+
*/
|
|
5
|
+
import assert from 'node:assert';
|
|
6
|
+
import { buildMonoPcm16WavFile } from '../cli/linux/audio-utils';
|
|
7
|
+
|
|
8
|
+
describe('audio utilities', () => {
|
|
9
|
+
it('builds a 16-bit mono PCM WAV file with the supplied sample rate', () => {
|
|
10
|
+
const pcm = Buffer.from([ 1, 2, 3, 4 ]);
|
|
11
|
+
const wav = buildMonoPcm16WavFile(pcm, 16000);
|
|
12
|
+
|
|
13
|
+
assert.strictEqual(wav.toString('ascii', 0, 4), 'RIFF');
|
|
14
|
+
assert.strictEqual(wav.readUInt32LE(4), 36 + pcm.length);
|
|
15
|
+
assert.strictEqual(wav.toString('ascii', 8, 12), 'WAVE');
|
|
16
|
+
assert.strictEqual(wav.readUInt16LE(20), 1);
|
|
17
|
+
assert.strictEqual(wav.readUInt16LE(22), 1);
|
|
18
|
+
assert.strictEqual(wav.readUInt32LE(24), 16000);
|
|
19
|
+
assert.strictEqual(wav.readUInt32LE(28), 32000);
|
|
20
|
+
assert.strictEqual(wav.readUInt16LE(32), 2);
|
|
21
|
+
assert.strictEqual(wav.readUInt16LE(34), 16);
|
|
22
|
+
assert.strictEqual(wav.toString('ascii', 36, 40), 'data');
|
|
23
|
+
assert.strictEqual(wav.readUInt32LE(40), pcm.length);
|
|
24
|
+
assert.deepStrictEqual(wav.subarray(44), pcm);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import Path from 'path';
|
|
5
|
+
import { Config } from '../cli-common/config';
|
|
6
|
+
import { ImpulseRecord, ModelMonitor } from '../cli-common/model-monitor';
|
|
7
|
+
import { ModelInformation } from '../library/classifier/linux-impulse-runner-types';
|
|
8
|
+
|
|
9
|
+
describe('model monitoring summary cadence', () => {
|
|
10
|
+
for (const interval of [ undefined, 5_000, 10_000, 60_000, 120_000 ]) {
|
|
11
|
+
it(`starts safely with configured interval ${interval ?? 'automatic'}`, async () => {
|
|
12
|
+
const storagePath = await fs.mkdtemp(Path.join(os.tmpdir(), 'mm-cadence-'));
|
|
13
|
+
try {
|
|
14
|
+
const config = {
|
|
15
|
+
getDeploymentVersion: async () => 1,
|
|
16
|
+
getStoragePath: async () => Path.join(storagePath, '1', '1'),
|
|
17
|
+
getDefaultStoragePath: () => storagePath,
|
|
18
|
+
getStorageMaxSizeMb: async () => undefined,
|
|
19
|
+
getStorageIndex: async () => 0,
|
|
20
|
+
getMonitorSummaryIntervalMs: async () => interval,
|
|
21
|
+
} as unknown as Config;
|
|
22
|
+
const model = {
|
|
23
|
+
project: { id: 1 },
|
|
24
|
+
modelParameters: {
|
|
25
|
+
model_type: 'classification', has_anomaly: 0,
|
|
26
|
+
thresholds: [{ type: 'classification', min_score: 0.5 }],
|
|
27
|
+
},
|
|
28
|
+
} as unknown as ModelInformation;
|
|
29
|
+
const monitor = await ModelMonitor.getModelMonitor(config, model);
|
|
30
|
+
const calculator = (monitor as unknown as {
|
|
31
|
+
_metricsCalculator: { updateMetrics(record: ImpulseRecord): Promise<boolean> };
|
|
32
|
+
})._metricsCalculator;
|
|
33
|
+
const expectedInterval = Math.max(interval ?? 60_000, 60_000);
|
|
34
|
+
for (const elapsed of [ 0, expectedInterval - 1, expectedInterval ]) {
|
|
35
|
+
const record: ImpulseRecord = {
|
|
36
|
+
timestamp: 1_000_000 + elapsed,
|
|
37
|
+
index: elapsed,
|
|
38
|
+
rawData: { type: 'wav', bufferBase64: '' },
|
|
39
|
+
impulseRecord: {
|
|
40
|
+
result: { classification: { keyword: 0.9 } },
|
|
41
|
+
timing: { dsp: 1, classification: 1, anomaly: 0 },
|
|
42
|
+
info: undefined,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
assert.strictEqual(await calculator.updateMetrics(record), elapsed === expectedInterval);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
await fs.rm(storagePath, { recursive: true, force: true });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
describe('adaptive model monitoring cadence', () => {
|
|
57
|
+
for (const configured of [ undefined, 5_000, 10_000, 60_000 ]) {
|
|
58
|
+
it(`adapts an in-flight aggregate and preserves preference ${configured}`, async () => {
|
|
59
|
+
const storagePath = await fs.mkdtemp(Path.join(os.tmpdir(), 'mm-adaptive-'));
|
|
60
|
+
try {
|
|
61
|
+
const config = {
|
|
62
|
+
getDeploymentVersion: async () => 1,
|
|
63
|
+
getStoragePath: async () => Path.join(storagePath, '1', '1'),
|
|
64
|
+
getDefaultStoragePath: () => storagePath,
|
|
65
|
+
getStorageMaxSizeMb: async () => undefined,
|
|
66
|
+
getStorageIndex: async () => 0,
|
|
67
|
+
getMonitorSummaryIntervalMs: async () => configured,
|
|
68
|
+
} as unknown as Config;
|
|
69
|
+
const model = {
|
|
70
|
+
project: { id: 1 },
|
|
71
|
+
modelParameters: {
|
|
72
|
+
model_type: 'classification', has_anomaly: 0,
|
|
73
|
+
thresholds: [{ type: 'classification', min_score: 0.5 }],
|
|
74
|
+
},
|
|
75
|
+
} as unknown as ModelInformation;
|
|
76
|
+
const monitor = await ModelMonitor.getModelMonitor(config, model);
|
|
77
|
+
const calculator = (monitor as unknown as {
|
|
78
|
+
_metricsCalculator: {
|
|
79
|
+
updateMetrics(record: ImpulseRecord): Promise<boolean>;
|
|
80
|
+
getMetrics(): { start: { index: number }; end: { index: number } };
|
|
81
|
+
};
|
|
82
|
+
})._metricsCalculator;
|
|
83
|
+
const policy = { intervalMs: 60_000, minimumIntervalMs: 5_000,
|
|
84
|
+
preparationWindowMs: 0, requirementsMet: true };
|
|
85
|
+
monitor.applySummaryPolicy(policy);
|
|
86
|
+
assert.strictEqual(monitor.effectiveSummaryIntervalMs, configured ?? 60_000);
|
|
87
|
+
const update = (index: number, elapsed: number) => calculator.updateMetrics({
|
|
88
|
+
timestamp: 1_000_000 + elapsed, index,
|
|
89
|
+
rawData: { type: 'wav', bufferBase64: '' },
|
|
90
|
+
impulseRecord: { result: { classification: { keyword: 0.9 } },
|
|
91
|
+
timing: { dsp: 1, classification: 1, anomaly: 0 }, info: undefined },
|
|
92
|
+
});
|
|
93
|
+
assert.strictEqual(await update(0, 0), false);
|
|
94
|
+
assert.strictEqual(await update(1, 4_000), false);
|
|
95
|
+
monitor.applySummaryPolicy({ ...policy, intervalMs: 5_000, preparationWindowMs: 120_000 });
|
|
96
|
+
assert.strictEqual(await update(2, 5_100), true);
|
|
97
|
+
assert.deepStrictEqual([ calculator.getMetrics().start.index, calculator.getMetrics().end.index ],
|
|
98
|
+
[ 0, 2 ]);
|
|
99
|
+
assert.strictEqual(await update(3, 5_450), false);
|
|
100
|
+
monitor.applySummaryPolicy(policy);
|
|
101
|
+
const slower = configured ?? 60_000;
|
|
102
|
+
assert.strictEqual(await update(4, 5_450 + slower - 1), false);
|
|
103
|
+
assert.strictEqual(await update(5, 5_450 + slower), true);
|
|
104
|
+
assert.deepStrictEqual([ calculator.getMetrics().start.index, calculator.getMetrics().end.index ],
|
|
105
|
+
[ 3, 5 ]);
|
|
106
|
+
assert.strictEqual(monitor.configuredSummaryIntervalMs, configured);
|
|
107
|
+
monitor.applySummaryPolicy({ ...policy, intervalMs: NaN });
|
|
108
|
+
assert.strictEqual(monitor.effectiveSummaryIntervalMs, slower, 'invalid policy preserves last cadence');
|
|
109
|
+
monitor.applySummaryPolicy({ ...policy, intervalMs: 60_000, minimumIntervalMs: 60_000,
|
|
110
|
+
preparationWindowMs: 120_000, requirementsMet: false });
|
|
111
|
+
assert.strictEqual(monitor.effectiveSummaryIntervalMs, 60_000);
|
|
112
|
+
monitor.applySummaryPolicy(undefined);
|
|
113
|
+
assert.strictEqual(monitor.effectiveSummaryIntervalMs, 60_000,
|
|
114
|
+
'a server without policy support restores the safe legacy cadence');
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
await fs.rm(storagePath, { recursive: true, force: true });
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { RemoteMgmt } from '../cli-common/remote-mgmt-service';
|
|
4
|
+
import { MonitoringSummaryPolicy } from '../shared/device-protocol/remote-management';
|
|
5
|
+
|
|
6
|
+
describe('monitoring policy protocol', () => {
|
|
7
|
+
for (const supportsPolicy of [ false, true ]) {
|
|
8
|
+
it(`handles ${supportsPolicy ? 'new' : 'old'} servers and keeps policy messages separate from record ACKs`, async () => {
|
|
9
|
+
const policies: (MonitoringSummaryPolicy | undefined)[] = [];
|
|
10
|
+
const sent: { hello?: { supportsMonitoringSummaryPolicy: boolean };
|
|
11
|
+
getMonitoringSummaryPolicy?: boolean }[] = [];
|
|
12
|
+
const ws = Object.assign(new EventEmitter(), {
|
|
13
|
+
send: (data: string) => { sent.push(JSON.parse(data)); }, ping: () => undefined,
|
|
14
|
+
});
|
|
15
|
+
const policy: MonitoringSummaryPolicy = { intervalMs: 5_000, minimumIntervalMs: 5_000,
|
|
16
|
+
preparationWindowMs: 120_000, requirementsMet: true };
|
|
17
|
+
// Use the real dispatch/Hello methods without opening sockets or installing the reconnect timer.
|
|
18
|
+
const remote = Object.assign(Object.create(RemoteMgmt.prototype), {
|
|
19
|
+
_ws: ws, _projectId: 1, _devKeys: { apiKey: 'test' },
|
|
20
|
+
_eiConfig: { command: 'test', endpoints: { internal: { api: 'http://localhost/v1' } } },
|
|
21
|
+
_device: { connected: () => true, getDeviceId: async () => 'device',
|
|
22
|
+
getDeviceType: async () => 'test', getConnectionType: () => 'ip',
|
|
23
|
+
getSensors: () => [], supportsSnapshotStreaming: () => false },
|
|
24
|
+
_inferenceInfo: {},
|
|
25
|
+
_monitor: { getStorageStatus: async () => undefined,
|
|
26
|
+
applySummaryPolicy: (value: MonitoringSummaryPolicy | undefined) => policies.push(value),
|
|
27
|
+
abortImpulseRecordsRequest: () => { throw new Error('policy consumed as a record ACK'); } },
|
|
28
|
+
checkName: async () => 'test',
|
|
29
|
+
getProjectInfo: async () => ({ name: 'project' }),
|
|
30
|
+
}) as { attachWsHandlers(): void; sendHello(): Promise<void>; registerPingPong(): void };
|
|
31
|
+
remote.attachWsHandlers();
|
|
32
|
+
await remote.sendHello();
|
|
33
|
+
assert.strictEqual(sent[0].hello?.supportsMonitoringSummaryPolicy, true);
|
|
34
|
+
ws.emit('message', Buffer.from(JSON.stringify({ hello: true, serverTimestamp: 123,
|
|
35
|
+
...(supportsPolicy ? { supportsMonitoringSummaryPolicy: true, monitoringSummaryPolicy: policy } : {}),
|
|
36
|
+
})));
|
|
37
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
38
|
+
assert.deepStrictEqual(policies, [ supportsPolicy ? policy : undefined ]);
|
|
39
|
+
const originalInterval = global.setInterval;
|
|
40
|
+
const originalTimeout = global.setTimeout;
|
|
41
|
+
try {
|
|
42
|
+
global.setInterval = ((fn: () => void, delay: number) => {
|
|
43
|
+
assert.strictEqual(delay, 30_000);
|
|
44
|
+
fn();
|
|
45
|
+
return 0;
|
|
46
|
+
}) as unknown as typeof setInterval;
|
|
47
|
+
global.setTimeout = (() => 0) as unknown as typeof setTimeout;
|
|
48
|
+
remote.registerPingPong();
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
global.setInterval = originalInterval;
|
|
52
|
+
global.setTimeout = originalTimeout;
|
|
53
|
+
}
|
|
54
|
+
assert.strictEqual(sent.some(message => message.getMonitoringSummaryPolicy), supportsPolicy);
|
|
55
|
+
ws.emit('message', Buffer.from(JSON.stringify({ monitoringSummaryPolicyUpdate: { ...policy, intervalMs: 60_000 } })));
|
|
56
|
+
ws.emit('message', Buffer.from(JSON.stringify({ impulseRecordAck: true, index: 1 })));
|
|
57
|
+
ws.emit('message', Buffer.from(JSON.stringify({ err: 'Policy lookup failed' })));
|
|
58
|
+
assert.strictEqual(policies.length, supportsPolicy ? 2 : 1);
|
|
59
|
+
if (supportsPolicy) assert.strictEqual(policies[1]?.intervalMs, 60_000);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies the non-interactive device selection used by agent-managed containers, without requiring
|
|
3
|
+
* camera or microphone hardware during the unit test.
|
|
4
|
+
*/
|
|
5
|
+
import assert from 'node:assert';
|
|
6
|
+
import { selectNonInteractiveDevice } from '../library/sensors/sensors-helper';
|
|
7
|
+
|
|
8
|
+
describe('non-interactive sensor selection', () => {
|
|
9
|
+
it('uses an explicitly selected device', () => {
|
|
10
|
+
assert.strictEqual(selectNonInteractiveDevice(
|
|
11
|
+
[ 'camera-1', 'camera-2' ], 'camera-2', '--camera', 'EI_CAMERA'), 'camera-2');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('automatically uses the only available device', () => {
|
|
15
|
+
assert.strictEqual(selectNonInteractiveDevice(
|
|
16
|
+
[ 'microphone-1' ], undefined, '--microphone', 'EI_MICROPHONE'), 'microphone-1');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('rejects an ambiguous selection instead of prompting', () => {
|
|
20
|
+
assert.throws(
|
|
21
|
+
() => selectNonInteractiveDevice(
|
|
22
|
+
[ 'camera-1', 'camera-2' ], undefined, '--camera', 'EI_CAMERA'),
|
|
23
|
+
/set --camera or EI_CAMERA/
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EXPERIMENTAL: Training processor for the impulse-specific-gpu rollout. This field is currently gated by a project
|
|
3
|
-
* experiment and may change in future API versions.
|
|
4
|
-
*/
|
|
5
|
-
export type ExperimentalImpulseSpecificGpuTrainingProcessor = 'cpu' | 'gpu';
|
|
6
|
-
export declare const ExperimentalImpulseSpecificGpuTrainingProcessorValues: string[];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Generated by studio/openapi/generate-models/convert.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ExperimentalImpulseSpecificGpuTrainingProcessorValues = void 0;
|
|
5
|
-
exports.ExperimentalImpulseSpecificGpuTrainingProcessorValues = ['cpu', 'gpu'];
|
|
6
|
-
//# sourceMappingURL=experimentalImpulseSpecificGpuTrainingProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"experimentalImpulseSpecificGpuTrainingProcessor.js","sourceRoot":"","sources":["../../../../../sdk/studio/sdk/model/experimentalImpulseSpecificGpuTrainingProcessor.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAQ5C,QAAA,qDAAqD,GAAa,CAAE,KAAK,EAAE,KAAK,CAAE,CAAC"}
|