@delta-infra/cli 1.0.76 → 1.0.78

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 (50) hide show
  1. package/README.md +405 -405
  2. package/checksums.txt +5 -5
  3. package/package.json +1 -1
  4. package/scripts/install-wizard.js +610 -596
  5. package/scripts/install.js +400 -400
  6. package/scripts/run.js +65 -65
  7. package/skills/antbo-ldm-guard/SKILL.md +51 -51
  8. package/skills/antbo-ldm-guard/agents/openai.yaml +4 -4
  9. package/skills/antbo-service/SKILL.md +71 -71
  10. package/skills/antbo-service/agents/openai.yaml +4 -4
  11. package/skills/antbo-service/references/operations.md +45 -45
  12. package/skills/delta-bo/SKILL.md +28 -28
  13. package/skills/delta-bo/agents/openai.yaml +4 -4
  14. package/skills/delta-bo/references/endpoints.md +263 -263
  15. package/skills/delta-sandbox/SKILL.md +356 -356
  16. package/skills/delta-sandbox/agents/openai.yaml +4 -4
  17. package/skills/delta-sandbox/references/commands.md +56 -56
  18. package/skills/delta-sandbox/references/lifecycle.md +92 -92
  19. package/skills/delta-sandbox/references/recipes.md +133 -133
  20. package/skills/delta-science/SKILL.md +163 -163
  21. package/skills/delta-science/agents/openai.yaml +4 -4
  22. package/skills/delta-science/references/cli-contract.md +84 -84
  23. package/skills/delta-science/references/services.md +112 -112
  24. package/skills/delta-science/references/workflows.md +44 -44
  25. package/skills/delta-science/scripts/invoke.py +257 -257
  26. package/skills/delta-shared/SKILL.md +95 -95
  27. package/skills/delta-shared/agents/openai.yaml +4 -4
  28. package/skills/gsasii/SKILL.md +34 -34
  29. package/skills/gsasii/agents/openai.yaml +4 -4
  30. package/skills/gsasii/references/endpoints.md +130 -130
  31. package/skills/lammps/SKILL.md +31 -31
  32. package/skills/lammps/agents/openai.yaml +4 -4
  33. package/skills/lammps/references/endpoints.md +61 -61
  34. package/skills/ldm-bo/SKILL.md +27 -27
  35. package/skills/ldm-bo/agents/openai.yaml +4 -4
  36. package/skills/ldm-bo/references/endpoints.md +127 -127
  37. package/skills/pubchem/SKILL.md +85 -85
  38. package/skills/pubchem/agents/openai.yaml +4 -4
  39. package/skills/pubchem/references/endpoints.md +122 -122
  40. package/skills/pubchem/references/operations.md +41 -41
  41. package/skills/pymatgen/SKILL.md +46 -46
  42. package/skills/pymatgen/agents/openai.yaml +4 -4
  43. package/skills/pymatgen/references/endpoints.md +66 -66
  44. package/skills/rdkit/SKILL.md +104 -104
  45. package/skills/rdkit/agents/openai.yaml +4 -4
  46. package/skills/rdkit/references/endpoints.md +133 -133
  47. package/skills/rdkit/references/operations.md +64 -64
  48. package/skills/synbo-service/SKILL.md +28 -28
  49. package/skills/synbo-service/agents/openai.yaml +4 -4
  50. package/skills/synbo-service/references/endpoints.md +157 -157
@@ -1,61 +1,61 @@
1
- # LAMMPS Endpoint Reference
2
-
3
- All paths are relative to `http://111.2.199.31:52317/api/v1`.
4
-
5
- ## Health
6
-
7
- `GET /chem/lammps/health`
8
-
9
- Key response fields in `data`: `status`, `service`, `lammps_available`,
10
- `metadata`, and `limits`.
11
-
12
- Use this before long simulations. A healthy service should report
13
- `data.status == "ok"` and `data.lammps_available == true`.
14
-
15
- ## Built-In Lennard-Jones Example
16
-
17
- `GET /chem/lammps/examples/lj-melt`
18
-
19
- Returns a complete `request` payload for `/chem/lammps/run`, plus workflow notes
20
- showing where pymatgen and GSAS-II fit around LAMMPS.
21
-
22
- ## Run
23
-
24
- `POST /chem/lammps/run`
25
-
26
- ```json
27
- {
28
- "input_script": "<LAMMPS input script>",
29
- "files": [
30
- {"path": "system.data", "content": "<LAMMPS data file text>", "encoding": "text"}
31
- ],
32
- "timeout_seconds": 30,
33
- "max_thermo_rows": 1000,
34
- "log_tail_lines": 200,
35
- "output_files": ["dump.lammpstrj", "final.data"],
36
- "include_log": true,
37
- "include_stdout": false,
38
- "include_stderr": false
39
- }
40
- ```
41
-
42
- `files` are written into a fresh job working directory before LAMMPS starts.
43
- `encoding` can be `text` or `base64`.
44
-
45
- The response includes parsed thermo rows, the final thermo row, atom count when
46
- detectable, log tail, warnings, and requested output files. Text output files
47
- return `content`; binary output files return `content_base64`.
48
-
49
- Notes:
50
-
51
- - Use relative file paths only.
52
- - The service rejects unsafe commands such as `shell`, `python`, `plugin`, and
53
- `jump` by default.
54
- - `include <relative-file>` is allowed when the included file is supplied in
55
- `files`; absolute paths, parent-directory traversal, URLs, and `jump` loops
56
- are rejected.
57
- - Dump/data products are returned as raw requested output files, not structured
58
- parsed atom-frame objects.
59
- - The gateway is synchronous; keep interactive runs short.
60
- - Force-field choice is caller responsibility. The service executes explicit
61
- LAMMPS input and does not infer potentials from formulas or structures.
1
+ # LAMMPS Endpoint Reference
2
+
3
+ All paths are relative to `http://111.2.199.31:52317/api/v1`.
4
+
5
+ ## Health
6
+
7
+ `GET /chem/lammps/health`
8
+
9
+ Key response fields in `data`: `status`, `service`, `lammps_available`,
10
+ `metadata`, and `limits`.
11
+
12
+ Use this before long simulations. A healthy service should report
13
+ `data.status == "ok"` and `data.lammps_available == true`.
14
+
15
+ ## Built-In Lennard-Jones Example
16
+
17
+ `GET /chem/lammps/examples/lj-melt`
18
+
19
+ Returns a complete `request` payload for `/chem/lammps/run`, plus workflow notes
20
+ showing where pymatgen and GSAS-II fit around LAMMPS.
21
+
22
+ ## Run
23
+
24
+ `POST /chem/lammps/run`
25
+
26
+ ```json
27
+ {
28
+ "input_script": "<LAMMPS input script>",
29
+ "files": [
30
+ {"path": "system.data", "content": "<LAMMPS data file text>", "encoding": "text"}
31
+ ],
32
+ "timeout_seconds": 30,
33
+ "max_thermo_rows": 1000,
34
+ "log_tail_lines": 200,
35
+ "output_files": ["dump.lammpstrj", "final.data"],
36
+ "include_log": true,
37
+ "include_stdout": false,
38
+ "include_stderr": false
39
+ }
40
+ ```
41
+
42
+ `files` are written into a fresh job working directory before LAMMPS starts.
43
+ `encoding` can be `text` or `base64`.
44
+
45
+ The response includes parsed thermo rows, the final thermo row, atom count when
46
+ detectable, log tail, warnings, and requested output files. Text output files
47
+ return `content`; binary output files return `content_base64`.
48
+
49
+ Notes:
50
+
51
+ - Use relative file paths only.
52
+ - The service rejects unsafe commands such as `shell`, `python`, `plugin`, and
53
+ `jump` by default.
54
+ - `include <relative-file>` is allowed when the included file is supplied in
55
+ `files`; absolute paths, parent-directory traversal, URLs, and `jump` loops
56
+ are rejected.
57
+ - Dump/data products are returned as raw requested output files, not structured
58
+ parsed atom-frame objects.
59
+ - The gateway is synchronous; keep interactive runs short.
60
+ - Force-field choice is caller responsibility. The service executes explicit
61
+ LAMMPS input and does not infer potentials from formulas or structures.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: ldm-bo
3
3
  description: 当用户要求对小分子 SMILES 使用 LDM-BO/PDF2Dock、Vina+NN、ReaSyn,生成下一条小分子候选或运行分子 BO trajectory 时使用。不得用于抗体、CDRH3、AntBO 或 /biology/antbo 场景;这些场景必须路由 antbo-service。
4
4
  metadata:
@@ -7,29 +7,29 @@ metadata:
7
7
  - python_repl
8
8
  - step_finish
9
9
  ---
10
-
11
- # 小分子 LDM-BO 服务
12
-
13
- ## 强制规则
14
-
15
- - 只用 `python_repl` 执行 `$SKILLS_ROOT/delta-science/scripts/invoke.py`,
16
- tool=`ldm-bo`;禁止 Bash、路径探测、字面 CLI、直接 HTTP 和本地 PDF2Dock。
17
- - `python_repl` 工具参数只能包含 `code`,禁止 `deps/dependencies/packages`。
18
- - 业务结果直接位于 `r["native"]`,禁止 `native.data`。
19
- - provider、模型路径、Vina/ReaSyn/GPU/LLM 配置由服务端注入,不放入请求 JSON。
20
- - 抗体/CDRH3 即使出现 “LDM” 也禁止调用本 Skill。
21
-
22
- ## operation 选择
23
-
24
- - `health`:检查 PDF2Dock/Vina/ReaSyn/NN/LLM 等部署依赖,无 body。
25
- - `recommend`:`method`、小分子 `pool`、真实
26
- `history:[{smiles,scores}]`、`batch_size`。
27
- - `trajectory`:保留连字符键 `seed-smiles`、`num-evaluations`、`batch-size`,以及
28
- method、seed、objective;有界 smoke 使用 `bo-tanimoto` 和很小 evaluation 数。
29
-
30
- 详细最小 payload 和 native 响应见 `references/endpoints.md`。缺 Vina、ReaSyn、模型或
31
- LLM 配置时原样报告后端错误,不切换方法或本地生成候选。
32
-
33
- 通过 wrapper 调用一次并显式打印有界 native 投影;成功后立即
34
- `step_finish(status="done", summary=<同一 JSON>)`,失败则
35
- `step_finish(status="failed", summary=<原始错误短摘要>)`。禁止重试和后续工具。
10
+
11
+ # 小分子 LDM-BO 服务
12
+
13
+ ## 强制规则
14
+
15
+ - 只用 `python_repl` 执行 `$SKILLS_ROOT/delta-science/scripts/invoke.py`,
16
+ tool=`ldm-bo`;禁止 Bash、路径探测、字面 CLI、直接 HTTP 和本地 PDF2Dock。
17
+ - `python_repl` 工具参数只能包含 `code`,禁止 `deps/dependencies/packages`。
18
+ - 业务结果直接位于 `r["native"]`,禁止 `native.data`。
19
+ - provider、模型路径、Vina/ReaSyn/GPU/LLM 配置由服务端注入,不放入请求 JSON。
20
+ - 抗体/CDRH3 即使出现 “LDM” 也禁止调用本 Skill。
21
+
22
+ ## operation 选择
23
+
24
+ - `health`:检查 PDF2Dock/Vina/ReaSyn/NN/LLM 等部署依赖,无 body。
25
+ - `recommend`:`method`、小分子 `pool`、真实
26
+ `history:[{smiles,scores}]`、`batch_size`。
27
+ - `trajectory`:保留连字符键 `seed-smiles`、`num-evaluations`、`batch-size`,以及
28
+ method、seed、objective;有界 smoke 使用 `bo-tanimoto` 和很小 evaluation 数。
29
+
30
+ 详细最小 payload 和 native 响应见 `references/endpoints.md`。缺 Vina、ReaSyn、模型或
31
+ LLM 配置时原样报告后端错误,不切换方法或本地生成候选。
32
+
33
+ 通过 wrapper 调用一次并显式打印有界 native 投影;成功后立即
34
+ `step_finish(status="done", summary=<同一 JSON>)`,失败则
35
+ `step_finish(status="failed", summary=<原始错误短摘要>)`。禁止重试和后续工具。
@@ -1,4 +1,4 @@
1
- interface:
2
- display_name: "LDM-BO 小分子优化"
3
- short_description: "通过 Delta CLI 生成小分子候选或执行分子优化轨迹"
4
- default_prompt: "使用 $ldm-bo 为这个小分子任务推荐下一条候选。"
1
+ interface:
2
+ display_name: "LDM-BO 小分子优化"
3
+ short_description: "通过 Delta CLI 生成小分子候选或执行分子优化轨迹"
4
+ default_prompt: "使用 $ldm-bo 为这个小分子任务推荐下一条候选。"
@@ -1,127 +1,127 @@
1
- # LDM-BO API Endpoint Reference
2
-
3
- All paths are relative to `http://111.2.199.31:52317/api/v1`.
4
-
5
- This reference is for using the exposed HTTP API. It is not a local PDF2Dock
6
- runner.
7
-
8
- ## Health
9
-
10
- `GET /chem/ldm-bo/health`
11
-
12
- The response reports whether the adapter can see the mounted PDF2Dock
13
- interpreter, `bo_api.py`, Vina binary, ReaSyn repo/interpreter/checkpoints, NN
14
- model files, cache directory, GPU settings, and LLM configuration. Missing LLM
15
- settings degrade health because LDM methods need them.
16
-
17
- ## One-Step Recommend
18
-
19
- `POST /chem/ldm-bo/recommend`
20
-
21
- Wraps `bo_api.recommend_next_smiles`.
22
-
23
- Typical payload:
24
-
25
- ```json
26
- {
27
- "method": "bo-tanimoto",
28
- "pool": ["CCO", "CCN", "CCC"],
29
- "history": [
30
- {"smiles": "CCO", "scores": [-7.1]},
31
- {"smiles": "CCN", "scores": [-6.8]}
32
- ],
33
- "batch_size": 1
34
- }
35
- ```
36
-
37
- Typical native response inside gateway `data`:
38
-
39
- ```json
40
- {
41
- "recommendations": ["CCC"],
42
- "acquisition_values": [0.12],
43
- "n_objectives": 1
44
- }
45
- ```
46
-
47
- LDM methods may include an `llm` diagnostics object.
48
-
49
- ## Full Trajectory
50
-
51
- `POST /chem/ldm-bo/trajectory`
52
-
53
- Wraps `bo_api.run_search_trajectory`.
54
-
55
- Small smoke payload:
56
-
57
- ```json
58
- {
59
- "method": "bo-tanimoto",
60
- "seed": 42,
61
- "seed-smiles": "CCO,CCN,CCC",
62
- "num-evaluations": 4,
63
- "batch-size": 1,
64
- "objective": "vina+nn"
65
- }
66
- ```
67
-
68
- Typical native response inside gateway `data`:
69
-
70
- ```json
71
- {
72
- "config": {},
73
- "history": [],
74
- "summary": {}
75
- }
76
- ```
77
-
78
- LDM methods may include `llm_trajectory`.
79
-
80
- ## Error Handling
81
-
82
- The service maps native `bo_api` error JSON to an upstream failure. The gateway
83
- returns a standard error envelope:
84
-
85
- ```json
86
- {
87
- "code": 1,
88
- "message": "AutoDock Vina executable not found...",
89
- "data": {
90
- "endpoint": "/v1/trajectory",
91
- "service_url": "http://ldm-bo-service:8895",
92
- "ldm_bo_response": {
93
- "error": "...",
94
- "error_type": "ValueError",
95
- "traceback": "Traceback ..."
96
- }
97
- }
98
- }
99
- ```
100
-
101
- Common causes are missing Vina, missing ReaSyn, wrong Python interpreter, CUDA
102
- device mismatch, missing LLM credentials for LDM methods, or an unwritable Vina
103
- cache directory.
104
-
105
- ## Provider Settings
106
-
107
- Do not send provider settings in request JSON. The adapter reads these from
108
- deployment config and passes them as Python kwargs to `bo_api`:
109
-
110
- ```text
111
- vina_bin
112
- vina_cache_dir
113
- vina_max_workers
114
- gp_device
115
- reasyn_repo
116
- reasyn_python_bin
117
- reasyn_model_path
118
- reasyn_devices
119
- nn_model_path
120
- nn_metadata_path
121
- llm_model
122
- llm_base_url
123
- llm_api_key
124
- ```
125
-
126
- The wrapper intentionally preserves user payloads and lets `bo_api` own native
127
- defaults and schema behavior.
1
+ # LDM-BO API Endpoint Reference
2
+
3
+ All paths are relative to `http://111.2.199.31:52317/api/v1`.
4
+
5
+ This reference is for using the exposed HTTP API. It is not a local PDF2Dock
6
+ runner.
7
+
8
+ ## Health
9
+
10
+ `GET /chem/ldm-bo/health`
11
+
12
+ The response reports whether the adapter can see the mounted PDF2Dock
13
+ interpreter, `bo_api.py`, Vina binary, ReaSyn repo/interpreter/checkpoints, NN
14
+ model files, cache directory, GPU settings, and LLM configuration. Missing LLM
15
+ settings degrade health because LDM methods need them.
16
+
17
+ ## One-Step Recommend
18
+
19
+ `POST /chem/ldm-bo/recommend`
20
+
21
+ Wraps `bo_api.recommend_next_smiles`.
22
+
23
+ Typical payload:
24
+
25
+ ```json
26
+ {
27
+ "method": "bo-tanimoto",
28
+ "pool": ["CCO", "CCN", "CCC"],
29
+ "history": [
30
+ {"smiles": "CCO", "scores": [-7.1]},
31
+ {"smiles": "CCN", "scores": [-6.8]}
32
+ ],
33
+ "batch_size": 1
34
+ }
35
+ ```
36
+
37
+ Typical native response inside gateway `data`:
38
+
39
+ ```json
40
+ {
41
+ "recommendations": ["CCC"],
42
+ "acquisition_values": [0.12],
43
+ "n_objectives": 1
44
+ }
45
+ ```
46
+
47
+ LDM methods may include an `llm` diagnostics object.
48
+
49
+ ## Full Trajectory
50
+
51
+ `POST /chem/ldm-bo/trajectory`
52
+
53
+ Wraps `bo_api.run_search_trajectory`.
54
+
55
+ Small smoke payload:
56
+
57
+ ```json
58
+ {
59
+ "method": "bo-tanimoto",
60
+ "seed": 42,
61
+ "seed-smiles": "CCO,CCN,CCC",
62
+ "num-evaluations": 4,
63
+ "batch-size": 1,
64
+ "objective": "vina+nn"
65
+ }
66
+ ```
67
+
68
+ Typical native response inside gateway `data`:
69
+
70
+ ```json
71
+ {
72
+ "config": {},
73
+ "history": [],
74
+ "summary": {}
75
+ }
76
+ ```
77
+
78
+ LDM methods may include `llm_trajectory`.
79
+
80
+ ## Error Handling
81
+
82
+ The service maps native `bo_api` error JSON to an upstream failure. The gateway
83
+ returns a standard error envelope:
84
+
85
+ ```json
86
+ {
87
+ "code": 1,
88
+ "message": "AutoDock Vina executable not found...",
89
+ "data": {
90
+ "endpoint": "/v1/trajectory",
91
+ "service_url": "http://ldm-bo-service:8895",
92
+ "ldm_bo_response": {
93
+ "error": "...",
94
+ "error_type": "ValueError",
95
+ "traceback": "Traceback ..."
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ Common causes are missing Vina, missing ReaSyn, wrong Python interpreter, CUDA
102
+ device mismatch, missing LLM credentials for LDM methods, or an unwritable Vina
103
+ cache directory.
104
+
105
+ ## Provider Settings
106
+
107
+ Do not send provider settings in request JSON. The adapter reads these from
108
+ deployment config and passes them as Python kwargs to `bo_api`:
109
+
110
+ ```text
111
+ vina_bin
112
+ vina_cache_dir
113
+ vina_max_workers
114
+ gp_device
115
+ reasyn_repo
116
+ reasyn_python_bin
117
+ reasyn_model_path
118
+ reasyn_devices
119
+ nn_model_path
120
+ nn_metadata_path
121
+ llm_model
122
+ llm_base_url
123
+ llm_api_key
124
+ ```
125
+
126
+ The wrapper intentionally preserves user payloads and lets `bo_api` own native
127
+ defaults and schema behavior.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: pubchem
3
3
  description: 当用户给出化学品、分子、药物名称并询问 CID、同义词、分子式、分子量、SMILES、InChI、IUPAC 名、XLogP、TPSA 或供受体数量时使用;也用于在 RDKit 前批量把名称解析为 SMILES。所有实时请求只走 Delta CLI wrapper,并以当前 WORKSPACE_ROOT 下的有界 JSON 作为权威交接产物。
4
4
  metadata:
@@ -7,87 +7,87 @@ metadata:
7
7
  - python_repl
8
8
  - step_finish
9
9
  ---
10
-
11
- # PubChem 服务
12
-
13
- ## 强制执行规则
14
-
15
- 1. 第一个且唯一实时执行工具是 `python_repl`,直接执行
16
- `$SKILLS_ROOT/delta-science/scripts/invoke.py`。
17
- 调用 `python_repl` 时工具参数对象只能包含 `code`;禁止传入 `deps`、
18
- `dependencies`、`packages` 或其他参数。
19
- 2. `SKILLS_ROOT` 只通过 `os.environ["SKILLS_ROOT"]` 读取;禁止 Bash、
20
- `list_dir/read_file/which/where/ls`、wrapper 检查和路径探测。
21
- 3. 禁止执行字面命令 `CLI/cli/delta-cli`,禁止 curl、requests、httpx、浏览器、
22
- PUG-REST 和本地替代。
23
- 4. wrapper 已解包所有 envelope,业务结果直接位于 `r["native"]`;禁止
24
- `native.data` 和递归找值。
25
- 5. 不先调用 health/schema,不为“验证”重复同一请求。
26
-
27
- ## 单化合物默认模板
28
-
29
- ```python
30
- import json, os, subprocess, sys
31
- from pathlib import Path
32
- wrapper=os.path.join(os.environ["SKILLS_ROOT"],"delta-science","scripts","invoke.py")
33
- payload={"identifier":"aspirin","namespace":"name"}
34
- p=subprocess.run([sys.executable,wrapper,"--tool","pubchem","--endpoint","compound-summary",
35
- "--data-json",json.dumps(payload)],capture_output=True,text=True,
36
- encoding="utf-8",errors="replace",shell=False,timeout=150)
37
- if p.returncode != 0: raise RuntimeError(p.stderr or p.stdout)
38
- r=json.loads(p.stdout)
39
- if r.get("ok") is not True or r.get("transport")!="delta-cli": raise RuntimeError(r)
40
- n=r["native"]; x=n["properties"]
41
- out={"transport":r["transport"],"endpoint":r["endpoint"],"valid":n["valid"],
42
- "cid":n.get("cid") or x.get("CID"),"canonical_smiles":x.get("CanonicalSMILES"),
43
- "molecular_formula":x.get("MolecularFormula"),
44
- "molecular_weight":x.get("MolecularWeight")}
45
- output_path=Path(os.environ["WORKSPACE_ROOT"])/"pubchem_result.json"
46
- output_path.write_text(json.dumps(out,ensure_ascii=False,indent=2),encoding="utf-8")
47
- print(json.dumps({"output_ref":str(output_path),"result":out},ensure_ascii=False))
48
- ```
49
-
50
- `out` 只保留用户要求的字段。逐字复制返回值:不得改写等价 SMILES、给公式加排版、
51
- 给数值加单位、添加 URL/链接/用途/机制或未请求属性。
52
-
53
- ## operation 选择
54
-
55
- - 一个名称的基础信息:一次 `compound-summary`。
56
- - 两个及以上名称:一次 `compound-batch-summary`,body 只用
57
- `{"identifiers":[...],"namespace":"name"}`。
58
- - 只解析 CID、只查属性或同义词:分别使用 `compound-resolve-cids`、
59
- `compound-properties`、`compound-synonyms`。
60
- - 每个 operation 的准确情景、payload 和投影见
61
- `references/operations.md`;复杂字段再看 `references/endpoints.md`。
62
-
63
- 批量结果从 `native.results[*]` 读取,原标签是 `input`,化合物字段在嵌套
64
- `properties`。SMILES 回退顺序固定为:
65
-
66
- ```text
67
- CanonicalSMILES || ConnectivitySMILES || SMILES || IsomericSMILES
68
- ```
69
-
70
- 无机材料化学式、组成和式量路由 pymatgen;PubChem not_found 原样保留,不编造 CID
71
- 或本地补算。PubChem `XLogP` 与 RDKit `MolLogP` 不得互换。
72
-
73
- 成功写入有界 JSON 后,用其中的原始字符串和数值构造无 Markdown、无单位的最终文本,
74
- 并立即调用 `step_finish` 恰好一次。例如:
75
-
76
- ```text
77
- 【最终答案,必须逐字转发】
78
- CID: 2244
79
- 规范 SMILES: CC(=O)OC1=CC=CC=C1C(=O)O
80
- 分子式: C9H8O4
81
- 分子量: 180.16
82
- ```
83
-
84
- `status="done"`,`summary` 第一行必须逐字为 `【最终答案,必须逐字转发】`,其余行
85
- 逐字使用当前 out;`output_ref` 必须是刚写入的绝对 `pubchem_result.json` 路径。
86
- 不得使用示例固定值。缺少首行或 output_ref 时不得结束步骤。
87
- Skill 自身的 final_response 和外层 Memento 都必须逐字复制 summary,包括大小写和标点,
88
- 不得改成 Markdown/LaTeX、另一种等价 SMILES、添加单位、链接或说明。失败时调用
89
- `step_finish(status="failed", summary=<原始错误短摘要>)`。调用后禁止自由文本和工具。
90
-
91
- 具名 Skill 返回后,外层若需要核验只能对 `output_ref` 使用一次原子 `read_file`;禁止
92
- `python_repl`、`list_dir`、路径探测或再次调用 PubChem/Science。该文件只是当前会话的
93
- 内部证据交接,不是用户要求的额外交付物。
10
+
11
+ # PubChem 服务
12
+
13
+ ## 强制执行规则
14
+
15
+ 1. 第一个且唯一实时执行工具是 `python_repl`,直接执行
16
+ `$SKILLS_ROOT/delta-science/scripts/invoke.py`。
17
+ 调用 `python_repl` 时工具参数对象只能包含 `code`;禁止传入 `deps`、
18
+ `dependencies`、`packages` 或其他参数。
19
+ 2. `SKILLS_ROOT` 只通过 `os.environ["SKILLS_ROOT"]` 读取;禁止 Bash、
20
+ `list_dir/read_file/which/where/ls`、wrapper 检查和路径探测。
21
+ 3. 禁止执行字面命令 `CLI/cli/delta-cli`,禁止 curl、requests、httpx、浏览器、
22
+ PUG-REST 和本地替代。
23
+ 4. wrapper 已解包所有 envelope,业务结果直接位于 `r["native"]`;禁止
24
+ `native.data` 和递归找值。
25
+ 5. 不先调用 health/schema,不为“验证”重复同一请求。
26
+
27
+ ## 单化合物默认模板
28
+
29
+ ```python
30
+ import json, os, subprocess, sys
31
+ from pathlib import Path
32
+ wrapper=os.path.join(os.environ["SKILLS_ROOT"],"delta-science","scripts","invoke.py")
33
+ payload={"identifier":"aspirin","namespace":"name"}
34
+ p=subprocess.run([sys.executable,wrapper,"--tool","pubchem","--endpoint","compound-summary",
35
+ "--data-json",json.dumps(payload)],capture_output=True,text=True,
36
+ encoding="utf-8",errors="replace",shell=False,timeout=150)
37
+ if p.returncode != 0: raise RuntimeError(p.stderr or p.stdout)
38
+ r=json.loads(p.stdout)
39
+ if r.get("ok") is not True or r.get("transport")!="delta-cli": raise RuntimeError(r)
40
+ n=r["native"]; x=n["properties"]
41
+ out={"transport":r["transport"],"endpoint":r["endpoint"],"valid":n["valid"],
42
+ "cid":n.get("cid") or x.get("CID"),"canonical_smiles":x.get("CanonicalSMILES"),
43
+ "molecular_formula":x.get("MolecularFormula"),
44
+ "molecular_weight":x.get("MolecularWeight")}
45
+ output_path=Path(os.environ["WORKSPACE_ROOT"])/"pubchem_result.json"
46
+ output_path.write_text(json.dumps(out,ensure_ascii=False,indent=2),encoding="utf-8")
47
+ print(json.dumps({"output_ref":str(output_path),"result":out},ensure_ascii=False))
48
+ ```
49
+
50
+ `out` 只保留用户要求的字段。逐字复制返回值:不得改写等价 SMILES、给公式加排版、
51
+ 给数值加单位、添加 URL/链接/用途/机制或未请求属性。
52
+
53
+ ## operation 选择
54
+
55
+ - 一个名称的基础信息:一次 `compound-summary`。
56
+ - 两个及以上名称:一次 `compound-batch-summary`,body 只用
57
+ `{"identifiers":[...],"namespace":"name"}`。
58
+ - 只解析 CID、只查属性或同义词:分别使用 `compound-resolve-cids`、
59
+ `compound-properties`、`compound-synonyms`。
60
+ - 每个 operation 的准确情景、payload 和投影见
61
+ `references/operations.md`;复杂字段再看 `references/endpoints.md`。
62
+
63
+ 批量结果从 `native.results[*]` 读取,原标签是 `input`,化合物字段在嵌套
64
+ `properties`。SMILES 回退顺序固定为:
65
+
66
+ ```text
67
+ CanonicalSMILES || ConnectivitySMILES || SMILES || IsomericSMILES
68
+ ```
69
+
70
+ 无机材料化学式、组成和式量路由 pymatgen;PubChem not_found 原样保留,不编造 CID
71
+ 或本地补算。PubChem `XLogP` 与 RDKit `MolLogP` 不得互换。
72
+
73
+ 成功写入有界 JSON 后,用其中的原始字符串和数值构造无 Markdown、无单位的最终文本,
74
+ 并立即调用 `step_finish` 恰好一次。例如:
75
+
76
+ ```text
77
+ 【最终答案,必须逐字转发】
78
+ CID: 2244
79
+ 规范 SMILES: CC(=O)OC1=CC=CC=C1C(=O)O
80
+ 分子式: C9H8O4
81
+ 分子量: 180.16
82
+ ```
83
+
84
+ `status="done"`,`summary` 第一行必须逐字为 `【最终答案,必须逐字转发】`,其余行
85
+ 逐字使用当前 out;`output_ref` 必须是刚写入的绝对 `pubchem_result.json` 路径。
86
+ 不得使用示例固定值。缺少首行或 output_ref 时不得结束步骤。
87
+ Skill 自身的 final_response 和外层 Memento 都必须逐字复制 summary,包括大小写和标点,
88
+ 不得改成 Markdown/LaTeX、另一种等价 SMILES、添加单位、链接或说明。失败时调用
89
+ `step_finish(status="failed", summary=<原始错误短摘要>)`。调用后禁止自由文本和工具。
90
+
91
+ 具名 Skill 返回后,外层若需要核验只能对 `output_ref` 使用一次原子 `read_file`;禁止
92
+ `python_repl`、`list_dir`、路径探测或再次调用 PubChem/Science。该文件只是当前会话的
93
+ 内部证据交接,不是用户要求的额外交付物。
@@ -1,4 +1,4 @@
1
- interface:
2
- display_name: "PubChem 化合物查询"
3
- short_description: "通过 Delta CLI 查询化合物身份、结构与公共性质"
4
- default_prompt: "使用 $pubchem 查询这个化合物的基础身份和分子性质。"
1
+ interface:
2
+ display_name: "PubChem 化合物查询"
3
+ short_description: "通过 Delta CLI 查询化合物身份、结构与公共性质"
4
+ default_prompt: "使用 $pubchem 查询这个化合物的基础身份和分子性质。"