@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
package/README.md CHANGED
@@ -1,45 +1,118 @@
1
1
  # @memberjunction/predictive-studio
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
3
+ > The **server-side engine** of **MemberJunction Predictive Studio** — assemble features, train models, score records, run experiment searches, keep models honest over time, and expose all of it through Actions + Remote Operations.
4
4
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
5
+ **What** — the engine that turns a client's own data into a trained, scored predictive model. Its core is four service classes — `FeatureAssemblyExecutor`, `TrainingEngine`, `MLModelInferenceProcessor`, `ExperimentOrchestrator` — surrounded by feature-pipeline discovery, ongoing maintenance, and two thin invocation surfaces (Actions and Remote Operations) so agents, UI, and workflows can drive it.
6
6
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
7
+ **Why** — predictive modeling needs feature assembly, anti-skew correctness, honest validation, batch scoring, and a budgeted search. Each of those already has a home in MJ's substrate; this engine **composes onto** them (Record Set Processing, entities/`RunView`, Remote Operations, Agents, vectors) plus the Python ML sidecar — rather than re-implementing batching, audit, or inference. The cardinal correctness rule: **one feature-assembly code path, used identically across train / materialize / on-demand**, so there is no train/serve skew by construction.
8
8
 
9
- ## Purpose
9
+ **How it fits** — in the four-layer architecture (data → feature → model → inference) this package owns the **feature, model, and inference** layers in TypeScript, sitting above the [type contracts](../Core/README.md) and the [`MLSidecar` client](../Sidecar/README.md), and is consumed by the Studio dashboard, the (planned) Model Development Agent, and any agent/workflow via its Actions + Remote Operations. See [How it fits the whole](#how-it-fits-the-whole).
10
10
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@memberjunction/predictive-studio`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
11
+ For the full architecture, read the **[Predictive Studio Guide](../../../../guides/PREDICTIVE_STUDIO_GUIDE.md)** (§4–§12 cover this package); for the design record, [`plans/predictive-studio.md`](../../../../plans/predictive-studio.md).
15
12
 
16
- ## What is OIDC Trusted Publishing?
13
+ ## Install
17
14
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
15
+ ```bash
16
+ npm install @memberjunction/predictive-studio
17
+ ```
19
18
 
20
- ## Setup Instructions
19
+ Depends on `@memberjunction/predictive-studio-core` (type contracts), `@memberjunction/predictive-studio-sidecar` (the `MLSidecar` client), `@memberjunction/record-set-processor-base` (the scoring work-type seam), and the MJ core/global/core-entities packages.
21
20
 
22
- To properly configure OIDC trusted publishing for this package:
21
+ ## The four core engines
23
22
 
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
23
+ | Component | Where | What it does |
24
+ |---|---|---|
25
+ | **`FeatureAssemblyExecutor`** | `src/feature-assembly/feature-assembly-executor.ts` | `(record set, frozen FeatureSteps) → raw matrix + preprocessing recipe`. The single code path for all three contexts (`'train'` / `'materialize'` / `'on-demand'`), so there's no train/serve skew by construction. Splits the graph into data-assembly steps (built as raw columns in TS) vs. preprocessing steps (emitted as a `PreprocessingOp[]` recipe for the sidecar to fit/apply). Enforces the **as-of** point-in-time cutoff (`as-of.ts`) and the **leakage** deny-list (`leakage-guard.ts`). |
26
+ | **`TrainingEngine`** | `src/training/training-engine.ts` | `trainModel(input, deps)` — resolve pipeline → assemble (fit context) → carve the **locked holdout** first → sidecar `/train` → persist the artifact to MJStorage → create an **immutable, versioned `MJ: ML Models`** row (with `FittedPreprocessing`, `FeatureSchema`, metrics, holdout metrics, importance, lineage) + an `MJ: ML Training Runs` row → run the single-feature-dominance leakage check. Built on injectable seams (`IEntityFactory` / `IRecordLoader` / `ISidecarTrainer` / `IArtifactStore`). |
27
+ | **`MLModelInferenceProcessor`** | `src/scoring/ml-model-inference-processor.ts` | A **Record Set Processing work type** (`@RegisterClass(MLModelInferenceProcessor, 'ML Model')`, alias `'MLModelInference'`) for batch + single-record scoring. Warm-loads the model once per run, assembles features transform-only (frozen — never re-fits), calls the sidecar `/predict`, returns an `MLInferenceResultPayload`. Ephemeral by default; the substrate's `WriteBackProcessor` applies an `OutputMapping` when present. Registers *without* forking the substrate (`src/scoring/register.ts`). |
28
+ | **`ExperimentOrchestrator`** | `src/experiment/experiment-orchestrator.ts` | `runSession(plan, deps, options)` — deterministic execution of an *approved* `ModelingPlanSpec` as **waves through Record Set Processing**: generate wave (`IWaveStrategist`) → train (bounded concurrency) → evaluate → leaderboard → prune → budget-gate → next wave. Wires the generic `MJ: Experiments` / `Experiment Sessions` / `Experiment Session Iterations` primitives. |
28
29
 
29
- ## DO NOT USE THIS PACKAGE
30
+ > The **`MLSidecar`** client (the self-managing Python sidecar) lives in its own package, [`@memberjunction/predictive-studio-sidecar`](../Sidecar/README.md) — import it directly from there; it is intentionally not re-exported here.
30
31
 
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
32
+ ## The supporting modules
36
33
 
37
- ## More Information
34
+ Beyond the four core engines, the package's `src/` is organized into focused folders, each its own barrel export:
38
35
 
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
36
+ | Folder | Exports | Role | Plan ref |
37
+ |---|---|---|---|
38
+ | `feature-assembly/` | `FeatureAssemblyExecutor` + `as-of` / `leakage-guard` / `vision-llm` / `data-access` seams | The single skew-free assembly path and its correctness primitives (point-in-time cutoff, deny-list, vision-LLM-as-feature) | §5 / §6 / §11 |
39
+ | `training/` | `TrainingEngine` + seams (`IEntityFactory` / `IRecordLoader` / `ISidecarTrainer` / `IArtifactStore`) + `artifact-store` | Train → persist an immutable, versioned `MJ: ML Models` row with full lineage | §3 / §4.3 |
40
+ | `scoring/` | `MLModelInferenceProcessor`, `LoadMLModelInferenceProcessor`, the `'ML Model'` work-type `register`, `artifact-loader`, `scoring-binding` | Batch + single-record inference as a Record Set Processing **work type**, registered without forking the substrate | §10 |
41
+ | `experiment/` | `ExperimentOrchestrator` + `leaderboard` / `concurrency` / `wave-strategist` / `seams` | Deterministic, wave-based execution of an approved `ModelingPlanSpec` with leaderboard, pruning, and a budget gate | §8 / §9 |
42
+ | `feature-pipelines/` | `FeaturePipelineEngine` (a `BaseEngine` cache) + projection types | Discover/monitor Feature Pipelines (categorized `MJ: Record Processes` rows) — "what pipelines exist, what each writes to, when each last ran" | §5.4 / SP6 |
43
+ | `maintenance/` | `MaintenanceEngine`, `RetrainingPolicy` + defaults, the honest `RowCountProxyDriftDetector`, seams | Staleness detection, scheduled re-scoring, retraining triggers, and challenger-vs-incumbent promotion recommendation | §12 / SP10 |
44
+ | `scheduling/` | `createScheduledModelScoring` (the Phase 2 north-star helper) | One call binds a model to write its prediction into a target column on a recurring cron (auto-creates the owned Scheduled Job) | §15 / PS2-6 |
45
+ | `actions/` | `PredictiveStudio{TrainModel,ScoreRecordSet,RunExperiment,PromoteModel}Action` + `LoadPredictiveStudioActions` | **Invocation surface A** — thin MJ Actions over the engines (see below) | §12 |
46
+ | `operations/` | `PredictiveStudio{TrainModel,ScoreRecordSet,RunFeaturePipeline,StartExperimentSession,ControlExperimentSession,PromoteModel}ServerOperation` + `LoadPredictiveStudioOperations` | **Invocation surface B** — typed Remote Operations over the engines (see below) | §12 |
42
47
 
43
- ---
48
+ ## Phase 2 reach — one scorer, many surfaces
44
49
 
45
- **Maintained for OIDC setup purposes only**
50
+ Phase 2 extends the model's *reach* without new ML: the **same** scorer (`MLModelInferenceProcessor`) and the **same** entry point (`ScoreRecordSet`) plumbed into every MJ surface where a prediction is useful, each through a registry / ClassFactory seam so no base/types package depends on Predictive Studio. Full write-up: **[Predictive Studio Guide §15](../../../../guides/PREDICTIVE_STUDIO_GUIDE.md#15-phase-2--model-as-a-first-class-primitive-reach)**.
51
+
52
+ | Item | Module | What it adds |
53
+ |---|---|---|
54
+ | **PS2-1** scoring as a saved/scheduled Record Process | `scoring/startup-register.ts` (`PredictiveStudioScoringStartup`), `scoring/register.ts` (`registerMLScoringProcessor`) | Registers the `'ML Model'` work type into `RecordProcessorRegistry` at MJAPI boot so a saved `MJ: Record Processes` row routes to the scorer. (Migration `V202606280215…` drops the closed `WorkType` CHECK so the registry governs work types.) |
55
+ | **PS2-2** per-model Action on Publish | `actions/model-scoring-action-generator.ts` (`ModelScoringActionGenerator`), hooked from `actions/promote-model.gate.ts` | Generates an idempotent child Action `Score with <pipeline> v<n>` (Type=Custom, parent's `DriverClass`, `ParentID` set, `ModelID` `DefaultValue` baked) — so every published model is a discoverable Action. |
56
+ | **PS2-3** scored-query enrichment | `scoring/ml-model-score-enricher.ts` (`MLModelScoreEnricher`, `@RegisterClass(QueryResultEnricherBase, 'ML Model Score')`) | Appends a model prediction column to a `RunQuery` result via the decoupled `RunQueryParams.Enrichment` seam in `@memberjunction/core`. |
57
+ | **PS2-6** scheduled model scoring (north-star) | `scheduling/scheduled-model-scoring.ts` (`createScheduledModelScoring`), `actions/schedule-model-scoring.action.ts` | One call creates an Active `'ML Model'` Record Process with `ScheduleEnabled` + monthly cron + `OutputMapping`; saving it auto-creates the owned Scheduled Job. |
58
+
59
+ > PS2-4 (the Interactive Components `utilities.ml` capability) lives **outside** this package — `SimpleMLTools` in `@memberjunction/interactive-component-types`, built by `RuntimeUtilities.CreateSimpleMLTools()` in `@memberjunction/ng-react`, marshaling `ScoreRecordSet` over GraphQL to this engine.
60
+
61
+ Each item ships with an MJServer integration script (`ps-live-recordprocess-scoring`, `ps-live-modelaction-generation`, `ps-inproc-scored-query`, `ps-inproc-scheduled-scoring`).
62
+
63
+ ### Business-experience layer
64
+
65
+ The **business-user experience** phase (the conversational north-star made real) builds on this engine without new ML: `createScheduledModelScoring` now, after saving the scheduled Record Process, also **records an `MJ: ML Model Scoring Binding`** (via `upsertScoringBinding` — `MLModelID` / `RecordProcessID` / `TargetEntityID` / `TargetColumn` / `Mode='Scheduled'`). That binding is the lineage seam the Angular surfaces key off — the generic, binding-driven risk-card form panel and the "Models in Production" Studio section both light up from it. On the agent side, the Model Development Agent now **proactively offers to operationalize** after a clean promote ("score everyone + refresh monthly?") and, on a yes, calls the `Schedule Model Scoring` action. Full plan + commit lineage: [`plans/predictive-studio-business-experience.md`](../../../../plans/predictive-studio-business-experience.md); architecture write-up: [Predictive Studio Guide §16](../../../../guides/PREDICTIVE_STUDIO_GUIDE.md#16-the-business-user-experience).
66
+
67
+ ## Two invocation surfaces: Actions vs. Remote Operations
68
+
69
+ The engine service classes are the *real* logic; both surfaces are thin and **share one delegation path** (`operations/delegation.ts`), so they train / score / experiment / promote through the same code — never duplicating it.
70
+
71
+ - **Actions** (`actions/`) — discoverable, metadata-driven boundaries for **agents, low-code workflows, and the visual designer**. Four driver-class keys (`PredictiveStudioTrainModelAction`, `…ScoreRecordSetAction`, `…RunExperimentAction`, `…PromoteModelAction`) matching the `metadata/actions/predictive-studio/` rows. Call `LoadPredictiveStudioActions()` from a server bootstrap to keep the `@RegisterClass` registrations from being tree-shaken.
72
+ - **Remote Operations** (`operations/`) — the typed peers, invoked by **stable key** from client or server with framework-applied scope/permission gates. Six keys: `PredictiveStudio.TrainModel`, `.ScoreRecordSet`, `.RunFeaturePipeline`, `.StartExperimentSession`, `.ControlExperimentSession`, `.PromoteModel`. These are the Manual-mode server bodies for the CodeGen-emitted operation bases in `@memberjunction/core-entities`. Call `LoadPredictiveStudioOperations()` from a server bootstrap to anchor them.
73
+
74
+ Which to reach for: **Actions** when an agent/workflow needs to *discover and chain* capabilities; **Remote Operations** when client or server code needs a *typed, gated call by key*. (Internal engine-to-engine calls use neither — they import the service class directly. See the Transport-Layer and Remote Operations guides.)
75
+
76
+ ## Usage
77
+
78
+ ```typescript
79
+ import { TrainingEngine, FeatureAssemblyExecutor } from '@memberjunction/predictive-studio';
80
+ import { MLModelInferenceProcessor, LoadMLModelInferenceProcessor } from '@memberjunction/predictive-studio';
81
+
82
+ // 1. Ensure the scoring work-type registration survives bundling (call from a server bootstrap)
83
+ LoadMLModelInferenceProcessor();
84
+
85
+ // 2. Train — produces a new immutable MJ: ML Models row
86
+ const engine = new TrainingEngine();
87
+ const result = await engine.trainModel({ PipelineID: retentionPipelineId /* … */ }, productionDeps);
88
+
89
+ // 3. Score — runs as the 'ML Model' Record Set Processing work type (on-demand or scheduled)
90
+ // See the Record Set Processing Guide for RunNow / scope-override mechanics.
91
+ ```
92
+
93
+ ## How it fits the whole
94
+
95
+ ```
96
+ predictive-studio-core (types) ─┐
97
+ predictive-studio-sidecar (MLSidecar) ─┤
98
+ record-set-processor / -base (substrate) ─┤
99
+ @memberjunction/actions + core-entities ─┤
100
+ ▼
101
+ @memberjunction/predictive-studio (this package)
102
+ feature-assembly · training · scoring · experiment · feature-pipelines ·
103
+ maintenance · actions · operations
104
+ │ exposed to / consumed by
105
+ ┌───────────────────────┬───────────┴───────────┬────────────────────┐
106
+ Actions (agents/ Remote Operations Studio dashboard (planned) Model
107
+ workflows/low-code) (typed, by key) (ng-dashboards) Development Agent
108
+ ```
109
+
110
+ ## Build & test
111
+
112
+ ```bash
113
+ npm run build # tsc && tsc-alias -f
114
+ npm run test # vitest run — unit tests (all seams mocked; no DB, no live sidecar)
115
+ npm run test:integration # opt-in end-to-end live test (PS_INTEGRATION=1) — spawns the real
116
+ # managed Python sidecar; skips gracefully if the venv is missing.
117
+ # Prereq: cd ../Sidecar && npm run setup:python
118
+ ```
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @module actions/base-predictive-studio.action
3
+ *
4
+ * Shared base for the four **Predictive Studio Actions** (plan §12 — the Action
5
+ * boundary). Per CLAUDE.md "Actions are boundaries, not internal APIs", each
6
+ * concrete action stays THIN: it extracts + validates its params, delegates to an
7
+ * already-built engine service class (`TrainingEngine` / `MLModelInferenceProcessor`
8
+ * / `ExperimentOrchestrator`), and maps the result back onto the action's
9
+ * input/output params. No ML business logic lives in the actions.
10
+ *
11
+ * This base provides only the cross-cutting plumbing every Predictive Studio
12
+ * action needs:
13
+ * - typed param extraction (string / boolean / number / JSON),
14
+ * - output-param emission,
15
+ * - a uniform `fail()` → {@link ActionResultSimple} mapping.
16
+ *
17
+ * The engine + its injected dependency bundle are NOT created here — each concrete
18
+ * action exposes its own protected, overridable factory seam so unit tests can
19
+ * substitute a mocked engine and in-memory deps with no live DB and no sidecar.
20
+ */
21
+ import type { ActionResultSimple, RunActionParams, ActionParam } from '@memberjunction/actions-base';
22
+ import { BaseAction } from '@memberjunction/actions';
23
+ /** A plain JSON object map parsed from a JSON-string or object-valued param. */
24
+ export type JsonObject = Record<string, unknown>;
25
+ /**
26
+ * Abstract base carrying the param-extraction + result-mapping helpers shared by
27
+ * every Predictive Studio action. Concrete actions implement `InternalRunAction`
28
+ * and their own engine/deps factory seams.
29
+ */
30
+ export declare abstract class BasePredictiveStudioAction extends BaseAction {
31
+ /**
32
+ * Read a string param (trimmed). Returns `undefined` when missing/empty so the
33
+ * caller can branch on required-ness.
34
+ */
35
+ protected getStringParam(params: RunActionParams, name: string): string | undefined;
36
+ /**
37
+ * Read a boolean param. Accepts native booleans and the usual truthy/falsey
38
+ * string forms (`true/1/yes`, `false/0/no`); falls back to `defaultValue`.
39
+ */
40
+ protected getBooleanParam(params: RunActionParams, name: string, defaultValue: boolean): boolean;
41
+ /**
42
+ * Read a numeric param. Returns `undefined` when missing or non-numeric so the
43
+ * caller can apply its own default / required check.
44
+ */
45
+ protected getNumericParam(params: RunActionParams, name: string): number | undefined;
46
+ /**
47
+ * Read a JSON-object param. Accepts either an object value or a JSON string that
48
+ * parses to an object. Returns `undefined` when missing or not an object.
49
+ */
50
+ protected getJsonObjectParam(params: RunActionParams, name: string): JsonObject | undefined;
51
+ /** Locate a param by case-insensitive, whitespace-tolerant name. */
52
+ protected findParam(params: RunActionParams, name: string): ActionParam | undefined;
53
+ /** Append (or overwrite) an output param on the run params. */
54
+ protected addOutputParam(params: RunActionParams, name: string, value: unknown): void;
55
+ /** Build a failure {@link ActionResultSimple}. */
56
+ protected fail(resultCode: string, message: string): ActionResultSimple;
57
+ /** Build a success {@link ActionResultSimple}, carrying the (mutated) params back. */
58
+ protected ok(params: RunActionParams, message: string): ActionResultSimple;
59
+ /** Coerce a param value (object or JSON string) into a plain object, or undefined. */
60
+ private coerceToObject;
61
+ private isPlainObject;
62
+ }
63
+ //# sourceMappingURL=base-predictive-studio.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-predictive-studio.action.d.ts","sourceRoot":"","sources":["../../src/actions/base-predictive-studio.action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD;;;;GAIG;AACH,8BAAsB,0BAA2B,SAAQ,UAAU;IAGjE;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IASnF;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO;IAchG;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IASpF;;;OAGG;IACH,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAQ3F,oEAAoE;IACpE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAKnF,+DAA+D;IAC/D,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAYrF,kDAAkD;IAClD,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,kBAAkB;IAIvE,sFAAsF;IACtF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,kBAAkB;IAM1E,sFAAsF;IACtF,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,aAAa;CAGtB"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @module actions/base-predictive-studio.action
3
+ *
4
+ * Shared base for the four **Predictive Studio Actions** (plan §12 — the Action
5
+ * boundary). Per CLAUDE.md "Actions are boundaries, not internal APIs", each
6
+ * concrete action stays THIN: it extracts + validates its params, delegates to an
7
+ * already-built engine service class (`TrainingEngine` / `MLModelInferenceProcessor`
8
+ * / `ExperimentOrchestrator`), and maps the result back onto the action's
9
+ * input/output params. No ML business logic lives in the actions.
10
+ *
11
+ * This base provides only the cross-cutting plumbing every Predictive Studio
12
+ * action needs:
13
+ * - typed param extraction (string / boolean / number / JSON),
14
+ * - output-param emission,
15
+ * - a uniform `fail()` → {@link ActionResultSimple} mapping.
16
+ *
17
+ * The engine + its injected dependency bundle are NOT created here — each concrete
18
+ * action exposes its own protected, overridable factory seam so unit tests can
19
+ * substitute a mocked engine and in-memory deps with no live DB and no sidecar.
20
+ */
21
+ import { BaseAction } from '@memberjunction/actions';
22
+ /**
23
+ * Abstract base carrying the param-extraction + result-mapping helpers shared by
24
+ * every Predictive Studio action. Concrete actions implement `InternalRunAction`
25
+ * and their own engine/deps factory seams.
26
+ */
27
+ export class BasePredictiveStudioAction extends BaseAction {
28
+ // ----- parameter helpers ---------------------------------------------------
29
+ /**
30
+ * Read a string param (trimmed). Returns `undefined` when missing/empty so the
31
+ * caller can branch on required-ness.
32
+ */
33
+ getStringParam(params, name) {
34
+ const param = this.findParam(params, name);
35
+ if (!param || param.Value === undefined || param.Value === null) {
36
+ return undefined;
37
+ }
38
+ const value = String(param.Value).trim();
39
+ return value.length > 0 ? value : undefined;
40
+ }
41
+ /**
42
+ * Read a boolean param. Accepts native booleans and the usual truthy/falsey
43
+ * string forms (`true/1/yes`, `false/0/no`); falls back to `defaultValue`.
44
+ */
45
+ getBooleanParam(params, name, defaultValue) {
46
+ const param = this.findParam(params, name);
47
+ if (!param || param.Value === undefined || param.Value === null) {
48
+ return defaultValue;
49
+ }
50
+ if (typeof param.Value === 'boolean') {
51
+ return param.Value;
52
+ }
53
+ const value = String(param.Value).trim().toLowerCase();
54
+ if (value === 'true' || value === '1' || value === 'yes')
55
+ return true;
56
+ if (value === 'false' || value === '0' || value === 'no')
57
+ return false;
58
+ return defaultValue;
59
+ }
60
+ /**
61
+ * Read a numeric param. Returns `undefined` when missing or non-numeric so the
62
+ * caller can apply its own default / required check.
63
+ */
64
+ getNumericParam(params, name) {
65
+ const param = this.findParam(params, name);
66
+ if (!param || param.Value === undefined || param.Value === null) {
67
+ return undefined;
68
+ }
69
+ const parsed = Number(param.Value);
70
+ return Number.isFinite(parsed) ? parsed : undefined;
71
+ }
72
+ /**
73
+ * Read a JSON-object param. Accepts either an object value or a JSON string that
74
+ * parses to an object. Returns `undefined` when missing or not an object.
75
+ */
76
+ getJsonObjectParam(params, name) {
77
+ const param = this.findParam(params, name);
78
+ if (!param || param.Value === undefined || param.Value === null) {
79
+ return undefined;
80
+ }
81
+ return this.coerceToObject(param.Value);
82
+ }
83
+ /** Locate a param by case-insensitive, whitespace-tolerant name. */
84
+ findParam(params, name) {
85
+ const target = name.trim().toLowerCase();
86
+ return params.Params.find((p) => p.Name.trim().toLowerCase() === target);
87
+ }
88
+ /** Append (or overwrite) an output param on the run params. */
89
+ addOutputParam(params, name, value) {
90
+ const existing = this.findParam(params, name);
91
+ if (existing) {
92
+ existing.Value = value;
93
+ existing.Type = existing.Type === 'Input' ? 'Both' : 'Output';
94
+ return;
95
+ }
96
+ params.Params.push({ Name: name, Type: 'Output', Value: value });
97
+ }
98
+ // ----- result mapping ------------------------------------------------------
99
+ /** Build a failure {@link ActionResultSimple}. */
100
+ fail(resultCode, message) {
101
+ return { Success: false, ResultCode: resultCode, Message: message };
102
+ }
103
+ /** Build a success {@link ActionResultSimple}, carrying the (mutated) params back. */
104
+ ok(params, message) {
105
+ return { Success: true, ResultCode: 'SUCCESS', Message: message, Params: params.Params };
106
+ }
107
+ // ----- json helpers --------------------------------------------------------
108
+ /** Coerce a param value (object or JSON string) into a plain object, or undefined. */
109
+ coerceToObject(value) {
110
+ if (typeof value === 'string') {
111
+ try {
112
+ const parsed = JSON.parse(value);
113
+ return this.isPlainObject(parsed) ? parsed : undefined;
114
+ }
115
+ catch {
116
+ return undefined;
117
+ }
118
+ }
119
+ return this.isPlainObject(value) ? value : undefined;
120
+ }
121
+ isPlainObject(value) {
122
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
123
+ }
124
+ }
125
+ //# sourceMappingURL=base-predictive-studio.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-predictive-studio.action.js","sourceRoot":"","sources":["../../src/actions/base-predictive-studio.action.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @module actions
3
+ *
4
+ * Barrel for the **Predictive Studio Actions** — the thin MemberJunction Action
5
+ * boundaries (CLAUDE.md "Actions are boundaries") over the already-built engine
6
+ * service classes, so agents / UI / workflows can invoke train / score /
7
+ * experiment / promote.
8
+ *
9
+ * Each action validates its params, delegates to the relevant engine service
10
+ * (`TrainingEngine` / `MLModelInferenceProcessor` / `ExperimentOrchestrator`)
11
+ * through injectable seams, and maps results back onto the action's output params.
12
+ * The engines + their dependency bundles are created behind overridable factory
13
+ * seams so the actions are unit-testable with no live DB and no sidecar.
14
+ *
15
+ * Driver-class keys (matching the `metadata/actions/predictive-studio/` rows):
16
+ * - {@link PredictiveStudioTrainModelAction} → `PredictiveStudioTrainModelAction`
17
+ * - {@link PredictiveStudioScoreRecordSetAction} → `PredictiveStudioScoreRecordSetAction`
18
+ * - {@link PredictiveStudioRunExperimentAction} → `PredictiveStudioRunExperimentAction`
19
+ * - {@link PredictiveStudioPromoteModelAction} → `PredictiveStudioPromoteModelAction`
20
+ */
21
+ export * from './base-predictive-studio.action.js';
22
+ export * from './train-model.action.js';
23
+ export * from './score-record-set.action.js';
24
+ export * from './score-record-set.runner.js';
25
+ export * from './run-experiment.action.js';
26
+ export * from './run-experiment.deps.js';
27
+ export * from './promote-model.action.js';
28
+ export * from './promote-model.gate.js';
29
+ export * from './model-scoring-action-generator.js';
30
+ export * from './schedule-model-scoring.action.js';
31
+ /**
32
+ * Tree-shaking anchor — call from a server bootstrap to guarantee the
33
+ * `@RegisterClass(BaseAction, ...)` registrations are not eliminated by the
34
+ * bundler. Referencing the classes through this function creates a static code
35
+ * path the bundler keeps (mirrors `LoadMLModelInferenceProcessor`).
36
+ */
37
+ export declare function LoadPredictiveStudioActions(): void;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAQhD;;;;;GAKG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAMlD"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @module actions
3
+ *
4
+ * Barrel for the **Predictive Studio Actions** — the thin MemberJunction Action
5
+ * boundaries (CLAUDE.md "Actions are boundaries") over the already-built engine
6
+ * service classes, so agents / UI / workflows can invoke train / score /
7
+ * experiment / promote.
8
+ *
9
+ * Each action validates its params, delegates to the relevant engine service
10
+ * (`TrainingEngine` / `MLModelInferenceProcessor` / `ExperimentOrchestrator`)
11
+ * through injectable seams, and maps results back onto the action's output params.
12
+ * The engines + their dependency bundles are created behind overridable factory
13
+ * seams so the actions are unit-testable with no live DB and no sidecar.
14
+ *
15
+ * Driver-class keys (matching the `metadata/actions/predictive-studio/` rows):
16
+ * - {@link PredictiveStudioTrainModelAction} → `PredictiveStudioTrainModelAction`
17
+ * - {@link PredictiveStudioScoreRecordSetAction} → `PredictiveStudioScoreRecordSetAction`
18
+ * - {@link PredictiveStudioRunExperimentAction} → `PredictiveStudioRunExperimentAction`
19
+ * - {@link PredictiveStudioPromoteModelAction} → `PredictiveStudioPromoteModelAction`
20
+ */
21
+ export * from './base-predictive-studio.action.js';
22
+ export * from './train-model.action.js';
23
+ export * from './score-record-set.action.js';
24
+ export * from './score-record-set.runner.js';
25
+ export * from './run-experiment.action.js';
26
+ export * from './run-experiment.deps.js';
27
+ export * from './promote-model.action.js';
28
+ export * from './promote-model.gate.js';
29
+ export * from './model-scoring-action-generator.js';
30
+ export * from './schedule-model-scoring.action.js';
31
+ import { PredictiveStudioTrainModelAction } from './train-model.action.js';
32
+ import { PredictiveStudioScoreRecordSetAction } from './score-record-set.action.js';
33
+ import { PredictiveStudioRunExperimentAction } from './run-experiment.action.js';
34
+ import { PredictiveStudioPromoteModelAction } from './promote-model.action.js';
35
+ import { PredictiveStudioScheduleModelScoringAction } from './schedule-model-scoring.action.js';
36
+ /**
37
+ * Tree-shaking anchor — call from a server bootstrap to guarantee the
38
+ * `@RegisterClass(BaseAction, ...)` registrations are not eliminated by the
39
+ * bundler. Referencing the classes through this function creates a static code
40
+ * path the bundler keeps (mirrors `LoadMLModelInferenceProcessor`).
41
+ */
42
+ export function LoadPredictiveStudioActions() {
43
+ void PredictiveStudioTrainModelAction;
44
+ void PredictiveStudioScoreRecordSetAction;
45
+ void PredictiveStudioRunExperimentAction;
46
+ void PredictiveStudioPromoteModelAction;
47
+ void PredictiveStudioScheduleModelScoringAction;
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAEhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,oCAAoC,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,0CAA0C,EAAE,MAAM,iCAAiC,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B;IACzC,KAAK,gCAAgC,CAAC;IACtC,KAAK,oCAAoC,CAAC;IAC1C,KAAK,mCAAmC,CAAC;IACzC,KAAK,kCAAkC,CAAC;IACxC,KAAK,0CAA0C,CAAC;AAClD,CAAC"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @module actions/model-scoring-action-generator
3
+ *
4
+ * **Per-model scoring Action generator** (plan PS2-2). When a Predictive Studio
5
+ * model is promoted to a usable status (`Published`), this service generates an
6
+ * idempotent child Action — `Score with <Model> v<n>` — so every published model
7
+ * becomes a first-class, discoverable Action (ActionSmith / CodeSmith pick it up
8
+ * for free) without any per-model code or AI codegen.
9
+ *
10
+ * ## Composition, not inheritance (CLAUDE.md: Actions)
11
+ * The generated row is a *child* of the canonical **Score Record Set** parent: it
12
+ * carries the parent's `ParentID` (metadata link only) and reuses the SAME
13
+ * `DriverClass` (`PredictiveStudioScoreRecordSetAction`). That class already reads
14
+ * the `ModelID` / `Scope` / `WriteBack` params, so the child needs no new
15
+ * implementation. The only thing that makes it model-specific is its `ModelID`
16
+ * input param's `DefaultValue`, which is pre-set to the model's id — ActionEngine
17
+ * seeds each param from its `DefaultValue` before invoke, so omitting `ModelID`
18
+ * scores with this model.
19
+ *
20
+ * ## Idempotency
21
+ * Mirrors {@link IntegrationActionGenerator}: the Action is found-or-created by its
22
+ * deterministic Name, and its child params are deleted + recreated on every run so
23
+ * they stay exactly in sync with the parent's contract.
24
+ *
25
+ * All saves are checked and failures are logged (never thrown up to the promote —
26
+ * action generation is an enhancement, not part of the promotion contract).
27
+ */
28
+ import { type UserInfo, type IMetadataProvider } from '@memberjunction/core';
29
+ import type { MJMLModelEntity, MJActionEntity, MJActionParamEntity } from '@memberjunction/core-entities';
30
+ /** Shape of a single Action Param to (re)create. Mirrors the parent's contract. */
31
+ interface ParamSpec {
32
+ Name: string;
33
+ Type: MJActionParamEntity['Type'];
34
+ ValueType: MJActionParamEntity['ValueType'];
35
+ IsRequired: boolean;
36
+ Description: string;
37
+ /** Pre-seeded default the ActionEngine applies before invoke (only ModelID uses it). */
38
+ DefaultValue?: string;
39
+ }
40
+ /**
41
+ * Generates (and disables) the per-model "Score with <Model> v<n>" child Action.
42
+ * Stateless + idempotent — safe to call on every promotion.
43
+ */
44
+ export declare class ModelScoringActionGenerator {
45
+ /**
46
+ * Find-or-create the per-model scoring Action for `model` and reconcile its
47
+ * params. Idempotent on the deterministic Action Name. Logs and returns on any
48
+ * failure (the parent action is missing, a save fails) rather than throwing —
49
+ * callers must never let scoring-action generation break the promotion path.
50
+ */
51
+ generateForModel(model: MJMLModelEntity, contextUser: UserInfo, provider: IMetadataProvider): Promise<void>;
52
+ /**
53
+ * Disable the generated scoring Action for `model` (e.g. when the model is
54
+ * Archived) by flipping its Status to `Disabled`. A no-op when no generated
55
+ * action exists. Never throws.
56
+ */
57
+ disableForModel(model: MJMLModelEntity, contextUser: UserInfo, provider: IMetadataProvider): Promise<void>;
58
+ /**
59
+ * Find-or-create the `MJ: Action Categories` row that groups all per-model
60
+ * scoring actions. Idempotent (find by Name first). Returns its ID, or null if
61
+ * the category couldn't be created (logged).
62
+ */
63
+ protected ensureModelsActionCategory(provider: IMetadataProvider, contextUser: UserInfo): Promise<string | null>;
64
+ /**
65
+ * Load the canonical parent **Score Record Set** Action — the top-level row
66
+ * (ParentID null) whose DriverClass is the scoring driver. Returns null (caller
67
+ * logs + bails) when it's missing.
68
+ */
69
+ protected findScoreRecordSetParentAction(provider: IMetadataProvider, contextUser: UserInfo): Promise<MJActionEntity | null>;
70
+ /**
71
+ * Find-or-create the per-model scoring Action by its deterministic Name and
72
+ * apply its fields. The child reuses the parent's DriverClass (composition) and
73
+ * links via ParentID. Returns the saved row, or null on save failure (logged).
74
+ */
75
+ protected upsertScoringAction(model: MJMLModelEntity, parent: MJActionEntity, categoryID: string | null, provider: IMetadataProvider, contextUser: UserInfo): Promise<MJActionEntity | null>;
76
+ /** Load an Action by exact Name (idempotency lookup), or null. */
77
+ protected findActionByName(name: string, provider: IMetadataProvider, contextUser: UserInfo): Promise<MJActionEntity | null>;
78
+ /**
79
+ * Delete the action's existing params and recreate the canonical scoring
80
+ * param set (matching the parent's contract). The `ModelID` input is pre-set to
81
+ * this model's id via `DefaultValue` so omitting it scores with this model.
82
+ */
83
+ protected recreateParams(actionID: string, model: MJMLModelEntity, provider: IMetadataProvider, contextUser: UserInfo): Promise<void>;
84
+ /** Load + delete all `MJ: Action Params` rows for the given action. */
85
+ protected deleteExistingParams(actionID: string, provider: IMetadataProvider, contextUser: UserInfo): Promise<void>;
86
+ /**
87
+ * The canonical scoring param set, mirroring the parent **Score Record Set**
88
+ * action: `ModelID` (pre-seeded for this model), `Scope`, `WriteBack`, plus the
89
+ * five output params. Kept DRY via a small spec list.
90
+ */
91
+ protected buildParamSpecs(model: MJMLModelEntity): ParamSpec[];
92
+ /**
93
+ * Deterministic Action Name: `Score with <label> v<version>`. The model has no
94
+ * `Name` column; its human label is the producing pipeline's name (the
95
+ * denormalized `Pipeline` view field), falling back to the model id.
96
+ */
97
+ protected scoringActionName(model: MJMLModelEntity): string;
98
+ /** Human-readable description naming the model label + version. */
99
+ protected scoringActionDescription(model: MJMLModelEntity): string;
100
+ /** The model's human label — its pipeline name, or the model id when unset. */
101
+ protected modelLabel(model: MJMLModelEntity): string;
102
+ /** The model's version, defaulting to 1 when unset. */
103
+ protected modelVersion(model: MJMLModelEntity): number;
104
+ /** Single-quote-escape a value for safe SQL filter interpolation. */
105
+ private escape;
106
+ }
107
+ export {};
108
+ //# sourceMappingURL=model-scoring-action-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-scoring-action-generator.d.ts","sourceRoot":"","sources":["../../src/actions/model-scoring-action-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAgC,KAAK,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,mBAAmB,EAEpB,MAAM,+BAA+B,CAAC;AAavC,mFAAmF;AACnF,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAClC,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,qBAAa,2BAA2B;IACtC;;;;;OAKG;IACU,gBAAgB,CAC3B,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,QAAQ,EACrB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAqBhB;;;;OAIG;IACU,eAAe,CAC1B,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,QAAQ,EACrB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAsBhB;;;;OAIG;cACa,0BAA0B,CACxC,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EAAE,QAAQ,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAiCzB;;;;OAIG;cACa,8BAA8B,CAC5C,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EAAE,QAAQ,GACpB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAkBjC;;;;OAIG;cACa,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EAAE,QAAQ,GACpB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IA6BjC,kEAAkE;cAClD,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EAAE,QAAQ,GACpB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAgBjC;;;;OAIG;cACa,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EAAE,QAAQ,GACpB,OAAO,CAAC,IAAI,CAAC;IAyBhB,uEAAuE;cACvD,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,iBAAiB,EAC3B,WAAW,EAAE,QAAQ,GACpB,OAAO,CAAC,IAAI,CAAC;IAuBhB;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,EAAE;IAsE9D;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM;IAI3D,mEAAmE;IACnE,SAAS,CAAC,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM;IAQlE,+EAA+E;IAC/E,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM;IAKpD,uDAAuD;IACvD,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM;IAItD,qEAAqE;IACrE,OAAO,CAAC,MAAM;CAGf"}