@memberjunction/predictive-studio 0.0.1 → 5.44.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 (266) hide show
  1. package/README.md +101 -28
  2. package/dist/actions/base-predictive-studio.action.d.ts +63 -0
  3. package/dist/actions/base-predictive-studio.action.d.ts.map +1 -0
  4. package/dist/actions/base-predictive-studio.action.js +125 -0
  5. package/dist/actions/base-predictive-studio.action.js.map +1 -0
  6. package/dist/actions/index.d.ts +38 -0
  7. package/dist/actions/index.d.ts.map +1 -0
  8. package/dist/actions/index.js +49 -0
  9. package/dist/actions/index.js.map +1 -0
  10. package/dist/actions/model-scoring-action-generator.d.ts +108 -0
  11. package/dist/actions/model-scoring-action-generator.d.ts.map +1 -0
  12. package/dist/actions/model-scoring-action-generator.js +316 -0
  13. package/dist/actions/model-scoring-action-generator.js.map +1 -0
  14. package/dist/actions/promote-model.action.d.ts +102 -0
  15. package/dist/actions/promote-model.action.d.ts.map +1 -0
  16. package/dist/actions/promote-model.action.js +132 -0
  17. package/dist/actions/promote-model.action.js.map +1 -0
  18. package/dist/actions/promote-model.gate.d.ts +77 -0
  19. package/dist/actions/promote-model.gate.d.ts.map +1 -0
  20. package/dist/actions/promote-model.gate.js +205 -0
  21. package/dist/actions/promote-model.gate.js.map +1 -0
  22. package/dist/actions/run-experiment.action.d.ts +60 -0
  23. package/dist/actions/run-experiment.action.d.ts.map +1 -0
  24. package/dist/actions/run-experiment.action.js +134 -0
  25. package/dist/actions/run-experiment.action.js.map +1 -0
  26. package/dist/actions/run-experiment.deps.d.ts +47 -0
  27. package/dist/actions/run-experiment.deps.d.ts.map +1 -0
  28. package/dist/actions/run-experiment.deps.js +71 -0
  29. package/dist/actions/run-experiment.deps.js.map +1 -0
  30. package/dist/actions/schedule-model-scoring.action.d.ts +71 -0
  31. package/dist/actions/schedule-model-scoring.action.d.ts.map +1 -0
  32. package/dist/actions/schedule-model-scoring.action.js +148 -0
  33. package/dist/actions/schedule-model-scoring.action.js.map +1 -0
  34. package/dist/actions/score-record-set.action.d.ts +133 -0
  35. package/dist/actions/score-record-set.action.d.ts.map +1 -0
  36. package/dist/actions/score-record-set.action.js +136 -0
  37. package/dist/actions/score-record-set.action.js.map +1 -0
  38. package/dist/actions/score-record-set.runner.d.ts +192 -0
  39. package/dist/actions/score-record-set.runner.d.ts.map +1 -0
  40. package/dist/actions/score-record-set.runner.js +416 -0
  41. package/dist/actions/score-record-set.runner.js.map +1 -0
  42. package/dist/actions/train-model.action.d.ts +57 -0
  43. package/dist/actions/train-model.action.d.ts.map +1 -0
  44. package/dist/actions/train-model.action.js +111 -0
  45. package/dist/actions/train-model.action.js.map +1 -0
  46. package/dist/agent/index.d.ts +14 -0
  47. package/dist/agent/index.d.ts.map +1 -0
  48. package/dist/agent/index.js +14 -0
  49. package/dist/agent/index.js.map +1 -0
  50. package/dist/agent/model-dev-orchestrator-agent.d.ts +42 -0
  51. package/dist/agent/model-dev-orchestrator-agent.d.ts.map +1 -0
  52. package/dist/agent/model-dev-orchestrator-agent.js +76 -0
  53. package/dist/agent/model-dev-orchestrator-agent.js.map +1 -0
  54. package/dist/agent/modeling-plan-to-pipeline.d.ts +49 -0
  55. package/dist/agent/modeling-plan-to-pipeline.d.ts.map +1 -0
  56. package/dist/agent/modeling-plan-to-pipeline.js +101 -0
  57. package/dist/agent/modeling-plan-to-pipeline.js.map +1 -0
  58. package/dist/agent/pipeline-builder-agent.d.ts +58 -0
  59. package/dist/agent/pipeline-builder-agent.d.ts.map +1 -0
  60. package/dist/agent/pipeline-builder-agent.js +101 -0
  61. package/dist/agent/pipeline-builder-agent.js.map +1 -0
  62. package/dist/agent/pipeline-builder.d.ts +67 -0
  63. package/dist/agent/pipeline-builder.d.ts.map +1 -0
  64. package/dist/agent/pipeline-builder.js +114 -0
  65. package/dist/agent/pipeline-builder.js.map +1 -0
  66. package/dist/experiment/concurrency.d.ts +41 -0
  67. package/dist/experiment/concurrency.d.ts.map +1 -0
  68. package/dist/experiment/concurrency.js +54 -0
  69. package/dist/experiment/concurrency.js.map +1 -0
  70. package/dist/experiment/experiment-orchestrator.d.ts +136 -0
  71. package/dist/experiment/experiment-orchestrator.d.ts.map +1 -0
  72. package/dist/experiment/experiment-orchestrator.js +408 -0
  73. package/dist/experiment/experiment-orchestrator.js.map +1 -0
  74. package/dist/experiment/index.d.ts +17 -0
  75. package/dist/experiment/index.d.ts.map +1 -0
  76. package/dist/experiment/index.js +17 -0
  77. package/dist/experiment/index.js.map +1 -0
  78. package/dist/experiment/leaderboard.d.ts +50 -0
  79. package/dist/experiment/leaderboard.d.ts.map +1 -0
  80. package/dist/experiment/leaderboard.js +91 -0
  81. package/dist/experiment/leaderboard.js.map +1 -0
  82. package/dist/experiment/seams.d.ts +95 -0
  83. package/dist/experiment/seams.d.ts.map +1 -0
  84. package/dist/experiment/seams.js +126 -0
  85. package/dist/experiment/seams.js.map +1 -0
  86. package/dist/experiment/types.d.ts +228 -0
  87. package/dist/experiment/types.d.ts.map +1 -0
  88. package/dist/experiment/types.js +19 -0
  89. package/dist/experiment/types.js.map +1 -0
  90. package/dist/experiment/wave-strategist.d.ts +31 -0
  91. package/dist/experiment/wave-strategist.d.ts.map +1 -0
  92. package/dist/experiment/wave-strategist.js +50 -0
  93. package/dist/experiment/wave-strategist.js.map +1 -0
  94. package/dist/feature-assembly/as-of.d.ts +74 -0
  95. package/dist/feature-assembly/as-of.d.ts.map +1 -0
  96. package/dist/feature-assembly/as-of.js +136 -0
  97. package/dist/feature-assembly/as-of.js.map +1 -0
  98. package/dist/feature-assembly/data-access.d.ts +114 -0
  99. package/dist/feature-assembly/data-access.d.ts.map +1 -0
  100. package/dist/feature-assembly/data-access.js +68 -0
  101. package/dist/feature-assembly/data-access.js.map +1 -0
  102. package/dist/feature-assembly/feature-assembly-executor.d.ts +273 -0
  103. package/dist/feature-assembly/feature-assembly-executor.d.ts.map +1 -0
  104. package/dist/feature-assembly/feature-assembly-executor.js +521 -0
  105. package/dist/feature-assembly/feature-assembly-executor.js.map +1 -0
  106. package/dist/feature-assembly/index.d.ts +13 -0
  107. package/dist/feature-assembly/index.d.ts.map +1 -0
  108. package/dist/feature-assembly/index.js +13 -0
  109. package/dist/feature-assembly/index.js.map +1 -0
  110. package/dist/feature-assembly/leakage-guard.d.ts +86 -0
  111. package/dist/feature-assembly/leakage-guard.d.ts.map +1 -0
  112. package/dist/feature-assembly/leakage-guard.js +111 -0
  113. package/dist/feature-assembly/leakage-guard.js.map +1 -0
  114. package/dist/feature-assembly/vision-llm.d.ts +125 -0
  115. package/dist/feature-assembly/vision-llm.d.ts.map +1 -0
  116. package/dist/feature-assembly/vision-llm.js +211 -0
  117. package/dist/feature-assembly/vision-llm.js.map +1 -0
  118. package/dist/feature-pipelines/feature-pipeline-engine.d.ts +159 -0
  119. package/dist/feature-pipelines/feature-pipeline-engine.d.ts.map +1 -0
  120. package/dist/feature-pipelines/feature-pipeline-engine.js +298 -0
  121. package/dist/feature-pipelines/feature-pipeline-engine.js.map +1 -0
  122. package/dist/feature-pipelines/index.d.ts +13 -0
  123. package/dist/feature-pipelines/index.d.ts.map +1 -0
  124. package/dist/feature-pipelines/index.js +13 -0
  125. package/dist/feature-pipelines/index.js.map +1 -0
  126. package/dist/feature-pipelines/types.d.ts +72 -0
  127. package/dist/feature-pipelines/types.d.ts.map +1 -0
  128. package/dist/feature-pipelines/types.js +17 -0
  129. package/dist/feature-pipelines/types.js.map +1 -0
  130. package/dist/index.d.ts +37 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +80 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/maintenance/index.d.ts +19 -0
  135. package/dist/maintenance/index.d.ts.map +1 -0
  136. package/dist/maintenance/index.js +19 -0
  137. package/dist/maintenance/index.js.map +1 -0
  138. package/dist/maintenance/maintenance-engine.d.ts +152 -0
  139. package/dist/maintenance/maintenance-engine.d.ts.map +1 -0
  140. package/dist/maintenance/maintenance-engine.js +412 -0
  141. package/dist/maintenance/maintenance-engine.js.map +1 -0
  142. package/dist/maintenance/metrics.d.ts +37 -0
  143. package/dist/maintenance/metrics.d.ts.map +1 -0
  144. package/dist/maintenance/metrics.js +85 -0
  145. package/dist/maintenance/metrics.js.map +1 -0
  146. package/dist/maintenance/seams.d.ts +85 -0
  147. package/dist/maintenance/seams.d.ts.map +1 -0
  148. package/dist/maintenance/seams.js +166 -0
  149. package/dist/maintenance/seams.js.map +1 -0
  150. package/dist/maintenance/types.d.ts +318 -0
  151. package/dist/maintenance/types.d.ts.map +1 -0
  152. package/dist/maintenance/types.js +27 -0
  153. package/dist/maintenance/types.js.map +1 -0
  154. package/dist/operations/__tests__/helpers.d.ts +30 -0
  155. package/dist/operations/__tests__/helpers.d.ts.map +1 -0
  156. package/dist/operations/__tests__/helpers.js +44 -0
  157. package/dist/operations/__tests__/helpers.js.map +1 -0
  158. package/dist/operations/control-experiment-session.operation.d.ts +33 -0
  159. package/dist/operations/control-experiment-session.operation.d.ts.map +1 -0
  160. package/dist/operations/control-experiment-session.operation.js +71 -0
  161. package/dist/operations/control-experiment-session.operation.js.map +1 -0
  162. package/dist/operations/create-scoring-process.operation.d.ts +30 -0
  163. package/dist/operations/create-scoring-process.operation.d.ts.map +1 -0
  164. package/dist/operations/create-scoring-process.operation.js +65 -0
  165. package/dist/operations/create-scoring-process.operation.js.map +1 -0
  166. package/dist/operations/delegation.d.ts +113 -0
  167. package/dist/operations/delegation.d.ts.map +1 -0
  168. package/dist/operations/delegation.js +139 -0
  169. package/dist/operations/delegation.js.map +1 -0
  170. package/dist/operations/index.d.ts +40 -0
  171. package/dist/operations/index.d.ts.map +1 -0
  172. package/dist/operations/index.js +55 -0
  173. package/dist/operations/index.js.map +1 -0
  174. package/dist/operations/promote-model.operation.d.ts +57 -0
  175. package/dist/operations/promote-model.operation.d.ts.map +1 -0
  176. package/dist/operations/promote-model.operation.js +113 -0
  177. package/dist/operations/promote-model.operation.js.map +1 -0
  178. package/dist/operations/run-feature-pipeline.operation.d.ts +56 -0
  179. package/dist/operations/run-feature-pipeline.operation.d.ts.map +1 -0
  180. package/dist/operations/run-feature-pipeline.operation.js +94 -0
  181. package/dist/operations/run-feature-pipeline.operation.js.map +1 -0
  182. package/dist/operations/score-record-set.operation.d.ts +47 -0
  183. package/dist/operations/score-record-set.operation.d.ts.map +1 -0
  184. package/dist/operations/score-record-set.operation.js +113 -0
  185. package/dist/operations/score-record-set.operation.js.map +1 -0
  186. package/dist/operations/start-experiment-session.operation.d.ts +66 -0
  187. package/dist/operations/start-experiment-session.operation.d.ts.map +1 -0
  188. package/dist/operations/start-experiment-session.operation.js +132 -0
  189. package/dist/operations/start-experiment-session.operation.js.map +1 -0
  190. package/dist/operations/train-model.operation.d.ts +50 -0
  191. package/dist/operations/train-model.operation.d.ts.map +1 -0
  192. package/dist/operations/train-model.operation.js +114 -0
  193. package/dist/operations/train-model.operation.js.map +1 -0
  194. package/dist/scheduling/index.d.ts +13 -0
  195. package/dist/scheduling/index.d.ts.map +1 -0
  196. package/dist/scheduling/index.js +13 -0
  197. package/dist/scheduling/index.js.map +1 -0
  198. package/dist/scheduling/scheduled-model-scoring.d.ts +169 -0
  199. package/dist/scheduling/scheduled-model-scoring.d.ts.map +1 -0
  200. package/dist/scheduling/scheduled-model-scoring.js +189 -0
  201. package/dist/scheduling/scheduled-model-scoring.js.map +1 -0
  202. package/dist/scoring/artifact-loader.d.ts +65 -0
  203. package/dist/scoring/artifact-loader.d.ts.map +1 -0
  204. package/dist/scoring/artifact-loader.js +97 -0
  205. package/dist/scoring/artifact-loader.js.map +1 -0
  206. package/dist/scoring/index.d.ts +26 -0
  207. package/dist/scoring/index.d.ts.map +1 -0
  208. package/dist/scoring/index.js +26 -0
  209. package/dist/scoring/index.js.map +1 -0
  210. package/dist/scoring/ml-model-inference-processor.d.ts +154 -0
  211. package/dist/scoring/ml-model-inference-processor.d.ts.map +1 -0
  212. package/dist/scoring/ml-model-inference-processor.js +320 -0
  213. package/dist/scoring/ml-model-inference-processor.js.map +1 -0
  214. package/dist/scoring/ml-model-score-enricher.d.ts +80 -0
  215. package/dist/scoring/ml-model-score-enricher.d.ts.map +1 -0
  216. package/dist/scoring/ml-model-score-enricher.js +139 -0
  217. package/dist/scoring/ml-model-score-enricher.js.map +1 -0
  218. package/dist/scoring/register.d.ts +81 -0
  219. package/dist/scoring/register.d.ts.map +1 -0
  220. package/dist/scoring/register.js +105 -0
  221. package/dist/scoring/register.js.map +1 -0
  222. package/dist/scoring/scoring-binding.d.ts +72 -0
  223. package/dist/scoring/scoring-binding.d.ts.map +1 -0
  224. package/dist/scoring/scoring-binding.js +76 -0
  225. package/dist/scoring/scoring-binding.js.map +1 -0
  226. package/dist/scoring/scoring-process-shared.d.ts +105 -0
  227. package/dist/scoring/scoring-process-shared.d.ts.map +1 -0
  228. package/dist/scoring/scoring-process-shared.js +141 -0
  229. package/dist/scoring/scoring-process-shared.js.map +1 -0
  230. package/dist/scoring/scoring-process.d.ts +128 -0
  231. package/dist/scoring/scoring-process.d.ts.map +1 -0
  232. package/dist/scoring/scoring-process.js +146 -0
  233. package/dist/scoring/scoring-process.js.map +1 -0
  234. package/dist/scoring/seams.d.ts +40 -0
  235. package/dist/scoring/seams.d.ts.map +1 -0
  236. package/dist/scoring/seams.js +66 -0
  237. package/dist/scoring/seams.js.map +1 -0
  238. package/dist/scoring/startup-register.d.ts +49 -0
  239. package/dist/scoring/startup-register.d.ts.map +1 -0
  240. package/dist/scoring/startup-register.js +72 -0
  241. package/dist/scoring/startup-register.js.map +1 -0
  242. package/dist/scoring/types.d.ts +134 -0
  243. package/dist/scoring/types.d.ts.map +1 -0
  244. package/dist/scoring/types.js +26 -0
  245. package/dist/scoring/types.js.map +1 -0
  246. package/dist/training/artifact-store.d.ts +124 -0
  247. package/dist/training/artifact-store.d.ts.map +1 -0
  248. package/dist/training/artifact-store.js +163 -0
  249. package/dist/training/artifact-store.js.map +1 -0
  250. package/dist/training/index.d.ts +13 -0
  251. package/dist/training/index.d.ts.map +1 -0
  252. package/dist/training/index.js +13 -0
  253. package/dist/training/index.js.map +1 -0
  254. package/dist/training/seams.d.ts +57 -0
  255. package/dist/training/seams.d.ts.map +1 -0
  256. package/dist/training/seams.js +103 -0
  257. package/dist/training/seams.js.map +1 -0
  258. package/dist/training/training-engine.d.ts +96 -0
  259. package/dist/training/training-engine.d.ts.map +1 -0
  260. package/dist/training/training-engine.js +300 -0
  261. package/dist/training/training-engine.js.map +1 -0
  262. package/dist/training/types.d.ts +159 -0
  263. package/dist/training/types.d.ts.map +1 -0
  264. package/dist/training/types.js +16 -0
  265. package/dist/training/types.js.map +1 -0
  266. package/package.json +44 -7
@@ -0,0 +1,159 @@
1
+ /**
2
+ * @module feature-pipelines/feature-pipeline-engine
3
+ *
4
+ * **FeaturePipelineEngine** — the discovery + monitoring cache for Feature
5
+ * Pipelines (Predictive Studio SP6, `plans/predictive-studio.md` §5.4).
6
+ *
7
+ * ## What a Feature Pipeline is (the "category route")
8
+ *
9
+ * A Feature Pipeline has **no dedicated entity / table**. It IS an
10
+ * `MJ: Record Processes` row whose `WorkType` is `Infer` / `Action` / `Agent`
11
+ * (with a write-back `OutputMapping`), **categorized** into the seeded
12
+ * `"Feature Pipeline"` `MJ: Record Process Categories` row. The run path already
13
+ * exists — `PredictiveStudio.RunFeaturePipeline` (a Remote Operation) and its
14
+ * sibling Action both delegate to the Record Set Processing substrate's
15
+ * `RecordProcessExecutor`. This engine makes those categorized rows
16
+ * **first-class, discoverable, and monitorable** for the Model Development Agent
17
+ * and the Knowledge Hub UI, without inventing a parallel registry.
18
+ *
19
+ * ## Why a BaseEngine (the canonical MJ reactive-cache pattern)
20
+ *
21
+ * Following `InteractiveFormsEngine` / `ComponentMetadataEngine`: the dataset is
22
+ * tiny (the feature-pipeline Record Processes plus their recent `MJ: Process Runs`
23
+ * headers — no big columns), so we cache it and get **reactivity for free**:
24
+ *
25
+ * - The `Configs` array passed to `Load()` tells BaseEngine which entities to
26
+ * subscribe to. A save / delete / remote-invalidate on a matching
27
+ * `MJ: Record Processes` or `MJ: Process Runs` row automatically refreshes the
28
+ * in-memory array (in place when possible) — **no manual invalidation code**.
29
+ * - Each cached property exposes a lazy `BehaviorSubject` via
30
+ * `ObserveProperty(...)`; the convenience getters {@link Pipelines$} /
31
+ * {@link Runs$} wrap it for Angular `async`-pipe consumption.
32
+ * - Lazy-load: every entry point calls `await FeaturePipelineEngine.Instance.Config(false, user, provider)`.
33
+ * BaseEngine's `Config` is a no-op when already loaded, so the call is cheap
34
+ * to sprinkle everywhere — the first caller pays, everyone else gets cache hits,
35
+ * and users who never open the surface pay nothing.
36
+ *
37
+ * ## Provider threading
38
+ *
39
+ * Multi-provider safe: callers pass the active `IMetadataProvider` to `Config`,
40
+ * and `GetProviderInstance` resolves a per-provider engine instance (the standard
41
+ * BaseEngine convention). All reads operate on the strongly-typed cached entities;
42
+ * the freshness computation is a pure function over already-loaded rows.
43
+ */
44
+ import { BaseEngine, type IMetadataProvider, type UserInfo } from '@memberjunction/core';
45
+ import type { MJRecordProcessEntity, MJProcessRunEntity } from '@memberjunction/core-entities';
46
+ import type { Observable } from 'rxjs';
47
+ import { type FeaturePipelineSummary } from './types.js';
48
+ /**
49
+ * Discovery + monitoring engine for Feature Pipelines. Singleton per provider;
50
+ * never construct directly — use {@link Instance} (default provider) or
51
+ * `BaseEngine.GetProviderInstance(provider, FeaturePipelineEngine)`.
52
+ */
53
+ export declare class FeaturePipelineEngine extends BaseEngine<FeaturePipelineEngine> {
54
+ /** Standard singleton accessor for the default provider. */
55
+ static get Instance(): FeaturePipelineEngine;
56
+ /** All `MJ: Record Processes` rows (cached); narrowed to feature pipelines by {@link Pipelines}. */
57
+ private _recordProcesses;
58
+ /** Recent `MJ: Process Runs` headers (cached) used to derive last-run / freshness. */
59
+ private _processRuns;
60
+ /**
61
+ * Lazy-load the Record Process + recent Process Run caches. Safe to call from
62
+ * every entry point — a no-op when already loaded (unless `forceRefresh`).
63
+ *
64
+ * We deliberately cache **all** `MJ: Record Processes` (a small, metadata-style
65
+ * table) rather than server-side filtering to the category, because the
66
+ * category id isn't known until the seeded row is loaded and because the full
67
+ * set is tiny; {@link Pipelines} narrows in memory by the category name. Process
68
+ * Runs are capped to the most recent rows (the audit headers carry no large
69
+ * columns) so freshness is cheap to compute.
70
+ *
71
+ * @param forceRefresh re-run the underlying RunViews even if already loaded
72
+ * @param contextUser the context user (required server-side for audit/security)
73
+ * @param provider the metadata provider to scope this load to (multi-provider safe)
74
+ */
75
+ Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
76
+ /**
77
+ * The feature-pipeline Record Processes — every cached `MJ: Record Processes`
78
+ * row whose `Category` is the seeded {@link FEATURE_PIPELINE_CATEGORY_NAME}.
79
+ * Matched on the denormalized `Category` view field (case-insensitive) so no
80
+ * separate category lookup is needed.
81
+ */
82
+ get Pipelines(): MJRecordProcessEntity[];
83
+ /** All cached Process Run headers (newest first; all entities — callers filter). */
84
+ get Runs(): MJProcessRunEntity[];
85
+ /**
86
+ * RxJS Observable of the feature-pipeline Record Processes. Emits the current
87
+ * filtered array on subscribe (BehaviorSubject semantics) and re-emits on every
88
+ * save / delete / remote-invalidate affecting `MJ: Record Processes`.
89
+ *
90
+ * NOTE: `ObserveProperty` emits the raw `_recordProcesses` array; Angular
91
+ * consumers should `map(rows => rows.filter(...))` or simply read {@link Pipelines}
92
+ * inside the subscription. We expose a `map`-friendly stream so callers stay
93
+ * reactive while still seeing only feature pipelines.
94
+ */
95
+ get Pipelines$(): Observable<MJRecordProcessEntity[]>;
96
+ /** RxJS Observable of the Process Run headers — same reactivity contract as {@link Pipelines$}. */
97
+ get Runs$(): Observable<MJProcessRunEntity[]>;
98
+ /** Find a feature pipeline by its `MJ: Record Processes` id. O(N) — N is small. */
99
+ FindPipelineByID(id: string): MJRecordProcessEntity | undefined;
100
+ /**
101
+ * The most recent `MJ: Process Runs` header for a given feature pipeline, or
102
+ * `undefined` if it has never run. Relies on the `__mj_CreatedAt DESC` order
103
+ * applied in {@link Config} (first match = newest).
104
+ *
105
+ * @param recordProcessID the feature pipeline's `MJ: Record Processes` id
106
+ */
107
+ LatestRunForPipeline(recordProcessID: string): MJProcessRunEntity | undefined;
108
+ /**
109
+ * Build the UI-/agent-facing summary for every feature pipeline: identity,
110
+ * target entity, the write-back output attribute, and last-run / freshness
111
+ * derived from the cached Process Run headers. Pure projection over the loaded
112
+ * caches — call after {@link Config}.
113
+ */
114
+ GetPipelineSummaries(): FeaturePipelineSummary[];
115
+ /**
116
+ * Pure, side-effect-free builder used by {@link GetPipelineSummaries} and by
117
+ * unit tests (which inject in-memory arrays — no live DB, no BaseEngine load).
118
+ * Separating the projection from the cache mirrors `InteractiveFormsEngine`'s
119
+ * split of loading vs. querying.
120
+ *
121
+ * @param pipelines the feature-pipeline Record Processes
122
+ * @param runs the Process Run headers (any order; newest-wins is computed here)
123
+ */
124
+ static BuildSummaries(pipelines: ReadonlyArray<MJRecordProcessEntity>, runs: ReadonlyArray<MJProcessRunEntity>): FeaturePipelineSummary[];
125
+ /** Whether a Record Process belongs to the seeded Feature Pipeline category. */
126
+ private isFeaturePipeline;
127
+ /** Newest run for a pipeline from an already-ordered (newest-first) array. */
128
+ private latestRunForPipeline;
129
+ /**
130
+ * Project one pipeline + the run set into a {@link FeaturePipelineSummary}.
131
+ * Static so it can be reused by {@link BuildSummaries} without an instance.
132
+ */
133
+ private static buildSummary;
134
+ /** Newest run for a pipeline id, scanning by `StartTime`/`__mj_CreatedAt` regardless of input order. */
135
+ private static newestRun;
136
+ /** Sort key for "most recent run": prefer StartTime, then EndTime, then createdAt. */
137
+ private static runSortTime;
138
+ /**
139
+ * Normalize a `MJ: Process Runs` status into the small {@link FeaturePipelineRunStatus}
140
+ * union the UI renders. `undefined` run → `'Never'`.
141
+ */
142
+ private static mapRunStatus;
143
+ /**
144
+ * Best-effort human-readable "what attribute does this pipeline write" derived
145
+ * from the Record Process `OutputMapping` JSON. The mapping shape is opaque to
146
+ * this engine (it's owned by the Record Set Processing substrate), so we probe
147
+ * the common shapes — a top-level `field` / `fields` / `targetField`, or an
148
+ * array of field names — and fall back to `null` when we can't tell. Never
149
+ * throws on malformed JSON.
150
+ *
151
+ * @param outputMapping the raw `OutputMapping` JSON string, or null
152
+ */
153
+ private static deriveOutputAttribute;
154
+ /** Extract a comma-joined field-name string from a parsed OutputMapping payload. */
155
+ private static extractFieldNames;
156
+ /** Collect field names from either an object map or an array of names. */
157
+ private static fieldNamesFrom;
158
+ }
159
+ //# sourceMappingURL=feature-pipeline-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-pipeline-engine.d.ts","sourceRoot":"","sources":["../../src/feature-pipelines/feature-pipeline-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EACL,UAAU,EAEV,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IAC1E,4DAA4D;IAC5D,WAAkB,QAAQ,IAAI,qBAAqB,CAElD;IAED,oGAAoG;IACpG,OAAO,CAAC,gBAAgB,CAA+B;IAEvD,sFAAsF;IACtF,OAAO,CAAC,YAAY,CAA4B;IAEhD;;;;;;;;;;;;;;OAcG;IACU,MAAM,CACjB,YAAY,CAAC,EAAE,OAAO,EACtB,WAAW,CAAC,EAAE,QAAQ,EACtB,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAuBhB;;;;;OAKG;IACH,IAAW,SAAS,IAAI,qBAAqB,EAAE,CAE9C;IAED,oFAAoF;IACpF,IAAW,IAAI,IAAI,kBAAkB,EAAE,CAEtC;IAED;;;;;;;;;OASG;IACH,IAAW,UAAU,IAAI,UAAU,CAAC,qBAAqB,EAAE,CAAC,CAE3D;IAED,mGAAmG;IACnG,IAAW,KAAK,IAAI,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAEnD;IAID,mFAAmF;IAC5E,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAMtE;;;;;;OAMG;IACI,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIpF;;;;;OAKG;IACI,oBAAoB,IAAI,sBAAsB,EAAE;IAIvD;;;;;;;;OAQG;WACW,cAAc,CAC1B,SAAS,EAAE,aAAa,CAAC,qBAAqB,CAAC,EAC/C,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC,GACtC,sBAAsB,EAAE;IAM3B,gFAAgF;IAChF,OAAO,CAAC,iBAAiB;IAKzB,8EAA8E;IAC9E,OAAO,CAAC,oBAAoB;IAS5B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAyB3B,wGAAwG;IACxG,OAAO,CAAC,MAAM,CAAC,SAAS;IAiBxB,sFAAsF;IACtF,OAAO,CAAC,MAAM,CAAC,WAAW;IAK1B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAkB3B;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAWpC,oFAAoF;IACpF,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAgBhC,0EAA0E;IAC1E,OAAO,CAAC,MAAM,CAAC,cAAc;CAS9B"}
@@ -0,0 +1,298 @@
1
+ /**
2
+ * @module feature-pipelines/feature-pipeline-engine
3
+ *
4
+ * **FeaturePipelineEngine** — the discovery + monitoring cache for Feature
5
+ * Pipelines (Predictive Studio SP6, `plans/predictive-studio.md` §5.4).
6
+ *
7
+ * ## What a Feature Pipeline is (the "category route")
8
+ *
9
+ * A Feature Pipeline has **no dedicated entity / table**. It IS an
10
+ * `MJ: Record Processes` row whose `WorkType` is `Infer` / `Action` / `Agent`
11
+ * (with a write-back `OutputMapping`), **categorized** into the seeded
12
+ * `"Feature Pipeline"` `MJ: Record Process Categories` row. The run path already
13
+ * exists — `PredictiveStudio.RunFeaturePipeline` (a Remote Operation) and its
14
+ * sibling Action both delegate to the Record Set Processing substrate's
15
+ * `RecordProcessExecutor`. This engine makes those categorized rows
16
+ * **first-class, discoverable, and monitorable** for the Model Development Agent
17
+ * and the Knowledge Hub UI, without inventing a parallel registry.
18
+ *
19
+ * ## Why a BaseEngine (the canonical MJ reactive-cache pattern)
20
+ *
21
+ * Following `InteractiveFormsEngine` / `ComponentMetadataEngine`: the dataset is
22
+ * tiny (the feature-pipeline Record Processes plus their recent `MJ: Process Runs`
23
+ * headers — no big columns), so we cache it and get **reactivity for free**:
24
+ *
25
+ * - The `Configs` array passed to `Load()` tells BaseEngine which entities to
26
+ * subscribe to. A save / delete / remote-invalidate on a matching
27
+ * `MJ: Record Processes` or `MJ: Process Runs` row automatically refreshes the
28
+ * in-memory array (in place when possible) — **no manual invalidation code**.
29
+ * - Each cached property exposes a lazy `BehaviorSubject` via
30
+ * `ObserveProperty(...)`; the convenience getters {@link Pipelines$} /
31
+ * {@link Runs$} wrap it for Angular `async`-pipe consumption.
32
+ * - Lazy-load: every entry point calls `await FeaturePipelineEngine.Instance.Config(false, user, provider)`.
33
+ * BaseEngine's `Config` is a no-op when already loaded, so the call is cheap
34
+ * to sprinkle everywhere — the first caller pays, everyone else gets cache hits,
35
+ * and users who never open the surface pay nothing.
36
+ *
37
+ * ## Provider threading
38
+ *
39
+ * Multi-provider safe: callers pass the active `IMetadataProvider` to `Config`,
40
+ * and `GetProviderInstance` resolves a per-provider engine instance (the standard
41
+ * BaseEngine convention). All reads operate on the strongly-typed cached entities;
42
+ * the freshness computation is a pure function over already-loaded rows.
43
+ */
44
+ import { BaseEngine, } from '@memberjunction/core';
45
+ import { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
46
+ import { FEATURE_PIPELINE_CATEGORY_NAME, } from './types.js';
47
+ /**
48
+ * Discovery + monitoring engine for Feature Pipelines. Singleton per provider;
49
+ * never construct directly — use {@link Instance} (default provider) or
50
+ * `BaseEngine.GetProviderInstance(provider, FeaturePipelineEngine)`.
51
+ */
52
+ export class FeaturePipelineEngine extends BaseEngine {
53
+ constructor() {
54
+ super(...arguments);
55
+ /** All `MJ: Record Processes` rows (cached); narrowed to feature pipelines by {@link Pipelines}. */
56
+ this._recordProcesses = [];
57
+ /** Recent `MJ: Process Runs` headers (cached) used to derive last-run / freshness. */
58
+ this._processRuns = [];
59
+ }
60
+ /** Standard singleton accessor for the default provider. */
61
+ static get Instance() {
62
+ return super.getInstance();
63
+ }
64
+ /**
65
+ * Lazy-load the Record Process + recent Process Run caches. Safe to call from
66
+ * every entry point — a no-op when already loaded (unless `forceRefresh`).
67
+ *
68
+ * We deliberately cache **all** `MJ: Record Processes` (a small, metadata-style
69
+ * table) rather than server-side filtering to the category, because the
70
+ * category id isn't known until the seeded row is loaded and because the full
71
+ * set is tiny; {@link Pipelines} narrows in memory by the category name. Process
72
+ * Runs are capped to the most recent rows (the audit headers carry no large
73
+ * columns) so freshness is cheap to compute.
74
+ *
75
+ * @param forceRefresh re-run the underlying RunViews even if already loaded
76
+ * @param contextUser the context user (required server-side for audit/security)
77
+ * @param provider the metadata provider to scope this load to (multi-provider safe)
78
+ */
79
+ async Config(forceRefresh, contextUser, provider) {
80
+ const configs = [
81
+ {
82
+ Type: 'entity',
83
+ EntityName: 'MJ: Record Processes',
84
+ PropertyName: '_recordProcesses',
85
+ OrderBy: 'Name',
86
+ CacheLocal: true,
87
+ },
88
+ {
89
+ Type: 'entity',
90
+ EntityName: 'MJ: Process Runs',
91
+ PropertyName: '_processRuns',
92
+ // Newest first so {@link latestRunForPipeline} can take the first match.
93
+ OrderBy: '__mj_CreatedAt DESC',
94
+ CacheLocal: true,
95
+ },
96
+ ];
97
+ await this.Load(configs, provider, forceRefresh, contextUser);
98
+ }
99
+ // ─── Read-side accessors ────────────────────────────────────────────────
100
+ /**
101
+ * The feature-pipeline Record Processes — every cached `MJ: Record Processes`
102
+ * row whose `Category` is the seeded {@link FEATURE_PIPELINE_CATEGORY_NAME}.
103
+ * Matched on the denormalized `Category` view field (case-insensitive) so no
104
+ * separate category lookup is needed.
105
+ */
106
+ get Pipelines() {
107
+ return (this._recordProcesses ?? []).filter((rp) => this.isFeaturePipeline(rp));
108
+ }
109
+ /** All cached Process Run headers (newest first; all entities — callers filter). */
110
+ get Runs() {
111
+ return this._processRuns ?? [];
112
+ }
113
+ /**
114
+ * RxJS Observable of the feature-pipeline Record Processes. Emits the current
115
+ * filtered array on subscribe (BehaviorSubject semantics) and re-emits on every
116
+ * save / delete / remote-invalidate affecting `MJ: Record Processes`.
117
+ *
118
+ * NOTE: `ObserveProperty` emits the raw `_recordProcesses` array; Angular
119
+ * consumers should `map(rows => rows.filter(...))` or simply read {@link Pipelines}
120
+ * inside the subscription. We expose a `map`-friendly stream so callers stay
121
+ * reactive while still seeing only feature pipelines.
122
+ */
123
+ get Pipelines$() {
124
+ return this.ObserveProperty('_recordProcesses');
125
+ }
126
+ /** RxJS Observable of the Process Run headers — same reactivity contract as {@link Pipelines$}. */
127
+ get Runs$() {
128
+ return this.ObserveProperty('_processRuns');
129
+ }
130
+ // ─── Convenience queries ────────────────────────────────────────────────
131
+ /** Find a feature pipeline by its `MJ: Record Processes` id. O(N) — N is small. */
132
+ FindPipelineByID(id) {
133
+ if (!id)
134
+ return undefined;
135
+ const norm = NormalizeUUID(id);
136
+ return this.Pipelines.find((p) => NormalizeUUID(p.ID) === norm);
137
+ }
138
+ /**
139
+ * The most recent `MJ: Process Runs` header for a given feature pipeline, or
140
+ * `undefined` if it has never run. Relies on the `__mj_CreatedAt DESC` order
141
+ * applied in {@link Config} (first match = newest).
142
+ *
143
+ * @param recordProcessID the feature pipeline's `MJ: Record Processes` id
144
+ */
145
+ LatestRunForPipeline(recordProcessID) {
146
+ return this.latestRunForPipeline(this.Runs, recordProcessID);
147
+ }
148
+ /**
149
+ * Build the UI-/agent-facing summary for every feature pipeline: identity,
150
+ * target entity, the write-back output attribute, and last-run / freshness
151
+ * derived from the cached Process Run headers. Pure projection over the loaded
152
+ * caches — call after {@link Config}.
153
+ */
154
+ GetPipelineSummaries() {
155
+ return FeaturePipelineEngine.BuildSummaries(this.Pipelines, this.Runs);
156
+ }
157
+ /**
158
+ * Pure, side-effect-free builder used by {@link GetPipelineSummaries} and by
159
+ * unit tests (which inject in-memory arrays — no live DB, no BaseEngine load).
160
+ * Separating the projection from the cache mirrors `InteractiveFormsEngine`'s
161
+ * split of loading vs. querying.
162
+ *
163
+ * @param pipelines the feature-pipeline Record Processes
164
+ * @param runs the Process Run headers (any order; newest-wins is computed here)
165
+ */
166
+ static BuildSummaries(pipelines, runs) {
167
+ return pipelines.map((p) => FeaturePipelineEngine.buildSummary(p, runs));
168
+ }
169
+ // ─── Internal helpers ───────────────────────────────────────────────────
170
+ /** Whether a Record Process belongs to the seeded Feature Pipeline category. */
171
+ isFeaturePipeline(rp) {
172
+ const category = (rp.Category ?? '').trim().toLowerCase();
173
+ return category === FEATURE_PIPELINE_CATEGORY_NAME.toLowerCase();
174
+ }
175
+ /** Newest run for a pipeline from an already-ordered (newest-first) array. */
176
+ latestRunForPipeline(runs, recordProcessID) {
177
+ if (!recordProcessID)
178
+ return undefined;
179
+ const norm = NormalizeUUID(recordProcessID);
180
+ return runs.find((r) => r.RecordProcessID != null && NormalizeUUID(r.RecordProcessID) === norm);
181
+ }
182
+ /**
183
+ * Project one pipeline + the run set into a {@link FeaturePipelineSummary}.
184
+ * Static so it can be reused by {@link BuildSummaries} without an instance.
185
+ */
186
+ static buildSummary(p, runs) {
187
+ const latest = FeaturePipelineEngine.newestRun(runs, p.ID);
188
+ return {
189
+ ID: p.ID,
190
+ Name: p.Name,
191
+ Description: p.Description ?? null,
192
+ Status: p.Status,
193
+ WorkType: p.WorkType,
194
+ TargetEntityID: p.EntityID,
195
+ TargetEntity: p.Entity,
196
+ OutputAttribute: FeaturePipelineEngine.deriveOutputAttribute(p.OutputMapping),
197
+ OnDemandEnabled: p.OnDemandEnabled,
198
+ ScheduleEnabled: p.ScheduleEnabled,
199
+ LastRunAt: latest?.StartTime ?? latest?.EndTime ?? null,
200
+ LastRunStatus: FeaturePipelineEngine.mapRunStatus(latest),
201
+ LastRunProcessRunID: latest?.ID ?? null,
202
+ LastRunProcessed: latest?.ProcessedItems ?? null,
203
+ LastRunSuccess: latest?.SuccessCount ?? null,
204
+ LastRunErrors: latest?.ErrorCount ?? null,
205
+ };
206
+ }
207
+ /** Newest run for a pipeline id, scanning by `StartTime`/`__mj_CreatedAt` regardless of input order. */
208
+ static newestRun(runs, recordProcessID) {
209
+ let best;
210
+ let bestTime = -Infinity;
211
+ for (const r of runs) {
212
+ if (r.RecordProcessID == null || !UUIDsEqual(r.RecordProcessID, recordProcessID))
213
+ continue;
214
+ const t = FeaturePipelineEngine.runSortTime(r);
215
+ if (t > bestTime) {
216
+ bestTime = t;
217
+ best = r;
218
+ }
219
+ }
220
+ return best;
221
+ }
222
+ /** Sort key for "most recent run": prefer StartTime, then EndTime, then createdAt. */
223
+ static runSortTime(r) {
224
+ const candidate = r.StartTime ?? r.EndTime ?? r.__mj_CreatedAt;
225
+ return candidate ? new Date(candidate).getTime() : -Infinity;
226
+ }
227
+ /**
228
+ * Normalize a `MJ: Process Runs` status into the small {@link FeaturePipelineRunStatus}
229
+ * union the UI renders. `undefined` run → `'Never'`.
230
+ */
231
+ static mapRunStatus(run) {
232
+ if (!run)
233
+ return 'Never';
234
+ switch (run.Status) {
235
+ case 'Completed':
236
+ return 'Completed';
237
+ case 'Failed':
238
+ return 'Failed';
239
+ case 'Cancelled':
240
+ return 'Cancelled';
241
+ case 'Running':
242
+ case 'Pending':
243
+ case 'Paused':
244
+ return 'Running';
245
+ default:
246
+ return 'Never';
247
+ }
248
+ }
249
+ /**
250
+ * Best-effort human-readable "what attribute does this pipeline write" derived
251
+ * from the Record Process `OutputMapping` JSON. The mapping shape is opaque to
252
+ * this engine (it's owned by the Record Set Processing substrate), so we probe
253
+ * the common shapes — a top-level `field` / `fields` / `targetField`, or an
254
+ * array of field names — and fall back to `null` when we can't tell. Never
255
+ * throws on malformed JSON.
256
+ *
257
+ * @param outputMapping the raw `OutputMapping` JSON string, or null
258
+ */
259
+ static deriveOutputAttribute(outputMapping) {
260
+ if (!outputMapping)
261
+ return null;
262
+ let parsed;
263
+ try {
264
+ parsed = JSON.parse(outputMapping);
265
+ }
266
+ catch {
267
+ return null;
268
+ }
269
+ return FeaturePipelineEngine.extractFieldNames(parsed);
270
+ }
271
+ /** Extract a comma-joined field-name string from a parsed OutputMapping payload. */
272
+ static extractFieldNames(parsed) {
273
+ if (parsed == null || typeof parsed !== 'object')
274
+ return null;
275
+ const obj = parsed;
276
+ // Shape A: { field: 'X' } or { targetField: 'X' }
277
+ const single = obj['field'] ?? obj['targetField'] ?? obj['attribute'];
278
+ if (typeof single === 'string' && single.trim())
279
+ return single.trim();
280
+ // Shape B: { fields: { 'X': ..., 'Y': ... } } or { fields: ['X','Y'] }
281
+ const fields = obj['fields'];
282
+ const names = FeaturePipelineEngine.fieldNamesFrom(fields);
283
+ if (names.length > 0)
284
+ return names.join(', ');
285
+ return null;
286
+ }
287
+ /** Collect field names from either an object map or an array of names. */
288
+ static fieldNamesFrom(fields) {
289
+ if (Array.isArray(fields)) {
290
+ return fields.filter((f) => typeof f === 'string' && f.trim().length > 0);
291
+ }
292
+ if (fields != null && typeof fields === 'object') {
293
+ return Object.keys(fields);
294
+ }
295
+ return [];
296
+ }
297
+ }
298
+ //# sourceMappingURL=feature-pipeline-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-pipeline-engine.js","sourceRoot":"","sources":["../../src/feature-pipelines/feature-pipeline-engine.ts"],"names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Ae;QAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzF,CAAC;QACD,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACjD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAiC,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @module feature-pipelines
3
+ *
4
+ * Feature Pipeline discovery + monitoring (Predictive Studio SP6). A Feature
5
+ * Pipeline is a categorized `MJ: Record Processes` row (the "category route" — no
6
+ * dedicated entity); this folder provides the `FeaturePipelineEngine` BaseEngine
7
+ * cache and its projection types so the Model Development Agent and the Knowledge
8
+ * Hub UI can discover "what feature pipelines exist, what entity each writes to,
9
+ * and when each last ran".
10
+ */
11
+ export * from './types.js';
12
+ export * from './feature-pipeline-engine.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feature-pipelines/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @module feature-pipelines
3
+ *
4
+ * Feature Pipeline discovery + monitoring (Predictive Studio SP6). A Feature
5
+ * Pipeline is a categorized `MJ: Record Processes` row (the "category route" — no
6
+ * dedicated entity); this folder provides the `FeaturePipelineEngine` BaseEngine
7
+ * cache and its projection types so the Model Development Agent and the Knowledge
8
+ * Hub UI can discover "what feature pipelines exist, what entity each writes to,
9
+ * and when each last ran".
10
+ */
11
+ export * from './types.js';
12
+ export * from './feature-pipeline-engine.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-pipelines/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @module feature-pipelines/types
3
+ *
4
+ * Shared contracts for Feature Pipeline discovery + monitoring (SP6). A Feature
5
+ * Pipeline is a categorized `MJ: Record Processes` row (no dedicated entity), so
6
+ * these are projection types over the cached Record Process + Process Run entities
7
+ * — NOT a new persistence shape.
8
+ */
9
+ import type { MJRecordProcessEntity } from '@memberjunction/core-entities';
10
+ /**
11
+ * Name of the seeded `MJ: Record Process Categories` row that marks a Record
12
+ * Process as a Feature Pipeline. Authored in
13
+ * `metadata/record-process-categories/.record-process-categories.json` and pushed
14
+ * with `mj sync`. The engine matches the denormalized `Category` view field on a
15
+ * Record Process against this name (case-insensitive).
16
+ */
17
+ export declare const FEATURE_PIPELINE_CATEGORY_NAME: "Feature Pipeline";
18
+ /**
19
+ * Normalized last-run status for a Feature Pipeline, derived from the most recent
20
+ * `MJ: Process Runs` header. `'Never'` means the pipeline has no recorded run.
21
+ * `Pending` / `Paused` collapse into `'Running'` for display.
22
+ */
23
+ export type FeaturePipelineRunStatus = 'Never' | 'Running' | 'Completed' | 'Failed' | 'Cancelled';
24
+ /**
25
+ * UI-/agent-facing summary of one Feature Pipeline: what it is, what entity it
26
+ * writes to, which attribute it produces, and how recently it ran. Built purely
27
+ * from the cached Record Process + Process Run entities by
28
+ * `FeaturePipelineEngine.GetPipelineSummaries()`.
29
+ */
30
+ export interface FeaturePipelineSummary {
31
+ /** The underlying `MJ: Record Processes` id (also the `RunFeaturePipeline` `featurePipelineID`). */
32
+ ID: string;
33
+ /** Display name of the pipeline (the Record Process name). */
34
+ Name: string;
35
+ /** Optional description. */
36
+ Description: string | null;
37
+ /** Record Process lifecycle status: `Active` / `Disabled` / `Draft`. */
38
+ Status: 'Active' | 'Disabled' | 'Draft';
39
+ /**
40
+ * The work the pipeline performs per record (Feature pipelines typically use Infer / Action /
41
+ * Agent). Derived from the entity's `WorkType` so it tracks the CodeGen-generated union — which
42
+ * is sourced from the `CK_RecordProcess_WorkType` CHECK constraint and grows as work types are
43
+ * added (e.g. `'ML Model'`).
44
+ */
45
+ WorkType: MJRecordProcessEntity['WorkType'];
46
+ /** Id of the entity whose records the pipeline derives features for. */
47
+ TargetEntityID: string;
48
+ /** Display name of the target entity (denormalized from the Record Process view). */
49
+ TargetEntity: string;
50
+ /**
51
+ * Best-effort attribute the pipeline writes back, parsed from the Record
52
+ * Process `OutputMapping`. `null` when the mapping shape isn't recognized.
53
+ */
54
+ OutputAttribute: string | null;
55
+ /** Whether the pipeline can be run on demand (the "Run" button is enabled). */
56
+ OnDemandEnabled: boolean;
57
+ /** Whether the pipeline runs on a cron schedule. */
58
+ ScheduleEnabled: boolean;
59
+ /** Timestamp of the most recent run (start time, falling back to end time), or null. */
60
+ LastRunAt: Date | null;
61
+ /** Normalized status of the most recent run. */
62
+ LastRunStatus: FeaturePipelineRunStatus;
63
+ /** Id of the most recent `MJ: Process Runs` row, or null if never run. */
64
+ LastRunProcessRunID: string | null;
65
+ /** Records processed in the most recent run, or null. */
66
+ LastRunProcessed: number | null;
67
+ /** Records whose features were written in the most recent run, or null. */
68
+ LastRunSuccess: number | null;
69
+ /** Records that errored in the most recent run, or null. */
70
+ LastRunErrors: number | null;
71
+ }
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/feature-pipelines/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,EAAG,kBAA2B,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAElG;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,oGAAoG;IACpG,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,wEAAwE;IACxE,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IACxC;;;;;OAKG;IACH,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC5C,wEAAwE;IACxE,cAAc,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,+EAA+E;IAC/E,eAAe,EAAE,OAAO,CAAC;IACzB,oDAAoD;IACpD,eAAe,EAAE,OAAO,CAAC;IACzB,wFAAwF;IACxF,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,gDAAgD;IAChD,aAAa,EAAE,wBAAwB,CAAC;IACxC,0EAA0E;IAC1E,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2EAA2E;IAC3E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4DAA4D;IAC5D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @module feature-pipelines/types
3
+ *
4
+ * Shared contracts for Feature Pipeline discovery + monitoring (SP6). A Feature
5
+ * Pipeline is a categorized `MJ: Record Processes` row (no dedicated entity), so
6
+ * these are projection types over the cached Record Process + Process Run entities
7
+ * — NOT a new persistence shape.
8
+ */
9
+ /**
10
+ * Name of the seeded `MJ: Record Process Categories` row that marks a Record
11
+ * Process as a Feature Pipeline. Authored in
12
+ * `metadata/record-process-categories/.record-process-categories.json` and pushed
13
+ * with `mj sync`. The engine matches the denormalized `Category` view field on a
14
+ * Record Process against this name (case-insensitive).
15
+ */
16
+ export const FEATURE_PIPELINE_CATEGORY_NAME = 'Feature Pipeline';
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/feature-pipelines/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,kBAA2B,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @module @memberjunction/predictive-studio
3
+ *
4
+ * Server-side engine for MemberJunction Predictive Studio. This is a scaffold —
5
+ * the real components land in later phases. The engine composes onto existing MJ
6
+ * substrates (Record Set Processing, Remote Operations, Agents, Vectors) and the
7
+ * Python sidecar, per `plans/predictive-studio.md`.
8
+ *
9
+ * This package depends on `@memberjunction/predictive-studio-core` for its type
10
+ * contracts and on the MJ core/global packages for entity + class-factory access.
11
+ */
12
+ import type { ModelingPlanSpec } from '@memberjunction/predictive-studio-core';
13
+ export * from './feature-assembly/index.js';
14
+ export * from './feature-pipelines/index.js';
15
+ export * from './training/index.js';
16
+ export * from './scoring/index.js';
17
+ export * from './scheduling/index.js';
18
+ export * from './experiment/index.js';
19
+ export * from './actions/index.js';
20
+ export * from './operations/index.js';
21
+ export * from './maintenance/index.js';
22
+ export * from './agent/index.js';
23
+ /**
24
+ * Version marker for the Predictive Studio engine package. Kept in sync with the
25
+ * package version so consumers can assert compatibility at runtime.
26
+ */
27
+ export declare const PredictiveStudioEngineVersion = "5.43.0";
28
+ /**
29
+ * Internal scaffold guard proving the core dependency is wired and a
30
+ * `ModelingPlanSpec` is consumable here. Replaced by real orchestration in a
31
+ * later phase.
32
+ *
33
+ * @param plan a (possibly partial) modeling plan
34
+ * @returns whether the plan has passed the user approval gate
35
+ */
36
+ export declare function isModelingPlanApproved(plan: ModelingPlanSpec): boolean;
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAO/E,cAAc,oBAAoB,CAAC;AAInC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAK1B,cAAc,cAAc,CAAC;AAI7B,cAAc,cAAc,CAAC;AAI7B,cAAc,WAAW,CAAC;AAK1B,cAAc,cAAc,CAAC;AAK7B,cAAc,eAAe,CAAC;AAK9B,cAAc,SAAS,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,6BAA6B,WAAW,CAAC;AAqBtD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAEtE"}