@camstack/addon-pipeline-orchestrator 1.2.294 → 1.2.295

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/dist/index.js CHANGED
@@ -24428,21 +24428,6 @@ var PipelineDefaultStepSchema = lazy(() => object({
24428
24428
  group: string().optional(),
24429
24429
  settings: record(string(), unknown()).optional()
24430
24430
  }));
24431
- var PipelineTemplateStepSchema = lazy(() => object({
24432
- addonId: string(),
24433
- enabled: boolean(),
24434
- modelId: string(),
24435
- children: array(PipelineTemplateStepSchema).readonly(),
24436
- settings: record(string(), unknown()).optional()
24437
- }));
24438
- var PipelineTemplateSchema$1 = object({
24439
- id: string(),
24440
- name: string(),
24441
- createdAt: string(),
24442
- updatedAt: string(),
24443
- engine: PipelineEngineChoiceSchema,
24444
- steps: array(PipelineTemplateStepSchema).readonly()
24445
- });
24446
24431
  var PipelineModelOptionSchema = object({
24447
24432
  id: string(),
24448
24433
  name: string(),
@@ -24764,18 +24749,6 @@ var pipelineExecutorCapability = {
24764
24749
  steps: array(PipelineStepInputSchema),
24765
24750
  deviceKey: string().optional()
24766
24751
  }), PipelineValidationResultSchema),
24767
- listTemplates: method(_void(), array(PipelineTemplateSchema$1).readonly()),
24768
- saveTemplate: method(object({
24769
- name: string(),
24770
- steps: array(PipelineTemplateStepSchema).readonly(),
24771
- engine: PipelineEngineChoiceSchema
24772
- }), PipelineTemplateSchema$1, { kind: "mutation" }),
24773
- updateTemplate: method(object({
24774
- id: string(),
24775
- name: string().optional(),
24776
- steps: array(PipelineTemplateStepSchema).readonly().optional()
24777
- }), PipelineTemplateSchema$1, { kind: "mutation" }),
24778
- deleteTemplate: method(object({ id: string() }), _void(), { kind: "mutation" }),
24779
24752
  getCapabilities: method(_void(), InferenceCapabilitiesBridge),
24780
24753
  getAddonModels: method(object({ addonId: string() }), ModelAvailabilityListBridge),
24781
24754
  downloadModel: method(object({
@@ -26756,14 +26729,6 @@ var CameraPipelineConfigSchema = object({
26756
26729
  settings: record(string(), unknown()).readonly().optional()
26757
26730
  }).nullable().optional()
26758
26731
  });
26759
- var PipelineTemplateSchema = object({
26760
- id: string(),
26761
- name: string(),
26762
- description: string().optional(),
26763
- config: CameraPipelineConfigSchema,
26764
- createdAt: string(),
26765
- updatedAt: string()
26766
- });
26767
26732
  var DeviceStepConfigSchema = object({
26768
26733
  modelId: string().optional(),
26769
26734
  settings: record(string(), unknown()).optional(),
@@ -26968,20 +26933,15 @@ var CameraBrokerStatusSchema = object({
26968
26933
  webrtcSessions: number(),
26969
26934
  rtspRestream: boolean()
26970
26935
  });
26971
- /** Shared-memory ring statistics within the decoder block. */
26972
- var CameraDecoderShmSchema = object({
26973
- framesWritten: number(),
26974
- getFrameHits: number(),
26975
- getFrameMisses: number(),
26976
- budgetMb: number()
26977
- });
26978
- /** Decoder block — null when the decoder stage is unreachable or inactive. */
26979
- var CameraDecoderStatusSchema = object({
26980
- nodeId: string(),
26981
- formats: array(string()).readonly(),
26982
- sessionCount: number(),
26983
- shm: CameraDecoderShmSchema
26984
- });
26936
+ /**
26937
+ * Decoder block — WHERE decode runs (co-located with the detection node by
26938
+ * construction); null when the camera has no detection node. It carries no
26939
+ * frame counter: the shared-memory plane whose counters it used to serve is
26940
+ * gone, and those fields read 0 forever. Whether frames actually flow is read
26941
+ * from `detection.actualFps` (frames delivered to and processed by the
26942
+ * detector), never from a counter nothing feeds.
26943
+ */
26944
+ var CameraDecoderStatusSchema = object({ nodeId: string() });
26985
26945
  /** Motion block — null when motion detection is not active for this device. */
26986
26946
  var CameraMotionStatusSchema = object({
26987
26947
  enabled: boolean(),
@@ -27835,33 +27795,7 @@ var pipelineOrchestratorCapability = {
27835
27795
  auth: "admin"
27836
27796
  }),
27837
27797
  /** Snapshot of the in-flight or last disk-wins fleet reconcile. */
27838
- getReconcileFromDiskStatus: method(_void(), DiskReconcileJobSchema, { auth: "admin" }),
27839
- /** List every template the operator has saved. */
27840
- listTemplates: method(_void(), array(PipelineTemplateSchema).readonly()),
27841
- /** Create a new named preset from a given CameraPipelineConfig. */
27842
- saveTemplate: method(object({
27843
- name: string(),
27844
- description: string().optional(),
27845
- config: CameraPipelineConfigSchema
27846
- }), PipelineTemplateSchema, {
27847
- kind: "mutation",
27848
- auth: "admin"
27849
- }),
27850
- /** Partial update of a template. Any omitted field is preserved. */
27851
- updateTemplate: method(object({
27852
- id: string(),
27853
- name: string().optional(),
27854
- description: string().optional(),
27855
- config: CameraPipelineConfigSchema.optional()
27856
- }), PipelineTemplateSchema, {
27857
- kind: "mutation",
27858
- auth: "admin"
27859
- }),
27860
- /** Remove a template. Camera configs that were seeded from it keep a copy. */
27861
- deleteTemplate: method(object({ id: string() }), object({ success: literal(true) }), {
27862
- kind: "mutation",
27863
- auth: "admin"
27864
- })
27798
+ getReconcileFromDiskStatus: method(_void(), DiskReconcileJobSchema, { auth: "admin" })
27865
27799
  }
27866
27800
  };
27867
27801
  /**
@@ -43504,12 +43438,6 @@ Object.freeze({
43504
43438
  addonId: null,
43505
43439
  access: "delete"
43506
43440
  },
43507
- "pipelineExecutor.deleteTemplate": {
43508
- capName: "pipeline-executor",
43509
- capScope: "system",
43510
- addonId: null,
43511
- access: "delete"
43512
- },
43513
43441
  "pipelineExecutor.downloadModel": {
43514
43442
  capName: "pipeline-executor",
43515
43443
  capScope: "system",
@@ -43648,12 +43576,6 @@ Object.freeze({
43648
43576
  addonId: null,
43649
43577
  access: "view"
43650
43578
  },
43651
- "pipelineExecutor.listTemplates": {
43652
- capName: "pipeline-executor",
43653
- capScope: "system",
43654
- addonId: null,
43655
- access: "view"
43656
- },
43657
43579
  "pipelineExecutor.rearmInferenceDevice": {
43658
43580
  capName: "pipeline-executor",
43659
43581
  capScope: "system",
@@ -43678,12 +43600,6 @@ Object.freeze({
43678
43600
  addonId: null,
43679
43601
  access: "create"
43680
43602
  },
43681
- "pipelineExecutor.saveTemplate": {
43682
- capName: "pipeline-executor",
43683
- capScope: "system",
43684
- addonId: null,
43685
- access: "create"
43686
- },
43687
43603
  "pipelineExecutor.setVideoPipelineSteps": {
43688
43604
  capName: "pipeline-executor",
43689
43605
  capScope: "system",
@@ -43702,12 +43618,6 @@ Object.freeze({
43702
43618
  addonId: null,
43703
43619
  access: "create"
43704
43620
  },
43705
- "pipelineExecutor.updateTemplate": {
43706
- capName: "pipeline-executor",
43707
- capScope: "system",
43708
- addonId: null,
43709
- access: "create"
43710
- },
43711
43621
  "pipelineExecutor.validatePipeline": {
43712
43622
  capName: "pipeline-executor",
43713
43623
  capScope: "system",
@@ -43738,12 +43648,6 @@ Object.freeze({
43738
43648
  addonId: null,
43739
43649
  access: "create"
43740
43650
  },
43741
- "pipelineOrchestrator.deleteTemplate": {
43742
- capName: "pipeline-orchestrator",
43743
- capScope: "system",
43744
- addonId: null,
43745
- access: "delete"
43746
- },
43747
43651
  "pipelineOrchestrator.getAgentLoad": {
43748
43652
  capName: "pipeline-orchestrator",
43749
43653
  capScope: "system",
@@ -43894,12 +43798,6 @@ Object.freeze({
43894
43798
  addonId: null,
43895
43799
  access: "view"
43896
43800
  },
43897
- "pipelineOrchestrator.listTemplates": {
43898
- capName: "pipeline-orchestrator",
43899
- capScope: "system",
43900
- addonId: null,
43901
- access: "view"
43902
- },
43903
43801
  "pipelineOrchestrator.pauseForStorageMigration": {
43904
43802
  capName: "pipeline-orchestrator",
43905
43803
  capScope: "system",
@@ -43954,12 +43852,6 @@ Object.freeze({
43954
43852
  addonId: null,
43955
43853
  access: "create"
43956
43854
  },
43957
- "pipelineOrchestrator.saveTemplate": {
43958
- capName: "pipeline-orchestrator",
43959
- capScope: "system",
43960
- addonId: null,
43961
- access: "create"
43962
- },
43963
43855
  "pipelineOrchestrator.setAgentCapabilities": {
43964
43856
  capName: "pipeline-orchestrator",
43965
43857
  capScope: "system",
@@ -44068,12 +43960,6 @@ Object.freeze({
44068
43960
  addonId: null,
44069
43961
  access: "create"
44070
43962
  },
44071
- "pipelineOrchestrator.updateTemplate": {
44072
- capName: "pipeline-orchestrator",
44073
- capScope: "system",
44074
- addonId: null,
44075
- access: "create"
44076
- },
44077
43963
  "pipelineRunner.attachCamera": {
44078
43964
  capName: "pipeline-runner",
44079
43965
  capScope: "system",
@@ -57386,22 +57272,9 @@ function mapBroker(brokerResult) {
57386
57272
  rtspRestream: brokerResult.rtspRestream
57387
57273
  };
57388
57274
  }
57389
- function mapDecoderShm(shm) {
57390
- return {
57391
- framesWritten: shm.framesWritten,
57392
- getFrameHits: shm.getFrameHits,
57393
- getFrameMisses: shm.getFrameMisses,
57394
- budgetMb: shm.budgetMb
57395
- };
57396
- }
57397
57275
  function mapDecoder(decoderResult) {
57398
57276
  if (decoderResult === null) return null;
57399
- return {
57400
- nodeId: decoderResult.nodeId,
57401
- formats: [...decoderResult.formats],
57402
- sessionCount: decoderResult.sessionCount,
57403
- shm: mapDecoderShm(decoderResult.shm)
57404
- };
57277
+ return { nodeId: decoderResult.nodeId };
57405
57278
  }
57406
57279
  function mapMotion(motionResult) {
57407
57280
  if (motionResult === null) return null;
@@ -57825,27 +57698,19 @@ var CameraStatusService = class {
57825
57698
  }), STAGE_TIMEOUT_MS, "broker", deviceId, sink);
57826
57699
  }
57827
57700
  /**
57828
- * Decoder stage. decoder cap methods (listActiveSessions/getInfo/getShmStats)
57829
- * are not node-addressable (void/sessionId input); live per-node decoder
57830
- * stats would need a node-addressable decoder method. The block therefore
57831
- * reports the node decode runs on BY CONSTRUCTION — the detection node
57832
- * (decode is always co-located with its frame consumer) — with zeroed
57833
- * stats. Unassigned camera → block stays null. (The ASSIGNMENT block
57834
- * upgrades to the broker's live session node when observed — see the T6
57835
- * post-processing in `getCameraStatus`.)
57701
+ * Decoder stage: the node decode runs on BY CONSTRUCTION — the detection
57702
+ * node (decode is always co-located with its frame consumer). Unassigned
57703
+ * camera → null. (The ASSIGNMENT block upgrades to the broker's live session
57704
+ * node when observed — see the T6 post-processing in `getCameraStatus`.)
57705
+ *
57706
+ * No counter rides along. This block used to serve shared-memory ring stats,
57707
+ * session count and formats hard-coded to 0 / [] after the SHM frame plane
57708
+ * was retired (frames live in the in-RAM RetainedFrameStore), and the admin
57709
+ * UI raised "decode path stalled" on every active camera from those zeros.
57710
+ * Frames reaching the detector are read from `detection.actualFps`.
57836
57711
  */
57837
57712
  buildDecoderStage(detectionNodeId) {
57838
- return detectionNodeId ? Promise.resolve({
57839
- nodeId: detectionNodeId,
57840
- formats: [],
57841
- sessionCount: 0,
57842
- shm: {
57843
- framesWritten: 0,
57844
- getFrameHits: 0,
57845
- getFrameMisses: 0,
57846
- budgetMb: 0
57847
- }
57848
- }) : Promise.resolve(null);
57713
+ return Promise.resolve(detectionNodeId ? { nodeId: detectionNodeId } : null);
57849
57714
  }
57850
57715
  /**
57851
57716
  * Motion stage (from cached runner config). Motion configuration lives in
@@ -64376,8 +64241,8 @@ function migrateCameraSettings(cameraMap) {
64376
64241
  * refused rather than substituted (D54). Reset happens to the STORE, before
64377
64242
  * anything is resolved.
64378
64243
  *
64379
- * Templates and the wholesale `pipelineByAgent` override are not swept: both
64380
- * carry step STRUCTURE only, and provisioning never reads a `modelId` from them.
64244
+ * The wholesale `pipelineByAgent` override is not swept: it carries step
64245
+ * STRUCTURE only, and provisioning never reads a `modelId` from it.
64381
64246
  */
64382
64247
  /** The one predicate: a pin to a deleted catalog id that no custom model owns. */
64383
64248
  function pinNamesRemovedModel(stepId, modelId, isCustom) {
@@ -64626,8 +64491,7 @@ async function redispatchAffected(deps, cleared) {
64626
64491
  /**
64627
64492
  * `orchestrator-store-schemas.ts` — whole-blob Zod schemas for the
64628
64493
  * orchestrator's addon-store keys that persist an ENTIRE collection
64629
- * under a single key (`nodeBindings`, `templates`, `agentSettings`,
64630
- * `cameraSettings`).
64494
+ * under a single key (`nodeBindings`, `agentSettings`, `cameraSettings`).
64631
64495
  *
64632
64496
  * These back the durable-state primitive (`this.state(KEY, Schema, {})`)
64633
64497
  * so a hand-written serializer can never silently drop a field on save:
@@ -64640,32 +64504,7 @@ async function redispatchAffected(deps, cleared) {
64640
64504
  * falls back to the empty map on a whole-blob parse failure, so the
64641
64505
  * schema is kept faithful to the on-disk shape rather than overly strict.
64642
64506
  */
64643
- var EngineChoiceSchema = object({
64644
- runtime: _enum(["python", "node"]).transform(() => "python"),
64645
- backend: string(),
64646
- format: string(),
64647
- device: string().optional()
64648
- });
64649
64507
  var NodeBindingsSchema = record(string(), record(string(), string()));
64650
- var StoredPipelineConfigSchema = object({
64651
- engine: EngineChoiceSchema.optional(),
64652
- steps: array(PipelineStepInputSchema).readonly(),
64653
- audio: object({
64654
- engine: EngineChoiceSchema.optional(),
64655
- modelId: string().optional(),
64656
- enabled: boolean(),
64657
- settings: record(string(), unknown()).readonly().optional()
64658
- }).nullable().optional()
64659
- });
64660
- var StoredPipelineTemplateSchema = object({
64661
- id: string(),
64662
- name: string(),
64663
- description: string().optional(),
64664
- config: StoredPipelineConfigSchema,
64665
- createdAt: string(),
64666
- updatedAt: string()
64667
- });
64668
- var TemplatesSchema = record(string(), StoredPipelineTemplateSchema);
64669
64508
  var StoredAgentAddonConfigSchema = object({
64670
64509
  enabled: boolean(),
64671
64510
  modelId: string().optional(),
@@ -64770,7 +64609,6 @@ var PipelineSettingsStore = class PipelineSettingsStore {
64770
64609
  blobWriteLock = new KeyedAsyncLock({ isShuttingDown: () => this.disposed });
64771
64610
  static AGENT_SETTINGS_LOCK_KEY = "agentSettings";
64772
64611
  _nodeBindingsState = null;
64773
- _templatesState = null;
64774
64612
  _agentSettingsState = null;
64775
64613
  _cameraSettingsState = null;
64776
64614
  _bindingsMigrationDoneState = null;
@@ -64779,10 +64617,6 @@ var PipelineSettingsStore = class PipelineSettingsStore {
64779
64617
  if (!this._nodeBindingsState) this._nodeBindingsState = this.deps.state("nodeBindings", NodeBindingsSchema, {});
64780
64618
  return this._nodeBindingsState;
64781
64619
  }
64782
- get templatesState() {
64783
- if (!this._templatesState) this._templatesState = this.deps.state("templates", TemplatesSchema, {});
64784
- return this._templatesState;
64785
- }
64786
64620
  get agentSettingsState() {
64787
64621
  if (!this._agentSettingsState) this._agentSettingsState = this.deps.state("agentSettings", AgentSettingsMapSchema, {});
64788
64622
  return this._agentSettingsState;
@@ -65065,59 +64899,6 @@ var PipelineSettingsStore = class PipelineSettingsStore {
65065
64899
  return rest;
65066
64900
  });
65067
64901
  }
65068
- /** Read the templates map from the addon store via the durable handle. */
65069
- async readTemplatesMap() {
65070
- const raw = await this.templatesState.get();
65071
- const out = {};
65072
- for (const [key, value] of Object.entries(raw)) if (this.isPipelineTemplate(value)) out[key] = value;
65073
- return out;
65074
- }
65075
- async listTemplates() {
65076
- const templates = await this.readTemplatesMap();
65077
- return Object.values(templates).slice().toSorted((a, b) => a.name.localeCompare(b.name));
65078
- }
65079
- async saveTemplate(input) {
65080
- const now = (/* @__PURE__ */ new Date()).toISOString();
65081
- const template = {
65082
- id: this.generateTemplateId(),
65083
- name: input.name,
65084
- description: input.description,
65085
- config: input.config,
65086
- createdAt: now,
65087
- updatedAt: now
65088
- };
65089
- const templates = await this.readTemplatesMap();
65090
- templates[template.id] = template;
65091
- await this.templatesState.set(templates);
65092
- this.deps.logger.info("template saved", { meta: {
65093
- templateId: template.id,
65094
- name: template.name
65095
- } });
65096
- return template;
65097
- }
65098
- async updateTemplate(input) {
65099
- const templates = await this.readTemplatesMap();
65100
- const existing = templates[input.id];
65101
- if (!existing) throw new Error(`updateTemplate: template '${input.id}' not found`);
65102
- const next = {
65103
- ...existing,
65104
- ...input.name !== void 0 ? { name: input.name } : {},
65105
- ...input.description !== void 0 ? { description: input.description } : {},
65106
- ...input.config !== void 0 ? { config: input.config } : {},
65107
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
65108
- };
65109
- templates[input.id] = next;
65110
- await this.templatesState.set(templates);
65111
- return next;
65112
- }
65113
- async deleteTemplate(input) {
65114
- const templates = await this.readTemplatesMap();
65115
- if (!templates[input.id]) return { success: true };
65116
- delete templates[input.id];
65117
- await this.templatesState.set(templates);
65118
- this.deps.logger.info("template deleted", { meta: { templateId: input.id } });
65119
- return { success: true };
65120
- }
65121
64902
  catalogCache = /* @__PURE__ */ new Map();
65122
64903
  /**
65123
64904
  * A node's `PipelineSchema`: the cached answer when fresh, else ONE live
@@ -65679,21 +65460,6 @@ var PipelineSettingsStore = class PipelineSettingsStore {
65679
65460
  const v = value;
65680
65461
  return Array.isArray(v["steps"]);
65681
65462
  }
65682
- isPipelineTemplate(value) {
65683
- if (!value || typeof value !== "object") return false;
65684
- const v = value;
65685
- return typeof v["id"] === "string" && typeof v["name"] === "string" && typeof v["createdAt"] === "string" && typeof v["updatedAt"] === "string" && this.isCameraPipelineConfig(v["config"]);
65686
- }
65687
- /**
65688
- * Generate a short template id. Collision risk at N≤1000 templates is
65689
- * effectively zero (12 hex chars = 48 bits of entropy). Not a UUID
65690
- * because the persisted shape is a plain map keyed by id and shorter
65691
- * keys keep the JSON compact.
65692
- */
65693
- generateTemplateId() {
65694
- const rand = Math.random().toString(36).slice(2, 8);
65695
- return `tpl_${Date.now().toString(36).slice(-6)}${rand}`;
65696
- }
65697
65463
  };
65698
65464
  /**
65699
65465
  * The camera's override for one accelerator, with its CAMERA-WIDE settings
@@ -71853,7 +71619,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
71853
71619
  nodeLifecycle = null;
71854
71620
  /**
71855
71621
  * The 3-level pipeline settings store (agent + camera settings maps,
71856
- * templates, pipeline-executor catalog cache) plus the co-declared
71622
+ * pipeline-executor catalog cache) plus the co-declared
71857
71623
  * `nodeBindings` capability-binding map and the one-shot bindings-
71858
71624
  * migration guard flag — see `pipeline-settings-store.ts` (S4
71859
71625
  * extraction, cluster C11). Constructed early in `onInitialize` (before
@@ -73415,18 +73181,6 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
73415
73181
  const resolved = await this.settingsStore.resolvePipelineForDevice(deviceId);
73416
73182
  this.emitCameraUpdated(deviceId, resolved);
73417
73183
  }
73418
- async listTemplates() {
73419
- return this.settingsStore.listTemplates();
73420
- }
73421
- async saveTemplate(input) {
73422
- return this.settingsStore.saveTemplate(input);
73423
- }
73424
- async updateTemplate(input) {
73425
- return this.settingsStore.updateTemplate(input);
73426
- }
73427
- async deleteTemplate(input) {
73428
- return this.settingsStore.deleteTemplate(input);
73429
- }
73430
73184
  /**
73431
73185
  * The per-camera FUNCTION SWITCH group (D61) — derived, never stored.
73432
73186
  *