@memberjunction/predictive-studio 0.0.1 → 5.45.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,113 @@
1
+ /**
2
+ * @module operations/promote-model.operation
3
+ *
4
+ * **Promote ML Model** Remote Operation — the server body for the Manual-mode
5
+ * `PredictiveStudio.PromoteModel` operation. A `Sync` lifecycle-only transition
6
+ * (`Draft → Validated → Published → Archived`) that **enforces the leakage sign-off
7
+ * gate**: a leakage-flagged model cannot be promoted without an explicit sign-off
8
+ * (and a justification reason).
9
+ *
10
+ * Per CLAUDE.md "transport-layer architecture", the operation is a THIN adapter — it
11
+ * carries no promotion logic. The leakage detection + state-machine transition live
12
+ * in {@link ProductionModelPromotionGate}, shared with the Promote action via
13
+ * {@link promoteModelViaGate}. The gate touches ONLY the `Status` (the model is
14
+ * immutable, §6.4).
15
+ *
16
+ * Non-promoted outcomes (leakage refusal, missing reason, invalid transition, not
17
+ * found, save failure) are surfaced as a thrown error so the framework wraps them as
18
+ * a clean `EXECUTION_ERROR` result; the message preserves the plain-language detail
19
+ * the Action also surfaces.
20
+ */
21
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
22
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
24
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
25
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
26
+ };
27
+ import { RegisterClass } from '@memberjunction/global';
28
+ import { BaseRemotableOperation } from '@memberjunction/core';
29
+ import { PredictiveStudioPromoteModelOperation, } from '@memberjunction/core-entities';
30
+ import { ProductionModelPromotionGate } from '../actions/promote-model.gate.js';
31
+ import { promoteModelViaGate } from './delegation.js';
32
+ /**
33
+ * Server implementation of `PredictiveStudio.PromoteModel`. Extends the
34
+ * CodeGen-emitted {@link PredictiveStudioPromoteModelOperation} base
35
+ * (`ExecutionMode='Sync'`, `RequiredScope='predictive:execute'`) and supplies only
36
+ * the body; registered last so it wins server-side dispatch.
37
+ */
38
+ let PredictiveStudioPromoteModelServerOperation = class PredictiveStudioPromoteModelServerOperation extends PredictiveStudioPromoteModelOperation {
39
+ /** @inheritdoc */
40
+ async InternalExecute(input, provider, user) {
41
+ if (!input?.modelId) {
42
+ throw new Error('modelId is required');
43
+ }
44
+ if (!input.targetStatus) {
45
+ throw new Error('targetStatus is required (one of: Validated, Published, Archived)');
46
+ }
47
+ const outcome = await promoteModelViaGate({
48
+ modelId: input.modelId,
49
+ targetStatus: input.targetStatus,
50
+ signOff: input.signOff ?? false,
51
+ reason: input.reason,
52
+ contextUser: user,
53
+ provider,
54
+ }, this.gate());
55
+ return this.toOutput(input, outcome);
56
+ }
57
+ /**
58
+ * Map the gate outcome onto the operation's typed output. The single happy path
59
+ * (`promoted`) returns `{ promoted: true, status: newStatus }`; every refusal /
60
+ * failure throws with the plain-language detail so the framework surfaces it as a
61
+ * clean error (rather than silently returning `promoted: false`).
62
+ */
63
+ toOutput(input, outcome) {
64
+ switch (outcome.kind) {
65
+ case 'promoted':
66
+ return { promoted: true, status: outcome.newStatus };
67
+ case 'refused-leakage':
68
+ throw new Error(this.leakageRefusalMessage(input.modelId, outcome));
69
+ case 'signoff-reason-required':
70
+ throw new Error(this.signOffReasonRequiredMessage(input.modelId, outcome));
71
+ case 'invalid-transition':
72
+ throw new Error(`Model ${input.modelId} cannot move from '${outcome.currentStatus}' to '${outcome.targetStatus}'. ` +
73
+ 'Allowed lifecycle: Draft → Validated → Published → Archived (with Published ↔ Archived).');
74
+ case 'not-found':
75
+ throw new Error(`ML Model '${input.modelId}' was not found.`);
76
+ case 'save-failed':
77
+ throw new Error(`Failed to transition model '${input.modelId}': ${outcome.message}`);
78
+ }
79
+ }
80
+ /** Plain-language refusal message for a leakage-flagged model (mirrors the Action). */
81
+ leakageRefusalMessage(modelId, outcome) {
82
+ const detail = outcome.topFeature != null
83
+ ? ` One feature ("${outcome.topFeature}") accounts for ${((outcome.topShare ?? 0) * 100).toFixed(0)}% of the model's predictions, which often signals the model is accidentally peeking at the answer.`
84
+ : '';
85
+ return (`Model ${modelId} was flagged for possible target leakage and cannot be promoted without sign-off.${detail} ` +
86
+ 'A human must review the model and re-run this operation with signOff=true (and a reason) to confirm the result is legitimate.');
87
+ }
88
+ /** Message when a sign-off override was requested without a justification reason. */
89
+ signOffReasonRequiredMessage(modelId, outcome) {
90
+ const detail = outcome.topFeature != null
91
+ ? ` (one feature, "${outcome.topFeature}", dominates this model's predictions)`
92
+ : '';
93
+ return (`Model ${modelId} is leakage-flagged${detail} and signOff=true was supplied without a reason. ` +
94
+ 'Overriding a leakage flag requires a non-empty reason so the sign-off is auditable.');
95
+ }
96
+ /**
97
+ * The promotion gate to delegate to. Overridable so unit tests inject a mock with
98
+ * no live DB. The production default ({@link ProductionModelPromotionGate}) is the
99
+ * SAME gate the Promote action uses.
100
+ */
101
+ gate() {
102
+ return new ProductionModelPromotionGate();
103
+ }
104
+ };
105
+ PredictiveStudioPromoteModelServerOperation = __decorate([
106
+ RegisterClass(BaseRemotableOperation, 'PredictiveStudio.PromoteModel')
107
+ ], PredictiveStudioPromoteModelServerOperation);
108
+ export { PredictiveStudioPromoteModelServerOperation };
109
+ /** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
110
+ export function LoadPredictiveStudioPromoteModelOperation() {
111
+ // intentionally empty
112
+ }
113
+ //# sourceMappingURL=promote-model.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promote-model.operation.js","sourceRoot":"","sources":["../../src/operations/promote-model.operation.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @module operations/run-feature-pipeline.operation
3
+ *
4
+ * **Run Feature Pipeline** Remote Operation — the server body for the Manual-mode
5
+ * `PredictiveStudio.RunFeaturePipeline` operation. A Feature Pipeline is a
6
+ * *categorized* `MJ: Record Processes` row (it has no dedicated entity), so running
7
+ * one is exactly running the underlying Record Process. This operation therefore
8
+ * delegates straight to the Record Set Processing substrate's facade
9
+ * (`RecordProcessExecutor.RunByID`) — the same hardened batching / resume / audit
10
+ * path every bulk operation uses — rather than re-implementing any iteration logic.
11
+ *
12
+ * Per CLAUDE.md "record-set-processing guide": don't re-implement batching/audit;
13
+ * compose the substrate. Marked `LongRunning`: it forwards the executor's per-batch
14
+ * progress as typed `RemoteOpProgress`, so an attached caller (and the over-the-wire
15
+ * progress channel) sees live run progress — mirroring `RecordProcess.RunNow`.
16
+ */
17
+ import type { IMetadataProvider, UserInfo } from '@memberjunction/core';
18
+ import { type RemoteOpServerContext } from '@memberjunction/core';
19
+ import { PredictiveStudioRunFeaturePipelineOperation, type PredictiveStudioRunFeaturePipelineInput, type PredictiveStudioRunFeaturePipelineOutput } from '@memberjunction/core-entities';
20
+ import type { ProcessRunResult } from '@memberjunction/record-set-processor-base';
21
+ import { type RunRecordProcessOptions } from '@memberjunction/record-set-processor';
22
+ /**
23
+ * The narrow facade seam this operation depends on — "run the Record Process with
24
+ * this id and these options, give me the run summary". The production implementation
25
+ * is the substrate's {@link RecordProcessExecutor}; tests inject a deterministic fake
26
+ * so the mapping is unit-testable with no live DB.
27
+ */
28
+ export interface IFeaturePipelineRunner {
29
+ /** Run a Record Process by id and return its run summary. */
30
+ RunByID(recordProcessID: string, options: RunRecordProcessOptions): Promise<ProcessRunResult>;
31
+ }
32
+ /**
33
+ * Server implementation of `PredictiveStudio.RunFeaturePipeline`. Extends the
34
+ * CodeGen-emitted {@link PredictiveStudioRunFeaturePipelineOperation} base
35
+ * (`ExecutionMode='LongRunning'`, `RequiredScope='predictive:execute'`) and supplies
36
+ * only the body; registered last so it wins server-side dispatch.
37
+ */
38
+ export declare class PredictiveStudioRunFeaturePipelineServerOperation extends PredictiveStudioRunFeaturePipelineOperation {
39
+ /** @inheritdoc */
40
+ protected InternalExecute(input: PredictiveStudioRunFeaturePipelineInput, provider: IMetadataProvider, user: UserInfo, context: RemoteOpServerContext): Promise<PredictiveStudioRunFeaturePipelineOutput>;
41
+ /**
42
+ * Map the substrate's {@link ProcessRunResult} onto the operation's typed output.
43
+ * `written` is the substrate's `Success` count — for a FieldRules feature pipeline
44
+ * those are the records whose feature values were written back (0 in dry-run).
45
+ */
46
+ protected toOutput(result: ProcessRunResult): PredictiveStudioRunFeaturePipelineOutput;
47
+ /**
48
+ * The Record Process facade to delegate to. Overridable so unit tests inject a
49
+ * fake with no live DB. The production default is the substrate's
50
+ * {@link RecordProcessExecutor}.
51
+ */
52
+ protected runner(): IFeaturePipelineRunner;
53
+ }
54
+ /** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
55
+ export declare function LoadPredictiveStudioRunFeaturePipelineOperation(): void;
56
+ //# sourceMappingURL=run-feature-pipeline.operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-feature-pipeline.operation.d.ts","sourceRoot":"","sources":["../../src/operations/run-feature-pipeline.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,2CAA2C,EAC3C,KAAK,uCAAuC,EAC5C,KAAK,wCAAwC,EAC9C,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE3G;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,6DAA6D;IAC7D,OAAO,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC/F;AAED;;;;;GAKG;AACH,qBACa,iDAAkD,SAAQ,2CAA2C;IAChH,kBAAkB;cACF,eAAe,CAC7B,KAAK,EAAE,uCAAuC,EAC9C,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,wCAAwC,CAAC;IA8BpD;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,wCAAwC;IAYtF;;;;OAIG;IACH,SAAS,CAAC,MAAM,IAAI,sBAAsB;CAG3C;AAED,sFAAsF;AACtF,wBAAgB,+CAA+C,IAAI,IAAI,CAEtE"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @module operations/run-feature-pipeline.operation
3
+ *
4
+ * **Run Feature Pipeline** Remote Operation — the server body for the Manual-mode
5
+ * `PredictiveStudio.RunFeaturePipeline` operation. A Feature Pipeline is a
6
+ * *categorized* `MJ: Record Processes` row (it has no dedicated entity), so running
7
+ * one is exactly running the underlying Record Process. This operation therefore
8
+ * delegates straight to the Record Set Processing substrate's facade
9
+ * (`RecordProcessExecutor.RunByID`) — the same hardened batching / resume / audit
10
+ * path every bulk operation uses — rather than re-implementing any iteration logic.
11
+ *
12
+ * Per CLAUDE.md "record-set-processing guide": don't re-implement batching/audit;
13
+ * compose the substrate. Marked `LongRunning`: it forwards the executor's per-batch
14
+ * progress as typed `RemoteOpProgress`, so an attached caller (and the over-the-wire
15
+ * progress channel) sees live run progress — mirroring `RecordProcess.RunNow`.
16
+ */
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ import { RegisterClass } from '@memberjunction/global';
24
+ import { BaseRemotableOperation } from '@memberjunction/core';
25
+ import { PredictiveStudioRunFeaturePipelineOperation, } from '@memberjunction/core-entities';
26
+ import { RecordProcessExecutor } from '@memberjunction/record-set-processor';
27
+ /**
28
+ * Server implementation of `PredictiveStudio.RunFeaturePipeline`. Extends the
29
+ * CodeGen-emitted {@link PredictiveStudioRunFeaturePipelineOperation} base
30
+ * (`ExecutionMode='LongRunning'`, `RequiredScope='predictive:execute'`) and supplies
31
+ * only the body; registered last so it wins server-side dispatch.
32
+ */
33
+ let PredictiveStudioRunFeaturePipelineServerOperation = class PredictiveStudioRunFeaturePipelineServerOperation extends PredictiveStudioRunFeaturePipelineOperation {
34
+ /** @inheritdoc */
35
+ async InternalExecute(input, provider, user, context) {
36
+ if (!input?.featurePipelineID) {
37
+ throw new Error('featurePipelineID is required');
38
+ }
39
+ const result = await this.runner().RunByID(input.featurePipelineID, {
40
+ contextUser: user,
41
+ provider,
42
+ triggeredBy: 'OnDemand',
43
+ singleRecordID: input.singleRecordID,
44
+ dryRun: input.dryRun,
45
+ // The wire scope shape IS the substrate's RecordProcessScopeOverride (both are
46
+ // the CodeGen-emitted `{ Kind: 'records' | 'view' | 'list' | 'filter'; … }`).
47
+ scope: input.scope,
48
+ // Forward the executor's per-batch progress as typed RemoteOpProgress so an
49
+ // attached caller's onProgress (and the over-the-wire channel) sees live progress.
50
+ onProgress: (p) => context.emitProgress({
51
+ OperationKey: this.OperationKey,
52
+ Processed: p.Processed,
53
+ Total: p.Total ?? undefined,
54
+ Status: 'Running',
55
+ Message: `Processed ${p.Processed}${p.Total != null ? ` of ${p.Total}` : ''} record(s)`,
56
+ Payload: { Success: p.Success, Error: p.Error, Skipped: p.Skipped, CurrentRecordID: p.CurrentRecordID },
57
+ }),
58
+ });
59
+ return this.toOutput(result);
60
+ }
61
+ /**
62
+ * Map the substrate's {@link ProcessRunResult} onto the operation's typed output.
63
+ * `written` is the substrate's `Success` count — for a FieldRules feature pipeline
64
+ * those are the records whose feature values were written back (0 in dry-run).
65
+ */
66
+ toOutput(result) {
67
+ return {
68
+ processRunID: result.ProcessRunID,
69
+ status: result.Status,
70
+ processed: result.Processed,
71
+ written: result.Success,
72
+ skipped: result.Skipped,
73
+ error: result.Error,
74
+ errorMessage: result.ErrorMessage,
75
+ };
76
+ }
77
+ /**
78
+ * The Record Process facade to delegate to. Overridable so unit tests inject a
79
+ * fake with no live DB. The production default is the substrate's
80
+ * {@link RecordProcessExecutor}.
81
+ */
82
+ runner() {
83
+ return new RecordProcessExecutor();
84
+ }
85
+ };
86
+ PredictiveStudioRunFeaturePipelineServerOperation = __decorate([
87
+ RegisterClass(BaseRemotableOperation, 'PredictiveStudio.RunFeaturePipeline')
88
+ ], PredictiveStudioRunFeaturePipelineServerOperation);
89
+ export { PredictiveStudioRunFeaturePipelineServerOperation };
90
+ /** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
91
+ export function LoadPredictiveStudioRunFeaturePipelineOperation() {
92
+ // intentionally empty
93
+ }
94
+ //# sourceMappingURL=run-feature-pipeline.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-feature-pipeline.operation.js","sourceRoot":"","sources":["../../src/operations/run-feature-pipeline.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAA8B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,2CAA2C,GAG5C,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,qBAAqB,EAAgC,MAAM,sCAAsC,CAAC;AAa3G;;;;;GAKG;AAEI,IAAM,iDAAiD,GAAvD,MAAM,iDAAkD,SAAQ,2CAA2C;IAChH,kBAAkB;IACR,KAAK,CAAC,eAAe,CAC7B,KAA8C,EAC9C,QAA2B,EAC3B,IAAc,EACd,OAA8B;QAE9B,IAAI,CAAC,KAAK,EAAE,iBAAiB,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE;YAClE,WAAW,EAAE,IAAI;YACjB,QAAQ;YACR,WAAW,EAAE,UAAU;YACvB,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,+EAA+E;YAC/E,8EAA8E;YAC9E,KAAK,EAAE,KAAK,CAAC,KAA+C;YAC5D,4EAA4E;YAC5E,mFAAmF;YACnF,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAChB,OAAO,CAAC,YAAY,CAAC;gBACnB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,SAAS,EAAE,CAAC,CAAC,SAAS;gBACtB,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,SAAS;gBAC3B,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,aAAa,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY;gBACvF,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC,eAAe,EAAE;aACxG,CAAC;SACL,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACO,QAAQ,CAAC,MAAwB;QACzC,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACO,MAAM;QACd,OAAO,IAAI,qBAAqB,EAAE,CAAC;IACrC,CAAC;CACF,CAAA;AA9DY,iDAAiD;IAD7D,aAAa,CAAC,sBAAsB,EAAE,qCAAqC,CAAC;GAChE,iDAAiD,CA8D7D;;AAED,sFAAsF;AACtF,MAAM,UAAU,+CAA+C;IAC7D,sBAAsB;AACxB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @module operations/score-record-set.operation
3
+ *
4
+ * **Score Record Set** Remote Operation — the server body for the Manual-mode
5
+ * `PredictiveStudio.ScoreRecordSet` operation. The typed peer of the Score *Action*:
6
+ * it resolves the requested scope and scores it with a trained model, returning the
7
+ * counts plus either ephemeral predictions or a write-back confirmation.
8
+ *
9
+ * Per CLAUDE.md "transport-layer architecture", the operation is a THIN adapter —
10
+ * it carries no scoring logic. The scope resolution + `MLModelInferenceProcessor`
11
+ * batch path live in {@link ProductionScoreRecordSetRunner}, shared with the Score
12
+ * action via {@link scoreRecordSetViaRunner}.
13
+ *
14
+ * Marked `LongRunning` (a large scope can take a while): it emits coarse start/finish
15
+ * progress. The runner does not expose a per-record progress hook today, so progress
16
+ * is bounded to the lifecycle phases.
17
+ */
18
+ import type { IMetadataProvider, UserInfo } from '@memberjunction/core';
19
+ import { type RemoteOpServerContext } from '@memberjunction/core';
20
+ import { PredictiveStudioScoreRecordSetOperation, type PredictiveStudioScoreRecordSetInput, type PredictiveStudioScoreRecordSetOutput } from '@memberjunction/core-entities';
21
+ import type { IScoreRecordSetRunner } from '../actions/score-record-set.action.js';
22
+ /**
23
+ * Server implementation of `PredictiveStudio.ScoreRecordSet`. Extends the
24
+ * CodeGen-emitted {@link PredictiveStudioScoreRecordSetOperation} base
25
+ * (`ExecutionMode='LongRunning'`, `RequiredScope='predictive:execute'`) and supplies
26
+ * only the body; registered last so it wins server-side dispatch.
27
+ */
28
+ export declare class PredictiveStudioScoreRecordSetServerOperation extends PredictiveStudioScoreRecordSetOperation {
29
+ /** @inheritdoc */
30
+ protected InternalExecute(input: PredictiveStudioScoreRecordSetInput, provider: IMetadataProvider, user: UserInfo, context: RemoteOpServerContext): Promise<PredictiveStudioScoreRecordSetOutput>;
31
+ /**
32
+ * Count how many of the mutually-exclusive scope selectors are populated. More
33
+ * than one is ambiguous and is rejected the same as none, so the caller's intent
34
+ * is always unambiguous (mirrors the Score action's `scopeHasTarget`).
35
+ */
36
+ protected countScopeSelectors(scope: PredictiveStudioScoreRecordSetInput['scope']): number;
37
+ /**
38
+ * The scoring runner to delegate to. Overridable so unit tests inject a mock with
39
+ * no live DB / sidecar (mirrors the Action's `createRunner` seam). The production
40
+ * default ({@link ProductionScoreRecordSetRunner}) resolves the scope and drives
41
+ * the `MLModelInferenceProcessor` — the SAME path the Score action uses.
42
+ */
43
+ protected runner(): IScoreRecordSetRunner;
44
+ }
45
+ /** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
46
+ export declare function LoadPredictiveStudioScoreRecordSetOperation(): void;
47
+ //# sourceMappingURL=score-record-set.operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"score-record-set.operation.d.ts","sourceRoot":"","sources":["../../src/operations/score-record-set.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,uCAAuC,EACvC,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EAC1C,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,oCAAoC,CAAC;AAI5C;;;;;GAKG;AACH,qBACa,6CAA8C,SAAQ,uCAAuC;IACxG,kBAAkB;cACF,eAAe,CAC7B,KAAK,EAAE,mCAAmC,EAC1C,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oCAAoC,CAAC;IA6ChD;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,mCAAmC,CAAC,OAAO,CAAC,GAAG,MAAM;IAU1F;;;;;OAKG;IACH,SAAS,CAAC,MAAM,IAAI,qBAAqB;CAM1C;AAED,sFAAsF;AACtF,wBAAgB,2CAA2C,IAAI,IAAI,CAElE"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @module operations/score-record-set.operation
3
+ *
4
+ * **Score Record Set** Remote Operation — the server body for the Manual-mode
5
+ * `PredictiveStudio.ScoreRecordSet` operation. The typed peer of the Score *Action*:
6
+ * it resolves the requested scope and scores it with a trained model, returning the
7
+ * counts plus either ephemeral predictions or a write-back confirmation.
8
+ *
9
+ * Per CLAUDE.md "transport-layer architecture", the operation is a THIN adapter —
10
+ * it carries no scoring logic. The scope resolution + `MLModelInferenceProcessor`
11
+ * batch path live in {@link ProductionScoreRecordSetRunner}, shared with the Score
12
+ * action via {@link scoreRecordSetViaRunner}.
13
+ *
14
+ * Marked `LongRunning` (a large scope can take a while): it emits coarse start/finish
15
+ * progress. The runner does not expose a per-record progress hook today, so progress
16
+ * is bounded to the lifecycle phases.
17
+ */
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ import { RegisterClass } from '@memberjunction/global';
25
+ import { BaseRemotableOperation } from '@memberjunction/core';
26
+ import { PredictiveStudioScoreRecordSetOperation, } from '@memberjunction/core-entities';
27
+ import { scoreRecordSetViaRunner, buildScoreRecordSetRunner } from './delegation.js';
28
+ /**
29
+ * Server implementation of `PredictiveStudio.ScoreRecordSet`. Extends the
30
+ * CodeGen-emitted {@link PredictiveStudioScoreRecordSetOperation} base
31
+ * (`ExecutionMode='LongRunning'`, `RequiredScope='predictive:execute'`) and supplies
32
+ * only the body; registered last so it wins server-side dispatch.
33
+ */
34
+ let PredictiveStudioScoreRecordSetServerOperation = class PredictiveStudioScoreRecordSetServerOperation extends PredictiveStudioScoreRecordSetOperation {
35
+ /** @inheritdoc */
36
+ async InternalExecute(input, provider, user, context) {
37
+ if (!input?.modelId) {
38
+ throw new Error('modelId is required');
39
+ }
40
+ const scope = input.scope;
41
+ if (!scope || this.countScopeSelectors(scope) !== 1) {
42
+ throw new Error('scope must populate exactly one of: records, viewId, listId, filter, single');
43
+ }
44
+ context.emitProgress({
45
+ OperationKey: this.OperationKey,
46
+ Processed: 0,
47
+ Status: 'Running',
48
+ Message: `Scoring records with model ${input.modelId}…`,
49
+ });
50
+ const result = await scoreRecordSetViaRunner({
51
+ modelId: input.modelId,
52
+ scope: scope,
53
+ writeBack: input.writeBack,
54
+ contextUser: user,
55
+ provider,
56
+ }, this.runner());
57
+ context.emitProgress({
58
+ OperationKey: this.OperationKey,
59
+ Processed: result.scoredCount + result.failedCount + result.skippedCount,
60
+ Status: 'Running',
61
+ Message: `Scored ${result.scoredCount}, failed ${result.failedCount}, skipped ${result.skippedCount}.`,
62
+ });
63
+ return {
64
+ scored: result.scoredCount,
65
+ failed: result.failedCount,
66
+ skipped: result.skippedCount,
67
+ wroteBack: result.wroteBack,
68
+ // Predictions are ephemeral — only present when NOT writing back (the runner
69
+ // already drops them on write-back; map straight through).
70
+ predictions: result.wroteBack ? undefined : result.predictions,
71
+ };
72
+ }
73
+ /**
74
+ * Count how many of the mutually-exclusive scope selectors are populated. More
75
+ * than one is ambiguous and is rejected the same as none, so the caller's intent
76
+ * is always unambiguous (mirrors the Score action's `scopeHasTarget`).
77
+ */
78
+ countScopeSelectors(scope) {
79
+ let count = 0;
80
+ if (Array.isArray(scope.records) && scope.records.length > 0)
81
+ count++;
82
+ if (scope.viewId)
83
+ count++;
84
+ if (scope.listId)
85
+ count++;
86
+ if (scope.filter)
87
+ count++;
88
+ if (scope.single)
89
+ count++;
90
+ return count;
91
+ }
92
+ /**
93
+ * The scoring runner to delegate to. Overridable so unit tests inject a mock with
94
+ * no live DB / sidecar (mirrors the Action's `createRunner` seam). The production
95
+ * default ({@link ProductionScoreRecordSetRunner}) resolves the scope and drives
96
+ * the `MLModelInferenceProcessor` — the SAME path the Score action uses.
97
+ */
98
+ runner() {
99
+ // Use the loader-wired factory so the runner can read the persisted model
100
+ // artifact at score time (a bare `new ProductionScoreRecordSetRunner()` has
101
+ // no artifact loader → "no artifact loader is configured").
102
+ return buildScoreRecordSetRunner();
103
+ }
104
+ };
105
+ PredictiveStudioScoreRecordSetServerOperation = __decorate([
106
+ RegisterClass(BaseRemotableOperation, 'PredictiveStudio.ScoreRecordSet')
107
+ ], PredictiveStudioScoreRecordSetServerOperation);
108
+ export { PredictiveStudioScoreRecordSetServerOperation };
109
+ /** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
110
+ export function LoadPredictiveStudioScoreRecordSetOperation() {
111
+ // intentionally empty
112
+ }
113
+ //# sourceMappingURL=score-record-set.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"score-record-set.operation.js","sourceRoot":"","sources":["../../src/operations/score-record-set.operation.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @module operations/start-experiment-session.operation
3
+ *
4
+ * **Start Experiment Session** Remote Operation — the server body for the
5
+ * Manual-mode `PredictiveStudio.StartExperimentSession` operation. The typed peer of
6
+ * the Run-Experiment *Action*: it validates that an **approved** modeling plan was
7
+ * supplied and runs it as an experiment session (in waves, under a budget,
8
+ * maintaining a leaderboard) via {@link ExperimentOrchestrator.runSession}.
9
+ *
10
+ * Per CLAUDE.md "transport-layer architecture", the operation is a THIN adapter —
11
+ * it carries no orchestration logic. The wave loop / leaderboard / budget gate live
12
+ * in the orchestrator, and the production deps wiring is shared with the action via
13
+ * {@link runExperimentSessionViaOrchestrator}.
14
+ *
15
+ * Marked `LongRunning`: it emits coarse start/finish progress. The orchestrator runs
16
+ * the session synchronously to completion (or a clean budget pause); it does not
17
+ * expose a per-wave progress hook today, so progress is bounded to lifecycle phases.
18
+ */
19
+ import type { IMetadataProvider, UserInfo } from '@memberjunction/core';
20
+ import { type RemoteOpServerContext } from '@memberjunction/core';
21
+ import { PredictiveStudioStartExperimentSessionOperation, type PredictiveStudioStartExperimentSessionInput, type PredictiveStudioStartExperimentSessionOutput } from '@memberjunction/core-entities';
22
+ import { type ModelingPlanSpec, type Budget } from '@memberjunction/predictive-studio-core';
23
+ import { ExperimentOrchestrator } from '../experiment/experiment-orchestrator.js';
24
+ import type { ExperimentRunOptions, ExperimentSessionResult } from '../experiment/types.js';
25
+ /**
26
+ * Server implementation of `PredictiveStudio.StartExperimentSession`. Extends the
27
+ * CodeGen-emitted {@link PredictiveStudioStartExperimentSessionOperation} base
28
+ * (`ExecutionMode='LongRunning'`, `RequiredScope='predictive:execute'`) and supplies
29
+ * only the body; registered last so it wins server-side dispatch.
30
+ */
31
+ export declare class PredictiveStudioStartExperimentSessionServerOperation extends PredictiveStudioStartExperimentSessionOperation {
32
+ /** @inheritdoc */
33
+ protected InternalExecute(input: PredictiveStudioStartExperimentSessionInput, provider: IMetadataProvider, user: UserInfo, context: RemoteOpServerContext): Promise<PredictiveStudioStartExperimentSessionOutput>;
34
+ /**
35
+ * Validate the untrusted plan against the Core schema and enforce the approval
36
+ * gate. Experiment execution is gated on user approval (§9.1) — an unapproved
37
+ * (or malformed) plan is refused before any orchestration begins.
38
+ *
39
+ * NB: the server tsconfig runs with `strictNullChecks` OFF, under which the
40
+ * discriminated-union return does NOT narrow on `validation.ok`; we read the
41
+ * failure detail off the concrete failure shape (mirrors the Run-Experiment action).
42
+ */
43
+ protected validatePlan(rawPlan: PredictiveStudioStartExperimentSessionInput['planSpec']): ModelingPlanSpec;
44
+ /**
45
+ * Build the orchestrator run options from the input — an optional `ExperimentID`
46
+ * to attach the session to, an optional validated `Budget` override (else the
47
+ * plan's `ProposedBudget`), and an optional session name.
48
+ */
49
+ protected buildOptions(input: PredictiveStudioStartExperimentSessionInput): ExperimentRunOptions;
50
+ /**
51
+ * Validate the optional budget override. A malformed budget is NOT a hard failure
52
+ * — the plan's `ProposedBudget` is the downstream fallback — so this returns
53
+ * `undefined` on absence or invalidity rather than throwing (mirrors the action).
54
+ */
55
+ protected parseBudget(raw: PredictiveStudioStartExperimentSessionInput['budget']): Budget | undefined;
56
+ /**
57
+ * The {@link ExperimentOrchestrator} to delegate to. Overridable so unit tests
58
+ * inject a mock with no live DB / sidecar (mirrors the Action's seam).
59
+ */
60
+ protected orchestrator(): ExperimentOrchestrator;
61
+ }
62
+ /** Local alias so JSDoc {@link} references resolve cleanly. */
63
+ export type { ExperimentSessionResult };
64
+ /** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
65
+ export declare function LoadPredictiveStudioStartExperimentSessionOperation(): void;
66
+ //# sourceMappingURL=start-experiment-session.operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-experiment-session.operation.d.ts","sourceRoot":"","sources":["../../src/operations/start-experiment-session.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,+CAA+C,EAC/C,KAAK,2CAA2C,EAChD,KAAK,4CAA4C,EAClD,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACZ,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGzF;;;;;GAKG;AACH,qBACa,qDAAsD,SAAQ,+CAA+C;IACxH,kBAAkB;cACF,eAAe,CAC7B,KAAK,EAAE,2CAA2C,EAClD,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,4CAA4C,CAAC;IAiCxD;;;;;;;;OAQG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,2CAA2C,CAAC,UAAU,CAAC,GAAG,gBAAgB;IAkB1G;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,2CAA2C,GAAG,oBAAoB;IAehG;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,2CAA2C,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,SAAS;IAQrG;;;OAGG;IACH,SAAS,CAAC,YAAY,IAAI,sBAAsB;CAGjD;AAED,+DAA+D;AAC/D,YAAY,EAAE,uBAAuB,EAAE,CAAC;AAExC,sFAAsF;AACtF,wBAAgB,mDAAmD,IAAI,IAAI,CAE1E"}