@zhuoyuezs/ml-platform 0.2.3-alpha.1 → 0.2.3-alpha.2

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 CHANGED
@@ -107,6 +107,12 @@ ml-platform build-dataset /absolute/path/to/manifest.json --wait
107
107
  ml-platform --help
108
108
  ```
109
109
 
110
+ 定时预测上报的目标配置使用 `ml_data_platform.destination_profile/v2`
111
+ 和声明式 `payload_mapping`。在启用计划前,可用
112
+ `ml-platform preview-destination-profile PROFILE_JSON STANDARD_PAYLOAD_JSON`
113
+ 查看映射后的请求体;具体合同和暂停/恢复流程见随包安装的
114
+ `prediction-report-management` Skill。旧 v1 Profile 不可在 v2 API 上执行。
115
+
110
116
  Dataset 查询和 `list-deployments` 直接使用远程 Registry/API,适合 Agent 对已发布版本执行发现、只读诊断和
111
117
  受控构建,不要求本地存在 Catalog。`apply`、`resolve-manifest` 和带本地 JSON 路径的
112
118
  `build-dataset` 用于新契约的编写和发布流程。
package/checksums.json CHANGED
@@ -2,17 +2,17 @@
2
2
  "files": [
3
3
  {
4
4
  "path": "runtime/business-client/README.md",
5
- "sha256": "sha256:f03d10f0de78e4ff456a6718b5b74b7fd001598f5a5963985d97d0b99403c0a5",
6
- "size_bytes": 12756
5
+ "sha256": "sha256:e0bf5707e13eb8bc36b530741a476827eef8263f23ff796f064dc0bfae9a8bfb",
6
+ "size_bytes": 14154
7
7
  },
8
8
  {
9
9
  "path": "runtime/business-client/package-lock.json",
10
- "sha256": "sha256:ebc31820ae0d2985879efd87ba4b0d8843e44a175d4c9e1dc557737893f8bdae",
10
+ "sha256": "sha256:fcc57e214724294f6208ec192dbe42b9cabbb6324945b0e93471bf991f76f0bc",
11
11
  "size_bytes": 1628
12
12
  },
13
13
  {
14
14
  "path": "runtime/business-client/package.json",
15
- "sha256": "sha256:4685ca172b5b23bd5de53bcccbd7f7412df281eff67533d72d1b598c63a28b47",
15
+ "sha256": "sha256:61b2a01e7611af07ad49a1789cbaddb5f8ec36d70b78ef72d54227039990e8dc",
16
16
  "size_bytes": 671
17
17
  },
18
18
  {
@@ -22,8 +22,8 @@
22
22
  },
23
23
  {
24
24
  "path": "runtime/business-client/src/cli.js",
25
- "sha256": "sha256:ecdc7d2e93323a4dd04514573219061f54db6583d955dfa82afc482abcd3335a",
26
- "size_bytes": 66532
25
+ "sha256": "sha256:3913154693561ea4cea1538f560bf5e4f4b4488398abf69332f23f302481ee04",
26
+ "size_bytes": 66966
27
27
  },
28
28
  {
29
29
  "path": "runtime/business-client/src/config.js",
@@ -192,8 +192,8 @@
192
192
  },
193
193
  {
194
194
  "path": "skills/prediction-report-management/SKILL.md",
195
- "sha256": "sha256:32abad9d9a152680d126cf1fa3df921a367a9ad9eb0aaaf3ce48b05538b4fbd5",
196
- "size_bytes": 4365
195
+ "sha256": "sha256:35242893137502ece779eb3b66f0d5a2e36d10dd944af5e2fead20547c7866e3",
196
+ "size_bytes": 5923
197
197
  },
198
198
  {
199
199
  "path": "skills/prediction-report-management/agents/openai.yaml",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhuoyuezs/ml-platform",
3
- "version": "0.2.3-alpha.1",
3
+ "version": "0.2.3-alpha.2",
4
4
  "description": "ML 数据平台 business CLI 与 Agent Skills 管理工具",
5
5
  "bin": {
6
6
  "ml-platform": "scripts/main.js"
package/release.json CHANGED
@@ -13,8 +13,8 @@
13
13
  "entrypoint": "src/cli.js",
14
14
  "name": "ml-platform",
15
15
  "path": "runtime/business-client",
16
- "sha256": "sha256:eaa88929b414e386294287009b4ecb25e26d1eb39403469ef649af145b2208de",
17
- "version": "0.8.3"
16
+ "sha256": "sha256:a002eb1fb35605ad13ad071b2131233fd4b798e3438984ae1c4c6f4ddf262902",
17
+ "version": "0.8.4"
18
18
  },
19
19
  "policy_sha256": "sha256:02fbde0134696b78c0c365d6e0b76c9814227208da5b2b3d4e5dbd82dc4a3606",
20
20
  "public_schema_versions": [
@@ -25,7 +25,7 @@
25
25
  "ml_data_platform.feature_set/v1",
26
26
  "ml_data_platform.dataset_manifest/v1"
27
27
  ],
28
- "release_version": "0.2.3-alpha.1",
28
+ "release_version": "0.2.3-alpha.2",
29
29
  "runtime_requirements": {
30
30
  "node": ">=18",
31
31
  "os": [
@@ -37,34 +37,34 @@
37
37
  "skills": {
38
38
  "data-source-exploration": {
39
39
  "path": "skills/data-source-exploration",
40
- "requires_cli": ">=0.8.3 <0.9.0",
41
- "revision": "0.2.3-alpha.1",
40
+ "requires_cli": ">=0.8.4 <0.9.0",
41
+ "revision": "0.2.3-alpha.2",
42
42
  "sha256": "sha256:2fa1e1802d799ee0c47b10263f2fde57b604e505fea5c98bfa23f51f382bbf69"
43
43
  },
44
44
  "feature-management": {
45
45
  "path": "skills/feature-management",
46
- "requires_cli": ">=0.8.3 <0.9.0",
47
- "revision": "0.2.3-alpha.1",
46
+ "requires_cli": ">=0.8.4 <0.9.0",
47
+ "revision": "0.2.3-alpha.2",
48
48
  "sha256": "sha256:6dfa708172c3b5b23af75997c82a6d43bc2eb8ca67cc2275c8b95022455b0c42"
49
49
  },
50
50
  "model-deployment-management": {
51
51
  "path": "skills/model-deployment-management",
52
- "requires_cli": ">=0.8.3 <0.9.0",
53
- "revision": "0.2.3-alpha.1",
52
+ "requires_cli": ">=0.8.4 <0.9.0",
53
+ "revision": "0.2.3-alpha.2",
54
54
  "sha256": "sha256:d3f3fe0e4a11b93d8f6f57758164aa236b84a49c1b9f0d0b700fd9d6d615a8d7"
55
55
  },
56
56
  "model-lifecycle-management": {
57
57
  "path": "skills/model-lifecycle-management",
58
- "requires_cli": ">=0.8.3 <0.9.0",
59
- "revision": "0.2.3-alpha.1",
58
+ "requires_cli": ">=0.8.4 <0.9.0",
59
+ "revision": "0.2.3-alpha.2",
60
60
  "sha256": "sha256:8822fbec7037c2312d18b1d18648b60757fc569e6bf5f2856ea41592f3ba987d"
61
61
  },
62
62
  "prediction-report-management": {
63
63
  "path": "skills/prediction-report-management",
64
- "requires_cli": ">=0.8.3 <0.9.0",
65
- "revision": "0.2.3-alpha.1",
66
- "sha256": "sha256:a0210cd93244bce41e5b71f8dc70c6c4a79973968cd22af7e0e0102eae3efaa3"
64
+ "requires_cli": ">=0.8.4 <0.9.0",
65
+ "revision": "0.2.3-alpha.2",
66
+ "sha256": "sha256:3a6991eec5cfa6bf30eaf43295f0c7d5c1e70e4f638904dfde1be2a39965d64f"
67
67
  }
68
68
  },
69
- "source_commit": "07c13464f3ed2c10644ba6707d329b54f48e725d"
69
+ "source_commit": "bd2e27ea798072563389c412ec4cae2a61296ba6"
70
70
  }
@@ -84,13 +84,27 @@ Deployment Controller 管理的部署,不把模型中心回写的 delivery 状
84
84
 
85
85
  ```json
86
86
  {
87
- "schema_version": "ml_data_platform.destination_profile/v1",
87
+ "schema_version": "ml_data_platform.destination_profile/v2",
88
88
  "name": "forecast_sink",
89
89
  "version": "v1",
90
90
  "environment": "test",
91
91
  "base_url": "https://integration.example.invalid/api",
92
92
  "path": "/forecast/report",
93
- "payload_mapping": "forecast-report-v1",
93
+ "payload_mapping": {
94
+ "schema_version": "ml_data_platform.report_mapping/v1",
95
+ "body": {
96
+ "deviceCode": {"source": "entity.site", "type": "string"},
97
+ "cutoffTime": {"source": "cutoff_time", "type": "string"},
98
+ "source": {"constant": "ITSMP", "type": "string"},
99
+ "values": {
100
+ "source": "predictions", "type": "array",
101
+ "items": {"fields": {
102
+ "time": {"source": "target_time", "type": "string"},
103
+ "value": {"source": "value", "type": "number", "scale": 1.0, "offset": 0.0}
104
+ }}
105
+ }
106
+ }
107
+ },
94
108
  "authentication": {
95
109
  "kind": "token_endpoint",
96
110
  "token_request": {
@@ -111,14 +125,22 @@ Deployment Controller 管理的部署,不把模型中心回写的 delivery 状
111
125
  }
112
126
  ```
113
127
 
114
- `token_path`、业务成功码和 `/forecast/report` 只是示例,必须按目标接口的真实响应和路径配置。
115
- 若响应提供有效期,可设置 `expires_in_path` 与 `expires_in_unit`;否则服务端默认按 7200 秒缓存,
128
+ 标准上下文包含 `run_id`、`schedule_id`、`deployment_id`、`deployment_revision`、`model_artifact_id`、
129
+ `cutoff_time`、`entity`、`horizon`、`output_window`、`prediction_hash` 和标准化的
130
+ `predictions`。每个 prediction point 至少包含 `series_index`、`value`,序列结果通常还包含
131
+ `target_time`。`source` 引用平台标准预测结果中的字段;`fields` 生成嵌套对象,`items` 将数组逐项转换,
132
+ `constant` 写入固定值,`template` 可拼接已存在的字符串字段。`format` 可格式化时间,
133
+ `scale` 和 `offset` 可执行受控数值换算,`type` 校验最终类型。`token_path`、业务成功码和
134
+ `/forecast/report` 只是示例,必须按目标接口的真实响应和路径配置。
135
+ 映射字段缺失或类型不匹配时不会发送请求,Run 会记录 `payload_mapping_failed`。若响应提供有效期,可设置 `expires_in_path` 与 `expires_in_unit`;否则服务端默认按 7200 秒缓存,
116
136
  并在 `refresh_skew_seconds` 前刷新。不同环境应使用不同 Profile 版本或名称;修改目标地址、
117
- 认证规则或凭据时创建新版本。`get`/`list` 只返回凭据已配置的脱敏标记,无法取回明文。
137
+ 认证规则、映射或凭据时创建新版本。`get`/`list` 只返回凭据已配置的脱敏标记,无法取回明文。
118
138
 
119
139
  ```bash
120
140
  ml-platform --profile server validate-destination-profile /absolute/path/to/profile.json
121
141
  ml-platform --profile server create-destination-profile /absolute/path/to/profile.json
142
+ ml-platform --profile server preview-destination-profile /absolute/path/to/profile.json \
143
+ /absolute/path/to/standard-prediction.json
122
144
  ml-platform --profile server list-destination-profiles --limit 50 --offset 0
123
145
  ml-platform --profile server get-destination-profile forecast_sink v1
124
146
  ```
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zhuoyuezs/ml-platform-business-client",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zhuoyuezs/ml-platform-business-client",
9
- "version": "0.8.3",
9
+ "version": "0.8.4",
10
10
  "license": "UNLICENSED",
11
11
  "bin": {
12
12
  "ml-platform": "src/cli.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhuoyuezs/ml-platform-business-client",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "private": true,
5
5
  "description": "JavaScript implementation of the ML Platform business client",
6
6
  "bin": {
@@ -40,7 +40,7 @@ const BUSINESS_COMMANDS = new Set([
40
40
  "get-deployment", "wait-deployment", "reconcile-deployment", "approve-deployment",
41
41
  "promote-deployment", "rollback-deployment", "suspend-deployment", "resume-deployment",
42
42
  "undeploy-deployment", "get-deployment-events", "predict-deployment",
43
- "validate-destination-profile", "create-destination-profile", "list-destination-profiles", "get-destination-profile",
43
+ "validate-destination-profile", "create-destination-profile", "preview-destination-profile", "list-destination-profiles", "get-destination-profile",
44
44
  "create-prediction-report-schedule", "list-prediction-report-schedules", "get-prediction-report-schedule",
45
45
  "update-prediction-report-schedule", "pause-prediction-report-schedule", "resume-prediction-report-schedule",
46
46
  "list-prediction-report-runs", "get-prediction-report-run",
@@ -172,6 +172,7 @@ const COMMAND_USAGE = {
172
172
  "predict-deployment": "predict-deployment DEPLOYMENT_ID REQUEST_JSON",
173
173
  "create-destination-profile": "create-destination-profile PROFILE_JSON",
174
174
  "validate-destination-profile": "validate-destination-profile PROFILE_JSON",
175
+ "preview-destination-profile": "preview-destination-profile PROFILE_JSON STANDARD_PAYLOAD_JSON",
175
176
  "list-destination-profiles": "list-destination-profiles [--limit N] [--offset N]",
176
177
  "get-destination-profile": "get-destination-profile NAME VERSION",
177
178
  "create-prediction-report-schedule": "create-prediction-report-schedule SCHEDULE_JSON",
@@ -877,6 +878,12 @@ async function runBusinessCli(argv) {
877
878
  else if (["create-destination-profile", "validate-destination-profile"].includes(options.command)) {
878
879
  result = await client(options).post(options.command === "create-destination-profile" ? "/destination-profiles" : "/destination-profiles/validate", readSpec(positional(rest, "profile JSON")));
879
880
  }
881
+ else if (options.command === "preview-destination-profile") {
882
+ result = await client(options).post("/destination-profiles/preview", {
883
+ profile: readSpec(positional(rest, "profile JSON")),
884
+ payload: readSpec(positional(rest, "standard payload JSON")),
885
+ });
886
+ }
880
887
  else if (options.command === "list-destination-profiles") {
881
888
  result = await listCollection(client(options), "/destination-profiles", {}, rest);
882
889
  }
@@ -29,26 +29,62 @@ policy. A report run may be `SKIPPED` when the selected revision is not READY.
29
29
  ## Configure a destination
30
30
 
31
31
  The `PROFILE_JSON` argument is a local JSON file, not inline JSON. Include
32
- `schema_version`, `name`, `version`, `base_url`, `path`, authentication, and
33
- response success rules as required by the target. For token-based auth, set
34
- `authentication.token_request` parameters and `token_path`; configure both
35
- token and report business success rules when HTTP 2xx alone is insufficient.
32
+ `schema_version: ml_data_platform.destination_profile/v2`, `name`,
33
+ `version`, `base_url`, `path`, a declarative
34
+ `payload_mapping`, authentication, and response success rules as required by
35
+ the target. For token-based auth, set `authentication.token_request` parameters
36
+ and `token_path`; configure both token and report business success rules when
37
+ HTTP 2xx alone is insufficient.
38
+
39
+ `payload_mapping` has `schema_version: ml_data_platform.report_mapping/v1`
40
+ and a non-empty `body` object. This maps each normalized prediction point:
41
+
42
+ ```json
43
+ {
44
+ "schema_version": "ml_data_platform.report_mapping/v1",
45
+ "body": {
46
+ "values": {
47
+ "source": "predictions",
48
+ "items": {"fields": {"value": {"source": "value", "type": "number"}}}
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ A point always has `series_index` and `value`; `target_time` is present only
55
+ when Serving returns it.
36
56
 
37
57
  ```bash
38
58
  ml-platform --profile server validate-destination-profile PROFILE_JSON
39
59
  ml-platform --profile server create-destination-profile PROFILE_JSON
60
+ ml-platform --profile server preview-destination-profile PROFILE_JSON STANDARD_PAYLOAD_JSON
40
61
  ml-platform --profile server get-destination-profile NAME v1
41
62
  ```
42
63
 
43
64
  Validation checks schema and local policy; it does **not** call the token or
44
65
  report endpoint. Versions are immutable. Changes to URL, auth, token extraction,
45
- or success rules require a new profile version and a schedule update to point
46
- to it. `get` and `list` redact credential values; they cannot reconstruct the
66
+ mapping, or success rules require a new profile version and a schedule update
67
+ to point to it. Profiles stored with the former v1 schema cannot be executed
68
+ under the v2 API; create a v2 profile and update the paused schedule first.
69
+ `get` and `list` redact credential values; they cannot reconstruct the
47
70
  original file. Keep credential-bearing JSON outside the repository, restrict
48
71
  file access, and do not print its contents or put secrets in shell arguments,
49
72
  logs, examples, or Agent answers. Destination URL and token credentials are
50
73
  business configuration submitted through this API, not Kubernetes Secrets.
51
74
 
75
+ Mapping sources use standard report fields such as `run_id`, `schedule_id`,
76
+ `deployment_id`, `cutoff_time`, `entity`, and `predictions`. Use `fields` for
77
+ nested objects, `items` for array conversion, `constant` for fixed values,
78
+ `template` for string composition, and `format`, `scale`, `offset`, and `type`
79
+ for bounded transformations and validation. Arbitrary code and expressions are
80
+ not supported. A missing field or type failure produces
81
+ `payload_mapping_failed` before any HTTP request is made.
82
+
83
+ Use `preview-destination-profile` with a standard prediction payload to inspect
84
+ the exact mapped business body before creating or enabling a schedule. Preview
85
+ does not call the token endpoint, does not send the report, and does not store
86
+ the profile or sample payload.
87
+
52
88
  ## Manage a schedule
53
89
 
54
90
  Creating a schedule starts reporting when `enabled` is true. Obtain explicit