@epoch-agent/cli 0.13.0 → 0.15.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/dist/index.js +97 -52
- package/dist/tui-entry.js +65 -53
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -510,6 +510,13 @@ var SECTION_FIELDS = {
|
|
|
510
510
|
autoPrune: (v) => v === "true" || v === "false",
|
|
511
511
|
retentionDays: isPositiveInt,
|
|
512
512
|
vacuumAfterPrune: (v) => v === "true" || v === "false"
|
|
513
|
+
},
|
|
514
|
+
automation: {
|
|
515
|
+
keepRuns: isPositiveInt,
|
|
516
|
+
maxRecordingMb: isPositiveInt
|
|
517
|
+
},
|
|
518
|
+
sessionSearch: {
|
|
519
|
+
allWorkspaces: (v) => v === "true" || v === "false"
|
|
513
520
|
}
|
|
514
521
|
};
|
|
515
522
|
function knownKeys() {
|
|
@@ -1325,7 +1332,7 @@ import { existsSync as existsSync6 } from "fs";
|
|
|
1325
1332
|
import { dirname as dirname4, join as join5 } from "path";
|
|
1326
1333
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1327
1334
|
import { isNonInteractive as isNonInteractive8, OPERATION_TYPES as OPERATION_TYPES3, PERMISSION_LEVELS as PERMISSION_LEVELS3 } from "@epoch-agent/core";
|
|
1328
|
-
import { t as t25 } from "@epoch-agent/infra";
|
|
1335
|
+
import { guardSpawn as guardSpawn3, t as t25 } from "@epoch-agent/infra";
|
|
1329
1336
|
import {
|
|
1330
1337
|
HEADLESS_INPUT_FORMATS as HEADLESS_INPUT_FORMATS2,
|
|
1331
1338
|
HEADLESS_OUTPUT_FORMATS as HEADLESS_OUTPUT_FORMATS2,
|
|
@@ -2330,23 +2337,31 @@ import { execFile } from "child_process";
|
|
|
2330
2337
|
import { randomBytes } from "crypto";
|
|
2331
2338
|
import { mkdirSync as mkdirSync4 } from "fs";
|
|
2332
2339
|
import { basename, join as join4, resolve as resolve3 } from "path";
|
|
2333
|
-
import { t as t16, worktreesDir } from "@epoch-agent/infra";
|
|
2340
|
+
import { guardSpawn, t as t16, worktreesDir } from "@epoch-agent/infra";
|
|
2334
2341
|
var TIMEOUT_MS = 6e4;
|
|
2335
2342
|
function git(args, cwd) {
|
|
2336
2343
|
return new Promise((done) => {
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2344
|
+
guardSpawn(
|
|
2345
|
+
() => execFile(
|
|
2346
|
+
"git",
|
|
2347
|
+
args,
|
|
2348
|
+
{ cwd, timeout: TIMEOUT_MS, encoding: "utf-8", windowsHide: true },
|
|
2349
|
+
(err2, stdout, stderr) => {
|
|
2350
|
+
const code = err2?.code;
|
|
2351
|
+
done({
|
|
2352
|
+
ok: !err2,
|
|
2353
|
+
stdout,
|
|
2354
|
+
stderr: stderr || "",
|
|
2355
|
+
missing: code === "ENOENT"
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
),
|
|
2359
|
+
(err2) => done({
|
|
2360
|
+
ok: false,
|
|
2361
|
+
stdout: "",
|
|
2362
|
+
stderr: `${err2.message} (cwd=${cwd})`,
|
|
2363
|
+
missing: err2.code === "ENOENT" || err2.code === "ENOTDIR"
|
|
2364
|
+
})
|
|
2350
2365
|
);
|
|
2351
2366
|
});
|
|
2352
2367
|
}
|
|
@@ -2579,7 +2594,7 @@ import {
|
|
|
2579
2594
|
matchPreauthorization,
|
|
2580
2595
|
mergeHeadlessPolicy
|
|
2581
2596
|
} from "@epoch-agent/core";
|
|
2582
|
-
import { createStreamDecoder, t as t18 } from "@epoch-agent/infra";
|
|
2597
|
+
import { createStreamDecoder, guardSpawn as guardSpawn2, t as t18 } from "@epoch-agent/infra";
|
|
2583
2598
|
import { APPROVAL_OUTCOMES as APPROVAL_OUTCOMES2, isApprovalOutcome as isApprovalOutcome2 } from "@epoch-agent/protocol";
|
|
2584
2599
|
var APPROVER_TIMEOUT_MS = 6e4;
|
|
2585
2600
|
var MAX_STDOUT_BYTES = 64 * 1024;
|
|
@@ -2633,11 +2648,15 @@ function askExternalApprover(program2, payload, opts = {}) {
|
|
|
2633
2648
|
settled = true;
|
|
2634
2649
|
resolve5(v);
|
|
2635
2650
|
};
|
|
2636
|
-
const child =
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2651
|
+
const child = guardSpawn2(
|
|
2652
|
+
() => spawn2(program2, {
|
|
2653
|
+
shell: true,
|
|
2654
|
+
...opts.cwd ? { cwd: opts.cwd } : {},
|
|
2655
|
+
stdio: ["pipe", "pipe", "inherit"]
|
|
2656
|
+
}),
|
|
2657
|
+
(err2) => settle({ ok: false, why: t18("approver.spawn_failed", { message: err2.message }) })
|
|
2658
|
+
);
|
|
2659
|
+
if (!child) return;
|
|
2641
2660
|
const timer = setTimeout(() => {
|
|
2642
2661
|
child.kill("SIGKILL");
|
|
2643
2662
|
settle({ ok: false, why: t18("approver.timeout", { ms: timeoutMs }) });
|
|
@@ -3435,6 +3454,10 @@ function registerSessionsCommand(program2) {
|
|
|
3435
3454
|
...opts.archivedOnly ? { archived: true } : {},
|
|
3436
3455
|
...opts.includePinned ? { includePinned: true } : {}
|
|
3437
3456
|
};
|
|
3457
|
+
const sweepOrphans = () => {
|
|
3458
|
+
const swept = withSessions((sm) => sm.sweepOrphans({ olderThanMs, now: Date.now() }));
|
|
3459
|
+
if (swept > 0) log7(t24("sessions.prune_swept", { count: swept, days }));
|
|
3460
|
+
};
|
|
3438
3461
|
const { victims, openCount } = withSessions((sm) => ({
|
|
3439
3462
|
victims: sm.pruneCandidates(select2),
|
|
3440
3463
|
openCount: sm.openPruneMatches({
|
|
@@ -3442,16 +3465,22 @@ function registerSessionsCommand(program2) {
|
|
|
3442
3465
|
...opts.includePinned ? { includePinned: true } : {}
|
|
3443
3466
|
})
|
|
3444
3467
|
}));
|
|
3468
|
+
const sweepNote = () => {
|
|
3469
|
+
if (openCount === 0) return;
|
|
3470
|
+
log7(t24("sessions.prune_open_skipped", { count: openCount }));
|
|
3471
|
+
if (!opts.yes) log7(t24("sessions.prune_sweep_preview", { days }));
|
|
3472
|
+
};
|
|
3445
3473
|
if (victims.length === 0) {
|
|
3446
3474
|
log7(t24("sessions.prune_none", { days }));
|
|
3447
|
-
|
|
3475
|
+
sweepNote();
|
|
3476
|
+
if (opts.yes) sweepOrphans();
|
|
3448
3477
|
return;
|
|
3449
3478
|
}
|
|
3450
3479
|
log7(t24("sessions.prune_head"));
|
|
3451
3480
|
for (const s of victims) {
|
|
3452
3481
|
log7(` ${s.id.slice(0, SHORT_ID_LEN2)} ${whenOf(s.updatedAt)} ${titleOf(s)}`);
|
|
3453
3482
|
}
|
|
3454
|
-
|
|
3483
|
+
sweepNote();
|
|
3455
3484
|
if (!opts.yes) {
|
|
3456
3485
|
log7(t24("sessions.prune_preview", { count: victims.length, days }));
|
|
3457
3486
|
return;
|
|
@@ -3461,6 +3490,7 @@ function registerSessionsCommand(program2) {
|
|
|
3461
3490
|
for (const s of victims) if (sm.delete(s.id)) removed++;
|
|
3462
3491
|
});
|
|
3463
3492
|
log7(t24("sessions.prune_done", { count: removed }));
|
|
3493
|
+
sweepOrphans();
|
|
3464
3494
|
if (removed > 0) {
|
|
3465
3495
|
const ratio = withSessions((sm) => sm.freelistRatio());
|
|
3466
3496
|
if (ratio > VACUUM_MIN_FREELIST_RATIO) {
|
|
@@ -3683,17 +3713,22 @@ async function launchTui(resumeId) {
|
|
|
3683
3713
|
const cmd = process.execPath;
|
|
3684
3714
|
const args = isSource ? ["--import", "tsx", target] : [target];
|
|
3685
3715
|
const { spawn: spawn3 } = await import("child_process");
|
|
3686
|
-
const child = spawn3(cmd, args, {
|
|
3687
|
-
stdio: "inherit",
|
|
3688
|
-
env: { ...process.env, ...resumeId ? { EPOCH_RESUME: resumeId } : {} }
|
|
3689
|
-
});
|
|
3690
3716
|
await new Promise((done) => {
|
|
3691
|
-
|
|
3717
|
+
const failToStart = (err2) => {
|
|
3692
3718
|
process.stderr.write(`${t25("run.tui_spawn_failed", { message: err2.message })}
|
|
3693
3719
|
`);
|
|
3694
3720
|
process.exitCode = EXIT_CODES.FAILURE;
|
|
3695
3721
|
done();
|
|
3696
|
-
}
|
|
3722
|
+
};
|
|
3723
|
+
const child = guardSpawn3(
|
|
3724
|
+
() => spawn3(cmd, args, {
|
|
3725
|
+
stdio: "inherit",
|
|
3726
|
+
env: { ...process.env, ...resumeId ? { EPOCH_RESUME: resumeId } : {} }
|
|
3727
|
+
}),
|
|
3728
|
+
failToStart
|
|
3729
|
+
);
|
|
3730
|
+
if (!child) return;
|
|
3731
|
+
child.on("error", failToStart);
|
|
3697
3732
|
child.on("exit", (code, signal) => {
|
|
3698
3733
|
process.exitCode = signal ? EXIT_CODES.FAILURE : code ?? EXIT_CODES.SUCCESS;
|
|
3699
3734
|
done();
|
|
@@ -4039,6 +4074,7 @@ function buildInput(opts, trigger, permission) {
|
|
|
4039
4074
|
prompt: opts.prompt ?? "",
|
|
4040
4075
|
...opts.workdir ? { workDir: opts.workdir } : {},
|
|
4041
4076
|
...opts.model ? { model: opts.model } : {},
|
|
4077
|
+
...opts.role ? { role: opts.role } : {},
|
|
4042
4078
|
permission,
|
|
4043
4079
|
...opts.allowTool ? { allowTools: opts.allowTool } : {},
|
|
4044
4080
|
allowOperations: parseOperations(opts.allowOperation),
|
|
@@ -4261,6 +4297,7 @@ async function runShow(idOrPrefix) {
|
|
|
4261
4297
|
);
|
|
4262
4298
|
log9(` ${t32("schedule.field_workdir")}: ${def.workDir}`);
|
|
4263
4299
|
if (def.model) log9(` ${t32("schedule.field_model")}: ${def.model}`);
|
|
4300
|
+
if (def.role) log9(` ${t32("schedule.field_role")}: ${def.role}`);
|
|
4264
4301
|
log9(` ${t32("schedule.field_permission")}: ${permissionLabel(def.permission)}`);
|
|
4265
4302
|
log9(
|
|
4266
4303
|
` ${t32("schedule.field_limits")}: ` + t32("schedule.limits_value", {
|
|
@@ -4270,6 +4307,11 @@ async function runShow(idOrPrefix) {
|
|
|
4270
4307
|
})
|
|
4271
4308
|
);
|
|
4272
4309
|
log9(` ${t32("schedule.field_backend")}: ${def.osBackend} ${def.osTaskId || "\u2014"}`);
|
|
4310
|
+
log9(
|
|
4311
|
+
` ${t32("schedule.field_session")}: ` + t32(
|
|
4312
|
+
def.showInSessionList === true ? "schedule.session_listed" : "schedule.session_discarded"
|
|
4313
|
+
)
|
|
4314
|
+
);
|
|
4273
4315
|
log9(` ${t32("schedule.field_prompt")}:`);
|
|
4274
4316
|
for (const line of def.prompt.split("\n")) log9(` ${line}`);
|
|
4275
4317
|
log9("");
|
|
@@ -4347,7 +4389,7 @@ function printRecording(run) {
|
|
|
4347
4389
|
var DEFAULT_LOG_LIMIT = 10;
|
|
4348
4390
|
function registerScheduleCommand(program2) {
|
|
4349
4391
|
const cmd = program2.command("schedule").description(t33("cli.schedule.summary"));
|
|
4350
|
-
cmd.command("add").description(t33("cli.schedule.add")).option("--name <name>", t33("cli.schedule.opt_name")).option("--prompt <text>", t33("cli.schedule.opt_prompt")).option("--daily <HH:mm>", t33("cli.schedule.opt_daily")).option("--weekly <days>", t33("cli.schedule.opt_weekly")).option("--monthly <days>", t33("cli.schedule.opt_monthly")).option("--every <interval>", t33("cli.schedule.opt_every")).option("--once <YYYY-MM-DD>", t33("cli.schedule.opt_once")).option("--at <HH:mm>", t33("cli.schedule.opt_at")).option("--start <YYYY-MM-DD>", t33("cli.schedule.opt_start")).option("--end <YYYY-MM-DD>", t33("cli.schedule.opt_end")).option("--workdir <dir>", t33("cli.schedule.opt_workdir")).option("--model <model>", t33("cli.schedule.opt_model")).option("--permission <level>", t33("cli.schedule.opt_permission")).option("--allow-tool <name>", t33("cli.schedule.opt_allow_tool"), collect3, []).option("--allow-operation <type>", t33("cli.schedule.opt_allow_operation"), collect3, []).option("--allow-rule <rule>", t33("cli.schedule.opt_allow_rule"), collect3, []).option("--max-turns <n>", t33("cli.schedule.opt_max_turns")).option("--budget <usd>", t33("cli.schedule.opt_budget")).option("--timeout <minutes>", t33("cli.schedule.opt_timeout")).option("--disabled", t33("cli.schedule.opt_disabled")).option("--i-understand-bypass", t33("cli.schedule.opt_bypass_ack")).action((opts) => runAdd(opts));
|
|
4392
|
+
cmd.command("add").description(t33("cli.schedule.add")).option("--name <name>", t33("cli.schedule.opt_name")).option("--prompt <text>", t33("cli.schedule.opt_prompt")).option("--daily <HH:mm>", t33("cli.schedule.opt_daily")).option("--weekly <days>", t33("cli.schedule.opt_weekly")).option("--monthly <days>", t33("cli.schedule.opt_monthly")).option("--every <interval>", t33("cli.schedule.opt_every")).option("--once <YYYY-MM-DD>", t33("cli.schedule.opt_once")).option("--at <HH:mm>", t33("cli.schedule.opt_at")).option("--start <YYYY-MM-DD>", t33("cli.schedule.opt_start")).option("--end <YYYY-MM-DD>", t33("cli.schedule.opt_end")).option("--workdir <dir>", t33("cli.schedule.opt_workdir")).option("--model <model>", t33("cli.schedule.opt_model")).option("--role <name>", t33("cli.schedule.opt_role")).option("--permission <level>", t33("cli.schedule.opt_permission")).option("--allow-tool <name>", t33("cli.schedule.opt_allow_tool"), collect3, []).option("--allow-operation <type>", t33("cli.schedule.opt_allow_operation"), collect3, []).option("--allow-rule <rule>", t33("cli.schedule.opt_allow_rule"), collect3, []).option("--max-turns <n>", t33("cli.schedule.opt_max_turns")).option("--budget <usd>", t33("cli.schedule.opt_budget")).option("--timeout <minutes>", t33("cli.schedule.opt_timeout")).option("--disabled", t33("cli.schedule.opt_disabled")).option("--i-understand-bypass", t33("cli.schedule.opt_bypass_ack")).action((opts) => runAdd(opts));
|
|
4351
4393
|
cmd.command("list", { isDefault: true }).description(t33("cli.schedule.list")).action(() => runList());
|
|
4352
4394
|
cmd.command("show").description(t33("cli.schedule.show")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runShow(id));
|
|
4353
4395
|
cmd.command("enable").description(t33("cli.schedule.enable")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runSetEnabled(id, true));
|
|
@@ -4383,7 +4425,7 @@ import { hasFailure } from "@epoch-agent/protocol";
|
|
|
4383
4425
|
// src/statusline.ts
|
|
4384
4426
|
import { execFile as execFile2 } from "child_process";
|
|
4385
4427
|
import { sanitizeToolOutput } from "@epoch-agent/core";
|
|
4386
|
-
import { shellSpawnArgs, t as t34 } from "@epoch-agent/infra";
|
|
4428
|
+
import { guardSpawn as guardSpawn4, shellSpawnArgs, t as t34 } from "@epoch-agent/infra";
|
|
4387
4429
|
var TIMEOUT_MS2 = 2e3;
|
|
4388
4430
|
var MAX_WIDTH = 60;
|
|
4389
4431
|
var MAX_BUFFER = 64 * 1024;
|
|
@@ -4395,28 +4437,31 @@ function formatStatusLine(stdout) {
|
|
|
4395
4437
|
function runStatusLineCommand(command, cwd) {
|
|
4396
4438
|
const { file, args, options } = shellSpawnArgs(command);
|
|
4397
4439
|
return new Promise((settle) => {
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4440
|
+
guardSpawn4(
|
|
4441
|
+
() => execFile2(
|
|
4442
|
+
file,
|
|
4443
|
+
args,
|
|
4444
|
+
{
|
|
4445
|
+
...options,
|
|
4446
|
+
cwd,
|
|
4447
|
+
timeout: TIMEOUT_MS2,
|
|
4448
|
+
maxBuffer: MAX_BUFFER,
|
|
4449
|
+
encoding: "utf-8",
|
|
4450
|
+
windowsHide: true
|
|
4451
|
+
},
|
|
4452
|
+
(err2, stdout) => {
|
|
4453
|
+
if (err2) {
|
|
4454
|
+
const killed = err2.killed === true;
|
|
4455
|
+
settle({
|
|
4456
|
+
text: null,
|
|
4457
|
+
error: killed ? t34("statusline.timeout", { ms: TIMEOUT_MS2 }) : err2.message.trim()
|
|
4458
|
+
});
|
|
4459
|
+
return;
|
|
4460
|
+
}
|
|
4461
|
+
settle({ text: formatStatusLine(stdout) });
|
|
4417
4462
|
}
|
|
4418
|
-
|
|
4419
|
-
}
|
|
4463
|
+
),
|
|
4464
|
+
(err2) => settle({ text: null, error: err2.message.trim() })
|
|
4420
4465
|
);
|
|
4421
4466
|
});
|
|
4422
4467
|
}
|
package/dist/tui-entry.js
CHANGED
|
@@ -458,7 +458,7 @@ import { listBackgroundTasks } from "@epoch-agent/runtime";
|
|
|
458
458
|
// src/clipboard.ts
|
|
459
459
|
import { execFile } from "child_process";
|
|
460
460
|
import { readImageSize, sniffMediaType } from "@epoch-agent/core";
|
|
461
|
-
import { t as t6 } from "@epoch-agent/infra";
|
|
461
|
+
import { guardSpawn, t as t6 } from "@epoch-agent/infra";
|
|
462
462
|
var MAX_BYTES = 32 * 1024 * 1024;
|
|
463
463
|
var TIMEOUT_MS = 5e3;
|
|
464
464
|
var WINDOWS_SCRIPT = [
|
|
@@ -506,18 +506,21 @@ function clipboardImageCandidates(platform = process.platform, env = process.env
|
|
|
506
506
|
}
|
|
507
507
|
function runCandidate(cmd) {
|
|
508
508
|
return new Promise((done) => {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
509
|
+
guardSpawn(
|
|
510
|
+
() => execFile(
|
|
511
|
+
cmd.command,
|
|
512
|
+
cmd.args,
|
|
513
|
+
{ timeout: TIMEOUT_MS, maxBuffer: MAX_BYTES, encoding: "buffer", windowsHide: true },
|
|
514
|
+
(err, stdout) => {
|
|
515
|
+
const e = err;
|
|
516
|
+
if (e?.code === "ENOENT") {
|
|
517
|
+
done(null);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
done({ stdout: Buffer.from(stdout), code: typeof e?.code === "number" ? e.code : 0 });
|
|
518
521
|
}
|
|
519
|
-
|
|
520
|
-
|
|
522
|
+
),
|
|
523
|
+
() => done(null)
|
|
521
524
|
);
|
|
522
525
|
});
|
|
523
526
|
}
|
|
@@ -700,23 +703,31 @@ import { execFile as execFile2 } from "child_process";
|
|
|
700
703
|
import { writeFileSync } from "fs";
|
|
701
704
|
import { isAbsolute, resolve } from "path";
|
|
702
705
|
import { loadPlugins, readPluginRecords, scanPluginDir } from "@epoch-agent/core";
|
|
703
|
-
import { pluginsStatePath, t as t8 } from "@epoch-agent/infra";
|
|
706
|
+
import { guardSpawn as guardSpawn2, pluginsStatePath, t as t8 } from "@epoch-agent/infra";
|
|
704
707
|
var TIMEOUT_MS2 = 1e4;
|
|
705
708
|
var MAX_BUFFER = 1024 * 1024;
|
|
706
709
|
function run(command, args, cwd) {
|
|
707
710
|
return new Promise((done) => {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
711
|
+
guardSpawn2(
|
|
712
|
+
() => execFile2(
|
|
713
|
+
command,
|
|
714
|
+
args,
|
|
715
|
+
{ cwd, timeout: TIMEOUT_MS2, maxBuffer: MAX_BUFFER, encoding: "utf-8", windowsHide: true },
|
|
716
|
+
(err, stdout, stderr) => {
|
|
717
|
+
const e = err;
|
|
718
|
+
if (e?.code === "ENOENT") {
|
|
719
|
+
done({ stdout: "", ok: false, missing: true, stderr: "" });
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
done({ stdout, ok: !err, missing: false, stderr: stderr || "" });
|
|
717
723
|
}
|
|
718
|
-
|
|
719
|
-
|
|
724
|
+
),
|
|
725
|
+
(err) => done({
|
|
726
|
+
stdout: "",
|
|
727
|
+
ok: false,
|
|
728
|
+
missing: err.code === "ENOENT" || err.code === "ENOTDIR",
|
|
729
|
+
stderr: err.message
|
|
730
|
+
})
|
|
720
731
|
);
|
|
721
732
|
});
|
|
722
733
|
}
|
|
@@ -737,17 +748,15 @@ async function writeClipboardText(text) {
|
|
|
737
748
|
const candidates = clipboardWriteCommand();
|
|
738
749
|
for (const cmd of candidates) {
|
|
739
750
|
const done = await new Promise((resolve_) => {
|
|
740
|
-
const child =
|
|
741
|
-
cmd.command,
|
|
742
|
-
cmd.args,
|
|
743
|
-
{ timeout: TIMEOUT_MS2, windowsHide: true },
|
|
744
|
-
(err) => {
|
|
751
|
+
const child = guardSpawn2(
|
|
752
|
+
() => execFile2(cmd.command, cmd.args, { timeout: TIMEOUT_MS2, windowsHide: true }, (err) => {
|
|
745
753
|
const e = err;
|
|
746
754
|
if (e?.code === "ENOENT") return resolve_("missing");
|
|
747
755
|
resolve_(err ? err.message ?? t8("host_actions.clipboard_write_failed") : "ok");
|
|
748
|
-
}
|
|
756
|
+
}),
|
|
757
|
+
() => resolve_("missing")
|
|
749
758
|
);
|
|
750
|
-
child
|
|
759
|
+
child?.stdin?.end(text, "utf-8");
|
|
751
760
|
});
|
|
752
761
|
if (done === "ok") return;
|
|
753
762
|
if (done === "missing") continue;
|
|
@@ -835,7 +844,7 @@ function contributionLines(dir, name) {
|
|
|
835
844
|
// src/statusline.ts
|
|
836
845
|
import { execFile as execFile3 } from "child_process";
|
|
837
846
|
import { sanitizeToolOutput } from "@epoch-agent/core";
|
|
838
|
-
import { shellSpawnArgs, t as t9 } from "@epoch-agent/infra";
|
|
847
|
+
import { guardSpawn as guardSpawn3, shellSpawnArgs, t as t9 } from "@epoch-agent/infra";
|
|
839
848
|
var TIMEOUT_MS3 = 2e3;
|
|
840
849
|
var MAX_WIDTH = 60;
|
|
841
850
|
var DEFAULT_INTERVAL_MS = 5e3;
|
|
@@ -848,28 +857,31 @@ function formatStatusLine(stdout) {
|
|
|
848
857
|
function runStatusLineCommand(command, cwd) {
|
|
849
858
|
const { file, args, options } = shellSpawnArgs(command);
|
|
850
859
|
return new Promise((settle) => {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
860
|
+
guardSpawn3(
|
|
861
|
+
() => execFile3(
|
|
862
|
+
file,
|
|
863
|
+
args,
|
|
864
|
+
{
|
|
865
|
+
...options,
|
|
866
|
+
cwd,
|
|
867
|
+
timeout: TIMEOUT_MS3,
|
|
868
|
+
maxBuffer: MAX_BUFFER2,
|
|
869
|
+
encoding: "utf-8",
|
|
870
|
+
windowsHide: true
|
|
871
|
+
},
|
|
872
|
+
(err, stdout) => {
|
|
873
|
+
if (err) {
|
|
874
|
+
const killed = err.killed === true;
|
|
875
|
+
settle({
|
|
876
|
+
text: null,
|
|
877
|
+
error: killed ? t9("statusline.timeout", { ms: TIMEOUT_MS3 }) : err.message.trim()
|
|
878
|
+
});
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
settle({ text: formatStatusLine(stdout) });
|
|
870
882
|
}
|
|
871
|
-
|
|
872
|
-
}
|
|
883
|
+
),
|
|
884
|
+
(err) => settle({ text: null, error: err.message.trim() })
|
|
873
885
|
);
|
|
874
886
|
});
|
|
875
887
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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/core": "0.
|
|
26
|
-
"@epoch-agent/
|
|
27
|
-
"@epoch-agent/
|
|
28
|
-
"@epoch-agent/runtime": "0.
|
|
29
|
-
"@epoch-agent/
|
|
30
|
-
"@epoch-agent/
|
|
25
|
+
"@epoch-agent/core": "0.15.0",
|
|
26
|
+
"@epoch-agent/infra": "0.15.0",
|
|
27
|
+
"@epoch-agent/server": "0.15.0",
|
|
28
|
+
"@epoch-agent/runtime": "0.15.0",
|
|
29
|
+
"@epoch-agent/protocol": "0.15.0",
|
|
30
|
+
"@epoch-agent/tui": "^0.15.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.20.1",
|