@delta-infra/cli 1.0.80 → 1.0.82

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 (32) hide show
  1. package/README.md +429 -429
  2. package/checksums.txt +5 -5
  3. package/package.json +1 -1
  4. package/scripts/install-wizard.js +625 -625
  5. package/scripts/install.js +417 -417
  6. package/scripts/run.js +65 -65
  7. package/skills/delta-sandbox/SKILL.md +356 -356
  8. package/skills/delta-sandbox/agents/openai.yaml +4 -4
  9. package/skills/delta-sandbox/references/commands.md +56 -56
  10. package/skills/delta-sandbox/references/lifecycle.md +92 -92
  11. package/skills/delta-sandbox/references/recipes.md +133 -133
  12. package/skills/delta-science/SKILL.md +136 -150
  13. package/skills/delta-science/agents/openai.yaml +4 -4
  14. package/skills/delta-science/references/antbo.md +100 -100
  15. package/skills/delta-science/references/cli-contract.md +53 -83
  16. package/skills/delta-science/references/delta-bo.md +89 -90
  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 -130
  20. package/skills/delta-science/references/ldm.md +73 -72
  21. package/skills/delta-science/references/pubchem.md +126 -127
  22. package/skills/delta-science/references/pymatgen.md +68 -68
  23. package/skills/delta-science/references/rdkit.md +138 -139
  24. package/skills/delta-science/references/routing-index.md +36 -36
  25. package/skills/delta-science/references/strbo.md +87 -87
  26. package/skills/delta-science/references/synbo.md +198 -197
  27. package/skills/delta-science/references/workflows.md +61 -61
  28. package/skills/delta-shared/SKILL.md +95 -95
  29. package/skills/delta-shared/agents/openai.yaml +4 -4
  30. package/skills/manifest.json +19 -19
  31. package/skills/delta-science/scripts/catalog.py +0 -92
  32. package/skills/delta-science/scripts/invoke.py +0 -346
@@ -1,83 +1,53 @@
1
- # Delta CLI 执行约定
2
-
3
- ## 只能通过内置 wrapper 调用
4
-
5
- 实时 Science 调用只能由宿主可用的 shell 或 Python 执行内置 wrapper。先定位当前
6
- `SKILL.md` 所在目录,再执行该目录下 `scripts/invoke.py` 的绝对路径;不得直接执行
7
- `delta-cli`,也不得改用直接 HTTP。Claude Code 可使用 `CLAUDE_SKILL_DIR` 定位当前
8
- Skill;Codex 应以当前已加载 Skill 的目录为工作目录,或在已安装的 Skills 目录中查找
9
- 精确的 `delta-science/scripts/invoke.py`。不得依赖宿主私有环境变量。
10
-
11
- 使用 Python 执行 wrapper。下面的 `wrapper` 必须是上述方法定位到的绝对路径:
12
-
13
- ```python
14
- import json, subprocess, sys
15
-
16
- wrapper = "/absolute/path/to/delta-science/scripts/invoke.py"
17
- payload = {"input": "CCO", "format": "smiles"}
18
- completed = subprocess.run(
19
- [sys.executable, wrapper, "--tool", "rdkit", "--endpoint", "parse",
20
- "--data-json", json.dumps(payload, ensure_ascii=False)],
21
- capture_output=True, text=True, encoding="utf-8", errors="replace",
22
- timeout=150,
23
- )
24
- result = json.loads(completed.stdout)
25
- ```
26
-
27
- 不要把调用拼成 shell 命令字符串。禁止使用 `curl`、`httpx`、`requests`、`Invoke-RestMethod` 或业务服务 URL。
28
-
29
- wrapper 内部构造以下 argv:
30
-
31
- ```text
32
- delta-cli science invoke --tool TOOL --endpoint ENDPOINT --data JSON
33
- ```
34
-
35
- 只有明确记录为查询参数的 operation 才使用 `--params-json`。同一次调用不得同时发送 `--data-json` 和 `--params-json`。
36
-
37
- ## 可执行文件与配置解析顺序
38
-
39
- wrapper 按以下顺序解析 `delta-cli`:
40
-
41
- 1. `--cli`
42
- 2. `DELTA_CLI_PATH`
43
- 3. `SKILL.md` 同级、未纳入版本控制的 `runtime.local.json`
44
- 4. `PATH` 中的 `delta-cli` 或 `delta-cli.exe`
45
- 5. npm 包相邻的 `bin/delta-cli[.exe]`
46
-
47
- CLI 从 `~/.delta-infra/config.json` 读取 `science_base_url`。显式 `--science-base-url` 只用于测试覆盖,并通过 `DELTA_INFRA_SCIENCE_BASE_URL` 传给子进程。
48
-
49
- ## wrapper 返回结果
50
-
51
- 成功输出格式:
52
-
53
- ```json
54
- {
55
- "ok": true,
56
- "transport": "delta-cli",
57
- "tool": "rdkit",
58
- "endpoint": "parse",
59
- "elapsed_seconds": 1.23,
60
- "envelope_depth": 2,
61
- "native": {}
62
- }
63
- ```
64
-
65
- `tools.name` 和 `tool_endpoints.name` 是唯一权威名称。Skill 代码始终把 reference 中的
66
- tool/operation 原样传给 CLI,CLI 再原样提交给 Science Server;任何一层都不执行旧
67
- 名称映射、前缀裁剪、profile 判断或失败后的改名重试。若 reference 与数据库名称不一致,
68
- 本次调用按 `not_found` 失败结束,应修正数据库配置或 reference,而不是在客户端添加映射。
69
-
70
- wrapper 校验 CLI 的 `{ok,data}` 信封,只解包已知的 Infra 转发结果
71
- `{status_code,headers,data}` 和业务服务信封 `{code,message,data}`。它不会在任意嵌套
72
- 字段中搜索看似合理的结果。`ok=false` 会包含稳定的 `stage`、`error_type`、
73
- `cli_exit_code` 和错误文本。宿主 shell/Python 的进程成功状态不能覆盖这些字段。
74
-
75
- 解包成功后,业务结果直接位于 `result["native"]` 顶层。禁止读取
76
- `result["native"]["data"]`,也禁止递归搜索字段。
77
-
78
- 即使存在部分数据,`ok=false` 仍必须视为失败。禁止静默切换到其他调用链,也不得在
79
- 最终统计中写“无错误”。业务成功后立即结束,不得为比较模型而追加请求。
80
-
81
- ## 二进制产物
82
-
83
- operation 返回 base64 数据时,只解码文档指定的 native 字段。PNG 文件必须以 `89 50 4e 47 0d 0a 1a 0a` 开头。以 `7b`(`{`)开头的是 JSON,不能描述成图片。
1
+ # Delta CLI 执行约定
2
+
3
+ ## 直接调用 CLI
4
+
5
+ 所有实时 Science 调用都直接执行已安装的 Delta CLI:
6
+
7
+ ```text
8
+ delta-cli science invoke --tool TOOL --endpoint ENDPOINT --data JSON
9
+ ```
10
+
11
+ `TOOL` 与 `ENDPOINT` 必须逐字使用当前 reference 或实时目录中的
12
+ `tools.name`、`tool_endpoints.name`;不得增加别名映射、裁剪前缀或在 `not_found` 后改名重试。
13
+ 仅当 operation 文档明确要求查询参数时使用 `--params JSON`。不要同时传递 `--data` 和
14
+ `--params`,也不要改用 `curl`、`httpx`、`requests`、`Invoke-RestMethod` 或业务服务 URL。
15
+
16
+ CLI 使用其标准认证和 `science_base_url` 配置。Skill 不得通过环境变量、命令参数或临时配置
17
+ 改写服务路由,也不读取、修改或伪造凭据。
18
+
19
+ ## 成功与结果
20
+
21
+ CLI 成功时输出单个 JSON 信封:
22
+
23
+ ```json
24
+ {
25
+ "ok": true,
26
+ "data": {}
27
+ }
28
+ ```
29
+
30
+ 只有 CLI 退出码为 0 且顶层 `ok` 为 `true` 时,才能报告调用成功。顶层 `data` 保存服务响应。
31
+ 按 operation reference 规定的响应结构读取字段:若文档明确说明网关或业务信封的 `data`,
32
+ 可读取该已知层级;不得递归搜索字段,也不得将业务返回的 `valid:false`、空结果或警告误报为
33
+ CLI 传输失败。
34
+
35
+ 退出码非 0 或顶层 `ok:false` 时,本次调用失败;转发 CLI 的原始错误短摘要,不得切换到
36
+ 其他调用链、修改参数或重试可能已执行的远程变更。
37
+
38
+ ## 实时目录
39
+
40
+ 当用户点名 reference 以外的新工具,或 reference 缺失、过期或与 CLI 返回不一致时,依次执行:
41
+
42
+ ```text
43
+ delta-cli science list
44
+ delta-cli science endpoints list TOOL
45
+ ```
46
+
47
+ 两次调用都必须满足成功条件。目录只用于获取精确名称;若其未提供足以安全构造请求的 schema,
48
+ 说明该限制而不要猜测请求体。
49
+
50
+ ## 二进制产物
51
+
52
+ operation 返回 base64 数据时,只解码 operation 文档指定的 `data` 字段。PNG 文件必须以
53
+ `89 50 4e 47 0d 0a 1a 0a` 开头。以 `7b`(`{`)开头的是 JSON,不能描述成图片。
@@ -1,90 +1,89 @@
1
- # Delta-BO 详细规则
2
-
3
- 所有在线调用只走统一 wrapper,tool 固定为 `delta-bo`。当前 CLI catalog 只暴露
4
- `commands` 和 `generate`;禁止根据旧 HTTP 文档猜测或直连 stateful command API。
5
-
6
- ## commands
7
-
8
- 情景:用户要求查看当前部署支持的 Delta-BO 命令。
9
-
10
- ```python
11
- result = invoke("delta-bo", "commands")
12
- native = result["native"]
13
- ```
14
-
15
- 无 body。只报告当前 native 命令列表,不从历史文档补全。
16
-
17
- ## generate
18
-
19
- 情景:针对数值、整数或分类实验变量生成随机搜索或贝叶斯优化建议。
20
-
21
- 无真实历史,或历史少于 5 条且用户没有明确要求 BO 时,使用有界随机搜索:
22
-
23
- ```json
24
- {
25
- "params": [
26
- {"name": "x", "type": "numeric", "low": 0.0, "high": 1.0}
27
- ],
28
- "num_suggestions": 3,
29
- "algorithm": "random-search",
30
- "seed": 42
31
- }
32
- ```
33
-
34
- 有真实历史且用户明确要求 BO 时,可以使用:
35
-
36
- ```json
37
- {
38
- "params": [
39
- {"name": "temperature", "type": "numeric", "low": 20.0, "high": 120.0},
40
- {"name": "catalyst", "type": "categorical", "choices": ["A", "B", "C"]}
41
- ],
42
- "objectives": [{"name": "yield", "minimize": false}],
43
- "num_suggestions": 2,
44
- "algorithm": "bo",
45
- "model": {"name": "gp", "min_samples": 2, "train_steps": 50},
46
- "acq_target": {"name": "ucb", "beta": 2.0},
47
- "solver": {"name": "ga", "pop_size": 40, "n_gen": 10},
48
- "histories": {
49
- "decisions": [
50
- {"temperature": 40.0, "catalyst": "A"},
51
- {"temperature": 80.0, "catalyst": "B"}
52
- ],
53
- "observations": [
54
- {"yield": 0.42},
55
- {"yield": 0.61}
56
- ]
57
- },
58
- "seed": 7
59
- }
60
- ```
61
-
62
- 参数类型仅支持 `numeric`、`integer`、`categorical`。优先使用 object-form history,
63
- 避免数组列顺序歧义。不得编造 observation、目标值或所谓最优点。
64
-
65
- 可选去重与约束:
66
-
67
- ```json
68
- {
69
- "diversity": {
70
- "deduplicate": true,
71
- "min_numeric_distance": {"temperature": 5.0},
72
- "prefer_unique_categories": true
73
- },
74
- "constraints": [
75
- {"type": "unique_batch"},
76
- {"type": "avoid_seen_decisions"}
77
- ]
78
- }
79
- ```
80
-
81
- 只报告 native 的 `suggestions`、`suggestion_metadata`、`warnings`、
82
- `generated_candidate_count` 和 `diversity` 中实际存在的字段。空 suggestions 或失败
83
- 不得用本地 GP、UCB 或随机数替代。
84
-
85
- ## 已知但未暴露的旧能力
86
-
87
- 旧服务曾包含 session、space、objective、policy、suggest、observe、loop、status、
88
- best 等有状态命令,但它们不是当前 Delta CLI operation。本 Skill 只保留这条能力
89
- 边界,不保留 URL 或 curl 示例,也不执行这些操作。需要扩展时,先由 Science Server
90
- 暴露 operation 和请求 schema,再更新本 reference。
1
+ # Delta-BO 详细规则
2
+
3
+ 所有在线调用直接使用 `delta-cli science invoke`,tool 固定为 `delta-bo`。当前 CLI catalog 只暴露
4
+ `commands` 和 `generate`;禁止根据旧 HTTP 文档猜测或直连 stateful command API。
5
+
6
+ ## commands
7
+
8
+ 情景:用户要求查看当前部署支持的 Delta-BO 命令。
9
+
10
+ ```text
11
+ delta-cli science invoke --tool delta-bo --endpoint commands
12
+ ```
13
+
14
+ 无 body。只报告当前业务响应中的命令列表,不从历史文档补全。
15
+
16
+ ## generate
17
+
18
+ 情景:针对数值、整数或分类实验变量生成随机搜索或贝叶斯优化建议。
19
+
20
+ 无真实历史,或历史少于 5 条且用户没有明确要求 BO 时,使用有界随机搜索:
21
+
22
+ ```json
23
+ {
24
+ "params": [
25
+ {"name": "x", "type": "numeric", "low": 0.0, "high": 1.0}
26
+ ],
27
+ "num_suggestions": 3,
28
+ "algorithm": "random-search",
29
+ "seed": 42
30
+ }
31
+ ```
32
+
33
+ 有真实历史且用户明确要求 BO 时,可以使用:
34
+
35
+ ```json
36
+ {
37
+ "params": [
38
+ {"name": "temperature", "type": "numeric", "low": 20.0, "high": 120.0},
39
+ {"name": "catalyst", "type": "categorical", "choices": ["A", "B", "C"]}
40
+ ],
41
+ "objectives": [{"name": "yield", "minimize": false}],
42
+ "num_suggestions": 2,
43
+ "algorithm": "bo",
44
+ "model": {"name": "gp", "min_samples": 2, "train_steps": 50},
45
+ "acq_target": {"name": "ucb", "beta": 2.0},
46
+ "solver": {"name": "ga", "pop_size": 40, "n_gen": 10},
47
+ "histories": {
48
+ "decisions": [
49
+ {"temperature": 40.0, "catalyst": "A"},
50
+ {"temperature": 80.0, "catalyst": "B"}
51
+ ],
52
+ "observations": [
53
+ {"yield": 0.42},
54
+ {"yield": 0.61}
55
+ ]
56
+ },
57
+ "seed": 7
58
+ }
59
+ ```
60
+
61
+ 参数类型仅支持 `numeric`、`integer`、`categorical`。优先使用 object-form history,
62
+ 避免数组列顺序歧义。不得编造 observation、目标值或所谓最优点。
63
+
64
+ 可选去重与约束:
65
+
66
+ ```json
67
+ {
68
+ "diversity": {
69
+ "deduplicate": true,
70
+ "min_numeric_distance": {"temperature": 5.0},
71
+ "prefer_unique_categories": true
72
+ },
73
+ "constraints": [
74
+ {"type": "unique_batch"},
75
+ {"type": "avoid_seen_decisions"}
76
+ ]
77
+ }
78
+ ```
79
+
80
+ 只报告业务响应的 `suggestions`、`suggestion_metadata`、`warnings`、
81
+ `generated_candidate_count` 和 `diversity` 中实际存在的字段。空 suggestions 或失败
82
+ 不得用本地 GP、UCB 或随机数替代。
83
+
84
+ ## 已知但未暴露的旧能力
85
+
86
+ 旧服务曾包含 session、space、objective、policy、suggest、observe、loop、status、
87
+ best 等有状态命令,但它们不是当前 Delta CLI operation。本 Skill 只保留这条能力
88
+ 边界,不保留 URL 或 curl 示例,也不执行这些操作。需要扩展时,先由 Science Server
89
+ 暴露 operation 和请求 schema,再更新本 reference。
@@ -1,116 +1,116 @@
1
- # GSAS-II 详细规则
2
-
3
- 所有调用只走统一 wrapper。模拟必须使用真实 CIF;精修必须使用真实 powder data、
4
- instrument parameters 和 phase CIF,任何失败不得用合成数据补齐。输入不是 CIF 时,
5
- 先使用当前任务中成功的 pymatgen `structure-convert` 结果。
6
-
7
- ## Health
8
-
9
- operation:`health`,无 body。
10
-
11
- Key response fields in `data`: `status`, `service`, `gsasii_available`,
12
- `metadata`, and `limits`.
13
-
14
- 只有用户明确要求健康检查时才调用;不要在模拟或精修前自动增加 health。
15
-
16
- ## Powder Simulation
17
-
18
- operation:`powder-simulate`。
19
-
20
- ```json
21
- {
22
- "cif": "<CIF text>",
23
- "phase_name": "phase",
24
- "instrument_parameters": "<GSAS-II instrument parameter text>",
25
- "histogram_name": "simulation",
26
- "t_min": 10.0,
27
- "t_max": 80.0,
28
- "t_step": 0.02,
29
- "include_profile": true,
30
- "max_profile_points": 1000,
31
- "include_reflections": true,
32
- "max_reflections": 1000,
33
- "return_refined_cif": false,
34
- "return_project": false
35
- }
36
- ```
37
-
38
- Use either `t_step` or `n_points`, not both. Optional fields include
39
- `wavelength`, `radiation`, `scale`, `include_profile`, `max_profile_points`,
40
- `include_reflections`, `max_reflections`, `return_refined_cif`, and
41
- `return_project`.
42
-
43
- The response includes `profile` points with `x`, `y_calc`, optional background,
44
- bounded `reflections` with hkl/d-spacing/2theta where available, and metadata.
45
- If `return_project` is true, `project_base64` contains the GSAS-II `.gpx`
46
- project. If `return_refined_cif` is true, `refined_cif` contains exported CIF
47
- text for pymatgen handoff when GSAS-II supports export for the phase.
48
-
49
- Notes:
50
-
51
- - `cif` should be valid CIF text. If the input is POSCAR/JSON/CSSR/XSF, use
52
- pymatgen `structure-convert` first with `output_format: "cif"`.
53
- - `instrument_parameters` should be GSAS-II instrument parameter text such as
54
- `INST_XRY.PRM` when instrument-specific simulation is needed.
55
- - For quick simulation only, `instrument_parameters` may be omitted. The service
56
- then generates a simple CW X-ray instrument model from `wavelength` or
57
- `radiation` (`CuKa` by default; also supports aliases such as `MoKa`, `CoKa`,
58
- `CrKa`, and explicit numeric wavelength).
59
- - Refinement still requires real `instrument_parameters`.
60
- - `max_profile_points` controls response sampling. Use small values for smoke
61
- tests and larger values for profile comparison.
62
- - Older deployed gateway images may require `max_profile_points >= 10`.
63
-
64
- ## Powder Refinement
65
-
66
- operation:`powder-refine`。
67
-
68
- ```json
69
- {
70
- "powder_data": "<two-column or three-column powder data text>",
71
- "powder_format": "xy",
72
- "instrument_parameters": "<GSAS-II instrument parameter text>",
73
- "phases": [
74
- {"name": "phase", "cif": "<CIF text>"}
75
- ],
76
- "refinement_mode": "rietveld",
77
- "refinement_steps": [],
78
- "max_cycles": 3,
79
- "histogram_name": "powder",
80
- "include_profile": true,
81
- "max_profile_points": 1000,
82
- "include_reflections": true,
83
- "max_reflections": 1000,
84
- "return_refined_cif": false,
85
- "return_project": false
86
- }
87
- ```
88
-
89
- Supported `powder_format` values: `xy`, `xye`, `fxye`, `gsas`, and `csv`.
90
-
91
- `refinement_mode: "rietveld"` is currently implemented. `pawley` and `lebail`
92
- return a clear not-implemented response until the service wires the
93
- mode-specific GSAS-II setup.
94
-
95
- The response includes fit `residuals` when available, phase summaries, sampled
96
- profile points, bounded `reflections`, warnings, optional `refined_cif`, and
97
- the optional `.gpx` project.
98
-
99
- Notes:
100
-
101
- - Use `xy` for simple whitespace-delimited `x y` rows, `xye` for `x y esd`,
102
- `csv` for numeric comma-separated rows, or `gsas`/`fxye` for GSAS-like powder
103
- formats.
104
- - `max_cycles: 0` is useful for project-construction smoke tests. Increase it
105
- only when the powder data, phase model, instrument file, and refinement steps
106
- are realistic.
107
- - `refinement_steps` is passed to `G2Project.do_refinements`. Keep recipes
108
- incremental and inspect `warnings`, `residuals`, and `lst` output.
109
- - Refinement may return `valid: false` with partial phase/profile information
110
- if GSAS-II constructed the project but a refinement step failed.
111
-
112
- ## 跨工具交接
113
-
114
- 结构转换、衍射模拟和精修必须在本 Skill 内通过 wrapper 逐步完成:
115
- `pymatgen structure-convert -> gsasii powder-simulate/powder-refine`。下游只使用上一步
116
- 成功 native 中的结构文本或 profile;不得执行本地脚本或直连服务。
1
+ # GSAS-II 详细规则
2
+
3
+ 所有调用直接使用 `delta-cli science invoke`。模拟必须使用真实 CIF;精修必须使用真实 powder data、
4
+ instrument parameters 和 phase CIF,任何失败不得用合成数据补齐。输入不是 CIF 时,
5
+ 先使用当前任务中成功的 pymatgen `structure-convert` 结果。
6
+
7
+ ## Health
8
+
9
+ operation:`health`,无 body。
10
+
11
+ Key response fields in `data`: `status`, `service`, `gsasii_available`,
12
+ `metadata`, and `limits`.
13
+
14
+ 只有用户明确要求健康检查时才调用;不要在模拟或精修前自动增加 health。
15
+
16
+ ## Powder Simulation
17
+
18
+ operation:`powder-simulate`。
19
+
20
+ ```json
21
+ {
22
+ "cif": "<CIF text>",
23
+ "phase_name": "phase",
24
+ "instrument_parameters": "<GSAS-II instrument parameter text>",
25
+ "histogram_name": "simulation",
26
+ "t_min": 10.0,
27
+ "t_max": 80.0,
28
+ "t_step": 0.02,
29
+ "include_profile": true,
30
+ "max_profile_points": 1000,
31
+ "include_reflections": true,
32
+ "max_reflections": 1000,
33
+ "return_refined_cif": false,
34
+ "return_project": false
35
+ }
36
+ ```
37
+
38
+ Use either `t_step` or `n_points`, not both. Optional fields include
39
+ `wavelength`, `radiation`, `scale`, `include_profile`, `max_profile_points`,
40
+ `include_reflections`, `max_reflections`, `return_refined_cif`, and
41
+ `return_project`.
42
+
43
+ The response includes `profile` points with `x`, `y_calc`, optional background,
44
+ bounded `reflections` with hkl/d-spacing/2theta where available, and metadata.
45
+ If `return_project` is true, `project_base64` contains the GSAS-II `.gpx`
46
+ project. If `return_refined_cif` is true, `refined_cif` contains exported CIF
47
+ text for pymatgen handoff when GSAS-II supports export for the phase.
48
+
49
+ Notes:
50
+
51
+ - `cif` should be valid CIF text. If the input is POSCAR/JSON/CSSR/XSF, use
52
+ pymatgen `structure-convert` first with `output_format: "cif"`.
53
+ - `instrument_parameters` should be GSAS-II instrument parameter text such as
54
+ `INST_XRY.PRM` when instrument-specific simulation is needed.
55
+ - For quick simulation only, `instrument_parameters` may be omitted. The service
56
+ then generates a simple CW X-ray instrument model from `wavelength` or
57
+ `radiation` (`CuKa` by default; also supports aliases such as `MoKa`, `CoKa`,
58
+ `CrKa`, and explicit numeric wavelength).
59
+ - Refinement still requires real `instrument_parameters`.
60
+ - `max_profile_points` controls response sampling. Use small values for smoke
61
+ tests and larger values for profile comparison.
62
+ - Older deployed gateway images may require `max_profile_points >= 10`.
63
+
64
+ ## Powder Refinement
65
+
66
+ operation:`powder-refine`。
67
+
68
+ ```json
69
+ {
70
+ "powder_data": "<two-column or three-column powder data text>",
71
+ "powder_format": "xy",
72
+ "instrument_parameters": "<GSAS-II instrument parameter text>",
73
+ "phases": [
74
+ {"name": "phase", "cif": "<CIF text>"}
75
+ ],
76
+ "refinement_mode": "rietveld",
77
+ "refinement_steps": [],
78
+ "max_cycles": 3,
79
+ "histogram_name": "powder",
80
+ "include_profile": true,
81
+ "max_profile_points": 1000,
82
+ "include_reflections": true,
83
+ "max_reflections": 1000,
84
+ "return_refined_cif": false,
85
+ "return_project": false
86
+ }
87
+ ```
88
+
89
+ Supported `powder_format` values: `xy`, `xye`, `fxye`, `gsas`, and `csv`.
90
+
91
+ `refinement_mode: "rietveld"` is currently implemented. `pawley` and `lebail`
92
+ return a clear not-implemented response until the service wires the
93
+ mode-specific GSAS-II setup.
94
+
95
+ The response includes fit `residuals` when available, phase summaries, sampled
96
+ profile points, bounded `reflections`, warnings, optional `refined_cif`, and
97
+ the optional `.gpx` project.
98
+
99
+ Notes:
100
+
101
+ - Use `xy` for simple whitespace-delimited `x y` rows, `xye` for `x y esd`,
102
+ `csv` for numeric comma-separated rows, or `gsas`/`fxye` for GSAS-like powder
103
+ formats.
104
+ - `max_cycles: 0` is useful for project-construction smoke tests. Increase it
105
+ only when the powder data, phase model, instrument file, and refinement steps
106
+ are realistic.
107
+ - `refinement_steps` is passed to `G2Project.do_refinements`. Keep recipes
108
+ incremental and inspect `warnings`, `residuals`, and `lst` output.
109
+ - Refinement may return `valid: false` with partial phase/profile information
110
+ if GSAS-II constructed the project but a refinement step failed.
111
+
112
+ ## 跨工具交接
113
+
114
+ 结构转换、衍射模拟和精修必须在本 Skill 内通过 CLI 逐步完成:
115
+ `pymatgen structure-convert -> gsasii powder-simulate/powder-refine`。下游只使用上一步
116
+ 成功业务响应中的结构文本或 profile;不得执行本地脚本或直连服务。