@delta-infra/cli 1.0.94 → 1.0.96

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
@@ -73,9 +73,11 @@ Remove-Item -Path delta-cli.zip
73
73
  # 将 delta-cli.exe 放到 PATH 中的目录
74
74
  ```
75
75
 
76
- ### 方式三:一键安装脚本(国内用户推荐)
76
+ ### 方式三:一键安装脚本(国内用户推荐 / 无 npm 也可用)
77
77
 
78
- 安装脚本会自动尝试国内 npm 镜像(npmmirror),失败后再回退到 npm 官方源:
78
+ 安装脚本会**自动检测环境**:
79
+ - **已有 npm** → 安装 `@delta-infra/cli` npm 包(自动尝试国内 npm 镜像 npmmirror,失败回退 npm 官方源)
80
+ - **没有 npm** → 直接通过纯 shell 方式下载二进制(PowerShell + curl / bash + curl + tar,Windows 10+、macOS、Linux 均自带),**无需安装 Node.js/npm**
79
81
 
80
82
  ```bash
81
83
  # Linux / macOS
@@ -85,6 +87,8 @@ curl -L https://raw.githubusercontent.com/yzailab/delta-infra-cli/main/install.s
85
87
  Invoke-RestMethod -Uri https://raw.githubusercontent.com/yzailab/delta-infra-cli/main/install.ps1 | Invoke-Expression
86
88
  ```
87
89
 
90
+ 脚本下载二进制时会按顺序尝试国内加速镜像(`gh.ddlc.top`、`ghproxy.net`、`gh-proxy.com`),全部失败再用 GitHub 源站,且会校验 SHA-256。可用 `DELTA_CLI_VERSION` 环境变量指定版本。
91
+
88
92
  ### 方式四:npm
89
93
 
90
94
  ```bash
@@ -93,9 +97,9 @@ npm install -g @delta-infra/cli
93
97
 
94
98
  `postinstall` 会按以下顺序尝试下载当前平台的二进制:
95
99
 
96
- 1. `DELTA_CLI_MIRROR` 环境变量(如果设置)
97
- 2. 国内加速镜像 `https://gh-proxy.com/https://github.com/...`
98
- 3. GitHub 源站 `https://github.com/yzailab/delta-infra-cli/releases/download/...`
100
+ 1. `DELTA_CLI_MIRROR` 环境变量指定的镜像(如果设置,需为 HTTPS 且允许全前缀格式,如 `https://gh.ddlc.top`)
101
+ 2. 依次探测国内加速镜像 `gh.ddlc.top`、`ghproxy.net`、`gh-proxy.com`,可用的优先
102
+ 3. GitHub 源站 `https://github.com/yzailab/delta-infra-cli/releases/download/...`(兜底)
99
103
 
100
104
  如果安装时下载失败,可以:
101
105
 
@@ -110,7 +114,7 @@ DELTA_CLI_ARCHIVE=/path/to/delta-cli-linux-amd64.tar.gz npm install -g @delta-in
110
114
 
111
115
  | 变量 | 说明 |
112
116
  |------|------|
113
- | `DELTA_CLI_MIRROR` | 下载镜像,例如 `https://gh-proxy.com/https://github.com`。只接受 HTTPS 且需在白名单内。 |
117
+ | `DELTA_CLI_MIRROR` | 下载镜像根地址,例如 `https://gh.ddlc.top`。脚本会自动补全为全前缀格式(`<mirror>/https://github.com/...`)。只接受 HTTPS 且需在白名单内。 |
114
118
  | `DELTA_CLI_MIRROR_ALLOWLIST` | 额外允许的主机列表,逗号分隔。 |
115
119
  | `DELTA_CLI_ARCHIVE` | 指向预先下载好的 `.tar.gz` / `.zip` 本地路径,跳过网络下载。 |
116
120
  | `DELTA_CLI_SKIP_POSTINSTALL` | 设置为 `1` 跳过安装时的二进制下载,之后由 `delta-cli` 运行时兜底。 |
package/checksums.txt CHANGED
@@ -1,5 +1,5 @@
1
- 1a680424f9d53ec58263ca23f8b4e55404929cabc4e2313dc562325f684480f4 delta-cli-darwin-amd64.tar.gz
2
- da0d075b7fe9890449ff437159c52a741ba5eeb1f74d1adebdb4f432b8fafb27 delta-cli-darwin-arm64.tar.gz
3
- ff5c95b561247352645db84688d9694e0198b79203223b2b9d50189e1305dd25 delta-cli-linux-amd64.tar.gz
4
- d0cd2aa31ee177ec35e242674c822767f901b6d861c4da753c7cf3fd83b44877 delta-cli-linux-arm64.tar.gz
5
- 65984f247a4c45b44b29a905cf051c8fa19dc629eafc9cddc2e1a6eedfd2a52e delta-cli-windows-amd64.zip
1
+ af6912b03e0311132006e11347039feec80625cb78009605f73634cca4ea6f81 delta-cli-darwin-amd64.tar.gz
2
+ bde40f2b408370e4ba4e7ab2db27e667252b0fffa170eb50a2ffbf6faddcb891 delta-cli-darwin-arm64.tar.gz
3
+ c4ba50ce8b6d0085d101b1e87ac2f26e100dc669efde17702d278f0be5674832 delta-cli-linux-amd64.tar.gz
4
+ d6845091f519d360fa8c5de540ff5728e90da3511a780ba2e3fd09bce62cee28 delta-cli-linux-arm64.tar.gz
5
+ 732de5321a1b4ace79a546bc0ca2c8dfefeef9ae9c97d3f26cf92f832d5e4905 delta-cli-windows-amd64.zip
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delta-infra/cli",
3
- "version": "1.0.94",
3
+ "version": "1.0.96",
4
4
  "description": "Delta Infra CLI for sandbox compute and science tools.",
5
5
  "bin": {
6
6
  "delta-cli": "scripts/run.js"
@@ -85,6 +85,24 @@ var _MIRROR_LIST = [
85
85
  ["gh-proxy.com", "https://gh-proxy.com"],
86
86
  ];
87
87
 
88
+ // A safe "discard" output path for curl. /dev/null does not exist on Windows
89
+ // and makes curl fail with "client returned ERROR on write" (exit 23), which
90
+ // silently broke mirror probing on Windows. Use a throwaway temp file instead.
91
+ function discardOutputPath() {
92
+ if (process.platform !== "win32") return "/dev/null";
93
+ try {
94
+ return path.join(os.tmpdir(), "delta-cli-probe-" + process.pid + ".out");
95
+ } catch {
96
+ return "delta-cli-probe-" + process.pid + ".out";
97
+ }
98
+ }
99
+
100
+ function removeDiscardOutput(p) {
101
+ if (process.platform === "win32" && p) {
102
+ try { fs.unlinkSync(p); } catch {}
103
+ }
104
+ }
105
+
88
106
  // Quick connectivity check: fetch a small file (checksums.txt) from each
89
107
  // mirror and return only the ones that respond within the probe timeout.
90
108
  function probeMirrors(version, cb) {
@@ -113,10 +131,11 @@ function probeMirrors(version, cb) {
113
131
  var host = entry[0];
114
132
  var prefix = entry[1];
115
133
  var testUrl = prefix + probeUrl;
134
+ var discardPath = discardOutputPath();
116
135
  var args = [
117
136
  "--fail", "--location", "--silent", "--show-error",
118
137
  "--connect-timeout", "3", "--max-time", "5",
119
- "--output", "/dev/null", testUrl,
138
+ "--output", discardPath, testUrl,
120
139
  ];
121
140
  var child;
122
141
  try {
@@ -126,6 +145,7 @@ function probeMirrors(version, cb) {
126
145
  child.stdout.on("data", function(d) { stdout += d; });
127
146
  child.stderr.on("data", function(d) { stderr += d; });
128
147
  child.on("close", function(code) {
148
+ removeDiscardOutput(discardPath);
129
149
  if (code === 0) {
130
150
  results.push(prefix + "/https://github.com/" + REPO + "/releases/download/v" + version + "/" + archiveName);
131
151
  }
@@ -133,10 +153,12 @@ function probeMirrors(version, cb) {
133
153
  if (pending === 0) finish();
134
154
  });
135
155
  child.on("error", function() {
156
+ removeDiscardOutput(discardPath);
136
157
  pending--;
137
158
  if (pending === 0) finish();
138
159
  });
139
160
  } catch (e) {
161
+ removeDiscardOutput(discardPath);
140
162
  pending--;
141
163
  if (pending === 0) finish();
142
164
  }
@@ -150,7 +172,10 @@ function releaseAssetUrls(version, assetName, cb) {
150
172
  var urls = [];
151
173
  var mirror = process.env.DELTA_CLI_MIRROR || "";
152
174
  if (mirror) {
153
- urls.push("" + mirror.replace(/\/$/, "") + "/yzailab/delta-infra-cli/releases/download/v" + version + "/" + assetName);
175
+ // The mirror proxies the full GitHub release URL by prefixing it (same
176
+ // scheme the probed mirrors use, e.g. https://<mirror>/https://github.com/...).
177
+ // A bare "https://<mirror>/yzailab/..." 404s on these proxy-style mirrors.
178
+ urls.push("" + mirror.replace(/\/$/, "") + "/https://github.com/" + REPO + "/releases/download/v" + version + "/" + assetName);
154
179
  }
155
180
  // Probe mirrors in parallel first, then fallback
156
181
  probeMirrors(version, function(mirrorUrls) {
@@ -0,0 +1,49 @@
1
+ # skills/delta-science — Science Skill Package
2
+
3
+ **Parent:** `../AGENTS.md`
4
+
5
+ ## OVERVIEW
6
+
7
+ Single public `delta-science` skill: the company online-Science unified entrypoint. It is host-neutral and routed exclusively through `delta-cli science invoke -> Science Server`. Per-tool operation contracts live in `references/` and are loaded on demand; there are no separate planner-visible per-tool skills.
8
+
9
+ ## STRUCTURE
10
+
11
+ ```
12
+ delta-science/
13
+ ├── SKILL.md # single entrypoint: routing, CLI-only execution, cross-tool handoff
14
+ ├── agents/
15
+ │ └── openai.yaml # host agent registration
16
+ └── references/
17
+ ├── cli-contract.md # CLI envelope/exit-code contract
18
+ ├── routing-index.md # stable routing rules across tools
19
+ ├── workflows.md # multi-tool workflows
20
+ └── <tool>.md # per-tool operation contract (pubchem, rdkit, pymatgen, gsasii,
21
+ # lammps, delta-bo, ldm-bo, ldm, strbo, synbo, antbo, ...)
22
+ ```
23
+
24
+ ## WHERE TO LOOK
25
+
26
+ | Path | Content |
27
+ |------|---------|
28
+ | `SKILL.md` | Service boundary, 安全红线 (no curl/requests/httpx/browser direct gateway), invocation template, cross-tool handoff |
29
+ | `references/cli-contract.md` | `delta-cli science` envelope + exit-code contract; `ok:true` gate |
30
+ | `references/routing-index.md` | Which tool handles which science domain; stable routing |
31
+ | `references/<tool>.md` | Authoritative operation + request field schema per tool |
32
+
33
+ ## CONVENTIONS
34
+
35
+ - All science operations go through `delta-cli science invoke --tool T --endpoint E --data JSON`; no alternate routes
36
+ - Tool/endpoint names are exact contracts from the server DB — read the matching reference first; never invent fields/enums from memory
37
+ - Success is reported only when subprocess exit is 0 AND top-level JSON `ok` is `true`; `data` holds the service response
38
+ - `references/` holds operation contracts; `retired_skills` (old per-tool skills) are removed, not referenced
39
+ - Host-neutral: `delta-cli` is the sole service boundary; no host-specific tool/env dependencies
40
+ - Discover newly-deployed tools via `delta-cli science list` / `delta-cli science endpoints list <tool>`; do not copy the server registry into the Skill
41
+
42
+ ## ANTI-PATTERNS
43
+
44
+ - Do not call `curl`/`requests`/`httpx`/browser/PowerShell web directly against the gateway
45
+ - Do not bypass delta-cli via the legacy `large-discovery-model` Skill or gateway scripts
46
+ - Do not fabricate science data or mislabel local-tool (RDKit/pymatgen/LAMMPS/etc.) results as Science results
47
+ - Do not create extra JSON/CSV/report/image artifacts unless the user explicitly asks to save/export/plot
48
+ - Do not embed realistic credentials or API keys in examples
49
+ - Do not break relative links between SKILL.md and `references/`