@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,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: rdkit
3
3
  description: 当用户需要通过已部署的 Delta Science 服务校验或规范化 SMILES/InChI、计算 RDKit 描述符、指纹、相似度、渲染或子结构筛选时使用。所有实时请求只能由 python_repl 直接执行 delta-science Skill 的 invoke.py;禁止 Bash、目录探测、直接 HTTP、本地 RDKit 和 native.data 路径。
4
4
  metadata:
@@ -7,106 +7,106 @@ metadata:
7
7
  - python_repl
8
8
  - step_finish
9
9
  ---
10
-
11
- # RDKit 服务
12
-
13
- ## 不可违反的执行规则
14
-
15
- 1. 第一个且唯一允许用于实时 Science 调用的工具是 `python_repl`。
16
- `python_repl` 的工具参数对象只能包含 `code`;禁止 `deps`、`dependencies`、
17
- `packages` 或其他参数。
18
- 2. 在 `python_repl` 中直接执行同级 Skill 的
19
- `$SKILLS_ROOT/delta-science/scripts/invoke.py`。`SKILLS_ROOT` 只能通过
20
- `os.environ["SKILLS_ROOT"]` 读取,不能把 `@SKILLS_ROOT` 当成目录。
21
- 3. 禁止使用 Bash、`list_dir`、`read_file`、`which`、`where`、`ls`,禁止检查
22
- wrapper 或寻找 CLI,禁止执行字面命令 `CLI`、`cli`、`delta-cli`。
23
- 4. 禁止 `curl`、`requests`、`httpx`、浏览器和本地 RDKit 回退。
24
- 5. wrapper 成功后,业务结果就在 `result["native"]` 顶层;绝不读取
25
- `result["native"]["data"]`。
26
- 6. 一个请求只执行完成任务所需的最少调用。失败后不得自行探测路径、改走 HTTP
27
- 或改用本地计算。
28
-
29
- ## 唯一调用模板
30
-
31
- ```python
32
- import json, os, subprocess, sys
33
- wrapper = os.path.join(os.environ["SKILLS_ROOT"], "delta-science", "scripts", "invoke.py")
34
- payload = {
35
- "molecules": [{"id": "aspirin", "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O"}],
36
- "descriptor_set": "basic",
37
- "sanitize": True,
38
- }
39
- p = subprocess.run(
40
- [sys.executable, wrapper, "--tool", "rdkit", "--endpoint", "batch-parse-describe",
41
- "--data-json", json.dumps(payload)],
42
- capture_output=True, text=True, shell=False,
43
- )
44
- if p.returncode != 0:
45
- raise RuntimeError(p.stderr or p.stdout)
46
- r = json.loads(p.stdout)
47
- if r.get("ok") is not True or r.get("transport") != "delta-cli":
48
- raise RuntimeError(r)
49
- n = r["native"]
50
- item = n["results"][0]
51
- answer = {
52
- "endpoint": r["endpoint"],
53
- "valid": item["valid"],
54
- "canonical_smiles": item.get("canonical_smiles"),
55
- "descriptors": item.get("descriptors"),
56
- "warnings": item.get("warnings", []),
57
- }
58
- print(json.dumps(answer, ensure_ascii=False))
59
- ```
60
-
61
- 只替换 payload 和逻辑 endpoint。不要先调用 health,也不要增加第二次 parse 或
62
- descriptors 调用。只要进程退出码、`ok`、`transport` 和解析均成功,本次调用就已
63
- 完成;不得因为界面未显示 Python 表达式值而重复调用,不得通过打印 stdout、stderr
64
- 或完整 native 调试。
65
-
66
- 成功打印有界 JSON 后,立即调用 `step_finish(status="done", summary=<该 JSON>)`
67
- 恰好一次,不设置 `output_ref`,随后不得输出自由文本或调用工具。失败时调用
68
- `step_finish(status="failed", summary=<原始错误的短摘要>)`,禁止重试、调试打印或
69
- 路径探测。
70
-
71
- ## 端点选择
72
-
73
- - 同时要求解析和基础描述符:只调用一次 `batch-parse-describe`,payload 必须使用
74
- `molecules`,每项使用 `id` 和 `smiles`;`descriptor_set` 为 `basic`,
75
- `sanitize` 为 `true`。
76
- - 只解析或规范化一个输入:`parse`,payload 为
77
- `{"input":"...","format":"smiles"}` 或相应 InChI 格式。
78
- - 只计算描述符:`descriptors`;批量只计算描述符:`batch-descriptors`。
79
- - 两个分子的相似度:`similarity`;多个分子的全对相似度:
80
- `similarity-matrix`。
81
- - 渲染:`render`;指纹:`fingerprint`;SMARTS 筛选:`substructure`。
82
-
83
- 非默认 operation 先读 `references/operations.md` 中对应小节;完整字段和允许值再见
84
- `references/endpoints.md`。不要根据其他服务相似端点猜 schema。
85
-
86
- ## 多分子相似度
87
-
88
- 名称必须先由 PubChem Skill 得到 SMILES,再执行一次 `similarity-matrix`:
89
-
90
- ```python
91
- payload = {
92
- "molecules": [{"id": name, "smiles": smiles} for name, smiles in resolved],
93
- "fingerprint": {"type": "morgan", "radius": 2, "n_bits": 2048},
94
- "sanitize": True,
95
- }
96
- ```
97
-
98
- 结果从 `n["matrix"]` 和 `n["ranked_pairs"]` 读取。每个排名项固定为
99
- `{"a": 名称, "b": 名称, "similarity": 数值}`;禁止读取 `i`、`j`、
100
- `score`,禁止自行重算或添加阈值解释。
101
-
102
- ## 结果与失败边界
103
-
104
- - 只报告本次 `native` 返回的字段、数值和警告,不用记忆补值。
105
- - 描述符只能逐项复制 `item["descriptors"]` 中实际存在的键和值;不得补充
106
- `NumAromaticRings`、形式电荷、官能团、手性、结构原因、单位或解释,除非这些字段
107
- 确实由本次 native 返回且用户明确要求。
108
- - `valid: false` 是化学输入校验失败,原样报告 `error`/`warnings`。
109
- - wrapper、CLI 或后端失败时,报告实际阶段和错误;不要继续探测或回退。
110
- - 渲染结果只有在解码后的字节以 PNG magic bytes 开头时才能保存为 `.png`;禁止
111
- 把 JSON envelope 保存成图片。
112
- - PubChem 的 `XLogP` 与 RDKit 的 `MolLogP` 不是同一来源,不得互相替代。
10
+
11
+ # RDKit 服务
12
+
13
+ ## 不可违反的执行规则
14
+
15
+ 1. 第一个且唯一允许用于实时 Science 调用的工具是 `python_repl`。
16
+ `python_repl` 的工具参数对象只能包含 `code`;禁止 `deps`、`dependencies`、
17
+ `packages` 或其他参数。
18
+ 2. 在 `python_repl` 中直接执行同级 Skill 的
19
+ `$SKILLS_ROOT/delta-science/scripts/invoke.py`。`SKILLS_ROOT` 只能通过
20
+ `os.environ["SKILLS_ROOT"]` 读取,不能把 `@SKILLS_ROOT` 当成目录。
21
+ 3. 禁止使用 Bash、`list_dir`、`read_file`、`which`、`where`、`ls`,禁止检查
22
+ wrapper 或寻找 CLI,禁止执行字面命令 `CLI`、`cli`、`delta-cli`。
23
+ 4. 禁止 `curl`、`requests`、`httpx`、浏览器和本地 RDKit 回退。
24
+ 5. wrapper 成功后,业务结果就在 `result["native"]` 顶层;绝不读取
25
+ `result["native"]["data"]`。
26
+ 6. 一个请求只执行完成任务所需的最少调用。失败后不得自行探测路径、改走 HTTP
27
+ 或改用本地计算。
28
+
29
+ ## 唯一调用模板
30
+
31
+ ```python
32
+ import json, os, subprocess, sys
33
+ wrapper = os.path.join(os.environ["SKILLS_ROOT"], "delta-science", "scripts", "invoke.py")
34
+ payload = {
35
+ "molecules": [{"id": "aspirin", "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O"}],
36
+ "descriptor_set": "basic",
37
+ "sanitize": True,
38
+ }
39
+ p = subprocess.run(
40
+ [sys.executable, wrapper, "--tool", "rdkit", "--endpoint", "batch-parse-describe",
41
+ "--data-json", json.dumps(payload)],
42
+ capture_output=True, text=True, shell=False,
43
+ )
44
+ if p.returncode != 0:
45
+ raise RuntimeError(p.stderr or p.stdout)
46
+ r = json.loads(p.stdout)
47
+ if r.get("ok") is not True or r.get("transport") != "delta-cli":
48
+ raise RuntimeError(r)
49
+ n = r["native"]
50
+ item = n["results"][0]
51
+ answer = {
52
+ "endpoint": r["endpoint"],
53
+ "valid": item["valid"],
54
+ "canonical_smiles": item.get("canonical_smiles"),
55
+ "descriptors": item.get("descriptors"),
56
+ "warnings": item.get("warnings", []),
57
+ }
58
+ print(json.dumps(answer, ensure_ascii=False))
59
+ ```
60
+
61
+ 只替换 payload 和逻辑 endpoint。不要先调用 health,也不要增加第二次 parse 或
62
+ descriptors 调用。只要进程退出码、`ok`、`transport` 和解析均成功,本次调用就已
63
+ 完成;不得因为界面未显示 Python 表达式值而重复调用,不得通过打印 stdout、stderr
64
+ 或完整 native 调试。
65
+
66
+ 成功打印有界 JSON 后,立即调用 `step_finish(status="done", summary=<该 JSON>)`
67
+ 恰好一次,不设置 `output_ref`,随后不得输出自由文本或调用工具。失败时调用
68
+ `step_finish(status="failed", summary=<原始错误的短摘要>)`,禁止重试、调试打印或
69
+ 路径探测。
70
+
71
+ ## 端点选择
72
+
73
+ - 同时要求解析和基础描述符:只调用一次 `batch-parse-describe`,payload 必须使用
74
+ `molecules`,每项使用 `id` 和 `smiles`;`descriptor_set` 为 `basic`,
75
+ `sanitize` 为 `true`。
76
+ - 只解析或规范化一个输入:`parse`,payload 为
77
+ `{"input":"...","format":"smiles"}` 或相应 InChI 格式。
78
+ - 只计算描述符:`descriptors`;批量只计算描述符:`batch-descriptors`。
79
+ - 两个分子的相似度:`similarity`;多个分子的全对相似度:
80
+ `similarity-matrix`。
81
+ - 渲染:`render`;指纹:`fingerprint`;SMARTS 筛选:`substructure`。
82
+
83
+ 非默认 operation 先读 `references/operations.md` 中对应小节;完整字段和允许值再见
84
+ `references/endpoints.md`。不要根据其他服务相似端点猜 schema。
85
+
86
+ ## 多分子相似度
87
+
88
+ 名称必须先由 PubChem Skill 得到 SMILES,再执行一次 `similarity-matrix`:
89
+
90
+ ```python
91
+ payload = {
92
+ "molecules": [{"id": name, "smiles": smiles} for name, smiles in resolved],
93
+ "fingerprint": {"type": "morgan", "radius": 2, "n_bits": 2048},
94
+ "sanitize": True,
95
+ }
96
+ ```
97
+
98
+ 结果从 `n["matrix"]` 和 `n["ranked_pairs"]` 读取。每个排名项固定为
99
+ `{"a": 名称, "b": 名称, "similarity": 数值}`;禁止读取 `i`、`j`、
100
+ `score`,禁止自行重算或添加阈值解释。
101
+
102
+ ## 结果与失败边界
103
+
104
+ - 只报告本次 `native` 返回的字段、数值和警告,不用记忆补值。
105
+ - 描述符只能逐项复制 `item["descriptors"]` 中实际存在的键和值;不得补充
106
+ `NumAromaticRings`、形式电荷、官能团、手性、结构原因、单位或解释,除非这些字段
107
+ 确实由本次 native 返回且用户明确要求。
108
+ - `valid: false` 是化学输入校验失败,原样报告 `error`/`warnings`。
109
+ - wrapper、CLI 或后端失败时,报告实际阶段和错误;不要继续探测或回退。
110
+ - 渲染结果只有在解码后的字节以 PNG magic bytes 开头时才能保存为 `.png`;禁止
111
+ 把 JSON envelope 保存成图片。
112
+ - PubChem 的 `XLogP` 与 RDKit 的 `MolLogP` 不是同一来源,不得互相替代。
@@ -1,4 +1,4 @@
1
- interface:
2
- display_name: "RDKit 化学信息学"
3
- short_description: "通过 Delta CLI 解析分子并计算描述符、相似度和子结构"
4
- default_prompt: "使用 $rdkit 校验这些分子并完成所需的结构计算。"
1
+ interface:
2
+ display_name: "RDKit 化学信息学"
3
+ short_description: "通过 Delta CLI 解析分子并计算描述符、相似度和子结构"
4
+ default_prompt: "使用 $rdkit 校验这些分子并完成所需的结构计算。"
@@ -1,133 +1,133 @@
1
- # RDKit Endpoint Reference
2
-
3
- 在 Memento 中只能通过 `delta-science/scripts/invoke.py` 调用。wrapper 已解包服务
4
- 信封,因此以下业务响应在 wrapper 结果中位于 `result["native"]` 顶层;禁止读取
5
- `result["native"]["data"]`。本文件中的 URL 只说明 schema,不授权直接 HTTP。
6
-
7
- All paths are relative to `http://111.2.199.31:52317/api/v1`.
8
-
9
- ## Health
10
-
11
- `GET /chem/rdkit/health`
12
-
13
- ## Parse
14
-
15
- `POST /chem/rdkit/parse`
16
-
17
- ```json
18
- {"input": "CCO", "format": "smiles", "sanitize": true}
19
- ```
20
-
21
- Formats: `smiles`, `inchi`, `molblock`.
22
-
23
- Key response fields in `data`: `valid`, `canonical_smiles`, `formula`,
24
- `molecular_weight`, `exact_molecular_weight`, `inchi_key`, `atom_count`,
25
- `heavy_atom_count`, `bond_count`, `warnings`, `error`.
26
-
27
- ## Descriptors
28
-
29
- `POST /chem/rdkit/descriptors`
30
-
31
- ```json
32
- {"smiles": "CCO", "descriptor_set": "basic", "sanitize": true}
33
- ```
34
-
35
- `descriptor_set` currently supports `basic`. Descriptor keys include `Formula`,
36
- `MolWt`, `ExactMolWt`, `HeavyAtomMolWt`, `TPSA`, `MolLogP`, `NumHDonors`,
37
- `NumHAcceptors`, `NumRotatableBonds`, `RingCount`, `FractionCSP3`,
38
- `HeavyAtomCount`, `AtomCount`, and `BondCount`.
39
-
40
- ## Batch Descriptors
41
-
42
- `POST /chem/rdkit/batch-descriptors`
43
-
44
- ```json
45
- {"smiles": ["CCO", "c1ccccc1"], "descriptor_set": "basic", "sanitize": true}
46
- ```
47
-
48
- Limits: 1-500 SMILES.
49
-
50
- ## Batch Parse Describe
51
-
52
- `POST /chem/rdkit/batch-parse-describe`
53
-
54
- ```json
55
- {
56
- "molecules": [
57
- {"id": "aspirin", "smiles": "CC(=O)Oc1ccccc1C(=O)O"},
58
- {"id": "caffeine", "smiles": "Cn1cnc2c1c(=O)n(C)c(=O)n2C"}
59
- ],
60
- "descriptor_set": "basic",
61
- "fingerprint": {"type": "morgan", "radius": 2, "n_bits": 2048},
62
- "sanitize": true
63
- }
64
- ```
65
-
66
- Limits: 1-500 molecules. Returns per-item `valid`, `canonical_smiles`, parse
67
- fields, `descriptors`, optional `fingerprint_metadata`, `on_bits`, `bit_count`,
68
- `warnings`, and `error`.
69
-
70
- ## Render
71
-
72
- `POST /chem/rdkit/render`
73
-
74
- ```json
75
- {"smiles": "CCO", "image_format": "svg", "width": 450, "height": 320}
76
- ```
77
-
78
- Image formats: `svg`, `png`. SVG returns text; PNG returns base64.
79
- Width/height range: 150-2000.
80
-
81
- ## Fingerprint
82
-
83
- `POST /chem/rdkit/fingerprint`
84
-
85
- ```json
86
- {"smiles": "CCO", "radius": 2, "n_bits": 2048}
87
- ```
88
-
89
- Morgan fingerprint parameters: `radius` 1-6, `n_bits` 128-8192.
90
-
91
- ## Similarity
92
-
93
- `POST /chem/rdkit/similarity`
94
-
95
- ```json
96
- {"query_smiles": "CCO", "target_smiles": "CCCO", "radius": 2, "n_bits": 2048}
97
- ```
98
-
99
- Returns Tanimoto similarity.
100
-
101
- ## Similarity Matrix
102
-
103
- `POST /chem/rdkit/similarity-matrix`
104
-
105
- ```json
106
- {
107
- "molecules": [
108
- {"id": "aspirin", "smiles": "CC(=O)Oc1ccccc1C(=O)O"},
109
- {"id": "ibuprofen", "smiles": "CC(C)Cc1ccc(cc1)[C@@H](C)C(=O)O"}
110
- ],
111
- "fingerprint": {"type": "morgan", "radius": 2, "n_bits": 2048},
112
- "sanitize": true
113
- }
114
- ```
115
-
116
- Returns `matrix` in input order and `ranked_pairs` sorted by descending
117
- Tanimoto similarity. Each ranked record is named, not index-based:
118
-
119
- ```json
120
- {"a":"aspirin","b":"ibuprofen","similarity":0.195122}
121
- ```
122
-
123
- Do not expect `i`, `j`, or `score` fields.
124
-
125
- ## Substructure
126
-
127
- `POST /chem/rdkit/substructure`
128
-
129
- ```json
130
- {"query_smarts": "c1ccccc1", "target_smiles": ["c1ccccc1", "CCO"]}
131
- ```
132
-
133
- Limits: SMARTS max length 5000; target list size 1-500.
1
+ # RDKit Endpoint Reference
2
+
3
+ 在 Memento 中只能通过 `delta-science/scripts/invoke.py` 调用。wrapper 已解包服务
4
+ 信封,因此以下业务响应在 wrapper 结果中位于 `result["native"]` 顶层;禁止读取
5
+ `result["native"]["data"]`。本文件中的 URL 只说明 schema,不授权直接 HTTP。
6
+
7
+ All paths are relative to `http://111.2.199.31:52317/api/v1`.
8
+
9
+ ## Health
10
+
11
+ `GET /chem/rdkit/health`
12
+
13
+ ## Parse
14
+
15
+ `POST /chem/rdkit/parse`
16
+
17
+ ```json
18
+ {"input": "CCO", "format": "smiles", "sanitize": true}
19
+ ```
20
+
21
+ Formats: `smiles`, `inchi`, `molblock`.
22
+
23
+ Key response fields in `data`: `valid`, `canonical_smiles`, `formula`,
24
+ `molecular_weight`, `exact_molecular_weight`, `inchi_key`, `atom_count`,
25
+ `heavy_atom_count`, `bond_count`, `warnings`, `error`.
26
+
27
+ ## Descriptors
28
+
29
+ `POST /chem/rdkit/descriptors`
30
+
31
+ ```json
32
+ {"smiles": "CCO", "descriptor_set": "basic", "sanitize": true}
33
+ ```
34
+
35
+ `descriptor_set` currently supports `basic`. Descriptor keys include `Formula`,
36
+ `MolWt`, `ExactMolWt`, `HeavyAtomMolWt`, `TPSA`, `MolLogP`, `NumHDonors`,
37
+ `NumHAcceptors`, `NumRotatableBonds`, `RingCount`, `FractionCSP3`,
38
+ `HeavyAtomCount`, `AtomCount`, and `BondCount`.
39
+
40
+ ## Batch Descriptors
41
+
42
+ `POST /chem/rdkit/batch-descriptors`
43
+
44
+ ```json
45
+ {"smiles": ["CCO", "c1ccccc1"], "descriptor_set": "basic", "sanitize": true}
46
+ ```
47
+
48
+ Limits: 1-500 SMILES.
49
+
50
+ ## Batch Parse Describe
51
+
52
+ `POST /chem/rdkit/batch-parse-describe`
53
+
54
+ ```json
55
+ {
56
+ "molecules": [
57
+ {"id": "aspirin", "smiles": "CC(=O)Oc1ccccc1C(=O)O"},
58
+ {"id": "caffeine", "smiles": "Cn1cnc2c1c(=O)n(C)c(=O)n2C"}
59
+ ],
60
+ "descriptor_set": "basic",
61
+ "fingerprint": {"type": "morgan", "radius": 2, "n_bits": 2048},
62
+ "sanitize": true
63
+ }
64
+ ```
65
+
66
+ Limits: 1-500 molecules. Returns per-item `valid`, `canonical_smiles`, parse
67
+ fields, `descriptors`, optional `fingerprint_metadata`, `on_bits`, `bit_count`,
68
+ `warnings`, and `error`.
69
+
70
+ ## Render
71
+
72
+ `POST /chem/rdkit/render`
73
+
74
+ ```json
75
+ {"smiles": "CCO", "image_format": "svg", "width": 450, "height": 320}
76
+ ```
77
+
78
+ Image formats: `svg`, `png`. SVG returns text; PNG returns base64.
79
+ Width/height range: 150-2000.
80
+
81
+ ## Fingerprint
82
+
83
+ `POST /chem/rdkit/fingerprint`
84
+
85
+ ```json
86
+ {"smiles": "CCO", "radius": 2, "n_bits": 2048}
87
+ ```
88
+
89
+ Morgan fingerprint parameters: `radius` 1-6, `n_bits` 128-8192.
90
+
91
+ ## Similarity
92
+
93
+ `POST /chem/rdkit/similarity`
94
+
95
+ ```json
96
+ {"query_smiles": "CCO", "target_smiles": "CCCO", "radius": 2, "n_bits": 2048}
97
+ ```
98
+
99
+ Returns Tanimoto similarity.
100
+
101
+ ## Similarity Matrix
102
+
103
+ `POST /chem/rdkit/similarity-matrix`
104
+
105
+ ```json
106
+ {
107
+ "molecules": [
108
+ {"id": "aspirin", "smiles": "CC(=O)Oc1ccccc1C(=O)O"},
109
+ {"id": "ibuprofen", "smiles": "CC(C)Cc1ccc(cc1)[C@@H](C)C(=O)O"}
110
+ ],
111
+ "fingerprint": {"type": "morgan", "radius": 2, "n_bits": 2048},
112
+ "sanitize": true
113
+ }
114
+ ```
115
+
116
+ Returns `matrix` in input order and `ranked_pairs` sorted by descending
117
+ Tanimoto similarity. Each ranked record is named, not index-based:
118
+
119
+ ```json
120
+ {"a":"aspirin","b":"ibuprofen","similarity":0.195122}
121
+ ```
122
+
123
+ Do not expect `i`, `j`, or `score` fields.
124
+
125
+ ## Substructure
126
+
127
+ `POST /chem/rdkit/substructure`
128
+
129
+ ```json
130
+ {"query_smarts": "c1ccccc1", "target_smiles": ["c1ccccc1", "CCO"]}
131
+ ```
132
+
133
+ Limits: SMARTS max length 5000; target list size 1-500.
@@ -1,64 +1,64 @@
1
- # RDKit operation 契约
2
-
3
- 所有示例都在 `SKILL.md` 的 wrapper 模板中设置 `endpoint` 和 `payload`。业务结果直接
4
- 位于 `r["native"]`。只做用户请求所需的一次调用,成功后调用 `step_finish`。
5
-
6
- ## health
7
-
8
- - 情景:明确检查 RDKit 服务状态。
9
- - 代码:`endpoint="health"; payload=None`,调用时省略 `--data-json`。
10
- - 投影:status、可用性、metadata、limits、warnings 中存在的字段。
11
-
12
- ## parse
13
-
14
- - 情景:只校验并规范化一个 SMILES/InChI。
15
- - 代码:`endpoint="parse"; payload={"input":"CCO","format":"smiles"}`
16
- - 投影:valid、canonical_smiles、formula、inchi_key、warnings/error。
17
-
18
- ## descriptors
19
-
20
- - 情景:只计算一个已知 SMILES 的描述符。
21
- - 代码:`endpoint="descriptors"; payload={"smiles":"CCO","descriptor_set":"basic","sanitize":True}`
22
- - 投影:valid 与 descriptors 中实际返回的键。
23
-
24
- ## batch-descriptors
25
-
26
- - 情景:对多个已知且无需再次解析的 SMILES 计算同一组描述符。
27
- - 代码:`endpoint="batch-descriptors"; payload={"smiles":["CCO","c1ccccc1"],"descriptor_set":"basic","sanitize":True}`
28
- - 投影:results 中每项的输入 SMILES、valid、descriptors、warnings/error。
29
-
30
- ## batch-parse-describe
31
-
32
- - 情景:同时校验、规范化并计算一个或多个分子的描述符。
33
- - 代码:`endpoint="batch-parse-describe"; payload={"molecules":[{"id":"aspirin","smiles":"CC(=O)OC1=CC=CC=C1C(=O)O"}],"descriptor_set":"basic","sanitize":True}`
34
- - 投影:results 中 id、valid、canonical_smiles、descriptors、warnings/error。
35
-
36
- ## render
37
-
38
- - 情景:用户明确要求分子结构图。
39
- - 代码:`endpoint="render"; payload={"smiles":"CCO","image_format":"png","width":500,"height":400}`
40
- - 投影:只解码文档指定的 base64 字段;验证 PNG magic bytes 后再保存。
41
-
42
- ## fingerprint
43
-
44
- - 情景:明确要求一个分子的 Morgan 指纹。
45
- - 代码:`endpoint="fingerprint"; payload={"smiles":"CCO","radius":2,"n_bits":2048}`
46
- - 投影:valid、fingerprint_metadata、on_bits、warnings/error。
47
-
48
- ## similarity
49
-
50
- - 情景:比较两个已知 SMILES。
51
- - 代码:`endpoint="similarity"; payload={"query_smiles":"CCO","target_smiles":"CCN","radius":2,"n_bits":2048}`
52
- - 投影:native 实际返回的 similarity、metric、fingerprint metadata。
53
-
54
- ## similarity-matrix
55
-
56
- - 情景:比较三个及以上分子的所有两两相似度。
57
- - 代码:`endpoint="similarity-matrix"; payload={"molecules":[{"id":"a","smiles":"CCO"},{"id":"b","smiles":"CCN"}],"fingerprint":{"type":"morgan","radius":2,"n_bits":2048},"sanitize":True}`
58
- - 投影:matrix 与 `ranked_pairs[{a,b,similarity}]`;禁止 i/j/score。
59
-
60
- ## substructure
61
-
62
- - 情景:用 SMARTS 在一个或多个目标 SMILES 中筛选子结构。
63
- - 代码:`endpoint="substructure"; payload={"query_smarts":"C(=O)O","target_smiles":["CC(=O)O","CCO"],"sanitize":True}`
64
- - 投影:query、每个目标的 valid/match/matches 与 warnings/error。
1
+ # RDKit operation 契约
2
+
3
+ 所有示例都在 `SKILL.md` 的 wrapper 模板中设置 `endpoint` 和 `payload`。业务结果直接
4
+ 位于 `r["native"]`。只做用户请求所需的一次调用,成功后调用 `step_finish`。
5
+
6
+ ## health
7
+
8
+ - 情景:明确检查 RDKit 服务状态。
9
+ - 代码:`endpoint="health"; payload=None`,调用时省略 `--data-json`。
10
+ - 投影:status、可用性、metadata、limits、warnings 中存在的字段。
11
+
12
+ ## parse
13
+
14
+ - 情景:只校验并规范化一个 SMILES/InChI。
15
+ - 代码:`endpoint="parse"; payload={"input":"CCO","format":"smiles"}`
16
+ - 投影:valid、canonical_smiles、formula、inchi_key、warnings/error。
17
+
18
+ ## descriptors
19
+
20
+ - 情景:只计算一个已知 SMILES 的描述符。
21
+ - 代码:`endpoint="descriptors"; payload={"smiles":"CCO","descriptor_set":"basic","sanitize":True}`
22
+ - 投影:valid 与 descriptors 中实际返回的键。
23
+
24
+ ## batch-descriptors
25
+
26
+ - 情景:对多个已知且无需再次解析的 SMILES 计算同一组描述符。
27
+ - 代码:`endpoint="batch-descriptors"; payload={"smiles":["CCO","c1ccccc1"],"descriptor_set":"basic","sanitize":True}`
28
+ - 投影:results 中每项的输入 SMILES、valid、descriptors、warnings/error。
29
+
30
+ ## batch-parse-describe
31
+
32
+ - 情景:同时校验、规范化并计算一个或多个分子的描述符。
33
+ - 代码:`endpoint="batch-parse-describe"; payload={"molecules":[{"id":"aspirin","smiles":"CC(=O)OC1=CC=CC=C1C(=O)O"}],"descriptor_set":"basic","sanitize":True}`
34
+ - 投影:results 中 id、valid、canonical_smiles、descriptors、warnings/error。
35
+
36
+ ## render
37
+
38
+ - 情景:用户明确要求分子结构图。
39
+ - 代码:`endpoint="render"; payload={"smiles":"CCO","image_format":"png","width":500,"height":400}`
40
+ - 投影:只解码文档指定的 base64 字段;验证 PNG magic bytes 后再保存。
41
+
42
+ ## fingerprint
43
+
44
+ - 情景:明确要求一个分子的 Morgan 指纹。
45
+ - 代码:`endpoint="fingerprint"; payload={"smiles":"CCO","radius":2,"n_bits":2048}`
46
+ - 投影:valid、fingerprint_metadata、on_bits、warnings/error。
47
+
48
+ ## similarity
49
+
50
+ - 情景:比较两个已知 SMILES。
51
+ - 代码:`endpoint="similarity"; payload={"query_smiles":"CCO","target_smiles":"CCN","radius":2,"n_bits":2048}`
52
+ - 投影:native 实际返回的 similarity、metric、fingerprint metadata。
53
+
54
+ ## similarity-matrix
55
+
56
+ - 情景:比较三个及以上分子的所有两两相似度。
57
+ - 代码:`endpoint="similarity-matrix"; payload={"molecules":[{"id":"a","smiles":"CCO"},{"id":"b","smiles":"CCN"}],"fingerprint":{"type":"morgan","radius":2,"n_bits":2048},"sanitize":True}`
58
+ - 投影:matrix 与 `ranked_pairs[{a,b,similarity}]`;禁止 i/j/score。
59
+
60
+ ## substructure
61
+
62
+ - 情景:用 SMARTS 在一个或多个目标 SMILES 中筛选子结构。
63
+ - 代码:`endpoint="substructure"; payload={"query_smarts":"C(=O)O","target_smiles":["CC(=O)O","CCO"],"sanitize":True}`
64
+ - 投影:query、每个目标的 valid/match/matches 与 warnings/error。