@delta-infra/cli 1.1.15 → 1.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +506 -493
  2. package/checksums.txt +5 -5
  3. package/package.json +1 -1
  4. package/scripts/install-wizard.js +701 -701
  5. package/scripts/install.js +442 -442
  6. package/scripts/run.js +65 -65
  7. package/skills/delta-sandbox/SKILL.md +388 -386
  8. package/skills/delta-sandbox/agents/openai.yaml +4 -4
  9. package/skills/delta-sandbox/references/commands.md +58 -58
  10. package/skills/delta-sandbox/references/lifecycle.md +100 -100
  11. package/skills/delta-sandbox/references/recipes.md +138 -138
  12. package/skills/delta-science/AGENTS.md +47 -47
  13. package/skills/delta-science/SKILL.md +185 -182
  14. package/skills/delta-science/agents/openai.yaml +4 -4
  15. package/skills/delta-science/references/antbo.md +100 -100
  16. package/skills/delta-science/references/delta-bo.md +89 -89
  17. package/skills/delta-science/references/gsasii.md +116 -116
  18. package/skills/delta-science/references/lammps.md +66 -66
  19. package/skills/delta-science/references/ldm-bo.md +129 -129
  20. package/skills/delta-science/references/materials-design.md +118 -118
  21. package/skills/delta-science/references/pubchem.md +126 -126
  22. package/skills/delta-science/references/pymatgen.md +68 -68
  23. package/skills/delta-science/references/qe.md +125 -125
  24. package/skills/delta-science/references/rdkit.md +138 -138
  25. package/skills/delta-science/references/strbo.md +87 -87
  26. package/skills/delta-science/references/synbo.md +198 -198
  27. package/skills/delta-science/references/xrd.md +186 -0
  28. package/skills/delta-science/scripts/catalog.py +92 -92
  29. package/skills/delta-science/scripts/generated_catalog.py +69 -69
  30. package/skills/delta-science/scripts/invoke.py +346 -346
  31. package/skills/delta-shared/SKILL.md +111 -111
  32. package/skills/delta-shared/agents/openai.yaml +4 -4
  33. package/skills/manifest.json +19 -19
@@ -1,198 +1,198 @@
1
- # SynBO operation 参考
2
-
3
- 所有在线调用都通过 `delta-cli science invoke`,服务地址来自 CLI 的标准
4
- `base_url` 派生配置(`{base_url}/science_tool`)。这里的路径只说明业务 operation,不得据此直连 HTTP。
5
-
6
- 用户说“优化反应条件”“推荐下一批实验”“偶联反应怎么继续做”,或给出溶剂、温度、
7
- 催化剂、碱、配体和历史得率时,即使没有提到 SynBO、BO、CLI 或字段名也使用本节。
8
- 每个用户任务最多一次 SynBO 业务调用;成功后立即结束,validation、502、504、
9
- timeout、断连或空 recommendations 均不得换参数、换模型或重试。
10
-
11
- ## Health
12
-
13
- operation:`health`,无 body。
14
-
15
- Reports SynBO import status, Torch/CUDA runtime availability, service limits,
16
- default device, and visible CUDA devices.
17
-
18
- Important fields inside gateway `data`:
19
-
20
- ```json
21
- {
22
- "status": "ok",
23
- "synbo_available": true,
24
- "metadata": {
25
- "service": "synbo-service",
26
- "engine": "synbo",
27
- "version": "0.1.0",
28
- "synbo_version": "0.1.0",
29
- "default_device": "cpu",
30
- "cuda_visible_devices": ""
31
- },
32
- "limits": {
33
- "max_batch_size": 128,
34
- "max_reaction_space_size": 200000,
35
- "max_previous_rows": 10000
36
- },
37
- "runtime": {
38
- "torch_available": true,
39
- "cuda_available": false,
40
- "cuda_device_count": 0,
41
- "cuda_device_names": []
42
- },
43
- "warnings": []
44
- }
45
- ```
46
-
47
- ## Initialize
48
-
49
- operation:`initialize`。
50
-
51
- Use for initial condition sampling when no measured previous results exist.
52
-
53
- Request body:
54
-
55
- ```json
56
- {
57
- "condition_dict": {
58
- "catalyst": ["Pd(OAc)2", "Pd(PPh3)4", "Pd2(dba)3"],
59
- "solvent": ["THF", "Dioxane", "Toluene"],
60
- "base": ["K2CO3", "NaOEt", "DBU"]
61
- },
62
- "opt_metrics": ["yield"],
63
- "opt_metric_settings": [
64
- {"opt_direct": "max", "opt_range": [0, 100], "metric_weight": 1.0}
65
- ],
66
- "batch_size": 3,
67
- "sampling_method": "random",
68
- "desc_normalize": "minmax",
69
- "random_seed": 42
70
- }
71
- ```
72
-
73
- Supported `sampling_method` values: `sobol`, `random`, `lhs`, `kmeans`.
74
-
75
- ## Optimize
76
-
77
- operation:`optimize`。
78
-
79
- Use after measured experiment rows are available. Each previous row must contain
80
- all condition columns and all objective metric columns.
81
-
82
- Request body:
83
-
84
- ```json
85
- {
86
- "condition_dict": {
87
- "catalyst": ["Pd(OAc)2", "Pd(PPh3)4", "Pd2(dba)3"],
88
- "solvent": ["THF", "Dioxane", "Toluene"],
89
- "base": ["K2CO3", "NaOEt", "DBU"]
90
- },
91
- "opt_metrics": ["yield"],
92
- "previous_results": [
93
- {"batch": 0, "catalyst": "Pd(OAc)2", "solvent": "THF", "base": "K2CO3", "yield": 42.0},
94
- {"batch": 0, "catalyst": "Pd(PPh3)4", "solvent": "Dioxane", "base": "NaOEt", "yield": 55.0},
95
- {"batch": 0, "catalyst": "Pd2(dba)3", "solvent": "Toluene", "base": "DBU", "yield": 63.0}
96
- ],
97
- "batch_size": 2,
98
- "accuracy": "tiny",
99
- "surrogate_model": "RF",
100
- "acq_func": "UCB",
101
- "device": "cpu",
102
- "random_seed": 42
103
- }
104
- ```
105
-
106
- ### 数值条件必须先离散化
107
-
108
- SynBO 的 `condition_dict` 只接受显式列表,不接受连续范围对象。对于“温度
109
- 40–100°C、催化剂用量 0.5–2.0%”并已有 60/70/80/90°C 与
110
- 0.5/1.0/1.5/2.0% 历史值的任务,使用:
111
-
112
- ```json
113
- {
114
- "condition_dict": {
115
- "solvent": ["ethanol", "acetonitrile", "DMSO"],
116
- "temperature_C": ["40", "60", "70", "80", "90", "100"],
117
- "catalyst_loading_pct": ["0.5", "1.0", "1.5", "2.0"]
118
- },
119
- "opt_metrics": ["yield"],
120
- "previous_results": [
121
- {
122
- "batch": 0,
123
- "solvent": "ethanol",
124
- "temperature_C": "60",
125
- "catalyst_loading_pct": "1.0",
126
- "yield": 55.0
127
- }
128
- ],
129
- "batch_size": 3,
130
- "accuracy": "tiny",
131
- "surrogate_model": "RF",
132
- "acq_func": "UCB",
133
- "device": "cpu",
134
- "random_seed": 42
135
- }
136
- ```
137
-
138
- 约束:
139
-
140
- - 每个条件值统一为字符串,objective metric 保持数值。
141
- - 每条 `previous_results` 中的条件值必须出现在对应 `condition_dict` 列表中。
142
- - 连续范围的离散网格必须包含用户上下界和全部历史观测值;最终答案必须说明实际网格。
143
- - 将条件值显式序列化为字符串,并确保每条历史记录只使用 `condition_dict` 中列出的值。
144
- 如需小数据 CPU 设置,显式传递 `accuracy:"tiny"`、`surrogate_model:"RF"`、
145
- `acq_func:"UCB"` 和 `device:"cpu"`;不得假定客户端会补充默认值。
146
-
147
- Useful optional fields:
148
-
149
- - `accuracy`: `tiny`, `low`, `medium`, `high`, or `ultra`.
150
- - `acq_func`: `EHVI`, `UCB`, `ParEGO`, or `NEI`.
151
- - `surrogate_model`: `GP`, `RF`, `BNN`, or `BayesianLinear`.
152
- - `device`: `cpu`, `auto`, `cuda`, or `cuda:0`.
153
- - `cuda_visible_devices`: request-level CUDA visibility hint. Use only when the
154
- user explicitly asks for it and `/health` indicates a CUDA-capable runtime.
155
- - `constraints`: map condition type to prohibited values.
156
-
157
- ## Descriptors
158
-
159
- If omitted, SynBO uses generated OneHot descriptors. To provide descriptors:
160
-
161
- ```json
162
- {
163
- "descriptors": {
164
- "solvent": [
165
- {"name": "THF", "polarity": 0.207, "boiling_point_C": 66.0},
166
- {"name": "Toluene", "polarity": 0.099, "boiling_point_C": 110.6}
167
- ]
168
- },
169
- "descriptor_index_col": "name"
170
- }
171
- ```
172
-
173
- `descriptors` must contain exactly the same keys as `condition_dict`. Descriptor
174
- rows must include the configured index column and numeric descriptor columns.
175
-
176
- ## Error Handling
177
-
178
- Gateway errors have the standard envelope:
179
-
180
- ```json
181
- {
182
- "code": 1,
183
- "message": "SynBO service returned HTTP 400",
184
- "data": {
185
- "endpoint": "/synbo/optimize",
186
- "synbo_response": {
187
- "detail": "previous_results is missing metric columns: ['yield']"
188
- }
189
- }
190
- }
191
- ```
192
-
193
- 常见原因包括条件空间过大、条件值重复、历史条件值不在 condition_dict 中、
194
- descriptor 非数值、历史行缺列、metric 非数值,以及无 GPU 时请求 CUDA。
195
-
196
- 服务端有独立于客户端的单次请求时限。GP、EHVI、高 accuracy 或共享资源繁忙可能导致
197
- timeout。普通用户任务中不得自动换参数重试;应报告“未产生推荐”,保留本次错误,
198
- 由用户决定是否另起一次明确的回归测试。
1
+ # SynBO operation 参考
2
+
3
+ 所有在线调用都通过 `delta-cli science invoke`,服务地址来自 CLI 的标准
4
+ `base_url` 派生配置(`{base_url}/science_tool`)。这里的路径只说明业务 operation,不得据此直连 HTTP。
5
+
6
+ 用户说“优化反应条件”“推荐下一批实验”“偶联反应怎么继续做”,或给出溶剂、温度、
7
+ 催化剂、碱、配体和历史得率时,即使没有提到 SynBO、BO、CLI 或字段名也使用本节。
8
+ 每个用户任务最多一次 SynBO 业务调用;成功后立即结束,validation、502、504、
9
+ timeout、断连或空 recommendations 均不得换参数、换模型或重试。
10
+
11
+ ## Health
12
+
13
+ operation:`health`,无 body。
14
+
15
+ Reports SynBO import status, Torch/CUDA runtime availability, service limits,
16
+ default device, and visible CUDA devices.
17
+
18
+ Important fields inside gateway `data`:
19
+
20
+ ```json
21
+ {
22
+ "status": "ok",
23
+ "synbo_available": true,
24
+ "metadata": {
25
+ "service": "synbo-service",
26
+ "engine": "synbo",
27
+ "version": "0.1.0",
28
+ "synbo_version": "0.1.0",
29
+ "default_device": "cpu",
30
+ "cuda_visible_devices": ""
31
+ },
32
+ "limits": {
33
+ "max_batch_size": 128,
34
+ "max_reaction_space_size": 200000,
35
+ "max_previous_rows": 10000
36
+ },
37
+ "runtime": {
38
+ "torch_available": true,
39
+ "cuda_available": false,
40
+ "cuda_device_count": 0,
41
+ "cuda_device_names": []
42
+ },
43
+ "warnings": []
44
+ }
45
+ ```
46
+
47
+ ## Initialize
48
+
49
+ operation:`initialize`。
50
+
51
+ Use for initial condition sampling when no measured previous results exist.
52
+
53
+ Request body:
54
+
55
+ ```json
56
+ {
57
+ "condition_dict": {
58
+ "catalyst": ["Pd(OAc)2", "Pd(PPh3)4", "Pd2(dba)3"],
59
+ "solvent": ["THF", "Dioxane", "Toluene"],
60
+ "base": ["K2CO3", "NaOEt", "DBU"]
61
+ },
62
+ "opt_metrics": ["yield"],
63
+ "opt_metric_settings": [
64
+ {"opt_direct": "max", "opt_range": [0, 100], "metric_weight": 1.0}
65
+ ],
66
+ "batch_size": 3,
67
+ "sampling_method": "random",
68
+ "desc_normalize": "minmax",
69
+ "random_seed": 42
70
+ }
71
+ ```
72
+
73
+ Supported `sampling_method` values: `sobol`, `random`, `lhs`, `kmeans`.
74
+
75
+ ## Optimize
76
+
77
+ operation:`optimize`。
78
+
79
+ Use after measured experiment rows are available. Each previous row must contain
80
+ all condition columns and all objective metric columns.
81
+
82
+ Request body:
83
+
84
+ ```json
85
+ {
86
+ "condition_dict": {
87
+ "catalyst": ["Pd(OAc)2", "Pd(PPh3)4", "Pd2(dba)3"],
88
+ "solvent": ["THF", "Dioxane", "Toluene"],
89
+ "base": ["K2CO3", "NaOEt", "DBU"]
90
+ },
91
+ "opt_metrics": ["yield"],
92
+ "previous_results": [
93
+ {"batch": 0, "catalyst": "Pd(OAc)2", "solvent": "THF", "base": "K2CO3", "yield": 42.0},
94
+ {"batch": 0, "catalyst": "Pd(PPh3)4", "solvent": "Dioxane", "base": "NaOEt", "yield": 55.0},
95
+ {"batch": 0, "catalyst": "Pd2(dba)3", "solvent": "Toluene", "base": "DBU", "yield": 63.0}
96
+ ],
97
+ "batch_size": 2,
98
+ "accuracy": "tiny",
99
+ "surrogate_model": "RF",
100
+ "acq_func": "UCB",
101
+ "device": "cpu",
102
+ "random_seed": 42
103
+ }
104
+ ```
105
+
106
+ ### 数值条件必须先离散化
107
+
108
+ SynBO 的 `condition_dict` 只接受显式列表,不接受连续范围对象。对于“温度
109
+ 40–100°C、催化剂用量 0.5–2.0%”并已有 60/70/80/90°C 与
110
+ 0.5/1.0/1.5/2.0% 历史值的任务,使用:
111
+
112
+ ```json
113
+ {
114
+ "condition_dict": {
115
+ "solvent": ["ethanol", "acetonitrile", "DMSO"],
116
+ "temperature_C": ["40", "60", "70", "80", "90", "100"],
117
+ "catalyst_loading_pct": ["0.5", "1.0", "1.5", "2.0"]
118
+ },
119
+ "opt_metrics": ["yield"],
120
+ "previous_results": [
121
+ {
122
+ "batch": 0,
123
+ "solvent": "ethanol",
124
+ "temperature_C": "60",
125
+ "catalyst_loading_pct": "1.0",
126
+ "yield": 55.0
127
+ }
128
+ ],
129
+ "batch_size": 3,
130
+ "accuracy": "tiny",
131
+ "surrogate_model": "RF",
132
+ "acq_func": "UCB",
133
+ "device": "cpu",
134
+ "random_seed": 42
135
+ }
136
+ ```
137
+
138
+ 约束:
139
+
140
+ - 每个条件值统一为字符串,objective metric 保持数值。
141
+ - 每条 `previous_results` 中的条件值必须出现在对应 `condition_dict` 列表中。
142
+ - 连续范围的离散网格必须包含用户上下界和全部历史观测值;最终答案必须说明实际网格。
143
+ - 将条件值显式序列化为字符串,并确保每条历史记录只使用 `condition_dict` 中列出的值。
144
+ 如需小数据 CPU 设置,显式传递 `accuracy:"tiny"`、`surrogate_model:"RF"`、
145
+ `acq_func:"UCB"` 和 `device:"cpu"`;不得假定客户端会补充默认值。
146
+
147
+ Useful optional fields:
148
+
149
+ - `accuracy`: `tiny`, `low`, `medium`, `high`, or `ultra`.
150
+ - `acq_func`: `EHVI`, `UCB`, `ParEGO`, or `NEI`.
151
+ - `surrogate_model`: `GP`, `RF`, `BNN`, or `BayesianLinear`.
152
+ - `device`: `cpu`, `auto`, `cuda`, or `cuda:0`.
153
+ - `cuda_visible_devices`: request-level CUDA visibility hint. Use only when the
154
+ user explicitly asks for it and `/health` indicates a CUDA-capable runtime.
155
+ - `constraints`: map condition type to prohibited values.
156
+
157
+ ## Descriptors
158
+
159
+ If omitted, SynBO uses generated OneHot descriptors. To provide descriptors:
160
+
161
+ ```json
162
+ {
163
+ "descriptors": {
164
+ "solvent": [
165
+ {"name": "THF", "polarity": 0.207, "boiling_point_C": 66.0},
166
+ {"name": "Toluene", "polarity": 0.099, "boiling_point_C": 110.6}
167
+ ]
168
+ },
169
+ "descriptor_index_col": "name"
170
+ }
171
+ ```
172
+
173
+ `descriptors` must contain exactly the same keys as `condition_dict`. Descriptor
174
+ rows must include the configured index column and numeric descriptor columns.
175
+
176
+ ## Error Handling
177
+
178
+ Gateway errors have the standard envelope:
179
+
180
+ ```json
181
+ {
182
+ "code": 1,
183
+ "message": "SynBO service returned HTTP 400",
184
+ "data": {
185
+ "endpoint": "/synbo/optimize",
186
+ "synbo_response": {
187
+ "detail": "previous_results is missing metric columns: ['yield']"
188
+ }
189
+ }
190
+ }
191
+ ```
192
+
193
+ 常见原因包括条件空间过大、条件值重复、历史条件值不在 condition_dict 中、
194
+ descriptor 非数值、历史行缺列、metric 非数值,以及无 GPU 时请求 CUDA。
195
+
196
+ 服务端有独立于客户端的单次请求时限。GP、EHVI、高 accuracy 或共享资源繁忙可能导致
197
+ timeout。普通用户任务中不得自动换参数重试;应报告“未产生推荐”,保留本次错误,
198
+ 由用户决定是否另起一次明确的回归测试。
@@ -0,0 +1,186 @@
1
+ # XRD Cloud Compute 详细规则
2
+
3
+ `xrd` 是通过 Science 工具代理访问 XRD cloud compute 的真实工具。所有调用必须经由
4
+ `delta-cli`,禁止使用 broker URL、`curl`、`requests`、`httpx`、浏览器或本地 XRD
5
+ 科学库绕过 CLI。本文是 `delta-science` 的工具 reference,不是第二套 HTTP 客户端。
6
+
7
+ ## 工具与 endpoint
8
+
9
+ 执行前使用实时目录确认当前环境中的 canonical 名称和启用状态:
10
+
11
+ ```text
12
+ delta-cli science list
13
+ delta-cli science endpoints list xrd
14
+ ```
15
+
16
+ `xrd` endpoint 名称必须逐字取自第二条命令的结果。当前 reference 覆盖以下稳定契约:
17
+
18
+ | endpoint | 方法/用途 | 请求类型 |
19
+ | --- | --- | --- |
20
+ | `healthz`、`readyz`、`capabilities`、`xmatcher-status` | 就绪、能力和数据库状态 | 只读 JSON |
21
+ | `xmatcher-artifacts` | 上传观测曲线、模型输入、CIF 或仪器参数 | `invoke --file` |
22
+ | `xmatcher-artifact`、`xmatcher-artifact-content` | 查询/读取 artifact | `invoke --path-params` |
23
+ | `xqueryer-predictions` | XQueryer 单相候选预测 | JSON |
24
+ | `xmatcher-detect-peaks`、`xmatcher-match` | 峰检测和单相匹配 | JSON |
25
+ | `xmatcher-multiphase-match`、`xdecomposer-predictions` | 多相匹配和相分解 | JSON |
26
+ | `xmatcher-cif-xrd`、`xmatcher-pdf-peaks-xlsx` | CIF 模拟及 PDF 峰表导出 | JSON/二进制 |
27
+ | `xmatcher-refinement-patterns` | 生成精修输入和 provenance manifest | JSON |
28
+ | `refinement-fullprof`、`refinement-gsasii`、`refinement-wpem` | 提交对应后端精修作业 | JSON + header |
29
+ | `refinement-job`、`refinement-job-events`、`refinement-job-artifacts` | 查询精修作业 | `invoke --path-params` |
30
+ | `refinement-job-cancel` | 请求取消精修作业 | `invoke --path-params` |
31
+ | `mp500-cif-exports` | MP500 结构导出为 CIF | JSON |
32
+
33
+ 目录是最终权威。若 endpoint 不在实时目录中,停止并报告配置问题,不改名重试。
34
+
35
+ ## CLI 参数映射
36
+
37
+ ```text
38
+ --data 上游 JSON body
39
+ --params 上游 URL query 参数
40
+ --path-params 替换 endpoint path 中的 {artifact_id}/{job_id}
41
+ --headers 额外上游请求头,例如 Idempotency-Key
42
+ --file 将本地文件通过 file_base64 传给工具代理
43
+ --content-type file 的原始 MIME 类型
44
+ ```
45
+
46
+ `--params` 不能替代 `--path-params`。不要把本地路径、base64、路径参数或幂等键塞进
47
+ 普通业务 `--data`。`science file` 是 QE/Materials Design 等独立文件接口;XRD 的
48
+ `xmatcher-artifacts` 属于工具代理 endpoint,应使用 `science invoke --file`。
49
+
50
+ ## 调用顺序
51
+
52
+ 1. 用户明确要求诊断或执行时,先读取 `healthz`;需要选择后端时再读取
53
+ `capabilities`。
54
+ 2. 通过 `xmatcher-artifacts` 上传真实文件,保存返回的 `artifact_id` 和 `sha256`。
55
+ 3. 观测数据使用 `xmatcher-match`、`xmatcher-multiphase-match` 或
56
+ `xdecomposer-predictions`;XQueryer 使用 `model_input_pattern`。
57
+ 4. CIF 模拟使用 `xmatcher-cif-xrd`;精修先调用 `xmatcher-refinement-patterns`,再选择
58
+ 与 `data.backends` 一致的 refinement endpoint。
59
+ 5. 精修提交后用 `refinement-job`、`refinement-job-events` 和
60
+ `refinement-job-artifacts` 读取状态和产物。
61
+
62
+ 不要把服务返回的 queued、scheduler completed 或 backend success 直接描述成科学结论。
63
+ 精修至少分开报告传输/作业终态、后端执行状态和科学接受状态。
64
+
65
+ ## 就绪检查
66
+
67
+ ```text
68
+ delta-cli science invoke --tool xrd --endpoint healthz
69
+ delta-cli science invoke --tool xrd --endpoint capabilities
70
+ ```
71
+
72
+ 只有需要诊断或用户明确要求时才额外调用 readiness/status。能力结果中的每个所需组件
73
+ 都必须满足 `available`;生产任务还应检查 `asset_release_approved`、checksum 字段和
74
+ warnings。`auto` 不代表实际使用 GPU,只有结果明确返回 GPU backend 才能这样报告。
75
+
76
+ ## Artifact 上传与身份
77
+
78
+ 上传观测曲线:
79
+
80
+ ```text
81
+ delta-cli science invoke --tool xrd --endpoint xmatcher-artifacts `
82
+ --file observed.csv `
83
+ --params '{"filename":"observed.csv","kind":"observed_pattern","media_type":"text/csv"}' `
84
+ --content-type application/octet-stream
85
+ ```
86
+
87
+ 允许的 `kind` 为:`observed_pattern`、`model_input_pattern`、`cif`、
88
+ `instrument_parameters`。成功响应中的 `artifact_id` 和 `sha256` 必须成对保存并原样
89
+ 传给下游。模式文件会在服务端标准化,返回的 digest 是标准化 artifact 的 digest,
90
+ 不是一定等于本地上传字节的 digest。
91
+
92
+ 查询 artifact 时使用路径参数:
93
+
94
+ ```text
95
+ delta-cli science invoke --tool xrd --endpoint xmatcher-artifact `
96
+ --path-params '{"artifact_id":"art_<returned-id>"}'
97
+ ```
98
+
99
+ 二进制内容响应可能返回 `data._binary=true`、`content_base64`、`media_type` 和
100
+ `content_length`。只有用户要求保存或工作流需要时才解码,并按服务返回的 SHA-256
101
+ 校验;不要凭文件名猜测格式。
102
+
103
+ ## 相识别与匹配
104
+
105
+ XQueryer 的 `model_input_pattern` 必须正好包含 3500 个样本,覆盖 10 到 90 度 2theta,
106
+ 强度不超过服务能力限制:
107
+
108
+ ```text
109
+ delta-cli science invoke --tool xrd --endpoint xqueryer-predictions `
110
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<model>","sha256":"<sha>"},"top_k":10,"radiation_profile":"CuKa"}'
111
+ ```
112
+
113
+ XMatcher 观测曲线:
114
+
115
+ ```text
116
+ delta-cli science invoke --tool xrd --endpoint xmatcher-match `
117
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha>"},"top_n":10,"element_filter_mode":"contains"}'
118
+ ```
119
+
120
+ 多相匹配:
121
+
122
+ ```text
123
+ delta-cli science invoke --tool xrd --endpoint xmatcher-multiphase-match `
124
+ --data '{"schema_version":1,"pattern":{"artifact_id":"art_<observed>","sha256":"<sha>"},"max_phases":3,"candidate_pool":8}'
125
+ ```
126
+
127
+ `xqueryer-predictions` 的 `score` 是 softmax probability;XMatcher 的 `score` 是
128
+ `raw_score / 100`。两者不可直接平均或当作同一校准概率。
129
+
130
+ ## CIF 模拟与峰表
131
+
132
+ `cifs` 中的每个 artifact 都必须同时提供 `artifact_id` 和 `sha256`:
133
+
134
+ ```text
135
+ delta-cli science invoke --tool xrd --endpoint xmatcher-cif-xrd `
136
+ --data '{"schema_version":1,"cifs":[{"artifact":{"artifact_id":"art_<cif>","sha256":"<sha>"},"name":"phase"}],"two_theta_range":[5.0,90.0],"wavelength":"CuKa"}'
137
+ ```
138
+
139
+ `xmatcher-pdf-peaks-xlsx` 返回二进制 XLSX;只有用户要求导出时才读取和保存它。
140
+
141
+ ## 精修作业
142
+
143
+ 先生成校正曲线和 provenance manifest:
144
+
145
+ ```text
146
+ delta-cli science invoke --tool xrd --endpoint xmatcher-refinement-patterns `
147
+ --data '{"schema_version":1,"source_pattern":{"artifact_id":"art_<observed>","sha256":"<sha>"}}'
148
+ ```
149
+
150
+ 然后使用与 `data.backends` 匹配的 endpoint。示例结构如下,所有 artifact 身份必须来自
151
+ 当前调用链:
152
+
153
+ ```text
154
+ delta-cli science invoke --tool xrd --endpoint refinement-gsasii `
155
+ --data '{"schema_version":1,"radiation_profile":"CuKa","refinement_pattern":{"observed_pattern":{"artifact_id":"art_<obs>","sha256":"<sha>"},"corrected_pattern":{"artifact_id":"art_<corrected>","sha256":"<sha>"},"provenance_manifest":{"artifact_id":"art_<manifest>","sha256":"<sha>"}},"phases":[{"phase_index":0,"name":"phase","cif":{"artifact_id":"art_<cif>","sha256":"<sha>"}}],"wavelengths_angstrom":[1.540593,1.544414],"backends":["gsasii"]}' `
156
+ --headers '{"Idempotency-Key":"<stable-unique-key>"}'
157
+ ```
158
+
159
+ `refinement-fullprof`、`refinement-gsasii`、`refinement-wpem` 选择计费/后端入口;不要
160
+ 因为它们映射到同一路径就互换 endpoint 名或 `backends`。提交、取消、重试和审核是
161
+ 远端变更,必须得到用户明确授权;超时或连接中断时不要盲目重试,先查询是否已经创建
162
+ 作业。
163
+
164
+ 查询作业时:
165
+
166
+ ```text
167
+ delta-cli science invoke --tool xrd --endpoint refinement-job `
168
+ --path-params '{"job_id":"refjob_<returned-id>"}'
169
+
170
+ delta-cli science invoke --tool xrd --endpoint refinement-job-events `
171
+ --path-params '{"job_id":"refjob_<returned-id>"}'
172
+ ```
173
+
174
+ ## 结果与错误
175
+
176
+ - 只有 CLI 退出码为 0 且顶层 JSON `ok` 为 `true` 才算调用成功。
177
+ - 原样保留服务返回的 `data`、warnings、错误 detail 和稳定错误码。
178
+ - `202`、`queued` 或 `running` 只代表作业接收/执行状态,不代表 solver 收敛或科学接受。
179
+ - `TIER_CONCURRENCY_EXCEEDED`、`Endpoint is disabled`、`ARTIFACT_MISSING`、
180
+ `MP500_IDENTITY_MISMATCH` 等错误应停止当前调用链并报告原始 detail;不要换 endpoint、
181
+ 改名、猜参数或用本地算法替代。
182
+ - 付费 endpoint 的价格和可用状态以实时目录为准;执行前确认用户确实要求该业务调用。
183
+
184
+ 证据边界:仅限当前 Delta CLI `data` 中的业务结果。
185
+ 调用链:`delta-cli`。
186
+ 禁止补充未返回内容:是。