@epoch-agent/cli 3.1.2 → 4.0.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 +10 -7
- package/dist/index.js +18 -3
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ epoch doctor # 装不上 / 跑不起来时第一个跑这个
|
|
|
49
49
|
| `worktree.ts` | `--worktree` 的 git 那一侧:建 worktree + 新分支、收尾时**有改动就不删** |
|
|
50
50
|
| `paths.ts` / `version.ts` | CLI 侧的路径与版本号;`--version` 那三行也在 `version.ts`,**第一行必须是裸版本号** |
|
|
51
51
|
|
|
52
|
-
## 带值的 flag
|
|
52
|
+
## 带值的 flag 在**分流之前**落地,其中七个走环境变量
|
|
53
53
|
|
|
54
54
|
「分流」= `commands/run.ts` 里那句「没有 prompt 就起 TUI」。所有带值 flag 的落地
|
|
55
55
|
与校验都排在它**前面**,入口只有一个:`commands/run-overrides.ts` 的
|
|
@@ -83,13 +83,15 @@ epoch doctor # 装不上 / 跑不起来时第一个跑这个
|
|
|
83
83
|
因为无参进 TUI 那条路**不经过 `runOnce`**——TUI 起的是另一个进程,选项对象过不去,
|
|
84
84
|
只有环境变量带得过去。路径一律转**绝对**:子进程的 cwd 不保证一样。
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
前六个在 action 一开头就落进 env,`launchTui` 那边 `{ ...process.env }` 白拿;
|
|
87
87
|
只有 `EPOCH_RESUME` 要显式塞,因为它是**算出来的**(`-c` 要查库、`-r` 不带值
|
|
88
88
|
要弹选择器)。加新 flag 时按这条分。
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
`new URL()`
|
|
90
|
+
取值是**封闭集合**的那两个(`-m` / `--fallback-model`)判**字形**:必须是
|
|
91
|
+
`@<id>` 形状(`parseModelRef`),指向「我的模型」里的一条。
|
|
92
|
+
⚠️ **「base URL 得能被 `new URL()` 解析」那句已经不适用了** —— 2.0.0 起模型名
|
|
93
|
+
收窄成 `@<id>`,端点地址写在那一条模型自己身上,flag 不再收 base URL。
|
|
94
|
+
卡得松是刻意的 —— 误伤一个合法模型名的代价是
|
|
93
95
|
「那个模型压根用不了」,比放过一句话严重得多。
|
|
94
96
|
|
|
95
97
|
反面例子是 `--worktree`:它**没有**对应的 `EPOCH_*`,因为它不是「传下去的一个设置」,
|
|
@@ -115,8 +117,9 @@ ink 一接管 stdin,inquirer 就抢不回来 —— 和信任闸门必须排
|
|
|
115
117
|
而这件事只在它拒绝读某个文件时才露头。「白给」(已经在工作区里了)不算错,
|
|
116
118
|
由运行时报一条诊断
|
|
117
119
|
- `--agent` 名字不认识 → 由 **runtime** 抛 `AgentRoleError`(可用角色都在消息里)。
|
|
118
|
-
故意不在 CLI
|
|
119
|
-
|
|
120
|
+
故意不在 CLI 侧先查一遍:合并之后那张角色表(用户级 / 项目级 / 插件 / 宿主)
|
|
121
|
+
只有 `buildRuntime()` 合并得出来,在这儿再发现一遍等于养第二份逻辑,
|
|
122
|
+
而两份迟早会给出不同答案
|
|
120
123
|
|
|
121
124
|
这三个错误加上 `ManagedPolicyError` 共用 `errors.ts` 里那张 `name → 退出码` 表,
|
|
122
125
|
一律只打一行 message(有 hint 再一行)、**不打 stack**:那段 stack 指向别人包里的
|
package/dist/index.js
CHANGED
|
@@ -2920,13 +2920,15 @@ function createExternalApproval(opts) {
|
|
|
2920
2920
|
}
|
|
2921
2921
|
// src/headless/tasks.ts
|
|
2922
2922
|
import { describeBackgroundTask } from "@epoch-agent/core";
|
|
2923
|
-
import { t as t20 } from "@epoch-agent/infra";
|
|
2923
|
+
import { currentLang, t as t20 } from "@epoch-agent/infra";
|
|
2924
2924
|
function backgroundTaskSummary(all) {
|
|
2925
2925
|
const tasks = all.filter((t41) => t41.kind === "command");
|
|
2926
2926
|
if (tasks.length === 0) return "";
|
|
2927
2927
|
const running = tasks.filter((t41) => t41.status === "running").length;
|
|
2928
2928
|
const head = running > 0 ? t20("background_tasks.head_running", { total: tasks.length, running }) : t20("background_tasks.head_done", { total: tasks.length });
|
|
2929
|
-
return [head, ...tasks.map((
|
|
2929
|
+
return [head, ...tasks.map((task) => ` ${describeBackgroundTask(task, currentLang())}`)].join(
|
|
2930
|
+
"\n"
|
|
2931
|
+
);
|
|
2930
2932
|
}
|
|
2931
2933
|
// src/import-prompt.ts
|
|
2932
2934
|
import {
|
|
@@ -3939,6 +3941,7 @@ var STATUS_KEYS = {
|
|
|
3939
3941
|
failed: "schedule.status.failed",
|
|
3940
3942
|
denied: "schedule.status.denied",
|
|
3941
3943
|
timeout: "schedule.status.timeout",
|
|
3944
|
+
cancelled: "schedule.status.cancelled",
|
|
3942
3945
|
budget: "schedule.status.budget",
|
|
3943
3946
|
"skipped-overlap": "schedule.status.skipped_overlap",
|
|
3944
3947
|
"skipped-window": "schedule.status.skipped_window",
|
|
@@ -4329,8 +4332,19 @@ async function runDoctor(opts) {
|
|
|
4329
4332
|
}
|
|
4330
4333
|
}
|
|
4331
4334
|
// src/schedule/manage.ts
|
|
4332
|
-
import { removeRecordings } from "@epoch-agent/core";
|
|
4335
|
+
import { removeRecordings, requestScheduleCancel } from "@epoch-agent/core";
|
|
4333
4336
|
import { automationLogsDir, t as t31 } from "@epoch-agent/infra";
|
|
4337
|
+
async function runStop(idOrPrefix) {
|
|
4338
|
+
const ctx = await openSchedule();
|
|
4339
|
+
try {
|
|
4340
|
+
const def = mustFind(ctx.store, idOrPrefix);
|
|
4341
|
+
const requested = requestScheduleCancel(ctx.store.connection, def.id);
|
|
4342
|
+
log10(requested ? t31("schedule.stop_requested", { name: def.name }) : t31("schedule.stop_no_run"));
|
|
4343
|
+
if (!requested) process.exitCode = 1;
|
|
4344
|
+
} finally {
|
|
4345
|
+
ctx.close();
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4334
4348
|
async function runSetEnabled(idOrPrefix, enabled) {
|
|
4335
4349
|
const ctx = await openSchedule();
|
|
4336
4350
|
try {
|
|
@@ -4565,6 +4579,7 @@ function registerScheduleCommand(program2) {
|
|
|
4565
4579
|
cmd.command("disable").description(t34("cli.schedule.disable")).argument("<id>", t34("cli.schedule.arg_id")).action((id) => runSetEnabled(id, false));
|
|
4566
4580
|
cmd.command("rm").alias("remove").description(t34("cli.schedule.rm")).argument("<id>", t34("cli.schedule.arg_id")).action((id) => runRemove(id));
|
|
4567
4581
|
cmd.command("run").description(t34("cli.schedule.run")).argument("<id>", t34("cli.schedule.arg_id")).option("--fix", t34("cli.schedule.opt_fix")).action((id, opts) => runManual(id, opts));
|
|
4582
|
+
cmd.command("stop").description(t34("cli.schedule.stop")).argument("<id>", t34("cli.schedule.arg_id")).action((id) => runStop(id));
|
|
4568
4583
|
cmd.command("logs").description(t34("cli.schedule.logs")).argument("<id>", t34("cli.schedule.arg_id")).option("-n, --limit <n>", t34("cli.schedule.opt_limit"), String(DEFAULT_LOG_LIMIT)).option("--tail", t34("cli.schedule.opt_tail")).action(
|
|
4569
4584
|
(id, opts) => runLogs(id, Number(opts.limit ?? DEFAULT_LOG_LIMIT), opts.tail === true)
|
|
4570
4585
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "epoch-agent CLI 入口",
|
|
6
6
|
"repository": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"commander": "^15.0.0",
|
|
23
23
|
"ink": "^7.1.1",
|
|
24
24
|
"react": "^19.2.8",
|
|
25
|
-
"@epoch-agent/protocol": "
|
|
26
|
-
"@epoch-agent/
|
|
27
|
-
"@epoch-agent/tui": "^
|
|
28
|
-
"@epoch-agent/
|
|
29
|
-
"@epoch-agent/
|
|
30
|
-
"@epoch-agent/
|
|
25
|
+
"@epoch-agent/protocol": "4.0.0",
|
|
26
|
+
"@epoch-agent/runtime": "4.0.0",
|
|
27
|
+
"@epoch-agent/tui": "^4.0.0",
|
|
28
|
+
"@epoch-agent/server": "4.0.0",
|
|
29
|
+
"@epoch-agent/core": "4.0.0",
|
|
30
|
+
"@epoch-agent/infra": "4.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.20.1",
|