@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.
- package/README.md +101 -28
- package/dist/actions/base-predictive-studio.action.d.ts +63 -0
- package/dist/actions/base-predictive-studio.action.d.ts.map +1 -0
- package/dist/actions/base-predictive-studio.action.js +125 -0
- package/dist/actions/base-predictive-studio.action.js.map +1 -0
- package/dist/actions/index.d.ts +38 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +49 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/model-scoring-action-generator.d.ts +108 -0
- package/dist/actions/model-scoring-action-generator.d.ts.map +1 -0
- package/dist/actions/model-scoring-action-generator.js +316 -0
- package/dist/actions/model-scoring-action-generator.js.map +1 -0
- package/dist/actions/promote-model.action.d.ts +102 -0
- package/dist/actions/promote-model.action.d.ts.map +1 -0
- package/dist/actions/promote-model.action.js +132 -0
- package/dist/actions/promote-model.action.js.map +1 -0
- package/dist/actions/promote-model.gate.d.ts +77 -0
- package/dist/actions/promote-model.gate.d.ts.map +1 -0
- package/dist/actions/promote-model.gate.js +205 -0
- package/dist/actions/promote-model.gate.js.map +1 -0
- package/dist/actions/run-experiment.action.d.ts +60 -0
- package/dist/actions/run-experiment.action.d.ts.map +1 -0
- package/dist/actions/run-experiment.action.js +134 -0
- package/dist/actions/run-experiment.action.js.map +1 -0
- package/dist/actions/run-experiment.deps.d.ts +47 -0
- package/dist/actions/run-experiment.deps.d.ts.map +1 -0
- package/dist/actions/run-experiment.deps.js +71 -0
- package/dist/actions/run-experiment.deps.js.map +1 -0
- package/dist/actions/schedule-model-scoring.action.d.ts +71 -0
- package/dist/actions/schedule-model-scoring.action.d.ts.map +1 -0
- package/dist/actions/schedule-model-scoring.action.js +148 -0
- package/dist/actions/schedule-model-scoring.action.js.map +1 -0
- package/dist/actions/score-record-set.action.d.ts +133 -0
- package/dist/actions/score-record-set.action.d.ts.map +1 -0
- package/dist/actions/score-record-set.action.js +136 -0
- package/dist/actions/score-record-set.action.js.map +1 -0
- package/dist/actions/score-record-set.runner.d.ts +192 -0
- package/dist/actions/score-record-set.runner.d.ts.map +1 -0
- package/dist/actions/score-record-set.runner.js +416 -0
- package/dist/actions/score-record-set.runner.js.map +1 -0
- package/dist/actions/train-model.action.d.ts +57 -0
- package/dist/actions/train-model.action.d.ts.map +1 -0
- package/dist/actions/train-model.action.js +111 -0
- package/dist/actions/train-model.action.js.map +1 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +14 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/model-dev-orchestrator-agent.d.ts +42 -0
- package/dist/agent/model-dev-orchestrator-agent.d.ts.map +1 -0
- package/dist/agent/model-dev-orchestrator-agent.js +76 -0
- package/dist/agent/model-dev-orchestrator-agent.js.map +1 -0
- package/dist/agent/modeling-plan-to-pipeline.d.ts +49 -0
- package/dist/agent/modeling-plan-to-pipeline.d.ts.map +1 -0
- package/dist/agent/modeling-plan-to-pipeline.js +101 -0
- package/dist/agent/modeling-plan-to-pipeline.js.map +1 -0
- package/dist/agent/pipeline-builder-agent.d.ts +58 -0
- package/dist/agent/pipeline-builder-agent.d.ts.map +1 -0
- package/dist/agent/pipeline-builder-agent.js +101 -0
- package/dist/agent/pipeline-builder-agent.js.map +1 -0
- package/dist/agent/pipeline-builder.d.ts +67 -0
- package/dist/agent/pipeline-builder.d.ts.map +1 -0
- package/dist/agent/pipeline-builder.js +114 -0
- package/dist/agent/pipeline-builder.js.map +1 -0
- package/dist/experiment/concurrency.d.ts +41 -0
- package/dist/experiment/concurrency.d.ts.map +1 -0
- package/dist/experiment/concurrency.js +54 -0
- package/dist/experiment/concurrency.js.map +1 -0
- package/dist/experiment/experiment-orchestrator.d.ts +136 -0
- package/dist/experiment/experiment-orchestrator.d.ts.map +1 -0
- package/dist/experiment/experiment-orchestrator.js +408 -0
- package/dist/experiment/experiment-orchestrator.js.map +1 -0
- package/dist/experiment/index.d.ts +17 -0
- package/dist/experiment/index.d.ts.map +1 -0
- package/dist/experiment/index.js +17 -0
- package/dist/experiment/index.js.map +1 -0
- package/dist/experiment/leaderboard.d.ts +50 -0
- package/dist/experiment/leaderboard.d.ts.map +1 -0
- package/dist/experiment/leaderboard.js +91 -0
- package/dist/experiment/leaderboard.js.map +1 -0
- package/dist/experiment/seams.d.ts +95 -0
- package/dist/experiment/seams.d.ts.map +1 -0
- package/dist/experiment/seams.js +126 -0
- package/dist/experiment/seams.js.map +1 -0
- package/dist/experiment/types.d.ts +228 -0
- package/dist/experiment/types.d.ts.map +1 -0
- package/dist/experiment/types.js +19 -0
- package/dist/experiment/types.js.map +1 -0
- package/dist/experiment/wave-strategist.d.ts +31 -0
- package/dist/experiment/wave-strategist.d.ts.map +1 -0
- package/dist/experiment/wave-strategist.js +50 -0
- package/dist/experiment/wave-strategist.js.map +1 -0
- package/dist/feature-assembly/as-of.d.ts +74 -0
- package/dist/feature-assembly/as-of.d.ts.map +1 -0
- package/dist/feature-assembly/as-of.js +136 -0
- package/dist/feature-assembly/as-of.js.map +1 -0
- package/dist/feature-assembly/data-access.d.ts +114 -0
- package/dist/feature-assembly/data-access.d.ts.map +1 -0
- package/dist/feature-assembly/data-access.js +68 -0
- package/dist/feature-assembly/data-access.js.map +1 -0
- package/dist/feature-assembly/feature-assembly-executor.d.ts +273 -0
- package/dist/feature-assembly/feature-assembly-executor.d.ts.map +1 -0
- package/dist/feature-assembly/feature-assembly-executor.js +521 -0
- package/dist/feature-assembly/feature-assembly-executor.js.map +1 -0
- package/dist/feature-assembly/index.d.ts +13 -0
- package/dist/feature-assembly/index.d.ts.map +1 -0
- package/dist/feature-assembly/index.js +13 -0
- package/dist/feature-assembly/index.js.map +1 -0
- package/dist/feature-assembly/leakage-guard.d.ts +86 -0
- package/dist/feature-assembly/leakage-guard.d.ts.map +1 -0
- package/dist/feature-assembly/leakage-guard.js +111 -0
- package/dist/feature-assembly/leakage-guard.js.map +1 -0
- package/dist/feature-assembly/vision-llm.d.ts +125 -0
- package/dist/feature-assembly/vision-llm.d.ts.map +1 -0
- package/dist/feature-assembly/vision-llm.js +211 -0
- package/dist/feature-assembly/vision-llm.js.map +1 -0
- package/dist/feature-pipelines/feature-pipeline-engine.d.ts +159 -0
- package/dist/feature-pipelines/feature-pipeline-engine.d.ts.map +1 -0
- package/dist/feature-pipelines/feature-pipeline-engine.js +298 -0
- package/dist/feature-pipelines/feature-pipeline-engine.js.map +1 -0
- package/dist/feature-pipelines/index.d.ts +13 -0
- package/dist/feature-pipelines/index.d.ts.map +1 -0
- package/dist/feature-pipelines/index.js +13 -0
- package/dist/feature-pipelines/index.js.map +1 -0
- package/dist/feature-pipelines/types.d.ts +72 -0
- package/dist/feature-pipelines/types.d.ts.map +1 -0
- package/dist/feature-pipelines/types.js +17 -0
- package/dist/feature-pipelines/types.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/maintenance/index.d.ts +19 -0
- package/dist/maintenance/index.d.ts.map +1 -0
- package/dist/maintenance/index.js +19 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/maintenance/maintenance-engine.d.ts +152 -0
- package/dist/maintenance/maintenance-engine.d.ts.map +1 -0
- package/dist/maintenance/maintenance-engine.js +412 -0
- package/dist/maintenance/maintenance-engine.js.map +1 -0
- package/dist/maintenance/metrics.d.ts +37 -0
- package/dist/maintenance/metrics.d.ts.map +1 -0
- package/dist/maintenance/metrics.js +85 -0
- package/dist/maintenance/metrics.js.map +1 -0
- package/dist/maintenance/seams.d.ts +85 -0
- package/dist/maintenance/seams.d.ts.map +1 -0
- package/dist/maintenance/seams.js +166 -0
- package/dist/maintenance/seams.js.map +1 -0
- package/dist/maintenance/types.d.ts +318 -0
- package/dist/maintenance/types.d.ts.map +1 -0
- package/dist/maintenance/types.js +27 -0
- package/dist/maintenance/types.js.map +1 -0
- package/dist/operations/__tests__/helpers.d.ts +30 -0
- package/dist/operations/__tests__/helpers.d.ts.map +1 -0
- package/dist/operations/__tests__/helpers.js +44 -0
- package/dist/operations/__tests__/helpers.js.map +1 -0
- package/dist/operations/control-experiment-session.operation.d.ts +33 -0
- package/dist/operations/control-experiment-session.operation.d.ts.map +1 -0
- package/dist/operations/control-experiment-session.operation.js +71 -0
- package/dist/operations/control-experiment-session.operation.js.map +1 -0
- package/dist/operations/create-scoring-process.operation.d.ts +30 -0
- package/dist/operations/create-scoring-process.operation.d.ts.map +1 -0
- package/dist/operations/create-scoring-process.operation.js +65 -0
- package/dist/operations/create-scoring-process.operation.js.map +1 -0
- package/dist/operations/delegation.d.ts +113 -0
- package/dist/operations/delegation.d.ts.map +1 -0
- package/dist/operations/delegation.js +139 -0
- package/dist/operations/delegation.js.map +1 -0
- package/dist/operations/index.d.ts +40 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +55 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/operations/promote-model.operation.d.ts +57 -0
- package/dist/operations/promote-model.operation.d.ts.map +1 -0
- package/dist/operations/promote-model.operation.js +113 -0
- package/dist/operations/promote-model.operation.js.map +1 -0
- package/dist/operations/run-feature-pipeline.operation.d.ts +56 -0
- package/dist/operations/run-feature-pipeline.operation.d.ts.map +1 -0
- package/dist/operations/run-feature-pipeline.operation.js +94 -0
- package/dist/operations/run-feature-pipeline.operation.js.map +1 -0
- package/dist/operations/score-record-set.operation.d.ts +47 -0
- package/dist/operations/score-record-set.operation.d.ts.map +1 -0
- package/dist/operations/score-record-set.operation.js +113 -0
- package/dist/operations/score-record-set.operation.js.map +1 -0
- package/dist/operations/start-experiment-session.operation.d.ts +66 -0
- package/dist/operations/start-experiment-session.operation.d.ts.map +1 -0
- package/dist/operations/start-experiment-session.operation.js +132 -0
- package/dist/operations/start-experiment-session.operation.js.map +1 -0
- package/dist/operations/train-model.operation.d.ts +50 -0
- package/dist/operations/train-model.operation.d.ts.map +1 -0
- package/dist/operations/train-model.operation.js +114 -0
- package/dist/operations/train-model.operation.js.map +1 -0
- package/dist/scheduling/index.d.ts +13 -0
- package/dist/scheduling/index.d.ts.map +1 -0
- package/dist/scheduling/index.js +13 -0
- package/dist/scheduling/index.js.map +1 -0
- package/dist/scheduling/scheduled-model-scoring.d.ts +169 -0
- package/dist/scheduling/scheduled-model-scoring.d.ts.map +1 -0
- package/dist/scheduling/scheduled-model-scoring.js +189 -0
- package/dist/scheduling/scheduled-model-scoring.js.map +1 -0
- package/dist/scoring/artifact-loader.d.ts +65 -0
- package/dist/scoring/artifact-loader.d.ts.map +1 -0
- package/dist/scoring/artifact-loader.js +97 -0
- package/dist/scoring/artifact-loader.js.map +1 -0
- package/dist/scoring/index.d.ts +26 -0
- package/dist/scoring/index.d.ts.map +1 -0
- package/dist/scoring/index.js +26 -0
- package/dist/scoring/index.js.map +1 -0
- package/dist/scoring/ml-model-inference-processor.d.ts +154 -0
- package/dist/scoring/ml-model-inference-processor.d.ts.map +1 -0
- package/dist/scoring/ml-model-inference-processor.js +320 -0
- package/dist/scoring/ml-model-inference-processor.js.map +1 -0
- package/dist/scoring/ml-model-score-enricher.d.ts +80 -0
- package/dist/scoring/ml-model-score-enricher.d.ts.map +1 -0
- package/dist/scoring/ml-model-score-enricher.js +139 -0
- package/dist/scoring/ml-model-score-enricher.js.map +1 -0
- package/dist/scoring/register.d.ts +81 -0
- package/dist/scoring/register.d.ts.map +1 -0
- package/dist/scoring/register.js +105 -0
- package/dist/scoring/register.js.map +1 -0
- package/dist/scoring/scoring-binding.d.ts +72 -0
- package/dist/scoring/scoring-binding.d.ts.map +1 -0
- package/dist/scoring/scoring-binding.js +76 -0
- package/dist/scoring/scoring-binding.js.map +1 -0
- package/dist/scoring/scoring-process-shared.d.ts +105 -0
- package/dist/scoring/scoring-process-shared.d.ts.map +1 -0
- package/dist/scoring/scoring-process-shared.js +141 -0
- package/dist/scoring/scoring-process-shared.js.map +1 -0
- package/dist/scoring/scoring-process.d.ts +128 -0
- package/dist/scoring/scoring-process.d.ts.map +1 -0
- package/dist/scoring/scoring-process.js +146 -0
- package/dist/scoring/scoring-process.js.map +1 -0
- package/dist/scoring/seams.d.ts +40 -0
- package/dist/scoring/seams.d.ts.map +1 -0
- package/dist/scoring/seams.js +66 -0
- package/dist/scoring/seams.js.map +1 -0
- package/dist/scoring/startup-register.d.ts +49 -0
- package/dist/scoring/startup-register.d.ts.map +1 -0
- package/dist/scoring/startup-register.js +72 -0
- package/dist/scoring/startup-register.js.map +1 -0
- package/dist/scoring/types.d.ts +134 -0
- package/dist/scoring/types.d.ts.map +1 -0
- package/dist/scoring/types.js +26 -0
- package/dist/scoring/types.js.map +1 -0
- package/dist/training/artifact-store.d.ts +124 -0
- package/dist/training/artifact-store.d.ts.map +1 -0
- package/dist/training/artifact-store.js +163 -0
- package/dist/training/artifact-store.js.map +1 -0
- package/dist/training/index.d.ts +13 -0
- package/dist/training/index.d.ts.map +1 -0
- package/dist/training/index.js +13 -0
- package/dist/training/index.js.map +1 -0
- package/dist/training/seams.d.ts +57 -0
- package/dist/training/seams.d.ts.map +1 -0
- package/dist/training/seams.js +103 -0
- package/dist/training/seams.js.map +1 -0
- package/dist/training/training-engine.d.ts +96 -0
- package/dist/training/training-engine.d.ts.map +1 -0
- package/dist/training/training-engine.js +300 -0
- package/dist/training/training-engine.js.map +1 -0
- package/dist/training/types.d.ts +159 -0
- package/dist/training/types.d.ts.map +1 -0
- package/dist/training/types.js +16 -0
- package/dist/training/types.js.map +1 -0
- package/package.json +44 -7
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module operations/control-experiment-session.operation
|
|
3
|
+
*
|
|
4
|
+
* **Control Experiment Session** Remote Operation — the server body for the
|
|
5
|
+
* Manual-mode `PredictiveStudio.ControlExperimentSession` operation. A quick `Sync`
|
|
6
|
+
* lifecycle transition over an `MJ: Experiment Sessions` run: pause a running
|
|
7
|
+
* session, resume a paused one, or cancel.
|
|
8
|
+
*
|
|
9
|
+
* Analogous to the Record Process `Pause/Resume/Cancel` control surface (which sets
|
|
10
|
+
* a run's `CancellationRequested` flag): the orchestrator honors the session's
|
|
11
|
+
* `Status` at its next wave checkpoint, so controlling a session is a lifecycle-only
|
|
12
|
+
* `Status` write on the session row. This operation therefore loads the session and
|
|
13
|
+
* sets ONLY its `Status` — it never touches the plan, budget, or any iteration.
|
|
14
|
+
*
|
|
15
|
+
* Per CLAUDE.md, data access uses the per-execution `provider` + `user` (never
|
|
16
|
+
* `new Metadata()`), and the entity Save return is checked (Save returns `false`, it
|
|
17
|
+
* does not throw, on logical failure).
|
|
18
|
+
*/
|
|
19
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
20
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22
|
+
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;
|
|
23
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24
|
+
};
|
|
25
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
26
|
+
import { BaseRemotableOperation } from '@memberjunction/core';
|
|
27
|
+
import { PredictiveStudioControlExperimentSessionOperation, } from '@memberjunction/core-entities';
|
|
28
|
+
/** The session `Status` value each control action transitions the session to. */
|
|
29
|
+
const ACTION_TO_STATUS = {
|
|
30
|
+
pause: 'Paused',
|
|
31
|
+
resume: 'Running',
|
|
32
|
+
cancel: 'Cancelled',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Server implementation of `PredictiveStudio.ControlExperimentSession`. Extends the
|
|
36
|
+
* CodeGen-emitted {@link PredictiveStudioControlExperimentSessionOperation} base
|
|
37
|
+
* (`ExecutionMode='Sync'`, `RequiredScope='predictive:execute'`) and supplies only
|
|
38
|
+
* the body; registered last so it wins server-side dispatch.
|
|
39
|
+
*/
|
|
40
|
+
let PredictiveStudioControlExperimentSessionServerOperation = class PredictiveStudioControlExperimentSessionServerOperation extends PredictiveStudioControlExperimentSessionOperation {
|
|
41
|
+
/** @inheritdoc */
|
|
42
|
+
async InternalExecute(input, provider, user) {
|
|
43
|
+
if (!input?.sessionId) {
|
|
44
|
+
throw new Error('sessionId is required');
|
|
45
|
+
}
|
|
46
|
+
const targetStatus = ACTION_TO_STATUS[input.action];
|
|
47
|
+
if (!targetStatus) {
|
|
48
|
+
throw new Error(`action must be one of: pause, resume, cancel (got '${input.action}')`);
|
|
49
|
+
}
|
|
50
|
+
const session = await provider.GetEntityObject('MJ: Experiment Sessions', user);
|
|
51
|
+
const loaded = await session.Load(input.sessionId);
|
|
52
|
+
if (!loaded) {
|
|
53
|
+
throw new Error(`Experiment Session '${input.sessionId}' not found`);
|
|
54
|
+
}
|
|
55
|
+
session.Status = targetStatus;
|
|
56
|
+
const saved = await session.Save();
|
|
57
|
+
if (!saved) {
|
|
58
|
+
throw new Error(`Failed to ${input.action} Experiment Session '${input.sessionId}': ${session.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
59
|
+
}
|
|
60
|
+
return { status: session.Status };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
PredictiveStudioControlExperimentSessionServerOperation = __decorate([
|
|
64
|
+
RegisterClass(BaseRemotableOperation, 'PredictiveStudio.ControlExperimentSession')
|
|
65
|
+
], PredictiveStudioControlExperimentSessionServerOperation);
|
|
66
|
+
export { PredictiveStudioControlExperimentSessionServerOperation };
|
|
67
|
+
/** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
|
|
68
|
+
export function LoadPredictiveStudioControlExperimentSessionOperation() {
|
|
69
|
+
// intentionally empty
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=control-experiment-session.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-experiment-session.operation.js","sourceRoot":"","sources":["../../src/operations/control-experiment-session.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,iDAAiD,GAKlD,MAAM,+BAA+B,CAAC;AAEvC,iFAAiF;AACjF,MAAM,gBAAgB,GAAmG;IACvH,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF;;;;;GAKG;AAEI,IAAM,uDAAuD,GAA7D,MAAM,uDAAwD,SAAQ,iDAAiD;IAC5H,kBAAkB;IACR,KAAK,CAAC,eAAe,CAC7B,KAAoD,EACpD,QAA2B,EAC3B,IAAc;QAEd,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,sDAAsD,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;QAC1F,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,eAAe,CAA4B,yBAAyB,EAAE,IAAI,CAAC,CAAC;QAC3G,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,CAAC,SAAS,aAAa,CAAC,CAAC;QACvE,CAAC;QAED,OAAO,CAAC,MAAM,GAAG,YAAY,CAAC;QAC9B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CACb,aAAa,KAAK,CAAC,MAAM,wBAAwB,KAAK,CAAC,SAAS,MAAM,OAAO,CAAC,YAAY,EAAE,eAAe,IAAI,eAAe,EAAE,CACjI,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AA/BY,uDAAuD;IADnE,aAAa,CAAC,sBAAsB,EAAE,2CAA2C,CAAC;GACtE,uDAAuD,CA+BnE;;AAED,sFAAsF;AACtF,MAAM,UAAU,qDAAqD;IACnE,sBAAsB;AACxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module operations/create-scoring-process.operation
|
|
3
|
+
*
|
|
4
|
+
* **Create Scoring Process** Remote Operation — the server body for the Manual-mode
|
|
5
|
+
* `PredictiveStudio.CreateScoringProcess` operation. Creates a persisted, on-demand
|
|
6
|
+
* `WorkType='ML Model'` `MJ: Record Processes` row that scores a target entity's
|
|
7
|
+
* records with a trained model (no schedule). The created row is then run immediately
|
|
8
|
+
* via the generic "Run Record Process" operation, or attached to a recurring schedule
|
|
9
|
+
* via the generic `@memberjunction/ng-scheduling` dialog — so scheduling is NOT this
|
|
10
|
+
* operation's concern.
|
|
11
|
+
*
|
|
12
|
+
* Per CLAUDE.md "transport-layer architecture", this is a THIN adapter: it carries no
|
|
13
|
+
* scoring-process logic. The Record-Process + binding contract lives in
|
|
14
|
+
* {@link createScoringProcess} (shared with the scheduled helper via the
|
|
15
|
+
* `scoring-process-shared` primitives). Validation/save failures throw, so the
|
|
16
|
+
* framework wraps them as a clean `EXECUTION_ERROR` result preserving the message.
|
|
17
|
+
*/
|
|
18
|
+
import type { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
19
|
+
import { PredictiveStudioCreateScoringProcessOperation, type PredictiveStudioCreateScoringProcessInput, type PredictiveStudioCreateScoringProcessOutput } from '@memberjunction/core-entities';
|
|
20
|
+
/**
|
|
21
|
+
* Server implementation of `PredictiveStudio.CreateScoringProcess`. Extends the
|
|
22
|
+
* CodeGen-emitted {@link PredictiveStudioCreateScoringProcessOperation} base
|
|
23
|
+
* (`ExecutionMode='Sync'`, `RequiredScope='predictive:execute'`) and supplies only
|
|
24
|
+
* the body; registered last so it wins server-side dispatch.
|
|
25
|
+
*/
|
|
26
|
+
export declare class PredictiveStudioCreateScoringProcessServerOperation extends PredictiveStudioCreateScoringProcessOperation {
|
|
27
|
+
/** @inheritdoc */
|
|
28
|
+
protected InternalExecute(input: PredictiveStudioCreateScoringProcessInput, provider: IMetadataProvider, user: UserInfo): Promise<PredictiveStudioCreateScoringProcessOutput>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=create-scoring-process.operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-scoring-process.operation.d.ts","sourceRoot":"","sources":["../../src/operations/create-scoring-process.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EACL,6CAA6C,EAC7C,KAAK,yCAAyC,EAC9C,KAAK,0CAA0C,EAChD,MAAM,+BAA+B,CAAC;AAGvC;;;;;GAKG;AACH,qBACa,mDAAoD,SAAQ,6CAA6C;IACpH,kBAAkB;cACF,eAAe,CAC7B,KAAK,EAAE,yCAAyC,EAChD,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,0CAA0C,CAAC;CA0BvD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module operations/create-scoring-process.operation
|
|
3
|
+
*
|
|
4
|
+
* **Create Scoring Process** Remote Operation — the server body for the Manual-mode
|
|
5
|
+
* `PredictiveStudio.CreateScoringProcess` operation. Creates a persisted, on-demand
|
|
6
|
+
* `WorkType='ML Model'` `MJ: Record Processes` row that scores a target entity's
|
|
7
|
+
* records with a trained model (no schedule). The created row is then run immediately
|
|
8
|
+
* via the generic "Run Record Process" operation, or attached to a recurring schedule
|
|
9
|
+
* via the generic `@memberjunction/ng-scheduling` dialog — so scheduling is NOT this
|
|
10
|
+
* operation's concern.
|
|
11
|
+
*
|
|
12
|
+
* Per CLAUDE.md "transport-layer architecture", this is a THIN adapter: it carries no
|
|
13
|
+
* scoring-process logic. The Record-Process + binding contract lives in
|
|
14
|
+
* {@link createScoringProcess} (shared with the scheduled helper via the
|
|
15
|
+
* `scoring-process-shared` primitives). Validation/save failures throw, so the
|
|
16
|
+
* framework wraps them as a clean `EXECUTION_ERROR` result preserving the message.
|
|
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 { PredictiveStudioCreateScoringProcessOperation, } from '@memberjunction/core-entities';
|
|
27
|
+
import { createScoringProcess } from '../scoring/scoring-process.js';
|
|
28
|
+
/**
|
|
29
|
+
* Server implementation of `PredictiveStudio.CreateScoringProcess`. Extends the
|
|
30
|
+
* CodeGen-emitted {@link PredictiveStudioCreateScoringProcessOperation} base
|
|
31
|
+
* (`ExecutionMode='Sync'`, `RequiredScope='predictive:execute'`) and supplies only
|
|
32
|
+
* the body; registered last so it wins server-side dispatch.
|
|
33
|
+
*/
|
|
34
|
+
let PredictiveStudioCreateScoringProcessServerOperation = class PredictiveStudioCreateScoringProcessServerOperation extends PredictiveStudioCreateScoringProcessOperation {
|
|
35
|
+
/** @inheritdoc */
|
|
36
|
+
async InternalExecute(input, provider, user) {
|
|
37
|
+
if (!input?.modelId) {
|
|
38
|
+
throw new Error('modelId is required');
|
|
39
|
+
}
|
|
40
|
+
if (!input.targetEntityName) {
|
|
41
|
+
throw new Error('targetEntityName is required');
|
|
42
|
+
}
|
|
43
|
+
const result = await createScoringProcess({
|
|
44
|
+
modelId: input.modelId,
|
|
45
|
+
targetEntityName: input.targetEntityName,
|
|
46
|
+
scope: input.scope,
|
|
47
|
+
outputField: input.outputField,
|
|
48
|
+
valueKind: input.valueKind,
|
|
49
|
+
primaryKeyField: input.primaryKeyField,
|
|
50
|
+
name: input.name,
|
|
51
|
+
contextUser: user,
|
|
52
|
+
provider,
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
recordProcessId: result.recordProcess.ID,
|
|
56
|
+
wroteColumn: result.binding !== null,
|
|
57
|
+
scoringBindingId: result.binding?.ID,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
PredictiveStudioCreateScoringProcessServerOperation = __decorate([
|
|
62
|
+
RegisterClass(BaseRemotableOperation, 'PredictiveStudio.CreateScoringProcess')
|
|
63
|
+
], PredictiveStudioCreateScoringProcessServerOperation);
|
|
64
|
+
export { PredictiveStudioCreateScoringProcessServerOperation };
|
|
65
|
+
//# sourceMappingURL=create-scoring-process.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-scoring-process.operation.js","sourceRoot":"","sources":["../../src/operations/create-scoring-process.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,6CAA6C,GAG9C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;;GAKG;AAEI,IAAM,mDAAmD,GAAzD,MAAM,mDAAoD,SAAQ,6CAA6C;IACpH,kBAAkB;IACR,KAAK,CAAC,eAAe,CAC7B,KAAgD,EAChD,QAA2B,EAC3B,IAAc;QAEd,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC;YACxC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,WAAW,EAAE,IAAI;YACjB,QAAQ;SACT,CAAC,CAAC;QAEH,OAAO;YACL,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,EAAE;YACxC,WAAW,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI;YACpC,gBAAgB,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE;SACrC,CAAC;IACJ,CAAC;CACF,CAAA;AAhCY,mDAAmD;IAD/D,aAAa,CAAC,sBAAsB,EAAE,uCAAuC,CAAC;GAClE,mDAAmD,CAgC/D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module operations/delegation
|
|
3
|
+
*
|
|
4
|
+
* Shared **engine-delegation helpers** for the Predictive Studio Remote Operations.
|
|
5
|
+
*
|
|
6
|
+
* The six Manual-mode Remote Operations and the four Predictive Studio Actions are
|
|
7
|
+
* two thin invocation surfaces over the SAME engine service classes
|
|
8
|
+
* (`TrainingEngine`, `ProductionScoreRecordSetRunner`, `ExperimentOrchestrator` via
|
|
9
|
+
* `buildProductionExperimentDeps`, `ProductionModelPromotionGate`). Per CLAUDE.md
|
|
10
|
+
* "push improvements to the generic level" and DRY, the production wiring each path
|
|
11
|
+
* needs lives here exactly ONCE, so the Remote Ops and Actions share one delegation
|
|
12
|
+
* path rather than duplicating the deps/seam construction.
|
|
13
|
+
*
|
|
14
|
+
* Each helper takes the already-validated typed input plus the per-execution
|
|
15
|
+
* `provider` + `user` (the ambient Remote Op contract) and returns the engine's
|
|
16
|
+
* native result; the calling operation maps that onto its CodeGen-emitted Output.
|
|
17
|
+
* Keeping the helpers free of any Remote-Op / Action specifics is what lets both
|
|
18
|
+
* surfaces reuse them.
|
|
19
|
+
*/
|
|
20
|
+
import type { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
21
|
+
import { TrainingEngine } from '../training/training-engine.js';
|
|
22
|
+
import type { TrainModelInput, TrainModelResult, TrainingDeps } from '../training/types.js';
|
|
23
|
+
import { ExperimentOrchestrator } from '../experiment/experiment-orchestrator.js';
|
|
24
|
+
import type { ExperimentRunOptions, ExperimentSessionResult } from '../experiment/types.js';
|
|
25
|
+
import { ProductionScoreRecordSetRunner } from '../actions/score-record-set.runner.js';
|
|
26
|
+
import type { MLInferenceDeps } from '../scoring/types.js';
|
|
27
|
+
import type { IScoreRecordSetRunner, ScoreRecordSetRequest, ScoreRecordSetResult } from '../actions/score-record-set.action.js';
|
|
28
|
+
import type { IModelPromotionGate, PromoteModelRequest, PromoteModelOutcome } from '../actions/promote-model.action.js';
|
|
29
|
+
import type { ModelingPlanSpec, Budget } from '@memberjunction/predictive-studio-core';
|
|
30
|
+
/**
|
|
31
|
+
* Build the {@link TrainingEngine}'s production dependency bundle from a per-call
|
|
32
|
+
* `provider` + `user`. Resolves the active File Storage Provider once and chooses
|
|
33
|
+
* the artifact-store family accordingly (MJ-Files when a provider is active, local
|
|
34
|
+
* disk when none is — see {@link resolveActiveFileStorageProviderId}). Async so the
|
|
35
|
+
* provider lookup is part of the wiring; the scoring side keys off the SAME
|
|
36
|
+
* decision (the composite loader routes by whether the artifact exists on local
|
|
37
|
+
* disk) so a model never gets trained to one family and scored from another.
|
|
38
|
+
*
|
|
39
|
+
* @param provider the owning provider for data access / multi-provider correctness
|
|
40
|
+
* @param user the acting user threaded through every entity op for isolation/audit
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildTrainingDeps(provider: IMetadataProvider, user: UserInfo): Promise<TrainingDeps>;
|
|
43
|
+
/**
|
|
44
|
+
* Train a model by pipeline id, delegating to {@link TrainingEngine.trainModel}
|
|
45
|
+
* with production deps. The `engine` is injectable so unit tests substitute a mock
|
|
46
|
+
* with no live DB / sidecar (mirroring the Action's `createEngine` seam).
|
|
47
|
+
*
|
|
48
|
+
* @param input the typed training input (pipeline id + optional overrides)
|
|
49
|
+
* @param provider the owning provider
|
|
50
|
+
* @param user the acting user
|
|
51
|
+
* @param engine optional engine override (defaults to a fresh {@link TrainingEngine})
|
|
52
|
+
*/
|
|
53
|
+
export declare function trainModelViaEngine(input: TrainModelInput, provider: IMetadataProvider, user: UserInfo, engine?: TrainingEngine): Promise<TrainModelResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Whether a training run was leakage-flagged. The engine keeps a flagged model in
|
|
56
|
+
* `Draft` and records a plain-language `LEAKAGE WARNING` in the run's `Notes`
|
|
57
|
+
* (§6.4); this reads that single source of truth so the Remote Op and Action agree.
|
|
58
|
+
*/
|
|
59
|
+
export declare function wasTrainingLeakageFlagged(result: TrainModelResult): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The production {@link MLInferenceDeps} bundle the scorer runs with — the
|
|
62
|
+
* {@link RunViewMLModelLoader} (loads the `MJ: ML Models` row), the
|
|
63
|
+
* {@link MJSidecarPredictor} (runs `/predict` against the Python sidecar) and the
|
|
64
|
+
* {@link LocalArtifactLoader} (reads the model bytes back by their `MJ: Files` row id,
|
|
65
|
+
* the read-side inverse of `MJFilesArtifactStore`). Shared by {@link buildScoreRecordSetRunner}
|
|
66
|
+
* (the Score action / Remote Op path) AND the startup work-type registration so a model
|
|
67
|
+
* trained one way is always scored the same way — one source of truth (CLAUDE.md DRY).
|
|
68
|
+
*
|
|
69
|
+
* **Production follow-up**: swap `LocalArtifactLoader` for a provider `GetObject`
|
|
70
|
+
* loader; the id contract (read by File id) is unchanged.
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildProductionMLInferenceDeps(): MLInferenceDeps;
|
|
73
|
+
/**
|
|
74
|
+
* Build the production scoring runner wired with the production {@link MLInferenceDeps}
|
|
75
|
+
* (see {@link buildProductionMLInferenceDeps}). No provider lookup is needed at score
|
|
76
|
+
* time — the File id IS the artifact key.
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildScoreRecordSetRunner(): ProductionScoreRecordSetRunner;
|
|
79
|
+
/**
|
|
80
|
+
* Score a record set, delegating to the SAME production runner the Score action
|
|
81
|
+
* uses ({@link ProductionScoreRecordSetRunner} → `MLModelInferenceProcessor`). The
|
|
82
|
+
* default runner is wired with the {@link LocalArtifactLoader} so the artifact is
|
|
83
|
+
* read back by its `MJ: Files` row id. The `runner` is injectable for tests.
|
|
84
|
+
*
|
|
85
|
+
* @param request the model id + resolved scope + write-back directive + user/provider
|
|
86
|
+
* @param runner optional runner override (defaults to {@link buildScoreRecordSetRunner})
|
|
87
|
+
*/
|
|
88
|
+
export declare function scoreRecordSetViaRunner(request: ScoreRecordSetRequest, runner?: IScoreRecordSetRunner): Promise<ScoreRecordSetResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Start (run) an experiment session, delegating to
|
|
91
|
+
* {@link ExperimentOrchestrator.runSession} with the SAME production deps the
|
|
92
|
+
* Run-Experiment action builds ({@link buildProductionExperimentDeps}). The
|
|
93
|
+
* `orchestrator` is injectable for tests.
|
|
94
|
+
*
|
|
95
|
+
* @param plan the approved modeling plan to execute
|
|
96
|
+
* @param options run tunables (experiment id to attach to, budget override, session name)
|
|
97
|
+
* @param provider the owning provider
|
|
98
|
+
* @param user the acting user
|
|
99
|
+
* @param orchestrator optional orchestrator override (defaults to {@link ExperimentOrchestrator})
|
|
100
|
+
*/
|
|
101
|
+
export declare function runExperimentSessionViaOrchestrator(plan: ModelingPlanSpec, options: ExperimentRunOptions, provider: IMetadataProvider, user: UserInfo, orchestrator?: ExperimentOrchestrator): Promise<ExperimentSessionResult>;
|
|
102
|
+
/**
|
|
103
|
+
* Transition a model's lifecycle status, delegating to the SAME production gate the
|
|
104
|
+
* Promote action uses ({@link ProductionModelPromotionGate}). The `gate` is
|
|
105
|
+
* injectable for tests.
|
|
106
|
+
*
|
|
107
|
+
* @param request the model id + target status + sign-off + user/provider
|
|
108
|
+
* @param gate optional gate override (defaults to {@link ProductionModelPromotionGate})
|
|
109
|
+
*/
|
|
110
|
+
export declare function promoteModelViaGate(request: PromoteModelRequest, gate?: IModelPromotionGate): Promise<PromoteModelOutcome>;
|
|
111
|
+
/** Re-export the orchestrator budget type for the operations that map it. */
|
|
112
|
+
export type { Budget };
|
|
113
|
+
//# sourceMappingURL=delegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../src/operations/delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AAGpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EACV,gBAAgB,EAChB,MAAM,EACP,MAAM,wCAAwC,CAAC;AAIhD;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAW1G;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,EACd,MAAM,GAAE,cAAqC,GAC5C,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAE3E;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,IAAI,eAAe,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,8BAA8B,CAE1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,qBAAqB,EAC9B,MAAM,GAAE,qBAAmD,GAC1D,OAAO,CAAC,oBAAoB,CAAC,CAE/B;AAID;;;;;;;;;;;GAWG;AACH,wBAAsB,mCAAmC,CACvD,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,EACd,YAAY,GAAE,sBAAqD,GAClE,OAAO,CAAC,uBAAuB,CAAC,CAElC;AAID;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,mBAAmB,EAC5B,IAAI,GAAE,mBAAwD,GAC7D,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED,6EAA6E;AAC7E,YAAY,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module operations/delegation
|
|
3
|
+
*
|
|
4
|
+
* Shared **engine-delegation helpers** for the Predictive Studio Remote Operations.
|
|
5
|
+
*
|
|
6
|
+
* The six Manual-mode Remote Operations and the four Predictive Studio Actions are
|
|
7
|
+
* two thin invocation surfaces over the SAME engine service classes
|
|
8
|
+
* (`TrainingEngine`, `ProductionScoreRecordSetRunner`, `ExperimentOrchestrator` via
|
|
9
|
+
* `buildProductionExperimentDeps`, `ProductionModelPromotionGate`). Per CLAUDE.md
|
|
10
|
+
* "push improvements to the generic level" and DRY, the production wiring each path
|
|
11
|
+
* needs lives here exactly ONCE, so the Remote Ops and Actions share one delegation
|
|
12
|
+
* path rather than duplicating the deps/seam construction.
|
|
13
|
+
*
|
|
14
|
+
* Each helper takes the already-validated typed input plus the per-execution
|
|
15
|
+
* `provider` + `user` (the ambient Remote Op contract) and returns the engine's
|
|
16
|
+
* native result; the calling operation maps that onto its CodeGen-emitted Output.
|
|
17
|
+
* Keeping the helpers free of any Remote-Op / Action specifics is what lets both
|
|
18
|
+
* surfaces reuse them.
|
|
19
|
+
*/
|
|
20
|
+
import { TrainingEngine } from '../training/training-engine.js';
|
|
21
|
+
import { MetadataEntityFactory, RunViewRecordLoader, MJSidecarTrainer } from '../training/seams.js';
|
|
22
|
+
import { resolveActiveFileStorageProviderId, buildArtifactStore } from '../training/artifact-store.js';
|
|
23
|
+
import { ExperimentOrchestrator } from '../experiment/experiment-orchestrator.js';
|
|
24
|
+
import { buildProductionExperimentDeps } from '../actions/run-experiment.deps.js';
|
|
25
|
+
import { ProductionScoreRecordSetRunner } from '../actions/score-record-set.runner.js';
|
|
26
|
+
import { RunViewMLModelLoader, MJSidecarPredictor } from '../scoring/seams.js';
|
|
27
|
+
import { LocalArtifactLoader } from '../scoring/artifact-loader.js';
|
|
28
|
+
import { ProductionModelPromotionGate } from '../actions/promote-model.gate.js';
|
|
29
|
+
// ----- Training ---------------------------------------------------------------
|
|
30
|
+
/**
|
|
31
|
+
* Build the {@link TrainingEngine}'s production dependency bundle from a per-call
|
|
32
|
+
* `provider` + `user`. Resolves the active File Storage Provider once and chooses
|
|
33
|
+
* the artifact-store family accordingly (MJ-Files when a provider is active, local
|
|
34
|
+
* disk when none is — see {@link resolveActiveFileStorageProviderId}). Async so the
|
|
35
|
+
* provider lookup is part of the wiring; the scoring side keys off the SAME
|
|
36
|
+
* decision (the composite loader routes by whether the artifact exists on local
|
|
37
|
+
* disk) so a model never gets trained to one family and scored from another.
|
|
38
|
+
*
|
|
39
|
+
* @param provider the owning provider for data access / multi-provider correctness
|
|
40
|
+
* @param user the acting user threaded through every entity op for isolation/audit
|
|
41
|
+
*/
|
|
42
|
+
export async function buildTrainingDeps(provider, user) {
|
|
43
|
+
const entityFactory = new MetadataEntityFactory(provider);
|
|
44
|
+
const providerId = await resolveActiveFileStorageProviderId(user, provider);
|
|
45
|
+
return {
|
|
46
|
+
entityFactory,
|
|
47
|
+
recordLoader: new RunViewRecordLoader(),
|
|
48
|
+
sidecar: new MJSidecarTrainer(),
|
|
49
|
+
artifactStore: buildArtifactStore(providerId, entityFactory),
|
|
50
|
+
contextUser: user,
|
|
51
|
+
provider,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Train a model by pipeline id, delegating to {@link TrainingEngine.trainModel}
|
|
56
|
+
* with production deps. The `engine` is injectable so unit tests substitute a mock
|
|
57
|
+
* with no live DB / sidecar (mirroring the Action's `createEngine` seam).
|
|
58
|
+
*
|
|
59
|
+
* @param input the typed training input (pipeline id + optional overrides)
|
|
60
|
+
* @param provider the owning provider
|
|
61
|
+
* @param user the acting user
|
|
62
|
+
* @param engine optional engine override (defaults to a fresh {@link TrainingEngine})
|
|
63
|
+
*/
|
|
64
|
+
export async function trainModelViaEngine(input, provider, user, engine = new TrainingEngine()) {
|
|
65
|
+
return engine.trainModel(input, await buildTrainingDeps(provider, user));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Whether a training run was leakage-flagged. The engine keeps a flagged model in
|
|
69
|
+
* `Draft` and records a plain-language `LEAKAGE WARNING` in the run's `Notes`
|
|
70
|
+
* (§6.4); this reads that single source of truth so the Remote Op and Action agree.
|
|
71
|
+
*/
|
|
72
|
+
export function wasTrainingLeakageFlagged(result) {
|
|
73
|
+
return (result.run.Notes ?? '').includes('LEAKAGE WARNING');
|
|
74
|
+
}
|
|
75
|
+
// ----- Scoring ----------------------------------------------------------------
|
|
76
|
+
/**
|
|
77
|
+
* The production {@link MLInferenceDeps} bundle the scorer runs with — the
|
|
78
|
+
* {@link RunViewMLModelLoader} (loads the `MJ: ML Models` row), the
|
|
79
|
+
* {@link MJSidecarPredictor} (runs `/predict` against the Python sidecar) and the
|
|
80
|
+
* {@link LocalArtifactLoader} (reads the model bytes back by their `MJ: Files` row id,
|
|
81
|
+
* the read-side inverse of `MJFilesArtifactStore`). Shared by {@link buildScoreRecordSetRunner}
|
|
82
|
+
* (the Score action / Remote Op path) AND the startup work-type registration so a model
|
|
83
|
+
* trained one way is always scored the same way — one source of truth (CLAUDE.md DRY).
|
|
84
|
+
*
|
|
85
|
+
* **Production follow-up**: swap `LocalArtifactLoader` for a provider `GetObject`
|
|
86
|
+
* loader; the id contract (read by File id) is unchanged.
|
|
87
|
+
*/
|
|
88
|
+
export function buildProductionMLInferenceDeps() {
|
|
89
|
+
return { modelLoader: new RunViewMLModelLoader(), sidecar: new MJSidecarPredictor(), artifactLoader: new LocalArtifactLoader() };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Build the production scoring runner wired with the production {@link MLInferenceDeps}
|
|
93
|
+
* (see {@link buildProductionMLInferenceDeps}). No provider lookup is needed at score
|
|
94
|
+
* time — the File id IS the artifact key.
|
|
95
|
+
*/
|
|
96
|
+
export function buildScoreRecordSetRunner() {
|
|
97
|
+
return new ProductionScoreRecordSetRunner({ deps: buildProductionMLInferenceDeps() });
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Score a record set, delegating to the SAME production runner the Score action
|
|
101
|
+
* uses ({@link ProductionScoreRecordSetRunner} → `MLModelInferenceProcessor`). The
|
|
102
|
+
* default runner is wired with the {@link LocalArtifactLoader} so the artifact is
|
|
103
|
+
* read back by its `MJ: Files` row id. The `runner` is injectable for tests.
|
|
104
|
+
*
|
|
105
|
+
* @param request the model id + resolved scope + write-back directive + user/provider
|
|
106
|
+
* @param runner optional runner override (defaults to {@link buildScoreRecordSetRunner})
|
|
107
|
+
*/
|
|
108
|
+
export function scoreRecordSetViaRunner(request, runner = buildScoreRecordSetRunner()) {
|
|
109
|
+
return runner.run(request);
|
|
110
|
+
}
|
|
111
|
+
// ----- Experiment -------------------------------------------------------------
|
|
112
|
+
/**
|
|
113
|
+
* Start (run) an experiment session, delegating to
|
|
114
|
+
* {@link ExperimentOrchestrator.runSession} with the SAME production deps the
|
|
115
|
+
* Run-Experiment action builds ({@link buildProductionExperimentDeps}). The
|
|
116
|
+
* `orchestrator` is injectable for tests.
|
|
117
|
+
*
|
|
118
|
+
* @param plan the approved modeling plan to execute
|
|
119
|
+
* @param options run tunables (experiment id to attach to, budget override, session name)
|
|
120
|
+
* @param provider the owning provider
|
|
121
|
+
* @param user the acting user
|
|
122
|
+
* @param orchestrator optional orchestrator override (defaults to {@link ExperimentOrchestrator})
|
|
123
|
+
*/
|
|
124
|
+
export async function runExperimentSessionViaOrchestrator(plan, options, provider, user, orchestrator = new ExperimentOrchestrator()) {
|
|
125
|
+
return orchestrator.runSession(plan, await buildProductionExperimentDeps(user, provider), options);
|
|
126
|
+
}
|
|
127
|
+
// ----- Promotion --------------------------------------------------------------
|
|
128
|
+
/**
|
|
129
|
+
* Transition a model's lifecycle status, delegating to the SAME production gate the
|
|
130
|
+
* Promote action uses ({@link ProductionModelPromotionGate}). The `gate` is
|
|
131
|
+
* injectable for tests.
|
|
132
|
+
*
|
|
133
|
+
* @param request the model id + target status + sign-off + user/provider
|
|
134
|
+
* @param gate optional gate override (defaults to {@link ProductionModelPromotionGate})
|
|
135
|
+
*/
|
|
136
|
+
export function promoteModelViaGate(request, gate = new ProductionModelPromotionGate()) {
|
|
137
|
+
return gate.promote(request);
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=delegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../src/operations/delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,kCAAkC,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAQjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAY7E,iFAAiF;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAA2B,EAAE,IAAc;IACjF,MAAM,aAAa,GAAG,IAAI,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,MAAM,kCAAkC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5E,OAAO;QACL,aAAa;QACb,YAAY,EAAE,IAAI,mBAAmB,EAAE;QACvC,OAAO,EAAE,IAAI,gBAAgB,EAAE;QAC/B,aAAa,EAAE,kBAAkB,CAAC,UAAU,EAAE,aAAa,CAAC;QAC5D,WAAW,EAAE,IAAI;QACjB,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAAsB,EACtB,QAA2B,EAC3B,IAAc,EACd,SAAyB,IAAI,cAAc,EAAE;IAE7C,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAwB;IAChE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAC9D,CAAC;AAED,iFAAiF;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,oBAAoB,EAAE,EAAE,OAAO,EAAE,IAAI,kBAAkB,EAAE,EAAE,cAAc,EAAE,IAAI,mBAAmB,EAAE,EAAE,CAAC;AACnI,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,8BAA8B,CAAC,EAAE,IAAI,EAAE,8BAA8B,EAAE,EAAE,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAA8B,EAC9B,SAAgC,yBAAyB,EAAE;IAE3D,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,iFAAiF;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,IAAsB,EACtB,OAA6B,EAC7B,QAA2B,EAC3B,IAAc,EACd,eAAuC,IAAI,sBAAsB,EAAE;IAEnE,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,6BAA6B,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AACrG,CAAC;AAED,iFAAiF;AAEjF;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA4B,EAC5B,OAA4B,IAAI,4BAA4B,EAAE;IAE9D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module operations
|
|
3
|
+
*
|
|
4
|
+
* Barrel for the **Predictive Studio Remote Operations** — the seven Manual-mode
|
|
5
|
+
* server bodies for the CodeGen-emitted `PredictiveStudio.*` operation bases
|
|
6
|
+
* (`@memberjunction/core-entities` → `generated/remote_operations.ts`).
|
|
7
|
+
*
|
|
8
|
+
* Each operation is the typed peer of the corresponding Predictive Studio Action:
|
|
9
|
+
* an agent / UI / workflow invokes the operation by stable key, the framework
|
|
10
|
+
* applies the scope / permission gates, and the subclass maps the typed input →
|
|
11
|
+
* engine delegation → the typed output. The production wiring is SHARED with the
|
|
12
|
+
* Actions (`./delegation`), so the two invocation surfaces train / score /
|
|
13
|
+
* experiment / promote through one path.
|
|
14
|
+
*
|
|
15
|
+
* Operation keys → server subclass:
|
|
16
|
+
* - `PredictiveStudio.TrainModel` → {@link PredictiveStudioTrainModelServerOperation}
|
|
17
|
+
* - `PredictiveStudio.ScoreRecordSet` → {@link PredictiveStudioScoreRecordSetServerOperation}
|
|
18
|
+
* - `PredictiveStudio.RunFeaturePipeline` → {@link PredictiveStudioRunFeaturePipelineServerOperation}
|
|
19
|
+
* - `PredictiveStudio.StartExperimentSession` → {@link PredictiveStudioStartExperimentSessionServerOperation}
|
|
20
|
+
* - `PredictiveStudio.ControlExperimentSession`→ {@link PredictiveStudioControlExperimentSessionServerOperation}
|
|
21
|
+
* - `PredictiveStudio.PromoteModel` → {@link PredictiveStudioPromoteModelServerOperation}
|
|
22
|
+
* - `PredictiveStudio.CreateScoringProcess` → {@link PredictiveStudioCreateScoringProcessServerOperation}
|
|
23
|
+
*/
|
|
24
|
+
export * from './delegation.js';
|
|
25
|
+
export * from './train-model.operation.js';
|
|
26
|
+
export * from './score-record-set.operation.js';
|
|
27
|
+
export * from './run-feature-pipeline.operation.js';
|
|
28
|
+
export * from './start-experiment-session.operation.js';
|
|
29
|
+
export * from './control-experiment-session.operation.js';
|
|
30
|
+
export * from './promote-model.operation.js';
|
|
31
|
+
export * from './create-scoring-process.operation.js';
|
|
32
|
+
/**
|
|
33
|
+
* Tree-shaking anchor — call from a server bootstrap to guarantee the seven
|
|
34
|
+
* `@RegisterClass(BaseRemotableOperation, 'PredictiveStudio.*')` registrations are
|
|
35
|
+
* not eliminated by the bundler. Referencing the classes through this function
|
|
36
|
+
* creates a static code path the bundler keeps (mirrors `LoadPredictiveStudioActions`
|
|
37
|
+
* and `LoadRecordProcessControlOperations`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function LoadPredictiveStudioOperations(): void;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AAUnD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAQrD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module operations
|
|
3
|
+
*
|
|
4
|
+
* Barrel for the **Predictive Studio Remote Operations** — the seven Manual-mode
|
|
5
|
+
* server bodies for the CodeGen-emitted `PredictiveStudio.*` operation bases
|
|
6
|
+
* (`@memberjunction/core-entities` → `generated/remote_operations.ts`).
|
|
7
|
+
*
|
|
8
|
+
* Each operation is the typed peer of the corresponding Predictive Studio Action:
|
|
9
|
+
* an agent / UI / workflow invokes the operation by stable key, the framework
|
|
10
|
+
* applies the scope / permission gates, and the subclass maps the typed input →
|
|
11
|
+
* engine delegation → the typed output. The production wiring is SHARED with the
|
|
12
|
+
* Actions (`./delegation`), so the two invocation surfaces train / score /
|
|
13
|
+
* experiment / promote through one path.
|
|
14
|
+
*
|
|
15
|
+
* Operation keys → server subclass:
|
|
16
|
+
* - `PredictiveStudio.TrainModel` → {@link PredictiveStudioTrainModelServerOperation}
|
|
17
|
+
* - `PredictiveStudio.ScoreRecordSet` → {@link PredictiveStudioScoreRecordSetServerOperation}
|
|
18
|
+
* - `PredictiveStudio.RunFeaturePipeline` → {@link PredictiveStudioRunFeaturePipelineServerOperation}
|
|
19
|
+
* - `PredictiveStudio.StartExperimentSession` → {@link PredictiveStudioStartExperimentSessionServerOperation}
|
|
20
|
+
* - `PredictiveStudio.ControlExperimentSession`→ {@link PredictiveStudioControlExperimentSessionServerOperation}
|
|
21
|
+
* - `PredictiveStudio.PromoteModel` → {@link PredictiveStudioPromoteModelServerOperation}
|
|
22
|
+
* - `PredictiveStudio.CreateScoringProcess` → {@link PredictiveStudioCreateScoringProcessServerOperation}
|
|
23
|
+
*/
|
|
24
|
+
export * from './delegation.js';
|
|
25
|
+
export * from './train-model.operation.js';
|
|
26
|
+
export * from './score-record-set.operation.js';
|
|
27
|
+
export * from './run-feature-pipeline.operation.js';
|
|
28
|
+
export * from './start-experiment-session.operation.js';
|
|
29
|
+
export * from './control-experiment-session.operation.js';
|
|
30
|
+
export * from './promote-model.operation.js';
|
|
31
|
+
export * from './create-scoring-process.operation.js';
|
|
32
|
+
import { PredictiveStudioTrainModelServerOperation } from './train-model.operation.js';
|
|
33
|
+
import { PredictiveStudioScoreRecordSetServerOperation } from './score-record-set.operation.js';
|
|
34
|
+
import { PredictiveStudioRunFeaturePipelineServerOperation } from './run-feature-pipeline.operation.js';
|
|
35
|
+
import { PredictiveStudioStartExperimentSessionServerOperation } from './start-experiment-session.operation.js';
|
|
36
|
+
import { PredictiveStudioControlExperimentSessionServerOperation } from './control-experiment-session.operation.js';
|
|
37
|
+
import { PredictiveStudioPromoteModelServerOperation } from './promote-model.operation.js';
|
|
38
|
+
import { PredictiveStudioCreateScoringProcessServerOperation } from './create-scoring-process.operation.js';
|
|
39
|
+
/**
|
|
40
|
+
* Tree-shaking anchor — call from a server bootstrap to guarantee the seven
|
|
41
|
+
* `@RegisterClass(BaseRemotableOperation, 'PredictiveStudio.*')` registrations are
|
|
42
|
+
* not eliminated by the bundler. Referencing the classes through this function
|
|
43
|
+
* creates a static code path the bundler keeps (mirrors `LoadPredictiveStudioActions`
|
|
44
|
+
* and `LoadRecordProcessControlOperations`).
|
|
45
|
+
*/
|
|
46
|
+
export function LoadPredictiveStudioOperations() {
|
|
47
|
+
void PredictiveStudioTrainModelServerOperation;
|
|
48
|
+
void PredictiveStudioScoreRecordSetServerOperation;
|
|
49
|
+
void PredictiveStudioRunFeaturePipelineServerOperation;
|
|
50
|
+
void PredictiveStudioStartExperimentSessionServerOperation;
|
|
51
|
+
void PredictiveStudioControlExperimentSessionServerOperation;
|
|
52
|
+
void PredictiveStudioPromoteModelServerOperation;
|
|
53
|
+
void PredictiveStudioCreateScoringProcessServerOperation;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AAEnD,OAAO,EAAE,yCAAyC,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,6CAA6C,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,iDAAiD,EAAE,MAAM,kCAAkC,CAAC;AACrG,OAAO,EAAE,qDAAqD,EAAE,MAAM,sCAAsC,CAAC;AAC7G,OAAO,EAAE,uDAAuD,EAAE,MAAM,wCAAwC,CAAC;AACjH,OAAO,EAAE,2CAA2C,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,mDAAmD,EAAE,MAAM,oCAAoC,CAAC;AAEzG;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B;IAC5C,KAAK,yCAAyC,CAAC;IAC/C,KAAK,6CAA6C,CAAC;IACnD,KAAK,iDAAiD,CAAC;IACvD,KAAK,qDAAqD,CAAC;IAC3D,KAAK,uDAAuD,CAAC;IAC7D,KAAK,2CAA2C,CAAC;IACjD,KAAK,mDAAmD,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
import type { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
22
|
+
import { PredictiveStudioPromoteModelOperation, type PredictiveStudioPromoteModelInput, type PredictiveStudioPromoteModelOutput } from '@memberjunction/core-entities';
|
|
23
|
+
import type { IModelPromotionGate, PromoteModelOutcome } from '../actions/promote-model.action.js';
|
|
24
|
+
/**
|
|
25
|
+
* Server implementation of `PredictiveStudio.PromoteModel`. Extends the
|
|
26
|
+
* CodeGen-emitted {@link PredictiveStudioPromoteModelOperation} base
|
|
27
|
+
* (`ExecutionMode='Sync'`, `RequiredScope='predictive:execute'`) and supplies only
|
|
28
|
+
* the body; registered last so it wins server-side dispatch.
|
|
29
|
+
*/
|
|
30
|
+
export declare class PredictiveStudioPromoteModelServerOperation extends PredictiveStudioPromoteModelOperation {
|
|
31
|
+
/** @inheritdoc */
|
|
32
|
+
protected InternalExecute(input: PredictiveStudioPromoteModelInput, provider: IMetadataProvider, user: UserInfo): Promise<PredictiveStudioPromoteModelOutput>;
|
|
33
|
+
/**
|
|
34
|
+
* Map the gate outcome onto the operation's typed output. The single happy path
|
|
35
|
+
* (`promoted`) returns `{ promoted: true, status: newStatus }`; every refusal /
|
|
36
|
+
* failure throws with the plain-language detail so the framework surfaces it as a
|
|
37
|
+
* clean error (rather than silently returning `promoted: false`).
|
|
38
|
+
*/
|
|
39
|
+
protected toOutput(input: PredictiveStudioPromoteModelInput, outcome: PromoteModelOutcome): PredictiveStudioPromoteModelOutput;
|
|
40
|
+
/** Plain-language refusal message for a leakage-flagged model (mirrors the Action). */
|
|
41
|
+
protected leakageRefusalMessage(modelId: string, outcome: Extract<PromoteModelOutcome, {
|
|
42
|
+
kind: 'refused-leakage';
|
|
43
|
+
}>): string;
|
|
44
|
+
/** Message when a sign-off override was requested without a justification reason. */
|
|
45
|
+
protected signOffReasonRequiredMessage(modelId: string, outcome: Extract<PromoteModelOutcome, {
|
|
46
|
+
kind: 'signoff-reason-required';
|
|
47
|
+
}>): string;
|
|
48
|
+
/**
|
|
49
|
+
* The promotion gate to delegate to. Overridable so unit tests inject a mock with
|
|
50
|
+
* no live DB. The production default ({@link ProductionModelPromotionGate}) is the
|
|
51
|
+
* SAME gate the Promote action uses.
|
|
52
|
+
*/
|
|
53
|
+
protected gate(): IModelPromotionGate;
|
|
54
|
+
}
|
|
55
|
+
/** Tree-shaking anchor — call from a server bootstrap to retain this registration. */
|
|
56
|
+
export declare function LoadPredictiveStudioPromoteModelOperation(): void;
|
|
57
|
+
//# sourceMappingURL=promote-model.operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promote-model.operation.d.ts","sourceRoot":"","sources":["../../src/operations/promote-model.operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EACL,qCAAqC,EACrC,KAAK,iCAAiC,EACtC,KAAK,kCAAkC,EACxC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAIzC;;;;;GAKG;AACH,qBACa,2CAA4C,SAAQ,qCAAqC;IACpG,kBAAkB;cACF,eAAe,CAC7B,KAAK,EAAE,iCAAiC,EACxC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,kCAAkC,CAAC;IAuB9C;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAChB,KAAK,EAAE,iCAAiC,EACxC,OAAO,EAAE,mBAAmB,GAC3B,kCAAkC;IAoBrC,uFAAuF;IACvF,SAAS,CAAC,qBAAqB,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,mBAAmB,EAAE;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,GACjE,MAAM;IAWT,qFAAqF;IACrF,SAAS,CAAC,4BAA4B,CACpC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,mBAAmB,EAAE;QAAE,IAAI,EAAE,yBAAyB,CAAA;KAAE,CAAC,GACzE,MAAM;IAWT;;;;OAIG;IACH,SAAS,CAAC,IAAI,IAAI,mBAAmB;CAGtC;AAED,sFAAsF;AACtF,wBAAgB,yCAAyC,IAAI,IAAI,CAEhE"}
|