modellab-cli 0.0.0-stage → 0.1.0

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
@@ -1,3 +1,88 @@
1
- # Temporary Holding Version
1
+ # ModelLab CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 独立 Node.js 24 命令行客户端,使用版本化公共契约和 SDK,不引用服务端或 Web 源码。
4
+
5
+ ```sh
6
+ npm install -g modellab-cli@0.1.0
7
+ modellab --version
8
+ ```
9
+
10
+ ## 本地构建
11
+
12
+ ```sh
13
+ pnpm install --frozen-lockfile
14
+ pnpm check
15
+ pnpm test
16
+ pnpm skill:pack
17
+ npm pack --pack-destination release
18
+ npm install -g ./release/modellab-cli-0.1.0.tgz
19
+ modellab --version
20
+ ```
21
+
22
+ 构建将运行依赖打包进 Node ESM 可执行文件,npm 安装后不需要本地 TypeScript、其他仓库或依赖注册表。Node.js 内置模块仍由用户安装的 Node.js 提供。
23
+
24
+ ```sh
25
+ modellab profile add local --server http://127.0.0.1:8080
26
+ modellab auth login --profile local --feishu
27
+ # 无系统凭证存储时显式选择受限文件:
28
+ modellab auth login --profile local --feishu --credential-store file
29
+ modellab context use --project PROJECT_UUID
30
+ modellab doctor --json
31
+ modellab schema list --json
32
+ modellab flows catalog --json
33
+ modellab schema get runs.create --json
34
+ modellab runs create --file run.json --dry-run --json
35
+ modellab runs create --file run.json --idempotency-key UNIQUE_KEY --json
36
+ modellab runs follow RUN_UUID --json
37
+ modellab runs wait RUN_UUID --timeout 1800 --json
38
+ modellab runs call RUN_UUID CALL_UUID --json
39
+ modellab runs respond RUN_UUID INPUT_UUID --action send --message "继续上一个问题" --json
40
+ modellab runs respond RUN_UUID INPUT_UUID --action finish --json
41
+ ```
42
+
43
+ 飞书登录时,在浏览器打开终端给出的工作台链接,输入登录码并确认。使用 ModelLab 账号时,省略 `--feishu`;非交互登录通过 `--stdin` 读取 JSON `{login,password}`。CLI 登录凭证有效期为 7 天。macOS 默认使用系统钥匙串;`--credential-store file` 使用 0700 配置目录和 0600 凭证文件。`MODELLAB_TOKEN` 可提供运行时令牌。
44
+
45
+ 模型和连接属于当前项目,使用 `context use --project <项目 ID>` 设置默认项目,也可以在 `models` 或 `connections` 子命令传入 `--project`。
46
+
47
+ `--json` 的 stdout 仅含 JSON,事件跟踪是 NDJSON。全局 --project / --profile / --no-input / --timeout 适用于子命令。草稿修改带 --if-revision;异步运行提交后立即返回 ID,Ctrl-C 停止本地跟踪,取消服务端任务使用 runs cancel。
48
+
49
+ 公开操作均可使用通用入口,Schema 与权限仍由服务端验证:
50
+
51
+ ```sh
52
+ modellab api call resources.get --params '{"id":"RESOURCE_UUID"}' --json
53
+ modellab api call datasets.import.preview --params '{"id":"DATASET_UUID"}' --file mapping.json --json
54
+ modellab api call budgets.set --file budget.json --json
55
+ ```
56
+
57
+ 退出码:0 成功;1 服务或网络;2 参数;3 权限;4 运行失败;5 修订或幂等冲突;6 本地等待超时;7 不兼容;8 写入结果未知;9 取消。
58
+
59
+ ## 独立操作 Skill
60
+
61
+ ```sh
62
+ modellab integrations skills install --target codex --skill-version 0.1.0
63
+ modellab integrations skills install --target claude --skill-version 0.1.0
64
+ # 或手工解压 release/modellab-operations-0.1.0.tgz 到目标工具的 Skill 目录。
65
+ ```
66
+
67
+ 操作包名为 modellab-operations,类型 operation-skill-package。它与服务端 instruction_skill 资源分离。安装检查路径和文件哈希,拒绝覆盖已有修改;可用 --directory 安装到新目录后比较。CLI 升级不会自动改写已经安装的 Skill。
68
+
69
+ `tests/standalone-smoke.mjs` 从 npm tarball 安装到全新临时目录,再连接指定测试服务验证登录、项目创建、运行、SSE、等待、重评和 Skill 安装。需要已完成本地浏览器假模型配置,或按测试脚本提供自己的测试环境。
70
+
71
+ ### 导入 Buz 聊天回归测试集
72
+
73
+ ```sh
74
+ modellab datasets import-buz /path/to/buz_eval/data/cases.json --dry-run --json
75
+ modellab datasets import-buz /path/to/buz_eval/data/cases.json --project PROJECT_UUID --json
76
+ ```
77
+
78
+ 导入会发布固定脚本测试集,保留原始用例编号、角色、逐轮用户消息和评分预期。相同名称和来源的已发布导入可安全重试。项目首页和测试集详情均可发起测试。Buz 回归项目的「Buz · ALoHa 聊天回归」和「Buz · 自定义角色聊天回归」各有独立的资源及版本 ID。
79
+
80
+ 运行配置使用 `flow.version` 指定已发布流程,用 `dataset.version` 指定发布测试集。可选的 `dataset.caseIds` 和 `dataset.mapping` 用于选择样本及映射输入。各步骤在流程里声明模型、Prompt、消息来源及入参。用 `parameters` 设置流程公开参数,用 `variants[].steps` 按步骤 ID 设定未绑定配置。先用 `runs create --file run.json --dry-run` 预检,再提交整个流程。`runs get` 返回最终输出、步骤轨迹、等待项和调用详情。
81
+
82
+ ### 设置本次评分的裁判参数
83
+
84
+ 使用 `modellab api call evaluations.plan.create --file scoring-request.json --project PROJECT_UUID --json` 提交已发布方案的评分。请求包含 `runId`、`plan` 版本引用,可选 `judge` 版本引用。提供 `judgeParameters` 时,它是本次替代方案参数的完整对象,例如 `{"reasoning_effort":"low"}`。省略沿用方案,传 `{}` 仅使用所选模型的预设。可选的 `judgeMaxOutputTokens` 设置本次输出上限,传 `null` 采用供应商默认值。
85
+
86
+ 临时模型评分或两两盲评使用 `evaluations.model.create`,模型参数放在 `judge.parameters`,输出上限放在 `limits.maxOutputTokens`。通过 `modellab schema get <操作名> --json` 查看请求结构。
87
+
88
+ 批量评分自动整理公共请求前缀。通过 `modellab evaluations get <批次 ID> --json` 读取 `judgeCache`,其中 `reportedCalls`、`hitCalls` 和 `inputTokens` 分别是报告缓存用量的调用数、命中次数和实际复用的输入 Token 数。