edge-impulse-linux 1.26.1 → 1.26.2

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 (90) hide show
  1. package/README.md +7 -2
  2. package/build/cli/linux/agent-capture.d.ts +29 -0
  3. package/build/cli/linux/agent-capture.js +94 -0
  4. package/build/cli/linux/agent-capture.js.map +1 -0
  5. package/build/cli/linux/agent-runner-metadata.d.ts +12 -3
  6. package/build/cli/linux/agent-runner-metadata.js +15 -3
  7. package/build/cli/linux/agent-runner-metadata.js.map +1 -1
  8. package/build/cli/linux/audio-utils.d.ts +1 -10
  9. package/build/cli/linux/audio-utils.js +2 -25
  10. package/build/cli/linux/audio-utils.js.map +1 -1
  11. package/build/cli/linux/runner-downloader.js +3 -0
  12. package/build/cli/linux/runner-downloader.js.map +1 -1
  13. package/build/cli/linux/runner-utils.js +1 -1
  14. package/build/cli/linux/runner-utils.js.map +1 -1
  15. package/build/cli/linux/runner.js +96 -60
  16. package/build/cli/linux/runner.js.map +1 -1
  17. package/build/cli-common/model-monitor.d.ts +97 -10
  18. package/build/cli-common/model-monitor.js +380 -373
  19. package/build/cli-common/model-monitor.js.map +1 -1
  20. package/build/cli-common/remote-mgmt-service.d.ts +1 -0
  21. package/build/cli-common/remote-mgmt-service.js +29 -11
  22. package/build/cli-common/remote-mgmt-service.js.map +1 -1
  23. package/build/library/classifier/audio-classifier.d.ts +16 -0
  24. package/build/library/classifier/audio-classifier.js +77 -1
  25. package/build/library/classifier/audio-classifier.js.map +1 -1
  26. package/build/library/classifier/image-classifier.d.ts +14 -0
  27. package/build/library/classifier/image-classifier.js +79 -3
  28. package/build/library/classifier/image-classifier.js.map +1 -1
  29. package/build/library/classifier/linux-impulse-runner.d.ts +8 -1
  30. package/build/library/classifier/linux-impulse-runner.js +13 -0
  31. package/build/library/classifier/linux-impulse-runner.js.map +1 -1
  32. package/build/library/sensors/audio-utils.d.ts +4 -0
  33. package/build/library/sensors/audio-utils.js +23 -0
  34. package/build/library/sensors/audio-utils.js.map +1 -0
  35. package/build/library/sensors/gstreamer.d.ts +1 -1
  36. package/build/library/sensors/gstreamer.js +7 -4
  37. package/build/library/sensors/gstreamer.js.map +1 -1
  38. package/build/sdk/studio/sdk/api/devicesApi.d.ts +2 -2
  39. package/build/sdk/studio/sdk/api/devicesApi.js +2 -2
  40. package/build/sdk/studio/sdk/model/additionalMetricOptionalFullPrecisionValue.d.ts +7 -0
  41. package/build/sdk/studio/sdk/model/additionalMetricOptionalFullPrecisionValue.js +4 -0
  42. package/build/sdk/studio/sdk/model/additionalMetricOptionalFullPrecisionValue.js.map +1 -0
  43. package/build/sdk/studio/sdk/model/dSPGroupItem.d.ts +9 -1
  44. package/build/sdk/studio/sdk/model/dSPGroupItem.js +3 -1
  45. package/build/sdk/studio/sdk/model/dSPGroupItem.js.map +1 -1
  46. package/build/sdk/studio/sdk/model/device.d.ts +5 -5
  47. package/build/sdk/studio/sdk/model/deviceApplication.d.ts +12 -0
  48. package/build/sdk/studio/sdk/model/{deviceWorkload.js → deviceApplication.js} +1 -1
  49. package/build/sdk/studio/sdk/model/deviceApplication.js.map +1 -0
  50. package/build/sdk/studio/sdk/model/{deviceWorkloadModel.d.ts → deviceApplicationModel.d.ts} +2 -2
  51. package/build/sdk/studio/sdk/model/{deviceWorkloadModel.js → deviceApplicationModel.js} +1 -1
  52. package/build/sdk/studio/sdk/model/deviceApplicationModel.js.map +1 -0
  53. package/build/sdk/studio/sdk/model/deviceDeploymentEvent.d.ts +4 -4
  54. package/build/sdk/studio/sdk/model/deviceModelDeploymentRequest.d.ts +5 -0
  55. package/build/sdk/studio/sdk/model/foldModelMetadata.d.ts +5 -0
  56. package/build/sdk/studio/sdk/model/getMonitoringEventDetailsResponse.d.ts +4 -0
  57. package/build/sdk/studio/sdk/model/getMonitoringEventDetailsResponse.js.map +1 -1
  58. package/build/sdk/studio/sdk/model/inferenceHistoryAggregate.d.ts +2 -2
  59. package/build/sdk/studio/sdk/model/kerasModelMetadata.d.ts +5 -0
  60. package/build/sdk/studio/sdk/model/kerasModelMetadataBase.d.ts +5 -0
  61. package/build/sdk/studio/sdk/model/kerasModelMetadataResponse.d.ts +5 -0
  62. package/build/sdk/studio/sdk/model/models.d.ts +3 -2
  63. package/build/sdk/studio/sdk/model/models.js +3 -2
  64. package/build/sdk/studio/sdk/model/models.js.map +1 -1
  65. package/build/sdk/studio/sdk/model/monitoringEventContext.d.ts +6 -2
  66. package/build/sdk/studio/sdk/model/monitoringInferenceSummary.d.ts +4 -0
  67. package/build/sdk/studio/sdk/model/userOrganization.d.ts +2 -0
  68. package/build/shared/viewmodels/init.d.ts +0 -1
  69. package/build/shared/viewmodels/init.js +0 -1
  70. package/build/shared/viewmodels/init.js.map +1 -1
  71. package/package.json +2 -2
  72. package/test/agent-bundle-lifecycle.test.ts +2 -2
  73. package/test/agent-bundle.test.ts +104 -0
  74. package/test/agent-capture.test.ts +528 -0
  75. package/test/agent-client.test.ts +64 -169
  76. package/test/agent-command-processor.test.ts +1 -1
  77. package/test/agent-preview-replacement.test.ts +114 -0
  78. package/test/agent-runner-configuration.test.ts +12 -3
  79. package/test/agent-runner-integration.test.ts +50 -8
  80. package/test/gstreamer.test.ts +1 -1
  81. package/test/helpers/mock-agent.ts +106 -0
  82. package/test/model-monitor.test.ts +250 -55
  83. package/test/monitoring-fixture.ts +168 -0
  84. package/test/monitoring-policy-protocol.test.ts +193 -1
  85. package/test/runner-preview.test.ts +59 -0
  86. package/test/summary-rules-fixtures.test.ts +194 -0
  87. package/test/utils/agent-runner-fixtures.ts +22 -7
  88. package/build/sdk/studio/sdk/model/deviceWorkload.d.ts +0 -12
  89. package/build/sdk/studio/sdk/model/deviceWorkload.js.map +0 -1
  90. package/build/sdk/studio/sdk/model/deviceWorkloadModel.js.map +0 -1
@@ -1,11 +1,13 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import fs from 'node:fs/promises';
3
3
  import Path from 'node:path';
4
- import { ActivateBundleCommand, BlockThreshold } from '../../shared/device-protocol/workload-contract';
4
+ import { ActivateBundleCommand, BlockThreshold } from '../../shared/device-protocol/application-contract';
5
5
 
6
6
  /** Selects the model identity and behavior exposed by a staged bundle fixture. */
7
7
  export type BundleFixtureOptions = {
8
8
  deploymentVersion: number;
9
+ producerLayout?: boolean;
10
+ mock?: MockEimOptions;
9
11
  sensor?: number;
10
12
  inferencingEngine?: number;
11
13
  manifestEngine?: string;
@@ -16,6 +18,10 @@ export type BundleFixtureOptions = {
16
18
  /** Selects the protocol responses and termination behavior of a mock `.eim` process. */
17
19
  export type MockEimOptions = {
18
20
  deploymentVersion?: number;
21
+ pidPath?: string;
22
+ imageWidth?: number;
23
+ imageHeight?: number;
24
+ resizeMode?: string;
19
25
  sensor?: number;
20
26
  inferencingEngine?: number;
21
27
  thresholds?: BlockThreshold[];
@@ -31,6 +37,8 @@ export async function writeBundle(
31
37
  ): Promise<ActivateBundleCommand> {
32
38
  const {
33
39
  deploymentVersion,
40
+ producerLayout = false,
41
+ mock = {},
34
42
  sensor = 3,
35
43
  inferencingEngine = 2,
36
44
  manifestEngine = 'tflite',
@@ -38,14 +46,16 @@ export async function writeBundle(
38
46
  classifyScore,
39
47
  } = options;
40
48
  const bundlePath = Path.join(rootDirectory, `bundle-${deploymentVersion}`);
41
- const modelPath = Path.join(bundlePath, 'model.eim');
42
- await fs.mkdir(bundlePath);
49
+ const relativeModelPath = producerLayout ? 'models/model.eim' : 'model.eim';
50
+ const modelPath = Path.join(bundlePath, relativeModelPath);
51
+ await fs.mkdir(Path.dirname(modelPath), { recursive: true });
43
52
  const source = mockEimSource({
44
53
  deploymentVersion,
45
54
  sensor,
46
55
  inferencingEngine,
47
56
  thresholds,
48
57
  classifyScore,
58
+ ...mock,
49
59
  });
50
60
  await fs.writeFile(modelPath, source, { mode: 0o755 });
51
61
  await fs.writeFile(Path.join(bundlePath, 'manifest.json'), JSON.stringify({
@@ -54,13 +64,13 @@ export async function writeBundle(
54
64
  target: 'test-target',
55
65
  runtime: { kind: 'inference_runner', minVersion: '1.0.0' },
56
66
  models: [{
57
- id: `model-${deploymentVersion}`,
67
+ id: producerLayout ? 'impulse-1' : `model-${deploymentVersion}`,
58
68
  projectId: 1,
59
69
  impulseId: 1,
60
70
  deploymentVersion,
61
71
  engine: manifestEngine,
62
72
  modelType: 'classification',
63
- path: 'model.eim',
73
+ path: relativeModelPath,
64
74
  sha256: createHash('sha256').update(source).digest('hex'),
65
75
  }],
66
76
  }));
@@ -75,6 +85,10 @@ export async function writeBundle(
75
85
  export function mockEimSource(options: MockEimOptions = {}): string {
76
86
  const {
77
87
  deploymentVersion = 1,
88
+ pidPath,
89
+ imageWidth = 1,
90
+ imageHeight = 1,
91
+ resizeMode = 'squash',
78
92
  sensor = 2,
79
93
  inferencingEngine = 2,
80
94
  thresholds = [],
@@ -84,6 +98,7 @@ export function mockEimSource(options: MockEimOptions = {}): string {
84
98
  } = options;
85
99
  return `#!/usr/bin/env node
86
100
  const net = require('net');
101
+ if (${pidPath !== undefined}) require('fs').writeFileSync(${JSON.stringify(pidPath ?? '')}, String(process.pid));
87
102
  const socketPath = process.argv[2];
88
103
  const server = net.createServer(socket => {
89
104
  let buffered = '';
@@ -101,8 +116,8 @@ const server = net.createServer(socket => {
101
116
  project: { id: 1, name: 'Test', owner: 'Owner', deploy_version: ${deploymentVersion} },
102
117
  model_parameters: {
103
118
  axis_count: 1, frequency: 1, has_anomaly: 0, input_features_count: 1,
104
- image_input_height: 1, image_input_width: 1, image_input_frames: 1,
105
- image_channel_count: 3, image_resize_mode: 'squash', interval_ms: 1,
119
+ image_input_height: ${imageHeight}, image_input_width: ${imageWidth}, image_input_frames: 1,
120
+ image_channel_count: 3, image_resize_mode: ${JSON.stringify(resizeMode)}, interval_ms: 1,
106
121
  label_count: 1, sensor: ${sensor}, labels: [ 'value' ], model_type: 'classification',
107
122
  use_continuous_mode: false, has_performance_calibration: false,
108
123
  inferencing_engine: ${inferencingEngine}, thresholds: ${JSON.stringify(thresholds)}
@@ -1,12 +0,0 @@
1
- import type { DeviceWorkloadModel } from './deviceWorkloadModel';
2
- export type DeviceWorkload = {
3
- /**
4
- * Stable provisioning identity, scoped to this device and project.
5
- */
6
- workloadId: string;
7
- /**
8
- * Whether the workload is registered on a connected device. Retirement preserves models and history.
9
- */
10
- connected: boolean;
11
- models: DeviceWorkloadModel[];
12
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"deviceWorkload.js","sourceRoot":"","sources":["../../../../../sdk/studio/sdk/model/deviceWorkload.ts"],"names":[],"mappings":";AAAA,yDAAyD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deviceWorkloadModel.js","sourceRoot":"","sources":["../../../../../sdk/studio/sdk/model/deviceWorkloadModel.ts"],"names":[],"mappings":";AAAA,yDAAyD"}