@delta-infra/cli 1.0.61 → 1.0.62
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/checksums.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
ee97f4fbd2e96e637186b16a2fe07e7f5efcee6e7d80b2f37be33169cd614ca8 delta-cli-darwin-amd64.tar.gz
|
|
2
|
+
cd5b445908a986529fc6eeb0c26552858ee9b0faed7eee863086033e027d44f7 delta-cli-darwin-arm64.tar.gz
|
|
3
|
+
e2cef122d91f28b14f24c1cb505033314a874bfabb2baf3942bad9a65c112ab0 delta-cli-linux-amd64.tar.gz
|
|
4
|
+
a63071b004394a3a5e2ed8c94da089655a334065d0e9507ecd4fc1e108130056 delta-cli-linux-arm64.tar.gz
|
|
5
|
+
5f9fc12e6af6ace5071ede349b526c1ce2b2e736355fe194262cc35977a43165 delta-cli-windows-amd64.zip
|
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ metadata:
|
|
|
49
49
|
- `finished=true` + `exit_code!=0` → 失败
|
|
50
50
|
- `running=true` → 仍运行
|
|
51
51
|
|
|
52
|
-
**故障诊断**:连续 3 次 `running=true` 且 `stderr_tail`/`cursor` 无变化且距离提交超过 60 秒 → 用 `sandbox status <id>` 检查 sandbox 是否存活。注意:`cursor` 字段无 `omitempty`,永远会出现在响应中(即使为 0);`stderr_tail` 默认只保留 **最后 200 字节** stderr 片段(CLI 硬编码 `tailString(s,
|
|
52
|
+
**故障诊断**:连续 3 次 `running=true` 且 `stderr_tail`/`stdout_tail`/`cursor` 无变化且距离提交超过 60 秒 → 用 `sandbox status <id>` 检查 sandbox 是否存活。注意:`cursor` 字段无 `omitempty`,永远会出现在响应中(即使为 0);`stderr_tail` 默认只保留 **最后 200 字节** stderr 片段,`stdout_tail` 默认保留 **最后 800 字节** stdout 片段(CLI 硬编码 `tailString(s, n)`,按字节截取;ASCII 文本等同于 n 字符,多字节 UTF-8 可能被截断),`cursor=0` 通常意味着服务端从 provider 还没读到任何 stderr 行。
|
|
53
53
|
|
|
54
54
|
- 后台任务成功后仍需按规则 2/3 销毁 sandbox。
|
|
55
55
|
|
|
@@ -142,7 +142,7 @@ required_outputs:
|
|
|
142
142
|
| **命令执行** | |
|
|
143
143
|
| 同步运行命令(≤60s) | `sandbox run <id> --command "..." [--timeout <秒>] [--summary/--no-summary] [--artifacts]` |
|
|
144
144
|
| 后台运行命令(>60s) | `sandbox run-bg <id> --command "..." [--timeout <秒>] [--wait] [--summary/--no-summary] [--artifacts]` |
|
|
145
|
-
| 查看后台日志 | `sandbox logs <id> --execution-id <exec_id> [--tail N --grep <pattern> --context N
|
|
145
|
+
| 查看后台日志 | `sandbox logs <id> --execution-id <exec_id> [--tail N --grep <pattern> --context N]` |
|
|
146
146
|
| 中断后台命令 | `sandbox cancel <id> --execution-id <exec_id>` |
|
|
147
147
|
| **文件操作** | |
|
|
148
148
|
| 读取文件 | `sandbox read <id> --path <path> [--output <本地路径> --tail N --grep <pattern> --offset N --limit N --context N --max-bytes N --parse-json]` |
|
|
@@ -187,7 +187,7 @@ required_outputs:
|
|
|
187
187
|
- Go:`go run /workspace/main.go`
|
|
188
188
|
- Shell:`bash /workspace/run.sh`
|
|
189
189
|
- **长任务(预计 > 60 秒,如下载模型、训练、编译、大规模数据处理)**:`delta-cli sandbox run-bg <id> --command "<命令>" --timeout <秒> [--log-file <路径>]` 提交后台任务,获得 `execution_id` 后通过以下命令轮询:
|
|
190
|
-
|
|
190
|
+
- `delta-cli sandbox logs <id> --execution-id <execution_id>` — 返回 `stdout_tail`(末尾 800 字节)、`stderr_tail`(末尾 200 字节)、`stdout_size`、`stderr_size`、`cursor`、`running`、`finished`、`exit_code`、`log_file`(完成后)。当 `finished=true` 时认为完成,完整输出需读取 `log_file`。
|
|
191
191
|
禁止对长任务使用同步 `sandbox run`
|
|
192
192
|
|
|
193
193
|
**推荐实践**:让 sandbox 脚本在 `stdout` 末尾打印一个独立的结构化 JSON 对象(例如 `{"status":"ok", ...}`),CLI 的 `--summary` 默认会自动反向扫描 stdout 末尾 JSON 提取为 `data.result_summary` 字段。这样即使 `stdout` 前面是大量训练/下载日志,skill 也无需让大模型去“读整段日志再摘要”。
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|------|------|
|
|
28
28
|
| `sandbox run <id> --command "..." [--timeout N] [--summary/--no-summary] [--artifacts]` | 同步运行命令;默认 `--summary` 开启,返回 JSON 中 `summary` 字段已含 stdout 末尾 JSON 提取结果;`--artifacts` 附带 workspace 产物清单 |
|
|
29
29
|
| `sandbox run-bg <id> --command "..." [--timeout N] [--wait] [--summary/--no-summary] [--artifacts]` | 后台运行命令;不加 `--wait` 立即返回 `{execution_id, sandbox_id}`;加 `--wait` 等待完成返回含 `summary` 的完整结果 |
|
|
30
|
-
| `sandbox logs <id> --execution-id <eid> [--tail N --grep <pattern> --context N
|
|
30
|
+
| `sandbox logs <id> --execution-id <eid> [--tail N --grep <pattern> --context N]` | 获取后台命令日志;**默认返回 `stdout_tail`(末尾 800 字节)+ `stderr_tail`(末尾 200 字节)+ `stderr_size` + `cursor`**,总计约 1KB,避免上下文爆炸;`--tail N` 同时作用于 stdout 和 stderr(各取尾 N 行);`--grep <pattern>` 同时过滤 stdout 和 stderr(正则);`--context N` 提供 grep 匹配行前后 N 行上下文(同时用于 stdout 和 stderr);**`cursor` 字段无 `omitempty`,0 也常驻响应**。 |
|
|
31
31
|
| `sandbox cancel <id> --execution-id <eid>` | 中断正在运行的后台命令 |
|
|
32
32
|
|
|
33
33
|
## 文件操作
|
|
@@ -51,30 +51,30 @@ delta-cli sandbox kill <id>
|
|
|
51
51
|
`sandbox logs` 返回的数据结构为:
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
|
-
{"ok":true,"data":{"sandbox_id":"...","execution_id":"...","stderr_tail":"...","stderr_size":1234,"cursor":5,"running":false,"finished":true,"exit_code":0,"log_file":"/tmp/delta-result-...json"}}
|
|
54
|
+
{"ok":true,"data":{"sandbox_id":"...","execution_id":"...","stdout_tail":"...","stderr_tail":"...","stdout_size":1234,"stderr_size":1234,"cursor":5,"running":false,"finished":true,"exit_code":0,"log_file":"/tmp/delta-result-...json"}}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
字段说明:
|
|
58
58
|
- `sandbox_id` / `execution_id` — 与请求一致
|
|
59
|
-
- `
|
|
59
|
+
- `stdout_tail` — CLI 默认保留的 **最后 800 字节** stdout 片段,避免上下文爆炸
|
|
60
|
+
- `stderr_tail` — CLI 默认保留的 **最后 200 字节** stderr 片段(CLI 硬编码 `tailString(s, n)` 按字节截取;ASCII 等同 n 字符,多字节 UTF-8 可能被截断),避免上下文爆炸。不传任何 range flag 时,CLI 会把原始 `stdout`/`stderr` 字段清空,只暴露 `stdout_tail`/`stderr_tail` 和 `stdout_size`/`stderr_size`
|
|
61
|
+
- `stdout_size` — 原始 stdout 字节数(CLI 端计算)
|
|
60
62
|
- `stderr_size` — 原始 stderr 字节数(CLI 端计算)
|
|
61
|
-
- `cursor` — 服务端 stderr 行计数器;**该字段无 `omitempty`,永远出现在响应中**(即使为 0
|
|
63
|
+
- `cursor` — 服务端 stderr 行计数器;**该字段无 `omitempty`,永远出现在响应中**(即使为 0)。`cursor=0` 通常意味着服务端从 provider 还没读到任何 stderr 行
|
|
62
64
|
- `running` — 命令是否仍在运行
|
|
63
65
|
- `finished` — 命令是否已完成(`finished = not running`)
|
|
64
66
|
- `exit_code` — 退出码(完成后才有值,运行中字段省略)
|
|
65
67
|
- `log_file` — 仅 `finished=true` 时出现,是 run envelope 日志文件路径(含完整 stdout + stderr + exit_code + finished + command + error),需读它用 `delta-cli sandbox read <id> --path <log_file>`
|
|
66
68
|
|
|
67
|
-
**stdout 路径说明**:`sandbox logs`
|
|
69
|
+
**stdout 路径说明**:`sandbox logs` 默认返回 stdout 末尾 800 字节(`stdout_tail`)提供实时中间进度预览,完整 stdout 仍在命令结束时被写入沙箱内的 `log_file`,需全文时用 `sandbox read` 读。CLI `run-bg --wait` 完成后默认开启 `--summary`,会自动 reverse-scan stdout 末尾 JSON 填入 `data.result_summary`,常用场景无需手动读 `log_file`。
|
|
68
70
|
|
|
69
|
-
要用 `--tail/--grep/--context
|
|
71
|
+
要用 `--tail/--grep/--context` 自定义切片:传任意一个 flag 时,CLI 会把过滤后的 stdout 和 stderr 分别写回 `stdout`/`stderr` 字段并更新 `stdout_size`/`stderr_size`;不传则保持 `stdout=""` + `stdout_tail` 末尾 800 字节预览 + `stderr=""` + `stderr_tail` 末尾 200 字节预览(总计约 1KB)。
|
|
70
72
|
|
|
71
73
|
```bash
|
|
72
|
-
# 看最后 50 行 stderr
|
|
74
|
+
# 看最后 50 行 stdout 和 stderr
|
|
73
75
|
delta-cli sandbox logs <id> --execution-id <eid> --tail 50
|
|
74
|
-
# 过滤 ERROR/warning
|
|
76
|
+
# 过滤 ERROR/warning 行(同时作用于 stdout 和 stderr)
|
|
75
77
|
delta-cli sandbox logs <id> --execution-id <eid> --grep "ERROR|warning" --context 2
|
|
76
|
-
# 兜底限流 32KB
|
|
77
|
-
delta-cli sandbox logs <id> --execution-id <eid> --max-bytes 32768
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
判断任务状态的规则(按优先顺序):
|