@iyulab/mloop-mcp 0.13.0 → 0.15.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/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +22 -3
- package/build/server.d.ts.map +1 -1
- package/build/server.js +6 -2
- package/build/server.js.map +1 -1
- package/build/tasks.d.ts +26 -0
- package/build/tasks.d.ts.map +1 -0
- package/build/tasks.js +26 -0
- package/build/tasks.js.map +1 -0
- package/build/tool-hints.d.ts +26 -0
- package/build/tool-hints.d.ts.map +1 -0
- package/build/tool-hints.js +72 -0
- package/build/tool-hints.js.map +1 -0
- package/build/tools/analyze.d.ts +5 -0
- package/build/tools/analyze.d.ts.map +1 -1
- package/build/tools/analyze.js +41 -8
- package/build/tools/analyze.js.map +1 -1
- package/build/tools/calibrate.d.ts +1 -0
- package/build/tools/calibrate.d.ts.map +1 -1
- package/build/tools/calibrate.js +4 -1
- package/build/tools/calibrate.js.map +1 -1
- package/build/tools/compare.d.ts +4 -1
- package/build/tools/compare.d.ts.map +1 -1
- package/build/tools/compare.js +11 -2
- package/build/tools/compare.js.map +1 -1
- package/build/tools/detect.d.ts +1 -0
- package/build/tools/detect.d.ts.map +1 -1
- package/build/tools/detect.js +4 -1
- package/build/tools/detect.js.map +1 -1
- package/build/tools/docker.d.ts +23 -0
- package/build/tools/docker.d.ts.map +1 -0
- package/build/tools/docker.js +38 -0
- package/build/tools/docker.js.map +1 -0
- package/build/tools/embed.d.ts +1 -0
- package/build/tools/embed.d.ts.map +1 -1
- package/build/tools/embed.js +6 -3
- package/build/tools/embed.js.map +1 -1
- package/build/tools/encoder.d.ts +5 -1
- package/build/tools/encoder.d.ts.map +1 -1
- package/build/tools/encoder.js +18 -9
- package/build/tools/encoder.js.map +1 -1
- package/build/tools/evaluate.d.ts +2 -0
- package/build/tools/evaluate.d.ts.map +1 -1
- package/build/tools/evaluate.js +9 -1
- package/build/tools/evaluate.js.map +1 -1
- package/build/tools/explain.d.ts +29 -0
- package/build/tools/explain.d.ts.map +1 -0
- package/build/tools/explain.js +57 -0
- package/build/tools/explain.js.map +1 -0
- package/build/tools/feedback.d.ts +3 -0
- package/build/tools/feedback.d.ts.map +1 -1
- package/build/tools/feedback.js +7 -0
- package/build/tools/feedback.js.map +1 -1
- package/build/tools/index.d.ts +3 -0
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +3 -0
- package/build/tools/index.js.map +1 -1
- package/build/tools/info.d.ts +1 -0
- package/build/tools/info.d.ts.map +1 -1
- package/build/tools/info.js +5 -1
- package/build/tools/info.js.map +1 -1
- package/build/tools/init.d.ts +15 -0
- package/build/tools/init.d.ts.map +1 -1
- package/build/tools/init.js +10 -2
- package/build/tools/init.js.map +1 -1
- package/build/tools/list.d.ts +1 -0
- package/build/tools/list.d.ts.map +1 -1
- package/build/tools/list.js +4 -1
- package/build/tools/list.js.map +1 -1
- package/build/tools/logs.d.ts +2 -0
- package/build/tools/logs.d.ts.map +1 -1
- package/build/tools/logs.js +6 -0
- package/build/tools/logs.js.map +1 -1
- package/build/tools/predict.d.ts +4 -0
- package/build/tools/predict.d.ts.map +1 -1
- package/build/tools/predict.js +14 -1
- package/build/tools/predict.js.map +1 -1
- package/build/tools/prep-plan.d.ts +1 -0
- package/build/tools/prep-plan.d.ts.map +1 -1
- package/build/tools/prep-plan.js +4 -1
- package/build/tools/prep-plan.js.map +1 -1
- package/build/tools/promote.d.ts +1 -0
- package/build/tools/promote.d.ts.map +1 -1
- package/build/tools/promote.js +4 -1
- package/build/tools/promote.js.map +1 -1
- package/build/tools/quick-start.d.ts +14 -1
- package/build/tools/quick-start.d.ts.map +1 -1
- package/build/tools/quick-start.js +7 -4
- package/build/tools/quick-start.js.map +1 -1
- package/build/tools/runtime.d.ts +31 -0
- package/build/tools/runtime.d.ts.map +1 -0
- package/build/tools/runtime.js +42 -0
- package/build/tools/runtime.js.map +1 -0
- package/build/tools/sample.d.ts +2 -1
- package/build/tools/sample.d.ts.map +1 -1
- package/build/tools/sample.js +5 -3
- package/build/tools/sample.js.map +1 -1
- package/build/tools/status.d.ts +1 -0
- package/build/tools/status.d.ts.map +1 -1
- package/build/tools/status.js +4 -1
- package/build/tools/status.js.map +1 -1
- package/build/tools/threshold.d.ts +2 -0
- package/build/tools/threshold.d.ts.map +1 -1
- package/build/tools/threshold.js +8 -2
- package/build/tools/threshold.js.map +1 -1
- package/build/tools/train.d.ts +29 -0
- package/build/tools/train.d.ts.map +1 -1
- package/build/tools/train.js +44 -2
- package/build/tools/train.js.map +1 -1
- package/build/tools/trigger.d.ts +2 -0
- package/build/tools/trigger.d.ts.map +1 -1
- package/build/tools/trigger.js +6 -0
- package/build/tools/trigger.js.map +1 -1
- package/build/tools/validate.d.ts +1 -0
- package/build/tools/validate.d.ts.map +1 -1
- package/build/tools/validate.js +3 -0
- package/build/tools/validate.js.map +1 -1
- package/build/training-run.d.ts +7 -1
- package/build/training-run.d.ts.map +1 -1
- package/build/training-run.js +9 -1
- package/build/training-run.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,74 @@ Releases before 0.11.3 are described by their commits. 0.12.0 includes the 0.11.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.15.0] - 2026-11-02
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `mloop_predict` takes `scoreThreshold`, passed as `mloop predict --score-threshold`: for an object-detection model, the confidence a box needs to be reported (default 0.5). A detector that finds objects without being 0.5 confident scores `map_50` 0 and shows nothing at the default; `0.3` (then lower) shows what it finds. Needs an `mloop` that has the flag; any other task refuses it.
|
|
14
|
+
- `mloop_train` takes `epochs`, passed as `mloop train --epochs`: how many epochs a deep-learning task (text classification, sentence similarity, NER,
|
|
15
|
+
question answering, object detection) trains for. `time` does not shorten such a fit, so the epoch count is its one dial on cost - try 2 first to see
|
|
16
|
+
what an epoch costs on the machine. Needs an `mloop` that has the flag; a task that does not count epochs refuses it.
|
|
17
|
+
- Options the CLI had and the tools could not pass now are fields: `records` (the dotted path to the rows of a JSON data file) on `mloop_info`,
|
|
18
|
+
`mloop_analyze`, `mloop_threshold`, `mloop_calibrate` and `mloop_detect`; `trials` on `mloop_list` (one experiment's trial leaderboard);
|
|
19
|
+
`from` / `to` on `mloop_logs` and `mloop_feedback` (`list`, `metrics`) and `limit` on `mloop_feedback` `list`; `accuracy` and `feedback`
|
|
20
|
+
thresholds on `mloop_trigger`; `best`, `metric` and `metricsFile` on `mloop_compare` (its `experiments` may now be left out, to compare the
|
|
21
|
+
model's completed experiments); `model` (a model file) on `mloop_predict`.
|
|
22
|
+
- `mloop_train` takes `analyzeData` (check the data quality and train nothing), `generateScript` (write a preprocessing script from that check), `autoMerge`
|
|
23
|
+
(merge the CSV files of one schema in `datasets/`) and `autoTime` (`true` sizes the time budget from the data even where `mloop.yaml` sets one, `false`
|
|
24
|
+
keeps the 300 s default). The answer of a data check carries `analysis` (the findings, each with a suggested fix; an empty list when there are none) and,
|
|
25
|
+
with `generateScript`, `script` (the path written) in place of `result`. The events come from an `mloop` newer than 0.48: older ones say nothing for
|
|
26
|
+
`--analyze-data --json`, and both fields are then null.
|
|
27
|
+
- `decideOnly` on `mloop_promote` (report what `latest`/`best` would promote and move nothing), `modelName` and `label` on `mloop_init`, `verbose` on
|
|
28
|
+
`mloop_status` and `mloop_validate`, `list` on `mloop_prep_plan`, and `textFile` on `mloop_embed` (a file of texts, one per line).
|
|
29
|
+
- `mloop_sample` takes `records` (the dotted path to the rows of a JSON data file) and says that `dataFile` may be a TSV, JSON, Excel or Parquet file - the sample is
|
|
30
|
+
written as CSV. Needs an `mloop` that reads those formats in `sample create --from`.
|
|
31
|
+
- Three tools for commands the CLI had and the server did not: `mloop_explain` (which input columns a model relies on — permutation importance on a labeled
|
|
32
|
+
file; needs an `mloop` newer than 0.48), `mloop_runtime` (list, install or remove the deep-learning runtimes `tf`, `torch`, `onnxruntime`) and
|
|
33
|
+
`mloop_docker` (write the Dockerfile and docker-compose.yml that serve a model). `mloop_encoder` also takes `add`: register an encoder of your own from its
|
|
34
|
+
definition file, ONNX graph and, for a text encoder, tokenizer.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- The package's `repository` field names this repository (`iyulab/mloop-mcp`). It pointed at the `MLoop` repository with a `mcp` directory, which that repository does
|
|
39
|
+
not have, so the npm page linked to a repository that does not hold this code (and a provenance statement made from this repository's
|
|
40
|
+
workflow would not have matched it).
|
|
41
|
+
|
|
42
|
+
## [0.14.0] - 2026-10-30
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- `mloop_train` takes `maxTrials`, passed as `mloop train --max-trials`: the trainer search stops after that many trials within `time`, so the
|
|
47
|
+
same call trains the same search on a fast machine and a slow one. Needs an `mloop` that has the flag; a task that runs no search refuses it.
|
|
48
|
+
- `mloop_init`, `mloop_train` and `mloop_quick_start` take every task the `mloop` CLI has — all sixteen, where they listed three
|
|
49
|
+
(`regression` and the two classification tasks) and an agent could not start a forecasting, clustering, image or text project.
|
|
50
|
+
The list is one module (`src/tasks.ts`); `npm run check:cli` now also compares it with `mloop init --help` and reports a task the
|
|
51
|
+
tools lack or one the CLI does not know.
|
|
52
|
+
- `mloop_train` passes `groupColumn` (ranking), `encoder` and `bankSize` (image-anomaly), `maxRows`, `samplingStrategy`, `seed` and
|
|
53
|
+
`records` (a JSON data file's row path) to the matching `mloop train` options.
|
|
54
|
+
`encoder`, `bankSize` and the `image-anomaly` task need `mloop` 0.47 or later.
|
|
55
|
+
- `mloop_evaluate` takes `normalClass` (the subfolder of normal pictures for an image-anomaly model) and `records`; `mloop_predict` takes `records` and
|
|
56
|
+
`includeFeatures` (false leaves the input columns out of the output file).
|
|
57
|
+
|
|
58
|
+
- `mloop_analyze` takes the `series` aspect with `column`, `maxLag` and `aroundTrend`: one column read as an ordered series, answered as the
|
|
59
|
+
autocorrelation and partial autocorrelation functions with their bands, the ADF and KPSS stationarity tests read together, and the
|
|
60
|
+
dominant period. It needs `mloop` 0.48 or later. A label and a model name are not used by this aspect and are not passed.
|
|
61
|
+
- Every tool now carries the four MCP safety hints (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`), so a client's
|
|
62
|
+
approval policy can read what a tool may do instead of guessing from its name. Twelve tools only read (`mloop_list`, `mloop_status`,
|
|
63
|
+
`mloop_info`, `mloop_analyze`, `mloop_compare`, `mloop_evaluate`, `mloop_validate`, `mloop_logs`, `mloop_trigger`, `mloop_drift`,
|
|
64
|
+
`mloop_embed`, `mloop_project_overview`) and so does `mloop_token`; the rest write, and those that can overwrite a file at a path
|
|
65
|
+
the caller names or delete a setting, a threshold or an installed encoder say `destructiveHint: true`. The hints live in one table
|
|
66
|
+
(`src/tool-hints.ts`) and the server refuses to start with a tool that has none.
|
|
67
|
+
- The repository and the package carry a `LICENSE` file (MIT, as `package.json` already declared).
|
|
68
|
+
- `mloop_threshold` takes `guarantee`, a risk such as 0.05 used with `precision`: the threshold is then the lowest one whose
|
|
69
|
+
precision is certified to reach the target (wrong in at most that share of the files it could be run on) instead of the lowest
|
|
70
|
+
one that reached it on the file, and the command refuses, writing nothing, when the file has too few rows to carry the
|
|
71
|
+
guarantee. It needs `mloop` 0.48 or later.
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
|
|
75
|
+
- `mloop_quick_start`'s `label` is optional (omit it for a task that learns without one) and its `dataFile` may be a folder of pictures.
|
|
76
|
+
|
|
9
77
|
## [0.13.0] - 2026-10-27
|
|
10
78
|
|
|
11
79
|
`mloop_feedback`, `mloop_sample`, `mloop_init` and `mloop_quick_start` need `mloop` 0.47 or later; the other tools
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 iyulab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ If MLoop is not in PATH, set the `MLOOP_PATH` environment variable:
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
# Windows
|
|
37
|
-
set MLOOP_PATH
|
|
37
|
+
set MLOOP_PATH=%USERPROFILE%\tools\mloop.exe
|
|
38
38
|
|
|
39
39
|
# Linux/macOS
|
|
40
40
|
export MLOOP_PATH=/usr/local/bin/mloop
|
|
@@ -83,7 +83,7 @@ plugins:
|
|
|
83
83
|
| `mloop_calibrate` | Fit a classifier's probability calibration (binary platt · isotonic, multiclass temperature) on labeled rows without retraining, show it, or clear it (mloop >= 0.40) |
|
|
84
84
|
| `mloop_export_onnx` | Model as ONNX + manifest (inputs and their data columns, outputs, classes, hashes) for runtimes without ML.NET |
|
|
85
85
|
| `mloop_info` | Analyze and profile datasets |
|
|
86
|
-
| `mloop_analyze` | Run one read-only EDA aspect (profile/correlation/importance/outliers/distribution) as structured JSON |
|
|
86
|
+
| `mloop_analyze` | Run one read-only EDA aspect (profile/correlation/importance/outliers/distribution/series) as structured JSON |
|
|
87
87
|
| `mloop_drift` | Recent inputs and answers vs the training data — PSI per column, for the answers (mloop >= 0.39), for free-text columns by length and unseen words (mloop >= 0.40), per slice, as JSON (mloop >= 0.38) |
|
|
88
88
|
| `mloop_detect` | One-shot time-series anomaly detection with SPC bounds — no training, no project required (mloop >= 0.21) |
|
|
89
89
|
| `mloop_prep_plan` | Declare a preprocessing step in mloop.yaml (policy only, no data change) as structured JSON |
|
|
@@ -94,7 +94,26 @@ plugins:
|
|
|
94
94
|
| `mloop_serve` | Start the REST API server; returns once it answers `/health`, and leaves it running |
|
|
95
95
|
| `mloop_token` | Issue the bearer token the server requires on every endpoint but `/health` (`role: admin` for writes) |
|
|
96
96
|
| `mloop_embed` | Images or texts to vectors with a pretrained encoder, with the encoder's identity (texts: mloop >= 0.46) |
|
|
97
|
-
| `mloop_encoder` | List, install (catalog: `dinov2-small`, `multilingual-minilm`) or remove pretrained encoders |
|
|
97
|
+
| `mloop_encoder` | List, install (catalog: `dinov2-small`, `multilingual-minilm`), add your own (definition, ONNX graph, tokenizer) or remove pretrained encoders |
|
|
98
|
+
| `mloop_explain` | Which input columns a model relies on — permutation importance on a labeled file, in the metric `mloop_evaluate` reports (an `mloop` newer than 0.48) |
|
|
99
|
+
| `mloop_runtime` | List, install or remove the on-demand deep-learning runtimes (`tf`, `torch`, `onnxruntime`) |
|
|
100
|
+
| `mloop_docker` | Generate the Dockerfile and docker-compose.yml that serve a project's model |
|
|
101
|
+
| `mloop_init` | Initialize a new MLoop project (`mloop.yaml`, `datasets/`, `models/`) |
|
|
102
|
+
| `mloop_quick_start` | One step from zero to a production model: initialize, train, auto-promote |
|
|
103
|
+
| `mloop_auto_train` | Profile the data, train with an automatic time budget and list the experiments in one call |
|
|
104
|
+
| `mloop_project_overview` | Status, every experiment and the production model's metrics in one call |
|
|
105
|
+
| `mloop_validate` | Validate `mloop.yaml` (syntax, missing fields, invalid values) |
|
|
106
|
+
| `mloop_prep` | Run a model's declared preprocessing steps over a CSV file and write the prepared file |
|
|
107
|
+
| `mloop_logs` | View a model's prediction logs |
|
|
108
|
+
| `mloop_feedback` | Add the actual value for a logged prediction (source, optional weight), list feedback, or read its metrics |
|
|
109
|
+
| `mloop_sample` | Create a sampled dataset from a CSV file, or a retraining dataset from logged predictions and feedback |
|
|
110
|
+
| `mloop_trigger` | Check whether retraining is due, as JSON: one result per condition |
|
|
111
|
+
|
|
112
|
+
Every tool declares the MCP safety hints (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) in `tools/list`, so a
|
|
113
|
+
client can apply an approval policy without reading tool names: the reading tools (`mloop_list`, `mloop_status`, `mloop_info`,
|
|
114
|
+
`mloop_analyze`, `mloop_compare`, `mloop_evaluate`, `mloop_validate`, `mloop_logs`, `mloop_trigger`, `mloop_drift`, `mloop_embed`,
|
|
115
|
+
`mloop_project_overview`, `mloop_token`, `mloop_explain`) change nothing; the others write, and `destructiveHint: true` marks the ones that can overwrite a
|
|
116
|
+
file at a path you name or delete a setting, a threshold, an installed encoder or runtime. The table is `src/tool-hints.ts`.
|
|
98
117
|
|
|
99
118
|
## Tool Examples
|
|
100
119
|
|
package/build/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAsB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAsB,MAAM,8BAA8B,CAAC;AA2F7E;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAexC"}
|
package/build/server.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* MCP Server for MLoop CLI
|
|
3
3
|
*/
|
|
4
4
|
import { McpServer } from '@modelcontextprotocol/server';
|
|
5
|
-
import { trainTool, trainSchema, predictTool, predictSchema, listTool, listSchema, promoteTool, promoteSchema, rollbackTool, rollbackSchema, thresholdTool, thresholdSchema, calibrateTool, calibrateSchema, exportOnnxTool, exportOnnxSchema, infoTool, infoSchema, statusTool, statusSchema, compareTool, compareSchema, evaluateTool, evaluateSchema, serveTool, serveSchema, initTool, initSchema, validateTool, validateSchema, prepTool, prepSchema, logsTool, logsSchema, feedbackTool, feedbackSchema, sampleTool, sampleSchema, triggerTool, triggerSchema, driftTool, driftSchema, analyzeTool, analyzeSchema, detectTool, detectSchema, prepPlanTool, prepPlanSchema, featuresSelectTool, featuresSelectSchema, tokenTool, tokenSchema, embedTool, embedSchema, encoderTool, encoderSchema, quickStartTool, quickStartSchema, autoTrainTool, autoTrainSchema, projectOverviewTool, projectOverviewSchema, } from './tools/index.js';
|
|
5
|
+
import { trainTool, trainSchema, predictTool, predictSchema, listTool, listSchema, promoteTool, promoteSchema, rollbackTool, rollbackSchema, thresholdTool, thresholdSchema, calibrateTool, calibrateSchema, exportOnnxTool, exportOnnxSchema, infoTool, infoSchema, statusTool, statusSchema, compareTool, compareSchema, evaluateTool, evaluateSchema, serveTool, serveSchema, initTool, initSchema, validateTool, validateSchema, prepTool, prepSchema, logsTool, logsSchema, feedbackTool, feedbackSchema, sampleTool, sampleSchema, triggerTool, triggerSchema, driftTool, driftSchema, analyzeTool, analyzeSchema, detectTool, detectSchema, prepPlanTool, prepPlanSchema, featuresSelectTool, featuresSelectSchema, tokenTool, tokenSchema, embedTool, embedSchema, encoderTool, encoderSchema, explainTool, explainSchema, runtimeTool, runtimeSchema, dockerTool, dockerSchema, quickStartTool, quickStartSchema, autoTrainTool, autoTrainSchema, projectOverviewTool, projectOverviewSchema, } from './tools/index.js';
|
|
6
6
|
import { packageVersion } from './package-info.js';
|
|
7
7
|
import { withRequestSignal } from './executor.js';
|
|
8
|
+
import { hintsFor } from './tool-hints.js';
|
|
8
9
|
/** Every tool, with the schema its arguments are validated against — in the order `tools/list` names them. */
|
|
9
10
|
const tools = [
|
|
10
11
|
[trainTool, trainSchema],
|
|
@@ -35,6 +36,9 @@ const tools = [
|
|
|
35
36
|
[tokenTool, tokenSchema],
|
|
36
37
|
[embedTool, embedSchema],
|
|
37
38
|
[encoderTool, encoderSchema],
|
|
39
|
+
[explainTool, explainSchema],
|
|
40
|
+
[runtimeTool, runtimeSchema],
|
|
41
|
+
[dockerTool, dockerSchema],
|
|
38
42
|
[quickStartTool, quickStartSchema],
|
|
39
43
|
[autoTrainTool, autoTrainSchema],
|
|
40
44
|
[projectOverviewTool, projectOverviewSchema],
|
|
@@ -48,7 +52,7 @@ export function createServer() {
|
|
|
48
52
|
version: packageVersion,
|
|
49
53
|
});
|
|
50
54
|
for (const [tool, schema] of tools) {
|
|
51
|
-
server.registerTool(tool.name, { description: tool.description, inputSchema: schema }, async (params, ctx) => withRequestSignal(ctx.mcpReq.signal, () => tool.handler(params, ctx)));
|
|
55
|
+
server.registerTool(tool.name, { description: tool.description, inputSchema: schema, annotations: hintsFor(tool.name) }, async (params, ctx) => withRequestSignal(ctx.mcpReq.signal, () => tool.handler(params, ctx)));
|
|
52
56
|
}
|
|
53
57
|
return server;
|
|
54
58
|
}
|
package/build/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAsB,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EACL,SAAS,EAAE,WAAW,EACtB,WAAW,EAAE,aAAa,EAC1B,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,aAAa,EAC1B,YAAY,EAAE,cAAc,EAC5B,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K,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/build/tasks.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ML task types `mloop` knows (`mloop init --help`). One list for every tool that takes a `task`: a tool with its own
|
|
3
|
+
* shorter copy is a CLI an agent can only partly drive. `scripts/check-cli-options.mjs` compares this list with the
|
|
4
|
+
* installed CLI's.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export declare const MLOOP_TASKS: readonly ['regression', 'binary-classification', 'multiclass-classification', 'anomaly-detection', 'clustering', 'ranking', 'forecasting', 'time-series-anomaly', 'image-classification', 'object-detection', 'image-anomaly', 'text-classification', 'sentence-similarity', 'ner', 'question-answering', 'recommendation'];
|
|
8
|
+
export declare const taskSchema: z.ZodEnum<{
|
|
9
|
+
"anomaly-detection": "anomaly-detection";
|
|
10
|
+
"binary-classification": "binary-classification";
|
|
11
|
+
clustering: "clustering";
|
|
12
|
+
forecasting: "forecasting";
|
|
13
|
+
"image-anomaly": "image-anomaly";
|
|
14
|
+
"image-classification": "image-classification";
|
|
15
|
+
"multiclass-classification": "multiclass-classification";
|
|
16
|
+
ner: "ner";
|
|
17
|
+
"object-detection": "object-detection";
|
|
18
|
+
"question-answering": "question-answering";
|
|
19
|
+
ranking: "ranking";
|
|
20
|
+
recommendation: "recommendation";
|
|
21
|
+
regression: "regression";
|
|
22
|
+
"sentence-similarity": "sentence-similarity";
|
|
23
|
+
"text-classification": "text-classification";
|
|
24
|
+
"time-series-anomaly": "time-series-anomaly";
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW,YACtB,YAAY,EACZ,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,EACL,oBAAoB,EACpB,gBAAgB,CACR,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;EAAsB,CAAC"}
|
package/build/tasks.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ML task types `mloop` knows (`mloop init --help`). One list for every tool that takes a `task`: a tool with its own
|
|
3
|
+
* shorter copy is a CLI an agent can only partly drive. `scripts/check-cli-options.mjs` compares this list with the
|
|
4
|
+
* installed CLI's.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export const MLOOP_TASKS = [
|
|
8
|
+
'regression',
|
|
9
|
+
'binary-classification',
|
|
10
|
+
'multiclass-classification',
|
|
11
|
+
'anomaly-detection',
|
|
12
|
+
'clustering',
|
|
13
|
+
'ranking',
|
|
14
|
+
'forecasting',
|
|
15
|
+
'time-series-anomaly',
|
|
16
|
+
'image-classification',
|
|
17
|
+
'object-detection',
|
|
18
|
+
'image-anomaly',
|
|
19
|
+
'text-classification',
|
|
20
|
+
'sentence-similarity',
|
|
21
|
+
'ner',
|
|
22
|
+
'question-answering',
|
|
23
|
+
'recommendation',
|
|
24
|
+
];
|
|
25
|
+
export const taskSchema = z.enum(MLOOP_TASKS);
|
|
26
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,YAAY;IACZ,uBAAuB;IACvB,2BAA2B;IAC3B,mBAAmB;IACnB,YAAY;IACZ,SAAS;IACT,aAAa;IACb,qBAAqB;IACrB,sBAAsB;IACtB,kBAAkB;IAClB,eAAe;IACf,qBAAqB;IACrB,qBAAqB;IACrB,KAAK;IACL,oBAAoB;IACpB,gBAAgB;CACR,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safety hints (MCP tool annotations) of every tool — the one place that says what a tool may do to the world, so an
|
|
3
|
+
* approval policy reads a mechanism instead of guessing from names.
|
|
4
|
+
*
|
|
5
|
+
* The four hints follow the MCP definitions and are written for the worst thing a tool can do in any of its modes:
|
|
6
|
+
* - readOnly — it changes nothing: no file written, no process started, no state of the project touched.
|
|
7
|
+
* - destructive — it can delete or overwrite something that is not regenerated by the same call: a file at a path the
|
|
8
|
+
* caller names, a setting, an installed encoder. Adding a new experiment, or replacing production
|
|
9
|
+
* (the replaced model is backed up and `mloop_rollback` returns it) is not destructive.
|
|
10
|
+
* - idempotent — the same call again has no further effect (a retry is safe).
|
|
11
|
+
* - openWorld — it reaches beyond the local machine and project: a download, a listener other hosts can call.
|
|
12
|
+
* A read-only tool says `destructiveHint: false`; the field is only meaningful otherwise, but a policy should not have to
|
|
13
|
+
* know that. Where a tool has modes (`mloop_threshold` chooses or clears), the hint is the worst mode's.
|
|
14
|
+
*
|
|
15
|
+
* `hintsFor` throws for a tool without an entry, so a tool added to the server cannot ship unannotated.
|
|
16
|
+
*/
|
|
17
|
+
export interface ToolHints {
|
|
18
|
+
readOnlyHint: boolean;
|
|
19
|
+
destructiveHint: boolean;
|
|
20
|
+
idempotentHint: boolean;
|
|
21
|
+
openWorldHint: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const TOOL_HINTS: Readonly<Record<string, ToolHints>>;
|
|
24
|
+
/** The hints of tool <paramref name="name"/>; throws when it has none. */
|
|
25
|
+
export declare function hintsFor(name: string): ToolHints;
|
|
26
|
+
//# sourceMappingURL=tool-hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-hints.d.ts","sourceRoot":"","sources":["../src/tool-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACxB;AAYD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CA4C1D,CAAC;AAEF,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAKhD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safety hints (MCP tool annotations) of every tool — the one place that says what a tool may do to the world, so an
|
|
3
|
+
* approval policy reads a mechanism instead of guessing from names.
|
|
4
|
+
*
|
|
5
|
+
* The four hints follow the MCP definitions and are written for the worst thing a tool can do in any of its modes:
|
|
6
|
+
* - readOnly — it changes nothing: no file written, no process started, no state of the project touched.
|
|
7
|
+
* - destructive — it can delete or overwrite something that is not regenerated by the same call: a file at a path the
|
|
8
|
+
* caller names, a setting, an installed encoder. Adding a new experiment, or replacing production
|
|
9
|
+
* (the replaced model is backed up and `mloop_rollback` returns it) is not destructive.
|
|
10
|
+
* - idempotent — the same call again has no further effect (a retry is safe).
|
|
11
|
+
* - openWorld — it reaches beyond the local machine and project: a download, a listener other hosts can call.
|
|
12
|
+
* A read-only tool says `destructiveHint: false`; the field is only meaningful otherwise, but a policy should not have to
|
|
13
|
+
* know that. Where a tool has modes (`mloop_threshold` chooses or clears), the hint is the worst mode's.
|
|
14
|
+
*
|
|
15
|
+
* `hintsFor` throws for a tool without an entry, so a tool added to the server cannot ship unannotated.
|
|
16
|
+
*/
|
|
17
|
+
const hints = (readOnlyHint, destructiveHint, idempotentHint, openWorldHint = false) => ({ readOnlyHint, destructiveHint, idempotentHint, openWorldHint });
|
|
18
|
+
/** Reads the project or a data file and writes nothing. */
|
|
19
|
+
const READS = hints(true, false, true);
|
|
20
|
+
/** Writes at a path the caller names or declares settings — a repeat gives the same result, and it can overwrite. */
|
|
21
|
+
const WRITES_OVER = hints(false, true, true);
|
|
22
|
+
/** Adds to the project (an experiment, an entry, a process) — a repeat adds again. */
|
|
23
|
+
const ADDS = hints(false, false, false);
|
|
24
|
+
export const TOOL_HINTS = {
|
|
25
|
+
// Reads
|
|
26
|
+
mloop_list: READS,
|
|
27
|
+
mloop_status: READS,
|
|
28
|
+
mloop_info: READS,
|
|
29
|
+
mloop_analyze: READS,
|
|
30
|
+
mloop_compare: READS,
|
|
31
|
+
mloop_evaluate: READS,
|
|
32
|
+
mloop_validate: READS,
|
|
33
|
+
mloop_logs: READS,
|
|
34
|
+
mloop_trigger: READS,
|
|
35
|
+
mloop_drift: READS,
|
|
36
|
+
mloop_embed: READS,
|
|
37
|
+
mloop_explain: READS,
|
|
38
|
+
mloop_project_overview: READS,
|
|
39
|
+
mloop_token: READS, // issues a signed token; nothing is stored
|
|
40
|
+
// Adds
|
|
41
|
+
mloop_train: ADDS, // a new experiment; a better model replaces production, the old one is backed up
|
|
42
|
+
mloop_auto_train: ADDS, // profiles, then trains
|
|
43
|
+
mloop_quick_start: ADDS, // init, train and promote in one call
|
|
44
|
+
mloop_init: ADDS, // a new project directory
|
|
45
|
+
mloop_feedback: ADDS, // `add` appends an entry
|
|
46
|
+
mloop_rollback: ADDS, // again returns to what production held before the rollback
|
|
47
|
+
mloop_predict: hints(false, true, false), // `output` overwrites the named file; `log` appends to the prediction log
|
|
48
|
+
mloop_serve: hints(false, false, false, true), // starts a server that keeps running and listens for other hosts
|
|
49
|
+
// Replaces the production pointer with a backup, and repeats are no-ops
|
|
50
|
+
mloop_promote: hints(false, false, true),
|
|
51
|
+
// Writes beside the model or at a caller-named path; `clear` / `reset` / `remove` modes delete
|
|
52
|
+
mloop_threshold: WRITES_OVER,
|
|
53
|
+
mloop_calibrate: WRITES_OVER,
|
|
54
|
+
mloop_export_onnx: WRITES_OVER,
|
|
55
|
+
mloop_prep: WRITES_OVER,
|
|
56
|
+
mloop_prep_plan: WRITES_OVER,
|
|
57
|
+
mloop_features_select: WRITES_OVER,
|
|
58
|
+
mloop_sample: WRITES_OVER,
|
|
59
|
+
mloop_detect: WRITES_OVER, // writes only when `output` is given
|
|
60
|
+
mloop_docker: WRITES_OVER, // writes a Dockerfile and a compose file over the ones there
|
|
61
|
+
// Installs download weights or a runtime; remove deletes them
|
|
62
|
+
mloop_encoder: hints(false, true, true, true),
|
|
63
|
+
mloop_runtime: hints(false, true, true, true),
|
|
64
|
+
};
|
|
65
|
+
/** The hints of tool <paramref name="name"/>; throws when it has none. */
|
|
66
|
+
export function hintsFor(name) {
|
|
67
|
+
const found = TOOL_HINTS[name];
|
|
68
|
+
if (!found)
|
|
69
|
+
throw new Error(`Tool '${name}' has no safety hints: add it to TOOL_HINTS in src/tool-hints.ts.`);
|
|
70
|
+
return found;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=tool-hints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-hints.js","sourceRoot":"","sources":["../src/tool-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,MAAM,KAAK,GAAG,CAAC,YAAqB,EAAE,eAAwB,EAAE,cAAuB,EAAE,aAAa,GAAG,KAAK,EAAa,EAAE,CAC3H,CAAC,EAAE,YAAY,EAAE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,CAAC;IAExC,+FAA+F;IAC/F,eAAe,EAAE,WAAW;IAC5B,eAAe,EAAE,WAAW;IAC5B,iBAAiB,EAAE,WAAW;IAC9B,UAAU,EAAE,WAAW;IACvB,eAAe,EAAE,WAAW;IAC5B,qBAAqB,EAAE,WAAW;IAClC,YAAY,EAAE,WAAW;IACzB,YAAY,EAAE,WAAW,EAAE,qCAAqC;IAChE,YAAY,EAAE,WAAW,EAAE,6DAA6D;IAExF,8DAA8D;IAC9D,aAAa,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC7C,aAAa,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;CAC9C,CAAC;AAEF,0EAA0E;AAC1E,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK;QACR,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,mEAAmE,CAAC,CAAC;IACpG,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/build/tools/analyze.d.ts
CHANGED
|
@@ -14,11 +14,16 @@ export declare const analyzeSchema: z.ZodObject<{
|
|
|
14
14
|
importance: "importance";
|
|
15
15
|
outliers: "outliers";
|
|
16
16
|
profile: "profile";
|
|
17
|
+
series: "series";
|
|
17
18
|
}>;
|
|
18
19
|
dataFile: z.ZodOptional<z.ZodString>;
|
|
19
20
|
projectPath: z.ZodOptional<z.ZodString>;
|
|
20
21
|
label: z.ZodOptional<z.ZodString>;
|
|
22
|
+
column: z.ZodOptional<z.ZodString>;
|
|
23
|
+
maxLag: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
aroundTrend: z.ZodOptional<z.ZodBoolean>;
|
|
21
25
|
modelName: z.ZodOptional<z.ZodString>;
|
|
26
|
+
records: z.ZodOptional<z.ZodString>;
|
|
22
27
|
}, z.core.$strip>;
|
|
23
28
|
export type AnalyzeParams = z.infer<typeof analyzeSchema>;
|
|
24
29
|
export declare function analyze(params: AnalyzeParams): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/tools/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/tools/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;iBA+CxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,wBAAsB,OAAO,CAC3B,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA+ChF;AAED,eAAO,MAAM,WAAW;IACtB,IAAI;IACJ,WAAW;IAIX,OAAO;CACR,CAAC"}
|
package/build/tools/analyze.js
CHANGED
|
@@ -12,12 +12,14 @@ import { parseCliOutput } from '../utils/parser.js';
|
|
|
12
12
|
import { formatError } from '../utils/errors.js';
|
|
13
13
|
export const analyzeSchema = z.object({
|
|
14
14
|
aspect: z
|
|
15
|
-
.enum(['profile', 'correlation', 'importance', 'outliers', 'distribution'])
|
|
15
|
+
.enum(['profile', 'correlation', 'importance', 'outliers', 'distribution', 'series'])
|
|
16
16
|
.describe('EDA aspect to compute: "profile" (column types, null %, cardinality, constant columns), ' +
|
|
17
17
|
'"correlation" (high-correlation pairs + multicollinearity), ' +
|
|
18
18
|
'"importance" (feature-importance ranking, requires a label), ' +
|
|
19
19
|
'"outliers" (count/rate/isolation-forest threshold), ' +
|
|
20
|
-
'"distribution" (skewness/kurtosis/normality tests)'
|
|
20
|
+
'"distribution" (skewness/kurtosis/normality tests), ' +
|
|
21
|
+
'"series" (one column read as an ordered series: autocorrelation/partial autocorrelation with their bands, ' +
|
|
22
|
+
'ADF and KPSS stationarity tests read together, dominant period; needs mloop 0.48 or later)'),
|
|
21
23
|
dataFile: z
|
|
22
24
|
.string()
|
|
23
25
|
.optional()
|
|
@@ -29,19 +31,50 @@ export const analyzeSchema = z.object({
|
|
|
29
31
|
.string()
|
|
30
32
|
.optional()
|
|
31
33
|
.describe('Label/target column name (overrides mloop.yaml; required for the "importance" aspect)'),
|
|
34
|
+
column: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Series column to analyze (only the "series" aspect; optional when the CSV has a single column)'),
|
|
38
|
+
maxLag: z
|
|
39
|
+
.number()
|
|
40
|
+
.int()
|
|
41
|
+
.positive()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Largest lag of the autocorrelation functions (only "series"; default min(10*log10 n, n - 1))'),
|
|
44
|
+
aroundTrend: z
|
|
45
|
+
.boolean()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Test stationarity around a linear trend instead of a constant level (only "series")'),
|
|
32
48
|
modelName: z
|
|
33
49
|
.string()
|
|
34
50
|
.optional()
|
|
35
51
|
.describe('Model name to read label configuration from mloop.yaml (default: "default")'),
|
|
52
|
+
records: z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe('For a JSON data file: the dotted path to the array whose items are the rows'),
|
|
36
56
|
});
|
|
37
57
|
export async function analyze(params) {
|
|
38
58
|
try {
|
|
39
|
-
const { aspect, dataFile, projectPath, label, modelName } = params;
|
|
59
|
+
const { aspect, dataFile, projectPath, label, modelName, column, maxLag, aroundTrend, records } = params;
|
|
40
60
|
const cliParams = {};
|
|
41
|
-
if (
|
|
42
|
-
cliParams['
|
|
43
|
-
if (
|
|
44
|
-
|
|
61
|
+
if (records)
|
|
62
|
+
cliParams['records'] = records;
|
|
63
|
+
if (aspect === 'series') {
|
|
64
|
+
// A series has no label and no model: its options are the column and the two test choices.
|
|
65
|
+
if (column)
|
|
66
|
+
cliParams['column'] = column;
|
|
67
|
+
if (maxLag !== undefined)
|
|
68
|
+
cliParams['maxLag'] = maxLag;
|
|
69
|
+
if (aroundTrend)
|
|
70
|
+
cliParams['aroundTrend'] = true;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (label)
|
|
74
|
+
cliParams['label'] = label;
|
|
75
|
+
if (modelName)
|
|
76
|
+
cliParams['name'] = modelName;
|
|
77
|
+
}
|
|
45
78
|
// Always emit the structured JSON envelope for LLM consumption.
|
|
46
79
|
cliParams['json'] = true;
|
|
47
80
|
// dataFile is optional: when omitted, the CLI defaults to the project's configured train data.
|
|
@@ -76,7 +109,7 @@ export const analyzeTool = {
|
|
|
76
109
|
name: 'mloop_analyze',
|
|
77
110
|
description: 'Run a single, read-only exploratory-data-analysis (EDA) aspect on a dataset and return a ' +
|
|
78
111
|
'structured JSON envelope for feature-engineering decisions. Aspects: profile, correlation, ' +
|
|
79
|
-
'importance (needs a label), outliers, distribution. Never mutates the data file or mloop.yaml.',
|
|
112
|
+
'importance (needs a label), outliers, distribution, series (a column as an ordered series). Never mutates the data file or mloop.yaml.',
|
|
80
113
|
handler: analyze,
|
|
81
114
|
};
|
|
82
115
|
//# sourceMappingURL=analyze.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../src/tools/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE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gEAAgE;QAChE,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAEzB,+FAA+F;QAC/F,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE;YACtC,GAAG,EAAE,WAAW;SACjB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE7C,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM,IAAI,MAAM,MAAM,sBAAsB;iBACnD;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;iBACzB;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,2FAA2F;QAC3F,6FAA6F;QAC7F,wIAAwI;IAC1I,OAAO,EAAE,OAAO;CACjB,CAAC"}
|
|
@@ -14,6 +14,7 @@ export declare const calibrateSchema: z.ZodObject<{
|
|
|
14
14
|
}>>;
|
|
15
15
|
weight: z.ZodOptional<z.ZodString>;
|
|
16
16
|
clear: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
records: z.ZodOptional<z.ZodString>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
export type CalibrateParams = z.infer<typeof calibrateSchema>;
|
|
19
20
|
export declare function calibrate(params: CalibrateParams): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calibrate.d.ts","sourceRoot":"","sources":["../../src/tools/calibrate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"calibrate.d.ts","sourceRoot":"","sources":["../../src/tools/calibrate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;iBAS1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wBAAsB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAyBvI;AAED,eAAO,MAAM,aAAa;IACxB,IAAI;IACJ,WAAW;IACX,OAAO;CACR,CAAC"}
|
package/build/tools/calibrate.js
CHANGED
|
@@ -13,10 +13,11 @@ export const calibrateSchema = z.object({
|
|
|
13
13
|
method: z.enum(['platt', 'isotonic', 'temperature']).optional().describe('Binary: platt (default; steady on a few hundred rows) or isotonic (no shape assumed, needs more rows). Multiclass: temperature (default; answers unchanged)'),
|
|
14
14
|
weight: z.string().optional().describe('Column that weights the rows (1/π for a recheck sample)'),
|
|
15
15
|
clear: z.boolean().optional().describe('Remove the calibration: the model answers with its own probabilities again'),
|
|
16
|
+
records: z.string().optional().describe('For a JSON dataFile: the dotted path to the array whose items are the rows'),
|
|
16
17
|
});
|
|
17
18
|
export async function calibrate(params) {
|
|
18
19
|
try {
|
|
19
|
-
const { projectPath, experimentId, modelName, dataFile, method, weight, clear } = params;
|
|
20
|
+
const { projectPath, experimentId, modelName, dataFile, method, weight, clear, records } = params;
|
|
20
21
|
const args = ['calibrate'];
|
|
21
22
|
if (experimentId)
|
|
22
23
|
args.push(experimentId);
|
|
@@ -28,6 +29,8 @@ export async function calibrate(params) {
|
|
|
28
29
|
args.push('--method', method);
|
|
29
30
|
if (weight)
|
|
30
31
|
args.push('--weight', weight);
|
|
32
|
+
if (records)
|
|
33
|
+
args.push('--records', records);
|
|
31
34
|
if (clear)
|
|
32
35
|
args.push('--clear');
|
|
33
36
|
args.push('--json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calibrate.js","sourceRoot":"","sources":["../../src/tools/calibrate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IACnE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IACvG,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;IACvD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4EAA4E,CAAC;IACtH,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6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AAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;YACrD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,spBAAspB;IACnqB,OAAO,EAAE,SAAS;CACnB,CAAC"}
|
package/build/tools/compare.d.ts
CHANGED
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
export declare const compareSchema: z.ZodObject<{
|
|
6
6
|
projectPath: z.ZodString;
|
|
7
|
-
experiments: z.ZodArray<z.ZodString
|
|
7
|
+
experiments: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
8
|
modelName: z.ZodOptional<z.ZodString>;
|
|
9
|
+
best: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
metric: z.ZodOptional<z.ZodString>;
|
|
11
|
+
metricsFile: z.ZodOptional<z.ZodString>;
|
|
9
12
|
}, z.core.$strip>;
|
|
10
13
|
export type CompareParams = z.infer<typeof compareSchema>;
|
|
11
14
|
export declare function compare(params: CompareParams): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/tools/compare.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/tools/compare.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa;;;;;;;iBAOxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,wBAAsB,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAiCnI;AAED,eAAO,MAAM,WAAW;IACtB,IAAI;IACJ,WAAW;IACX,OAAO;CACR,CAAC"}
|
package/build/tools/compare.js
CHANGED
|
@@ -7,16 +7,25 @@ import { parseCliOutput } from '../utils/parser.js';
|
|
|
7
7
|
import { formatError } from '../utils/errors.js';
|
|
8
8
|
export const compareSchema = z.object({
|
|
9
9
|
projectPath: z.string().describe('Path to MLoop project directory'),
|
|
10
|
-
experiments: z.array(z.string()).min(2).describe('Experiment IDs to compare (at least 2)'),
|
|
10
|
+
experiments: z.array(z.string()).min(2).optional().describe('Experiment IDs to compare (at least 2; leave out to compare the model\'s completed experiments)'),
|
|
11
11
|
modelName: z.string().optional().describe('Model name'),
|
|
12
|
+
best: z.number().int().positive().optional().describe('Compare only the top N experiments by metric (without experiments)'),
|
|
13
|
+
metric: z.string().optional().describe('Rank by this metric instead of the one the model was trained to optimize'),
|
|
14
|
+
metricsFile: z.string().optional().describe('Rank candidates from a JSON file of metrics, with no MLoop project needed (an external system of record\'s candidates): [{"id": ..., "metrics": {...}}, ...]'),
|
|
12
15
|
});
|
|
13
16
|
export async function compare(params) {
|
|
14
17
|
try {
|
|
15
|
-
const { projectPath, experiments, modelName } = params;
|
|
18
|
+
const { projectPath, experiments = [], modelName, best, metric, metricsFile } = params;
|
|
16
19
|
const args = ['compare', ...experiments, '--json'];
|
|
17
20
|
if (modelName) {
|
|
18
21
|
args.push('--name', modelName);
|
|
19
22
|
}
|
|
23
|
+
if (best !== undefined)
|
|
24
|
+
args.push('--best', String(best));
|
|
25
|
+
if (metric)
|
|
26
|
+
args.push('--metric', metric);
|
|
27
|
+
if (metricsFile)
|
|
28
|
+
args.push('--metrics-file', metricsFile);
|
|
20
29
|
const result = await executeMloop(args, {
|
|
21
30
|
cwd: projectPath,
|
|
22
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/tools/compare.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IACnE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/tools/compare.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IACnE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC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C;QAEH,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE7C,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM,IAAI,+BAA+B;iBAChD,CAAC;SACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;iBACzB,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,oFAAoF;IACjG,OAAO,EAAE,OAAO;CACjB,CAAC"}
|
package/build/tools/detect.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const detectSchema: z.ZodObject<{
|
|
|
8
8
|
threshold: z.ZodOptional<z.ZodNumber>;
|
|
9
9
|
sensitivity: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
output: z.ZodOptional<z.ZodString>;
|
|
11
|
+
records: z.ZodOptional<z.ZodString>;
|
|
11
12
|
}, z.core.$strip>;
|
|
12
13
|
export type DetectParams = z.infer<typeof detectSchema>;
|
|
13
14
|
export declare function detect(params: DetectParams): Promise<{
|